Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
58a737a
feat(stoptb): store camp vanID in Redis on MMU user van selection
vishwab1 Jun 4, 2026
6cdc2a1
feat(stoptb): add Stop TB tables to VALID_TABLES whitelist for centra…
vishwab1 Jun 10, 2026
def92de
feat(stoptb): add tb_stoptb_general_examination and tb_stoptb_general…
vishwab1 Jun 10, 2026
dc85df1
fix(datasync): send central JWT as Jwttoken header instead of Authori…
vishwab1 Jun 10, 2026
f770cac
fix(datasync): skip JWT validation for dataSync endpoints to resolve 401
vishwab1 Jun 11, 2026
b5aa4dc
fix(datasync): remove PreAuthorize from datasync controller
vishwab1 Jun 11, 2026
b595355
fix(datasync): fix case-insensitive VanID lookup to prevent duplicate…
vishwab1 Jun 11, 2026
a6c4188
fix(datasync): send plain array to Identity-API for BenGenID import
vishwab1 Jun 30, 2026
0e45d64
fix(datasync): inject vanID into each BenGenID record before sending …
vishwab1 Jun 30, 2026
f1b4731
fix(datasync): add tb_stoptb_visit and i_householddetails to VALID_TA…
vishwab1 Jul 23, 2026
3e31aaa
Merge release-3.8.2 into vb/stoptb to catch up before raising PR
vishwab1 Jul 23, 2026
09895e1
Merge pull request #172 from PSMRI/vb/stoptb
vishwab1 Jul 23, 2026
b52c0e0
fix(datasync): add missing Stop TB diagnostic/beneficiary tables to V…
vishwab1 Aug 7, 2026
01533a8
Merge pull request #174 from PSMRI/vb/release-3.8.2-van
vishwab1 Aug 7, 2026
aa76532
fix(datasync): add Dynamic Form response tables to VALID_TABLES
vishwab1 Aug 7, 2026
6e70273
Merge pull request #175 from PSMRI/vb/release-3.8.2-van
snehar-nd Aug 7, 2026
32990b0
chore(stoptb): remove camp:vanID/parkingPlaceID Redis write on MMU login
vishwab1 Aug 9, 2026
83b6c86
Merge pull request #176 from PSMRI/vb/release-3.8.2-van-env-fix
SauravBizbRolly Aug 9, 2026
8597bba
fix: add the endpoints and schema for downsync from central to local
vanitha1822 Aug 20, 2026
9815769
fix: downsync implementation
vanitha1822 Aug 24, 2026
1090c4b
fix: build issue
vanitha1822 Aug 24, 2026
eaf2edd
fix: lastmoddate updation
vanitha1822 Aug 25, 2026
40686bd
fix: update the response of downsync
vanitha1822 Aug 27, 2026
c8c5cb7
fix: update the continuous call on check sync progress
vanitha1822 Aug 27, 2026
2f35483
fix: column name issue for stoptb tables
vanitha1822 Aug 27, 2026
7b2213b
fix: issue in stoptb tables
vanitha1822 Aug 27, 2026
a9e7768
fix: add central id
vanitha1822 Sep 1, 2026
c01a97b
fix: FK Mapping issue
vanitha1822 Sep 1, 2026
6dfae61
fix: downsync issue
vanitha1822 Sep 1, 2026
9e25ef6
fix: FK issue in i_ beneficiarymapping table
vanitha1822 Sep 1, 2026
8988062
fix: include U for downsync again
vanitha1822 Sep 1, 2026
7c68c8b
fix: revert central id for m_beneficiaryregidmapping
vanitha1822 Sep 1, 2026
822a04d
fix: conflict section
vanitha1822 Sep 1, 2026
f983c85
fix: manage conflicts and add F flag for resync
vanitha1822 Sep 1, 2026
21c488c
fix: pom version update
vanitha1822 Sep 2, 2026
944f6f7
fix: add the condition to block the download from different van
vanitha1822 Sep 2, 2026
fd55819
fix: resolve foreign key violation
vanitha1822 Sep 2, 2026
4215eb8
fix: retry failed records
vanitha1822 Sep 2, 2026
0924990
fix: update 'F' flag
vanitha1822 Sep 2, 2026
0f6837b
fix: sonarqube comments
vanitha1822 Sep 4, 2026
f3b9f56
Merge remote-tracking branch 'origin/release-3.9.0' into nd/vs/stoptb…
vanitha1822 Sep 4, 2026
b7005a3
fix: resolve sonarcube comments
vanitha1822 Sep 4, 2026
ab87e18
fix: issue in m_beneficiaryregidmapping table
vanitha1822 Sep 9, 2026
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
9 changes: 9 additions & 0 deletions src/main/environment/common_ci.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ dataSyncTransactionDownloadUrl=@env.MMU_CENTRAL_SERVER@dataSync/server-to-van-tr
## inventory transaction processed flag update URL, central, mmu
dataSyncProcessedFlagUpdate=@env.MMU_CENTRAL_SERVER@dataSync/updateProcessedFlagPostDownload

