a6407388 张雷

孪生体增加镜头焦距,增加报警功能

1 个父辈 de1cbf78
......@@ -3,6 +3,7 @@ package com.skua.modules.business.controller;
import com.skua.core.api.vo.Result;
import com.skua.modules.business.service.IOlympicCenterService;
import com.skua.modules.business.service.ISynthesizeService;
import com.skua.modules.business.vo.AlarmParams;
import com.skua.modules.business.vo.EchartResult;
import com.skua.modules.business.vo.InputQueryParams;
import io.swagger.annotations.Api;
......@@ -226,4 +227,15 @@ public class OlympicCenterController {
return result;
}
@ApiOperation(value="获取实时报警信息", notes="获取实时报警信息")
@GetMapping(value = "/getAlarmList")
public Result<List<Map<String,Object>>> getAlarmList(AlarmParams alarmParams){
Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>();
List<Map<String,Object>> list = new ArrayList<>();
list = olympicCenterService.getAlarmList(alarmParams);
result.setResult(list);
result.setSuccess(true);
return result;
}
}
......
package com.skua.modules.business.service;
import com.skua.modules.business.vo.AlarmParams;
import com.skua.modules.business.vo.EchartResult;
import com.skua.modules.business.vo.InputQueryParams;
......@@ -44,4 +45,6 @@ public interface IOlympicCenterService {
Map<String, Object> getPumpOrFlowChart(InputQueryParams inputQueryParams);
List<EchartResult> getHistoryTrendsByDate(InputQueryParams inputQueryParams);
List<Map<String, Object>> getAlarmList(AlarmParams alarmParams);
}
......
package com.skua.modules.business.service.impl;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.service.IFactoryInfoService;
import com.skua.modules.business.entity.WhatStructData;
import com.skua.modules.business.mapper.WhatStructDataMapper;
import com.skua.modules.business.service.IOlympicCenterService;
import com.skua.modules.business.vo.AlarmParams;
import com.skua.modules.business.vo.EchartResult;
import com.skua.modules.business.vo.InputQueryParams;
import com.skua.modules.business.vo.TextResult;
import com.skua.modules.monitor.service.IFmPgQueryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
......@@ -1732,4 +1735,24 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
return Double.parseDouble(str);
}
@Override
public List<Map<String, Object>> getAlarmList(AlarmParams alarmParams) {
int minute = 1;
if(alarmParams.getMinute()!=0){
minute = alarmParams.getMinute();
}
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date now = new Date();
// System.out.println("当前时间为:" + dateFormat.format(now));
Date before = new Date(now.getTime() - minute * 60 * 1000);
// System.out.println("之前的时间为:" + dateFormat.format(before));
List<Map<String, Object>> list = new ArrayList<>();
JdbcTemplate alarmDB = (JdbcTemplate) SpringContextUtils.getBean("mysql-alarm");
list = alarmDB.queryForList("select alarm_content as alarmContent from alert_record_history " +
" where handle_status = 0 " +
" and record_time between '"+dateFormat.format(before)+"' and '"+dateFormat.format(now)+"' " +
" ORDER BY record_time");
return list;
}
}
......
package com.skua.modules.business.vo;
import lombok.Data;
@Data
public class AlarmParams {
private int minute;
}
......@@ -101,6 +101,7 @@ public class FmRoamServiceImpl implements IFmRoamService {
fmRoamPointVO.setRemark(fmRoamPoint.getRemark());
fmRoamPointVO.setPointLocation(pointLocation);
fmRoamPointVO.setPointRotate(pointRotate);
fmRoamPointVO.setCameraFieldOfView(fmRoamPoint.getCameraFieldOfView());
return fmRoamPointVO;
}
}
......
......@@ -81,4 +81,7 @@ public class FmTwinEquip {
@Excel(name = "删除标识", width = 15)
@ApiModelProperty(value = "删除标识")
private java.lang.String delFlag;
/**镜头焦距*/
@TableField(exist = false)
private java.lang.String cameraFieldOfView;
}
......
......@@ -24,4 +24,7 @@ public interface FmTwinManageMapper extends BaseMapper<FmTwinManage> {
List<FmTwinSqlResult> getListNoBound(@Param("projectId") String projectId,
@Param("twinType") String twinType,@Param("twinName") String twinName);
void editByTwinId(@Param("twinId") String twinId,@Param("projectId") String projectId,
@Param("cameraFieldOfView") String cameraFieldOfView);
}
......
......@@ -8,6 +8,7 @@
m.twin_name,
m.twin_type,
m.project_id,
m.camera_field_of_view,
e.equip_name,
e.equip_id,
e.equip_type,
......@@ -22,7 +23,16 @@
</select>
<select id="getOneEquipByTwinId" resultType="com.skua.modules.twin.entity.FmTwinEquip">
select * from fm_twin_equip where twin_id = #{twinId} and project_id = #{projectId} limit 1
SELECT
e.*,
m.camera_field_of_view
FROM
fm_twin_equip e
LEFT JOIN fm_twin_manage m ON m.twin_id = e.twin_id
WHERE
e.twin_id = #{twinId}
AND e.project_id = #{projectId}
LIMIT 1
</select>
</mapper>
\ No newline at end of file
......
......@@ -87,4 +87,9 @@
select * from fm_twin_manage where twin_id = #{twinId} and project_id = #{projectId} limit 1
</select>
<update id="editByTwinId">
update fm_twin_manage set camera_field_of_view = #{cameraFieldOfView}
where twin_id = #{twinId} and project_id = #{projectId}
</update>
</mapper>
\ No newline at end of file
......
......@@ -144,6 +144,7 @@ public class FmTwinServiceImpl implements IFmTwinService {
twinEquipResultVO.setTwinName(twinEquipSqlResult.getTwinName());
twinEquipResultVO.setTwinType(twinEquipSqlResult.getTwinType());
twinEquipResultVO.setProjectId(twinEquipSqlResult.getProjectId());
twinEquipResultVO.setCameraFieldOfView(twinEquipSqlResult.getCameraFieldOfView());
EquipEntity twinEquipEntity = new EquipEntity();
twinEquipEntity.setEquipId(twinEquipSqlResult.getEquipId());
twinEquipEntity.setEquipName(twinEquipSqlResult.getEquipName());
......@@ -180,6 +181,9 @@ public class FmTwinServiceImpl implements IFmTwinService {
}else{
count = fmTwinEquipMapper.insert(fmTwinEquip);
}
if(fmTwinEquip.getCameraFieldOfView()!=null){
fmTwinManageMapper.editByTwinId(fmTwinEquip.getTwinId(),fmTwinEquip.getProjectId(),fmTwinEquip.getCameraFieldOfView());
}
if(count == 1){
return true;
}else{
......
......@@ -24,6 +24,7 @@ public class FmTwinEquipSqlResult {
private String equipType;
/**设备音频*/
private String equipVoice;
/**镜头焦距*/
private String cameraFieldOfView;
}
......
......@@ -96,6 +96,11 @@ spring:
username: jk_test
password: Jk_test1211rw
driver-class-name: com.mysql.jdbc.Driver
mysql-alarm:
url: jdbc:mysql://47.104.99.86:3306/intelligent-devices?characterEncoding=UTF-8&useUnicode=true&useSSL=false
username: id_rw
password: s2eCvUEPO2Vk3U1w
driver-class-name: com.mysql.jdbc.Driver
# 多数据源配置
pg-db:
url: jdbc:postgresql://47.104.99.86:10086/postgres?useUnicode=true&characterEncoding=UTF8
......
......@@ -96,6 +96,11 @@ spring:
username: jk_test
password: Jk_test1211rw
driver-class-name: com.mysql.jdbc.Driver
mysql-alarm:
url: jdbc:mysql://47.104.99.86:3306/intelligent-devices?characterEncoding=UTF-8&useUnicode=true&useSSL=false
username: id_rw
password: s2eCvUEPO2Vk3U1w
driver-class-name: com.mysql.jdbc.Driver
# 多数据源配置
pg-db:
url: jdbc:postgresql://47.104.99.86:10086/postgres?useUnicode=true&characterEncoding=UTF8
......
......@@ -96,6 +96,11 @@ spring:
username: root
password: jkauto@123wh
driver-class-name: com.mysql.jdbc.Driver
mysql-alarm:
url: jdbc:mysql://192.168.21.6:13306/zhsw_modules?characterEncoding=UTF-8&useUnicode=true&useSSL=false
username: root
password: jkauto@123wh
driver-class-name: com.mysql.jdbc.Driver
# 多数据源配置
pg-db:
url: jdbc:postgresql://192.168.21.5:10086/postgres?useUnicode=true&characterEncoding=UTF8
......
......@@ -96,6 +96,11 @@ spring:
username: root
password: jkauto@123yw
driver-class-name: com.mysql.jdbc.Driver
mysql-alarm:
url: jdbc:mysql://10.0.210.112:13306/zhsw_modules?characterEncoding=UTF-8&useUnicode=true&useSSL=false
username: root
password: jkauto@123yw
driver-class-name: com.mysql.jdbc.Driver
# 多数据源配置
pg-db:
url: jdbc:postgresql://10.0.210.111:10086/postgres?useUnicode=true&characterEncoding=UTF8
......
spring:
profiles:
active: dev
active: prod
# 信息安全
security:
csrf:
......@@ -11,6 +11,6 @@ swagger:
production: false
basic:
#是否开启swagger登陆鉴权配置,true开启,false停止
enable: false
enable: true
username: admin
password: 1qaz@WS
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!