Commit 546aefd3 authored by tangwei's avatar tangwei

修改扫描bug

parent 5b66aa10
......@@ -16,11 +16,11 @@ public class IndexLogsRequest {
private String timeEnd;
private String fieldKey;
private String equipmentIndex;
private Long page;
private Long total;
private Long size;
private long page;
private long total;
private long size;
public IndexLogsRequest( String timeStart, String timeEnd, String equipmentIndex, Long page, Long size) {
public IndexLogsRequest( String timeStart, String timeEnd, String equipmentIndex, long page, long size) {
this.timeStart = timeStart;
this.timeEnd = timeEnd;
this.equipmentIndex = equipmentIndex;
......
package com.yeejoin.equipmanage.fegin;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.entity.dto.IndexLogsRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
......@@ -71,5 +72,5 @@ public interface IotFeign {
@RequestMapping(value = "v1/livedata/index/logs", method = RequestMethod.POST, consumes = "application/json")
ResponseModel<List<Map<String ,Object>>> getEquipAlarmLog( @RequestBody IndexLogsRequest indexLogsRequest );
ResponseModel<Map<String ,Object>> getEquipAlarmLog(@RequestBody IndexLogsRequest indexLogsRequest );
}
......@@ -119,18 +119,19 @@ public class EquipmentSpecificAlarmLogServiceImpl extends ServiceImpl<EquipmentS
endTime= endTime.replace("00:00:00","23:59:59");
IndexLogsRequest indexLogsRequest=new IndexLogsRequest( startTime, endTime, iotCode, current, pageSize);
IndexLogsRequest indexLogsRequest=new IndexLogsRequest( startTime, endTime, "YJ210093SBMC0001FHS_FirePump_PowerRunStatus", current, pageSize);
//调用iot 获取数据
ResponseModel<List<Map<String, Object>>> date = iotFeign.getEquipAlarmLog(indexLogsRequest);
ResponseModel<Map<String, Object>> date = iotFeign.getEquipAlarmLog(indexLogsRequest);
if (date.getStatus() != 200 ) {
throw new BadRequest("系统错误!");
}
List<Map<String, Object>> listObject = date.getResult();
Map<String, Object> listObject = date.getResult();
if (listObject != null) {
List<Map<String, Object>> listObjectdate=( List<Map<String, Object>>)listObject.get("records");
//数据处理
for (Map<String, Object> map : listObject) {
for (Map<String, Object> map : listObjectdate) {
//过滤告警
String key=map.get("iotCode").toString()+map.get("indexName");
if(mapkey.containsKey(key)){
......@@ -145,11 +146,17 @@ public class EquipmentSpecificAlarmLogServiceImpl extends ServiceImpl<EquipmentS
}
}
}
pageBean.setTotal(listDate.size());
pageBean.setRecords(listDate);
//由于iot 分页 ,没有数据时返回int,有数据时返回字符串,还是Double类型字符串,需统一处理。
Double tot= Double.valueOf(listObject.get("total").toString());
pageBean.setTotal(tot.intValue());
return pageBean;
}
public String getReadableStatus(String value ) {
if("true".equals(value)){
return "是";
......
......@@ -20,7 +20,7 @@ public class DispatchMapServiceImpl implements IHomePageService {
//实现首页dispatchMap
@Autowired
AlertCalledMapper alertCalledMapper;
private static AlertCalledMapper alertCalledMapper1;
private AlertCalledMapper alertCalledMapper1;
@PostConstruct
public void init(){
......
......@@ -19,7 +19,7 @@ public class DispatchTaskServiceImpl implements IHomePageService {
//实现首页dispatchMap
@Autowired
AlertCalledMapper alertCalledMapper;
private static AlertCalledMapper alertCalledMapper1;
private AlertCalledMapper alertCalledMapper1;
@PostConstruct
public void init(){
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
......@@ -8,6 +9,7 @@ import java.util.List;
import javax.annotation.PostConstruct;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
......@@ -33,6 +35,8 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.ESAlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStatusEnum;
import com.yeejoin.amos.boot.module.jcs.biz.dao.ESAlertCalledRepository;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
/**
*
* <pre>
......@@ -56,7 +60,8 @@ public class ESAlertCalledService {
@Value("${alertcall.es.synchrony.time}")
private Long time;
private static final String CALLTIMELONG="callTimeLong";
@PostConstruct
public void init() throws Exception
......@@ -68,7 +73,7 @@ public class ESAlertCalledService {
/**
* 重建索引
*/
public Boolean initEs() throws Exception {
public Boolean initEs() {
esAlertCalledRepository.deleteAll();
/**
* 同步历史48小时以内的警情处置记录
......@@ -91,10 +96,7 @@ public class ESAlertCalledService {
List<AlertCalled> alertCalleds = alertCalledService.list(wrapper);
if (!ValidationUtil.isEmpty(alertCalleds))
{
// for (AlertCalled alertCalled : alertCalleds)
// {
// saveAlertCalledToES(alertCalled);
// }
saveAlertCalledToES(alertCalleds);
}
......@@ -108,9 +110,9 @@ public class ESAlertCalledService {
* 批量保存
* </pre>
*
* @param list 警情信息列表
* @param
*/
public void saveAll(List<AlertCalled> alertCalleds) throws Exception{
public void saveAll(List<AlertCalled> alertCalleds) {
if (!ValidationUtil.isEmpty(alertCalleds))
{
......@@ -127,9 +129,9 @@ public class ESAlertCalledService {
* 根据警情记录批量保存
* </pre>
*
* @param alertCalleds 警情信息列表
* @param
*/
public ESAlertCalled saveAlertCalledToES(AlertCalled alertCalled) throws Exception
public ESAlertCalled saveAlertCalledToES(AlertCalled alertCalled)
{
ESAlertCalled esAlertCalled = new ESAlertCalled();
esAlertCalled.setSequenceNbr(alertCalled.getSequenceNbr());
......@@ -146,7 +148,11 @@ public class ESAlertCalledService {
esAlertCalled.setFlightNumber(alertCalled.getFlightNumber());
if(alertCalled.getLandingTime() != null ){
Date date = new Date();
date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alertCalled.getLandingTime());
try {
date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alertCalled.getLandingTime());
} catch (ParseException e) {
throw new BadRequest("系统异常");
}
esAlertCalled.setLandingTime(date.getTime());
}
if (alertCalled.getAlertStatus())
......@@ -167,7 +173,7 @@ public class ESAlertCalledService {
}
public List<ESAlertCalled> saveAlertCalledToES(List<AlertCalled> alertCalleds) throws Exception
public List<ESAlertCalled> saveAlertCalledToES(List<AlertCalled> alertCalleds)
{
List<ESAlertCalled> list1=new ArrayList<>();
for (AlertCalled alertCalled : alertCalleds)
......@@ -214,7 +220,7 @@ public class ESAlertCalledService {
* @return
* @throws Exception
*/
public Boolean deleteById(List<Long> ids) throws Exception{
public Boolean deleteById(List<Long> ids){
if (!ValidationUtil.isEmpty(ids)) {
for (Long sequenceNbr : ids) {
if (esAlertCalledRepository.existsById(sequenceNbr)) {
......@@ -239,7 +245,7 @@ public class ESAlertCalledService {
/**
* 根据关键字查询文档,关键字不为空时按相关性从大到小排序
*
* @param queryStr 关键字
* @param
* @param current 当前页码
* @param size 页面大小
* @return
......@@ -281,7 +287,7 @@ public class ESAlertCalledService {
long currentTime = System.currentTimeMillis() ;
currentTime = currentTime - 30*60*1000;
BoolQueryBuilder qb1 = QueryBuilders.boolQuery()
.must(QueryBuilders.rangeQuery("callTimeLong").gte(currentTime));
.must(QueryBuilders.rangeQuery(CALLTIMELONG).gte(currentTime));
boolMust.should(qb1);
//报警人及报警电话一致
if (!ValidationUtil.isEmpty(alertCalled.getContactUser()) && !ValidationUtil.isEmpty(alertCalled.getContactPhone()))
......@@ -354,7 +360,7 @@ public class ESAlertCalledService {
//过滤条件
.withQuery(boolMustAll)
// 排序
.withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC))
.withSort(SortBuilders.fieldSort(CALLTIMELONG).order(SortOrder.DESC))
// 分页
.withPageable(PageRequest.of(current, size))
;
......@@ -367,8 +373,8 @@ public class ESAlertCalledService {
for (SearchHit searchHit : searchHits.getSearchHits())
{
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(searchHit.getContent());
ESAlertCalledDto eSAlertCalled =JSONObject.toJavaObject(jsonObject, ESAlertCalledDto.class);
JSONObject jsonObject = (JSONObject) JSON.toJSON(searchHit.getContent());
ESAlertCalledDto eSAlertCalled = JSON.toJavaObject(jsonObject, ESAlertCalledDto.class);
list.add(eSAlertCalled);
}
totle =searchHits.getTotalHits();
......@@ -419,7 +425,7 @@ public class ESAlertCalledService {
long currentTime = System.currentTimeMillis() ;
currentTime = currentTime - 30*60*1000;
BoolQueryBuilder qb1 = QueryBuilders.boolQuery()
.must(QueryBuilders.rangeQuery("callTimeLong").gte(currentTime));
.must(QueryBuilders.rangeQuery(CALLTIMELONG).gte(currentTime));
boolMust.should(qb1);
//报警人及报警电话一致
if (!ValidationUtil.isEmpty(alertCalled.getContactUser()) && !ValidationUtil.isEmpty(alertCalled.getContactPhone()))
......@@ -439,7 +445,6 @@ public class ESAlertCalledService {
//警情类型一致
BoolQueryBuilder qb4 = QueryBuilders.boolQuery()
.must(QueryBuilders.termQuery("alertTypeCode.keyword", alertCalled.getAlertTypeCode()));
//boolMust.should(qb4);
//事发单位名称一致
if (!ValidationUtil.isEmpty(alertCalled.getUnitInvolved()))
{
......@@ -465,7 +470,7 @@ public class ESAlertCalledService {
// 分页
.withPageable(PageRequest.of(current, size))
// 排序
.withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC))
.withSort(SortBuilders.fieldSort(CALLTIMELONG).order(SortOrder.DESC))
//过滤条件
.withQuery(boolMustAll)
;
......@@ -479,8 +484,8 @@ public class ESAlertCalledService {
for (SearchHit searchHit : searchHits.getSearchHits())
{
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(searchHit.getContent());
ESAlertCalledDto eSAlertCalled =JSONObject.toJavaObject(jsonObject, ESAlertCalledDto.class);
JSONObject jsonObject = (JSONObject) JSON.toJSON(searchHit.getContent());
ESAlertCalledDto eSAlertCalled =JSON.toJavaObject(jsonObject, ESAlertCalledDto.class);
list.add(eSAlertCalled);
}
totle =searchHits.getTotalHits();
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
......@@ -64,10 +65,10 @@ public class ESCarService implements IESCarService {
{
SearchHits<ESCar> searchHits =elasticsearchTemplate.search(queryBuilder.build(), ESCar.class);
for (SearchHit searchHit : searchHits.getSearchHits())
for (SearchHit<ESCar> searchHit : searchHits.getSearchHits())
{
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(searchHit.getContent());
ESCar eSCar =JSONObject.toJavaObject(jsonObject, ESCar.class);
JSONObject jsonObject = (JSONObject) JSON.toJSON(searchHit.getContent());
ESCar eSCar = JSON.toJavaObject(jsonObject, ESCar.class);
list.add(eSCar);
}
......@@ -77,8 +78,11 @@ public class ESCarService implements IESCarService {
e.printStackTrace();
}
if(list.size()>0){
return list.get(0);
}
return list!=null&&list.size()>0?list.get(0):null;
return null;
}
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
......@@ -50,9 +51,10 @@ public class EquipmentServiceImpl {
@Autowired
private RedisUtils redisUtils;
private static final String CHILDREN="children";
public List<MenuFrom> getFireSystemList() {
// 导出模板增加权限
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
// 权限处理
PermissionInterceptorContext.setDataAuthRule("fire_water_info");
ResponseModel<Object> response = equipFeignClient.getFireSystemListAll();
......@@ -71,14 +73,13 @@ public class EquipmentServiceImpl {
stopWatch.start();
ResponseModel<Object> response = equipFeignClient.getBuildingTree();
stopWatch.stop();
System.out.printf("耗时%f秒/n", stopWatch.getTotalTimeSeconds());
List<Map<String, Object>> buildingMapList = (List<Map<String, Object>>) response.getResult();
List<MenuFrom> buildingTreeList = Lists.newArrayList();
buildingMapList.forEach(building -> {
MenuFrom menuFrom = new MenuFrom((String) building.get("id"), "全部建筑", (String) building.get("parentId"),
"0");
List<Map<String, Object>> children = (List<Map<String, Object>>) building.get("children");
List<Map<String, Object>> children = (List<Map<String, Object>>) building.get(CHILDREN);
menuFrom.setChildren(parseTree(menuFrom, children));
menuFrom.setIsLeaf(false);
buildingTreeList.add(menuFrom);
......@@ -92,8 +93,8 @@ public class EquipmentServiceImpl {
children.forEach(child -> {
MenuFrom menuFrom = new MenuFrom((String) child.get("id"), (String) child.get("name"),
(String) child.get("parentId"), "0");
if (!ValidationUtil.isEmpty(child.get("children"))) {
parseTree(menuFrom, (List<Map<String, Object>>) child.get("children"));
if (!ValidationUtil.isEmpty(child.get(CHILDREN))) {
parseTree(menuFrom, (List<Map<String, Object>>) child.get(CHILDREN));
if(parent!=null){
parent.setIsLeaf(false);
}
......
......@@ -19,7 +19,7 @@ public class FaultServiceImpl implements IHomePageService {
@Autowired
EquipFeignClient quipFeignClient;
private static EquipFeignClient quipFeignClient1;
private EquipFeignClient quipFeignClient1;
@PostConstruct
public void init(){
......
......@@ -20,7 +20,7 @@ public class FireAlarmServiceImpl implements IHomePageService {
@Autowired
EquipFeignClient quipFeignClient;
private static EquipFeignClient quipFeignClient1;
private EquipFeignClient quipFeignClient1;
@PostConstruct
public void init(){
......
......@@ -39,7 +39,7 @@ public class FirefightersJacketServiceImpl extends BaseService<FirefightersJacke
@Override
public ResponseModel<Page<Object>> getAirEquipSpecificPage(EquipSpecificDto equipSpecificDto, int current, int size) {
Page page = new Page(current, size);
Page<Object> page = new Page<Object>(current, size);
equipSpecificDto.setPage(page);
ResponseModel<Page<Object>> airEquipSpecificPage = equipFeignClient.getAirEquipSpecificPage(equipSpecificDto);
return airEquipSpecificPage;
......
......@@ -42,7 +42,7 @@ public class FirestationJacketServiceImpl extends BaseService<FirestationJacketD
@Override
public ResponseModel<Page<Object>> getAirEquipSpecificPage(EquipSpecificDto equipSpecificDto, int current, int size) {
Page page = new Page(current, size);
Page<Object> page = new Page<Object>(current, size);
equipSpecificDto.setPage(page);
ResponseModel<Page<Object>> airEquipSpecificPage = equipFeignClient.getAirEquipSpecificPage(equipSpecificDto);
return airEquipSpecificPage;
......
......@@ -26,6 +26,8 @@ public class FusionServiceImpl implements IFusionService {
@Value("${ifc.url}")
private String voiceURL;
private static String LOGD="访问融合终端失败";
@Override
public JSONObject getAllOnlineUser() {
JSONObject jsonObject = null;
......@@ -33,7 +35,7 @@ public class FusionServiceImpl implements IFusionService {
jsonObject = RestTemplateUtil.getRestInstance().getForObject(String.format("%s/GetAllOnlineUser", voiceURL), JSONObject.class);
} catch (RestClientException e) {
e.printStackTrace();
throw new BadRequest("访问融合终端失败");
throw new BadRequest(LOGD);
}
return jsonObject;
}
......@@ -46,7 +48,7 @@ public class FusionServiceImpl implements IFusionService {
jsonObject = RestTemplateUtil.getRestInstance().getForObject(url, JSONObject.class);
} catch (RestClientException e) {
e.printStackTrace();
throw new BadRequest("访问融合终端失败");
throw new BadRequest(LOGD);
}
return jsonObject;
}
......@@ -60,7 +62,7 @@ public class FusionServiceImpl implements IFusionService {
jsonObject = RestTemplateUtil.getRestInstance().postForObject(String.format("%s/GetGISByEmployeeID", voiceURL), requestEntity, JSONObject.class);
} catch (RestClientException e) {
e.printStackTrace();
throw new BadRequest("访问融合终端失败");
throw new BadRequest(LOGD);
}
return getResult(jsonObject);
}
......@@ -75,7 +77,7 @@ public class FusionServiceImpl implements IFusionService {
jsonObject = RestTemplateUtil.getRestInstance().postForObject(String.format("%s/GetCallRecordByNumber", voiceURL), requestEntity, JSONObject.class);
} catch (RestClientException e) {
e.printStackTrace();
throw new BadRequest("访问融合终端失败");
throw new BadRequest(LOGD);
}
return getResult(jsonObject);
}
......@@ -89,7 +91,7 @@ public class FusionServiceImpl implements IFusionService {
jsonObject = RestTemplateUtil.getRestInstance().postForObject(String.format("%s/GetCallRecordByCID", voiceURL), requestEntity, JSONObject.class);
} catch (RestClientException e) {
e.printStackTrace();
throw new BadRequest("访问融合终端失败");
throw new BadRequest(LOGD);
}
return getResult(jsonObject);
}
......@@ -142,7 +144,7 @@ public class FusionServiceImpl implements IFusionService {
jsonObject = RestTemplateUtil.getRestInstance().postForObject(String.format("%s/selectCallRecordByConditions", voiceURL), requestEntity, JSONObject.class);
} catch (RestClientException e) {
e.printStackTrace();
throw new BadRequest("访问融合终端失败");
throw new BadRequest(LOGD);
}
return jsonObject;
}
......@@ -153,7 +155,7 @@ public class FusionServiceImpl implements IFusionService {
public Map<String, String> getResult(JSONObject jsonObject) {
Map<String, String> map = new HashMap<>();
if (ValidationUtil.isEmpty(jsonObject)) {
throw new BadRequest("访问融合终端失败");
throw new BadRequest(LOGD);
}
if (jsonObject.get("data") instanceof Map) {
JSONObject data = jsonObject.getJSONObject("data");
......
......@@ -56,7 +56,7 @@
find_in_set(#{systemId},spe.system_id) and spe.single = true and wlsd.`status` = 1
</select>
<select id="getEquiplistBySystemIdList" resultMap="EquiplistBySystemId">
<select id="getEquiplistBySystemIdList" resultType="com.yeejoin.equipmanage.common.entity.vo.EquiplistSpecificBySystemVO">
SELECT
det.`name` equipmentName,
spe.`iot_code` iotCode,
......
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