## down-sync (central -> local) data API, central, mmu
downSyncDataUrl=@env.MMU_CENTRAL_SERVER@dataSync/server-to-van-downsync

## down-sync (central -> local) flag update API, central, mmu
downSyncFlagUpdateUrl=@env.MMU_CENTRAL_SERVER@dataSync/updateDownSyncFlagPostDownload

## mark an up-synced record as already delivered to the van (central only)
downSync.markDeliveredOnUpSync=true


fileBasePath =@env.MMU_FILE_BASE_PATH@

Expand Down
181 changes: 95 additions & 86 deletions src/main/environment/common_docker.properties
Original file line number Diff line number Diff line change
@@ -1,87 +1,96 @@
# local env
# DB Connections
spring.datasource.url=${DATABASE_URL}
spring.datasource.username=${DATABASE_USERNAME}
spring.datasource.password=${DATABASE_PASSWORD}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

## Carestream URLs, local
carestreamOrderCreateURL=${COMMON_API}carestream/createOrder

## Identity - Common URLs
# Registration
registrationUrl =${COMMON_API}beneficiary/createBeneficiary

registrarQuickSearchByIdUrl =${COMMON_API}beneficiary/searchUserByID

registrarQuickSearchByPhoneNoUrl =${COMMON_API}beneficiary/searchUserByPhone

getBenImageFromIdentity =${IDENTITY_API_BASE_URL}id/benImageByBenRegID

beneficiaryEditUrl =${COMMON_API}beneficiary/updateBenefciaryDetails

registrarAdvanceSearchUrl =${COMMON_API}beneficiary/searchBeneficiary

## Data Sync API, central
dataSyncUploadUrl=${MMU_CENTRAL_SERVER}dataSync/van-to-server

## Data download API, central
dataSyncDownloadUrl=${MMU_CENTRAL_SERVER}dataSync/server-to-van

## TC specialist slot booking, # not required
tcSpecialistSlotBook=${TM_API}schedule/bookSlot

## TC specialist slot cancelling, # not required
tcSpecialistSlotCancel=${TM_API}schedule/cancelBookedSlot

## benGenUrl, common, central
benGenUrlCentral=${COMMON_API_OPEN_SYNC}beneficiary/generateBeneficiaryIDs

## benImportUrl, identity, local
benImportUrlLocal=${IDENTITY_API_BASE_URL}id/saveGeneratedBenIDToLocalServer
mmucentralserver = ${MMU_CENTRAL_SERVER}common/get/Case-sheet/centralServerTMCaseSheet

tmCentralServer = ${TM_CENTRAL_SERVER}common/get/Case-sheet/printData

specialistSign=${COMMON_API}signature1/getSignClass

## inventory transaction download URL, central, mmu
dataSyncTransactionDownloadUrl=${MMU_CENTRAL_SERVER}dataSync/server-to-van-transactional

## inventory transaction processed flag update URL, central, mmu
dataSyncProcessedFlagUpdate=${MMU_CENTRAL_SERVER}dataSync/updateProcessedFlagPostDownload


fileBasePath =${MMU_FILE_BASE_PATH}

## data sync batch size
BATCH_SIZE=30
snomedCTPageSize=10
nurseWL=7
docWL=7
pharmaWL=7
labWL=7
radioWL=7
oncoWL=7

