sonaer异味修改
This commit is contained in:
parent
dcebdcd9f5
commit
095e73d015
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.bonus.sgzb.common.core.constant.HttpStatus;
|
import com.bonus.sgzb.common.core.constant.HttpStatus;
|
||||||
import com.bonus.sgzb.common.core.constant.TokenConstants;
|
import com.bonus.sgzb.common.core.constant.TokenConstants;
|
||||||
|
import com.bonus.sgzb.common.core.exception.ServiceException;
|
||||||
import com.bonus.sgzb.common.core.utils.HttpHelper;
|
import com.bonus.sgzb.common.core.utils.HttpHelper;
|
||||||
import com.bonus.sgzb.common.core.utils.StringHelper;
|
import com.bonus.sgzb.common.core.utils.StringHelper;
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
|
|
@ -77,7 +78,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
int res = iotMachineMapper.add(iotDto);
|
int res = iotMachineMapper.add(iotDto);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
// 如果添加失败,返回保存到数据库异常的错误信息
|
// 如果添加失败,返回保存到数据库异常的错误信息
|
||||||
throw new RuntimeException(ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
throw new ServiceException(ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||||
} else {
|
} else {
|
||||||
// 添加成功,返回成功的消息和新增的记录数
|
// 添加成功,返回成功的消息和新增的记录数
|
||||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), res);
|
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), res);
|
||||||
|
|
@ -110,7 +111,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
int res = iotMachineMapper.update(iotDto);
|
int res = iotMachineMapper.update(iotDto);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
// 如果修改失败,返回修改到数据库异常的错误信息
|
// 如果修改失败,返回修改到数据库异常的错误信息
|
||||||
throw new RuntimeException(ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
|
throw new ServiceException(ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
|
||||||
} else {
|
} else {
|
||||||
// 修改成功,返回成功的消息和修改的记录数
|
// 修改成功,返回成功的消息和修改的记录数
|
||||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), res);
|
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), res);
|
||||||
|
|
@ -181,12 +182,12 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
//绑定设备
|
//绑定设备
|
||||||
res = iotMachineMapper.bind(iotDto);
|
res = iotMachineMapper.bind(iotDto);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
throw new RuntimeException(ExceptionEnum.BIND_TO_DATABASE.getMsg());
|
throw new ServiceException(ExceptionEnum.BIND_TO_DATABASE.getMsg());
|
||||||
}
|
}
|
||||||
//更新绑定状态
|
//更新绑定状态
|
||||||
res = iotMachineMapper.updateBindStatus(iotDto);
|
res = iotMachineMapper.updateBindStatus(iotDto);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
throw new RuntimeException(ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
|
throw new ServiceException(ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("设备绑定异常:{}", e.getMessage());
|
log.error("设备绑定异常:{}", e.getMessage());
|
||||||
|
|
@ -215,12 +216,12 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
//解绑设备
|
//解绑设备
|
||||||
res = iotMachineMapper.unbind(iotDto);
|
res = iotMachineMapper.unbind(iotDto);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
throw new RuntimeException(ExceptionEnum.UN_BIND_TO_DATABASE.getMsg());
|
throw new ServiceException(ExceptionEnum.UN_BIND_TO_DATABASE.getMsg());
|
||||||
}
|
}
|
||||||
//更新绑定状态
|
//更新绑定状态
|
||||||
res = iotMachineMapper.updateUnBindStatus(iotDto);
|
res = iotMachineMapper.updateUnBindStatus(iotDto);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
throw new RuntimeException(ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
|
throw new ServiceException(ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("设备解绑异常:{}", e.getMessage());
|
log.error("设备解绑异常:{}", e.getMessage());
|
||||||
|
|
@ -240,7 +241,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
@Override
|
@Override
|
||||||
public List<IotVo> getTypeList(IotDto iotDto) {
|
public List<IotVo> getTypeList(IotDto iotDto) {
|
||||||
if (iotDto == null || iotDto.getMaCode() == null) {
|
if (iotDto == null || iotDto.getMaCode() == null) {
|
||||||
throw new RuntimeException(ExceptionEnum.PARAM_NULL.getMsg());
|
throw new ServiceException(ExceptionEnum.PARAM_NULL.getMsg());
|
||||||
}
|
}
|
||||||
return iotMachineMapper.getTypeList(iotDto);
|
return iotMachineMapper.getTypeList(iotDto);
|
||||||
}
|
}
|
||||||
|
|
@ -273,7 +274,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
@Override
|
@Override
|
||||||
public List<IotRecordVo> getRecordList(IotDto iotDto) {
|
public List<IotRecordVo> getRecordList(IotDto iotDto) {
|
||||||
if (iotDto == null || iotDto.getIotId() == null) {
|
if (iotDto == null || iotDto.getIotId() == null) {
|
||||||
throw new RuntimeException(ExceptionEnum.PARAM_NULL.getMsg());
|
throw new ServiceException(ExceptionEnum.PARAM_NULL.getMsg());
|
||||||
}
|
}
|
||||||
return iotMachineMapper.getRecordList(iotDto);
|
return iotMachineMapper.getRecordList(iotDto);
|
||||||
}
|
}
|
||||||
|
|
@ -287,7 +288,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
public AjaxResult getLocation(IotDto iotDto) {
|
public AjaxResult getLocation(IotDto iotDto) {
|
||||||
log.info("getLocation:{}", iotDto);
|
log.info("getLocation:{}", iotDto);
|
||||||
if (iotDto == null || iotDto.getIotId() == null) {
|
if (iotDto == null || iotDto.getIotId() == null) {
|
||||||
throw new RuntimeException(ExceptionEnum.PARAM_NULL.getMsg());
|
throw new ServiceException(ExceptionEnum.PARAM_NULL.getMsg());
|
||||||
}
|
}
|
||||||
List<String> list=new ArrayList<>();
|
List<String> list=new ArrayList<>();
|
||||||
Map<String,Object> map=new HashMap<>();
|
Map<String,Object> map=new HashMap<>();
|
||||||
|
|
@ -305,7 +306,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
String res = HttpHelper.doPost(HttpStatus.LAST_POSITION_URL+redisCode,param);
|
String res = HttpHelper.doPost(HttpStatus.LAST_POSITION_URL+redisCode,param);
|
||||||
//对返回的结果进行解析
|
//对返回的结果进行解析
|
||||||
IotLocationVo iotLocationVo = resultDataHandler(res);
|
IotLocationVo iotLocationVo = resultDataHandler(res);
|
||||||
log.info("resultDataHandler:{}", iotLocationVo);
|
log.info("返回结果resultDataHandler:{}", iotLocationVo);
|
||||||
return AjaxResult.success(iotLocationVo);
|
return AjaxResult.success(iotLocationVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -318,7 +319,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
public AjaxResult searchItinerary(IotLocationVo iotLocationVo) {
|
public AjaxResult searchItinerary(IotLocationVo iotLocationVo) {
|
||||||
log.info("searchItinerary:{}", iotLocationVo);
|
log.info("searchItinerary:{}", iotLocationVo);
|
||||||
if (iotLocationVo == null || iotLocationVo.getBeginTime() == null || iotLocationVo.getEndTime() == null) {
|
if (iotLocationVo == null || iotLocationVo.getBeginTime() == null || iotLocationVo.getEndTime() == null) {
|
||||||
throw new RuntimeException(ExceptionEnum.PARAM_NULL.getMsg());
|
throw new ServiceException(ExceptionEnum.PARAM_NULL.getMsg());
|
||||||
}
|
}
|
||||||
Map<String,Object> map=new HashMap<>();
|
Map<String,Object> map=new HashMap<>();
|
||||||
//从redis中获取token
|
//从redis中获取token
|
||||||
|
|
@ -347,7 +348,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
|
|
||||||
log.info("reportParkDetailByTime:{}", iotLocationVo);
|
log.info("reportParkDetailByTime:{}", iotLocationVo);
|
||||||
if (iotLocationVo == null || iotLocationVo.getBeginTime() == null || iotLocationVo.getEndTime() == null) {
|
if (iotLocationVo == null || iotLocationVo.getBeginTime() == null || iotLocationVo.getEndTime() == null) {
|
||||||
throw new RuntimeException(ExceptionEnum.PARAM_NULL.getMsg());
|
throw new ServiceException(ExceptionEnum.PARAM_NULL.getMsg());
|
||||||
}
|
}
|
||||||
Map<String,Object> map=new HashMap<>();
|
Map<String,Object> map=new HashMap<>();
|
||||||
//从redis中获取token
|
//从redis中获取token
|
||||||
|
|
@ -376,7 +377,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
*/
|
*/
|
||||||
private List<IotLocationVo> resultReportParkDetailByTime(String res) {
|
private List<IotLocationVo> resultReportParkDetailByTime(String res) {
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
throw new RuntimeException(ExceptionEnum.RETURN_DATA_IS_EMPTY.getMsg());
|
throw new ServiceException(ExceptionEnum.RETURN_DATA_IS_EMPTY.getMsg());
|
||||||
}
|
}
|
||||||
List<IotLocationVo> iotLocationVoList = new ArrayList<>();
|
List<IotLocationVo> iotLocationVoList = new ArrayList<>();
|
||||||
JSONObject object = JSONObject.parseObject(res);
|
JSONObject object = JSONObject.parseObject(res);
|
||||||
|
|
@ -424,12 +425,12 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
//绑定设备
|
//绑定设备
|
||||||
res = iotMachineMapper.bind(iotDto);
|
res = iotMachineMapper.bind(iotDto);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
throw new RuntimeException(ExceptionEnum.BIND_TO_DATABASE.getMsg());
|
throw new ServiceException(ExceptionEnum.BIND_TO_DATABASE.getMsg());
|
||||||
}
|
}
|
||||||
//更新绑定状态
|
//更新绑定状态
|
||||||
res = iotMachineMapper.updateBindStatus(iotDto);
|
res = iotMachineMapper.updateBindStatus(iotDto);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
throw new RuntimeException(ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
|
throw new ServiceException(ExceptionEnum.UPDATE_TO_DATABASE.getMsg());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("设备绑定异常:{}", e.getMessage());
|
log.error("设备绑定异常:{}", e.getMessage());
|
||||||
|
|
@ -449,7 +450,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
public AjaxResult reportAlarm(IotLocationVo iotLocationVo) {
|
public AjaxResult reportAlarm(IotLocationVo iotLocationVo) {
|
||||||
log.info("reportAlarm:{}", iotLocationVo);
|
log.info("reportAlarm:{}", iotLocationVo);
|
||||||
if (iotLocationVo == null || iotLocationVo.getIotId() == null || iotLocationVo.getBeginTime() == null || iotLocationVo.getEndTime() == null) {
|
if (iotLocationVo == null || iotLocationVo.getIotId() == null || iotLocationVo.getBeginTime() == null || iotLocationVo.getEndTime() == null) {
|
||||||
throw new RuntimeException(ExceptionEnum.PARAM_NULL.getMsg());
|
throw new ServiceException(ExceptionEnum.PARAM_NULL.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String,Object> map=new HashMap<>();
|
Map<String,Object> map=new HashMap<>();
|
||||||
|
|
@ -483,7 +484,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
*/
|
*/
|
||||||
private List<IotLocationVo> resultReportAlarm(String res) {
|
private List<IotLocationVo> resultReportAlarm(String res) {
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
throw new RuntimeException(ExceptionEnum.RETURN_DATA_IS_EMPTY.getMsg());
|
throw new ServiceException(ExceptionEnum.RETURN_DATA_IS_EMPTY.getMsg());
|
||||||
}
|
}
|
||||||
List<IotLocationVo> iotLocationVoList = new ArrayList<>();
|
List<IotLocationVo> iotLocationVoList = new ArrayList<>();
|
||||||
JSONObject object = JSONObject.parseObject(res);
|
JSONObject object = JSONObject.parseObject(res);
|
||||||
|
|
@ -514,7 +515,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
*/
|
*/
|
||||||
private IotLocationVo resultDataHandler(String res) {
|
private IotLocationVo resultDataHandler(String res) {
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
throw new RuntimeException(ExceptionEnum.RETURN_DATA_IS_EMPTY.getMsg());
|
throw new ServiceException(ExceptionEnum.RETURN_DATA_IS_EMPTY.getMsg());
|
||||||
}
|
}
|
||||||
IotLocationVo iotLocationVo = new IotLocationVo();
|
IotLocationVo iotLocationVo = new IotLocationVo();
|
||||||
JSONObject object = JSONObject.parseObject(res);
|
JSONObject object = JSONObject.parseObject(res);
|
||||||
|
|
@ -535,9 +536,4 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
}
|
}
|
||||||
return iotLocationVo;
|
return iotLocationVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue