bug修复
This commit is contained in:
parent
b013d62f8d
commit
059fa27bb1
@ -10,9 +10,9 @@ import com.zhgd.xmgl.enums.ParamEnum;
|
|||||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatAlarm;
|
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatAlarm;
|
||||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData;
|
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData;
|
||||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatAlarmMapper;
|
|
||||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDataMapper;
|
|
||||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDevMapper;
|
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDevMapper;
|
||||||
|
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatAlarmService;
|
||||||
|
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDataService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public class SafetyHatWSClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入安全帽实时数据和报警数据
|
* 插入智能安全帽实时数据和报警数据
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
*/
|
*/
|
||||||
@ -81,7 +81,11 @@ public class SafetyHatWSClient {
|
|||||||
data.setLongitude(yPoint);
|
data.setLongitude(yPoint);
|
||||||
data.setUploadTime(new Date(ctime * 1000L));
|
data.setUploadTime(new Date(ctime * 1000L));
|
||||||
data.setProjectSn(dev.getProjectSn());
|
data.setProjectSn(dev.getProjectSn());
|
||||||
SpringContextUtils.getBean(SafetyHatDataMapper.class).insert(data);
|
try {
|
||||||
|
SpringContextUtils.getBean(ISafetyHatDataService.class).add(data);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,7 +115,11 @@ public class SafetyHatWSClient {
|
|||||||
alarm.setAlarmType(sosType);
|
alarm.setAlarmType(sosType);
|
||||||
alarm.setLatitude(yPoint);
|
alarm.setLatitude(yPoint);
|
||||||
alarm.setLongitude(xPoint);
|
alarm.setLongitude(xPoint);
|
||||||
SpringContextUtils.getBean(SafetyHatAlarmMapper.class).insert(alarm);
|
try {
|
||||||
|
SpringContextUtils.getBean(ISafetyHatAlarmService.class).add(alarm);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.zhgd.xmgl.modules.safetyhat.controller;
|
package com.zhgd.xmgl.modules.safetyhat.controller;
|
||||||
|
|
||||||
|
import com.gexin.fastjson.JSON;
|
||||||
import com.zhgd.xmgl.base.entity.vo.TrendVo;
|
import com.zhgd.xmgl.base.entity.vo.TrendVo;
|
||||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatAlarmService;
|
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatAlarmService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -75,6 +76,7 @@ public class SafetyHatAlarmController {
|
|||||||
@ApiOperation(value = "添加智能安全帽-报警信息", notes = "添加智能安全帽-报警信息", httpMethod = "POST")
|
@ApiOperation(value = "添加智能安全帽-报警信息", notes = "添加智能安全帽-报警信息", httpMethod = "POST")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<SafetyHatAlarm> add(@RequestBody @Validate SafetyHatAlarm safetyHatAlarm) {
|
public Result<SafetyHatAlarm> add(@RequestBody @Validate SafetyHatAlarm safetyHatAlarm) {
|
||||||
|
log.info("添加智能安全帽-报警信息:{}", JSON.toJSONString(safetyHatAlarm));
|
||||||
safetyHatAlarmService.add(safetyHatAlarm);
|
safetyHatAlarmService.add(safetyHatAlarm);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.zhgd.xmgl.modules.safetyhat.controller;
|
package com.zhgd.xmgl.modules.safetyhat.controller;
|
||||||
|
|
||||||
|
import com.gexin.fastjson.JSON;
|
||||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData;
|
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData;
|
||||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDataService;
|
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDataService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -74,7 +75,8 @@ public class SafetyHatDataController {
|
|||||||
@ApiOperation(value = "添加智能安全帽-实时数据信息", notes = "添加智能安全帽-实时数据信息", httpMethod = "POST")
|
@ApiOperation(value = "添加智能安全帽-实时数据信息", notes = "添加智能安全帽-实时数据信息", httpMethod = "POST")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<SafetyHatData> add(@RequestBody @Validate SafetyHatData safetyHatData) {
|
public Result<SafetyHatData> add(@RequestBody @Validate SafetyHatData safetyHatData) {
|
||||||
safetyHatDataService.add(safetyHatData);
|
log.info("列表查询智能安全帽-实时数据信息:{}", JSON.toJSONString(safetyHatData));
|
||||||
|
safetyHatDataService.add(safetyHatData);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package com.zhgd.xmgl.modules.safetyhat.service.impl;
|
package com.zhgd.xmgl.modules.safetyhat.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||||
import com.zhgd.xmgl.base.entity.vo.TrendVo;
|
import com.zhgd.xmgl.base.entity.vo.TrendVo;
|
||||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatAlarm;
|
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatAlarm;
|
||||||
|
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatAlarmMapper;
|
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatAlarmMapper;
|
||||||
|
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDevMapper;
|
||||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatAlarmService;
|
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatAlarmService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@ -31,6 +34,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
public class SafetyHatAlarmServiceImpl extends ServiceImpl<SafetyHatAlarmMapper, SafetyHatAlarm> implements ISafetyHatAlarmService {
|
public class SafetyHatAlarmServiceImpl extends ServiceImpl<SafetyHatAlarmMapper, SafetyHatAlarm> implements ISafetyHatAlarmService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SafetyHatAlarmMapper safetyHatAlarmMapper;
|
private SafetyHatAlarmMapper safetyHatAlarmMapper;
|
||||||
|
@Autowired
|
||||||
|
private SafetyHatDevMapper safetyHatDevMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<SafetyHatAlarm> queryPageList(HashMap<String, Object> paramMap) {
|
public IPage<SafetyHatAlarm> queryPageList(HashMap<String, Object> paramMap) {
|
||||||
@ -60,6 +65,13 @@ public class SafetyHatAlarmServiceImpl extends ServiceImpl<SafetyHatAlarmMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(SafetyHatAlarm safetyHatAlarm) {
|
public void add(SafetyHatAlarm safetyHatAlarm) {
|
||||||
|
SafetyHatDev dev = safetyHatDevMapper.selectOne(new LambdaQueryWrapper<SafetyHatDev>()
|
||||||
|
.eq(SafetyHatDev::getDevSn, safetyHatAlarm.getDevSn()));
|
||||||
|
if (dev == null) {
|
||||||
|
throw new OpenAlertException("设备编号不正确");
|
||||||
|
}
|
||||||
|
safetyHatAlarm.setWorkerInfoId(dev.getWorkerInfoId());
|
||||||
|
safetyHatAlarm.setProjectSn(dev.getProjectSn());
|
||||||
safetyHatAlarm.setId(null);
|
safetyHatAlarm.setId(null);
|
||||||
baseMapper.insert(safetyHatAlarm);
|
baseMapper.insert(safetyHatAlarm);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,24 +1,27 @@
|
|||||||
package com.zhgd.xmgl.modules.safetyhat.service.impl;
|
package com.zhgd.xmgl.modules.safetyhat.service.impl;
|
||||||
|
|
||||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData;
|
|
||||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDataMapper;
|
|
||||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDataService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
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.zhgd.jeecg.common.system.query.QueryGenerator;
|
|
||||||
import com.zhgd.xmgl.util.PageUtil;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||||
|
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData;
|
||||||
|
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||||
|
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDataMapper;
|
||||||
|
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDevMapper;
|
||||||
|
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDataService;
|
||||||
|
import com.zhgd.xmgl.util.PageUtil;
|
||||||
|
import com.zhgd.xmgl.util.RefUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.zhgd.xmgl.util.RefUtil;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 智能安全帽-实时数据
|
* @Description: 智能安全帽-实时数据
|
||||||
* @author: pds
|
* @author: pds
|
||||||
@ -30,6 +33,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
public class SafetyHatDataServiceImpl extends ServiceImpl<SafetyHatDataMapper, SafetyHatData> implements ISafetyHatDataService {
|
public class SafetyHatDataServiceImpl extends ServiceImpl<SafetyHatDataMapper, SafetyHatData> implements ISafetyHatDataService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SafetyHatDataMapper safetyHatDataMapper;
|
private SafetyHatDataMapper safetyHatDataMapper;
|
||||||
|
@Autowired
|
||||||
|
private SafetyHatDevMapper safetyHatDevMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<SafetyHatData> queryPageList(HashMap<String, Object> paramMap) {
|
public IPage<SafetyHatData> queryPageList(HashMap<String, Object> paramMap) {
|
||||||
@ -59,7 +64,19 @@ public class SafetyHatDataServiceImpl extends ServiceImpl<SafetyHatDataMapper, S
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(SafetyHatData safetyHatData) {
|
public void add(SafetyHatData safetyHatData) {
|
||||||
|
SafetyHatDev dev = safetyHatDevMapper.selectOne(new LambdaQueryWrapper<SafetyHatDev>()
|
||||||
|
.eq(SafetyHatDev::getDevSn, safetyHatData.getDevSn()));
|
||||||
|
if (dev == null) {
|
||||||
|
throw new OpenAlertException("设备编号不正确");
|
||||||
|
}
|
||||||
|
dev.setHeartbeatTime(new Date());
|
||||||
|
safetyHatDevMapper.update(dev, new LambdaQueryWrapper<SafetyHatDev>()
|
||||||
|
.eq(SafetyHatDev::getDevSn, safetyHatData.getDevSn()));
|
||||||
|
safetyHatData.setDevSn(dev.getDevSn());
|
||||||
|
safetyHatData.setProjectSn(dev.getProjectSn());
|
||||||
safetyHatData.setId(null);
|
safetyHatData.setId(null);
|
||||||
|
safetyHatData.setWorkerInfoId(dev.getWorkerInfoId());
|
||||||
|
safetyHatData.setUploadTime(new Date());
|
||||||
baseMapper.insert(safetyHatData);
|
baseMapper.insert(safetyHatData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -50,11 +50,11 @@ public class SafetyHatDayRecordServiceImpl extends ServiceImpl<SafetyHatDayRecor
|
|||||||
SafetyHatDev dev = safetyHatDevMapper.selectOne(new LambdaQueryWrapper<SafetyHatDev>()
|
SafetyHatDev dev = safetyHatDevMapper.selectOne(new LambdaQueryWrapper<SafetyHatDev>()
|
||||||
.eq(SafetyHatDev::getDevSn, safetyHatDayRecord.getDevSn()));
|
.eq(SafetyHatDev::getDevSn, safetyHatDayRecord.getDevSn()));
|
||||||
if (dev == null) {
|
if (dev == null) {
|
||||||
throw new OpenAlertException("设备不存在");
|
throw new OpenAlertException("设备编号不正确");
|
||||||
}
|
}
|
||||||
safetyHatDayRecord.setProjectSn(dev.getProjectSn());
|
safetyHatDayRecord.setProjectSn(dev.getProjectSn());
|
||||||
safetyHatDayRecord.setId(null);
|
safetyHatDayRecord.setId(null);
|
||||||
save(safetyHatDayRecord);
|
baseMapper.insert(safetyHatDayRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user