refactor(smartCamCarLicenseSnapshotData): 优化数据保存逻辑- 在 PojoProcessor 中增加对 ResponseEntity 类型的处理,避免不必要的操作

- 在 SmartCamCarLicenseSnapshotDataController 中添加 OrgScope 注解
- 在 SmartCamCarLicenseSnapshotDataService 中增加日志记录,便于调试和监控
This commit is contained in:
2025-02-18 20:42:25 +08:00
parent a1834ae92b
commit 1be710b8b5
3 changed files with 8 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;
@@ -100,6 +101,10 @@ public class PojoProcessor {
return;
}
if (pojo instanceof ResponseEntity<?>){
return;
}
if (pojo instanceof Iterable<?> it) {
it.forEach(this::collectActions);
return;

View File

@@ -62,6 +62,7 @@ public class SmartCamCarLicenseSnapshotDataController {
@RateLimit(value = false)
@SignCheck(value = false)
@SubmitToken(value = false)
@OrgScope(value = false)
@PostMapping("/saveEvent")
public ResponseEntity<String> saveEvent(@RequestBody String json) {
ObjectNode jsonNodes = this.service.saveEvent(json);

View File

@@ -106,6 +106,8 @@ public class SmartCamCarLicenseSnapshotDataService
@SneakyThrows
public ObjectNode saveEvent(String json) {
log.info("saveEvent {}", json);
JsonNode rootNode = objectMapper.readTree(json);
SmartCamCarLicenseSnapshotDataEntity entity = new SmartCamCarLicenseSnapshotDataEntity();