Commit 90ca2549 authored by suhuiguang's avatar suhuiguang

1.集群es redis 适配

parent 51c5b9e7
package com.yeejoin.amos.boot.module.elevator.biz.config; package com.yeejoin.amos.boot.module.elevator.biz.config;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope; import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider; import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder; import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
...@@ -16,6 +13,8 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -16,6 +13,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration @Configuration
public class ElasticSearchClientConfig { public class ElasticSearchClientConfig {
...@@ -35,27 +34,19 @@ public class ElasticSearchClientConfig { ...@@ -35,27 +34,19 @@ public class ElasticSearchClientConfig {
new UsernamePasswordCredentials(username, password)); new UsernamePasswordCredentials(username, password));
try { try {
String url = uris.replace("http://", ""); HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
final String[] parts = StringUtils.split(url, ":"); RestClientBuilder builder = RestClient.builder(httpHosts);
HttpHost httpHost = new HttpHost(parts[0], Integer.parseInt(parts[1]), "http"); builder.setHttpClientConfigCallback(httpClientBuilder -> {
RestClientBuilder builder = RestClient.builder(httpHost); httpClientBuilder.disableAuthCaching();
builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() { return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
@Override });
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) { // 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
httpClientBuilder.disableAuthCaching(); builder.setRequestConfigCallback(requestConfigBuilder -> {
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider); // 连接超时(默认为1秒)
} return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
}); });
builder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
@Override
public RequestConfig.Builder customizeRequestConfig(
RequestConfig.Builder requestConfigBuilder) {
return requestConfigBuilder.setConnectTimeout(5000 * 1000) // 连接超时(默认为1秒)
.setSocketTimeout(6000 * 1000);// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
}
});// 调整最大重试超时时间(默认为30秒).setMaxRetryTimeoutMillis(60000);
return new RestHighLevelClient(builder); return new RestHighLevelClient(builder);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -148,17 +148,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -148,17 +148,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//一码通复制功能url参数key //一码通复制功能url参数key
private static final String COPY_KEY = "stashType"; private static final String COPY_KEY = "stashType";
@Value("${biz.elasticsearch.address}")
private String esAddress;
@Value("${biz.elasticsearch.port}") @Autowired
private Integer esPort; RestHighLevelClient restHighLevelClient;
@Value("${elasticsearch.username}")
private String esUserName;
@Value("${elasticsearch.password}")
private String esPwd;
private static String USE_CODE = "use_code"; private static String USE_CODE = "use_code";
...@@ -1200,11 +1192,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1200,11 +1192,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return save; return save;
} }
public Page<JSONObject> queryByKeys(JSONObject map) { public Page<JSONObject> queryByKeys(JSONObject map) {
//根据当前登录人查询 // //根据当前登录人查询
if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) { if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) {
map.put(EQUSTATE, EquimentEnum.getCode.get(map.get(EQUSTATE).toString()).toString()); map.put(EQUSTATE, EquimentEnum.getCode.get(map.get(EQUSTATE).toString()).toString());
} }
ResponseModel<Page<Map<String, Object>>> model = new ResponseModel<>();
JSONObject object = getCompanyType().get(0); JSONObject object = getCompanyType().get(0);
String level = object.getString("level"); String level = object.getString("level");
String code = object.getString("orgCode"); String code = object.getString("orgCode");
...@@ -1219,19 +1210,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1219,19 +1210,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
} }
Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size")); Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size"));
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient = new RestHighLevelClient(
RestClient.builder(
new HttpHost(esAddress, esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
})
);
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all"); request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
...@@ -1329,7 +1307,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1329,7 +1307,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
List<JSONObject> list = new LinkedList<>(); List<JSONObject> list = new LinkedList<>();
long totle = 0; long totle = 0;
try { try {
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT); SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits().getHits()) { for (org.elasticsearch.search.SearchHit hit : response.getHits().getHits()) {
System.out.println(hit); System.out.println(hit);
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
...@@ -1348,7 +1326,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1348,7 +1326,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
throw new RuntimeException(e); throw new RuntimeException(e);
} finally { } finally {
try { try {
esClient.close(); restHighLevelClient.close();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
...@@ -10,25 +10,15 @@ import com.yeejoin.amos.boot.module.elevator.flc.api.dto.CylinderFillingRecordDt ...@@ -10,25 +10,15 @@ import com.yeejoin.amos.boot.module.elevator.flc.api.dto.CylinderFillingRecordDt
import com.yeejoin.amos.boot.module.elevator.flc.api.entity.CylinderFillingRecord; import com.yeejoin.amos.boot.module.elevator.flc.api.entity.CylinderFillingRecord;
import com.yeejoin.amos.boot.module.elevator.flc.api.mapper.CylinderFillingRecordMapper; import com.yeejoin.amos.boot.module.elevator.flc.api.mapper.CylinderFillingRecordMapper;
import com.yeejoin.amos.boot.module.elevator.flc.api.service.ICylinderFillingRecordService; import com.yeejoin.amos.boot.module.elevator.flc.api.service.ICylinderFillingRecordService;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
...@@ -55,17 +45,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -55,17 +45,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Autowired @Autowired
CylinderFillingRecordMapper cylinderFillingRecordMapper; CylinderFillingRecordMapper cylinderFillingRecordMapper;
@Value("${biz.elasticsearch.address}") @Autowired
private String esAddress; RestHighLevelClient restHighLevelClient;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Value("${elasticsearch.username}")
private String esUserName;
@Value("${elasticsearch.password}")
private String esPwd;
/** /**
* 分页查询 * 分页查询
...@@ -127,7 +108,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -127,7 +108,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
//@Scheduled(cron = "${tzs.cylinder.fill.cron}") //@Scheduled(cron = "${tzs.cylinder.fill.cron}")
public void setTimeSaveCylinderInfoToES(){ public void setTimeSaveCylinderInfoToES() {
Page<ESCylinderFillingRecordDto> cylinderFillingRecordPage = new Page<>(); Page<ESCylinderFillingRecordDto> cylinderFillingRecordPage = new Page<>();
Page<ESCylinderFillingRecordDto> cyinderInfoList = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage); Page<ESCylinderFillingRecordDto> cyinderInfoList = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage);
Long count = cyinderInfoList.getCurrent(); Long count = cyinderInfoList.getCurrent();
...@@ -143,10 +124,10 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -143,10 +124,10 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
cylinderFillingRecordPage.setCurrent(i); cylinderFillingRecordPage.setCurrent(i);
cylinderFillingRecordPage.setSize(1000); cylinderFillingRecordPage.setSize(1000);
cylinderFillingRecordPage = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage); cylinderFillingRecordPage = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage);
if(!ObjectUtils.isEmpty(cylinderFillingRecordPage)){ if (!ObjectUtils.isEmpty(cylinderFillingRecordPage)) {
cylinderFillingRecordPage.getRecords().stream().map(item->{ cylinderFillingRecordPage.getRecords().stream().map(item -> {
if(!ObjectUtils.isEmpty(item.getSequenceCode())){ if (!ObjectUtils.isEmpty(item.getSequenceCode())) {
ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(),item.getSequenceCode()); ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode());
item.setUnitName(cyinderFillingRecordInfo.getUnitName()); item.setUnitName(cyinderFillingRecordInfo.getUnitName());
item.setFactoryNum(cyinderFillingRecordInfo.getFactoryNum()); item.setFactoryNum(cyinderFillingRecordInfo.getFactoryNum());
item.setCylinderVariety(cyinderFillingRecordInfo.getCylinderVariety()); item.setCylinderVariety(cyinderFillingRecordInfo.getCylinderVariety());
...@@ -164,7 +145,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -164,7 +145,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
// for (ESCylinderFillingRecordDto ci : cylinderFillingRecordPage.getRecords()) { // for (ESCylinderFillingRecordDto ci : cylinderFillingRecordPage.getRecords()) {
// saveCylinderFillingRecordToES(ci); // saveCylinderFillingRecordToES(ci);
// } // }
if(!ObjectUtils.isEmpty(cylinderFillingRecordPage)){ if (!ObjectUtils.isEmpty(cylinderFillingRecordPage)) {
saveCylinderFillingRecord2ES(cylinderFillingRecordPage.getRecords()); saveCylinderFillingRecord2ES(cylinderFillingRecordPage.getRecords());
} }
} }
...@@ -174,7 +155,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -174,7 +155,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Override @Override
public Page<ESCylinderFillingRecordDto> getCyinderFillingRecord(Page<ESCylinderFillingRecordDto> cylinderFillingRecordDto) { public Page<ESCylinderFillingRecordDto> getCyinderFillingRecord(Page<ESCylinderFillingRecordDto> cylinderFillingRecordDto) {
Page<ESCylinderFillingRecordDto> cyinderFillingRecord = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordDto); Page<ESCylinderFillingRecordDto> cyinderFillingRecord = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordDto);
if(!ObjectUtils.isEmpty(cyinderFillingRecord)){ if (!ObjectUtils.isEmpty(cyinderFillingRecord)) {
cyinderFillingRecord.getRecords().stream().map(item -> { cyinderFillingRecord.getRecords().stream().map(item -> {
if (!ObjectUtils.isEmpty(item.getSequenceCode())) { if (!ObjectUtils.isEmpty(item.getSequenceCode())) {
ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode()); ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode());
...@@ -202,26 +183,6 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -202,26 +183,6 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
public Page<ESCylinderFillingRecordDto> queryByKeys(ESCylinderFillingRecordDto esCylinderFillingRecordDto, int pageNum, int pageSize) { public Page<ESCylinderFillingRecordDto> queryByKeys(ESCylinderFillingRecordDto esCylinderFillingRecordDto, int pageNum, int pageSize) {
Page<ESCylinderFillingRecordDto> result = new Page<ESCylinderFillingRecordDto>(pageNum, pageSize); Page<ESCylinderFillingRecordDto> result = new Page<ESCylinderFillingRecordDto>(pageNum, pageSize);
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient =new RestHighLevelClient(
RestClient.builder(
new HttpHost(esAddress,esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
})
);
// RestHighLevelClient esClient = new RestHighLevelClient(
// RestClient.builder(new HttpHost(esAddress, esPort, "http"))
// );
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("cylinder_filling"); request.indices("cylinder_filling");
...@@ -328,7 +289,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -328,7 +289,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
boolMust.must(query); boolMust.must(query);
} }
if(flag) { // 搜索全部 if (flag) { // 搜索全部
boolMust.must(QueryBuilders.matchAllQuery()); boolMust.must(QueryBuilders.matchAllQuery());
} }
...@@ -340,9 +301,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -340,9 +301,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
List<ESCylinderFillingRecordDto> list = new LinkedList<>(); List<ESCylinderFillingRecordDto> list = new LinkedList<>();
long totle = 0; long totle = 0;
try { try {
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT); SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits()) { for (org.elasticsearch.search.SearchHit hit : response.getHits()) {
System.out.println(hit);
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
ESCylinderFillingRecordDto esCylinderFillingRecordDto1 = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderFillingRecordDto.class); ESCylinderFillingRecordDto esCylinderFillingRecordDto1 = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderFillingRecordDto.class);
list.add(esCylinderFillingRecordDto1); list.add(esCylinderFillingRecordDto1);
...@@ -352,6 +312,12 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -352,6 +312,12 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
result.setTotal(totle); result.setTotal(totle);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} finally {
try {
restHighLevelClient.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
} }
return result; return result;
...@@ -362,7 +328,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -362,7 +328,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
List<CylinderFillingRecord> cylinderFillingRecordList = new ArrayList<>(); List<CylinderFillingRecord> cylinderFillingRecordList = new ArrayList<>();
for (ESCylinderFillingRecordDto record : records) { for (ESCylinderFillingRecordDto record : records) {
CylinderFillingRecord cylinderFillingRecord = new CylinderFillingRecord(); CylinderFillingRecord cylinderFillingRecord = new CylinderFillingRecord();
BeanUtils.copyProperties(record,cylinderFillingRecord); BeanUtils.copyProperties(record, cylinderFillingRecord);
cylinderFillingRecord.setIsNotEs("1"); cylinderFillingRecord.setIsNotEs("1");
cylinderFillingRecord.setSequenceNbr(record.getSequenceNbr()); cylinderFillingRecord.setSequenceNbr(record.getSequenceNbr());
cylinderFillingRecordList.add(cylinderFillingRecord); cylinderFillingRecordList.add(cylinderFillingRecord);
......
...@@ -25,17 +25,9 @@ import com.yeejoin.amos.feign.systemctl.Systemctl; ...@@ -25,17 +25,9 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
...@@ -43,7 +35,6 @@ import org.elasticsearch.search.builder.SearchSourceBuilder; ...@@ -43,7 +35,6 @@ import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -68,1040 +59,1011 @@ import java.util.function.IntConsumer; ...@@ -68,1040 +59,1011 @@ import java.util.function.IntConsumer;
@Service @Service
@Slf4j @Slf4j
public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, CylinderInfo, CylinderInfoMapper> public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, CylinderInfo, CylinderInfoMapper>
implements ICylinderInfoService { implements ICylinderInfoService {
@Autowired @Autowired
CylinderUnitServiceImpl cylinderUnitServiceImpl; CylinderUnitServiceImpl cylinderUnitServiceImpl;
@Autowired @Autowired
CylinderUnitDataServiceImpl cylinderUnitDataServiceImpl; CylinderUnitDataServiceImpl cylinderUnitDataServiceImpl;
@Autowired @Autowired
CylinderInfoDataServiceImpl cylinderInfoDataServiceImpl; CylinderInfoDataServiceImpl cylinderInfoDataServiceImpl;
@Autowired @Autowired
CylinderTagsServiceImpl cylinderTagsServiceImpl; CylinderTagsServiceImpl cylinderTagsServiceImpl;
@Autowired @Autowired
CylinderFillingServiceImpl cylinderFillingServiceImpl; CylinderFillingServiceImpl cylinderFillingServiceImpl;
@Autowired @Autowired
CylinderIntegrityDataServiceImpl cylinderIntegrityDataServiceImpl; CylinderIntegrityDataServiceImpl cylinderIntegrityDataServiceImpl;
@Autowired @Autowired
CylinderFillingRecordServiceImpl cylinderFillingRecordServiceImpl; CylinderFillingRecordServiceImpl cylinderFillingRecordServiceImpl;
@Autowired @Autowired
CylinderFillingCheckServiceImpl cylinderFillingCheckServiceImpl; CylinderFillingCheckServiceImpl cylinderFillingCheckServiceImpl;
@Autowired @Autowired
CylinderAreaDataServiceImpl cylinderAreaDataServiceImpl; CylinderAreaDataServiceImpl cylinderAreaDataServiceImpl;
@Autowired @Autowired
CylinderFillingUnloadDataServiceImpl cylinderFillingUnloadDataServiceImpl; CylinderFillingUnloadDataServiceImpl cylinderFillingUnloadDataServiceImpl;
@Autowired @Autowired
CylinderInfoDataUnitServiceImpl cylinderInfoDataUnitServiceImpl; CylinderInfoDataUnitServiceImpl cylinderInfoDataUnitServiceImpl;
@Autowired @Autowired
CylinderFillingDataUnitServiceImpl cylinderFillingDataUnitServiceImpl; CylinderFillingDataUnitServiceImpl cylinderFillingDataUnitServiceImpl;
@Autowired @Autowired
CylinderTagsDataUnitServiceImpl cylinderTagsDataUnitServiceImpl; CylinderTagsDataUnitServiceImpl cylinderTagsDataUnitServiceImpl;
@Autowired @Autowired
CylinderIntegrityDataUnitServiceImpl cylinderIntegrityDataUnitServiceImpl; CylinderIntegrityDataUnitServiceImpl cylinderIntegrityDataUnitServiceImpl;
@Autowired @Autowired
CylinderFillingCheckDataUnitServiceImpl cylinderFillingCheckDataUnitServiceImpl; CylinderFillingCheckDataUnitServiceImpl cylinderFillingCheckDataUnitServiceImpl;
@Autowired @Autowired
CylinderFillingUnloadDataUnitServiceImpl cylinderFillingUnloadDataUnitServiceImpl; CylinderFillingUnloadDataUnitServiceImpl cylinderFillingUnloadDataUnitServiceImpl;
@Autowired @Autowired
MsgLogServiceImpl msgLogService; MsgLogServiceImpl msgLogService;
@Autowired @Autowired
private RuleTrigger ruleTrigger; private RuleTrigger ruleTrigger;
@Autowired @Autowired
TzsAuthServiceImpl tzsAuthService; TzsAuthServiceImpl tzsAuthService;
@Autowired @Autowired
private ScheduleMapper scheduleMapper; private ScheduleMapper scheduleMapper;
@Value("${cylinder-early-warning-packageId:气瓶监管/cylwarningmsg}") @Value("${cylinder-early-warning-packageId:气瓶监管/cylwarningmsg}")
private String packageId; private String packageId;
@Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}") @Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}")
private String cylPackageId; private String cylPackageId;
@Value("${biz.elasticsearch.address}")
private String esAddress; @Autowired
StartPlatformTokenService startPlatformTokenService;
@Value("${biz.elasticsearch.port}")
private Integer esPort; @Autowired
CylinderInfoMapper cylinderInfoMapper;
@Value("${elasticsearch.username}")
private String esUserName; @Autowired
ESCylinderInfoRepository esCylinderInfoRepository;
@Value("${elasticsearch.password}")
private String esPwd; @Autowired
RestHighLevelClient restHighLevelClient;
@Autowired
StartPlatformTokenService startPlatformTokenService; /**
* 分页查询
@Autowired */
CylinderInfoMapper cylinderInfoMapper; public Page<CylinderInfoDto> queryForCylinderInfoPage(Page<CylinderInfoDto> page) {
return queryForPage(page, null, false);
@Autowired }
ESCylinderInfoRepository esCylinderInfoRepository;
/**
* 列表查询 示例
/** */
* 分页查询 public List<CylinderInfoDto> queryForCylinderInfoList() {
*/ return queryForList("", false);
public Page<CylinderInfoDto> queryForCylinderInfoPage(Page<CylinderInfoDto> page) { }
return queryForPage(page, null, false);
} @Override
public Map<String, String> queryNumAndOutOfDateNum(Long unitId) {
/** return baseMapper.queryNumAndOutOfDateNum(unitId);
* 列表查询 示例 }
*/
public List<CylinderInfoDto> queryForCylinderInfoList() { /**
return queryForList("", false); * 获取上个月气瓶总量
} */
public Integer getMonthInfoTotal(String regionCode) {
@Override return baseMapper.getMonthInfoTotal(regionCode);
public Map<String, String> queryNumAndOutOfDateNum(Long unitId) { }
return baseMapper.queryNumAndOutOfDateNum(unitId);
} /**
* 获取上个月气瓶总量
/** */
* 获取上个月气瓶总量 public Integer getLastMonthInfoTotal(String regionCode) {
*/ return baseMapper.getLastMonthInfoTotal(regionCode);
public Integer getMonthInfoTotal(String regionCode) { }
return baseMapper.getMonthInfoTotal(regionCode);
} /**
* 获取上上个月气瓶总量
/** */
* 获取上个月气瓶总量 public Integer getMonthBeforeLastInfoTotal(String regionCode) {
*/ return baseMapper.getMonthBeforeLastInfoTotal(regionCode);
public Integer getLastMonthInfoTotal(String regionCode) { }
return baseMapper.getLastMonthInfoTotal(regionCode);
} public Integer getInfoTotalByRegionCode(String regionCode) {
return baseMapper.getInfoTotalByRegionCode(regionCode);
/** }
* 获取上上个月气瓶总量
*/ public Double queryIntegirtyByAppId(String appId) {
public Integer getMonthBeforeLastInfoTotal(String regionCode) { return this.baseMapper.queryIntegirtyByAppId(appId);
return baseMapper.getMonthBeforeLastInfoTotal(regionCode); }
}
public Integer getWarnNum(String code) {
public Integer getInfoTotalByRegionCode(String regionCode) { return baseMapper.getWarnNum(code);
return baseMapper.getInfoTotalByRegionCode(regionCode); }
}
/**
public Double queryIntegirtyByAppId(String appId) { * 按单位统计
return this.baseMapper.queryIntegirtyByAppId(appId); */
} @Transactional(rollbackFor = Exception.class)
//@Scheduled(cron = "0 0 2 * * ?")
public Integer getWarnNum(String code) { public void synFillingUnloadData() {
return baseMapper.getWarnNum(code); cylinderFillingUnloadDataServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadData>());
} countByRegion(regionModel -> {
Calendar now = Calendar.getInstance();
/** SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
* 按单位统计 for (int i = 0; i < 30; i++) {
*/ now.add(Calendar.DATE, -1);
@Transactional(rollbackFor = Exception.class) CylinderFillingUnloadDataDto temp = new CylinderFillingUnloadDataDto();
//@Scheduled(cron = "0 0 2 * * ?") Double fillingSum = cylinderFillingRecordServiceImpl
public void synFillingUnloadData() { .getFillingSum(String.valueOf(regionModel.getRegionCode()), now.getTime());
cylinderFillingUnloadDataServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadData>()); Double unloadSum = 0d;
countByRegion(regionModel -> { temp.setFillingSum(fillingSum);
Calendar now = Calendar.getInstance(); temp.setRegionCode(String.valueOf(regionModel.getRegionCode()));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); temp.setStatisDate(now.getTime());
for (int i = 0; i < 30; i++) { temp.setStatisDateStr(sdf.format(now.getTime()));
now.add(Calendar.DATE, -1); temp.setUnloadSum(unloadSum);
CylinderFillingUnloadDataDto temp = new CylinderFillingUnloadDataDto(); cylinderFillingUnloadDataServiceImpl.createWithModel(temp);
Double fillingSum = cylinderFillingRecordServiceImpl }
.getFillingSum(String.valueOf(regionModel.getRegionCode()), now.getTime()); });
Double unloadSum = 0d; }
temp.setFillingSum(fillingSum);
temp.setRegionCode(String.valueOf(regionModel.getRegionCode())); /**
temp.setStatisDate(now.getTime()); * 按区域统计
temp.setStatisDateStr(sdf.format(now.getTime())); */
temp.setUnloadSum(unloadSum); @Transactional(rollbackFor = Exception.class)
cylinderFillingUnloadDataServiceImpl.createWithModel(temp); //@Scheduled(cron = "0 0 2 * * ?")
} public void synAreaData() {
}); cylinderAreaDataServiceImpl.remove(new LambdaQueryWrapper<CylinderAreaData>());
} countByRegion(regionModel -> {
CylinderAreaDataDto temp = new CylinderAreaDataDto();
/** temp.setAreaName(regionModel.getRegionName());
* 按区域统计 String code = regionModel.getRegionCode() + "";
*/ Integer cylinderTotal = this.getInfoTotalByRegionCode(code);
@Transactional(rollbackFor = Exception.class) Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(code);
//@Scheduled(cron = "0 0 2 * * ?") Integer cylinderUnitWarn = cylinderUnitServiceImpl.getWarnNum(code);
public void synAreaData() { Integer cylinderInfoWarn = this.getWarnNum(code);
cylinderAreaDataServiceImpl.remove(new LambdaQueryWrapper<CylinderAreaData>()); int warmTotal = cylinderUnitWarn + cylinderInfoWarn;
countByRegion(regionModel -> { String parentCode = "";
CylinderAreaDataDto temp = new CylinderAreaDataDto(); if ("610000".equals(code)) {
temp.setAreaName(regionModel.getRegionName()); parentCode = "-1";
String code = regionModel.getRegionCode() + ""; } else if (!"00".equals(code.substring(4, 6))) {
Integer cylinderTotal = this.getInfoTotalByRegionCode(code); parentCode = code.substring(0, 4) + "00";
Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(code); } else {
Integer cylinderUnitWarn = cylinderUnitServiceImpl.getWarnNum(code); parentCode = "610000";
Integer cylinderInfoWarn = this.getWarnNum(code); }
int warmTotal = cylinderUnitWarn + cylinderInfoWarn; temp.setCylinderNum(Long.valueOf(cylinderTotal));
String parentCode = ""; temp.setParentRegionCode(parentCode);
if ("610000".equals(code)) { temp.setRegionCode(regionModel.getRegionCode() + "");
parentCode = "-1"; temp.setUnitNum(Long.valueOf(cylinderUnitTotal));
} else if (!"00".equals(code.substring(4, 6))) { temp.setWarnNum((long) warmTotal);
parentCode = code.substring(0, 4) + "00"; cylinderAreaDataServiceImpl.createWithModel(temp);
} else { });
parentCode = "610000"; }
}
temp.setCylinderNum(Long.valueOf(cylinderTotal)); /**
temp.setParentRegionCode(parentCode); * 按区域统计
temp.setRegionCode(regionModel.getRegionCode() + ""); */
temp.setUnitNum(Long.valueOf(cylinderUnitTotal)); @Transactional(rollbackFor = Exception.class)
temp.setWarnNum((long) warmTotal); //@Scheduled(cron = "* * 2 * * ?")
cylinderAreaDataServiceImpl.createWithModel(temp); public void addIntegrityData() {
}); System.out.println("====================数据完整性开始============================");
} cylinderIntegrityDataServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityData>());
countByRegion(regionModel -> {
/** List<CylinderUnit> unitlist = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>()
* 按区域统计 .like(CylinderUnit::getRegionCode, regionModel.getRegionCode()));
*/ List<CylinderIntegrityDataDto> tempList = new LinkedList<>();
@Transactional(rollbackFor = Exception.class) System.out.println(
//@Scheduled(cron = "* * 2 * * ?") "====================regioncode: " + regionModel.getRegionCode() + "============================");
public void addIntegrityData() { unitlist.forEach(t -> {
System.out.println("====================数据完整性开始============================"); System.out.println("====================appId: " + t.getAppId() + "============================");
cylinderIntegrityDataServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityData>()); CylinderIntegrityDataDto temp = new CylinderIntegrityDataDto();
countByRegion(regionModel -> { String appId = t.getAppId();
List<CylinderUnit> unitlist = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>() Double totalIntegirty = 0d;
.like(CylinderUnit::getRegionCode, regionModel.getRegionCode())); // tz_cylinder_info
List<CylinderIntegrityDataDto> tempList = new LinkedList<>(); Double unitIntegirty = t.getIntegrity();
System.out.println( unitIntegirty = unitIntegirty == null ? 0d : unitIntegirty;
"====================regioncode: " + regionModel.getRegionCode() + "============================"); // tz_cylinder_tags
unitlist.forEach(t -> { Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(appId);
System.out.println("====================appId: " + t.getAppId() + "============================"); tagIntegirty = tagIntegirty == null ? 0d : tagIntegirty;
CylinderIntegrityDataDto temp = new CylinderIntegrityDataDto(); // tz_cylinder_info
String appId = t.getAppId(); Double infoIntegirty = this.queryIntegirtyByAppId(appId);
Double totalIntegirty = 0d; infoIntegirty = infoIntegirty == null ? 0d : infoIntegirty;
// tz_cylinder_info // tz_cylinder_filling_record 30天内
Double unitIntegirty = t.getIntegrity(); Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(appId);
unitIntegirty = unitIntegirty == null ? 0d : unitIntegirty; recordIntegirty = recordIntegirty == null ? 0d : recordIntegirty;
// tz_cylinder_tags // tz_cylinder_filling 30天内ji
Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(appId); Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(appId);
tagIntegirty = tagIntegirty == null ? 0d : tagIntegirty; fillingIntegirty = fillingIntegirty == null ? 0d : fillingIntegirty;
// tz_cylinder_info // tz_cylinder_filling_check 30天内
Double infoIntegirty = this.queryIntegirtyByAppId(appId); Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(appId);
infoIntegirty = infoIntegirty == null ? 0d : infoIntegirty; checkIntegirty = checkIntegirty == null ? 0d : checkIntegirty;
// tz_cylinder_filling_record 30天内 totalIntegirty = (unitIntegirty + tagIntegirty + infoIntegirty + recordIntegirty + fillingIntegirty
Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(appId); + checkIntegirty) / 6;
recordIntegirty = recordIntegirty == null ? 0d : recordIntegirty; BigDecimal bg = new BigDecimal(totalIntegirty);
// tz_cylinder_filling 30天内ji totalIntegirty = bg.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(appId); temp.setAppId(appId);
fillingIntegirty = fillingIntegirty == null ? 0d : fillingIntegirty; temp.setRegionCode(String.valueOf(regionModel.getRegionCode()));
// tz_cylinder_filling_check 30天内 temp.setIntegrity(totalIntegirty);
Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(appId); temp.setUnitName(t.getUnitName());
checkIntegirty = checkIntegirty == null ? 0d : checkIntegirty; // 判断list 是否达到5个,如果达到则对比最后一个进行替换
totalIntegirty = (unitIntegirty + tagIntegirty + infoIntegirty + recordIntegirty + fillingIntegirty if (tempList.size() == 5) {
+ checkIntegirty) / 6; if (tempList.get(0).getIntegrity() < totalIntegirty) {
BigDecimal bg = new BigDecimal(totalIntegirty); tempList.set(0, temp);
totalIntegirty = bg.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100; }
temp.setAppId(appId); } else {
temp.setRegionCode(String.valueOf(regionModel.getRegionCode())); tempList.add(temp);
temp.setIntegrity(totalIntegirty); }
temp.setUnitName(t.getUnitName()); tempList.sort(Comparator.comparing(CylinderIntegrityDataDto::getIntegrity));
// 判断list 是否达到5个,如果达到则对比最后一个进行替换 });
if (tempList.size() == 5) { tempList.forEach(t -> {
if (tempList.get(0).getIntegrity() < totalIntegirty) { System.out.println("====================unitName: " + t.getUnitName() + "============================");
tempList.set(0, temp); t.setUpdateTime(new Date());
} cylinderIntegrityDataServiceImpl.createWithModel(t);
} else { });
tempList.add(temp); });
} System.out.println("====================数据完整性结束============================");
tempList.sort(Comparator.comparing(CylinderIntegrityDataDto::getIntegrity)); }
});
tempList.forEach(t -> { /**
System.out.println("====================unitName: " + t.getUnitName() + "============================"); * 企业总量按区域统计
t.setUpdateTime(new Date()); */
cylinderIntegrityDataServiceImpl.createWithModel(t); @Transactional(rollbackFor = Exception.class)
}); //@Scheduled(cron = "0 0 2 * * ?")
}); public void getCylinderUnitInfo() {
System.out.println("====================数据完整性结束============================"); cylinderUnitDataServiceImpl.remove(new LambdaQueryWrapper<CylinderUnitData>());
} countByRegion(regionModel -> {
String regionCode = String.valueOf(regionModel.getRegionCode());
/** Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(regionCode);
* 企业总量按区域统计 Integer thisMonthUnitTotal = cylinderUnitServiceImpl.getThisMonthUnitTotalByRegionCode(regionCode);
*/ Double lastUnitTotal = Double.valueOf(cylinderUnitServiceImpl.getLastMonthUnitTotal(regionCode));
@Transactional(rollbackFor = Exception.class) Double monthUnitLastInfo = Double.valueOf(cylinderUnitServiceImpl.getMonthBeforeLastUnitTotal(regionCode));
//@Scheduled(cron = "0 0 2 * * ?") double changeNum = thisMonthUnitTotal - lastUnitTotal;
public void getCylinderUnitInfo() { double percent = 0d;
cylinderUnitDataServiceImpl.remove(new LambdaQueryWrapper<CylinderUnitData>()); if (monthUnitLastInfo != 0) {
countByRegion(regionModel -> { percent = (lastUnitTotal - monthUnitLastInfo) / monthUnitLastInfo;
String regionCode = String.valueOf(regionModel.getRegionCode()); BigDecimal bg = new BigDecimal(percent);
Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(regionCode); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
Integer thisMonthUnitTotal = cylinderUnitServiceImpl.getThisMonthUnitTotalByRegionCode(regionCode); } else {
Double lastUnitTotal = Double.valueOf(cylinderUnitServiceImpl.getLastMonthUnitTotal(regionCode)); percent = 0;
Double monthUnitLastInfo = Double.valueOf(cylinderUnitServiceImpl.getMonthBeforeLastUnitTotal(regionCode)); BigDecimal bg = new BigDecimal(percent);
double changeNum = thisMonthUnitTotal - lastUnitTotal; percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
double percent = 0d; }
if (monthUnitLastInfo != 0) { CylinderUnitDataDto temp = new CylinderUnitDataDto();
percent = (lastUnitTotal-monthUnitLastInfo) / monthUnitLastInfo; temp.setChangeSum((long) changeNum);
BigDecimal bg = new BigDecimal(percent); temp.setChangePercent((int) (percent * 100) + "");
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); temp.setRegionCode(regionCode);
} else { temp.setTotalSum((long) cylinderUnitTotal);
percent = 0 ; temp.setUpdateTime(new Date());
BigDecimal bg = new BigDecimal(percent); cylinderUnitDataServiceImpl.createWithModel(temp);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); });
} }
CylinderUnitDataDto temp = new CylinderUnitDataDto();
temp.setChangeSum((long) changeNum); /**
temp.setChangePercent((int) (percent * 100) + ""); * 气瓶总量按区域统计
temp.setRegionCode(regionCode); */
temp.setTotalSum((long) cylinderUnitTotal); @Transactional(rollbackFor = Exception.class)
temp.setUpdateTime(new Date()); //@Scheduled(cron = "0 0 2 * * ?")
cylinderUnitDataServiceImpl.createWithModel(temp); public void getCylinderInfo() {
}); cylinderInfoDataServiceImpl.remove(new LambdaQueryWrapper<>());
} countByRegion(regionModel -> {
CylinderInfoDataDto temp = new CylinderInfoDataDto();
/** String regionCode = String.valueOf(regionModel.getRegionCode());
* 气瓶总量按区域统计 Integer cylinderTotal = this.getInfoTotalByRegionCode(regionCode);// 当前总数
*/ Double InfoTotal = Double.valueOf(this.getMonthInfoTotal(regionCode));
@Transactional(rollbackFor = Exception.class) Double lastInfoTotal = Double.valueOf(this.getLastMonthInfoTotal(regionCode));// 上月总数
//@Scheduled(cron = "0 0 2 * * ?") Double monthBeforeLastInfo = Double.valueOf(this.getMonthBeforeLastInfoTotal(regionCode));// 上上月总数
public void getCylinderInfo() { double percent = 0d;
cylinderInfoDataServiceImpl.remove(new LambdaQueryWrapper<>()); if (monthBeforeLastInfo != 0) {
countByRegion(regionModel -> { percent = (lastInfoTotal - monthBeforeLastInfo) / monthBeforeLastInfo;
CylinderInfoDataDto temp = new CylinderInfoDataDto(); BigDecimal bg = new BigDecimal(percent);
String regionCode = String.valueOf(regionModel.getRegionCode()); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
Integer cylinderTotal = this.getInfoTotalByRegionCode(regionCode);// 当前总数 } else {
Double InfoTotal = Double.valueOf(this.getMonthInfoTotal(regionCode)); percent = 0;
Double lastInfoTotal = Double.valueOf(this.getLastMonthInfoTotal(regionCode));// 上月总数 BigDecimal bg = new BigDecimal(percent);
Double monthBeforeLastInfo = Double.valueOf(this.getMonthBeforeLastInfoTotal(regionCode));// 上上月总数 percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
double percent = 0d; }
if (monthBeforeLastInfo != 0) { temp.setChangeSum((long) (InfoTotal - lastInfoTotal));
percent = (lastInfoTotal - monthBeforeLastInfo) / monthBeforeLastInfo; temp.setChangePercent((int) (percent * 100) + "");
BigDecimal bg = new BigDecimal(percent); temp.setRegionCode(regionCode);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); temp.setTotalSum((long) cylinderTotal);
}else cylinderInfoDataServiceImpl.createWithModel(temp);
{ });
percent = 0; }
BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); /**
} * 按单位统计
temp.setChangeSum((long) (InfoTotal - lastInfoTotal)); */
temp.setChangePercent((int) (percent * 100) + ""); @Transactional(rollbackFor = Exception.class)
temp.setRegionCode(regionCode); //@Scheduled(cron = "0 0 2 * * ?")
temp.setTotalSum((long) cylinderTotal); public void synUnitCylinderInfoData() {
cylinderInfoDataServiceImpl.createWithModel(temp); cylinderInfoDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderInfoDataUnit>());
}); countByUnit(cylinderUnit -> {
} CylinderInfoDataUnitDto temp = new CylinderInfoDataUnitDto();
temp.setAppId(cylinderUnit.getAppId());
/** int count = this
* 按单位统计 .count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));// 当前总数
*/ temp.setTotalSum((long) count);
@Transactional(rollbackFor = Exception.class) Double month = Double.valueOf(baseMapper.getMonthInfoTotalUnit(cylinderUnit.getAppId()));
//@Scheduled(cron = "0 0 2 * * ?") Double thismonth = Double.valueOf(baseMapper.getLastMonthInfoTotalUnit(cylinderUnit.getAppId()));// 上月总数
public void synUnitCylinderInfoData() { Double lastmonth = Double.valueOf(baseMapper.getMonthBeforeLastInfoTotalUnit(cylinderUnit.getAppId()));// 上上月总数
cylinderInfoDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderInfoDataUnit>()); double percent = 0d;
countByUnit(cylinderUnit -> { if (lastmonth != 0) {
CylinderInfoDataUnitDto temp = new CylinderInfoDataUnitDto(); percent = (thismonth - lastmonth) / lastmonth;
temp.setAppId(cylinderUnit.getAppId()); BigDecimal bg = new BigDecimal(percent);
int count = this percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));// 当前总数 } else {
temp.setTotalSum((long) count); percent = 0;
Double month = Double.valueOf(baseMapper.getMonthInfoTotalUnit(cylinderUnit.getAppId())); BigDecimal bg = new BigDecimal(percent);
Double thismonth = Double.valueOf(baseMapper.getLastMonthInfoTotalUnit(cylinderUnit.getAppId()));// 上月总数 percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
Double lastmonth = Double.valueOf(baseMapper.getMonthBeforeLastInfoTotalUnit(cylinderUnit.getAppId()));// 上上月总数 }
double percent = 0d; temp.setChangeSum((long) (month - thismonth));
if (lastmonth != 0) { temp.setChangePercent((int) (percent * 100) + "");
percent = (thismonth - lastmonth) / lastmonth; cylinderInfoDataUnitServiceImpl.createWithModel(temp);
BigDecimal bg = new BigDecimal(percent); });
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); }
}else
{ /**
percent = 0; * 充装量按单位和月统计
BigDecimal bg = new BigDecimal(percent); */
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); @Transactional(rollbackFor = Exception.class)
} //@Scheduled(cron = "0 0 2 * * ?")
temp.setChangeSum((long) (month - thismonth)); public void synUnitCylinderFillingData() {
temp.setChangePercent((int) (percent * 100) + ""); cylinderFillingDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingDataUnit>());
cylinderInfoDataUnitServiceImpl.createWithModel(temp); countByUnit(cylinderUnit -> {
}); // 按照月份 获取数据 取一年数据
} Calendar calendar = Calendar.getInstance();
// 按月份获取充装量
/** // 当月与上月 对比获取数据
* 充装量按单位和月统计 for (int i = 0; i < 12; i++) {
*/ // 获取当月数据
@Transactional(rollbackFor = Exception.class) CylinderFillingDataUnitDto temp = new CylinderFillingDataUnitDto();
//@Scheduled(cron = "0 0 2 * * ?") String year = calendar.get(Calendar.YEAR) + "";
public void synUnitCylinderFillingData() { int month = calendar.get(Calendar.MONTH) + 1;
cylinderFillingDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingDataUnit>()); String monthStr = month < 10 ? "0" + month : month + "";
countByUnit(cylinderUnit -> { temp.setFillingYear(year);
// 按照月份 获取数据 取一年数据 temp.setFillingMonth(monthStr);
Calendar calendar = Calendar.getInstance(); temp.setFillingDate(year + "-" + monthStr);
// 按月份获取充装量 // 本月
// 当月与上月 对比获取数据 Double thisMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(),
for (int i = 0; i < 12; i++) { calendar.getTime());
// 获取当月数据 temp.setTotalSum(thisMonth);
CylinderFillingDataUnitDto temp = new CylinderFillingDataUnitDto(); calendar.add(Calendar.MONTH, -1);
String year = calendar.get(Calendar.YEAR) + ""; // 上月
int month = calendar.get(Calendar.MONTH) + 1; Double lastMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(),
String monthStr = month < 10 ? "0" + month : month + ""; calendar.getTime());
temp.setFillingYear(year); double percent = 0d;
temp.setFillingMonth(monthStr); if (lastMonth != 0) {
temp.setFillingDate(year+"-"+monthStr); percent = (thisMonth - lastMonth) / lastMonth;
// 本月 BigDecimal bg = new BigDecimal(percent);
Double thisMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(), percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
calendar.getTime()); }
temp.setTotalSum(thisMonth); temp.setChangePercent((int) (percent * 100) + "");
calendar.add(Calendar.MONTH, -1); temp.setAppId(cylinderUnit.getAppId());
// 上月 temp.setChangeSum(thisMonth - lastMonth);
Double lastMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(), cylinderFillingDataUnitServiceImpl.createWithModel(temp);
calendar.getTime()); }
double percent = 0d; });
if (lastMonth != 0) { }
percent = (thisMonth - lastMonth) / lastMonth;
BigDecimal bg = new BigDecimal(percent); /**
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); * 按单位统计
} */
temp.setChangePercent((int) (percent * 100) + ""); @Transactional(rollbackFor = Exception.class)
temp.setAppId(cylinderUnit.getAppId()); //@Scheduled(cron = "0 0 2 * * ?")
temp.setChangeSum(thisMonth - lastMonth); public void synUnitCylinderTagsData() {
cylinderFillingDataUnitServiceImpl.createWithModel(temp); cylinderTagsDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderTagsDataUnit>());
} countByUnit(cylinderUnit -> {
}); CylinderTagsDataUnitDto temp = new CylinderTagsDataUnitDto();
} temp.setAppId(cylinderUnit.getAppId());
int cylinder = this
/** .count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));
* 按单位统计 int tags = cylinderTagsServiceImpl
*/ .count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, cylinderUnit.getAppId()));
@Transactional(rollbackFor = Exception.class) String percent = "";
//@Scheduled(cron = "0 0 2 * * ?") if (tags != 0) {
public void synUnitCylinderTagsData() { double zz = (double) cylinder / (double) tags;
cylinderTagsDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderTagsDataUnit>()); DecimalFormat df = new DecimalFormat("##.00%");
countByUnit(cylinderUnit -> { if (Math.abs(zz) < 0.0000000000001) {
CylinderTagsDataUnitDto temp = new CylinderTagsDataUnitDto(); percent = "0.00%";
temp.setAppId(cylinderUnit.getAppId()); } else {
int cylinder = this percent = df.format(zz);
.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId())); }
int tags = cylinderTagsServiceImpl }
.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, cylinderUnit.getAppId())); temp.setCylinderSum((long) cylinder);
String percent = ""; temp.setTagsSum((long) tags);
if (tags != 0) { temp.setTagPercent(percent);
double zz = (double) cylinder /(double) tags; cylinderTagsDataUnitServiceImpl.createWithModel(temp);
DecimalFormat df = new DecimalFormat("##.00%"); });
if (Math.abs(zz) < 0.0000000000001) { }
percent = "0.00%";
} else { /**
percent = df.format(zz); * 按单位统计
} */
} @Transactional(rollbackFor = Exception.class)
temp.setCylinderSum((long) cylinder); //@Scheduled(cron = "0 0 2 * * ?")
temp.setTagsSum((long) tags); public void synUnitIntegrityData() {
temp.setTagPercent(percent); cylinderIntegrityDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityDataUnit>());
cylinderTagsDataUnitServiceImpl.createWithModel(temp); countByUnit(cylinderUnit -> {
}); // 企业信息
} CylinderIntegrityDataUnitDto uninInfo = new CylinderIntegrityDataUnitDto();
uninInfo.setAppId(cylinderUnit.getAppId());
/** uninInfo.setDataType("企业信息");
* 按单位统计 Double unitIntegirty = cylinderUnit.getIntegrity();
*/ uninInfo.setIntegrity(unitIntegirty);
@Transactional(rollbackFor = Exception.class) cylinderIntegrityDataUnitServiceImpl.createWithModel(uninInfo);
//@Scheduled(cron = "0 0 2 * * ?") // 气瓶基本信息
public void synUnitIntegrityData() { CylinderIntegrityDataUnitDto cylinderInfo = new CylinderIntegrityDataUnitDto();
cylinderIntegrityDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityDataUnit>()); cylinderInfo.setAppId(cylinderUnit.getAppId());
countByUnit(cylinderUnit -> { cylinderInfo.setDataType("气瓶基本信息");
// 企业信息 Double cylinderIntegirty = this.queryIntegirtyByAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto uninInfo = new CylinderIntegrityDataUnitDto(); cylinderInfo.setIntegrity(cylinderIntegirty);
uninInfo.setAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInfo);
uninInfo.setDataType("企业信息"); // 气瓶标签信息
Double unitIntegirty = cylinderUnit.getIntegrity(); CylinderIntegrityDataUnitDto cylinderTag = new CylinderIntegrityDataUnitDto();
uninInfo.setIntegrity(unitIntegirty); cylinderTag.setAppId(cylinderUnit.getAppId());
cylinderIntegrityDataUnitServiceImpl.createWithModel(uninInfo); cylinderTag.setDataType("气瓶标签信息");
// 气瓶基本信息 Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderInfo = new CylinderIntegrityDataUnitDto(); cylinderTag.setIntegrity(tagIntegirty);
cylinderInfo.setAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderTag);
cylinderInfo.setDataType("气瓶基本信息"); // 气瓶检验信息
Double cylinderIntegirty = this.queryIntegirtyByAppId(cylinderUnit.getAppId()); CylinderIntegrityDataUnitDto cylinderInspection = new CylinderIntegrityDataUnitDto();
cylinderInfo.setIntegrity(cylinderIntegirty); cylinderInspection.setAppId(cylinderUnit.getAppId());
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInfo); cylinderInspection.setDataType("气瓶检验信息");
// 气瓶标签信息 cylinderInspection.setIntegrity(0d);
CylinderIntegrityDataUnitDto cylinderTag = new CylinderIntegrityDataUnitDto(); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInspection);
cylinderTag.setAppId(cylinderUnit.getAppId()); // 充装前检查
cylinderTag.setDataType("气瓶标签信息"); CylinderIntegrityDataUnitDto cylinderFilling = new CylinderIntegrityDataUnitDto();
Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderFilling.setAppId(cylinderUnit.getAppId());
cylinderTag.setIntegrity(tagIntegirty); cylinderFilling.setDataType("充装前检查");
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderTag); Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
// 气瓶检验信息 cylinderFilling.setIntegrity(fillingIntegirty);
CylinderIntegrityDataUnitDto cylinderInspection = new CylinderIntegrityDataUnitDto(); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderFilling);
cylinderInspection.setAppId(cylinderUnit.getAppId()); // 充装信息
cylinderInspection.setDataType("气瓶检验信息"); CylinderIntegrityDataUnitDto cylinderRecord = new CylinderIntegrityDataUnitDto();
cylinderInspection.setIntegrity(0d); cylinderRecord.setAppId(cylinderUnit.getAppId());
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInspection); cylinderRecord.setDataType("充装信息");
// 充装前检查 Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderFilling = new CylinderIntegrityDataUnitDto(); cylinderRecord.setIntegrity(recordIntegirty);
cylinderFilling.setAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderRecord);
cylinderFilling.setDataType("充装前检查"); // 充装后复查
Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); CylinderIntegrityDataUnitDto cylinderCheck = new CylinderIntegrityDataUnitDto();
cylinderFilling.setIntegrity(fillingIntegirty); cylinderCheck.setAppId(cylinderUnit.getAppId());
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderFilling); cylinderCheck.setDataType("充装后复查");
// 充装信息 Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderRecord = new CylinderIntegrityDataUnitDto(); cylinderCheck.setIntegrity(checkIntegirty);
cylinderRecord.setAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderCheck);
cylinderRecord.setDataType("充装信息"); });
Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); }
cylinderRecord.setIntegrity(recordIntegirty);
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderRecord); /**
// 充装后复查 * 充装详情按单位统计
CylinderIntegrityDataUnitDto cylinderCheck = new CylinderIntegrityDataUnitDto(); */
cylinderCheck.setAppId(cylinderUnit.getAppId()); @Transactional(rollbackFor = Exception.class)
cylinderCheck.setDataType("充装后复查"); //@Scheduled(cron = "0 0 2 * * ?")
Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); public void synUnitFillingCheckData() {
cylinderCheck.setIntegrity(checkIntegirty);
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderCheck);
});
}
/**
* 充装详情按单位统计
*/
@Transactional(rollbackFor = Exception.class)
//@Scheduled(cron = "0 0 2 * * ?")
public void synUnitFillingCheckData() {
// cylinderFillingCheckDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingCheckDataUnit>()); // cylinderFillingCheckDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingCheckDataUnit>());
countByUnit(cylinderUnit -> { countByUnit(cylinderUnit -> {
List<CylinderFillingCheckDataUnitDto> allCylinderFillingCheckDataList = List<CylinderFillingCheckDataUnitDto> allCylinderFillingCheckDataList =
cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), null); cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), null);
// 按照月份 获取数据 取一年数据 // 按照月份 获取数据 取一年数据
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
// 第一次查询到该appId对应的统计数据为空,则计算过去一年12个月的数据统计 // 第一次查询到该appId对应的统计数据为空,则计算过去一年12个月的数据统计
if (ValidationUtil.isEmpty(allCylinderFillingCheckDataList)) { if (ValidationUtil.isEmpty(allCylinderFillingCheckDataList)) {
// 按月份获取充装量 // 按月份获取充装量
// 当月与上月 对比获取数据 // 当月与上月 对比获取数据
for (int i = 0; i < 12; i++) { for (int i = 0; i < 12; i++) {
// 获取当月数据 // 获取当月数据
CylinderFillingCheckDataUnitDto temp = new CylinderFillingCheckDataUnitDto(); CylinderFillingCheckDataUnitDto temp = new CylinderFillingCheckDataUnitDto();
calcCylinderFillingCheckDataUnitData(cylinderUnit, c, temp); calcCylinderFillingCheckDataUnitData(cylinderUnit, c, temp);
c.add(Calendar.MONTH, -1); c.add(Calendar.MONTH, -1);
cylinderFillingCheckDataUnitServiceImpl.createWithModel(temp); cylinderFillingCheckDataUnitServiceImpl.createWithModel(temp);
} }
} else { } else {
// 如果已经有该appId对应数据,则直接更新当前月的数据即可 // 如果已经有该appId对应数据,则直接更新当前月的数据即可
Calendar current = Calendar.getInstance(); Calendar current = Calendar.getInstance();
String year = current.get(Calendar.YEAR) + ""; String year = current.get(Calendar.YEAR) + "";
int month = current.get(Calendar.MONTH) + 1; int month = current.get(Calendar.MONTH) + 1;
String monthStr = month < 10 ? "0" + month : month + ""; String monthStr = month < 10 ? "0" + month : month + "";
List<CylinderFillingCheckDataUnitDto> existDataDtoList = List<CylinderFillingCheckDataUnitDto> existDataDtoList =
cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), year + "-" + monthStr); cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), year + "-" + monthStr);
CylinderFillingCheckDataUnitDto tempDto = new CylinderFillingCheckDataUnitDto(); CylinderFillingCheckDataUnitDto tempDto = new CylinderFillingCheckDataUnitDto();
if (!ValidationUtil.isEmpty(existDataDtoList) && !ValidationUtil.isEmpty(existDataDtoList.get(0))) { if (!ValidationUtil.isEmpty(existDataDtoList) && !ValidationUtil.isEmpty(existDataDtoList.get(0))) {
tempDto = existDataDtoList.get(0); tempDto = existDataDtoList.get(0);
calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto); calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto);
cylinderFillingCheckDataUnitServiceImpl.updateWithModel(tempDto); cylinderFillingCheckDataUnitServiceImpl.updateWithModel(tempDto);
} else if (ValidationUtil.isEmpty(existDataDtoList)) { } else if (ValidationUtil.isEmpty(existDataDtoList)) {
// 处理当前月第一天还没数据情况 // 处理当前月第一天还没数据情况
calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto); calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto);
cylinderFillingCheckDataUnitServiceImpl.createWithModel(tempDto); cylinderFillingCheckDataUnitServiceImpl.createWithModel(tempDto);
} }
} }
}); });
} }
/** /**
* 计算当前单位的充装检查数据统计 * 计算当前单位的充装检查数据统计
* *
* @param cylinderUnit * @param cylinderUnit
* @param calender * @param calender
* @param cylinderFillingCheckDataUnitDto * @param cylinderFillingCheckDataUnitDto
*/ */
public void calcCylinderFillingCheckDataUnitData(CylinderUnit cylinderUnit, Calendar calender, CylinderFillingCheckDataUnitDto cylinderFillingCheckDataUnitDto) { public void calcCylinderFillingCheckDataUnitData(CylinderUnit cylinderUnit, Calendar calender, CylinderFillingCheckDataUnitDto cylinderFillingCheckDataUnitDto) {
String year = calender.get(Calendar.YEAR) + ""; String year = calender.get(Calendar.YEAR) + "";
int month = calender.get(Calendar.MONTH) + 1; int month = calender.get(Calendar.MONTH) + 1;
String monthStr = month < 10 ? "0" + month : month + ""; String monthStr = month < 10 ? "0" + month : month + "";
cylinderFillingCheckDataUnitDto.setFillingMonth(monthStr); cylinderFillingCheckDataUnitDto.setFillingMonth(monthStr);
cylinderFillingCheckDataUnitDto.setFillingYear(year); cylinderFillingCheckDataUnitDto.setFillingYear(year);
cylinderFillingCheckDataUnitDto.setFillingDate(year + "-" + monthStr); cylinderFillingCheckDataUnitDto.setFillingDate(year + "-" + monthStr);
Integer countThisMonth = cylinderFillingRecordServiceImpl Integer countThisMonth = cylinderFillingRecordServiceImpl
.getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime());
cylinderFillingCheckDataUnitDto.setTotalSum((long) countThisMonth); cylinderFillingCheckDataUnitDto.setTotalSum((long) countThisMonth);
// 获取本月数据 // 获取本月数据
Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(),
calender.getTime()); calender.getTime());
Integer fillingCheckCount = cylinderFillingCheckServiceImpl Integer fillingCheckCount = cylinderFillingCheckServiceImpl
.getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime());
// 充装前检查率:充装前检查次数/充装次数 // 充装前检查率:充装前检查次数/充装次数
double before = 0d; double before = 0d;
if (countThisMonth != 0) { if (countThisMonth != 0) {
before = (double) (fillingCount) / (double) countThisMonth; before = (double) (fillingCount) / (double) countThisMonth;
} }
cylinderFillingCheckDataUnitDto.setFillingCount((long) fillingCount); cylinderFillingCheckDataUnitDto.setFillingCount((long) fillingCount);
cylinderFillingCheckDataUnitDto.setFillingPercent(before * 100); cylinderFillingCheckDataUnitDto.setFillingPercent(before * 100);
// 充装后检查率:充装后检查次数/充装次数 // 充装后检查率:充装后检查次数/充装次数
double after = 0d; double after = 0d;
if (countThisMonth != 0) { if (countThisMonth != 0) {
after = (double) (fillingCheckCount) / (double) countThisMonth; after = (double) (fillingCheckCount) / (double) countThisMonth;
} }
cylinderFillingCheckDataUnitDto.setFillingCheckCount((long) fillingCheckCount); cylinderFillingCheckDataUnitDto.setFillingCheckCount((long) fillingCheckCount);
cylinderFillingCheckDataUnitDto.setFillingCheckPercent(after * 100); cylinderFillingCheckDataUnitDto.setFillingCheckPercent(after * 100);
// 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数 // 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数
double passed = 0d; double passed = 0d;
// 充装前检查合格次数 // 充装前检查合格次数
Integer fillingPassedCount = cylinderFillingServiceImpl Integer fillingPassedCount = cylinderFillingServiceImpl
.getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime());
// 充装后检查合格次数 // 充装后检查合格次数
Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl
.getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime());
if (countThisMonth != 0) { if (countThisMonth != 0) {
passed = ((double) (fillingPassedCount) + (double) fillingCheckPassedCount) passed = ((double) (fillingPassedCount) + (double) fillingCheckPassedCount)
/ (double) (2 * countThisMonth); / (double) (2 * countThisMonth);
} }
cylinderFillingCheckDataUnitDto.setFillingPassedCount((long) (fillingPassedCount + fillingCheckPassedCount)); cylinderFillingCheckDataUnitDto.setFillingPassedCount((long) (fillingPassedCount + fillingCheckPassedCount));
cylinderFillingCheckDataUnitDto.setTotalSumDouble((long) 2 * countThisMonth); cylinderFillingCheckDataUnitDto.setTotalSumDouble((long) 2 * countThisMonth);
cylinderFillingCheckDataUnitDto.setFillingPassedPercent(passed * 100); cylinderFillingCheckDataUnitDto.setFillingPassedPercent(passed * 100);
cylinderFillingCheckDataUnitDto.setAppId(cylinderUnit.getAppId()); cylinderFillingCheckDataUnitDto.setAppId(cylinderUnit.getAppId());
} }
/** /**
* 充装量、卸液量按单位统计 * 充装量、卸液量按单位统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
//@Scheduled(cron = "0 0 2 * * ?") //@Scheduled(cron = "0 0 2 * * ?")
public void synFillingUnloadUnitData() { public void synFillingUnloadUnitData() {
cylinderFillingUnloadDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadDataUnit>()); cylinderFillingUnloadDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadDataUnit>());
countByUnit(cylinderUnit -> { countByUnit(cylinderUnit -> {
Calendar now = Calendar.getInstance(); Calendar now = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
now.add(Calendar.DATE, -1); now.add(Calendar.DATE, -1);
CylinderFillingUnloadDataUnitDto temp = new CylinderFillingUnloadDataUnitDto(); CylinderFillingUnloadDataUnitDto temp = new CylinderFillingUnloadDataUnitDto();
Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSumByDate(cylinderUnit.getAppId(), Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSumByDate(cylinderUnit.getAppId(),
now.getTime()); now.getTime());
Double unloadSum = 0d; Double unloadSum = 0d;
temp.setFillingSum(fillingSum); temp.setFillingSum(fillingSum);
temp.setAppId(cylinderUnit.getAppId()); temp.setAppId(cylinderUnit.getAppId());
temp.setStatisDate(now.getTime()); temp.setStatisDate(now.getTime());
temp.setStatisDateStr(sdf.format(now.getTime())); temp.setStatisDateStr(sdf.format(now.getTime()));
temp.setUnloadSum(unloadSum); temp.setUnloadSum(unloadSum);
cylinderFillingUnloadDataUnitServiceImpl.createWithModel(temp); cylinderFillingUnloadDataUnitServiceImpl.createWithModel(temp);
} }
}); });
} }
//@Scheduled(cron = "${tzs.cylinder.info.cron}") //@Scheduled(cron = "${tzs.cylinder.info.cron}")
public void setTimeSaveCylinderInfoToES(){ public void setTimeSaveCylinderInfoToES() {
Page<CylinderInfoDto> cylinderInfoPage = new Page<>(); Page<CylinderInfoDto> cylinderInfoPage = new Page<>();
Page<CylinderInfoDto> cyinderInfoList = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage); Page<CylinderInfoDto> cyinderInfoList = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage);
Long count = cyinderInfoList.getCurrent(); Long count = cyinderInfoList.getCurrent();
Long times = 0L; Long times = 0L;
if (count != 0) { if (count != 0) {
times = count / 1000; times = count / 1000;
Long last = count % 1000; Long last = count % 1000;
if (last > 0) { if (last > 0) {
times++; times++;
} }
} }
for (int i = 0; i <= times; i++) { for (int i = 0; i <= times; i++) {
cylinderInfoPage.setCurrent(1); cylinderInfoPage.setCurrent(1);
cylinderInfoPage.setSize(1000); cylinderInfoPage.setSize(1000);
cylinderInfoPage = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage); cylinderInfoPage = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage);
if(!ObjectUtils.isEmpty(cylinderInfoPage)){ if (!ObjectUtils.isEmpty(cylinderInfoPage)) {
saveCylinderInfo2ES(cylinderInfoPage.getRecords()); saveCylinderInfo2ES(cylinderInfoPage.getRecords());
} }
// for (CylinderInfoDto ci : cylinderInfoPage.getRecords()) { // for (CylinderInfoDto ci : cylinderInfoPage.getRecords()) {
// saveCylinderInfoToES(ci); // saveCylinderInfoToES(ci);
// } // }
} }
} }
@Override @Override
public void saveCylinderInfo2ES(List<CylinderInfoDto> records) { public void saveCylinderInfo2ES(List<CylinderInfoDto> records) {
List<ESCylinderInfoDto> esCylinderInfoDto = new ArrayList<>(); List<ESCylinderInfoDto> esCylinderInfoDto = new ArrayList<>();
List<CylinderInfo> CylinderInfoList = new ArrayList<>(); List<CylinderInfo> CylinderInfoList = new ArrayList<>();
for (CylinderInfoDto record : records) { for (CylinderInfoDto record : records) {
ESCylinderInfoDto esCylinderInfo = new ESCylinderInfoDto(); ESCylinderInfoDto esCylinderInfo = new ESCylinderInfoDto();
BeanUtils.copyProperties(record,esCylinderInfo); BeanUtils.copyProperties(record, esCylinderInfo);
esCylinderInfoDto.add(esCylinderInfo); esCylinderInfoDto.add(esCylinderInfo);
CylinderInfo cylinderInfo = new CylinderInfo(); CylinderInfo cylinderInfo = new CylinderInfo();
BeanUtils.copyProperties(record,cylinderInfo); BeanUtils.copyProperties(record, cylinderInfo);
cylinderInfo.setSequenceNbr(record.getSequenceNbr()); cylinderInfo.setSequenceNbr(record.getSequenceNbr());
cylinderInfo.setIsNotEs("1"); cylinderInfo.setIsNotEs("1");
CylinderInfoList.add(cylinderInfo); CylinderInfoList.add(cylinderInfo);
} }
esCylinderInfoRepository.saveAll(esCylinderInfoDto); esCylinderInfoRepository.saveAll(esCylinderInfoDto);
this.updateBatchById(CylinderInfoList); this.updateBatchById(CylinderInfoList);
} }
@Override @Override
public Integer getInfoTotal() { public Integer getInfoTotal() {
return cylinderInfoMapper.getInfoTotal(); return cylinderInfoMapper.getInfoTotal();
} }
@Override @Override
public ESCylinderInfoDto saveCylinderInfoToES(CylinderInfoDto ci) { public ESCylinderInfoDto saveCylinderInfoToES(CylinderInfoDto ci) {
ESCylinderInfoDto esCylinderInfoDto = new ESCylinderInfoDto(); ESCylinderInfoDto esCylinderInfoDto = new ESCylinderInfoDto();
BeanUtils.copyProperties(ci,esCylinderInfoDto); BeanUtils.copyProperties(ci, esCylinderInfoDto);
ESCylinderInfoDto saveResult = esCylinderInfoRepository.save(esCylinderInfoDto); ESCylinderInfoDto saveResult = esCylinderInfoRepository.save(esCylinderInfoDto);
if(!ObjectUtils.isEmpty(saveResult)){ if (!ObjectUtils.isEmpty(saveResult)) {
//同步到es后修改 //同步到es后修改
CylinderInfo cylinderInfo = new CylinderInfo(); CylinderInfo cylinderInfo = new CylinderInfo();
cylinderInfo.setIsNotEs("1"); cylinderInfo.setIsNotEs("1");
cylinderInfoMapper.update(cylinderInfo, new QueryWrapper<CylinderInfo>().eq("sequence_nbr", ci.getSequenceNbr())); cylinderInfoMapper.update(cylinderInfo, new QueryWrapper<CylinderInfo>().eq("sequence_nbr", ci.getSequenceNbr()));
} }
return saveResult; return saveResult;
} }
@Override @Override
public Page<ESCylinderInfoDto> queryByKeys(CylinderInfoDto cylinderInfoDto, int pageNum, int pageSize) { public Page<ESCylinderInfoDto> queryByKeys(CylinderInfoDto cylinderInfoDto, int pageNum, int pageSize) {
Page<ESCylinderInfoDto> result = new Page<ESCylinderInfoDto>(pageNum, pageSize); Page<ESCylinderInfoDto> result = new Page<ESCylinderInfoDto>(pageNum, pageSize);
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, SearchRequest request = new SearchRequest();
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码 request.indices("cylinder_info");
RestHighLevelClient esClient =new RestHighLevelClient(
RestClient.builder( //通用匹配规则,条件构建
new HttpHost(esAddress,esPort) boolean flag = true;
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) { SearchSourceBuilder builder = new SearchSourceBuilder();
httpClientBuilder.disableAuthCaching(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
} //匹配统一信用代码
}) if (!ObjectUtils.isEmpty(cylinderInfoDto.getCreditCode())) {
); flag = false;
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchQuery("creditCode", cylinderInfoDto.getCreditCode()));
boolMust.must(meBuilder);
// RestHighLevelClient esClient = new RestHighLevelClient( }
// RestClient.builder(new HttpHost(esAddress, esPort, "http"))
// ); //匹配RegionCode
if (!ObjectUtils.isEmpty(cylinderInfoDto.getRegionCode())) {
flag = false;
SearchRequest request = new SearchRequest(); BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery();
request.indices("cylinder_info"); appIdBuilder.must(QueryBuilders.matchQuery("regionCode", "*" + cylinderInfoDto.getRegionCode() + "*"));
boolMust.should(appIdBuilder);
//通用匹配规则,条件构建 }
boolean flag = true;
//匹配appid
SearchSourceBuilder builder = new SearchSourceBuilder(); if (!ObjectUtils.isEmpty(cylinderInfoDto.getAppId())) {
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); flag = false;
BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery();
//匹配统一信用代码 appIdBuilder.must(QueryBuilders.matchQuery("appId", "*" + cylinderInfoDto.getAppId() + "*"));
if (!ObjectUtils.isEmpty(cylinderInfoDto.getCreditCode())) { boolMust.should(appIdBuilder);
flag = false; }
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchQuery("creditCode", cylinderInfoDto.getCreditCode())); //匹配产权单位
boolMust.must(meBuilder); if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitName())) {
} flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery();
//匹配RegionCode query.must(QueryBuilders.matchQuery("unitName", "*" + cylinderInfoDto.getUnitName() + "*"));
if (!ObjectUtils.isEmpty(cylinderInfoDto.getRegionCode())) { boolMust.must(query);
flag = false; }
BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery();
appIdBuilder.must(QueryBuilders.matchQuery("regionCode", "*" + cylinderInfoDto.getRegionCode() + "*")); //匹配出厂编号
boolMust.should(appIdBuilder); if (!ObjectUtils.isEmpty(cylinderInfoDto.getFactoryNum())) {
} flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery();
//匹配appid query.must(QueryBuilders.matchQuery("factoryNum", "*" + cylinderInfoDto.getFactoryNum() + "*"));
if (!ObjectUtils.isEmpty(cylinderInfoDto.getAppId())) { boolMust.must(query);
flag = false; }
BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery();
appIdBuilder.must(QueryBuilders.matchQuery("appId", "*" + cylinderInfoDto.getAppId() + "*")); //匹配气瓶品种
boolMust.should(appIdBuilder); if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderVariety())) {
} flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery();
//匹配产权单位 query.must(QueryBuilders.matchQuery("cylinderVariety", cylinderInfoDto.getCylinderVariety()));
if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitName())) { boolMust.must(query);
flag = false; }
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("unitName", "*" + cylinderInfoDto.getUnitName() + "*")); //匹配二维码编码
boolMust.must(query); if (!ObjectUtils.isEmpty(cylinderInfoDto.getQrCode())) {
} flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery();
//匹配出厂编号 query.must(QueryBuilders.matchQuery("qrCode", "*" + cylinderInfoDto.getQrCode() + "*"));
if (!ObjectUtils.isEmpty(cylinderInfoDto.getFactoryNum())) { boolMust.must(query);
flag = false; }
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("factoryNum", "*" + cylinderInfoDto.getFactoryNum() + "*")); //匹配电子标签
boolMust.must(query); if (!ObjectUtils.isEmpty(cylinderInfoDto.getElectronicLabelCode())) {
} flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery();
//匹配气瓶品种 query.must(QueryBuilders.matchQuery("electronicLabelCode", "*" + cylinderInfoDto.getElectronicLabelCode() + "*"));
if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderVariety())) { boolMust.must(query);
flag = false; }
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("cylinderVariety", cylinderInfoDto.getCylinderVariety())); //匹配气瓶唯一标识
boolMust.must(query); if (!ObjectUtils.isEmpty(cylinderInfoDto.getSequenceCode())) {
} flag = false;
BoolQueryBuilder sequenceCodeBuilder = QueryBuilders.boolQuery();
//匹配二维码编码 sequenceCodeBuilder.must(QueryBuilders.matchQuery("sequenceCode", cylinderInfoDto.getSequenceCode()));
if (!ObjectUtils.isEmpty(cylinderInfoDto.getQrCode())) { boolMust.must(sequenceCodeBuilder);
flag = false; }
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("qrCode", "*" + cylinderInfoDto.getQrCode() + "*")); //匹配单位内部编号
boolMust.must(query); if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitInnerCode())) {
} flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery();
//匹配电子标签 query.must(QueryBuilders.matchQuery("unitInnerCode", "*" + cylinderInfoDto.getUnitInnerCode() + "*"));
if (!ObjectUtils.isEmpty(cylinderInfoDto.getElectronicLabelCode())) { boolMust.must(query);
flag = false; }
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("electronicLabelCode", "*" + cylinderInfoDto.getElectronicLabelCode() + "*")); //气瓶状态
boolMust.must(query); if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderStatus())) {
} flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery();
//匹配气瓶唯一标识 query.must(QueryBuilders.matchQuery("cylinderStatus", cylinderInfoDto.getCylinderStatus()));
if (!ObjectUtils.isEmpty(cylinderInfoDto.getSequenceCode())) { boolMust.must(query);
flag = false; }
BoolQueryBuilder sequenceCodeBuilder = QueryBuilders.boolQuery();
sequenceCodeBuilder.must(QueryBuilders.matchQuery("sequenceCode", cylinderInfoDto.getSequenceCode())); //制造单位
boolMust.must(sequenceCodeBuilder); if (!ObjectUtils.isEmpty(cylinderInfoDto.getManufacturingUnit())) {
} flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery();
//匹配单位内部编号 query.must(QueryBuilders.matchQuery("manufacturingUnit", "*" + cylinderInfoDto.getManufacturingUnit() + "*"));
if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitInnerCode())) { boolMust.must(query);
flag = false; }
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("unitInnerCode", "*" + cylinderInfoDto.getUnitInnerCode() + "*")); //检验日期
boolMust.must(query); if (!ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateStart()) && !ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateEnd())) {
} flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery();
//气瓶状态 query.must(QueryBuilders.rangeQuery("inspectionDate").from(cylinderInfoDto.getInspectionDateStart()).to(cylinderInfoDto.getInspectionDateEnd()));
if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderStatus())) { boolMust.must(query);
flag = false; }
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("cylinderStatus", cylinderInfoDto.getCylinderStatus())); if (flag) { // 搜索全部
boolMust.must(query); boolMust.must(QueryBuilders.matchAllQuery());
} }
//制造单位 builder.query(boolMust);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getManufacturingUnit())) { builder.from((pageNum - 1) * pageSize);
flag = false; builder.size(pageSize);
BoolQueryBuilder query = QueryBuilders.boolQuery(); builder.trackTotalHits(true);
query.must(QueryBuilders.matchQuery("manufacturingUnit", "*" + cylinderInfoDto.getManufacturingUnit() + "*")); request.source(builder);
boolMust.must(query); List<ESCylinderInfoDto> list = new LinkedList<>();
} long totle = 0;
try {
//检验日期 SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateStart()) && !ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateEnd())) { for (org.elasticsearch.search.SearchHit hit : response.getHits()) {
flag = false; JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
BoolQueryBuilder query = QueryBuilders.boolQuery(); ESCylinderInfoDto esCylinderInfoDto = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderInfoDto.class);
query.must(QueryBuilders.rangeQuery("inspectionDate").from(cylinderInfoDto.getInspectionDateStart()).to(cylinderInfoDto.getInspectionDateEnd())); list.add(esCylinderInfoDto);
boolMust.must(query); }
} totle = response.getInternalResponse().hits().getTotalHits().value;
result.setRecords(list);
if(flag) { // 搜索全部 result.setTotal(totle);
boolMust.must(QueryBuilders.matchAllQuery()); } catch (IOException e) {
} throw new RuntimeException(e);
} finally {
builder.query(boolMust); try {
builder.from((pageNum - 1) * pageSize); restHighLevelClient.close();
builder.size(pageSize); } catch (Exception e) {
builder.trackTotalHits(true); throw new RuntimeException(e);
request.source(builder); }
List<ESCylinderInfoDto> list = new LinkedList<>(); }
long totle = 0;
try { return result;
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT); }
for (org.elasticsearch.search.SearchHit hit : response.getHits()) {
System.out.println(hit);
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); /**
ESCylinderInfoDto esCylinderInfoDto = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderInfoDto.class); * 根据月份统计
list.add(esCylinderInfoDto); */
} private void countByMonth(IntConsumer consumer) {
totle = response.getInternalResponse().hits().getTotalHits().value; for (int i = 0; i < 12; i++) {
result.setRecords(list); consumer.accept(i);
result.setTotal(totle); }
} catch (IOException e) { }
throw new RuntimeException(e);
} /**
* 根据单位统计
return result; */
} private void countByUnit(Consumer<CylinderUnit> consumer) {
List<CylinderUnit> units = cylinderUnitServiceImpl.list();
units.forEach(consumer);
}
/**
/** * 根据区域统计
* 根据月份统计 */
*/ private void countByRegion(Consumer<RegionModel> consumer) {
private void countByMonth(IntConsumer consumer) { List<RegionModel> regionList = new ArrayList<>();
for (int i = 0; i < 12; i++) { startPlatformTokenService.getToken();
consumer.accept(i); Collection<RegionModel> regions = Systemctl.regionClient.queryForTree(null).getResult();
} regions.forEach(regionModel -> convertTreeToList(regionList, regionModel));
} regionList.forEach(consumer);
}
/**
* 根据单位统计 /**
*/ * 将区域树转为区域List列表
private void countByUnit(Consumer<CylinderUnit> consumer) { */
List<CylinderUnit> units = cylinderUnitServiceImpl.list(); private void convertTreeToList(List<RegionModel> regionList, RegionModel region) {
units.forEach(consumer); regionList.add(region);
} if (region.getChildren() != null) {
region.getChildren().forEach(c -> {
/** convertTreeToList(regionList, c);
* 根据区域统计 });
*/ }
private void countByRegion(Consumer<RegionModel> consumer) { }
List<RegionModel> regionList = new ArrayList<>();
startPlatformTokenService.getToken(); public Integer getOverDateStatisticsNumber(String earlyWarningLevel) {
Collection<RegionModel> regions = Systemctl.regionClient.queryForTree(null).getResult(); return this.baseMapper.countOverDateNumber(earlyWarningLevel);
regions.forEach(regionModel -> convertTreeToList(regionList, regionModel)); }
regionList.forEach(consumer);
} public Page<CylinderInfoDto> earlyWarningLevelPageList(Page<CylinderInfoDto> page, String earlyWarningLevel) {
Page<CylinderInfoDto> result = this.baseMapper.queryPageListByEarlyWarningLevel(page, earlyWarningLevel);
/** result.getRecords().forEach(r -> {
* 将区域树转为区域List列表
*/
private void convertTreeToList(List<RegionModel> regionList, RegionModel region) {
regionList.add(region);
if (region.getChildren() != null) {
region.getChildren().forEach(c -> {
convertTreeToList(regionList, c);
});
}
}
public Integer getOverDateStatisticsNumber(String earlyWarningLevel) {
return this.baseMapper.countOverDateNumber(earlyWarningLevel);
}
public Page<CylinderInfoDto> earlyWarningLevelPageList(Page<CylinderInfoDto> page, String earlyWarningLevel) {
Page<CylinderInfoDto> result = this.baseMapper.queryPageListByEarlyWarningLevel(page, earlyWarningLevel);
result.getRecords().forEach(r -> {
// r.setEarlyWarningLevelName(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getName()); // r.setEarlyWarningLevelName(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getName());
// r.setInspectionStatusDesc(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getStatus()); // r.setInspectionStatusDesc(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getStatus());
}); });
return result; return result;
} }
public void calEarlyWarningLevel() { public void calEarlyWarningLevel() {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("气瓶超期预警时间调用规则开始"); log.debug("气瓶超期预警时间调用规则开始");
} }
// 1.批量分组大小 // 1.批量分组大小
int size = 500; int size = 500;
int total = this.count(); int total = this.count();
int groupNumber = total / size + 1; int groupNumber = total / size + 1;
// 2.批量小分组处理数据,调用规则 // 2.批量小分组处理数据,调用规则
for (int i = 0; i < groupNumber; i++) { for (int i = 0; i < groupNumber; i++) {
Page<CylinderInfo> page = new Page<>(); Page<CylinderInfo> page = new Page<>();
page.setCurrent(i); page.setCurrent(i);
page.setSize(size); page.setSize(size);
LambdaQueryWrapper<CylinderInfo> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CylinderInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.select(CylinderInfo::getSequenceCode, CylinderInfo::getSequenceNbr) wrapper.select(CylinderInfo::getSequenceCode, CylinderInfo::getSequenceNbr)
.orderByDesc(CylinderInfo::getSequenceNbr); .orderByDesc(CylinderInfo::getSequenceNbr);
IPage<CylinderInfo> result = this.page(page, wrapper); IPage<CylinderInfo> result = this.page(page, wrapper);
for (CylinderInfo r : result.getRecords()) { for (CylinderInfo r : result.getRecords()) {
// 设置token // 设置token
tzsAuthService.setRequestContext(); tzsAuthService.setRequestContext();
// 调用规则 // 调用规则
this.touchRuleToCalLevel(r); this.touchRuleToCalLevel(r);
} }
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("气瓶超期预警时间调用规则完成"); log.debug("气瓶超期预警时间调用规则完成");
} }
} }
private void touchRuleToCalLevel(CylinderInfo r) { private void touchRuleToCalLevel(CylinderInfo r) {
Date now = new Date(); Date now = new Date();
String dateStr; String dateStr;
try { try {
dateStr = DateUtils.dateFormat(now, DateUtils.DATE_TIME_PATTERN); dateStr = DateUtils.dateFormat(now, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) { } catch (ParseException e) {
throw new RuntimeException("日期个时候失败"); throw new RuntimeException("日期个时候失败");
} }
// 1.气瓶详情 // 1.气瓶详情
CylinderInfoDto cylinderInfoDto = this.getDetail(r.getSequenceCode()); CylinderInfoDto cylinderInfoDto = this.getDetail(r.getSequenceCode());
try { try {
WarningMsgDto warningMsgDto = new WarningMsgDto(); WarningMsgDto warningMsgDto = new WarningMsgDto();
int interval = DateUtils.dateBetweenIncludeToday(now, cylinderInfoDto.getNextInspectionDate()) - 1; int interval = DateUtils.dateBetweenIncludeToday(now, cylinderInfoDto.getNextInspectionDate()) - 1;
warningMsgDto.setNum(String.valueOf(interval)); warningMsgDto.setNum(String.valueOf(interval));
warningMsgDto.setFactoryNum(cylinderInfoDto.getFactoryNum()); warningMsgDto.setFactoryNum(cylinderInfoDto.getFactoryNum());
// warningMsgDto.setUserType(cylinderInfoDto.getCustomType()); // warningMsgDto.setUserType(cylinderInfoDto.getCustomType());
// warningMsgDto.setUserPeople(cylinderInfoDto.getCustomName()); // warningMsgDto.setUserPeople(cylinderInfoDto.getCustomName());
// warningMsgDto.setUserPeoplePhone(cylinderInfoDto.getContactPhone()); // warningMsgDto.setUserPeoplePhone(cylinderInfoDto.getContactPhone());
warningMsgDto.setCode(cylinderInfoDto.getSequenceCode()); warningMsgDto.setCode(cylinderInfoDto.getSequenceCode());
warningMsgDto.setCompanyName(cylinderInfoDto.getUnitName()); warningMsgDto.setCompanyName(cylinderInfoDto.getUnitName());
warningMsgDto.setPhone(cylinderInfoDto.getPersonMobilePhone()); warningMsgDto.setPhone(cylinderInfoDto.getPersonMobilePhone());
warningMsgDto.setPeople(cylinderInfoDto.getUnitPerson()); warningMsgDto.setPeople(cylinderInfoDto.getUnitPerson());
warningMsgDto.setCurrentTime(dateStr); warningMsgDto.setCurrentTime(dateStr);
// 2.循环调用规则 触发计算等级及发送消息 // 2.循环调用规则 触发计算等级及发送消息
if (log.isInfoEnabled()) { if (log.isInfoEnabled()) {
log.info("调用规则对象!+:{}", JSON.toJSONString(warningMsgDto)); log.info("调用规则对象!+:{}", JSON.toJSONString(warningMsgDto));
} }
ruleTrigger.publish(warningMsgDto, packageId, null); ruleTrigger.publish(warningMsgDto, packageId, null);
} catch (Exception e) { } catch (Exception e) {
log.error("调用规则失败!:{},{}", JSON.toJSONString(cylinderInfoDto), e); log.error("调用规则失败!:{},{}", JSON.toJSONString(cylinderInfoDto), e);
} }
} }
public CylinderInfoDto getDetail(String sequenceCode) { public CylinderInfoDto getDetail(String sequenceCode) {
CylinderInfoDto dto = scheduleMapper.getCylDetail(sequenceCode); CylinderInfoDto dto = scheduleMapper.getCylDetail(sequenceCode);
dto.setInspectionStatusDesc(StringUtils.isNotEmpty(dto.getEarlyWarningLevel()) dto.setInspectionStatusDesc(StringUtils.isNotEmpty(dto.getEarlyWarningLevel())
? EarlyWarningLevelEnum.getEumByLevel(dto.getEarlyWarningLevel()).getStatus() ? EarlyWarningLevelEnum.getEumByLevel(dto.getEarlyWarningLevel()).getStatus()
: ""); : "");
return dto; return dto;
} }
public List<MsgLog> getMsgList(String sequenceCode, String terminalType) { public List<MsgLog> getMsgList(String sequenceCode, String terminalType) {
LambdaQueryWrapper<MsgLog> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<MsgLog> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MsgLog::getRelationCode, sequenceCode); wrapper.eq(MsgLog::getRelationCode, sequenceCode);
wrapper.eq(StringUtils.isNotEmpty(terminalType), MsgLog::getTerminalType, terminalType); wrapper.eq(StringUtils.isNotEmpty(terminalType), MsgLog::getTerminalType, terminalType);
wrapper.orderByDesc(MsgLog::getSendTime); wrapper.orderByDesc(MsgLog::getSendTime);
return msgLogService.list(wrapper); return msgLogService.list(wrapper);
} }
/** /**
* 更新气瓶等级 * 更新气瓶等级
* *
* @param sequenceCode 唯一表设 * @param sequenceCode 唯一表设
* @param level 等级 * @param level 等级
* @return CylinderInfo * @return CylinderInfo
*/ */
public CylinderInfo updateEarlyWarningLevel(String sequenceCode, String level) { public CylinderInfo updateEarlyWarningLevel(String sequenceCode, String level) {
CylinderInfo cylinderInfo = this CylinderInfo cylinderInfo = this
.getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, sequenceCode)); .getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, sequenceCode));
cylinderInfo.setEarlyWarningLevel(level); cylinderInfo.setEarlyWarningLevel(level);
cylinderInfo.setEarlyWarningLevelCalDate(new Date()); cylinderInfo.setEarlyWarningLevelCalDate(new Date());
this.updateById(cylinderInfo); this.updateById(cylinderInfo);
return cylinderInfo; return cylinderInfo;
} }
public Boolean nextInspectionDateUpdate(List<CylinderInfoDto> cylinderInfoDtos) { public Boolean nextInspectionDateUpdate(List<CylinderInfoDto> cylinderInfoDtos) {
// 1.更新下次检验日期 // 1.更新下次检验日期
List<CylinderInfo> cylinderInfos = new ArrayList<>(); List<CylinderInfo> cylinderInfos = new ArrayList<>();
cylinderInfoDtos.forEach(c -> { cylinderInfoDtos.forEach(c -> {
CylinderInfo cylinderInfo = this.getOne( CylinderInfo cylinderInfo = this.getOne(
new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, c.getSequenceCode())); new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, c.getSequenceCode()));
// cylinderInfo.setNextInspectionDate(c.getNextInspectionDate()); // cylinderInfo.setNextInspectionDate(c.getNextInspectionDate());
cylinderInfos.add(cylinderInfo); cylinderInfos.add(cylinderInfo);
}); });
if (!cylinderInfos.isEmpty()) { if (!cylinderInfos.isEmpty()) {
this.updateBatchById(cylinderInfos); this.updateBatchById(cylinderInfos);
} }
// 2.循环调用规则 触发计算等级及发送消息 // 2.循环调用规则 触发计算等级及发送消息
cylinderInfos.forEach(this::touchRuleToCalLevel); cylinderInfos.forEach(this::touchRuleToCalLevel);
return Boolean.TRUE; return Boolean.TRUE;
} }
public Page<CylinderInfoDto> cyinderInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort,List<String> appids){ public Page<CylinderInfoDto> cyinderInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort, List<String> appids) {
return cylinderInfoMapper.cyinderInfoList(page,cylinderInfoDto,sort,appids); return cylinderInfoMapper.cyinderInfoList(page, cylinderInfoDto, sort, appids);
} }
public Page<CylinderInfoDto> getCyinderInfoList(Page<CylinderInfoDto> page) { public Page<CylinderInfoDto> getCyinderInfoList(Page<CylinderInfoDto> page) {
return cylinderInfoMapper.getCyinderInfoList(page); return cylinderInfoMapper.getCyinderInfoList(page);
} }
public Page<CylinderInfoDto> cyinderOutInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort,List<String> appids){ public Page<CylinderInfoDto> cyinderOutInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort, List<String> appids) {
return cylinderInfoMapper.cyinderOutInfoList(page,cylinderInfoDto,sort,appids); return cylinderInfoMapper.cyinderOutInfoList(page, cylinderInfoDto, sort, appids);
} }
} }
\ No newline at end of file
#DB properties: #DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=cn.com.vastbase.Driver
spring.datasource.url=jdbc:mysql://36.46.151.113:23306/tzs_amos_tzs_biz_init?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.datasource.url=jdbc:vastbase://192.168.249.180:54321/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=Yeejoin@2020 spring.datasource.password=Yeejoin@2023
eureka.client.service-url.defaultZone=http://192.168.249.13:10001/eureka/,http://192.168.249.139:10001/eureka/
#eureka properties: eureka.instance.prefer-ip-address=true
eureka.instance.hostname= eureka eureka.instance.ip-address=192.168.249.13
eureka.instance.prefer-ip-address = true management.endpoint.health.show-details=always
eureka.client.serviceUrl.defaultZone =http://36.46.151.113:10001/eureka/ management.endpoints.web.exposure.include=*
eureka.instance.ip-address = 172.16.3.133 eureka.instance.health-check-url=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/doc.html
## ES properties: ## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=docker-cluster
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username=elastic elasticsearch.username=elastic
elasticsearch.password=123456 elasticsearch.password=Yeejoin@2023
spring.elasticsearch.rest.uris=http://192.168.249.218:9200,http://192.168.249.114:9200,http://192.168.249.155:9200
## unit(h) ## unit(h)
alertcall.es.synchrony.time=48 alertcall.es.synchrony.time=48
#redis properties: #redis properties:
spring.redis.database=1 #集群环境
spring.redis.host=36.46.151.113 spring.redis.cluster.nodes=192.168.249.218:6377,192.168.249.114:6377,192.168.249.155:6377
spring.redis.port=16379 spring.redis.password=Yeejoin@2023
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200 spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1 spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=300
## emqx properties: ## emqx properties:
emqx.clean-session=false emqx.clean-session=false
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://36.46.151.113:1883 emqx.broker=tcp://192.168.249.180:2883
emqx.user-name=super emqx.user-name=super
emqx.password=123456 emqx.password=123456
emqx.keepAliveInterval=1000 emqx.keepAliveInterval=1000
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4 tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.46.151.113:8000 tzs.cti.url=http://36.41.172.83:8000
##wechatTokenls
##wechatToken
tzs.wechat.token=yeejoin_2021 tzs.wechat.token=yeejoin_2021
##wechatTicketUrl ##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token= tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
#tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw #tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
...@@ -61,41 +50,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html ...@@ -61,41 +50,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
#tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU #tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti cti.user.name=tzs_cti
cti.user.pwd=a1234567 cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001 flc.sms.tempCode=SMS_TZS_0001
## ??????id
## \u9884\u8B66\u901A\u77E5\u6A21\u677Fid
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##\u7763\u67E5\u6574\u6539\u901A\u77E5 ##??????
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## ???????id???userId?
## \u516C\u4F17\u53F7\u6D4B\u8BD5\u7528\u6237id\uFF08\u5E73\u53F0userId\uFF09
tzs.wechat.test.userId=3413513 tzs.wechat.test.userId=3413513
##new properties
fileserver.domain=https://rpm.yeeamos.com:8888/
org.filter.group.seq=1564150103147573249 org.filter.group.seq=1564150103147573249
fileserver.domain=http://192.168.249.180:19000/
log.level=INFO
duty.seats.role.ids=1585956200472674305,1585956257590706177 duty.seats.role.ids=1585956200472674305,1585956257590706177
## ???? properties:
rule.definition.load=false
##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto
rule.definition.default-agency=tzs
rule.definition.local-ip=192.168.249.13
#\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.fill.cron=0 0 12 * * ?
#\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.info.cron=0 0 1 * * ?
# ??????????
minio.url.path=http://192.168.249.180:19000/
## 生成监管码前缀域名
regulatory_code_prefix=https://nav.sspai.top/tzs?code=
outSystem.user.password=a1234560
amos.system.user.app-key=AMOS_STUDIO
amos.system.user.product=STUDIO_APP_WEB
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.10.90:53306/tzs_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://172.16.3.99:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.99:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.99:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.99:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=172.16.10.90
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic
elasticsearch.password= Yeejoin@2020
## unit(h)
alertcall.es.synchrony.time=48
fileserver.domain=https://rpm.yeeamos.com:8888/
#redis properties:
spring.redis.database=1
spring.redis.host=172.16.10.90
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.90:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://172.16.10.90:8000
rule.definition.load=false
rule.definition.model-package=com.yeejoin.amos.boot.module.elevator.api.dto
rule.definition.default-agency=tzs
rule.definition.localIp=172.16.3.39
org.filter.group.seq=1564150103147573249
duty.seats.role.ids=1585956200472674305,1585956257590706177
\ No newline at end of file
#DB properties: #DB properties:
spring.datasource.driver-class-name=cn.com.vastbase.Driver spring.datasource.driver-class-name=cn.com.vastbase.Driver
spring.datasource.url=jdbc:vastbase://36.46.137.116:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true spring.datasource.url=jdbc:vastbase://36.46.137.116:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true
#spring.datasource.url=jdbc:vastbase://36.46.151.113:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz
spring.datasource.username=admin spring.datasource.username=admin
spring.datasource.password=Yeejoin@2023 spring.datasource.password=Yeejoin@2023
eureka.client.service-url.defaultZone=http://172.16.10.230:10001/eureka/
#DB properties:
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.url=jdbc:mysql://172.16.10.230:53306/${TZS_BIZ_DATABASE}?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
#spring.datasource.username=${MYSQL_ROOT_USER}
#spring.datasource.password=${MYSQL_ROOT_PASSWORD}
#eureka prioperties:
#eureka.client.serviceUrl.defaultZone=http://172.16.10.230:10001/eureka/
#eureka.client.register-with-eureka=true
#eureka.client.fetch-registry=true
#eureka.client.healthcheck.enabled=true
#ribbon.eureka.enabled=true
#eureka.instance.hostname=${spring.cloud.client.ip-address}
#eureka.instance.prefer-ip-address=true
#eureka.instance.instance-id=${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
#eureka.instance.lease-expiration-duration-in-seconds=10
#eureka.instance.lease-renewal-interval-in-seconds=5
#management.endpoint.health.show-details=always
#management.endpoints.web.exposure.include=*
#
#eureka.instance.prefer-ip-address = true
#eureka.instance.ip-address = 172.16.10.230
eureka.client.service-url.defaultZone =http://172.16.10.230:10001/eureka/
eureka.instance.prefer-ip-address=true eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=* management.endpoints.web.exposure.include=*
...@@ -36,25 +11,13 @@ eureka.instance.health-check-url=http://172.16.3.34:${server.port}${server.servl ...@@ -36,25 +11,13 @@ eureka.instance.health-check-url=http://172.16.3.34:${server.port}${server.servl
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.34:${server.port}${server.servlet.context-path}/actuator/info eureka.instance.status-page-url=http://172.16.3.34:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.34:${server.port}${server.servlet.context-path}/doc.html eureka.instance.metadata-map.management.api-docs=http://172.16.3.34:${server.port}${server.servlet.context-path}/doc.html
eureka.instance.ip-address=172.16.3.34
eureka.instance.ip-address = 172.16.3.34
## ES properties: ## ES properties:
biz.elasticsearch.port=9200 elasticsearch.username=elastic
biz.elasticsearch.address=172.16.10.230 elasticsearch.password=a123456
spring.data.elasticsearch.cluster-name=docker-cluster spring.elasticsearch.rest.uris=http:/172.16.10.230:9200
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic
elasticsearch.password= a123456
## unit(h) ## unit(h)
alertcall.es.synchrony.time=48 alertcall.es.synchrony.time=48
#redis properties: #redis properties:
spring.redis.database=1 spring.redis.database=1
spring.redis.host=172.16.10.230 spring.redis.host=172.16.10.230
...@@ -65,7 +28,6 @@ spring.redis.lettuce.pool.max-wait=-1 ...@@ -65,7 +28,6 @@ spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=300
## emqx properties: ## emqx properties:
emqx.clean-session=false emqx.clean-session=false
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
...@@ -73,20 +35,13 @@ emqx.broker=tcp://36.46.151.113:1883 ...@@ -73,20 +35,13 @@ emqx.broker=tcp://36.46.151.113:1883
emqx.user-name=super emqx.user-name=super
emqx.password=123456 emqx.password=123456
emqx.keepAliveInterval=1000 emqx.keepAliveInterval=1000
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4 tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.41.172.83:8000 tzs.cti.url=http://36.41.172.83:8000
##wechatToken ##wechatToken
tzs.wechat.token=yeejoin_2021 tzs.wechat.token=yeejoin_2021
##wechatTicketUrl ##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token= tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
#tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw #tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
...@@ -96,67 +51,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html ...@@ -96,67 +51,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
#tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU #tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti cti.user.name=tzs_cti
cti.user.pwd=a1234567 cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001 flc.sms.tempCode=SMS_TZS_0001
## ??????id ## ??????id
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##?????? ##??????
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## ???????id???userId? ## ???????id???userId?
tzs.wechat.test.userId=3413513 tzs.wechat.test.userId=3413513
##new properties ##new properties
org.filter.group.seq=1564150103147573249 org.filter.group.seq=1564150103147573249
fileserver.domain=http://172.16.10.230:19000/ fileserver.domain=http://172.16.10.230:19000/
log.level=INFO log.level=INFO
duty.seats.role.ids=1585956200472674305,1585956257590706177 duty.seats.role.ids=1585956200472674305,1585956257590706177
## ???? properties: ## ???? properties:
rule.definition.load=false rule.definition.load=false
##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto ##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto
rule.definition.default-agency=tzs rule.definition.default-agency=tzs
rule.definition.local-ip=172.16.10.230 rule.definition.local-ip=172.16.10.230
#\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es #\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.fill.cron=0 0 12 * * ? tzs.cylinder.fill.cron=0 0 12 * * ?
#\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es #\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.info.cron=0 0 1 * * ? tzs.cylinder.info.cron=0 0 1 * * ?
# ?????????? # ??????????
minio.url.path=http://172.16.10.230:9000/ minio.url.path=http://172.16.10.230:9000/
## ɼǰ׺ ## ɼǰ׺
regulatory_code_prefix=https://nav.sspai.top/tzs?code= regulatory_code_prefix=https://nav.sspai.top/tzs?code=
outSystem.user.password=a1234560 outSystem.user.password=a1234560
amos.system.user.app-key=AMOS_STUDIO amos.system.user.app-key=AMOS_STUDIO
amos.system.user.product=STUDIO_APP_WEB amos.system.user.product=STUDIO_APP_WEB
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://113.134.211.174:3306/xiy_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://172.16.3.28:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.28:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.28:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://192.168.1.10:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
## unit(h)
alertcall.es.synchrony.time=48
#redis properties:
spring.redis.database=1
spring.redis.host=172.16.3.28
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.3.28:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://113.134.211.174:8000
rule.definition.load=false
rule.definition.model-package=com.yeejoin.amos.boot.module.elevator.api.dto
rule.definition.default-agency=tzs
rule.definition.localIp=172.16.3.39
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://36.46.151.113:13306/tzs_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://36.46.151.113:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
## unit(h)
alertcall.es.synchrony.time=48
#redis properties:
spring.redis.database=1
spring.redis.host=36.46.151.113
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://36.46.151.113:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://113.134.211.174:8000
...@@ -37,20 +37,20 @@ ...@@ -37,20 +37,20 @@
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" /> <logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
--> -->
<!--myibatis log configure--> <!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/> <logger name="com.apache.ibatis" level="debug"/>
<logger name="org.mybatis" level="INFO" /> <logger name="org.mybatis" level="debug" />
<logger name="java.sql.Connection" level="INFO"/> <logger name="java.sql.Connection" level="debug"/>
<logger name="java.sql.Statement" level="INFO"/> <logger name="java.sql.Statement" level="debug"/>
<logger name="java.sql.PreparedStatement" level="INFO"/> <logger name="java.sql.PreparedStatement" level="debug"/>
<logger name="org.springframework" level="INFO"/> <logger name="org.springframework" level="debug"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/> <logger name="com.baomidou.mybatisplus" level="debug"/>
<logger name="org.apache.activemq" level="INFO"/> <logger name="org.apache.activemq" level="debug"/>
<logger name="org.typroject" level="INFO"/> <logger name="org.typroject" level="debug"/>
<logger name="com.yeejoin" level="INFO"/> <logger name="com.yeejoin" level="debug"/>
<!-- 日志输出级别 --> <!-- 日志输出级别 -->
<root level="ERROR"> <root level="error">
<!-- <appender-ref ref="FILE" /> --> <!-- <appender-ref ref="FILE" /> -->
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
<!-- <appender-ref ref="ELK" />--> <!-- <appender-ref ref="ELK" />-->
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/96333.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- ELK管理 -->
<appender name="ELK" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>172.16.10.230:4560</destination>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/>
<logger name="org.mybatis" level="INFO" />
<logger name="java.sql.Connection" level="INFO"/>
<logger name="java.sql.Statement" level="INFO"/>
<logger name="java.sql.PreparedStatement" level="INFO"/>
<logger name="org.springframework" level="INFO"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="INFO"/>
<logger name="com.yeejoin" level="INFO"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<!-- <appender-ref ref="FILE" /> -->
<appender-ref ref="STDOUT" />
<!-- <appender-ref ref="ELK" />-->
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/96333.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="org.mybatis" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<logger name="com.baomidou.mybatisplus" level="DEBUG"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/96333.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="org.mybatis" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<logger name="com.baomidou.mybatisplus" level="DEBUG"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
package com.yeejoin.amos.boot.module.cylinder.biz.config; package com.yeejoin.amos.boot.module.cylinder.biz.config;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope; import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider; import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder; import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
...@@ -16,6 +13,8 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -16,6 +13,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration @Configuration
public class ElasticSearchClientConfig { public class ElasticSearchClientConfig {
...@@ -35,27 +34,19 @@ public class ElasticSearchClientConfig { ...@@ -35,27 +34,19 @@ public class ElasticSearchClientConfig {
new UsernamePasswordCredentials(username, password)); new UsernamePasswordCredentials(username, password));
try { try {
String url = uris.replace("http://", ""); HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
final String[] parts = StringUtils.split(url, ":"); RestClientBuilder builder = RestClient.builder(httpHosts);
HttpHost httpHost = new HttpHost(parts[0], Integer.parseInt(parts[1]), "http"); builder.setHttpClientConfigCallback(httpClientBuilder -> {
RestClientBuilder builder = RestClient.builder(httpHost); httpClientBuilder.disableAuthCaching();
builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() { return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
@Override });
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) { // 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
httpClientBuilder.disableAuthCaching(); builder.setRequestConfigCallback(requestConfigBuilder -> {
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider); // 连接超时(默认为1秒)
} return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
}); });
builder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
@Override
public RequestConfig.Builder customizeRequestConfig(
RequestConfig.Builder requestConfigBuilder) {
return requestConfigBuilder.setConnectTimeout(5000 * 1000) // 连接超时(默认为1秒)
.setSocketTimeout(6000 * 1000);// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
}
});// 调整最大重试超时时间(默认为30秒).setMaxRetryTimeoutMillis(60000);
return new RestHighLevelClient(builder); return new RestHighLevelClient(builder);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -148,17 +148,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -148,17 +148,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//一码通复制功能url参数key //一码通复制功能url参数key
private static final String COPY_KEY = "stashType"; private static final String COPY_KEY = "stashType";
@Value("${biz.elasticsearch.address}") @Autowired
private String esAddress; RestHighLevelClient restHighLevelClient;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Value("${elasticsearch.username}")
private String esUserName;
@Value("${elasticsearch.password}")
private String esPwd;
private static String USE_CODE = "use_code"; private static String USE_CODE = "use_code";
...@@ -1200,11 +1191,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1200,11 +1191,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return save; return save;
} }
public Page<JSONObject> queryByKeys(JSONObject map) { public Page<JSONObject> queryByKeys(JSONObject map) {
//根据当前登录人查询 // //根据当前登录人查询
if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) { if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) {
map.put(EQUSTATE, EquimentEnum.getCode.get(map.get(EQUSTATE).toString()).toString()); map.put(EQUSTATE, EquimentEnum.getCode.get(map.get(EQUSTATE).toString()).toString());
} }
ResponseModel<Page<Map<String, Object>>> model = new ResponseModel<>();
JSONObject object = getCompanyType().get(0); JSONObject object = getCompanyType().get(0);
String level = object.getString("level"); String level = object.getString("level");
String code = object.getString("orgCode"); String code = object.getString("orgCode");
...@@ -1219,19 +1209,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1219,19 +1209,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
} }
Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size")); Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size"));
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient = new RestHighLevelClient(
RestClient.builder(
new HttpHost(esAddress, esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
})
);
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all"); request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
...@@ -1329,7 +1306,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1329,7 +1306,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
List<JSONObject> list = new LinkedList<>(); List<JSONObject> list = new LinkedList<>();
long totle = 0; long totle = 0;
try { try {
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT); SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits().getHits()) { for (org.elasticsearch.search.SearchHit hit : response.getHits().getHits()) {
System.out.println(hit); System.out.println(hit);
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
...@@ -1348,7 +1325,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1348,7 +1325,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
throw new RuntimeException(e); throw new RuntimeException(e);
} finally { } finally {
try { try {
esClient.close(); restHighLevelClient.close();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
...@@ -4,31 +4,22 @@ import com.alibaba.fastjson.JSONArray; ...@@ -4,31 +4,22 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.cylinder.biz.dao.ESCylinderFillingRecordRepository;
import com.yeejoin.amos.boot.module.cylinder.api.entity.ESCylinderFillingRecordDto; import com.yeejoin.amos.boot.module.cylinder.api.entity.ESCylinderFillingRecordDto;
import com.yeejoin.amos.boot.module.cylinder.biz.dao.ESCylinderFillingRecordRepository;
import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderFillingRecordDto; import com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderFillingRecordDto;
import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderFillingRecord; import com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderFillingRecord;
import com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylinderFillingRecordMapper; import com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylinderFillingRecordMapper;
import com.yeejoin.amos.boot.module.cylinder.flc.api.service.ICylinderFillingRecordService; import com.yeejoin.amos.boot.module.cylinder.flc.api.service.ICylinderFillingRecordService;
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock; import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -56,17 +47,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -56,17 +47,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Autowired @Autowired
CylinderFillingRecordMapper cylinderFillingRecordMapper; CylinderFillingRecordMapper cylinderFillingRecordMapper;
@Value("${biz.elasticsearch.address}") @Autowired
private String esAddress; RestHighLevelClient restHighLevelClient;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Value("${elasticsearch.username}")
private String esUserName;
@Value("${elasticsearch.password}")
private String esPwd;
/** /**
* 分页查询 * 分页查询
...@@ -128,8 +110,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -128,8 +110,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Scheduled(cron = "${tzs.cylinder.fill.cron}") @Scheduled(cron = "${tzs.cylinder.fill.cron}")
@SchedulerLock(name="cylinderFillingRecord2ESTask",lockAtMostFor = "PT6H") @SchedulerLock(name = "cylinderFillingRecord2ESTask", lockAtMostFor = "PT6H")
public void setTimeSaveCylinderInfoToES(){ public void setTimeSaveCylinderInfoToES() {
Page<ESCylinderFillingRecordDto> cylinderFillingRecordPage = new Page<>(); Page<ESCylinderFillingRecordDto> cylinderFillingRecordPage = new Page<>();
Page<ESCylinderFillingRecordDto> cyinderInfoList = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage); Page<ESCylinderFillingRecordDto> cyinderInfoList = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage);
Long count = cyinderInfoList.getCurrent(); Long count = cyinderInfoList.getCurrent();
...@@ -145,10 +127,10 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -145,10 +127,10 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
cylinderFillingRecordPage.setCurrent(i); cylinderFillingRecordPage.setCurrent(i);
cylinderFillingRecordPage.setSize(1000); cylinderFillingRecordPage.setSize(1000);
cylinderFillingRecordPage = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage); cylinderFillingRecordPage = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage);
if(!ObjectUtils.isEmpty(cylinderFillingRecordPage)){ if (!ObjectUtils.isEmpty(cylinderFillingRecordPage)) {
cylinderFillingRecordPage.getRecords().stream().map(item->{ cylinderFillingRecordPage.getRecords().stream().map(item -> {
if(!ObjectUtils.isEmpty(item.getSequenceCode())){ if (!ObjectUtils.isEmpty(item.getSequenceCode())) {
ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(),item.getSequenceCode()); ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode());
item.setUnitName(cyinderFillingRecordInfo.getUnitName()); item.setUnitName(cyinderFillingRecordInfo.getUnitName());
item.setFactoryNum(cyinderFillingRecordInfo.getFactoryNum()); item.setFactoryNum(cyinderFillingRecordInfo.getFactoryNum());
item.setCylinderVariety(cyinderFillingRecordInfo.getCylinderVariety()); item.setCylinderVariety(cyinderFillingRecordInfo.getCylinderVariety());
...@@ -166,7 +148,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -166,7 +148,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
// for (ESCylinderFillingRecordDto ci : cylinderFillingRecordPage.getRecords()) { // for (ESCylinderFillingRecordDto ci : cylinderFillingRecordPage.getRecords()) {
// saveCylinderFillingRecordToES(ci); // saveCylinderFillingRecordToES(ci);
// } // }
if(!ObjectUtils.isEmpty(cylinderFillingRecordPage)){ if (!ObjectUtils.isEmpty(cylinderFillingRecordPage)) {
saveCylinderFillingRecord2ES(cylinderFillingRecordPage.getRecords()); saveCylinderFillingRecord2ES(cylinderFillingRecordPage.getRecords());
} }
} }
...@@ -176,7 +158,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -176,7 +158,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Override @Override
public Page<ESCylinderFillingRecordDto> getCyinderFillingRecord(Page<ESCylinderFillingRecordDto> cylinderFillingRecordDto) { public Page<ESCylinderFillingRecordDto> getCyinderFillingRecord(Page<ESCylinderFillingRecordDto> cylinderFillingRecordDto) {
Page<ESCylinderFillingRecordDto> cyinderFillingRecord = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordDto); Page<ESCylinderFillingRecordDto> cyinderFillingRecord = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordDto);
if(!ObjectUtils.isEmpty(cyinderFillingRecord)){ if (!ObjectUtils.isEmpty(cyinderFillingRecord)) {
cyinderFillingRecord.getRecords().stream().map(item -> { cyinderFillingRecord.getRecords().stream().map(item -> {
if (!ObjectUtils.isEmpty(item.getSequenceCode())) { if (!ObjectUtils.isEmpty(item.getSequenceCode())) {
ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode()); ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode());
...@@ -204,26 +186,6 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -204,26 +186,6 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
public Page<ESCylinderFillingRecordDto> queryByKeys(ESCylinderFillingRecordDto esCylinderFillingRecordDto, int pageNum, int pageSize) { public Page<ESCylinderFillingRecordDto> queryByKeys(ESCylinderFillingRecordDto esCylinderFillingRecordDto, int pageNum, int pageSize) {
Page<ESCylinderFillingRecordDto> result = new Page<ESCylinderFillingRecordDto>(pageNum, pageSize); Page<ESCylinderFillingRecordDto> result = new Page<ESCylinderFillingRecordDto>(pageNum, pageSize);
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient =new RestHighLevelClient(
RestClient.builder(
new HttpHost(esAddress,esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
})
);
// RestHighLevelClient esClient = new RestHighLevelClient(
// RestClient.builder(new HttpHost(esAddress, esPort, "http"))
// );
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("cylinder_filling"); request.indices("cylinder_filling");
...@@ -330,7 +292,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -330,7 +292,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
boolMust.must(query); boolMust.must(query);
} }
if(flag) { // 搜索全部 if (flag) { // 搜索全部
boolMust.must(QueryBuilders.matchAllQuery()); boolMust.must(QueryBuilders.matchAllQuery());
} }
...@@ -342,9 +304,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -342,9 +304,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
List<ESCylinderFillingRecordDto> list = new LinkedList<>(); List<ESCylinderFillingRecordDto> list = new LinkedList<>();
long totle = 0; long totle = 0;
try { try {
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT); SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits()) { for (org.elasticsearch.search.SearchHit hit : response.getHits()) {
System.out.println(hit);
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
ESCylinderFillingRecordDto esCylinderFillingRecordDto1 = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderFillingRecordDto.class); ESCylinderFillingRecordDto esCylinderFillingRecordDto1 = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderFillingRecordDto.class);
list.add(esCylinderFillingRecordDto1); list.add(esCylinderFillingRecordDto1);
...@@ -354,6 +315,12 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -354,6 +315,12 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
result.setTotal(totle); result.setTotal(totle);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} finally {
try {
restHighLevelClient.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
} }
return result; return result;
...@@ -364,7 +331,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -364,7 +331,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
List<CylinderFillingRecord> cylinderFillingRecordList = new ArrayList<>(); List<CylinderFillingRecord> cylinderFillingRecordList = new ArrayList<>();
for (ESCylinderFillingRecordDto record : records) { for (ESCylinderFillingRecordDto record : records) {
CylinderFillingRecord cylinderFillingRecord = new CylinderFillingRecord(); CylinderFillingRecord cylinderFillingRecord = new CylinderFillingRecord();
BeanUtils.copyProperties(record,cylinderFillingRecord); BeanUtils.copyProperties(record, cylinderFillingRecord);
cylinderFillingRecord.setIsNotEs("1"); cylinderFillingRecord.setIsNotEs("1");
cylinderFillingRecord.setSequenceNbr(record.getSequenceNbr()); cylinderFillingRecord.setSequenceNbr(record.getSequenceNbr());
cylinderFillingRecordList.add(cylinderFillingRecord); cylinderFillingRecordList.add(cylinderFillingRecord);
......
...@@ -7,12 +7,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -7,12 +7,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.cylinder.biz.dao.ESCylinderInfoRepository;
import com.yeejoin.amos.boot.module.cylinder.api.dto.WarningMsgDto; import com.yeejoin.amos.boot.module.cylinder.api.dto.WarningMsgDto;
import com.yeejoin.amos.boot.module.cylinder.api.entity.ESCylinderInfoDto; import com.yeejoin.amos.boot.module.cylinder.api.entity.ESCylinderInfoDto;
import com.yeejoin.amos.boot.module.cylinder.api.entity.MsgLog; import com.yeejoin.amos.boot.module.cylinder.api.entity.MsgLog;
import com.yeejoin.amos.boot.module.cylinder.api.enums.EarlyWarningLevelEnum; import com.yeejoin.amos.boot.module.cylinder.api.enums.EarlyWarningLevelEnum;
import com.yeejoin.amos.boot.module.cylinder.api.mapper.ScheduleMapper; import com.yeejoin.amos.boot.module.cylinder.api.mapper.ScheduleMapper;
import com.yeejoin.amos.boot.module.cylinder.biz.dao.ESCylinderInfoRepository;
import com.yeejoin.amos.boot.module.cylinder.biz.service.impl.MsgLogServiceImpl; import com.yeejoin.amos.boot.module.cylinder.biz.service.impl.MsgLogServiceImpl;
import com.yeejoin.amos.boot.module.cylinder.biz.service.impl.StartPlatformTokenService; import com.yeejoin.amos.boot.module.cylinder.biz.service.impl.StartPlatformTokenService;
import com.yeejoin.amos.boot.module.cylinder.biz.service.impl.TzsAuthServiceImpl; import com.yeejoin.amos.boot.module.cylinder.biz.service.impl.TzsAuthServiceImpl;
...@@ -26,17 +26,9 @@ import com.yeejoin.amos.feign.systemctl.model.RegionModel; ...@@ -26,17 +26,9 @@ import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock; import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
...@@ -69,1062 +61,1031 @@ import java.util.function.IntConsumer; ...@@ -69,1062 +61,1031 @@ import java.util.function.IntConsumer;
@Service @Service
@Slf4j @Slf4j
public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, CylinderInfo, CylinderInfoMapper> public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, CylinderInfo, CylinderInfoMapper>
implements ICylinderInfoService { implements ICylinderInfoService {
@Autowired
CylinderUnitServiceImpl cylinderUnitServiceImpl;
@Autowired
CylinderUnitDataServiceImpl cylinderUnitDataServiceImpl;
@Autowired
CylinderInfoDataServiceImpl cylinderInfoDataServiceImpl;
@Autowired
CylinderTagsServiceImpl cylinderTagsServiceImpl;
@Autowired @Autowired
CylinderFillingServiceImpl cylinderFillingServiceImpl; CylinderUnitServiceImpl cylinderUnitServiceImpl;
@Autowired @Autowired
CylinderIntegrityDataServiceImpl cylinderIntegrityDataServiceImpl; CylinderUnitDataServiceImpl cylinderUnitDataServiceImpl;
@Autowired @Autowired
CylinderFillingRecordServiceImpl cylinderFillingRecordServiceImpl; CylinderInfoDataServiceImpl cylinderInfoDataServiceImpl;
@Autowired @Autowired
CylinderFillingCheckServiceImpl cylinderFillingCheckServiceImpl; CylinderTagsServiceImpl cylinderTagsServiceImpl;
@Autowired @Autowired
CylinderAreaDataServiceImpl cylinderAreaDataServiceImpl; CylinderFillingServiceImpl cylinderFillingServiceImpl;
@Autowired @Autowired
CylinderFillingUnloadDataServiceImpl cylinderFillingUnloadDataServiceImpl; CylinderIntegrityDataServiceImpl cylinderIntegrityDataServiceImpl;
@Autowired @Autowired
CylinderInfoDataUnitServiceImpl cylinderInfoDataUnitServiceImpl; CylinderFillingRecordServiceImpl cylinderFillingRecordServiceImpl;
@Autowired @Autowired
CylinderFillingDataUnitServiceImpl cylinderFillingDataUnitServiceImpl; CylinderFillingCheckServiceImpl cylinderFillingCheckServiceImpl;
@Autowired @Autowired
CylinderTagsDataUnitServiceImpl cylinderTagsDataUnitServiceImpl; CylinderAreaDataServiceImpl cylinderAreaDataServiceImpl;
@Autowired @Autowired
CylinderIntegrityDataUnitServiceImpl cylinderIntegrityDataUnitServiceImpl; CylinderFillingUnloadDataServiceImpl cylinderFillingUnloadDataServiceImpl;
@Autowired @Autowired
CylinderFillingCheckDataUnitServiceImpl cylinderFillingCheckDataUnitServiceImpl; CylinderInfoDataUnitServiceImpl cylinderInfoDataUnitServiceImpl;
@Autowired @Autowired
CylinderFillingUnloadDataUnitServiceImpl cylinderFillingUnloadDataUnitServiceImpl; CylinderFillingDataUnitServiceImpl cylinderFillingDataUnitServiceImpl;
@Autowired @Autowired
MsgLogServiceImpl msgLogService; CylinderTagsDataUnitServiceImpl cylinderTagsDataUnitServiceImpl;
@Autowired @Autowired
private RuleTrigger ruleTrigger; CylinderIntegrityDataUnitServiceImpl cylinderIntegrityDataUnitServiceImpl;
@Autowired @Autowired
TzsAuthServiceImpl tzsAuthService; CylinderFillingCheckDataUnitServiceImpl cylinderFillingCheckDataUnitServiceImpl;
@Autowired @Autowired
private ScheduleMapper scheduleMapper; CylinderFillingUnloadDataUnitServiceImpl cylinderFillingUnloadDataUnitServiceImpl;
@Value("${cylinder-early-warning-packageId:气瓶监管/cylwarningmsg}") @Autowired
private String packageId; MsgLogServiceImpl msgLogService;
@Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}") @Autowired
private String cylPackageId; private RuleTrigger ruleTrigger;
@Value("${biz.elasticsearch.address}") @Autowired
private String esAddress; TzsAuthServiceImpl tzsAuthService;
@Value("${biz.elasticsearch.port}") @Autowired
private Integer esPort; private ScheduleMapper scheduleMapper;
@Value("${elasticsearch.username}") @Value("${cylinder-early-warning-packageId:气瓶监管/cylwarningmsg}")
private String esUserName; private String packageId;
@Value("${elasticsearch.password}") @Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}")
private String esPwd; private String cylPackageId;
@Autowired
RestHighLevelClient restHighLevelClient;
@Autowired @Autowired
StartPlatformTokenService startPlatformTokenService; StartPlatformTokenService startPlatformTokenService;
@Autowired @Autowired
CylinderInfoMapper cylinderInfoMapper; CylinderInfoMapper cylinderInfoMapper;
@Autowired @Autowired
ESCylinderInfoRepository esCylinderInfoRepository; ESCylinderInfoRepository esCylinderInfoRepository;
/** /**
* 分页查询 * 分页查询
*/ */
public Page<CylinderInfoDto> queryForCylinderInfoPage(Page<CylinderInfoDto> page) { public Page<CylinderInfoDto> queryForCylinderInfoPage(Page<CylinderInfoDto> page) {
return queryForPage(page, null, false); return queryForPage(page, null, false);
} }
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<CylinderInfoDto> queryForCylinderInfoList() { public List<CylinderInfoDto> queryForCylinderInfoList() {
return queryForList("", false); return queryForList("", false);
} }
@Override @Override
public Map<String, String> queryNumAndOutOfDateNum(Long unitId) { public Map<String, String> queryNumAndOutOfDateNum(Long unitId) {
return baseMapper.queryNumAndOutOfDateNum(unitId); return baseMapper.queryNumAndOutOfDateNum(unitId);
} }
/** /**
* 获取上个月气瓶总量 * 获取上个月气瓶总量
*/ */
public Integer getMonthInfoTotal(String regionCode) { public Integer getMonthInfoTotal(String regionCode) {
return baseMapper.getMonthInfoTotal(regionCode); return baseMapper.getMonthInfoTotal(regionCode);
} }
/** /**
* 获取上个月气瓶总量 * 获取上个月气瓶总量
*/ */
public Integer getLastMonthInfoTotal(String regionCode) { public Integer getLastMonthInfoTotal(String regionCode) {
return baseMapper.getLastMonthInfoTotal(regionCode); return baseMapper.getLastMonthInfoTotal(regionCode);
} }
/** /**
* 获取上上个月气瓶总量 * 获取上上个月气瓶总量
*/ */
public Integer getMonthBeforeLastInfoTotal(String regionCode) { public Integer getMonthBeforeLastInfoTotal(String regionCode) {
return baseMapper.getMonthBeforeLastInfoTotal(regionCode); return baseMapper.getMonthBeforeLastInfoTotal(regionCode);
} }
public Integer getInfoTotalByRegionCode(String regionCode) { public Integer getInfoTotalByRegionCode(String regionCode) {
return baseMapper.getInfoTotalByRegionCode(regionCode); return baseMapper.getInfoTotalByRegionCode(regionCode);
} }
public Double queryIntegirtyByAppId(String appId) { public Double queryIntegirtyByAppId(String appId) {
return this.baseMapper.queryIntegirtyByAppId(appId); return this.baseMapper.queryIntegirtyByAppId(appId);
} }
public Integer getWarnNum(String code) { public Integer getWarnNum(String code) {
return baseMapper.getWarnNum(code); return baseMapper.getWarnNum(code);
} }
/** /**
* 按单位统计 * 按单位统计
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "0 0 2 * * ?") @Scheduled(cron = "0 0 2 * * ?")
@SchedulerLock(name="synFillingUnloadDataTask",lockAtMostFor = "PT6H") @SchedulerLock(name = "synFillingUnloadDataTask", lockAtMostFor = "PT6H")
public void synFillingUnloadData() { public void synFillingUnloadData() {
cylinderFillingUnloadDataServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadData>()); cylinderFillingUnloadDataServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadData>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
Calendar now = Calendar.getInstance(); Calendar now = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
now.add(Calendar.DATE, -1); now.add(Calendar.DATE, -1);
CylinderFillingUnloadDataDto temp = new CylinderFillingUnloadDataDto(); CylinderFillingUnloadDataDto temp = new CylinderFillingUnloadDataDto();
Double fillingSum = cylinderFillingRecordServiceImpl Double fillingSum = cylinderFillingRecordServiceImpl
.getFillingSum(String.valueOf(regionModel.getRegionCode()), now.getTime()); .getFillingSum(String.valueOf(regionModel.getRegionCode()), now.getTime());
Double unloadSum = 0d; Double unloadSum = 0d;
temp.setFillingSum(fillingSum); temp.setFillingSum(fillingSum);
temp.setRegionCode(String.valueOf(regionModel.getRegionCode())); temp.setRegionCode(String.valueOf(regionModel.getRegionCode()));
temp.setStatisDate(now.getTime()); temp.setStatisDate(now.getTime());
temp.setStatisDateStr(sdf.format(now.getTime())); temp.setStatisDateStr(sdf.format(now.getTime()));
temp.setUnloadSum(unloadSum); temp.setUnloadSum(unloadSum);
cylinderFillingUnloadDataServiceImpl.createWithModel(temp); cylinderFillingUnloadDataServiceImpl.createWithModel(temp);
} }
}); });
} }
/** /**
* 按区域统计 * 按区域统计
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "0 0 2 * * ?") @Scheduled(cron = "0 0 2 * * ?")
@SchedulerLock(name="synAreaDataTask",lockAtMostFor = "PT60M") @SchedulerLock(name = "synAreaDataTask", lockAtMostFor = "PT60M")
public void synAreaData() { public void synAreaData() {
cylinderAreaDataServiceImpl.remove(new LambdaQueryWrapper<CylinderAreaData>()); cylinderAreaDataServiceImpl.remove(new LambdaQueryWrapper<CylinderAreaData>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
CylinderAreaDataDto temp = new CylinderAreaDataDto(); CylinderAreaDataDto temp = new CylinderAreaDataDto();
temp.setAreaName(regionModel.getRegionName()); temp.setAreaName(regionModel.getRegionName());
String code = regionModel.getRegionCode() + ""; String code = regionModel.getRegionCode() + "";
Integer cylinderTotal = this.getInfoTotalByRegionCode(code); Integer cylinderTotal = this.getInfoTotalByRegionCode(code);
Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(code); Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(code);
Integer cylinderUnitWarn = cylinderUnitServiceImpl.getWarnNum(code); Integer cylinderUnitWarn = cylinderUnitServiceImpl.getWarnNum(code);
Integer cylinderInfoWarn = this.getWarnNum(code); Integer cylinderInfoWarn = this.getWarnNum(code);
int warmTotal = cylinderUnitWarn + cylinderInfoWarn; int warmTotal = cylinderUnitWarn + cylinderInfoWarn;
String parentCode = ""; String parentCode = "";
if ("610000".equals(code)) { if ("610000".equals(code)) {
parentCode = "-1"; parentCode = "-1";
} else if (!"00".equals(code.substring(4, 6))) { } else if (!"00".equals(code.substring(4, 6))) {
parentCode = code.substring(0, 4) + "00"; parentCode = code.substring(0, 4) + "00";
} else { } else {
parentCode = "610000"; parentCode = "610000";
} }
temp.setCylinderNum(Long.valueOf(cylinderTotal)); temp.setCylinderNum(Long.valueOf(cylinderTotal));
temp.setParentRegionCode(parentCode); temp.setParentRegionCode(parentCode);
temp.setRegionCode(regionModel.getRegionCode() + ""); temp.setRegionCode(regionModel.getRegionCode() + "");
temp.setUnitNum(Long.valueOf(cylinderUnitTotal)); temp.setUnitNum(Long.valueOf(cylinderUnitTotal));
temp.setWarnNum((long) warmTotal); temp.setWarnNum((long) warmTotal);
cylinderAreaDataServiceImpl.createWithModel(temp); cylinderAreaDataServiceImpl.createWithModel(temp);
}); });
} }
/** /**
* 按区域统计 * 按区域统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "* * 2 * * ?") @Scheduled(cron = "* * 2 * * ?")
@SchedulerLock(name="addIntegrityDataTask",lockAtMostFor = "PT60M") @SchedulerLock(name = "addIntegrityDataTask", lockAtMostFor = "PT60M")
public void addIntegrityData() { public void addIntegrityData() {
System.out.println("====================数据完整性开始============================"); System.out.println("====================数据完整性开始============================");
cylinderIntegrityDataServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityData>()); cylinderIntegrityDataServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityData>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
List<CylinderUnit> unitlist = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>() List<CylinderUnit> unitlist = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>()
.like(CylinderUnit::getRegionCode, regionModel.getRegionCode())); .like(CylinderUnit::getRegionCode, regionModel.getRegionCode()));
List<CylinderIntegrityDataDto> tempList = new LinkedList<>(); List<CylinderIntegrityDataDto> tempList = new LinkedList<>();
System.out.println( System.out.println(
"====================regioncode: " + regionModel.getRegionCode() + "============================"); "====================regioncode: " + regionModel.getRegionCode() + "============================");
unitlist.forEach(t -> { unitlist.forEach(t -> {
System.out.println("====================appId: " + t.getAppId() + "============================"); System.out.println("====================appId: " + t.getAppId() + "============================");
CylinderIntegrityDataDto temp = new CylinderIntegrityDataDto(); CylinderIntegrityDataDto temp = new CylinderIntegrityDataDto();
String appId = t.getAppId(); String appId = t.getAppId();
Double totalIntegirty = 0d; Double totalIntegirty = 0d;
// tz_cylinder_info // tz_cylinder_info
Double unitIntegirty = t.getIntegrity(); Double unitIntegirty = t.getIntegrity();
unitIntegirty = unitIntegirty == null ? 0d : unitIntegirty; unitIntegirty = unitIntegirty == null ? 0d : unitIntegirty;
// tz_cylinder_tags // tz_cylinder_tags
Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(appId); Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(appId);
tagIntegirty = tagIntegirty == null ? 0d : tagIntegirty; tagIntegirty = tagIntegirty == null ? 0d : tagIntegirty;
// tz_cylinder_info // tz_cylinder_info
Double infoIntegirty = this.queryIntegirtyByAppId(appId); Double infoIntegirty = this.queryIntegirtyByAppId(appId);
infoIntegirty = infoIntegirty == null ? 0d : infoIntegirty; infoIntegirty = infoIntegirty == null ? 0d : infoIntegirty;
// tz_cylinder_filling_record 30天内 // tz_cylinder_filling_record 30天内
Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(appId); Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(appId);
recordIntegirty = recordIntegirty == null ? 0d : recordIntegirty; recordIntegirty = recordIntegirty == null ? 0d : recordIntegirty;
// tz_cylinder_filling 30天内ji // tz_cylinder_filling 30天内ji
Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(appId); Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(appId);
fillingIntegirty = fillingIntegirty == null ? 0d : fillingIntegirty; fillingIntegirty = fillingIntegirty == null ? 0d : fillingIntegirty;
// tz_cylinder_filling_check 30天内 // tz_cylinder_filling_check 30天内
Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(appId); Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(appId);
checkIntegirty = checkIntegirty == null ? 0d : checkIntegirty; checkIntegirty = checkIntegirty == null ? 0d : checkIntegirty;
totalIntegirty = (unitIntegirty + tagIntegirty + infoIntegirty + recordIntegirty + fillingIntegirty totalIntegirty = (unitIntegirty + tagIntegirty + infoIntegirty + recordIntegirty + fillingIntegirty
+ checkIntegirty) / 6; + checkIntegirty) / 6;
BigDecimal bg = new BigDecimal(totalIntegirty); BigDecimal bg = new BigDecimal(totalIntegirty);
totalIntegirty = bg.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100; totalIntegirty = bg.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
temp.setAppId(appId); temp.setAppId(appId);
temp.setRegionCode(String.valueOf(regionModel.getRegionCode())); temp.setRegionCode(String.valueOf(regionModel.getRegionCode()));
temp.setIntegrity(totalIntegirty); temp.setIntegrity(totalIntegirty);
temp.setUnitName(t.getUnitName()); temp.setUnitName(t.getUnitName());
// 判断list 是否达到5个,如果达到则对比最后一个进行替换 // 判断list 是否达到5个,如果达到则对比最后一个进行替换
if (tempList.size() == 5) { if (tempList.size() == 5) {
if (tempList.get(0).getIntegrity() < totalIntegirty) { if (tempList.get(0).getIntegrity() < totalIntegirty) {
tempList.set(0, temp); tempList.set(0, temp);
} }
} else { } else {
tempList.add(temp); tempList.add(temp);
} }
tempList.sort(Comparator.comparing(CylinderIntegrityDataDto::getIntegrity)); tempList.sort(Comparator.comparing(CylinderIntegrityDataDto::getIntegrity));
}); });
tempList.forEach(t -> { tempList.forEach(t -> {
System.out.println("====================unitName: " + t.getUnitName() + "============================"); System.out.println("====================unitName: " + t.getUnitName() + "============================");
t.setUpdateTime(new Date()); t.setUpdateTime(new Date());
cylinderIntegrityDataServiceImpl.createWithModel(t); cylinderIntegrityDataServiceImpl.createWithModel(t);
}); });
}); });
System.out.println("====================数据完整性结束============================"); System.out.println("====================数据完整性结束============================");
} }
/** /**
* 企业总量按区域统计 * 企业总量按区域统计
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "0 0 2 * * ?") @Scheduled(cron = "0 0 2 * * ?")
@SchedulerLock(name="cylinderUnitInfoTask",lockAtMostFor = "PT60M") @SchedulerLock(name = "cylinderUnitInfoTask", lockAtMostFor = "PT60M")
public void getCylinderUnitInfo() { public void getCylinderUnitInfo() {
cylinderUnitDataServiceImpl.remove(new LambdaQueryWrapper<CylinderUnitData>()); cylinderUnitDataServiceImpl.remove(new LambdaQueryWrapper<CylinderUnitData>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
String regionCode = String.valueOf(regionModel.getRegionCode()); String regionCode = String.valueOf(regionModel.getRegionCode());
Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(regionCode); Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(regionCode);
Integer thisMonthUnitTotal = cylinderUnitServiceImpl.getThisMonthUnitTotalByRegionCode(regionCode); Integer thisMonthUnitTotal = cylinderUnitServiceImpl.getThisMonthUnitTotalByRegionCode(regionCode);
Double lastUnitTotal = Double.valueOf(cylinderUnitServiceImpl.getLastMonthUnitTotal(regionCode)); Double lastUnitTotal = Double.valueOf(cylinderUnitServiceImpl.getLastMonthUnitTotal(regionCode));
Double monthUnitLastInfo = Double.valueOf(cylinderUnitServiceImpl.getMonthBeforeLastUnitTotal(regionCode)); Double monthUnitLastInfo = Double.valueOf(cylinderUnitServiceImpl.getMonthBeforeLastUnitTotal(regionCode));
double changeNum = thisMonthUnitTotal - lastUnitTotal; double changeNum = thisMonthUnitTotal - lastUnitTotal;
double percent = 0d; double percent = 0d;
if (monthUnitLastInfo != 0) { if (monthUnitLastInfo != 0) {
percent = (lastUnitTotal-monthUnitLastInfo) / monthUnitLastInfo; percent = (lastUnitTotal - monthUnitLastInfo) / monthUnitLastInfo;
BigDecimal bg = new BigDecimal(percent); BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
} else { } else {
percent = 0 ; percent = 0;
BigDecimal bg = new BigDecimal(percent); BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
} }
CylinderUnitDataDto temp = new CylinderUnitDataDto(); CylinderUnitDataDto temp = new CylinderUnitDataDto();
temp.setChangeSum((long) changeNum); temp.setChangeSum((long) changeNum);
temp.setChangePercent((int) (percent * 100) + ""); temp.setChangePercent((int) (percent * 100) + "");
temp.setRegionCode(regionCode); temp.setRegionCode(regionCode);
temp.setTotalSum((long) cylinderUnitTotal); temp.setTotalSum((long) cylinderUnitTotal);
temp.setUpdateTime(new Date()); temp.setUpdateTime(new Date());
cylinderUnitDataServiceImpl.createWithModel(temp); cylinderUnitDataServiceImpl.createWithModel(temp);
}); });
} }
/** /**
* 气瓶总量按区域统计 * 气瓶总量按区域统计
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "0 0 2 * * ?") @Scheduled(cron = "0 0 2 * * ?")
@SchedulerLock(name="cylinderInfoTask",lockAtMostFor = "PT6H") @SchedulerLock(name = "cylinderInfoTask", lockAtMostFor = "PT6H")
public void getCylinderInfo() { public void getCylinderInfo() {
cylinderInfoDataServiceImpl.remove(new LambdaQueryWrapper<>()); cylinderInfoDataServiceImpl.remove(new LambdaQueryWrapper<>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
CylinderInfoDataDto temp = new CylinderInfoDataDto(); CylinderInfoDataDto temp = new CylinderInfoDataDto();
String regionCode = String.valueOf(regionModel.getRegionCode()); String regionCode = String.valueOf(regionModel.getRegionCode());
Integer cylinderTotal = this.getInfoTotalByRegionCode(regionCode);// 当前总数 Integer cylinderTotal = this.getInfoTotalByRegionCode(regionCode);// 当前总数
Double InfoTotal = Double.valueOf(this.getMonthInfoTotal(regionCode)); Double InfoTotal = Double.valueOf(this.getMonthInfoTotal(regionCode));
Double lastInfoTotal = Double.valueOf(this.getLastMonthInfoTotal(regionCode));// 上月总数 Double lastInfoTotal = Double.valueOf(this.getLastMonthInfoTotal(regionCode));// 上月总数
Double monthBeforeLastInfo = Double.valueOf(this.getMonthBeforeLastInfoTotal(regionCode));// 上上月总数 Double monthBeforeLastInfo = Double.valueOf(this.getMonthBeforeLastInfoTotal(regionCode));// 上上月总数
double percent = 0d; double percent = 0d;
if (monthBeforeLastInfo != 0) { if (monthBeforeLastInfo != 0) {
percent = (lastInfoTotal - monthBeforeLastInfo) / monthBeforeLastInfo; percent = (lastInfoTotal - monthBeforeLastInfo) / monthBeforeLastInfo;
BigDecimal bg = new BigDecimal(percent); BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}else } else {
{ percent = 0;
percent = 0; BigDecimal bg = new BigDecimal(percent);
BigDecimal bg = new BigDecimal(percent); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); }
} temp.setChangeSum((long) (InfoTotal - lastInfoTotal));
temp.setChangeSum((long) (InfoTotal - lastInfoTotal)); temp.setChangePercent((int) (percent * 100) + "");
temp.setChangePercent((int) (percent * 100) + ""); temp.setRegionCode(regionCode);
temp.setRegionCode(regionCode); temp.setTotalSum((long) cylinderTotal);
temp.setTotalSum((long) cylinderTotal); cylinderInfoDataServiceImpl.createWithModel(temp);
cylinderInfoDataServiceImpl.createWithModel(temp); });
}); }
}
/**
/** * 按单位统计
* 按单位统计 */
*/ @Override
@Override @Transactional(rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class) @Scheduled(cron = "0 0 2 * * ?")
@Scheduled(cron = "0 0 2 * * ?") @SchedulerLock(name = "synUnitCylinderInfoDataTask", lockAtMostFor = "PT6H")
@SchedulerLock(name="synUnitCylinderInfoDataTask",lockAtMostFor = "PT6H") public void synUnitCylinderInfoData() {
public void synUnitCylinderInfoData() { cylinderInfoDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderInfoDataUnit>());
cylinderInfoDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderInfoDataUnit>()); countByUnit(cylinderUnit -> {
countByUnit(cylinderUnit -> { CylinderInfoDataUnitDto temp = new CylinderInfoDataUnitDto();
CylinderInfoDataUnitDto temp = new CylinderInfoDataUnitDto(); temp.setAppId(cylinderUnit.getAppId());
temp.setAppId(cylinderUnit.getAppId()); int count = this
int count = this .count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));// 当前总数
.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));// 当前总数 temp.setTotalSum((long) count);
temp.setTotalSum((long) count); Double month = Double.valueOf(baseMapper.getMonthInfoTotalUnit(cylinderUnit.getAppId()));
Double month = Double.valueOf(baseMapper.getMonthInfoTotalUnit(cylinderUnit.getAppId())); Double thismonth = Double.valueOf(baseMapper.getLastMonthInfoTotalUnit(cylinderUnit.getAppId()));// 上月总数
Double thismonth = Double.valueOf(baseMapper.getLastMonthInfoTotalUnit(cylinderUnit.getAppId()));// 上月总数 Double lastmonth = Double.valueOf(baseMapper.getMonthBeforeLastInfoTotalUnit(cylinderUnit.getAppId()));// 上上月总数
Double lastmonth = Double.valueOf(baseMapper.getMonthBeforeLastInfoTotalUnit(cylinderUnit.getAppId()));// 上上月总数 double percent = 0d;
double percent = 0d; if (lastmonth != 0) {
if (lastmonth != 0) { percent = (thismonth - lastmonth) / lastmonth;
percent = (thismonth - lastmonth) / lastmonth; BigDecimal bg = new BigDecimal(percent);
BigDecimal bg = new BigDecimal(percent); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); } else {
}else percent = 0;
{ BigDecimal bg = new BigDecimal(percent);
percent = 0; percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
BigDecimal bg = new BigDecimal(percent); }
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); temp.setChangeSum((long) (month - thismonth));
} temp.setChangePercent((int) (percent * 100) + "");
temp.setChangeSum((long) (month - thismonth)); cylinderInfoDataUnitServiceImpl.createWithModel(temp);
temp.setChangePercent((int) (percent * 100) + ""); });
cylinderInfoDataUnitServiceImpl.createWithModel(temp); }
});
} /**
* 充装量按单位和月统计
/** */
* 充装量按单位和月统计 @Override
*/ @Transactional(rollbackFor = Exception.class)
@Override @Scheduled(cron = "0 0 2 * * ?")
@Transactional(rollbackFor = Exception.class) @SchedulerLock(name = "synUnitCylinderFillingDataTask", lockAtMostFor = "PT6H")
@Scheduled(cron = "0 0 2 * * ?") public void synUnitCylinderFillingData() {
@SchedulerLock(name="synUnitCylinderFillingDataTask",lockAtMostFor = "PT6H") cylinderFillingDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingDataUnit>());
public void synUnitCylinderFillingData() { countByUnit(cylinderUnit -> {
cylinderFillingDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingDataUnit>()); // 按照月份 获取数据 取一年数据
countByUnit(cylinderUnit -> { Calendar calendar = Calendar.getInstance();
// 按照月份 获取数据 取一年数据 // 按月份获取充装量
Calendar calendar = Calendar.getInstance(); // 当月与上月 对比获取数据
// 按月份获取充装量 for (int i = 0; i < 12; i++) {
// 当月与上月 对比获取数据 // 获取当月数据
for (int i = 0; i < 12; i++) { CylinderFillingDataUnitDto temp = new CylinderFillingDataUnitDto();
// 获取当月数据 String year = calendar.get(Calendar.YEAR) + "";
CylinderFillingDataUnitDto temp = new CylinderFillingDataUnitDto(); int month = calendar.get(Calendar.MONTH) + 1;
String year = calendar.get(Calendar.YEAR) + ""; String monthStr = month < 10 ? "0" + month : month + "";
int month = calendar.get(Calendar.MONTH) + 1; temp.setFillingYear(year);
String monthStr = month < 10 ? "0" + month : month + ""; temp.setFillingMonth(monthStr);
temp.setFillingYear(year); temp.setFillingDate(year + "-" + monthStr);
temp.setFillingMonth(monthStr); // 本月
temp.setFillingDate(year+"-"+monthStr); Double thisMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(),
// 本月 calendar.getTime());
Double thisMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(), temp.setTotalSum(thisMonth);
calendar.getTime()); calendar.add(Calendar.MONTH, -1);
temp.setTotalSum(thisMonth); // 上月
calendar.add(Calendar.MONTH, -1); Double lastMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(),
// 上月 calendar.getTime());
Double lastMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(), double percent = 0d;
calendar.getTime()); if (lastMonth != 0) {
double percent = 0d; percent = (thisMonth - lastMonth) / lastMonth;
if (lastMonth != 0) { BigDecimal bg = new BigDecimal(percent);
percent = (thisMonth - lastMonth) / lastMonth; percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
BigDecimal bg = new BigDecimal(percent); }
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); temp.setChangePercent((int) (percent * 100) + "");
} temp.setAppId(cylinderUnit.getAppId());
temp.setChangePercent((int) (percent * 100) + ""); temp.setChangeSum(thisMonth - lastMonth);
temp.setAppId(cylinderUnit.getAppId()); cylinderFillingDataUnitServiceImpl.createWithModel(temp);
temp.setChangeSum(thisMonth - lastMonth); }
cylinderFillingDataUnitServiceImpl.createWithModel(temp); });
} }
});
} /**
* 按单位统计
/** */
* 按单位统计 @Override
*/ @Transactional(rollbackFor = Exception.class)
@Override @Scheduled(cron = "0 0 2 * * ?")
@Transactional(rollbackFor = Exception.class) @SchedulerLock(name = "synUnitCylinderTagsDataTask", lockAtMostFor = "PT6H")
@Scheduled(cron = "0 0 2 * * ?") public void synUnitCylinderTagsData() {
@SchedulerLock(name="synUnitCylinderTagsDataTask",lockAtMostFor = "PT6H") cylinderTagsDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderTagsDataUnit>());
public void synUnitCylinderTagsData() { countByUnit(cylinderUnit -> {
cylinderTagsDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderTagsDataUnit>()); CylinderTagsDataUnitDto temp = new CylinderTagsDataUnitDto();
countByUnit(cylinderUnit -> { temp.setAppId(cylinderUnit.getAppId());
CylinderTagsDataUnitDto temp = new CylinderTagsDataUnitDto(); int cylinder = this
temp.setAppId(cylinderUnit.getAppId()); .count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));
int cylinder = this int tags = cylinderTagsServiceImpl
.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId())); .count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, cylinderUnit.getAppId()));
int tags = cylinderTagsServiceImpl String percent = "";
.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, cylinderUnit.getAppId())); if (tags != 0) {
String percent = ""; double zz = (double) cylinder / (double) tags;
if (tags != 0) { DecimalFormat df = new DecimalFormat("##.00%");
double zz = (double) cylinder /(double) tags; if (Math.abs(zz) < 0.0000000000001) {
DecimalFormat df = new DecimalFormat("##.00%"); percent = "0.00%";
if (Math.abs(zz) < 0.0000000000001) { } else {
percent = "0.00%"; percent = df.format(zz);
} else { }
percent = df.format(zz); }
} temp.setCylinderSum((long) cylinder);
} temp.setTagsSum((long) tags);
temp.setCylinderSum((long) cylinder); temp.setTagPercent(percent);
temp.setTagsSum((long) tags); cylinderTagsDataUnitServiceImpl.createWithModel(temp);
temp.setTagPercent(percent); });
cylinderTagsDataUnitServiceImpl.createWithModel(temp); }
});
} /**
* 按单位统计
/** */
* 按单位统计 @Override
*/ @Transactional(rollbackFor = Exception.class)
@Override @Scheduled(cron = "0 0 2 * * ?")
@Transactional(rollbackFor = Exception.class) @SchedulerLock(name = "synUnitIntegrityDataTask", lockAtMostFor = "PT6H")
@Scheduled(cron = "0 0 2 * * ?") public void synUnitIntegrityData() {
@SchedulerLock(name="synUnitIntegrityDataTask",lockAtMostFor = "PT6H") cylinderIntegrityDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityDataUnit>());
public void synUnitIntegrityData() { countByUnit(cylinderUnit -> {
cylinderIntegrityDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityDataUnit>()); // 企业信息
countByUnit(cylinderUnit -> { CylinderIntegrityDataUnitDto uninInfo = new CylinderIntegrityDataUnitDto();
// 企业信息 uninInfo.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto uninInfo = new CylinderIntegrityDataUnitDto(); uninInfo.setDataType("企业信息");
uninInfo.setAppId(cylinderUnit.getAppId()); Double unitIntegirty = cylinderUnit.getIntegrity();
uninInfo.setDataType("企业信息"); uninInfo.setIntegrity(unitIntegirty);
Double unitIntegirty = cylinderUnit.getIntegrity(); cylinderIntegrityDataUnitServiceImpl.createWithModel(uninInfo);
uninInfo.setIntegrity(unitIntegirty); // 气瓶基本信息
cylinderIntegrityDataUnitServiceImpl.createWithModel(uninInfo); CylinderIntegrityDataUnitDto cylinderInfo = new CylinderIntegrityDataUnitDto();
// 气瓶基本信息 cylinderInfo.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderInfo = new CylinderIntegrityDataUnitDto(); cylinderInfo.setDataType("气瓶基本信息");
cylinderInfo.setAppId(cylinderUnit.getAppId()); Double cylinderIntegirty = this.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderInfo.setDataType("气瓶基本信息"); cylinderInfo.setIntegrity(cylinderIntegirty);
Double cylinderIntegirty = this.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInfo);
cylinderInfo.setIntegrity(cylinderIntegirty); // 气瓶标签信息
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInfo); CylinderIntegrityDataUnitDto cylinderTag = new CylinderIntegrityDataUnitDto();
// 气瓶标签信息 cylinderTag.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderTag = new CylinderIntegrityDataUnitDto(); cylinderTag.setDataType("气瓶标签信息");
cylinderTag.setAppId(cylinderUnit.getAppId()); Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderTag.setDataType("气瓶标签信息"); cylinderTag.setIntegrity(tagIntegirty);
Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderTag);
cylinderTag.setIntegrity(tagIntegirty); // 气瓶检验信息
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderTag); CylinderIntegrityDataUnitDto cylinderInspection = new CylinderIntegrityDataUnitDto();
// 气瓶检验信息 cylinderInspection.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderInspection = new CylinderIntegrityDataUnitDto(); cylinderInspection.setDataType("气瓶检验信息");
cylinderInspection.setAppId(cylinderUnit.getAppId()); cylinderInspection.setIntegrity(0d);
cylinderInspection.setDataType("气瓶检验信息"); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInspection);
cylinderInspection.setIntegrity(0d); // 充装前检查
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInspection); CylinderIntegrityDataUnitDto cylinderFilling = new CylinderIntegrityDataUnitDto();
// 充装前检查 cylinderFilling.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderFilling = new CylinderIntegrityDataUnitDto(); cylinderFilling.setDataType("充装前检查");
cylinderFilling.setAppId(cylinderUnit.getAppId()); Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderFilling.setDataType("充装前检查"); cylinderFilling.setIntegrity(fillingIntegirty);
Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderFilling);
cylinderFilling.setIntegrity(fillingIntegirty); // 充装信息
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderFilling); CylinderIntegrityDataUnitDto cylinderRecord = new CylinderIntegrityDataUnitDto();
// 充装信息 cylinderRecord.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderRecord = new CylinderIntegrityDataUnitDto(); cylinderRecord.setDataType("充装信息");
cylinderRecord.setAppId(cylinderUnit.getAppId()); Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderRecord.setDataType("充装信息"); cylinderRecord.setIntegrity(recordIntegirty);
Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderRecord);
cylinderRecord.setIntegrity(recordIntegirty); // 充装后复查
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderRecord); CylinderIntegrityDataUnitDto cylinderCheck = new CylinderIntegrityDataUnitDto();
// 充装后复查 cylinderCheck.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderCheck = new CylinderIntegrityDataUnitDto(); cylinderCheck.setDataType("充装后复查");
cylinderCheck.setAppId(cylinderUnit.getAppId()); Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderCheck.setDataType("充装后复查"); cylinderCheck.setIntegrity(checkIntegirty);
Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderCheck);
cylinderCheck.setIntegrity(checkIntegirty); });
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderCheck); }
});
} /**
* 充装详情按单位统计
/** */
* 充装详情按单位统计 @Override
*/ @Transactional(rollbackFor = Exception.class)
@Override @Scheduled(cron = "0 0 2 * * ?")
@Transactional(rollbackFor = Exception.class) @SchedulerLock(name = "synUnitFillingCheckDataTask", lockAtMostFor = "PT6H")
@Scheduled(cron = "0 0 2 * * ?") public void synUnitFillingCheckData() {
@SchedulerLock(name="synUnitFillingCheckDataTask",lockAtMostFor = "PT6H")
public void synUnitFillingCheckData() {
// cylinderFillingCheckDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingCheckDataUnit>()); // cylinderFillingCheckDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingCheckDataUnit>());
countByUnit(cylinderUnit -> { countByUnit(cylinderUnit -> {
List<CylinderFillingCheckDataUnitDto> allCylinderFillingCheckDataList = List<CylinderFillingCheckDataUnitDto> allCylinderFillingCheckDataList =
cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), null); cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), null);
// 按照月份 获取数据 取一年数据 // 按照月份 获取数据 取一年数据
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
// 第一次查询到该appId对应的统计数据为空,则计算过去一年12个月的数据统计 // 第一次查询到该appId对应的统计数据为空,则计算过去一年12个月的数据统计
if (ValidationUtil.isEmpty(allCylinderFillingCheckDataList)) { if (ValidationUtil.isEmpty(allCylinderFillingCheckDataList)) {
// 按月份获取充装量 // 按月份获取充装量
// 当月与上月 对比获取数据 // 当月与上月 对比获取数据
for (int i = 0; i < 12; i++) { for (int i = 0; i < 12; i++) {
// 获取当月数据 // 获取当月数据
CylinderFillingCheckDataUnitDto temp = new CylinderFillingCheckDataUnitDto(); CylinderFillingCheckDataUnitDto temp = new CylinderFillingCheckDataUnitDto();
calcCylinderFillingCheckDataUnitData(cylinderUnit, c, temp); calcCylinderFillingCheckDataUnitData(cylinderUnit, c, temp);
c.add(Calendar.MONTH, -1); c.add(Calendar.MONTH, -1);
cylinderFillingCheckDataUnitServiceImpl.createWithModel(temp); cylinderFillingCheckDataUnitServiceImpl.createWithModel(temp);
} }
} else { } else {
// 如果已经有该appId对应数据,则直接更新当前月的数据即可 // 如果已经有该appId对应数据,则直接更新当前月的数据即可
Calendar current = Calendar.getInstance(); Calendar current = Calendar.getInstance();
String year = current.get(Calendar.YEAR) + ""; String year = current.get(Calendar.YEAR) + "";
int month = current.get(Calendar.MONTH) + 1; int month = current.get(Calendar.MONTH) + 1;
String monthStr = month < 10 ? "0" + month : month + ""; String monthStr = month < 10 ? "0" + month : month + "";
List<CylinderFillingCheckDataUnitDto> existDataDtoList = List<CylinderFillingCheckDataUnitDto> existDataDtoList =
cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), year + "-" + monthStr); cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), year + "-" + monthStr);
CylinderFillingCheckDataUnitDto tempDto = new CylinderFillingCheckDataUnitDto(); CylinderFillingCheckDataUnitDto tempDto = new CylinderFillingCheckDataUnitDto();
if (!ValidationUtil.isEmpty(existDataDtoList) && !ValidationUtil.isEmpty(existDataDtoList.get(0))) { if (!ValidationUtil.isEmpty(existDataDtoList) && !ValidationUtil.isEmpty(existDataDtoList.get(0))) {
tempDto = existDataDtoList.get(0); tempDto = existDataDtoList.get(0);
calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto); calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto);
cylinderFillingCheckDataUnitServiceImpl.updateWithModel(tempDto); cylinderFillingCheckDataUnitServiceImpl.updateWithModel(tempDto);
} else if (ValidationUtil.isEmpty(existDataDtoList)) { } else if (ValidationUtil.isEmpty(existDataDtoList)) {
// 处理当前月第一天还没数据情况 // 处理当前月第一天还没数据情况
calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto); calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto);
cylinderFillingCheckDataUnitServiceImpl.createWithModel(tempDto); cylinderFillingCheckDataUnitServiceImpl.createWithModel(tempDto);
} }
} }
}); });
} }
/** /**
* 计算当前单位的充装检查数据统计 * 计算当前单位的充装检查数据统计
* *
* @param cylinderUnit * @param cylinderUnit
* @param calender * @param calender
* @param cylinderFillingCheckDataUnitDto * @param cylinderFillingCheckDataUnitDto
*/ */
public void calcCylinderFillingCheckDataUnitData(CylinderUnit cylinderUnit, Calendar calender, CylinderFillingCheckDataUnitDto cylinderFillingCheckDataUnitDto) { public void calcCylinderFillingCheckDataUnitData(CylinderUnit cylinderUnit, Calendar calender, CylinderFillingCheckDataUnitDto cylinderFillingCheckDataUnitDto) {
String year = calender.get(Calendar.YEAR) + ""; String year = calender.get(Calendar.YEAR) + "";
int month = calender.get(Calendar.MONTH) + 1; int month = calender.get(Calendar.MONTH) + 1;
String monthStr = month < 10 ? "0" + month : month + ""; String monthStr = month < 10 ? "0" + month : month + "";
cylinderFillingCheckDataUnitDto.setFillingMonth(monthStr); cylinderFillingCheckDataUnitDto.setFillingMonth(monthStr);
cylinderFillingCheckDataUnitDto.setFillingYear(year); cylinderFillingCheckDataUnitDto.setFillingYear(year);
cylinderFillingCheckDataUnitDto.setFillingDate(year + "-" + monthStr); cylinderFillingCheckDataUnitDto.setFillingDate(year + "-" + monthStr);
Integer countThisMonth = cylinderFillingRecordServiceImpl Integer countThisMonth = cylinderFillingRecordServiceImpl
.getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime());
cylinderFillingCheckDataUnitDto.setTotalSum((long) countThisMonth); cylinderFillingCheckDataUnitDto.setTotalSum((long) countThisMonth);
// 获取本月数据 // 获取本月数据
Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(),
calender.getTime()); calender.getTime());
Integer fillingCheckCount = cylinderFillingCheckServiceImpl Integer fillingCheckCount = cylinderFillingCheckServiceImpl
.getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime());
// 充装前检查率:充装前检查次数/充装次数 // 充装前检查率:充装前检查次数/充装次数
double before = 0d; double before = 0d;
if (countThisMonth != 0) { if (countThisMonth != 0) {
before = (double) (fillingCount) / (double) countThisMonth; before = (double) (fillingCount) / (double) countThisMonth;
} }
cylinderFillingCheckDataUnitDto.setFillingCount((long) fillingCount); cylinderFillingCheckDataUnitDto.setFillingCount((long) fillingCount);
cylinderFillingCheckDataUnitDto.setFillingPercent(before * 100); cylinderFillingCheckDataUnitDto.setFillingPercent(before * 100);
// 充装后检查率:充装后检查次数/充装次数 // 充装后检查率:充装后检查次数/充装次数
double after = 0d; double after = 0d;
if (countThisMonth != 0) { if (countThisMonth != 0) {
after = (double) (fillingCheckCount) / (double) countThisMonth; after = (double) (fillingCheckCount) / (double) countThisMonth;
} }
cylinderFillingCheckDataUnitDto.setFillingCheckCount((long) fillingCheckCount); cylinderFillingCheckDataUnitDto.setFillingCheckCount((long) fillingCheckCount);
cylinderFillingCheckDataUnitDto.setFillingCheckPercent(after * 100); cylinderFillingCheckDataUnitDto.setFillingCheckPercent(after * 100);
// 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数 // 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数
double passed = 0d; double passed = 0d;
// 充装前检查合格次数 // 充装前检查合格次数
Integer fillingPassedCount = cylinderFillingServiceImpl Integer fillingPassedCount = cylinderFillingServiceImpl
.getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime());
// 充装后检查合格次数 // 充装后检查合格次数
Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl
.getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime());
if (countThisMonth != 0) { if (countThisMonth != 0) {
passed = ((double) (fillingPassedCount) + (double) fillingCheckPassedCount) passed = ((double) (fillingPassedCount) + (double) fillingCheckPassedCount)
/ (double) (2 * countThisMonth); / (double) (2 * countThisMonth);
} }
cylinderFillingCheckDataUnitDto.setFillingPassedCount((long) (fillingPassedCount + fillingCheckPassedCount)); cylinderFillingCheckDataUnitDto.setFillingPassedCount((long) (fillingPassedCount + fillingCheckPassedCount));
cylinderFillingCheckDataUnitDto.setTotalSumDouble((long) 2 * countThisMonth); cylinderFillingCheckDataUnitDto.setTotalSumDouble((long) 2 * countThisMonth);
cylinderFillingCheckDataUnitDto.setFillingPassedPercent(passed * 100); cylinderFillingCheckDataUnitDto.setFillingPassedPercent(passed * 100);
cylinderFillingCheckDataUnitDto.setAppId(cylinderUnit.getAppId()); cylinderFillingCheckDataUnitDto.setAppId(cylinderUnit.getAppId());
} }
/** /**
* 充装量、卸液量按单位统计 * 充装量、卸液量按单位统计
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "0 0 2 * * ?") @Scheduled(cron = "0 0 2 * * ?")
@SchedulerLock(name="synFillingUnloadUnitDataTask",lockAtMostFor = "PT6H") @SchedulerLock(name = "synFillingUnloadUnitDataTask", lockAtMostFor = "PT6H")
public void synFillingUnloadUnitData() { public void synFillingUnloadUnitData() {
cylinderFillingUnloadDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadDataUnit>()); cylinderFillingUnloadDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadDataUnit>());
countByUnit(cylinderUnit -> { countByUnit(cylinderUnit -> {
Calendar now = Calendar.getInstance(); Calendar now = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
now.add(Calendar.DATE, -1); now.add(Calendar.DATE, -1);
CylinderFillingUnloadDataUnitDto temp = new CylinderFillingUnloadDataUnitDto(); CylinderFillingUnloadDataUnitDto temp = new CylinderFillingUnloadDataUnitDto();
Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSumByDate(cylinderUnit.getAppId(), Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSumByDate(cylinderUnit.getAppId(),
now.getTime()); now.getTime());
Double unloadSum = 0d; Double unloadSum = 0d;
temp.setFillingSum(fillingSum); temp.setFillingSum(fillingSum);
temp.setAppId(cylinderUnit.getAppId()); temp.setAppId(cylinderUnit.getAppId());
temp.setStatisDate(now.getTime()); temp.setStatisDate(now.getTime());
temp.setStatisDateStr(sdf.format(now.getTime())); temp.setStatisDateStr(sdf.format(now.getTime()));
temp.setUnloadSum(unloadSum); temp.setUnloadSum(unloadSum);
cylinderFillingUnloadDataUnitServiceImpl.createWithModel(temp); cylinderFillingUnloadDataUnitServiceImpl.createWithModel(temp);
} }
}); });
} }
@Scheduled(cron = "${tzs.cylinder.info.cron}") @Scheduled(cron = "${tzs.cylinder.info.cron}")
@SchedulerLock(name="cylinderInfoToESTask",lockAtMostFor = "PT6H") @SchedulerLock(name = "cylinderInfoToESTask", lockAtMostFor = "PT6H")
public void setTimeSaveCylinderInfoToES(){ public void setTimeSaveCylinderInfoToES() {
Page<CylinderInfoDto> cylinderInfoPage = new Page<>(); Page<CylinderInfoDto> cylinderInfoPage = new Page<>();
Page<CylinderInfoDto> cyinderInfoList = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage); Page<CylinderInfoDto> cyinderInfoList = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage);
Long count = cyinderInfoList.getCurrent(); Long count = cyinderInfoList.getCurrent();
Long times = 0L; Long times = 0L;
if (count != 0) { if (count != 0) {
times = count / 1000; times = count / 1000;
Long last = count % 1000; Long last = count % 1000;
if (last > 0) { if (last > 0) {
times++; times++;
} }
} }
for (int i = 0; i <= times; i++) { for (int i = 0; i <= times; i++) {
cylinderInfoPage.setCurrent(1); cylinderInfoPage.setCurrent(1);
cylinderInfoPage.setSize(1000); cylinderInfoPage.setSize(1000);
cylinderInfoPage = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage); cylinderInfoPage = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage);
if(!ObjectUtils.isEmpty(cylinderInfoPage)){ if (!ObjectUtils.isEmpty(cylinderInfoPage)) {
saveCylinderInfo2ES(cylinderInfoPage.getRecords()); saveCylinderInfo2ES(cylinderInfoPage.getRecords());
} }
// for (CylinderInfoDto ci : cylinderInfoPage.getRecords()) { // for (CylinderInfoDto ci : cylinderInfoPage.getRecords()) {
// saveCylinderInfoToES(ci); // saveCylinderInfoToES(ci);
// } // }
} }
} }
@Override @Override
public void saveCylinderInfo2ES(List<CylinderInfoDto> records) { public void saveCylinderInfo2ES(List<CylinderInfoDto> records) {
List<ESCylinderInfoDto> esCylinderInfoDto = new ArrayList<>(); List<ESCylinderInfoDto> esCylinderInfoDto = new ArrayList<>();
List<CylinderInfo> CylinderInfoList = new ArrayList<>(); List<CylinderInfo> CylinderInfoList = new ArrayList<>();
for (CylinderInfoDto record : records) { for (CylinderInfoDto record : records) {
ESCylinderInfoDto esCylinderInfo = new ESCylinderInfoDto(); ESCylinderInfoDto esCylinderInfo = new ESCylinderInfoDto();
BeanUtils.copyProperties(record,esCylinderInfo); BeanUtils.copyProperties(record, esCylinderInfo);
esCylinderInfoDto.add(esCylinderInfo); esCylinderInfoDto.add(esCylinderInfo);
CylinderInfo cylinderInfo = new CylinderInfo(); CylinderInfo cylinderInfo = new CylinderInfo();
BeanUtils.copyProperties(record,cylinderInfo); BeanUtils.copyProperties(record, cylinderInfo);
cylinderInfo.setSequenceNbr(record.getSequenceNbr()); cylinderInfo.setSequenceNbr(record.getSequenceNbr());
cylinderInfo.setIsNotEs("1"); cylinderInfo.setIsNotEs("1");
CylinderInfoList.add(cylinderInfo); CylinderInfoList.add(cylinderInfo);
} }
esCylinderInfoRepository.saveAll(esCylinderInfoDto); esCylinderInfoRepository.saveAll(esCylinderInfoDto);
this.updateBatchById(CylinderInfoList); this.updateBatchById(CylinderInfoList);
} }
@Override @Override
public Integer getInfoTotal() { public Integer getInfoTotal() {
return cylinderInfoMapper.getInfoTotal(); return cylinderInfoMapper.getInfoTotal();
} }
@Override @Override
public ESCylinderInfoDto saveCylinderInfoToES(CylinderInfoDto ci) { public ESCylinderInfoDto saveCylinderInfoToES(CylinderInfoDto ci) {
ESCylinderInfoDto esCylinderInfoDto = new ESCylinderInfoDto(); ESCylinderInfoDto esCylinderInfoDto = new ESCylinderInfoDto();
BeanUtils.copyProperties(ci,esCylinderInfoDto); BeanUtils.copyProperties(ci, esCylinderInfoDto);
ESCylinderInfoDto saveResult = esCylinderInfoRepository.save(esCylinderInfoDto); ESCylinderInfoDto saveResult = esCylinderInfoRepository.save(esCylinderInfoDto);
if(!ObjectUtils.isEmpty(saveResult)){ if (!ObjectUtils.isEmpty(saveResult)) {
//同步到es后修改 //同步到es后修改
CylinderInfo cylinderInfo = new CylinderInfo(); CylinderInfo cylinderInfo = new CylinderInfo();
cylinderInfo.setIsNotEs("1"); cylinderInfo.setIsNotEs("1");
cylinderInfoMapper.update(cylinderInfo, new QueryWrapper<CylinderInfo>().eq("sequence_nbr", ci.getSequenceNbr())); cylinderInfoMapper.update(cylinderInfo, new QueryWrapper<CylinderInfo>().eq("sequence_nbr", ci.getSequenceNbr()));
} }
return saveResult; return saveResult;
} }
@Override @Override
public Page<ESCylinderInfoDto> queryByKeys(CylinderInfoDto cylinderInfoDto, int pageNum, int pageSize) { public Page<ESCylinderInfoDto> queryByKeys(CylinderInfoDto cylinderInfoDto, int pageNum, int pageSize) {
Page<ESCylinderInfoDto> result = new Page<ESCylinderInfoDto>(pageNum, pageSize); Page<ESCylinderInfoDto> result = new Page<ESCylinderInfoDto>(pageNum, pageSize);
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); SearchRequest request = new SearchRequest();
credentialsProvider.setCredentials(AuthScope.ANY, request.indices("cylinder_info");
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient =new RestHighLevelClient( //通用匹配规则,条件构建
RestClient.builder( boolean flag = true;
new HttpHost(esAddress,esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() { SearchSourceBuilder builder = new SearchSourceBuilder();
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) { BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider); //匹配统一信用代码
} if (!ObjectUtils.isEmpty(cylinderInfoDto.getCreditCode())) {
}) flag = false;
); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchQuery("creditCode", cylinderInfoDto.getCreditCode()));
boolMust.must(meBuilder);
}
// RestHighLevelClient esClient = new RestHighLevelClient(
// RestClient.builder(new HttpHost(esAddress, esPort, "http")) //匹配RegionCode
// ); if (!ObjectUtils.isEmpty(cylinderInfoDto.getRegionCode())) {
flag = false;
BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery();
SearchRequest request = new SearchRequest(); appIdBuilder.must(QueryBuilders.matchQuery("regionCode", "*" + cylinderInfoDto.getRegionCode() + "*"));
request.indices("cylinder_info"); boolMust.should(appIdBuilder);
}
//通用匹配规则,条件构建
boolean flag = true; //匹配appid
if (!ObjectUtils.isEmpty(cylinderInfoDto.getAppId())) {
SearchSourceBuilder builder = new SearchSourceBuilder(); flag = false;
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery();
appIdBuilder.must(QueryBuilders.matchQuery("appId", "*" + cylinderInfoDto.getAppId() + "*"));
//匹配统一信用代码 boolMust.should(appIdBuilder);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getCreditCode())) { }
flag = false;
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); //匹配产权单位
meBuilder.must(QueryBuilders.matchQuery("creditCode", cylinderInfoDto.getCreditCode())); if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitName())) {
boolMust.must(meBuilder); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("unitName", "*" + cylinderInfoDto.getUnitName() + "*"));
//匹配RegionCode boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getRegionCode())) { }
flag = false;
BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery(); //匹配出厂编号
appIdBuilder.must(QueryBuilders.matchQuery("regionCode", "*" + cylinderInfoDto.getRegionCode() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getFactoryNum())) {
boolMust.should(appIdBuilder); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("factoryNum", "*" + cylinderInfoDto.getFactoryNum() + "*"));
//匹配appid boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getAppId())) { }
flag = false;
BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery(); //匹配气瓶品种
appIdBuilder.must(QueryBuilders.matchQuery("appId", "*" + cylinderInfoDto.getAppId() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderVariety())) {
boolMust.should(appIdBuilder); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("cylinderVariety", cylinderInfoDto.getCylinderVariety()));
//匹配产权单位 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitName())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //匹配二维码编码
query.must(QueryBuilders.matchQuery("unitName", "*" + cylinderInfoDto.getUnitName() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getQrCode())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("qrCode", "*" + cylinderInfoDto.getQrCode() + "*"));
//匹配出厂编号 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getFactoryNum())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //匹配电子标签
query.must(QueryBuilders.matchQuery("factoryNum", "*" + cylinderInfoDto.getFactoryNum() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getElectronicLabelCode())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("electronicLabelCode", "*" + cylinderInfoDto.getElectronicLabelCode() + "*"));
//匹配气瓶品种 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderVariety())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //匹配气瓶唯一标识
query.must(QueryBuilders.matchQuery("cylinderVariety", cylinderInfoDto.getCylinderVariety())); if (!ObjectUtils.isEmpty(cylinderInfoDto.getSequenceCode())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder sequenceCodeBuilder = QueryBuilders.boolQuery();
sequenceCodeBuilder.must(QueryBuilders.matchQuery("sequenceCode", cylinderInfoDto.getSequenceCode()));
//匹配二维码编码 boolMust.must(sequenceCodeBuilder);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getQrCode())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //匹配单位内部编号
query.must(QueryBuilders.matchQuery("qrCode", "*" + cylinderInfoDto.getQrCode() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitInnerCode())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("unitInnerCode", "*" + cylinderInfoDto.getUnitInnerCode() + "*"));
//匹配电子标签 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getElectronicLabelCode())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //气瓶状态
query.must(QueryBuilders.matchQuery("electronicLabelCode", "*" + cylinderInfoDto.getElectronicLabelCode() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderStatus())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("cylinderStatus", cylinderInfoDto.getCylinderStatus()));
//匹配气瓶唯一标识 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getSequenceCode())) { }
flag = false;
BoolQueryBuilder sequenceCodeBuilder = QueryBuilders.boolQuery(); //制造单位
sequenceCodeBuilder.must(QueryBuilders.matchQuery("sequenceCode", cylinderInfoDto.getSequenceCode())); if (!ObjectUtils.isEmpty(cylinderInfoDto.getManufacturingUnit())) {
boolMust.must(sequenceCodeBuilder); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("manufacturingUnit", "*" + cylinderInfoDto.getManufacturingUnit() + "*"));
//匹配单位内部编号 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitInnerCode())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //检验日期
query.must(QueryBuilders.matchQuery("unitInnerCode", "*" + cylinderInfoDto.getUnitInnerCode() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateStart()) && !ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateEnd())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.rangeQuery("inspectionDate").from(cylinderInfoDto.getInspectionDateStart()).to(cylinderInfoDto.getInspectionDateEnd()));
//气瓶状态 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderStatus())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); if (flag) { // 搜索全部
query.must(QueryBuilders.matchQuery("cylinderStatus", cylinderInfoDto.getCylinderStatus())); boolMust.must(QueryBuilders.matchAllQuery());
boolMust.must(query); }
}
builder.query(boolMust);
//制造单位 builder.from((pageNum - 1) * pageSize);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getManufacturingUnit())) { builder.size(pageSize);
flag = false; builder.trackTotalHits(true);
BoolQueryBuilder query = QueryBuilders.boolQuery(); request.source(builder);
query.must(QueryBuilders.matchQuery("manufacturingUnit", "*" + cylinderInfoDto.getManufacturingUnit() + "*")); List<ESCylinderInfoDto> list = new LinkedList<>();
boolMust.must(query); long totle = 0;
} try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
//检验日期 for (org.elasticsearch.search.SearchHit hit : response.getHits()) {
if (!ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateStart()) && !ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateEnd())) { JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
flag = false; ESCylinderInfoDto esCylinderInfoDto = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderInfoDto.class);
BoolQueryBuilder query = QueryBuilders.boolQuery(); list.add(esCylinderInfoDto);
query.must(QueryBuilders.rangeQuery("inspectionDate").from(cylinderInfoDto.getInspectionDateStart()).to(cylinderInfoDto.getInspectionDateEnd())); }
boolMust.must(query); totle = response.getInternalResponse().hits().getTotalHits().value;
} result.setRecords(list);
result.setTotal(totle);
if(flag) { // 搜索全部 } catch (IOException e) {
boolMust.must(QueryBuilders.matchAllQuery()); throw new RuntimeException(e);
} } finally {
try {
builder.query(boolMust); restHighLevelClient.close();
builder.from((pageNum - 1) * pageSize); } catch (Exception e) {
builder.size(pageSize); throw new RuntimeException(e);
builder.trackTotalHits(true); }
request.source(builder); }
List<ESCylinderInfoDto> list = new LinkedList<>();
long totle = 0; return result;
try { }
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits()) {
System.out.println(hit); /**
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); * 根据月份统计
ESCylinderInfoDto esCylinderInfoDto = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderInfoDto.class); */
list.add(esCylinderInfoDto); private void countByMonth(IntConsumer consumer) {
} for (int i = 0; i < 12; i++) {
totle = response.getInternalResponse().hits().getTotalHits().value; consumer.accept(i);
result.setRecords(list); }
result.setTotal(totle); }
} catch (IOException e) {
throw new RuntimeException(e); /**
} * 根据单位统计
*/
return result; private void countByUnit(Consumer<CylinderUnit> consumer) {
} List<CylinderUnit> units = cylinderUnitServiceImpl.list();
units.forEach(consumer);
}
/**
* 根据区域统计
/** */
* 根据月份统计 private void countByRegion(Consumer<RegionModel> consumer) {
*/ List<RegionModel> regionList = new ArrayList<>();
private void countByMonth(IntConsumer consumer) { startPlatformTokenService.getToken();
for (int i = 0; i < 12; i++) { Collection<RegionModel> regions = Systemctl.regionClient.queryForTree(null).getResult();
consumer.accept(i); regions.forEach(regionModel -> convertTreeToList(regionList, regionModel));
} regionList.forEach(consumer);
} }
/** /**
* 根据单位统计 * 将区域树转为区域List列表
*/ */
private void countByUnit(Consumer<CylinderUnit> consumer) { private void convertTreeToList(List<RegionModel> regionList, RegionModel region) {
List<CylinderUnit> units = cylinderUnitServiceImpl.list(); regionList.add(region);
units.forEach(consumer); if (region.getChildren() != null) {
} region.getChildren().forEach(c -> {
convertTreeToList(regionList, c);
/** });
* 根据区域统计 }
*/ }
private void countByRegion(Consumer<RegionModel> consumer) {
List<RegionModel> regionList = new ArrayList<>(); public Integer getOverDateStatisticsNumber(String earlyWarningLevel) {
startPlatformTokenService.getToken(); return this.baseMapper.countOverDateNumber(earlyWarningLevel);
Collection<RegionModel> regions = Systemctl.regionClient.queryForTree(null).getResult(); }
regions.forEach(regionModel -> convertTreeToList(regionList, regionModel));
regionList.forEach(consumer); public Page<CylinderInfoDto> earlyWarningLevelPageList(Page<CylinderInfoDto> page, String earlyWarningLevel) {
} Page<CylinderInfoDto> result = this.baseMapper.queryPageListByEarlyWarningLevel(page, earlyWarningLevel);
result.getRecords().forEach(r -> {
/**
* 将区域树转为区域List列表
*/
private void convertTreeToList(List<RegionModel> regionList, RegionModel region) {
regionList.add(region);
if (region.getChildren() != null) {
region.getChildren().forEach(c -> {
convertTreeToList(regionList, c);
});
}
}
public Integer getOverDateStatisticsNumber(String earlyWarningLevel) {
return this.baseMapper.countOverDateNumber(earlyWarningLevel);
}
public Page<CylinderInfoDto> earlyWarningLevelPageList(Page<CylinderInfoDto> page, String earlyWarningLevel) {
Page<CylinderInfoDto> result = this.baseMapper.queryPageListByEarlyWarningLevel(page, earlyWarningLevel);
result.getRecords().forEach(r -> {
// r.setEarlyWarningLevelName(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getName()); // r.setEarlyWarningLevelName(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getName());
// r.setInspectionStatusDesc(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getStatus()); // r.setInspectionStatusDesc(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getStatus());
}); });
return result; return result;
} }
public void calEarlyWarningLevel() { public void calEarlyWarningLevel() {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("气瓶超期预警时间调用规则开始"); log.debug("气瓶超期预警时间调用规则开始");
} }
// 1.批量分组大小 // 1.批量分组大小
int size = 500; int size = 500;
int total = this.count(); int total = this.count();
int groupNumber = total / size + 1; int groupNumber = total / size + 1;
// 2.批量小分组处理数据,调用规则 // 2.批量小分组处理数据,调用规则
for (int i = 0; i < groupNumber; i++) { for (int i = 0; i < groupNumber; i++) {
Page<CylinderInfo> page = new Page<>(); Page<CylinderInfo> page = new Page<>();
page.setCurrent(i); page.setCurrent(i);
page.setSize(size); page.setSize(size);
LambdaQueryWrapper<CylinderInfo> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CylinderInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.select(CylinderInfo::getSequenceCode, CylinderInfo::getSequenceNbr) wrapper.select(CylinderInfo::getSequenceCode, CylinderInfo::getSequenceNbr)
.orderByDesc(CylinderInfo::getSequenceNbr); .orderByDesc(CylinderInfo::getSequenceNbr);
IPage<CylinderInfo> result = this.page(page, wrapper); IPage<CylinderInfo> result = this.page(page, wrapper);
for (CylinderInfo r : result.getRecords()) { for (CylinderInfo r : result.getRecords()) {
// 设置token // 设置token
tzsAuthService.setRequestContext(); tzsAuthService.setRequestContext();
// 调用规则 // 调用规则
this.touchRuleToCalLevel(r); this.touchRuleToCalLevel(r);
} }
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("气瓶超期预警时间调用规则完成"); log.debug("气瓶超期预警时间调用规则完成");
} }
} }
private void touchRuleToCalLevel(CylinderInfo r) { private void touchRuleToCalLevel(CylinderInfo r) {
Date now = new Date(); Date now = new Date();
String dateStr; String dateStr;
try { try {
dateStr = DateUtils.dateFormat(now, DateUtils.DATE_TIME_PATTERN); dateStr = DateUtils.dateFormat(now, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) { } catch (ParseException e) {
throw new RuntimeException("日期个时候失败"); throw new RuntimeException("日期个时候失败");
} }
// 1.气瓶详情 // 1.气瓶详情
CylinderInfoDto cylinderInfoDto = this.getDetail(r.getSequenceCode()); CylinderInfoDto cylinderInfoDto = this.getDetail(r.getSequenceCode());
try { try {
WarningMsgDto warningMsgDto = new WarningMsgDto(); WarningMsgDto warningMsgDto = new WarningMsgDto();
int interval = DateUtils.dateBetweenIncludeToday(now, cylinderInfoDto.getNextInspectionDate()) - 1; int interval = DateUtils.dateBetweenIncludeToday(now, cylinderInfoDto.getNextInspectionDate()) - 1;
warningMsgDto.setNum(String.valueOf(interval)); warningMsgDto.setNum(String.valueOf(interval));
warningMsgDto.setFactoryNum(cylinderInfoDto.getFactoryNum()); warningMsgDto.setFactoryNum(cylinderInfoDto.getFactoryNum());
// warningMsgDto.setUserType(cylinderInfoDto.getCustomType()); // warningMsgDto.setUserType(cylinderInfoDto.getCustomType());
// warningMsgDto.setUserPeople(cylinderInfoDto.getCustomName()); // warningMsgDto.setUserPeople(cylinderInfoDto.getCustomName());
// warningMsgDto.setUserPeoplePhone(cylinderInfoDto.getContactPhone()); // warningMsgDto.setUserPeoplePhone(cylinderInfoDto.getContactPhone());
warningMsgDto.setCode(cylinderInfoDto.getSequenceCode()); warningMsgDto.setCode(cylinderInfoDto.getSequenceCode());
warningMsgDto.setCompanyName(cylinderInfoDto.getUnitName()); warningMsgDto.setCompanyName(cylinderInfoDto.getUnitName());
warningMsgDto.setPhone(cylinderInfoDto.getPersonMobilePhone()); warningMsgDto.setPhone(cylinderInfoDto.getPersonMobilePhone());
warningMsgDto.setPeople(cylinderInfoDto.getUnitPerson()); warningMsgDto.setPeople(cylinderInfoDto.getUnitPerson());
warningMsgDto.setCurrentTime(dateStr); warningMsgDto.setCurrentTime(dateStr);
// 2.循环调用规则 触发计算等级及发送消息 // 2.循环调用规则 触发计算等级及发送消息
if (log.isInfoEnabled()) { if (log.isInfoEnabled()) {
log.info("调用规则对象!+:{}", JSON.toJSONString(warningMsgDto)); log.info("调用规则对象!+:{}", JSON.toJSONString(warningMsgDto));
} }
ruleTrigger.publish(warningMsgDto, packageId, null); ruleTrigger.publish(warningMsgDto, packageId, null);
} catch (Exception e) { } catch (Exception e) {
log.error("调用规则失败!:{},{}", JSON.toJSONString(cylinderInfoDto), e); log.error("调用规则失败!:{},{}", JSON.toJSONString(cylinderInfoDto), e);
} }
} }
public CylinderInfoDto getDetail(String sequenceCode) { public CylinderInfoDto getDetail(String sequenceCode) {
CylinderInfoDto dto = scheduleMapper.getCylDetail(sequenceCode); CylinderInfoDto dto = scheduleMapper.getCylDetail(sequenceCode);
dto.setInspectionStatusDesc(StringUtils.isNotEmpty(dto.getEarlyWarningLevel()) dto.setInspectionStatusDesc(StringUtils.isNotEmpty(dto.getEarlyWarningLevel())
? EarlyWarningLevelEnum.getEumByLevel(dto.getEarlyWarningLevel()).getStatus() ? EarlyWarningLevelEnum.getEumByLevel(dto.getEarlyWarningLevel()).getStatus()
: ""); : "");
return dto; return dto;
} }
public List<MsgLog> getMsgList(String sequenceCode, String terminalType) { public List<MsgLog> getMsgList(String sequenceCode, String terminalType) {
LambdaQueryWrapper<MsgLog> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<MsgLog> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MsgLog::getRelationCode, sequenceCode); wrapper.eq(MsgLog::getRelationCode, sequenceCode);
wrapper.eq(StringUtils.isNotEmpty(terminalType), MsgLog::getTerminalType, terminalType); wrapper.eq(StringUtils.isNotEmpty(terminalType), MsgLog::getTerminalType, terminalType);
wrapper.orderByDesc(MsgLog::getSendTime); wrapper.orderByDesc(MsgLog::getSendTime);
return msgLogService.list(wrapper); return msgLogService.list(wrapper);
} }
/** /**
* 更新气瓶等级 * 更新气瓶等级
* *
* @param sequenceCode 唯一表设 * @param sequenceCode 唯一表设
* @param level 等级 * @param level 等级
* @return CylinderInfo * @return CylinderInfo
*/ */
public CylinderInfo updateEarlyWarningLevel(String sequenceCode, String level) { public CylinderInfo updateEarlyWarningLevel(String sequenceCode, String level) {
CylinderInfo cylinderInfo = this CylinderInfo cylinderInfo = this
.getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, sequenceCode)); .getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, sequenceCode));
cylinderInfo.setEarlyWarningLevel(level); cylinderInfo.setEarlyWarningLevel(level);
cylinderInfo.setEarlyWarningLevelCalDate(new Date()); cylinderInfo.setEarlyWarningLevelCalDate(new Date());
this.updateById(cylinderInfo); this.updateById(cylinderInfo);
return cylinderInfo; return cylinderInfo;
} }
public Boolean nextInspectionDateUpdate(List<CylinderInfoDto> cylinderInfoDtos) { public Boolean nextInspectionDateUpdate(List<CylinderInfoDto> cylinderInfoDtos) {
// 1.更新下次检验日期 // 1.更新下次检验日期
List<CylinderInfo> cylinderInfos = new ArrayList<>(); List<CylinderInfo> cylinderInfos = new ArrayList<>();
cylinderInfoDtos.forEach(c -> { cylinderInfoDtos.forEach(c -> {
CylinderInfo cylinderInfo = this.getOne( CylinderInfo cylinderInfo = this.getOne(
new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, c.getSequenceCode())); new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, c.getSequenceCode()));
// cylinderInfo.setNextInspectionDate(c.getNextInspectionDate()); // cylinderInfo.setNextInspectionDate(c.getNextInspectionDate());
cylinderInfos.add(cylinderInfo); cylinderInfos.add(cylinderInfo);
}); });
if (!cylinderInfos.isEmpty()) { if (!cylinderInfos.isEmpty()) {
this.updateBatchById(cylinderInfos); this.updateBatchById(cylinderInfos);
} }
// 2.循环调用规则 触发计算等级及发送消息 // 2.循环调用规则 触发计算等级及发送消息
cylinderInfos.forEach(this::touchRuleToCalLevel); cylinderInfos.forEach(this::touchRuleToCalLevel);
return Boolean.TRUE; return Boolean.TRUE;
} }
public Page<CylinderInfoDto> cyinderInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort,List<String> appids){ public Page<CylinderInfoDto> cyinderInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort, List<String> appids) {
return cylinderInfoMapper.cyinderInfoList(page,cylinderInfoDto,sort,appids); return cylinderInfoMapper.cyinderInfoList(page, cylinderInfoDto, sort, appids);
} }
public Page<CylinderInfoDto> getCyinderInfoList(Page<CylinderInfoDto> page) { public Page<CylinderInfoDto> getCyinderInfoList(Page<CylinderInfoDto> page) {
return cylinderInfoMapper.getCyinderInfoList(page); return cylinderInfoMapper.getCyinderInfoList(page);
} }
public Page<CylinderInfoDto> cyinderOutInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort,List<String> appids){ public Page<CylinderInfoDto> cyinderOutInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort, List<String> appids) {
return cylinderInfoMapper.cyinderOutInfoList(page,cylinderInfoDto,sort,appids); return cylinderInfoMapper.cyinderOutInfoList(page, cylinderInfoDto, sort, appids);
} }
} }
\ No newline at end of file
#DB properties: #DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=cn.com.vastbase.Driver
spring.datasource.url=jdbc:mysql://36.46.151.113:23306/tzs_amos_tzs_biz_init?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.datasource.url=jdbc:vastbase://192.168.249.180:54321/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=Yeejoin@2020 spring.datasource.password=Yeejoin@2023
eureka.client.service-url.defaultZone=http://192.168.249.13:10001/eureka/,http://192.168.249.139:10001/eureka/
#eureka properties: eureka.instance.prefer-ip-address=true
eureka.instance.hostname= eureka eureka.instance.ip-address=192.168.249.13
eureka.instance.prefer-ip-address = true management.endpoint.health.show-details=always
eureka.client.serviceUrl.defaultZone =http://36.46.151.113:10001/eureka/ management.endpoints.web.exposure.include=*
eureka.instance.ip-address = 172.16.3.133 eureka.instance.health-check-url=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/doc.html
## ES properties: ## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=docker-cluster
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username=elastic elasticsearch.username=elastic
elasticsearch.password=123456 elasticsearch.password=Yeejoin@2023
spring.elasticsearch.rest.uris=http://192.168.249.218:9200,http://192.168.249.114:9200,http://192.168.249.155:9200
## unit(h) ## unit(h)
alertcall.es.synchrony.time=48 alertcall.es.synchrony.time=48
#redis properties: #redis properties:
spring.redis.database=1 #集群环境
spring.redis.host=36.46.151.113 spring.redis.cluster.nodes=192.168.249.218:6377,192.168.249.114:6377,192.168.249.155:6377
spring.redis.port=16379 spring.redis.password=Yeejoin@2023
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200 spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1 spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=300
## emqx properties: ## emqx properties:
emqx.clean-session=false emqx.clean-session=false
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://36.46.151.113:1883 emqx.broker=tcp://192.168.249.180:2883
emqx.user-name=super emqx.user-name=super
emqx.password=123456 emqx.password=123456
emqx.keepAliveInterval=1000 emqx.keepAliveInterval=1000
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4 tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.46.151.113:8000 tzs.cti.url=http://36.41.172.83:8000
##wechatTokenls
##wechatToken
tzs.wechat.token=yeejoin_2021 tzs.wechat.token=yeejoin_2021
##wechatTicketUrl ##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token= tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
#tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw #tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
...@@ -61,41 +50,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html ...@@ -61,41 +50,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
#tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU #tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti cti.user.name=tzs_cti
cti.user.pwd=a1234567 cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001 flc.sms.tempCode=SMS_TZS_0001
## ??????id
## \u9884\u8B66\u901A\u77E5\u6A21\u677Fid
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##\u7763\u67E5\u6574\u6539\u901A\u77E5 ##??????
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## ???????id???userId?
## \u516C\u4F17\u53F7\u6D4B\u8BD5\u7528\u6237id\uFF08\u5E73\u53F0userId\uFF09
tzs.wechat.test.userId=3413513 tzs.wechat.test.userId=3413513
##new properties
fileserver.domain=https://rpm.yeeamos.com:8888/
org.filter.group.seq=1564150103147573249 org.filter.group.seq=1564150103147573249
fileserver.domain=http://192.168.249.180:19000/
log.level=INFO
duty.seats.role.ids=1585956200472674305,1585956257590706177 duty.seats.role.ids=1585956200472674305,1585956257590706177
## ???? properties:
rule.definition.load=false
##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto
rule.definition.default-agency=tzs
rule.definition.local-ip=192.168.249.13
#\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.fill.cron=0 0 12 * * ?
#\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.info.cron=0 0 1 * * ?
# ??????????
minio.url.path=http://192.168.249.180:19000/
## 生成监管码前缀域名
regulatory_code_prefix=https://nav.sspai.top/tzs?code=
outSystem.user.password=a1234560
amos.system.user.app-key=AMOS_STUDIO
amos.system.user.product=STUDIO_APP_WEB
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.10.90:53306/tzs_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://172.16.3.99:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.99:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.99:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.99:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=172.16.10.90
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic
elasticsearch.password= Yeejoin@2020
## unit(h)
alertcall.es.synchrony.time=48
fileserver.domain=https://rpm.yeeamos.com:8888/
#redis properties:
spring.redis.database=1
spring.redis.host=172.16.10.90
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.90:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://172.16.10.90:8000
rule.definition.load=false
rule.definition.model-package=com.yeejoin.amos.boot.module.cylinder.api.dto
rule.definition.default-agency=tzs
rule.definition.localIp=172.16.3.39
org.filter.group.seq=1564150103147573249
duty.seats.role.ids=1585956200472674305,1585956257590706177
\ No newline at end of file
#DB properties: #DB properties:
spring.datasource.driver-class-name=cn.com.vastbase.Driver spring.datasource.driver-class-name=cn.com.vastbase.Driver
spring.datasource.url=jdbc:vastbase://36.46.137.116:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true spring.datasource.url=jdbc:vastbase://36.46.137.116:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true
#spring.datasource.url=jdbc:vastbase://36.46.151.113:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz
spring.datasource.username=admin spring.datasource.username=admin
spring.datasource.password=Yeejoin@2023 spring.datasource.password=Yeejoin@2023
eureka.client.service-url.defaultZone=http://172.16.10.230:10001/eureka/
#DB properties:
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.url=jdbc:mysql://172.16.10.230:53306/${TZS_BIZ_DATABASE}?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
#spring.datasource.username=${MYSQL_ROOT_USER}
#spring.datasource.password=${MYSQL_ROOT_PASSWORD}
#eureka prioperties:
#eureka.client.serviceUrl.defaultZone=http://172.16.10.230:10001/eureka/
#eureka.client.register-with-eureka=true
#eureka.client.fetch-registry=true
#eureka.client.healthcheck.enabled=true
#ribbon.eureka.enabled=true
#eureka.instance.hostname=${spring.cloud.client.ip-address}
#eureka.instance.prefer-ip-address=true
#eureka.instance.instance-id=${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
#eureka.instance.lease-expiration-duration-in-seconds=10
#eureka.instance.lease-renewal-interval-in-seconds=5
#management.endpoint.health.show-details=always
#management.endpoints.web.exposure.include=*
#
#eureka.instance.prefer-ip-address = true
#eureka.instance.ip-address = 172.16.10.230
eureka.client.service-url.defaultZone =http://172.16.10.230:10001/eureka/
eureka.instance.prefer-ip-address=true eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=* management.endpoints.web.exposure.include=*
...@@ -36,25 +11,13 @@ eureka.instance.health-check-url=http://172.16.3.34:${server.port}${server.servl ...@@ -36,25 +11,13 @@ eureka.instance.health-check-url=http://172.16.3.34:${server.port}${server.servl
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.34:${server.port}${server.servlet.context-path}/actuator/info eureka.instance.status-page-url=http://172.16.3.34:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.34:${server.port}${server.servlet.context-path}/doc.html eureka.instance.metadata-map.management.api-docs=http://172.16.3.34:${server.port}${server.servlet.context-path}/doc.html
eureka.instance.ip-address=172.16.3.34
eureka.instance.ip-address = 172.16.3.34
## ES properties: ## ES properties:
biz.elasticsearch.port=9200 elasticsearch.username=elastic
biz.elasticsearch.address=172.16.10.230 elasticsearch.password=a123456
spring.data.elasticsearch.cluster-name=docker-cluster spring.elasticsearch.rest.uris=http:/172.16.10.230:9200
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic
elasticsearch.password= a123456
## unit(h) ## unit(h)
alertcall.es.synchrony.time=48 alertcall.es.synchrony.time=48
#redis properties: #redis properties:
spring.redis.database=1 spring.redis.database=1
spring.redis.host=172.16.10.230 spring.redis.host=172.16.10.230
...@@ -65,7 +28,6 @@ spring.redis.lettuce.pool.max-wait=-1 ...@@ -65,7 +28,6 @@ spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=300
## emqx properties: ## emqx properties:
emqx.clean-session=false emqx.clean-session=false
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
...@@ -73,20 +35,13 @@ emqx.broker=tcp://36.46.151.113:1883 ...@@ -73,20 +35,13 @@ emqx.broker=tcp://36.46.151.113:1883
emqx.user-name=super emqx.user-name=super
emqx.password=123456 emqx.password=123456
emqx.keepAliveInterval=1000 emqx.keepAliveInterval=1000
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4 tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.41.172.83:8000 tzs.cti.url=http://36.41.172.83:8000
##wechatToken ##wechatToken
tzs.wechat.token=yeejoin_2021 tzs.wechat.token=yeejoin_2021
##wechatTicketUrl ##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token= tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
#tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw #tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
...@@ -96,67 +51,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html ...@@ -96,67 +51,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
#tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU #tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti cti.user.name=tzs_cti
cti.user.pwd=a1234567 cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001 flc.sms.tempCode=SMS_TZS_0001
## ??????id ## ??????id
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##?????? ##??????
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## ???????id???userId? ## ???????id???userId?
tzs.wechat.test.userId=3413513 tzs.wechat.test.userId=3413513
##new properties ##new properties
org.filter.group.seq=1564150103147573249 org.filter.group.seq=1564150103147573249
fileserver.domain=http://172.16.10.230:19000/ fileserver.domain=http://172.16.10.230:19000/
log.level=INFO log.level=INFO
duty.seats.role.ids=1585956200472674305,1585956257590706177 duty.seats.role.ids=1585956200472674305,1585956257590706177
## ???? properties: ## ???? properties:
rule.definition.load=false rule.definition.load=false
##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto ##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto
rule.definition.default-agency=tzs rule.definition.default-agency=tzs
rule.definition.local-ip=172.16.10.230 rule.definition.local-ip=172.16.10.230
#\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es #\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.fill.cron=0 0 12 * * ? tzs.cylinder.fill.cron=0 0 12 * * ?
#\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es #\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.info.cron=0 0 1 * * ? tzs.cylinder.info.cron=0 0 1 * * ?
# ?????????? # ??????????
minio.url.path=http://172.16.10.230:9000/ minio.url.path=http://172.16.10.230:9000/
## ɼǰ׺ ## ɼǰ׺
regulatory_code_prefix=https://nav.sspai.top/tzs?code= regulatory_code_prefix=https://nav.sspai.top/tzs?code=
outSystem.user.password=a1234560 outSystem.user.password=a1234560
amos.system.user.app-key=AMOS_STUDIO amos.system.user.app-key=AMOS_STUDIO
amos.system.user.product=STUDIO_APP_WEB amos.system.user.product=STUDIO_APP_WEB
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://113.134.211.174:3306/xiy_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://172.16.3.28:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.28:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.28:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://192.168.1.10:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
## unit(h)
alertcall.es.synchrony.time=48
#redis properties:
spring.redis.database=1
spring.redis.host=172.16.3.28
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.3.28:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://113.134.211.174:8000
rule.definition.load=false
rule.definition.model-package=com.yeejoin.amos.boot.module.cylinder.api.dto
rule.definition.default-agency=tzs
rule.definition.localIp=172.16.3.39
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://36.46.151.113:13306/tzs_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://36.46.151.113:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
## unit(h)
alertcall.es.synchrony.time=48
#redis properties:
spring.redis.database=1
spring.redis.host=36.46.151.113
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://36.46.151.113:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://113.134.211.174:8000
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名--> <!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/96333.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern> <FileNamePattern>${LOG_HOME}/Tcm.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<MaxHistory>30</MaxHistory> <MaxHistory>30</MaxHistory>
<!--日志文件大小--> <!--日志文件大小-->
...@@ -37,20 +37,20 @@ ...@@ -37,20 +37,20 @@
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" /> <logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
--> -->
<!--myibatis log configure--> <!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/> <logger name="com.apache.ibatis" level="debug"/>
<logger name="org.mybatis" level="INFO" /> <logger name="org.mybatis" level="debug" />
<logger name="java.sql.Connection" level="INFO"/> <logger name="java.sql.Connection" level="debug"/>
<logger name="java.sql.Statement" level="INFO"/> <logger name="java.sql.Statement" level="debug"/>
<logger name="java.sql.PreparedStatement" level="INFO"/> <logger name="java.sql.PreparedStatement" level="debug"/>
<logger name="org.springframework" level="INFO"/> <logger name="org.springframework" level="debug"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/> <logger name="com.baomidou.mybatisplus" level="debug"/>
<logger name="org.apache.activemq" level="INFO"/> <logger name="org.apache.activemq" level="debug"/>
<logger name="org.typroject" level="INFO"/> <logger name="org.typroject" level="debug"/>
<logger name="com.yeejoin" level="INFO"/> <logger name="com.yeejoin" level="debug"/>
<!-- 日志输出级别 --> <!-- 日志输出级别 -->
<root level="DEBUG"> <root level="error">
<!-- <appender-ref ref="FILE" /> --> <!-- <appender-ref ref="FILE" /> -->
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
<!-- <appender-ref ref="ELK" />--> <!-- <appender-ref ref="ELK" />-->
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/cylinder.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- ELK管理 -->
<appender name="ELK" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>172.16.10.230:4560</destination>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/>
<logger name="org.mybatis" level="INFO" />
<logger name="java.sql.Connection" level="INFO"/>
<logger name="java.sql.Statement" level="INFO"/>
<logger name="java.sql.PreparedStatement" level="INFO"/>
<logger name="org.springframework" level="INFO"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="INFO"/>
<logger name="com.yeejoin" level="INFO"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<!-- <appender-ref ref="FILE" /> -->
<appender-ref ref="STDOUT" />
<!-- <appender-ref ref="ELK" />-->
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/cylinder.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="org.mybatis" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<logger name="com.baomidou.mybatisplus" level="DEBUG"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/cylinder.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="org.mybatis" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<logger name="com.baomidou.mybatisplus" level="DEBUG"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
package com.yeejoin.amos.boot.module.jczs.biz.config; package com.yeejoin.amos.boot.module.jczs.biz.config;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope; import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider; import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder; import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
...@@ -16,6 +13,8 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -16,6 +13,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration @Configuration
public class ElasticSearchClientConfig { public class ElasticSearchClientConfig {
...@@ -28,34 +27,25 @@ public class ElasticSearchClientConfig { ...@@ -28,34 +27,25 @@ public class ElasticSearchClientConfig {
private String password; private String password;
@Bean @Bean
@Qualifier("highLevelClient")
public RestHighLevelClient restHighLevelClient() { public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password)); new UsernamePasswordCredentials(username, password));
try { try {
String url = uris.replace("http://", ""); HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
final String[] parts = StringUtils.split(url, ":"); RestClientBuilder builder = RestClient.builder(httpHosts);
HttpHost httpHost = new HttpHost(parts[0], Integer.parseInt(parts[1]), "http"); builder.setHttpClientConfigCallback(httpClientBuilder -> {
RestClientBuilder builder = RestClient.builder(httpHost); httpClientBuilder.disableAuthCaching();
builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() { return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
@Override });
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) { // 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
httpClientBuilder.disableAuthCaching(); builder.setRequestConfigCallback(requestConfigBuilder -> {
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider); // 连接超时(默认为1秒)
} return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
}); });
builder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
@Override
public RequestConfig.Builder customizeRequestConfig(
RequestConfig.Builder requestConfigBuilder) {
return requestConfigBuilder.setConnectTimeout(5000 * 1000) // 连接超时(默认为1秒)
.setSocketTimeout(6000 * 1000);// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
}
});// 调整最大重试超时时间(默认为30秒).setMaxRetryTimeoutMillis(60000);
return new RestHighLevelClient(builder); return new RestHighLevelClient(builder);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -89,6 +89,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -89,6 +89,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Autowired @Autowired
EquipmentCategoryMapper equipmentCategoryMapper; EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
RestHighLevelClient restHighLevelClient;
@Value("classpath:/json/equipCategory.json") @Value("classpath:/json/equipCategory.json")
private Resource equipCategory; private Resource equipCategory;
...@@ -148,18 +151,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -148,18 +151,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//一码通复制功能url参数key //一码通复制功能url参数key
private static final String COPY_KEY = "stashType"; private static final String COPY_KEY = "stashType";
@Value("${biz.elasticsearch.address}")
private String esAddress;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Value("${elasticsearch.username}")
private String esUserName;
@Value("${elasticsearch.password}")
private String esPwd;
private static String USE_CODE = "use_code"; private static String USE_CODE = "use_code";
private static String ORG_BRANCH_CODE = "supervise_org_code"; private static String ORG_BRANCH_CODE = "supervise_org_code";
...@@ -1200,11 +1191,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1200,11 +1191,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return save; return save;
} }
public Page<JSONObject> queryByKeys(JSONObject map) { public Page<JSONObject> queryByKeys(JSONObject map) {
//根据当前登录人查询 // //根据当前登录人查询
if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) { if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) {
map.put(EQUSTATE, EquimentEnum.getCode.get(map.get(EQUSTATE).toString()).toString()); map.put(EQUSTATE, EquimentEnum.getCode.get(map.get(EQUSTATE).toString()).toString());
} }
ResponseModel<Page<Map<String, Object>>> model = new ResponseModel<>();
JSONObject object = getCompanyType().get(0); JSONObject object = getCompanyType().get(0);
String level = object.getString("level"); String level = object.getString("level");
String code = object.getString("orgCode"); String code = object.getString("orgCode");
...@@ -1219,19 +1209,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1219,19 +1209,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
} }
Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size")); Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size"));
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient = new RestHighLevelClient(
RestClient.builder(
new HttpHost(esAddress, esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
})
);
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all"); request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
...@@ -1329,7 +1306,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1329,7 +1306,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
List<JSONObject> list = new LinkedList<>(); List<JSONObject> list = new LinkedList<>();
long totle = 0; long totle = 0;
try { try {
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT); SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits().getHits()) { for (org.elasticsearch.search.SearchHit hit : response.getHits().getHits()) {
System.out.println(hit); System.out.println(hit);
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
...@@ -1348,7 +1325,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1348,7 +1325,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
throw new RuntimeException(e); throw new RuntimeException(e);
} finally { } finally {
try { try {
esClient.close(); restHighLevelClient.close();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
...@@ -10,24 +10,15 @@ import com.yeejoin.amos.boot.module.jczs.flc.api.dto.CylinderFillingRecordDto; ...@@ -10,24 +10,15 @@ import com.yeejoin.amos.boot.module.jczs.flc.api.dto.CylinderFillingRecordDto;
import com.yeejoin.amos.boot.module.jczs.flc.api.entity.CylinderFillingRecord; import com.yeejoin.amos.boot.module.jczs.flc.api.entity.CylinderFillingRecord;
import com.yeejoin.amos.boot.module.jczs.flc.api.mapper.CylinderFillingRecordMapper; import com.yeejoin.amos.boot.module.jczs.flc.api.mapper.CylinderFillingRecordMapper;
import com.yeejoin.amos.boot.module.jczs.flc.api.service.ICylinderFillingRecordService; import com.yeejoin.amos.boot.module.jczs.flc.api.service.ICylinderFillingRecordService;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -55,17 +46,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -55,17 +46,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Autowired @Autowired
CylinderFillingRecordMapper cylinderFillingRecordMapper; CylinderFillingRecordMapper cylinderFillingRecordMapper;
@Value("${biz.elasticsearch.address}") @Autowired
private String esAddress; RestHighLevelClient restHighLevelClient;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Value("${elasticsearch.username}")
private String esUserName;
@Value("${elasticsearch.password}")
private String esPwd;
/** /**
* 分页查询 * 分页查询
...@@ -127,7 +109,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -127,7 +109,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Scheduled(cron = "${tzs.cylinder.fill.cron}") @Scheduled(cron = "${tzs.cylinder.fill.cron}")
public void setTimeSaveCylinderInfoToES(){ public void setTimeSaveCylinderInfoToES() {
Page<ESCylinderFillingRecordDto> cylinderFillingRecordPage = new Page<>(); Page<ESCylinderFillingRecordDto> cylinderFillingRecordPage = new Page<>();
Page<ESCylinderFillingRecordDto> cyinderInfoList = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage); Page<ESCylinderFillingRecordDto> cyinderInfoList = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage);
Long count = cyinderInfoList.getCurrent(); Long count = cyinderInfoList.getCurrent();
...@@ -143,10 +125,10 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -143,10 +125,10 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
cylinderFillingRecordPage.setCurrent(i); cylinderFillingRecordPage.setCurrent(i);
cylinderFillingRecordPage.setSize(1000); cylinderFillingRecordPage.setSize(1000);
cylinderFillingRecordPage = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage); cylinderFillingRecordPage = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage);
if(!ObjectUtils.isEmpty(cylinderFillingRecordPage)){ if (!ObjectUtils.isEmpty(cylinderFillingRecordPage)) {
cylinderFillingRecordPage.getRecords().stream().map(item->{ cylinderFillingRecordPage.getRecords().stream().map(item -> {
if(!ObjectUtils.isEmpty(item.getSequenceCode())){ if (!ObjectUtils.isEmpty(item.getSequenceCode())) {
ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(),item.getSequenceCode()); ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode());
item.setUnitName(cyinderFillingRecordInfo.getUnitName()); item.setUnitName(cyinderFillingRecordInfo.getUnitName());
item.setFactoryNum(cyinderFillingRecordInfo.getFactoryNum()); item.setFactoryNum(cyinderFillingRecordInfo.getFactoryNum());
item.setCylinderVariety(cyinderFillingRecordInfo.getCylinderVariety()); item.setCylinderVariety(cyinderFillingRecordInfo.getCylinderVariety());
...@@ -164,7 +146,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -164,7 +146,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
// for (ESCylinderFillingRecordDto ci : cylinderFillingRecordPage.getRecords()) { // for (ESCylinderFillingRecordDto ci : cylinderFillingRecordPage.getRecords()) {
// saveCylinderFillingRecordToES(ci); // saveCylinderFillingRecordToES(ci);
// } // }
if(!ObjectUtils.isEmpty(cylinderFillingRecordPage)){ if (!ObjectUtils.isEmpty(cylinderFillingRecordPage)) {
saveCylinderFillingRecord2ES(cylinderFillingRecordPage.getRecords()); saveCylinderFillingRecord2ES(cylinderFillingRecordPage.getRecords());
} }
} }
...@@ -174,7 +156,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -174,7 +156,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Override @Override
public Page<ESCylinderFillingRecordDto> getCyinderFillingRecord(Page<ESCylinderFillingRecordDto> cylinderFillingRecordDto) { public Page<ESCylinderFillingRecordDto> getCyinderFillingRecord(Page<ESCylinderFillingRecordDto> cylinderFillingRecordDto) {
Page<ESCylinderFillingRecordDto> cyinderFillingRecord = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordDto); Page<ESCylinderFillingRecordDto> cyinderFillingRecord = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordDto);
if(!ObjectUtils.isEmpty(cyinderFillingRecord)){ if (!ObjectUtils.isEmpty(cyinderFillingRecord)) {
cyinderFillingRecord.getRecords().stream().map(item -> { cyinderFillingRecord.getRecords().stream().map(item -> {
if (!ObjectUtils.isEmpty(item.getSequenceCode())) { if (!ObjectUtils.isEmpty(item.getSequenceCode())) {
ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode()); ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode());
...@@ -202,26 +184,6 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -202,26 +184,6 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
public Page<ESCylinderFillingRecordDto> queryByKeys(ESCylinderFillingRecordDto esCylinderFillingRecordDto, int pageNum, int pageSize) { public Page<ESCylinderFillingRecordDto> queryByKeys(ESCylinderFillingRecordDto esCylinderFillingRecordDto, int pageNum, int pageSize) {
Page<ESCylinderFillingRecordDto> result = new Page<ESCylinderFillingRecordDto>(pageNum, pageSize); Page<ESCylinderFillingRecordDto> result = new Page<ESCylinderFillingRecordDto>(pageNum, pageSize);
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient =new RestHighLevelClient(
RestClient.builder(
new HttpHost(esAddress,esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
})
);
// RestHighLevelClient esClient = new RestHighLevelClient(
// RestClient.builder(new HttpHost(esAddress, esPort, "http"))
// );
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("cylinder_filling"); request.indices("cylinder_filling");
...@@ -328,7 +290,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -328,7 +290,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
boolMust.must(query); boolMust.must(query);
} }
if(flag) { // 搜索全部 if (flag) { // 搜索全部
boolMust.must(QueryBuilders.matchAllQuery()); boolMust.must(QueryBuilders.matchAllQuery());
} }
...@@ -340,9 +302,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -340,9 +302,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
List<ESCylinderFillingRecordDto> list = new LinkedList<>(); List<ESCylinderFillingRecordDto> list = new LinkedList<>();
long totle = 0; long totle = 0;
try { try {
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT); SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits()) { for (org.elasticsearch.search.SearchHit hit : response.getHits()) {
System.out.println(hit);
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
ESCylinderFillingRecordDto esCylinderFillingRecordDto1 = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderFillingRecordDto.class); ESCylinderFillingRecordDto esCylinderFillingRecordDto1 = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderFillingRecordDto.class);
list.add(esCylinderFillingRecordDto1); list.add(esCylinderFillingRecordDto1);
...@@ -352,6 +313,12 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -352,6 +313,12 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
result.setTotal(totle); result.setTotal(totle);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} finally {
try {
restHighLevelClient.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
} }
return result; return result;
...@@ -362,7 +329,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -362,7 +329,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
List<CylinderFillingRecord> cylinderFillingRecordList = new ArrayList<>(); List<CylinderFillingRecord> cylinderFillingRecordList = new ArrayList<>();
for (ESCylinderFillingRecordDto record : records) { for (ESCylinderFillingRecordDto record : records) {
CylinderFillingRecord cylinderFillingRecord = new CylinderFillingRecord(); CylinderFillingRecord cylinderFillingRecord = new CylinderFillingRecord();
BeanUtils.copyProperties(record,cylinderFillingRecord); BeanUtils.copyProperties(record, cylinderFillingRecord);
cylinderFillingRecord.setIsNotEs("1"); cylinderFillingRecord.setIsNotEs("1");
cylinderFillingRecord.setSequenceNbr(record.getSequenceNbr()); cylinderFillingRecord.setSequenceNbr(record.getSequenceNbr());
cylinderFillingRecordList.add(cylinderFillingRecord); cylinderFillingRecordList.add(cylinderFillingRecord);
......
...@@ -25,17 +25,9 @@ import com.yeejoin.amos.feign.systemctl.Systemctl; ...@@ -25,17 +25,9 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
...@@ -136,18 +128,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -136,18 +128,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
@Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}") @Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}")
private String cylPackageId; private String cylPackageId;
@Value("${biz.elasticsearch.address}") @Autowired
private String esAddress; RestHighLevelClient restHighLevelClient;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Value("${elasticsearch.username}")
private String esUserName;
@Value("${elasticsearch.password}")
private String esPwd;
@Autowired @Autowired
StartPlatformTokenService startPlatformTokenService; StartPlatformTokenService startPlatformTokenService;
...@@ -760,27 +742,6 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -760,27 +742,6 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
public Page<ESCylinderInfoDto> queryByKeys(CylinderInfoDto cylinderInfoDto, int pageNum, int pageSize) { public Page<ESCylinderInfoDto> queryByKeys(CylinderInfoDto cylinderInfoDto, int pageNum, int pageSize) {
Page<ESCylinderInfoDto> result = new Page<ESCylinderInfoDto>(pageNum, pageSize); Page<ESCylinderInfoDto> result = new Page<ESCylinderInfoDto>(pageNum, pageSize);
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient =new RestHighLevelClient(
RestClient.builder(
new HttpHost(esAddress,esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
})
);
// RestHighLevelClient esClient = new RestHighLevelClient(
// RestClient.builder(new HttpHost(esAddress, esPort, "http"))
// );
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("cylinder_info"); request.indices("cylinder_info");
...@@ -906,9 +867,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -906,9 +867,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
List<ESCylinderInfoDto> list = new LinkedList<>(); List<ESCylinderInfoDto> list = new LinkedList<>();
long totle = 0; long totle = 0;
try { try {
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT); SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits()) { for (org.elasticsearch.search.SearchHit hit : response.getHits()) {
System.out.println(hit);
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
ESCylinderInfoDto esCylinderInfoDto = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderInfoDto.class); ESCylinderInfoDto esCylinderInfoDto = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderInfoDto.class);
list.add(esCylinderInfoDto); list.add(esCylinderInfoDto);
...@@ -918,6 +878,12 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -918,6 +878,12 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
result.setTotal(totle); result.setTotal(totle);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
}finally {
try {
restHighLevelClient.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
} }
return result; return result;
......
#DB properties: #DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=cn.com.vastbase.Driver
spring.datasource.url=jdbc:mysql://36.46.151.113:23306/tzs_amos_tzs_biz_init?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.datasource.url=jdbc:vastbase://192.168.249.180:54321/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=Yeejoin@2020 spring.datasource.password=Yeejoin@2023
eureka.client.service-url.defaultZone=http://192.168.249.13:10001/eureka/,http://192.168.249.139:10001/eureka/
#eureka properties: eureka.instance.prefer-ip-address=true
eureka.instance.hostname= eureka eureka.instance.ip-address=192.168.249.13
eureka.instance.prefer-ip-address = true management.endpoint.health.show-details=always
eureka.client.serviceUrl.defaultZone =http://36.46.151.113:10001/eureka/ management.endpoints.web.exposure.include=*
eureka.instance.ip-address = 172.16.3.133 eureka.instance.health-check-url=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/doc.html
## ES properties: ## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=docker-cluster
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username=elastic elasticsearch.username=elastic
elasticsearch.password=123456 elasticsearch.password=Yeejoin@2023
spring.elasticsearch.rest.uris=http://192.168.249.218:9200,http://192.168.249.114:9200,http://192.168.249.155:9200
## unit(h) ## unit(h)
alertcall.es.synchrony.time=48 alertcall.es.synchrony.time=48
#redis properties: #redis properties:
spring.redis.database=1 #集群环境
spring.redis.host=36.46.151.113 spring.redis.cluster.nodes=192.168.249.218:6377,192.168.249.114:6377,192.168.249.155:6377
spring.redis.port=16379 spring.redis.password=Yeejoin@2023
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200 spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1 spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=300
## emqx properties: ## emqx properties:
emqx.clean-session=false emqx.clean-session=false
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://36.46.151.113:1883 emqx.broker=tcp://192.168.249.180:2883
emqx.user-name=super emqx.user-name=super
emqx.password=123456 emqx.password=123456
emqx.keepAliveInterval=1000 emqx.keepAliveInterval=1000
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4 tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.46.151.113:8000 tzs.cti.url=http://36.41.172.83:8000
##wechatTokenls
##wechatToken
tzs.wechat.token=yeejoin_2021 tzs.wechat.token=yeejoin_2021
##wechatTicketUrl ##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token= tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
#tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw #tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
...@@ -61,41 +50,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html ...@@ -61,41 +50,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
#tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU #tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti cti.user.name=tzs_cti
cti.user.pwd=a1234567 cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001 flc.sms.tempCode=SMS_TZS_0001
## ??????id
## \u9884\u8B66\u901A\u77E5\u6A21\u677Fid
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##\u7763\u67E5\u6574\u6539\u901A\u77E5 ##??????
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## ???????id???userId?
## \u516C\u4F17\u53F7\u6D4B\u8BD5\u7528\u6237id\uFF08\u5E73\u53F0userId\uFF09
tzs.wechat.test.userId=3413513 tzs.wechat.test.userId=3413513
##new properties
fileserver.domain=https://rpm.yeeamos.com:8888/
org.filter.group.seq=1564150103147573249 org.filter.group.seq=1564150103147573249
fileserver.domain=http://192.168.249.180:19000/
log.level=INFO
duty.seats.role.ids=1585956200472674305,1585956257590706177 duty.seats.role.ids=1585956200472674305,1585956257590706177
## ???? properties:
rule.definition.load=false
##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto
rule.definition.default-agency=tzs
rule.definition.local-ip=192.168.249.13
#\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.fill.cron=0 0 12 * * ?
#\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.info.cron=0 0 1 * * ?
# ??????????
minio.url.path=http://192.168.249.180:19000/
## 生成监管码前缀域名
regulatory_code_prefix=https://nav.sspai.top/tzs?code=
outSystem.user.password=a1234560
amos.system.user.app-key=AMOS_STUDIO
amos.system.user.product=STUDIO_APP_WEB
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.10.90:53306/tzs_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://172.16.3.99:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.99:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.99:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.99:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=172.16.10.90
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic
elasticsearch.password= Yeejoin@2020
## unit(h)
alertcall.es.synchrony.time=48
fileserver.domain=https://rpm.yeeamos.com:8888/
#redis properties:
spring.redis.database=1
spring.redis.host=172.16.10.90
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.90:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://172.16.10.90:8000
rule.definition.load=false
rule.definition.model-package=com.yeejoin.amos.boot.module.jczs.api.dto
rule.definition.default-agency=tzs
rule.definition.localIp=172.16.3.39
org.filter.group.seq=1564150103147573249
duty.seats.role.ids=1585956200472674305,1585956257590706177
\ No newline at end of file
#DB properties: #DB properties:
spring.datasource.driver-class-name=cn.com.vastbase.Driver spring.datasource.driver-class-name=cn.com.vastbase.Driver
spring.datasource.url=jdbc:vastbase://36.46.137.116:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true spring.datasource.url=jdbc:vastbase://36.46.137.116:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true
#spring.datasource.url=jdbc:vastbase://36.46.151.113:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz
spring.datasource.username=admin spring.datasource.username=admin
spring.datasource.password=Yeejoin@2023 spring.datasource.password=Yeejoin@2023
eureka.client.service-url.defaultZone=http://172.16.10.230:10001/eureka/
#DB properties:
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.url=jdbc:mysql://172.16.10.230:53306/${TZS_BIZ_DATABASE}?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
#spring.datasource.username=${MYSQL_ROOT_USER}
#spring.datasource.password=${MYSQL_ROOT_PASSWORD}
#eureka prioperties:
#eureka.client.serviceUrl.defaultZone=http://172.16.10.230:10001/eureka/
#eureka.client.register-with-eureka=true
#eureka.client.fetch-registry=true
#eureka.client.healthcheck.enabled=true
#ribbon.eureka.enabled=true
#eureka.instance.hostname=${spring.cloud.client.ip-address}
#eureka.instance.prefer-ip-address=true
#eureka.instance.instance-id=${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
#eureka.instance.lease-expiration-duration-in-seconds=10
#eureka.instance.lease-renewal-interval-in-seconds=5
#management.endpoint.health.show-details=always
#management.endpoints.web.exposure.include=*
#
#eureka.instance.prefer-ip-address = true
#eureka.instance.ip-address = 172.16.10.230
eureka.client.service-url.defaultZone =http://172.16.10.230:10001/eureka/
eureka.instance.prefer-ip-address=true eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=* management.endpoints.web.exposure.include=*
...@@ -36,25 +11,13 @@ eureka.instance.health-check-url=http://172.16.3.34:${server.port}${server.servl ...@@ -36,25 +11,13 @@ eureka.instance.health-check-url=http://172.16.3.34:${server.port}${server.servl
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.34:${server.port}${server.servlet.context-path}/actuator/info eureka.instance.status-page-url=http://172.16.3.34:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.34:${server.port}${server.servlet.context-path}/doc.html eureka.instance.metadata-map.management.api-docs=http://172.16.3.34:${server.port}${server.servlet.context-path}/doc.html
eureka.instance.ip-address=172.16.3.34
eureka.instance.ip-address = 172.16.3.34
## ES properties: ## ES properties:
biz.elasticsearch.port=9200 elasticsearch.username=elastic
biz.elasticsearch.address=172.16.10.230 elasticsearch.password=a123456
spring.data.elasticsearch.cluster-name=docker-cluster spring.elasticsearch.rest.uris=http:/172.16.10.230:9200
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic
elasticsearch.password= a123456
## unit(h) ## unit(h)
alertcall.es.synchrony.time=48 alertcall.es.synchrony.time=48
#redis properties: #redis properties:
spring.redis.database=1 spring.redis.database=1
spring.redis.host=172.16.10.230 spring.redis.host=172.16.10.230
...@@ -65,7 +28,6 @@ spring.redis.lettuce.pool.max-wait=-1 ...@@ -65,7 +28,6 @@ spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=300
## emqx properties: ## emqx properties:
emqx.clean-session=false emqx.clean-session=false
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
...@@ -73,20 +35,13 @@ emqx.broker=tcp://36.46.151.113:1883 ...@@ -73,20 +35,13 @@ emqx.broker=tcp://36.46.151.113:1883
emqx.user-name=super emqx.user-name=super
emqx.password=123456 emqx.password=123456
emqx.keepAliveInterval=1000 emqx.keepAliveInterval=1000
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4 tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.41.172.83:8000 tzs.cti.url=http://36.41.172.83:8000
##wechatToken ##wechatToken
tzs.wechat.token=yeejoin_2021 tzs.wechat.token=yeejoin_2021
##wechatTicketUrl ##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token= tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
#tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw #tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
...@@ -96,67 +51,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html ...@@ -96,67 +51,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
#tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU #tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti cti.user.name=tzs_cti
cti.user.pwd=a1234567 cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001 flc.sms.tempCode=SMS_TZS_0001
## ??????id ## ??????id
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##?????? ##??????
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## ???????id???userId? ## ???????id???userId?
tzs.wechat.test.userId=3413513 tzs.wechat.test.userId=3413513
##new properties ##new properties
org.filter.group.seq=1564150103147573249 org.filter.group.seq=1564150103147573249
fileserver.domain=http://172.16.10.230:19000/ fileserver.domain=http://172.16.10.230:19000/
log.level=INFO log.level=INFO
duty.seats.role.ids=1585956200472674305,1585956257590706177 duty.seats.role.ids=1585956200472674305,1585956257590706177
## ???? properties: ## ???? properties:
rule.definition.load=false rule.definition.load=false
##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto ##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto
rule.definition.default-agency=tzs rule.definition.default-agency=tzs
rule.definition.local-ip=172.16.10.230 rule.definition.local-ip=172.16.10.230
#\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es #\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.fill.cron=0 0 12 * * ? tzs.cylinder.fill.cron=0 0 12 * * ?
#\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es #\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.info.cron=0 0 1 * * ? tzs.cylinder.info.cron=0 0 1 * * ?
# ?????????? # ??????????
minio.url.path=http://172.16.10.230:9000/ minio.url.path=http://172.16.10.230:9000/
## ɼǰ׺ ## ɼǰ׺
regulatory_code_prefix=https://nav.sspai.top/tzs?code= regulatory_code_prefix=https://nav.sspai.top/tzs?code=
outSystem.user.password=a1234560 outSystem.user.password=a1234560
amos.system.user.app-key=AMOS_STUDIO amos.system.user.app-key=AMOS_STUDIO
amos.system.user.product=STUDIO_APP_WEB amos.system.user.product=STUDIO_APP_WEB
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://113.134.211.174:3306/xiy_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://172.16.3.28:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.28:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.28:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://192.168.1.10:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
## unit(h)
alertcall.es.synchrony.time=48
#redis properties:
spring.redis.database=1
spring.redis.host=172.16.3.28
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.3.28:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://113.134.211.174:8000
rule.definition.load=false
rule.definition.model-package=com.yeejoin.amos.boot.module.jczs.api.dto
rule.definition.default-agency=tzs
rule.definition.localIp=172.16.3.39
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://36.46.151.113:13306/tzs_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://36.46.151.113:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
## unit(h)
alertcall.es.synchrony.time=48
#redis properties:
spring.redis.database=1
spring.redis.host=36.46.151.113
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://36.46.151.113:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://113.134.211.174:8000
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名--> <!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/cylinder.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern> <FileNamePattern>${LOG_HOME}/Tcm.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<MaxHistory>30</MaxHistory> <MaxHistory>30</MaxHistory>
<!--日志文件大小--> <!--日志文件大小-->
...@@ -37,20 +37,20 @@ ...@@ -37,20 +37,20 @@
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" /> <logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
--> -->
<!--myibatis log configure--> <!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/> <logger name="com.apache.ibatis" level="debug"/>
<logger name="org.mybatis" level="INFO" /> <logger name="org.mybatis" level="debug" />
<logger name="java.sql.Connection" level="INFO"/> <logger name="java.sql.Connection" level="debug"/>
<logger name="java.sql.Statement" level="INFO"/> <logger name="java.sql.Statement" level="debug"/>
<logger name="java.sql.PreparedStatement" level="INFO"/> <logger name="java.sql.PreparedStatement" level="debug"/>
<logger name="org.springframework" level="INFO"/> <logger name="org.springframework" level="debug"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/> <logger name="com.baomidou.mybatisplus" level="debug"/>
<logger name="org.apache.activemq" level="INFO"/> <logger name="org.apache.activemq" level="debug"/>
<logger name="org.typroject" level="INFO"/> <logger name="org.typroject" level="debug"/>
<logger name="com.yeejoin" level="INFO"/> <logger name="com.yeejoin" level="debug"/>
<!-- 日志输出级别 --> <!-- 日志输出级别 -->
<root level="DEBUG"> <root level="error">
<!-- <appender-ref ref="FILE" /> --> <!-- <appender-ref ref="FILE" /> -->
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
<!-- <appender-ref ref="ELK" />--> <!-- <appender-ref ref="ELK" />-->
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/jczs.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- ELK管理 -->
<appender name="ELK" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>172.16.10.230:4560</destination>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/>
<logger name="org.mybatis" level="INFO" />
<logger name="java.sql.Connection" level="INFO"/>
<logger name="java.sql.Statement" level="INFO"/>
<logger name="java.sql.PreparedStatement" level="INFO"/>
<logger name="org.springframework" level="INFO"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="INFO"/>
<logger name="com.yeejoin" level="INFO"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<!-- <appender-ref ref="FILE" /> -->
<appender-ref ref="STDOUT" />
<!-- <appender-ref ref="ELK" />-->
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/jczs.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="org.mybatis" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<logger name="com.baomidou.mybatisplus" level="DEBUG"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/jczs.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="org.mybatis" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<logger name="com.baomidou.mybatisplus" level="DEBUG"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
package com.yeejoin.amos.boot.module.tcm.biz.config; package com.yeejoin.amos.boot.module.tcm.biz.config;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope; import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider; import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder; import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
...@@ -15,6 +12,7 @@ import org.springframework.beans.factory.annotation.Qualifier; ...@@ -15,6 +12,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration @Configuration
public class ElasticSearchClientConfig { public class ElasticSearchClientConfig {
...@@ -28,34 +26,25 @@ public class ElasticSearchClientConfig { ...@@ -28,34 +26,25 @@ public class ElasticSearchClientConfig {
private String password; private String password;
@Bean @Bean
@Qualifier("highLevelClient")
public RestHighLevelClient restHighLevelClient() { public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password)); new UsernamePasswordCredentials(username, password));
try { try {
String url = uris.replace("http://", ""); HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
final String[] parts = StringUtils.split(url, ":"); RestClientBuilder builder = RestClient.builder(httpHosts);
HttpHost httpHost = new HttpHost(parts[0], Integer.parseInt(parts[1]), "http"); builder.setHttpClientConfigCallback(httpClientBuilder -> {
RestClientBuilder builder = RestClient.builder(httpHost); httpClientBuilder.disableAuthCaching();
builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() { return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
@Override });
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) { // 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
httpClientBuilder.disableAuthCaching(); builder.setRequestConfigCallback(requestConfigBuilder -> {
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider); // 连接超时(默认为1秒)
} return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
}); });
builder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
@Override
public RequestConfig.Builder customizeRequestConfig(
RequestConfig.Builder requestConfigBuilder) {
return requestConfigBuilder.setConnectTimeout(5000 * 1000) // 连接超时(默认为1秒)
.setSocketTimeout(6000 * 1000);// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
}
});// 调整最大重试超时时间(默认为30秒).setMaxRetryTimeoutMillis(60000);
return new RestHighLevelClient(builder); return new RestHighLevelClient(builder);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -122,6 +122,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -122,6 +122,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
private String code; private String code;
@Autowired @Autowired
RestHighLevelClient restHighLevelClient;
@Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
//管辖机构redis缓存key //管辖机构redis缓存key
private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE"; private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE";
...@@ -148,17 +151,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -148,17 +151,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//一码通复制功能url参数key //一码通复制功能url参数key
private static final String COPY_KEY = "stashType"; private static final String COPY_KEY = "stashType";
@Value("${biz.elasticsearch.address}")
private String esAddress;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Value("${elasticsearch.username}")
private String esUserName;
@Value("${elasticsearch.password}")
private String esPwd;
private static String USE_CODE = "use_code"; private static String USE_CODE = "use_code";
...@@ -1200,11 +1192,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1200,11 +1192,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return save; return save;
} }
public Page<JSONObject> queryByKeys(JSONObject map) { public Page<JSONObject> queryByKeys(JSONObject map) {
//根据当前登录人查询 // //根据当前登录人查询
if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) { if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) {
map.put(EQUSTATE, EquimentEnum.getCode.get(map.get(EQUSTATE).toString()).toString()); map.put(EQUSTATE, EquimentEnum.getCode.get(map.get(EQUSTATE).toString()).toString());
} }
ResponseModel<Page<Map<String, Object>>> model = new ResponseModel<>();
JSONObject object = getCompanyType().get(0); JSONObject object = getCompanyType().get(0);
String level = object.getString("level"); String level = object.getString("level");
String code = object.getString("orgCode"); String code = object.getString("orgCode");
...@@ -1219,19 +1210,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1219,19 +1210,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
} }
Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size")); Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size"));
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient = new RestHighLevelClient(
RestClient.builder(
new HttpHost(esAddress, esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
})
);
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all"); request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
...@@ -1329,7 +1307,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1329,7 +1307,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
List<JSONObject> list = new LinkedList<>(); List<JSONObject> list = new LinkedList<>();
long totle = 0; long totle = 0;
try { try {
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT); SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits().getHits()) { for (org.elasticsearch.search.SearchHit hit : response.getHits().getHits()) {
System.out.println(hit); System.out.println(hit);
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
...@@ -1348,7 +1326,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1348,7 +1326,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
throw new RuntimeException(e); throw new RuntimeException(e);
} finally { } finally {
try { try {
esClient.close(); restHighLevelClient.close();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
...@@ -10,25 +10,15 @@ import com.yeejoin.amos.boot.module.tcm.flc.api.dto.CylinderFillingRecordDto; ...@@ -10,25 +10,15 @@ import com.yeejoin.amos.boot.module.tcm.flc.api.dto.CylinderFillingRecordDto;
import com.yeejoin.amos.boot.module.tcm.flc.api.entity.CylinderFillingRecord; import com.yeejoin.amos.boot.module.tcm.flc.api.entity.CylinderFillingRecord;
import com.yeejoin.amos.boot.module.tcm.flc.api.mapper.CylinderFillingRecordMapper; import com.yeejoin.amos.boot.module.tcm.flc.api.mapper.CylinderFillingRecordMapper;
import com.yeejoin.amos.boot.module.tcm.flc.api.service.ICylinderFillingRecordService; import com.yeejoin.amos.boot.module.tcm.flc.api.service.ICylinderFillingRecordService;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
...@@ -55,17 +45,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -55,17 +45,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Autowired @Autowired
CylinderFillingRecordMapper cylinderFillingRecordMapper; CylinderFillingRecordMapper cylinderFillingRecordMapper;
@Value("${biz.elasticsearch.address}") @Autowired
private String esAddress; RestHighLevelClient restHighLevelClient;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Value("${elasticsearch.username}")
private String esUserName;
@Value("${elasticsearch.password}")
private String esPwd;
/** /**
* 分页查询 * 分页查询
...@@ -127,7 +108,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -127,7 +108,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
//@Scheduled(cron = "${tzs.cylinder.fill.cron}") //@Scheduled(cron = "${tzs.cylinder.fill.cron}")
public void setTimeSaveCylinderInfoToES(){ public void setTimeSaveCylinderInfoToES() {
Page<ESCylinderFillingRecordDto> cylinderFillingRecordPage = new Page<>(); Page<ESCylinderFillingRecordDto> cylinderFillingRecordPage = new Page<>();
Page<ESCylinderFillingRecordDto> cyinderInfoList = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage); Page<ESCylinderFillingRecordDto> cyinderInfoList = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage);
Long count = cyinderInfoList.getCurrent(); Long count = cyinderInfoList.getCurrent();
...@@ -143,10 +124,10 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -143,10 +124,10 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
cylinderFillingRecordPage.setCurrent(i); cylinderFillingRecordPage.setCurrent(i);
cylinderFillingRecordPage.setSize(1000); cylinderFillingRecordPage.setSize(1000);
cylinderFillingRecordPage = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage); cylinderFillingRecordPage = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage);
if(!ObjectUtils.isEmpty(cylinderFillingRecordPage)){ if (!ObjectUtils.isEmpty(cylinderFillingRecordPage)) {
cylinderFillingRecordPage.getRecords().stream().map(item->{ cylinderFillingRecordPage.getRecords().stream().map(item -> {
if(!ObjectUtils.isEmpty(item.getSequenceCode())){ if (!ObjectUtils.isEmpty(item.getSequenceCode())) {
ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(),item.getSequenceCode()); ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode());
item.setUnitName(cyinderFillingRecordInfo.getUnitName()); item.setUnitName(cyinderFillingRecordInfo.getUnitName());
item.setFactoryNum(cyinderFillingRecordInfo.getFactoryNum()); item.setFactoryNum(cyinderFillingRecordInfo.getFactoryNum());
item.setCylinderVariety(cyinderFillingRecordInfo.getCylinderVariety()); item.setCylinderVariety(cyinderFillingRecordInfo.getCylinderVariety());
...@@ -164,7 +145,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -164,7 +145,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
// for (ESCylinderFillingRecordDto ci : cylinderFillingRecordPage.getRecords()) { // for (ESCylinderFillingRecordDto ci : cylinderFillingRecordPage.getRecords()) {
// saveCylinderFillingRecordToES(ci); // saveCylinderFillingRecordToES(ci);
// } // }
if(!ObjectUtils.isEmpty(cylinderFillingRecordPage)){ if (!ObjectUtils.isEmpty(cylinderFillingRecordPage)) {
saveCylinderFillingRecord2ES(cylinderFillingRecordPage.getRecords()); saveCylinderFillingRecord2ES(cylinderFillingRecordPage.getRecords());
} }
} }
...@@ -174,7 +155,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -174,7 +155,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Override @Override
public Page<ESCylinderFillingRecordDto> getCyinderFillingRecord(Page<ESCylinderFillingRecordDto> cylinderFillingRecordDto) { public Page<ESCylinderFillingRecordDto> getCyinderFillingRecord(Page<ESCylinderFillingRecordDto> cylinderFillingRecordDto) {
Page<ESCylinderFillingRecordDto> cyinderFillingRecord = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordDto); Page<ESCylinderFillingRecordDto> cyinderFillingRecord = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordDto);
if(!ObjectUtils.isEmpty(cyinderFillingRecord)){ if (!ObjectUtils.isEmpty(cyinderFillingRecord)) {
cyinderFillingRecord.getRecords().stream().map(item -> { cyinderFillingRecord.getRecords().stream().map(item -> {
if (!ObjectUtils.isEmpty(item.getSequenceCode())) { if (!ObjectUtils.isEmpty(item.getSequenceCode())) {
ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode()); ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode());
...@@ -203,25 +184,6 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -203,25 +184,6 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
Page<ESCylinderFillingRecordDto> result = new Page<ESCylinderFillingRecordDto>(pageNum, pageSize); Page<ESCylinderFillingRecordDto> result = new Page<ESCylinderFillingRecordDto>(pageNum, pageSize);
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient =new RestHighLevelClient(
RestClient.builder(
new HttpHost(esAddress,esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
})
);
// RestHighLevelClient esClient = new RestHighLevelClient(
// RestClient.builder(new HttpHost(esAddress, esPort, "http"))
// );
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("cylinder_filling"); request.indices("cylinder_filling");
...@@ -328,7 +290,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -328,7 +290,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
boolMust.must(query); boolMust.must(query);
} }
if(flag) { // 搜索全部 if (flag) { // 搜索全部
boolMust.must(QueryBuilders.matchAllQuery()); boolMust.must(QueryBuilders.matchAllQuery());
} }
...@@ -340,7 +302,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -340,7 +302,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
List<ESCylinderFillingRecordDto> list = new LinkedList<>(); List<ESCylinderFillingRecordDto> list = new LinkedList<>();
long totle = 0; long totle = 0;
try { try {
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT); SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits()) { for (org.elasticsearch.search.SearchHit hit : response.getHits()) {
System.out.println(hit); System.out.println(hit);
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
...@@ -352,6 +314,12 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -352,6 +314,12 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
result.setTotal(totle); result.setTotal(totle);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} finally {
try {
restHighLevelClient.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
} }
return result; return result;
...@@ -362,7 +330,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -362,7 +330,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
List<CylinderFillingRecord> cylinderFillingRecordList = new ArrayList<>(); List<CylinderFillingRecord> cylinderFillingRecordList = new ArrayList<>();
for (ESCylinderFillingRecordDto record : records) { for (ESCylinderFillingRecordDto record : records) {
CylinderFillingRecord cylinderFillingRecord = new CylinderFillingRecord(); CylinderFillingRecord cylinderFillingRecord = new CylinderFillingRecord();
BeanUtils.copyProperties(record,cylinderFillingRecord); BeanUtils.copyProperties(record, cylinderFillingRecord);
cylinderFillingRecord.setIsNotEs("1"); cylinderFillingRecord.setIsNotEs("1");
cylinderFillingRecord.setSequenceNbr(record.getSequenceNbr()); cylinderFillingRecord.setSequenceNbr(record.getSequenceNbr());
cylinderFillingRecordList.add(cylinderFillingRecord); cylinderFillingRecordList.add(cylinderFillingRecord);
......
...@@ -25,17 +25,9 @@ import com.yeejoin.amos.feign.systemctl.Systemctl; ...@@ -25,17 +25,9 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
...@@ -43,7 +35,6 @@ import org.elasticsearch.search.builder.SearchSourceBuilder; ...@@ -43,7 +35,6 @@ import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -68,1040 +59,1010 @@ import java.util.function.IntConsumer; ...@@ -68,1040 +59,1010 @@ import java.util.function.IntConsumer;
@Service @Service
@Slf4j @Slf4j
public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, CylinderInfo, CylinderInfoMapper> public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, CylinderInfo, CylinderInfoMapper>
implements ICylinderInfoService { implements ICylinderInfoService {
@Autowired @Autowired
CylinderUnitServiceImpl cylinderUnitServiceImpl; CylinderUnitServiceImpl cylinderUnitServiceImpl;
@Autowired @Autowired
CylinderUnitDataServiceImpl cylinderUnitDataServiceImpl; CylinderUnitDataServiceImpl cylinderUnitDataServiceImpl;
@Autowired @Autowired
CylinderInfoDataServiceImpl cylinderInfoDataServiceImpl; CylinderInfoDataServiceImpl cylinderInfoDataServiceImpl;
@Autowired @Autowired
CylinderTagsServiceImpl cylinderTagsServiceImpl; CylinderTagsServiceImpl cylinderTagsServiceImpl;
@Autowired @Autowired
CylinderFillingServiceImpl cylinderFillingServiceImpl; CylinderFillingServiceImpl cylinderFillingServiceImpl;
@Autowired @Autowired
CylinderIntegrityDataServiceImpl cylinderIntegrityDataServiceImpl; CylinderIntegrityDataServiceImpl cylinderIntegrityDataServiceImpl;
@Autowired @Autowired
CylinderFillingRecordServiceImpl cylinderFillingRecordServiceImpl; CylinderFillingRecordServiceImpl cylinderFillingRecordServiceImpl;
@Autowired @Autowired
CylinderFillingCheckServiceImpl cylinderFillingCheckServiceImpl; CylinderFillingCheckServiceImpl cylinderFillingCheckServiceImpl;
@Autowired @Autowired
CylinderAreaDataServiceImpl cylinderAreaDataServiceImpl; CylinderAreaDataServiceImpl cylinderAreaDataServiceImpl;
@Autowired @Autowired
CylinderFillingUnloadDataServiceImpl cylinderFillingUnloadDataServiceImpl; CylinderFillingUnloadDataServiceImpl cylinderFillingUnloadDataServiceImpl;
@Autowired @Autowired
CylinderInfoDataUnitServiceImpl cylinderInfoDataUnitServiceImpl; CylinderInfoDataUnitServiceImpl cylinderInfoDataUnitServiceImpl;
@Autowired @Autowired
CylinderFillingDataUnitServiceImpl cylinderFillingDataUnitServiceImpl; CylinderFillingDataUnitServiceImpl cylinderFillingDataUnitServiceImpl;
@Autowired @Autowired
CylinderTagsDataUnitServiceImpl cylinderTagsDataUnitServiceImpl; CylinderTagsDataUnitServiceImpl cylinderTagsDataUnitServiceImpl;
@Autowired @Autowired
CylinderIntegrityDataUnitServiceImpl cylinderIntegrityDataUnitServiceImpl; CylinderIntegrityDataUnitServiceImpl cylinderIntegrityDataUnitServiceImpl;
@Autowired @Autowired
CylinderFillingCheckDataUnitServiceImpl cylinderFillingCheckDataUnitServiceImpl; CylinderFillingCheckDataUnitServiceImpl cylinderFillingCheckDataUnitServiceImpl;
@Autowired @Autowired
CylinderFillingUnloadDataUnitServiceImpl cylinderFillingUnloadDataUnitServiceImpl; CylinderFillingUnloadDataUnitServiceImpl cylinderFillingUnloadDataUnitServiceImpl;
@Autowired @Autowired
MsgLogServiceImpl msgLogService; MsgLogServiceImpl msgLogService;
@Autowired @Autowired
private RuleTrigger ruleTrigger; private RuleTrigger ruleTrigger;
@Autowired @Autowired
TzsAuthServiceImpl tzsAuthService; TzsAuthServiceImpl tzsAuthService;
@Autowired @Autowired
private ScheduleMapper scheduleMapper; private ScheduleMapper scheduleMapper;
@Value("${cylinder-early-warning-packageId:气瓶监管/cylwarningmsg}") @Value("${cylinder-early-warning-packageId:气瓶监管/cylwarningmsg}")
private String packageId; private String packageId;
@Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}") @Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}")
private String cylPackageId; private String cylPackageId;
@Value("${biz.elasticsearch.address}") @Autowired
private String esAddress; RestHighLevelClient restHighLevelClient;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Value("${elasticsearch.username}") @Autowired
private String esUserName; StartPlatformTokenService startPlatformTokenService;
@Value("${elasticsearch.password}") @Autowired
private String esPwd; CylinderInfoMapper cylinderInfoMapper;
@Autowired
@Autowired
StartPlatformTokenService startPlatformTokenService;
@Autowired
CylinderInfoMapper cylinderInfoMapper;
@Autowired
ESCylinderInfoRepository esCylinderInfoRepository; ESCylinderInfoRepository esCylinderInfoRepository;
/** /**
* 分页查询 * 分页查询
*/ */
public Page<CylinderInfoDto> queryForCylinderInfoPage(Page<CylinderInfoDto> page) { public Page<CylinderInfoDto> queryForCylinderInfoPage(Page<CylinderInfoDto> page) {
return queryForPage(page, null, false); return queryForPage(page, null, false);
} }
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<CylinderInfoDto> queryForCylinderInfoList() { public List<CylinderInfoDto> queryForCylinderInfoList() {
return queryForList("", false); return queryForList("", false);
} }
@Override @Override
public Map<String, String> queryNumAndOutOfDateNum(Long unitId) { public Map<String, String> queryNumAndOutOfDateNum(Long unitId) {
return baseMapper.queryNumAndOutOfDateNum(unitId); return baseMapper.queryNumAndOutOfDateNum(unitId);
} }
/** /**
* 获取上个月气瓶总量 * 获取上个月气瓶总量
*/ */
public Integer getMonthInfoTotal(String regionCode) { public Integer getMonthInfoTotal(String regionCode) {
return baseMapper.getMonthInfoTotal(regionCode); return baseMapper.getMonthInfoTotal(regionCode);
} }
/** /**
* 获取上个月气瓶总量 * 获取上个月气瓶总量
*/ */
public Integer getLastMonthInfoTotal(String regionCode) { public Integer getLastMonthInfoTotal(String regionCode) {
return baseMapper.getLastMonthInfoTotal(regionCode); return baseMapper.getLastMonthInfoTotal(regionCode);
} }
/** /**
* 获取上上个月气瓶总量 * 获取上上个月气瓶总量
*/ */
public Integer getMonthBeforeLastInfoTotal(String regionCode) { public Integer getMonthBeforeLastInfoTotal(String regionCode) {
return baseMapper.getMonthBeforeLastInfoTotal(regionCode); return baseMapper.getMonthBeforeLastInfoTotal(regionCode);
} }
public Integer getInfoTotalByRegionCode(String regionCode) { public Integer getInfoTotalByRegionCode(String regionCode) {
return baseMapper.getInfoTotalByRegionCode(regionCode); return baseMapper.getInfoTotalByRegionCode(regionCode);
} }
public Double queryIntegirtyByAppId(String appId) { public Double queryIntegirtyByAppId(String appId) {
return this.baseMapper.queryIntegirtyByAppId(appId); return this.baseMapper.queryIntegirtyByAppId(appId);
} }
public Integer getWarnNum(String code) { public Integer getWarnNum(String code) {
return baseMapper.getWarnNum(code); return baseMapper.getWarnNum(code);
} }
/** /**
* 按单位统计 * 按单位统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
//@Scheduled(cron = "0 0 2 * * ?") //@Scheduled(cron = "0 0 2 * * ?")
public void synFillingUnloadData() { public void synFillingUnloadData() {
cylinderFillingUnloadDataServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadData>()); cylinderFillingUnloadDataServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadData>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
Calendar now = Calendar.getInstance(); Calendar now = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
now.add(Calendar.DATE, -1); now.add(Calendar.DATE, -1);
CylinderFillingUnloadDataDto temp = new CylinderFillingUnloadDataDto(); CylinderFillingUnloadDataDto temp = new CylinderFillingUnloadDataDto();
Double fillingSum = cylinderFillingRecordServiceImpl Double fillingSum = cylinderFillingRecordServiceImpl
.getFillingSum(String.valueOf(regionModel.getRegionCode()), now.getTime()); .getFillingSum(String.valueOf(regionModel.getRegionCode()), now.getTime());
Double unloadSum = 0d; Double unloadSum = 0d;
temp.setFillingSum(fillingSum); temp.setFillingSum(fillingSum);
temp.setRegionCode(String.valueOf(regionModel.getRegionCode())); temp.setRegionCode(String.valueOf(regionModel.getRegionCode()));
temp.setStatisDate(now.getTime()); temp.setStatisDate(now.getTime());
temp.setStatisDateStr(sdf.format(now.getTime())); temp.setStatisDateStr(sdf.format(now.getTime()));
temp.setUnloadSum(unloadSum); temp.setUnloadSum(unloadSum);
cylinderFillingUnloadDataServiceImpl.createWithModel(temp); cylinderFillingUnloadDataServiceImpl.createWithModel(temp);
} }
}); });
} }
/** /**
* 按区域统计 * 按区域统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
//@Scheduled(cron = "0 0 2 * * ?") //@Scheduled(cron = "0 0 2 * * ?")
public void synAreaData() { public void synAreaData() {
cylinderAreaDataServiceImpl.remove(new LambdaQueryWrapper<CylinderAreaData>()); cylinderAreaDataServiceImpl.remove(new LambdaQueryWrapper<CylinderAreaData>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
CylinderAreaDataDto temp = new CylinderAreaDataDto(); CylinderAreaDataDto temp = new CylinderAreaDataDto();
temp.setAreaName(regionModel.getRegionName()); temp.setAreaName(regionModel.getRegionName());
String code = regionModel.getRegionCode() + ""; String code = regionModel.getRegionCode() + "";
Integer cylinderTotal = this.getInfoTotalByRegionCode(code); Integer cylinderTotal = this.getInfoTotalByRegionCode(code);
Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(code); Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(code);
Integer cylinderUnitWarn = cylinderUnitServiceImpl.getWarnNum(code); Integer cylinderUnitWarn = cylinderUnitServiceImpl.getWarnNum(code);
Integer cylinderInfoWarn = this.getWarnNum(code); Integer cylinderInfoWarn = this.getWarnNum(code);
int warmTotal = cylinderUnitWarn + cylinderInfoWarn; int warmTotal = cylinderUnitWarn + cylinderInfoWarn;
String parentCode = ""; String parentCode = "";
if ("610000".equals(code)) { if ("610000".equals(code)) {
parentCode = "-1"; parentCode = "-1";
} else if (!"00".equals(code.substring(4, 6))) { } else if (!"00".equals(code.substring(4, 6))) {
parentCode = code.substring(0, 4) + "00"; parentCode = code.substring(0, 4) + "00";
} else { } else {
parentCode = "610000"; parentCode = "610000";
} }
temp.setCylinderNum(Long.valueOf(cylinderTotal)); temp.setCylinderNum(Long.valueOf(cylinderTotal));
temp.setParentRegionCode(parentCode); temp.setParentRegionCode(parentCode);
temp.setRegionCode(regionModel.getRegionCode() + ""); temp.setRegionCode(regionModel.getRegionCode() + "");
temp.setUnitNum(Long.valueOf(cylinderUnitTotal)); temp.setUnitNum(Long.valueOf(cylinderUnitTotal));
temp.setWarnNum((long) warmTotal); temp.setWarnNum((long) warmTotal);
cylinderAreaDataServiceImpl.createWithModel(temp); cylinderAreaDataServiceImpl.createWithModel(temp);
}); });
} }
/** /**
* 按区域统计 * 按区域统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
//@Scheduled(cron = "* * 2 * * ?") //@Scheduled(cron = "* * 2 * * ?")
public void addIntegrityData() { public void addIntegrityData() {
System.out.println("====================数据完整性开始============================"); System.out.println("====================数据完整性开始============================");
cylinderIntegrityDataServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityData>()); cylinderIntegrityDataServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityData>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
List<CylinderUnit> unitlist = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>() List<CylinderUnit> unitlist = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>()
.like(CylinderUnit::getRegionCode, regionModel.getRegionCode())); .like(CylinderUnit::getRegionCode, regionModel.getRegionCode()));
List<CylinderIntegrityDataDto> tempList = new LinkedList<>(); List<CylinderIntegrityDataDto> tempList = new LinkedList<>();
System.out.println( System.out.println(
"====================regioncode: " + regionModel.getRegionCode() + "============================"); "====================regioncode: " + regionModel.getRegionCode() + "============================");
unitlist.forEach(t -> { unitlist.forEach(t -> {
System.out.println("====================appId: " + t.getAppId() + "============================"); System.out.println("====================appId: " + t.getAppId() + "============================");
CylinderIntegrityDataDto temp = new CylinderIntegrityDataDto(); CylinderIntegrityDataDto temp = new CylinderIntegrityDataDto();
String appId = t.getAppId(); String appId = t.getAppId();
Double totalIntegirty = 0d; Double totalIntegirty = 0d;
// tz_cylinder_info // tz_cylinder_info
Double unitIntegirty = t.getIntegrity(); Double unitIntegirty = t.getIntegrity();
unitIntegirty = unitIntegirty == null ? 0d : unitIntegirty; unitIntegirty = unitIntegirty == null ? 0d : unitIntegirty;
// tz_cylinder_tags // tz_cylinder_tags
Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(appId); Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(appId);
tagIntegirty = tagIntegirty == null ? 0d : tagIntegirty; tagIntegirty = tagIntegirty == null ? 0d : tagIntegirty;
// tz_cylinder_info // tz_cylinder_info
Double infoIntegirty = this.queryIntegirtyByAppId(appId); Double infoIntegirty = this.queryIntegirtyByAppId(appId);
infoIntegirty = infoIntegirty == null ? 0d : infoIntegirty; infoIntegirty = infoIntegirty == null ? 0d : infoIntegirty;
// tz_cylinder_filling_record 30天内 // tz_cylinder_filling_record 30天内
Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(appId); Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(appId);
recordIntegirty = recordIntegirty == null ? 0d : recordIntegirty; recordIntegirty = recordIntegirty == null ? 0d : recordIntegirty;
// tz_cylinder_filling 30天内ji // tz_cylinder_filling 30天内ji
Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(appId); Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(appId);
fillingIntegirty = fillingIntegirty == null ? 0d : fillingIntegirty; fillingIntegirty = fillingIntegirty == null ? 0d : fillingIntegirty;
// tz_cylinder_filling_check 30天内 // tz_cylinder_filling_check 30天内
Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(appId); Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(appId);
checkIntegirty = checkIntegirty == null ? 0d : checkIntegirty; checkIntegirty = checkIntegirty == null ? 0d : checkIntegirty;
totalIntegirty = (unitIntegirty + tagIntegirty + infoIntegirty + recordIntegirty + fillingIntegirty totalIntegirty = (unitIntegirty + tagIntegirty + infoIntegirty + recordIntegirty + fillingIntegirty
+ checkIntegirty) / 6; + checkIntegirty) / 6;
BigDecimal bg = new BigDecimal(totalIntegirty); BigDecimal bg = new BigDecimal(totalIntegirty);
totalIntegirty = bg.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100; totalIntegirty = bg.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
temp.setAppId(appId); temp.setAppId(appId);
temp.setRegionCode(String.valueOf(regionModel.getRegionCode())); temp.setRegionCode(String.valueOf(regionModel.getRegionCode()));
temp.setIntegrity(totalIntegirty); temp.setIntegrity(totalIntegirty);
temp.setUnitName(t.getUnitName()); temp.setUnitName(t.getUnitName());
// 判断list 是否达到5个,如果达到则对比最后一个进行替换 // 判断list 是否达到5个,如果达到则对比最后一个进行替换
if (tempList.size() == 5) { if (tempList.size() == 5) {
if (tempList.get(0).getIntegrity() < totalIntegirty) { if (tempList.get(0).getIntegrity() < totalIntegirty) {
tempList.set(0, temp); tempList.set(0, temp);
} }
} else { } else {
tempList.add(temp); tempList.add(temp);
} }
tempList.sort(Comparator.comparing(CylinderIntegrityDataDto::getIntegrity)); tempList.sort(Comparator.comparing(CylinderIntegrityDataDto::getIntegrity));
}); });
tempList.forEach(t -> { tempList.forEach(t -> {
System.out.println("====================unitName: " + t.getUnitName() + "============================"); System.out.println("====================unitName: " + t.getUnitName() + "============================");
t.setUpdateTime(new Date()); t.setUpdateTime(new Date());
cylinderIntegrityDataServiceImpl.createWithModel(t); cylinderIntegrityDataServiceImpl.createWithModel(t);
}); });
}); });
System.out.println("====================数据完整性结束============================"); System.out.println("====================数据完整性结束============================");
} }
/** /**
* 企业总量按区域统计 * 企业总量按区域统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
//@Scheduled(cron = "0 0 2 * * ?") //@Scheduled(cron = "0 0 2 * * ?")
public void getCylinderUnitInfo() { public void getCylinderUnitInfo() {
cylinderUnitDataServiceImpl.remove(new LambdaQueryWrapper<CylinderUnitData>()); cylinderUnitDataServiceImpl.remove(new LambdaQueryWrapper<CylinderUnitData>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
String regionCode = String.valueOf(regionModel.getRegionCode()); String regionCode = String.valueOf(regionModel.getRegionCode());
Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(regionCode); Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(regionCode);
Integer thisMonthUnitTotal = cylinderUnitServiceImpl.getThisMonthUnitTotalByRegionCode(regionCode); Integer thisMonthUnitTotal = cylinderUnitServiceImpl.getThisMonthUnitTotalByRegionCode(regionCode);
Double lastUnitTotal = Double.valueOf(cylinderUnitServiceImpl.getLastMonthUnitTotal(regionCode)); Double lastUnitTotal = Double.valueOf(cylinderUnitServiceImpl.getLastMonthUnitTotal(regionCode));
Double monthUnitLastInfo = Double.valueOf(cylinderUnitServiceImpl.getMonthBeforeLastUnitTotal(regionCode)); Double monthUnitLastInfo = Double.valueOf(cylinderUnitServiceImpl.getMonthBeforeLastUnitTotal(regionCode));
double changeNum = thisMonthUnitTotal - lastUnitTotal; double changeNum = thisMonthUnitTotal - lastUnitTotal;
double percent = 0d; double percent = 0d;
if (monthUnitLastInfo != 0) { if (monthUnitLastInfo != 0) {
percent = (lastUnitTotal-monthUnitLastInfo) / monthUnitLastInfo; percent = (lastUnitTotal - monthUnitLastInfo) / monthUnitLastInfo;
BigDecimal bg = new BigDecimal(percent); BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
} else { } else {
percent = 0 ; percent = 0;
BigDecimal bg = new BigDecimal(percent); BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
} }
CylinderUnitDataDto temp = new CylinderUnitDataDto(); CylinderUnitDataDto temp = new CylinderUnitDataDto();
temp.setChangeSum((long) changeNum); temp.setChangeSum((long) changeNum);
temp.setChangePercent((int) (percent * 100) + ""); temp.setChangePercent((int) (percent * 100) + "");
temp.setRegionCode(regionCode); temp.setRegionCode(regionCode);
temp.setTotalSum((long) cylinderUnitTotal); temp.setTotalSum((long) cylinderUnitTotal);
temp.setUpdateTime(new Date()); temp.setUpdateTime(new Date());
cylinderUnitDataServiceImpl.createWithModel(temp); cylinderUnitDataServiceImpl.createWithModel(temp);
}); });
} }
/** /**
* 气瓶总量按区域统计 * 气瓶总量按区域统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
//@Scheduled(cron = "0 0 2 * * ?") //@Scheduled(cron = "0 0 2 * * ?")
public void getCylinderInfo() { public void getCylinderInfo() {
cylinderInfoDataServiceImpl.remove(new LambdaQueryWrapper<>()); cylinderInfoDataServiceImpl.remove(new LambdaQueryWrapper<>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
CylinderInfoDataDto temp = new CylinderInfoDataDto(); CylinderInfoDataDto temp = new CylinderInfoDataDto();
String regionCode = String.valueOf(regionModel.getRegionCode()); String regionCode = String.valueOf(regionModel.getRegionCode());
Integer cylinderTotal = this.getInfoTotalByRegionCode(regionCode);// 当前总数 Integer cylinderTotal = this.getInfoTotalByRegionCode(regionCode);// 当前总数
Double InfoTotal = Double.valueOf(this.getMonthInfoTotal(regionCode)); Double InfoTotal = Double.valueOf(this.getMonthInfoTotal(regionCode));
Double lastInfoTotal = Double.valueOf(this.getLastMonthInfoTotal(regionCode));// 上月总数 Double lastInfoTotal = Double.valueOf(this.getLastMonthInfoTotal(regionCode));// 上月总数
Double monthBeforeLastInfo = Double.valueOf(this.getMonthBeforeLastInfoTotal(regionCode));// 上上月总数 Double monthBeforeLastInfo = Double.valueOf(this.getMonthBeforeLastInfoTotal(regionCode));// 上上月总数
double percent = 0d; double percent = 0d;
if (monthBeforeLastInfo != 0) { if (monthBeforeLastInfo != 0) {
percent = (lastInfoTotal - monthBeforeLastInfo) / monthBeforeLastInfo; percent = (lastInfoTotal - monthBeforeLastInfo) / monthBeforeLastInfo;
BigDecimal bg = new BigDecimal(percent); BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}else } else {
{ percent = 0;
percent = 0; BigDecimal bg = new BigDecimal(percent);
BigDecimal bg = new BigDecimal(percent); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); }
} temp.setChangeSum((long) (InfoTotal - lastInfoTotal));
temp.setChangeSum((long) (InfoTotal - lastInfoTotal)); temp.setChangePercent((int) (percent * 100) + "");
temp.setChangePercent((int) (percent * 100) + ""); temp.setRegionCode(regionCode);
temp.setRegionCode(regionCode); temp.setTotalSum((long) cylinderTotal);
temp.setTotalSum((long) cylinderTotal); cylinderInfoDataServiceImpl.createWithModel(temp);
cylinderInfoDataServiceImpl.createWithModel(temp); });
}); }
}
/**
/** * 按单位统计
* 按单位统计 */
*/ @Transactional(rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class) //@Scheduled(cron = "0 0 2 * * ?")
//@Scheduled(cron = "0 0 2 * * ?") public void synUnitCylinderInfoData() {
public void synUnitCylinderInfoData() { cylinderInfoDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderInfoDataUnit>());
cylinderInfoDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderInfoDataUnit>()); countByUnit(cylinderUnit -> {
countByUnit(cylinderUnit -> { CylinderInfoDataUnitDto temp = new CylinderInfoDataUnitDto();
CylinderInfoDataUnitDto temp = new CylinderInfoDataUnitDto(); temp.setAppId(cylinderUnit.getAppId());
temp.setAppId(cylinderUnit.getAppId()); int count = this
int count = this .count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));// 当前总数
.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));// 当前总数 temp.setTotalSum((long) count);
temp.setTotalSum((long) count); Double month = Double.valueOf(baseMapper.getMonthInfoTotalUnit(cylinderUnit.getAppId()));
Double month = Double.valueOf(baseMapper.getMonthInfoTotalUnit(cylinderUnit.getAppId())); Double thismonth = Double.valueOf(baseMapper.getLastMonthInfoTotalUnit(cylinderUnit.getAppId()));// 上月总数
Double thismonth = Double.valueOf(baseMapper.getLastMonthInfoTotalUnit(cylinderUnit.getAppId()));// 上月总数 Double lastmonth = Double.valueOf(baseMapper.getMonthBeforeLastInfoTotalUnit(cylinderUnit.getAppId()));// 上上月总数
Double lastmonth = Double.valueOf(baseMapper.getMonthBeforeLastInfoTotalUnit(cylinderUnit.getAppId()));// 上上月总数 double percent = 0d;
double percent = 0d; if (lastmonth != 0) {
if (lastmonth != 0) { percent = (thismonth - lastmonth) / lastmonth;
percent = (thismonth - lastmonth) / lastmonth; BigDecimal bg = new BigDecimal(percent);
BigDecimal bg = new BigDecimal(percent); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); } else {
}else percent = 0;
{ BigDecimal bg = new BigDecimal(percent);
percent = 0; percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
BigDecimal bg = new BigDecimal(percent); }
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); temp.setChangeSum((long) (month - thismonth));
} temp.setChangePercent((int) (percent * 100) + "");
temp.setChangeSum((long) (month - thismonth)); cylinderInfoDataUnitServiceImpl.createWithModel(temp);
temp.setChangePercent((int) (percent * 100) + ""); });
cylinderInfoDataUnitServiceImpl.createWithModel(temp); }
});
} /**
* 充装量按单位和月统计
/** */
* 充装量按单位和月统计 @Transactional(rollbackFor = Exception.class)
*/ //@Scheduled(cron = "0 0 2 * * ?")
@Transactional(rollbackFor = Exception.class) public void synUnitCylinderFillingData() {
//@Scheduled(cron = "0 0 2 * * ?") cylinderFillingDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingDataUnit>());
public void synUnitCylinderFillingData() { countByUnit(cylinderUnit -> {
cylinderFillingDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingDataUnit>()); // 按照月份 获取数据 取一年数据
countByUnit(cylinderUnit -> { Calendar calendar = Calendar.getInstance();
// 按照月份 获取数据 取一年数据 // 按月份获取充装量
Calendar calendar = Calendar.getInstance(); // 当月与上月 对比获取数据
// 按月份获取充装量 for (int i = 0; i < 12; i++) {
// 当月与上月 对比获取数据 // 获取当月数据
for (int i = 0; i < 12; i++) { CylinderFillingDataUnitDto temp = new CylinderFillingDataUnitDto();
// 获取当月数据 String year = calendar.get(Calendar.YEAR) + "";
CylinderFillingDataUnitDto temp = new CylinderFillingDataUnitDto(); int month = calendar.get(Calendar.MONTH) + 1;
String year = calendar.get(Calendar.YEAR) + ""; String monthStr = month < 10 ? "0" + month : month + "";
int month = calendar.get(Calendar.MONTH) + 1; temp.setFillingYear(year);
String monthStr = month < 10 ? "0" + month : month + ""; temp.setFillingMonth(monthStr);
temp.setFillingYear(year); temp.setFillingDate(year + "-" + monthStr);
temp.setFillingMonth(monthStr); // 本月
temp.setFillingDate(year+"-"+monthStr); Double thisMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(),
// 本月 calendar.getTime());
Double thisMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(), temp.setTotalSum(thisMonth);
calendar.getTime()); calendar.add(Calendar.MONTH, -1);
temp.setTotalSum(thisMonth); // 上月
calendar.add(Calendar.MONTH, -1); Double lastMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(),
// 上月 calendar.getTime());
Double lastMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(), double percent = 0d;
calendar.getTime()); if (lastMonth != 0) {
double percent = 0d; percent = (thisMonth - lastMonth) / lastMonth;
if (lastMonth != 0) { BigDecimal bg = new BigDecimal(percent);
percent = (thisMonth - lastMonth) / lastMonth; percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
BigDecimal bg = new BigDecimal(percent); }
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); temp.setChangePercent((int) (percent * 100) + "");
} temp.setAppId(cylinderUnit.getAppId());
temp.setChangePercent((int) (percent * 100) + ""); temp.setChangeSum(thisMonth - lastMonth);
temp.setAppId(cylinderUnit.getAppId()); cylinderFillingDataUnitServiceImpl.createWithModel(temp);
temp.setChangeSum(thisMonth - lastMonth); }
cylinderFillingDataUnitServiceImpl.createWithModel(temp); });
} }
});
} /**
* 按单位统计
/** */
* 按单位统计 @Transactional(rollbackFor = Exception.class)
*/ //@Scheduled(cron = "0 0 2 * * ?")
@Transactional(rollbackFor = Exception.class) public void synUnitCylinderTagsData() {
//@Scheduled(cron = "0 0 2 * * ?") cylinderTagsDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderTagsDataUnit>());
public void synUnitCylinderTagsData() { countByUnit(cylinderUnit -> {
cylinderTagsDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderTagsDataUnit>()); CylinderTagsDataUnitDto temp = new CylinderTagsDataUnitDto();
countByUnit(cylinderUnit -> { temp.setAppId(cylinderUnit.getAppId());
CylinderTagsDataUnitDto temp = new CylinderTagsDataUnitDto(); int cylinder = this
temp.setAppId(cylinderUnit.getAppId()); .count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));
int cylinder = this int tags = cylinderTagsServiceImpl
.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId())); .count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, cylinderUnit.getAppId()));
int tags = cylinderTagsServiceImpl String percent = "";
.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, cylinderUnit.getAppId())); if (tags != 0) {
String percent = ""; double zz = (double) cylinder / (double) tags;
if (tags != 0) { DecimalFormat df = new DecimalFormat("##.00%");
double zz = (double) cylinder /(double) tags; if (Math.abs(zz) < 0.0000000000001) {
DecimalFormat df = new DecimalFormat("##.00%"); percent = "0.00%";
if (Math.abs(zz) < 0.0000000000001) { } else {
percent = "0.00%"; percent = df.format(zz);
} else { }
percent = df.format(zz); }
} temp.setCylinderSum((long) cylinder);
} temp.setTagsSum((long) tags);
temp.setCylinderSum((long) cylinder); temp.setTagPercent(percent);
temp.setTagsSum((long) tags); cylinderTagsDataUnitServiceImpl.createWithModel(temp);
temp.setTagPercent(percent); });
cylinderTagsDataUnitServiceImpl.createWithModel(temp); }
});
} /**
* 按单位统计
/** */
* 按单位统计 @Transactional(rollbackFor = Exception.class)
*/ //@Scheduled(cron = "0 0 2 * * ?")
@Transactional(rollbackFor = Exception.class) public void synUnitIntegrityData() {
//@Scheduled(cron = "0 0 2 * * ?") cylinderIntegrityDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityDataUnit>());
public void synUnitIntegrityData() { countByUnit(cylinderUnit -> {
cylinderIntegrityDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityDataUnit>()); // 企业信息
countByUnit(cylinderUnit -> { CylinderIntegrityDataUnitDto uninInfo = new CylinderIntegrityDataUnitDto();
// 企业信息 uninInfo.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto uninInfo = new CylinderIntegrityDataUnitDto(); uninInfo.setDataType("企业信息");
uninInfo.setAppId(cylinderUnit.getAppId()); Double unitIntegirty = cylinderUnit.getIntegrity();
uninInfo.setDataType("企业信息"); uninInfo.setIntegrity(unitIntegirty);
Double unitIntegirty = cylinderUnit.getIntegrity(); cylinderIntegrityDataUnitServiceImpl.createWithModel(uninInfo);
uninInfo.setIntegrity(unitIntegirty); // 气瓶基本信息
cylinderIntegrityDataUnitServiceImpl.createWithModel(uninInfo); CylinderIntegrityDataUnitDto cylinderInfo = new CylinderIntegrityDataUnitDto();
// 气瓶基本信息 cylinderInfo.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderInfo = new CylinderIntegrityDataUnitDto(); cylinderInfo.setDataType("气瓶基本信息");
cylinderInfo.setAppId(cylinderUnit.getAppId()); Double cylinderIntegirty = this.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderInfo.setDataType("气瓶基本信息"); cylinderInfo.setIntegrity(cylinderIntegirty);
Double cylinderIntegirty = this.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInfo);
cylinderInfo.setIntegrity(cylinderIntegirty); // 气瓶标签信息
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInfo); CylinderIntegrityDataUnitDto cylinderTag = new CylinderIntegrityDataUnitDto();
// 气瓶标签信息 cylinderTag.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderTag = new CylinderIntegrityDataUnitDto(); cylinderTag.setDataType("气瓶标签信息");
cylinderTag.setAppId(cylinderUnit.getAppId()); Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderTag.setDataType("气瓶标签信息"); cylinderTag.setIntegrity(tagIntegirty);
Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderTag);
cylinderTag.setIntegrity(tagIntegirty); // 气瓶检验信息
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderTag); CylinderIntegrityDataUnitDto cylinderInspection = new CylinderIntegrityDataUnitDto();
// 气瓶检验信息 cylinderInspection.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderInspection = new CylinderIntegrityDataUnitDto(); cylinderInspection.setDataType("气瓶检验信息");
cylinderInspection.setAppId(cylinderUnit.getAppId()); cylinderInspection.setIntegrity(0d);
cylinderInspection.setDataType("气瓶检验信息"); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInspection);
cylinderInspection.setIntegrity(0d); // 充装前检查
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInspection); CylinderIntegrityDataUnitDto cylinderFilling = new CylinderIntegrityDataUnitDto();
// 充装前检查 cylinderFilling.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderFilling = new CylinderIntegrityDataUnitDto(); cylinderFilling.setDataType("充装前检查");
cylinderFilling.setAppId(cylinderUnit.getAppId()); Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderFilling.setDataType("充装前检查"); cylinderFilling.setIntegrity(fillingIntegirty);
Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderFilling);
cylinderFilling.setIntegrity(fillingIntegirty); // 充装信息
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderFilling); CylinderIntegrityDataUnitDto cylinderRecord = new CylinderIntegrityDataUnitDto();
// 充装信息 cylinderRecord.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderRecord = new CylinderIntegrityDataUnitDto(); cylinderRecord.setDataType("充装信息");
cylinderRecord.setAppId(cylinderUnit.getAppId()); Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderRecord.setDataType("充装信息"); cylinderRecord.setIntegrity(recordIntegirty);
Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderRecord);
cylinderRecord.setIntegrity(recordIntegirty); // 充装后复查
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderRecord); CylinderIntegrityDataUnitDto cylinderCheck = new CylinderIntegrityDataUnitDto();
// 充装后复查 cylinderCheck.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderCheck = new CylinderIntegrityDataUnitDto(); cylinderCheck.setDataType("充装后复查");
cylinderCheck.setAppId(cylinderUnit.getAppId()); Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderCheck.setDataType("充装后复查"); cylinderCheck.setIntegrity(checkIntegirty);
Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderCheck);
cylinderCheck.setIntegrity(checkIntegirty); });
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderCheck); }
});
} /**
* 充装详情按单位统计
/** */
* 充装详情按单位统计 @Transactional(rollbackFor = Exception.class)
*/ //@Scheduled(cron = "0 0 2 * * ?")
@Transactional(rollbackFor = Exception.class) public void synUnitFillingCheckData() {
//@Scheduled(cron = "0 0 2 * * ?")
public void synUnitFillingCheckData() {
// cylinderFillingCheckDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingCheckDataUnit>()); // cylinderFillingCheckDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingCheckDataUnit>());
countByUnit(cylinderUnit -> { countByUnit(cylinderUnit -> {
List<CylinderFillingCheckDataUnitDto> allCylinderFillingCheckDataList = List<CylinderFillingCheckDataUnitDto> allCylinderFillingCheckDataList =
cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), null); cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), null);
// 按照月份 获取数据 取一年数据 // 按照月份 获取数据 取一年数据
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
// 第一次查询到该appId对应的统计数据为空,则计算过去一年12个月的数据统计 // 第一次查询到该appId对应的统计数据为空,则计算过去一年12个月的数据统计
if (ValidationUtil.isEmpty(allCylinderFillingCheckDataList)) { if (ValidationUtil.isEmpty(allCylinderFillingCheckDataList)) {
// 按月份获取充装量 // 按月份获取充装量
// 当月与上月 对比获取数据 // 当月与上月 对比获取数据
for (int i = 0; i < 12; i++) { for (int i = 0; i < 12; i++) {
// 获取当月数据 // 获取当月数据
CylinderFillingCheckDataUnitDto temp = new CylinderFillingCheckDataUnitDto(); CylinderFillingCheckDataUnitDto temp = new CylinderFillingCheckDataUnitDto();
calcCylinderFillingCheckDataUnitData(cylinderUnit, c, temp); calcCylinderFillingCheckDataUnitData(cylinderUnit, c, temp);
c.add(Calendar.MONTH, -1); c.add(Calendar.MONTH, -1);
cylinderFillingCheckDataUnitServiceImpl.createWithModel(temp); cylinderFillingCheckDataUnitServiceImpl.createWithModel(temp);
} }
} else { } else {
// 如果已经有该appId对应数据,则直接更新当前月的数据即可 // 如果已经有该appId对应数据,则直接更新当前月的数据即可
Calendar current = Calendar.getInstance(); Calendar current = Calendar.getInstance();
String year = current.get(Calendar.YEAR) + ""; String year = current.get(Calendar.YEAR) + "";
int month = current.get(Calendar.MONTH) + 1; int month = current.get(Calendar.MONTH) + 1;
String monthStr = month < 10 ? "0" + month : month + ""; String monthStr = month < 10 ? "0" + month : month + "";
List<CylinderFillingCheckDataUnitDto> existDataDtoList = List<CylinderFillingCheckDataUnitDto> existDataDtoList =
cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), year + "-" + monthStr); cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), year + "-" + monthStr);
CylinderFillingCheckDataUnitDto tempDto = new CylinderFillingCheckDataUnitDto(); CylinderFillingCheckDataUnitDto tempDto = new CylinderFillingCheckDataUnitDto();
if (!ValidationUtil.isEmpty(existDataDtoList) && !ValidationUtil.isEmpty(existDataDtoList.get(0))) { if (!ValidationUtil.isEmpty(existDataDtoList) && !ValidationUtil.isEmpty(existDataDtoList.get(0))) {
tempDto = existDataDtoList.get(0); tempDto = existDataDtoList.get(0);
calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto); calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto);
cylinderFillingCheckDataUnitServiceImpl.updateWithModel(tempDto); cylinderFillingCheckDataUnitServiceImpl.updateWithModel(tempDto);
} else if (ValidationUtil.isEmpty(existDataDtoList)) { } else if (ValidationUtil.isEmpty(existDataDtoList)) {
// 处理当前月第一天还没数据情况 // 处理当前月第一天还没数据情况
calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto); calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto);
cylinderFillingCheckDataUnitServiceImpl.createWithModel(tempDto); cylinderFillingCheckDataUnitServiceImpl.createWithModel(tempDto);
} }
} }
}); });
} }
/** /**
* 计算当前单位的充装检查数据统计 * 计算当前单位的充装检查数据统计
* *
* @param cylinderUnit * @param cylinderUnit
* @param calender * @param calender
* @param cylinderFillingCheckDataUnitDto * @param cylinderFillingCheckDataUnitDto
*/ */
public void calcCylinderFillingCheckDataUnitData(CylinderUnit cylinderUnit, Calendar calender, CylinderFillingCheckDataUnitDto cylinderFillingCheckDataUnitDto) { public void calcCylinderFillingCheckDataUnitData(CylinderUnit cylinderUnit, Calendar calender, CylinderFillingCheckDataUnitDto cylinderFillingCheckDataUnitDto) {
String year = calender.get(Calendar.YEAR) + ""; String year = calender.get(Calendar.YEAR) + "";
int month = calender.get(Calendar.MONTH) + 1; int month = calender.get(Calendar.MONTH) + 1;
String monthStr = month < 10 ? "0" + month : month + ""; String monthStr = month < 10 ? "0" + month : month + "";
cylinderFillingCheckDataUnitDto.setFillingMonth(monthStr); cylinderFillingCheckDataUnitDto.setFillingMonth(monthStr);
cylinderFillingCheckDataUnitDto.setFillingYear(year); cylinderFillingCheckDataUnitDto.setFillingYear(year);
cylinderFillingCheckDataUnitDto.setFillingDate(year + "-" + monthStr); cylinderFillingCheckDataUnitDto.setFillingDate(year + "-" + monthStr);
Integer countThisMonth = cylinderFillingRecordServiceImpl Integer countThisMonth = cylinderFillingRecordServiceImpl
.getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime());
cylinderFillingCheckDataUnitDto.setTotalSum((long) countThisMonth); cylinderFillingCheckDataUnitDto.setTotalSum((long) countThisMonth);
// 获取本月数据 // 获取本月数据
Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(),
calender.getTime()); calender.getTime());
Integer fillingCheckCount = cylinderFillingCheckServiceImpl Integer fillingCheckCount = cylinderFillingCheckServiceImpl
.getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime());
// 充装前检查率:充装前检查次数/充装次数 // 充装前检查率:充装前检查次数/充装次数
double before = 0d; double before = 0d;
if (countThisMonth != 0) { if (countThisMonth != 0) {
before = (double) (fillingCount) / (double) countThisMonth; before = (double) (fillingCount) / (double) countThisMonth;
} }
cylinderFillingCheckDataUnitDto.setFillingCount((long) fillingCount); cylinderFillingCheckDataUnitDto.setFillingCount((long) fillingCount);
cylinderFillingCheckDataUnitDto.setFillingPercent(before * 100); cylinderFillingCheckDataUnitDto.setFillingPercent(before * 100);
// 充装后检查率:充装后检查次数/充装次数 // 充装后检查率:充装后检查次数/充装次数
double after = 0d; double after = 0d;
if (countThisMonth != 0) { if (countThisMonth != 0) {
after = (double) (fillingCheckCount) / (double) countThisMonth; after = (double) (fillingCheckCount) / (double) countThisMonth;
} }
cylinderFillingCheckDataUnitDto.setFillingCheckCount((long) fillingCheckCount); cylinderFillingCheckDataUnitDto.setFillingCheckCount((long) fillingCheckCount);
cylinderFillingCheckDataUnitDto.setFillingCheckPercent(after * 100); cylinderFillingCheckDataUnitDto.setFillingCheckPercent(after * 100);
// 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数 // 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数
double passed = 0d; double passed = 0d;
// 充装前检查合格次数 // 充装前检查合格次数
Integer fillingPassedCount = cylinderFillingServiceImpl Integer fillingPassedCount = cylinderFillingServiceImpl
.getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime());
// 充装后检查合格次数 // 充装后检查合格次数
Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl
.getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime());
if (countThisMonth != 0) { if (countThisMonth != 0) {
passed = ((double) (fillingPassedCount) + (double) fillingCheckPassedCount) passed = ((double) (fillingPassedCount) + (double) fillingCheckPassedCount)
/ (double) (2 * countThisMonth); / (double) (2 * countThisMonth);
} }
cylinderFillingCheckDataUnitDto.setFillingPassedCount((long) (fillingPassedCount + fillingCheckPassedCount)); cylinderFillingCheckDataUnitDto.setFillingPassedCount((long) (fillingPassedCount + fillingCheckPassedCount));
cylinderFillingCheckDataUnitDto.setTotalSumDouble((long) 2 * countThisMonth); cylinderFillingCheckDataUnitDto.setTotalSumDouble((long) 2 * countThisMonth);
cylinderFillingCheckDataUnitDto.setFillingPassedPercent(passed * 100); cylinderFillingCheckDataUnitDto.setFillingPassedPercent(passed * 100);
cylinderFillingCheckDataUnitDto.setAppId(cylinderUnit.getAppId()); cylinderFillingCheckDataUnitDto.setAppId(cylinderUnit.getAppId());
} }
/** /**
* 充装量、卸液量按单位统计 * 充装量、卸液量按单位统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
//@Scheduled(cron = "0 0 2 * * ?") //@Scheduled(cron = "0 0 2 * * ?")
public void synFillingUnloadUnitData() { public void synFillingUnloadUnitData() {
cylinderFillingUnloadDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadDataUnit>()); cylinderFillingUnloadDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadDataUnit>());
countByUnit(cylinderUnit -> { countByUnit(cylinderUnit -> {
Calendar now = Calendar.getInstance(); Calendar now = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
now.add(Calendar.DATE, -1); now.add(Calendar.DATE, -1);
CylinderFillingUnloadDataUnitDto temp = new CylinderFillingUnloadDataUnitDto(); CylinderFillingUnloadDataUnitDto temp = new CylinderFillingUnloadDataUnitDto();
Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSumByDate(cylinderUnit.getAppId(), Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSumByDate(cylinderUnit.getAppId(),
now.getTime()); now.getTime());
Double unloadSum = 0d; Double unloadSum = 0d;
temp.setFillingSum(fillingSum); temp.setFillingSum(fillingSum);
temp.setAppId(cylinderUnit.getAppId()); temp.setAppId(cylinderUnit.getAppId());
temp.setStatisDate(now.getTime()); temp.setStatisDate(now.getTime());
temp.setStatisDateStr(sdf.format(now.getTime())); temp.setStatisDateStr(sdf.format(now.getTime()));
temp.setUnloadSum(unloadSum); temp.setUnloadSum(unloadSum);
cylinderFillingUnloadDataUnitServiceImpl.createWithModel(temp); cylinderFillingUnloadDataUnitServiceImpl.createWithModel(temp);
} }
}); });
} }
// @Scheduled(cron = "${tzs.cylinder.info.cron}") // @Scheduled(cron = "${tzs.cylinder.info.cron}")
public void setTimeSaveCylinderInfoToES(){ public void setTimeSaveCylinderInfoToES() {
Page<CylinderInfoDto> cylinderInfoPage = new Page<>(); Page<CylinderInfoDto> cylinderInfoPage = new Page<>();
Page<CylinderInfoDto> cyinderInfoList = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage); Page<CylinderInfoDto> cyinderInfoList = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage);
Long count = cyinderInfoList.getCurrent(); Long count = cyinderInfoList.getCurrent();
Long times = 0L; Long times = 0L;
if (count != 0) { if (count != 0) {
times = count / 1000; times = count / 1000;
Long last = count % 1000; Long last = count % 1000;
if (last > 0) { if (last > 0) {
times++; times++;
} }
} }
for (int i = 0; i <= times; i++) { for (int i = 0; i <= times; i++) {
cylinderInfoPage.setCurrent(1); cylinderInfoPage.setCurrent(1);
cylinderInfoPage.setSize(1000); cylinderInfoPage.setSize(1000);
cylinderInfoPage = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage); cylinderInfoPage = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage);
if(!ObjectUtils.isEmpty(cylinderInfoPage)){ if (!ObjectUtils.isEmpty(cylinderInfoPage)) {
saveCylinderInfo2ES(cylinderInfoPage.getRecords()); saveCylinderInfo2ES(cylinderInfoPage.getRecords());
} }
// for (CylinderInfoDto ci : cylinderInfoPage.getRecords()) { // for (CylinderInfoDto ci : cylinderInfoPage.getRecords()) {
// saveCylinderInfoToES(ci); // saveCylinderInfoToES(ci);
// } // }
} }
} }
@Override @Override
public void saveCylinderInfo2ES(List<CylinderInfoDto> records) { public void saveCylinderInfo2ES(List<CylinderInfoDto> records) {
List<ESCylinderInfoDto> esCylinderInfoDto = new ArrayList<>(); List<ESCylinderInfoDto> esCylinderInfoDto = new ArrayList<>();
List<CylinderInfo> CylinderInfoList = new ArrayList<>(); List<CylinderInfo> CylinderInfoList = new ArrayList<>();
for (CylinderInfoDto record : records) { for (CylinderInfoDto record : records) {
ESCylinderInfoDto esCylinderInfo = new ESCylinderInfoDto(); ESCylinderInfoDto esCylinderInfo = new ESCylinderInfoDto();
BeanUtils.copyProperties(record,esCylinderInfo); BeanUtils.copyProperties(record, esCylinderInfo);
esCylinderInfoDto.add(esCylinderInfo); esCylinderInfoDto.add(esCylinderInfo);
CylinderInfo cylinderInfo = new CylinderInfo(); CylinderInfo cylinderInfo = new CylinderInfo();
BeanUtils.copyProperties(record,cylinderInfo); BeanUtils.copyProperties(record, cylinderInfo);
cylinderInfo.setSequenceNbr(record.getSequenceNbr()); cylinderInfo.setSequenceNbr(record.getSequenceNbr());
cylinderInfo.setIsNotEs("1"); cylinderInfo.setIsNotEs("1");
CylinderInfoList.add(cylinderInfo); CylinderInfoList.add(cylinderInfo);
} }
esCylinderInfoRepository.saveAll(esCylinderInfoDto); esCylinderInfoRepository.saveAll(esCylinderInfoDto);
this.updateBatchById(CylinderInfoList); this.updateBatchById(CylinderInfoList);
} }
@Override @Override
public Integer getInfoTotal() { public Integer getInfoTotal() {
return cylinderInfoMapper.getInfoTotal(); return cylinderInfoMapper.getInfoTotal();
} }
@Override @Override
public ESCylinderInfoDto saveCylinderInfoToES(CylinderInfoDto ci) { public ESCylinderInfoDto saveCylinderInfoToES(CylinderInfoDto ci) {
ESCylinderInfoDto esCylinderInfoDto = new ESCylinderInfoDto(); ESCylinderInfoDto esCylinderInfoDto = new ESCylinderInfoDto();
BeanUtils.copyProperties(ci,esCylinderInfoDto); BeanUtils.copyProperties(ci, esCylinderInfoDto);
ESCylinderInfoDto saveResult = esCylinderInfoRepository.save(esCylinderInfoDto); ESCylinderInfoDto saveResult = esCylinderInfoRepository.save(esCylinderInfoDto);
if(!ObjectUtils.isEmpty(saveResult)){ if (!ObjectUtils.isEmpty(saveResult)) {
//同步到es后修改 //同步到es后修改
CylinderInfo cylinderInfo = new CylinderInfo(); CylinderInfo cylinderInfo = new CylinderInfo();
cylinderInfo.setIsNotEs("1"); cylinderInfo.setIsNotEs("1");
cylinderInfoMapper.update(cylinderInfo, new QueryWrapper<CylinderInfo>().eq("sequence_nbr", ci.getSequenceNbr())); cylinderInfoMapper.update(cylinderInfo, new QueryWrapper<CylinderInfo>().eq("sequence_nbr", ci.getSequenceNbr()));
} }
return saveResult; return saveResult;
} }
@Override @Override
public Page<ESCylinderInfoDto> queryByKeys(CylinderInfoDto cylinderInfoDto, int pageNum, int pageSize) { public Page<ESCylinderInfoDto> queryByKeys(CylinderInfoDto cylinderInfoDto, int pageNum, int pageSize) {
Page<ESCylinderInfoDto> result = new Page<ESCylinderInfoDto>(pageNum, pageSize); Page<ESCylinderInfoDto> result = new Page<ESCylinderInfoDto>(pageNum, pageSize);
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); SearchRequest request = new SearchRequest();
credentialsProvider.setCredentials(AuthScope.ANY, request.indices("cylinder_info");
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient =new RestHighLevelClient( //通用匹配规则,条件构建
RestClient.builder( boolean flag = true;
new HttpHost(esAddress,esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() { SearchSourceBuilder builder = new SearchSourceBuilder();
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) { BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider); //匹配统一信用代码
} if (!ObjectUtils.isEmpty(cylinderInfoDto.getCreditCode())) {
}) flag = false;
); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchQuery("creditCode", cylinderInfoDto.getCreditCode()));
boolMust.must(meBuilder);
}
// RestHighLevelClient esClient = new RestHighLevelClient(
// RestClient.builder(new HttpHost(esAddress, esPort, "http")) //匹配RegionCode
// ); if (!ObjectUtils.isEmpty(cylinderInfoDto.getRegionCode())) {
flag = false;
BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery();
SearchRequest request = new SearchRequest(); appIdBuilder.must(QueryBuilders.matchQuery("regionCode", "*" + cylinderInfoDto.getRegionCode() + "*"));
request.indices("cylinder_info"); boolMust.should(appIdBuilder);
}
//通用匹配规则,条件构建
boolean flag = true; //匹配appid
if (!ObjectUtils.isEmpty(cylinderInfoDto.getAppId())) {
SearchSourceBuilder builder = new SearchSourceBuilder(); flag = false;
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery();
appIdBuilder.must(QueryBuilders.matchQuery("appId", "*" + cylinderInfoDto.getAppId() + "*"));
//匹配统一信用代码 boolMust.should(appIdBuilder);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getCreditCode())) { }
flag = false;
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); //匹配产权单位
meBuilder.must(QueryBuilders.matchQuery("creditCode", cylinderInfoDto.getCreditCode())); if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitName())) {
boolMust.must(meBuilder); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("unitName", "*" + cylinderInfoDto.getUnitName() + "*"));
//匹配RegionCode boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getRegionCode())) { }
flag = false;
BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery(); //匹配出厂编号
appIdBuilder.must(QueryBuilders.matchQuery("regionCode", "*" + cylinderInfoDto.getRegionCode() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getFactoryNum())) {
boolMust.should(appIdBuilder); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("factoryNum", "*" + cylinderInfoDto.getFactoryNum() + "*"));
//匹配appid boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getAppId())) { }
flag = false;
BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery(); //匹配气瓶品种
appIdBuilder.must(QueryBuilders.matchQuery("appId", "*" + cylinderInfoDto.getAppId() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderVariety())) {
boolMust.should(appIdBuilder); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("cylinderVariety", cylinderInfoDto.getCylinderVariety()));
//匹配产权单位 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitName())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //匹配二维码编码
query.must(QueryBuilders.matchQuery("unitName", "*" + cylinderInfoDto.getUnitName() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getQrCode())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("qrCode", "*" + cylinderInfoDto.getQrCode() + "*"));
//匹配出厂编号 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getFactoryNum())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //匹配电子标签
query.must(QueryBuilders.matchQuery("factoryNum", "*" + cylinderInfoDto.getFactoryNum() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getElectronicLabelCode())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("electronicLabelCode", "*" + cylinderInfoDto.getElectronicLabelCode() + "*"));
//匹配气瓶品种 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderVariety())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //匹配气瓶唯一标识
query.must(QueryBuilders.matchQuery("cylinderVariety", cylinderInfoDto.getCylinderVariety())); if (!ObjectUtils.isEmpty(cylinderInfoDto.getSequenceCode())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder sequenceCodeBuilder = QueryBuilders.boolQuery();
sequenceCodeBuilder.must(QueryBuilders.matchQuery("sequenceCode", cylinderInfoDto.getSequenceCode()));
//匹配二维码编码 boolMust.must(sequenceCodeBuilder);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getQrCode())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //匹配单位内部编号
query.must(QueryBuilders.matchQuery("qrCode", "*" + cylinderInfoDto.getQrCode() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitInnerCode())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("unitInnerCode", "*" + cylinderInfoDto.getUnitInnerCode() + "*"));
//匹配电子标签 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getElectronicLabelCode())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //气瓶状态
query.must(QueryBuilders.matchQuery("electronicLabelCode", "*" + cylinderInfoDto.getElectronicLabelCode() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderStatus())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("cylinderStatus", cylinderInfoDto.getCylinderStatus()));
//匹配气瓶唯一标识 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getSequenceCode())) { }
flag = false;
BoolQueryBuilder sequenceCodeBuilder = QueryBuilders.boolQuery(); //制造单位
sequenceCodeBuilder.must(QueryBuilders.matchQuery("sequenceCode", cylinderInfoDto.getSequenceCode())); if (!ObjectUtils.isEmpty(cylinderInfoDto.getManufacturingUnit())) {
boolMust.must(sequenceCodeBuilder); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("manufacturingUnit", "*" + cylinderInfoDto.getManufacturingUnit() + "*"));
//匹配单位内部编号 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitInnerCode())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //检验日期
query.must(QueryBuilders.matchQuery("unitInnerCode", "*" + cylinderInfoDto.getUnitInnerCode() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateStart()) && !ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateEnd())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.rangeQuery("inspectionDate").from(cylinderInfoDto.getInspectionDateStart()).to(cylinderInfoDto.getInspectionDateEnd()));
//气瓶状态 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderStatus())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); if (flag) { // 搜索全部
query.must(QueryBuilders.matchQuery("cylinderStatus", cylinderInfoDto.getCylinderStatus())); boolMust.must(QueryBuilders.matchAllQuery());
boolMust.must(query); }
}
builder.query(boolMust);
//制造单位 builder.from((pageNum - 1) * pageSize);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getManufacturingUnit())) { builder.size(pageSize);
flag = false; builder.trackTotalHits(true);
BoolQueryBuilder query = QueryBuilders.boolQuery(); request.source(builder);
query.must(QueryBuilders.matchQuery("manufacturingUnit", "*" + cylinderInfoDto.getManufacturingUnit() + "*")); List<ESCylinderInfoDto> list = new LinkedList<>();
boolMust.must(query); long totle = 0;
} try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
//检验日期 for (org.elasticsearch.search.SearchHit hit : response.getHits()) {
if (!ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateStart()) && !ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateEnd())) { JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
flag = false; ESCylinderInfoDto esCylinderInfoDto = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderInfoDto.class);
BoolQueryBuilder query = QueryBuilders.boolQuery(); list.add(esCylinderInfoDto);
query.must(QueryBuilders.rangeQuery("inspectionDate").from(cylinderInfoDto.getInspectionDateStart()).to(cylinderInfoDto.getInspectionDateEnd())); }
boolMust.must(query); totle = response.getInternalResponse().hits().getTotalHits().value;
} result.setRecords(list);
result.setTotal(totle);
if(flag) { // 搜索全部 } catch (IOException e) {
boolMust.must(QueryBuilders.matchAllQuery()); throw new RuntimeException(e);
} } finally {
try {
builder.query(boolMust); restHighLevelClient.close();
builder.from((pageNum - 1) * pageSize); } catch (Exception e) {
builder.size(pageSize); throw new RuntimeException(e);
builder.trackTotalHits(true); }
request.source(builder); }
List<ESCylinderInfoDto> list = new LinkedList<>();
long totle = 0; return result;
try { }
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits()) {
System.out.println(hit); /**
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); * 根据月份统计
ESCylinderInfoDto esCylinderInfoDto = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderInfoDto.class); */
list.add(esCylinderInfoDto); private void countByMonth(IntConsumer consumer) {
} for (int i = 0; i < 12; i++) {
totle = response.getInternalResponse().hits().getTotalHits().value; consumer.accept(i);
result.setRecords(list); }
result.setTotal(totle); }
} catch (IOException e) {
throw new RuntimeException(e); /**
} * 根据单位统计
*/
return result; private void countByUnit(Consumer<CylinderUnit> consumer) {
} List<CylinderUnit> units = cylinderUnitServiceImpl.list();
units.forEach(consumer);
}
/**
* 根据区域统计
/** */
* 根据月份统计 private void countByRegion(Consumer<RegionModel> consumer) {
*/ List<RegionModel> regionList = new ArrayList<>();
private void countByMonth(IntConsumer consumer) { startPlatformTokenService.getToken();
for (int i = 0; i < 12; i++) { Collection<RegionModel> regions = Systemctl.regionClient.queryForTree(null).getResult();
consumer.accept(i); regions.forEach(regionModel -> convertTreeToList(regionList, regionModel));
} regionList.forEach(consumer);
} }
/** /**
* 根据单位统计 * 将区域树转为区域List列表
*/ */
private void countByUnit(Consumer<CylinderUnit> consumer) { private void convertTreeToList(List<RegionModel> regionList, RegionModel region) {
List<CylinderUnit> units = cylinderUnitServiceImpl.list(); regionList.add(region);
units.forEach(consumer); if (region.getChildren() != null) {
} region.getChildren().forEach(c -> {
convertTreeToList(regionList, c);
/** });
* 根据区域统计 }
*/ }
private void countByRegion(Consumer<RegionModel> consumer) {
List<RegionModel> regionList = new ArrayList<>(); public Integer getOverDateStatisticsNumber(String earlyWarningLevel) {
startPlatformTokenService.getToken(); return this.baseMapper.countOverDateNumber(earlyWarningLevel);
Collection<RegionModel> regions = Systemctl.regionClient.queryForTree(null).getResult(); }
regions.forEach(regionModel -> convertTreeToList(regionList, regionModel));
regionList.forEach(consumer); public Page<CylinderInfoDto> earlyWarningLevelPageList(Page<CylinderInfoDto> page, String earlyWarningLevel) {
} Page<CylinderInfoDto> result = this.baseMapper.queryPageListByEarlyWarningLevel(page, earlyWarningLevel);
result.getRecords().forEach(r -> {
/**
* 将区域树转为区域List列表
*/
private void convertTreeToList(List<RegionModel> regionList, RegionModel region) {
regionList.add(region);
if (region.getChildren() != null) {
region.getChildren().forEach(c -> {
convertTreeToList(regionList, c);
});
}
}
public Integer getOverDateStatisticsNumber(String earlyWarningLevel) {
return this.baseMapper.countOverDateNumber(earlyWarningLevel);
}
public Page<CylinderInfoDto> earlyWarningLevelPageList(Page<CylinderInfoDto> page, String earlyWarningLevel) {
Page<CylinderInfoDto> result = this.baseMapper.queryPageListByEarlyWarningLevel(page, earlyWarningLevel);
result.getRecords().forEach(r -> {
// r.setEarlyWarningLevelName(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getName()); // r.setEarlyWarningLevelName(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getName());
// r.setInspectionStatusDesc(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getStatus()); // r.setInspectionStatusDesc(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getStatus());
}); });
return result; return result;
} }
public void calEarlyWarningLevel() { public void calEarlyWarningLevel() {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("气瓶超期预警时间调用规则开始"); log.debug("气瓶超期预警时间调用规则开始");
} }
// 1.批量分组大小 // 1.批量分组大小
int size = 500; int size = 500;
int total = this.count(); int total = this.count();
int groupNumber = total / size + 1; int groupNumber = total / size + 1;
// 2.批量小分组处理数据,调用规则 // 2.批量小分组处理数据,调用规则
for (int i = 0; i < groupNumber; i++) { for (int i = 0; i < groupNumber; i++) {
Page<CylinderInfo> page = new Page<>(); Page<CylinderInfo> page = new Page<>();
page.setCurrent(i); page.setCurrent(i);
page.setSize(size); page.setSize(size);
LambdaQueryWrapper<CylinderInfo> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CylinderInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.select(CylinderInfo::getSequenceCode, CylinderInfo::getSequenceNbr) wrapper.select(CylinderInfo::getSequenceCode, CylinderInfo::getSequenceNbr)
.orderByDesc(CylinderInfo::getSequenceNbr); .orderByDesc(CylinderInfo::getSequenceNbr);
IPage<CylinderInfo> result = this.page(page, wrapper); IPage<CylinderInfo> result = this.page(page, wrapper);
for (CylinderInfo r : result.getRecords()) { for (CylinderInfo r : result.getRecords()) {
// 设置token // 设置token
tzsAuthService.setRequestContext(); tzsAuthService.setRequestContext();
// 调用规则 // 调用规则
this.touchRuleToCalLevel(r); this.touchRuleToCalLevel(r);
} }
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("气瓶超期预警时间调用规则完成"); log.debug("气瓶超期预警时间调用规则完成");
} }
} }
private void touchRuleToCalLevel(CylinderInfo r) { private void touchRuleToCalLevel(CylinderInfo r) {
Date now = new Date(); Date now = new Date();
String dateStr; String dateStr;
try { try {
dateStr = DateUtils.dateFormat(now, DateUtils.DATE_TIME_PATTERN); dateStr = DateUtils.dateFormat(now, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) { } catch (ParseException e) {
throw new RuntimeException("日期个时候失败"); throw new RuntimeException("日期个时候失败");
} }
// 1.气瓶详情 // 1.气瓶详情
CylinderInfoDto cylinderInfoDto = this.getDetail(r.getSequenceCode()); CylinderInfoDto cylinderInfoDto = this.getDetail(r.getSequenceCode());
try { try {
WarningMsgDto warningMsgDto = new WarningMsgDto(); WarningMsgDto warningMsgDto = new WarningMsgDto();
int interval = DateUtils.dateBetweenIncludeToday(now, cylinderInfoDto.getNextInspectionDate()) - 1; int interval = DateUtils.dateBetweenIncludeToday(now, cylinderInfoDto.getNextInspectionDate()) - 1;
warningMsgDto.setNum(String.valueOf(interval)); warningMsgDto.setNum(String.valueOf(interval));
warningMsgDto.setFactoryNum(cylinderInfoDto.getFactoryNum()); warningMsgDto.setFactoryNum(cylinderInfoDto.getFactoryNum());
// warningMsgDto.setUserType(cylinderInfoDto.getCustomType()); // warningMsgDto.setUserType(cylinderInfoDto.getCustomType());
// warningMsgDto.setUserPeople(cylinderInfoDto.getCustomName()); // warningMsgDto.setUserPeople(cylinderInfoDto.getCustomName());
// warningMsgDto.setUserPeoplePhone(cylinderInfoDto.getContactPhone()); // warningMsgDto.setUserPeoplePhone(cylinderInfoDto.getContactPhone());
warningMsgDto.setCode(cylinderInfoDto.getSequenceCode()); warningMsgDto.setCode(cylinderInfoDto.getSequenceCode());
warningMsgDto.setCompanyName(cylinderInfoDto.getUnitName()); warningMsgDto.setCompanyName(cylinderInfoDto.getUnitName());
warningMsgDto.setPhone(cylinderInfoDto.getPersonMobilePhone()); warningMsgDto.setPhone(cylinderInfoDto.getPersonMobilePhone());
warningMsgDto.setPeople(cylinderInfoDto.getUnitPerson()); warningMsgDto.setPeople(cylinderInfoDto.getUnitPerson());
warningMsgDto.setCurrentTime(dateStr); warningMsgDto.setCurrentTime(dateStr);
// 2.循环调用规则 触发计算等级及发送消息 // 2.循环调用规则 触发计算等级及发送消息
if (log.isInfoEnabled()) { if (log.isInfoEnabled()) {
log.info("调用规则对象!+:{}", JSON.toJSONString(warningMsgDto)); log.info("调用规则对象!+:{}", JSON.toJSONString(warningMsgDto));
} }
ruleTrigger.publish(warningMsgDto, packageId, null); ruleTrigger.publish(warningMsgDto, packageId, null);
} catch (Exception e) { } catch (Exception e) {
log.error("调用规则失败!:{},{}", JSON.toJSONString(cylinderInfoDto), e); log.error("调用规则失败!:{},{}", JSON.toJSONString(cylinderInfoDto), e);
} }
} }
public CylinderInfoDto getDetail(String sequenceCode) { public CylinderInfoDto getDetail(String sequenceCode) {
CylinderInfoDto dto = scheduleMapper.getCylDetail(sequenceCode); CylinderInfoDto dto = scheduleMapper.getCylDetail(sequenceCode);
dto.setInspectionStatusDesc(StringUtils.isNotEmpty(dto.getEarlyWarningLevel()) dto.setInspectionStatusDesc(StringUtils.isNotEmpty(dto.getEarlyWarningLevel())
? EarlyWarningLevelEnum.getEumByLevel(dto.getEarlyWarningLevel()).getStatus() ? EarlyWarningLevelEnum.getEumByLevel(dto.getEarlyWarningLevel()).getStatus()
: ""); : "");
return dto; return dto;
} }
public List<MsgLog> getMsgList(String sequenceCode, String terminalType) { public List<MsgLog> getMsgList(String sequenceCode, String terminalType) {
LambdaQueryWrapper<MsgLog> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<MsgLog> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MsgLog::getRelationCode, sequenceCode); wrapper.eq(MsgLog::getRelationCode, sequenceCode);
wrapper.eq(StringUtils.isNotEmpty(terminalType), MsgLog::getTerminalType, terminalType); wrapper.eq(StringUtils.isNotEmpty(terminalType), MsgLog::getTerminalType, terminalType);
wrapper.orderByDesc(MsgLog::getSendTime); wrapper.orderByDesc(MsgLog::getSendTime);
return msgLogService.list(wrapper); return msgLogService.list(wrapper);
} }
/** /**
* 更新气瓶等级 * 更新气瓶等级
* *
* @param sequenceCode 唯一表设 * @param sequenceCode 唯一表设
* @param level 等级 * @param level 等级
* @return CylinderInfo * @return CylinderInfo
*/ */
public CylinderInfo updateEarlyWarningLevel(String sequenceCode, String level) { public CylinderInfo updateEarlyWarningLevel(String sequenceCode, String level) {
CylinderInfo cylinderInfo = this CylinderInfo cylinderInfo = this
.getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, sequenceCode)); .getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, sequenceCode));
cylinderInfo.setEarlyWarningLevel(level); cylinderInfo.setEarlyWarningLevel(level);
cylinderInfo.setEarlyWarningLevelCalDate(new Date()); cylinderInfo.setEarlyWarningLevelCalDate(new Date());
this.updateById(cylinderInfo); this.updateById(cylinderInfo);
return cylinderInfo; return cylinderInfo;
} }
public Boolean nextInspectionDateUpdate(List<CylinderInfoDto> cylinderInfoDtos) { public Boolean nextInspectionDateUpdate(List<CylinderInfoDto> cylinderInfoDtos) {
// 1.更新下次检验日期 // 1.更新下次检验日期
List<CylinderInfo> cylinderInfos = new ArrayList<>(); List<CylinderInfo> cylinderInfos = new ArrayList<>();
cylinderInfoDtos.forEach(c -> { cylinderInfoDtos.forEach(c -> {
CylinderInfo cylinderInfo = this.getOne( CylinderInfo cylinderInfo = this.getOne(
new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, c.getSequenceCode())); new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, c.getSequenceCode()));
// cylinderInfo.setNextInspectionDate(c.getNextInspectionDate()); // cylinderInfo.setNextInspectionDate(c.getNextInspectionDate());
cylinderInfos.add(cylinderInfo); cylinderInfos.add(cylinderInfo);
}); });
if (!cylinderInfos.isEmpty()) { if (!cylinderInfos.isEmpty()) {
this.updateBatchById(cylinderInfos); this.updateBatchById(cylinderInfos);
} }
// 2.循环调用规则 触发计算等级及发送消息 // 2.循环调用规则 触发计算等级及发送消息
cylinderInfos.forEach(this::touchRuleToCalLevel); cylinderInfos.forEach(this::touchRuleToCalLevel);
return Boolean.TRUE; return Boolean.TRUE;
} }
public Page<CylinderInfoDto> cyinderInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort,List<String> appids){ public Page<CylinderInfoDto> cyinderInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort, List<String> appids) {
return cylinderInfoMapper.cyinderInfoList(page,cylinderInfoDto,sort,appids); return cylinderInfoMapper.cyinderInfoList(page, cylinderInfoDto, sort, appids);
} }
public Page<CylinderInfoDto> getCyinderInfoList(Page<CylinderInfoDto> page) { public Page<CylinderInfoDto> getCyinderInfoList(Page<CylinderInfoDto> page) {
return cylinderInfoMapper.getCyinderInfoList(page); return cylinderInfoMapper.getCyinderInfoList(page);
} }
public Page<CylinderInfoDto> cyinderOutInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort,List<String> appids){ public Page<CylinderInfoDto> cyinderOutInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort, List<String> appids) {
return cylinderInfoMapper.cyinderOutInfoList(page,cylinderInfoDto,sort,appids); return cylinderInfoMapper.cyinderOutInfoList(page, cylinderInfoDto, sort, appids);
} }
} }
\ No newline at end of file
#DB properties: #DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=cn.com.vastbase.Driver
spring.datasource.url=jdbc:mysql://36.46.151.113:23306/tzs_amos_tzs_biz_init?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.datasource.url=jdbc:vastbase://192.168.249.180:54321/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=Yeejoin@2020 spring.datasource.password=Yeejoin@2023
eureka.client.service-url.defaultZone=http://192.168.249.13:10001/eureka/,http://192.168.249.139:10001/eureka/
#eureka properties: eureka.instance.prefer-ip-address=true
eureka.instance.hostname= eureka eureka.instance.ip-address=192.168.249.13
eureka.instance.prefer-ip-address = true management.endpoint.health.show-details=always
eureka.client.serviceUrl.defaultZone =http://36.46.151.113:10001/eureka/ management.endpoints.web.exposure.include=*
eureka.instance.ip-address = 172.16.3.133 eureka.instance.health-check-url=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/doc.html
## ES properties: ## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=docker-cluster
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username=elastic elasticsearch.username=elastic
elasticsearch.password=123456 elasticsearch.password=Yeejoin@2023
spring.elasticsearch.rest.uris=http://192.168.249.218:9200,http://192.168.249.114:9200,http://192.168.249.155:9200
## unit(h) ## unit(h)
alertcall.es.synchrony.time=48 alertcall.es.synchrony.time=48
#redis properties: #redis properties:
spring.redis.database=1 #集群环境
spring.redis.host=36.46.151.113 spring.redis.cluster.nodes=192.168.249.218:6377,192.168.249.114:6377,192.168.249.155:6377
spring.redis.port=16379 spring.redis.password=Yeejoin@2023
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200 spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1 spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=300
## emqx properties: ## emqx properties:
emqx.clean-session=false emqx.clean-session=false
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://36.46.151.113:1883 emqx.broker=tcp://192.168.249.180:2883
emqx.user-name=super emqx.user-name=super
emqx.password=123456 emqx.password=123456
emqx.keepAliveInterval=1000 emqx.keepAliveInterval=1000
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4 tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.46.151.113:8000 tzs.cti.url=http://36.41.172.83:8000
##wechatTokenls
##wechatToken
tzs.wechat.token=yeejoin_2021 tzs.wechat.token=yeejoin_2021
##wechatTicketUrl ##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token= tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
#tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw #tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
...@@ -61,41 +50,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html ...@@ -61,41 +50,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
#tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU #tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti cti.user.name=tzs_cti
cti.user.pwd=a1234567 cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001 flc.sms.tempCode=SMS_TZS_0001
## ??????id
## \u9884\u8B66\u901A\u77E5\u6A21\u677Fid
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##\u7763\u67E5\u6574\u6539\u901A\u77E5 ##??????
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## ???????id???userId?
## \u516C\u4F17\u53F7\u6D4B\u8BD5\u7528\u6237id\uFF08\u5E73\u53F0userId\uFF09
tzs.wechat.test.userId=3413513 tzs.wechat.test.userId=3413513
##new properties
fileserver.domain=https://rpm.yeeamos.com:8888/
org.filter.group.seq=1564150103147573249 org.filter.group.seq=1564150103147573249
fileserver.domain=http://192.168.249.180:19000/
log.level=INFO
duty.seats.role.ids=1585956200472674305,1585956257590706177 duty.seats.role.ids=1585956200472674305,1585956257590706177
## ???? properties:
rule.definition.load=false
##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto
rule.definition.default-agency=tzs
rule.definition.local-ip=192.168.249.13
#\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.fill.cron=0 0 12 * * ?
#\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.info.cron=0 0 1 * * ?
# ??????????
minio.url.path=http://192.168.249.180:19000/
## 生成监管码前缀域名
regulatory_code_prefix=https://nav.sspai.top/tzs?code=
outSystem.user.password=a1234560
amos.system.user.app-key=AMOS_STUDIO
amos.system.user.product=STUDIO_APP_WEB
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.10.90:53306/tzs_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://172.16.3.99:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.99:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.99:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.99:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=172.16.10.90
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic
elasticsearch.password= Yeejoin@2020
## unit(h)
alertcall.es.synchrony.time=48
fileserver.domain=https://rpm.yeeamos.com:8888/
#redis properties:
spring.redis.database=1
spring.redis.host=172.16.10.90
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.90:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://172.16.10.90:8000
rule.definition.load=false
rule.definition.model-package=com.yeejoin.amos.boot.module.tzs.api.dto
rule.definition.default-agency=tzs
rule.definition.localIp=172.16.3.39
org.filter.group.seq=1564150103147573249
duty.seats.role.ids=1585956200472674305,1585956257590706177
\ No newline at end of file
#DB properties: #DB properties:
spring.datasource.driver-class-name=cn.com.vastbase.Driver spring.datasource.driver-class-name=cn.com.vastbase.Driver
spring.datasource.url=jdbc:vastbase://36.46.137.116:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true spring.datasource.url=jdbc:vastbase://36.46.137.116:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true
#spring.datasource.url=jdbc:vastbase://36.46.151.113:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz
spring.datasource.username=admin spring.datasource.username=admin
spring.datasource.password=Yeejoin@2023 spring.datasource.password=Yeejoin@2023
#DB properties: eureka.client.service-url.defaultZone=http://172.16.10.230:10001/eureka/
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.url=jdbc:mysql://172.16.10.230:53306/${TZS_BIZ_DATABASE}?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
#spring.datasource.username=${MYSQL_ROOT_USER}
#spring.datasource.password=${MYSQL_ROOT_PASSWORD}
#eureka prioperties:
#eureka.client.serviceUrl.defaultZone=http://172.16.10.230:10001/eureka/
#eureka.client.register-with-eureka=true
#eureka.client.fetch-registry=true
#eureka.client.healthcheck.enabled=true
#ribbon.eureka.enabled=true
#eureka.instance.hostname=${spring.cloud.client.ip-address}
#eureka.instance.prefer-ip-address=true
#eureka.instance.instance-id=${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
#eureka.instance.lease-expiration-duration-in-seconds=10
#eureka.instance.lease-renewal-interval-in-seconds=5
#management.endpoint.health.show-details=always
#management.endpoints.web.exposure.include=*
#
#eureka.instance.prefer-ip-address = true
#eureka.instance.ip-address = 172.16.10.230
eureka.client.service-url.defaultZone =http://172.16.10.230:10001/eureka/
eureka.instance.prefer-ip-address=true eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=* management.endpoints.web.exposure.include=*
...@@ -36,25 +12,13 @@ eureka.instance.health-check-url=http://172.16.3.34:${server.port}${server.servl ...@@ -36,25 +12,13 @@ eureka.instance.health-check-url=http://172.16.3.34:${server.port}${server.servl
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.34:${server.port}${server.servlet.context-path}/actuator/info eureka.instance.status-page-url=http://172.16.3.34:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.34:${server.port}${server.servlet.context-path}/doc.html eureka.instance.metadata-map.management.api-docs=http://172.16.3.34:${server.port}${server.servlet.context-path}/doc.html
eureka.instance.ip-address=172.16.3.34
eureka.instance.ip-address = 172.16.3.34
## ES properties: ## ES properties:
biz.elasticsearch.port=9200 elasticsearch.username=elastic
biz.elasticsearch.address=172.16.10.230 elasticsearch.password=a123456
spring.data.elasticsearch.cluster-name=docker-cluster spring.elasticsearch.rest.uris=http:/172.16.10.230:9200
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic
elasticsearch.password= a123456
## unit(h) ## unit(h)
alertcall.es.synchrony.time=48 alertcall.es.synchrony.time=48
#redis properties: #redis properties:
spring.redis.database=1 spring.redis.database=1
spring.redis.host=172.16.10.230 spring.redis.host=172.16.10.230
...@@ -65,7 +29,6 @@ spring.redis.lettuce.pool.max-wait=-1 ...@@ -65,7 +29,6 @@ spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=300
## emqx properties: ## emqx properties:
emqx.clean-session=false emqx.clean-session=false
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
...@@ -73,20 +36,13 @@ emqx.broker=tcp://36.46.151.113:1883 ...@@ -73,20 +36,13 @@ emqx.broker=tcp://36.46.151.113:1883
emqx.user-name=super emqx.user-name=super
emqx.password=123456 emqx.password=123456
emqx.keepAliveInterval=1000 emqx.keepAliveInterval=1000
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4 tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.41.172.83:8000 tzs.cti.url=http://36.41.172.83:8000
##wechatToken ##wechatToken
tzs.wechat.token=yeejoin_2021 tzs.wechat.token=yeejoin_2021
##wechatTicketUrl ##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token= tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
#tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw #tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
...@@ -96,67 +52,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html ...@@ -96,67 +52,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
#tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU #tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti cti.user.name=tzs_cti
cti.user.pwd=a1234567 cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001 flc.sms.tempCode=SMS_TZS_0001
## ??????id ## ??????id
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##?????? ##??????
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## ???????id???userId? ## ???????id???userId?
tzs.wechat.test.userId=3413513 tzs.wechat.test.userId=3413513
##new properties ##new properties
org.filter.group.seq=1564150103147573249 org.filter.group.seq=1564150103147573249
fileserver.domain=http://172.16.10.230:19000/ fileserver.domain=http://172.16.10.230:19000/
log.level=INFO log.level=INFO
duty.seats.role.ids=1585956200472674305,1585956257590706177 duty.seats.role.ids=1585956200472674305,1585956257590706177
## ???? properties: ## ???? properties:
rule.definition.load=false rule.definition.load=false
##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto ##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto
rule.definition.default-agency=tzs rule.definition.default-agency=tzs
rule.definition.local-ip=172.16.10.230 rule.definition.local-ip=172.16.10.230
#\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es #\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.fill.cron=0 0 12 * * ? tzs.cylinder.fill.cron=0 0 12 * * ?
#\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es #\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.info.cron=0 0 1 * * ? tzs.cylinder.info.cron=0 0 1 * * ?
# ?????????? # ??????????
minio.url.path=http://172.16.10.230:9000/ minio.url.path=http://172.16.10.230:9000/
## ɼǰ׺ ## ɼǰ׺
regulatory_code_prefix=https://nav.sspai.top/tzs?code= regulatory_code_prefix=https://nav.sspai.top/tzs?code=
outSystem.user.password=a1234560 outSystem.user.password=a1234560
amos.system.user.app-key=AMOS_STUDIO amos.system.user.app-key=AMOS_STUDIO
amos.system.user.product=STUDIO_APP_WEB amos.system.user.product=STUDIO_APP_WEB
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://113.134.211.174:3306/xiy_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://172.16.3.28:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.28:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.28:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://192.168.1.10:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
## unit(h)
alertcall.es.synchrony.time=48
#redis properties:
spring.redis.database=1
spring.redis.host=172.16.3.28
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.3.28:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://113.134.211.174:8000
rule.definition.load=false
rule.definition.model-package=com.yeejoin.amos.boot.module.tzs.api.dto
rule.definition.default-agency=tzs
rule.definition.localIp=172.16.3.39
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://36.46.151.113:13306/tzs_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://36.46.151.113:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
## unit(h)
alertcall.es.synchrony.time=48
#redis properties:
spring.redis.database=1
spring.redis.host=36.46.151.113
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://36.46.151.113:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://113.134.211.174:8000
spring.application.name=TZS-COMMON spring.application.name=TZS-COMMON-SHG
server.servlet.context-path=/tcm server.servlet.context-path=/tcm
server.port=11001 server.port=11002
spring.profiles.active=dev3 spring.profiles.active=dev3
#最大等待队列长度,默认100 #最大等待队列长度,默认100
server.tomcat.accept-count=1000 server.tomcat.accept-count=1000
...@@ -11,7 +11,7 @@ server.tomcat.threads.max=800 ...@@ -11,7 +11,7 @@ server.tomcat.threads.max=800
#最小线程数,默认10 #最小线程数,默认10
server.tomcat.threads.min-spare=100 server.tomcat.threads.min-spare=100
logging.level.net.javacrumbs.shedlock=DEBUG
spring.jackson.time-zone=GMT+8 spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名--> <!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/jczs.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern> <FileNamePattern>${LOG_HOME}/Tcm.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<MaxHistory>30</MaxHistory> <MaxHistory>30</MaxHistory>
<!--日志文件大小--> <!--日志文件大小-->
...@@ -37,20 +37,20 @@ ...@@ -37,20 +37,20 @@
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" /> <logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
--> -->
<!--myibatis log configure--> <!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/> <logger name="com.apache.ibatis" level="debug"/>
<logger name="org.mybatis" level="INFO" /> <logger name="org.mybatis" level="debug" />
<logger name="java.sql.Connection" level="INFO"/> <logger name="java.sql.Connection" level="debug"/>
<logger name="java.sql.Statement" level="INFO"/> <logger name="java.sql.Statement" level="debug"/>
<logger name="java.sql.PreparedStatement" level="INFO"/> <logger name="java.sql.PreparedStatement" level="debug"/>
<logger name="org.springframework" level="INFO"/> <logger name="org.springframework" level="debug"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/> <logger name="com.baomidou.mybatisplus" level="debug"/>
<logger name="org.apache.activemq" level="INFO"/> <logger name="org.apache.activemq" level="debug"/>
<logger name="org.typroject" level="INFO"/> <logger name="org.typroject" level="debug"/>
<logger name="com.yeejoin" level="INFO"/> <logger name="com.yeejoin" level="debug"/>
<!-- 日志输出级别 --> <!-- 日志输出级别 -->
<root level="DEBUG"> <root level="error">
<!-- <appender-ref ref="FILE" /> --> <!-- <appender-ref ref="FILE" /> -->
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
<!-- <appender-ref ref="ELK" />--> <!-- <appender-ref ref="ELK" />-->
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/Tcm.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- ELK管理 -->
<appender name="ELK" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>172.16.10.230:4560</destination>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/>
<logger name="org.mybatis" level="INFO" />
<logger name="java.sql.Connection" level="INFO"/>
<logger name="java.sql.Statement" level="INFO"/>
<logger name="java.sql.PreparedStatement" level="INFO"/>
<logger name="org.springframework" level="INFO"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="INFO"/>
<logger name="com.yeejoin" level="INFO"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<!-- <appender-ref ref="FILE" /> -->
<appender-ref ref="STDOUT" />
<!-- <appender-ref ref="ELK" />-->
</root>
</configuration>
\ No newline at end of file
...@@ -37,20 +37,20 @@ ...@@ -37,20 +37,20 @@
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" /> <logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
--> -->
<!--myibatis log configure--> <!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/> <logger name="com.apache.ibatis" level="debug"/>
<logger name="org.mybatis" level="INFO" /> <logger name="org.mybatis" level="debug" />
<logger name="java.sql.Connection" level="INFO"/> <logger name="java.sql.Connection" level="debug"/>
<logger name="java.sql.Statement" level="INFO"/> <logger name="java.sql.Statement" level="debug"/>
<logger name="java.sql.PreparedStatement" level="INFO"/> <logger name="java.sql.PreparedStatement" level="debug"/>
<logger name="org.springframework" level="INFO"/> <logger name="org.springframework" level="debug"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/> <logger name="com.baomidou.mybatisplus" level="debug"/>
<logger name="org.apache.activemq" level="INFO"/> <logger name="org.apache.activemq" level="debug"/>
<logger name="org.typroject" level="INFO"/> <logger name="org.typroject" level="debug"/>
<logger name="com.yeejoin" level="INFO"/> <logger name="com.yeejoin" level="debug"/>
<!-- 日志输出级别 --> <!-- 日志输出级别 -->
<root level="DEBUG"> <root level="debug">
<!-- <appender-ref ref="FILE" /> --> <!-- <appender-ref ref="FILE" /> -->
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
<!-- <appender-ref ref="ELK" />--> <!-- <appender-ref ref="ELK" />-->
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/Tcm.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="org.mybatis" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<logger name="com.baomidou.mybatisplus" level="DEBUG"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/Tcm.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="org.mybatis" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<logger name="com.baomidou.mybatisplus" level="DEBUG"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
package com.yeejoin.amos.boot.module.ymt.biz.config; package com.yeejoin.amos.boot.module.ymt.biz.config;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope; import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider; import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder; import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
...@@ -16,6 +13,8 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -16,6 +13,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration @Configuration
public class ElasticSearchClientConfig { public class ElasticSearchClientConfig {
...@@ -35,27 +34,19 @@ public class ElasticSearchClientConfig { ...@@ -35,27 +34,19 @@ public class ElasticSearchClientConfig {
new UsernamePasswordCredentials(username, password)); new UsernamePasswordCredentials(username, password));
try { try {
String url = uris.replace("http://", ""); HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
final String[] parts = StringUtils.split(url, ":"); RestClientBuilder builder = RestClient.builder(httpHosts);
HttpHost httpHost = new HttpHost(parts[0], Integer.parseInt(parts[1]), "http"); builder.setHttpClientConfigCallback(httpClientBuilder -> {
RestClientBuilder builder = RestClient.builder(httpHost); httpClientBuilder.disableAuthCaching();
builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() { return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
@Override });
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) { // 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
httpClientBuilder.disableAuthCaching(); builder.setRequestConfigCallback(requestConfigBuilder -> {
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider); // 连接超时(默认为1秒)
} return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
}); });
builder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
@Override
public RequestConfig.Builder customizeRequestConfig(
RequestConfig.Builder requestConfigBuilder) {
return requestConfigBuilder.setConnectTimeout(5000 * 1000) // 连接超时(默认为1秒)
.setSocketTimeout(6000 * 1000);// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
}
});// 调整最大重试超时时间(默认为30秒).setMaxRetryTimeoutMillis(60000);
return new RestHighLevelClient(builder); return new RestHighLevelClient(builder);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -158,17 +158,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -158,17 +158,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//一码通复制功能url参数key //一码通复制功能url参数key
private static final String COPY_KEY = "stashType"; private static final String COPY_KEY = "stashType";
@Value("${biz.elasticsearch.address}") @Autowired
private String esAddress; RestHighLevelClient restHighLevelClient;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Value("${elasticsearch.username}")
private String esUserName;
@Value("${elasticsearch.password}")
private String esPwd;
private static String USE_CODE = "use_code"; private static String USE_CODE = "use_code";
...@@ -1185,11 +1176,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1185,11 +1176,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
public Page<JSONObject> queryByKeys(JSONObject map) { public Page<JSONObject> queryByKeys(JSONObject map) {
//根据当前登录人查询 // //根据当前登录人查询
if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) { if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) {
map.put(EQUSTATE, EquimentEnum.getCode.get(map.get(EQUSTATE).toString()).toString()); map.put(EQUSTATE, EquimentEnum.getCode.get(map.get(EQUSTATE).toString()).toString());
} }
ResponseModel<Page<Map<String, Object>>> model = new ResponseModel<>();
JSONObject object = getCompanyType().get(0); JSONObject object = getCompanyType().get(0);
String level = object.getString("level"); String level = object.getString("level");
String code = object.getString("orgCode"); String code = object.getString("orgCode");
...@@ -1204,19 +1194,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1204,19 +1194,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
} }
Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size")); Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size"));
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient = new RestHighLevelClient(
RestClient.builder(
new HttpHost(esAddress, esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
})
);
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all"); request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
...@@ -1226,12 +1203,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1226,12 +1203,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//SEQUENCE_NBR //SEQUENCE_NBR
if (!ObjectUtils.isEmpty(map.getString("SEQUENCE_NBR"))) { if (!ObjectUtils.isEmpty(map.getString("SEQUENCE_NBR"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("SEQUENCE_NBR", "*" + map.getString("SEQUENCE_NBR") + "*")); meBuilder.must(QueryBuilders.matchPhraseQuery("SEQUENCE_NBR", "*"+map.getString("SEQUENCE_NBR")+"*"));
boolMust.must(meBuilder); boolMust.must(meBuilder);
} }
if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_NAME"))) { if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_NAME"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery(); BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchPhraseQuery("ORG_BRANCH_NAME", "*" + map.getString("ORG_BRANCH_NAME") + "*")); query.must(QueryBuilders.matchPhraseQuery("ORG_BRANCH_NAME", "*"+map.getString("ORG_BRANCH_NAME")+"*" ));
boolMust.must(query); boolMust.must(query);
} }
if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_CODE"))) { if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_CODE"))) {
...@@ -1241,12 +1218,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1241,12 +1218,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_NAME"))) { if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_NAME"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery(); BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchPhraseQuery("USE_UNIT_NAME", "*" + map.getString("USE_UNIT_NAME") + "*")); query.must(QueryBuilders.matchPhraseQuery("USE_UNIT_NAME", "*"+map.getString("USE_UNIT_NAME")+"*"));
boolMust.must(query); boolMust.must(query);
} }
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_CREDIT_CODE"))) { if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_CREDIT_CODE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("USE_UNIT_CREDIT_CODE", "*" + map.getString("USE_UNIT_CREDIT_CODE") + "*")); meBuilder.must(QueryBuilders.matchPhraseQuery("USE_UNIT_CREDIT_CODE", "*"+map.getString("USE_UNIT_CREDIT_CODE")+"*"));
boolMust.must(meBuilder); boolMust.must(meBuilder);
} }
if (!ObjectUtils.isEmpty(map.getString("EQU_LIST_CODE"))) { if (!ObjectUtils.isEmpty(map.getString("EQU_LIST_CODE"))) {
...@@ -1256,23 +1233,23 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1256,23 +1233,23 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
if (!ObjectUtils.isEmpty(map.getString("EQU_LIST"))) { if (!ObjectUtils.isEmpty(map.getString("EQU_LIST"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_LIST", "*" + map.getString("EQU_LIST") + "*")); meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_LIST", "*"+map.getString("EQU_LIST")+"*"));
boolMust.must(meBuilder); boolMust.must(meBuilder);
} }
if (!ObjectUtils.isEmpty(map.getString("EQU_CATEGORY"))) { if (!ObjectUtils.isEmpty(map.getString("EQU_CATEGORY"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_CATEGORY", "*" + map.getString("EQU_CATEGORY") + "*")); meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_CATEGORY", "*"+map.getString("EQU_CATEGORY")+"*"));
boolMust.must(meBuilder); boolMust.must(meBuilder);
} }
if (!ObjectUtils.isEmpty(map.getString("USE_ORG_CODE"))) { if (!ObjectUtils.isEmpty(map.getString("USE_ORG_CODE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*" + map.getString("USE_ORG_CODE").toLowerCase() + "*")); meBuilder.must(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*"+map.getString("USE_ORG_CODE").toLowerCase()+"*"));
boolMust.must(meBuilder); boolMust.must(meBuilder);
} }
if (!ObjectUtils.isEmpty(map.getString("CODE96333"))) { if (!ObjectUtils.isEmpty(map.getString("CODE96333"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.wildcardQuery("CODE96333", "*" + map.getString("CODE96333").toLowerCase() + "*")); meBuilder.must(QueryBuilders.wildcardQuery("CODE96333", "*"+map.getString("CODE96333").toLowerCase()+"*"));
boolMust.must(meBuilder); boolMust.must(meBuilder);
} }
if (!ObjectUtils.isEmpty(map.getString("EQU_CODE"))) { if (!ObjectUtils.isEmpty(map.getString("EQU_CODE"))) {
...@@ -1283,7 +1260,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1283,7 +1260,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if (!ObjectUtils.isEmpty(map.getString("SUPERVISORY_CODE"))) { if (!ObjectUtils.isEmpty(map.getString("SUPERVISORY_CODE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.wildcardQuery("SUPERVISORY_CODE", "*" + map.getString("SUPERVISORY_CODE").toLowerCase() + "*")); meBuilder.must(QueryBuilders.wildcardQuery("SUPERVISORY_CODE", "*"+map.getString("SUPERVISORY_CODE").toLowerCase()+"*"));
boolMust.must(meBuilder); boolMust.must(meBuilder);
} }
if (!ObjectUtils.isEmpty(map.getString("USE_PLACE"))) { if (!ObjectUtils.isEmpty(map.getString("USE_PLACE"))) {
...@@ -1296,14 +1273,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1296,14 +1273,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
query.must(QueryBuilders.matchPhraseQuery("ADDRESS", "*" + map.getString("ADDRESS") + "*")); query.must(QueryBuilders.matchPhraseQuery("ADDRESS", "*" + map.getString("ADDRESS") + "*"));
boolMust.must(query); boolMust.must(query);
} }
if (!ObjectUtils.isEmpty(map.getString("EQU_STATE"))) { if (!ObjectUtils.isEmpty(map.getString("EQU_STATE")) ) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchQuery("EQU_STATE", map.getLong("EQU_STATE"))); meBuilder.must(QueryBuilders.matchQuery("EQU_STATE", map.getLong("EQU_STATE")));
boolMust.must(meBuilder); boolMust.must(meBuilder);
} }
if (!ObjectUtils.isEmpty(map.getString("STATUS"))) { if (!ObjectUtils.isEmpty(map.getString("STATUS"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchPhraseQuery("STATUS", "*" + map.getString("STATUS") + "*")); meBuilder.must(QueryBuilders.matchPhraseQuery("STATUS", "*"+map.getString("STATUS")+"*"));
boolMust.must(meBuilder); boolMust.must(meBuilder);
} }
builder.query(boolMust); builder.query(boolMust);
...@@ -1314,7 +1291,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1314,7 +1291,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
List<JSONObject> list = new LinkedList<>(); List<JSONObject> list = new LinkedList<>();
long totle = 0; long totle = 0;
try { try {
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT); SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits().getHits()) { for (org.elasticsearch.search.SearchHit hit : response.getHits().getHits()) {
System.out.println(hit); System.out.println(hit);
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
...@@ -1333,7 +1310,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1333,7 +1310,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
throw new RuntimeException(e); throw new RuntimeException(e);
} finally { } finally {
try { try {
esClient.close(); restHighLevelClient.close();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
...@@ -10,24 +10,15 @@ import com.yeejoin.amos.boot.module.ymt.flc.api.dto.CylinderFillingRecordDto; ...@@ -10,24 +10,15 @@ import com.yeejoin.amos.boot.module.ymt.flc.api.dto.CylinderFillingRecordDto;
import com.yeejoin.amos.boot.module.ymt.flc.api.entity.CylinderFillingRecord; import com.yeejoin.amos.boot.module.ymt.flc.api.entity.CylinderFillingRecord;
import com.yeejoin.amos.boot.module.ymt.flc.api.mapper.CylinderFillingRecordMapper; import com.yeejoin.amos.boot.module.ymt.flc.api.mapper.CylinderFillingRecordMapper;
import com.yeejoin.amos.boot.module.ymt.flc.api.service.ICylinderFillingRecordService; import com.yeejoin.amos.boot.module.ymt.flc.api.service.ICylinderFillingRecordService;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -55,17 +46,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -55,17 +46,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Autowired @Autowired
CylinderFillingRecordMapper cylinderFillingRecordMapper; CylinderFillingRecordMapper cylinderFillingRecordMapper;
@Value("${biz.elasticsearch.address}") @Autowired
private String esAddress; RestHighLevelClient restHighLevelClient;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Value("${elasticsearch.username}")
private String esUserName;
@Value("${elasticsearch.password}")
private String esPwd;
/** /**
* 分页查询 * 分页查询
...@@ -127,7 +109,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -127,7 +109,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Scheduled(cron = "${tzs.cylinder.fill.cron}") @Scheduled(cron = "${tzs.cylinder.fill.cron}")
public void setTimeSaveCylinderInfoToES(){ public void setTimeSaveCylinderInfoToES() {
Page<ESCylinderFillingRecordDto> cylinderFillingRecordPage = new Page<>(); Page<ESCylinderFillingRecordDto> cylinderFillingRecordPage = new Page<>();
Page<ESCylinderFillingRecordDto> cyinderInfoList = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage); Page<ESCylinderFillingRecordDto> cyinderInfoList = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage);
Long count = cyinderInfoList.getCurrent(); Long count = cyinderInfoList.getCurrent();
...@@ -143,10 +125,10 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -143,10 +125,10 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
cylinderFillingRecordPage.setCurrent(i); cylinderFillingRecordPage.setCurrent(i);
cylinderFillingRecordPage.setSize(1000); cylinderFillingRecordPage.setSize(1000);
cylinderFillingRecordPage = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage); cylinderFillingRecordPage = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordPage);
if(!ObjectUtils.isEmpty(cylinderFillingRecordPage)){ if (!ObjectUtils.isEmpty(cylinderFillingRecordPage)) {
cylinderFillingRecordPage.getRecords().stream().map(item->{ cylinderFillingRecordPage.getRecords().stream().map(item -> {
if(!ObjectUtils.isEmpty(item.getSequenceCode())){ if (!ObjectUtils.isEmpty(item.getSequenceCode())) {
ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(),item.getSequenceCode()); ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode());
item.setUnitName(cyinderFillingRecordInfo.getUnitName()); item.setUnitName(cyinderFillingRecordInfo.getUnitName());
item.setFactoryNum(cyinderFillingRecordInfo.getFactoryNum()); item.setFactoryNum(cyinderFillingRecordInfo.getFactoryNum());
item.setCylinderVariety(cyinderFillingRecordInfo.getCylinderVariety()); item.setCylinderVariety(cyinderFillingRecordInfo.getCylinderVariety());
...@@ -164,7 +146,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -164,7 +146,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
// for (ESCylinderFillingRecordDto ci : cylinderFillingRecordPage.getRecords()) { // for (ESCylinderFillingRecordDto ci : cylinderFillingRecordPage.getRecords()) {
// saveCylinderFillingRecordToES(ci); // saveCylinderFillingRecordToES(ci);
// } // }
if(!ObjectUtils.isEmpty(cylinderFillingRecordPage)){ if (!ObjectUtils.isEmpty(cylinderFillingRecordPage)) {
saveCylinderFillingRecord2ES(cylinderFillingRecordPage.getRecords()); saveCylinderFillingRecord2ES(cylinderFillingRecordPage.getRecords());
} }
} }
...@@ -174,7 +156,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -174,7 +156,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Override @Override
public Page<ESCylinderFillingRecordDto> getCyinderFillingRecord(Page<ESCylinderFillingRecordDto> cylinderFillingRecordDto) { public Page<ESCylinderFillingRecordDto> getCyinderFillingRecord(Page<ESCylinderFillingRecordDto> cylinderFillingRecordDto) {
Page<ESCylinderFillingRecordDto> cyinderFillingRecord = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordDto); Page<ESCylinderFillingRecordDto> cyinderFillingRecord = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordDto);
if(!ObjectUtils.isEmpty(cyinderFillingRecord)){ if (!ObjectUtils.isEmpty(cyinderFillingRecord)) {
cyinderFillingRecord.getRecords().stream().map(item -> { cyinderFillingRecord.getRecords().stream().map(item -> {
if (!ObjectUtils.isEmpty(item.getSequenceCode())) { if (!ObjectUtils.isEmpty(item.getSequenceCode())) {
ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode()); ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode());
...@@ -202,26 +184,6 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -202,26 +184,6 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
public Page<ESCylinderFillingRecordDto> queryByKeys(ESCylinderFillingRecordDto esCylinderFillingRecordDto, int pageNum, int pageSize) { public Page<ESCylinderFillingRecordDto> queryByKeys(ESCylinderFillingRecordDto esCylinderFillingRecordDto, int pageNum, int pageSize) {
Page<ESCylinderFillingRecordDto> result = new Page<ESCylinderFillingRecordDto>(pageNum, pageSize); Page<ESCylinderFillingRecordDto> result = new Page<ESCylinderFillingRecordDto>(pageNum, pageSize);
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient =new RestHighLevelClient(
RestClient.builder(
new HttpHost(esAddress,esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
})
);
// RestHighLevelClient esClient = new RestHighLevelClient(
// RestClient.builder(new HttpHost(esAddress, esPort, "http"))
// );
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("cylinder_filling"); request.indices("cylinder_filling");
...@@ -328,7 +290,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -328,7 +290,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
boolMust.must(query); boolMust.must(query);
} }
if(flag) { // 搜索全部 if (flag) { // 搜索全部
boolMust.must(QueryBuilders.matchAllQuery()); boolMust.must(QueryBuilders.matchAllQuery());
} }
...@@ -340,9 +302,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -340,9 +302,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
List<ESCylinderFillingRecordDto> list = new LinkedList<>(); List<ESCylinderFillingRecordDto> list = new LinkedList<>();
long totle = 0; long totle = 0;
try { try {
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT); SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits()) { for (org.elasticsearch.search.SearchHit hit : response.getHits()) {
System.out.println(hit);
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
ESCylinderFillingRecordDto esCylinderFillingRecordDto1 = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderFillingRecordDto.class); ESCylinderFillingRecordDto esCylinderFillingRecordDto1 = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderFillingRecordDto.class);
list.add(esCylinderFillingRecordDto1); list.add(esCylinderFillingRecordDto1);
...@@ -352,6 +313,12 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -352,6 +313,12 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
result.setTotal(totle); result.setTotal(totle);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} finally {
try {
restHighLevelClient.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
} }
return result; return result;
...@@ -362,7 +329,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -362,7 +329,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
List<CylinderFillingRecord> cylinderFillingRecordList = new ArrayList<>(); List<CylinderFillingRecord> cylinderFillingRecordList = new ArrayList<>();
for (ESCylinderFillingRecordDto record : records) { for (ESCylinderFillingRecordDto record : records) {
CylinderFillingRecord cylinderFillingRecord = new CylinderFillingRecord(); CylinderFillingRecord cylinderFillingRecord = new CylinderFillingRecord();
BeanUtils.copyProperties(record,cylinderFillingRecord); BeanUtils.copyProperties(record, cylinderFillingRecord);
cylinderFillingRecord.setIsNotEs("1"); cylinderFillingRecord.setIsNotEs("1");
cylinderFillingRecord.setSequenceNbr(record.getSequenceNbr()); cylinderFillingRecord.setSequenceNbr(record.getSequenceNbr());
cylinderFillingRecordList.add(cylinderFillingRecord); cylinderFillingRecordList.add(cylinderFillingRecord);
......
...@@ -25,17 +25,9 @@ import com.yeejoin.amos.feign.systemctl.Systemctl; ...@@ -25,17 +25,9 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
...@@ -68,1040 +60,1010 @@ import java.util.function.IntConsumer; ...@@ -68,1040 +60,1010 @@ import java.util.function.IntConsumer;
@Service @Service
@Slf4j @Slf4j
public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, CylinderInfo, CylinderInfoMapper> public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, CylinderInfo, CylinderInfoMapper>
implements ICylinderInfoService { implements ICylinderInfoService {
@Autowired @Autowired
CylinderUnitServiceImpl cylinderUnitServiceImpl; CylinderUnitServiceImpl cylinderUnitServiceImpl;
@Autowired @Autowired
CylinderUnitDataServiceImpl cylinderUnitDataServiceImpl; CylinderUnitDataServiceImpl cylinderUnitDataServiceImpl;
@Autowired @Autowired
CylinderInfoDataServiceImpl cylinderInfoDataServiceImpl; CylinderInfoDataServiceImpl cylinderInfoDataServiceImpl;
@Autowired @Autowired
CylinderTagsServiceImpl cylinderTagsServiceImpl; CylinderTagsServiceImpl cylinderTagsServiceImpl;
@Autowired @Autowired
CylinderFillingServiceImpl cylinderFillingServiceImpl; CylinderFillingServiceImpl cylinderFillingServiceImpl;
@Autowired @Autowired
CylinderIntegrityDataServiceImpl cylinderIntegrityDataServiceImpl; CylinderIntegrityDataServiceImpl cylinderIntegrityDataServiceImpl;
@Autowired @Autowired
CylinderFillingRecordServiceImpl cylinderFillingRecordServiceImpl; CylinderFillingRecordServiceImpl cylinderFillingRecordServiceImpl;
@Autowired @Autowired
CylinderFillingCheckServiceImpl cylinderFillingCheckServiceImpl; CylinderFillingCheckServiceImpl cylinderFillingCheckServiceImpl;
@Autowired @Autowired
CylinderAreaDataServiceImpl cylinderAreaDataServiceImpl; CylinderAreaDataServiceImpl cylinderAreaDataServiceImpl;
@Autowired @Autowired
CylinderFillingUnloadDataServiceImpl cylinderFillingUnloadDataServiceImpl; CylinderFillingUnloadDataServiceImpl cylinderFillingUnloadDataServiceImpl;
@Autowired @Autowired
CylinderInfoDataUnitServiceImpl cylinderInfoDataUnitServiceImpl; CylinderInfoDataUnitServiceImpl cylinderInfoDataUnitServiceImpl;
@Autowired @Autowired
CylinderFillingDataUnitServiceImpl cylinderFillingDataUnitServiceImpl; CylinderFillingDataUnitServiceImpl cylinderFillingDataUnitServiceImpl;
@Autowired @Autowired
CylinderTagsDataUnitServiceImpl cylinderTagsDataUnitServiceImpl; CylinderTagsDataUnitServiceImpl cylinderTagsDataUnitServiceImpl;
@Autowired @Autowired
CylinderIntegrityDataUnitServiceImpl cylinderIntegrityDataUnitServiceImpl; CylinderIntegrityDataUnitServiceImpl cylinderIntegrityDataUnitServiceImpl;
@Autowired @Autowired
CylinderFillingCheckDataUnitServiceImpl cylinderFillingCheckDataUnitServiceImpl; CylinderFillingCheckDataUnitServiceImpl cylinderFillingCheckDataUnitServiceImpl;
@Autowired @Autowired
CylinderFillingUnloadDataUnitServiceImpl cylinderFillingUnloadDataUnitServiceImpl; CylinderFillingUnloadDataUnitServiceImpl cylinderFillingUnloadDataUnitServiceImpl;
@Autowired @Autowired
MsgLogServiceImpl msgLogService; MsgLogServiceImpl msgLogService;
@Autowired @Autowired
private RuleTrigger ruleTrigger; private RuleTrigger ruleTrigger;
@Autowired @Autowired
TzsAuthServiceImpl tzsAuthService; TzsAuthServiceImpl tzsAuthService;
@Autowired @Autowired
private ScheduleMapper scheduleMapper; private ScheduleMapper scheduleMapper;
@Value("${cylinder-early-warning-packageId:气瓶监管/cylwarningmsg}") @Value("${cylinder-early-warning-packageId:气瓶监管/cylwarningmsg}")
private String packageId; private String packageId;
@Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}") @Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}")
private String cylPackageId; private String cylPackageId;
@Value("${biz.elasticsearch.address}") @Autowired
private String esAddress; RestHighLevelClient restHighLevelClient;
@Value("${biz.elasticsearch.port}")
private Integer esPort;
@Value("${elasticsearch.username}") @Autowired
private String esUserName; StartPlatformTokenService startPlatformTokenService;
@Value("${elasticsearch.password}") @Autowired
private String esPwd; CylinderInfoMapper cylinderInfoMapper;
@Autowired
@Autowired
StartPlatformTokenService startPlatformTokenService;
@Autowired
CylinderInfoMapper cylinderInfoMapper;
@Autowired
ESCylinderInfoRepository esCylinderInfoRepository; ESCylinderInfoRepository esCylinderInfoRepository;
/** /**
* 分页查询 * 分页查询
*/ */
public Page<CylinderInfoDto> queryForCylinderInfoPage(Page<CylinderInfoDto> page) { public Page<CylinderInfoDto> queryForCylinderInfoPage(Page<CylinderInfoDto> page) {
return queryForPage(page, null, false); return queryForPage(page, null, false);
} }
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<CylinderInfoDto> queryForCylinderInfoList() { public List<CylinderInfoDto> queryForCylinderInfoList() {
return queryForList("", false); return queryForList("", false);
} }
@Override @Override
public Map<String, String> queryNumAndOutOfDateNum(Long unitId) { public Map<String, String> queryNumAndOutOfDateNum(Long unitId) {
return baseMapper.queryNumAndOutOfDateNum(unitId); return baseMapper.queryNumAndOutOfDateNum(unitId);
} }
/** /**
* 获取上个月气瓶总量 * 获取上个月气瓶总量
*/ */
public Integer getMonthInfoTotal(String regionCode) { public Integer getMonthInfoTotal(String regionCode) {
return baseMapper.getMonthInfoTotal(regionCode); return baseMapper.getMonthInfoTotal(regionCode);
} }
/** /**
* 获取上个月气瓶总量 * 获取上个月气瓶总量
*/ */
public Integer getLastMonthInfoTotal(String regionCode) { public Integer getLastMonthInfoTotal(String regionCode) {
return baseMapper.getLastMonthInfoTotal(regionCode); return baseMapper.getLastMonthInfoTotal(regionCode);
} }
/** /**
* 获取上上个月气瓶总量 * 获取上上个月气瓶总量
*/ */
public Integer getMonthBeforeLastInfoTotal(String regionCode) { public Integer getMonthBeforeLastInfoTotal(String regionCode) {
return baseMapper.getMonthBeforeLastInfoTotal(regionCode); return baseMapper.getMonthBeforeLastInfoTotal(regionCode);
} }
public Integer getInfoTotalByRegionCode(String regionCode) { public Integer getInfoTotalByRegionCode(String regionCode) {
return baseMapper.getInfoTotalByRegionCode(regionCode); return baseMapper.getInfoTotalByRegionCode(regionCode);
} }
public Double queryIntegirtyByAppId(String appId) { public Double queryIntegirtyByAppId(String appId) {
return this.baseMapper.queryIntegirtyByAppId(appId); return this.baseMapper.queryIntegirtyByAppId(appId);
} }
public Integer getWarnNum(String code) { public Integer getWarnNum(String code) {
return baseMapper.getWarnNum(code); return baseMapper.getWarnNum(code);
} }
/** /**
* 按单位统计 * 按单位统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "0 0 2 * * ?") @Scheduled(cron = "0 0 2 * * ?")
public void synFillingUnloadData() { public void synFillingUnloadData() {
cylinderFillingUnloadDataServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadData>()); cylinderFillingUnloadDataServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadData>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
Calendar now = Calendar.getInstance(); Calendar now = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
now.add(Calendar.DATE, -1); now.add(Calendar.DATE, -1);
CylinderFillingUnloadDataDto temp = new CylinderFillingUnloadDataDto(); CylinderFillingUnloadDataDto temp = new CylinderFillingUnloadDataDto();
Double fillingSum = cylinderFillingRecordServiceImpl Double fillingSum = cylinderFillingRecordServiceImpl
.getFillingSum(String.valueOf(regionModel.getRegionCode()), now.getTime()); .getFillingSum(String.valueOf(regionModel.getRegionCode()), now.getTime());
Double unloadSum = 0d; Double unloadSum = 0d;
temp.setFillingSum(fillingSum); temp.setFillingSum(fillingSum);
temp.setRegionCode(String.valueOf(regionModel.getRegionCode())); temp.setRegionCode(String.valueOf(regionModel.getRegionCode()));
temp.setStatisDate(now.getTime()); temp.setStatisDate(now.getTime());
temp.setStatisDateStr(sdf.format(now.getTime())); temp.setStatisDateStr(sdf.format(now.getTime()));
temp.setUnloadSum(unloadSum); temp.setUnloadSum(unloadSum);
cylinderFillingUnloadDataServiceImpl.createWithModel(temp); cylinderFillingUnloadDataServiceImpl.createWithModel(temp);
} }
}); });
} }
/** /**
* 按区域统计 * 按区域统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "0 0 2 * * ?") @Scheduled(cron = "0 0 2 * * ?")
public void synAreaData() { public void synAreaData() {
cylinderAreaDataServiceImpl.remove(new LambdaQueryWrapper<CylinderAreaData>()); cylinderAreaDataServiceImpl.remove(new LambdaQueryWrapper<CylinderAreaData>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
CylinderAreaDataDto temp = new CylinderAreaDataDto(); CylinderAreaDataDto temp = new CylinderAreaDataDto();
temp.setAreaName(regionModel.getRegionName()); temp.setAreaName(regionModel.getRegionName());
String code = regionModel.getRegionCode() + ""; String code = regionModel.getRegionCode() + "";
Integer cylinderTotal = this.getInfoTotalByRegionCode(code); Integer cylinderTotal = this.getInfoTotalByRegionCode(code);
Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(code); Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(code);
Integer cylinderUnitWarn = cylinderUnitServiceImpl.getWarnNum(code); Integer cylinderUnitWarn = cylinderUnitServiceImpl.getWarnNum(code);
Integer cylinderInfoWarn = this.getWarnNum(code); Integer cylinderInfoWarn = this.getWarnNum(code);
int warmTotal = cylinderUnitWarn + cylinderInfoWarn; int warmTotal = cylinderUnitWarn + cylinderInfoWarn;
String parentCode = ""; String parentCode = "";
if ("610000".equals(code)) { if ("610000".equals(code)) {
parentCode = "-1"; parentCode = "-1";
} else if (!"00".equals(code.substring(4, 6))) { } else if (!"00".equals(code.substring(4, 6))) {
parentCode = code.substring(0, 4) + "00"; parentCode = code.substring(0, 4) + "00";
} else { } else {
parentCode = "610000"; parentCode = "610000";
} }
temp.setCylinderNum(Long.valueOf(cylinderTotal)); temp.setCylinderNum(Long.valueOf(cylinderTotal));
temp.setParentRegionCode(parentCode); temp.setParentRegionCode(parentCode);
temp.setRegionCode(regionModel.getRegionCode() + ""); temp.setRegionCode(regionModel.getRegionCode() + "");
temp.setUnitNum(Long.valueOf(cylinderUnitTotal)); temp.setUnitNum(Long.valueOf(cylinderUnitTotal));
temp.setWarnNum((long) warmTotal); temp.setWarnNum((long) warmTotal);
cylinderAreaDataServiceImpl.createWithModel(temp); cylinderAreaDataServiceImpl.createWithModel(temp);
}); });
} }
/** /**
* 按区域统计 * 按区域统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "* * 2 * * ?") @Scheduled(cron = "* * 2 * * ?")
public void addIntegrityData() { public void addIntegrityData() {
System.out.println("====================数据完整性开始============================"); System.out.println("====================数据完整性开始============================");
cylinderIntegrityDataServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityData>()); cylinderIntegrityDataServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityData>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
List<CylinderUnit> unitlist = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>() List<CylinderUnit> unitlist = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>()
.like(CylinderUnit::getRegionCode, regionModel.getRegionCode())); .like(CylinderUnit::getRegionCode, regionModel.getRegionCode()));
List<CylinderIntegrityDataDto> tempList = new LinkedList<>(); List<CylinderIntegrityDataDto> tempList = new LinkedList<>();
System.out.println( System.out.println(
"====================regioncode: " + regionModel.getRegionCode() + "============================"); "====================regioncode: " + regionModel.getRegionCode() + "============================");
unitlist.forEach(t -> { unitlist.forEach(t -> {
System.out.println("====================appId: " + t.getAppId() + "============================"); System.out.println("====================appId: " + t.getAppId() + "============================");
CylinderIntegrityDataDto temp = new CylinderIntegrityDataDto(); CylinderIntegrityDataDto temp = new CylinderIntegrityDataDto();
String appId = t.getAppId(); String appId = t.getAppId();
Double totalIntegirty = 0d; Double totalIntegirty = 0d;
// tz_cylinder_info // tz_cylinder_info
Double unitIntegirty = t.getIntegrity(); Double unitIntegirty = t.getIntegrity();
unitIntegirty = unitIntegirty == null ? 0d : unitIntegirty; unitIntegirty = unitIntegirty == null ? 0d : unitIntegirty;
// tz_cylinder_tags // tz_cylinder_tags
Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(appId); Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(appId);
tagIntegirty = tagIntegirty == null ? 0d : tagIntegirty; tagIntegirty = tagIntegirty == null ? 0d : tagIntegirty;
// tz_cylinder_info // tz_cylinder_info
Double infoIntegirty = this.queryIntegirtyByAppId(appId); Double infoIntegirty = this.queryIntegirtyByAppId(appId);
infoIntegirty = infoIntegirty == null ? 0d : infoIntegirty; infoIntegirty = infoIntegirty == null ? 0d : infoIntegirty;
// tz_cylinder_filling_record 30天内 // tz_cylinder_filling_record 30天内
Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(appId); Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(appId);
recordIntegirty = recordIntegirty == null ? 0d : recordIntegirty; recordIntegirty = recordIntegirty == null ? 0d : recordIntegirty;
// tz_cylinder_filling 30天内ji // tz_cylinder_filling 30天内ji
Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(appId); Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(appId);
fillingIntegirty = fillingIntegirty == null ? 0d : fillingIntegirty; fillingIntegirty = fillingIntegirty == null ? 0d : fillingIntegirty;
// tz_cylinder_filling_check 30天内 // tz_cylinder_filling_check 30天内
Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(appId); Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(appId);
checkIntegirty = checkIntegirty == null ? 0d : checkIntegirty; checkIntegirty = checkIntegirty == null ? 0d : checkIntegirty;
totalIntegirty = (unitIntegirty + tagIntegirty + infoIntegirty + recordIntegirty + fillingIntegirty totalIntegirty = (unitIntegirty + tagIntegirty + infoIntegirty + recordIntegirty + fillingIntegirty
+ checkIntegirty) / 6; + checkIntegirty) / 6;
BigDecimal bg = new BigDecimal(totalIntegirty); BigDecimal bg = new BigDecimal(totalIntegirty);
totalIntegirty = bg.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100; totalIntegirty = bg.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
temp.setAppId(appId); temp.setAppId(appId);
temp.setRegionCode(String.valueOf(regionModel.getRegionCode())); temp.setRegionCode(String.valueOf(regionModel.getRegionCode()));
temp.setIntegrity(totalIntegirty); temp.setIntegrity(totalIntegirty);
temp.setUnitName(t.getUnitName()); temp.setUnitName(t.getUnitName());
// 判断list 是否达到5个,如果达到则对比最后一个进行替换 // 判断list 是否达到5个,如果达到则对比最后一个进行替换
if (tempList.size() == 5) { if (tempList.size() == 5) {
if (tempList.get(0).getIntegrity() < totalIntegirty) { if (tempList.get(0).getIntegrity() < totalIntegirty) {
tempList.set(0, temp); tempList.set(0, temp);
} }
} else { } else {
tempList.add(temp); tempList.add(temp);
} }
tempList.sort(Comparator.comparing(CylinderIntegrityDataDto::getIntegrity)); tempList.sort(Comparator.comparing(CylinderIntegrityDataDto::getIntegrity));
}); });
tempList.forEach(t -> { tempList.forEach(t -> {
System.out.println("====================unitName: " + t.getUnitName() + "============================"); System.out.println("====================unitName: " + t.getUnitName() + "============================");
t.setUpdateTime(new Date()); t.setUpdateTime(new Date());
cylinderIntegrityDataServiceImpl.createWithModel(t); cylinderIntegrityDataServiceImpl.createWithModel(t);
}); });
}); });
System.out.println("====================数据完整性结束============================"); System.out.println("====================数据完整性结束============================");
} }
/** /**
* 企业总量按区域统计 * 企业总量按区域统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "0 0 2 * * ?") @Scheduled(cron = "0 0 2 * * ?")
public void getCylinderUnitInfo() { public void getCylinderUnitInfo() {
cylinderUnitDataServiceImpl.remove(new LambdaQueryWrapper<CylinderUnitData>()); cylinderUnitDataServiceImpl.remove(new LambdaQueryWrapper<CylinderUnitData>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
String regionCode = String.valueOf(regionModel.getRegionCode()); String regionCode = String.valueOf(regionModel.getRegionCode());
Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(regionCode); Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(regionCode);
Integer thisMonthUnitTotal = cylinderUnitServiceImpl.getThisMonthUnitTotalByRegionCode(regionCode); Integer thisMonthUnitTotal = cylinderUnitServiceImpl.getThisMonthUnitTotalByRegionCode(regionCode);
Double lastUnitTotal = Double.valueOf(cylinderUnitServiceImpl.getLastMonthUnitTotal(regionCode)); Double lastUnitTotal = Double.valueOf(cylinderUnitServiceImpl.getLastMonthUnitTotal(regionCode));
Double monthUnitLastInfo = Double.valueOf(cylinderUnitServiceImpl.getMonthBeforeLastUnitTotal(regionCode)); Double monthUnitLastInfo = Double.valueOf(cylinderUnitServiceImpl.getMonthBeforeLastUnitTotal(regionCode));
double changeNum = thisMonthUnitTotal - lastUnitTotal; double changeNum = thisMonthUnitTotal - lastUnitTotal;
double percent = 0d; double percent = 0d;
if (monthUnitLastInfo != 0) { if (monthUnitLastInfo != 0) {
percent = (lastUnitTotal-monthUnitLastInfo) / monthUnitLastInfo; percent = (lastUnitTotal - monthUnitLastInfo) / monthUnitLastInfo;
BigDecimal bg = new BigDecimal(percent); BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
} else { } else {
percent = 0 ; percent = 0;
BigDecimal bg = new BigDecimal(percent); BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
} }
CylinderUnitDataDto temp = new CylinderUnitDataDto(); CylinderUnitDataDto temp = new CylinderUnitDataDto();
temp.setChangeSum((long) changeNum); temp.setChangeSum((long) changeNum);
temp.setChangePercent((int) (percent * 100) + ""); temp.setChangePercent((int) (percent * 100) + "");
temp.setRegionCode(regionCode); temp.setRegionCode(regionCode);
temp.setTotalSum((long) cylinderUnitTotal); temp.setTotalSum((long) cylinderUnitTotal);
temp.setUpdateTime(new Date()); temp.setUpdateTime(new Date());
cylinderUnitDataServiceImpl.createWithModel(temp); cylinderUnitDataServiceImpl.createWithModel(temp);
}); });
} }
/** /**
* 气瓶总量按区域统计 * 气瓶总量按区域统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "0 0 2 * * ?") @Scheduled(cron = "0 0 2 * * ?")
public void getCylinderInfo() { public void getCylinderInfo() {
cylinderInfoDataServiceImpl.remove(new LambdaQueryWrapper<>()); cylinderInfoDataServiceImpl.remove(new LambdaQueryWrapper<>());
countByRegion(regionModel -> { countByRegion(regionModel -> {
CylinderInfoDataDto temp = new CylinderInfoDataDto(); CylinderInfoDataDto temp = new CylinderInfoDataDto();
String regionCode = String.valueOf(regionModel.getRegionCode()); String regionCode = String.valueOf(regionModel.getRegionCode());
Integer cylinderTotal = this.getInfoTotalByRegionCode(regionCode);// 当前总数 Integer cylinderTotal = this.getInfoTotalByRegionCode(regionCode);// 当前总数
Double InfoTotal = Double.valueOf(this.getMonthInfoTotal(regionCode)); Double InfoTotal = Double.valueOf(this.getMonthInfoTotal(regionCode));
Double lastInfoTotal = Double.valueOf(this.getLastMonthInfoTotal(regionCode));// 上月总数 Double lastInfoTotal = Double.valueOf(this.getLastMonthInfoTotal(regionCode));// 上月总数
Double monthBeforeLastInfo = Double.valueOf(this.getMonthBeforeLastInfoTotal(regionCode));// 上上月总数 Double monthBeforeLastInfo = Double.valueOf(this.getMonthBeforeLastInfoTotal(regionCode));// 上上月总数
double percent = 0d; double percent = 0d;
if (monthBeforeLastInfo != 0) { if (monthBeforeLastInfo != 0) {
percent = (lastInfoTotal - monthBeforeLastInfo) / monthBeforeLastInfo; percent = (lastInfoTotal - monthBeforeLastInfo) / monthBeforeLastInfo;
BigDecimal bg = new BigDecimal(percent); BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}else } else {
{ percent = 0;
percent = 0; BigDecimal bg = new BigDecimal(percent);
BigDecimal bg = new BigDecimal(percent); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); }
} temp.setChangeSum((long) (InfoTotal - lastInfoTotal));
temp.setChangeSum((long) (InfoTotal - lastInfoTotal)); temp.setChangePercent((int) (percent * 100) + "");
temp.setChangePercent((int) (percent * 100) + ""); temp.setRegionCode(regionCode);
temp.setRegionCode(regionCode); temp.setTotalSum((long) cylinderTotal);
temp.setTotalSum((long) cylinderTotal); cylinderInfoDataServiceImpl.createWithModel(temp);
cylinderInfoDataServiceImpl.createWithModel(temp); });
}); }
}
/**
/** * 按单位统计
* 按单位统计 */
*/ @Transactional(rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class) @Scheduled(cron = "0 0 2 * * ?")
@Scheduled(cron = "0 0 2 * * ?") public void synUnitCylinderInfoData() {
public void synUnitCylinderInfoData() { cylinderInfoDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderInfoDataUnit>());
cylinderInfoDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderInfoDataUnit>()); countByUnit(cylinderUnit -> {
countByUnit(cylinderUnit -> { CylinderInfoDataUnitDto temp = new CylinderInfoDataUnitDto();
CylinderInfoDataUnitDto temp = new CylinderInfoDataUnitDto(); temp.setAppId(cylinderUnit.getAppId());
temp.setAppId(cylinderUnit.getAppId()); int count = this
int count = this .count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));// 当前总数
.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));// 当前总数 temp.setTotalSum((long) count);
temp.setTotalSum((long) count); Double month = Double.valueOf(baseMapper.getMonthInfoTotalUnit(cylinderUnit.getAppId()));
Double month = Double.valueOf(baseMapper.getMonthInfoTotalUnit(cylinderUnit.getAppId())); Double thismonth = Double.valueOf(baseMapper.getLastMonthInfoTotalUnit(cylinderUnit.getAppId()));// 上月总数
Double thismonth = Double.valueOf(baseMapper.getLastMonthInfoTotalUnit(cylinderUnit.getAppId()));// 上月总数 Double lastmonth = Double.valueOf(baseMapper.getMonthBeforeLastInfoTotalUnit(cylinderUnit.getAppId()));// 上上月总数
Double lastmonth = Double.valueOf(baseMapper.getMonthBeforeLastInfoTotalUnit(cylinderUnit.getAppId()));// 上上月总数 double percent = 0d;
double percent = 0d; if (lastmonth != 0) {
if (lastmonth != 0) { percent = (thismonth - lastmonth) / lastmonth;
percent = (thismonth - lastmonth) / lastmonth; BigDecimal bg = new BigDecimal(percent);
BigDecimal bg = new BigDecimal(percent); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); } else {
}else percent = 0;
{ BigDecimal bg = new BigDecimal(percent);
percent = 0; percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
BigDecimal bg = new BigDecimal(percent); }
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); temp.setChangeSum((long) (month - thismonth));
} temp.setChangePercent((int) (percent * 100) + "");
temp.setChangeSum((long) (month - thismonth)); cylinderInfoDataUnitServiceImpl.createWithModel(temp);
temp.setChangePercent((int) (percent * 100) + ""); });
cylinderInfoDataUnitServiceImpl.createWithModel(temp); }
});
} /**
* 充装量按单位和月统计
/** */
* 充装量按单位和月统计 @Transactional(rollbackFor = Exception.class)
*/ @Scheduled(cron = "0 0 2 * * ?")
@Transactional(rollbackFor = Exception.class) public void synUnitCylinderFillingData() {
@Scheduled(cron = "0 0 2 * * ?") cylinderFillingDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingDataUnit>());
public void synUnitCylinderFillingData() { countByUnit(cylinderUnit -> {
cylinderFillingDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingDataUnit>()); // 按照月份 获取数据 取一年数据
countByUnit(cylinderUnit -> { Calendar calendar = Calendar.getInstance();
// 按照月份 获取数据 取一年数据 // 按月份获取充装量
Calendar calendar = Calendar.getInstance(); // 当月与上月 对比获取数据
// 按月份获取充装量 for (int i = 0; i < 12; i++) {
// 当月与上月 对比获取数据 // 获取当月数据
for (int i = 0; i < 12; i++) { CylinderFillingDataUnitDto temp = new CylinderFillingDataUnitDto();
// 获取当月数据 String year = calendar.get(Calendar.YEAR) + "";
CylinderFillingDataUnitDto temp = new CylinderFillingDataUnitDto(); int month = calendar.get(Calendar.MONTH) + 1;
String year = calendar.get(Calendar.YEAR) + ""; String monthStr = month < 10 ? "0" + month : month + "";
int month = calendar.get(Calendar.MONTH) + 1; temp.setFillingYear(year);
String monthStr = month < 10 ? "0" + month : month + ""; temp.setFillingMonth(monthStr);
temp.setFillingYear(year); temp.setFillingDate(year + "-" + monthStr);
temp.setFillingMonth(monthStr); // 本月
temp.setFillingDate(year+"-"+monthStr); Double thisMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(),
// 本月 calendar.getTime());
Double thisMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(), temp.setTotalSum(thisMonth);
calendar.getTime()); calendar.add(Calendar.MONTH, -1);
temp.setTotalSum(thisMonth); // 上月
calendar.add(Calendar.MONTH, -1); Double lastMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(),
// 上月 calendar.getTime());
Double lastMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(), double percent = 0d;
calendar.getTime()); if (lastMonth != 0) {
double percent = 0d; percent = (thisMonth - lastMonth) / lastMonth;
if (lastMonth != 0) { BigDecimal bg = new BigDecimal(percent);
percent = (thisMonth - lastMonth) / lastMonth; percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
BigDecimal bg = new BigDecimal(percent); }
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); temp.setChangePercent((int) (percent * 100) + "");
} temp.setAppId(cylinderUnit.getAppId());
temp.setChangePercent((int) (percent * 100) + ""); temp.setChangeSum(thisMonth - lastMonth);
temp.setAppId(cylinderUnit.getAppId()); cylinderFillingDataUnitServiceImpl.createWithModel(temp);
temp.setChangeSum(thisMonth - lastMonth); }
cylinderFillingDataUnitServiceImpl.createWithModel(temp); });
} }
});
} /**
* 按单位统计
/** */
* 按单位统计 @Transactional(rollbackFor = Exception.class)
*/ @Scheduled(cron = "0 0 2 * * ?")
@Transactional(rollbackFor = Exception.class) public void synUnitCylinderTagsData() {
@Scheduled(cron = "0 0 2 * * ?") cylinderTagsDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderTagsDataUnit>());
public void synUnitCylinderTagsData() { countByUnit(cylinderUnit -> {
cylinderTagsDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderTagsDataUnit>()); CylinderTagsDataUnitDto temp = new CylinderTagsDataUnitDto();
countByUnit(cylinderUnit -> { temp.setAppId(cylinderUnit.getAppId());
CylinderTagsDataUnitDto temp = new CylinderTagsDataUnitDto(); int cylinder = this
temp.setAppId(cylinderUnit.getAppId()); .count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));
int cylinder = this int tags = cylinderTagsServiceImpl
.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId())); .count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, cylinderUnit.getAppId()));
int tags = cylinderTagsServiceImpl String percent = "";
.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, cylinderUnit.getAppId())); if (tags != 0) {
String percent = ""; double zz = (double) cylinder / (double) tags;
if (tags != 0) { DecimalFormat df = new DecimalFormat("##.00%");
double zz = (double) cylinder /(double) tags; if (Math.abs(zz) < 0.0000000000001) {
DecimalFormat df = new DecimalFormat("##.00%"); percent = "0.00%";
if (Math.abs(zz) < 0.0000000000001) { } else {
percent = "0.00%"; percent = df.format(zz);
} else { }
percent = df.format(zz); }
} temp.setCylinderSum((long) cylinder);
} temp.setTagsSum((long) tags);
temp.setCylinderSum((long) cylinder); temp.setTagPercent(percent);
temp.setTagsSum((long) tags); cylinderTagsDataUnitServiceImpl.createWithModel(temp);
temp.setTagPercent(percent); });
cylinderTagsDataUnitServiceImpl.createWithModel(temp); }
});
} /**
* 按单位统计
/** */
* 按单位统计 @Transactional(rollbackFor = Exception.class)
*/ @Scheduled(cron = "0 0 2 * * ?")
@Transactional(rollbackFor = Exception.class) public void synUnitIntegrityData() {
@Scheduled(cron = "0 0 2 * * ?") cylinderIntegrityDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityDataUnit>());
public void synUnitIntegrityData() { countByUnit(cylinderUnit -> {
cylinderIntegrityDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityDataUnit>()); // 企业信息
countByUnit(cylinderUnit -> { CylinderIntegrityDataUnitDto uninInfo = new CylinderIntegrityDataUnitDto();
// 企业信息 uninInfo.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto uninInfo = new CylinderIntegrityDataUnitDto(); uninInfo.setDataType("企业信息");
uninInfo.setAppId(cylinderUnit.getAppId()); Double unitIntegirty = cylinderUnit.getIntegrity();
uninInfo.setDataType("企业信息"); uninInfo.setIntegrity(unitIntegirty);
Double unitIntegirty = cylinderUnit.getIntegrity(); cylinderIntegrityDataUnitServiceImpl.createWithModel(uninInfo);
uninInfo.setIntegrity(unitIntegirty); // 气瓶基本信息
cylinderIntegrityDataUnitServiceImpl.createWithModel(uninInfo); CylinderIntegrityDataUnitDto cylinderInfo = new CylinderIntegrityDataUnitDto();
// 气瓶基本信息 cylinderInfo.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderInfo = new CylinderIntegrityDataUnitDto(); cylinderInfo.setDataType("气瓶基本信息");
cylinderInfo.setAppId(cylinderUnit.getAppId()); Double cylinderIntegirty = this.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderInfo.setDataType("气瓶基本信息"); cylinderInfo.setIntegrity(cylinderIntegirty);
Double cylinderIntegirty = this.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInfo);
cylinderInfo.setIntegrity(cylinderIntegirty); // 气瓶标签信息
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInfo); CylinderIntegrityDataUnitDto cylinderTag = new CylinderIntegrityDataUnitDto();
// 气瓶标签信息 cylinderTag.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderTag = new CylinderIntegrityDataUnitDto(); cylinderTag.setDataType("气瓶标签信息");
cylinderTag.setAppId(cylinderUnit.getAppId()); Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderTag.setDataType("气瓶标签信息"); cylinderTag.setIntegrity(tagIntegirty);
Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderTag);
cylinderTag.setIntegrity(tagIntegirty); // 气瓶检验信息
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderTag); CylinderIntegrityDataUnitDto cylinderInspection = new CylinderIntegrityDataUnitDto();
// 气瓶检验信息 cylinderInspection.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderInspection = new CylinderIntegrityDataUnitDto(); cylinderInspection.setDataType("气瓶检验信息");
cylinderInspection.setAppId(cylinderUnit.getAppId()); cylinderInspection.setIntegrity(0d);
cylinderInspection.setDataType("气瓶检验信息"); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInspection);
cylinderInspection.setIntegrity(0d); // 充装前检查
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInspection); CylinderIntegrityDataUnitDto cylinderFilling = new CylinderIntegrityDataUnitDto();
// 充装前检查 cylinderFilling.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderFilling = new CylinderIntegrityDataUnitDto(); cylinderFilling.setDataType("充装前检查");
cylinderFilling.setAppId(cylinderUnit.getAppId()); Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderFilling.setDataType("充装前检查"); cylinderFilling.setIntegrity(fillingIntegirty);
Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderFilling);
cylinderFilling.setIntegrity(fillingIntegirty); // 充装信息
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderFilling); CylinderIntegrityDataUnitDto cylinderRecord = new CylinderIntegrityDataUnitDto();
// 充装信息 cylinderRecord.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderRecord = new CylinderIntegrityDataUnitDto(); cylinderRecord.setDataType("充装信息");
cylinderRecord.setAppId(cylinderUnit.getAppId()); Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderRecord.setDataType("充装信息"); cylinderRecord.setIntegrity(recordIntegirty);
Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderRecord);
cylinderRecord.setIntegrity(recordIntegirty); // 充装后复查
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderRecord); CylinderIntegrityDataUnitDto cylinderCheck = new CylinderIntegrityDataUnitDto();
// 充装后复查 cylinderCheck.setAppId(cylinderUnit.getAppId());
CylinderIntegrityDataUnitDto cylinderCheck = new CylinderIntegrityDataUnitDto(); cylinderCheck.setDataType("充装后复查");
cylinderCheck.setAppId(cylinderUnit.getAppId()); Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
cylinderCheck.setDataType("充装后复查"); cylinderCheck.setIntegrity(checkIntegirty);
Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderCheck);
cylinderCheck.setIntegrity(checkIntegirty); });
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderCheck); }
});
} /**
* 充装详情按单位统计
/** */
* 充装详情按单位统计 @Transactional(rollbackFor = Exception.class)
*/ @Scheduled(cron = "0 0 2 * * ?")
@Transactional(rollbackFor = Exception.class) public void synUnitFillingCheckData() {
@Scheduled(cron = "0 0 2 * * ?")
public void synUnitFillingCheckData() {
// cylinderFillingCheckDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingCheckDataUnit>()); // cylinderFillingCheckDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingCheckDataUnit>());
countByUnit(cylinderUnit -> { countByUnit(cylinderUnit -> {
List<CylinderFillingCheckDataUnitDto> allCylinderFillingCheckDataList = List<CylinderFillingCheckDataUnitDto> allCylinderFillingCheckDataList =
cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), null); cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), null);
// 按照月份 获取数据 取一年数据 // 按照月份 获取数据 取一年数据
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
// 第一次查询到该appId对应的统计数据为空,则计算过去一年12个月的数据统计 // 第一次查询到该appId对应的统计数据为空,则计算过去一年12个月的数据统计
if (ValidationUtil.isEmpty(allCylinderFillingCheckDataList)) { if (ValidationUtil.isEmpty(allCylinderFillingCheckDataList)) {
// 按月份获取充装量 // 按月份获取充装量
// 当月与上月 对比获取数据 // 当月与上月 对比获取数据
for (int i = 0; i < 12; i++) { for (int i = 0; i < 12; i++) {
// 获取当月数据 // 获取当月数据
CylinderFillingCheckDataUnitDto temp = new CylinderFillingCheckDataUnitDto(); CylinderFillingCheckDataUnitDto temp = new CylinderFillingCheckDataUnitDto();
calcCylinderFillingCheckDataUnitData(cylinderUnit, c, temp); calcCylinderFillingCheckDataUnitData(cylinderUnit, c, temp);
c.add(Calendar.MONTH, -1); c.add(Calendar.MONTH, -1);
cylinderFillingCheckDataUnitServiceImpl.createWithModel(temp); cylinderFillingCheckDataUnitServiceImpl.createWithModel(temp);
} }
} else { } else {
// 如果已经有该appId对应数据,则直接更新当前月的数据即可 // 如果已经有该appId对应数据,则直接更新当前月的数据即可
Calendar current = Calendar.getInstance(); Calendar current = Calendar.getInstance();
String year = current.get(Calendar.YEAR) + ""; String year = current.get(Calendar.YEAR) + "";
int month = current.get(Calendar.MONTH) + 1; int month = current.get(Calendar.MONTH) + 1;
String monthStr = month < 10 ? "0" + month : month + ""; String monthStr = month < 10 ? "0" + month : month + "";
List<CylinderFillingCheckDataUnitDto> existDataDtoList = List<CylinderFillingCheckDataUnitDto> existDataDtoList =
cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), year + "-" + monthStr); cylinderFillingCheckDataUnitServiceImpl.queryCylinderFillingCheckListByParam(cylinderUnit.getAppId(), year + "-" + monthStr);
CylinderFillingCheckDataUnitDto tempDto = new CylinderFillingCheckDataUnitDto(); CylinderFillingCheckDataUnitDto tempDto = new CylinderFillingCheckDataUnitDto();
if (!ValidationUtil.isEmpty(existDataDtoList) && !ValidationUtil.isEmpty(existDataDtoList.get(0))) { if (!ValidationUtil.isEmpty(existDataDtoList) && !ValidationUtil.isEmpty(existDataDtoList.get(0))) {
tempDto = existDataDtoList.get(0); tempDto = existDataDtoList.get(0);
calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto); calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto);
cylinderFillingCheckDataUnitServiceImpl.updateWithModel(tempDto); cylinderFillingCheckDataUnitServiceImpl.updateWithModel(tempDto);
} else if (ValidationUtil.isEmpty(existDataDtoList)) { } else if (ValidationUtil.isEmpty(existDataDtoList)) {
// 处理当前月第一天还没数据情况 // 处理当前月第一天还没数据情况
calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto); calcCylinderFillingCheckDataUnitData(cylinderUnit, current, tempDto);
cylinderFillingCheckDataUnitServiceImpl.createWithModel(tempDto); cylinderFillingCheckDataUnitServiceImpl.createWithModel(tempDto);
} }
} }
}); });
} }
/** /**
* 计算当前单位的充装检查数据统计 * 计算当前单位的充装检查数据统计
* *
* @param cylinderUnit * @param cylinderUnit
* @param calender * @param calender
* @param cylinderFillingCheckDataUnitDto * @param cylinderFillingCheckDataUnitDto
*/ */
public void calcCylinderFillingCheckDataUnitData(CylinderUnit cylinderUnit, Calendar calender, CylinderFillingCheckDataUnitDto cylinderFillingCheckDataUnitDto) { public void calcCylinderFillingCheckDataUnitData(CylinderUnit cylinderUnit, Calendar calender, CylinderFillingCheckDataUnitDto cylinderFillingCheckDataUnitDto) {
String year = calender.get(Calendar.YEAR) + ""; String year = calender.get(Calendar.YEAR) + "";
int month = calender.get(Calendar.MONTH) + 1; int month = calender.get(Calendar.MONTH) + 1;
String monthStr = month < 10 ? "0" + month : month + ""; String monthStr = month < 10 ? "0" + month : month + "";
cylinderFillingCheckDataUnitDto.setFillingMonth(monthStr); cylinderFillingCheckDataUnitDto.setFillingMonth(monthStr);
cylinderFillingCheckDataUnitDto.setFillingYear(year); cylinderFillingCheckDataUnitDto.setFillingYear(year);
cylinderFillingCheckDataUnitDto.setFillingDate(year + "-" + monthStr); cylinderFillingCheckDataUnitDto.setFillingDate(year + "-" + monthStr);
Integer countThisMonth = cylinderFillingRecordServiceImpl Integer countThisMonth = cylinderFillingRecordServiceImpl
.getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime());
cylinderFillingCheckDataUnitDto.setTotalSum((long) countThisMonth); cylinderFillingCheckDataUnitDto.setTotalSum((long) countThisMonth);
// 获取本月数据 // 获取本月数据
Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(),
calender.getTime()); calender.getTime());
Integer fillingCheckCount = cylinderFillingCheckServiceImpl Integer fillingCheckCount = cylinderFillingCheckServiceImpl
.getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingCountByMonth(cylinderUnit.getAppId(), calender.getTime());
// 充装前检查率:充装前检查次数/充装次数 // 充装前检查率:充装前检查次数/充装次数
double before = 0d; double before = 0d;
if (countThisMonth != 0) { if (countThisMonth != 0) {
before = (double) (fillingCount) / (double) countThisMonth; before = (double) (fillingCount) / (double) countThisMonth;
} }
cylinderFillingCheckDataUnitDto.setFillingCount((long) fillingCount); cylinderFillingCheckDataUnitDto.setFillingCount((long) fillingCount);
cylinderFillingCheckDataUnitDto.setFillingPercent(before * 100); cylinderFillingCheckDataUnitDto.setFillingPercent(before * 100);
// 充装后检查率:充装后检查次数/充装次数 // 充装后检查率:充装后检查次数/充装次数
double after = 0d; double after = 0d;
if (countThisMonth != 0) { if (countThisMonth != 0) {
after = (double) (fillingCheckCount) / (double) countThisMonth; after = (double) (fillingCheckCount) / (double) countThisMonth;
} }
cylinderFillingCheckDataUnitDto.setFillingCheckCount((long) fillingCheckCount); cylinderFillingCheckDataUnitDto.setFillingCheckCount((long) fillingCheckCount);
cylinderFillingCheckDataUnitDto.setFillingCheckPercent(after * 100); cylinderFillingCheckDataUnitDto.setFillingCheckPercent(after * 100);
// 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数 // 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数
double passed = 0d; double passed = 0d;
// 充装前检查合格次数 // 充装前检查合格次数
Integer fillingPassedCount = cylinderFillingServiceImpl Integer fillingPassedCount = cylinderFillingServiceImpl
.getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime());
// 充装后检查合格次数 // 充装后检查合格次数
Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl
.getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime()); .getFillingPassedCountByMonth(cylinderUnit.getAppId(), calender.getTime());
if (countThisMonth != 0) { if (countThisMonth != 0) {
passed = ((double) (fillingPassedCount) + (double) fillingCheckPassedCount) passed = ((double) (fillingPassedCount) + (double) fillingCheckPassedCount)
/ (double) (2 * countThisMonth); / (double) (2 * countThisMonth);
} }
cylinderFillingCheckDataUnitDto.setFillingPassedCount((long) (fillingPassedCount + fillingCheckPassedCount)); cylinderFillingCheckDataUnitDto.setFillingPassedCount((long) (fillingPassedCount + fillingCheckPassedCount));
cylinderFillingCheckDataUnitDto.setTotalSumDouble((long) 2 * countThisMonth); cylinderFillingCheckDataUnitDto.setTotalSumDouble((long) 2 * countThisMonth);
cylinderFillingCheckDataUnitDto.setFillingPassedPercent(passed * 100); cylinderFillingCheckDataUnitDto.setFillingPassedPercent(passed * 100);
cylinderFillingCheckDataUnitDto.setAppId(cylinderUnit.getAppId()); cylinderFillingCheckDataUnitDto.setAppId(cylinderUnit.getAppId());
} }
/** /**
* 充装量、卸液量按单位统计 * 充装量、卸液量按单位统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "0 0 2 * * ?") @Scheduled(cron = "0 0 2 * * ?")
public void synFillingUnloadUnitData() { public void synFillingUnloadUnitData() {
cylinderFillingUnloadDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadDataUnit>()); cylinderFillingUnloadDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadDataUnit>());
countByUnit(cylinderUnit -> { countByUnit(cylinderUnit -> {
Calendar now = Calendar.getInstance(); Calendar now = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
now.add(Calendar.DATE, -1); now.add(Calendar.DATE, -1);
CylinderFillingUnloadDataUnitDto temp = new CylinderFillingUnloadDataUnitDto(); CylinderFillingUnloadDataUnitDto temp = new CylinderFillingUnloadDataUnitDto();
Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSumByDate(cylinderUnit.getAppId(), Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSumByDate(cylinderUnit.getAppId(),
now.getTime()); now.getTime());
Double unloadSum = 0d; Double unloadSum = 0d;
temp.setFillingSum(fillingSum); temp.setFillingSum(fillingSum);
temp.setAppId(cylinderUnit.getAppId()); temp.setAppId(cylinderUnit.getAppId());
temp.setStatisDate(now.getTime()); temp.setStatisDate(now.getTime());
temp.setStatisDateStr(sdf.format(now.getTime())); temp.setStatisDateStr(sdf.format(now.getTime()));
temp.setUnloadSum(unloadSum); temp.setUnloadSum(unloadSum);
cylinderFillingUnloadDataUnitServiceImpl.createWithModel(temp); cylinderFillingUnloadDataUnitServiceImpl.createWithModel(temp);
} }
}); });
} }
@Scheduled(cron = "${tzs.cylinder.info.cron}") @Scheduled(cron = "${tzs.cylinder.info.cron}")
public void setTimeSaveCylinderInfoToES(){ public void setTimeSaveCylinderInfoToES() {
Page<CylinderInfoDto> cylinderInfoPage = new Page<>(); Page<CylinderInfoDto> cylinderInfoPage = new Page<>();
Page<CylinderInfoDto> cyinderInfoList = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage); Page<CylinderInfoDto> cyinderInfoList = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage);
Long count = cyinderInfoList.getCurrent(); Long count = cyinderInfoList.getCurrent();
Long times = 0L; Long times = 0L;
if (count != 0) { if (count != 0) {
times = count / 1000; times = count / 1000;
Long last = count % 1000; Long last = count % 1000;
if (last > 0) { if (last > 0) {
times++; times++;
} }
} }
for (int i = 0; i <= times; i++) { for (int i = 0; i <= times; i++) {
cylinderInfoPage.setCurrent(1); cylinderInfoPage.setCurrent(1);
cylinderInfoPage.setSize(1000); cylinderInfoPage.setSize(1000);
cylinderInfoPage = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage); cylinderInfoPage = cylinderInfoMapper.getCyinderInfoList(cylinderInfoPage);
if(!ObjectUtils.isEmpty(cylinderInfoPage)){ if (!ObjectUtils.isEmpty(cylinderInfoPage)) {
saveCylinderInfo2ES(cylinderInfoPage.getRecords()); saveCylinderInfo2ES(cylinderInfoPage.getRecords());
} }
// for (CylinderInfoDto ci : cylinderInfoPage.getRecords()) { // for (CylinderInfoDto ci : cylinderInfoPage.getRecords()) {
// saveCylinderInfoToES(ci); // saveCylinderInfoToES(ci);
// } // }
} }
} }
@Override @Override
public void saveCylinderInfo2ES(List<CylinderInfoDto> records) { public void saveCylinderInfo2ES(List<CylinderInfoDto> records) {
List<ESCylinderInfoDto> esCylinderInfoDto = new ArrayList<>(); List<ESCylinderInfoDto> esCylinderInfoDto = new ArrayList<>();
List<CylinderInfo> CylinderInfoList = new ArrayList<>(); List<CylinderInfo> CylinderInfoList = new ArrayList<>();
for (CylinderInfoDto record : records) { for (CylinderInfoDto record : records) {
ESCylinderInfoDto esCylinderInfo = new ESCylinderInfoDto(); ESCylinderInfoDto esCylinderInfo = new ESCylinderInfoDto();
BeanUtils.copyProperties(record,esCylinderInfo); BeanUtils.copyProperties(record, esCylinderInfo);
esCylinderInfoDto.add(esCylinderInfo); esCylinderInfoDto.add(esCylinderInfo);
CylinderInfo cylinderInfo = new CylinderInfo(); CylinderInfo cylinderInfo = new CylinderInfo();
BeanUtils.copyProperties(record,cylinderInfo); BeanUtils.copyProperties(record, cylinderInfo);
cylinderInfo.setSequenceNbr(record.getSequenceNbr()); cylinderInfo.setSequenceNbr(record.getSequenceNbr());
cylinderInfo.setIsNotEs("1"); cylinderInfo.setIsNotEs("1");
CylinderInfoList.add(cylinderInfo); CylinderInfoList.add(cylinderInfo);
} }
esCylinderInfoRepository.saveAll(esCylinderInfoDto); esCylinderInfoRepository.saveAll(esCylinderInfoDto);
this.updateBatchById(CylinderInfoList); this.updateBatchById(CylinderInfoList);
} }
@Override @Override
public Integer getInfoTotal() { public Integer getInfoTotal() {
return cylinderInfoMapper.getInfoTotal(); return cylinderInfoMapper.getInfoTotal();
} }
@Override @Override
public ESCylinderInfoDto saveCylinderInfoToES(CylinderInfoDto ci) { public ESCylinderInfoDto saveCylinderInfoToES(CylinderInfoDto ci) {
ESCylinderInfoDto esCylinderInfoDto = new ESCylinderInfoDto(); ESCylinderInfoDto esCylinderInfoDto = new ESCylinderInfoDto();
BeanUtils.copyProperties(ci,esCylinderInfoDto); BeanUtils.copyProperties(ci, esCylinderInfoDto);
ESCylinderInfoDto saveResult = esCylinderInfoRepository.save(esCylinderInfoDto); ESCylinderInfoDto saveResult = esCylinderInfoRepository.save(esCylinderInfoDto);
if(!ObjectUtils.isEmpty(saveResult)){ if (!ObjectUtils.isEmpty(saveResult)) {
//同步到es后修改 //同步到es后修改
CylinderInfo cylinderInfo = new CylinderInfo(); CylinderInfo cylinderInfo = new CylinderInfo();
cylinderInfo.setIsNotEs("1"); cylinderInfo.setIsNotEs("1");
cylinderInfoMapper.update(cylinderInfo, new QueryWrapper<CylinderInfo>().eq("sequence_nbr", ci.getSequenceNbr())); cylinderInfoMapper.update(cylinderInfo, new QueryWrapper<CylinderInfo>().eq("sequence_nbr", ci.getSequenceNbr()));
} }
return saveResult; return saveResult;
} }
@Override @Override
public Page<ESCylinderInfoDto> queryByKeys(CylinderInfoDto cylinderInfoDto, int pageNum, int pageSize) { public Page<ESCylinderInfoDto> queryByKeys(CylinderInfoDto cylinderInfoDto, int pageNum, int pageSize) {
Page<ESCylinderInfoDto> result = new Page<ESCylinderInfoDto>(pageNum, pageSize); Page<ESCylinderInfoDto> result = new Page<ESCylinderInfoDto>(pageNum, pageSize);
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); SearchRequest request = new SearchRequest();
credentialsProvider.setCredentials(AuthScope.ANY, request.indices("cylinder_info");
new UsernamePasswordCredentials(esUserName, esPwd)); //es账号密码
RestHighLevelClient esClient =new RestHighLevelClient( //通用匹配规则,条件构建
RestClient.builder( boolean flag = true;
new HttpHost(esAddress,esPort)
).setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() { SearchSourceBuilder builder = new SearchSourceBuilder();
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) { BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider); //匹配统一信用代码
} if (!ObjectUtils.isEmpty(cylinderInfoDto.getCreditCode())) {
}) flag = false;
); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
meBuilder.must(QueryBuilders.matchQuery("creditCode", cylinderInfoDto.getCreditCode()));
boolMust.must(meBuilder);
}
// RestHighLevelClient esClient = new RestHighLevelClient(
// RestClient.builder(new HttpHost(esAddress, esPort, "http")) //匹配RegionCode
// ); if (!ObjectUtils.isEmpty(cylinderInfoDto.getRegionCode())) {
flag = false;
BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery();
SearchRequest request = new SearchRequest(); appIdBuilder.must(QueryBuilders.matchQuery("regionCode", "*" + cylinderInfoDto.getRegionCode() + "*"));
request.indices("cylinder_info"); boolMust.should(appIdBuilder);
}
//通用匹配规则,条件构建
boolean flag = true; //匹配appid
if (!ObjectUtils.isEmpty(cylinderInfoDto.getAppId())) {
SearchSourceBuilder builder = new SearchSourceBuilder(); flag = false;
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery();
appIdBuilder.must(QueryBuilders.matchQuery("appId", "*" + cylinderInfoDto.getAppId() + "*"));
//匹配统一信用代码 boolMust.should(appIdBuilder);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getCreditCode())) { }
flag = false;
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); //匹配产权单位
meBuilder.must(QueryBuilders.matchQuery("creditCode", cylinderInfoDto.getCreditCode())); if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitName())) {
boolMust.must(meBuilder); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("unitName", "*" + cylinderInfoDto.getUnitName() + "*"));
//匹配RegionCode boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getRegionCode())) { }
flag = false;
BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery(); //匹配出厂编号
appIdBuilder.must(QueryBuilders.matchQuery("regionCode", "*" + cylinderInfoDto.getRegionCode() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getFactoryNum())) {
boolMust.should(appIdBuilder); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("factoryNum", "*" + cylinderInfoDto.getFactoryNum() + "*"));
//匹配appid boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getAppId())) { }
flag = false;
BoolQueryBuilder appIdBuilder = QueryBuilders.boolQuery(); //匹配气瓶品种
appIdBuilder.must(QueryBuilders.matchQuery("appId", "*" + cylinderInfoDto.getAppId() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderVariety())) {
boolMust.should(appIdBuilder); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("cylinderVariety", cylinderInfoDto.getCylinderVariety()));
//匹配产权单位 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitName())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //匹配二维码编码
query.must(QueryBuilders.matchQuery("unitName", "*" + cylinderInfoDto.getUnitName() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getQrCode())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("qrCode", "*" + cylinderInfoDto.getQrCode() + "*"));
//匹配出厂编号 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getFactoryNum())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //匹配电子标签
query.must(QueryBuilders.matchQuery("factoryNum", "*" + cylinderInfoDto.getFactoryNum() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getElectronicLabelCode())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("electronicLabelCode", "*" + cylinderInfoDto.getElectronicLabelCode() + "*"));
//匹配气瓶品种 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderVariety())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //匹配气瓶唯一标识
query.must(QueryBuilders.matchQuery("cylinderVariety", cylinderInfoDto.getCylinderVariety())); if (!ObjectUtils.isEmpty(cylinderInfoDto.getSequenceCode())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder sequenceCodeBuilder = QueryBuilders.boolQuery();
sequenceCodeBuilder.must(QueryBuilders.matchQuery("sequenceCode", cylinderInfoDto.getSequenceCode()));
//匹配二维码编码 boolMust.must(sequenceCodeBuilder);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getQrCode())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //匹配单位内部编号
query.must(QueryBuilders.matchQuery("qrCode", "*" + cylinderInfoDto.getQrCode() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitInnerCode())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("unitInnerCode", "*" + cylinderInfoDto.getUnitInnerCode() + "*"));
//匹配电子标签 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getElectronicLabelCode())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //气瓶状态
query.must(QueryBuilders.matchQuery("electronicLabelCode", "*" + cylinderInfoDto.getElectronicLabelCode() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderStatus())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("cylinderStatus", cylinderInfoDto.getCylinderStatus()));
//匹配气瓶唯一标识 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getSequenceCode())) { }
flag = false;
BoolQueryBuilder sequenceCodeBuilder = QueryBuilders.boolQuery(); //制造单位
sequenceCodeBuilder.must(QueryBuilders.matchQuery("sequenceCode", cylinderInfoDto.getSequenceCode())); if (!ObjectUtils.isEmpty(cylinderInfoDto.getManufacturingUnit())) {
boolMust.must(sequenceCodeBuilder); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("manufacturingUnit", "*" + cylinderInfoDto.getManufacturingUnit() + "*"));
//匹配单位内部编号 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getUnitInnerCode())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); //检验日期
query.must(QueryBuilders.matchQuery("unitInnerCode", "*" + cylinderInfoDto.getUnitInnerCode() + "*")); if (!ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateStart()) && !ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateEnd())) {
boolMust.must(query); flag = false;
} BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.rangeQuery("inspectionDate").from(cylinderInfoDto.getInspectionDateStart()).to(cylinderInfoDto.getInspectionDateEnd()));
//气瓶状态 boolMust.must(query);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getCylinderStatus())) { }
flag = false;
BoolQueryBuilder query = QueryBuilders.boolQuery(); if (flag) { // 搜索全部
query.must(QueryBuilders.matchQuery("cylinderStatus", cylinderInfoDto.getCylinderStatus())); boolMust.must(QueryBuilders.matchAllQuery());
boolMust.must(query); }
}
builder.query(boolMust);
//制造单位 builder.from((pageNum - 1) * pageSize);
if (!ObjectUtils.isEmpty(cylinderInfoDto.getManufacturingUnit())) { builder.size(pageSize);
flag = false; builder.trackTotalHits(true);
BoolQueryBuilder query = QueryBuilders.boolQuery(); request.source(builder);
query.must(QueryBuilders.matchQuery("manufacturingUnit", "*" + cylinderInfoDto.getManufacturingUnit() + "*")); List<ESCylinderInfoDto> list = new LinkedList<>();
boolMust.must(query); long totle = 0;
} try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
//检验日期 for (org.elasticsearch.search.SearchHit hit : response.getHits()) {
if (!ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateStart()) && !ObjectUtils.isEmpty(cylinderInfoDto.getInspectionDateEnd())) { JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
flag = false; ESCylinderInfoDto esCylinderInfoDto = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderInfoDto.class);
BoolQueryBuilder query = QueryBuilders.boolQuery(); list.add(esCylinderInfoDto);
query.must(QueryBuilders.rangeQuery("inspectionDate").from(cylinderInfoDto.getInspectionDateStart()).to(cylinderInfoDto.getInspectionDateEnd())); }
boolMust.must(query); totle = response.getInternalResponse().hits().getTotalHits().value;
} result.setRecords(list);
result.setTotal(totle);
if(flag) { // 搜索全部 } catch (IOException e) {
boolMust.must(QueryBuilders.matchAllQuery()); throw new RuntimeException(e);
} } finally {
try {
builder.query(boolMust); restHighLevelClient.close();
builder.from((pageNum - 1) * pageSize); } catch (Exception e) {
builder.size(pageSize); throw new RuntimeException(e);
builder.trackTotalHits(true); }
request.source(builder); }
List<ESCylinderInfoDto> list = new LinkedList<>();
long totle = 0; return result;
try { }
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT);
for (org.elasticsearch.search.SearchHit hit : response.getHits()) {
System.out.println(hit); /**
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); * 根据月份统计
ESCylinderInfoDto esCylinderInfoDto = JSONObject.toJavaObject(jsonObject.getJSONObject("sourceAsMap"), ESCylinderInfoDto.class); */
list.add(esCylinderInfoDto); private void countByMonth(IntConsumer consumer) {
} for (int i = 0; i < 12; i++) {
totle = response.getInternalResponse().hits().getTotalHits().value; consumer.accept(i);
result.setRecords(list); }
result.setTotal(totle); }
} catch (IOException e) {
throw new RuntimeException(e); /**
} * 根据单位统计
*/
return result; private void countByUnit(Consumer<CylinderUnit> consumer) {
} List<CylinderUnit> units = cylinderUnitServiceImpl.list();
units.forEach(consumer);
}
/**
* 根据区域统计
/** */
* 根据月份统计 private void countByRegion(Consumer<RegionModel> consumer) {
*/ List<RegionModel> regionList = new ArrayList<>();
private void countByMonth(IntConsumer consumer) { startPlatformTokenService.getToken();
for (int i = 0; i < 12; i++) { Collection<RegionModel> regions = Systemctl.regionClient.queryForTree(null).getResult();
consumer.accept(i); regions.forEach(regionModel -> convertTreeToList(regionList, regionModel));
} regionList.forEach(consumer);
} }
/** /**
* 根据单位统计 * 将区域树转为区域List列表
*/ */
private void countByUnit(Consumer<CylinderUnit> consumer) { private void convertTreeToList(List<RegionModel> regionList, RegionModel region) {
List<CylinderUnit> units = cylinderUnitServiceImpl.list(); regionList.add(region);
units.forEach(consumer); if (region.getChildren() != null) {
} region.getChildren().forEach(c -> {
convertTreeToList(regionList, c);
/** });
* 根据区域统计 }
*/ }
private void countByRegion(Consumer<RegionModel> consumer) {
List<RegionModel> regionList = new ArrayList<>(); public Integer getOverDateStatisticsNumber(String earlyWarningLevel) {
startPlatformTokenService.getToken(); return this.baseMapper.countOverDateNumber(earlyWarningLevel);
Collection<RegionModel> regions = Systemctl.regionClient.queryForTree(null).getResult(); }
regions.forEach(regionModel -> convertTreeToList(regionList, regionModel));
regionList.forEach(consumer); public Page<CylinderInfoDto> earlyWarningLevelPageList(Page<CylinderInfoDto> page, String earlyWarningLevel) {
} Page<CylinderInfoDto> result = this.baseMapper.queryPageListByEarlyWarningLevel(page, earlyWarningLevel);
result.getRecords().forEach(r -> {
/**
* 将区域树转为区域List列表
*/
private void convertTreeToList(List<RegionModel> regionList, RegionModel region) {
regionList.add(region);
if (region.getChildren() != null) {
region.getChildren().forEach(c -> {
convertTreeToList(regionList, c);
});
}
}
public Integer getOverDateStatisticsNumber(String earlyWarningLevel) {
return this.baseMapper.countOverDateNumber(earlyWarningLevel);
}
public Page<CylinderInfoDto> earlyWarningLevelPageList(Page<CylinderInfoDto> page, String earlyWarningLevel) {
Page<CylinderInfoDto> result = this.baseMapper.queryPageListByEarlyWarningLevel(page, earlyWarningLevel);
result.getRecords().forEach(r -> {
// r.setEarlyWarningLevelName(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getName()); // r.setEarlyWarningLevelName(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getName());
// r.setInspectionStatusDesc(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getStatus()); // r.setInspectionStatusDesc(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getStatus());
}); });
return result; return result;
} }
public void calEarlyWarningLevel() { public void calEarlyWarningLevel() {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("气瓶超期预警时间调用规则开始"); log.debug("气瓶超期预警时间调用规则开始");
} }
// 1.批量分组大小 // 1.批量分组大小
int size = 500; int size = 500;
int total = this.count(); int total = this.count();
int groupNumber = total / size + 1; int groupNumber = total / size + 1;
// 2.批量小分组处理数据,调用规则 // 2.批量小分组处理数据,调用规则
for (int i = 0; i < groupNumber; i++) { for (int i = 0; i < groupNumber; i++) {
Page<CylinderInfo> page = new Page<>(); Page<CylinderInfo> page = new Page<>();
page.setCurrent(i); page.setCurrent(i);
page.setSize(size); page.setSize(size);
LambdaQueryWrapper<CylinderInfo> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CylinderInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.select(CylinderInfo::getSequenceCode, CylinderInfo::getSequenceNbr) wrapper.select(CylinderInfo::getSequenceCode, CylinderInfo::getSequenceNbr)
.orderByDesc(CylinderInfo::getSequenceNbr); .orderByDesc(CylinderInfo::getSequenceNbr);
IPage<CylinderInfo> result = this.page(page, wrapper); IPage<CylinderInfo> result = this.page(page, wrapper);
for (CylinderInfo r : result.getRecords()) { for (CylinderInfo r : result.getRecords()) {
// 设置token // 设置token
tzsAuthService.setRequestContext(); tzsAuthService.setRequestContext();
// 调用规则 // 调用规则
this.touchRuleToCalLevel(r); this.touchRuleToCalLevel(r);
} }
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("气瓶超期预警时间调用规则完成"); log.debug("气瓶超期预警时间调用规则完成");
} }
} }
private void touchRuleToCalLevel(CylinderInfo r) { private void touchRuleToCalLevel(CylinderInfo r) {
Date now = new Date(); Date now = new Date();
String dateStr; String dateStr;
try { try {
dateStr = DateUtils.dateFormat(now, DateUtils.DATE_TIME_PATTERN); dateStr = DateUtils.dateFormat(now, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) { } catch (ParseException e) {
throw new RuntimeException("日期个时候失败"); throw new RuntimeException("日期个时候失败");
} }
// 1.气瓶详情 // 1.气瓶详情
CylinderInfoDto cylinderInfoDto = this.getDetail(r.getSequenceCode()); CylinderInfoDto cylinderInfoDto = this.getDetail(r.getSequenceCode());
try { try {
WarningMsgDto warningMsgDto = new WarningMsgDto(); WarningMsgDto warningMsgDto = new WarningMsgDto();
int interval = DateUtils.dateBetweenIncludeToday(now, cylinderInfoDto.getNextInspectionDate()) - 1; int interval = DateUtils.dateBetweenIncludeToday(now, cylinderInfoDto.getNextInspectionDate()) - 1;
warningMsgDto.setNum(String.valueOf(interval)); warningMsgDto.setNum(String.valueOf(interval));
warningMsgDto.setFactoryNum(cylinderInfoDto.getFactoryNum()); warningMsgDto.setFactoryNum(cylinderInfoDto.getFactoryNum());
// warningMsgDto.setUserType(cylinderInfoDto.getCustomType()); // warningMsgDto.setUserType(cylinderInfoDto.getCustomType());
// warningMsgDto.setUserPeople(cylinderInfoDto.getCustomName()); // warningMsgDto.setUserPeople(cylinderInfoDto.getCustomName());
// warningMsgDto.setUserPeoplePhone(cylinderInfoDto.getContactPhone()); // warningMsgDto.setUserPeoplePhone(cylinderInfoDto.getContactPhone());
warningMsgDto.setCode(cylinderInfoDto.getSequenceCode()); warningMsgDto.setCode(cylinderInfoDto.getSequenceCode());
warningMsgDto.setCompanyName(cylinderInfoDto.getUnitName()); warningMsgDto.setCompanyName(cylinderInfoDto.getUnitName());
warningMsgDto.setPhone(cylinderInfoDto.getPersonMobilePhone()); warningMsgDto.setPhone(cylinderInfoDto.getPersonMobilePhone());
warningMsgDto.setPeople(cylinderInfoDto.getUnitPerson()); warningMsgDto.setPeople(cylinderInfoDto.getUnitPerson());
warningMsgDto.setCurrentTime(dateStr); warningMsgDto.setCurrentTime(dateStr);
// 2.循环调用规则 触发计算等级及发送消息 // 2.循环调用规则 触发计算等级及发送消息
if (log.isInfoEnabled()) { if (log.isInfoEnabled()) {
log.info("调用规则对象!+:{}", JSON.toJSONString(warningMsgDto)); log.info("调用规则对象!+:{}", JSON.toJSONString(warningMsgDto));
} }
ruleTrigger.publish(warningMsgDto, packageId, null); ruleTrigger.publish(warningMsgDto, packageId, null);
} catch (Exception e) { } catch (Exception e) {
log.error("调用规则失败!:{},{}", JSON.toJSONString(cylinderInfoDto), e); log.error("调用规则失败!:{},{}", JSON.toJSONString(cylinderInfoDto), e);
} }
} }
public CylinderInfoDto getDetail(String sequenceCode) { public CylinderInfoDto getDetail(String sequenceCode) {
CylinderInfoDto dto = scheduleMapper.getCylDetail(sequenceCode); CylinderInfoDto dto = scheduleMapper.getCylDetail(sequenceCode);
dto.setInspectionStatusDesc(StringUtils.isNotEmpty(dto.getEarlyWarningLevel()) dto.setInspectionStatusDesc(StringUtils.isNotEmpty(dto.getEarlyWarningLevel())
? EarlyWarningLevelEnum.getEumByLevel(dto.getEarlyWarningLevel()).getStatus() ? EarlyWarningLevelEnum.getEumByLevel(dto.getEarlyWarningLevel()).getStatus()
: ""); : "");
return dto; return dto;
} }
public List<MsgLog> getMsgList(String sequenceCode, String terminalType) { public List<MsgLog> getMsgList(String sequenceCode, String terminalType) {
LambdaQueryWrapper<MsgLog> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<MsgLog> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MsgLog::getRelationCode, sequenceCode); wrapper.eq(MsgLog::getRelationCode, sequenceCode);
wrapper.eq(StringUtils.isNotEmpty(terminalType), MsgLog::getTerminalType, terminalType); wrapper.eq(StringUtils.isNotEmpty(terminalType), MsgLog::getTerminalType, terminalType);
wrapper.orderByDesc(MsgLog::getSendTime); wrapper.orderByDesc(MsgLog::getSendTime);
return msgLogService.list(wrapper); return msgLogService.list(wrapper);
} }
/** /**
* 更新气瓶等级 * 更新气瓶等级
* *
* @param sequenceCode 唯一表设 * @param sequenceCode 唯一表设
* @param level 等级 * @param level 等级
* @return CylinderInfo * @return CylinderInfo
*/ */
public CylinderInfo updateEarlyWarningLevel(String sequenceCode, String level) { public CylinderInfo updateEarlyWarningLevel(String sequenceCode, String level) {
CylinderInfo cylinderInfo = this CylinderInfo cylinderInfo = this
.getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, sequenceCode)); .getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, sequenceCode));
cylinderInfo.setEarlyWarningLevel(level); cylinderInfo.setEarlyWarningLevel(level);
cylinderInfo.setEarlyWarningLevelCalDate(new Date()); cylinderInfo.setEarlyWarningLevelCalDate(new Date());
this.updateById(cylinderInfo); this.updateById(cylinderInfo);
return cylinderInfo; return cylinderInfo;
} }
public Boolean nextInspectionDateUpdate(List<CylinderInfoDto> cylinderInfoDtos) { public Boolean nextInspectionDateUpdate(List<CylinderInfoDto> cylinderInfoDtos) {
// 1.更新下次检验日期 // 1.更新下次检验日期
List<CylinderInfo> cylinderInfos = new ArrayList<>(); List<CylinderInfo> cylinderInfos = new ArrayList<>();
cylinderInfoDtos.forEach(c -> { cylinderInfoDtos.forEach(c -> {
CylinderInfo cylinderInfo = this.getOne( CylinderInfo cylinderInfo = this.getOne(
new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, c.getSequenceCode())); new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, c.getSequenceCode()));
// cylinderInfo.setNextInspectionDate(c.getNextInspectionDate()); // cylinderInfo.setNextInspectionDate(c.getNextInspectionDate());
cylinderInfos.add(cylinderInfo); cylinderInfos.add(cylinderInfo);
}); });
if (!cylinderInfos.isEmpty()) { if (!cylinderInfos.isEmpty()) {
this.updateBatchById(cylinderInfos); this.updateBatchById(cylinderInfos);
} }
// 2.循环调用规则 触发计算等级及发送消息 // 2.循环调用规则 触发计算等级及发送消息
cylinderInfos.forEach(this::touchRuleToCalLevel); cylinderInfos.forEach(this::touchRuleToCalLevel);
return Boolean.TRUE; return Boolean.TRUE;
} }
public Page<CylinderInfoDto> cyinderInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort,List<String> appids){ public Page<CylinderInfoDto> cyinderInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort, List<String> appids) {
return cylinderInfoMapper.cyinderInfoList(page,cylinderInfoDto,sort,appids); return cylinderInfoMapper.cyinderInfoList(page, cylinderInfoDto, sort, appids);
} }
public Page<CylinderInfoDto> getCyinderInfoList(Page<CylinderInfoDto> page) { public Page<CylinderInfoDto> getCyinderInfoList(Page<CylinderInfoDto> page) {
return cylinderInfoMapper.getCyinderInfoList(page); return cylinderInfoMapper.getCyinderInfoList(page);
} }
public Page<CylinderInfoDto> cyinderOutInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort,List<String> appids){ public Page<CylinderInfoDto> cyinderOutInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort, List<String> appids) {
return cylinderInfoMapper.cyinderOutInfoList(page,cylinderInfoDto,sort,appids); return cylinderInfoMapper.cyinderOutInfoList(page, cylinderInfoDto, sort, appids);
} }
} }
\ No newline at end of file
#DB properties: #DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=cn.com.vastbase.Driver
spring.datasource.url=jdbc:mysql://36.46.151.113:23306/tzs_amos_tzs_biz_init?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.datasource.url=jdbc:vastbase://192.168.249.180:54321/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=Yeejoin@2020 spring.datasource.password=Yeejoin@2023
eureka.client.service-url.defaultZone=http://192.168.249.13:10001/eureka/,http://192.168.249.139:10001/eureka/
#eureka properties: eureka.instance.prefer-ip-address=true
eureka.instance.hostname= eureka eureka.instance.ip-address=192.168.249.13
eureka.instance.prefer-ip-address = true management.endpoint.health.show-details=always
eureka.client.serviceUrl.defaultZone =http://36.46.151.113:10001/eureka/ management.endpoints.web.exposure.include=*
eureka.instance.ip-address = 172.16.3.133 eureka.instance.health-check-url=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://${eureka.instance.ip-address}:${server.port}${server.servlet.context-path}/doc.html
## ES properties: ## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=docker-cluster
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username=elastic elasticsearch.username=elastic
elasticsearch.password=123456 elasticsearch.password=Yeejoin@2023
spring.elasticsearch.rest.uris=http://192.168.249.218:9200,http://192.168.249.114:9200,http://192.168.249.155:9200
## unit(h) ## unit(h)
alertcall.es.synchrony.time=48 alertcall.es.synchrony.time=48
#redis properties: #redis properties:
spring.redis.database=1 #集群环境
spring.redis.host=36.46.151.113 spring.redis.cluster.nodes=192.168.249.218:6377,192.168.249.114:6377,192.168.249.155:6377
spring.redis.port=16379 spring.redis.password=Yeejoin@2023
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200 spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1 spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=300
## emqx properties: ## emqx properties:
emqx.clean-session=false emqx.clean-session=false
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://36.46.151.113:1883 emqx.broker=tcp://192.168.249.180:2883
emqx.user-name=super emqx.user-name=super
emqx.password=123456 emqx.password=123456
emqx.keepAliveInterval=1000 emqx.keepAliveInterval=1000
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4 tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.46.151.113:8000 tzs.cti.url=http://36.41.172.83:8000
##wechatTokenls
##wechatToken
tzs.wechat.token=yeejoin_2021 tzs.wechat.token=yeejoin_2021
##wechatTicketUrl ##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token= tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
#tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw #tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
...@@ -61,41 +50,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html ...@@ -61,41 +50,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
#tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU #tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti cti.user.name=tzs_cti
cti.user.pwd=a1234567 cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001 flc.sms.tempCode=SMS_TZS_0001
## ??????id
## \u9884\u8B66\u901A\u77E5\u6A21\u677Fid
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##\u7763\u67E5\u6574\u6539\u901A\u77E5 ##??????
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## ???????id???userId?
## \u516C\u4F17\u53F7\u6D4B\u8BD5\u7528\u6237id\uFF08\u5E73\u53F0userId\uFF09
tzs.wechat.test.userId=3413513 tzs.wechat.test.userId=3413513
##new properties
fileserver.domain=https://rpm.yeeamos.com:8888/
org.filter.group.seq=1564150103147573249 org.filter.group.seq=1564150103147573249
fileserver.domain=http://192.168.249.180:19000/
log.level=INFO
duty.seats.role.ids=1585956200472674305,1585956257590706177 duty.seats.role.ids=1585956200472674305,1585956257590706177
## ???? properties:
rule.definition.load=false
##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto
rule.definition.default-agency=tzs
rule.definition.local-ip=192.168.249.13
#\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.fill.cron=0 0 12 * * ?
#\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.info.cron=0 0 1 * * ?
# ??????????
minio.url.path=http://192.168.249.180:19000/
## 生成监管码前缀域名
regulatory_code_prefix=https://nav.sspai.top/tzs?code=
outSystem.user.password=a1234560
amos.system.user.app-key=AMOS_STUDIO
amos.system.user.product=STUDIO_APP_WEB
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.10.90:53306/tzs_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://172.16.3.99:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.99:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.99:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.99:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=172.16.10.90
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic
elasticsearch.password= Yeejoin@2020
## unit(h)
alertcall.es.synchrony.time=48
fileserver.domain=https://rpm.yeeamos.com:8888/
#redis properties:
spring.redis.database=1
spring.redis.host=172.16.10.90
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.90:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://172.16.10.90:8000
rule.definition.load=false
rule.definition.model-package=com.yeejoin.amos.boot.module.tzs.api.dto
rule.definition.default-agency=tzs
rule.definition.localIp=172.16.3.39
org.filter.group.seq=1564150103147573249
duty.seats.role.ids=1585956200472674305,1585956257590706177
\ No newline at end of file
...@@ -4,31 +4,7 @@ spring.datasource.url=jdbc:vastbase://36.46.137.116:5432/tzs_amos_tzs_biz_init?c ...@@ -4,31 +4,7 @@ spring.datasource.url=jdbc:vastbase://36.46.137.116:5432/tzs_amos_tzs_biz_init?c
#spring.datasource.url=jdbc:vastbase://36.46.151.113:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz #spring.datasource.url=jdbc:vastbase://36.46.151.113:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz
spring.datasource.username=admin spring.datasource.username=admin
spring.datasource.password=Yeejoin@2023 spring.datasource.password=Yeejoin@2023
eureka.client.service-url.defaultZone=http://172.16.10.230:10001/eureka/
#DB properties:
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.url=jdbc:mysql://172.16.10.230:53306/${TZS_BIZ_DATABASE}?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
#spring.datasource.username=${MYSQL_ROOT_USER}
#spring.datasource.password=${MYSQL_ROOT_PASSWORD}
#eureka prioperties:
#eureka.client.serviceUrl.defaultZone=http://172.16.10.230:10001/eureka/
#eureka.client.register-with-eureka=true
#eureka.client.fetch-registry=true
#eureka.client.healthcheck.enabled=true
#ribbon.eureka.enabled=true
#eureka.instance.hostname=${spring.cloud.client.ip-address}
#eureka.instance.prefer-ip-address=true
#eureka.instance.instance-id=${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
#eureka.instance.lease-expiration-duration-in-seconds=10
#eureka.instance.lease-renewal-interval-in-seconds=5
#management.endpoint.health.show-details=always
#management.endpoints.web.exposure.include=*
#
#eureka.instance.prefer-ip-address = true
#eureka.instance.ip-address = 172.16.10.230
eureka.client.service-url.defaultZone =http://172.16.10.230:10001/eureka/
eureka.instance.prefer-ip-address=true eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=* management.endpoints.web.exposure.include=*
...@@ -36,25 +12,13 @@ eureka.instance.health-check-url=http://172.16.3.34:${server.port}${server.servl ...@@ -36,25 +12,13 @@ eureka.instance.health-check-url=http://172.16.3.34:${server.port}${server.servl
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.34:${server.port}${server.servlet.context-path}/actuator/info eureka.instance.status-page-url=http://172.16.3.34:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.34:${server.port}${server.servlet.context-path}/doc.html eureka.instance.metadata-map.management.api-docs=http://172.16.3.34:${server.port}${server.servlet.context-path}/doc.html
eureka.instance.ip-address=172.16.3.34
eureka.instance.ip-address = 172.16.3.34
## ES properties: ## ES properties:
biz.elasticsearch.port=9200 elasticsearch.username=elastic
biz.elasticsearch.address=172.16.10.230 elasticsearch.password=a123456
spring.data.elasticsearch.cluster-name=docker-cluster spring.elasticsearch.rest.uris=http:/172.16.10.230:9200
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic
elasticsearch.password= a123456
## unit(h) ## unit(h)
alertcall.es.synchrony.time=48 alertcall.es.synchrony.time=48
#redis properties: #redis properties:
spring.redis.database=1 spring.redis.database=1
spring.redis.host=172.16.10.230 spring.redis.host=172.16.10.230
...@@ -65,7 +29,6 @@ spring.redis.lettuce.pool.max-wait=-1 ...@@ -65,7 +29,6 @@ spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=300
## emqx properties: ## emqx properties:
emqx.clean-session=false emqx.clean-session=false
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
...@@ -73,20 +36,13 @@ emqx.broker=tcp://36.46.151.113:1883 ...@@ -73,20 +36,13 @@ emqx.broker=tcp://36.46.151.113:1883
emqx.user-name=super emqx.user-name=super
emqx.password=123456 emqx.password=123456
emqx.keepAliveInterval=1000 emqx.keepAliveInterval=1000
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4 tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.41.172.83:8000 tzs.cti.url=http://36.41.172.83:8000
##wechatToken ##wechatToken
tzs.wechat.token=yeejoin_2021 tzs.wechat.token=yeejoin_2021
##wechatTicketUrl ##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token= tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
#tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw #tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
...@@ -96,67 +52,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html ...@@ -96,67 +52,41 @@ tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
#tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU #tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti cti.user.name=tzs_cti
cti.user.pwd=a1234567 cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001 flc.sms.tempCode=SMS_TZS_0001
## ??????id ## ??????id
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##?????? ##??????
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## ???????id???userId? ## ???????id???userId?
tzs.wechat.test.userId=3413513 tzs.wechat.test.userId=3413513
##new properties ##new properties
org.filter.group.seq=1564150103147573249 org.filter.group.seq=1564150103147573249
fileserver.domain=http://172.16.10.230:19000/ fileserver.domain=http://172.16.10.230:19000/
log.level=INFO log.level=INFO
duty.seats.role.ids=1585956200472674305,1585956257590706177 duty.seats.role.ids=1585956200472674305,1585956257590706177
## ???? properties: ## ???? properties:
rule.definition.load=false rule.definition.load=false
##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto ##rule.definition.model-package=com.yeejoin.amos.boot.module.jcs.api.dto
rule.definition.default-agency=tzs rule.definition.default-agency=tzs
rule.definition.local-ip=172.16.10.230 rule.definition.local-ip=172.16.10.230
#\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es #\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.fill.cron=0 0 12 * * ? tzs.cylinder.fill.cron=0 0 12 * * ?
#\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es #\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.info.cron=0 0 1 * * ? tzs.cylinder.info.cron=0 0 1 * * ?
# ?????????? # ??????????
minio.url.path=http://172.16.10.230:9000/ minio.url.path=http://172.16.10.230:9000/
## ɼǰ׺ ## ɼǰ׺
regulatory_code_prefix=https://sxtzsb.sxsei.com:9435/tzs?code= regulatory_code_prefix=https://sxtzsb.sxsei.com:9435/tzs?code=
#outSystem.user.password=a1234560 #outSystem.user.password=a1234560
#amos.system.user.app-key=AMOS_STUDIO #amos.system.user.app-key=AMOS_STUDIO
#amos.system.user.product=STUDIO_APP_WEB #amos.system.user.product=STUDIO_APP_WEB
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://113.134.211.174:3306/xiy_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://172.16.3.28:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.28:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.28:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://192.168.1.10:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
## unit(h)
alertcall.es.synchrony.time=48
#redis properties:
spring.redis.database=1
spring.redis.host=172.16.3.28
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.3.28:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://113.134.211.174:8000
rule.definition.load=false
rule.definition.model-package=com.yeejoin.amos.boot.module.tzs.api.dto
rule.definition.default-agency=tzs
rule.definition.localIp=172.16.3.39
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://36.46.151.113:13306/tzs_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://36.46.151.113:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://localhost:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/doc.html
## ES properties:
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
## unit(h)
alertcall.es.synchrony.time=48
#redis properties:
spring.redis.database=1
spring.redis.host=36.46.151.113
spring.redis.port=16379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://36.46.151.113:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://113.134.211.174:8000
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名--> <!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/ymt.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern> <FileNamePattern>${LOG_HOME}/Tcm.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<MaxHistory>30</MaxHistory> <MaxHistory>30</MaxHistory>
<!--日志文件大小--> <!--日志文件大小-->
...@@ -37,20 +37,20 @@ ...@@ -37,20 +37,20 @@
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" /> <logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
--> -->
<!--myibatis log configure--> <!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/> <logger name="com.apache.ibatis" level="debug"/>
<logger name="org.mybatis" level="INFO" /> <logger name="org.mybatis" level="debug" />
<logger name="java.sql.Connection" level="INFO"/> <logger name="java.sql.Connection" level="debug"/>
<logger name="java.sql.Statement" level="INFO"/> <logger name="java.sql.Statement" level="debug"/>
<logger name="java.sql.PreparedStatement" level="INFO"/> <logger name="java.sql.PreparedStatement" level="debug"/>
<logger name="org.springframework" level="INFO"/> <logger name="org.springframework" level="debug"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/> <logger name="com.baomidou.mybatisplus" level="debug"/>
<logger name="org.apache.activemq" level="INFO"/> <logger name="org.apache.activemq" level="debug"/>
<logger name="org.typroject" level="INFO"/> <logger name="org.typroject" level="debug"/>
<logger name="com.yeejoin" level="INFO"/> <logger name="com.yeejoin" level="debug"/>
<!-- 日志输出级别 --> <!-- 日志输出级别 -->
<root level="DEBUG"> <root level="error">
<!-- <appender-ref ref="FILE" /> --> <!-- <appender-ref ref="FILE" /> -->
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
<!-- <appender-ref ref="ELK" />--> <!-- <appender-ref ref="ELK" />-->
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/ymt.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- ELK管理 -->
<appender name="ELK" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>172.16.10.230:4560</destination>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/>
<logger name="org.mybatis" level="INFO" />
<logger name="java.sql.Connection" level="INFO"/>
<logger name="java.sql.Statement" level="INFO"/>
<logger name="java.sql.PreparedStatement" level="INFO"/>
<logger name="org.springframework" level="INFO"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="INFO"/>
<logger name="com.yeejoin" level="INFO"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<!-- <appender-ref ref="FILE" /> -->
<appender-ref ref="STDOUT" />
<!-- <appender-ref ref="ELK" />-->
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/ymt.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="org.mybatis" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<logger name="com.baomidou.mybatisplus" level="DEBUG"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/ymt.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="org.mybatis" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<logger name="com.baomidou.mybatisplus" level="DEBUG"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
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