Commit c34ea62e authored by liufan's avatar liufan

优化:设备列表,新增时异常情况的处理

parent 2edf0213
...@@ -51,6 +51,7 @@ import org.elasticsearch.index.query.QueryBuilders; ...@@ -51,6 +51,7 @@ import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
...@@ -158,7 +159,20 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -158,7 +159,20 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
checkEsData(record); checkEsData(record);
} }
} catch (Exception e) { } catch (Exception e) {
//删除Es数据 log.error(e.getMessage(), e);
//删除数据库数据和ES数据
if (!ObjectUtils.isEmpty(record)) {
List<String> records = new ArrayList<>();
records.add(record);
superviseInfoMapper.deleteDataAll(records);
esEquipmentCategory.deleteById(record);
}
ResponseModel<Object> response = new ResponseModel<>();
response.setDevMessage(e.getMessage());
response.setResult(null);
response.setMessage("操作失败,请检查数据输入后重新提交");
response.setStatus(HttpStatus.BAD_REQUEST.value());
return response;
} }
return ResponseHelper.buildResponse(record); return ResponseHelper.buildResponse(record);
} }
......
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