Commit aad3037a authored by 赵啸非's avatar 赵啸非

地图详细显示

parent d72eb3ff
......@@ -24,7 +24,7 @@
:events="marker.events"
:position="marker.position"
:label="marker.label"
:icon="marker.icon"
:contentRender="contentRender"
:extData="marker"
>
</el-amap-marker>
......@@ -144,11 +144,14 @@ export default {
},
methods: {
formatterDate,
contentRender(h, params){
//console.log(params.extData.extData.productId)
let value="el-icon-location-information"
let style="font-size:40px,color-red"
return (<i class={value} style="font-size:40px;color:deepskyblue" />)
},
getDeviceDetial(){
//获取设备列表
console.log("device siteId",this.info.siteId)
this.$emit("choose", this.info, (val) => {
//data = val;
......@@ -175,9 +178,9 @@ export default {
setMarker(item) {
if (!item.lng && !item.lat) return;
let markerLabel = {
label: { content: item.siteName, offset: [30, 70] },
label: { content: item.siteName, offset: [20, 38] },
position: [item.lng, item.lat],
icon: require("@/assets/images/marker-blue.png"),
//icon: require("@/assets/images/marker-blue.png"),
extData: item,
events: {
click: (e) => {
......
......@@ -27,7 +27,7 @@
:key="'marker' + index"
:events="marker.events"
:position="marker.position"
:contentRender="contentRender"
:icon="marker.icon"
:extData="marker"
>
......@@ -73,6 +73,11 @@ export default {
},
methods: {
formatterDate,
contentRender(h, params){
//console.log(params.extData.extData.productId)
let value="el-icon-location-information location"+params.extData.extData.productId
return (<i class={value} />)
},
getDeviceDetial() {
//获取设备列表
console.log("device siteId", this.info.siteId);
......@@ -81,11 +86,12 @@ export default {
console.log("刷新数据", data);
// this.markersGroupData = data;
//this.$refs.map.clear();
let map = this.amapManager.getMap()
map.clearMap()
//amapManager.getMap.clear();
for(let group of data){
for(let item of group.deviceList){
console.log("marker", item);
//console.log("marker", item);
this.setMarker(item);
}
......@@ -104,8 +110,9 @@ export default {
let markerLabel = {
label: { content: item.deviceName, offset: [30, 70] },
position: [item.lon, item.lati],
icon: require("@/assets/images/marker-phxt.png"),
extData: item,
events: {
click: (e) => {
console.log("getExtData", e.target.getExtData());
......
......@@ -59,7 +59,7 @@
:enumData="dict.deviceDataSourceWay"
placeholder="请选择数据获取方式"
/>
<Field
<!-- <Field
label="经度"
prop="lon"
v-model="form.lon"
......@@ -70,7 +70,7 @@
prop="lati"
v-model="form.lati"
placeholder="请输入纬度"
/>
/> -->
<Field
label="所属楼栋"
prop="deviceInBuilding"
......
......@@ -4,7 +4,7 @@
:title="title"
:visible.sync="open"
:direction="direction"
size="70%"
size="80%"
>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-tabs style="margin-left: 10px" v-model="activeName">
......
......@@ -180,9 +180,7 @@ export default {
created() {
console.log(this.$route);
this.siteId = this.$route.query.siteId;
this.info=this.$route.query
this.query={siteId:this.siteId}
this.$get("/sitestat/siteInfo", {
......@@ -190,6 +188,7 @@ export default {
})
.then((res) => {
if (res.code == 1) {
//this.info=res.data
this.siteName = res.data.siteName;
this.siteCode = res.data.siteCode;
}
......@@ -198,7 +197,7 @@ export default {
this.$message.error(error.message);
});
this.$router.push({ query: { } });
// this.$router.push({ query: { } });
},
methods: {
switchMap(){
......
......@@ -87,7 +87,7 @@
>
{{ util_formatters("deviceDataSourceWay", form.deviceDataSourceWay) }}
</el-descriptions-item>
<el-descriptions-item
<!-- <el-descriptions-item
label="经度"
label-class-name="labelClass"
content-class-name="contentClass"
......@@ -100,7 +100,7 @@
content-class-name="contentClass"
>
{{ form.lati }}
</el-descriptions-item>
</el-descriptions-item> -->
<el-descriptions-item
label="所属楼栋"
label-class-name="labelClass"
......
......@@ -89,7 +89,7 @@
>编辑站点</el-button
>
<el-button type="primary" size="mini" icon="el-icon-plus"
<el-button type="primary" size="mini" @click="addDevice" icon="el-icon-plus"
>添加设备</el-button
>
</el-row>
......@@ -136,7 +136,7 @@
>
<i
style="font-size: 20px"
v-bind:class="[true ? 'location' + index : '']"
v-bind:class="[true ? 'location' + value : '']"
class="el-icon-location-information"
></i>
<span style="font-size: 12px">{{ label }}</span>
......@@ -181,6 +181,14 @@ export default {
},
methods: {
formatterDate,
addDevice(){
let row={}
row.siteId = this.info.siteId;
row.siteName = this.info.siteName;
row.siteCode = this.info.siteCode;
this.$refs.drawerform.add(row);
},
switchList() {
//进入设备列表页面
this.$router.push({
......@@ -346,6 +354,10 @@ export default {
}
}
</style>
<style>
.location0 {
font-size: 18px;
color: red;
......@@ -398,4 +410,12 @@ export default {
font-size: 18px;
color: forestgreen;
}
.location13 {
font-size: 18px;
color:cyan;
}
.location14 {
font-size: 18px;
color:deepskyblue;
}
</style>
\ No newline at end of file
......@@ -448,8 +448,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
return deviceMapEntity;
}).collect(Collectors.toList());
//更新坐标点 轴步进 0.0001~~11米
BigDecimal lngStep = new BigDecimal(0.0001);
BigDecimal latiStep = new BigDecimal(0.0001);
BigDecimal lngStep = new BigDecimal(0.00005);
BigDecimal latiStep = new BigDecimal(0.00005);
String longitude = sitePdu.getLongitude();
String latitude = sitePdu.getLatitude();
......
......@@ -99,11 +99,9 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
this.addDict(model, "enabled", paramService.getParamBySecondOrganize("Device", "enabled"));
this.addDict(model, "source", DeviceSourceEnum.getEnumMap());
//返回产品列表及其样式
//productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName())).
super.init(model, context);
}
......@@ -115,62 +113,6 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
super.doListBefore(query, model, context);
}
/**
* 下发信息
*/
/* @PostMapping(value = "downMsg")
public String downMsg(@RequestParam(value = "deviceId") Long deviceId, @RequestParam(value = "content") String content) {
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = this.getModuleDesc() + "下发设备消息";
try {
//根据设备编码查询设备
DeviceEntity deviceEntity = this.service.get(deviceId, getContext());
if (!ObjectUtils.isEmpty(deviceEntity)) {
//将上报信息转发到mq中
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
if (ObjectUtils.isEmpty(platformEntity)) {
throw new AppException("当前设备未配置所属系统平台,请在后台配置后再激活!");
}
// authInfo.setHost(platformEntity.getPlatformSn());
ProductEntity productEntity = productService.get(deviceEntity.getProductId());
if (ObjectUtils.isEmpty(productEntity)) {
throw new AppException("当前设备未配置所属产品,请在后台配置后再激活!");
}
String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode();
TopicPartitionInfo info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.DOWN_TOPIC + deviceEntity.getDeviceCode()).build();
TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders();
header.put(MessageHeader.MESSAGETYPE, Constant.MESSAGETYPE_UPGREAD);
JSONObject obj = new JSONObject();
obj.put("content", content);
ApiResp<String> sendDeviceMessageResp = this.service.sendDeviceMessage(deviceEntity, info, header, JSON.toJSONString(obj), null);
log.info(String.format("sendMsgResp:%s", JSON.toJSONString(sendDeviceMessageResp)));
if (ApiRespCodeEnum.SUCCESS.getValue() != sendDeviceMessageResp.getCode()) {
throw new AppException("下发消息失败!");
}
// Thread.sleep(50);
//log.info(String.format("sendMsgResp:%s", JSON.toJSONString(sendDeviceMessageResp)));
} else {
throw new AppException("设备不存在!deviceId:" + deviceId);
}
// this.init(request, response, null, model, getContext());
recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
} catch (Exception e) {
log.error("下发设备消息", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return jsonObject.toJSONString();
}*/
/**
* 设备激活
*/
......
......@@ -77,7 +77,15 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si
if (result.getCode() == YesNoEnum.YES.getValue()) {
//根据返回的id 筛选列表
Map<Long, SitestatEntity> collectMap = this.find(new SitestatEntity()).stream().collect(Collectors.toMap(x -> x.getSiteId(), y -> y, (o, n) -> n));
List<SitestatEntity> list = result.getData().stream().filter(f -> collectMap.containsKey(f.getId())).map(m -> collectMap.get(m.getId())).collect(Collectors.toList());
List<SitestatEntity> list = result.getData().stream()
.filter(f -> collectMap.containsKey(f.getId()))
.map(m -> {
SitestatEntity sitestatEntity = collectMap.get(m.getId());
sitestatEntity.setLng(m.getLongitude());
sitestatEntity.setLat(m.getLatitude());
sitestatEntity.setAddress(m.getDetailAddress());
return sitestatEntity;
}).collect(Collectors.toList());
return list.stream();
}
return new ArrayList<SitestatEntity>().stream();
......
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