## For File Sync
serverIP=${FILE_SYNC_SERVER_IP}
serverDomain=${FILE_SYNC_SERVER_DOMAIN}
serverUserName=${FILE_SYNC_SERVER_USERNAME}
serverPassword=${FILE_SYNC_SERVER_PASSWORD}
localFolderToSync=${LOCAL_FOLDER_TO_SYNC}
serverFolder=MMUSync
getServerCredentialURL=${MMU_API}fileSyncController/getServerCredential
tmReferCheckValue=TM
### Redis IP
spring.redis.host=${REDIS_HOST}

jwt.secret=${JWT_SECRET_KEY}


#ELK logging file name
logging.path=logs
logging.file.name=${MMU_API_LOGGING_FILE_NAME}

springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED}
# local env
# DB Connections
spring.datasource.url=${DATABASE_URL}
spring.datasource.username=${DATABASE_USERNAME}
spring.datasource.password=${DATABASE_PASSWORD}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

## Carestream URLs, local
carestreamOrderCreateURL=${COMMON_API}carestream/createOrder

## Identity - Common URLs
# Registration
registrationUrl =${COMMON_API}beneficiary/createBeneficiary

registrarQuickSearchByIdUrl =${COMMON_API}beneficiary/searchUserByID

registrarQuickSearchByPhoneNoUrl =${COMMON_API}beneficiary/searchUserByPhone

getBenImageFromIdentity =${IDENTITY_API_BASE_URL}id/benImageByBenRegID

beneficiaryEditUrl =${COMMON_API}beneficiary/updateBenefciaryDetails

registrarAdvanceSearchUrl =${COMMON_API}beneficiary/searchBeneficiary

## Data Sync API, central
dataSyncUploadUrl=${MMU_CENTRAL_SERVER}dataSync/van-to-server

## Data download API, central
dataSyncDownloadUrl=${MMU_CENTRAL_SERVER}dataSync/server-to-van

## TC specialist slot booking, # not required
tcSpecialistSlotBook=${TM_API}schedule/bookSlot

## TC specialist slot cancelling, # not required
tcSpecialistSlotCancel=${TM_API}schedule/cancelBookedSlot

## benGenUrl, common, central
benGenUrlCentral=${COMMON_API_OPEN_SYNC}beneficiary/generateBeneficiaryIDs

## benImportUrl, identity, local
benImportUrlLocal=${IDENTITY_API_BASE_URL}id/saveGeneratedBenIDToLocalServer
mmucentralserver = ${MMU_CENTRAL_SERVER}common/get/Case-sheet/centralServerTMCaseSheet

tmCentralServer = ${TM_CENTRAL_SERVER}common/get/Case-sheet/printData

specialistSign=${COMMON_API}signature1/getSignClass

## inventory transaction download URL, central, mmu
dataSyncTransactionDownloadUrl=${MMU_CENTRAL_SERVER}dataSync/server-to-van-transactional

## inventory transaction processed flag update URL, central, mmu
dataSyncProcessedFlagUpdate=${MMU_CENTRAL_SERVER}dataSync/updateProcessedFlagPostDownload

## down-sync (central -> local) data API, central, mmu
downSyncDataUrl=${MMU_CENTRAL_SERVER}dataSync/server-to-van-downsync

## down-sync (central -> local) flag update API, central, mmu
downSyncFlagUpdateUrl=${MMU_CENTRAL_SERVER}dataSync/updateDownSyncFlagPostDownload

## mark an up-synced record as already delivered to the van (central only)
downSync.markDeliveredOnUpSync=true


fileBasePath =${MMU_FILE_BASE_PATH}

## data sync batch size
BATCH_SIZE=30
snomedCTPageSize=10
nurseWL=7
docWL=7
pharmaWL=7
labWL=7
radioWL=7
oncoWL=7

## For File Sync
serverIP=${FILE_SYNC_SERVER_IP}
serverDomain=${FILE_SYNC_SERVER_DOMAIN}
serverUserName=${FILE_SYNC_SERVER_USERNAME}
serverPassword=${FILE_SYNC_SERVER_PASSWORD}
localFolderToSync=${LOCAL_FOLDER_TO_SYNC}
serverFolder=MMUSync
getServerCredentialURL=${MMU_API}fileSyncController/getServerCredential
tmReferCheckValue=TM
### Redis IP
spring.redis.host=${REDIS_HOST}

jwt.secret=${JWT_SECRET_KEY}


