Skip to content

Commit

Permalink
Merge pull request #976 from egovernments/ISNE-304
Browse files Browse the repository at this point in the history
[ISNE-304] - set createdtime and createdby in audit details for demand and water reindexing
  • Loading branch information
pradeepkumarcm-egov authored Oct 14, 2024
2 parents 402c30e + e82b5e0 commit d87fd5c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,12 @@ public DemandResponse updateAsync(DemandRequest demandRequest, PaymentBackUpdate

RequestInfo requestInfo = demandRequest.getRequestInfo();
List<Demand> demands = demandRequest.getDemands();
AuditDetails currAuditDetails=demands.get(0).getAuditDetails();
AuditDetails auditDetail = util.getAuditDetail(requestInfo);
if (currAuditDetails != null) {
auditDetail.setCreatedTime(currAuditDetails.getCreatedTime());
auditDetail.setCreatedBy(currAuditDetails.getCreatedBy());
}

List<Demand> newDemands = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,13 @@ private List<String> getIdList(RequestInfo requestInfo, String tenantId, String
*
* @param waterConnectionRequest WaterConnectionRequest Object
*/
public void enrichUpdateWaterConnection(WaterConnectionRequest waterConnectionRequest) {
public void enrichUpdateWaterConnection(AuditDetails currentAuditDetails, WaterConnectionRequest waterConnectionRequest) {
AuditDetails auditDetails = waterServicesUtil
.getAuditDetails(waterConnectionRequest.getRequestInfo().getUserInfo().getUuid(), false);
if (currentAuditDetails != null) {
auditDetails.setCreatedBy(currentAuditDetails.getCreatedBy());
auditDetails.setCreatedTime(currentAuditDetails.getCreatedTime());
}
waterConnectionRequest.getWaterConnection().setAuditDetails(auditDetails);
WaterConnection connection = waterConnectionRequest.getWaterConnection();
if (!CollectionUtils.isEmpty(connection.getDocuments())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public List<WaterConnection> updateWaterConnection(WaterConnectionRequest waterC
throw new CustomException("DUPLICATE_OLD_CONNECTION_NUMBER",
"Duplicate Old connection number");
}

AuditDetails auditDetails=waterConnection.get(0).getAuditDetails();
mDMSValidator.validateMasterData(waterConnectionRequest, WCConstants.UPDATE_APPLICATION);
Property property = validateProperty.getOrValidateProperty(waterConnectionRequest);
validateProperty.validatePropertyFields(property, waterConnectionRequest.getRequestInfo());
Expand All @@ -252,7 +252,7 @@ public List<WaterConnection> updateWaterConnection(WaterConnectionRequest waterC
String previousApplicationStatus = workflowService.getApplicationStatus(waterConnectionRequest.getRequestInfo(),
waterConnectionRequest.getWaterConnection().getApplicationNo(),
waterConnectionRequest.getWaterConnection().getTenantId(), config.getBusinessServiceValue());
enrichmentService.enrichUpdateWaterConnection(waterConnectionRequest);
enrichmentService.enrichUpdateWaterConnection(auditDetails, waterConnectionRequest);
actionValidator.validateUpdateRequest(waterConnectionRequest, businessService, previousApplicationStatus);
waterConnectionValidator.validateUpdate(waterConnectionRequest, searchResult, WCConstants.UPDATE_APPLICATION);
userService.updateUser(waterConnectionRequest, searchResult);
Expand Down Expand Up @@ -331,6 +331,7 @@ private List<WaterConnection> updateWaterConnectionForModifyFlow(WaterConnection
throw new CustomException("DUPLICATE_OLD_CONNECTION_NUMBER",
"Duplicate Old connection number");
}
AuditDetails auditDetails=waterConnection.get(0).getAuditDetails();
mDMSValidator.validateMasterData(waterConnectionRequest, WCConstants.MODIFY_CONNECTION);
BusinessService businessService = workflowService.getBusinessService(
waterConnectionRequest.getWaterConnection().getTenantId(), waterConnectionRequest.getRequestInfo(),
Expand All @@ -342,7 +343,7 @@ private List<WaterConnection> updateWaterConnectionForModifyFlow(WaterConnection
String previousApplicationStatus = workflowService.getApplicationStatus(waterConnectionRequest.getRequestInfo(),
waterConnectionRequest.getWaterConnection().getApplicationNo(),
waterConnectionRequest.getWaterConnection().getTenantId(), config.getModifyWSBusinessServiceName());
enrichmentService.enrichUpdateWaterConnection(waterConnectionRequest);
enrichmentService.enrichUpdateWaterConnection(auditDetails, waterConnectionRequest);
actionValidator.validateUpdateRequest(waterConnectionRequest, businessService, previousApplicationStatus);
userService.updateUser(waterConnectionRequest, searchResult);
waterConnectionValidator.validateUpdate(waterConnectionRequest, searchResult, WCConstants.MODIFY_CONNECTION);
Expand Down

0 comments on commit d87fd5c

Please sign in to comment.