Commit c613c756 authored by ma's avatar ma

修改错误上报处理接口

parent 9fd060ef
...@@ -63,31 +63,23 @@ public class TerminalDeviceServiceImpl implements TerminalDeviceService { ...@@ -63,31 +63,23 @@ public class TerminalDeviceServiceImpl implements TerminalDeviceService {
if (reportErrorMsgDTOs == null || reportErrorMsgDTOs.size() == 0) { if (reportErrorMsgDTOs == null || reportErrorMsgDTOs.size() == 0) {
return BaseResult.validate_failed(); return BaseResult.validate_failed();
} }
reportErrorMsgDTOs.sort(Comparator.comparingInt(ReportErrorMsgDTO::getId)); for (ReportErrorMsgDTO reportErrorMsgDTO : reportErrorMsgDTOs) {
for (int i = 0; i < reportErrorMsgDTOs.size() - 1; i++) {
ReportErrorMsgDTO reportErrorMsgDTO = reportErrorMsgDTOs.get(i);
Integer id = reportErrorMsgDTO.getId(); Integer id = reportErrorMsgDTO.getId();
if (id == null || id == 0) { if (id == null || id == 0 || reportErrorMsgDTO.getErrorCode() == null) {
return BaseResult.validate_failed(); return BaseResult.validate_failed();
} }
pmsUseService.deletePmsUseLogById(id);
}
ReportErrorMsgDTO reportErrorMsgDTO = reportErrorMsgDTOs.get(reportErrorMsgDTOs.size() - 1);
if (reportErrorMsgDTO.getId() == null || reportErrorMsgDTO.getId() == 0 || reportErrorMsgDTO.getErrorCode() == null) {
return BaseResult.validate_failed();
} else {
if ("0".equals(reportErrorMsgDTO.getErrorCode())) { if ("0".equals(reportErrorMsgDTO.getErrorCode())) {
pmsUseService.success(reportErrorMsgDTO.getId()); pmsUseService.success(reportErrorMsgDTO.getId());
return BaseResult.success(); } else if ("-1".equals(reportErrorMsgDTO.getErrorCode())) {
pmsUseService.deletePmsUseLogById(id);
} else { } else {
boolean res = pmsUseService.reportErrorMsg(reportErrorMsgDTO); boolean res = pmsUseService.reportErrorMsg(reportErrorMsgDTO);
if (res) { if (!res) {
return BaseResult.success();
} else {
return BaseResult.failed(); return BaseResult.failed();
} }
} }
} }
return BaseResult.success();
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment