Merge branch 'master' of codeup.aliyun.com:6428039c708c83a3fd907211/hzwmiot/hzwmiot24_java

This commit is contained in:
wyw
2024-08-19 11:21:38 +08:00
12 changed files with 177 additions and 15 deletions

View File

@@ -13,6 +13,7 @@ import com.fastbee.common.exception.ServiceException;
import com.fastbee.common.utils.SecurityUtils;
import com.fastbee.common.utils.StringUtils;
import com.fastbee.common.utils.poi.ExcelUtil;
import com.fastbee.data.service.devicedetail.IDeviceDetailService;
import com.fastbee.iot.domain.Device;
import com.fastbee.iot.domain.JiankongDeviceParam;
import com.fastbee.iot.model.DeviceAssignmentVO;
@@ -52,7 +53,8 @@ import java.util.stream.Collectors;
public class DeviceController extends BaseController {
@Autowired
private IDeviceService deviceService;
@Autowired
private IDeviceDetailService deviceDetailService;
// @Lazy
@Autowired
private IMqttMessagePublish messagePublish;
@@ -165,6 +167,7 @@ public class DeviceController extends BaseController {
@ApiOperation("获取设备详情")
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
Device device = deviceService.selectDeviceByDeviceId(deviceId);
device.setDeviceDetailVo(deviceDetailService.getDetailInfo(device));
// 判断当前用户是否有设备分享权限 (设备所属机构管理员和设备所属用户有权限)
// LoginUser loginUser = getLoginUser();
// List<SysRole> roles = loginUser.getUser().getRoles();

View File

@@ -87,6 +87,7 @@ public class UploadedPhotosController extends BaseController {
@RequestParam("cpuTemp") Double cpuTemp,
@RequestParam("eventType") String eventType,
@RequestParam("doorState") String doorState,
@RequestParam("anFangStatus") String anFangStatus,
@RequestParam("time") String time) {
if (photo.isEmpty()) {
@@ -111,7 +112,8 @@ public class UploadedPhotosController extends BaseController {
//推送告警短信通知
uploadedPhotosService.sendAlarmMessage(sn, doorState, shakeState,eventType);
UploadedPhotos uploadedPhotos = new UploadedPhotos(
null, fileName, monitorPath, imei, sn, latitude, longitude, temperature, doorState, shakeState,cpuTemp,eventType, date
null, fileName, monitorPath, imei, sn, latitude, longitude,
temperature, doorState, shakeState,cpuTemp,eventType,anFangStatus, date
);
return toAjax(uploadedPhotosService.insertUploadedPhotos(uploadedPhotos));
} catch (IOException e) {
@@ -142,6 +144,7 @@ public class UploadedPhotosController extends BaseController {
@RequestParam("doorState") String doorState,
@RequestParam("cpuTemp") Double cpuTemp,
@RequestParam("eventType") String eventType,
@RequestParam("anFangStatus") String anFangStatus,
@RequestParam("time") String time) {
// 处理可能为空的字段
Double latitude = isEmpty(lat) ? 0.0 : Double.valueOf(lat);
@@ -156,7 +159,7 @@ public class UploadedPhotosController extends BaseController {
//推送告警短信通知
uploadedPhotosService.sendAlarmMessage(sn, doorState, shakeState,eventType);
UploadedPhotos uploadedPhotos = new UploadedPhotos(
null, "", monitorPath, imei, sn, latitude, longitude, temperature, doorState, shakeState,cpuTemp,eventType, date
null, "", monitorPath, imei, sn, latitude, longitude, temperature, doorState, shakeState,cpuTemp,eventType,anFangStatus, date
);
return toAjax(uploadedPhotosService.insertUploadedPhotos(uploadedPhotos));
}

View File

@@ -244,6 +244,12 @@ public class UploadedPhotosServiceImpl implements IUploadedPhotosService {
} else if (Integer.parseInt(eventType) == 3) {
temp.put("warnInfo", "箱门持续打开");
notify = true;
}else if(Integer.parseInt(eventType) == 4){
temp.put("warnInfo", "开启布放");
notify = true;
}else if(Integer.parseInt(eventType) == 5){
temp.put("warnInfo", "撤防");
notify = true;
}
if (notify) {
DeviceAlertUser deviceAlertUser = new DeviceAlertUser();
@@ -278,14 +284,25 @@ public class UploadedPhotosServiceImpl implements IUploadedPhotosService {
}
int doorState = 0;
int shakeState = 0;
int anFangStatus = 0;
int eventType = doorAlertBto.getEventType();
if (doorAlertBto.getEventType() > 0) {
if (doorAlertBto.getEventType() == 1) {
if (eventType == 1) {
shakeState = doorAlertBto.getEventType();
doorState = 0;
} else if (doorAlertBto.getEventType() >= 2) {
anFangStatus = 1;
} else if (eventType == 2 || eventType == 3) {
doorState = 1;
shakeState = 0;
anFangStatus = 1;
}else if(eventType == 4 ){
anFangStatus = 1;
doorState = 0;
shakeState = 0;
}else if(eventType == 5){
anFangStatus = 0;
doorState = 0;
shakeState = 0;
}
sendAlarmMessage(device.getSerialNumber(), doorState + "", shakeState + "", eventType + "");
}
@@ -295,7 +312,7 @@ public class UploadedPhotosServiceImpl implements IUploadedPhotosService {
null, "", monitorPath, "", device.getSerialNumber(),
device.getLatitude() != null ? device.getLatitude().doubleValue() : 0d,
device.getLongitude() != null ? device.getLatitude().doubleValue() : 0d,
18.23d, doorState + "", shakeState + "", 32.3, doorAlertBto.getEventType().toString(), new Date()
18.23d, doorState + "", shakeState + "", 32.3, doorAlertBto.getEventType().toString(),anFangStatus + "", new Date()
);
int count = insertUploadedPhotos(uploadedPhotos);
if (count > 0) {