Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ public String dataSyncToServer(@RequestBody String requestOBJ,
@PostMapping(value = { "/diagnostic-documents-to-server" })
public String diagnosticDocumentsToServer(@RequestHeader(value = "Authorization") String authorization,
@RequestHeader(value = "ServerAuthorization") String serverAuthorization,
@RequestParam Long villageId) {
@RequestParam(required = false) Long villageId) {
OutputResponse response = new OutputResponse();
try {
String s = diagnosticDocumentPushServiceImpl.pushPendingDocuments(serverAuthorization, villageId);
String s = diagnosticDocumentPushServiceImpl.pushPendingDocuments(serverAuthorization);
if (s != null)
response.setResponse(s);
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,21 @@
String sha256Hash = (String) item.get("sha256Hash");
if (sha256Hash != null && !sha256Hash.equalsIgnoreCase(sha256Hex(plaintext))) {
ack.put("status", "FAILED");
ack.put("error", "sha256 mismatch on receipt");

Check failure on line 78 in src/main/java/com/iemr/mmu/service/dataSyncLayerCentral/DiagnosticDocumentIngestService.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "error" 3 times.

See more on https://sonarcloud.io/project/issues?id=PSMRI_MMU-API&issues=AaEQS9OK3ymrGPBJln7q&open=AaEQS9OK3ymrGPBJln7q&pullRequest=197
return ack;
}

Long beneficiaryId = asLong(item.get("beneficiaryId"));
Long villageId = asLong(item.get("villageId"));
Long vanId = asLong(item.get("vanID"));
String orderType = (String) item.get("orderType");
String storedFileName = (String) item.get("storedFileName");
if (villageId == null || beneficiaryId == null || orderType == null || documentType == null
if (vanId == null || beneficiaryId == null || orderType == null || documentType == null
|| storedFileName == null) {
ack.put("status", "FAILED");
ack.put("error", "Missing villageId, beneficiaryId, orderType, documentType or storedFileName");
ack.put("error", "Missing vanID, beneficiaryId, orderType, documentType or storedFileName");
return ack;
}
String s3Key = villageId + "/" + beneficiaryId + "/" + orderType + "/" + documentType + "/"
String s3Key = vanId + "/" + beneficiaryId + "/" + orderType + "/" + documentType + "/"
+ storedFileName;
String contentType = (String) item.get("contentType");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
@Autowired
private CryptoUtil cryptoUtil;

public String pushPendingDocuments(String Authorization, Long villageId) throws Exception {
public String pushPendingDocuments(String Authorization) throws Exception {

Check failure on line 69 in src/main/java/com/iemr/mmu/service/dataSyncLayerCentral/DiagnosticDocumentPushServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this method to reduce its Cognitive Complexity from 45 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=PSMRI_MMU-API&issues=AaEQS9Jh3ymrGPBJln7p&open=AaEQS9Jh3ymrGPBJln7p&pullRequest=197

Check warning on line 69 in src/main/java/com/iemr/mmu/service/dataSyncLayerCentral/DiagnosticDocumentPushServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.

See more on https://sonarcloud.io/project/issues?id=PSMRI_MMU-API&issues=AaEQS9Jh3ymrGPBJln7n&open=AaEQS9Jh3ymrGPBJln7n&pullRequest=197

Check warning on line 69 in src/main/java/com/iemr/mmu/service/dataSyncLayerCentral/DiagnosticDocumentPushServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace generic exceptions with specific library exceptions or a custom exception.

See more on https://sonarcloud.io/project/issues?id=PSMRI_MMU-API&issues=AaEQS9Jh3ymrGPBJln7o&open=AaEQS9Jh3ymrGPBJln7o&pullRequest=197
List<Map<String, Object>> pendingRows = diagnosticDocumentRepository.findPendingDocuments();
boolean anyRowsFound = !pendingRows.isEmpty();
int totalAttempted = 0;
Expand Down Expand Up @@ -118,7 +118,6 @@
item.put("vanID", row.get("vanID"));
item.put("parkingPlaceID", row.get("parkingPlaceID"));
item.put("vanSerialNo", row.get("vanSerialNo"));
item.put("villageId", villageId);
item.put("fileContentBase64", base64Plaintext);
payloadItems.add(item);
rowsById.put(rowId, row);
Expand Down
Loading