Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuldevgarg committed Dec 1, 2023
2 parents 08ced58 + ae752fa commit 2044f9e
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,32 @@ public int compare(DemandDetail dD1, DemandDetail dD2) {
}
};
}

public Map<String, String> migrateToV1(Integer startBatch, Integer batchSizeInput) {

public static String getCountQuery(String stateLevelTenantId){
return new String("select count(*) from egbs_demand where businessservice IN ('TL','PT') AND tenantid ilike '"+stateLevelTenantId+"%';");
}
public static String getSelectQuery(String stateLevelTenantId){
return new String("select d.id as did,dl.id as dlid,dl.demandid as dldemandid,"
+ "d.consumercode as dconsumercode,d.consumertype as dconsumertype,d.taxperiodfrom as dtaxperiodfrom,"
+ "d.taxperiodto as dtaxperiodto,U.uuid as payer,null as dbillexpirytime,"
+ " d.businessservice as dbusinessservice,d.status as status,d.minimumamountpayable as dminimumamountpayable, "
+ " (CASE WHEN taxheadcode='PT_DECIMAL_CEILING_CREDIT' OR taxheadcode='PT_DECIMAL_CEILING_DEBIT' THEN 'PT_ROUNDOFF' else taxheadcode END)"
+ " as dltaxheadcode, (CASE WHEN taxheadcode IN ('PT_TIME_REBATE', 'PT_ADVANCE_CARRYFORWARD', 'PT_OWNER_EXEMPTION','PT_UNIT_USAGE_EXEMPTION'"
+ ", 'PT_ADHOC_REBATE', 'PT_DECIMAL_CEILING_DEBIT','TL_ADHOC_REBATE') then taxamount*-1 else taxamount END) as dltaxamount,"
+ " dl.collectionamount as dlcollectionamount, dl.createdby as dlcreatedby,dl.createdtime as dlcreatedtime,dl.lastmodifiedby as dllastmodifiedby,"
+ " dl.lastmodifiedtime as dllastmodifiedtime,dl.tenantid as dltenantid, d.createdby as dcreatedby,d.createdtime as dcreatedtime,"
+ " d.lastmodifiedby as dlastmodifiedby,d.lastmodifiedtime as dlastmodifiedtime,d.tenantid as dtenantid "
+ " from egbs_demand d inner join egbs_demanddetail dl ON d.id=dl.demandid AND d.tenantid=dl.tenantid "
+ " LEFT OUTER JOIN eg_user U ON U.id::CHARACTER VARYING=d.owner"
+ " WHERE d.businessservice IN ('TL','PT') AND d.tenantid ilike '"+stateLevelTenantId+"%' "
+ " AND d.id IN (select id from egbs_demand order by id offset ? limit ?);");
}

public Map<String, String> migrateToV1(Integer startBatch, Integer batchSizeInput,String stateLevelTenantId) {

Map<String, String> responseMap = new HashMap<>();

int count = jdbcTemplate.queryForObject(COUNT_QUERY, Integer.class);
int count = jdbcTemplate.queryForObject(getCountQuery(stateLevelTenantId), Integer.class);
int i = 0;
if (null != startBatch && startBatch > 0)
i = startBatch;
Expand All @@ -111,7 +131,7 @@ public Map<String, String> migrateToV1(Integer startBatch, Integer batchSizeInpu

for( ; i<count;i = i+batchSize) {

List<Demand> demands = jdbcTemplate.query(SELECT_QUERY, new Object[] { i, batchSize }, demandRowMapper);
List<Demand> demands = jdbcTemplate.query(getSelectQuery(stateLevelTenantId), new Object[] { i, batchSize }, demandRowMapper);
try {

apportionDemands(demands);
Expand All @@ -128,7 +148,7 @@ public Map<String, String> migrateToV1(Integer startBatch, Integer batchSizeInpu

return responseMap;
}

private void addResponseToMap(List<Demand> demands, Map<String, String> responseMap, String message) {

demands.forEach(demand -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public ResponseEntity<?> search(@RequestBody RequestInfoWrapper requestInfoWrapp
public ResponseEntity<?> migrate(@RequestBody @Valid RequestInfoWrapper wrapper,
@RequestParam(required=false) Integer batchStart, @RequestParam(required=true) Integer batchSizeInput) {

Map<String, String> resultMap = migrationService.migrateToV1(batchStart, batchSizeInput);
Map<String, String> resultMap = migrationService.migrateToV1(batchStart, batchSizeInput, wrapper.getRequestInfo().getUserInfo().getTenantId().substring(0,2));
return new ResponseEntity<>(resultMap, HttpStatus.OK);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public HashMap<String, String> getLocalizationMessage(RequestInfo requestInfo, S
StringBuilder uri = new StringBuilder();
uri.append(config.getLocalizationHost()).append(config.getLocalizationContextPath())
.append(config.getLocalizationSearchEndpoint()).append("?").append("locale=").append(locale)
.append("&tenantId=").append("pb").append("&module=").append("mgramseva-common")
.append("&tenantId=").append(tenantId, 0, 2).append("&module=").append("mgramseva-common")
.append("&codes=").append(code);

Map<String, Object> request = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,8 @@ public class WSCalculationConfiguration {

@Value("${sms.bill.download.enabled}")
private boolean isSmsForBillDownloadEnabled;

@Value("${sms.exclude.tenant}")
private String smsExcludeTenant;

}
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ private void generateDemandAndSendnotification(RequestInfo requestInfo, String t
* + connectionNo ); continue; }
*/
try {
if(tenantId != "pb.testing") {
if(tenantId.equals(config.getSmsExcludeTenant())) {
generateDemandInBatch(calculationReq, masterMap, billingCycle, isSendMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public HashMap<String, String> getLocalizationMessage(RequestInfo requestInfo, S
StringBuilder uri = new StringBuilder();
uri.append(config.getLocalizationHost()).append(config.getLocalizationContextPath())
.append(config.getLocalizationSearchEndpoint()).append("?").append("locale=").append(locale)
.append("&tenantId=").append("pb").append("&module=").append("mgramseva-common")
.append("&tenantId=").append(tenantId,0,2).append("&module=").append("mgramseva-common")
.append("&codes=").append(code);

Map<String, Object> request = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,4 @@ egov.pspcl.vendor.number=9569761362
sms.demand.enabled: true
sms.payment.link.enabled: true
sms.bill.download.enabled: true
sms.exclude.tenant="pb.testing"
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public HashMap<String,String> process(MultipartFile file, RequestInfoWrapper req
if (!StringUtils.isEmpty(tenantId)) {
tenantId = tenantId.split("\\.")[0];
} else {
tenantId = "pb";
throw new CustomException("ONBOARD_NOT_FOUND", "Invalid tenantid");
}
user.setTenantId(tenantId);
} else if (2 == address.getColumn()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public HashMap<String, String> getLocalizationMessage(RequestInfo requestInfo, S
StringBuilder uri = new StringBuilder();
uri.append(config.getLocalizationHost()).append(config.getLocalizationContextPath())
.append(config.getLocalizationSearchEndpoint()).append("?").append("locale=").append(locale)
.append("&tenantId=").append("pb").append("&module=").append("mgramseva-common")
.append("&tenantId=").append(tenantId,0,2).append("&module=").append("mgramseva-common")
.append("&codes=").append(code);

Map<String, Object> request = new HashMap<>();
Expand Down

0 comments on commit 2044f9e

Please sign in to comment.