#ELK logging file name
logging.path=logs
logging.file.name=${MMU_API_LOGGING_FILE_NAME}

springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED}
springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED}
9 changes: 9 additions & 0 deletions src/main/environment/common_example.properties
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ dataSyncTransactionDownloadUrl=http://10.208.122.38:8080/mmu-api/dataSync/server
## inventory transaction processed flag update URL, central, mmu
dataSyncProcessedFlagUpdate=http://10.208.122.38:8080/mmu-api/dataSync/updateProcessedFlagPostDownload

## down-sync (central -> local) data API, central, mmu
downSyncDataUrl=http://10.208.122.38:8080/mmu-api/dataSync/server-to-van-downsync

## down-sync (central -> local) flag update API, central, mmu
downSyncFlagUpdateUrl=http://10.208.122.38:8080/mmu-api/dataSync/updateDownSyncFlagPostDownload

## mark an up-synced record as already delivered to the van (central only)
downSync.markDeliveredOnUpSync=true

## fetching the TM case sheet for MMU.
mmucentralserver = <Enter your socket address here>/mmu-api/common/get/Case-sheet/centralServerTMCaseSheet

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.springframework.web.bind.annotation.RestController;

import com.google.gson.Gson;
import com.iemr.mmu.service.dataSyncActivity.DownSyncDataFromServerImpl;
import com.iemr.mmu.service.dataSyncActivity.DownloadDataFromServerImpl;
import com.iemr.mmu.service.dataSyncActivity.DownloadDataFromServerTransactionalImpl;
import com.iemr.mmu.service.dataSyncActivity.UploadDataToServerImpl;
Expand All @@ -58,6 +59,8 @@ public class StartSyncActivity {
private DownloadDataFromServerImpl downloadDataFromServerImpl;
@Autowired
private DownloadDataFromServerTransactionalImpl downloadDataFromServerTransactionalImpl;
@Autowired
private DownSyncDataFromServerImpl downSyncDataFromServerImpl;
private static final String GROUP_ID = "groupID";
private static final String PROVIDER_SERVICE_MAP_ID = "providerServiceMapID";

Expand Down Expand Up @@ -225,4 +228,59 @@ public String downloadTransactionToLocal(@RequestBody String requestOBJ,
return response.toString();
}


@Operation(summary = "Start the down-sync of masters & transactional data from central to local")
@PostMapping(value = { "/startDownSync" })
public String startDownSync(@RequestBody String requestOBJ,
@RequestHeader(value = "Authorization") String authorization,
@RequestHeader(value = "ServerAuthorization") String serverAuthorization, HttpServletRequest request) {
OutputResponse response = new OutputResponse();
try {
String jwtToken = CookieUtil.getJwtTokenFromCookie(request);

if (serverAuthorization == null || serverAuthorization.trim().isEmpty()) {
logger.error("Down-sync : ServerAuthorization is empty - do the data sync server login first");
response.setError(5000,
"Server authorization is missing. Kindly do the data sync server login and try again.");
return response.toString();
}
logger.info("Down-sync : ServerAuthorization received, length {}", serverAuthorization.trim().length());

JSONObject obj = new JSONObject(requestOBJ);
if (obj.has("vanID") && obj.get("vanID") != null) {
Integer providerServiceMapID = obj.has(PROVIDER_SERVICE_MAP_ID) && !obj.isNull(PROVIDER_SERVICE_MAP_ID)
? obj.getInt(PROVIDER_SERVICE_MAP_ID)
: null;

String s = downSyncDataFromServerImpl.startDownSync(serverAuthorization, jwtToken, obj.getInt("vanID"),
providerServiceMapID);

if (s != null && s.equalsIgnoreCase("inProgress")) {
response.setError(5000, "Down-sync is already in progress, kindly wait for it to finish");
} else {
response.setResponse(new Gson().toJson(downSyncDataFromServerImpl.getDownSyncStatus()));
}
} else {
response.setError(5000, "vanID is missing, Kindly contact the administrator.");
}
} catch (Exception e) {
logger.error("Error in down-sync : {}", e.getMessage(), e);
response.setError(e);
}
return response.toString();
}

@Operation(summary = "Down-sync progress check")
@GetMapping(value = { "/checkDownSyncProgress" })
public String checkDownSyncProgress() {
OutputResponse response = new OutputResponse();
try {
response.setResponse(new Gson().toJson(downSyncDataFromServerImpl.getDownSyncStatus()));
} catch (Exception e) {
logger.error("Error in down-sync progress check : {}", e.getMessage(), e);
response.setError(e);
}
return response.toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.iemr.mmu.data.syncActivity_syncLayer.DownSyncDataDigester;
import com.iemr.mmu.data.syncActivity_syncLayer.SyncDownloadMaster;
import com.iemr.mmu.data.syncActivity_syncLayer.SyncUploadDataDigester;
import com.iemr.mmu.service.dataSyncLayerCentral.FetchDownloadDataImpl;
import com.iemr.mmu.service.dataSyncLayerCentral.GetDataFromVanAndSyncToDBImpl;
import com.iemr.mmu.service.dataSyncLayerCentral.GetDownSyncDataFromCentralImpl;
import com.iemr.mmu.service.dataSyncLayerCentral.GetMasterDataFromCentralForVanImpl;
import com.iemr.mmu.utils.CookieUtil;
import com.iemr.mmu.utils.response.OutputResponse;
Expand All @@ -48,7 +50,6 @@
*/
@RestController
@RequestMapping(value = "/dataSync", headers = "Authorization")
@PreAuthorize("hasRole('DATASYNC') || hasRole('DATA_SYNC') ")
public class MMUDataSyncVanToServer {
private Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());

Expand All @@ -58,6 +59,8 @@
private GetMasterDataFromCentralForVanImpl getMasterDataFromCentralForVanImpl;
@Autowired
private FetchDownloadDataImpl fetchDownloadDataImpl;
@Autowired
private GetDownSyncDataFromCentralImpl getDownSyncDataFromCentralImpl;

@Operation(summary = "Sync data from van-to-server")
@PostMapping(value = { "/van-to-server" }, consumes = "application/json", produces = "application/json")
Expand Down Expand Up @@ -157,4 +160,52 @@
return response.toStringWithSerialization();
}


@Operation(summary = "Down-sync data of one configured table from central to van")
@PostMapping(value = { "/server-to-van-downsync" }, consumes = "application/json", produces = "application/json")
public String downSyncDataFromServer(@RequestBody DownSyncDataDigester downSyncDataDigester,
@RequestHeader(value = "Authorization") String Authorization) {
OutputResponse response = new OutputResponse();
try {
if (downSyncDataDigester != null) {
String s = getDownSyncDataFromCentralImpl.getDownSyncDataForVan(downSyncDataDigester);
if (s != null)
response.setResponse(s);
else
response.setError(5000, "Error in down-sync for table " + downSyncDataDigester.getSchemaName() + "."
+ downSyncDataDigester.getTableName());
} else {
response.setError(5000, "Invalid request");
}
} catch (Exception e) {
if (downSyncDataDigester != null)
logger.error("Error in down-sync for table {}.{}", downSyncDataDigester.getSchemaName(),
downSyncDataDigester.getTableName(), e);
response.setError(e);
}
return response.toStringWithSerialization();
}

@Operation(summary = "Update the down-sync flag at central post delivery to the van")
@PostMapping(value = {
"/updateDownSyncFlagPostDownload" }, consumes = "application/json", produces = "application/json")
public String updateDownSyncFlagPostDownload(@RequestBody DownSyncDataDigester downSyncDataDigester,
@RequestHeader(value = "Authorization") String Authorization) {

Check warning on line 193 in src/main/java/com/iemr/mmu/controller/dataSyncLayerCentral/MMUDataSyncVanToServer.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=AaBgpWAGBKaFPVc79iyI&open=AaBgpWAGBKaFPVc79iyI&pullRequest=179
OutputResponse response = new OutputResponse();
try {
if (downSyncDataDigester != null) {
int i = getDownSyncDataFromCentralImpl.updateDownSyncFlagPostDownload(downSyncDataDigester);
response.setResponse(String.valueOf(i));
} else {
response.setError(5000, "Invalid request");
}
} catch (Exception e) {
if (downSyncDataDigester != null)
logger.error("Error while updating the down-sync flag for {}.{}", downSyncDataDigester.getSchemaName(),
downSyncDataDigester.getTableName(), e);
response.setError(e);
}
return response.toStringWithSerialization();
}

}
Loading
Loading