宣城导入错误问题和redis切换主从监听失效问题处理
parent
3fd5bc2f17
commit
fe00bd7311
|
|
@ -169,7 +169,7 @@ public class GpsServiceImpl implements IGpsService {
|
|||
|
||||
@Override
|
||||
public R updateOnlineStatusBatch(List<EsGpsInfoVO2> list) {
|
||||
logger.error("下线设备数量={}",list.size());
|
||||
logger.error("记录仪状态修改设备数量={}",list.size());
|
||||
int num = 0;
|
||||
for (EsGpsInfo originEsGpsInfo : list) {
|
||||
String deviceCode = originEsGpsInfo.getDeviceCode();
|
||||
|
|
@ -177,8 +177,14 @@ public class GpsServiceImpl implements IGpsService {
|
|||
// DeviceEntityV2 de = deviceService.checkDeviceExists(info);
|
||||
JSONObject o = RedisUtils.getBucket(RedisConstants.ONLINE_USERS + deviceType+":" + deviceCode);
|
||||
if (Objects.isNull(o)) {
|
||||
logger.error("redis中的Object=null,deviceType={},deviceCode={}",deviceType,deviceCode);
|
||||
continue;
|
||||
|
||||
if ("5".equals(deviceType) || "7".equals(deviceType) || "8".equals(deviceType)){
|
||||
logger.error("记录仪设备不在online_users中,deviceCode={},deviceType={}",deviceCode,deviceType);
|
||||
o = JSONUtil.parseObj(originEsGpsInfo);
|
||||
}else {
|
||||
logger.error("redis中的Object=null,deviceType={},deviceCode={}",deviceType,deviceCode);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
EsGpsInfoVO2 esGpsInfoVO2 = JSONUtil.toBean(o, EsGpsInfoVO2.class);
|
||||
//更新在线状态和时间,经纬度不变
|
||||
|
|
@ -204,6 +210,7 @@ public class GpsServiceImpl implements IGpsService {
|
|||
num++;
|
||||
// storeDataService.saveDataByPersonType(esGpsInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
num--;
|
||||
logger.error(e.getMessage());
|
||||
// return response.error(500,e.getMessage());
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class TDeviceExportVo implements Serializable {
|
|||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
@ExcelProperty(value = "设备类型")
|
||||
@ExcelProperty(value = "设备类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "zd_device_type")
|
||||
private String deviceType;
|
||||
|
||||
|
|
@ -41,28 +41,28 @@ public class TDeviceExportVo implements Serializable {
|
|||
/**
|
||||
* 警号(若有)
|
||||
*/
|
||||
@ExcelProperty(value = "警号", converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "警号")
|
||||
private String policeNo;
|
||||
|
||||
/**
|
||||
* 姓名(若有)
|
||||
*/
|
||||
@ExcelProperty(value = "警员姓名", converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "警员姓名")
|
||||
private String policeName;
|
||||
|
||||
/**
|
||||
* 联系电话(若有)
|
||||
*/
|
||||
@ExcelProperty(value = "电话号码", converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "电话号码")
|
||||
private String phoneNum;
|
||||
|
||||
/**
|
||||
* 车牌号(若有)
|
||||
*/
|
||||
@ExcelProperty(value = "车牌号", converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "车牌号")
|
||||
private String carNum;
|
||||
|
||||
@ExcelProperty(value = "证件号码", converter = ExcelDictConvert.class)
|
||||
@ExcelProperty(value = "证件号码")
|
||||
private String cardNum;
|
||||
|
||||
@ExcelProperty(value = "设备名称")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.dromara.system.listener;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
|
|
@ -15,6 +16,7 @@ import org.dromara.common.core.utils.ValidatorUtils;
|
|||
import org.dromara.common.excel.core.ExcelListener;
|
||||
import org.dromara.common.excel.core.ExcelResult;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.system.domain.TDevice;
|
||||
import org.dromara.system.domain.bo.TDeviceBo;
|
||||
import org.dromara.system.domain.vo.SysDeptVo;
|
||||
import org.dromara.system.domain.vo.TDeviceImportVo;
|
||||
|
|
@ -22,6 +24,7 @@ import org.dromara.system.domain.vo.TDeviceVo;
|
|||
import org.dromara.system.service.ISysDeptService;
|
||||
import org.dromara.system.service.ITDeviceService;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
|
|
@ -53,7 +56,7 @@ public class TDeviceImportListener extends AnalysisEventListener<TDeviceImportVo
|
|||
failureMsg.append("请删除Excel中提示必须删除的行后重新导入!");
|
||||
}else {
|
||||
String deviceCode = deviceImportVo.getDeviceCode().replaceAll("[\\p{Zs}\\s]", "");
|
||||
TDeviceVo deviceVo = this.deviceService.queryByDeviceCode(deviceCode);
|
||||
TDevice deviceVo = this.deviceService.queryByDeviceCode(deviceCode);
|
||||
try {
|
||||
// 验证是否存在这个设备
|
||||
if (ObjectUtil.isNull(deviceVo)) {
|
||||
|
|
@ -64,6 +67,8 @@ public class TDeviceImportListener extends AnalysisEventListener<TDeviceImportVo
|
|||
}
|
||||
TDeviceBo deviceBo = BeanUtil.toBean(deviceImportVo, TDeviceBo.class);
|
||||
ValidatorUtils.validate(deviceBo);
|
||||
deviceBo.setCreateTime(new Date());
|
||||
deviceBo.setUpdateTime(new Date());
|
||||
deviceService.insertByBo(deviceBo);
|
||||
successNum++;
|
||||
successMsg.append("<br/>").append(successNum).append("、设备 ").append(deviceBo.getDeviceCode()).append(" 导入成功");
|
||||
|
|
@ -71,11 +76,12 @@ public class TDeviceImportListener extends AnalysisEventListener<TDeviceImportVo
|
|||
Long id = deviceVo.getId();
|
||||
SysDeptVo deptVo = deptService.selectDeptById(deviceVo.getZzjgdm());
|
||||
if(null != deptVo){
|
||||
deviceVo.setZzjgmc(deptVo.getShortName());
|
||||
deviceImportVo.setZzjgmc(deptVo.getShortName());
|
||||
}
|
||||
TDeviceBo deviceBo = BeanUtil.toBean(deviceVo, TDeviceBo.class);
|
||||
TDeviceBo deviceBo = BeanUtil.toBean(deviceImportVo, TDeviceBo.class);
|
||||
deviceBo.setId(id);
|
||||
ValidatorUtils.validate(deviceBo);
|
||||
deviceBo.setUpdateTime(new Date());
|
||||
deviceService.updateByBo(deviceBo);
|
||||
successNum++;
|
||||
successMsg.append("<br/>").append(successNum).append("、设备 ").append(deviceImportVo.getDeviceCode()).append(" 更新成功");
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public interface ITDeviceService {
|
|||
|
||||
R saveDeviceToSt(String infoSource,List<TDevice> list);
|
||||
|
||||
TDeviceVo queryByDeviceCode(String deviceCode);
|
||||
TDevice queryByDeviceCode(String deviceCode);
|
||||
|
||||
List<TDeviceExportVo> selectDeviceExportList(TDeviceBo bo);
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class TDeviceServiceImpl implements ITDeviceService {
|
|||
// bo.setValid(1);
|
||||
LambdaQueryWrapper<TDevice> lqw = buildQueryWrapper(bo);
|
||||
Page<TDeviceVo> result = baseMapper.selectPageDevicetList(pageQuery.build(), lqw);
|
||||
List<TDeviceVo> list = result.getRecords();
|
||||
// List<TDeviceVo> list = result.getRecords();
|
||||
/*for (TDeviceVo vo : list) {
|
||||
if ("".equals(vo.getPoliceName()) || null == vo.getPoliceName()){
|
||||
vo.setDeviceName(vo.getCarNum());
|
||||
|
|
@ -410,10 +410,11 @@ public class TDeviceServiceImpl implements ITDeviceService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TDeviceVo queryByDeviceCode(String deviceCode) {
|
||||
public TDevice queryByDeviceCode(String deviceCode) {
|
||||
QueryWrapper<TDevice> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("device_code", deviceCode);
|
||||
TDeviceVo vo = baseMapper.selectVoOne(queryWrapper);
|
||||
queryWrapper.last("order by update_time desc limit 1");
|
||||
TDevice vo = baseMapper.selectOne(queryWrapper);
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
device_type = VALUES(device_type),
|
||||
online = VALUES(online),
|
||||
zzjgdm = VALUES(zzjgdm)
|
||||
</insert>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
</select>
|
||||
|
||||
<select id="selectPageDevicetList" resultMap="DevicetResult">
|
||||
select u.id,u.device_code, u.device_type, u.zzjgdm, u.zzjgmc, u.police_no, u.police_name, u.phone_num, u.car_num, u.valid,
|
||||
select u.id,u.device_code, u.device_type, u.zzjgdm, u.zzjgmc, u.police_no, u.police_name, u.phone_num, u.car_num,u.device_name, u.valid,
|
||||
u.remark1, u.remark2, u.card_num, u.create_time, u.update_time
|
||||
from t_device u
|
||||
${ew.getCustomSqlSegment}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,9 @@ public class DeviceStatusSchedule {
|
|||
}else {
|
||||
info.setDeviceType("5");
|
||||
}
|
||||
info.setLat(originDevice.getLatitude()+""); //解决记录仪设备在线 但对接的时候已经没有坐标回传问题
|
||||
info.setLng(originDevice.getLongitude()+""); //
|
||||
info.setGpsTime(originDevice.getUpdateTime());
|
||||
info.setOnline(originDevice.getAlive());
|
||||
Timestamp updateTime = originDevice.getUpdateTime();
|
||||
list.add(info);
|
||||
|
|
|
|||
Loading…
Reference in New Issue