diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/controllers/DashboardController.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/controllers/DashboardController.java index a019ad1de43..24cdd852a84 100644 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/controllers/DashboardController.java +++ b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/controllers/DashboardController.java @@ -135,6 +135,7 @@ public String getVisualizationChartV2( @RequestBody RequestDto requestDto, @Requ StringBuilder finalString = new StringBuilder(requestBodyString).append(headersString); requestInfo.setHashKey(finalString.toString().hashCode()); + logger.info("hashKey:: "+finalString.toString().hashCode()); Map headers = requestDto.getHeaders(); String response = ""; try { diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/IResponseHandler.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/IResponseHandler.java index 3f1d39cd0c8..bcc72b4e486 100644 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/IResponseHandler.java +++ b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/IResponseHandler.java @@ -1,212 +1,210 @@ -package com.tarento.analytics.handler; - -import java.io.IOException; -import java.util.*; -import java.util.function.Function; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; - -import com.tarento.analytics.dto.AggregateDto; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.Data; -import com.tarento.analytics.dto.Plot; -import com.tarento.analytics.enums.ChartType; -import org.apache.commons.collections.CollectionUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Handles Elastic search consolidate responses - */ -public interface IResponseHandler { - - public static final Logger logger = LoggerFactory.getLogger(IResponseHandler.class); - - public static final String API_CONFIG_JSON = "ChartApiConfig.json"; - public static final String AGGS_PATH = "aggregationPaths"; - - public static final String CHART_NAME = "chartName"; - public static final String CHART_TYPE = "chartType"; - public static final String DRILL_CHART = "drillChart"; - public static final String VALUE_TYPE = "valueType"; - public static final String FILTER_KEYS = "filterKeys"; - - // Table Chart Keys - public static final String SERIAL_NUMBER = "S.N."; - public static final String TABLE_TEXT = "text" ; - public static final String TABLE_KEY = "Key"; - - - // TODO remove the specific column names. - public static final String TOTAL_COLLECTION = "Total Collection"; - public static final String TARGET_COLLECTION = "Target Collection"; - public static final String TARGET_ACHIEVED = "Target Achievement"; - - public static final String PT_DDR_BOUNDARY = "demandCollectionIndexDDRRevenue"; - public static final String PT_BOUNDARY = "demandCollectionIndexBoundaryRevenue"; - public static final String PT_BOUNDARY_DRILL = "boundaryDrillDown"; - public static final String TL_DDR_BOUNDARY = "licenseIssuedDDRRevenue"; - public static final String TL_BOUNDARY = "licenseIssuedBoundaryRevenue"; - public static final String TL_BOUNDARY_DRILL = "licenseIssuedBoundaryDrillDown"; - - - - public final String ASC = "asc"; - public final String DESC = "desc"; - public final String RANK = "Rank"; - public final String AGGREGATIONS = "aggregations"; - public final String PLOT_LABEL = "plotLabel"; - public final String COMPUTED_FIELDS = "computedFields"; - public final String EXCLUDED_COLUMNS = "excludedColumns"; - public final String LIMIT = "limit"; - public final String ORDER = "order"; - public final String ACTION = "action"; - public final String TYPE_MAPPING = "pathDataTypeMapping"; - - public static String BUCKETS = "buckets"; - public static String KEY = "key"; - public static String VALUE = "value"; - - public final String PERCENTAGE = "percentage"; - public final String DOC_COUNT = "doc_count"; - - public static final String POST_AGGREGATION_THEORY = "postAggregationTheory"; - - public static final String CHART_SPECIFIC = "chartSpecificProperty"; - - public static final String XTABLE_COLUMN = "XtableColumnOrder"; - - public static final String IS_ROUND_OFF = "isRoundOff"; - - public static Double BOUNDARY_VALUE = 50.0; - - public static final String DIVISION = "division"; - - /** - * Translate the consolidated/aggregated response - * - * @param requestDto - * @param aggregations - * @return - * @throws IOException - */ - public AggregateDto translate(AggregateRequestDto requestDto, ObjectNode aggregations) throws IOException; - - /** - * Prepare aggregated dato for a chart node - * Also sets the drillChart Value - * @param chartNode - * @param dataList - data plots object - * @return - */ - default AggregateDto getAggregatedDto(JsonNode chartNode, List dataList, String visualizationCode) { - AggregateDto aggregateDto = new AggregateDto(); - aggregateDto.setVisualizationCode(visualizationCode); - aggregateDto.setDrillDownChartId(chartNode.get(DRILL_CHART).asText()); - ChartType chartType = ChartType.fromValue(chartNode.get(CHART_TYPE).asText()); - aggregateDto.setChartType(chartType); - aggregateDto.setData(dataList); - if(null!=chartNode.get(FILTER_KEYS)) - aggregateDto.setFilter((ArrayNode) chartNode.get(FILTER_KEYS)); - return aggregateDto; - } - - /** - * Append computed field for a given Data, for its existing fields - * computes as partfield/wholefield * 100 - * - * @param data - * @param newfield - * @param partField - * @param wholeField - */ - default void addComputedField(Data data, String newfield, String partField, String wholeField) { - try { - Map plotMap = data.getPlots().stream().collect(Collectors.toMap(Plot::getName, Function.identity())); - - if (plotMap.get(partField).getValue() == 0.0 || plotMap.get(wholeField).getValue() == 0.0) { - data.getPlots().add(new Plot(newfield, 0.0, "percentage")); - } else { - double fieldValue = plotMap.get(partField).getValue() / plotMap.get(wholeField).getValue() * 100; - data.getPlots().add(new Plot(newfield, fieldValue, "percentage")); - - } - } catch (Exception e) { - data.getPlots().add(new Plot(newfield, 0.0, "percentage")); - } - - } - - /** - * Computes the percentage from 0th and 1st index of list - * Ex: 0th element/1st element * 100 - * @param values - * @return - */ - default Double percentageValue(List values, boolean isRoundOff) { - - logger.info("values for percentage are " + values); - double val = (values.get(0)/values.get(1) * 100); - - val = Math.round(val); - - return (values.size() > 1 && values.get(0) != 0.0 && values.get(1) != 0.0) ? val : 0.0; - } - - - /** - * Computes the percentage from 1st & 2nd element of collection - * Ex: first element/second element * 100 - * @param values - * @return - */ - default Double getPercentage(Map values, String partField, String wholeField, boolean isRoundOff) { - - double val = (values.get(partField)/ values.get(wholeField) * 100); - if(isRoundOff) { - val = Math.round(val); - } - return (values.size() > 1 && values.get(partField) != 0.0 && values.get(wholeField) != 0.0) ? val: 0.0; - } - - /** - * Adding missing plot elements with cumulative data - * @param plotKeys - all required plot key - * @param data - * @param symbol - */ - default void appendMissingPlot(Set plotKeys, Data data, String symbol, boolean isCumulative) { - - //To maintain the sorted plots list order - Map sortedMap = data.getPlots().stream() - .collect(Collectors.toMap( - Plot::getName, - plot -> plot, - (u,v) -> { throw new IllegalStateException(String.format("Duplicate key %s", u)); }, - LinkedHashMap::new - )); - - logger.info(data.getHeaderName() + " existing keys: "+sortedMap.keySet()+ "& size:"+sortedMap.keySet().size()); - - Collection allKeysMinusDataKeys = CollectionUtils.subtract(plotKeys, sortedMap.keySet()); - logger.info(data.getHeaderName() +" missing keys: "+allKeysMinusDataKeys); - - - for(String plKey:allKeysMinusDataKeys){ - sortedMap.put(plKey, new Plot(plKey, new Double("0"), symbol)); - if(isCumulative){ - List keys = sortedMap.keySet().stream().collect(Collectors.toList()); - int index = keys.indexOf(plKey); - double value = index>0 ? sortedMap.get(keys.get(index-1)).getValue():0.0; - sortedMap.get(plKey).setValue(value); - } - } - logger.info("after appending missing plots : "+ sortedMap); - data.setPlots(sortedMap.values().stream().collect(Collectors.toList())); - } - -} +package com.tarento.analytics.handler; + +import java.io.IOException; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; + +import com.tarento.analytics.dto.AggregateDto; +import com.tarento.analytics.dto.AggregateRequestDto; +import com.tarento.analytics.dto.Data; +import com.tarento.analytics.dto.Plot; +import com.tarento.analytics.enums.ChartType; +import org.apache.commons.collections.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Handles Elastic search consolidate responses + */ +public interface IResponseHandler { + + public static final Logger logger = LoggerFactory.getLogger(IResponseHandler.class); + + public static final String API_CONFIG_JSON = "ChartApiConfig.json"; + public static final String AGGS_PATH = "aggregationPaths"; + + public static final String CHART_NAME = "chartName"; + public static final String CHART_TYPE = "chartType"; + public static final String DRILL_CHART = "drillChart"; + public static final String VALUE_TYPE = "valueType"; + public static final String FILTER_KEYS = "filterKeys"; + + // Table Chart Keys + public static final String SERIAL_NUMBER = "S.N."; + public static final String TABLE_TEXT = "text" ; + public static final String TABLE_KEY = "Key"; + + + // TODO remove the specific column names. + public static final String TOTAL_COLLECTION = "Total Collection"; + public static final String TARGET_COLLECTION = "Target Collection"; + public static final String TARGET_ACHIEVED = "Target Achievement"; + + public static final String PT_DDR_BOUNDARY = "demandCollectionIndexDDRRevenue"; + public static final String PT_BOUNDARY = "demandCollectionIndexBoundaryRevenue"; + public static final String PT_BOUNDARY_DRILL = "boundaryDrillDown"; + public static final String TL_DDR_BOUNDARY = "licenseIssuedDDRRevenue"; + public static final String TL_BOUNDARY = "licenseIssuedBoundaryRevenue"; + public static final String TL_BOUNDARY_DRILL = "licenseIssuedBoundaryDrillDown"; + + + + public final String ASC = "asc"; + public final String DESC = "desc"; + public final String RANK = "Rank"; + public final String AGGREGATIONS = "aggregations"; + public final String PLOT_LABEL = "plotLabel"; + public final String COMPUTED_FIELDS = "computedFields"; + public final String EXCLUDED_COLUMNS = "excludedColumns"; + public final String LIMIT = "limit"; + public final String ORDER = "order"; + public final String ACTION = "action"; + public final String TYPE_MAPPING = "pathDataTypeMapping"; + + public static String BUCKETS = "buckets"; + public static String KEY = "key"; + public static String VALUE = "value"; + + public final String PERCENTAGE = "percentage"; + public final String DOC_COUNT = "doc_count"; + + public static final String POST_AGGREGATION_THEORY = "postAggregationTheory"; + + public static final String CHART_SPECIFIC = "chartSpecificProperty"; + + public static final String XTABLE_COLUMN = "XtableColumnOrder"; + + public static final String IS_ROUND_OFF = "isRoundOff"; + + public static Double BOUNDARY_VALUE = 50.0; + + public static final String DIVISION = "division"; + + /** + * Translate the consolidated/aggregated response + * + * @param requestDto + * @param aggregations + * @return + * @throws IOException + */ + public AggregateDto translate(AggregateRequestDto requestDto, ObjectNode aggregations) throws IOException; + + /** + * Prepare aggregated dato for a chart node + * Also sets the drillChart Value + * @param chartNode + * @param dataList - data plots object + * @return + */ + default AggregateDto getAggregatedDto(JsonNode chartNode, List dataList, String visualizationCode) { + AggregateDto aggregateDto = new AggregateDto(); + aggregateDto.setVisualizationCode(visualizationCode); + aggregateDto.setDrillDownChartId(chartNode.get(DRILL_CHART).asText()); + ChartType chartType = ChartType.fromValue(chartNode.get(CHART_TYPE).asText()); + aggregateDto.setChartType(chartType); + aggregateDto.setData(dataList); + if(null!=chartNode.get(FILTER_KEYS)) + aggregateDto.setFilter((ArrayNode) chartNode.get(FILTER_KEYS)); + return aggregateDto; + } + + /** + * Append computed field for a given Data, for its existing fields + * computes as partfield/wholefield * 100 + * + * @param data + * @param newfield + * @param partField + * @param wholeField + */ + default void addComputedField(Data data, String newfield, String partField, String wholeField) { + try { + Map plotMap = data.getPlots().stream().collect(Collectors.toMap(Plot::getName, Function.identity())); + + if (plotMap.get(partField).getValue() == 0.0 || plotMap.get(wholeField).getValue() == 0.0) { + data.getPlots().add(new Plot(newfield, 0.0, "percentage")); + } else { + double fieldValue = plotMap.get(partField).getValue() / plotMap.get(wholeField).getValue() * 100; + data.getPlots().add(new Plot(newfield, fieldValue, "percentage")); + + } + } catch (Exception e) { + data.getPlots().add(new Plot(newfield, 0.0, "percentage")); + } + + } + + /** + * Computes the percentage from 0th and 1st index of list + * Ex: 0th element/1st element * 100 + * @param values + * @return + */ + default Double percentageValue(List values, boolean isRoundOff) { + double val = (values.get(0)/values.get(1) * 100); + if(isRoundOff) { + val = Math.round(val); + } + return (values.size() > 1 && values.get(0) != 0.0 && values.get(1) != 0.0) ? val : 0.0; + } + + + /** + * Computes the percentage from 1st & 2nd element of collection + * Ex: first element/second element * 100 + * @param values + * @return + */ + default Double getPercentage(Map values, String partField, String wholeField, boolean isRoundOff) { + + double val = (values.get(partField)/ values.get(wholeField) * 100); + if(isRoundOff) { + val = Math.round(val); + } + return (values.size() > 1 && values.get(partField) != 0.0 && values.get(wholeField) != 0.0) ? val: 0.0; + } + + /** + * Adding missing plot elements with cumulative data + * @param plotKeys - all required plot key + * @param data + * @param symbol + */ + default void appendMissingPlot(Set plotKeys, Data data, String symbol, boolean isCumulative) { + + //To maintain the sorted plots list order + Map sortedMap = data.getPlots().stream() + .collect(Collectors.toMap( + Plot::getName, + plot -> plot, + (u,v) -> { throw new IllegalStateException(String.format("Duplicate key %s", u)); }, + LinkedHashMap::new + )); + + logger.info(data.getHeaderName() + " existing keys: "+sortedMap.keySet()+ "& size:"+sortedMap.keySet().size()); + + Collection allKeysMinusDataKeys = CollectionUtils.subtract(plotKeys, sortedMap.keySet()); + logger.info(data.getHeaderName() +" missing keys: "+allKeysMinusDataKeys); + + + for(String plKey:allKeysMinusDataKeys){ + sortedMap.put(plKey, new Plot(plKey, new Double("0"), symbol)); + if(isCumulative){ + List keys = sortedMap.keySet().stream().collect(Collectors.toList()); + int index = keys.indexOf(plKey); + double value = index>0 ? sortedMap.get(keys.get(index-1)).getValue():0.0; + sortedMap.get(plKey).setValue(value); + } + } + logger.info("after appending missing plots : "+ sortedMap); + data.setPlots(sortedMap.values().stream().collect(Collectors.toList())); + } + +} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/MetricChartResponseHandler.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/MetricChartResponseHandler.java index a56f8dab103..eb42542a49f 100644 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/MetricChartResponseHandler.java +++ b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/MetricChartResponseHandler.java @@ -23,6 +23,7 @@ import com.tarento.analytics.dto.Plot; import com.tarento.analytics.helper.ComputeHelper; import com.tarento.analytics.helper.ComputeHelperFactory; +import com.tarento.analytics.utils.ResponseRecorder; /** * This handles ES response for single index, multiple index to represent single data value diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/TarentoServiceImpl.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/TarentoServiceImpl.java index 7186682ec16..8163015157e 100644 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/TarentoServiceImpl.java +++ b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/TarentoServiceImpl.java @@ -3,6 +3,7 @@ import java.io.IOException; import java.util.Calendar; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -25,7 +26,6 @@ import com.tarento.analytics.dto.AggregateRequestDto; import com.tarento.analytics.dto.CummulativeDataRequestDto; import com.tarento.analytics.dto.DashboardHeaderDto; -import com.tarento.analytics.dto.Plot; import com.tarento.analytics.dto.RoleDto; import com.tarento.analytics.enums.ChartType; import com.tarento.analytics.exception.AINException; @@ -71,6 +71,7 @@ public class TarentoServiceImpl implements ClientService { @Cacheable(value="versions", key="#request.hashKey") public AggregateDto getAggregatedData(AggregateRequestDto request, List roles) throws AINException, IOException { // Read visualization Code + logger.info("inside Tarento AggregateDto"); String internalChartId = request.getVisualizationCode(); ObjectNode aggrObjectNode = JsonNodeFactory.instance.objectNode(); ObjectNode insightAggrObjectNode = JsonNodeFactory.instance.objectNode(); @@ -84,10 +85,48 @@ public AggregateDto getAggregatedData(AggregateRequestDto request, List filters.put("tenantId", filters.get("ulb")); } + Map indexes = new HashMap<>(); // Load Chart API configuration to Object Node for easy retrieval later ObjectNode node = configurationLoader.get(Constants.ConfigurationFiles.CHART_API_CONFIG); ObjectNode chartNode = (ObjectNode) node.get(internalChartId); + // added pivot code from here + ArrayNode queries = (ArrayNode) chartNode.get(Constants.JsonPaths.QUERIES); + queries.forEach(query -> { + String module = query.get(Constants.JsonPaths.MODULE).asText(); + String indexName = ""; + if (request.getModuleLevel().equals(Constants.Modules.HOME_REVENUE) || + request.getModuleLevel().equals(Constants.Modules.HOME_SERVICES) || + query.get(Constants.JsonPaths.MODULE).asText().equals(Constants.Modules.COMMON) || + request.getModuleLevel().equals(module)) { + + indexName = query.get(Constants.JsonPaths.INDEX_NAME).asText(); + String initialIndexName = indexName; + boolean isDefaultPresent = false; + boolean isRequestContainsInterval = null == request.getRequestDate() ? false : (request.getRequestDate().getInterval() != null && !request.getRequestDate().getInterval().isEmpty()); + String interval = isRequestContainsInterval ? request.getRequestDate().getInterval() : (isDefaultPresent ? chartNode.get(Constants.JsonPaths.INTERVAL).asText() : ""); + logger.info("interval :: {} "+interval); + logger.info("VisualizationCode :: {} "+request.getVisualizationCode()); + logger.info("Before constructing indexName :: {} "+indexName); + if (indexName.contains("*") && !StringUtils.isBlank(interval)) { + logger.info("entered into if block :: "+indexName); + //if interval is coming as year changed to month to match data + if(interval.equals("year")){ + interval = "month"; + } + indexName = indexName.replace("*", interval); + } else if (indexName.contains("*") && StringUtils.isBlank(interval)) { + logger.info("entered into else if block :: "+indexName); + indexName = indexName.replace("*", "month"); + } + indexes.put(indexName, initialIndexName); + logger.info("after constructing indexName :: {} "+indexName); + } + logger.info("Before setting indexName to NODE :: {} "+indexName); + ((ObjectNode) query).put(Constants.JsonPaths.INDEX_NAME, indexName); + + }); + ((ObjectNode) chartNode).put(Constants.JsonPaths.QUERIES, queries); InsightsConfiguration insightsConfig = null; if(chartNode.get(Constants.JsonPaths.INSIGHT) != null) { insightsConfig = mapper.treeToValue(chartNode.get(Constants.JsonPaths.INSIGHT), InsightsConfiguration.class); @@ -96,7 +135,9 @@ public AggregateDto getAggregatedData(AggregateRequestDto request, List boolean isDefaultPresent = chartType.equals(ChartType.LINE) && chartNode.get(Constants.JsonPaths.INTERVAL)!=null; boolean isRequestContainsInterval = null == request.getRequestDate() ? false : (request.getRequestDate().getInterval()!=null && !request.getRequestDate().getInterval().isEmpty()) ; String interval = isRequestContainsInterval? request.getRequestDate().getInterval(): (isDefaultPresent ? chartNode.get(Constants.JsonPaths.INTERVAL).asText():""); - + ObjectMapper mapper1 = new ObjectMapper(); + String json1 = mapper1.writerWithDefaultPrettyPrinter().writeValueAsString(chartNode); + logger.info("CHART NODE before executeConfiguredQueries:: {}"+json1); executeConfiguredQueries(chartNode, aggrObjectNode, nodes, request, interval); request.setChartNode(chartNode); ResponseRecorder responseRecorder = new ResponseRecorder(); @@ -133,7 +174,19 @@ Data is fetched with updated RequestDates (updated in getInsightsDate which subt aggregateDto = insightsHandler.getInsights(aggregateDto, request.getVisualizationCode(), request.getModuleLevel(), insightsConfig,request.getResponseRecorder()); } } - + + if(!queries.isEmpty()) + queries.forEach(query -> { + String indexName = indexes.get(query.get(Constants.JsonPaths.INDEX_NAME).asText()); + logger.info("VisualizationCode During indexname reset :: {} "+request.getVisualizationCode()); + logger.info("Index name from CHART NODE:::::::"+query.get(Constants.JsonPaths.INDEX_NAME).asText()); + logger.info("Index name from Map:::::::"+indexName); + if(!StringUtils.isBlank(indexName)) + ((ObjectNode) query).put(Constants.JsonPaths.INDEX_NAME, indexName); + }); + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(chartNode.get(Constants.JsonPaths.QUERIES)); + logger.info("Index name after resetting CHART NODE :: {}"+json); return aggregateDto; } @@ -147,6 +200,7 @@ Data is fetched with updated RequestDates (updated in getInsightsDate which subt * be fetched from AggregateRequestDto */ private void executeConfiguredQueries(ObjectNode chartNode, ObjectNode aggrObjectNode, ObjectNode nodes, AggregateRequestDto request, String interval) { + logger.info("nodes :: {}"+nodes); preHandle(request, chartNode, mdmsApiMappings); ArrayNode queries = (ArrayNode) chartNode.get(Constants.JsonPaths.QUERIES); @@ -159,6 +213,7 @@ private void executeConfiguredQueries(ObjectNode chartNode, ObjectNode aggrObjec request.getModuleLevel().equals(module)) { String indexName = query.get(Constants.JsonPaths.INDEX_NAME).asText(); + logger.info("indexName in executeConfiguredQueries:: {}"+indexName); ObjectNode objectNode = queryService.getChartConfigurationQuery(request, query, indexName, interval); try { JsonNode aggrNode = restService.search(indexName,objectNode.toString()); diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/RestService.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/RestService.java index 6fc25f9a4b3..04879d5c8ee 100644 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/RestService.java +++ b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/RestService.java @@ -1,6 +1,6 @@ -package com.tarento.analytics.service.impl; - +package com.tarento.analytics.service.impl; + import static javax.servlet.http.HttpServletRequest.BASIC_AUTH; import static org.apache.commons.codec.CharEncoding.US_ASCII; import static org.springframework.http.HttpHeaders.AUTHORIZATION; @@ -24,142 +24,142 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Component -public class RestService { - public static final Logger LOGGER = LoggerFactory.getLogger(RestService.class); - - @Value("${services.esindexer.host}") - private String indexServiceHost; - @Value("${egov.services.esindexer.host.search}") - private String indexServiceHostSearch; - @Value("${services.esindexer.host}") - private String dssindexServiceHost; - @Value("${egov.es.username}") - private String userName; - @Value("${egov.es.password}") - private String password; - - @Autowired - private RetryTemplate retryTemplate; - - - /** - * search on Elastic search for a search query - * @param index elastic search index name against which search operation - * @param searchQuery search query as request body - * @return - * @throws IOException - */ - - public JsonNode search(String index, String searchQuery) { - //System.out.println("INSIDE REST"); - String url =( indexServiceHost) + index + indexServiceHostSearch; - HttpHeaders headers = getHttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - LOGGER.info("Index Name : " + index); - LOGGER.info("Searching ES for Query: " + searchQuery); - HttpEntity requestEntity = new HttpEntity<>(searchQuery, headers); +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component +public class RestService { + public static final Logger LOGGER = LoggerFactory.getLogger(RestService.class); + + @Value("${services.esindexer.host}") + private String indexServiceHost; + @Value("${egov.services.esindexer.host.search}") + private String indexServiceHostSearch; + @Value("${services.esindexer.host}") + private String dssindexServiceHost; + @Value("${egov.es.username}") + private String userName; + @Value("${egov.es.password}") + private String password; + + @Autowired + private RetryTemplate retryTemplate; + + + /** + * search on Elastic search for a search query + * @param index elastic search index name against which search operation + * @param searchQuery search query as request body + * @return + * @throws IOException + */ + + public JsonNode search(String index, String searchQuery) { + //System.out.println("INSIDE REST"); + String url =( indexServiceHost) + index + indexServiceHostSearch; + HttpHeaders headers = getHttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + LOGGER.info("Index Name : " + index); + LOGGER.info("Searching ES for Query: " + searchQuery); + HttpEntity requestEntity = new HttpEntity<>(searchQuery, headers); JsonNode responseNode = null; - - try { - ResponseEntity response = retryTemplate.postForEntity(url, requestEntity); - responseNode = new ObjectMapper().convertValue(response.getBody(), JsonNode.class); - LOGGER.info("RestTemplate response :- "+responseNode); - - } catch (HttpClientErrorException e) { - e.printStackTrace(); - LOGGER.error("client error while searching ES : " + e.getMessage()); - } - return responseNode; - } - - /** - * makes a client rest api call of Http POST option - * @param uri - * @param authToken - * @param requestNode - * @return - * @throws IOException - */ - public JsonNode post(String uri, String authToken, JsonNode requestNode) { - - HttpHeaders headers = new HttpHeaders(); - if(authToken != null && !authToken.isEmpty()) - headers.add("Authorization", "Bearer "+ authToken ); - headers.setContentType(MediaType.APPLICATION_JSON); - - LOGGER.info("Request URI: " + uri + ", Node: " + requestNode); - HttpEntity requestEntity = null; - if(requestNode != null ) requestEntity = new HttpEntity<>(requestNode.toString(), headers); - else requestEntity = new HttpEntity<>("{}", headers); - - JsonNode responseNode = null; - - try { - ResponseEntity response = retryTemplate.postForEntity(uri,requestEntity); - responseNode = new ObjectMapper().convertValue(response.getBody(), JsonNode.class); - LOGGER.info("RestTemplate response :- "+responseNode); - - } catch (HttpClientErrorException e) { - LOGGER.error("post client exception: " + e.getMessage()); - } - return responseNode; - } - - /** - * makes a client rest api call of Http GET option - * @param uri - * @param authToken - * @return - * @throws IOException - */ - public JsonNode get(String uri, String authToken) { - - HttpHeaders headers = new HttpHeaders(); - headers.add("Authorization", "Bearer "+ authToken ); - headers.setContentType(MediaType.APPLICATION_JSON); - HttpEntity headerEntity = new HttpEntity<>("{}", headers); - - JsonNode responseNode = null; - try { - ResponseEntity response = retryTemplate.getForEntity(uri, headerEntity); - responseNode = new ObjectMapper().convertValue(response.getBody(), JsonNode.class); - LOGGER.info("RestTemplate response :- "+responseNode); - - } catch (HttpClientErrorException e) { - LOGGER.error("get client exception: " + e.getMessage()); - } - return responseNode; - } - - - private HttpHeaders getHttpHeaders() { - HttpHeaders headers = new HttpHeaders(); - headers.add(AUTHORIZATION, getBase64Value(userName, password)); - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - headers.setContentType(MediaType.APPLICATION_JSON); - - List mediaTypes = new ArrayList<>(); - mediaTypes.add(MediaType.APPLICATION_JSON); - headers.setAccept(mediaTypes); - return headers; - } - - /** - * Helper Method to create the Base64Value for headers - * - * @param userName - * @param password - * @return - */ - private String getBase64Value(String userName, String password) { - String authString = String.format("%s:%s", userName, password); - byte[] encodedAuthString = Base64.encodeBase64(authString.getBytes(Charset.forName(US_ASCII))); - return String.format(BASIC_AUTH, new String(encodedAuthString)); - } - -} + + try { + ResponseEntity response = retryTemplate.postForEntity(url, requestEntity); + responseNode = new ObjectMapper().convertValue(response.getBody(), JsonNode.class); + //LOGGER.info("RestTemplate response :- "+responseNode); + + } catch (HttpClientErrorException e) { + e.printStackTrace(); + LOGGER.error("client error while searching ES : " + e.getMessage()); + } + return responseNode; + } + + /** + * makes a client rest api call of Http POST option + * @param uri + * @param authToken + * @param requestNode + * @return + * @throws IOException + */ + public JsonNode post(String uri, String authToken, JsonNode requestNode) { + + HttpHeaders headers = new HttpHeaders(); + if(authToken != null && !authToken.isEmpty()) + headers.add("Authorization", "Bearer "+ authToken ); + headers.setContentType(MediaType.APPLICATION_JSON); + + LOGGER.info("Request URI: " + uri + ", Node: " + requestNode); + HttpEntity requestEntity = null; + if(requestNode != null ) requestEntity = new HttpEntity<>(requestNode.toString(), headers); + else requestEntity = new HttpEntity<>("{}", headers); + + JsonNode responseNode = null; + + try { + ResponseEntity response = retryTemplate.postForEntity(uri,requestEntity); + responseNode = new ObjectMapper().convertValue(response.getBody(), JsonNode.class); + LOGGER.info("RestTemplate response :- "+responseNode); + + } catch (HttpClientErrorException e) { + LOGGER.error("post client exception: " + e.getMessage()); + } + return responseNode; + } + + /** + * makes a client rest api call of Http GET option + * @param uri + * @param authToken + * @return + * @throws IOException + */ + public JsonNode get(String uri, String authToken) { + + HttpHeaders headers = new HttpHeaders(); + headers.add("Authorization", "Bearer "+ authToken ); + headers.setContentType(MediaType.APPLICATION_JSON); + HttpEntity headerEntity = new HttpEntity<>("{}", headers); + + JsonNode responseNode = null; + try { + ResponseEntity response = retryTemplate.getForEntity(uri, headerEntity); + responseNode = new ObjectMapper().convertValue(response.getBody(), JsonNode.class); + LOGGER.info("RestTemplate response :- "+responseNode); + + } catch (HttpClientErrorException e) { + LOGGER.error("get client exception: " + e.getMessage()); + } + return responseNode; + } + + + private HttpHeaders getHttpHeaders() { + HttpHeaders headers = new HttpHeaders(); + headers.add(AUTHORIZATION, getBase64Value(userName, password)); + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + headers.setContentType(MediaType.APPLICATION_JSON); + + List mediaTypes = new ArrayList<>(); + mediaTypes.add(MediaType.APPLICATION_JSON); + headers.setAccept(mediaTypes); + return headers; + } + + /** + * Helper Method to create the Base64Value for headers + * + * @param userName + * @param password + * @return + */ + private String getBase64Value(String userName, String password) { + String authString = String.format("%s:%s", userName, password); + byte[] encodedAuthString = Base64.encodeBase64(authString.getBytes(Charset.forName(US_ASCII))); + return String.format(BASIC_AUTH, new String(encodedAuthString)); + } + +} diff --git a/business-services/egov-hrms/pom.xml b/business-services/egov-hrms/pom.xml index a413052a992..e6589fb1306 100644 --- a/business-services/egov-hrms/pom.xml +++ b/business-services/egov-hrms/pom.xml @@ -9,7 +9,7 @@ org.egov egov-hrms - 1.2.5-SNAPSHOT + 1.2.6-SNAPSHOT egov-hrms HR Management System @@ -97,6 +97,12 @@ jsoup 1.10.2 + + org.egov.common + health-services-models + 1.0.6-SNAPSHOT + compile + @@ -108,6 +114,9 @@ repo.egovernments.org.snapshots eGov ERP Releases Repository https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ + + always + diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/EgovEmployeeApplication.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/EgovEmployeeApplication.java index f9c4df5d061..12c7c5daeb5 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/EgovEmployeeApplication.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/EgovEmployeeApplication.java @@ -44,8 +44,15 @@ import javax.annotation.PostConstruct; +import lombok.extern.slf4j.Slf4j; import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.hrms.config.PropertiesManager; +import org.egov.hrms.repository.RestCallRepository; +import org.egov.hrms.service.DefaultUserService; +import org.egov.hrms.service.IndividualService; +import org.egov.hrms.service.UserService; import org.egov.tracer.config.TracerConfiguration; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -55,10 +62,12 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.context.annotation.Primary; @SpringBootApplication -@ComponentScan(basePackages = { "org.egov.hrms", "org.egov.hrms.web.controllers" , "org.egov.hrms.config"}) +@ComponentScan(basePackages = { "org.egov.hrms", "org.egov.hrms.web.controller" , "org.egov.hrms.config"}) @Import({TracerConfiguration.class, MultiStateInstanceUtil.class}) +@Slf4j public class EgovEmployeeApplication { @Value("${app.timezone}") @@ -77,6 +86,34 @@ public ObjectMapper getObjectMapper() { return objectMapper; } + @Bean + @Primary + public UserService getUserService(@Value("${egov.hrms.user.service.qualifier}") String userServiceQualifier, + @Autowired PropertiesManager propertiesManager, + @Autowired RestCallRepository restCallRepository, + @Autowired ObjectMapper objectMapper, + @Autowired MultiStateInstanceUtil multiStateInstanceUtil, + @Value("${egov.user.create.endpoint}") String userCreateEndpoint, + @Value("${egov.user.update.endpoint}") String userUpdateEndpoint, + @Value("${egov.user.search.endpoint}") String userSearchEndpoint) { + if (userServiceQualifier.equalsIgnoreCase("individualService")) { + log.info("using individual module as user service"); + return new IndividualService(propertiesManager, restCallRepository); + } + else { + log.info("using egov-user module as user service"); + DefaultUserService userService = new DefaultUserService(); + userService.setPropertiesManager(propertiesManager); + userService.setRestCallRepository(restCallRepository); + userService.setObjectMapper(objectMapper); + userService.setCentralInstanceUtil(multiStateInstanceUtil); + userService.setUserCreateEndpoint(userCreateEndpoint); + userService.setUserUpdateEndpoint(userUpdateEndpoint); + userService.setUserSearchEndpoint(userSearchEndpoint); + return userService; + } + } + public static void main(String[] args) { SpringApplication.run(EgovEmployeeApplication.class, args); } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java index d9263d4587b..dd0fb1ee4c6 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java @@ -116,4 +116,22 @@ public class PropertiesManager { @Value("${decryption.abac.enable}") private Boolean isDecryptionEnable; + + @Value("${egov.individual.host}") + private String individualHost; + + @Value("${egov.individual.create.endpoint}") + private String individualCreateEndpoint; + + @Value("${egov.individual.update.endpoint}") + private String individualUpdateEndpoint; + + @Value("${egov.individual.delete.endpoint}") + private String individualDeleteEndpoint; + + @Value("${egov.individual.search.endpoint}") + private String individualSearchEndpoint; + + @Value("${egov.hrms.auto.generate.password}") + private boolean autoGeneratePassword; } \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java index e75d2f8bb30..f6a9b5cd59a 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java @@ -90,8 +90,6 @@ public class Employee { @Valid - @NotEmpty - @Size(min = 1) private List assignments = new ArrayList<>(); @Valid diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueries.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueries.java index 9bb07130f75..6b824692a34 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueries.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueries.java @@ -52,4 +52,6 @@ public class EmployeeQueries { public static final String HRMS_GET_ASSIGNMENT = "select distinct(employeeid) from eg_hrms_assignment assignment where assignment.tenantid notnull "; public static final String HRMS_COUNT_EMP_QUERY = "SELECT active, count(*) FROM eg_hrms_employee WHERE tenantid "; + + public static final String HRMS_GET_UNASSIGNED_EMPLOYEES = "SELECT employee.uuid from eg_hrms_employee employee LEFT JOIN eg_hrms_assignment assignment ON employee.uuid = assignment.employeeid where assignment.employeeid is null"; } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueryBuilder.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueryBuilder.java index 67140d47ee4..4e5e5d7bdc4 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueryBuilder.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueryBuilder.java @@ -158,5 +158,11 @@ private void addToPreparedStatement(List preparedStmtList, List ids) }); } + public String getUnassignedEmployeesSearchQuery(EmployeeSearchCriteria criteria, List preparedStmtList) { + StringBuilder builder = new StringBuilder(EmployeeQueries.HRMS_GET_UNASSIGNED_EMPLOYEES); + addWhereClauseAssignment(criteria, builder, preparedStmtList); + return builder.toString(); + } + } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java index 518fb1dcfb5..20bb37a813e 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java @@ -58,6 +58,10 @@ public List fetchEmployees(EmployeeSearchCriteria criteria, RequestInf criteria.setUuids(empUuids); } } + if (criteria.getIncludeUnassigned() != null && criteria.getIncludeUnassigned()) { + List empUuids = fetchUnassignedEmployees(criteria, requestInfo); + criteria.setUuids(empUuids); + } String query = queryBuilder.getEmployeeSearchQuery(criteria, preparedStmtList); try { employees = jdbcTemplate.query(query, preparedStmtList.toArray(),rowMapper); @@ -68,6 +72,19 @@ public List fetchEmployees(EmployeeSearchCriteria criteria, RequestInf return employees; } + private List fetchUnassignedEmployees(EmployeeSearchCriteria criteria, RequestInfo requestInfo) { + List employeesIds = new ArrayList<>(); + List preparedStmtList = new ArrayList<>(); + String query = queryBuilder.getUnassignedEmployeesSearchQuery(criteria, preparedStmtList); + try { + employeesIds = jdbcTemplate.queryForList(query, preparedStmtList.toArray(),String.class); + }catch(Exception e) { + log.error("Exception while making the db call: ",e); + log.error("query; "+query); + } + return employeesIds; + } + private List fetchEmployeesforAssignment(EmployeeSearchCriteria criteria, RequestInfo requestInfo) { List employeesIds = new ArrayList<>(); List preparedStmtList = new ArrayList<>(); diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/RestCallRepository.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/RestCallRepository.java index 13b4e023e12..596538863e5 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/RestCallRepository.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/RestCallRepository.java @@ -3,6 +3,7 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; +import org.egov.tracer.model.CustomException; import org.egov.tracer.model.ServiceCallException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; @@ -21,6 +22,9 @@ public class RestCallRepository { @Autowired private RestTemplate restTemplate; + @Autowired + private ObjectMapper objectMapper; + /** * Fetches results from the given API and request and handles errors. * @@ -30,8 +34,6 @@ public class RestCallRepository { * @author vishal */ public Object fetchResult(StringBuilder uri, Object request) { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); Object response = null; try { response = restTemplate.postForObject(uri.toString(), request, Map.class); @@ -49,4 +51,17 @@ public Object fetchResult(StringBuilder uri, Object request) { } + public T fetchResult(StringBuilder uri, Object request, Class + clazz) { + objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + T response; + try { + response = restTemplate.postForObject(uri.toString(), request, clazz); + } catch (HttpClientErrorException e) { + throw new CustomException("HTTP_CLIENT_ERROR", + String.format("%s - %s", e.getMessage(), e.getResponseBodyAsString())); + } + return response; + } + } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/DefaultUserService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/DefaultUserService.java new file mode 100644 index 00000000000..0b232ae6448 --- /dev/null +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/DefaultUserService.java @@ -0,0 +1,281 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) 2016 eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.egovernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. + */ + +package org.egov.hrms.service; + +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.request.Role; +import org.egov.common.contract.request.User; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.hrms.config.PropertiesManager; +import org.egov.hrms.repository.RestCallRepository; +import org.egov.hrms.utils.HRMSConstants; +import org.egov.hrms.web.contract.UserRequest; +import org.egov.hrms.web.contract.UserResponse; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; + +import javax.annotation.PostConstruct; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +import static org.egov.hrms.utils.HRMSConstants.*; + +@Slf4j +@Setter +@Getter +public class DefaultUserService implements UserService { + + @Autowired + private PropertiesManager propertiesManager; + + @Autowired + private ObjectMapper objectMapper; + + @Autowired + private RestCallRepository restCallRepository; + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + @Value("${egov.user.create.endpoint}") + private String userCreateEndpoint; + + @Value("${egov.user.search.endpoint}") + private String userSearchEndpoint; + + @Value("${egov.user.update.endpoint}") + private String userUpdateEndpoint; + + private String internalMicroserviceRoleUuid = null; + + @PostConstruct + void initalizeSystemuser(){ + log.info("initialising system user"); + RequestInfo requestInfo = new RequestInfo(); + StringBuilder uri = new StringBuilder(); + uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserSearchEndpoint()); // URL for user search call + Map userSearchRequest = new HashMap<>(); + userSearchRequest.put("RequestInfo", requestInfo); + userSearchRequest.put("tenantId", propertiesManager.getStateLevelTenantId()); + userSearchRequest.put("roleCodes", Collections.singletonList(INTERNALMICROSERVICEROLE_CODE)); + try { + LinkedHashMap responseMap = (LinkedHashMap) restCallRepository.fetchResult(uri, userSearchRequest); + List> users = (List>) responseMap.get("user"); + if(users.size()==0) + createInternalMicroserviceUser(requestInfo); + internalMicroserviceRoleUuid = (String) users.get(0).get("uuid"); + }catch (Exception e) { + throw new CustomException("EG_USER_SEARCH_ERROR", "Service returned null while fetching user"); + } + + } + + private void createInternalMicroserviceUser(RequestInfo requestInfo){ + Map userCreateRequest = new HashMap<>(); + //Creating role with INTERNAL_MICROSERVICE_ROLE + Role role = Role.builder() + .name(INTERNALMICROSERVICEROLE_NAME).code(INTERNALMICROSERVICEROLE_CODE) + .tenantId(propertiesManager.getStateLevelTenantId()).build(); + User user = User.builder().userName(INTERNALMICROSERVICEUSER_USERNAME) + .name(INTERNALMICROSERVICEUSER_NAME).mobileNumber(INTERNALMICROSERVICEUSER_MOBILENO) + .type(INTERNALMICROSERVICEUSER_TYPE).tenantId(propertiesManager.getStateLevelTenantId()) + .roles(Collections.singletonList(role)).id(0L).build(); + + userCreateRequest.put("RequestInfo", requestInfo); + userCreateRequest.put("user", user); + + StringBuilder uri = new StringBuilder(); + uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserCreateEndpoint()); // URL for user create call + + try { + LinkedHashMap responseMap = (LinkedHashMap) restCallRepository.fetchResult(uri, userCreateRequest); + List> users = (List>) responseMap.get("user"); + internalMicroserviceRoleUuid = (String) users.get(0).get("uuid"); + }catch (Exception e) { + throw new CustomException("EG_USER_CRETE_ERROR", "Service returned throws error while creating user"); + } + } + + @Override + public UserResponse createUser(UserRequest userRequest) { + StringBuilder uri = new StringBuilder(); + uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserCreateEndpoint()); + UserResponse userResponse = null; + try { + userResponse = userCall(userRequest,uri); + }catch(Exception e) { + log.error("User created failed: ",e); + } + + return userResponse; + } + + @Override + public UserResponse updateUser(UserRequest userRequest) { + StringBuilder uri = new StringBuilder(); + uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserUpdateEndpoint()); + UserResponse userResponse = null; + try { + userResponse = userCall(userRequest,uri); + }catch(Exception e) { + log.error("User created failed: ",e); + } + + return userResponse; + } + + @Override + public UserResponse getUser(RequestInfo requestInfo, Map userSearchCriteria) { + StringBuilder uri = new StringBuilder(); + Map userSearchReq = new HashMap<>(); + User userInfoCopy = requestInfo.getUserInfo(); + + if(propertiesManager.getIsDecryptionEnable()){ + User enrichedUserInfo = getEncrichedandCopiedUserInfo(String.valueOf(userSearchCriteria.get("tenantId"))); + requestInfo.setUserInfo(enrichedUserInfo); + } + + userSearchReq.put("RequestInfo", requestInfo); + userSearchReq.put(HRMSConstants.HRMS_USER_SERACH_CRITERIA_USERTYPE_CODE,HRMSConstants.HRMS_USER_SERACH_CRITERIA_USERTYPE); + for( String key: userSearchCriteria.keySet()) + userSearchReq.put(key, userSearchCriteria.get(key)); + uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserSearchEndpoint()); + UserResponse userResponse = new UserResponse(); + try { + userResponse = userCall(userSearchReq,uri); + }catch(Exception e) { + log.error("User search failed: ",e); + } + if(propertiesManager.getIsDecryptionEnable()) + requestInfo.setUserInfo(userInfoCopy); + + return userResponse; + } + + private User getEncrichedandCopiedUserInfo(String tenantId){ + //Creating role with INTERNAL_MICROSERVICE_ROLE + Role role = Role.builder() + .name(INTERNALMICROSERVICEROLE_NAME).code(INTERNALMICROSERVICEROLE_CODE) + .tenantId(centralInstanceUtil.getStateLevelTenant(tenantId)).build(); + + //Creating userinfo with uuid and role of internal micro service role + User userInfo = User.builder() + .uuid(internalMicroserviceRoleUuid) + .type(INTERNALMICROSERVICEUSER_TYPE) + .roles(Collections.singletonList(role)).id(0L).build(); + + return userInfo; + } + + + /** + * Returns UserDetailResponse by calling user service with given uri and object + * @param userRequest Request object for user service + * @param uri The address of the endpoint + * @return Response from user service as parsed as userDetailResponse + */ + @SuppressWarnings("all") + private UserResponse userCall(Object userRequest, StringBuilder uri) { + String dobFormat = null; + if(uri.toString().contains(userSearchEndpoint) || uri.toString().contains(userUpdateEndpoint)) + dobFormat="yyyy-MM-dd"; + else if(uri.toString().contains(userCreateEndpoint)) + dobFormat = "dd/MM/yyyy"; + try{ + LinkedHashMap responseMap = (LinkedHashMap) restCallRepository.fetchResult(uri, userRequest); + parseResponse(responseMap,dobFormat); + UserResponse userDetailResponse = objectMapper.convertValue(responseMap,UserResponse.class); + return userDetailResponse; + } + catch(IllegalArgumentException e) { + throw new CustomException("IllegalArgumentException","ObjectMapper not able to convertValue in userCall"); + } + } + + + /** + * Parses date formats to long for all users in responseMap + * @param responeMap LinkedHashMap got from user api response + * @param dobFormat dob format (required because dob is returned in different format's in search and create response in user service) + */ + @SuppressWarnings("all") + private void parseResponse(LinkedHashMap responeMap,String dobFormat){ + List users = (List)responeMap.get("user"); + String format1 = "dd-MM-yyyy HH:mm:ss"; + if(users!=null){ + users.forEach( map -> { + map.put("createdDate",dateTolong((String)map.get("createdDate"),format1)); + if((String)map.get("lastModifiedDate")!=null) + map.put("lastModifiedDate",dateTolong((String)map.get("lastModifiedDate"),format1)); + if((String)map.get("dob")!=null) + map.put("dob",dateTolong((String)map.get("dob"),dobFormat)); + if((String)map.get("pwdExpiryDate")!=null) + map.put("pwdExpiryDate",dateTolong((String)map.get("pwdExpiryDate"),format1)); + } + ); + } + } + + /** + * Converts date to long + * @param date date to be parsed + * @param format Format of the date + * @return Long value of date + */ + private Long dateTolong(String date,String format){ + SimpleDateFormat f = new SimpleDateFormat(format); + Date d = null; + try { + d = f.parse(date); + } catch (ParseException e) { + e.printStackTrace(); + } + return d.getTime(); + } + + +} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java index a6cfb483d9a..db7623697b6 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java @@ -142,13 +142,18 @@ public EmployeeResponse search(EmployeeSearchCriteria criteria, RequestInfo requ else criteria.setIsActive(false);*/ Map mapOfUsers = new HashMap(); - if(!StringUtils.isEmpty(criteria.getPhone()) || !CollectionUtils.isEmpty(criteria.getRoles())) { + if(!StringUtils.isEmpty(criteria.getPhone()) + || !CollectionUtils.isEmpty(criteria.getRoles()) + || !CollectionUtils.isEmpty(criteria.getCodes())) { Map userSearchCriteria = new HashMap<>(); userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_TENANTID,criteria.getTenantId()); if(!StringUtils.isEmpty(criteria.getPhone())) userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_MOBILENO,criteria.getPhone()); if( !CollectionUtils.isEmpty(criteria.getRoles()) ) userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_ROLECODES,criteria.getRoles()); + if (!CollectionUtils.isEmpty(criteria.getCodes())) { + userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_USERNAME, criteria.getCodes().get(0)); + } UserResponse userResponse = userService.getUser(requestInfo, userSearchCriteria); userChecked =true; if(!CollectionUtils.isEmpty(userResponse.getUser())) { @@ -194,10 +199,13 @@ public EmployeeResponse search(EmployeeSearchCriteria criteria, RequestInfo requ log.info("Active employees are::" + employees.size() + "uuids are :::" + uuids); if(!CollectionUtils.isEmpty(uuids)){ - Map UserSearchCriteria = new HashMap<>(); - UserSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_UUID,uuids); + Map userSearchCriteria = new HashMap<>(); + userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_UUID,uuids); + userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_TENANTID, criteria.getTenantId()); + log.info("uuid is available {}", userSearchCriteria); if(mapOfUsers.isEmpty()){ - UserResponse userResponse = userService.getUser(requestInfo, UserSearchCriteria); + log.info("searching in user service"); + UserResponse userResponse = userService.getUser(requestInfo, userSearchCriteria); if(!CollectionUtils.isEmpty(userResponse.getUser())) { mapOfUsers = userResponse.getUser().stream() .collect(Collectors.toMap(User :: getUuid, Function.identity())); @@ -224,10 +232,11 @@ private void createUser(Employee employee, RequestInfo requestInfo) { try { UserResponse response = userService.createUser(request); User user = response.getUser().get(0); - employee.setId(user.getId()); + employee.setId(UUID.fromString(user.getUuid()).getMostSignificantBits()); employee.setUuid(user.getUuid()); employee.getUser().setId(user.getId()); employee.getUser().setUuid(user.getUuid()); + employee.getUser().setUserServiceUuid(user.getUserServiceUuid()); }catch(Exception e) { log.error("Exception while creating user: ",e); log.error("request: "+request); @@ -247,7 +256,9 @@ private void enrichUser(Employee employee) { pwdParams.add(employee.getUser().getMobileNumber()); pwdParams.add(employee.getTenantId()); pwdParams.add(employee.getUser().getName().toUpperCase()); - employee.getUser().setPassword(hrmsUtils.generatePassword(pwdParams)); + if (propertiesManager.isAutoGeneratePassword()) { + employee.getUser().setPassword(hrmsUtils.generatePassword(pwdParams)); + } employee.getUser().setUserName(employee.getCode()); employee.getUser().setActive(true); employee.getUser().setType(UserType.EMPLOYEE.toString()); @@ -272,11 +283,13 @@ private void enrichCreateRequest(Employee employee, RequestInfo requestInfo) { if(null == jurisdiction.getIsActive()) jurisdiction.setIsActive(true); }); - employee.getAssignments().stream().forEach(assignment -> { - assignment.setId(UUID.randomUUID().toString()); - assignment.setAuditDetails(auditDetails); - assignment.setPosition(getPosition()); - }); + if (employee.getAssignments() != null && !employee.getAssignments().isEmpty()) { + employee.getAssignments().stream().forEach(assignment -> { + assignment.setId(UUID.randomUUID().toString()); + assignment.setAuditDetails(auditDetails); + assignment.setPosition(getPosition()); + }); + } if(!CollectionUtils.isEmpty(employee.getServiceHistory())) { employee.getServiceHistory().stream().forEach(serviceHistory -> { serviceHistory.setId(UUID.randomUUID().toString()); diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/IndividualService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/IndividualService.java new file mode 100644 index 00000000000..882c5ab2247 --- /dev/null +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/IndividualService.java @@ -0,0 +1,228 @@ +package org.egov.hrms.service; + +import digit.models.coremodels.user.enums.UserType; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.models.core.Role; +import org.egov.common.models.individual.Address; +import org.egov.common.models.individual.AddressType; +import org.egov.common.models.individual.Gender; +import org.egov.common.models.individual.Individual; +import org.egov.common.models.individual.IndividualBulkResponse; +import org.egov.common.models.individual.IndividualRequest; +import org.egov.common.models.individual.IndividualResponse; +import org.egov.common.models.individual.IndividualSearch; +import org.egov.common.models.individual.IndividualSearchRequest; +import org.egov.common.models.individual.Name; +import org.egov.common.models.individual.UserDetails; +import org.egov.hrms.config.PropertiesManager; +import org.egov.hrms.repository.RestCallRepository; +import org.egov.hrms.utils.HRMSConstants; +import org.egov.hrms.web.contract.User; +import org.egov.hrms.web.contract.UserRequest; +import org.egov.hrms.web.contract.UserResponse; +import org.springframework.beans.factory.annotation.Autowired; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; +import java.util.stream.Collectors; + +@Slf4j +public class IndividualService implements UserService { + + private final PropertiesManager propertiesManager; + + private final RestCallRepository restCallRepository; + + @Autowired + public IndividualService(PropertiesManager propertiesManager, + RestCallRepository restCallRepository) { + this.propertiesManager = propertiesManager; + this.restCallRepository = restCallRepository; + } + + + @Override + public UserResponse createUser(UserRequest userRequest) { + IndividualRequest request = mapToIndividualRequest(userRequest); + StringBuilder uri = new StringBuilder(); + uri.append(propertiesManager.getIndividualHost()); + uri.append(propertiesManager.getIndividualCreateEndpoint()); + IndividualResponse response = restCallRepository + .fetchResult(uri, request, IndividualResponse.class); + UserResponse userResponse = null; + if (response != null && response.getIndividual() != null) { + log.info("response received from individual service"); + userResponse = mapToUserResponse(response); + } + return userResponse; + } + + @Override + public UserResponse updateUser(UserRequest userRequest) { + IndividualRequest request = mapToIndividualRequest(userRequest); + StringBuilder uri = new StringBuilder(); + uri.append(propertiesManager.getIndividualHost()); + uri.append(propertiesManager.getIndividualUpdateEndpoint()); + IndividualResponse response = restCallRepository + .fetchResult(uri, request, IndividualResponse.class); + UserResponse userResponse = null; + if (response != null && response.getIndividual() != null) { + log.info("response received from individual service"); + userResponse = mapToUserResponse(response); + } + return userResponse; + } + + @Override + public UserResponse getUser(RequestInfo requestInfo, Map userSearchCriteria ) { + IndividualSearchRequest request = IndividualSearchRequest.builder() + .requestInfo(requestInfo) + .individual(IndividualSearch.builder() + .mobileNumber((String) userSearchCriteria.get("mobileNumber")) + .id((List) userSearchCriteria.get("uuid")) + .roleCodes((List) userSearchCriteria.get("roleCodes")) + .username((String) userSearchCriteria.get(HRMSConstants.HRMS_USER_SEARCH_CRITERA_USERNAME)) + // given name + .individualName((String) userSearchCriteria + .get(HRMSConstants.HRMS_USER_SEARCH_CRITERA_NAME)) + .build()) + .build(); + IndividualBulkResponse response = getIndividualResponse((String) userSearchCriteria + .get(HRMSConstants.HRMS_USER_SEARCH_CRITERA_TENANTID), + request); + UserResponse userResponse = new UserResponse(); + if (response != null && response.getIndividual() != null && !response.getIndividual().isEmpty()) { + log.info("response received from individual service"); + userResponse = mapToUserResponse(response); + } + return userResponse; + } + + private IndividualBulkResponse getIndividualResponse(String tenantId, IndividualSearchRequest individualSearchRequest) { + return restCallRepository.fetchResult( + new StringBuilder(propertiesManager.getIndividualHost() + + propertiesManager.getIndividualSearchEndpoint() + + "?limit=1000&offset=0&tenantId=" + tenantId), + individualSearchRequest, IndividualBulkResponse.class); + } + + + /** + * Converts a long value representing milliseconds since the epoch to a Date object in the format dd/MM/yyyy. + * + * @param milliseconds the long value representing milliseconds since the epoch. + * @return a Date object in the format dd/MM/yyyy. + */ + private static Date convertMillisecondsToDate(long milliseconds) { + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + formatter.setTimeZone(TimeZone.getTimeZone("UTC")); + String dateString = formatter.format(new Date(milliseconds)); + try { + return formatter.parse(dateString); + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } + + private static IndividualRequest mapToIndividualRequest(UserRequest userRequest) { + Individual individual = Individual.builder() + .id(userRequest.getUser().getUuid()) + .userId(userRequest.getUser().getId() != null ? + String.valueOf(userRequest.getUser().getId()) : null) + .userUuid(userRequest.getUser().getUserServiceUuid()) + .isSystemUser(true) + .isSystemUserActive(userRequest.getUser().getActive()) + .name(Name.builder() + .givenName(userRequest.getUser().getName()) + .build()) + .gender(Gender.fromValue(userRequest.getUser().getGender())) + .email(userRequest.getUser().getEmailId()) + .mobileNumber(userRequest.getUser().getMobileNumber()) + .dateOfBirth(convertMillisecondsToDate(userRequest.getUser().getDob())) + .tenantId(userRequest.getUser().getTenantId()) + .address(Collections.singletonList(Address.builder() + .type(AddressType.CORRESPONDENCE) + .addressLine1(userRequest.getUser().getCorrespondenceAddress()) + .isDeleted(Boolean.FALSE) + .build())) + .userDetails(UserDetails.builder() + .username(userRequest.getUser().getUserName()) + .password(userRequest.getUser().getPassword()) + .tenantId(userRequest.getUser().getTenantId()) + .roles(userRequest.getUser().getRoles().stream().map(role -> Role.builder() + .code(role.getCode()) + .name(role.getName()) + .tenantId(userRequest.getUser().getTenantId()) + .description(role.getDescription()) + .build()).collect(Collectors.toList())) + .userType(UserType.fromValue(userRequest.getUser().getType())) + .build()) + .isDeleted(Boolean.FALSE) + .rowVersion(userRequest.getUser().getRowVersion()) + .build(); + return IndividualRequest.builder() + .requestInfo(userRequest.getRequestInfo()) + .individual(individual) + .build(); + } + + private static UserResponse mapToUserResponse(IndividualResponse response) { + UserResponse userResponse; + userResponse = UserResponse.builder() + .responseInfo(response.getResponseInfo()) + .user(Collections.singletonList(getUser(response.getIndividual()))) + .build(); + return userResponse; + } + + private static UserResponse mapToUserResponse(IndividualBulkResponse response) { + UserResponse userResponse; + userResponse = UserResponse.builder() + .responseInfo(response.getResponseInfo()) + .user(response.getIndividual().stream() + .map(IndividualService::getUser).collect(Collectors.toList())) + .build(); + return userResponse; + } + + + private static User getUser(Individual individual) { + return User.builder() + .id(individual.getUserId() != null ? Long.parseLong(individual.getUserId()) : null) + .mobileNumber(individual.getMobileNumber()) + .name(individual.getName().getGivenName()) + .uuid(individual.getId()) + .userServiceUuid(individual.getUserUuid()) + .active(individual.getIsSystemUserActive()) + .gender(individual.getGender() != null ? individual.getGender().name() : null) + .userName(individual.getUserDetails().getUsername()) + .emailId(individual.getEmail()) + .correspondenceAddress(individual.getAddress() != null && !individual.getAddress().isEmpty() + ? individual.getAddress().stream().filter(address -> address.getType() + .equals(AddressType.CORRESPONDENCE)).findFirst() + .orElse(Address.builder().build()) + .getAddressLine1() : null) + .dob(individual.getDateOfBirth().getTime()) + .tenantId(individual.getTenantId()) + .createdBy(individual.getAuditDetails().getCreatedBy()) + .createdDate(individual.getAuditDetails().getCreatedTime()) + .lastModifiedBy(individual.getAuditDetails().getLastModifiedBy()) + .lastModifiedDate(individual.getAuditDetails().getLastModifiedTime()) + .rowVersion(individual.getRowVersion()) + .roles(individual.getUserDetails() + .getRoles().stream().map(role -> org.egov.hrms.model.Role.builder() + .code(role.getCode()) + .tenantId(role.getTenantId()) + .name(role.getName()) + .build()).collect(Collectors.toList())) + + .build(); + } +} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java index 840e259b72a..dcdb1fc4c9f 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java @@ -1,277 +1,16 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - package org.egov.hrms.service; -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.extern.slf4j.Slf4j; import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.Role; -import org.egov.common.contract.request.User; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.hrms.config.PropertiesManager; -import org.egov.hrms.model.Employee; -import org.egov.hrms.model.enums.UserType; -import org.egov.hrms.repository.RestCallRepository; -import org.egov.hrms.utils.HRMSConstants; import org.egov.hrms.web.contract.UserRequest; import org.egov.hrms.web.contract.UserResponse; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import javax.annotation.PostConstruct; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.*; - -import static org.egov.hrms.utils.HRMSConstants.*; - -@Slf4j -@Service -public class UserService { - - @Autowired - private PropertiesManager propertiesManager; - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private RestCallRepository restCallRepository; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - @Value("${egov.user.create.endpoint}") - private String userCreateEndpoint; - - @Value("${egov.user.search.endpoint}") - private String userSearchEndpoint; - - @Value("${egov.user.update.endpoint}") - private String userUpdateEndpoint; - - private String internalMicroserviceRoleUuid = null; - - @PostConstruct - void initalizeSystemuser(){ - RequestInfo requestInfo = new RequestInfo(); - StringBuilder uri = new StringBuilder(); - uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserSearchEndpoint()); // URL for user search call - Map userSearchRequest = new HashMap<>(); - userSearchRequest.put("RequestInfo", requestInfo); - userSearchRequest.put("tenantId", propertiesManager.getStateLevelTenantId()); - userSearchRequest.put("roleCodes", Collections.singletonList(INTERNALMICROSERVICEROLE_CODE)); - try { - LinkedHashMap responseMap = (LinkedHashMap) restCallRepository.fetchResult(uri, userSearchRequest); - List> users = (List>) responseMap.get("user"); - if(users.size()==0) - createInternalMicroserviceUser(requestInfo); - internalMicroserviceRoleUuid = (String) users.get(0).get("uuid"); - }catch (Exception e) { - throw new CustomException("EG_USER_SEARCH_ERROR", "Service returned null while fetching user"); - } - - } - - private void createInternalMicroserviceUser(RequestInfo requestInfo){ - Map userCreateRequest = new HashMap<>(); - //Creating role with INTERNAL_MICROSERVICE_ROLE - Role role = Role.builder() - .name(INTERNALMICROSERVICEROLE_NAME).code(INTERNALMICROSERVICEROLE_CODE) - .tenantId(propertiesManager.getStateLevelTenantId()).build(); - User user = User.builder().userName(INTERNALMICROSERVICEUSER_USERNAME) - .name(INTERNALMICROSERVICEUSER_NAME).mobileNumber(INTERNALMICROSERVICEUSER_MOBILENO) - .type(INTERNALMICROSERVICEUSER_TYPE).tenantId(propertiesManager.getStateLevelTenantId()) - .roles(Collections.singletonList(role)).id(0L).build(); - - userCreateRequest.put("RequestInfo", requestInfo); - userCreateRequest.put("user", user); - - StringBuilder uri = new StringBuilder(); - uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserCreateEndpoint()); // URL for user create call - - try { - LinkedHashMap responseMap = (LinkedHashMap) restCallRepository.fetchResult(uri, userCreateRequest); - List> users = (List>) responseMap.get("user"); - internalMicroserviceRoleUuid = (String) users.get(0).get("uuid"); - }catch (Exception e) { - throw new CustomException("EG_USER_CRETE_ERROR", "Service returned throws error while creating user"); - } - } - - public UserResponse createUser(UserRequest userRequest) { - StringBuilder uri = new StringBuilder(); - uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserCreateEndpoint()); - UserResponse userResponse = null; - try { - userResponse = userCall(userRequest,uri); - }catch(Exception e) { - log.error("User created failed: ",e); - } - - return userResponse; - } - - public UserResponse updateUser(UserRequest userRequest) { - StringBuilder uri = new StringBuilder(); - uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserUpdateEndpoint()); - UserResponse userResponse = null; - try { - userResponse = userCall(userRequest,uri); - }catch(Exception e) { - log.error("User created failed: ",e); - } - - return userResponse; - } - - public UserResponse getUser(RequestInfo requestInfo, Map userSearchCriteria ) { - StringBuilder uri = new StringBuilder(); - Map userSearchReq = new HashMap<>(); - User userInfoCopy = requestInfo.getUserInfo(); - - if(propertiesManager.getIsDecryptionEnable()){ - User enrichedUserInfo = getEncrichedandCopiedUserInfo(String.valueOf(userSearchCriteria.get("tenantId"))); - requestInfo.setUserInfo(enrichedUserInfo); - } - - userSearchReq.put("RequestInfo", requestInfo); - userSearchReq.put(HRMSConstants.HRMS_USER_SERACH_CRITERIA_USERTYPE_CODE,HRMSConstants.HRMS_USER_SERACH_CRITERIA_USERTYPE); - for( String key: userSearchCriteria.keySet()) - userSearchReq.put(key, userSearchCriteria.get(key)); - uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserSearchEndpoint()); - UserResponse userResponse = new UserResponse(); - try { - userResponse = userCall(userSearchReq,uri); - }catch(Exception e) { - log.error("User search failed: ",e); - } - if(propertiesManager.getIsDecryptionEnable()) - requestInfo.setUserInfo(userInfoCopy); - - return userResponse; - } - - private User getEncrichedandCopiedUserInfo(String tenantId){ - //Creating role with INTERNAL_MICROSERVICE_ROLE - Role role = Role.builder() - .name(INTERNALMICROSERVICEROLE_NAME).code(INTERNALMICROSERVICEROLE_CODE) - .tenantId(centralInstanceUtil.getStateLevelTenant(tenantId)).build(); - - //Creating userinfo with uuid and role of internal micro service role - User userInfo = User.builder() - .uuid(internalMicroserviceRoleUuid) - .type(INTERNALMICROSERVICEUSER_TYPE) - .roles(Collections.singletonList(role)).id(0L).build(); - - return userInfo; - } - - - /** - * Returns UserDetailResponse by calling user service with given uri and object - * @param userRequest Request object for user service - * @param uri The address of the endpoint - * @return Response from user service as parsed as userDetailResponse - */ - @SuppressWarnings("all") - private UserResponse userCall(Object userRequest, StringBuilder uri) { - String dobFormat = null; - if(uri.toString().contains(userSearchEndpoint) || uri.toString().contains(userUpdateEndpoint)) - dobFormat="yyyy-MM-dd"; - else if(uri.toString().contains(userCreateEndpoint)) - dobFormat = "dd/MM/yyyy"; - try{ - LinkedHashMap responseMap = (LinkedHashMap) restCallRepository.fetchResult(uri, userRequest); - parseResponse(responseMap,dobFormat); - UserResponse userDetailResponse = objectMapper.convertValue(responseMap,UserResponse.class); - return userDetailResponse; - } - catch(IllegalArgumentException e) { - throw new CustomException("IllegalArgumentException","ObjectMapper not able to convertValue in userCall"); - } - } +import java.util.Map; - /** - * Parses date formats to long for all users in responseMap - * @param responeMap LinkedHashMap got from user api response - * @param dobFormat dob format (required because dob is returned in different format's in search and create response in user service) - */ - @SuppressWarnings("all") - private void parseResponse(LinkedHashMap responeMap,String dobFormat){ - List users = (List)responeMap.get("user"); - String format1 = "dd-MM-yyyy HH:mm:ss"; - if(users!=null){ - users.forEach( map -> { - map.put("createdDate",dateTolong((String)map.get("createdDate"),format1)); - if((String)map.get("lastModifiedDate")!=null) - map.put("lastModifiedDate",dateTolong((String)map.get("lastModifiedDate"),format1)); - if((String)map.get("dob")!=null) - map.put("dob",dateTolong((String)map.get("dob"),dobFormat)); - if((String)map.get("pwdExpiryDate")!=null) - map.put("pwdExpiryDate",dateTolong((String)map.get("pwdExpiryDate"),format1)); - } - ); - } - } +public interface UserService { - /** - * Converts date to long - * @param date date to be parsed - * @param format Format of the date - * @return Long value of date - */ - private Long dateTolong(String date,String format){ - SimpleDateFormat f = new SimpleDateFormat(format); - Date d = null; - try { - d = f.parse(date); - } catch (ParseException e) { - e.printStackTrace(); - } - return d.getTime(); - } + UserResponse createUser(UserRequest userRequest); + UserResponse updateUser(UserRequest userRequest); + UserResponse getUser(RequestInfo requestInfo, Map userSearchCriteria); } \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/ErrorConstants.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/ErrorConstants.java index b50975fa6d1..1dccb2952f8 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/ErrorConstants.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/ErrorConstants.java @@ -199,4 +199,8 @@ public class ErrorConstants { public static final String HRMS_INVALID_SEARCH_CITIZEN_CODE = "ERR_HRMS_INVALID_SEARCH_CITIZEN"; public static final String HRMS_INVALID_SEARCH_CITIZEN_MSG = "Citizen are not allowed to access employee search with Ids."; + public static final String HRMS_PASSWORD_REQUIRED = "ERR_HRMS_PASSWORD_REQUIRED"; + + public static final String HRMS_PASSWORD_REQUIRED_MSG = "Password is required"; + } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java index cce02417720..f5a3f9dfca6 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java @@ -55,6 +55,8 @@ public class EmployeeSearchCriteria { public Integer offset; public Integer limit; + + private Boolean includeUnassigned = false; public boolean isCriteriaEmpty(EmployeeSearchCriteria criteria) { diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/User.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/User.java index 51d9fcc5226..913ed3ab0a9 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/User.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/User.java @@ -7,6 +7,7 @@ import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.egov.hrms.model.Role; import org.egov.hrms.model.enums.GuardianRelation; import org.springframework.validation.annotation.Validated; @@ -29,6 +30,9 @@ @Setter @ToString @Builder +@JsonIgnoreProperties( + ignoreUnknown = true +) public class User { @JsonProperty("id") @@ -38,6 +42,10 @@ public class User { @JsonProperty("uuid") private String uuid; + @Size(max=64) + @JsonProperty("userServiceUuid") + private String userServiceUuid; + @Size(max=180) @JsonProperty("userName") private String userName; @@ -172,6 +180,9 @@ public class User { @Size(max=256) @JsonProperty("tenantId") private String tenantId; + + @JsonProperty("rowVersion") + private Integer rowVersion; } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/UserResponse.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/UserResponse.java index 2cd8466501f..285964a0a87 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/UserResponse.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/UserResponse.java @@ -43,6 +43,7 @@ import java.util.ArrayList; import java.util.List; +import lombok.Builder; import org.egov.common.contract.response.ResponseInfo; import lombok.AllArgsConstructor; @@ -58,6 +59,7 @@ @NoArgsConstructor @Setter @ToString +@Builder public class UserResponse { private ResponseInfo responseInfo; diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java index 99a12ff5054..0b780a74f6a 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java @@ -116,6 +116,7 @@ public ResponseEntity update(@RequestBody @Valid EmployeeRequest employeeRequ @ResponseBody public ResponseEntity search(@RequestBody @Valid RequestInfoWrapper requestInfoWrapper, @ModelAttribute @Valid EmployeeSearchCriteria criteria) { validator.validateSearchRequest(requestInfoWrapper.getRequestInfo(), criteria); + log.info(criteria.toString()); EmployeeResponse employeeResponse = employeeService.search(criteria, requestInfoWrapper.getRequestInfo()); return new ResponseEntity<>(employeeResponse,HttpStatus.OK); } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java index 7d773639a3f..413d650a2c5 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java @@ -8,7 +8,6 @@ import com.jayway.jsonpath.JsonPath; import org.apache.commons.lang3.StringUtils; -import org.apache.kafka.common.protocol.types.Field; import org.egov.common.contract.request.RequestInfo; import org.egov.common.contract.request.Role; import org.egov.hrms.config.PropertiesManager; @@ -58,6 +57,7 @@ public class EmployeeValidator { public void validateCreateEmployee(EmployeeRequest request) { Map errorMap = new HashMap<>(); validateExistingDuplicates(request ,errorMap); + validatePassword(request, errorMap); if(!CollectionUtils.isEmpty(errorMap.keySet())) throw new CustomException(errorMap); Map> boundaryMap = getBoundaryList(request.getRequestInfo(),request.getEmployees().get(0)); @@ -69,6 +69,16 @@ public void validateCreateEmployee(EmployeeRequest request) { throw new CustomException(errorMap); } + private void validatePassword(EmployeeRequest request, Map errorMap) { + List employees = request.getEmployees(); + if (!propertiesManager.isAutoGeneratePassword()) { + employees.forEach(employee -> { + if (StringUtils.isEmpty(employee.getUser().getPassword())) + errorMap.put(ErrorConstants.HRMS_PASSWORD_REQUIRED, ErrorConstants.HRMS_PASSWORD_REQUIRED_MSG); + }); + } + } + public Map> getBoundaryList(RequestInfo requestInfo,Employee employee){ List boundarytList = new ArrayList<>(); Map> eachMasterMap = new HashMap<>(); @@ -347,45 +357,48 @@ private void validateEmployee(Employee employee, Map errorMap, M * @param mdmsData */ private void validateAssignments(Employee employee, Map errorMap, Map> mdmsData) { - List currentAssignments = employee.getAssignments().stream().filter(assignment -> assignment.getIsCurrentAssignment()).collect(Collectors.toList()); - if(currentAssignments.size() != 1){ - errorMap.put(ErrorConstants.HRMS_INVALID_CURRENT_ASSGN_CODE, ErrorConstants.HRMS_INVALID_CURRENT_ASSGN_MSG); - } - employee.getAssignments().sort(new Comparator() { - @Override - public int compare(Assignment assignment1, Assignment assignment2) { - return assignment1.getFromDate().compareTo(assignment2.getFromDate()); + if (employee.getAssignments() != null && !employee.getAssignments().isEmpty()) { + List currentAssignments = employee.getAssignments().stream().filter(assignment -> assignment.getIsCurrentAssignment()).collect(Collectors.toList()); + if (currentAssignments.size() != 1) { + errorMap.put(ErrorConstants.HRMS_INVALID_CURRENT_ASSGN_CODE, ErrorConstants.HRMS_INVALID_CURRENT_ASSGN_MSG); } - }); - int length = employee.getAssignments().size(); - boolean overlappingCheck =false; - for(int i=0;i employee.getAssignments().get(i+1).getFromDate()) - overlappingCheck=true; - } - if(overlappingCheck) - errorMap.put(ErrorConstants.HRMS_OVERLAPPING_ASSGN_CODE, ErrorConstants.HRMS_OVERLAPPING_ASSGN_MSG); - - for(Assignment assignment: employee.getAssignments()) { - if(!assignment.getIsCurrentAssignment() && !CollectionUtils.isEmpty(currentAssignments) && null != assignment.getToDate()&& currentAssignments.get(0).getFromDate() < assignment.getToDate() ) - errorMap.put(ErrorConstants.HRMS_OVERLAPPING_ASSGN_CURRENT_CODE,ErrorConstants.HRMS_OVERLAPPING_ASSGN_CURRENT_MSG); - if(!mdmsData.get(HRMSConstants.HRMS_MDMS_DEPT_CODE).contains(assignment.getDepartment())) - errorMap.put(ErrorConstants.HRMS_INVALID_DEPT_CODE, ErrorConstants.HRMS_INVALID_DEPT_MSG); - if(!mdmsData.get(HRMSConstants.HRMS_MDMS_DESG_CODE).contains(assignment.getDesignation())) - errorMap.put(ErrorConstants.HRMS_INVALID_DESG_CODE, ErrorConstants.HRMS_INVALID_DESG_MSG); - if( assignment.getIsCurrentAssignment() && null != assignment.getToDate()) - errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_CURRENT_TO_DATE_CODE,ErrorConstants.HRMS_INVALID_ASSIGNMENT_CURRENT_TO_DATE_MSG); - if(!assignment.getIsCurrentAssignment() && null == assignment.getToDate()) - errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_NON_CURRENT_TO_DATE_CODE,ErrorConstants.HRMS_INVALID_ASSIGNMENT_NON_CURRENT_TO_DATE_MSG); - if(null != assignment.getToDate() && assignment.getFromDate() > assignment.getToDate()) - errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_PERIOD_CODE, ErrorConstants.HRMS_INVALID_ASSIGNMENT_PERIOD_MSG); - if(employee.getUser().getDob()!=null ) - if(assignment.getFromDate() < employee.getUser().getDob() || (null != assignment.getToDate() && assignment.getToDate() < employee.getUser().getDob())) - errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_DATES_CODE, ErrorConstants.HRMS_INVALID_ASSIGNMENT_DATES_MSG); - if(null != employee.getDateOfAppointment() && assignment.getFromDate() < employee.getDateOfAppointment()) - errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_DATES_APPOINTMENT_CODE, ErrorConstants.HRMS_INVALID_ASSIGNMENT_DATES_APPOINTMENT_MSG); + employee.getAssignments().sort(new Comparator() { + @Override + public int compare(Assignment assignment1, Assignment assignment2) { + return assignment1.getFromDate().compareTo(assignment2.getFromDate()); + } + }); + int length = employee.getAssignments().size(); + boolean overlappingCheck = false; + for (int i = 0; i < length - 1; i++) { + if (null != employee.getAssignments().get(i).getToDate() && employee.getAssignments().get(i).getToDate() > employee.getAssignments().get(i + 1).getFromDate()) + overlappingCheck = true; + } + if (overlappingCheck) + errorMap.put(ErrorConstants.HRMS_OVERLAPPING_ASSGN_CODE, ErrorConstants.HRMS_OVERLAPPING_ASSGN_MSG); + + for (Assignment assignment : employee.getAssignments()) { + if (!assignment.getIsCurrentAssignment() && !CollectionUtils.isEmpty(currentAssignments) && null != assignment.getToDate() && currentAssignments.get(0).getFromDate() < assignment.getToDate()) + errorMap.put(ErrorConstants.HRMS_OVERLAPPING_ASSGN_CURRENT_CODE, ErrorConstants.HRMS_OVERLAPPING_ASSGN_CURRENT_MSG); + if (!mdmsData.get(HRMSConstants.HRMS_MDMS_DEPT_CODE).contains(assignment.getDepartment())) + errorMap.put(ErrorConstants.HRMS_INVALID_DEPT_CODE, ErrorConstants.HRMS_INVALID_DEPT_MSG); + /*if (!assignment.getDesignation().equalsIgnoreCase("undefined") && + !mdmsData.get(HRMSConstants.HRMS_MDMS_DESG_CODE).contains(assignment.getDesignation())) + errorMap.put(ErrorConstants.HRMS_INVALID_DESG_CODE, ErrorConstants.HRMS_INVALID_DESG_MSG);*/ + if (assignment.getIsCurrentAssignment() && null != assignment.getToDate()) + errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_CURRENT_TO_DATE_CODE, ErrorConstants.HRMS_INVALID_ASSIGNMENT_CURRENT_TO_DATE_MSG); + if (!assignment.getIsCurrentAssignment() && null == assignment.getToDate()) + errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_NON_CURRENT_TO_DATE_CODE, ErrorConstants.HRMS_INVALID_ASSIGNMENT_NON_CURRENT_TO_DATE_MSG); + if (null != assignment.getToDate() && assignment.getFromDate() > assignment.getToDate()) + errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_PERIOD_CODE, ErrorConstants.HRMS_INVALID_ASSIGNMENT_PERIOD_MSG); + if (employee.getUser().getDob() != null) + if (assignment.getFromDate() < employee.getUser().getDob() || (null != assignment.getToDate() && assignment.getToDate() < employee.getUser().getDob())) + errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_DATES_CODE, ErrorConstants.HRMS_INVALID_ASSIGNMENT_DATES_MSG); + if (null != employee.getDateOfAppointment() && assignment.getFromDate() < employee.getDateOfAppointment()) + errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_DATES_APPOINTMENT_CODE, ErrorConstants.HRMS_INVALID_ASSIGNMENT_DATES_APPOINTMENT_MSG); - } + } + } } @@ -559,7 +572,9 @@ public void validateUpdateEmployee(EmployeeRequest request) { Map> boundaryMap = getBoundaryList(request.getRequestInfo(),request.getEmployees().get(0)); Map> mdmsData = mdmsService.getMDMSData(request.getRequestInfo(), request.getEmployees().get(0).getTenantId()); List uuidList = request.getEmployees().stream().map(Employee :: getUuid).collect(Collectors.toList()); - EmployeeResponse existingEmployeeResponse = employeeService.search(EmployeeSearchCriteria.builder().uuids(uuidList).build(),request.getRequestInfo()); + EmployeeResponse existingEmployeeResponse = employeeService.search(EmployeeSearchCriteria.builder().uuids(uuidList) + .tenantId(request.getEmployees().get(0).getTenantId()) + .build(),request.getRequestInfo()); List existingEmployees = existingEmployeeResponse.getEmployees(); for(Employee employee: request.getEmployees()){ if(validateEmployeeForUpdate(employee, errorMap)){ @@ -634,15 +649,17 @@ private void validateConsistencyJurisdiction(Employee existingEmp, Employee upda * @param errorMap */ private void validateConsistencyAssignment(Employee existingEmp, Employee updatedEmployeeData, Map errorMap) { - boolean check = - updatedEmployeeData.getAssignments().stream() - .map(assignment -> assignment.getId()) - .collect(Collectors.toList()) - .containsAll(existingEmp.getAssignments().stream() - .map(assignment -> assignment.getId()) - .collect(Collectors.toList())); - if(!check){ - errorMap.put(ErrorConstants.HRMS_UPDATE_ASSIGNEMENT_INCOSISTENT_CODE, ErrorConstants.HRMS_UPDATE_ASSIGNEMENT_INCOSISTENT_MSG); + if (updatedEmployeeData.getAssignments() != null && existingEmp.getAssignments() != null) { + boolean check = + updatedEmployeeData.getAssignments().stream() + .map(assignment -> assignment.getId()) + .collect(Collectors.toList()) + .containsAll(existingEmp.getAssignments().stream() + .map(assignment -> assignment.getId()) + .collect(Collectors.toList())); + if (!check) { + errorMap.put(ErrorConstants.HRMS_UPDATE_ASSIGNEMENT_INCOSISTENT_CODE, ErrorConstants.HRMS_UPDATE_ASSIGNEMENT_INCOSISTENT_MSG); + } } } diff --git a/business-services/egov-hrms/src/main/resources/application.properties b/business-services/egov-hrms/src/main/resources/application.properties index 11600397ad1..76c55a599b6 100644 --- a/business-services/egov-hrms/src/main/resources/application.properties +++ b/business-services/egov-hrms/src/main/resources/application.properties @@ -23,6 +23,8 @@ server.port=9999 app.timezone=UTC #-------------------------- EXTERNAL API CONFIGURATIONS ---------------------------# + + egov.services.data_sync_employee.required = false @@ -59,6 +61,17 @@ egov.idgen.ack.name=hrms.employeecode egov.idgen.ack.format=EMP-[city]-[SEQ_EG_HRMS_EMP_CODE] +egov.individual.host=https://health-dev.digit.org +egov.individual.create.endpoint=/individual/v1/_create +egov.individual.update.endpoint=/individual/v1/_update +egov.individual.search.endpoint=/individual/v1/_search +egov.individual.delete.endpoint=/individual/v1/_delete + +# use qualifier as "defaultUserService" to integrate with egov-user module +# use qualifier as "individualService" to integrate with individual module +egov.hrms.user.service.qualifier=defaultUserService + + #user egov.hrms.employee.app.link=https://mseva.lgpunjab.gov.in/employee/user/login @@ -101,4 +114,6 @@ logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.S log4j.logger.org.springframework.jdbc.core = TRACE -state.level.tenant.id=pb \ No newline at end of file +state.level.tenant.id=default + +egov.hrms.auto.generate.password=true diff --git a/core-services/egov-enc-service/src/main/resources/application.properties b/core-services/egov-enc-service/src/main/resources/application.properties index 7d449b40375..5648999b581 100644 --- a/core-services/egov-enc-service/src/main/resources/application.properties +++ b/core-services/egov-enc-service/src/main/resources/application.properties @@ -47,7 +47,7 @@ master.initialvector=qweasdzxqwea type.to.method.map = {"Normal":"SYM","Imp":"ASY"} #----------------eGov MDMS----------------------# -egov.mdms.host=https://dev.digit.org +egov.mdms.host=http://egov-mdms-service:8080 egov.mdms.search.endpoint=/egov-mdms-service/v1/_search #----------State Level Tenant Id (for MDMS request)-----------# egov.state.level.tenant.id=pg diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/IndexerService.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/IndexerService.java index 8419866c88d..e471e1a2b7c 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/IndexerService.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/IndexerService.java @@ -61,6 +61,9 @@ public class IndexerService { @Value("${egov.infra.indexer.host}") private String esHostUrl; + @Value("${egov.infra.indexer.legacy.version}") + private Boolean isLegacyVersionES; + /** * Method that processes data according to the config and posts them to es. * @@ -123,7 +126,11 @@ public void indexProccessor(Index index, Mapping.ConfigKeyEnum configkey, String Long startTime = null; log.debug("index: " + index.getCustomJsonMapping()); StringBuilder url = new StringBuilder(); - url.append(esHostUrl).append(index.getName()).append("/").append(index.getType()).append("/").append("_bulk"); + if(this.isLegacyVersionES) { + url.append(esHostUrl).append(index.getName()).append("/").append(index.getType()).append("/").append("_bulk"); + } else { + url.append(esHostUrl).append(index.getName()).append("/").append("_bulk"); + } startTime = new Date().getTime(); String jsonToBeIndexed; if (null != index.getCustomJsonMapping()) { @@ -171,9 +178,14 @@ public void validateAndIndex(String finalJson, String url, Index index) throws E */ public void indexWithESId(Index index, String finalJson) throws Exception { StringBuilder urlForNonBulk = new StringBuilder(); - urlForNonBulk.append(esHostUrl).append(index.getName()).append("/").append(index.getType()).append("/") - .append("_index"); + if(this.isLegacyVersionES) { + urlForNonBulk.append(esHostUrl).append(index.getName()).append("/") + .append("_index"); + } else { + urlForNonBulk.append(esHostUrl).append(index.getName()).append("/").append(index.getType()).append("/") + .append("_index"); + } bulkIndexer.indexJsonOntoES(urlForNonBulk.toString(), finalJson, index); } -} \ No newline at end of file +} diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/LegacyIndexService.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/LegacyIndexService.java index cc4ff9d6c4a..204712ca5aa 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/LegacyIndexService.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/LegacyIndexService.java @@ -92,6 +92,10 @@ public class LegacyIndexService { @Value("${egov.core.index.thread.poll.ms}") private Long indexThreadPollInterval; + @Value("${egov.infra.indexer.legacy.version}") + private Boolean isLegacyVersionES; + + private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(5); private final ScheduledExecutorService schedulerofChildThreads = Executors.newScheduledThreadPool(1); @@ -106,7 +110,11 @@ public LegacyIndexResponse createLegacyindexJob(LegacyIndexRequest legacyindexRe LegacyIndexResponse legacyindexResponse = null; StringBuilder url = new StringBuilder(); Index index = mappingsMap.get(legacyindexRequest.getLegacyIndexTopic()).getIndexes().get(0); - url.append(esHostUrl).append(index.getName()).append("/").append(index.getType()).append("/_search"); + if(this.isLegacyVersionES) { + url.append(esHostUrl).append(index.getName()).append("/").append(index.getType()).append("/_search"); + } else { + url.append(esHostUrl).append(index.getName()).append("/_search"); + } legacyindexResponse = LegacyIndexResponse.builder() .message("Please hit the 'url' after the legacy index job is complete.").url(url.toString()) .responseInfo(factory.createResponseInfoFromRequestInfo(legacyindexRequest.getRequestInfo(), true)) diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/ReindexService.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/ReindexService.java index a6184bb0e19..aa4b549019b 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/ReindexService.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/ReindexService.java @@ -75,6 +75,9 @@ public class ReindexService { @Value("${egov.core.index.thread.poll.ms}") private Long indexThreadPollInterval; + @Value("${egov.infra.indexer.legacy.version}") + private Boolean isLegacyVersionES; + private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(5); private final ScheduledExecutorService schedulerofChildThreads = Executors.newScheduledThreadPool(1); @@ -94,7 +97,11 @@ public ReindexResponse createReindexJob(ReindexRequest reindexRequest) { Integer total = JsonPath.read(response, "$.hits.total"); StringBuilder url = new StringBuilder(); Index index = mappingsMap.get(reindexRequest.getReindexTopic()).getIndexes().get(0); - url.append(esHostUrl).append(index.getName()).append("/").append(index.getType()).append("/_search"); + if(this.isLegacyVersionES) { + url.append(esHostUrl).append(index.getName()).append("/").append(index.getType()).append("/_search"); + } else { + url.append(esHostUrl).append(index.getName()).append("/_search"); + } reindexResponse = ReindexResponse.builder().totalRecordsToBeIndexed(total) .estimatedTime(indexerUtils.fetchEstimatedTime(total)) .message("Please hit the 'url' for the newly indexed data after the mentioned 'estimated time'.") diff --git a/core-services/egov-indexer/src/main/resources/application.properties b/core-services/egov-indexer/src/main/resources/application.properties index e2ff5d5fad6..e74009bd65c 100644 --- a/core-services/egov-indexer/src/main/resources/application.properties +++ b/core-services/egov-indexer/src/main/resources/application.properties @@ -75,6 +75,9 @@ kafka.topics=save-service-db,update-service-db egov.indexer.es.cluster.name=elasticsearch egov.indexer.es.host.name=127.0.0.1 egov.indexer.es.port.no=9200 +egov.indexer.es.username=elastic +egov.indexer.es.password=elastic +egov.infra.indexer.legacy.version=false #....................................................................................# #.................................Internal Variables..................................# diff --git a/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/consumer/SmsNotificationListener.java b/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/consumer/SmsNotificationListener.java index 8a6ef09a461..67c1cbd5f3d 100644 --- a/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/consumer/SmsNotificationListener.java +++ b/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/consumer/SmsNotificationListener.java @@ -44,6 +44,9 @@ public class SmsNotificationListener { @Value("${kafka.topics.error.sms}") String errorSmsTopic; + @Value("${sms.enabled}") + Boolean smsEnable; + @Autowired public SmsNotificationListener( @@ -62,20 +65,26 @@ public void process(HashMap consumerRecord) { RequestContext.setId(UUID.randomUUID().toString()); SMSRequest request = null; try { - request = objectMapper.convertValue(consumerRecord, SMSRequest.class); - if (request.getExpiryTime() != null && request.getCategory() == Category.OTP) { - Long expiryTime = request.getExpiryTime(); - Long currentTime = System.currentTimeMillis(); - if (expiryTime < currentTime) { - log.info("OTP Expired"); - if (!StringUtils.isEmpty(expiredSmsTopic)) - kafkaTemplate.send(expiredSmsTopic, request); + if(!smsEnable){ + log.info("Sms service is disable to enable the notification service set the value of sms.enable flag as true"); + } + else{ + request = objectMapper.convertValue(consumerRecord, SMSRequest.class); + if (request.getExpiryTime() != null && request.getCategory() == Category.OTP) { + Long expiryTime = request.getExpiryTime(); + Long currentTime = System.currentTimeMillis(); + if (expiryTime < currentTime) { + log.info("OTP Expired"); + if (!StringUtils.isEmpty(expiredSmsTopic)) + kafkaTemplate.send(expiredSmsTopic, request); + } else { + smsService.sendSMS(request.toDomain()); + } } else { smsService.sendSMS(request.toDomain()); } - } else { - smsService.sendSMS(request.toDomain()); } + } catch (RestClientException rx) { log.info("Going to backup SMS Service", rx); if (!StringUtils.isEmpty(backupSmsTopic)) diff --git a/core-services/egov-notification-sms/src/main/resources/application.properties b/core-services/egov-notification-sms/src/main/resources/application.properties index 0ee50158591..13ee7e24e83 100644 --- a/core-services/egov-notification-sms/src/main/resources/application.properties +++ b/core-services/egov-notification-sms/src/main/resources/application.properties @@ -32,6 +32,7 @@ sms.enabled=true sms.config.map={'username':'$username', 'pin': '$password', 'signature':'$senderid', 'mnumber':'$mobileno', 'message':'$message', 'smsservicetype':'unicodemsg', 'myParam': '$extraParam' , 'messageType': '$mtype'} sms.category.map={'mtype': {'*': 'abc', 'OTP': 'def'}} sms.extra.config.map={'extraParam': 'abc'} +sms.enabled=false # this should be the name of class with first letter in small sms.url.dont_encode_url = true diff --git a/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java b/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java index 79a89c9b4a0..5841b13d209 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java +++ b/core-services/egov-user/src/main/java/org/egov/user/domain/service/UserService.java @@ -1,659 +1,659 @@ -package org.egov.user.domain.service; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectReader; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.node.ObjectNode; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.CustomException; -import org.egov.user.domain.exception.*; -import org.egov.user.domain.model.LoggedInUserUpdatePasswordRequest; -import org.egov.user.domain.model.NonLoggedInUserUpdatePasswordRequest; -import org.egov.user.domain.model.User; -import org.egov.user.domain.model.UserSearchCriteria; -import org.egov.user.domain.model.enums.UserType; -import org.egov.user.domain.service.utils.EncryptionDecryptionUtil; -import org.egov.user.domain.service.utils.NotificationUtil; -import org.egov.user.persistence.dto.FailedLoginAttempt; -import org.egov.user.persistence.repository.FileStoreRepository; -import org.egov.user.persistence.repository.OtpRepository; -import org.egov.user.persistence.repository.UserRepository; -import org.egov.user.web.contract.Otp; -import org.egov.user.web.contract.OtpValidateRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.security.crypto.password.PasswordEncoder; -import org.springframework.security.oauth2.common.OAuth2AccessToken; -import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; -import org.springframework.security.oauth2.provider.token.TokenStore; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.client.RestTemplate; - -import java.io.IOException; -import java.util.*; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -import static java.util.Objects.isNull; -import static org.apache.commons.lang3.StringUtils.isEmpty; -import static org.egov.user.config.UserServiceConstants.USER_CLIENT_ID; -import static org.springframework.util.CollectionUtils.isEmpty; - -@Service -@Slf4j -public class UserService { - - private UserRepository userRepository; - private OtpRepository otpRepository; - private PasswordEncoder passwordEncoder; - private int defaultPasswordExpiryInDays; - private boolean isCitizenLoginOtpBased; - private boolean isEmployeeLoginOtpBased; - private FileStoreRepository fileRepository; - private EncryptionDecryptionUtil encryptionDecryptionUtil; - private TokenStore tokenStore; - - @Value("${egov.user.host}") - private String userHost; - - @Value("${account.unlock.cool.down.period.minutes}") - private Long accountUnlockCoolDownPeriod; - - @Value("${max.invalid.login.attempts.period.minutes}") - private Long maxInvalidLoginAttemptsPeriod; - - @Value("${create.user.validate.name}") - private boolean createUserValidateName; - - @Value("${max.invalid.login.attempts}") - private Long maxInvalidLoginAttempts; - - - @Value("${egov.user.pwd.pattern}") - private String pwdRegex; - - @Value("${egov.user.pwd.pattern.min.length}") - private Integer pwdMinLength; - - @Value("${egov.user.pwd.pattern.max.length}") - private Integer pwdMaxLength; - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private NotificationUtil notificationUtil; - - public UserService(UserRepository userRepository, OtpRepository otpRepository, FileStoreRepository fileRepository, - PasswordEncoder passwordEncoder, EncryptionDecryptionUtil encryptionDecryptionUtil, TokenStore tokenStore, - @Value("${default.password.expiry.in.days}") int defaultPasswordExpiryInDays, - @Value("${citizen.login.password.otp.enabled}") boolean isCitizenLoginOtpBased, - @Value("${employee.login.password.otp.enabled}") boolean isEmployeeLoginOtpBased, - @Value("${egov.user.pwd.pattern}") String pwdRegex, - @Value("${egov.user.pwd.pattern.max.length}") Integer pwdMaxLength, - @Value("${egov.user.pwd.pattern.min.length}") Integer pwdMinLength) { - this.userRepository = userRepository; - this.otpRepository = otpRepository; - this.passwordEncoder = passwordEncoder; - this.defaultPasswordExpiryInDays = defaultPasswordExpiryInDays; - this.isCitizenLoginOtpBased = isCitizenLoginOtpBased; - this.isEmployeeLoginOtpBased = isEmployeeLoginOtpBased; - this.fileRepository = fileRepository; - this.encryptionDecryptionUtil = encryptionDecryptionUtil; - this.tokenStore = tokenStore; - this.pwdRegex = pwdRegex; - this.pwdMaxLength = pwdMaxLength; - this.pwdMinLength = pwdMinLength; - - } - - /** - * get user By UserName And TenantId - * - * @param userName - * @param tenantId - * @return - */ - public User getUniqueUser(String userName, String tenantId, UserType userType) { - - UserSearchCriteria userSearchCriteria = UserSearchCriteria.builder() - .userName(userName) - .tenantId(getStateLevelTenantForCitizen(tenantId, userType)) - .type(userType) - .build(); - - if (isEmpty(userName) || isEmpty(tenantId) || isNull(userType)) { - log.error("Invalid lookup, mandatory fields are absent"); - throw new UserNotFoundException(userSearchCriteria); - } - - /* encrypt here */ - - userSearchCriteria = encryptionDecryptionUtil.encryptObject(userSearchCriteria, "User", UserSearchCriteria.class); - List users = userRepository.findAll(userSearchCriteria); - - if (users.isEmpty()) - throw new UserNotFoundException(userSearchCriteria); - if (users.size() > 1) - throw new DuplicateUserNameException(userSearchCriteria); - - return users.get(0); - } - - public User getUserByUuid(String uuid) { - - UserSearchCriteria userSearchCriteria = UserSearchCriteria.builder() - .uuid(Collections.singletonList(uuid)) - .build(); - - if (isEmpty(uuid)) { - log.error("UUID is mandatory"); - throw new UserNotFoundException(userSearchCriteria); - } - - List users = userRepository.findAll(userSearchCriteria); - - if (users.isEmpty()) - throw new UserNotFoundException(userSearchCriteria); - return users.get(0); - } - - - /** - * get the users based on on userSearch criteria - * - * @param searchCriteria - * @return - */ - - public List searchUsers(UserSearchCriteria searchCriteria, - boolean isInterServiceCall, RequestInfo requestInfo) { - - searchCriteria.validate(isInterServiceCall); - - searchCriteria.setTenantId(getStateLevelTenantForCitizen(searchCriteria.getTenantId(), searchCriteria.getType())); - /* encrypt here / encrypted searchcriteria will be used for search*/ - - String altmobnumber=null; - - if(searchCriteria.getMobileNumber()!=null) { - altmobnumber = searchCriteria.getMobileNumber(); - } - - searchCriteria = encryptionDecryptionUtil.encryptObject(searchCriteria, "User", UserSearchCriteria.class); - - if(altmobnumber!=null) { - searchCriteria.setAlternatemobilenumber(altmobnumber); - } - - List list = userRepository.findAll(searchCriteria); - - /* decrypt here / final reponse decrypted*/ - - list = encryptionDecryptionUtil.decryptObject(list, null, User.class, requestInfo); - - setFileStoreUrlsByFileStoreIds(list); - return list; - } - - /** - * api will create the user based on some validations - * - * @param user - * @return - */ - public User createUser(User user, RequestInfo requestInfo) { - user.setUuid(UUID.randomUUID().toString()); - user.validateNewUser(createUserValidateName); - conditionallyValidateOtp(user); - /* encrypt here */ - user = encryptionDecryptionUtil.encryptObject(user, "User", User.class); - validateUserUniqueness(user); - if (isEmpty(user.getPassword())) { - user.setPassword(UUID.randomUUID().toString()); - } else { - validatePassword(user.getPassword()); - } - user.setPassword(encryptPwd(user.getPassword())); - user.setDefaultPasswordExpiry(defaultPasswordExpiryInDays); - user.setTenantId(getStateLevelTenantForCitizen(user.getTenantId(), user.getType())); - User persistedNewUser = persistNewUser(user); - return encryptionDecryptionUtil.decryptObject(persistedNewUser, "UserSelf", User.class, requestInfo); - - /* decrypt here because encrypted data coming from DB*/ - - } - - private void validateUserUniqueness(User user) { - if (userRepository.isUserPresent(user.getUsername(), getStateLevelTenantForCitizen(user.getTenantId(), user - .getType()), user.getType())) - throw new DuplicateUserNameException(UserSearchCriteria.builder().userName(user.getUsername()).type(user - .getType()).tenantId(user.getTenantId()).build()); - } - - private String getStateLevelTenantForCitizen(String tenantId, UserType userType) { - if (!isNull(userType) && userType.equals(UserType.CITIZEN) && !isEmpty(tenantId) && tenantId.contains(".")) - return tenantId.split("\\.")[0]; - else - return tenantId; - } - - /** - * api will create the citizen with otp - * - * @param user - * @return - */ - public User createCitizen(User user, RequestInfo requestInfo) { - validateAndEnrichCitizen(user); - return createUser(user, requestInfo); - } - - - private void validateAndEnrichCitizen(User user) { - log.info("Validating User........"); - if (isCitizenLoginOtpBased && !StringUtils.isNumeric(user.getUsername())) - throw new UserNameNotValidException(); - else if (isCitizenLoginOtpBased) - user.setMobileNumber(user.getUsername()); - if (!isCitizenLoginOtpBased) - validatePassword(user.getPassword()); - user.setRoleToCitizen(); - user.setTenantId(getStateLevelTenantForCitizen(user.getTenantId(), user.getType())); - } - - /** - * api will create the citizen with otp - * - * @param user - * @return - */ - public Object registerWithLogin(User user, RequestInfo requestInfo) { - user.setActive(true); - createCitizen(user, requestInfo); - return getAccess(user, user.getOtpReference()); - } - - private Object getAccess(User user, String password) { - log.info("Fetch access token for register with login flow"); - try { - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - headers.set("Authorization", "Basic ZWdvdi11c2VyLWNsaWVudDo="); - MultiValueMap map = new LinkedMultiValueMap<>(); - map.add("username", user.getUsername()); - if (!isEmpty(password)) - map.add("password", password); - else - map.add("password", user.getPassword()); - map.add("grant_type", "password"); - map.add("scope", "read"); - map.add("tenantId", user.getTenantId()); - map.add("isInternal", "true"); - map.add("userType", UserType.CITIZEN.name()); - - HttpEntity> request = new HttpEntity>(map, - headers); - return restTemplate.postForEntity(userHost + "/user/oauth/token", request, Map.class).getBody(); - - } catch (Exception e) { - log.error("Error occurred while logging-in via register flow", e); - throw new CustomException("LOGIN_ERROR", "Error occurred while logging in via register flow: " + e.getMessage()); - } - } - - /** - * dependent on otpValidationMandatory filed,it will validate the otp. - * - * @param user - */ - private void conditionallyValidateOtp(User user) { - if (user.isOtpValidationMandatory()) { - if (!validateOtp(user)) - throw new OtpValidationPendingException(); - } - } - - /** - * This api will validate the otp - * - * @param user - * @return - */ - public Boolean validateOtp(User user) { - Otp otp = Otp.builder().otp(user.getOtpReference()).identity(user.getMobileNumber()).tenantId(user.getTenantId()) - .userType(user.getType()).build(); - RequestInfo requestInfo = RequestInfo.builder().action("validate").ts(System.currentTimeMillis()).build(); - OtpValidateRequest otpValidationRequest = OtpValidateRequest.builder().requestInfo(requestInfo).otp(otp) - .build(); - return otpRepository.validateOtp(otpValidationRequest); - - } - - - /** - * api will update user details without otp - * - * @param user - * @return - */ - // TODO Fix date formats - public User updateWithoutOtpValidation(User user, RequestInfo requestInfo) { - final User existingUser = getUserByUuid(user.getUuid()); - user.setTenantId(getStateLevelTenantForCitizen(user.getTenantId(), user.getType())); - validateUserRoles(user); - user.validateUserModification(); - validatePassword(user.getPassword()); - user.setPassword(encryptPwd(user.getPassword())); - /* encrypt */ - user = encryptionDecryptionUtil.encryptObject(user, "User", User.class); - userRepository.update(user, existingUser,requestInfo.getUserInfo().getId(), requestInfo.getUserInfo().getUuid() ); - - // If user is being unlocked via update, reset failed login attempts - if (user.getAccountLocked() != null && !user.getAccountLocked() && existingUser.getAccountLocked()) - resetFailedLoginAttempts(user); - - User encryptedUpdatedUserfromDB = getUserByUuid(user.getUuid()); - User decryptedupdatedUserfromDB = encryptionDecryptionUtil.decryptObject(encryptedUpdatedUserfromDB, "UserSelf", User.class, requestInfo); - return decryptedupdatedUserfromDB; - } - - public void removeTokensByUser(User user) { - Collection tokens = tokenStore.findTokensByClientIdAndUserName(USER_CLIENT_ID, - user.getUsername()); - - for (OAuth2AccessToken token : tokens) { - if (token.getAdditionalInformation() != null && token.getAdditionalInformation().containsKey("UserRequest")) { - if (token.getAdditionalInformation().get("UserRequest") instanceof org.egov.user.web.contract.auth.User) { - org.egov.user.web.contract.auth.User userInfo = - (org.egov.user.web.contract.auth.User) token.getAdditionalInformation().get( - "UserRequest"); - if (user.getUsername().equalsIgnoreCase(userInfo.getUserName()) && user.getTenantId().equalsIgnoreCase(userInfo.getTenantId()) - && user.getType().equals(UserType.fromValue(userInfo.getType()))) - tokenStore.removeAccessToken(token); - } - } - } - - } - - /** - * this api will validate whether user roles exist in Database or not - * - * @param user - */ - private void validateUserRoles(User user) { - if (user.getRoles() == null || user.getRoles() != null && user.getRoles().isEmpty()) { - throw new AtleastOneRoleCodeException(); - } - } - - /** - * this api will update user profile data except these fields userName , - * mobileNumber type , password ,pwsExpiryData, roles - * - * @param user - * @return - */ - public User partialUpdate(User user, RequestInfo requestInfo) { - /* encrypt here */ - user = encryptionDecryptionUtil.encryptObject(user, "User", User.class); - - User existingUser = getUserByUuid(user.getUuid()); - validateProfileUpdateIsDoneByTheSameLoggedInUser(user); - user.nullifySensitiveFields(); - validatePassword(user.getPassword()); - userRepository.update(user, existingUser,requestInfo.getUserInfo().getId(), requestInfo.getUserInfo().getUuid() ); - User updatedUser = getUserByUuid(user.getUuid()); - - /* decrypt here */ - existingUser = encryptionDecryptionUtil.decryptObject(existingUser, "UserSelf", User.class, requestInfo); - updatedUser = encryptionDecryptionUtil.decryptObject(updatedUser, "UserSelf", User.class, requestInfo); - - setFileStoreUrlsByFileStoreIds(Collections.singletonList(updatedUser)); - String oldEmail = existingUser.getEmailId(); - String newEmail = updatedUser.getEmailId(); - if((oldEmail != null && !oldEmail.isEmpty()) && newEmail != null && !(newEmail.equalsIgnoreCase(oldEmail))) { - // Sending sms and email to old email to notify that email has been changed - notificationUtil.sendEmail(requestInfo, existingUser, updatedUser); - } - return updatedUser; - } - - /** - * This api will update the password for logged-in user - * - * @param updatePasswordRequest - */ - public void updatePasswordForLoggedInUser(LoggedInUserUpdatePasswordRequest updatePasswordRequest) { - updatePasswordRequest.validate(); - final User user = getUniqueUser(updatePasswordRequest.getUserName(), updatePasswordRequest.getTenantId(), - updatePasswordRequest.getType()); - - if (user.getType().toString().equals(UserType.CITIZEN.toString()) && isCitizenLoginOtpBased) - throw new InvalidUpdatePasswordRequestException(); - if (user.getType().toString().equals(UserType.EMPLOYEE.toString()) && isEmployeeLoginOtpBased) - throw new InvalidUpdatePasswordRequestException(); - - validateExistingPassword(user, updatePasswordRequest.getExistingPassword()); - validatePassword(updatePasswordRequest.getNewPassword()); - user.updatePassword(encryptPwd(updatePasswordRequest.getNewPassword())); - userRepository.update(user, user, user.getId() , user.getUuid()); - } - - /** - * This Api will update the password for non logged-in user - * - * @param request - */ - public void updatePasswordForNonLoggedInUser(NonLoggedInUserUpdatePasswordRequest request, RequestInfo requestInfo) { - request.validate(); - // validateOtp(request.getOtpValidationRequest()); - User user = getUniqueUser(request.getUserName(), request.getTenantId(), request.getType()); - if (user.getType().toString().equals(UserType.CITIZEN.toString()) && isCitizenLoginOtpBased) { - log.info("CITIZEN forgot password flow is disabled"); - throw new InvalidUpdatePasswordRequestException(); - } - if (user.getType().toString().equals(UserType.EMPLOYEE.toString()) && isEmployeeLoginOtpBased) { - log.info("EMPLOYEE forgot password flow is disabled"); - throw new InvalidUpdatePasswordRequestException(); - } - /* decrypt here */ - /* the reason for decryption here is the otp service requires decrypted username */ - user = encryptionDecryptionUtil.decryptObject(user, "User", User.class, requestInfo); - user.setOtpReference(request.getOtpReference()); - validateOtp(user); - validatePassword(request.getNewPassword()); - user.updatePassword(encryptPwd(request.getNewPassword())); - /* encrypt here */ - /* encrypted value is stored in DB*/ - user = encryptionDecryptionUtil.encryptObject(user, "User", User.class); - userRepository.update(user, user,user.getId()!=null?user.getId():0 , user.getUuid()!=null?user.getUuid():"NA"); - } - - - /** - * Deactivate failed login attempts for provided user - * - * @param user whose failed login attempts are to be reset - */ - public void resetFailedLoginAttempts(User user) { - if (user.getUuid() != null) - userRepository.resetFailedLoginAttemptsForUser(user.getUuid()); - } - - /** - * Checks if user is eligible for unlock - * returns true, - * - If configured cool down period has passed since last lock - * else false - * - * @param user to be checked for eligibility for unlock - * @return if unlock able - */ - public boolean isAccountUnlockAble(User user) { - if (user.getAccountLocked()) { - boolean unlockAble = - System.currentTimeMillis() - user.getAccountLockedDate() > TimeUnit.MINUTES.toMillis(accountUnlockCoolDownPeriod); - - log.info("Account eligible for unlock - " + unlockAble); - log.info("Current time {}, last lock time {} , cool down period {} ", System.currentTimeMillis(), - user.getAccountLockedDate(), TimeUnit.MINUTES.toMillis(accountUnlockCoolDownPeriod)); - return unlockAble; - } else - return true; - } - - /** - * Perform actions where a user login fails - * - Fetch existing failed login attempts within configured time - * period{@link UserService#maxInvalidLoginAttemptsPeriod} - * - If failed login attempts exceeds configured {@link UserService#maxInvalidLoginAttempts} - * - then lock account - * - Add failed login attempt entry to repository - * - * @param user user whose failed login attempt to be handled - * @param ipAddress IP address of remote - */ - public void handleFailedLogin(User user, String ipAddress, RequestInfo requestInfo) { - if (!Objects.isNull(user.getUuid())) { - List failedLoginAttempts = - userRepository.fetchFailedAttemptsByUserAndTime(user.getUuid(), - System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(maxInvalidLoginAttemptsPeriod)); - - if (failedLoginAttempts.size() + 1 >= maxInvalidLoginAttempts) { - User userToBeUpdated = user.toBuilder() - .accountLocked(true) - .password(null) - .accountLockedDate(System.currentTimeMillis()) - .build(); - - user = updateWithoutOtpValidation(userToBeUpdated, requestInfo); - removeTokensByUser(user); - log.info("Locked account with uuid {} for {} minutes as exceeded max allowed attempts of {} within {} " + - "minutes", - user.getUuid(), accountUnlockCoolDownPeriod, maxInvalidLoginAttempts, maxInvalidLoginAttemptsPeriod); - throw new OAuth2Exception("Account locked"); - } - - userRepository.insertFailedLoginAttempt(new FailedLoginAttempt(user.getUuid(), ipAddress, - System.currentTimeMillis(), true)); - } - } - - - /** - * This api will validate existing password and current password matching or - * not - * - * @param user - * @param existingRawPassword - */ - private void validateExistingPassword(User user, String existingRawPassword) { - if (!passwordEncoder.matches(existingRawPassword, user.getPassword())) { - throw new PasswordMismatchException("Invalid username or password"); - } - } - -// /** -// * this api will check user is exist or not, If not exist it will throw -// * exception. -// * -// * @param user -// */ -// private void validateUserPresent(User user) { -// if (user == null) { -// throw new UserNotFoundException(null); -// } -// } - - /** - * this api will validate, updating the profile for same logged-in user or - * not - * - * @param user - */ - private void validateProfileUpdateIsDoneByTheSameLoggedInUser(User user) { - if (user.isLoggedInUserDifferentFromUpdatedUser()) { - throw new UserProfileUpdateDeniedException(); - } - } - - - String encryptPwd(String pwd) { - if (!isNull(pwd)) - return passwordEncoder.encode(pwd); - else - return null; - } - - /** - * This api will persist the user - * - * @param user - * @return - */ - private User persistNewUser(User user) { - - return userRepository.create(user); - } - - /** - * This api will fetch the fileStoreUrl By fileStoreId - * - * @param userList - * @throws Exception - */ - private void setFileStoreUrlsByFileStoreIds(List userList) { - List fileStoreIds = userList.parallelStream().filter(p -> p.getPhoto() != null).map(User::getPhoto) - .collect(Collectors.toList()); - if (!isEmpty(fileStoreIds)) { - Map fileStoreUrlList = null; - try { - fileStoreUrlList = fileRepository.getUrlByFileStoreId(userList.get(0).getTenantId(), fileStoreIds); - } catch (Exception e) { - // TODO Auto-generated catch block - - log.error("Error while fetching fileStore url list: " + e.getMessage()); - } - - if (fileStoreUrlList != null && !fileStoreUrlList.isEmpty()) { - for (User user : userList) { - user.setPhoto(fileStoreUrlList.get(user.getPhoto())); - } - } - } - } - - - public void validatePassword(String password) { - Map errorMap = new HashMap<>(); - if (!StringUtils.isEmpty(password)) { - if (password.length() < pwdMinLength || password.length() > pwdMaxLength) - errorMap.put("INVALID_PWD_LENGTH", "Password must be of minimum: " + pwdMinLength + " and maximum: " + pwdMaxLength + " characters."); - Pattern p = Pattern.compile(pwdRegex); - Matcher m = p.matcher(password); - if (!m.find()) { - errorMap.put("INVALID_PWD_PATTERN", "Password MUST HAVE: Atleast one digit, one upper case, one lower case, one special character (@#$%) and MUST NOT contain any spaces"); - } - } - if (!CollectionUtils.isEmpty(errorMap.keySet())) { - throw new CustomException(errorMap); - } - } - - -} +package org.egov.user.domain.service; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectReader; +import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.databind.node.ObjectNode; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.egov.common.contract.request.RequestInfo; +import org.egov.tracer.model.CustomException; +import org.egov.user.domain.exception.*; +import org.egov.user.domain.model.LoggedInUserUpdatePasswordRequest; +import org.egov.user.domain.model.NonLoggedInUserUpdatePasswordRequest; +import org.egov.user.domain.model.User; +import org.egov.user.domain.model.UserSearchCriteria; +import org.egov.user.domain.model.enums.UserType; +import org.egov.user.domain.service.utils.EncryptionDecryptionUtil; +import org.egov.user.domain.service.utils.NotificationUtil; +import org.egov.user.persistence.dto.FailedLoginAttempt; +import org.egov.user.persistence.repository.FileStoreRepository; +import org.egov.user.persistence.repository.OtpRepository; +import org.egov.user.persistence.repository.UserRepository; +import org.egov.user.web.contract.Otp; +import org.egov.user.web.contract.OtpValidateRequest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.oauth2.common.OAuth2AccessToken; +import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; +import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +import java.io.IOException; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import static java.util.Objects.isNull; +import static org.apache.commons.lang3.StringUtils.isEmpty; +import static org.egov.user.config.UserServiceConstants.USER_CLIENT_ID; +import static org.springframework.util.CollectionUtils.isEmpty; + +@Service +@Slf4j +public class UserService { + + private UserRepository userRepository; + private OtpRepository otpRepository; + private PasswordEncoder passwordEncoder; + private int defaultPasswordExpiryInDays; + private boolean isCitizenLoginOtpBased; + private boolean isEmployeeLoginOtpBased; + private FileStoreRepository fileRepository; + private EncryptionDecryptionUtil encryptionDecryptionUtil; + private TokenStore tokenStore; + + @Value("${egov.user.host}") + private String userHost; + + @Value("${account.unlock.cool.down.period.minutes}") + private Long accountUnlockCoolDownPeriod; + + @Value("${max.invalid.login.attempts.period.minutes}") + private Long maxInvalidLoginAttemptsPeriod; + + @Value("${create.user.validate.name}") + private boolean createUserValidateName; + + @Value("${max.invalid.login.attempts}") + private Long maxInvalidLoginAttempts; + + + @Value("${egov.user.pwd.pattern}") + private String pwdRegex; + + @Value("${egov.user.pwd.pattern.min.length}") + private Integer pwdMinLength; + + @Value("${egov.user.pwd.pattern.max.length}") + private Integer pwdMaxLength; + + @Autowired + private RestTemplate restTemplate; + + @Autowired + private NotificationUtil notificationUtil; + + public UserService(UserRepository userRepository, OtpRepository otpRepository, FileStoreRepository fileRepository, + PasswordEncoder passwordEncoder, EncryptionDecryptionUtil encryptionDecryptionUtil, TokenStore tokenStore, + @Value("${default.password.expiry.in.days}") int defaultPasswordExpiryInDays, + @Value("${citizen.login.password.otp.enabled}") boolean isCitizenLoginOtpBased, + @Value("${employee.login.password.otp.enabled}") boolean isEmployeeLoginOtpBased, + @Value("${egov.user.pwd.pattern}") String pwdRegex, + @Value("${egov.user.pwd.pattern.max.length}") Integer pwdMaxLength, + @Value("${egov.user.pwd.pattern.min.length}") Integer pwdMinLength) { + this.userRepository = userRepository; + this.otpRepository = otpRepository; + this.passwordEncoder = passwordEncoder; + this.defaultPasswordExpiryInDays = defaultPasswordExpiryInDays; + this.isCitizenLoginOtpBased = isCitizenLoginOtpBased; + this.isEmployeeLoginOtpBased = isEmployeeLoginOtpBased; + this.fileRepository = fileRepository; + this.encryptionDecryptionUtil = encryptionDecryptionUtil; + this.tokenStore = tokenStore; + this.pwdRegex = pwdRegex; + this.pwdMaxLength = pwdMaxLength; + this.pwdMinLength = pwdMinLength; + + } + + /** + * get user By UserName And TenantId + * + * @param userName + * @param tenantId + * @return + */ + public User getUniqueUser(String userName, String tenantId, UserType userType) { + + UserSearchCriteria userSearchCriteria = UserSearchCriteria.builder() + .userName(userName) + .tenantId(getStateLevelTenantForCitizen(tenantId, userType)) + .type(userType) + .build(); + + if (isEmpty(userName) || isEmpty(tenantId) || isNull(userType)) { + log.error("Invalid lookup, mandatory fields are absent"); + throw new UserNotFoundException(userSearchCriteria); + } + + /* encrypt here */ + + userSearchCriteria = encryptionDecryptionUtil.encryptObject(userSearchCriteria, "User", UserSearchCriteria.class); + List users = userRepository.findAll(userSearchCriteria); + + if (users.isEmpty()) + throw new UserNotFoundException(userSearchCriteria); + if (users.size() > 1) + throw new DuplicateUserNameException(userSearchCriteria); + + return users.get(0); + } + + public User getUserByUuid(String uuid) { + + UserSearchCriteria userSearchCriteria = UserSearchCriteria.builder() + .uuid(Collections.singletonList(uuid)) + .build(); + + if (isEmpty(uuid)) { + log.error("UUID is mandatory"); + throw new UserNotFoundException(userSearchCriteria); + } + + List users = userRepository.findAll(userSearchCriteria); + + if (users.isEmpty()) + throw new UserNotFoundException(userSearchCriteria); + return users.get(0); + } + + + /** + * get the users based on on userSearch criteria + * + * @param searchCriteria + * @return + */ + + public List searchUsers(UserSearchCriteria searchCriteria, + boolean isInterServiceCall, RequestInfo requestInfo) { + + searchCriteria.validate(isInterServiceCall); + + searchCriteria.setTenantId(getStateLevelTenantForCitizen(searchCriteria.getTenantId(), searchCriteria.getType())); + /* encrypt here / encrypted searchcriteria will be used for search*/ + + String altmobnumber=null; + + if(searchCriteria.getMobileNumber()!=null) { + altmobnumber = searchCriteria.getMobileNumber(); + } + + searchCriteria = encryptionDecryptionUtil.encryptObject(searchCriteria, "User", UserSearchCriteria.class); + + if(altmobnumber!=null) { + searchCriteria.setAlternatemobilenumber(altmobnumber); + } + + List list = userRepository.findAll(searchCriteria); + + /* decrypt here / final reponse decrypted*/ + + list = encryptionDecryptionUtil.decryptObject(list, null, User.class, requestInfo); + + setFileStoreUrlsByFileStoreIds(list); + return list; + } + + /** + * api will create the user based on some validations + * + * @param user + * @return + */ + public User createUser(User user, RequestInfo requestInfo) { + user.setUuid(UUID.randomUUID().toString()); + user.validateNewUser(createUserValidateName); + conditionallyValidateOtp(user); + /* encrypt here */ + user = encryptionDecryptionUtil.encryptObject(user, "User", User.class); + validateUserUniqueness(user); + if (isEmpty(user.getPassword())) { + user.setPassword(UUID.randomUUID().toString()); + } else { + validatePassword(user.getPassword()); + } + user.setPassword(encryptPwd(user.getPassword())); + user.setDefaultPasswordExpiry(defaultPasswordExpiryInDays); + user.setTenantId(getStateLevelTenantForCitizen(user.getTenantId(), user.getType())); + User persistedNewUser = persistNewUser(user); + return encryptionDecryptionUtil.decryptObject(persistedNewUser, "UserSelf", User.class, requestInfo); + + /* decrypt here because encrypted data coming from DB*/ + + } + + private void validateUserUniqueness(User user) { + if (userRepository.isUserPresent(user.getUsername(), getStateLevelTenantForCitizen(user.getTenantId(), user + .getType()), user.getType())) + throw new DuplicateUserNameException(UserSearchCriteria.builder().userName(user.getUsername()).type(user + .getType()).tenantId(user.getTenantId()).build()); + } + + private String getStateLevelTenantForCitizen(String tenantId, UserType userType) { + if (!isNull(userType) && userType.equals(UserType.CITIZEN) && !isEmpty(tenantId) && tenantId.contains(".")) + return tenantId.split("\\.")[0]; + else + return tenantId; + } + + /** + * api will create the citizen with otp + * + * @param user + * @return + */ + public User createCitizen(User user, RequestInfo requestInfo) { + validateAndEnrichCitizen(user); + return createUser(user, requestInfo); + } + + + private void validateAndEnrichCitizen(User user) { + log.info("Validating User........"); + if (isCitizenLoginOtpBased && !StringUtils.isNumeric(user.getUsername())) + throw new UserNameNotValidException(); + else if (isCitizenLoginOtpBased) + user.setMobileNumber(user.getUsername()); + if (!isCitizenLoginOtpBased) + validatePassword(user.getPassword()); + user.setRoleToCitizen(); + user.setTenantId(getStateLevelTenantForCitizen(user.getTenantId(), user.getType())); + } + + /** + * api will create the citizen with otp + * + * @param user + * @return + */ + public Object registerWithLogin(User user, RequestInfo requestInfo) { + user.setActive(true); + createCitizen(user, requestInfo); + return getAccess(user, user.getOtpReference()); + } + + private Object getAccess(User user, String password) { + log.info("Fetch access token for register with login flow"); + try { + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + headers.set("Authorization", "Basic ZWdvdi11c2VyLWNsaWVudDo="); + MultiValueMap map = new LinkedMultiValueMap<>(); + map.add("username", user.getUsername()); + if (!isEmpty(password)) + map.add("password", password); + else + map.add("password", user.getPassword()); + map.add("grant_type", "password"); + map.add("scope", "read"); + map.add("tenantId", user.getTenantId()); + map.add("isInternal", "true"); + map.add("userType", UserType.CITIZEN.name()); + + HttpEntity> request = new HttpEntity>(map, + headers); + return restTemplate.postForEntity(userHost + "/user/oauth/token", request, Map.class).getBody(); + + } catch (Exception e) { + log.error("Error occurred while logging-in via register flow", e); + throw new CustomException("LOGIN_ERROR", "Error occurred while logging in via register flow: " + e.getMessage()); + } + } + + /** + * dependent on otpValidationMandatory filed,it will validate the otp. + * + * @param user + */ + private void conditionallyValidateOtp(User user) { + if (user.isOtpValidationMandatory()) { + if (!validateOtp(user)) + throw new OtpValidationPendingException(); + } + } + + /** + * This api will validate the otp + * + * @param user + * @return + */ + public Boolean validateOtp(User user) { + Otp otp = Otp.builder().otp(user.getOtpReference()).identity(user.getMobileNumber()).tenantId(user.getTenantId()) + .userType(user.getType()).build(); + RequestInfo requestInfo = RequestInfo.builder().action("validate").ts(System.currentTimeMillis()).build(); + OtpValidateRequest otpValidationRequest = OtpValidateRequest.builder().requestInfo(requestInfo).otp(otp) + .build(); + return otpRepository.validateOtp(otpValidationRequest); + + } + + + /** + * api will update user details without otp + * + * @param user + * @return + */ + // TODO Fix date formats + public User updateWithoutOtpValidation(User user, RequestInfo requestInfo) { + final User existingUser = getUserByUuid(user.getUuid()); + user.setTenantId(getStateLevelTenantForCitizen(user.getTenantId(), user.getType())); + validateUserRoles(user); + user.validateUserModification(); + validatePassword(user.getPassword()); + user.setPassword(encryptPwd(user.getPassword())); + /* encrypt */ + user = encryptionDecryptionUtil.encryptObject(user, "User", User.class); + userRepository.update(user, existingUser,requestInfo.getUserInfo().getId(), requestInfo.getUserInfo().getUuid() ); + + // If user is being unlocked via update, reset failed login attempts + if (user.getAccountLocked() != null && !user.getAccountLocked() && existingUser.getAccountLocked()) + resetFailedLoginAttempts(user); + + User encryptedUpdatedUserfromDB = getUserByUuid(user.getUuid()); + User decryptedupdatedUserfromDB = encryptionDecryptionUtil.decryptObject(encryptedUpdatedUserfromDB, "UserSelf", User.class, requestInfo); + return decryptedupdatedUserfromDB; + } + + public void removeTokensByUser(User user) { + Collection tokens = tokenStore.findTokensByClientIdAndUserName(USER_CLIENT_ID, + user.getUsername()); + + for (OAuth2AccessToken token : tokens) { + if (token.getAdditionalInformation() != null && token.getAdditionalInformation().containsKey("UserRequest")) { + if (token.getAdditionalInformation().get("UserRequest") instanceof org.egov.user.web.contract.auth.User) { + org.egov.user.web.contract.auth.User userInfo = + (org.egov.user.web.contract.auth.User) token.getAdditionalInformation().get( + "UserRequest"); + if (user.getUsername().equalsIgnoreCase(userInfo.getUserName()) && user.getTenantId().equalsIgnoreCase(userInfo.getTenantId()) + && user.getType().equals(UserType.fromValue(userInfo.getType()))) + tokenStore.removeAccessToken(token); + } + } + } + + } + + /** + * this api will validate whether user roles exist in Database or not + * + * @param user + */ + private void validateUserRoles(User user) { + if (user.getRoles() == null || user.getRoles() != null && user.getRoles().isEmpty()) { + throw new AtleastOneRoleCodeException(); + } + } + + /** + * this api will update user profile data except these fields userName , + * mobileNumber type , password ,pwsExpiryData, roles + * + * @param user + * @return + */ + public User partialUpdate(User user, RequestInfo requestInfo) { + /* encrypt here */ + user = encryptionDecryptionUtil.encryptObject(user, "User", User.class); + + User existingUser = getUserByUuid(user.getUuid()); + validateProfileUpdateIsDoneByTheSameLoggedInUser(user); + user.nullifySensitiveFields(); + validatePassword(user.getPassword()); + userRepository.update(user, existingUser,requestInfo.getUserInfo().getId(), requestInfo.getUserInfo().getUuid() ); + User updatedUser = getUserByUuid(user.getUuid()); + + /* decrypt here */ + existingUser = encryptionDecryptionUtil.decryptObject(existingUser, "UserSelf", User.class, requestInfo); + updatedUser = encryptionDecryptionUtil.decryptObject(updatedUser, "UserSelf", User.class, requestInfo); + + setFileStoreUrlsByFileStoreIds(Collections.singletonList(updatedUser)); + String oldEmail = existingUser.getEmailId(); + String newEmail = updatedUser.getEmailId(); + if((oldEmail != null && !oldEmail.isEmpty()) && newEmail != null && !(newEmail.equalsIgnoreCase(oldEmail))) { + // Sending sms and email to old email to notify that email has been changed + notificationUtil.sendEmail(requestInfo, existingUser, updatedUser); + } + return updatedUser; + } + + /** + * This api will update the password for logged-in user + * + * @param updatePasswordRequest + */ + public void updatePasswordForLoggedInUser(LoggedInUserUpdatePasswordRequest updatePasswordRequest) { + updatePasswordRequest.validate(); + final User user = getUniqueUser(updatePasswordRequest.getUserName(), updatePasswordRequest.getTenantId(), + updatePasswordRequest.getType()); + + if (user.getType().toString().equals(UserType.CITIZEN.toString()) && isCitizenLoginOtpBased) + throw new InvalidUpdatePasswordRequestException(); + if (user.getType().toString().equals(UserType.EMPLOYEE.toString()) && isEmployeeLoginOtpBased) + throw new InvalidUpdatePasswordRequestException(); + + validateExistingPassword(user, updatePasswordRequest.getExistingPassword()); + validatePassword(updatePasswordRequest.getNewPassword()); + user.updatePassword(encryptPwd(updatePasswordRequest.getNewPassword())); + userRepository.update(user, user, user.getId() , user.getUuid()); + } + + /** + * This Api will update the password for non logged-in user + * + * @param request + */ + public void updatePasswordForNonLoggedInUser(NonLoggedInUserUpdatePasswordRequest request, RequestInfo requestInfo) { + request.validate(); + // validateOtp(request.getOtpValidationRequest()); + User user = getUniqueUser(request.getUserName(), request.getTenantId(), request.getType()); + if (user.getType().toString().equals(UserType.CITIZEN.toString()) && isCitizenLoginOtpBased) { + log.info("CITIZEN forgot password flow is disabled"); + throw new InvalidUpdatePasswordRequestException(); + } + if (user.getType().toString().equals(UserType.EMPLOYEE.toString()) && isEmployeeLoginOtpBased) { + log.info("EMPLOYEE forgot password flow is disabled"); + throw new InvalidUpdatePasswordRequestException(); + } + /* decrypt here */ + /* the reason for decryption here is the otp service requires decrypted username */ + user = encryptionDecryptionUtil.decryptObject(user, "User", User.class, requestInfo); + user.setOtpReference(request.getOtpReference()); + validateOtp(user); + validatePassword(request.getNewPassword()); + user.updatePassword(encryptPwd(request.getNewPassword())); + /* encrypt here */ + /* encrypted value is stored in DB*/ + user = encryptionDecryptionUtil.encryptObject(user, "User", User.class); + userRepository.update(user, user, requestInfo.getUserInfo().getId(), requestInfo.getUserInfo().getUuid()); + } + + + /** + * Deactivate failed login attempts for provided user + * + * @param user whose failed login attempts are to be reset + */ + public void resetFailedLoginAttempts(User user) { + if (user.getUuid() != null) + userRepository.resetFailedLoginAttemptsForUser(user.getUuid()); + } + + /** + * Checks if user is eligible for unlock + * returns true, + * - If configured cool down period has passed since last lock + * else false + * + * @param user to be checked for eligibility for unlock + * @return if unlock able + */ + public boolean isAccountUnlockAble(User user) { + if (user.getAccountLocked()) { + boolean unlockAble = + System.currentTimeMillis() - user.getAccountLockedDate() > TimeUnit.MINUTES.toMillis(accountUnlockCoolDownPeriod); + + log.info("Account eligible for unlock - " + unlockAble); + log.info("Current time {}, last lock time {} , cool down period {} ", System.currentTimeMillis(), + user.getAccountLockedDate(), TimeUnit.MINUTES.toMillis(accountUnlockCoolDownPeriod)); + return unlockAble; + } else + return true; + } + + /** + * Perform actions where a user login fails + * - Fetch existing failed login attempts within configured time + * period{@link UserService#maxInvalidLoginAttemptsPeriod} + * - If failed login attempts exceeds configured {@link UserService#maxInvalidLoginAttempts} + * - then lock account + * - Add failed login attempt entry to repository + * + * @param user user whose failed login attempt to be handled + * @param ipAddress IP address of remote + */ + public void handleFailedLogin(User user, String ipAddress, RequestInfo requestInfo) { + if (!Objects.isNull(user.getUuid())) { + List failedLoginAttempts = + userRepository.fetchFailedAttemptsByUserAndTime(user.getUuid(), + System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(maxInvalidLoginAttemptsPeriod)); + + if (failedLoginAttempts.size() + 1 >= maxInvalidLoginAttempts) { + User userToBeUpdated = user.toBuilder() + .accountLocked(true) + .password(null) + .accountLockedDate(System.currentTimeMillis()) + .build(); + + user = updateWithoutOtpValidation(userToBeUpdated, requestInfo); + removeTokensByUser(user); + log.info("Locked account with uuid {} for {} minutes as exceeded max allowed attempts of {} within {} " + + "minutes", + user.getUuid(), accountUnlockCoolDownPeriod, maxInvalidLoginAttempts, maxInvalidLoginAttemptsPeriod); + throw new OAuth2Exception("Account locked"); + } + + userRepository.insertFailedLoginAttempt(new FailedLoginAttempt(user.getUuid(), ipAddress, + System.currentTimeMillis(), true)); + } + } + + + /** + * This api will validate existing password and current password matching or + * not + * + * @param user + * @param existingRawPassword + */ + private void validateExistingPassword(User user, String existingRawPassword) { + if (!passwordEncoder.matches(existingRawPassword, user.getPassword())) { + throw new PasswordMismatchException("Invalid username or password"); + } + } + +// /** +// * this api will check user is exist or not, If not exist it will throw +// * exception. +// * +// * @param user +// */ +// private void validateUserPresent(User user) { +// if (user == null) { +// throw new UserNotFoundException(null); +// } +// } + + /** + * this api will validate, updating the profile for same logged-in user or + * not + * + * @param user + */ + private void validateProfileUpdateIsDoneByTheSameLoggedInUser(User user) { + if (user.isLoggedInUserDifferentFromUpdatedUser()) { + throw new UserProfileUpdateDeniedException(); + } + } + + + String encryptPwd(String pwd) { + if (!isNull(pwd)) + return passwordEncoder.encode(pwd); + else + return null; + } + + /** + * This api will persist the user + * + * @param user + * @return + */ + private User persistNewUser(User user) { + + return userRepository.create(user); + } + + /** + * This api will fetch the fileStoreUrl By fileStoreId + * + * @param userList + * @throws Exception + */ + private void setFileStoreUrlsByFileStoreIds(List userList) { + List fileStoreIds = userList.parallelStream().filter(p -> p.getPhoto() != null).map(User::getPhoto) + .collect(Collectors.toList()); + if (!isEmpty(fileStoreIds)) { + Map fileStoreUrlList = null; + try { + fileStoreUrlList = fileRepository.getUrlByFileStoreId(userList.get(0).getTenantId(), fileStoreIds); + } catch (Exception e) { + // TODO Auto-generated catch block + + log.error("Error while fetching fileStore url list: " + e.getMessage()); + } + + if (fileStoreUrlList != null && !fileStoreUrlList.isEmpty()) { + for (User user : userList) { + user.setPhoto(fileStoreUrlList.get(user.getPhoto())); + } + } + } + } + + + public void validatePassword(String password) { + Map errorMap = new HashMap<>(); + if (!StringUtils.isEmpty(password)) { + if (password.length() < pwdMinLength || password.length() > pwdMaxLength) + errorMap.put("INVALID_PWD_LENGTH", "Password must be of minimum: " + pwdMinLength + " and maximum: " + pwdMaxLength + " characters."); + Pattern p = Pattern.compile(pwdRegex); + Matcher m = p.matcher(password); + if (!m.find()) { + errorMap.put("INVALID_PWD_PATTERN", "Password MUST HAVE: Atleast one digit, one upper case, one lower case, one special character (@#$%) and MUST NOT contain any spaces"); + } + } + if (!CollectionUtils.isEmpty(errorMap.keySet())) { + throw new CustomException(errorMap); + } + } + + +} diff --git a/core-services/mdms-v2/CHANGELOG.md b/core-services/mdms-v2/CHANGELOG.md new file mode 100644 index 00000000000..91d931292ae --- /dev/null +++ b/core-services/mdms-v2/CHANGELOG.md @@ -0,0 +1,42 @@ + + +# Changelog +All notable changes to this module will be documented in this file. + +## 1.3.2 - 2022-01-13 +- Updated to log4j2 version 2.17.1 + +## 1.3.1 - 2021-05-11 +- Added finally blocked wherever missing +- Changes to error handling + + +## 1.3.0 - 2020-05-29 + +- Added typescript definition generation plugin +- Upgraded to `tracer:2.0.0-SNAPSHOT` +- Upgraded to spring boot `2.2.6-RELEASE` +- Upgraded to spring-kafka `2.3.7.RELEASE` +- Upgraded to spring-integration-kafka `3.2.0.RELEASE` +- Upgraded to jackson-dataformat-yaml `2.10.0` +- Upgraded to jackson-databind `2.10.0` +- Removed the spring-integration-java-dsl because from Spring Integration 5.0, the + 'spring-integration-java-dsl' dependency is no longer needed. The Java DSL has + been merged into the core project. + +## 1.2.0 + +- Removed reload consumers +- Removed `start.sh` and `Dockerfile` +- Remove reload endpoints +- Remove all unused dependencies +- Migrated to the latest Spring Boot `2.2.6` +- Upgraded to tracer `2.0.0` + +## 1.1.0 + +- Added support for partial files using `isMergeAllowed` flag in the config file. By default, merge is `false` + +## 1.0.0 + +- Base version diff --git a/core-services/mdms-v2/LOCALSETUP.md b/core-services/mdms-v2/LOCALSETUP.md new file mode 100644 index 00000000000..5decabe365b --- /dev/null +++ b/core-services/mdms-v2/LOCALSETUP.md @@ -0,0 +1,30 @@ +# Local Setup + +To setup the MDMS service in your local system, clone the [Core Service repository](https://github.com/egovernments/core-services). + +## Dependencies + +### Infra Dependency + +- [ ] Postgres DB +- [ ] Redis +- [ ] Elasticsearch +- [ ] Kafka + - [ ] Consumer + - [ ] Producer + +## Running Locally + +To run the MDMS services locally, update below listed properties in `application.properties` before running the project: + +```ini +egov.mdms.conf.path = +masters.config.url = +``` +- Update `egov.mdms.conf.path` and `masters.config.url` to point to the folder/file where the master configuration/data is stored. You can put the folder path present in your local system or put the git hub link of MDMS config folder/file [Sample data](https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/) and [Sample config](https://raw.githubusercontent.com/egovernments/egov-mdms-data/master/master-config.json) + +>**Note:** +If you are mentioning local folder path in above mention property, then add `file://` as prefix. +`file://` +egov.mdms.conf.path = file:///home/abc/xyz/egov-mdms-data/data/pb +>If there are multiple file seperate it with `,` . \ No newline at end of file diff --git a/core-services/mdms-v2/README.md b/core-services/mdms-v2/README.md new file mode 100644 index 00000000000..b2fc7a24cc1 --- /dev/null +++ b/core-services/mdms-v2/README.md @@ -0,0 +1,87 @@ +# Master Data Management service + +Master Data Management Service is a core service that is made available on the DIGIT platform. It encapsulates the functionality surrounding Master Data Management. The service fetches Master Data pertaining to different modules. The functionality is exposed via REST API. + +### DB UML Diagram + +- NA + +### Service Dependencies +- NA + +### Swagger API Contract + +Please refer to the below Swagger API contarct for MDMS service to understand the structure of APIs and to have visualization of all internal APIs. +http://editor.swagger.io/?url=https://raw.githubusercontent.com/egovernments/egov-services/master/docs/mdms/contract/v1-0-0.yml#!/ + + +## Service Details + +The MDM service reads the data from a set of JSON files from a pre-specified location. It can either be an online location (readable JSON files from online) or offline (JSON files stored in local memory). The JSON files should conform to a prescribed format. The data is stored in a map and tenantID of the file serves as a key. +Once the data is stored in the map the same can be retrieved by making an API request to the MDM service. Filters can be applied in the request to retrieve data based on the existing fields of JSON. + +#### Master data management files check in location and details - + +1. Data folder parallel to docs (https://github.com/egovernments/egov-mdms-data/tree/master/data/pb). +2. Under data folder there will be a folder `` which is a state specific master folder. +3. Under `` folder there will `` folders where ulb specific master data will be checked in. for example `pb.testing` +4. Each module will have one file each for statewise and ulb wise master data. Keep the file name as module name itself. + +### Sample Config + +Each master has three key parameters `tenantId`, `moduleName`, `masterName`. A sample master would look like below + +```json +{ + "tenantId": "pb", + "moduleName": "common-masters", + "OwnerType": [ + { + "code": "FREEDOMFIGHTER", + "active": true + }, + { + "code": "WIDOW", + "active": true + }, + { + "code": "HANDICAPPED", + "active": true + } + ] +} +``` +Suppose there are huge data to be store in one config file, the data can be store in seperate files. And these seperated config file data can be use under one master name, if `isMergeAllowed` +flag is `true` in [mdms-masters-config.json](https://raw.githubusercontent.com/egovernments/punjab-mdms-data/UAT/mdms-masters-config.json) +### API Details + +`BasePath` /mdms/v1/[API endpoint] + +##### Method +a) `POST /_search` + +This method fetches a list of masters for a specified module and tenantId. +- `MDMSCriteriaReq (mdms request)` : Request Info + MdmsCriteria — Details of module and master which need to be searched using MDMS. + +- `MdmsCriteria` + + | Input Field | Description | Mandatory | Data Type | + | ----------------------------------------- | ------------------------------------------------------------------| -----------|------------------| + | `tenantId` | Unique id for a tenant. | Yes | String | + | `moduleDetails` | module for which master data is required | Yes | String | + +- `MdmsResponse` Response Info + Mdms + +- `Mdms` + + | Input Field | Description | Mandatory | Data Type | + | ----------------------------------------- | ------------------------------------------------------------------| -----------|------------------| + | `mdms` | Array of modules | Yes | String | + +### Kafka Consumers + +- NA + +### Kafka Producers + +- NA \ No newline at end of file diff --git a/core-services/mdms-v2/pom.xml b/core-services/mdms-v2/pom.xml new file mode 100644 index 00000000000..cbf1480b11d --- /dev/null +++ b/core-services/mdms-v2/pom.xml @@ -0,0 +1,129 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.2.13.RELEASE + + + org.egov.mdms + mdms-v2 + 1.3.2-SNAPSHOT + egov-infra-mdms-v2 + http://maven.apache.org + + 2.17.1 + UTF-8 + 1.8 + UTF-8 + ${java.version} + ${java.version} + + + + org.projectlombok + lombok + 1.18.22 + provided + + + com.jayway.jsonpath + json-path + + + com.fasterxml.jackson.core + jackson-databind + + + org.egov.services + tracer + 2.1.0-SNAPSHOT + + + + org.everit.json + org.everit.json.schema + 1.5.1 + + + + + + io.swagger + swagger-core + 1.5.18 + + + io.swagger.core.v3 + swagger-annotations + 2.2.8 + + + + org.flywaydb + flyway-core + + + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.postgresql + postgresql + 42.2.2 + + + org.egov.services + services-common + 2.0.0-SNAPSHOT + + + org.springframework.boot + spring-boot-devtools + + + org.springframework.boot + spring-boot-starter-aop + + + + + repo.egovernments.org + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ + + + repo.egovernments.org.snapshots + eGov ERP Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + org.springframework.boot + spring-boot-devtools + + + + + + + + + diff --git a/core-services/mdms-v2/sample/data/Level1/Level2/level2Master.json b/core-services/mdms-v2/sample/data/Level1/Level2/level2Master.json new file mode 100644 index 00000000000..f20cd824103 --- /dev/null +++ b/core-services/mdms-v2/sample/data/Level1/Level2/level2Master.json @@ -0,0 +1,11 @@ +{ + "tenantId": "Level1.Level2", + "moduleName": "Level2Module", + "masterName": "Level2Master", + "Level2Master": [ + { + "code": "ABC", + "data": "data-ABC" + } + ] +} \ No newline at end of file diff --git a/core-services/mdms-v2/sample/data/Level1/level1Master.json b/core-services/mdms-v2/sample/data/Level1/level1Master.json new file mode 100644 index 00000000000..005050baa35 --- /dev/null +++ b/core-services/mdms-v2/sample/data/Level1/level1Master.json @@ -0,0 +1,11 @@ +{ + "tenantId": "Level1", + "moduleName": "Level1Module", + "masterName": "Level2Master", + "Level2Master": [ + { + "code": "ABC", + "data": "data-ABC" + } + ] +} \ No newline at end of file diff --git a/core-services/mdms-v2/sample/master-config.json b/core-services/mdms-v2/sample/master-config.json new file mode 100644 index 00000000000..efa73116b22 --- /dev/null +++ b/core-services/mdms-v2/sample/master-config.json @@ -0,0 +1,5 @@ +{ + "Level1": { + + } +} \ No newline at end of file diff --git a/core-services/mdms-v2/src/main/java/org/egov/MDMSApplication.java b/core-services/mdms-v2/src/main/java/org/egov/MDMSApplication.java new file mode 100644 index 00000000000..de224d8fd25 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/MDMSApplication.java @@ -0,0 +1,16 @@ +package org.egov; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; + + +@ComponentScan +@SpringBootApplication +public class MDMSApplication { + + public static void main(String[] args) { + SpringApplication.run(MDMSApplication.class, args); + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/config/ApplicationConfig.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/config/ApplicationConfig.java new file mode 100644 index 00000000000..8cea5ca6da9 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/config/ApplicationConfig.java @@ -0,0 +1,33 @@ +package org.egov.infra.mdms.config; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@ToString +@Setter +@Getter +@Import({MultiStateInstanceUtil.class}) +public class ApplicationConfig { + + @Value("${egov.mdms.schema.definition.save.topic}") + private String saveSchemaDefinitionTopicName; + + @Value("${egov.mdms.data.save.topic}") + private String saveMdmsDataTopicName; + + @Value("${egov.mdms.data.update.topic}") + private String updateMdmsDataTopicName; + + @Value("${mdms.default.offset}") + private Integer defaultOffset; + + @Value("${mdms.default.limit}") + private Integer defaultLimit; + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/constants/SchemaDefinitionConstant.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/constants/SchemaDefinitionConstant.java new file mode 100644 index 00000000000..965b891dea5 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/constants/SchemaDefinitionConstant.java @@ -0,0 +1,4 @@ +package org.egov.infra.mdms.constants; + +public class SchemaDefinitionConstant { +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/controller/MDMSController.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/controller/MDMSController.java new file mode 100644 index 00000000000..86d5549a61b --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/controller/MDMSController.java @@ -0,0 +1,41 @@ +package org.egov.infra.mdms.controller; + +import java.util.Map; + +import javax.validation.Valid; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.service.MDMSService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; + +@RestController +@Slf4j +@RequestMapping(value = "/v1") +public class MDMSController { + + private MDMSService mdmsService; + + @Autowired + public MDMSController(MDMSService mdmsService) { + this.mdmsService = mdmsService; + } + + /** + * Request handler for serving v1 search requests. + * @param body + * @return + */ + @RequestMapping(value="_search", method = RequestMethod.POST) + public ResponseEntity search(@Valid @RequestBody MdmsCriteriaReq body) { + Map> moduleMasterMap = mdmsService.search(body); + MdmsResponse mdmsResponse = MdmsResponse.builder() + .mdmsRes(moduleMasterMap) + .build(); + return new ResponseEntity<>(mdmsResponse, HttpStatus.OK); + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/controller/MDMSControllerV2.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/controller/MDMSControllerV2.java new file mode 100644 index 00000000000..cfacaeee95a --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/controller/MDMSControllerV2.java @@ -0,0 +1,61 @@ +package org.egov.infra.mdms.controller; + +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.service.MDMSServiceV2; +import org.egov.infra.mdms.utils.ResponseUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; +import java.util.List; + +@RestController +@Slf4j +@RequestMapping(value = "/v2") +public class MDMSControllerV2 { + + private MDMSServiceV2 mdmsServiceV2; + + @Autowired + public MDMSControllerV2(MDMSServiceV2 mdmsServiceV2) { + this.mdmsServiceV2 = mdmsServiceV2; + } + + /** + * Request handler for serving create requests + * @param mdmsRequest + * @param schemaCode + * @return + */ + @RequestMapping(value="_create/{schemaCode}", method = RequestMethod.POST) + public ResponseEntity create(@Valid @RequestBody MdmsRequest mdmsRequest, @PathVariable("schemaCode") String schemaCode) { + List masterDataList = mdmsServiceV2.create(mdmsRequest); + return new ResponseEntity<>(ResponseUtil.getMasterDataV2Response(mdmsRequest.getRequestInfo(), masterDataList), HttpStatus.ACCEPTED); + } + + /** + * Request handler for serving search requests + * @param masterDataSearchCriteria + * @return + */ + @RequestMapping(value="_search", method = RequestMethod.POST) + public ResponseEntity search(@Valid @RequestBody MdmsCriteriaReqV2 masterDataSearchCriteria) { + List masterDataList = mdmsServiceV2.search(masterDataSearchCriteria); + return new ResponseEntity<>(ResponseUtil.getMasterDataV2Response(RequestInfo.builder().build(), masterDataList), HttpStatus.OK); + } + + /** + * Request handler for serving update requests + * @param mdmsRequest + * @param schemaCode + * @return + */ + @RequestMapping(value="_update/{schemaCode}", method = RequestMethod.POST) + public ResponseEntity update(@Valid @RequestBody MdmsRequest mdmsRequest, @PathVariable("schemaCode") String schemaCode) { + List masterDataList = mdmsServiceV2.update(mdmsRequest); + return new ResponseEntity<>(ResponseUtil.getMasterDataV2Response(mdmsRequest.getRequestInfo(), masterDataList), HttpStatus.ACCEPTED); + } +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/controller/SchemaDefinitionController.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/controller/SchemaDefinitionController.java new file mode 100644 index 00000000000..22ea306c69e --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/controller/SchemaDefinitionController.java @@ -0,0 +1,63 @@ +package org.egov.infra.mdms.controller; + + +import lombok.extern.slf4j.Slf4j; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.service.SchemaDefinitionService; +import org.egov.infra.mdms.utils.ResponseUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import javax.validation.Valid; +import java.util.List; + +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Controller +@RequestMapping("schema/v1") +@Slf4j +public class SchemaDefinitionController { + + private SchemaDefinitionService schemaDefinitionService; + + @Autowired + public SchemaDefinitionController(SchemaDefinitionService schemaDefinitionService) { + this.schemaDefinitionService = schemaDefinitionService; + } + + /** + * Request handler for serving schema create requests. + * @param schemaDefinitionRequest + * @return + */ + @RequestMapping(value = "_create", method = RequestMethod.POST) + public ResponseEntity create(@Valid @RequestBody SchemaDefinitionRequest schemaDefinitionRequest) { + List schemaDefinitions = schemaDefinitionService.create(schemaDefinitionRequest); + return new ResponseEntity<>(ResponseUtil.getSchemaDefinitionResponse(schemaDefinitionRequest.getRequestInfo(), schemaDefinitions), HttpStatus.ACCEPTED); + } + + /** + * Request handler for serving schema search requests. + * @param schemaDefinitionSearchRequest + * @return + */ + @RequestMapping(value = "_search", method = RequestMethod.POST) + public ResponseEntity search(@Valid @RequestBody SchemaDefSearchRequest schemaDefinitionSearchRequest) { + List schemaDefinitions = schemaDefinitionService.search(schemaDefinitionSearchRequest); + return new ResponseEntity<>(ResponseUtil.getSchemaDefinitionResponse(schemaDefinitionSearchRequest.getRequestInfo(), schemaDefinitions), HttpStatus.ACCEPTED); + } + + /** + * Request handler for serving schema update requests - NOT implemented as of now. + * @param schemaDefinitionUpdateRequest + * @return + */ + @RequestMapping(value = "_update", method = RequestMethod.POST) + public ResponseEntity update(@Valid @RequestBody SchemaDefinitionRequest schemaDefinitionUpdateRequest) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/errors/ErrorCodes.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/errors/ErrorCodes.java new file mode 100644 index 00000000000..1037b947730 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/errors/ErrorCodes.java @@ -0,0 +1,30 @@ +package org.egov.infra.mdms.errors; + +import org.springframework.stereotype.Component; + +@Component +public class ErrorCodes { + + public static final String DUPLICATE_SCHEMA_CODE = "DUPLICATE_SCHEMA_CODE"; + + public static final String DUPLICATE_SCHEMA_CODE_MSG = "Schema code already exists"; + + public static final String INVALID_REQUEST_JSON = "INVALID_REQUEST_JSON"; + + public static final String INVALID_JSON = "INVALID_JSON"; + + public static final String INVALID_JSON_MSG = "Failed to deserialize json"; + + public static final String REQUIRED_ATTRIBUTE_LIST_ERR_CODE = "REQUIRED_ATTRIBUTE_LIST_ERR"; + + public static final String REQUIRED_ATTRIBUTE_LIST_EMPTY_MSG = "Required attribute list cannot be empty"; + + public static final String UNIQUE_ATTRIBUTE_LIST_ERR_CODE = "UNIQUE_ATTRIBUTE_LIST_ERR"; + + public static final String UNIQUE_ATTRIBUTE_LIST_EMPTY_MSG = "Unique attribute list cannot be empty"; + + public static final String UNIQUE_ATTRIBUTE_LIST_INVALID_MSG = "Fields provided under unique fields must be a subset of required attributes list"; + + + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MasterDetail.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MasterDetail.java new file mode 100644 index 00000000000..58f178efd03 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MasterDetail.java @@ -0,0 +1,35 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * MasterDetail + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MasterDetail { + @JsonProperty("name") + @NotNull + + @Size(min = 1, max = 100) + private String name = null; + + @JsonProperty("filter") + + @Size(min = 1, max = 500) + private String filter = null; + + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/Mdms.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/Mdms.java new file mode 100644 index 00000000000..2eba84d0c1b --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/Mdms.java @@ -0,0 +1,58 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.models.AuditDetails; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * Bind the request meta data(RequestInfo) and Schema defination + */ +@Schema(description = "Bind the request meta data(RequestInfo) and Schema defination") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Mdms { + + @JsonProperty("id") + @Size(min = 2, max = 64) + private String id; + + @JsonProperty("tenantId") + @NotNull + @Size(min = 2, max = 128) + private String tenantId = null; + + @JsonProperty("schemaCode") + @NotNull + @Size(min = 2, max = 128) + private String schemaCode = null; + + @JsonProperty("uniqueIdentifier") + @Size(min = 1, max = 128) + private String uniqueIdentifier = null; + + @JsonProperty("data") + @NotNull + private JsonNode data = null; + + @JsonProperty("isActive") + private Boolean isActive = true; + + @JsonProperty("auditDetails") + @Valid + private AuditDetails auditDetails = null; + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteria.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteria.java new file mode 100644 index 00000000000..a9aebca91d5 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteria.java @@ -0,0 +1,61 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * MdmsCriteria + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsCriteria { + @JsonProperty("tenantId") + @Size(min = 1, max = 100) + @NotNull + private String tenantId = null; + + @JsonProperty("ids") + private Set ids = null; + + @JsonProperty("uniqueIdentifier") + @Size(min = 1, max = 64) + private String uniqueIdentifier = null; + + @JsonProperty("moduleDetails") + @Valid + @NotNull + private List moduleDetails = null; + + @JsonIgnore + private Map schemaCodeFilterMap = null; + + @JsonIgnore + private Boolean isActive = Boolean.TRUE; + + + public MdmsCriteria addModuleDetailsItem(ModuleDetail moduleDetailsItem) { + if (this.moduleDetails == null) { + this.moduleDetails = new ArrayList<>(); + } + this.moduleDetails.add(moduleDetailsItem); + return this; + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaReq.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaReq.java new file mode 100644 index 00000000000..f5b6f3b05bf --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaReq.java @@ -0,0 +1,34 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; + +/** + * MdmsCriteriaReq + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsCriteriaReq { + @JsonProperty("RequestInfo") + + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("MdmsCriteria") + + @Valid + private MdmsCriteria mdmsCriteria = null; + + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaReqV2.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaReqV2.java new file mode 100644 index 00000000000..88110d63d52 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaReqV2.java @@ -0,0 +1,32 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; + +/** + * MdmsCriteriaReq + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsCriteriaReqV2 { + + @JsonProperty("RequestInfo") + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("MdmsCriteria") + @Valid + private MdmsCriteriaV2 mdmsCriteria = null; + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaV2.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaV2.java new file mode 100644 index 00000000000..f8998e5406b --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaV2.java @@ -0,0 +1,64 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * MdmsCriteria + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsCriteriaV2 { + + @JsonProperty("tenantId") + @Size(min = 1, max = 100) + @NotNull + private String tenantId = null; + + @JsonProperty("ids") + private Set ids = null; + + @JsonProperty("uniqueIdentifiers") + @Size(min = 1, max = 64) + private Set uniqueIdentifiers = null; + + @JsonProperty("schemaCode") + private String schemaCode = null; + + @JsonProperty("filters") + private Map filterMap = null; + + @JsonProperty("isActive") + private Boolean isActive = null; + + @JsonIgnore + private Map schemaCodeFilterMap = null; + + @JsonIgnore + private Set uniqueIdentifiersForRefVerification = null; + + @JsonProperty("offset") + private Integer offset; + + @JsonProperty("limit") + private Integer limit; + + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsDataRedisWrapper.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsDataRedisWrapper.java new file mode 100644 index 00000000000..0e67592d9ff --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsDataRedisWrapper.java @@ -0,0 +1,22 @@ +package org.egov.infra.mdms.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import net.minidev.json.JSONArray; +import org.springframework.validation.annotation.Validated; + +import java.util.Map; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsDataRedisWrapper { + + private String tenantSchemaCode; + + private Map schemaCodeData; +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsRequest.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsRequest.java new file mode 100644 index 00000000000..958c1cb8848 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsRequest.java @@ -0,0 +1,40 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.Map; + +/** + * MdmsRequest + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsRequest { + @JsonProperty("RequestInfo") + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("Mdms") + @Valid + @NotNull + private Mdms mdms = null; + + /*@JsonProperty("Workflow") + + @Valid + private Workflow workflow = null;*/ + + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsResponse.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsResponse.java new file mode 100644 index 00000000000..dd3b2eed203 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsResponse.java @@ -0,0 +1,33 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import net.minidev.json.JSONArray; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.Map; + +/** + * MdmsResponse + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsResponse { + + @JsonProperty("ResponseInfo") + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("MdmsRes") + private Map> mdmsRes = null; + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsResponseV2.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsResponseV2.java new file mode 100644 index 00000000000..f6ad544466c --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsResponseV2.java @@ -0,0 +1,25 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.response.ResponseInfo; + +import javax.validation.Valid; +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsResponseV2 { + + @JsonProperty("ResponseInfo") + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("mdms") + private List mdms = null; +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsTenantMasterCriteria.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsTenantMasterCriteria.java new file mode 100644 index 00000000000..ee11473e303 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/MdmsTenantMasterCriteria.java @@ -0,0 +1,17 @@ +package org.egov.infra.mdms.model; + +import lombok.*; + +@Setter +@Getter +@ToString +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MdmsTenantMasterCriteria { + + private String tenantId; + + private String schemaCode; + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/ModuleDetail.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/ModuleDetail.java new file mode 100644 index 00000000000..57326a83991 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/ModuleDetail.java @@ -0,0 +1,43 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +/** + * ModuleDetail + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ModuleDetail { + @JsonProperty("moduleName") + @NotNull + + @Size(min = 1, max = 100) + private String moduleName = null; + + @JsonProperty("masterDetails") + @NotNull + @Valid + private List masterDetails = new ArrayList<>(); + + + public ModuleDetail addMasterDetailsItem(MasterDetail masterDetailsItem) { + this.masterDetails.add(masterDetailsItem); + return this; + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefCriteria.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefCriteria.java new file mode 100644 index 00000000000..abfe8844106 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefCriteria.java @@ -0,0 +1,49 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +/** + * SchemaDefCriteria + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SchemaDefCriteria { + + @JsonProperty("tenantId") + @Size(min = 1, max = 100) + @NotNull + private String tenantId = null; + + @JsonProperty("codes") + private List codes = null; + + @JsonProperty("offset") + private Integer offset; + + @JsonProperty("limit") + private Integer limit; + + + public SchemaDefCriteria addCodesItem(String codesItem) { + if (this.codes == null) { + this.codes = new ArrayList<>(); + } + this.codes.add(codesItem); + return this; + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefSearchRequest.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefSearchRequest.java new file mode 100644 index 00000000000..d7d7620773b --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefSearchRequest.java @@ -0,0 +1,35 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +/** + * Bind the request meta data(RequestInfo) and Schema defination + */ +@Schema(description = "Bind the request meta data(RequestInfo) and Schema defination") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class SchemaDefSearchRequest { + @JsonProperty("RequestInfo") + @NotNull + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("SchemaDefCriteria") + @NotNull + @Valid + private SchemaDefCriteria schemaDefCriteria = null; + + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinition.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinition.java new file mode 100644 index 00000000000..a42c03511c4 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinition.java @@ -0,0 +1,58 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import org.egov.common.contract.models.AuditDetails; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + * Bind the request meta data(RequestInfo) and Schema defination + */ +@Schema(description = "Bind the request meta data(RequestInfo) and Schema defination") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class SchemaDefinition implements Serializable{ + + @JsonProperty("id") + @Size(min = 2, max = 128) + private String id = null; + + @JsonProperty("tenantId") + @NotNull + @Size(min = 2, max = 128) + private String tenantId = null; + + @JsonProperty("code") + @NotNull + @Size(min = 2, max = 128) + private String code = null; + + @JsonProperty("description") + + @Size(min = 2, max = 512) + private String description = null; + + @JsonProperty("definition") + @NotNull + private JsonNode definition = null; + + @JsonProperty("isActive") + private Boolean isActive = true; + + @JsonProperty("auditDetails") + @Valid + private AuditDetails auditDetails = null; + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinitionRequest.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinitionRequest.java new file mode 100644 index 00000000000..963fad06ae0 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinitionRequest.java @@ -0,0 +1,35 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +/** + * Bind the request meta data(RequestInfo) and Schema defination + */ +@Schema(description = "Bind the request meta data(RequestInfo) and Schema defination") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class SchemaDefinitionRequest { + @JsonProperty("RequestInfo") + @NotNull + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("SchemaDefinition") + @NotNull + @Valid + private SchemaDefinition schemaDefinition = null; + + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinitionResponse.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinitionResponse.java new file mode 100644 index 00000000000..be83829ecb0 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinitionResponse.java @@ -0,0 +1,45 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * Response from server + */ +@Schema(description = "Response from server") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SchemaDefinitionResponse { + @JsonProperty("ResponseInfo") + + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("SchemaDefinitions") + @Valid + private List schemaDefinitions = null; + + + public SchemaDefinitionResponse addSchemaDefinitionsItem(SchemaDefinition schemaDefinitionsItem) { + if (this.schemaDefinitions == null) { + this.schemaDefinitions = new ArrayList<>(); + } + this.schemaDefinitions.add(schemaDefinitionsItem); + return this; + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/producer/Producer.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/producer/Producer.java new file mode 100644 index 00000000000..9ea28d25c6c --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/producer/Producer.java @@ -0,0 +1,17 @@ +package org.egov.infra.mdms.producer; + +import org.egov.tracer.kafka.CustomKafkaTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class Producer { + + @Autowired + private CustomKafkaTemplate kafkaTemplate; + + public void push(String topic, Object value) { + kafkaTemplate.send(topic, value); + } + +} \ No newline at end of file diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/MdmsDataRepository.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/MdmsDataRepository.java new file mode 100644 index 00000000000..aebeb3aa9bf --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/MdmsDataRepository.java @@ -0,0 +1,19 @@ +package org.egov.infra.mdms.repository; + +import net.minidev.json.JSONArray; +import org.egov.infra.mdms.model.*; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Map; + +@Repository +public interface MdmsDataRepository { + public void create(MdmsRequest mdmsRequest); + + public void update(MdmsRequest mdmsRequest); + + public List searchV2(MdmsCriteriaV2 mdmsCriteriaV2); + + public Map> search(MdmsCriteria mdmsCriteria); +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/SchemaDefinitionRepository.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/SchemaDefinitionRepository.java new file mode 100644 index 00000000000..cf09ebd9fd7 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/SchemaDefinitionRepository.java @@ -0,0 +1,18 @@ +package org.egov.infra.mdms.repository; + +import org.egov.infra.mdms.model.SchemaDefCriteria; +import org.egov.infra.mdms.model.SchemaDefinition; +import org.egov.infra.mdms.model.SchemaDefinitionRequest; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface SchemaDefinitionRepository { + public void create(SchemaDefinitionRequest schemaDefinitionRequest); + + public void update(SchemaDefinitionRequest schemaDefinitionRequest); + + public List search(SchemaDefCriteria schemaDefCriteria); + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/impl/MdmsDataRepositoryImpl.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/impl/MdmsDataRepositoryImpl.java new file mode 100644 index 00000000000..ce126197922 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/impl/MdmsDataRepositoryImpl.java @@ -0,0 +1,90 @@ +package org.egov.infra.mdms.repository.impl; + +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; +import org.egov.infra.mdms.config.ApplicationConfig; +import org.egov.infra.mdms.model.Mdms; +import org.egov.infra.mdms.model.MdmsCriteria; +import org.egov.infra.mdms.model.MdmsCriteriaV2; +import org.egov.infra.mdms.model.MdmsRequest; +import org.egov.infra.mdms.producer.Producer; +import org.egov.infra.mdms.repository.MdmsDataRepository; +import org.egov.infra.mdms.repository.querybuilder.MdmsDataQueryBuilder; +import org.egov.infra.mdms.repository.querybuilder.MdmsDataQueryBuilderV2; +import org.egov.infra.mdms.repository.rowmapper.MdmsDataRowMapper; +import org.egov.infra.mdms.repository.rowmapper.MdmsDataRowMapperV2; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Repository; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Repository +@Slf4j +public class MdmsDataRepositoryImpl implements MdmsDataRepository { + + private Producer producer; + private JdbcTemplate jdbcTemplate; + private ApplicationConfig applicationConfig; + private MdmsDataQueryBuilder mdmsDataQueryBuilder; + private MdmsDataQueryBuilderV2 mdmsDataQueryBuilderV2; + private MdmsDataRowMapperV2 mdmsDataRowMapperV2; + private MdmsDataRowMapper mdmsDataRowMapper; + + @Autowired + public MdmsDataRepositoryImpl(Producer producer, JdbcTemplate jdbcTemplate, + ApplicationConfig applicationConfig, MdmsDataQueryBuilder mdmsDataQueryBuilder, + MdmsDataRowMapperV2 mdmsDataRowMapperV2, + MdmsDataQueryBuilderV2 mdmsDataQueryBuilderV2, + MdmsDataRowMapper mdmsDataRowMapper) { + this.producer = producer; + this.jdbcTemplate = jdbcTemplate; + this.applicationConfig = applicationConfig; + this.mdmsDataQueryBuilder = mdmsDataQueryBuilder; + this.mdmsDataRowMapper = mdmsDataRowMapper; + this.mdmsDataRowMapperV2 = mdmsDataRowMapperV2; + this.mdmsDataQueryBuilderV2 = mdmsDataQueryBuilderV2; + } + + /** + * @param mdmsRequest + */ + @Override + public void create(MdmsRequest mdmsRequest) { + producer.push(applicationConfig.getSaveMdmsDataTopicName(), mdmsRequest); + } + + /** + * @param mdmsRequest + */ + @Override + public void update(MdmsRequest mdmsRequest) { + producer.push(applicationConfig.getUpdateMdmsDataTopicName(), mdmsRequest); + } + + /** + * @param mdmsCriteriaV2 + * @return + */ + @Override + public List searchV2(MdmsCriteriaV2 mdmsCriteriaV2) { + List preparedStmtList = new ArrayList<>(); + String query = mdmsDataQueryBuilderV2.getMdmsDataSearchQuery(mdmsCriteriaV2, preparedStmtList); + log.info(query); + return jdbcTemplate.query(query, preparedStmtList.toArray(), mdmsDataRowMapperV2); + } + + /** + * @param mdmsCriteria + * @return + */ + @Override + public Map> search(MdmsCriteria mdmsCriteria) { + List preparedStmtList = new ArrayList<>(); + String query = mdmsDataQueryBuilder.getMdmsDataSearchQuery(mdmsCriteria, preparedStmtList); + log.info(query); + return jdbcTemplate.query(query, preparedStmtList.toArray(), mdmsDataRowMapper); + } +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/impl/SchemaDefinitionDbRepositoryImpl.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/impl/SchemaDefinitionDbRepositoryImpl.java new file mode 100644 index 00000000000..a4f265f25af --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/impl/SchemaDefinitionDbRepositoryImpl.java @@ -0,0 +1,77 @@ +package org.egov.infra.mdms.repository.impl; + +import lombok.extern.slf4j.Slf4j; +import org.egov.infra.mdms.config.ApplicationConfig; +import org.egov.infra.mdms.model.SchemaDefCriteria; +import org.egov.infra.mdms.model.SchemaDefinition; +import org.egov.infra.mdms.model.SchemaDefinitionRequest; +import org.egov.infra.mdms.producer.Producer; +import org.egov.infra.mdms.repository.SchemaDefinitionRepository; +import org.egov.infra.mdms.repository.querybuilder.SchemaDefinitionQueryBuilder; +import org.egov.infra.mdms.repository.rowmapper.SchemaDefinitionRowMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Repository; +import java.util.ArrayList; +import java.util.List; + +@Repository +@Slf4j +public class SchemaDefinitionDbRepositoryImpl implements SchemaDefinitionRepository { + + private Producer producer; + + private JdbcTemplate jdbcTemplate; + + private ApplicationConfig applicationConfig; + + private SchemaDefinitionQueryBuilder schemaDefinitionQueryBuilder; + + private SchemaDefinitionRowMapper rowMapper; + + @Autowired + public SchemaDefinitionDbRepositoryImpl(Producer producer, JdbcTemplate jdbcTemplate, + ApplicationConfig applicationConfig, SchemaDefinitionRowMapper rowMapper, SchemaDefinitionQueryBuilder schemaDefinitionQueryBuilder){ + this.producer = producer; + this.jdbcTemplate = jdbcTemplate; + this.applicationConfig = applicationConfig; + this.rowMapper = rowMapper; + this.schemaDefinitionQueryBuilder = schemaDefinitionQueryBuilder; + } + + + /** + * This method emits schema definition create request on kafka for async persistence + * @param schemaDefinitionRequest + */ + @Override + public void create(SchemaDefinitionRequest schemaDefinitionRequest) { + producer.push(applicationConfig.getSaveSchemaDefinitionTopicName(), schemaDefinitionRequest); + } + + /** + * This method queries the database and returns schema definition search response based on + * the provided criteria. + * @param schemaDefCriteria + */ + @Override + public List search(SchemaDefCriteria schemaDefCriteria) { + List preparedStatementList = new ArrayList<>(); + + // Invoke query builder to generate query based on the provided criteria + String query = schemaDefinitionQueryBuilder.getSchemaSearchQuery(schemaDefCriteria, preparedStatementList); + log.info("Schema definition search query: " + query); + + // Query the database to fetch schema definitions + return jdbcTemplate.query(query, preparedStatementList.toArray(), rowMapper); + } + + /** + * Skeleton method for update as update API has not been implemented + * @param schemaDefinitionRequest + */ + @Override + public void update(SchemaDefinitionRequest schemaDefinitionRequest) { + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/MdmsDataQueryBuilder.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/MdmsDataQueryBuilder.java new file mode 100644 index 00000000000..05c91a10690 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/MdmsDataQueryBuilder.java @@ -0,0 +1,66 @@ +package org.egov.infra.mdms.repository.querybuilder; + +import org.egov.infra.mdms.model.MdmsCriteria; +import org.egov.infra.mdms.utils.QueryUtil; +import org.springframework.stereotype.Component; + +import java.util.*; + +@Component +public class MdmsDataQueryBuilder { + + private static String SEARCH_MDMS_DATA_QUERY = "SELECT data.tenantid, data.uniqueidentifier, data.schemacode, data.data, data.isactive, data.createdby, data.lastmodifiedby, data.createdtime, data.lastmodifiedtime" + + " FROM eg_mdms_data data "; + + private static final String MDMS_DATA_QUERY_ORDER_BY_CLAUSE = " order by data.createdtime desc "; + + /** + * Method to handle request for fetching MDMS data search query + * @param mdmsCriteria + * @param preparedStmtList + * @return + */ + public String getMdmsDataSearchQuery(MdmsCriteria mdmsCriteria, List preparedStmtList) { + String query = buildQuery(mdmsCriteria, preparedStmtList); + query = QueryUtil.addOrderByClause(query, MDMS_DATA_QUERY_ORDER_BY_CLAUSE); + return query; + } + + /** + * Method to build query dynamically based on the criteria passed to the method + * @param mdmsCriteria + * @param preparedStmtList + * @return + */ + private String buildQuery(MdmsCriteria mdmsCriteria, List preparedStmtList) { + StringBuilder builder = new StringBuilder(SEARCH_MDMS_DATA_QUERY); + Map schemaCodeFilterMap = mdmsCriteria.getSchemaCodeFilterMap(); + if (!Objects.isNull(mdmsCriteria.getTenantId())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.tenantid LIKE ? "); + preparedStmtList.add(mdmsCriteria.getTenantId() + "%"); + } + if (!Objects.isNull(mdmsCriteria.getIds())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.id IN ( ").append(QueryUtil.createQuery(mdmsCriteria.getIds().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, mdmsCriteria.getIds()); + } + if (!Objects.isNull(mdmsCriteria.getUniqueIdentifier())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.uniqueidentifier = ? "); + preparedStmtList.add(mdmsCriteria.getUniqueIdentifier()); + } + if (!Objects.isNull(mdmsCriteria.getSchemaCodeFilterMap())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.schemacode IN ( ").append(QueryUtil.createQuery(schemaCodeFilterMap.keySet().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, schemaCodeFilterMap.keySet()); + } + if(!Objects.isNull(mdmsCriteria.getIsActive())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.isactive = ? "); + preparedStmtList.add(mdmsCriteria.getIsActive()); + } + return builder.toString(); + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/MdmsDataQueryBuilderV2.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/MdmsDataQueryBuilderV2.java new file mode 100644 index 00000000000..5985ba44883 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/MdmsDataQueryBuilderV2.java @@ -0,0 +1,104 @@ +package org.egov.infra.mdms.repository.querybuilder; + +import org.egov.infra.mdms.config.ApplicationConfig; +import org.egov.infra.mdms.model.MdmsCriteriaV2; +import org.egov.infra.mdms.utils.QueryUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; + +import java.util.*; + +@Component +public class MdmsDataQueryBuilderV2 { + + @Autowired + private ApplicationConfig config; + + private static final String SEARCH_MDMS_DATA_QUERY = "SELECT data.id, data.tenantid, data.uniqueidentifier, data.schemacode, data.data, data.isactive, data.createdby, data.lastmodifiedby, data.createdtime, data.lastmodifiedtime" + + " FROM eg_mdms_data data "; + + private static final String MDMS_DATA_QUERY_ORDER_BY_CLAUSE = " order by data.createdtime desc "; + + /** + * Method to handle request for fetching MDMS data search query + * @param mdmsCriteriaV2 + * @param preparedStmtList + * @return + */ + public String getMdmsDataSearchQuery(MdmsCriteriaV2 mdmsCriteriaV2, List preparedStmtList) { + String query = buildQuery(mdmsCriteriaV2, preparedStmtList); + query = QueryUtil.addOrderByClause(query, MDMS_DATA_QUERY_ORDER_BY_CLAUSE); + query = getPaginatedQuery(query, mdmsCriteriaV2, preparedStmtList); + return query; + } + + /** + * Method to build query dynamically based on the criteria passed to the method + * @param mdmsCriteriaV2 + * @param preparedStmtList + * @return + */ + private String buildQuery(MdmsCriteriaV2 mdmsCriteriaV2, List preparedStmtList) { + StringBuilder builder = new StringBuilder(SEARCH_MDMS_DATA_QUERY); + Map schemaCodeFilterMap = mdmsCriteriaV2.getSchemaCodeFilterMap(); + if (!Objects.isNull(mdmsCriteriaV2.getTenantId())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.tenantid = ? "); + preparedStmtList.add(mdmsCriteriaV2.getTenantId()); + } + if (!Objects.isNull(mdmsCriteriaV2.getIds())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.id IN ( ").append(QueryUtil.createQuery(mdmsCriteriaV2.getIds().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, mdmsCriteriaV2.getIds()); + } + if (!Objects.isNull(mdmsCriteriaV2.getUniqueIdentifiers())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.uniqueidentifier IN ( ").append(QueryUtil.createQuery(mdmsCriteriaV2.getUniqueIdentifiers().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, mdmsCriteriaV2.getUniqueIdentifiers()); + } + if (!Objects.isNull(mdmsCriteriaV2.getSchemaCodeFilterMap())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.schemacode IN ( ").append(QueryUtil.createQuery(schemaCodeFilterMap.keySet().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, schemaCodeFilterMap.keySet()); + } + if(!Objects.isNull(mdmsCriteriaV2.getSchemaCode())){ + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.schemacode = ? "); + preparedStmtList.add(mdmsCriteriaV2.getSchemaCode()); + } + if(!CollectionUtils.isEmpty(mdmsCriteriaV2.getFilterMap())){ + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.data @> CAST( ? AS jsonb )"); + String partialQueryJsonString = QueryUtil.preparePartialJsonStringFromFilterMap(mdmsCriteriaV2.getFilterMap()); + preparedStmtList.add(partialQueryJsonString); + } + if(!CollectionUtils.isEmpty(mdmsCriteriaV2.getUniqueIdentifiersForRefVerification())){ + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.uniqueidentifier IN ( ").append(QueryUtil.createQuery(mdmsCriteriaV2.getUniqueIdentifiersForRefVerification().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, mdmsCriteriaV2.getUniqueIdentifiersForRefVerification()); + } + if(!Objects.isNull(mdmsCriteriaV2.getIsActive())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.isactive = ? "); + preparedStmtList.add(mdmsCriteriaV2.getIsActive()); + } + return builder.toString(); + } + + private String getPaginatedQuery(String query, MdmsCriteriaV2 mdmsCriteriaV2, List preparedStmtList) { + StringBuilder paginatedQuery = new StringBuilder(query); + + // Append offset + paginatedQuery.append(" OFFSET ? "); + preparedStmtList.add(ObjectUtils.isEmpty(mdmsCriteriaV2.getOffset()) ? config.getDefaultOffset() : mdmsCriteriaV2.getOffset()); + + // Append limit + paginatedQuery.append(" LIMIT ? "); + preparedStmtList.add(ObjectUtils.isEmpty(mdmsCriteriaV2.getLimit()) ? config.getDefaultLimit() : mdmsCriteriaV2.getLimit()); + + return paginatedQuery.toString(); + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/SchemaDefinitionQueryBuilder.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/SchemaDefinitionQueryBuilder.java new file mode 100644 index 00000000000..43e29366ba4 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/SchemaDefinitionQueryBuilder.java @@ -0,0 +1,74 @@ +package org.egov.infra.mdms.repository.querybuilder; + +import org.egov.infra.mdms.config.ApplicationConfig; +import org.egov.infra.mdms.model.SchemaDefCriteria; +import org.egov.infra.mdms.utils.QueryUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; + +import java.util.*; + +@Component +public class SchemaDefinitionQueryBuilder { + + @Autowired + private ApplicationConfig config; + + private static final String SEARCH_SCHEMA_DEF_QUERY = "SELECT schema.id,schema.tenantid, schema.code, schema.description, schema.definition, schema.isactive, " + + "schema.createdby, schema.lastmodifiedby, schema.createdtime, schema.lastmodifiedtime FROM " + + "eg_mdms_schema_definition schema "; + + private static final String SEARCH_SCHEMA_DEF_ORDER_BY_CLAUSE = " order by schema.createdtime desc "; + + /** + * Method to handle request for fetching schema search query + * @param schemaDefCriteria + * @param preparedStmtList + * @return + */ + public String getSchemaSearchQuery(SchemaDefCriteria schemaDefCriteria, List preparedStmtList) { + String query = buildQuery(schemaDefCriteria, preparedStmtList); + query = QueryUtil.addOrderByClause(query, SEARCH_SCHEMA_DEF_ORDER_BY_CLAUSE); + query = getPaginatedQuery(query, schemaDefCriteria, preparedStmtList); + return query; + } + + /** + * Method to build query dynamically based on the criteria passed to the method + * @param schemaDefCriteria + * @param preparedStmtList + * @return + */ + private String buildQuery(SchemaDefCriteria schemaDefCriteria, List preparedStmtList) { + StringBuilder builder = new StringBuilder(SchemaDefinitionQueryBuilder.SEARCH_SCHEMA_DEF_QUERY); + + if (!Objects.isNull(schemaDefCriteria.getTenantId())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" schema.tenantid = ? "); + preparedStmtList.add(schemaDefCriteria.getTenantId()); + } + if (!Objects.isNull(schemaDefCriteria.getCodes())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" schema.code IN ( ").append(QueryUtil.createQuery(schemaDefCriteria.getCodes().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, new HashSet<>(schemaDefCriteria.getCodes())); + } + + return builder.toString(); + } + + private String getPaginatedQuery(String query, SchemaDefCriteria schemaDefCriteria, List preparedStmtList) { + StringBuilder paginatedQuery = new StringBuilder(query); + + // Append offset + paginatedQuery.append(" OFFSET ? "); + preparedStmtList.add(ObjectUtils.isEmpty(schemaDefCriteria.getOffset()) ? config.getDefaultOffset() : schemaDefCriteria.getOffset()); + + // Append limit + paginatedQuery.append(" LIMIT ? "); + preparedStmtList.add(ObjectUtils.isEmpty(schemaDefCriteria.getLimit()) ? config.getDefaultLimit() : schemaDefCriteria.getLimit()); + + return paginatedQuery.toString(); + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/MdmsDataRowMapper.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/MdmsDataRowMapper.java new file mode 100644 index 00000000000..d5829ac662a --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/MdmsDataRowMapper.java @@ -0,0 +1,70 @@ +package org.egov.infra.mdms.repository.rowmapper; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; +import org.egov.common.contract.models.AuditDetails; +import org.egov.infra.mdms.model.Mdms; +import org.egov.infra.mdms.model.SchemaDefinition; +import static org.egov.infra.mdms.errors.ErrorCodes.*; +import org.egov.tracer.model.CustomException; +import org.postgresql.util.PGobject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.*; + +import static java.util.Objects.isNull; + +@Component +@Slf4j +public class MdmsDataRowMapper implements ResultSetExtractor>> { + + @Autowired + private ObjectMapper objectMapper; + + /** + * This method accepts a resultSet and extracts master data in JSONArray format + * and creates a map of schemaCode vs master data + * @param resultSet + * @return + * @throws SQLException + * @throws DataAccessException + */ + @Override + public Map> extractData(ResultSet resultSet) throws SQLException, DataAccessException { + Map> tenantMasterMap = new HashMap<>(); + + while(resultSet.next()){ + JSONArray jsonArray = null; + Map masterMap = new HashMap<>(); + LinkedHashMap data = null; + if( ! isNull(resultSet.getObject("data"))){ + String dataStr = ((PGobject) resultSet.getObject("data")).getValue(); + try { + data = objectMapper.readValue(dataStr, LinkedHashMap.class); + } catch (IOException e) { + throw new CustomException(INVALID_JSON, INVALID_JSON_MSG); + } + } + String schemaCode = resultSet.getString("schemacode"); + String tenantId = resultSet.getString("tenantid"); + jsonArray = tenantMasterMap.getOrDefault(tenantId, new HashMap<>()).getOrDefault(schemaCode, new JSONArray()); + jsonArray.add(data); + masterMap.put(schemaCode, jsonArray); + if(tenantMasterMap.containsKey(tenantId)) { + tenantMasterMap.get(tenantId).put(schemaCode, jsonArray); + } else { + tenantMasterMap.put(tenantId, masterMap); + } + } + + return tenantMasterMap; + } +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/MdmsDataRowMapperV2.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/MdmsDataRowMapperV2.java new file mode 100644 index 00000000000..c1a4d355d2e --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/MdmsDataRowMapperV2.java @@ -0,0 +1,75 @@ +package org.egov.infra.mdms.repository.rowmapper; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.models.AuditDetails; +import org.egov.infra.mdms.model.Mdms; +import org.egov.tracer.model.CustomException; +import org.postgresql.util.PGobject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import static java.util.Objects.isNull; +import static org.egov.infra.mdms.errors.ErrorCodes.INVALID_JSON; +import static org.egov.infra.mdms.errors.ErrorCodes.INVALID_JSON_MSG; + +@Component +@Slf4j +public class MdmsDataRowMapperV2 implements ResultSetExtractor> { + + @Autowired + private ObjectMapper objectMapper; + + /** + * This method accepts resultSet from the executed search query and extracts data out + * of the result set and maps it into master data POJO + * @param resultSet + * @return + * @throws SQLException + * @throws DataAccessException + */ + @Override + public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { + + List mdmsList = new ArrayList<>(); + + while (resultSet.next()) { + AuditDetails auditDetails = AuditDetails.builder().createdBy(resultSet.getString("createdby")). + createdTime(resultSet.getLong("createdtime")). + lastModifiedBy(resultSet.getString("lastmodifiedby")). + lastModifiedTime(resultSet.getLong("lastmodifiedtime")).build(); + + JsonNode data = null; + if (!isNull(resultSet.getObject("data"))) { + String dataStr = ((PGobject) resultSet.getObject("data")).getValue(); + try { + data = objectMapper.readTree(dataStr); + } catch (IOException e) { + throw new CustomException(INVALID_JSON, INVALID_JSON_MSG); + } + } + + Mdms mdms = Mdms.builder() + .id(resultSet.getString("id")) + .tenantId(resultSet.getString("tenantid")) + .schemaCode(resultSet.getString("schemacode")) + .uniqueIdentifier(resultSet.getString("uniqueidentifier")) + .data(data) + .isActive(resultSet.getBoolean("isactive")) + .auditDetails(auditDetails).build(); + + mdmsList.add(mdms); + } + + return mdmsList; + } +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/SchemaDefinitionRowMapper.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/SchemaDefinitionRowMapper.java new file mode 100644 index 00000000000..b2a3f947c7f --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/SchemaDefinitionRowMapper.java @@ -0,0 +1,78 @@ +package org.egov.infra.mdms.repository.rowmapper; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.egov.common.contract.models.AuditDetails; +import org.egov.infra.mdms.model.SchemaDefinition; +import org.egov.tracer.model.CustomException; +import org.postgresql.util.PGobject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +@Component +public class SchemaDefinitionRowMapper implements ResultSetExtractor> { + + @Autowired + private ObjectMapper objectMapper; + + /** + * This method accepts resultSet from query execution, extracts the respective fields + * and maps it into SchemaDefinition POJO. + * @param resultSet + * @return + * @throws SQLException + * @throws DataAccessException + */ + @Override + public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { + List schemaDefinitions = new ArrayList<>(); + while(resultSet.next()){ + + AuditDetails auditDetails = AuditDetails.builder().createdBy(resultSet.getString("createdby")). + createdTime(resultSet.getLong("createdtime")). + lastModifiedBy(resultSet.getString("lastmodifiedby")). + lastModifiedTime(resultSet.getLong("lastmodifiedtime")).build(); + + SchemaDefinition schemaDefinition = SchemaDefinition.builder() + .tenantId(resultSet.getString("tenantid")) + .id(resultSet.getString("id")) + .code(resultSet.getString("code")) + .description(resultSet.getString("description")) + .definition(getJsonValue((PGobject) resultSet.getObject("definition"))) + .isActive(resultSet.getBoolean("isactive")) + .auditDetails(auditDetails) + .build(); + + schemaDefinitions.add(schemaDefinition); + } + + return schemaDefinitions; + } + + /** + * This method accepts a PGobject and converts it into JsonNode. + * @param pGobject + * @return + */ + private JsonNode getJsonValue(PGobject pGobject) { + try { + if (Objects.isNull(pGobject) || Objects.isNull(pGobject.getValue())) + return null; + else + return objectMapper.readTree(pGobject.getValue()); + } catch (IOException e) { + throw new CustomException("SERVER_ERROR", "Exception occurred while parsing the additionalDetail json : " + e + .getMessage()); + } + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/MDMSService.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/MDMSService.java new file mode 100644 index 00000000000..227e8f629b2 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/MDMSService.java @@ -0,0 +1,150 @@ +package org.egov.infra.mdms.service; + +import java.util.*; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.jayway.jsonpath.JsonPath; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.repository.MdmsDataRepository; +import org.egov.infra.mdms.service.enrichment.MdmsDataEnricher; +import org.egov.infra.mdms.service.validator.MdmsDataValidator; +import org.egov.infra.mdms.utils.FallbackUtil; +import org.egov.infra.mdms.utils.SchemaUtil; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; +import org.springframework.util.ObjectUtils; + +import static org.egov.infra.mdms.utils.MDMSConstants.*; + +@Service +@Slf4j +public class MDMSService { + + private MdmsDataValidator mdmsDataValidator; + + private MdmsDataEnricher mdmsDataEnricher; + + private MdmsDataRepository mdmsDataRepository; + + private SchemaUtil schemaUtil; + + private MultiStateInstanceUtil multiStateInstanceUtil; + + @Autowired + public MDMSService(MdmsDataValidator mdmsDataValidator, MdmsDataEnricher mdmsDataEnricher, + MdmsDataRepository mdmsDataRepository, SchemaUtil schemaUtil, MultiStateInstanceUtil multiStateInstanceUtil) { + this.mdmsDataValidator = mdmsDataValidator; + this.mdmsDataEnricher = mdmsDataEnricher; + this.mdmsDataRepository = mdmsDataRepository; + this.schemaUtil = schemaUtil; + this.multiStateInstanceUtil = multiStateInstanceUtil; + } + + /** + * This method processes the requests that come for master data creation. + * @param mdmsRequest + * @return + */ + public List create(MdmsRequest mdmsRequest) { + + // Fetch schema against which data is getting created + JSONObject schemaObject = schemaUtil.getSchema(mdmsRequest); + + // Validate incoming request + mdmsDataValidator.validateCreateRequest(mdmsRequest, schemaObject); + + // Enrich incoming request + mdmsDataEnricher.enrichCreateRequest(mdmsRequest, schemaObject); + + // Emit mdms creation request event + mdmsDataRepository.create(mdmsRequest); + + return Arrays.asList(mdmsRequest.getMdms()); + } + + /** + * This method processes the requests that come for master data search. + * @param mdmsCriteriaReq + * @return + */ + public Map> search(MdmsCriteriaReq mdmsCriteriaReq) { + Map> tenantMasterMap = new HashMap<>(); + + /* + * Set incoming tenantId as state level tenantId for fallback in case master data for + * concrete tenantId does not exist. + */ + String tenantId = new StringBuilder(mdmsCriteriaReq.getMdmsCriteria().getTenantId()).toString(); + mdmsCriteriaReq.getMdmsCriteria().setTenantId(multiStateInstanceUtil.getStateLevelTenant(tenantId)); + + Map schemaCodes = getSchemaCodes(mdmsCriteriaReq.getMdmsCriteria()); + mdmsCriteriaReq.getMdmsCriteria().setSchemaCodeFilterMap(schemaCodes); + + // Make a call to the repository layer to fetch data as per given criteria + tenantMasterMap = mdmsDataRepository.search(mdmsCriteriaReq.getMdmsCriteria()); + + // Apply filters to incoming data + tenantMasterMap = applyFilterToData(tenantMasterMap, mdmsCriteriaReq.getMdmsCriteria().getSchemaCodeFilterMap()); + + // Perform fallback + Map masterDataMap = FallbackUtil.backTrackTenantMasterDataMap(tenantMasterMap, tenantId); + + // Return response in MDMS v1 search response format for backward compatibility + return getModuleMasterMap(masterDataMap); + } + + private Map> applyFilterToData(Map> tenantMasterMap, Map schemaCodeFilterMap) { + Map> tenantMasterMapPostFiltering = new HashMap<>(); + + tenantMasterMap.keySet().forEach(tenantId -> { + Map schemaCodeVsFilteredMasters = new HashMap<>(); + tenantMasterMap.get(tenantId).keySet().forEach(schemaCode -> { + JSONArray masters = tenantMasterMap.get(tenantId).get(schemaCode); + if(!ObjectUtils.isEmpty(schemaCodeFilterMap.get(schemaCode))) { + schemaCodeVsFilteredMasters.put(schemaCode, filterMasters(masters, schemaCodeFilterMap.get(schemaCode))); + } else { + schemaCodeVsFilteredMasters.put(schemaCode, masters); + } + }); + tenantMasterMapPostFiltering.put(tenantId, schemaCodeVsFilteredMasters); + }); + + return tenantMasterMapPostFiltering; + } + + private JSONArray filterMasters(JSONArray masters, String filterExp) { + JSONArray filteredMasters = JsonPath.read(masters, filterExp); + return filteredMasters; + } + + private Map> getModuleMasterMap(Map masterMap) { + Map> moduleMasterMap = new HashMap<>(); + + for (Map.Entry entry : masterMap.entrySet()) { + String[] moduleMaster = entry.getKey().split(DOT_REGEX); + String moduleName = moduleMaster[0]; + String masterName = moduleMaster[1]; + + moduleMasterMap.computeIfAbsent(moduleName, k -> new HashMap<>()) + .put(masterName, entry.getValue()); + } + return moduleMasterMap; + } + + private Map getSchemaCodes(MdmsCriteria mdmsCriteria) { + Map schemaCodesFilterMap = new HashMap<>(); + for (ModuleDetail moduleDetail : mdmsCriteria.getModuleDetails()) { + for (MasterDetail masterDetail : moduleDetail.getMasterDetails()) { + String key = moduleDetail.getModuleName().concat(DOT_SEPARATOR).concat(masterDetail.getName()); + String value = masterDetail.getFilter(); + schemaCodesFilterMap.put(key, value); + } + } + return schemaCodesFilterMap; + } +} \ No newline at end of file diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/MDMSServiceV2.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/MDMSServiceV2.java new file mode 100644 index 00000000000..4c77ec4ee4c --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/MDMSServiceV2.java @@ -0,0 +1,116 @@ +package org.egov.infra.mdms.service; + +import lombok.extern.slf4j.Slf4j; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.repository.MdmsDataRepository; +import org.egov.infra.mdms.service.enrichment.MdmsDataEnricher; +import org.egov.infra.mdms.service.validator.MdmsDataValidator; +import org.egov.infra.mdms.utils.FallbackUtil; +import org.egov.infra.mdms.utils.SchemaUtil; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +@Slf4j +@Service +public class MDMSServiceV2 { + + private MdmsDataValidator mdmsDataValidator; + + private MdmsDataEnricher mdmsDataEnricher; + + private MdmsDataRepository mdmsDataRepository; + + private SchemaUtil schemaUtil; + + private MultiStateInstanceUtil multiStateInstanceUtil; + + @Autowired + public MDMSServiceV2(MdmsDataValidator mdmsDataValidator, MdmsDataEnricher mdmsDataEnricher, + MdmsDataRepository mdmsDataRepository, SchemaUtil schemaUtil, MultiStateInstanceUtil multiStateInstanceUtil) { + this.mdmsDataValidator = mdmsDataValidator; + this.mdmsDataEnricher = mdmsDataEnricher; + this.mdmsDataRepository = mdmsDataRepository; + this.schemaUtil = schemaUtil; + this.multiStateInstanceUtil = multiStateInstanceUtil; + } + + /** + * This method processes the requests that come for master data creation. + * @param mdmsRequest + * @return + */ + public List create(MdmsRequest mdmsRequest) { + + // Fetch schema against which data is getting created + JSONObject schemaObject = schemaUtil.getSchema(mdmsRequest); + + // Perform validations on incoming request + mdmsDataValidator.validateCreateRequest(mdmsRequest, schemaObject); + + // Enrich incoming master data + mdmsDataEnricher.enrichCreateRequest(mdmsRequest, schemaObject); + + // Emit MDMS create event to be listened by persister + mdmsDataRepository.create(mdmsRequest); + + return Arrays.asList(mdmsRequest.getMdms()); + } + + /** + * This method processes the requests that come for master data search. + * @param mdmsCriteriaReqV2 + * @return + */ + public List search(MdmsCriteriaReqV2 mdmsCriteriaReqV2) { + + /* + * Set incoming tenantId as state level tenantId for fallback in case master data for + * concrete tenantId does not exist. + */ + String tenantId = mdmsCriteriaReqV2.getMdmsCriteria().getTenantId(); + + List masterDataList = new ArrayList<>(); + List subTenantListForFallback = FallbackUtil.getSubTenantListForFallBack(tenantId); + + // Make a call to repository and get list of master data + for(String subTenantId : subTenantListForFallback) { + mdmsCriteriaReqV2.getMdmsCriteria().setTenantId(subTenantId); + masterDataList = mdmsDataRepository.searchV2(mdmsCriteriaReqV2.getMdmsCriteria()); + + if(!CollectionUtils.isEmpty(masterDataList)) + break; + } + + return masterDataList; + } + + /** + * This method processes the requests that come for master data update. + * @param mdmsRequest + * @return + */ + public List update(MdmsRequest mdmsRequest) { + + // Fetch schema against which data is getting created + JSONObject schemaObject = schemaUtil.getSchema(mdmsRequest); + + // Validate master data update request + mdmsDataValidator.validateUpdateRequest(mdmsRequest, schemaObject); + + // Enrich master data update request + mdmsDataEnricher.enrichUpdateRequest(mdmsRequest); + + // Emit MDMS update event to be listened by persister + mdmsDataRepository.update(mdmsRequest); + + return Arrays.asList(mdmsRequest.getMdms()); + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/SchemaDefinitionService.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/SchemaDefinitionService.java new file mode 100644 index 00000000000..dbde2ff784e --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/SchemaDefinitionService.java @@ -0,0 +1,78 @@ +package org.egov.infra.mdms.service; + +import lombok.Builder; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.infra.mdms.config.ApplicationConfig; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.repository.SchemaDefinitionRepository; +import org.egov.infra.mdms.service.enrichment.SchemaDefinitionEnricher; +import org.egov.infra.mdms.service.validator.SchemaDefinitionValidator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.List; + +@Service +@Builder +@Slf4j +public class SchemaDefinitionService { + + private SchemaDefinitionRepository schemaDefinitionRepository; + private ApplicationConfig applicationConfig; + private SchemaDefinitionEnricher schemaDefinitionEnricher; + private SchemaDefinitionValidator schemaDefinitionValidator; + private MultiStateInstanceUtil multiStateInstanceUtil; + + @Autowired + public SchemaDefinitionService(SchemaDefinitionRepository schemaDefinitionRepository, ApplicationConfig applicationConfig, + SchemaDefinitionEnricher schemaDefinitionEnricher, SchemaDefinitionValidator schemaDefinitionValidator, MultiStateInstanceUtil multiStateInstanceUtil){ + this.schemaDefinitionRepository = schemaDefinitionRepository; + this.applicationConfig = applicationConfig; + this.schemaDefinitionEnricher = schemaDefinitionEnricher; + this.schemaDefinitionValidator = schemaDefinitionValidator; + this.multiStateInstanceUtil = multiStateInstanceUtil; + } + + /** + * This method processes requests for schema definition creation. + * @param schemaDefinitionRequest + * @return + */ + public List create(SchemaDefinitionRequest schemaDefinitionRequest) { + + // Set incoming tenantId as state level tenantId as schema is always created at state level + String tenantId = schemaDefinitionRequest.getSchemaDefinition().getTenantId(); + schemaDefinitionRequest.getSchemaDefinition().setTenantId(multiStateInstanceUtil.getStateLevelTenant(tenantId)); + + // Validate schema create request + schemaDefinitionValidator.validateCreateRequest(schemaDefinitionRequest); + + // Enrich schema create request + schemaDefinitionEnricher.enrichCreateRequest(schemaDefinitionRequest); + + // Invoke repository method to emit schema creation event + schemaDefinitionRepository.create(schemaDefinitionRequest); + + return Arrays.asList(schemaDefinitionRequest.getSchemaDefinition()); + } + + /** + * This method processes the requests for schema definition search. + * @param schemaDefSearchRequest + * @return + */ + public List search(SchemaDefSearchRequest schemaDefSearchRequest) { + + // Set incoming tenantId as state level tenantId as schema is created at state level + String tenantId = schemaDefSearchRequest.getSchemaDefCriteria().getTenantId(); + schemaDefSearchRequest.getSchemaDefCriteria().setTenantId(multiStateInstanceUtil.getStateLevelTenant(tenantId)); + + // Fetch schema definitions based on the given criteria + List schemaDefinitions = schemaDefinitionRepository.search(schemaDefSearchRequest.getSchemaDefCriteria()); + + return schemaDefinitions; + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/enrichment/MdmsDataEnricher.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/enrichment/MdmsDataEnricher.java new file mode 100644 index 00000000000..bc20d3a8924 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/enrichment/MdmsDataEnricher.java @@ -0,0 +1,50 @@ +package org.egov.infra.mdms.service.enrichment; + +import org.egov.common.contract.models.AuditDetails; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.AuditDetailsEnrichmentUtil; +import org.egov.common.utils.UUIDEnrichmentUtil; +import org.egov.infra.mdms.model.Mdms; +import org.egov.infra.mdms.model.MdmsRequest; +import org.egov.infra.mdms.utils.CompositeUniqueIdentifierGenerationUtil; +import org.egov.tracer.model.CustomException; +import org.json.JSONObject; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; + +@Component +public class MdmsDataEnricher { + + public void enrichCreateRequest(MdmsRequest mdmsRequest, JSONObject schemaObject) { + Mdms mdms = mdmsRequest.getMdms(); + UUIDEnrichmentUtil.enrichRandomUuid(mdms, "id"); + mdms.setAuditDetails(AuditDetailsEnrichmentUtil.prepareAuditDetails(mdms.getAuditDetails(), mdmsRequest.getRequestInfo(), Boolean.TRUE)); + mdms.setUniqueIdentifier(CompositeUniqueIdentifierGenerationUtil.getUniqueIdentifier(schemaObject, mdmsRequest)); + } + + public AuditDetails getAuditDetails(RequestInfo requestInfo, AuditDetails auditDetails, Boolean isCreateRequest) { + if(isCreateRequest) { + auditDetails = AuditDetails.builder().createdBy(requestInfo.getUserInfo().getUuid()). + createdTime(System.currentTimeMillis()).lastModifiedBy(requestInfo.getUserInfo().getUuid()). + lastModifiedTime(System.currentTimeMillis()).build(); + } else { + if(auditDetails != null) { + auditDetails = AuditDetails.builder().createdBy(auditDetails.getCreatedBy()). + createdTime(auditDetails.getCreatedTime()).lastModifiedBy(requestInfo.getUserInfo().getUuid()). + lastModifiedTime(System.currentTimeMillis()).build(); + } else { + throw new CustomException("AUDIT_DETAILS_NULL_FOR_UPDATE_REQ","Audit details can not be null for update request"); + } + } + return auditDetails; + } + + public void enrichUpdateRequest(MdmsRequest mdmsRequest) { + Mdms mdms = mdmsRequest.getMdms(); + + if(ObjectUtils.isEmpty(mdms.getAuditDetails())) + throw new CustomException("AUDIT_DETAILS_ABSENT_ERR", "Audit details cannot be absent for update request"); + + mdms.setAuditDetails(getAuditDetails(mdmsRequest.getRequestInfo(), mdms.getAuditDetails(), Boolean.FALSE)); + } +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/enrichment/SchemaDefinitionEnricher.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/enrichment/SchemaDefinitionEnricher.java new file mode 100644 index 00000000000..9d2c12dd9cd --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/enrichment/SchemaDefinitionEnricher.java @@ -0,0 +1,48 @@ +package org.egov.infra.mdms.service.enrichment; + +import org.egov.common.contract.models.AuditDetails; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.AuditDetailsEnrichmentUtil; +import org.egov.common.utils.UUIDEnrichmentUtil; +import org.egov.infra.mdms.model.SchemaDefinition; +import org.egov.infra.mdms.model.SchemaDefinitionRequest; +import org.egov.tracer.model.CustomException; +import org.springframework.stereotype.Component; + +import java.util.UUID; + +@Component +public class SchemaDefinitionEnricher { + + /** + * This method enriches schemaDefinitionRequest + * @param schemaDefinitionRequest + */ + public void enrichCreateRequest(SchemaDefinitionRequest schemaDefinitionRequest) { + SchemaDefinition schemaDefinition = schemaDefinitionRequest.getSchemaDefinition(); + + // Invoke enrichment of uuid on id field of schemaDefinition + UUIDEnrichmentUtil.enrichRandomUuid(schemaDefinition, "id"); + + // Populate auditDetails + schemaDefinition.setAuditDetails(getAuditDetail(schemaDefinitionRequest.getRequestInfo(),schemaDefinition.getAuditDetails(), true)); + } + + public AuditDetails getAuditDetail(RequestInfo requestInfo, AuditDetails auditDetails, Boolean isCreateRequest) { + if(isCreateRequest) { + auditDetails = AuditDetails.builder().createdBy(requestInfo.getUserInfo().getUuid()). + createdTime(System.currentTimeMillis()).lastModifiedBy(requestInfo.getUserInfo().getUuid()). + lastModifiedTime(System.currentTimeMillis()).build(); + } else { + if(auditDetails != null ) { + auditDetails = AuditDetails.builder().createdBy(auditDetails.getCreatedBy()). + createdTime(auditDetails.getCreatedTime()).lastModifiedBy(requestInfo.getUserInfo().getUuid()). + lastModifiedTime(System.currentTimeMillis()).build(); + } else { + throw new CustomException("AUDIT_DETAILS_NULL_FOR_UPDATE_REQ","Audit details can not be null for update request"); + } + } + return auditDetails; + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/validator/MdmsDataValidator.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/validator/MdmsDataValidator.java new file mode 100644 index 00000000000..52186b61cf3 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/validator/MdmsDataValidator.java @@ -0,0 +1,252 @@ +package org.egov.infra.mdms.service.validator; + +import com.fasterxml.jackson.databind.JsonNode; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.TypeRef; +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.repository.MdmsDataRepository; +import org.egov.infra.mdms.service.SchemaDefinitionService; +import org.egov.infra.mdms.utils.CompositeUniqueIdentifierGenerationUtil; +import org.egov.infra.mdms.utils.ErrorUtil; +import org.egov.infra.mdms.utils.FallbackUtil; +import org.egov.tracer.model.CustomException; +import org.everit.json.schema.Schema; +import org.everit.json.schema.ValidationException; +import org.everit.json.schema.loader.SchemaLoader; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.StreamSupport; + +import static org.egov.infra.mdms.utils.MDMSConstants.*; + +@Component +@Slf4j +public class MdmsDataValidator { + + private final SchemaDefinitionService schemaDefinitionService; + + private final MdmsDataRepository mdmsDataRepository; + + @Autowired + public MdmsDataValidator(SchemaDefinitionService schemaDefinitionService, MdmsDataRepository mdmsDataRepository) { + this.schemaDefinitionService = schemaDefinitionService; + this.mdmsDataRepository = mdmsDataRepository; + } + + /** + * This method performs business validations on create master data request. + * @param mdmsRequest + * @param schemaObject + */ + public void validateCreateRequest(MdmsRequest mdmsRequest, JSONObject schemaObject) { + // Initialize error map and fetch schema + Map errors = new HashMap<>(); + + // Validations are performed here on the incoming data + validateDataWithSchemaDefinition(mdmsRequest, schemaObject, errors); + checkDuplicate(schemaObject, mdmsRequest); + validateReference(schemaObject, mdmsRequest.getMdms()); + + // Throw validation errors + ErrorUtil.throwCustomExceptions(errors); + } + + /** + * This method validates the incoming master data against the schema for which the master + * data is being created and populates violations(if any) in errors map. + * @param mdmsRequest + * @param schemaObject + * @param errors + */ + private void validateDataWithSchemaDefinition(MdmsRequest mdmsRequest, JSONObject schemaObject,Map errors) { + try { + // Load incoming master data as a json object + JSONObject dataObject = new JSONObject(mdmsRequest.getMdms().getData().toString()); + + // Load schema + Schema schema = SchemaLoader.load(schemaObject); + + // Validate data against the schema + schema.validate(dataObject); + } catch (ValidationException e) { + // Populate errors map for all the validation errors + Integer count = 0; + if (!e.getCausingExceptions().isEmpty()) { + for (ValidationException validationException : e.getCausingExceptions()) { + ++count; + errors.put("INVALID_REQUEST_".concat(validationException.getKeyword().toUpperCase()).concat(count.toString()), validationException.getErrorMessage()); + } + } else { + errors.put("INVALID_REQUEST", e.getErrorMessage()); + } + } catch (Exception e) { + throw new CustomException("MASTER_DATA_VALIDATION_ERR", "An unknown error occurred while validating provided master data against the schema - " + e.getMessage()); + } + } + + /** + * This method checks whether the master data which is being created already + * exists in the database or not. + * @param schemaObject + * @param mdmsRequest + */ + private void checkDuplicate(JSONObject schemaObject, MdmsRequest mdmsRequest) { + // Get the uniqueIdentifier for the incoming master data request + String uniqueIdentifier = CompositeUniqueIdentifierGenerationUtil.getUniqueIdentifier(schemaObject, mdmsRequest); + + // Fetch master data + List masterData = fetchMasterData(MdmsCriteriaV2.builder() + .tenantId(mdmsRequest.getMdms().getTenantId()) + .uniqueIdentifiers(Collections.singleton(uniqueIdentifier)) + .schemaCode(mdmsRequest.getMdms().getSchemaCode()) + .isActive(Boolean.TRUE) + .build()); + + // Throw error if the provided master data already exists + if (masterData != null && masterData.size() != 0) { + throw new CustomException("DUPLICATE_RECORD", "Duplicate record"); + } + + } + + /** + * This method fetches master data from the database depending on the criteria + * being passed. + * @param mdmsCriteria + * @return + */ + private List fetchMasterData(MdmsCriteriaV2 mdmsCriteria) { + // Make a call to the repository to check if the provided master data already exists + List moduleMasterData = mdmsDataRepository.searchV2(mdmsCriteria); + + return moduleMasterData; + + } + + /** + * This method validates whether the provided reference exists in the database. + * @param schemaObject + * @param mdms + */ + private void validateReference(JSONObject schemaObject, Mdms mdms) { + if (schemaObject.has(X_REFERENCE_SCHEMA_KEY)) { + org.json.JSONArray referenceSchema = (org.json.JSONArray) schemaObject.get(X_REFERENCE_SCHEMA_KEY); + + if (referenceSchema != null && referenceSchema.length() > 0) { + JsonNode mdmsData = mdms.getData(); + + IntStream.range(0, referenceSchema.length()).forEach(i -> { + Set uniqueIdentifiersForRefVerification = new HashSet<>(); + + JSONObject jsonObject = referenceSchema.getJSONObject(i); + String refFieldPath = jsonObject.getString(FIELD_PATH_KEY); + String schemaCode = jsonObject.getString(SCHEMA_CODE_KEY); + Object refResult = JsonPath.read(mdmsData.toString(), CompositeUniqueIdentifierGenerationUtil.getJsonPathExpressionFromDotSeparatedPath(refFieldPath)); + + addTypeCastedUniqueIdentifiersToVerificationSet(refResult, uniqueIdentifiersForRefVerification); + List subTenantListForFallback = FallbackUtil.getSubTenantListForFallBack(mdms.getTenantId()); + + Boolean isRefDataFound = Boolean.FALSE; + + for(String subTenant : subTenantListForFallback) { + List moduleMasterData = mdmsDataRepository.searchV2( + MdmsCriteriaV2.builder().tenantId(subTenant).uniqueIdentifiersForRefVerification(uniqueIdentifiersForRefVerification).schemaCode(schemaCode).build()); + + if (moduleMasterData.size() == uniqueIdentifiersForRefVerification.size()) { + isRefDataFound = Boolean.TRUE; + break; + } + } + + if(!isRefDataFound) { + throw new CustomException("REFERENCE_VALIDATION_ERR", "Provided reference value does not exist in database"); + } + + }); + } + } + } + + /** + * This method takes the reference object provided in the data create request, type casts it into String + * and adds it to the uniqueIdentifiers set for performing search. + * @param refResult + * @param uniqueIdentifiersForRefVerification + */ + private void addTypeCastedUniqueIdentifiersToVerificationSet(Object refResult, Set uniqueIdentifiersForRefVerification) { + if (refResult instanceof String) { + uniqueIdentifiersForRefVerification.add((String) refResult); + } else if(refResult instanceof Number){ + uniqueIdentifiersForRefVerification.add(String.valueOf(refResult)); + } else if (refResult instanceof List) { + uniqueIdentifiersForRefVerification.addAll((Collection) refResult); + } else { + throw new CustomException("REFERENCE_VALIDATION_ERR", "Reference must only be of the type string, number or a list of strings/numbers"); + } + } + + /** + * This method performs business validations on create master data request. + * @param mdmsRequest + * @param schemaObject + */ + public void validateUpdateRequest(MdmsRequest mdmsRequest, JSONObject schemaObject) { + // Initialize error map and fetch schema + Map errors = new HashMap<>(); + + // Validations are performed here on the incoming data + String uniqueIdentifierOfExistingRecord = fetchUniqueIdentifier(mdmsRequest); + validateIfUniqueFieldsAreNotBeingUpdated(uniqueIdentifierOfExistingRecord, CompositeUniqueIdentifierGenerationUtil.getUniqueIdentifier(schemaObject, mdmsRequest)); + validateDataWithSchemaDefinition(mdmsRequest, schemaObject, errors); + validateReference(schemaObject, mdmsRequest.getMdms()); + + // Throw validation errors + ErrorUtil.throwCustomExceptions(errors); + + } + + /** + * This method validates if any fields defined under unique field list are being updated. + * @param uniqueIdentifierOfExistingRecord + * @param uniqueIdentifier + */ + private void validateIfUniqueFieldsAreNotBeingUpdated(String uniqueIdentifierOfExistingRecord, String uniqueIdentifier) { + if(!uniqueIdentifierOfExistingRecord.equalsIgnoreCase(uniqueIdentifier)) { + throw new CustomException("UNIQUE_KEY_UPDATE_ERR", "Updating fields defined as unique is not allowed."); + } + } + + /** + * This method checks if the master that is being created already exists or not. + * @param mdmsRequest + * @return + */ + private String fetchUniqueIdentifier(MdmsRequest mdmsRequest) { + if(ObjectUtils.isEmpty(mdmsRequest.getMdms().getId())) + throw new CustomException("MASTER_DATA_ID_ABSENT_ERR", "Providing master data id is mandatory for update operation."); + + Set idForSearch = new HashSet<>(); + idForSearch.add(mdmsRequest.getMdms().getId()); + + // Fetch master data from database + List masterData = fetchMasterData(MdmsCriteriaV2.builder() + .tenantId(mdmsRequest.getMdms().getTenantId()) + .ids(idForSearch) + .build()); + + // Throw error if the provided master data does not exist + if (masterData == null || masterData.size() == 0) { + throw new CustomException("MASTER_DATA_NOT_FOUND", "Master data not found for update operation."); + } // Return unique identifier if the master data exists + else { + return masterData.get(0).getUniqueIdentifier(); + } + } +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/validator/SchemaDefinitionValidator.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/validator/SchemaDefinitionValidator.java new file mode 100644 index 00000000000..c7fa9c8e44a --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/service/validator/SchemaDefinitionValidator.java @@ -0,0 +1,99 @@ +package org.egov.infra.mdms.service.validator; + +import com.fasterxml.jackson.databind.JsonNode; +import org.egov.common.contract.request.RequestInfo; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.repository.SchemaDefinitionRepository; +import static org.egov.infra.mdms.errors.ErrorCodes.*; +import static org.egov.infra.mdms.utils.MDMSConstants.*; +import org.egov.infra.mdms.utils.ErrorUtil; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import java.util.*; + +@Component +public class SchemaDefinitionValidator { + + private SchemaDefinitionRepository schemaDefinitionRepository; + + @Autowired + public SchemaDefinitionValidator(SchemaDefinitionRepository schemaDefinitionRepository) { + this.schemaDefinitionRepository = schemaDefinitionRepository; + } + + /** + * This method performs business validations on schemaDefinitionRequest. + * @param schemaDefinitionRequest + */ + public void validateCreateRequest(SchemaDefinitionRequest schemaDefinitionRequest) { + + SchemaDefinition schemaDefinition = schemaDefinitionRequest.getSchemaDefinition(); + Map errors = new HashMap<>(); + + // Validate schema attributes + validateSchemaAttributes(schemaDefinition.getDefinition(), errors); + + // Check schema code uniqueness + checkSchemaCode(schemaDefinition.getTenantId(), Arrays.asList(schemaDefinition.getCode()), errors); + + // Throw errors if any + ErrorUtil.throwCustomExceptions(errors); + } + + /** + * This method performs validations on the schema definition attributes namely - + * 1. validate that required fields list is not empty + * 2. validate that unique fields list is not empty + * 3. validate that list of unique attributes is a subset of list of required attributes + * @param definition + * @param errorMap + */ + private void validateSchemaAttributes(JsonNode definition, Map errorMap) { + JSONObject schemaObject = new JSONObject(definition.toString()); + + // Check if the incoming schema definition has "required" key and at least one value against it + if(!schemaObject.has(REQUIRED_KEY) || ((org.json.JSONArray) schemaObject.get(REQUIRED_KEY)).length() == 0){ + errorMap.put(REQUIRED_ATTRIBUTE_LIST_ERR_CODE, REQUIRED_ATTRIBUTE_LIST_EMPTY_MSG); + } + + // Check if the incoming schema definition has "x-unique" key and at least one value against it + if(!schemaObject.has(X_UNIQUE_KEY) || ((org.json.JSONArray) schemaObject.get(X_UNIQUE_KEY)).length() == 0) { + errorMap.put(UNIQUE_ATTRIBUTE_LIST_ERR_CODE, UNIQUE_ATTRIBUTE_LIST_EMPTY_MSG); + } + + // Perform further validations iff both "required" and "x-unique" keys are present + if(CollectionUtils.isEmpty(errorMap)) { + List requiredAttributesList = ((org.json.JSONArray) schemaObject.get(REQUIRED_KEY)).toList(); + + List uniqueAttributesList = ((org.json.JSONArray) schemaObject.get(X_UNIQUE_KEY)).toList(); + + // Check if values against unique attributes are a subset of required fields + if (uniqueAttributesList.size() > requiredAttributesList.size() || !requiredAttributesList.containsAll(uniqueAttributesList)) { + errorMap.put(UNIQUE_ATTRIBUTE_LIST_ERR_CODE, UNIQUE_ATTRIBUTE_LIST_INVALID_MSG); + } + } + } + + /** + * This method checks whether a schema definition with the provided tenantId and code already exists. + * @param tenantId + * @param codes + * @param errorMap + */ + private void checkSchemaCode(String tenantId, List codes, Map errorMap) { + + // Build schema definition search criteria + SchemaDefCriteria schemaDefCriteria = SchemaDefCriteria.builder().tenantId(tenantId).codes(codes).build(); + + // Search for schema definitions with the incoming tenantId and codes + List schemaDefinitions = schemaDefinitionRepository.search(schemaDefCriteria); + + // If schema definition already exists for tenantId and code combination, populate error map + if(!schemaDefinitions.isEmpty()){ + errorMap.put(DUPLICATE_SCHEMA_CODE, DUPLICATE_SCHEMA_CODE_MSG); + } + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/CompositeUniqueIdentifierGenerationUtil.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/CompositeUniqueIdentifierGenerationUtil.java new file mode 100644 index 00000000000..cad46a2f946 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/CompositeUniqueIdentifierGenerationUtil.java @@ -0,0 +1,65 @@ +package org.egov.infra.mdms.utils; + +import com.fasterxml.jackson.databind.JsonNode; +import org.egov.infra.mdms.model.MdmsRequest; +import org.egov.tracer.model.CustomException; +import org.json.JSONObject; +import org.springframework.util.StringUtils; + +import java.util.stream.IntStream; +import static org.egov.infra.mdms.utils.MDMSConstants.*; + +public class CompositeUniqueIdentifierGenerationUtil { + + private CompositeUniqueIdentifierGenerationUtil(){} + + /** + * This method creates composite unique identifier based on the attributes provided + * in x-unique-key param. + * @param schemaObject + * @param mdmsRequest + * @return + */ + public static String getUniqueIdentifier(JSONObject schemaObject, MdmsRequest mdmsRequest) { + org.json.JSONArray uniqueFieldPaths = (org.json.JSONArray) schemaObject.get(X_UNIQUE_KEY); + + JsonNode data = mdmsRequest.getMdms().getData(); + StringBuilder compositeUniqueIdentifier = new StringBuilder(); + + // Build composite unique identifier + IntStream.range(0, uniqueFieldPaths.length()).forEach(i -> { + String uniqueIdentifierChunk = data.at(getJsonPointerExpressionFromDotSeparatedPath(uniqueFieldPaths.getString(i))).asText(); + + // Throw error in case value against unique identifier is empty + if(StringUtils.isEmpty(uniqueIdentifierChunk)) { + throw new CustomException("UNIQUE_IDENTIFIER_EMPTY_ERR", "Values defined against unique fields cannot be empty."); + } + + compositeUniqueIdentifier.append(uniqueIdentifierChunk); + + if (i != (uniqueFieldPaths.length() - 1)) + compositeUniqueIdentifier.append(DOT_SEPARATOR); + }); + + return compositeUniqueIdentifier.toString(); + } + + /** + * This method creates a JSON pointer expression from dot separated path. + * @param dotSeparatedPath + * @return + */ + public static String getJsonPointerExpressionFromDotSeparatedPath(String dotSeparatedPath) { + return FORWARD_SLASH + dotSeparatedPath.replaceAll(DOT_REGEX, FORWARD_SLASH); + } + + /** + * This method creates JSON path expression from dot separated path. + * @param dotSeparatedPath + * @return + */ + public static String getJsonPathExpressionFromDotSeparatedPath(String dotSeparatedPath) { + return DOLLAR_DOT + dotSeparatedPath; + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/ErrorUtil.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/ErrorUtil.java new file mode 100644 index 00000000000..f10d45503ae --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/ErrorUtil.java @@ -0,0 +1,21 @@ +package org.egov.infra.mdms.utils; + +import org.egov.tracer.model.CustomException; + +import java.util.Map; + +public class ErrorUtil { + + private ErrorUtil(){} + + /** + * This method throws custom exception for a map of exceptions + * @param exceptions + */ + public static void throwCustomExceptions(Map exceptions) { + if (!exceptions.isEmpty()) { + throw new CustomException(exceptions); + } + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/FallbackUtil.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/FallbackUtil.java new file mode 100644 index 00000000000..f3f0d69bb30 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/FallbackUtil.java @@ -0,0 +1,71 @@ +package org.egov.infra.mdms.utils; + +import net.minidev.json.JSONArray; +import org.egov.infra.mdms.model.Mdms; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static org.egov.infra.mdms.utils.MDMSConstants.DOT_SEPARATOR; + +public class FallbackUtil { + + private FallbackUtil() {} + + public static List getSubTenantListForFallBack(String tenantId) { + List subTenantList = new ArrayList<>(); + + subTenantList.add(tenantId); + + while(tenantId.contains(DOT_SEPARATOR)){ + tenantId = tenantId.substring(0, tenantId.lastIndexOf(DOT_SEPARATOR)); + subTenantList.add(tenantId); + } + + return subTenantList; + } + + public static Map backTrackTenantMasterDataMap(Map> tenantMasterMap, String tenantId) { + List subTenantListForFallback = FallbackUtil.getSubTenantListForFallBack(tenantId); + Map masterDataPostFallBack = new HashMap<>(); + for (String subTenant : subTenantListForFallback) { + if(tenantMasterMap.containsKey(subTenant)) { + for (Map.Entry entry : tenantMasterMap.get(subTenant).entrySet()) { + String schemaCode = entry.getKey(); + if(!masterDataPostFallBack.containsKey(schemaCode)) { + masterDataPostFallBack.put(schemaCode, entry.getValue()); + } + } + } + } + + return masterDataPostFallBack; + } + + public static List backTrackTenantMasterDataList(List masterDataList, String tenantId) { + List masterDataListAfterFallback = new ArrayList<>(); + List subTenantListForFallback = FallbackUtil.getSubTenantListForFallBack(tenantId); + + Map> schemaMasterMap = masterDataList.parallelStream().collect(Collectors.groupingBy(Mdms::getSchemaCode)); + + Map>> schemaGroupedTenantMasterMap = new HashMap<>(); + schemaMasterMap.keySet().forEach(schemaCode -> { + Map> tenantMasterMap = schemaMasterMap.get(schemaCode).stream().collect(Collectors.groupingBy(Mdms::getTenantId)); + schemaGroupedTenantMasterMap.put(schemaCode, tenantMasterMap); + }); + + for (String schemaCode : schemaGroupedTenantMasterMap.keySet()) { + Map> tenantMasterMap = schemaGroupedTenantMasterMap.get(schemaCode); + + for (String subTenant : subTenantListForFallback) { + if (tenantMasterMap.containsKey(subTenant)) + masterDataListAfterFallback.addAll(tenantMasterMap.get(subTenant)); + } + } + + return masterDataListAfterFallback; + } +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/MDMSConstants.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/MDMSConstants.java new file mode 100644 index 00000000000..3e58074fc76 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/MDMSConstants.java @@ -0,0 +1,19 @@ +package org.egov.infra.mdms.utils; + +import org.springframework.stereotype.Component; + + +@Component +public class MDMSConstants { + + public static final String X_UNIQUE_KEY = "x-unique"; + public static final String X_REFERENCE_SCHEMA_KEY = "x-ref-schema"; + public static final String REQUIRED_KEY = "required"; + public static final String DOT_SEPARATOR = "."; + public static final String DOT_REGEX = "\\."; + public static final String FORWARD_SLASH = "/"; + public static final String DOLLAR_DOT = "$."; + public static final String FIELD_PATH_KEY = "fieldPath"; + public static final String SCHEMA_CODE_KEY = "schemaCode"; + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/QueryUtil.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/QueryUtil.java new file mode 100644 index 00000000000..7d06cd8e68d --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/QueryUtil.java @@ -0,0 +1,124 @@ +package org.egov.infra.mdms.utils; + +import com.google.gson.Gson; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.IntStream; + +import static org.egov.infra.mdms.utils.MDMSConstants.*; + +public class QueryUtil { + + private QueryUtil(){} + + private static final Gson gson = new Gson(); + + /** + * This method aids in adding "WHERE" clause and "AND" condition depending on preparedStatementList i.e., + * if preparedStatementList is empty, it will understand that it is the first clause being added so it + * will add "WHERE" to the query and otherwise it will + * @param query + * @param preparedStmtList + */ + public static void addClauseIfRequired(StringBuilder query, List preparedStmtList){ + if(preparedStmtList.isEmpty()){ + query.append(" WHERE "); + }else{ + query.append(" AND "); + } + } + + /** + * This method returns a string with placeholders equal to the number of values that need to be put inside + * "IN" clause + * @param size + * @return + */ + public static String createQuery(Integer size) { + StringBuilder builder = new StringBuilder(); + + IntStream.range(0, size).forEach(i -> { + builder.append(" ?"); + if (i != size - 1) + builder.append(","); + }); + + return builder.toString(); + } + + /** + * This method adds a set of String values into preparedStatementList + * @param preparedStmtList + * @param ids + */ + public static void addToPreparedStatement(List preparedStmtList, Set ids) { + ids.forEach(id -> { + preparedStmtList.add(id); + }); + } + + /** + * This method appends order by clause to the query + * @param query + * @param orderByClause + * @return + */ + public static String addOrderByClause(String query, String orderByClause){ + return query + orderByClause; + } + + /** + * This method prepares partial json string from the filter map to query on jsonb column + * @param filterMap + * @return + */ + public static String preparePartialJsonStringFromFilterMap(Map filterMap) { + Map queryMap = new HashMap<>(); + + filterMap.keySet().forEach(key -> { + if(key.contains(DOT_SEPARATOR)){ + String[] keyArray = key.split(DOT_REGEX); + Map nestedQueryMap = new HashMap<>(); + prepareNestedQueryMap(0, keyArray, nestedQueryMap, filterMap.get(key)); + queryMap.put(keyArray[0], nestedQueryMap.get(keyArray[0])); + } else{ + queryMap.put(key, filterMap.get(key)); + } + }); + + String partialJsonQueryString = gson.toJson(queryMap); + + return partialJsonQueryString; + } + + /** + * Tail recursive method to prepare n-level nested partial json for queries on nested data in + * master data. For e.g. , if the key is in the format a.b.c, it will construct a nested json + * object of the form - {"a":{"b":{"c": "value"}}} + * @param index + * @param nestedKeyArray + * @param currentQueryMap + * @param value + */ + private static void prepareNestedQueryMap(int index, String[] nestedKeyArray, Map currentQueryMap, String value) { + // Return when all levels have been reached. + if(index == nestedKeyArray.length) + return; + + // For the final level simply put the value in the map. + else if (index == nestedKeyArray.length - 1) { + currentQueryMap.put(nestedKeyArray[index], value); + return; + } + + // For non terminal levels, add a child map. + currentQueryMap.put(nestedKeyArray[index], new HashMap<>()); + + // Make a recursive call to enrich data in next level. + prepareNestedQueryMap(index + 1, nestedKeyArray, (Map) currentQueryMap.get(nestedKeyArray[index]), value); + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/ResponseUtil.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/ResponseUtil.java new file mode 100644 index 00000000000..5a662882310 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/ResponseUtil.java @@ -0,0 +1,29 @@ +package org.egov.infra.mdms.utils; + +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.response.ResponseInfo; +import org.egov.common.utils.ResponseInfoUtil; +import org.egov.infra.mdms.model.Mdms; +import org.egov.infra.mdms.model.MdmsResponseV2; +import org.egov.infra.mdms.model.SchemaDefinition; +import org.egov.infra.mdms.model.SchemaDefinitionResponse; + +import java.util.List; + +public class ResponseUtil { + + private ResponseUtil(){} + + public static SchemaDefinitionResponse getSchemaDefinitionResponse(RequestInfo requestInfo , List schemaDefinitions){ + ResponseInfo responseInfo = ResponseInfoUtil.createResponseInfoFromRequestInfo(requestInfo, Boolean.TRUE); + SchemaDefinitionResponse schemaDefinitionResponse = SchemaDefinitionResponse.builder().schemaDefinitions(schemaDefinitions).responseInfo(responseInfo).build(); + return schemaDefinitionResponse; + } + + public static MdmsResponseV2 getMasterDataV2Response(RequestInfo requestInfo, List masterDataList){ + ResponseInfo responseInfo = ResponseInfoUtil.createResponseInfoFromRequestInfo(requestInfo, Boolean.TRUE); + MdmsResponseV2 response = MdmsResponseV2.builder().mdms(masterDataList).responseInfo(responseInfo).build(); + return response; + } + +} diff --git a/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/SchemaUtil.java b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/SchemaUtil.java new file mode 100644 index 00000000000..80a8294c389 --- /dev/null +++ b/core-services/mdms-v2/src/main/java/org/egov/infra/mdms/utils/SchemaUtil.java @@ -0,0 +1,52 @@ +package org.egov.infra.mdms.utils; + +import lombok.extern.slf4j.Slf4j; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.service.SchemaDefinitionService; +import org.egov.tracer.model.CustomException; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.Arrays; +import java.util.List; + +@Component +@Slf4j +public class SchemaUtil { + + private SchemaDefinitionService schemaDefinitionService; + + @Autowired + public SchemaUtil(SchemaDefinitionService schemaDefinitionService){ + this.schemaDefinitionService = schemaDefinitionService; + } + + /** + * This method fetches the schema definition object for the master data being created. + * @param mdmsRequest + * @return + */ + public JSONObject getSchema(MdmsRequest mdmsRequest) { + + Mdms mdms = mdmsRequest.getMdms(); + + SchemaDefCriteria schemaDefCriteria = SchemaDefCriteria.builder() + .tenantId(mdms.getTenantId()) + .codes(Arrays.asList(mdms.getSchemaCode())) + .build(); + + List schemaDefinitions = schemaDefinitionService.search(SchemaDefSearchRequest.builder() + .requestInfo(mdmsRequest.getRequestInfo()) + .schemaDefCriteria(schemaDefCriteria).build()); + + if(CollectionUtils.isEmpty(schemaDefinitions)) + throw new CustomException("SCHEMA_DEFINITION_NOT_FOUND_ERR", "Schema definition against which data is being created is not found"); + + JSONObject schemaObject = new JSONObject(schemaDefinitions.get(0).getDefinition().toString()); + + return schemaObject; + } + +} diff --git a/core-services/mdms-v2/src/main/resources/application.properties b/core-services/mdms-v2/src/main/resources/application.properties new file mode 100644 index 00000000000..674bf6a8f9d --- /dev/null +++ b/core-services/mdms-v2/src/main/resources/application.properties @@ -0,0 +1,41 @@ +server.port=8094 + +server.context-path=/mdms-v2 +server.servlet.context-path=/mdms-v2 +management.endpoints.web.base-path=/ +app.timezone=UTC + +#DATABASE CONFIGURATION +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url=jdbc:postgresql://localhost:5432/microdb +spring.datasource.username=postgres +spring.datasource.password=postgres + +#FLYWAY CONFIGURATION +spring.flyway.url=jdbc:postgresql://localhost:5432/microdb +spring.flyway.user=postgres +spring.flyway.password=postgres +spring.flyway.table=public +spring.flyway.baseline-on-migrate=true +spring.flyway.outOfOrder=true +spring.flyway.locations=classpath:/db/migration/main +spring.flyway.enabled=true + +# KAFKA SERVER CONFIGURATIONS +kafka.config.bootstrap_server_config=localhost:9092 +spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.group-id=mdms +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.listener.missing-topics-fatal=false +spring.kafka.consumer.properties.spring.json.use.type.headers=false + +# TOPICS +egov.mdms.schema.definition.save.topic=save-mdms-schema-definition +egov.mdms.data.save.topic=save-mdms-data +egov.mdms.data.update.topic=update-mdms-data +mdms.default.offset=0 +mdms.default.limit=10 + +logging.level.org.springframework.aop=DEBUG \ No newline at end of file diff --git a/core-services/mdms-v2/src/main/resources/db/Dockerfile b/core-services/mdms-v2/src/main/resources/db/Dockerfile new file mode 100644 index 00000000000..a5699ff7d99 --- /dev/null +++ b/core-services/mdms-v2/src/main/resources/db/Dockerfile @@ -0,0 +1,9 @@ +FROM egovio/flyway:4.1.2 + +COPY ./migration/main /flyway/sql + +COPY migrate.sh /usr/bin/migrate.sh + +RUN chmod +x /usr/bin/migrate.sh + +CMD ["/usr/bin/migrate.sh"] diff --git a/core-services/mdms-v2/src/main/resources/db/migrate.sh b/core-services/mdms-v2/src/main/resources/db/migrate.sh new file mode 100644 index 00000000000..43960b25cdb --- /dev/null +++ b/core-services/mdms-v2/src/main/resources/db/migrate.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file diff --git a/core-services/mdms-v2/src/main/resources/db/migration/main/V20230531114515__schema_definition_ddl.sql b/core-services/mdms-v2/src/main/resources/db/migration/main/V20230531114515__schema_definition_ddl.sql new file mode 100644 index 00000000000..95eeef0306d --- /dev/null +++ b/core-services/mdms-v2/src/main/resources/db/migration/main/V20230531114515__schema_definition_ddl.sql @@ -0,0 +1,13 @@ +CREATE TABLE eg_mdms_schema_definition ( + id VARCHAR(64) NOT NULL, + tenantid VARCHAR(255) NOT NULL, + code VARCHAR(255) NOT NULL, + description VARCHAR(512), + definition JSONB NOT NULL, + isactive BOOLEAN NOT NULL, + createdBy character varying(64), + lastModifiedBy character varying(64), + createdTime bigint, + lastModifiedTime bigint, + CONSTRAINT pk_eg_schema_definition PRIMARY KEY (tenantId,code) +); diff --git a/core-services/mdms-v2/src/main/resources/db/migration/main/V20230531144020__mdms_data_create_ddl.sql b/core-services/mdms-v2/src/main/resources/db/migration/main/V20230531144020__mdms_data_create_ddl.sql new file mode 100644 index 00000000000..191ee9e0259 --- /dev/null +++ b/core-services/mdms-v2/src/main/resources/db/migration/main/V20230531144020__mdms_data_create_ddl.sql @@ -0,0 +1,14 @@ +CREATE TABLE eg_mdms_data ( + id VARCHAR(64) NOT NULL, + tenantid VARCHAR(255) NOT NULL, + uniqueidentifier VARCHAR(255), + schemacode VARCHAR(255) NOT NULL, + data JSONB NOT NULL, + isactive BOOLEAN NOT NULL, + createdBy character varying(64), + lastModifiedBy character varying(64), + createdTime bigint, + lastModifiedTime bigint, + CONSTRAINT pk_eg_mdms_data PRIMARY KEY (tenantId,schemacode,uniqueidentifier), + CONSTRAINT uk_eg_mdms_data UNIQUE(id) +); diff --git a/core-services/mdms-v2/src/main/resources/mdms-persister.yml b/core-services/mdms-v2/src/main/resources/mdms-persister.yml new file mode 100644 index 00000000000..6771da75718 --- /dev/null +++ b/core-services/mdms-v2/src/main/resources/mdms-persister.yml @@ -0,0 +1,63 @@ +serviceMaps: + serviceName: Mdms-Service + mappings: + - version: 1.0 + description: Persists the schema definition + fromTopic: save-mdms-schema-definition + isTransaction: true + queryMaps: + - query: INSERT INTO eg_mdms_schema_definition (id ,tenantid, code, description, definition, isactive, createdby, lastmodifiedby, createdtime, lastmodifiedtime) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?); + basePath: $.SchemaDefinition + jsonMaps: + - jsonPath: $.SchemaDefinition.id + + - jsonPath: $.SchemaDefinition.tenantId + + - jsonPath: $.SchemaDefinition.code + + - jsonPath: $.SchemaDefinition.description + + - jsonPath: $.SchemaDefinition.definition + type: JSON + dbType: JSONB + + - jsonPath: $.SchemaDefinition.isActive + + - jsonPath: $.SchemaDefinition.auditDetails.createdBy + + - jsonPath: $.SchemaDefinition.auditDetails.lastModifiedBy + + - jsonPath: $.SchemaDefinition.auditDetails.createdTime + + - jsonPath: $.SchemaDefinition.auditDetails.lastModifiedTime + + + - version: 1.0 + description: Persists the mdms data + fromTopic: save-mdms-data + isTransaction: true + queryMaps: + - query: INSERT INTO eg_mdms_data (tenantid, uniqueidentifier, schemacode, data, isactive, createdby, lastmodifiedby, createdtime, lastmodifiedtime) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?); + basePath: $.Mdms + jsonMaps: + - jsonPath: $.Mdms.tenantId + + - jsonPath: $.Mdms.uniqueIdentifier + + - jsonPath: $.Mdms.schemaCode + + - jsonPath: $.Mdms.data + type: JSON + dbType: JSONB + + - jsonPath: $.Mdms.isActive + + - jsonPath: $.Mdms.auditDetails.createdBy + + - jsonPath: $.Mdms.auditDetails.lastModifiedBy + + - jsonPath: $.Mdms.auditDetails.createdTime + + - jsonPath: $.Mdms.auditDetails.lastModifiedTime + + diff --git a/core-services/national-dashboard-ingest/src/main/java/org/egov/nationaldashboardingest/config/ApplicationProperties.java b/core-services/national-dashboard-ingest/src/main/java/org/egov/nationaldashboardingest/config/ApplicationProperties.java index f1c3726c40f..72d16a4ef7f 100644 --- a/core-services/national-dashboard-ingest/src/main/java/org/egov/nationaldashboardingest/config/ApplicationProperties.java +++ b/core-services/national-dashboard-ingest/src/main/java/org/egov/nationaldashboardingest/config/ApplicationProperties.java @@ -62,4 +62,7 @@ public class ApplicationProperties { @Value("#{${national.dashboard.usageTypeNOC}}") private List nationalDashboardUsageTypeNOC; -} \ No newline at end of file + + @Value("${national.dashboard.legacy.version}") + private Boolean isLegacyVersionES; +} diff --git a/core-services/national-dashboard-ingest/src/main/java/org/egov/nationaldashboardingest/repository/ElasticSearchRepository.java b/core-services/national-dashboard-ingest/src/main/java/org/egov/nationaldashboardingest/repository/ElasticSearchRepository.java index b0f5bc41f01..93485d81223 100644 --- a/core-services/national-dashboard-ingest/src/main/java/org/egov/nationaldashboardingest/repository/ElasticSearchRepository.java +++ b/core-services/national-dashboard-ingest/src/main/java/org/egov/nationaldashboardingest/repository/ElasticSearchRepository.java @@ -44,7 +44,11 @@ public void indexFlattenedDataToES(Map> indexNameVsDocument // Conversion of multi-index request to a single request to avoid repetitive REST calls to ES. indexNameVsDocumentsToBeIndexed.keySet().forEach(indexName -> { - String actionMetaData = String.format("{ \"index\" : { \"_index\" : \"%s\", \"_type\" : \"_doc\" } }%n", indexName); + String actionMetaData; + if(applicationProperties.getIsLegacyVersionES()) + actionMetaData = String.format("{ \"index\" : { \"_index\" : \"%s\", \"_type\" : \"_doc\" } }%n", indexName); + else + actionMetaData = String.format("{ \"index\" : { \"_index\" : \"%s\" } }%n", indexName); for (String document : indexNameVsDocumentsToBeIndexed.get(indexName)) { bulkRequestBody.append(actionMetaData); bulkRequestBody.append(document); diff --git a/core-services/national-dashboard-ingest/src/main/java/org/egov/nationaldashboardingest/validators/IngestValidator.java b/core-services/national-dashboard-ingest/src/main/java/org/egov/nationaldashboardingest/validators/IngestValidator.java index b2fbcba8c56..9085eed9dd7 100644 --- a/core-services/national-dashboard-ingest/src/main/java/org/egov/nationaldashboardingest/validators/IngestValidator.java +++ b/core-services/national-dashboard-ingest/src/main/java/org/egov/nationaldashboardingest/validators/IngestValidator.java @@ -150,10 +150,11 @@ public void verifyCrossStateMasterDataRequest(MasterDataRequest masterDataReques public void verifyDataStructure(Data ingestData){ validateDateFormat(ingestData.getDate()); - validateStringNotNumeric(ingestData.getWard()); validateStringNotNumeric(ingestData.getUlb()); + validateStringNotNumeric(ingestData.getWard()); validateStringNotNumeric(ingestData.getRegion()); validateStringNotNumeric(ingestData.getState()); + if(ingestData.getWard().contains(":")) ingestData.setWard(ingestData.getWard().replace(":"," ")); @@ -514,8 +515,9 @@ public IngestAckData verifyIfDataAlreadyIngested(List ingestData) { Set uniquenessHash = new HashSet<>(); IngestAckData hashedData = new IngestAckData(); List ackEntityList = new ArrayList<>(); + ingestData.forEach(data -> { - if(data.getWard().contains(":")) + if(data.getWard().contains(":")) data.setWard(data.getWard().replace(":"," ")); StringBuilder currKeyData = new StringBuilder(); currKeyData.append(data.getDate()).append(":").append(data.getModule()).append(":").append(data.getWard()).append(":").append(data.getUlb()).append(":").append(data.getRegion()).append(":").append(data.getState()); diff --git a/core-services/national-dashboard-ingest/src/main/resources/application.properties b/core-services/national-dashboard-ingest/src/main/resources/application.properties index 9daf435e034..ff8317d3ba2 100644 --- a/core-services/national-dashboard-ingest/src/main/resources/application.properties +++ b/core-services/national-dashboard-ingest/src/main/resources/application.properties @@ -18,11 +18,12 @@ spring.flyway.outOfOrder=true spring.flyway.locations=classpath:/db/migration/main spring.flyway.enabled=false -national.dashboard.user={"Punjab":"3c9e3f73-6345-4c5d-803b-67c0ec09eaff,36915841-ac97-459c-a6bb-5ac26d03bcd7","Karnataka":"98c6d961-5daf-4f53-a532-204229f2b8ad","Rajasthan":"4580803f-52e3-4495-911f-2895b65ed928","Goa":"492a8462-4fe3-460d-8b07-b22de30bc00c","Andhra Pradesh":"4275911e-f085-436b-b3df-735095250f01","Madhya Pradesh":"fd98e215-29fa-42a8-812f-49aefa3c3904","Telangana":"89ed69cf-c1c9-461d-9e3c-8cb04555fc49","Tamil Nadu":"63fce6cb-5af6-4fcb-94fa-2b7f0a796660","Chandigarh":"c499b45b-7d65-418f-b003-5ce5db2220d2","Chhattisgarh":"33dc5944-6bd3-46e2-8e90-db32270c9977","Maharashtra":"49ec839a-35be-4347-b166-12cee02cd885","Uttarakhand":"cb343459-62ba-4fa0-9179-bd58ac635ef2"} +national.dashboard.user={"SUPERUUID":"efc090de-a1a2-4cbb-9ed2-dd1fb9196ae7","Punjab":"3c9e3f73-6345-4c5d-803b-67c0ec09eaff,36915841-ac97-459c-a6bb-5ac26d03bcd7","Karnataka":"98c6d961-5daf-4f53-a532-204229f2b8ad","Rajasthan":"4580803f-52e3-4495-911f-2895b65ed928","Goa":"492a8462-4fe3-460d-8b07-b22de30bc00c","Andhra Pradesh":"4275911e-f085-436b-b3df-735095250f01","Madhya Pradesh":"fd98e215-29fa-42a8-812f-49aefa3c3904","Telangana":"89ed69cf-c1c9-461d-9e3c-8cb04555fc49","Tamil Nadu":"63fce6cb-5af6-4fcb-94fa-2b7f0a796660","Chandigarh":"c499b45b-7d65-418f-b003-5ce5db2220d2","Chhattisgarh":"33dc5944-6bd3-46e2-8e90-db32270c9977","Maharashtra":"49ec839a-35be-4347-b166-12cee02cd885","Uttarakhand":"cb343459-62ba-4fa0-9179-bd58ac635ef2"} national.dashboard.usageTypePT={"assessedProperties", "transactions", "rebate", "penalty" , "todaysCollection", "propertyTax", "cess" , "interest"} national.dashboard.usageTypeWS={"todaysCollection", "sewerageConnections", "waterConnections"} national.dashboard.usageTypeNOC={"actualNOCIssued"} national.dashboard.usageTypeFSM={"todaysCollection"} +national.dashboard.legacy.version=false # KAFKA SERVER CONFIGURATIONS @@ -66,4 +67,4 @@ adaptor.ingest.system.role=NDA_SYSTEM #mdms egov.mdms.host=http://egov-mdms-service.egov:8080 -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search \ No newline at end of file +egov.mdms.search.endpoint=/egov-mdms-service/v1/_search diff --git a/core-services/national-dashboard-kafka-pipeline/src/main/resources/application.properties b/core-services/national-dashboard-kafka-pipeline/src/main/resources/application.properties index 66ebf759f8b..1237ec85f4a 100644 --- a/core-services/national-dashboard-kafka-pipeline/src/main/resources/application.properties +++ b/core-services/national-dashboard-kafka-pipeline/src/main/resources/application.properties @@ -43,5 +43,5 @@ kafka.producer.config.buffer_memory_config=33554432 # INDEX CONFIGURATIONS kafka.topics.national.events=persist-national-records -module.index.mapping={"PT": "pt-national-dashboard", "PGR": "pgr-national-dashboard", "WS": "ws-national-dashboard", "FIRENOC": "firenoc-national-dashboard", "TL": "tl-national-dashboard", "MCOLLECT": "mcollect-national-dashboard", "OBPS": "obps-national-dashboard", "COMMON": "common-national-dashboard", "BPA": "bpa-national-dashboard", "FSM":"fsm-national-dashboard"} +module.index.mapping={"PT": "pt-national-dashboard-temp", "PGR": "pgr-national-dashboard", "WS": "ws-national-dashboard", "FIRENOC": "firenoc-national-dashboard", "TL": "tl-national-dashboard", "MCOLLECT": "mcollect-national-dashboard", "OBPS": "obps-national-dashboard", "COMMON": "common-national-dashboard", "BPA": "bpa-national-dashboard", "FSM":"fsm-national-dashboard"} diff --git a/core-services/report/CHANGELOG.md b/core-services/report/CHANGELOG.md index 070b704a872..9772795a35e 100644 --- a/core-services/report/CHANGELOG.md +++ b/core-services/report/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this module will be documented in this file. +## 1.3.6 - 2023-08-10 + +- Central Instance Library Integration + ## 1.3.5 - 2023-02-06 - Transition from 1.3.5-beta version to 1.3.5 version diff --git a/core-services/report/pom.xml b/core-services/report/pom.xml index ab7fe49bb00..a9826c11063 100644 --- a/core-services/report/pom.xml +++ b/core-services/report/pom.xml @@ -10,7 +10,7 @@ org.egov.services report - 1.3.5-SNAPSHOT + 1.3.6-SNAPSHOT Report Infra Report Infra @@ -36,17 +36,17 @@ org.egov enc-client - 2.0.3-SNAPSHOT + 2.0.4-SNAPSHOT org.egov.services services-common - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT org.egov.services tracer - 1.2.0-SNAPSHOT + 2.1.0-SNAPSHOT org.springframework.boot diff --git a/core-services/service-request/src/main/java/digit/config/Configuration.java b/core-services/service-request/src/main/java/digit/config/Configuration.java index febd9097d8f..c7849475706 100644 --- a/core-services/service-request/src/main/java/digit/config/Configuration.java +++ b/core-services/service-request/src/main/java/digit/config/Configuration.java @@ -51,6 +51,9 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM @Value("${egov.service.definition.create.topic}") private String serviceDefinitionCreateTopic; + @Value("${egov.service.definition.update.topic}") + private String serviceDefinitionUpdateTopic; + @Value("${egov.service.create.topic}") private String serviceCreateTopic; @@ -60,4 +63,31 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM @Value("${egov.max.string.input.size}") private Integer maxStringInputSize; + @Value("${user.service.hostname}") + private String userServiceHostName; + + @Value("${user.service.searchpath}") + private String userServiceSearchPath; + + @Value("${egov.service.notification.action.code}") + private String surveyActionCode; + + @Value("${egov.service.notification.event.topic}") + private String userEventTopic; + + @Value("${egov.service.notification.ui.host}") + private String notificationUiHost; + + @Value("${egov.service.notification.ui.redirect.url}") + private String notificationEndpoint; + + @Value("${egov.localization.host}") + private String localizationHost; + + @Value("${egov.localization.search.endpoint}") + private String localizationEndpoint; + + @Value("${egov.service.notification.fallback.locale}") + private String fallBackLocale; + } diff --git a/core-services/service-request/src/main/java/digit/constants/Constants.java b/core-services/service-request/src/main/java/digit/constants/Constants.java index 66bd547818f..d44726a6dfe 100644 --- a/core-services/service-request/src/main/java/digit/constants/Constants.java +++ b/core-services/service-request/src/main/java/digit/constants/Constants.java @@ -21,4 +21,14 @@ public class Constants { public static final String CHANNEL = "channel"; + public static final String NEW_SURVEY = "New Survey"; + public static final String WEBAPP = "WEBAPP"; + public static final String SYSTEMGENERATED = "SYSTEMGENERATED"; + public static final String APPLICATION_NUMBER_PLACEHOLDER = "{APPNUMBER}"; + public static final String TENANTID_PLACEHOLDER = "{TENANTID}"; + public static final String LOCALIZATION_MODULE = "rainmaker-common"; + public static final String LOCALIZATION_CODE = "SS_SURVEY_NOTIFICATION_TEMPLATE"; + public static final String SURVEY_TITLE = "{survey_title}"; + public static final String LOCALIZATION_CODES_JSONPATH = "$.messages.*.code"; + public static final String LOCALIZATION_MSGS_JSONPATH = "$.messages.*.message"; } diff --git a/core-services/service-request/src/main/java/digit/kafka/Consumer.java b/core-services/service-request/src/main/java/digit/kafka/Consumer.java index 557ffe5d7bb..2d5107a6172 100644 --- a/core-services/service-request/src/main/java/digit/kafka/Consumer.java +++ b/core-services/service-request/src/main/java/digit/kafka/Consumer.java @@ -3,19 +3,45 @@ import org.springframework.kafka.annotation.KafkaListener; import org.springframework.stereotype.Component; +import lombok.extern.slf4j.Slf4j; +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.service.NotificationService; +import digit.web.models.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.kafka.support.KafkaHeaders; +import org.springframework.messaging.handler.annotation.Header; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; + + import java.util.HashMap; @Component +@Slf4j public class Consumer { /* * Uncomment the below line to start consuming record from kafka.topics.consumer * Value of the variable kafka.topics.consumer should be overwritten in application.properties */ - //@KafkaListener(topics = {"kafka.topics.consumer"}) - public void listen(final HashMap record) { + @Autowired + private ObjectMapper mapper; + + @Autowired + private NotificationService notificationService; + + @KafkaListener(topics = {"save-service-definition"}) + public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { + + try { + ServiceDefinitionRequest request = mapper.convertValue(record, ServiceDefinitionRequest.class); + //log.info(request.toString()); + notificationService.prepareEventAndSend(request); + + } catch (final Exception e) { - //TODO + log.error("Error while listening to value: " + record + " on topic: " + topic + ": ", e); + } } } diff --git a/core-services/service-request/src/main/java/digit/repository/ServiceDefinitionRequestRepository.java b/core-services/service-request/src/main/java/digit/repository/ServiceDefinitionRequestRepository.java index acf01303e30..8ae028064f6 100644 --- a/core-services/service-request/src/main/java/digit/repository/ServiceDefinitionRequestRepository.java +++ b/core-services/service-request/src/main/java/digit/repository/ServiceDefinitionRequestRepository.java @@ -54,12 +54,31 @@ public List getServiceDefinitions(ServiceDefinitionSearchRequ + System.out.println("inside get service definition"); + System.out.println(criteria); String query = serviceDefinitionQueryBuilder.getServiceDefinitionSearchQuery(criteria, preparedStmtList); log.info("query for search: " + query + " params: " + preparedStmtList); return jdbcTemplate.query(query, preparedStmtList.toArray(), serviceDefinitionRowMapper); } + public Integer fetchTotalSurveyCount(ServiceDefinitionSearchRequest ServiceDefinitionSearchRequest) { + List preparedStmtList = new ArrayList<>(); + ServiceDefinitionCriteria ServiceDefinitionCriteria = ServiceDefinitionSearchRequest.getServiceDefinitionCriteria(); + + if(CollectionUtils.isEmpty(ServiceDefinitionCriteria.getIds())) + return 0; + + // Omit pagination in case of count + ServiceDefinitionCriteria.setIsCountCall(Boolean.TRUE); + String query = serviceDefinitionQueryBuilder.getSurveyCountQuery(ServiceDefinitionSearchRequest, preparedStmtList); + ServiceDefinitionCriteria.setIsCountCall(Boolean.FALSE); + + log.info("query for count search call: " + query + " params: " + preparedStmtList); + + return jdbcTemplate.queryForObject(query, preparedStmtList.toArray(), Integer.class); + } + public List getService(ServiceCriteria criteria) { return new ArrayList<>(); } diff --git a/core-services/service-request/src/main/java/digit/repository/ServiceRequestRepository.java b/core-services/service-request/src/main/java/digit/repository/ServiceRequestRepository.java index 17a0cdf5ddf..88ff29ea61b 100644 --- a/core-services/service-request/src/main/java/digit/repository/ServiceRequestRepository.java +++ b/core-services/service-request/src/main/java/digit/repository/ServiceRequestRepository.java @@ -6,15 +6,22 @@ import digit.repository.rowmapper.ServiceRowMapper; import digit.web.models.*; import lombok.extern.slf4j.Slf4j; +import org.egov.tracer.model.ServiceCallException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.SingleColumnRowMapper; import org.springframework.stereotype.Repository; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; import java.util.ArrayList; import java.util.List; +import java.util.Map; @Slf4j @Repository @@ -29,6 +36,11 @@ public class ServiceRequestRepository { @Autowired private ServiceQueryBuilder serviceQueryBuilder; + @Autowired + private ObjectMapper mapper; + + @Autowired + private RestTemplate restTemplate; public List getService(ServiceSearchRequest serviceSearchRequest) { ServiceCriteria criteria = serviceSearchRequest.getServiceCriteria(); @@ -60,4 +72,31 @@ public List getService(ServiceSearchRequest serviceSearchRequest) { log.info("query for search: " + query + " params: " + preparedStmtList); return jdbcTemplate.query(query, preparedStmtList.toArray(), serviceRowMapper); } + + /** + * fetch method which takes the URI and request object + * and returns response in generic format + * @param uri + * @param request + * @return + */ + @SuppressWarnings("rawtypes") + public Map fetchResult(String uri, Object request) { + + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + Map response = null; + log.info("URI: "+ uri); + + try { + log.info("Request: "+mapper.writeValueAsString(request)); + response = restTemplate.postForObject(uri, request, Map.class); + }catch(HttpClientErrorException e) { + log.error("External Service threw an Exception: ",e.getResponseBodyAsString()); + throw new ServiceCallException(e.getResponseBodyAsString()); + }catch(JsonProcessingException e) { + log.error("Exception while searching user data : ",e); + } + + return response; + } } diff --git a/core-services/service-request/src/main/java/digit/repository/querybuilder/ServiceDefinitionQueryBuilder.java b/core-services/service-request/src/main/java/digit/repository/querybuilder/ServiceDefinitionQueryBuilder.java index 937093cc7c6..a940262a8ef 100644 --- a/core-services/service-request/src/main/java/digit/repository/querybuilder/ServiceDefinitionQueryBuilder.java +++ b/core-services/service-request/src/main/java/digit/repository/querybuilder/ServiceDefinitionQueryBuilder.java @@ -23,11 +23,13 @@ public class ServiceDefinitionQueryBuilder { private static final String AND_QUERY = " AND "; private static final String IDS_WRAPPER_QUERY = " SELECT id FROM ({HELPER_TABLE}) temp "; + public static final String SURVEY_COUNT_WRAPPER = " SELECT COUNT(*) FROM ({INTERNAL_QUERY}) AS count "; private final String ORDERBY_CREATEDTIME = " ORDER BY sd.createdtime DESC "; public String getServiceDefinitionsIdsQuery(ServiceDefinitionSearchRequest serviceDefinitionSearchRequest, List preparedStmtList) { ServiceDefinitionCriteria criteria = serviceDefinitionSearchRequest.getServiceDefinitionCriteria(); - + System.out.println("criteria in query method"); + System.out.println(criteria); StringBuilder query = new StringBuilder(SELECT + " DISTINCT(sd.id), sd.createdtime "); query.append(" FROM eg_service_definition sd "); @@ -39,7 +41,7 @@ public String getServiceDefinitionsIdsQuery(ServiceDefinitionSearchRequest servi if(!CollectionUtils.isEmpty(criteria.getCode())){ addClauseIfRequired(query, preparedStmtList); - query.append(" sd.code IN ( ").append(createQuery(criteria.getCode())).append(" )"); + query.append(" sd.code ILIKE ( ").append(createQuery(criteria.getCode())).append(" || '%' )"); addToPreparedStatement(preparedStmtList, criteria.getCode()); } @@ -60,6 +62,31 @@ public String getServiceDefinitionsIdsQuery(ServiceDefinitionSearchRequest servi query.append(" sd.clientid = ? "); preparedStmtList.add(criteria.getClientId()); } + + if(!ObjectUtils.isEmpty(criteria.getTodaysDate())) + { + System.out.println("inside todays date query"); + if(!ObjectUtils.isEmpty(criteria.getStatus()) && criteria.getStatus().equalsIgnoreCase("Active")){ + addClauseIfRequired(query, preparedStmtList); + System.out.println("inside active query"); + query.append(" to_timestamp((sd.additionaldetails->>'endDate')::bigint) > to_timestamp(?::bigint)"); + preparedStmtList.add(criteria.getTodaysDate()); + }else if(!ObjectUtils.isEmpty(criteria.getStatus()) && criteria.getStatus().equalsIgnoreCase("Inactive")){ + addClauseIfRequired(query, preparedStmtList); + + query.append(" to_timestamp((sd.additionaldetails->>'startDate')::bigint) < to_timestamp(?::bigint)"); + query.append(" AND to_timestamp((sd.additionaldetails->>'endDate')::bigint) < to_timestamp(?::bigint)"); + + preparedStmtList.add(criteria.getTodaysDate()); + preparedStmtList.add(criteria.getTodaysDate()); + } + } + + if(!ObjectUtils.isEmpty(criteria.getPostedBy())){ + addClauseIfRequired(query, preparedStmtList); + query.append("LOWER(sd.additionaldetails->>'postedBy') ILIKE ( ? || '%' )"); + preparedStmtList.add(criteria.getPostedBy()); + } // Fetch service definitions which have NOT been soft deleted addClauseIfRequired(query, preparedStmtList); @@ -70,14 +97,21 @@ public String getServiceDefinitionsIdsQuery(ServiceDefinitionSearchRequest servi query.append(ORDERBY_CREATEDTIME); // Pagination to limit results - if(ObjectUtils.isEmpty(serviceDefinitionSearchRequest.getPagination())){ - prepareDefaultPaginationObject(serviceDefinitionSearchRequest); + if(criteria!=null && !criteria.getIsCountCall()){ + if(ObjectUtils.isEmpty(serviceDefinitionSearchRequest.getPagination())){ + prepareDefaultPaginationObject(serviceDefinitionSearchRequest); + } + addPagination(query, preparedStmtList, serviceDefinitionSearchRequest.getPagination()); } - addPagination(query, preparedStmtList, serviceDefinitionSearchRequest.getPagination()); return IDS_WRAPPER_QUERY.replace("{HELPER_TABLE}", query.toString()); } + public String getSurveyCountQuery(ServiceDefinitionSearchRequest criteria, List preparedStmtList) { + String query = "select count(*) from eg_service_definition where isactive = true"; + return query; + } + private void prepareDefaultPaginationObject(ServiceDefinitionSearchRequest serviceDefinitionSearchRequest) { Pagination pagination = new Pagination(); pagination.setOffset(config.getDefaultOffset()); @@ -142,6 +176,31 @@ public String getServiceDefinitionSearchQuery(ServiceDefinitionCriteria criteria addToPreparedStatement(preparedStmtList, criteria.getIds()); } + if(!ObjectUtils.isEmpty(criteria.getTodaysDate())) + { + System.out.println("inside todays date query"); + if(!ObjectUtils.isEmpty(criteria.getStatus()) && criteria.getStatus().equalsIgnoreCase("Active")){ + addClauseIfRequired(query, preparedStmtList); + System.out.println("inside active query"); + query.append(" to_timestamp((sd.additionaldetails->>'endDate')::bigint) > to_timestamp(?::bigint)"); + preparedStmtList.add(criteria.getTodaysDate()); + }else if(!ObjectUtils.isEmpty(criteria.getStatus()) && criteria.getStatus().equalsIgnoreCase("Inactive")){ + addClauseIfRequired(query, preparedStmtList); + query.append(" to_timestamp((sd.additionaldetails->>'startDate')::bigint) < to_timestamp(?::bigint)"); + query.append(" AND to_timestamp((sd.additionaldetails->>'endDate')::bigint) < to_timestamp(?::bigint)"); + preparedStmtList.add(criteria.getTodaysDate()); + preparedStmtList.add(criteria.getTodaysDate()); + } + } + + if(!ObjectUtils.isEmpty(criteria.getPostedBy())){ + addClauseIfRequired(query, preparedStmtList); + query.append("LOWER(sd.additionaldetails->>'postedBy') ILIKE ( ? || '%' )"); + preparedStmtList.add(criteria.getPostedBy()); + } + + + return query.toString(); } -} +} \ No newline at end of file diff --git a/core-services/service-request/src/main/java/digit/repository/querybuilder/ServiceQueryBuilder.java b/core-services/service-request/src/main/java/digit/repository/querybuilder/ServiceQueryBuilder.java index e5244218391..96228779355 100644 --- a/core-services/service-request/src/main/java/digit/repository/querybuilder/ServiceQueryBuilder.java +++ b/core-services/service-request/src/main/java/digit/repository/querybuilder/ServiceQueryBuilder.java @@ -71,11 +71,11 @@ public String getServiceIdsQuery(ServiceSearchRequest serviceSearchRequest, List // order services based on their createdtime in latest first manner query.append(ORDERBY_CREATEDTIME); - if(ObjectUtils.isEmpty(serviceSearchRequest.getPagination())) - prepareDefaultPaginationObject(serviceSearchRequest); + // if(ObjectUtils.isEmpty(serviceSearchRequest.getPagination())) + // prepareDefaultPaginationObject(serviceSearchRequest); - // Pagination to limit results - addPagination(query, preparedStmtList, serviceSearchRequest.getPagination()); + // // Pagination to limit results + // addPagination(query, preparedStmtList, serviceSearchRequest.getPagination()); return IDS_WRAPPER_QUERY.replace("{HELPER_TABLE}", query.toString()); } @@ -120,8 +120,7 @@ private void addPagination(StringBuilder query, List preparedStmtList, P // Append limit query.append(" LIMIT ? "); - preparedStmtList.add(ObjectUtils.isEmpty(pagination.getLimit()) ? config.getDefaultLimit() : - ((pagination.getLimit() > config.getMaxLimit()) ? config.getMaxLimit() : pagination.getLimit())); + preparedStmtList.add(ObjectUtils.isEmpty(pagination.getLimit()) ? config.getDefaultLimit() : pagination.getLimit()); } diff --git a/core-services/service-request/src/main/java/digit/service/NotificationService.java b/core-services/service-request/src/main/java/digit/service/NotificationService.java new file mode 100644 index 00000000000..59dad0b4d61 --- /dev/null +++ b/core-services/service-request/src/main/java/digit/service/NotificationService.java @@ -0,0 +1,118 @@ +package digit.service; + +import com.jayway.jsonpath.JsonPath; +import lombok.extern.slf4j.Slf4j; +import net.logstash.logback.encoder.org.apache.commons.lang.StringUtils; +import org.egov.common.contract.request.RequestInfo; +import digit.config.Configuration; +import digit.kafka.Producer; +import digit.web.models.*; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.web.client.RestTemplate; +import static digit.constants.Constants.*; +import java.util.*; + + +@Slf4j +@Service +public class NotificationService { + + @Autowired + private Producer producer; + + @Autowired + private Configuration configs; + + @Autowired + private RestTemplate restTemplate; + + /** + * Prepares event notifications and pushes to event-notification topic + * @param request Request object containing details of survey + */ + public void prepareEventAndSend(ServiceDefinitionRequest request){ + // Prepare link to view document + String tenantId = request.getServiceDefinition().getTenantId(); + StringBuilder link = new StringBuilder(configs.getNotificationUiHost()); + link.append(configs.getNotificationEndpoint()); + String customizedLink = getCustomSurveyViewLink(link.toString(), request.getServiceDefinition()); + String messageTemplate = fetchContentFromLocalization(request.getRequestInfo(), tenantId,LOCALIZATION_MODULE , LOCALIZATION_CODE); + messageTemplate = messageTemplate.replace(SURVEY_TITLE, request.getServiceDefinition().getCode()); + + Action action = null; + + List items = new ArrayList<>(); + ActionItem documentItem = ActionItem.builder().actionUrl(customizedLink).code(configs.getSurveyActionCode()).build(); + items.add(documentItem); + + action = Action.builder().actionUrls(items).build(); + + List events = Collections.singletonList(Event.builder() + .tenantId(request.getServiceDefinition().getTenantId()) + .name(NEW_SURVEY) + .source(WEBAPP) + .eventType(SYSTEMGENERATED) + .description(messageTemplate) + .actions(action) + .build()); + log.info(events.toString()); + producer.push(configs.getUserEventTopic(), new EventRequest(request.getRequestInfo(), events)); + } + + /** + * Forms survey view link for notifications + * @param link link with placeholders + * @param serviceDefinition object containing details of survey to be validated + * @return link with replaced information + */ + private String getCustomSurveyViewLink(String link, ServiceDefinition serviceDefinition) { + link = link.replace(APPLICATION_NUMBER_PLACEHOLDER, serviceDefinition.getClientId()); + link = link.replace(TENANTID_PLACEHOLDER, serviceDefinition.getTenantId()); + return link; + } + + /** + * Fetches messages from localization service + * + * @param tenantId tenantId of the BPA + * @param requestInfo The requestInfo of the request + * @return Localization messages for the module + */ + private String fetchContentFromLocalization(RequestInfo requestInfo, String tenantId, String module, String code){ + String message = null; + List codes = new ArrayList<>(); + List messages = new ArrayList<>(); + Object result = null; + String locale = ""; + if(requestInfo.getMsgId().contains("|")) + locale = requestInfo.getMsgId().split("[\\|]")[1]; + if(StringUtils.isEmpty(locale)) + locale = configs.getFallBackLocale(); + StringBuilder uri = new StringBuilder(); + uri.append(configs.getLocalizationHost()).append(configs.getLocalizationEndpoint()); + uri.append("?tenantId=").append(tenantId.split("\\.")[0]).append("&locale=").append(locale).append("&module=").append(module); + + Map request = new HashMap<>(); + request.put("RequestInfo", requestInfo); + try { + result = restTemplate.postForObject(uri.toString(), request, Map.class); + codes = JsonPath.read(result, LOCALIZATION_CODES_JSONPATH); + messages = JsonPath.read(result, LOCALIZATION_MSGS_JSONPATH); + } catch (Exception e) { + log.error("Exception while fetching from localization: " + e); + } + if(CollectionUtils.isEmpty(messages)){ + throw new CustomException("LOCALIZATION_NOT_FOUND", "Localization not found for the code: " + code); + } + for(int index = 0; index < codes.size(); index++){ + if(codes.get(index).equals(code)){ + message = messages.get(index); + } + } + return message; + } + +} diff --git a/core-services/service-request/src/main/java/digit/service/ServiceDefinitionRequestService.java b/core-services/service-request/src/main/java/digit/service/ServiceDefinitionRequestService.java index eba021c8c88..e670c34391d 100644 --- a/core-services/service-request/src/main/java/digit/service/ServiceDefinitionRequestService.java +++ b/core-services/service-request/src/main/java/digit/service/ServiceDefinitionRequestService.java @@ -8,10 +8,23 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import digit.repository.ServiceRequestRepository; +import lombok.extern.slf4j.Slf4j; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.JsonNode; + +import java.time.Instant; +import java.time.LocalDate; +import java.time.ZoneId; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashSet; import java.util.List; +import java.util.Set; +@Slf4j @Service public class ServiceDefinitionRequestService { @@ -30,6 +43,12 @@ public class ServiceDefinitionRequestService { @Autowired private Configuration config; + @Autowired + private ObjectMapper mapper; + + @Autowired + private ServiceRequestRepository serviceRequestRepository; + public ServiceDefinition createServiceDefinition(ServiceDefinitionRequest serviceDefinitionRequest) { ServiceDefinition serviceDefinition = serviceDefinitionRequest.getServiceDefinition(); @@ -43,17 +62,43 @@ public ServiceDefinition createServiceDefinition(ServiceDefinitionRequest servic // Producer statement to emit service definition to kafka for persisting producer.push(config.getServiceDefinitionCreateTopic(), serviceDefinitionRequest); - // Restore attribute values to the type in which it was sent in service definition request + // Restore attribute values to the type in which it was sent in service + // definition request enrichmentService.setAttributeDefinitionValuesBackToNativeState(serviceDefinition); return serviceDefinition; } - public List searchServiceDefinition(ServiceDefinitionSearchRequest serviceDefinitionSearchRequest){ - - List listOfServiceDefinitions = serviceDefinitionRequestRepository.getServiceDefinitions(serviceDefinitionSearchRequest); - - if(CollectionUtils.isEmpty(listOfServiceDefinitions)) + public List searchServiceDefinition( + ServiceDefinitionSearchRequest serviceDefinitionSearchRequest) { + + System.out.println("search service definition outside"); + System.out.println(serviceDefinitionSearchRequest.getServiceDefinitionCriteria()); + if (serviceDefinitionSearchRequest.getServiceDefinitionCriteria().getStatus() != null + && (!serviceDefinitionSearchRequest.getServiceDefinitionCriteria().getStatus().isEmpty()) + && (!serviceDefinitionSearchRequest.getServiceDefinitionCriteria().getStatus() + .equalsIgnoreCase("all"))) { + + LocalDate currentDate = LocalDate.now(ZoneId.systemDefault()); + long todayStartEpochMillis = currentDate.atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); + + ServiceDefinitionCriteria ServiceDefinitionCriteria = serviceDefinitionSearchRequest.getServiceDefinitionCriteria(); + ServiceDefinitionCriteria.setTodaysDate(todayStartEpochMillis); + serviceDefinitionSearchRequest.setServiceDefinitionCriteria(ServiceDefinitionCriteria); + System.out.println("search service definition inside"); + System.out.println(serviceDefinitionSearchRequest.getServiceDefinitionCriteria()); + List ListOfActiveInactiveServiceDefinitions = serviceDefinitionRequestRepository + .getServiceDefinitions(serviceDefinitionSearchRequest); + + Collections.sort(ListOfActiveInactiveServiceDefinitions); + return ListOfActiveInactiveServiceDefinitions; + + } + + List listOfServiceDefinitions = serviceDefinitionRequestRepository + .getServiceDefinitions(serviceDefinitionSearchRequest); + + if (CollectionUtils.isEmpty(listOfServiceDefinitions)) return new ArrayList<>(); listOfServiceDefinitions.forEach(serviceDefinition -> { @@ -61,15 +106,92 @@ public List searchServiceDefinition(ServiceDefinitionSearchRe enrichmentService.setAttributeDefinitionValuesBackToNativeState(serviceDefinition); }); + // serch user by uuid which is clientid in service definition and enrich the + // posted by variable. + Set clientIds = new HashSet<>(); + // prepare a set of clientIds from servicedefinitionrequest to send to user + // search request + listOfServiceDefinitions.forEach(serviceDefinition -> { + if (serviceDefinition.getClientId() != null) + clientIds.add(serviceDefinition.getClientId()); + }); + + UserSearchRequest userSearchRequestByUuid = null; + String Url = config.getUserServiceHostName() + .concat(config.getUserServiceSearchPath()); + + userSearchRequestByUuid = UserSearchRequest.builder() + .requestInfo(serviceDefinitionSearchRequest.getRequestInfo()) + .uuid(clientIds).build(); + + List usersresponse = mapper + .convertValue(serviceRequestRepository.fetchResult(Url, userSearchRequestByUuid), UserResponse.class) + .getUser(); + + listOfServiceDefinitions.forEach(serviceDefinition -> { + String id = serviceDefinition.getClientId(); + usersresponse.forEach(user -> { + if (user.getUuid().equals(id)) { + serviceDefinition.setPostedBy(user.getName()); + } + }); + }); + + if (serviceDefinitionSearchRequest.getServiceDefinitionCriteria().getPostedBy() != null + && (!serviceDefinitionSearchRequest.getServiceDefinitionCriteria().getPostedBy().isEmpty()) + && (!serviceDefinitionSearchRequest.getServiceDefinitionCriteria().getPostedBy() + .equalsIgnoreCase("All"))) { + // UserSearchRequest userSearchRequest = null; + // String userUri = config.getUserServiceHostName() + // .concat(config.getUserServiceSearchPath()); + + // userSearchRequest = UserSearchRequest.builder().requestInfo(serviceDefinitionSearchRequest.getRequestInfo()) + // .tenantId(serviceDefinitionSearchRequest.getServiceDefinitionCriteria().getTenantId()) + // .name(serviceDefinitionSearchRequest.getServiceDefinitionCriteria().getPostedBy()).build(); + + // List users = mapper + // .convertValue(serviceRequestRepository.fetchResult(userUri, userSearchRequest), UserResponse.class) + // .getUser(); + + // List finalListOfServiceDefinitions = new ArrayList<>(); + + // listOfServiceDefinitions.forEach(serviceDefinition -> { + // String id = serviceDefinition.getClientId(); + // users.forEach(user -> { + // if (user.getUuid().equals(id)) { + // finalListOfServiceDefinitions.add(serviceDefinition); + // } + // }); + // }); + + // listOfServiceDefinitions = finalListOfServiceDefinitions; + List ListOfPostedByServiceDefinitions = serviceDefinitionRequestRepository + .getServiceDefinitions(serviceDefinitionSearchRequest); + listOfServiceDefinitions = ListOfPostedByServiceDefinitions; + } + Collections.sort(listOfServiceDefinitions); return listOfServiceDefinitions; } + public ServiceDefinition updateServiceDefinition(ServiceDefinitionRequest serviceDefinitionRequest) { - // TO DO + ServiceDefinition serviceDefinition = serviceDefinitionRequest.getServiceDefinition(); + + enrichmentService.updateServiceDefinitionRequest(serviceDefinitionRequest); + + producer.push(config.getServiceDefinitionUpdateTopic(), serviceDefinitionRequest); + + return serviceDefinition; + } - return serviceDefinitionRequest.getServiceDefinition(); + /** + * Fetches total count of surveys in the system based on the search criteria + * + * @param criteria Survey search criteria + */ + public Integer countTotalSurveys(ServiceDefinitionSearchRequest serviceDefinitionSearchRequest) { + return serviceDefinitionRequestRepository.fetchTotalSurveyCount(serviceDefinitionSearchRequest); } } - diff --git a/core-services/service-request/src/main/java/digit/service/ServiceRequestEnrichmentService.java b/core-services/service-request/src/main/java/digit/service/ServiceRequestEnrichmentService.java index 79a8e90a3a0..a52ccc98a93 100644 --- a/core-services/service-request/src/main/java/digit/service/ServiceRequestEnrichmentService.java +++ b/core-services/service-request/src/main/java/digit/service/ServiceRequestEnrichmentService.java @@ -103,4 +103,18 @@ public void setAttributeValuesBackToNativeState(ServiceRequest serviceRequest, M attributeValue.setValue(attributeCodeVsValueMap.get(attributeValue.getAttributeCode())); }); } + + public void updateServiceDefinitionRequest(ServiceDefinitionRequest serviceDefinitionRequest) { + ServiceDefinition serviceDefinition = serviceDefinitionRequest.getServiceDefinition(); + RequestInfo requestInfo = serviceDefinitionRequest.getRequestInfo(); + + AuditDetails auditDetails = new AuditDetails(); + auditDetails.setCreatedBy(requestInfo.getUserInfo().getUuid()); + auditDetails.setLastModifiedBy(requestInfo.getUserInfo().getUuid()); + auditDetails.setCreatedTime(System.currentTimeMillis()); + auditDetails.setLastModifiedTime(System.currentTimeMillis()); + + serviceDefinition.setAuditDetails(auditDetails); + + } } diff --git a/core-services/service-request/src/main/java/digit/web/controllers/ServiceDefinitionController.java b/core-services/service-request/src/main/java/digit/web/controllers/ServiceDefinitionController.java index 8cc826b4b26..574480a2825 100644 --- a/core-services/service-request/src/main/java/digit/web/controllers/ServiceDefinitionController.java +++ b/core-services/service-request/src/main/java/digit/web/controllers/ServiceDefinitionController.java @@ -44,7 +44,8 @@ public ResponseEntity create(@RequestBody @Valid Serv @RequestMapping(value="/definition/v1/_search", method = RequestMethod.POST) public ResponseEntity search(@Valid @RequestBody ServiceDefinitionSearchRequest serviceDefinitionSearchRequest) { List serviceDefinitionList = serviceDefinitionRequestService.searchServiceDefinition(serviceDefinitionSearchRequest); - ServiceDefinitionResponse response = ServiceDefinitionResponse.builder().serviceDefinition(serviceDefinitionList).build(); + Integer totalCount = serviceDefinitionRequestService.countTotalSurveys(serviceDefinitionSearchRequest); + ServiceDefinitionResponse response = ServiceDefinitionResponse.builder().serviceDefinition(serviceDefinitionList).totalCount(totalCount).build(); return new ResponseEntity<>(response,HttpStatus.OK); } diff --git a/core-services/service-request/src/main/java/digit/web/models/Action.java b/core-services/service-request/src/main/java/digit/web/models/Action.java new file mode 100644 index 00000000000..8c1fb9fc78b --- /dev/null +++ b/core-services/service-request/src/main/java/digit/web/models/Action.java @@ -0,0 +1,27 @@ +package digit.web.models; + +import java.util.List; + +import javax.validation.constraints.NotNull; +import lombok.*; +import org.springframework.validation.annotation.Validated; + + +@Validated +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +@Builder +public class Action { + private String tenantId; + + private String id; + + private String eventId; + + @NotNull + private List actionUrls; +} diff --git a/core-services/service-request/src/main/java/digit/web/models/ActionItem.java b/core-services/service-request/src/main/java/digit/web/models/ActionItem.java new file mode 100644 index 00000000000..6c540b16e49 --- /dev/null +++ b/core-services/service-request/src/main/java/digit/web/models/ActionItem.java @@ -0,0 +1,23 @@ +package digit.web.models; + +import javax.validation.constraints.NotNull; +import lombok.*; +import org.springframework.validation.annotation.Validated; + + +@Validated +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +@Builder +public class ActionItem { + @NotNull + private String actionUrl; + + @NotNull + private String code; + +} diff --git a/core-services/service-request/src/main/java/digit/web/models/Event.java b/core-services/service-request/src/main/java/digit/web/models/Event.java new file mode 100644 index 00000000000..c1f4aa6ac94 --- /dev/null +++ b/core-services/service-request/src/main/java/digit/web/models/Event.java @@ -0,0 +1,37 @@ +package digit.web.models; + +import javax.validation.constraints.NotNull; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; + +@Validated +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +@Builder +public class Event { + @NotNull + private String tenantId; + + private String id; + + @NotNull + private String eventType; + + private String name; + + @NotNull + private String description; + + @NotNull + private String source; + + private EventDetails eventDetails; + + private Action actions; +} diff --git a/core-services/service-request/src/main/java/digit/web/models/EventDetails.java b/core-services/service-request/src/main/java/digit/web/models/EventDetails.java new file mode 100644 index 00000000000..1df32197b1a --- /dev/null +++ b/core-services/service-request/src/main/java/digit/web/models/EventDetails.java @@ -0,0 +1,37 @@ +package digit.web.models; + +import java.math.BigDecimal; +import lombok.*; +import org.springframework.validation.annotation.Validated; + +@Validated +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +@Builder +public class EventDetails { + private String id; + + private String eventId; + + private Long fromDate; + + private Long toDate; + + private BigDecimal latitude; + + private BigDecimal longitude; + + private String address; + + + public boolean isEmpty(EventDetails details) { + if(null == details.getFromDate() || null == details.getToDate() || null == details.getLatitude() || null == details.getLongitude()) { + return true; + } + return false; + } +} diff --git a/core-services/service-request/src/main/java/digit/web/models/EventRequest.java b/core-services/service-request/src/main/java/digit/web/models/EventRequest.java new file mode 100644 index 00000000000..c935ab81bef --- /dev/null +++ b/core-services/service-request/src/main/java/digit/web/models/EventRequest.java @@ -0,0 +1,32 @@ +package digit.web.models; + +import java.util.List; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +@Validated +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EventRequest { + @NotNull + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + @NotNull + @Valid + @JsonProperty("events") + private List events; +} diff --git a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinition.java b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinition.java index 0d186e8114e..5456ba1f77a 100644 --- a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinition.java +++ b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinition.java @@ -30,7 +30,7 @@ @AllArgsConstructor @NoArgsConstructor @Builder -public class ServiceDefinition { +public class ServiceDefinition implements Comparable { @JsonProperty("id") @Size(min = 2, max = 64) private String id = null; @@ -44,6 +44,9 @@ public class ServiceDefinition { @Size(min = 2, max = 64) private String code = null; + @JsonProperty("postedBy") + private String postedBy = null; + @JsonProperty("module") @NotNull @Size(min = 2, max = 64) @@ -52,6 +55,10 @@ public class ServiceDefinition { @JsonProperty("isActive") private Boolean isActive = true; + @Size(max = 128) + @JsonProperty("status") + private String status; + @JsonProperty("attributes") @NotNull @Valid @@ -73,4 +80,10 @@ public ServiceDefinition addAttributesItem(AttributeDefinition attributesItem) { return this; } + // for sorting response according to create time + @Override + public int compareTo(ServiceDefinition other) { + return Long.compare(this.auditDetails.getCreatedTime(), other.auditDetails.getCreatedTime()); + } + } diff --git a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionCriteria.java b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionCriteria.java index f66d6aaf683..ae892d49f5a 100644 --- a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionCriteria.java +++ b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionCriteria.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.v3.oas.annotations.media.Schema; import java.util.ArrayList; @@ -18,6 +19,7 @@ import lombok.NoArgsConstructor; import lombok.Data; import lombok.Builder; +import lombok.Builder.Default;; /** * The object will contain all the search parameters for Service Definition. @@ -46,6 +48,22 @@ public class ServiceDefinitionCriteria { @JsonProperty("clientId") private String clientId = null; + @JsonProperty("postedBy") + private String postedBy; + + @JsonProperty("status") + private String status; + + @JsonProperty("todaysDate") + private Long todaysDate; + + @JsonProperty("isActive") + private Boolean isActive; + + @JsonIgnore + @Default + private Boolean isCountCall = false; + public ServiceDefinitionCriteria addIdsItem(String idsItem) { if (this.ids == null) { this.ids = new ArrayList<>(); diff --git a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionResponse.java b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionResponse.java index 7e5e126f0d5..f853988c579 100644 --- a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionResponse.java +++ b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionResponse.java @@ -42,6 +42,9 @@ public class ServiceDefinitionResponse { @JsonProperty("Pagination") @Valid private Pagination pagination = null; + + @JsonProperty("TotalCount") + private Integer totalCount; public ServiceDefinitionResponse addServiceDefinitionItem(ServiceDefinition serviceDefinitionItem) { diff --git a/core-services/service-request/src/main/java/digit/web/models/User.java b/core-services/service-request/src/main/java/digit/web/models/User.java new file mode 100644 index 00000000000..d3791eac854 --- /dev/null +++ b/core-services/service-request/src/main/java/digit/web/models/User.java @@ -0,0 +1,76 @@ +package digit.web.models; + + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import javax.validation.Valid; + + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class User { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("uuid") + private String uuid = null; + + @JsonProperty("userName") + private String userName = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("gender") + private String gender = null; + + @JsonProperty("mobileNumber") + private String mobileNumber = null; + + @JsonProperty("emailId") + private String emailId = null; + + @JsonProperty("altContactNumber") + private String altContactNumber = null; + + @JsonProperty("pan") + private String pan = null; + + @JsonProperty("aadhaarNumber") + private String aadhaarNumber = null; + + @JsonProperty("permanentAddress") + private String permanentAddress = null; + + @JsonProperty("permanentPincode") + private String permanentPincode = null; + + @JsonProperty("correspondencePincode") + private String correspondencePincode = null; + + @JsonProperty("correspondenceAddress") + private String correspondenceAddress = null; + + @JsonProperty("active") + private Boolean active = null; + + @JsonProperty("createdBy") + private Long createdBy = null; + + @JsonProperty("lastModifiedBy") + private Long lastModifiedBy = null; + + @JsonProperty("tenantId") + private String tenantId = null; +} diff --git a/core-services/service-request/src/main/java/digit/web/models/UserResponse.java b/core-services/service-request/src/main/java/digit/web/models/UserResponse.java new file mode 100644 index 00000000000..e35c87e8d04 --- /dev/null +++ b/core-services/service-request/src/main/java/digit/web/models/UserResponse.java @@ -0,0 +1,22 @@ +package digit.web.models; + +import java.util.List; + +import org.egov.common.contract.response.ResponseInfo; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@AllArgsConstructor +@Data +@NoArgsConstructor +public class UserResponse { + @JsonProperty("responseInfo") + ResponseInfo responseInfo; + + @JsonProperty("user") + List user; +} diff --git a/core-services/service-request/src/main/java/digit/web/models/UserSearchRequest.java b/core-services/service-request/src/main/java/digit/web/models/UserSearchRequest.java new file mode 100644 index 00000000000..f7114beddea --- /dev/null +++ b/core-services/service-request/src/main/java/digit/web/models/UserSearchRequest.java @@ -0,0 +1,54 @@ +package digit.web.models; + +import java.util.List; +import java.util.Set; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.egov.common.contract.request.RequestInfo; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +public class UserSearchRequest { + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + @JsonProperty("id") + private List id; + + @JsonProperty("uuid") + private Set uuid; + + @JsonProperty("userName") + private String userName; + + @JsonProperty("name") + private String name; + + @JsonProperty("mobileNumber") + private String mobileNumber; + + @JsonProperty("aadhaarNumber") + private String aadhaarNumber; + + @JsonProperty("pan") + private String pan; + + @JsonProperty("emailId") + private String emailId; + + @JsonProperty("tenantId") + private String tenantId; + + @JsonProperty("pageSize") + private Integer pageSize=500; + + @JsonProperty("userType") + private String userType; +} diff --git a/core-services/service-request/src/main/resources/application.properties b/core-services/service-request/src/main/resources/application.properties index c040a347c22..036d2410559 100644 --- a/core-services/service-request/src/main/resources/application.properties +++ b/core-services/service-request/src/main/resources/application.properties @@ -47,8 +47,24 @@ egov.service.request.max.limit=100 # Kafka topics egov.service.definition.create.topic=save-service-definition +egov.service.definition.update.topic=update-service-definition egov.service.create.topic=save-service egov.service.create.indexer.topic=save-service-indexer # String input size configuration -egov.max.string.input.size=8192 \ No newline at end of file +egov.max.string.input.size=8192 + +#USER APIs +user.service.hostname=http://egov-user:8080/ +user.service.searchpath=user/_search + +# NOTIFICATION CONFIGS +egov.service.notification.ui.host=https://upyog-sandbox.niua.org/ +egov.service.notification.ui.redirect.url=digit-ui/citizen/engagement/surveys/fill-survey?applicationNumber={APPNUMBER}&tenantId={TENANTID} +egov.service.notification.fallback.locale=en_IN +egov.service.notification.action.code=PARTICIPATE +egov.service.notification.event.topic=persist-user-events-async + +# LOCALIZATION CONFIG +egov.localization.host=https://dev.digit.org +egov.localization.search.endpoint=/localization/messages/v1/_search \ No newline at end of file diff --git a/core-services/service-request/src/main/resources/service-request-persister.yml b/core-services/service-request/src/main/resources/service-request-persister.yml index ada2919663d..72985fdf203 100644 --- a/core-services/service-request/src/main/resources/service-request-persister.yml +++ b/core-services/service-request/src/main/resources/service-request-persister.yml @@ -135,4 +135,23 @@ serviceMaps: - jsonPath: $.Service.attributes.*.additionalDetails type: JSON - dbType: JSONB \ No newline at end of file + dbType: JSONB + + - version: 1.0 + description: Update service definition details in service definition table + fromTopic: update-service-definition + isTransaction: true + queryMaps: + + - query: UPDATE eg_service_definition SET isactive = ?, lastmodifiedby = ?, lastmodifiedtime = ? WHERE id = ? + basePath: $.ServiceDefinition + jsonMaps: + - jsonPath: $.ServiceDefinition.isActive + + - jsonPath: $.ServiceDefinition.auditDetails.lastModifiedBy + + - jsonPath: $.ServiceDefinition.auditDetails.lastModifiedTime + + - jsonPath: $.ServiceDefinition.clientId + + - jsonPath: $.ServiceDefinition.id \ No newline at end of file diff --git a/edcr/service/CHANGELOG.md b/edcr/service/CHANGELOG.md index fb17f5e144c..9bd664fb93a 100644 --- a/edcr/service/CHANGELOG.md +++ b/edcr/service/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All notable changes to this module will be documented in this file. +## 2.1.2 - 2023-09-14 +Central Instance Library Integration + ## 2.1.1 - Data push for edcr diff --git a/edcr/service/egov/egov-commons/pom.xml b/edcr/service/egov/egov-commons/pom.xml index 6daeb659c2f..1fa8da0c114 100644 --- a/edcr/service/egov/egov-commons/pom.xml +++ b/edcr/service/egov/egov-commons/pom.xml @@ -33,7 +33,7 @@ egov-erp org.egov.edcr - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT 4.0.0 @@ -57,7 +57,7 @@ org.egov.edcr egov-config - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT tests test diff --git a/edcr/service/egov/egov-commons/src/main/java/org/egov/common/entity/edcr/Plan.java b/edcr/service/egov/egov-commons/src/main/java/org/egov/common/entity/edcr/Plan.java index 72faf6766d2..993b0beac7f 100644 --- a/edcr/service/egov/egov-commons/src/main/java/org/egov/common/entity/edcr/Plan.java +++ b/edcr/service/egov/egov-commons/src/main/java/org/egov/common/entity/edcr/Plan.java @@ -71,13 +71,15 @@ public class Plan implements Serializable { private static final long serialVersionUID = 7276648029097296311L; + + private String tenantId; + Map planInfoProperties = new HashMap<>(); + /** * Plan scrutiny report status. Values true mean "Accepted" and False mean "Not Accepted". Default value false. On plan * scrutiny, if all the rules are success then value is true. */ - Map planInfoProperties = new HashMap<>(); - private Boolean edcrPassed = false; // Submission date of plan scrutiny. private Date applicationDate; @@ -197,10 +199,19 @@ public class Plan implements Serializable { private transient Map noObjectionCertificates = new HashMap<>(); private List nocDeptCodes = new ArrayList(); private HashMap featureAmendments = new LinkedHashMap<>(); + @JsonIgnore private transient Map> mdmsMasterData; private transient Boolean mainDcrPassed = false; private List icts = new ArrayList<>(); + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public List getCanopyDistanceFromPlotBoundary() { return canopyDistanceFromPlotBoundary; } @@ -647,4 +658,4 @@ public void setIcts(List icts) { this.icts = icts; } -} +} \ No newline at end of file diff --git a/edcr/service/egov/egov-commons/src/main/java/org/egov/commons/service/RestCallService.java b/edcr/service/egov/egov-commons/src/main/java/org/egov/commons/service/RestCallService.java index 25ebcd89bc6..a5404c275db 100644 --- a/edcr/service/egov/egov-commons/src/main/java/org/egov/commons/service/RestCallService.java +++ b/edcr/service/egov/egov-commons/src/main/java/org/egov/commons/service/RestCallService.java @@ -24,6 +24,7 @@ public Object fetchResult(StringBuilder uri, Object request) { LOG.info("Request: " + mapper.writeValueAsString(request)); RestTemplate restTemplate = new RestTemplate(); response = restTemplate.postForObject(uri.toString(), request, Map.class); + LOG.info("Response: " + mapper.writeValueAsString(response)); } catch (HttpClientErrorException | JsonProcessingException e) { LOG.error("Error occurred while calling API", e); } diff --git a/edcr/service/egov/egov-config/pom.xml b/edcr/service/egov/egov-config/pom.xml index 4db862328c7..a93cf44376a 100644 --- a/edcr/service/egov/egov-config/pom.xml +++ b/edcr/service/egov/egov-config/pom.xml @@ -51,7 +51,7 @@ egov-erp org.egov.edcr - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT 4.0.0 diff --git a/edcr/service/egov/egov-ear/pom.xml b/edcr/service/egov/egov-ear/pom.xml index 4c93e10de29..d217bfebbaf 100644 --- a/edcr/service/egov/egov-ear/pom.xml +++ b/edcr/service/egov/egov-ear/pom.xml @@ -5,7 +5,7 @@ org.egov.edcr egov-erp - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT 4.0.0 @@ -19,13 +19,13 @@ org.egov.edcr egov-egiweb - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT war org.egov.edcr egov-edcrweb - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT war diff --git a/edcr/service/egov/egov-edcr-extract/pom.xml b/edcr/service/egov/egov-edcr-extract/pom.xml index f8bb156264c..e47ff3c2542 100644 --- a/edcr/service/egov/egov-edcr-extract/pom.xml +++ b/edcr/service/egov/egov-edcr-extract/pom.xml @@ -35,7 +35,7 @@ org.egov.edcr egov-erp - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT e-governments edcr extract @@ -134,13 +134,13 @@ org.egov.edcr egov-egi - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT org.egov.edcr egov-commons - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT diff --git a/edcr/service/egov/egov-edcr-extract/src/main/java/org/egov/edcr/feature/DxfToPdfConverterExtract.java b/edcr/service/egov/egov-edcr-extract/src/main/java/org/egov/edcr/feature/DxfToPdfConverterExtract.java index 2fab39b2a8d..72d34bd73b0 100644 --- a/edcr/service/egov/egov-edcr-extract/src/main/java/org/egov/edcr/feature/DxfToPdfConverterExtract.java +++ b/edcr/service/egov/egov-edcr-extract/src/main/java/org/egov/edcr/feature/DxfToPdfConverterExtract.java @@ -64,6 +64,7 @@ import org.kabeja.math.MathUtils; import org.kabeja.xml.SAXSerializer; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -96,6 +97,8 @@ public class DxfToPdfConverterExtract extends FeatureExtract { private MDMSValidator mdmsValidator; @Autowired private CityService cityService; + @Value("${is.environment.central.instance}") + private String isEnvironmentCentralInstance; @Override public PlanDetail extract(PlanDetail planDetail) { @@ -104,7 +107,12 @@ public PlanDetail extract(PlanDetail planDetail) { boolean mdmsDxfToPdfEnabled = false; if (mdmsEnabled != null && mdmsEnabled) { City stateCity = cityService.fetchStateCityDetails(); - String tenantID = ApplicationThreadLocals.getTenantID(); + String[] tenantArr = ApplicationThreadLocals.getFullTenantID().split("\\."); + String tenantID; + if(Boolean.TRUE.equals(Boolean.valueOf(isEnvironmentCentralInstance))) { + tenantID = tenantArr[0].concat(".").concat(tenantArr[1]); + } else + tenantID = tenantArr[0]; Object mdmsData = edcrMdmsUtil.mDMSCall(new RequestInfo(), new StringBuilder().append(stateCity.getCode()).append(".").append(tenantID).toString()); @@ -149,10 +157,10 @@ public PlanDetail extract(PlanDetail planDetail) { } catch (IOException e) { LOG.error("Error occured while reading mdms data", e); } - } + } else { + return planDetail; } - } } else { List dxfToPdfAppConfigEnabled = appConfigValueService diff --git a/edcr/service/egov/egov-edcr-extract/src/main/java/org/egov/edcr/service/ExtractService.java b/edcr/service/egov/egov-edcr-extract/src/main/java/org/egov/edcr/service/ExtractService.java index 6a1d0c7f1b5..a84de264756 100644 --- a/edcr/service/egov/egov-edcr-extract/src/main/java/org/egov/edcr/service/ExtractService.java +++ b/edcr/service/egov/egov-edcr-extract/src/main/java/org/egov/edcr/service/ExtractService.java @@ -40,6 +40,7 @@ import org.kabeja.parser.Parser; import org.kabeja.parser.ParserBuilder; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import com.fasterxml.jackson.databind.ObjectMapper; @@ -58,6 +59,8 @@ public class ExtractService { private CityService cityService; @Autowired private MDMSValidator mdmsValidator; + @Value("${is.environment.central.instance}") + private String isEnvironmentCentralInstance; private Logger LOG = LogManager.getLogger(ExtractService.class); @@ -96,9 +99,15 @@ public Plan extract(File dxfFile, Amendment amd, Date scrutinyDate, List org.egov.edcr egov-erp - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT egov-edcr e-governments edcr @@ -62,7 +62,7 @@ org.egov.edcr egov-edcr-extract - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT diff --git a/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/entity/EdcrApplication.java b/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/entity/EdcrApplication.java index daaa814cd38..c1b7fe11e50 100644 --- a/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/entity/EdcrApplication.java +++ b/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/entity/EdcrApplication.java @@ -29,6 +29,7 @@ import org.egov.infra.admin.master.entity.User; import org.egov.infra.persistence.entity.AbstractAuditable; import org.hibernate.validator.constraints.Length; +import org.hibernate.validator.constraints.SafeHtml; import org.springframework.web.multipart.MultipartFile; @Entity @@ -103,6 +104,9 @@ public class EdcrApplication extends AbstractAuditable { private transient Map> mdmsMasterData; private transient String deviationStatus; + + @SafeHtml + private String tenantId; @Override public Long getId() { @@ -306,4 +310,12 @@ public void setDeviationStatus(String deviationStatus) { this.deviationStatus = deviationStatus; } -} + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + +} \ No newline at end of file diff --git a/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/entity/EdcrApplicationDetail.java b/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/entity/EdcrApplicationDetail.java index 5d27f76a60f..12fea844425 100644 --- a/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/entity/EdcrApplicationDetail.java +++ b/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/entity/EdcrApplicationDetail.java @@ -61,6 +61,7 @@ import org.egov.infra.filestore.entity.FileStoreMapper; import org.egov.infra.persistence.entity.AbstractAuditable; import org.hibernate.validator.constraints.Length; +import org.hibernate.validator.constraints.SafeHtml; @Entity @Table(name = "EDCR_APPLICATION_DETAIL") @@ -114,6 +115,9 @@ public class EdcrApplicationDetail extends AbstractAuditable { @Length(min = 1, max = 128) private String comparisonDcrNumber; + + @SafeHtml + private String tenantId; @Override public Long getId() { @@ -221,4 +225,12 @@ public void setComparisonDcrNumber(String comparisonDcrNumber) { this.comparisonDcrNumber = comparisonDcrNumber; } -} + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + +} \ No newline at end of file diff --git a/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/entity/EdcrPdfDetail.java b/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/entity/EdcrPdfDetail.java index 724d751e7b7..f4e6e532c21 100644 --- a/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/entity/EdcrPdfDetail.java +++ b/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/entity/EdcrPdfDetail.java @@ -17,6 +17,7 @@ import org.egov.infra.filestore.entity.FileStoreMapper; import org.egov.infra.persistence.entity.AbstractAuditable; +import org.hibernate.validator.constraints.SafeHtml; @Entity @@ -48,6 +49,9 @@ public class EdcrPdfDetail extends AbstractAuditable { @Transient private List violations; + + @SafeHtml + private String tenantId; @Override public Long getId() { @@ -107,4 +111,12 @@ public void setViolations(List violations) { this.violations = violations; } -} + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + +} \ No newline at end of file diff --git a/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/repository/PlanFeatureRepository.java b/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/repository/PlanFeatureRepository.java index 8c7aae40574..9816319fb5f 100644 --- a/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/repository/PlanFeatureRepository.java +++ b/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/repository/PlanFeatureRepository.java @@ -380,8 +380,9 @@ public List getFeatures() { pf = new PlanFeature(InfoCommsTechService.class); features.add(pf); - pf = new PlanFeature(DxfToPdfConverter.class); - features.add(pf); + /* + * pf = new PlanFeature(DxfToPdfConverter.class); features.add(pf); + */ return features; diff --git a/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/service/EdcrApplicationService.java b/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/service/EdcrApplicationService.java index 978b6cefde0..fd3bd1064df 100644 --- a/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/service/EdcrApplicationService.java +++ b/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/service/EdcrApplicationService.java @@ -29,6 +29,7 @@ import org.egov.edcr.repository.EdcrApplicationDetailRepository; import org.egov.edcr.repository.EdcrApplicationRepository; import org.egov.edcr.service.es.EdcrIndexService; +import org.egov.infra.config.core.ApplicationThreadLocals; import org.egov.infra.config.persistence.datasource.routing.annotation.ReadOnly; import org.egov.infra.filestore.entity.FileStoreMapper; import org.egov.infra.filestore.service.FileStoreService; @@ -121,8 +122,10 @@ public EdcrApplication update(final EdcrApplication edcrApplication) { private Plan callDcrProcess(EdcrApplication edcrApplication, String applicationType){ Plan planDetail = new Plan(); + planDetail.setTenantId(ApplicationThreadLocals.getFullTenantID()); planDetail = planService.process(edcrApplication, applicationType); updateFile(planDetail, edcrApplication); + edcrApplication.getEdcrApplicationDetails().get(0).setTenantId(ApplicationThreadLocals.getFullTenantID()); edcrApplicationDetailService.saveAll(edcrApplication.getEdcrApplicationDetails()); return planDetail; } diff --git a/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/service/EdcrBpaRestService.java b/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/service/EdcrBpaRestService.java index 4b6e466d5a8..fa09c27cb18 100644 --- a/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/service/EdcrBpaRestService.java +++ b/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/service/EdcrBpaRestService.java @@ -16,6 +16,8 @@ @Service("edcrBpaRestService") public class EdcrBpaRestService { + private static final String COMMON_DOMAIN_NAME = "common.domain.name"; + private static final String IS_ENVIRONMENT_CENTRAL_INSTANCE = "is.environment.central.instance"; private static final String BPACHECKDEMOND = "%s/bpa/rest/stakeholder/check/demand-pending/{userId}"; private static final String REDIRECTTOCOLLECTION = "%s/bpa/application/stakeholder/generate-bill/{userId}"; private static final String STAKEHOLDER_VALIDATION_URL = "%s/bpa/rest/validate/stakeholder/{userId}"; @@ -26,14 +28,20 @@ public class EdcrBpaRestService { public Boolean checkAnyTaxIsPendingToCollectForStakeHolder(final Long userId, final HttpServletRequest request) { final RestTemplate restTemplate = new RestTemplate(); - final String url = String.format(BPACHECKDEMOND, WebUtils.extractRequestDomainURL(request, false)); + final String url = String.format(BPACHECKDEMOND, + WebUtils.extractRequestDomainURL(request, false, + environmentSettings.getProperty(IS_ENVIRONMENT_CENTRAL_INSTANCE, Boolean.class), + environmentSettings.getProperty(COMMON_DOMAIN_NAME))); Map checkPending = restTemplate.getForObject(url, Map.class, userId); return checkPending.get("pending") != null && checkPending.get("pending"); } public String generateBillAndRedirectToCollection(final Long userId, final HttpServletRequest request) { final RestTemplate restTemplate = new RestTemplate(); - final String url = String.format(REDIRECTTOCOLLECTION, WebUtils.extractRequestDomainURL(request, false)); + final String url = String.format(REDIRECTTOCOLLECTION, + WebUtils.extractRequestDomainURL(request, false, + environmentSettings.getProperty(IS_ENVIRONMENT_CENTRAL_INSTANCE, Boolean.class), + environmentSettings.getProperty(COMMON_DOMAIN_NAME))); return restTemplate.getForObject(url, String.class, userId); } @@ -46,13 +54,19 @@ public ErrorDetail validateStakeholder(final Long userId, final HttpServletReque url = String.format(STAKEHOLDER_VALIDATION_URL, environmentSettings.getProperty("stakeholder.domain.url", String.class)); else - url = String.format(STAKEHOLDER_VALIDATION_URL, WebUtils.extractRequestDomainURL(request, false)); + url = String.format(STAKEHOLDER_VALIDATION_URL, + WebUtils.extractRequestDomainURL(request, false, + environmentSettings.getProperty(IS_ENVIRONMENT_CENTRAL_INSTANCE, Boolean.class), + environmentSettings.getProperty(COMMON_DOMAIN_NAME))); return restTemplate.getForObject(url, ErrorDetail.class, userId); } public List getEdcrIntegratedServices(final HttpServletRequest request) { final RestTemplate restTemplate = new RestTemplate(); - final String url = String.format(EDCR_SERVICES_URL, WebUtils.extractRequestDomainURL(request, false)); + final String url = String.format(EDCR_SERVICES_URL, + WebUtils.extractRequestDomainURL(request, false, + environmentSettings.getProperty(IS_ENVIRONMENT_CENTRAL_INSTANCE, Boolean.class), + environmentSettings.getProperty(COMMON_DOMAIN_NAME))); return restTemplate.getForObject(url, List.class); } } diff --git a/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/service/EdcrRestService.java b/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/service/EdcrRestService.java index 10f6fe7704e..148d9989299 100644 --- a/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/service/EdcrRestService.java +++ b/edcr/service/egov/egov-edcr/src/main/java/org/egov/edcr/service/EdcrRestService.java @@ -70,9 +70,8 @@ import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.egov.common.entity.dcr.helper.ErrorDetail; import org.egov.common.entity.edcr.Plan; import org.egov.common.entity.edcr.PlanInformation; @@ -121,6 +120,8 @@ @Transactional(readOnly = true) public class EdcrRestService { + private static final String IS_ENVIRONMENT_CENTRAL_INSTANCE = "is.environment.central.instance"; + private final SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); private static final String MSG_UNQ_TRANSACTION_NUMBER = "Transaction Number should be unique"; @@ -135,7 +136,7 @@ public class EdcrRestService { private static final String BPA_05 = "BPA-05"; - private static Logger LOG = LogManager.getLogger(EdcrApplicationService.class); + private static final Logger LOG = LoggerFactory.getLogger(EdcrApplicationService.class); public static final String FILE_DOWNLOAD_URL = "%s/edcr/rest/dcr/downloadfile"; @@ -164,25 +165,17 @@ public class EdcrRestService { private EdcrApplicationDetailService applicationDetailService; @Autowired - private EnvironmentSettings environmentSettings; - - @Autowired - private RestTemplate restTemplate; - - @Value("${egov.services.egov-indexer.url}") - private String egovIndexerUrl; + private EdcrApplicationDetailService applicationDetailService; - @Value("${indexer.host}") - private String indexerHost; - public Session getCurrentSession() { return entityManager.unwrap(Session.class); } @Transactional public EdcrDetail createEdcr(final EdcrRequest edcrRequest, final MultipartFile file, - Map> masterData){ + Map> masterData) { EdcrApplication edcrApplication = new EdcrApplication(); + edcrApplication.setTenantId(ApplicationThreadLocals.getFullTenantID()); edcrApplication.setMdmsMasterData(masterData); EdcrApplicationDetail edcrApplicationDetail = new EdcrApplicationDetail(); if (ApplicationType.OCCUPANCY_CERTIFICATE.toString().equalsIgnoreCase(edcrRequest.getAppliactionType())) { @@ -235,19 +228,20 @@ public EdcrDetail createEdcr(final EdcrRequest edcrRequest, final MultipartFile tenantId = ApplicationThreadLocals.getTenantID(); } edcrApplication.setThirdPartyUserTenant(tenantId); + edcrApplication.setArchitectInformation(edcrRequest.getRequestInfo().getUserInfo().getName()); } edcrApplication = edcrApplicationService.createRestEdcr(edcrApplication); - + //Code to push the data of edcr application to kafka index EdcrIndexData edcrIndexData = new EdcrIndexData(); - if(environmentSettings.getDataPush()) { - //Building object to be pushed + if (environmentSettings.getDataPush()) { + //Building object to be pushed edcrIndexData = setEdcrIndexData(edcrApplication, edcrApplication.getEdcrApplicationDetails().get(0)); - // call kafka topic - pushDataToIndexer(edcrIndexData, "edcr-create-application"); - } - + // call kafka topic + pushDataToIndexer(edcrIndexData, "edcr-create-application"); + } + return setEdcrResponse(edcrApplication.getEdcrApplicationDetails().get(0), edcrRequest); } @@ -398,11 +392,28 @@ public EdcrDetail setEdcrResponse(EdcrApplicationDetail edcrApplnDtl, EdcrReques if (edcrApplnDtl.getApplication().getServiceType() != null) edcrDetail.setApplicationSubType(edcrApplnDtl.getApplication().getServiceType()); String tenantId; - String[] tenantArr = edcrApplnDtl.getApplication().getThirdPartyUserTenant().split("\\."); - if (tenantArr.length == 1) - tenantId = tenantArr[0]; - else - tenantId = tenantArr[1]; + boolean isCentralInstanceEnabled = environmentSettings.getProperty(IS_ENVIRONMENT_CENTRAL_INSTANCE, Boolean.class); + if (isCentralInstanceEnabled) { + tenantId = edcrApplnDtl.getPlanDetailFileStore().getTenantId(); + if (StringUtils.isBlank(tenantId)) { + String[] tenantArr = edcrApplnDtl.getApplication().getThirdPartyUserTenant().split("\\."); + if (tenantArr.length == 1) + tenantId = tenantArr[0]; + else + tenantId = tenantArr[1]; + } + } else { + if (edcrApplnDtl.getPlanDetailFileStore() != null && edcrApplnDtl.getPlanDetailFileStore().getTenantId() != null) { + tenantId = edcrApplnDtl.getPlanDetailFileStore().getTenantId(); + } else { + String[] tenantArr = edcrApplnDtl.getApplication().getThirdPartyUserTenant().split("\\."); + if (tenantArr.length == 1) + tenantId = tenantArr[0]; + else + tenantId = tenantArr[1]; + } + } + if (edcrApplnDtl.getDxfFileId() != null) edcrDetail.setDxfFile(format(getFileDownloadUrl(edcrApplnDtl.getDxfFileId().getFileStoreId(), tenantId))); @@ -416,7 +427,7 @@ public EdcrDetail setEdcrResponse(EdcrApplicationDetail edcrApplnDtl, EdcrReques File file = edcrApplnDtl.getPlanDetailFileStore() != null ? fileStoreService.fetch(edcrApplnDtl.getPlanDetailFileStore().getFileStoreId(), - DcrConstants.APPLICATION_MODULE_TYPE, tenantId) + DcrConstants.APPLICATION_MODULE_TYPE, tenantId) : null; if (LOG.isInfoEnabled()) @@ -438,7 +449,7 @@ public EdcrDetail setEdcrResponse(EdcrApplicationDetail edcrApplnDtl, EdcrReques edcrDetail.setPlanDetail(pl1); } } catch (IOException e) { - LOG.log(Level.ERROR, e); + LOG.error("Error occurred while mapping !!", e); } for (EdcrPdfDetail planPdf : edcrApplnDtl.getEdcrPdfDetails()) { @@ -455,8 +466,9 @@ public EdcrDetail setEdcrResponse(EdcrApplicationDetail edcrApplnDtl, EdcrReques } edcrDetail.setPlanPdfs(planPdfs); - edcrDetail.setTenantId(edcrRequest.getTenantId()); - + edcrDetail.setTenantId(edcrApplnDtl.getTenantId() == null ? edcrRequest.getTenantId() : edcrApplnDtl.getTenantId()); + if (edcrDetail.getPlanDetail() != null && edcrDetail.getPlanDetail().getTenantId() == null) + edcrDetail.getPlanDetail().setTenantId(edcrApplnDtl.getTenantId()); if (StringUtils.isNotBlank(edcrRequest.getComparisonEdcrNumber())) edcrDetail.setComparisonEdcrNumber(edcrRequest.getComparisonEdcrNumber()); @@ -507,7 +519,7 @@ public EdcrDetail setEdcrResponseForAcrossTenants(Object[] applnDtls, String sta try { file = String.valueOf(applnDtls[8]) != null ? fileStoreService.fetch(String.valueOf(applnDtls[8]), - DcrConstants.APPLICATION_MODULE_TYPE, tenantId) + DcrConstants.APPLICATION_MODULE_TYPE, tenantId) : null; } catch (ApplicationRuntimeException e) { LOG.error("Error occurred, while fetching plan details!!!", e); @@ -532,7 +544,7 @@ public EdcrDetail setEdcrResponseForAcrossTenants(Object[] applnDtls, String sta edcrDetail.setPlanDetail(pl1); } } catch (IOException e) { - LOG.log(Level.ERROR, e); + LOG.error("Error occurred while mapping !!", e); } edcrDetail.setTenantId(stateCityCode.concat(".").concat(tenantId)); @@ -590,131 +602,263 @@ && isBlank(edcrRequest.getApplicationNumber()) if (edcrRequest.getLimit() != null) offset = edcrRequest.getOffset(); - if (edcrRequest != null && edcrRequest.getTenantId().equalsIgnoreCase(stateCity.getCode())) { - final Map params = new ConcurrentHashMap<>(); + boolean isCentralIntsanceEnabled = environmentSettings.getProperty(IS_ENVIRONMENT_CENTRAL_INSTANCE, Boolean.class); + if (isCentralIntsanceEnabled) { + final Criteria criteria = getCurrentSession().createCriteria(EdcrApplicationDetail.class, + "edcrApplicationDetail"); + criteria.createAlias("edcrApplicationDetail.application", "application"); + if (edcrRequest != null && isNotBlank(edcrRequest.getEdcrNumber())) { + criteria.add(Restrictions.eq("edcrApplicationDetail.dcrNumber", edcrRequest.getEdcrNumber())); + } + if (edcrRequest != null && isNotBlank(edcrRequest.getTransactionNumber())) { + criteria.add(Restrictions.eq("application.transactionNumber", edcrRequest.getTransactionNumber())); + } + if (edcrRequest != null && isNotBlank(edcrRequest.getApplicationNumber())) { + criteria.add(Restrictions.eq("application.applicationNumber", edcrRequest.getApplicationNumber())); + } - String queryString = searchAtStateTenantLevel(edcrRequest, userInfo, userId, onlyTenantId, params, isStakeholder); - LOG.info(queryString); - final Query query = getCurrentSession().createSQLQuery(queryString).setFirstResult(offset) - .setMaxResults(limit); - for (final Map.Entry param : params.entrySet()) - query.setParameter(param.getKey(), param.getValue()); - List applns = query.list(); - if (applns.isEmpty()) { - EdcrDetail edcrDetail = new EdcrDetail(); - edcrDetail.setErrors("No Record Found"); - return Arrays.asList(edcrDetail); - } else { - List edcrDetails2 = new ArrayList<>(); - for (Object[] appln : applns) - edcrDetails2.add(setEdcrResponseForAcrossTenants(appln, stateCity.getCode())); - List sortedList = new ArrayList<>(); - String orderBy = "desc"; - if (isNotBlank(edcrRequest.getOrderBy())) - orderBy = edcrRequest.getOrderBy(); - if (orderBy.equalsIgnoreCase("asc")) - sortedList = edcrDetails2.stream().sorted(Comparator.comparing(EdcrDetail::getApplicationDate)) - .collect(Collectors.toList()); - else - sortedList = edcrDetails2.stream().sorted(Comparator.comparing(EdcrDetail::getApplicationDate).reversed()) - .collect(Collectors.toList()); + String appliactionType = edcrRequest.getAppliactionType(); - LOG.info("The number of records = " + edcrDetails2.size()); - return sortedList; + if (edcrRequest != null && isNotBlank(appliactionType)) { + ApplicationType applicationType = null; + if ("BUILDING_PLAN_SCRUTINY".equalsIgnoreCase(appliactionType)) { + applicationType = ApplicationType.PERMIT; + } else if ("BUILDING_OC_PLAN_SCRUTINY".equalsIgnoreCase(appliactionType)) { + applicationType = ApplicationType.OCCUPANCY_CERTIFICATE; + } + if ("Permit".equalsIgnoreCase(appliactionType)) { + applicationType = ApplicationType.PERMIT; + } else if ("Occupancy certificate".equalsIgnoreCase(appliactionType)) { + applicationType = ApplicationType.OCCUPANCY_CERTIFICATE; + } + criteria.add(Restrictions.eq("application.applicationType", applicationType)); } - } else { - final Criteria criteria = getCriteriaofSingleTenant(edcrRequest, userInfo, userId, onlyTenantId, isStakeholder); - LOG.info(criteria.toString()); + if (edcrRequest != null && isNotBlank(edcrRequest.getApplicationSubType())) { + criteria.add(Restrictions.eq("application.serviceType", edcrRequest.getApplicationSubType())); + } + + if (edcrRequest != null && isNotBlank(edcrRequest.getTenantId())) { + criteria.add(Restrictions.ilike("edcrApplicationDetail.tenantId", "%" + edcrRequest.getTenantId() + "%")); + } + + if (onlyTenantId && userInfo != null && isNotBlank(userId)) { + criteria.add(Restrictions.eq("application.thirdPartyUserCode", userId)); + } + + if (isNotBlank(edcrRequest.getStatus())) + criteria.add(Restrictions.eq("edcrApplicationDetail.status", edcrRequest.getStatus())); + if (edcrRequest.getFromDate() != null) + criteria.add(Restrictions.ge("application.applicationDate", edcrRequest.getFromDate())); + if (edcrRequest.getToDate() != null) + criteria.add(Restrictions.le("application.applicationDate", edcrRequest.getToDate())); + String orderBy = "desc"; + if (isNotBlank(edcrRequest.getOrderBy())) + orderBy = edcrRequest.getOrderBy(); + if (orderBy.equalsIgnoreCase("asc")) + criteria.addOrder(Order.asc("edcrApplicationDetail.createdDate")); + else + criteria.addOrder(Order.desc("edcrApplicationDetail.createdDate")); + + criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY); criteria.setFirstResult(offset); criteria.setMaxResults(limit); edcrApplications = criteria.list(); - } - LOG.info("The number of records = " + edcrApplications.size()); - if (edcrApplications.isEmpty()) { - EdcrDetail edcrDetail = new EdcrDetail(); - edcrDetail.setErrors("No Record Found"); - return Arrays.asList(edcrDetail); } else { - return edcrDetailsResponse(edcrApplications, edcrRequest); + if (edcrRequest != null && edcrRequest.getTenantId().equalsIgnoreCase(stateCity.getCode())) { + final Map params = new ConcurrentHashMap<>(); + + StringBuilder queryStr = new StringBuilder(); + searchAtStateTenantLevel(edcrRequest, userInfo, userId, onlyTenantId, params, isStakeholder); + final Query query = getCurrentSession().createSQLQuery(queryStr.toString()).setFirstResult(offset) + .setMaxResults(limit); + LOG.info(queryStr.toString()); + + for (final Map.Entry param : params.entrySet()) + query.setParameter(param.getKey(), param.getValue()); + List applns = query.list(); + if (applns.isEmpty()) { + EdcrDetail edcrDetail = new EdcrDetail(); + edcrDetail.setErrors("No Record Found"); + return Arrays.asList(edcrDetail); + } else { + List edcrDetails2 = new ArrayList<>(); + for (Object[] appln : applns) + edcrDetails2.add(setEdcrResponseForAcrossTenants(appln, stateCity.getCode())); + List sortedList = new ArrayList<>(); + String orderBy = "desc"; + if (isNotBlank(edcrRequest.getOrderBy())) + orderBy = edcrRequest.getOrderBy(); + if (orderBy.equalsIgnoreCase("asc")) + sortedList = edcrDetails2.stream().sorted(Comparator.comparing(EdcrDetail::getApplicationDate)) + .collect(Collectors.toList()); + else + sortedList = edcrDetails2.stream().sorted(Comparator.comparing(EdcrDetail::getApplicationDate).reversed()) + .collect(Collectors.toList()); + + LOG.info("The number of records = " + edcrDetails2.size()); + return sortedList; + } + } else { + final Criteria criteria = getCriteriaofSingleTenant(edcrRequest, userInfo, userId, onlyTenantId, isStakeholder); + + LOG.info(criteria.toString()); + criteria.setFirstResult(offset); + criteria.setMaxResults(limit); + edcrApplications = criteria.list(); + } } + + LOG.info("The number of records = " + edcrApplications.size()); + if (edcrApplications.isEmpty()) { + EdcrDetail edcrDetail = new EdcrDetail(); + edcrDetail.setErrors("No Record Found"); + return Arrays.asList(edcrDetail); + } else { + return edcrDetailsResponse(edcrApplications, edcrRequest); + } } - public Integer fetchCount(final EdcrRequest edcrRequest, final RequestInfoWrapper reqInfoWrapper) { - UserInfo userInfo = reqInfoWrapper.getRequestInfo() == null ? null - : reqInfoWrapper.getRequestInfo().getUserInfo(); - String userId = ""; - if (userInfo != null && StringUtils.isNoneBlank(userInfo.getUuid())) - userId = userInfo.getUuid(); - else if (userInfo != null && StringUtils.isNoneBlank(userInfo.getId())) - userId = userInfo.getId(); - - // When the user is ANONYMOUS, then search application by edcrno or transaction - // number - if (userInfo != null && StringUtils.isNoneBlank(userId) && userInfo.getPrimaryrole() != null - && !userInfo.getPrimaryrole().isEmpty()) { - List roles = userInfo.getPrimaryrole().stream().map(Role::getCode).collect(Collectors.toList()); - LOG.info("****Roles***" + roles); - if (roles.contains("ANONYMOUS")) - userId = ""; - } - boolean onlyTenantId = edcrRequest != null && isBlank(edcrRequest.getEdcrNumber()) - && isBlank(edcrRequest.getTransactionNumber()) && isBlank(edcrRequest.getAppliactionType()) - && isBlank(edcrRequest.getApplicationSubType()) && isBlank(edcrRequest.getStatus()) - && edcrRequest.getFromDate() == null && edcrRequest.getToDate() == null - && isBlank(edcrRequest.getApplicationNumber()) - && isNotBlank(edcrRequest.getTenantId()); - - boolean isStakeholder = edcrRequest != null && (isNotBlank(edcrRequest.getAppliactionType()) - || isNotBlank(edcrRequest.getApplicationSubType()) || isNotBlank(edcrRequest.getStatus()) - || edcrRequest.getFromDate() != null || edcrRequest.getToDate() != null); + public Integer fetchCount ( final EdcrRequest edcrRequest, final RequestInfoWrapper reqInfoWrapper){ + UserInfo userInfo = reqInfoWrapper.getRequestInfo() == null ? null + : reqInfoWrapper.getRequestInfo().getUserInfo(); + String userId = ""; + if (userInfo != null && StringUtils.isNoneBlank(userInfo.getUuid())) + userId = userInfo.getUuid(); + else if (userInfo != null && StringUtils.isNoneBlank(userInfo.getId())) + userId = userInfo.getId(); + + // When the user is ANONYMOUS, then search application by edcrno or transaction + // number + if (userInfo != null && StringUtils.isNoneBlank(userId) && userInfo.getPrimaryrole() != null + && !userInfo.getPrimaryrole().isEmpty()) { + List roles = userInfo.getPrimaryrole().stream().map(Role::getCode).collect(Collectors.toList()); + LOG.info("****Roles***" + roles); + if (roles.contains("ANONYMOUS")) + userId = ""; + } + boolean onlyTenantId = edcrRequest != null && isBlank(edcrRequest.getEdcrNumber()) + && isBlank(edcrRequest.getTransactionNumber()) && isBlank(edcrRequest.getAppliactionType()) + && isBlank(edcrRequest.getApplicationSubType()) && isBlank(edcrRequest.getStatus()) + && edcrRequest.getFromDate() == null && edcrRequest.getToDate() == null + && isBlank(edcrRequest.getApplicationNumber()) + && isNotBlank(edcrRequest.getTenantId()); + + boolean isStakeholder = edcrRequest != null && (isNotBlank(edcrRequest.getAppliactionType()) + || isNotBlank(edcrRequest.getApplicationSubType()) || isNotBlank(edcrRequest.getStatus()) + || edcrRequest.getFromDate() != null || edcrRequest.getToDate() != null); + + boolean isCentralIntsanceEnabled = environmentSettings.getProperty(IS_ENVIRONMENT_CENTRAL_INSTANCE, Boolean.class); + if (isCentralIntsanceEnabled) { + + final Criteria criteria = getCurrentSession().createCriteria(EdcrApplicationDetail.class, + "edcrApplicationDetail"); + criteria.createAlias("edcrApplicationDetail.application", "application"); + if (edcrRequest != null && isNotBlank(edcrRequest.getEdcrNumber())) { + criteria.add(Restrictions.eq("edcrApplicationDetail.dcrNumber", edcrRequest.getEdcrNumber())); + } + if (edcrRequest != null && isNotBlank(edcrRequest.getTransactionNumber())) { + criteria.add(Restrictions.eq("application.transactionNumber", edcrRequest.getTransactionNumber())); + } + if (edcrRequest != null && isNotBlank(edcrRequest.getApplicationNumber())) { + criteria.add(Restrictions.eq("application.applicationNumber", edcrRequest.getApplicationNumber())); + } - City stateCity = cityService.fetchStateCityDetails(); - if (edcrRequest != null && edcrRequest.getTenantId().equalsIgnoreCase(stateCity.getCode())) { - final Map params = new ConcurrentHashMap<>(); + String appliactionType = edcrRequest.getAppliactionType(); + + if (edcrRequest != null && isNotBlank(appliactionType)) { + ApplicationType applicationType = null; + if ("BUILDING_PLAN_SCRUTINY".equalsIgnoreCase(appliactionType)) { + applicationType = ApplicationType.PERMIT; + } else if ("BUILDING_OC_PLAN_SCRUTINY".equalsIgnoreCase(appliactionType)) { + applicationType = ApplicationType.OCCUPANCY_CERTIFICATE; + } + if ("Permit".equalsIgnoreCase(appliactionType)) { + applicationType = ApplicationType.PERMIT; + } else if ("Occupancy certificate".equalsIgnoreCase(appliactionType)) { + applicationType = ApplicationType.OCCUPANCY_CERTIFICATE; + } + criteria.add(Restrictions.eq("application.applicationType", applicationType)); + } + if (edcrRequest != null && isNotBlank(edcrRequest.getApplicationSubType())) { + criteria.add(Restrictions.eq("application.serviceType", edcrRequest.getApplicationSubType())); + } - String queryString = searchAtStateTenantLevel(edcrRequest, userInfo, userId, onlyTenantId, params, isStakeholder); + if (edcrRequest != null && isNotBlank(edcrRequest.getTenantId())) { + criteria.add(Restrictions.ilike("edcrApplicationDetail.tenantId", "%" + edcrRequest.getTenantId() + "%")); + } - final Query query = getCurrentSession().createSQLQuery(queryString); - for (final Map.Entry param : params.entrySet()) - query.setParameter(param.getKey(), param.getValue()); - return query.list().size(); - } else { - final Criteria criteria = getCriteriaofSingleTenant(edcrRequest, userInfo, userId, onlyTenantId, isStakeholder); - return criteria.list().size(); - } + if (onlyTenantId && userInfo != null && isNotBlank(userId)) { + criteria.add(Restrictions.eq("application.thirdPartyUserCode", userId)); + } - } + if (isNotBlank(edcrRequest.getStatus())) + criteria.add(Restrictions.eq("edcrApplicationDetail.status", edcrRequest.getStatus())); + if (edcrRequest.getFromDate() != null) + criteria.add(Restrictions.ge("application.applicationDate", edcrRequest.getFromDate())); + if (edcrRequest.getToDate() != null) + criteria.add(Restrictions.le("application.applicationDate", edcrRequest.getToDate())); + String orderBy = "desc"; + if (isNotBlank(edcrRequest.getOrderBy())) + orderBy = edcrRequest.getOrderBy(); + if (orderBy.equalsIgnoreCase("asc")) + criteria.addOrder(Order.asc("edcrApplicationDetail.createdDate")); + else + criteria.addOrder(Order.desc("edcrApplicationDetail.createdDate")); + + criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY); + return criteria.list().size(); + } else { + City stateCity = cityService.fetchStateCityDetails(); + if (edcrRequest != null && edcrRequest.getTenantId().equalsIgnoreCase(stateCity.getCode())) { + final Map params = new ConcurrentHashMap<>(); + + StringBuilder queryStr = new StringBuilder(); + searchAtStateTenantLevel(edcrRequest, userInfo, userId, onlyTenantId, params, isStakeholder); + + String queryString = searchAtStateTenantLevel(edcrRequest, userInfo, userId, onlyTenantId, params, isStakeholder); + + final Query query = getCurrentSession().createSQLQuery(queryString); + for (final Map.Entry param : params.entrySet()) + query.setParameter(param.getKey(), param.getValue()); + return query.list().size(); + } else { + final Criteria criteria = getCriteriaofSingleTenant(edcrRequest, userInfo, userId, onlyTenantId, isStakeholder); + return criteria.list().size(); + } + } + } - private String searchAtStateTenantLevel(final EdcrRequest edcrRequest, UserInfo userInfo, String userId, boolean onlyTenantId, - final Map params, boolean isStakeholder) { - StringBuilder queryStr = new StringBuilder(); - Map tenants = tenantUtils.tenantsMap(); - Iterator> tenantItr = tenants.entrySet().iterator(); - String orderByWrapperDesc = "select * from ({}) as result order by result.applicationDate desc"; - String orderByWrapperAsc = "select * from ({}) as result order by result.applicationDate asc"; - while (tenantItr.hasNext()) { - Map.Entry value = tenantItr.next(); - queryStr.append("(select '") - .append(value.getKey()) - .append("' as tenantId,appln.transactionNumber,dtl.dcrNumber,dtl.status,appln.applicantName,dxf.fileStoreId as dxfFileId,scrudxf.fileStoreId as scrutinizedDxfFileId,rofile.fileStoreId as reportOutputId,pdfile.fileStoreId as planDetailFileStore,appln.applicationDate,appln.applicationNumber,appln.applicationType,appln.serviceType,appln.planPermitNumber,appln.permitApplicationDate from ") - .append(value.getKey()) - .append(".edcr_application appln, ") - .append(value.getKey()) - .append(".edcr_application_detail dtl, ") - .append(value.getKey()) - .append(".eg_filestoremap dxf, ") - .append(value.getKey()) - .append(".eg_filestoremap scrudxf, ") - .append(value.getKey()) - .append(".eg_filestoremap rofile, ") - .append(value.getKey()) - .append(".eg_filestoremap pdfile ") - .append("where appln.id = dtl.application and dtl.dxfFileId=dxf.id and dtl.scrutinizedDxfFileId=scrudxf.id and dtl.reportOutputId=rofile.id and dtl.planDetailFileStore=pdfile.id "); + private String searchAtStateTenantLevel ( final EdcrRequest edcrRequest, UserInfo userInfo, String userId, + boolean onlyTenantId, + final Map params, boolean isStakeholder){ + StringBuilder queryStr = new StringBuilder(); + Map tenants = tenantUtils.tenantsMap(); + Iterator> tenantItr = tenants.entrySet().iterator(); + String orderByWrapperDesc = "select * from ({}) as result order by result.applicationDate desc"; + String orderByWrapperAsc = "select * from ({}) as result order by result.applicationDate asc"; + while (tenantItr.hasNext()) { + Map.Entry value = tenantItr.next(); + queryStr.append("(select '") + .append(value.getKey()) + .append("' as tenantId,appln.transactionNumber,dtl.dcrNumber,dtl.status,appln.applicantName,dxf.fileStoreId as dxfFileId,scrudxf.fileStoreId as scrutinizedDxfFileId,rofile.fileStoreId as reportOutputId,pdfile.fileStoreId as planDetailFileStore,appln.applicationDate,appln.applicationNumber,appln.applicationType,appln.serviceType,appln.planPermitNumber,appln.permitApplicationDate from ") + .append(value.getKey()) + .append(".edcr_application appln, ") + .append(value.getKey()) + .append(".edcr_application_detail dtl, ") + .append(value.getKey()) + .append(".eg_filestoremap dxf, ") + .append(value.getKey()) + .append(".eg_filestoremap scrudxf, ") + .append(value.getKey()) + .append(".eg_filestoremap rofile, ") + .append(value.getKey()) + .append(".eg_filestoremap pdfile ") + .append("where appln.id = dtl.application and dtl.dxfFileId=dxf.id and dtl.scrutinizedDxfFileId=scrudxf.id and dtl.reportOutputId=rofile.id and dtl.planDetailFileStore=pdfile.id "); if (isNotBlank(edcrRequest.getEdcrNumber())) { queryStr.append("and dtl.dcrNumber=:dcrNumber "); @@ -726,15 +870,10 @@ private String searchAtStateTenantLevel(final EdcrRequest edcrRequest, UserInfo params.put("transactionNumber", edcrRequest.getTransactionNumber()); } - if (isNotBlank(edcrRequest.getApplicationNumber())) { - queryStr.append("and appln.applicationNumber=:applicationNumber "); - params.put("applicationNumber", edcrRequest.getApplicationNumber()); - } - - if ((onlyTenantId || isStakeholder) && userInfo != null && isNotBlank(userId)) { - queryStr.append("and appln.thirdPartyUserCode=:thirdPartyUserCode "); - params.put("thirdPartyUserCode", userId); - } + if (onlyTenantId && userInfo != null && isNotBlank(userId)) { + queryStr.append("and appln.thirdPartyUserCode=:thirdPartyUserCode "); + params.put("thirdPartyUserCode", userId); + } String appliactionType = edcrRequest.getAppliactionType(); if (isNotBlank(appliactionType)) { @@ -757,56 +896,35 @@ private String searchAtStateTenantLevel(final EdcrRequest edcrRequest, UserInfo params.put("servicetype", edcrRequest.getApplicationSubType()); } - if (isNotBlank(edcrRequest.getStatus())) { - queryStr.append("and dtl.status=:status "); - params.put("status", edcrRequest.getStatus()); + queryStr.append(" order by appln.createddate desc)"); + if (tenantItr.hasNext()) { + queryStr.append(" union "); + } } - if (edcrRequest.getFromDate() != null) { - queryStr.append("and appln.applicationDate>=to_timestamp(:fromDate, 'yyyy-MM-dd')"); - params.put("fromDate", sf.format(resetFromDateTimeStamp(edcrRequest.getFromDate()))); + final Query query = getCurrentSession().createSQLQuery(queryStr.toString()); + for (final Map.Entry param : params.entrySet()) + query.setParameter(param.getKey(), param.getValue()); + List applns = query.list(); + if (applns.isEmpty()) { + EdcrDetail edcrDetail = new EdcrDetail(); + edcrDetail.setErrors("No Record Found"); + return Arrays.asList(edcrDetail); + } else { + List edcrDetails2 = new ArrayList<>(); + for (Object[] appln : applns) + edcrDetails2.add(setEdcrResponseForAcrossTenants(appln, stateCity.getCode())); + return edcrDetails2; } - - if (edcrRequest.getToDate() != null) { - queryStr.append("and appln.applicationDate<=to_timestamp(:toDate ,'yyyy-MM-dd')"); - params.put("toDate", sf.format(resetToDateTimeStamp(edcrRequest.getToDate()))); + } else { + final Criteria criteria = getCurrentSession().createCriteria(EdcrApplicationDetail.class, "edcrApplicationDetail"); + criteria.createAlias("edcrApplicationDetail.application", "application"); + if (edcrRequest != null && isNotBlank(edcrRequest.getEdcrNumber())) { + criteria.add(Restrictions.eq("edcrApplicationDetail.dcrNumber", edcrRequest.getEdcrNumber())); } - String orderBy = "desc"; - if (isNotBlank(edcrRequest.getOrderBy())) - orderBy = edcrRequest.getOrderBy(); - if (orderBy.equalsIgnoreCase("asc")) - queryStr.append(" order by appln.createddate asc)"); - else - queryStr.append(" order by appln.createddate desc)"); - if (tenantItr.hasNext()) { - queryStr.append(" union "); + if (edcrRequest != null && isNotBlank(edcrRequest.getTransactionNumber())) { + criteria.add(Restrictions.eq("application.transactionNumber", edcrRequest.getTransactionNumber())); } - } - String query; - String orderBy = "desc"; - if (isNotBlank(edcrRequest.getOrderBy())) - orderBy = edcrRequest.getOrderBy(); - if (orderBy.equalsIgnoreCase("asc")) - query = orderByWrapperAsc.replace("{}", queryStr); - else - query = orderByWrapperDesc.replace("{}", queryStr); - return query; - } - - private Criteria getCriteriaofSingleTenant(final EdcrRequest edcrRequest, UserInfo userInfo, String userId, - boolean onlyTenantId, boolean isStakeholder) { - final Criteria criteria = getCurrentSession().createCriteria(EdcrApplicationDetail.class, - "edcrApplicationDetail"); - criteria.createAlias("edcrApplicationDetail.application", "application"); - if (edcrRequest != null && isNotBlank(edcrRequest.getEdcrNumber())) { - criteria.add(Restrictions.eq("edcrApplicationDetail.dcrNumber", edcrRequest.getEdcrNumber())); - } - if (edcrRequest != null && isNotBlank(edcrRequest.getTransactionNumber())) { - criteria.add(Restrictions.eq("application.transactionNumber", edcrRequest.getTransactionNumber())); - } - if (edcrRequest != null && isNotBlank(edcrRequest.getApplicationNumber())) { - criteria.add(Restrictions.eq("application.applicationNumber", edcrRequest.getApplicationNumber())); - } String appliactionType = edcrRequest.getAppliactionType(); @@ -829,246 +947,248 @@ private Criteria getCriteriaofSingleTenant(final EdcrRequest edcrRequest, UserIn criteria.add(Restrictions.eq("application.serviceType", edcrRequest.getApplicationSubType())); } - if ((onlyTenantId || isStakeholder) && userInfo != null && isNotBlank(userId)) { - criteria.add(Restrictions.eq("application.thirdPartyUserCode", userId)); - } + if ((onlyTenantId || isStakeholder) && userInfo != null && isNotBlank(userId)) { + criteria.add(Restrictions.eq("application.thirdPartyUserCode", userId)); + } - if (isNotBlank(edcrRequest.getStatus())) - criteria.add(Restrictions.eq("edcrApplicationDetail.status", edcrRequest.getStatus())); - if (edcrRequest.getFromDate() != null) - criteria.add(Restrictions.ge("application.applicationDate", edcrRequest.getFromDate())); - if (edcrRequest.getToDate() != null) - criteria.add(Restrictions.le("application.applicationDate", edcrRequest.getToDate())); - String orderBy = "desc"; - if (isNotBlank(edcrRequest.getOrderBy())) - orderBy = edcrRequest.getOrderBy(); - if (orderBy.equalsIgnoreCase("asc")) - criteria.addOrder(Order.asc("edcrApplicationDetail.createdDate")); - else - criteria.addOrder(Order.desc("edcrApplicationDetail.createdDate")); + if (isNotBlank(edcrRequest.getStatus())) + criteria.add(Restrictions.eq("edcrApplicationDetail.status", edcrRequest.getStatus())); + if (edcrRequest.getFromDate() != null) + criteria.add(Restrictions.ge("application.applicationDate", edcrRequest.getFromDate())); + if (edcrRequest.getToDate() != null) + criteria.add(Restrictions.le("application.applicationDate", edcrRequest.getToDate())); + String orderBy = "desc"; + if (isNotBlank(edcrRequest.getOrderBy())) + orderBy = edcrRequest.getOrderBy(); + if (orderBy.equalsIgnoreCase("asc")) + criteria.addOrder(Order.asc("edcrApplicationDetail.createdDate")); + else + criteria.addOrder(Order.desc("edcrApplicationDetail.createdDate")); - criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY); - return criteria; - } + criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY); + return criteria; + } - public ErrorDetail validatePlanFile(final MultipartFile file) { - List dcrAllowedExtenstions = new ArrayList<>( - Arrays.asList(edcrApplicationSettings.getValue("dcr.dxf.allowed.extenstions").split(","))); - - String fileSize = edcrApplicationSettings.getValue("dcr.dxf.max.size"); - final String maxAllowSizeInMB = fileSize; - String extension; - if (file != null && !file.isEmpty()) { - extension = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf('.') + 1); - if (extension != null && !extension.isEmpty()) { - - if (!dcrAllowedExtenstions.contains(extension.toLowerCase())) { - return new ErrorDetail("BPA-02", "Please upload " + dcrAllowedExtenstions + " format file only"); - } else if (file.getSize() > (Long.valueOf(maxAllowSizeInMB) * 1024 * 1024)) { - return new ErrorDetail("BPA-04", "File size should not exceed 30 MB"); - } /* - * else if (allowedExtenstions.contains(extension.toLowerCase()) && (!mimeTypes.contains(mimeType) || - * StringUtils.countMatches(file.getOriginalFilename(), ".") > 1 || file.getOriginalFilename().contains("%00"))) - * { return new ErrorDetail("BPA-03", "Malicious file upload"); } - */ + public ErrorDetail validatePlanFile ( final MultipartFile file){ + List dcrAllowedExtenstions = new ArrayList<>( + Arrays.asList(edcrApplicationSettings.getValue("dcr.dxf.allowed.extenstions").split(","))); + + String fileSize = edcrApplicationSettings.getValue("dcr.dxf.max.size"); + final String maxAllowSizeInMB = fileSize; + String extension; + if (file != null && !file.isEmpty()) { + extension = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf('.') + 1); + if (extension != null && !extension.isEmpty()) { + + if (!dcrAllowedExtenstions.contains(extension.toLowerCase())) { + return new ErrorDetail("BPA-02", "Please upload " + dcrAllowedExtenstions + " format file only"); + } else if (file.getSize() > (Long.valueOf(maxAllowSizeInMB) * 1024 * 1024)) { + return new ErrorDetail("BPA-04", "File size should not exceed 30 MB"); + } /* + * else if (allowedExtenstions.contains(extension.toLowerCase()) && (!mimeTypes.contains(mimeType) || + * StringUtils.countMatches(file.getOriginalFilename(), ".") > 1 || file.getOriginalFilename().contains("%00"))) + * { return new ErrorDetail("BPA-03", "Malicious file upload"); } + */ + } + } else { + return new ErrorDetail(BPA_05, "Please upload plan file, It is mandatory"); } - } else { - return new ErrorDetail(BPA_05, "Please upload plan file, It is mandatory"); + + return null; } - return null; - } + public ErrorDetail validateEdcrRequest ( final EdcrRequest edcrRequest, final MultipartFile planFile){ + if (edcrRequest.getRequestInfo() == null) + return new ErrorDetail(BPA_07, REQ_BODY_REQUIRED); + else if (edcrRequest.getRequestInfo().getUserInfo() == null + || (edcrRequest.getRequestInfo().getUserInfo() != null + && isBlank(edcrRequest.getRequestInfo().getUserInfo().getUuid()))) + return new ErrorDetail(BPA_07, USER_ID_IS_MANDATORY); + + if (isBlank(edcrRequest.getTransactionNumber())) + return new ErrorDetail(BPA_07, "Please enter transaction number"); + if (isNotBlank(edcrRequest.getTransactionNumber()) + && edcrApplicationService.findByTransactionNumber(edcrRequest.getTransactionNumber()) != null) { + return new ErrorDetail(BPA_01, MSG_UNQ_TRANSACTION_NUMBER); + } - public ErrorDetail validateEdcrRequest(final EdcrRequest edcrRequest, final MultipartFile planFile) { - if (edcrRequest.getRequestInfo() == null) - return new ErrorDetail(BPA_07, REQ_BODY_REQUIRED); - else if (edcrRequest.getRequestInfo().getUserInfo() == null - || (edcrRequest.getRequestInfo().getUserInfo() != null - && isBlank(edcrRequest.getRequestInfo().getUserInfo().getUuid()))) - return new ErrorDetail(BPA_07, USER_ID_IS_MANDATORY); - - if (isBlank(edcrRequest.getTransactionNumber())) - return new ErrorDetail(BPA_07, "Please enter transaction number"); - if (isNotBlank(edcrRequest.getTransactionNumber()) - && edcrApplicationService.findByTransactionNumber(edcrRequest.getTransactionNumber()) != null) { - return new ErrorDetail(BPA_01, MSG_UNQ_TRANSACTION_NUMBER); + return validatePlanFile(planFile); } - return validatePlanFile(planFile); - } + public ErrorDetail validateEdcrOcRequest ( final EdcrRequest edcrRequest, final MultipartFile planFile){ + if (edcrRequest.getRequestInfo() == null) + return new ErrorDetail(BPA_07, REQ_BODY_REQUIRED); + else if (edcrRequest.getRequestInfo().getUserInfo() == null + || (edcrRequest.getRequestInfo().getUserInfo() != null + && isBlank(edcrRequest.getRequestInfo().getUserInfo().getUuid()))) + return new ErrorDetail(BPA_07, USER_ID_IS_MANDATORY); - public ErrorDetail validateEdcrOcRequest(final EdcrRequest edcrRequest, final MultipartFile planFile) { - if (edcrRequest.getRequestInfo() == null) - return new ErrorDetail(BPA_07, REQ_BODY_REQUIRED); - else if (edcrRequest.getRequestInfo().getUserInfo() == null - || (edcrRequest.getRequestInfo().getUserInfo() != null - && isBlank(edcrRequest.getRequestInfo().getUserInfo().getUuid()))) - return new ErrorDetail(BPA_07, USER_ID_IS_MANDATORY); + if (isBlank(edcrRequest.getTransactionNumber())) + return new ErrorDetail(BPA_07, "Transaction number is mandatory"); - if (isBlank(edcrRequest.getTransactionNumber())) - return new ErrorDetail(BPA_07, "Transaction number is mandatory"); + if (null == edcrRequest.getPermitDate()) + return new ErrorDetail("BPA-08", "Permit Date is mandatory"); + if (isNotBlank(edcrRequest.getTransactionNumber()) + && edcrApplicationService.findByTransactionNumber(edcrRequest.getTransactionNumber()) != null) { + return new ErrorDetail(BPA_01, MSG_UNQ_TRANSACTION_NUMBER); - if (null == edcrRequest.getPermitDate()) - return new ErrorDetail("BPA-08", "Permit Date is mandatory"); - if (isNotBlank(edcrRequest.getTransactionNumber()) - && edcrApplicationService.findByTransactionNumber(edcrRequest.getTransactionNumber()) != null) { - return new ErrorDetail(BPA_01, MSG_UNQ_TRANSACTION_NUMBER); + } + return validatePlanFile(planFile); } - return validatePlanFile(planFile); - } + public List validateScrutinizeOcRequest ( final EdcrRequest edcrRequest, + final MultipartFile planFile){ + List errorDetails = new ArrayList<>(); - public List validateScrutinizeOcRequest(final EdcrRequest edcrRequest, final MultipartFile planFile) { - List errorDetails = new ArrayList<>(); + if (edcrRequest.getRequestInfo() == null) + errorDetails.add(new ErrorDetail(BPA_07, REQ_BODY_REQUIRED)); + else if (edcrRequest.getRequestInfo().getUserInfo() == null + || (edcrRequest.getRequestInfo().getUserInfo() != null + && isBlank(edcrRequest.getRequestInfo().getUserInfo().getUuid()))) + errorDetails.add(new ErrorDetail("BPA-08", USER_ID_IS_MANDATORY)); - if (edcrRequest.getRequestInfo() == null) - errorDetails.add(new ErrorDetail(BPA_07, REQ_BODY_REQUIRED)); - else if (edcrRequest.getRequestInfo().getUserInfo() == null - || (edcrRequest.getRequestInfo().getUserInfo() != null - && isBlank(edcrRequest.getRequestInfo().getUserInfo().getUuid()))) - errorDetails.add(new ErrorDetail("BPA-08", USER_ID_IS_MANDATORY)); + if (isBlank(edcrRequest.getTransactionNumber())) + errorDetails.add(new ErrorDetail("BPA-09", "Transaction number is mandatory")); - if (isBlank(edcrRequest.getTransactionNumber())) - errorDetails.add(new ErrorDetail("BPA-09", "Transaction number is mandatory")); + if (null == edcrRequest.getPermitDate()) + errorDetails.add(new ErrorDetail("BPA-10", "Permit Date is mandatory")); + if (isNotBlank(edcrRequest.getTransactionNumber()) + && edcrApplicationService.findByTransactionNumber(edcrRequest.getTransactionNumber()) != null) { + errorDetails.add(new ErrorDetail("BPA-11", MSG_UNQ_TRANSACTION_NUMBER)); - if (null == edcrRequest.getPermitDate()) - errorDetails.add(new ErrorDetail("BPA-10", "Permit Date is mandatory")); - if (isNotBlank(edcrRequest.getTransactionNumber()) - && edcrApplicationService.findByTransactionNumber(edcrRequest.getTransactionNumber()) != null) { - errorDetails.add(new ErrorDetail("BPA-11", MSG_UNQ_TRANSACTION_NUMBER)); + } - } + String dcrNo = edcrRequest.getComparisonEdcrNumber(); + if (StringUtils.isBlank(dcrNo)) { + errorDetails.add(new ErrorDetail("BPA-29", "Comparison eDcr number is mandatory")); + } else { + EdcrApplicationDetail permitDcr = applicationDetailService.findByDcrNumberAndTPUserTenant(dcrNo, + edcrRequest.getTenantId()); - String dcrNo = edcrRequest.getComparisonEdcrNumber(); - if (StringUtils.isBlank(dcrNo)) { - errorDetails.add(new ErrorDetail("BPA-29", "Comparison eDcr number is mandatory")); - } else { - EdcrApplicationDetail permitDcr = applicationDetailService.findByDcrNumberAndTPUserTenant(dcrNo, - edcrRequest.getTenantId()); + if (permitDcr != null && permitDcr.getApplication() != null + && StringUtils.isBlank(permitDcr.getApplication().getServiceType())) { + errorDetails.add(new ErrorDetail("BPA-26", "No service type found for dcr number " + dcrNo)); + } - if (permitDcr != null && permitDcr.getApplication() != null - && StringUtils.isBlank(permitDcr.getApplication().getServiceType())) { - errorDetails.add(new ErrorDetail("BPA-26", "No service type found for dcr number " + dcrNo)); - } + if (permitDcr == null) { + errorDetails.add(new ErrorDetail("BPA-24", "No record found with dcr number " + dcrNo)); + } - if (permitDcr == null) { - errorDetails.add(new ErrorDetail("BPA-24", "No record found with dcr number " + dcrNo)); - } + if (permitDcr != null && permitDcr.getApplication() != null && edcrRequest.getAppliactionType() + .equalsIgnoreCase(permitDcr.getApplication().getApplicationType().toString())) { + errorDetails.add(new ErrorDetail("BPA-27", "Application types are same")); + } - if (permitDcr != null && permitDcr.getApplication() != null && edcrRequest.getAppliactionType() - .equalsIgnoreCase(permitDcr.getApplication().getApplicationType().toString())) { - errorDetails.add(new ErrorDetail("BPA-27", "Application types are same")); + if (permitDcr != null && permitDcr.getApplication() != null && !edcrRequest.getApplicationSubType() + .equalsIgnoreCase(permitDcr.getApplication().getServiceType())) { + errorDetails.add(new ErrorDetail("BPA-28", "Service types are not mathing")); + } } - if (permitDcr != null && permitDcr.getApplication() != null && !edcrRequest.getApplicationSubType() - .equalsIgnoreCase(permitDcr.getApplication().getServiceType())) { - errorDetails.add(new ErrorDetail("BPA-28", "Service types are not mathing")); - } + ErrorDetail validatePlanFile = validatePlanFile(planFile); + if (validatePlanFile != null) + errorDetails.add(validatePlanFile); + + return errorDetails; } - ErrorDetail validatePlanFile = validatePlanFile(planFile); - if (validatePlanFile != null) - errorDetails.add(validatePlanFile); + public List validateEdcrMandatoryFields ( final EdcrRequest edcrRequest){ + List errors = new ArrayList<>(); + if (StringUtils.isBlank(edcrRequest.getAppliactionType())) { + errors.add(new ErrorDetail("BPA-10", "Application type is missing")); + } - return errorDetails; - } + if (StringUtils.isBlank(edcrRequest.getApplicationSubType())) { + errors.add(new ErrorDetail("BPA-11", "Service type is missing")); + } - public List validateEdcrMandatoryFields(final EdcrRequest edcrRequest) { - List errors = new ArrayList<>(); - if (StringUtils.isBlank(edcrRequest.getAppliactionType())) { - errors.add(new ErrorDetail("BPA-10", "Application type is missing")); + return errors; } - if (StringUtils.isBlank(edcrRequest.getApplicationSubType())) { - errors.add(new ErrorDetail("BPA-11", "Service type is missing")); + public ErrorDetail validateSearchRequest ( final String edcrNumber, final String transactionNumber){ + ErrorDetail errorDetail = null; + if (isBlank(edcrNumber) && isBlank(transactionNumber)) + return new ErrorDetail(BPA_07, "Please enter valid edcr number or transaction number"); + return errorDetail; } - return errors; - } - - public ErrorDetail validateSearchRequest(final String edcrNumber, final String transactionNumber) { - ErrorDetail errorDetail = null; - if (isBlank(edcrNumber) && isBlank(transactionNumber)) - return new ErrorDetail(BPA_07, "Please enter valid edcr number or transaction number"); - return errorDetail; - } - /* - * public String getMimeType(final MultipartFile file) { MimeUtil.registerMimeDetector( - * "eu.medsea.mimeutil.detector.MagicMimeMimeDetector"); eu.medsea.mimeutil.MimeType mimeType = null; try { mimeType = - * MimeUtil.getMostSpecificMimeType(MimeUtil.getMimeTypes(file.getInputStream()) ); } catch (MimeException | IOException e) { - * LOG.error(e); } MimeUtil.unregisterMimeDetector( "eu.medsea.mimeutil.detector.MagicMimeMimeDetector"); return - * String.valueOf(mimeType); } + * public String getMimeType(final MultipartFile file) { + * MimeUtil.registerMimeDetector("eu.medsea.mimeutil.detector.MagicMimeMimeDetector"); eu.medsea.mimeutil.MimeType mimeType = + * null; try { mimeType = MimeUtil.getMostSpecificMimeType(MimeUtil.getMimeTypes(file.getInputStream())); } catch + * (MimeException | IOException e) { LOG.error(e); } + * MimeUtil.unregisterMimeDetector("eu.medsea.mimeutil.detector.MagicMimeMimeDetector"); return String.valueOf(mimeType); } */ - @SuppressWarnings("unused") - public ErrorDetail validateParam(List allowedExtenstions, List mimeTypes, MultipartFile file, - final String maxAllowSizeInMB) { - String extension; - String mimeType; - if (file != null && !file.isEmpty()) { - extension = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf('.') + 1); - if (extension != null && !extension.isEmpty()) { - // mimeType = getMimeType(file); - if (!allowedExtenstions.contains(extension.toLowerCase())) { - return new ErrorDetail("BPA-02", "Please upload " + allowedExtenstions + " format file only"); - } else if (file.getSize() > (Long.valueOf(maxAllowSizeInMB) * 1024 * 1024)) { - return new ErrorDetail("BPA-04", "File size should not exceed 30 MB"); - } /* - * else if (allowedExtenstions.contains(extension.toLowerCase()) && (!mimeTypes.contains(mimeType) || - * StringUtils.countMatches(file.getOriginalFilename(), ".") > 1 || file.getOriginalFilename().contains("%00"))) - * { return new ErrorDetail("BPA-03", "Malicious file upload"); } - */ + @SuppressWarnings("unused") + public ErrorDetail validateParam (List < String > allowedExtenstions, List < String > mimeTypes, MultipartFile + file, + final String maxAllowSizeInMB){ + String extension; + String mimeType; + if (file != null && !file.isEmpty()) { + extension = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf('.') + 1); + if (extension != null && !extension.isEmpty()) { + // mimeType = getMimeType(file); + if (!allowedExtenstions.contains(extension.toLowerCase())) { + return new ErrorDetail("BPA-02", "Please upload " + allowedExtenstions + " format file only"); + } else if (file.getSize() > (Long.valueOf(maxAllowSizeInMB) * 1024 * 1024)) { + return new ErrorDetail("BPA-04", "File size should not exceed 30 MB"); + } /* + * else if (allowedExtenstions.contains(extension.toLowerCase()) && (!mimeTypes.contains(mimeType) || + * StringUtils.countMatches(file.getOriginalFilename(), ".") > 1 || file.getOriginalFilename().contains("%00"))) + * { return new ErrorDetail("BPA-03", "Malicious file upload"); } + */ + } + } else { + return new ErrorDetail(BPA_05, "Please, upload plan file is mandatory"); } - } else { - return new ErrorDetail(BPA_05, "Please, upload plan file is mandatory"); + + return null; } - return null; - } + public ResponseInfo createResponseInfoFromRequestInfo (RequestInfo requestInfo, Boolean success){ + String apiId = null; + String ver = null; + String ts = null; + String resMsgId = ""; + String msgId = null; + if (requestInfo != null) { + apiId = requestInfo.getApiId(); + ver = requestInfo.getVer(); + if (requestInfo.getTs() != null) + ts = requestInfo.getTs().toString(); + msgId = requestInfo.getMsgId(); + } + String responseStatus = success ? "successful" : "failed"; - public ResponseInfo createResponseInfoFromRequestInfo(RequestInfo requestInfo, Boolean success) { - String apiId = null; - String ver = null; - String ts = null; - String resMsgId = ""; - String msgId = null; - if (requestInfo != null) { - apiId = requestInfo.getApiId(); - ver = requestInfo.getVer(); - if (requestInfo.getTs() != null) - ts = requestInfo.getTs().toString(); - msgId = requestInfo.getMsgId(); + return new ResponseInfo(apiId, ver, ts, resMsgId, msgId, responseStatus); } - String responseStatus = success ? "successful" : "failed"; - - return new ResponseInfo(apiId, ver, ts, resMsgId, msgId, responseStatus); - } - public String getFileDownloadUrl(final String fileStoreId, final String tenantId) { - return String.format(FILE_DOWNLOAD_URL, ApplicationThreadLocals.getDomainURL()) + "?tenantId=" + tenantId - + "&fileStoreId=" + fileStoreId; - } + public String getFileDownloadUrl ( final String fileStoreId, final String tenantId){ + return String.format(FILE_DOWNLOAD_URL, ApplicationThreadLocals.getDomainURL()) + "?tenantId=" + tenantId + + "&fileStoreId=" + fileStoreId; + } - public Date resetFromDateTimeStamp(final Date date) { - final Calendar cal1 = Calendar.getInstance(); - cal1.setTime(date); - cal1.set(Calendar.HOUR_OF_DAY, 0); - cal1.set(Calendar.MINUTE, 0); - cal1.set(Calendar.SECOND, 0); - cal1.set(Calendar.MILLISECOND, 0); - return cal1.getTime(); - } + public Date resetFromDateTimeStamp ( final Date date){ + final Calendar cal1 = Calendar.getInstance(); + cal1.setTime(date); + cal1.set(Calendar.HOUR_OF_DAY, 0); + cal1.set(Calendar.MINUTE, 0); + cal1.set(Calendar.SECOND, 0); + cal1.set(Calendar.MILLISECOND, 0); + return cal1.getTime(); + } - public Date resetToDateTimeStamp(final Date date) { - final Calendar cal1 = Calendar.getInstance(); - cal1.setTime(date); - cal1.set(Calendar.HOUR_OF_DAY, 23); - cal1.set(Calendar.MINUTE, 59); - cal1.set(Calendar.SECOND, 59); - cal1.set(Calendar.MILLISECOND, 999); - return cal1.getTime(); - } + public Date resetToDateTimeStamp ( final Date date){ + final Calendar cal1 = Calendar.getInstance(); + cal1.setTime(date); + cal1.set(Calendar.HOUR_OF_DAY, 23); + cal1.set(Calendar.MINUTE, 59); + cal1.set(Calendar.SECOND, 59); + cal1.set(Calendar.MILLISECOND, 999); + return cal1.getTime(); + } } \ No newline at end of file diff --git a/edcr/service/egov/egov-edcr/src/main/resources/db/migration/main/V20211129124739__edcr_tenantid_add_column_ddl.sql b/edcr/service/egov/egov-edcr/src/main/resources/db/migration/main/V20211129124739__edcr_tenantid_add_column_ddl.sql new file mode 100644 index 00000000000..0cb04e39564 --- /dev/null +++ b/edcr/service/egov/egov-edcr/src/main/resources/db/migration/main/V20211129124739__edcr_tenantid_add_column_ddl.sql @@ -0,0 +1,5 @@ +alter table edcr_application add column tenantId character varying(64); + +alter table edcr_application_detail add column tenantId character varying(64); + +alter table edcr_pdf_detail add column tenantId character varying(64); \ No newline at end of file diff --git a/edcr/service/egov/egov-edcrweb/pom.xml b/edcr/service/egov/egov-edcrweb/pom.xml index 28ce780bd0c..35dced698fd 100644 --- a/edcr/service/egov/egov-edcrweb/pom.xml +++ b/edcr/service/egov/egov-edcrweb/pom.xml @@ -34,7 +34,7 @@ egov-erp org.egov.edcr - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT 4.0.0 @@ -46,19 +46,19 @@ org.egov.edcr egov-egi - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT org.egov.edcr egov-commons - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT org.egov.edcr egov-edcr - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT diff --git a/edcr/service/egov/egov-edcrweb/src/main/java/org/egov/edcr/web/controller/rest/RestEdcrApplicationController.java b/edcr/service/egov/egov-edcrweb/src/main/java/org/egov/edcr/web/controller/rest/RestEdcrApplicationController.java index 00803aed519..5820a31158f 100644 --- a/edcr/service/egov/egov-edcrweb/src/main/java/org/egov/edcr/web/controller/rest/RestEdcrApplicationController.java +++ b/edcr/service/egov/egov-edcrweb/src/main/java/org/egov/edcr/web/controller/rest/RestEdcrApplicationController.java @@ -138,7 +138,7 @@ public class RestEdcrApplicationController { @Autowired private EdcrValidator edcrValidator; - + @PostMapping(value = "/scrutinizeplan", produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public ResponseEntity scrutinizePlan(@RequestBody MultipartFile planFile, @@ -230,6 +230,7 @@ public ResponseEntity scrutinize(@RequestPart("planFile") MultipartFile planF enrichUser.setUuid(userInfoReq.getUuid()); enrichUser.setMobile(userInfoReq.getMobile()); enrichUser.setTenantId(userInfoReq.getTenantId()); + enrichUser.setName(userInfoReq.getName()); edcr.getRequestInfo().setUserInfo(enrichUser); } ErrorDetail edcRes = edcrValidator.validate(edcr); diff --git a/edcr/service/egov/egov-egi/pom.xml b/edcr/service/egov/egov-egi/pom.xml index 27caf80627d..928fdc00ab8 100644 --- a/edcr/service/egov/egov-egi/pom.xml +++ b/edcr/service/egov/egov-egi/pom.xml @@ -35,7 +35,7 @@ egov-erp org.egov.edcr - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT 4.0.0 @@ -47,14 +47,14 @@ org.egov.edcr egov-config - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT org.egov.edcr egov-config - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT tests test diff --git a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/config/core/ApplicationThreadLocals.java b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/config/core/ApplicationThreadLocals.java index 0b400ba4f59..215307fb25a 100644 --- a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/config/core/ApplicationThreadLocals.java +++ b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/config/core/ApplicationThreadLocals.java @@ -57,56 +57,52 @@ public class ApplicationThreadLocals { private static ThreadLocal cityName = new ThreadLocal<>(); private static ThreadLocal municipalityName = new ThreadLocal<>(); private static ThreadLocal domainURL = new ThreadLocal<>(); - + private static ThreadLocal cityNameLocal = new ThreadLocal<>(); - + private static ThreadLocal districtName = new ThreadLocal<>(); private static ThreadLocal districtCode = new ThreadLocal<>(); private static ThreadLocal stateName = new ThreadLocal<>(); - private static ThreadLocal grade = new ThreadLocal<>(); - - - + private static ThreadLocal grade = new ThreadLocal<>(); + private static ThreadLocal fullTenantID = new ThreadLocal<>(); + private static ThreadLocal filestoreTenantID = new ThreadLocal<>(); public static String getGrade() { - return grade.get(); - } + return grade.get(); + } - public static void setGrade(String localGrade) { - grade.set(localGrade); - } - + public static void setGrade(String localGrade) { + grade.set(localGrade); + } public static String getDistrictName() { - return districtName.get(); - } + return districtName.get(); + } + + public static void setDistrictName(String localDistrictName) { + districtName.set(localDistrictName); + } - public static void setDistrictName(String localDistrictName) { - districtName.set(localDistrictName); - } - public static String getDistrictCode() { - return districtCode.get(); - } + return districtCode.get(); + } + + public static void setDistrictCode(String localDistrictCode) { + districtCode.set(localDistrictCode); + } - public static void setDistrictCode(String localDistrictCode) { - districtCode.set(localDistrictCode); - } - public static String getStateName() { - return stateName.get(); - } + return stateName.get(); + } - public static void setStateName(String localStateName) { - stateName.set(localStateName); - } - - + public static void setStateName(String localStateName) { + stateName.set(localStateName); + } - private ApplicationThreadLocals() { - //Not to be initialized + private ApplicationThreadLocals() { + // Not to be initialized } - + public static String getCityName() { return cityName.get(); } @@ -162,7 +158,7 @@ public static String getDomainURL() { public static void setDomainURL(String domURL) { domainURL.set(domURL); } - + public static String getCityNameLocal() { return cityNameLocal.get(); } @@ -171,6 +167,22 @@ public static void setCityNameLocal(String citiNameLocal) { cityNameLocal.set(citiNameLocal); } + public static String getFullTenantID() { + return fullTenantID.get(); + } + + public static void setFullTenantID(String fullTenantId) { + fullTenantID.set(fullTenantId); + } + + public static String getFilestoreTenantID() { + return filestoreTenantID.get(); + } + + public static void setFilestoreTenantID(String filestoreTenant) { + filestoreTenantID.set(filestoreTenant); + } + public static void clearValues() { domainName.remove(); userId.remove(); @@ -179,14 +191,14 @@ public static void clearValues() { cityName.remove(); municipalityName.remove(); domainURL.remove(); - + cityNameLocal.remove(); - + grade.remove(); districtCode.remove(); districtName.remove(); stateName.remove(); - - + fullTenantID.remove(); + filestoreTenantID.remove(); } -} +} \ No newline at end of file diff --git a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/custom/CustomImplProvider.java b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/custom/CustomImplProvider.java index 5afd4b393a3..c566a119cbb 100644 --- a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/custom/CustomImplProvider.java +++ b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/custom/CustomImplProvider.java @@ -218,7 +218,7 @@ public Object find(String beanName) { } // get ULB grade wise bean - if (ApplicationThreadLocals.getGrade().isEmpty()) { + if (ApplicationThreadLocals.getGrade() == null || ApplicationThreadLocals.getGrade().isEmpty()) { throw new RuntimeException("ULB grade not defined. Please update and try again"); } else { gradeBean = getBeanByName(beanName + "_" + ApplicationThreadLocals.getGrade()); diff --git a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/filestore/entity/FileStoreMapper.java b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/filestore/entity/FileStoreMapper.java index 3797750adaa..0ab1c2a0d6d 100644 --- a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/filestore/entity/FileStoreMapper.java +++ b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/filestore/entity/FileStoreMapper.java @@ -94,6 +94,9 @@ public class FileStoreMapper extends AbstractPersistable { @Temporal(TemporalType.TIMESTAMP) private Date createdDate = new Date(); + + @SafeHtml + private String tenantId; protected FileStoreMapper() { // For JPA @@ -160,4 +163,13 @@ public boolean equals(Object other) { public int hashCode() { return Objects.hash(id); } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + } \ No newline at end of file diff --git a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/filestore/service/impl/EgovMicroServiceStore.java b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/filestore/service/impl/EgovMicroServiceStore.java index f92f3085c1d..d280ddaad29 100644 --- a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/filestore/service/impl/EgovMicroServiceStore.java +++ b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/filestore/service/impl/EgovMicroServiceStore.java @@ -133,13 +133,14 @@ public FileStoreMapper store(File file, String fileName, String mimeType, String headers.setContentType(MediaType.MULTIPART_FORM_DATA); MultiValueMap map = new LinkedMultiValueMap(); map.add("file", new FileSystemResource(file.getName())); - map.add("tenantId", ApplicationThreadLocals.getTenantID()); + map.add("tenantId", ApplicationThreadLocals.getFilestoreTenantID()); map.add("module", moduleName); HttpEntity> request = new HttpEntity>(map, headers); ResponseEntity result = restTemplate.postForEntity(url, request, StorageResponse.class); FileStoreMapper fileMapper = new FileStoreMapper(result.getBody().getFiles().get(0).getFileStoreId(), fileName); + fileMapper.setTenantId(ApplicationThreadLocals.getFilestoreTenantID()); if (LOG.isDebugEnabled()) LOG.debug( String.format("Uploaded file %s with filestoreid %s ", file.getName(), fileMapper.getFileStoreId())); @@ -178,7 +179,7 @@ public FileStoreMapper store(InputStream fileStream, String fileName, String mim headers.setContentType(MediaType.MULTIPART_FORM_DATA); MultiValueMap map = new LinkedMultiValueMap(); map.add("file", new FileSystemResource(f.getName())); - map.add("tenantId", ApplicationThreadLocals.getTenantID()); + map.add("tenantId", ApplicationThreadLocals.getFilestoreTenantID()); map.add("module", moduleName); HttpEntity> request = new HttpEntity>(map, headers); @@ -188,7 +189,51 @@ public FileStoreMapper store(InputStream fileStream, String fileName, String mim if (LOG.isDebugEnabled()) LOG.debug(String.format("Upload completed for %s with filestoreid ", f.getName(), fileMapper.getFileStoreId())); + fileMapper.setTenantId(ApplicationThreadLocals.getFilestoreTenantID()); + fileMapper.setContentType(mimeType); + if (closeStream) + Files.deleteIfExists(Paths.get(fileName)); + return fileMapper; + } catch (RestClientException | IOException e) { + LOG.error("Error while Saving to FileStore", e); + + } + return null; + + } + + @Override + public FileStoreMapper store(InputStream fileStream, String fileName, String mimeType, String moduleName, + String tenantId, boolean closeStream) { + + try { + HttpHeaders headers = new HttpHeaders(); + fileName = normalizeString(fileName); + mimeType = normalizeString(mimeType); + moduleName = normalizeString(moduleName); + File f = new File(fileName); + FileUtils.copyToFile(fileStream, f); + if (closeStream) { + fileStream.close(); + } + if (LOG.isDebugEnabled()) + LOG.debug(String.format("Uploading ..... %s with size %s ", f.getName(), f.length())); + + headers.setContentType(MediaType.MULTIPART_FORM_DATA); + MultiValueMap map = new LinkedMultiValueMap(); + map.add("file", new FileSystemResource(f.getName())); + map.add("tenantId", StringUtils.isEmpty(tenantId) ? ApplicationThreadLocals.getFilestoreTenantID() : tenantId); + map.add("module", moduleName); + HttpEntity> request = new HttpEntity>(map, + headers); + ResponseEntity result = restTemplate.postForEntity(url, request, StorageResponse.class); + FileStoreMapper fileMapper = new FileStoreMapper(result.getBody().getFiles().get(0).getFileStoreId(), + fileName); + if (LOG.isDebugEnabled()) + LOG.debug(String.format("Upload completed for %s with filestoreid ", f.getName(), + fileMapper.getFileStoreId())); + fileMapper.setTenantId(ApplicationThreadLocals.getFilestoreTenantID()); fileMapper.setContentType(mimeType); if (closeStream) Files.deleteIfExists(Paths.get(fileName)); @@ -262,7 +307,7 @@ public File fetch(String fileStoreId, String moduleName) { fileStoreId = normalizeString(fileStoreId); moduleName = normalizeString(moduleName); - String urls = url + "/id?tenantId=" + ApplicationThreadLocals.getTenantID() + "&fileStoreId=" + fileStoreId; + String urls = url + "/id?tenantId=" + ApplicationThreadLocals.getFilestoreTenantID() + "&fileStoreId=" + fileStoreId; if (LOG.isDebugEnabled()) LOG.debug(String.format("fetch file fron url %s ", urls)); @@ -316,7 +361,7 @@ private Path getFilePath(Path fileDirPath, String fileStoreId) { public File fetch(String fileStoreId, String moduleName, String tenantId) { fileStoreId = normalizeString(fileStoreId); moduleName = normalizeString(moduleName); - String tenant = StringUtils.isEmpty(tenantId) ? ApplicationThreadLocals.getTenantID() : tenantId; + String tenant = StringUtils.isEmpty(tenantId) ? ApplicationThreadLocals.getFilestoreTenantID() : tenantId; String urls = url + "/id?tenantId=" + tenant + "&fileStoreId=" + fileStoreId; LOG.info(String.format("fetch file from url %s ", urls)); Path path = Paths.get("/tmp/" + RandomUtils.nextLong()); diff --git a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/filestore/service/impl/LocalDiskFileStoreService.java b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/filestore/service/impl/LocalDiskFileStoreService.java index d7f97d24e96..8e2b30c117e 100644 --- a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/filestore/service/impl/LocalDiskFileStoreService.java +++ b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/filestore/service/impl/LocalDiskFileStoreService.java @@ -48,6 +48,7 @@ package org.egov.infra.filestore.service.impl; +import org.egov.infra.config.core.ApplicationThreadLocals; import org.egov.infra.exception.ApplicationRuntimeException; import org.egov.infra.filestore.entity.FileStoreMapper; import org.egov.infra.filestore.service.FileStoreService; @@ -108,6 +109,7 @@ public FileStoreMapper store(File file, String fileName, String mimeType, String Path newFilePath = this.createNewFilePath(fileMapper, moduleName); Files.copy(file.toPath(), newFilePath); fileMapper.setContentType(mimeType); + fileMapper.setTenantId(ApplicationThreadLocals.getFilestoreTenantID()); if (deleteFile && file.delete()) LOG.info("File store source file deleted"); return fileMapper; @@ -133,6 +135,7 @@ private FileStoreMapper storeCommon(InputStream fileStream, String fileName, Str Path newFilePath = this.createNewFilePath(fileMapper, moduleName); Files.copy(fileStream, newFilePath); fileMapper.setContentType(mimeType); + fileMapper.setTenantId(ApplicationThreadLocals.getFilestoreTenantID()); if (closeStream) fileStream.close(); return fileMapper; diff --git a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/web/filter/ApplicationCoreFilter.java b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/web/filter/ApplicationCoreFilter.java index 0aee164aa09..ed8706c851f 100644 --- a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/web/filter/ApplicationCoreFilter.java +++ b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/web/filter/ApplicationCoreFilter.java @@ -97,14 +97,17 @@ public class ApplicationCoreFilter implements Filter { private String cdnURL; @Resource(name = "cities") - private transient List cities; + private List cities; @Value("${client.id}") private String clientId; @Value("${app.version}_${app.build.no}") private String applicationRelease; - + + @Value("${is.environment.central.instance}") + private String isEnvironmentCentralInstance; + private static final Logger LOG = LoggerFactory.getLogger(ApplicationCoreFilter.class); @Override @@ -124,7 +127,23 @@ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain private void prepareRestService(HttpServletRequest req, HttpSession session) { String requestURL = new StringBuilder().append(ApplicationThreadLocals.getDomainURL()) .append(req.getRequestURI()).toString(); - if (requestURL.contains(ApplicationTenantResolverFilter.tenants.get("state")) + String fullTenant = req.getParameter("tenantId"); + + String[] tenantArr = fullTenant == null ? new String[0] : fullTenant.split("\\."); + String stateName; + if(Boolean.TRUE.equals(Boolean.valueOf(isEnvironmentCentralInstance))) { + if (tenantArr.length == 3 || tenantArr.length == 2) { + ApplicationThreadLocals.setStateName(tenantArr[1]); + stateName = tenantArr[1]; + } else { + if(tenantArr.length == 1) + ApplicationThreadLocals.setStateName(tenantArr[0]); + stateName = "state"; + } + } else { + stateName = "state"; + } + if (requestURL.contains(ApplicationTenantResolverFilter.tenants.get(stateName)) && (requestURL.contains("/rest/") || requestURL.contains("/oauth/"))) { prepareThreadLocal(ApplicationThreadLocals.getTenantID()); @@ -151,9 +170,17 @@ private void prepareUserSession(HttpSession session) { } private void prepareApplicationThreadLocal(HttpSession session) { - + String stateName; + String cityName; + if(Boolean.valueOf(isEnvironmentCentralInstance)) { + stateName = ApplicationThreadLocals.getStateName(); + cityName = ApplicationThreadLocals.getCityName(); + } else { + stateName = clientId; + cityName = (String) session.getAttribute(CITY_NAME_KEY); + } ApplicationThreadLocals.setCityCode((String) session.getAttribute(CITY_CODE_KEY)); - ApplicationThreadLocals.setCityName((String) session.getAttribute(CITY_NAME_KEY)); + ApplicationThreadLocals.setCityName(cityName); ApplicationThreadLocals.setCityNameLocal((String) session.getAttribute(CITY_LOCAL_NAME_KEY)); ApplicationThreadLocals.setMunicipalityName((String) session.getAttribute(CITY_CORP_NAME_KEY)); ApplicationThreadLocals.setUserId((Long) session.getAttribute(USERID_KEY)); @@ -162,7 +189,7 @@ private void prepareApplicationThreadLocal(HttpSession session) { if (city != null) { ApplicationThreadLocals.setDistrictCode(city.getDistrictCode()); ApplicationThreadLocals.setDistrictName(city.getDistrictName()); - ApplicationThreadLocals.setStateName(clientId); + ApplicationThreadLocals.setStateName(stateName); ApplicationThreadLocals.setGrade(city.getGrade()); } } @@ -176,11 +203,20 @@ private void prepareThreadLocal(String tenant) { // TODO: get the city by tenant City city = this.cityService.findAll().get(0); if (city != null) { + String stateName; + String cityName; + if(Boolean.TRUE.equals(Boolean.valueOf(isEnvironmentCentralInstance))) { + stateName = ApplicationThreadLocals.getStateName(); + cityName = ApplicationThreadLocals.getCityName(); + } else { + stateName = clientId; + cityName = city.getName(); + } ApplicationThreadLocals.setCityCode(city.getCode()); - ApplicationThreadLocals.setCityName(city.getName()); + ApplicationThreadLocals.setCityName(cityName); ApplicationThreadLocals.setDistrictCode(city.getDistrictCode()); ApplicationThreadLocals.setDistrictName(city.getDistrictName()); - ApplicationThreadLocals.setStateName(clientId); + ApplicationThreadLocals.setStateName(stateName); ApplicationThreadLocals.setGrade(city.getGrade()); ApplicationThreadLocals.setDomainName(city.getDomainURL()); // ApplicationThreadLocals.setDomainURL("https://"+city.getDomainURL()); @@ -203,4 +239,4 @@ public void destroy() { public void init(FilterConfig filterConfig) throws ServletException { // Nothing to be initialized } -} +} \ No newline at end of file diff --git a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/web/filter/ApplicationTenantResolverFilter.java b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/web/filter/ApplicationTenantResolverFilter.java index badd61f7b76..48deeb66a37 100644 --- a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/web/filter/ApplicationTenantResolverFilter.java +++ b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/web/filter/ApplicationTenantResolverFilter.java @@ -110,15 +110,19 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha HttpServletRequest req = (HttpServletRequest) request; MultiReadRequestWrapper customRequest = new MultiReadRequestWrapper(req); HttpSession session = customRequest.getSession(); - LOG.info("Request URL-->" + customRequest.getRequestURL()); - LOG.info("Request URI-->" + customRequest.getRequestURI()); - String domainURL = extractRequestDomainURL(customRequest, false); - String domainName = extractRequestedDomainName(customRequest); + LOG.info("Request URL--> {}", customRequest.getRequestURL()); + LOG.info("Request URI--> {}", customRequest.getRequestURI()); + boolean isEnvironmentCentralInstance = environmentSettings.getProperty("is.environment.central.instance", Boolean.class); + String commonDomainName = environmentSettings.getProperty("common.domain.name"); + LOG.info("####isEnvironmentCentralInstance--> {} #### domain name-->> {}", isEnvironmentCentralInstance, commonDomainName); + String domainURL = extractRequestDomainURL(customRequest, false, isEnvironmentCentralInstance, commonDomainName); + LOG.info("domainURL-->>>>>>" + domainURL); + String domainName = extractRequestedDomainName(customRequest, isEnvironmentCentralInstance, commonDomainName); ApplicationThreadLocals.setTenantID(environmentSettings.schemaName(domainName)); ApplicationThreadLocals.setDomainName(domainName); ApplicationThreadLocals.setDomainURL(domainURL); prepareRestService(customRequest, session); - LOG.info("***Tenant ID-->" + ApplicationThreadLocals.getTenantID()); + LOG.info("***Tenant ID--> {}", ApplicationThreadLocals.getTenantID()); chain.doFilter(customRequest, response); } @@ -133,6 +137,8 @@ public void destroy() { } private void prepareRestService(MultiReadRequestWrapper customRequest, HttpSession session) { + + boolean isEnvironmentCentralInstance = environmentSettings.getProperty("is.environment.central.instance", Boolean.class); if (tenants == null || tenants.isEmpty()) { tenants = tenantUtils.tenantsMap(); } @@ -141,25 +147,86 @@ private void prepareRestService(MultiReadRequestWrapper customRequest, HttpSessi // LOG.info("***********Enter to set tenant id and custom header**************" + req.getRequestURL().toString()); String requestURL = new StringBuilder().append(ApplicationThreadLocals.getDomainURL()) .append(customRequest.getRequestURI()).toString(); - if (requestURL.contains(tenants.get("state")) + LOG.debug("All tenants from config" + tenants); + LOG.info("tenants.get(state))" + tenants.get("state")); + LOG.info("Inside method to set tenant id and custom header"); + String tenantFromBody = StringUtils.EMPTY; + tenantFromBody = setCustomHeader(requestURL, tenantFromBody, customRequest); + LOG.info("Tenant from Body***" + tenantFromBody); + String fullTenant = customRequest.getParameter("tenantId"); + LOG.info("fullTenant***" + fullTenant); + if (StringUtils.isBlank(fullTenant)) { + fullTenant = tenantFromBody; + } + String[] tenantArr = fullTenant.split("\\."); + String stateName; + if(isEnvironmentCentralInstance) { + if (tenantArr.length == 3 || tenantArr.length == 2) { + ApplicationThreadLocals.setStateName(tenantArr[1]); + stateName = tenantArr[1]; + } else { + ApplicationThreadLocals.setStateName(tenantArr[0]); + stateName = "state"; + } + } else { + stateName = "state"; + } + LOG.info("stateName***" + stateName +"---->>>>"+requestURL); + LOG.info("tenants.get(stateName)***" + tenants.get(stateName)); + if (requestURL.contains(tenants.get(stateName)) && (requestURL.contains("/edcr/") && (requestURL.contains("/rest/") || requestURL.contains("/oauth/")))) { - - LOG.debug("All tenants from config" + tenants); - LOG.info("tenants.get(state))" + tenants.get("state")); - LOG.info("Inside method to set tenant id and custom header"); - String tenantFromBody = StringUtils.EMPTY; - tenantFromBody = setCustomHeader(requestURL, tenantFromBody, customRequest); - LOG.info("Tenant from Body***" + tenantFromBody); - String fullTenant = customRequest.getParameter("tenantId"); - LOG.info("fullTenant***" + fullTenant); - if (StringUtils.isBlank(fullTenant)) { - fullTenant = tenantFromBody; - } if (StringUtils.isBlank(fullTenant)) { throw new ApplicationRestException("incorrect_request", "RestUrl does not contain tenantId: " + fullTenant); } - String tenant = fullTenant.substring(fullTenant.lastIndexOf('.') + 1, fullTenant.length()); + ApplicationThreadLocals.setFullTenantID(fullTenant); + String tenant; + if(isEnvironmentCentralInstance) { + LOG.info("tenantArr.length---->>>>>>>>"+tenantArr.length); + LOG.info("tenantArr-1**---->>>>>>>>"+tenantArr[1]); + if (tenantArr.length == 3) { + tenant = tenantArr[1]; + ApplicationThreadLocals.setStateName(stateName); + ApplicationThreadLocals.setCityName(tenantArr[2]); + ApplicationThreadLocals.setFilestoreTenantID(fullTenant); + /* To support backward compatibility of rule processing, + * some dummy value is setting for district name, citycode and ULB grade + */ + ApplicationThreadLocals.setCityCode(tenantArr[2]); + ApplicationThreadLocals.setDistrictName(tenantArr[2]); + ApplicationThreadLocals.setGrade(tenantArr[2]); + } else if (tenantArr.length == 2) { + tenant = tenantArr[1]; + ApplicationThreadLocals.setCityName(tenant); + ApplicationThreadLocals.setCityCode(tenant); + ApplicationThreadLocals.setDistrictName(tenant); + ApplicationThreadLocals.setGrade(tenant); + ApplicationThreadLocals.setFilestoreTenantID(tenant); + } else { + tenant = tenantArr[0]; + ApplicationThreadLocals.setFilestoreTenantID(tenant); + } + } else { + if (tenantArr.length == 3) { + tenant = tenantArr[1]; + ApplicationThreadLocals.setStateName(stateName); + ApplicationThreadLocals.setCityName(tenantArr[2]); + ApplicationThreadLocals.setFilestoreTenantID(fullTenant); + /* To support backward compatibility of rule processing, + * some dummy value is setting for district name, citycode and ULB grade + */ + ApplicationThreadLocals.setCityCode(tenantArr[2]); + ApplicationThreadLocals.setDistrictName(tenantArr[2]); + ApplicationThreadLocals.setGrade(tenantArr[2]); + } else if (tenantArr.length == 2) { + tenant = tenantArr[1]; + ApplicationThreadLocals.setFilestoreTenantID(tenant); + } else { + tenant = tenantArr[0]; + ApplicationThreadLocals.setFilestoreTenantID(tenant); + } + } + LOG.info("tenant***" + tenant); LOG.info("tenant from rest request =" + tenant); LOG.info("City Code from session " + (String) session.getAttribute(CITY_CODE_KEY)); @@ -168,7 +235,7 @@ private void prepareRestService(MultiReadRequestWrapper customRequest, HttpSessi if (tenant.equalsIgnoreCase("generic") || tenant.equalsIgnoreCase("state")) { ApplicationThreadLocals.setTenantID(tenant); found = true; - } else if (tenant.equalsIgnoreCase(stateCity.getCode())) { + } else if (stateCity != null && tenant.equalsIgnoreCase(stateCity.getCode())) { ApplicationThreadLocals.setTenantID("state"); found = true; } else { @@ -262,4 +329,4 @@ private String setCustomHeader(String requestURL, String tenantAtBody, return tenantAtBody; } -} +} \ No newline at end of file diff --git a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/web/utils/WebUtils.java b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/web/utils/WebUtils.java index 453ee5a9206..5ff29390b1e 100644 --- a/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/web/utils/WebUtils.java +++ b/edcr/service/egov/egov-egi/src/main/java/org/egov/infra/web/utils/WebUtils.java @@ -68,7 +68,7 @@ public final class WebUtils { private static final char QUESTION_MARK = '?'; private static final char FORWARD_SLASH = '/'; private static final String SCHEME_DOMAIN_SEPARATOR = "://"; - private static final String EDCR_SERVICE_INTERNAL_URL = "egov-edcr.egov"; + private static final String EDCR_SERVICE_INTERNAL_URL = "egov-edcr."; private static final Logger LOG = LoggerFactory.getLogger(WebUtils.class); @@ -80,15 +80,19 @@ private WebUtils() { * This will return only domain name from http request
* eg: http://www.domain.com/cxt/xyz will return www.domain.com http://somehost:8090/cxt/xyz will return somehost **/ - public static String extractRequestedDomainName(HttpServletRequest httpRequest) { + public static String extractRequestedDomainName(HttpServletRequest httpRequest, boolean isCentralInstance, String commonDomainName) { String requestURL = httpRequest.getRequestURL().toString(); String domainName = getDomainName(requestURL); if (domainName.contains(EDCR_SERVICE_INTERNAL_URL)) { - String host = httpRequest.getHeader("x-forwarded-host"); - if (StringUtils.isNotBlank(host)) { - domainName = host.toString().split(",")[0]; - LOG.info("*****Domain Name*****" + domainName); + if(isCentralInstance) { + domainName = commonDomainName; + } else { + String host = httpRequest.getHeader("x-forwarded-host"); + if (StringUtils.isNotBlank(host)) { + domainName = host.split(",")[0]; + } } + LOG.info("*****Domain Name***** {}", domainName); } return domainName; } @@ -98,8 +102,7 @@ public static String extractRequestedDomainName(HttpServletRequest httpRequest) * eg: http://www.domain.com/cxt/xyz will return www.domain.com http://somehost:8090/cxt/xyz will return somehost **/ public static String extractRequestedDomainName(String requestURL) { - String domainName = getDomainName(requestURL); - return domainName; + return getDomainName(requestURL); } private static String getDomainName(String requestURL) { @@ -117,18 +120,23 @@ private static String getDomainName(String requestURL) { * http://www.domain.com/cxt/xyz withContext value as true will return http://www.domain.com/cxt/
* http://www.domain.com/cxt/xyz withContext value as false will return http://www.domain.com **/ - public static String extractRequestDomainURL(HttpServletRequest httpRequest, boolean withContext) { + public static String extractRequestDomainURL(HttpServletRequest httpRequest, boolean withContext, boolean isCentralInstance, String domainName) { StringBuilder url = new StringBuilder(httpRequest.getRequestURL()); String domainURL = ""; String protocol = httpRequest.getHeader("x-forwarded-proto"); String host = httpRequest.getHeader("x-forwarded-host"); + LOG.info("*****protocol Name***** {}", protocol); if (getDomainName(url.toString()).contains(EDCR_SERVICE_INTERNAL_URL)) { - if (StringUtils.isNotBlank(protocol) && StringUtils.isNotBlank(host)) { - String proto = protocol.toString().split(",")[0]; - String hostName = host.toString().split(",")[0]; - domainURL = new StringBuilder().append(proto).append(SCHEME_DOMAIN_SEPARATOR).append(hostName).toString(); - LOG.info("Domain URL*******" + domainURL); + String proto = "https"; + if(protocol != null) + proto = protocol.split(",")[0]; + String hostName = host.split(",")[0]; + if(isCentralInstance) { + proto = "https"; + hostName = domainName; } + domainURL = new StringBuilder().append(proto).append(SCHEME_DOMAIN_SEPARATOR).append(hostName).toString(); + LOG.info("Domain URL******* {}", domainURL); } else { String uri = httpRequest.getRequestURI(); domainURL = withContext diff --git a/edcr/service/egov/egov-egi/src/main/resources/config/application-config.properties b/edcr/service/egov/egov-egi/src/main/resources/config/application-config.properties index e31243ba620..1b543a60082 100644 --- a/edcr/service/egov/egov-egi/src/main/resources/config/application-config.properties +++ b/edcr/service/egov/egov-egi/src/main/resources/config/application-config.properties @@ -335,3 +335,5 @@ egov.edcr.max.limit=800 egov.services.egov-indexer.url=egov-indexer/index-operations/{edcr-create-application}/_index indexer.host=https://dev.digit.org/ edcr.indexer.data.push.required=false + +is.environment.central.instance=false diff --git a/edcr/service/egov/egov-egi/src/main/resources/db/migration/main/V20211129125021__egi_add_column_tenantid_ddl.sql b/edcr/service/egov/egov-egi/src/main/resources/db/migration/main/V20211129125021__egi_add_column_tenantid_ddl.sql new file mode 100644 index 00000000000..dbc8d4b9951 --- /dev/null +++ b/edcr/service/egov/egov-egi/src/main/resources/db/migration/main/V20211129125021__egi_add_column_tenantid_ddl.sql @@ -0,0 +1 @@ +alter table eg_filestoremap add column tenantId character varying(64); \ No newline at end of file diff --git a/edcr/service/egov/egov-egiweb/pom.xml b/edcr/service/egov/egov-egiweb/pom.xml index 74dc466a18d..f5bc6101d2e 100644 --- a/edcr/service/egov/egov-egiweb/pom.xml +++ b/edcr/service/egov/egov-egiweb/pom.xml @@ -53,7 +53,7 @@ egov-erp org.egov.edcr - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT e-governments egi web @@ -64,13 +64,13 @@ org.egov.edcr egov-egi - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT org.egov.edcr egov-config - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT tests test diff --git a/edcr/service/egov/pom.xml b/edcr/service/egov/pom.xml index be4a5102f5a..10084136ba2 100644 --- a/edcr/service/egov/pom.xml +++ b/edcr/service/egov/pom.xml @@ -6,7 +6,7 @@ org.egov.edcr egov-erp - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT pom @@ -207,7 +207,7 @@ org.egov.edcr egov-egi - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT commons-logging @@ -218,12 +218,12 @@ org.egov.edcr egov-config - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT org.egov.edcr egov-commons - 2.1.1-SNAPSHOT + 2.1.2-SNAPSHOT diff --git a/municipal-services/birth-death-services/CHANGELOG.md b/municipal-services/birth-death-services/CHANGELOG.md index 06144d509a7..39060bc2f77 100644 --- a/municipal-services/birth-death-services/CHANGELOG.md +++ b/municipal-services/birth-death-services/CHANGELOG.md @@ -2,6 +2,10 @@ # Changelog All notable changes to this module will be documented in this file. +## 1.0.2 - 2023-08-10 + +- Central Instance Library Integration + ## 1.0.1 - 2023-02-01 - Transition from 1.0.1-beta version to 1.0.1 version diff --git a/municipal-services/birth-death-services/pom.xml b/municipal-services/birth-death-services/pom.xml index d765ab542ee..81ec800de4b 100644 --- a/municipal-services/birth-death-services/pom.xml +++ b/municipal-services/birth-death-services/pom.xml @@ -7,7 +7,7 @@ org.egov birth-death-services - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT birth-death-services 1.8 @@ -42,12 +42,13 @@ org.egov.services tracer - 2.0.0-SNAPSHOT + 2.1.0-SNAPSHOT org.egov.services services-common - 1.0.1-SNAPSHOT + 1.1.1-SNAPSHOT + compile org.projectlombok @@ -62,7 +63,7 @@ org.egov mdms-client - 0.0.2-SNAPSHOT + 0.0.4-SNAPSHOT org.egov diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/BirthDeathApplication.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/BirthDeathApplication.java index 595178924b5..8c43574861c 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/BirthDeathApplication.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/BirthDeathApplication.java @@ -4,6 +4,7 @@ import javax.annotation.PostConstruct; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.encryption.config.EncryptionConfiguration; import org.egov.tracer.config.TracerConfiguration; import org.springframework.beans.factory.annotation.Value; @@ -21,7 +22,7 @@ @SpringBootApplication(scanBasePackages = "org.bel.birthdeath" ) @EnableAutoConfiguration //@Import({TracerConfiguration.class}) -@Import({TracerConfiguration.class,EncryptionConfiguration.class}) +@Import({TracerConfiguration.class,EncryptionConfiguration.class, MultiStateInstanceUtil.class}) public class BirthDeathApplication { @Value("${app.timezone}") diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/controller/BirthController.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/controller/BirthController.java index a4f9353db9d..e7baee7047d 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/controller/BirthController.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/controller/BirthController.java @@ -109,7 +109,7 @@ public ResponseEntity getfilestoreid(@RequestBody RequestInfo @PostMapping(value = { "/_searchapplications"}) public ResponseEntity searchApplications(@RequestBody RequestInfoWrapper requestInfoWrapper, @ModelAttribute SearchCriteria criteria ) { - List applications = birthService.searchApplications(requestInfoWrapper); + List applications = birthService.searchApplications(requestInfoWrapper,criteria); BirthCertApplnResponse response = BirthCertApplnResponse.builder().applications(applications).responseInfo( responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true)) .build(); diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/repository/BirthRepository.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/repository/BirthRepository.java index 038b0849f33..db2b01f9c3c 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/repository/BirthRepository.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/repository/BirthRepository.java @@ -33,10 +33,13 @@ import org.bel.birthdeath.utils.BirthDeathConstants; import org.bel.birthdeath.utils.CommonUtils; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.exception.InvalidTenantIdException; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.model.CustomException; import org.json.JSONArray; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; @@ -101,11 +104,27 @@ public class BirthRepository { @Value("${egov.bnd.freedownload.tenants}") private String freeDownloadTenants; + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + @Autowired + private ServiceRequestRepository serviceRequestRepository; + + @Autowired + @Qualifier("objectMapperBnd") + private ObjectMapper mapper; public List getBirthDtls(SearchCriteria criteria) { List preparedStmtList = new ArrayList<>(); String query = allqueryBuilder.getBirtDtls(criteria, preparedStmtList); - return jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("BIRTHCERT_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + return jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); } public List getBirthCertificateForPlainSearch(SearchCriteria criteria) { @@ -122,12 +141,18 @@ public List getBirthCertificateForPlainSearch(SearchCriteria c if (criteria.getOffset() != null) offset = criteria.getOffset(); - String query = "SELECT * FROM eg_birth_cert_request OFFSET " + offset + " LIMIT " + limit; + String query = "SELECT * FROM {schema}.eg_birth_cert_request OFFSET " + offset + " LIMIT " + limit; + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("BIRTHCERT_PLAINSEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } List> list = jdbcTemplate.queryForList(query); log.info("Size of list: " + list.size()); for(Map map: list) { BirthCertificate birthCertificate = new BirthCertificate(); - EgBirthDtl birthDtl = getBirthDtlById((String) map.get("birthdtlid")); + EgBirthDtl birthDtl = getBirthDtlById((String) map.get("birthdtlid"),criteria.getTenantId()); birthCertificate.setId((String) map.get("id")); birthCertificate.setBirthCertificateNo((String) map.get("birthcertificateno")); @@ -160,13 +185,19 @@ public List getBirthCertificateForPlainSearch(SearchCriteria c return birthCertificates; } - public EgBirthDtl getBirthDtlById(String id) { - String birthDtlQuery = "SELECT * FROM eg_birth_dtls WHERE id = ?"; + public EgBirthDtl getBirthDtlById(String id, String tenantId) { + String birthDtlQuery = "SELECT * FROM {schema}.eg_birth_dtls WHERE id = ?"; + try { + birthDtlQuery = centralInstanceUtil.replaceSchemaPlaceholder(birthDtlQuery, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("BIRTHCERT_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } return (EgBirthDtl) jdbcTemplate.queryForObject(birthDtlQuery, new Object[]{id}, new BeanPropertyRowMapper(EgBirthDtl.class)); } public void save(BirthCertRequest birthCertRequest) { - bndProducer.push(config.getSaveBirthTopic(), birthCertRequest); + bndProducer.push(birthCertRequest.getBirthCertificate().getTenantId(), config.getSaveBirthTopic(), birthCertRequest); } public EgovPdfResp saveBirthCertPdf(BirthPdfApplicationRequest pdfApplicationRequest) { @@ -191,17 +222,24 @@ public EgovPdfResp saveBirthCertPdf(BirthPdfApplicationRequest pdfApplicationReq pdfApplicationRequest.getBirthCertificate().forEach(cert-> { String uiHost = config.getEgovPdfHost(); String birthCertPath = config.getEgovPdfBirthEndPoint(); - String tenantId = cert.getTenantid().split("\\.")[0]; + /*String tenantId = cert.getTenantid().split("\\.")[0];*/ + String tenantId = centralInstanceUtil.getStateLevelTenant(cert.getTenantid()); birthCertPath = birthCertPath.replace("$tenantId",tenantId); String pdfFinalPath = uiHost + birthCertPath; - EgovPdfResp response = restTemplate.postForObject(pdfFinalPath, req, EgovPdfResp.class); + + Object responseObject = serviceRequestRepository.fetchResult(new StringBuilder(pdfFinalPath), req); + EgovPdfResp response = mapper.convertValue(responseObject, EgovPdfResp.class); if (response != null && CollectionUtils.isEmpty(response.getFilestoreIds())) { throw new CustomException("EMPTY_FILESTORE_IDS_FROM_PDF_SERVICE", "No file store id found from pdf service"); } result.setFilestoreIds(response.getFilestoreIds()); }); - }catch(Exception e) { + } + catch (IllegalArgumentException e) { + throw new CustomException("PARSING ERROR","Failed to parse response of Filestore Service"); + } + catch(Exception e) { e.printStackTrace(); throw new CustomException("PDF_ERROR","Error in generating PDF"); } @@ -211,6 +249,12 @@ public EgovPdfResp saveBirthCertPdf(BirthPdfApplicationRequest pdfApplicationReq public List getBirthDtlsAll(SearchCriteria criteria ,RequestInfo requestInfo) { List preparedStmtList = new ArrayList<>(); String query = allqueryBuilder.getBirtDtlsAll(criteria, preparedStmtList); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("BIRTHCERT_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } List birthDtls = jdbcTemplate.query(query, preparedStmtList.toArray(), allRowMapper); if(birthDtls != null) { birthDtls.forEach(birthDtl -> { @@ -222,11 +266,17 @@ public List getBirthDtlsAll(SearchCriteria criteria ,RequestInfo req return birthDtls; } - public BirthCertificate getBirthCertReqByConsumerCode(String consumerCode, RequestInfo requestInfo) { + public BirthCertificate getBirthCertReqByConsumerCode(String consumerCode, RequestInfo requestInfo, String tenantId) { try { List preparedStmtList = new ArrayList<>(); SearchCriteria criteria = new SearchCriteria(); String query = allqueryBuilder.getBirthCertReq(consumerCode,requestInfo,preparedStmtList); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("BIRTHCERT_SEARCH_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } List birthCerts = jdbcTemplate.query(query, preparedStmtList.toArray(), birthCertRowMapper); if(null!=birthCerts && !birthCerts.isEmpty()) { criteria.setTenantId(birthCerts.get(0).getTenantId()); @@ -249,12 +299,19 @@ public BirthCertificate getBirthCertReqByConsumerCode(String consumerCode, Reque return null; } - public void updateCounter(String birthDtlId) { + public void updateCounter(String birthDtlId,String tenantId) { try { - String updateQry="UPDATE public.eg_birth_dtls SET counter=counter+1 WHERE id=:id and tenantid not in (:tenantIds)"; + String updateQry="UPDATE {schema}.eg_birth_dtls SET counter=counter+1 WHERE id=:id and tenantid not in (:tenantIds)"; Map params = new HashMap<>(); params.put("id", birthDtlId); params.put("tenantIds",Arrays.asList(freeDownloadTenants.split(","))); + try { + //TODO: Update is being called here. need to check with kavi if we need to call here to + updateQry = centralInstanceUtil.replaceSchemaPlaceholder(updateQry, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("BIRTHCERT_UPDATE_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } namedParameterJdbcTemplate.update(updateQry ,params); }catch(Exception e) { e.printStackTrace(); @@ -263,11 +320,18 @@ public void updateCounter(String birthDtlId) { } - public List searchApplications( String uuid) { + public List searchApplications( String uuid, String tenantId) { List birthCertAppls = new ArrayList<>(); try { List preparedStmtList = new ArrayList<>(); String applQuery=allqueryBuilder.searchApplications(uuid, preparedStmtList); + try { + //TODO: No tenantId , hence passing empty id check with kavi + applQuery = centralInstanceUtil.replaceSchemaPlaceholder(applQuery, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("BIRTHCERT_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } birthCertAppls = jdbcTemplate.query(applQuery, preparedStmtList.toArray(), certApplnRowMapper); } catch(Exception e) { @@ -279,7 +343,7 @@ public List searchApplications( String uuid) { } public void update(BirthCertRequest certRequest) { - bndProducer.push(config.getUpdateBirthTopic(), certRequest); + bndProducer.push(certRequest.getBirthCertificate().getTenantId(), config.getUpdateBirthTopic(), certRequest); } public String getShortenedUrl(String url){ @@ -287,7 +351,14 @@ public String getShortenedUrl(String url){ body.put("url",url); StringBuilder builder = new StringBuilder(config.getUrlShortnerHost()); builder.append(config.getUrlShortnerEndpoint()); - String res = restTemplate.postForObject(builder.toString(), body, String.class); + + String res = null; + try { + res = restTemplate.postForObject(builder.toString(), body, String.class); + } catch (IllegalArgumentException e) { + throw new CustomException("PARSING ERROR", "Failed to parse response of URL Shortening"); + } + if(StringUtils.isEmpty(res)){ log.error("URL_SHORTENING_ERROR","Unable to shorten url: "+url); return url; @@ -297,7 +368,7 @@ public String getShortenedUrl(String url){ public List viewCertificateData(SearchCriteria criteria) { List certData = new ArrayList<>(); - BirthCertificate certificate = getBirthCertReqByConsumerCode(criteria.getBirthcertificateno(),null); + BirthCertificate certificate = getBirthCertReqByConsumerCode(criteria.getBirthcertificateno(),null,criteria.getTenantId()); criteria.setId(certificate.getBirthDtlId()); certData = getBirthDtlsAll(criteria,null); certData.get(0).setDateofissue(certificate.getDateofissue()); @@ -307,6 +378,12 @@ public List viewCertificateData(SearchCriteria criteria) { public List viewfullCertMasterData(SearchCriteria criteria,RequestInfo requestInfo) { List preparedStmtList = new ArrayList<>(); String query = allqueryBuilder.getBirthCertMasterDtl(criteria, preparedStmtList); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("BIRTHCERT_SEARCH_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } List birthCertMasterDtl = jdbcTemplate.query(query, preparedStmtList.toArray(), birthMasterDtlRowMapper); if(birthCertMasterDtl != null) { birthCertMasterDtl.forEach(birthDtl -> { diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/repository/builder/BirthDtlAllQueryBuilder.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/repository/builder/BirthDtlAllQueryBuilder.java index d2ea236d92a..5f3b7786cc4 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/repository/builder/BirthDtlAllQueryBuilder.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/repository/builder/BirthDtlAllQueryBuilder.java @@ -24,7 +24,7 @@ public class BirthDtlAllQueryBuilder { private static String QUERY_MASTER_FULL_ALL = "SELECT bdtl.id birthdtlid,bfat.id bfatid,bmot.id bmotid,bpmad.id bpmadid,bpsad.id bpsadid," + "bdtl.tenantid tenantid, registrationno, dateofbirth, counter, gender , " + "CASE WHEN gender = '1' THEN 'Male' WHEN gender = '2' THEN 'Female' WHEN gender = '3' THEN 'Others' END AS genderstr ," + - "(select bh.hospitalname from eg_birth_death_hospitals bh where bh.id=hospitalid) AS hospitalname, placeofbirth, dateofreport, remarks," + + "(select bh.hospitalname from {schema}.eg_birth_death_hospitals bh where bh.id=hospitalid) AS hospitalname, placeofbirth, dateofreport, remarks," + "hospitalid , informantsname , informantsaddress , islegacyrecord, " + "bfat.firstname bfatfn ,bmot.firstname bmotfn , bdtl.firstname bdtlfn ," + "bfat.middlename bfatmn ,bmot.middlename bmotmn , bdtl.middlename bdtlmn ," + @@ -40,15 +40,15 @@ public class BirthDtlAllQueryBuilder { "bpmad.district pmdistrict,bpmad.city pmcity ,bpmad.state pmstate,bpmad.pinno pmpinno,bpmad.country pmcountry," + "bpsad.houseno pshouseno,bpsad.buildingno psbuildingno,bpsad.streetname psstreetname,bpsad.locality pslocality,bpsad.tehsil pstehsil," + "bpsad.district psdistrict,bpsad.city pscity ,bpsad.state psstate,bpsad.pinno pspinno,bpsad.country pscountry " + - "FROM public.eg_birth_dtls bdtl " + - "left join eg_birth_father_info bfat on bfat.birthdtlid = bdtl.id " + - "left join eg_birth_mother_info bmot on bmot.birthdtlid = bdtl.id " + - "left join eg_birth_permaddr bpmad on bpmad.birthdtlid = bdtl.id " + - "left join eg_birth_presentaddr bpsad on bpsad.birthdtlid = bdtl.id"; - + "FROM {schema}.eg_birth_dtls bdtl " + + "left join {schema}.eg_birth_father_info bfat on bfat.birthdtlid = bdtl.id " + + "left join {schema}.eg_birth_mother_info bmot on bmot.birthdtlid = bdtl.id " + + "left join {schema}.eg_birth_permaddr bpmad on bpmad.birthdtlid = bdtl.id " + + "left join {schema}.eg_birth_presentaddr bpsad on bpsad.birthdtlid = bdtl.id"; + private static String QUERY_MASTER_ALL = "SELECT bdtl.id birthdtlid, bdtl.tenantid tenantid, registrationno, dateofbirth, counter, gender , " + "CASE WHEN gender = '1' THEN 'Male' WHEN gender = '2' THEN 'Female' WHEN gender = '3' THEN 'Others' END AS genderstr ," - + " (select bh.hospitalname from eg_birth_death_hospitals bh where bh.id=hospitalid) AS hospitalname, placeofbirth, dateofreport, remarks, " + + " (select bh.hospitalname from {schema}.eg_birth_death_hospitals bh where bh.id=hospitalid) AS hospitalname, placeofbirth, dateofreport, remarks, " + "bfat.firstname bfatfn ,bmot.firstname bmotfn , bdtl.firstname bdtlfn ," + "bfat.middlename bfatmn ,bmot.middlename bmotmn , bdtl.middlename bdtlmn ," + "bfat.lastname bfatln ,bmot.lastname bmotln , bdtl.lastname bdtlln ," @@ -57,26 +57,26 @@ public class BirthDtlAllQueryBuilder { + "bpsad.houseno pshouseno,bpsad.buildingno psbuildingno,bpsad.streetname psstreetname,bpsad.locality pslocality,bpsad.tehsil pstehsil," + "bpsad.district psdistrict,bpsad.city pscity ,bpsad.state psstate,bpsad.pinno pspinno,bpsad.country pscountry, " + "bfat.aadharno bfataadharno ,bmot.aadharno bmotaadharno "+ - "FROM public.eg_birth_dtls bdtl " + - "left join eg_birth_father_info bfat on bfat.birthdtlid = bdtl.id " + - "left join eg_birth_mother_info bmot on bmot.birthdtlid = bdtl.id " + - "left join eg_birth_permaddr bpmad on bpmad.birthdtlid = bdtl.id " + - "left join eg_birth_presentaddr bpsad on bpsad.birthdtlid = bdtl.id "; - + "FROM {schema}.eg_birth_dtls bdtl " + + "left join {schema}.eg_birth_father_info bfat on bfat.birthdtlid = bdtl.id " + + "left join {schema}.eg_birth_mother_info bmot on bmot.birthdtlid = bdtl.id " + + "left join {schema}.eg_birth_permaddr bpmad on bpmad.birthdtlid = bdtl.id " + + "left join {schema}.eg_birth_presentaddr bpsad on bpsad.birthdtlid = bdtl.id "; + private static final String QUERY_MASTER = "SELECT bdtl.id birthdtlid, tenantid, registrationno, dateofbirth, counter, gender ,hospitalname, "+ "CASE WHEN gender = '1' THEN 'Male' WHEN gender = '2' THEN 'Female' WHEN gender = '3' THEN 'Others' END AS genderstr ," + - " (select bh.hospitalname from eg_birth_death_hospitals bh where bh.id=hospitalid) AS hospitalname ,"+ + " (select bh.hospitalname from {schema}.eg_birth_death_hospitals bh where bh.id=hospitalid) AS hospitalname ,"+ "bfat.firstname bfatfn ,bmot.firstname bmotfn , bdtl.firstname bdtlfn ,"+ "bfat.middlename bfatmn ,bmot.middlename bmotmn , bdtl.middlename bdtlmn ,"+ "bfat.lastname bfatln ,bmot.lastname bmotln , bdtl.lastname bdtlln "+ - "FROM public.eg_birth_dtls bdtl " + - "left join eg_birth_father_info bfat on bfat.birthdtlid = bdtl.id " + - "left join eg_birth_mother_info bmot on bmot.birthdtlid = bdtl.id " ; + "FROM {schema}.eg_birth_dtls bdtl " + + "left join {schema}.eg_birth_father_info bfat on bfat.birthdtlid = bdtl.id " + + "left join {schema}.eg_birth_mother_info bmot on bmot.birthdtlid = bdtl.id " ; private static String APPLSQUERY ="select breq.birthCertificateNo, breq.createdtime, breq.status, bdtl.registrationno, bdtl.tenantid, " + "concat(COALESCE(bdtl.firstname,'') , ' ', COALESCE(bdtl.middlename,'') ,' ', COALESCE(bdtl.lastname,'')) as name, " + "CASE WHEN breq.lastmodifiedtime/1000 < (extract(epoch from NOW())-?*24*60*60) THEN 'EXPIRED' ELSE breq.filestoreid END as filestoreid " - + "from eg_birth_cert_request breq left join eg_birth_dtls bdtl on bdtl.id=breq.birthDtlId where " + + "from {schema}.eg_birth_cert_request breq left join {schema}.eg_birth_dtls bdtl on bdtl.id=breq.birthDtlId where " + "breq.createdby=? order by breq.createdtime DESC "; private static final String PAGINATIONWRAPPER = "SELECT * FROM " + @@ -95,7 +95,7 @@ private static void addClauseIfRequired(List values, StringBuilder query public String getBirthCertReq(String consumerCode, RequestInfo requestInfo, List preparedStmtList) { - StringBuilder builder = new StringBuilder("select req.*,(select tenantid from eg_birth_dtls dtl where req.birthdtlid=dtl.id) from eg_birth_cert_request req"); + StringBuilder builder = new StringBuilder("select req.*,(select tenantid from {schema}.eg_birth_dtls dtl where req.birthdtlid=dtl.id) from {schema}.eg_birth_cert_request req"); if (consumerCode != null && !consumerCode.isEmpty()) { addClauseIfRequired(preparedStmtList, builder); builder.append(" birthcertificateno=? "); diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/service/BirthService.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/service/BirthService.java index 8e6bc4a4b30..fc80620d711 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/service/BirthService.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/birth/service/BirthService.java @@ -122,7 +122,7 @@ public BirthCertificate download(SearchCriteria criteria, RequestInfo requestInf birthCertificate.setEmbeddedUrl(applicationRequest.getBirthCertificate().get(0).getEmbeddedUrl()); birthCertificate.setDateofissue(applicationRequest.getBirthCertificate().get(0).getDateofissue()); birthCertificate.setFilestoreid(pdfResp.getFilestoreIds().get(0)); - repository.updateCounter(birthCertificate.getBirthDtlId()); + repository.updateCounter(birthCertificate.getBirthDtlId(), birthCertificate.getTenantId()); birthCertificate.setApplicationStatus(StatusEnum.FREE_DOWNLOAD); } @@ -137,17 +137,17 @@ public BirthCertificate download(SearchCriteria criteria, RequestInfo requestInf } public BirthCertificate getBirthCertReqByConsumerCode(SearchCriteria criteria, RequestInfo requestInfo) { - return repository.getBirthCertReqByConsumerCode(criteria.getConsumerCode(),requestInfo); + return repository.getBirthCertReqByConsumerCode(criteria.getConsumerCode(),requestInfo, criteria.getTenantId()); } - public List searchApplications(RequestInfoWrapper requestInfoWrapper) { + public List searchApplications(RequestInfoWrapper requestInfoWrapper, SearchCriteria searchCriteria) { List certApplns = null; - certApplns = repository.searchApplications(requestInfoWrapper.getRequestInfo().getUserInfo().getUuid()); + certApplns = repository.searchApplications(requestInfoWrapper.getRequestInfo().getUserInfo().getUuid(), searchCriteria.getTenantId()); for (BirthCertAppln certAppln : certApplns) { if (certAppln.getStatus().equalsIgnoreCase(StatusEnum.PAID.toString())) { try { BirthCertificate cert = repository.getBirthCertReqByConsumerCode(certAppln.getApplicationNumber(), - requestInfoWrapper.getRequestInfo()); + requestInfoWrapper.getRequestInfo(), certAppln.getTenantId()); String uuid = requestInfoWrapper.getRequestInfo().getUserInfo().getUuid(); AuditDetails auditDetails = commUtils.getAuditDetails(uuid, false); cert.getAuditDetails().setLastModifiedBy(auditDetails.getLastModifiedBy()); diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/consumer/ReceiptConsumer.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/consumer/ReceiptConsumer.java index 8f80202ee10..e7f26a638df 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/consumer/ReceiptConsumer.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/consumer/ReceiptConsumer.java @@ -28,6 +28,7 @@ import org.bel.birthdeath.utils.CommonUtils; import org.egov.common.contract.request.RequestInfo; import org.egov.tracer.model.CustomException; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.kafka.annotation.KafkaListener; @@ -64,8 +65,10 @@ public class ReceiptConsumer { @Autowired private DeathRepository repositoryDeath; - @KafkaListener(topics = {"${kafka.topics.receipt.create}"}) + @KafkaListener(topicPattern = "${kafka.topics.receipt.create.pattern}" ) public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { + + try { process(record); } catch (final Exception e) { @@ -78,6 +81,10 @@ public void process(HashMap record) { try { log.info("Process for object"+ record); PaymentRequest paymentRequest = mapper.convertValue(record, PaymentRequest.class); + + // Adding in MDC so that tracer can add it in header + MDC.put(BirthDeathConstants.TENANTID_MDC_STRING, paymentRequest.getPayment().getTenantId()); + RequestInfo requestInfo = paymentRequest.getRequestInfo(); if( paymentRequest.getPayment().getTotalAmountPaid().compareTo(paymentRequest.getPayment().getTotalDue())!=0) return; @@ -100,7 +107,7 @@ public void process(HashMap record) { public DeathCertificate updateDeathPAID(RequestInfo requestInfo, PaymentDetail paymentDetail) { try { - DeathCertificate deathCertificate = repositoryDeath.getDeathCertReqByConsumerCode(paymentDetail.getBill().getConsumerCode(),requestInfo); + DeathCertificate deathCertificate = repositoryDeath.getDeathCertReqByConsumerCode(paymentDetail.getBill().getConsumerCode(), requestInfo, paymentDetail.getTenantId()); if(deathCertificate.getApplicationStatus().equals(org.bel.birthdeath.death.certmodel.DeathCertificate.StatusEnum.ACTIVE)) { String uuid = requestInfo.getUserInfo().getUuid(); AuditDetails auditDetails = commUtils.getAuditDetails(uuid, false); @@ -109,7 +116,7 @@ public DeathCertificate updateDeathPAID(RequestInfo requestInfo, PaymentDetail p deathCertificate.setApplicationStatus(org.bel.birthdeath.death.certmodel.DeathCertificate.StatusEnum.PAID); deathCertificate.setDeathCertificateNo(paymentDetail.getBill().getConsumerCode()); DeathCertRequest request = DeathCertRequest.builder().requestInfo(requestInfo).deathCertificate(deathCertificate).build(); - bndProducer.push(config.getUpdateDeathTopic(), request); + bndProducer.push(request.getDeathCertificate().getTenantId(), config.getUpdateDeathTopic(), request); } return deathCertificate; } @@ -136,8 +143,8 @@ public DeathCertificate updateDeathPDFGEN(RequestInfo requestInfo, DeathCertific } deathCertificate.setApplicationStatus(org.bel.birthdeath.death.certmodel.DeathCertificate.StatusEnum.PAID_PDF_GENERATED); DeathCertRequest requestNew = DeathCertRequest.builder().requestInfo(requestInfo).deathCertificate(deathCertificate).build(); - bndProducer.push(config.getUpdateDeathTopic(), requestNew); - repositoryDeath.updateCounter(deathCertificate.getDeathDtlId()); + bndProducer.push(requestNew.getDeathCertificate().getTenantId(), config.getUpdateDeathTopic(), requestNew); + repositoryDeath.updateCounter(deathCertificate.getDeathDtlId(), deathCertificate.getTenantId()); } return deathCertificate; } @@ -149,7 +156,7 @@ public DeathCertificate updateDeathPDFGEN(RequestInfo requestInfo, DeathCertific public BirthCertificate updateBirthPAID(RequestInfo requestInfo, PaymentDetail paymentDetail) { try { - BirthCertificate birthCertificate = repository.getBirthCertReqByConsumerCode(paymentDetail.getBill().getConsumerCode(),requestInfo); + BirthCertificate birthCertificate = repository.getBirthCertReqByConsumerCode(paymentDetail.getBill().getConsumerCode(),requestInfo,paymentDetail.getTenantId()); if(birthCertificate.getApplicationStatus().equals(StatusEnum.ACTIVE)) { String uuid = requestInfo.getUserInfo().getUuid(); AuditDetails auditDetails = commUtils.getAuditDetails(uuid, false); @@ -158,7 +165,7 @@ public BirthCertificate updateBirthPAID(RequestInfo requestInfo, PaymentDetail p birthCertificate.setApplicationStatus(StatusEnum.PAID); birthCertificate.setBirthCertificateNo(paymentDetail.getBill().getConsumerCode()); BirthCertRequest request = BirthCertRequest.builder().requestInfo(requestInfo).birthCertificate(birthCertificate).build(); - bndProducer.push(config.getUpdateBirthTopic(), request); + bndProducer.push(request.getBirthCertificate().getTenantId(), config.getUpdateBirthTopic(), request); } return birthCertificate; } @@ -185,8 +192,8 @@ public BirthCertificate updateBirthPDFGEN(RequestInfo requestInfo, BirthCertifi } birthCertificate.setApplicationStatus(StatusEnum.PAID_PDF_GENERATED); BirthCertRequest requestNew = BirthCertRequest.builder().requestInfo(requestInfo).birthCertificate(birthCertificate).build(); - bndProducer.push(config.getUpdateBirthTopic(), requestNew); - repository.updateCounter(birthCertificate.getBirthDtlId()); + bndProducer.push(requestNew.getBirthCertificate().getTenantId(), config.getUpdateBirthTopic(), requestNew); + repository.updateCounter(birthCertificate.getBirthDtlId(), birthCertificate.getTenantId()); } return birthCertificate; } diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/producer/BndProducer.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/producer/BndProducer.java index 7f83626470b..6cb02c78876 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/producer/BndProducer.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/producer/BndProducer.java @@ -1,16 +1,24 @@ package org.bel.birthdeath.common.producer; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.kafka.CustomKafkaTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service +@Slf4j public class BndProducer { @Autowired private CustomKafkaTemplate kafkaTemplate; - public void push(String topic, Object value) { - kafkaTemplate.send(topic, value); + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + public void push(String tenantId, String topic, Object value) { + String updatedTopic = centralInstanceUtil.getStateSpecificTopicName(tenantId, topic); + log.info("The Kafka topic for the tenantId : " + tenantId + " is : " + updatedTopic); + kafkaTemplate.send(updatedTopic, value); } } diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/CommonRepository.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/CommonRepository.java index b379a44d554..938f4679b9c 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/CommonRepository.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/CommonRepository.java @@ -36,6 +36,8 @@ import org.bel.birthdeath.utils.BirthDeathConstants; import org.bel.birthdeath.utils.CommonUtils; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.exception.InvalidTenantIdException; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; @@ -76,116 +78,119 @@ public class CommonRepository { @Autowired EncryptionDecryptionUtil encryptionDecryptionUtil; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + @Autowired @Lazy public CommonRepository(CommonService commonService) { this.commonService = commonService; } - private static final String BIRTHDTLDELETEQRY="Delete from eg_birth_dtls where tenantid = :tenantid and registrationno = :registrationno; "; - - private static final String DEATHDTLDELETEQRY="Delete from eg_death_dtls where tenantid = :tenantid and registrationno = :registrationno; "; - - private static final String BIRTHDTLSAVEQRY="INSERT INTO public.eg_birth_dtls(id, registrationno, hospitalname, dateofreport, " + private static final String BIRTHDTLDELETEQRY="Delete from {schema}.eg_birth_dtls where tenantid = :tenantid and registrationno = :registrationno; "; + + private static final String DEATHDTLDELETEQRY="Delete from {schema}.eg_death_dtls where tenantid = :tenantid and registrationno = :registrationno; "; + + private static final String BIRTHDTLSAVEQRY="INSERT INTO {schema}.eg_birth_dtls(id, registrationno, hospitalname, dateofreport, " + "dateofbirth, firstname, middlename, lastname, placeofbirth, informantsname, informantsaddress, " + "createdtime, createdby, lastmodifiedtime, lastmodifiedby, counter, tenantid, gender, remarks, hospitalid, islegacyrecord) " + "VALUES (:id, :registrationno, :hospitalname, :dateofreport, :dateofbirth, :firstname, :middlename, :lastname, " + ":placeofbirth, :informantsname, :informantsaddress, :createdtime, :createdby, :lastmodifiedtime, " + ":lastmodifiedby, :counter, :tenantid, :gender, :remarks, :hospitalid, :islegacyrecord); "; - private static final String BIRTHFATHERINFOSAVEQRY="INSERT INTO public.eg_birth_father_info( id, firstname, middlename, lastname, aadharno, " + private static final String BIRTHFATHERINFOSAVEQRY="INSERT INTO {schema}.eg_birth_father_info( id, firstname, middlename, lastname, aadharno, " + "emailid, mobileno, education, proffession, nationality, religion, createdtime, createdby, lastmodifiedtime, lastmodifiedby, birthdtlid) " + "VALUES (:id, :firstname, :middlename, :lastname, :aadharno, :emailid, :mobileno, :education, :proffession, :nationality," + " :religion, :createdtime, :createdby, :lastmodifiedtime, :lastmodifiedby, :birthdtlid);"; - private static final String BIRTHMOTHERINFOSAVEQRY="INSERT INTO public.eg_birth_mother_info(id, firstname, middlename, lastname, aadharno, " + private static final String BIRTHMOTHERINFOSAVEQRY="INSERT INTO {schema}.eg_birth_mother_info(id, firstname, middlename, lastname, aadharno, " + "emailid, mobileno, education, proffession, nationality, religion, createdtime, createdby, lastmodifiedtime, lastmodifiedby, birthdtlid) " + "VALUES (:id, :firstname, :middlename, :lastname, :aadharno, :emailid, :mobileno, :education, :proffession, :nationality," + " :religion, :createdtime, :createdby, :lastmodifiedtime, :lastmodifiedby, :birthdtlid);"; - private static final String BIRTHPERMADDRSAVEQRY="INSERT INTO public.eg_birth_permaddr(id, buildingno, houseno, streetname, locality, tehsil, " + private static final String BIRTHPERMADDRSAVEQRY="INSERT INTO {schema}.eg_birth_permaddr(id, buildingno, houseno, streetname, locality, tehsil, " + "district, city, state, pinno, country, createdby, createdtime, lastmodifiedby, lastmodifiedtime, birthdtlid) " + "VALUES (:id, :buildingno, :houseno, :streetname, :locality, :tehsil, :district, :city, :state, :pinno, :country," + " :createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime, :birthdtlid);"; - private static final String BIRTHPRESENTADDRSAVEQRY="INSERT INTO public.eg_birth_presentaddr(id, buildingno, houseno, streetname, locality, tehsil, " + private static final String BIRTHPRESENTADDRSAVEQRY="INSERT INTO {schema}.eg_birth_presentaddr(id, buildingno, houseno, streetname, locality, tehsil, " + "district, city, state, pinno, country, createdby, createdtime, lastmodifiedby, lastmodifiedtime, birthdtlid) " + "VALUES (:id, :buildingno, :houseno, :streetname, :locality, :tehsil, :district, :city, :state, :pinno, :country, " + ":createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime, :birthdtlid);"; - private static final String DEATHDTLSAVEQRY="INSERT INTO public.eg_death_dtls(id, registrationno, hospitalname, dateofreport, " + private static final String DEATHDTLSAVEQRY="INSERT INTO {schema}.eg_death_dtls(id, registrationno, hospitalname, dateofreport, " + "dateofdeath, firstname, middlename, lastname, placeofdeath, informantsname, informantsaddress, " + "createdtime, createdby, lastmodifiedtime, lastmodifiedby, counter, tenantid, gender, remarks, hospitalid, age, eidno, aadharno, nationality, religion, icdcode, islegacyrecord) " + "VALUES (:id, :registrationno, :hospitalname, :dateofreport, :dateofdeath, :firstname, :middlename, :lastname, " + ":placeofdeath, :informantsname, :informantsaddress, :createdtime, :createdby, :lastmodifiedtime, " + ":lastmodifiedby, :counter, :tenantid, :gender, :remarks, :hospitalid, :age, :eidno, :aadharno, :nationality, :religion, :icdcode, :islegacyrecord); "; - private static final String DEATHFATHERINFOSAVEQRY="INSERT INTO public.eg_death_father_info( id, firstname, middlename, lastname, aadharno, " + private static final String DEATHFATHERINFOSAVEQRY="INSERT INTO {schema}.eg_death_father_info( id, firstname, middlename, lastname, aadharno, " + "emailid, mobileno, createdtime, createdby, lastmodifiedtime, lastmodifiedby, deathdtlid) " + "VALUES (:id, :firstname, :middlename, :lastname, :aadharno, :emailid, :mobileno, :createdtime, :createdby, :lastmodifiedtime, :lastmodifiedby, :deathdtlid);"; - - private static final String DEATHMOTHERINFOSAVEQRY="INSERT INTO public.eg_death_mother_info(id, firstname, middlename, lastname, aadharno, " + + private static final String DEATHMOTHERINFOSAVEQRY="INSERT INTO {schema}.eg_death_mother_info(id, firstname, middlename, lastname, aadharno, " + "emailid, mobileno, createdtime, createdby, lastmodifiedtime, lastmodifiedby, deathdtlid) " + "VALUES (:id, :firstname, :middlename, :lastname, :aadharno, :emailid, :mobileno, :createdtime, :createdby, :lastmodifiedtime, :lastmodifiedby, :deathdtlid);"; - - private static final String DEATHSPOUSEINFOSAVEQRY="INSERT INTO public.eg_death_spouse_info(id, firstname, middlename, lastname, aadharno, " + + private static final String DEATHSPOUSEINFOSAVEQRY="INSERT INTO {schema}.eg_death_spouse_info(id, firstname, middlename, lastname, aadharno, " + "emailid, mobileno, createdtime, createdby, lastmodifiedtime, lastmodifiedby, deathdtlid) " + "VALUES (:id, :firstname, :middlename, :lastname, :aadharno, :emailid, :mobileno, :createdtime, :createdby, :lastmodifiedtime, :lastmodifiedby, :deathdtlid);"; - - private static final String DEATHPERMADDRSAVEQRY="INSERT INTO public.eg_death_permaddr(id, buildingno, houseno, streetname, locality, tehsil, " + + private static final String DEATHPERMADDRSAVEQRY="INSERT INTO {schema}.eg_death_permaddr(id, buildingno, houseno, streetname, locality, tehsil, " + "district, city, state, pinno, country, createdby, createdtime, lastmodifiedby, lastmodifiedtime, deathdtlid) " + "VALUES (:id, :buildingno, :houseno, :streetname, :locality, :tehsil, :district, :city, :state, :pinno, :country," + " :createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime, :deathdtlid);"; - private static final String DEATHPRESENTADDRSAVEQRY="INSERT INTO public.eg_death_presentaddr(id, buildingno, houseno, streetname, locality, tehsil, " + private static final String DEATHPRESENTADDRSAVEQRY="INSERT INTO {schema}.eg_death_presentaddr(id, buildingno, houseno, streetname, locality, tehsil, " + "district, city, state, pinno, country, createdby, createdtime, lastmodifiedby, lastmodifiedtime, deathdtlid) " + "VALUES (:id, :buildingno, :houseno, :streetname, :locality, :tehsil, :district, :city, :state, :pinno, :country, " + ":createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime, :deathdtlid);"; - private static final String HOSPITALINSERTSQL="INSERT INTO public.eg_birth_death_hospitals(id, hospitalname, tenantid) VALUES " + private static final String HOSPITALINSERTSQL="INSERT INTO {schema}.eg_birth_death_hospitals(id, hospitalname, tenantid) VALUES " + " (?, ?, ?) ;"; - - private static final String BIRTHDTLUPDATEQRY="UPDATE public.eg_birth_dtls SET registrationno = :registrationno, hospitalname = :hospitalname, dateofreport = :dateofreport, " + + private static final String BIRTHDTLUPDATEQRY="UPDATE {schema}.eg_birth_dtls SET registrationno = :registrationno, hospitalname = :hospitalname, dateofreport = :dateofreport, " + "dateofbirth = :dateofbirth , firstname= :firstname, middlename = :middlename, lastname = :lastname, placeofbirth= :placeofbirth, informantsname = :informantsname, " + "informantsaddress = :informantsaddress, lastmodifiedtime = :lastmodifiedtime, lastmodifiedby= :lastmodifiedby, gender = :gender, remarks = :remarks, " + "hospitalid = :hospitalid, islegacyrecord =:islegacyrecord WHERE id = :id;"; - private static final String BIRTHFATHERINFOUPDATEQRY="UPDATE public.eg_birth_father_info SET firstname = :firstname, middlename = :middlename, lastname = :lastname, " + private static final String BIRTHFATHERINFOUPDATEQRY="UPDATE {schema}.eg_birth_father_info SET firstname = :firstname, middlename = :middlename, lastname = :lastname, " + "aadharno = :aadharno, emailid = :emailid, mobileno = :mobileno, education = :education, proffession = :proffession, nationality = :nationality, " + "religion = :religion, lastmodifiedtime = :lastmodifiedtime, lastmodifiedby = :lastmodifiedby WHERE birthdtlid = :birthdtlid;"; - private static final String BIRTHMOTHERINFOUPDATEQRY="UPDATE public.eg_birth_mother_info SET firstname = :firstname, middlename = :middlename, lastname = :lastname, " + private static final String BIRTHMOTHERINFOUPDATEQRY="UPDATE {schema}.eg_birth_mother_info SET firstname = :firstname, middlename = :middlename, lastname = :lastname, " + "aadharno = :aadharno, emailid = :emailid, mobileno = :mobileno, education = :education, proffession = :proffession, nationality = :nationality, " + "religion = :religion, lastmodifiedtime = :lastmodifiedtime, lastmodifiedby = :lastmodifiedby WHERE birthdtlid = :birthdtlid;"; - private static final String BIRTHPERMADDRUPDATEQRY = "UPDATE public.eg_birth_permaddr SET buildingno = :buildingno, houseno = :houseno, streetname = :streetname, " + private static final String BIRTHPERMADDRUPDATEQRY = "UPDATE {schema}.eg_birth_permaddr SET buildingno = :buildingno, houseno = :houseno, streetname = :streetname, " + "locality = :locality, tehsil = :tehsil, district = :district, city = :city, state = :state, pinno = :pinno, country = :country, " + "lastmodifiedby = :lastmodifiedby, lastmodifiedtime = :lastmodifiedtime WHERE birthdtlid = :birthdtlid;"; - private static final String BIRTHPRESENTADDRUPDATEQRY="UPDATE public.eg_birth_presentaddr SET buildingno = :buildingno, houseno = :houseno, streetname = :streetname, " + private static final String BIRTHPRESENTADDRUPDATEQRY="UPDATE {schema}.eg_birth_presentaddr SET buildingno = :buildingno, houseno = :houseno, streetname = :streetname, " + "locality = :locality, tehsil = :tehsil, district = :district, city = :city, state = :state, pinno = :pinno, country = :country, " + "lastmodifiedby = :lastmodifiedby, lastmodifiedtime = :lastmodifiedtime WHERE birthdtlid = :birthdtlid;"; - private static final String DEATHDTLUPDATEQRY="UPDATE public.eg_death_dtls SET registrationno = :registrationno, hospitalname = :hospitalname, dateofreport = :dateofreport, " + private static final String DEATHDTLUPDATEQRY="UPDATE {schema}.eg_death_dtls SET registrationno = :registrationno, hospitalname = :hospitalname, dateofreport = :dateofreport, " + "dateofdeath = :dateofdeath , firstname= :firstname, middlename = :middlename, lastname = :lastname, placeofdeath= :placeofdeath, informantsname = :informantsname, " + "informantsaddress = :informantsaddress, lastmodifiedtime = :lastmodifiedtime, lastmodifiedby= :lastmodifiedby, gender = :gender, remarks = :remarks, " + "hospitalid = :hospitalid , age = :age, eidno = :eidno, aadharno = :aadharno, nationality = :nationality, religion = :religion, icdcode = :icdcode, islegacyrecord =:islegacyrecord WHERE id = :id;"; - private static final String DEATHFATHERINFOUPDATEQRY="UPDATE public.eg_death_father_info SET firstname = :firstname, middlename = :middlename, lastname = :lastname, " + private static final String DEATHFATHERINFOUPDATEQRY="UPDATE {schema}.eg_death_father_info SET firstname = :firstname, middlename = :middlename, lastname = :lastname, " + "aadharno = :aadharno, emailid = :emailid, mobileno = :mobileno, lastmodifiedtime = :lastmodifiedtime, lastmodifiedby = :lastmodifiedby WHERE deathdtlid = :deathdtlid;"; - - private static final String DEATHMOTHERINFOUPDATEQRY="UPDATE public.eg_death_mother_info SET firstname = :firstname, middlename = :middlename, lastname = :lastname, " + + private static final String DEATHMOTHERINFOUPDATEQRY="UPDATE {schema}.eg_death_mother_info SET firstname = :firstname, middlename = :middlename, lastname = :lastname, " + "aadharno = :aadharno, emailid = :emailid, mobileno = :mobileno, lastmodifiedtime = :lastmodifiedtime, lastmodifiedby = :lastmodifiedby WHERE deathdtlid = :deathdtlid;"; - - private static final String DEATHSPOUSEINFOUPDATEQRY="UPDATE public.eg_death_spouse_info SET firstname = :firstname, middlename = :middlename, lastname = :lastname, " + + private static final String DEATHSPOUSEINFOUPDATEQRY="UPDATE {schema}.eg_death_spouse_info SET firstname = :firstname, middlename = :middlename, lastname = :lastname, " + "aadharno = :aadharno, emailid = :emailid, mobileno = :mobileno, lastmodifiedtime = :lastmodifiedtime, lastmodifiedby = :lastmodifiedby WHERE deathdtlid = :deathdtlid;"; - - private static final String DEATHPERMADDRUPDATEQRY = "UPDATE public.eg_death_permaddr SET buildingno = :buildingno, houseno = :houseno, streetname = :streetname, " + + private static final String DEATHPERMADDRUPDATEQRY = "UPDATE {schema}.eg_death_permaddr SET buildingno = :buildingno, houseno = :houseno, streetname = :streetname, " + "locality = :locality, tehsil = :tehsil, district = :district, city = :city, state = :state, pinno = :pinno, country = :country, " + "lastmodifiedby = :lastmodifiedby, lastmodifiedtime = :lastmodifiedtime WHERE deathdtlid = :deathdtlid;"; - - private static final String DEATHPRESENTADDRUPDATEQRY="UPDATE public.eg_death_presentaddr SET buildingno = :buildingno, houseno = :houseno, streetname = :streetname, " + + private static final String DEATHPRESENTADDRUPDATEQRY="UPDATE {schema}.eg_death_presentaddr SET buildingno = :buildingno, houseno = :houseno, streetname = :streetname, " + "locality = :locality, tehsil = :tehsil, district = :district, city = :city, state = :state, pinno = :pinno, country = :country, " + "lastmodifiedby = :lastmodifiedby, lastmodifiedtime = :lastmodifiedtime WHERE deathdtlid = :deathdtlid;"; @@ -193,6 +198,12 @@ public CommonRepository(CommonService commonService) { public List getHospitalDtls(String tenantId) { List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getHospitalDtls(tenantId, preparedStmtList); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("WS_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } List hospitalDtls = jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); return hospitalDtls; } @@ -277,11 +288,11 @@ public ImportBirthWrapper saveBirthImport(BirthResponse response, RequestInfo re } if(birthValidator.validateUniqueRegNo(birthDtl,importBirthWrapper) && birthValidator.validateImportFields(birthDtl,importBirthWrapper)){ try { - namedParameterJdbcTemplate.update(BIRTHDTLSAVEQRY, getParametersForBirthDtl(birthDtl, auditDetails, true)); - namedParameterJdbcTemplate.update(BIRTHFATHERINFOSAVEQRY, getParametersForFatherInfo(birthDtl, auditDetails, true)); - namedParameterJdbcTemplate.update(BIRTHMOTHERINFOSAVEQRY, getParametersForMotherInfo(birthDtl, auditDetails, true)); - namedParameterJdbcTemplate.update(BIRTHPERMADDRSAVEQRY, getParametersForPermAddr(birthDtl, auditDetails, true)); - namedParameterJdbcTemplate.update(BIRTHPRESENTADDRSAVEQRY, getParametersForPresentAddr(birthDtl, auditDetails, true)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(BIRTHDTLSAVEQRY, birthDtl.getTenantid()), getParametersForBirthDtl(birthDtl, auditDetails, true)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(BIRTHFATHERINFOSAVEQRY, birthDtl.getTenantid()), getParametersForFatherInfo(birthDtl, auditDetails, true)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(BIRTHMOTHERINFOSAVEQRY, birthDtl.getTenantid()), getParametersForMotherInfo(birthDtl, auditDetails, true)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(BIRTHPERMADDRSAVEQRY, birthDtl.getTenantid()), getParametersForPermAddr(birthDtl, auditDetails, true)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(BIRTHPRESENTADDRSAVEQRY, birthDtl.getTenantid()), getParametersForPresentAddr(birthDtl, auditDetails, true)); finalCount++; } catch (Exception e) { @@ -290,7 +301,7 @@ public ImportBirthWrapper saveBirthImport(BirthResponse response, RequestInfo re Map params = new HashMap<>(); params.put("tenantid", birthDtl.getTenantid()); params.put("registrationno", birthDtl.getRegistrationno()); - namedParameterJdbcTemplate.update(BIRTHDTLDELETEQRY, params); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(BIRTHDTLDELETEQRY,birthDtl.getTenantid()), params); e.printStackTrace(); } } @@ -324,7 +335,7 @@ private void modifyHospIdBirth(Map> uniqueHospList , St if(!dbHospNameIdMap.containsKey(hospName)) { String id = tenantid.split("\\.")[1] + "_" + (dbHospNameIdMap.keySet().size() + 1); - jdbcTemplate.update(HOSPITALINSERTSQL, id,hospName,tenantid); + jdbcTemplate.update(callToReplaceSchemaPlaceHolder(HOSPITALINSERTSQL, tenantid), id,hospName,tenantid); dbHospNameIdMap.put(hospName,id); } for (EgBirthDtl bdtl : uniqueHospList.get(hospName)) { @@ -346,7 +357,7 @@ private void modifyHospIdDeath(Map> uniqueHospList , St if(!dbHospNameIdMap.containsKey(hospName)) { String id = tenantid.split("\\.")[1] + "_" + (dbHospNameIdMap.keySet().size() + 1); - jdbcTemplate.update(HOSPITALINSERTSQL, id,hospName,tenantid); + jdbcTemplate.update(callToReplaceSchemaPlaceHolder(HOSPITALINSERTSQL,tenantid), id,hospName,tenantid); dbHospNameIdMap.put(hospName,id); } for (EgDeathDtl bdtl : uniqueHospList.get(hospName)) { @@ -585,12 +596,12 @@ public ImportDeathWrapper saveDeathImport(DeathResponse response, RequestInfo re } if(deathValidator.validateUniqueRegNo(deathDtl,importDeathWrapper) && deathValidator.validateImportFields(deathDtl,importDeathWrapper)){ try { - namedParameterJdbcTemplate.update(DEATHDTLSAVEQRY, getParametersForDeathDtl(deathDtl, auditDetails, true)); - namedParameterJdbcTemplate.update(DEATHFATHERINFOSAVEQRY, getParametersForFatherInfo(deathDtl, auditDetails, true)); - namedParameterJdbcTemplate.update(DEATHMOTHERINFOSAVEQRY, getParametersForMotherInfo(deathDtl, auditDetails, true)); - namedParameterJdbcTemplate.update(DEATHSPOUSEINFOSAVEQRY, getParametersForSpouseInfo(deathDtl, auditDetails, true)); - namedParameterJdbcTemplate.update(DEATHPERMADDRSAVEQRY, getParametersForPermAddr(deathDtl, auditDetails, true)); - namedParameterJdbcTemplate.update(DEATHPRESENTADDRSAVEQRY, getParametersForPresentAddr(deathDtl, auditDetails, true)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(DEATHDTLSAVEQRY, deathDtl.getTenantid()), getParametersForDeathDtl(deathDtl, auditDetails, true)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(DEATHFATHERINFOSAVEQRY, deathDtl.getTenantid()), getParametersForFatherInfo(deathDtl, auditDetails, true)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(DEATHMOTHERINFOSAVEQRY, deathDtl.getTenantid()), getParametersForMotherInfo(deathDtl, auditDetails, true)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(DEATHSPOUSEINFOSAVEQRY, deathDtl.getTenantid()), getParametersForSpouseInfo(deathDtl, auditDetails, true)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(DEATHPERMADDRSAVEQRY, deathDtl.getTenantid()), getParametersForPermAddr(deathDtl, auditDetails, true)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(DEATHPRESENTADDRSAVEQRY,deathDtl.getTenantid()), getParametersForPresentAddr(deathDtl, auditDetails, true)); finalCount++; } catch (Exception e) { @@ -599,7 +610,7 @@ public ImportDeathWrapper saveDeathImport(DeathResponse response, RequestInfo re Map params = new HashMap<>(); params.put("tenantid", deathDtl.getTenantid()); params.put("registrationno", deathDtl.getRegistrationno()); - namedParameterJdbcTemplate.update(DEATHDTLDELETEQRY, params); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(DEATHDTLDELETEQRY, deathDtl.getTenantid()), params); e.printStackTrace(); } } @@ -872,11 +883,11 @@ public ImportBirthWrapper updateBirthImport(BirthResponse response, RequestInfo } if(birthValidator.validateImportFields(birthDtl,importBirthWrapper)){ try { - namedParameterJdbcTemplate.update(BIRTHDTLUPDATEQRY, getParametersForBirthDtl(birthDtl, auditDetails, false)); - namedParameterJdbcTemplate.update(BIRTHFATHERINFOUPDATEQRY, getParametersForFatherInfo(birthDtl, auditDetails, false)); - namedParameterJdbcTemplate.update(BIRTHMOTHERINFOUPDATEQRY, getParametersForMotherInfo(birthDtl, auditDetails, false)); - namedParameterJdbcTemplate.update(BIRTHPERMADDRUPDATEQRY, getParametersForPermAddr(birthDtl, auditDetails, false)); - namedParameterJdbcTemplate.update(BIRTHPRESENTADDRUPDATEQRY, getParametersForPresentAddr(birthDtl, auditDetails, false)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(BIRTHDTLUPDATEQRY, birthDtl.getTenantid()), getParametersForBirthDtl(birthDtl, auditDetails, false)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(BIRTHFATHERINFOUPDATEQRY, birthDtl.getTenantid()),getParametersForFatherInfo(birthDtl, auditDetails, false)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(BIRTHMOTHERINFOUPDATEQRY, birthDtl.getTenantid()),getParametersForMotherInfo(birthDtl, auditDetails, false)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(BIRTHPERMADDRUPDATEQRY, birthDtl.getTenantid()),getParametersForPermAddr(birthDtl, auditDetails, false)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(BIRTHPRESENTADDRUPDATEQRY,birthDtl.getTenantid()), getParametersForPresentAddr(birthDtl, auditDetails, false)); finalCount++; } catch (Exception e) { @@ -981,12 +992,12 @@ public ImportDeathWrapper updateDeathImport(DeathResponse response, RequestInfo } if(deathValidator.validateImportFields(deathDtl,importDeathWrapper)){ try { - namedParameterJdbcTemplate.update(DEATHDTLUPDATEQRY, getParametersForDeathDtl(deathDtl, auditDetails, false)); - namedParameterJdbcTemplate.update(DEATHFATHERINFOUPDATEQRY, getParametersForFatherInfo(deathDtl, auditDetails, false)); - namedParameterJdbcTemplate.update(DEATHMOTHERINFOUPDATEQRY, getParametersForMotherInfo(deathDtl, auditDetails, false)); - namedParameterJdbcTemplate.update(DEATHSPOUSEINFOUPDATEQRY, getParametersForSpouseInfo(deathDtl, auditDetails, false)); - namedParameterJdbcTemplate.update(DEATHPERMADDRUPDATEQRY, getParametersForPermAddr(deathDtl, auditDetails, false)); - namedParameterJdbcTemplate.update(DEATHPRESENTADDRUPDATEQRY, getParametersForPresentAddr(deathDtl, auditDetails, false)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(DEATHDTLUPDATEQRY, deathDtl.getTenantid()), getParametersForDeathDtl(deathDtl, auditDetails, false)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(DEATHFATHERINFOUPDATEQRY, deathDtl.getTenantid()), getParametersForFatherInfo(deathDtl, auditDetails, false)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(DEATHMOTHERINFOUPDATEQRY, deathDtl.getTenantid()), getParametersForMotherInfo(deathDtl, auditDetails, false)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(DEATHSPOUSEINFOUPDATEQRY, deathDtl.getTenantid()), getParametersForSpouseInfo(deathDtl, auditDetails, false)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(DEATHPERMADDRUPDATEQRY, deathDtl.getTenantid()), getParametersForPermAddr(deathDtl, auditDetails, false)); + namedParameterJdbcTemplate.update(callToReplaceSchemaPlaceHolder(DEATHPRESENTADDRUPDATEQRY, deathDtl.getTenantid()), getParametersForPresentAddr(deathDtl, auditDetails, false)); finalCount++; } catch (Exception e) { @@ -1014,4 +1025,15 @@ public ImportDeathWrapper updateDeathImport(DeathResponse response, RequestInfo return importDeathWrapper; } + public String callToReplaceSchemaPlaceHolder(String query, String tenantId){ + try { + //TODO: Need to check with kavi if we need to do this or if its correct + query = centralInstanceUtil.replaceSchemaPlaceholder(query, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("WS_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + return query; + } + } \ No newline at end of file diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/IdGenRepository.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/IdGenRepository.java index 464fe31a38a..c5563070eab 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/IdGenRepository.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/IdGenRepository.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; +import com.fasterxml.jackson.databind.ObjectMapper; import org.bel.birthdeath.common.Idgen.IdGenerationRequest; import org.bel.birthdeath.common.Idgen.IdGenerationResponse; import org.bel.birthdeath.common.Idgen.IdRequest; @@ -14,6 +15,7 @@ import org.egov.tracer.model.CustomException; import org.egov.tracer.model.ServiceCallException; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Repository; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; @@ -27,6 +29,13 @@ public class IdGenRepository { @Autowired private BirthDeathConfiguration config; + @Autowired + private ServiceRequestRepository serviceRequestRepository; + + @Autowired + @Qualifier("objectMapperBnd") + private ObjectMapper mapper; + public IdGenerationResponse getId(RequestInfo requestInfo, String tenantId, String name, String format, int count) { List reqList = new ArrayList<>(); @@ -34,11 +43,12 @@ public IdGenerationResponse getId(RequestInfo requestInfo, String tenantId, Stri reqList.add(IdRequest.builder().idName(name).format(format).tenantId(tenantId).build()); } IdGenerationRequest req = IdGenerationRequest.builder().idRequests(reqList).requestInfo(requestInfo).build(); + Object result = serviceRequestRepository.fetchResult(new StringBuilder(config.getIdGenHost() + config.getIdGenPath()), req); IdGenerationResponse response = null; try { - response = restTemplate.postForObject( config.getIdGenHost()+ config.getIdGenPath(), req, IdGenerationResponse.class); - } catch (HttpClientErrorException e) { - throw new ServiceCallException(e.getResponseBodyAsString()); + response = mapper.convertValue(result, IdGenerationResponse.class); + } catch (IllegalArgumentException e) { + throw new CustomException("PARSING ERROR","Failed to parse response of ID Generation"); } catch (Exception e) { Map map = new HashMap<>(); map.put(e.getCause().getClass().getName(),e.getMessage()); diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/ServiceRequestRepository.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/ServiceRequestRepository.java index 1c1b137faf1..838506b0978 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/ServiceRequestRepository.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/ServiceRequestRepository.java @@ -1,10 +1,15 @@ package org.bel.birthdeath.common.repository; +import static org.bel.birthdeath.utils.BirthDeathConstants.TENANTID_MDC_STRING; + import java.util.Map; import org.egov.tracer.model.ServiceCallException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Repository; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; @@ -20,11 +25,14 @@ public class ServiceRequestRepository { @Autowired private RestTemplate restTemplate; - + @Autowired @Qualifier("objectMapperBnd") private ObjectMapper mapper; - + + @Value("${egov.state.level.tenant.id}") + private String stateLevelTenantId; + public Object fetchResult(StringBuilder uri, Object request) { mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); Object response = null; diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/builder/CommonQueryBuilder.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/builder/CommonQueryBuilder.java index e66329ac694..36c3ee2a447 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/builder/CommonQueryBuilder.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/common/repository/builder/CommonQueryBuilder.java @@ -11,7 +11,7 @@ public class CommonQueryBuilder { - private static final String QUERY_MASTER = "SELECT * FROM eg_birth_death_hospitals bdtl"; + private static final String QUERY_MASTER = "SELECT * FROM {schema}.eg_birth_death_hospitals bdtl"; private static void addClauseIfRequired(List values, StringBuilder queryString) { if (values.isEmpty()) diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/controller/DeathController.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/controller/DeathController.java index b9bae5dbc7a..f9c11a5db53 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/controller/DeathController.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/controller/DeathController.java @@ -108,7 +108,7 @@ public ResponseEntity getfilestoreid(@RequestBody RequestInfo @PostMapping(value = { "/_searchapplications"}) public ResponseEntity searchApplications(@RequestBody RequestInfoWrapper requestInfoWrapper, @ModelAttribute SearchCriteria criteria ) { - List applications = deathService.searchApplications(requestInfoWrapper); + List applications = deathService.searchApplications(requestInfoWrapper, criteria); DeathCertApplnResponse response = DeathCertApplnResponse.builder().applications(applications).responseInfo( responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true)) .build(); diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/repository/DeathRepository.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/repository/DeathRepository.java index 8f001c98b53..ceef8350800 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/repository/DeathRepository.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/repository/DeathRepository.java @@ -8,12 +8,15 @@ import java.util.List; import java.util.Map; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.bel.birthdeath.common.Idgen.IdGenerationResponse; import org.bel.birthdeath.common.contract.BirthPdfApplicationRequest; import org.bel.birthdeath.common.contract.DeathPdfApplicationRequest; import org.bel.birthdeath.common.contract.EgovPdfResp; import org.bel.birthdeath.common.contract.EncryptionDecryptionUtil; import org.bel.birthdeath.common.model.AuditDetails; import org.bel.birthdeath.common.producer.BndProducer; +import org.bel.birthdeath.common.repository.ServiceRequestRepository; import org.bel.birthdeath.config.BirthDeathConfiguration; import org.bel.birthdeath.death.certmodel.DeathCertAppln; import org.bel.birthdeath.death.certmodel.DeathCertRequest; @@ -32,8 +35,11 @@ import org.bel.birthdeath.utils.BirthDeathConstants; import org.bel.birthdeath.utils.CommonUtils; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.exception.InvalidTenantIdException; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; @@ -98,10 +104,26 @@ public class DeathRepository { @Autowired private NamedParameterJdbcTemplate namedParameterJdbcTemplate; + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + @Autowired + private ServiceRequestRepository serviceRequestRepository; + + @Autowired + @Qualifier("objectMapperBnd") + private ObjectMapper mapper; public List getDeathDtls(SearchCriteria criteria) { List preparedStmtList = new ArrayList<>(); String query = allqueryBuilder.getDeathDtls(criteria, preparedStmtList); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("DEATHCERT_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } return jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); } @@ -119,13 +141,19 @@ public List getDeathDtlsForPlainSearch(SearchCriteria criteria if (criteria.getOffset() != null) offset = criteria.getOffset(); - String query = "SELECT * FROM eg_death_cert_request OFFSET " + offset + " LIMIT " + limit; + String query = "SELECT * FROM {schema}.eg_death_cert_request OFFSET " + offset + " LIMIT " + limit; + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("DEATHCERT_PLAINSEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } List> list = jdbcTemplate.queryForList(query); for(Map map: list) { DeathCertificate deathCertificate = new DeathCertificate(); log.info("Death Detail ID = " + map.get("deathdtlid")); - EgDeathDtl deathDtl = getDeathDtlById((String) map.get("deathdtlid")); + EgDeathDtl deathDtl = getDeathDtlById((String) map.get("deathdtlid"), criteria.getTenantId()); deathCertificate.setId((String) map.get("id")); deathCertificate.setDeathCertificateNo((String) map.get("deathcertificateno")); @@ -159,13 +187,20 @@ public List getDeathDtlsForPlainSearch(SearchCriteria criteria return deathCertificates; } - public EgDeathDtl getDeathDtlById(String id) { - String deathDtlQuery = "SELECT * FROM eg_death_dtls WHERE id = ?"; + public EgDeathDtl getDeathDtlById(String id, String tenantId) { + String deathDtlQuery = "SELECT * FROM {schema}.eg_death_dtls WHERE id = ?"; + try { + //TODO: Passing tenenantId as empty.Check with kavi + deathDtlQuery = centralInstanceUtil.replaceSchemaPlaceholder(deathDtlQuery, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("DEATHCERT_SEARCH_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } return (EgDeathDtl) jdbcTemplate.queryForObject(deathDtlQuery, new Object[]{id}, new BeanPropertyRowMapper(EgDeathDtl.class)); } public void save(DeathCertRequest deathCertRequest) { - bndProducer.push(config.getSaveDeathTopic(), deathCertRequest); + bndProducer.push(deathCertRequest.getDeathCertificate().getTenantId(), config.getSaveDeathTopic(), deathCertRequest); } public EgovPdfResp saveDeathCertPdf(DeathPdfApplicationRequest pdfApplicationRequest) { @@ -191,16 +226,22 @@ public EgovPdfResp saveDeathCertPdf(DeathPdfApplicationRequest pdfApplicationReq pdfApplicationRequest.getDeathCertificate().forEach(cert-> { String uiHost = config.getEgovPdfHost(); String deathCertPath = config.getEgovPdfDeathEndPoint(); - String tenantId = cert.getTenantid().split("\\.")[0]; + /*String tenantId = cert.getTenantid().split("\\.")[0];*/ + String tenantId = centralInstanceUtil.getStateLevelTenant(cert.getTenantid()); deathCertPath = deathCertPath.replace("$tenantId",tenantId); String pdfFinalPath = uiHost + deathCertPath; - EgovPdfResp response = restTemplate.postForObject(pdfFinalPath, req, EgovPdfResp.class); + + Object responseObject = serviceRequestRepository.fetchResult(new StringBuilder(pdfFinalPath), req); + EgovPdfResp response = mapper.convertValue(responseObject, EgovPdfResp.class); + if (response != null && CollectionUtils.isEmpty(response.getFilestoreIds())) { throw new CustomException("EMPTY_FILESTORE_IDS_FROM_PDF_SERVICE", "No file store id found from pdf service"); } result.setFilestoreIds(response.getFilestoreIds()); }); + } catch (IllegalArgumentException e) { + throw new CustomException("PARSING ERROR","Failed to parse response of PDF-Service"); }catch(Exception e) { e.printStackTrace(); throw new CustomException("PDF_ERROR","Error in generating PDF"); @@ -212,6 +253,12 @@ public EgovPdfResp saveDeathCertPdf(DeathPdfApplicationRequest pdfApplicationReq public List getDeathDtlsAll(SearchCriteria criteria ,RequestInfo requestInfo) { List preparedStmtList = new ArrayList<>(); String query = allqueryBuilder.getDeathDtlsAll(criteria, preparedStmtList); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("DEATHCERT_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } List deathDtls = jdbcTemplate.query(query, preparedStmtList.toArray(), allRowMapper); if(deathDtls != null) { deathDtls.forEach(deathDtl -> { @@ -227,11 +274,17 @@ public List getDeathDtlsAll(SearchCriteria criteria ,RequestInfo req return deathDtls; } - public DeathCertificate getDeathCertReqByConsumerCode(String consumerCode, RequestInfo requestInfo) { + public DeathCertificate getDeathCertReqByConsumerCode(String consumerCode, RequestInfo requestInfo, String tenantId) { try { List preparedStmtList = new ArrayList<>(); SearchCriteria criteria = new SearchCriteria(); String query = allqueryBuilder.getDeathCertReq(consumerCode, requestInfo, preparedStmtList); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("DEATHCERT_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } List deathCerts = jdbcTemplate.query(query, preparedStmtList.toArray(), deathCertRowMapper); if (null != deathCerts && !deathCerts.isEmpty()) { criteria.setTenantId(deathCerts.get(0).getTenantId()); @@ -254,25 +307,39 @@ public DeathCertificate getDeathCertReqByConsumerCode(String consumerCode, Reque return null; } - public void updateCounter(String deathDtlId) { + public void updateCounter(String deathDtlId, String tenantId) { try { - String updateQry="UPDATE public.eg_death_dtls SET counter=counter+1 WHERE id=:id and tenantid not in (:tenantIds)"; + String updateQry = "UPDATE {schema}.eg_death_dtls SET counter=counter+1 WHERE id=:id and tenantid not in (:tenantIds)"; Map params = new HashMap<>(); params.put("id", deathDtlId); - params.put("tenantIds",Arrays.asList(freeDownloadTenants.split(","))); - namedParameterJdbcTemplate.update(updateQry ,params); - }catch(Exception e) { + params.put("tenantIds", Arrays.asList(freeDownloadTenants.split(","))); + try { + //TODO: Update is being called here. need to check with kavi if we need to call here to + updateQry = centralInstanceUtil.replaceSchemaPlaceholder(updateQry, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("DEATHCERT_UPDATE_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + namedParameterJdbcTemplate.update(updateQry, params); + } catch (Exception e) { e.printStackTrace(); - throw new CustomException("Invalid_data","Error in updating"); + throw new CustomException("Invalid_data", "Error in updating"); } } - public List searchApplications( String uuid) { + public List searchApplications( String uuid, String tenantId) { List deathCertAppls = new ArrayList<>(); try { List preparedStmtList = new ArrayList<>(); String applQuery=allqueryBuilder.searchApplications(uuid, preparedStmtList); + try { + //TODO:Passing empty tenantId as tenantId is not there.need to cjeck with kavi + applQuery = centralInstanceUtil.replaceSchemaPlaceholder(applQuery, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("DEATHCERT_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } deathCertAppls = jdbcTemplate.query(applQuery, preparedStmtList.toArray(), certApplnRowMapper); } catch(Exception e) { @@ -284,7 +351,7 @@ public List searchApplications( String uuid) { } public void update(DeathCertRequest certRequest) { - bndProducer.push(config.getUpdateDeathTopic(), certRequest); + bndProducer.push(certRequest.getDeathCertificate().getTenantId(), config.getUpdateDeathTopic(), certRequest); } public String getShortenedUrl(String url){ @@ -292,7 +359,14 @@ public String getShortenedUrl(String url){ body.put("url",url); StringBuilder builder = new StringBuilder(config.getUrlShortnerHost()); builder.append(config.getUrlShortnerEndpoint()); - String res = restTemplate.postForObject(builder.toString(), body, String.class); + + String res = null; + try { + res = restTemplate.postForObject(builder.toString(), body, String.class); + } catch (IllegalArgumentException e) { + throw new CustomException("PARSING ERROR", "Failed to parse response of URL Shortening"); + } + if(StringUtils.isEmpty(res)){ log.error("URL_SHORTENING_ERROR","Unable to shorten url: "+url); return url; @@ -302,8 +376,9 @@ public String getShortenedUrl(String url){ public List viewCertificateData(SearchCriteria criteria) { List certData = new ArrayList<>(); - DeathCertificate certificate = getDeathCertReqByConsumerCode(criteria.getDeathcertificateno(),null); + DeathCertificate certificate = getDeathCertReqByConsumerCode(criteria.getDeathcertificateno(),null, criteria.getTenantId()); criteria.setId(certificate.getDeathDtlId()); + criteria.setTenantId(certificate.getTenantId()); certData= getDeathDtlsAll(criteria,null); certData.get(0).setDateofissue(certificate.getDateofissue()); return certData; @@ -312,6 +387,12 @@ public List viewCertificateData(SearchCriteria criteria) { public List viewfullCertMasterData(SearchCriteria criteria,RequestInfo requestInfo) { List preparedStmtList = new ArrayList<>(); String query = allqueryBuilder.getDeathCertMasterDtl(criteria, preparedStmtList); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("DEATHCERT_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } List deathCertMasterDtl = jdbcTemplate.query(query, preparedStmtList.toArray(), deathMasterDtlRowMapper); if(deathCertMasterDtl != null) { deathCertMasterDtl.forEach(deathDtl -> { diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/repository/builder/DeathDtlAllQueryBuilder.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/repository/builder/DeathDtlAllQueryBuilder.java index 09471a2fdb8..927efefff29 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/repository/builder/DeathDtlAllQueryBuilder.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/repository/builder/DeathDtlAllQueryBuilder.java @@ -36,12 +36,12 @@ public class DeathDtlAllQueryBuilder { "bpmad.district pmdistrict,bpmad.city pmcity ,bpmad.state pmstate,bpmad.pinno pmpinno,bpmad.country pmcountry, " + "bpsad.houseno pshouseno,bpsad.buildingno psbuildingno,bpsad.streetname psstreetname,bpsad.locality pslocality,bpsad.tehsil pstehsil, " + "bpsad.district psdistrict,bpsad.city pscity ,bpsad.state psstate,bpsad.pinno pspinno,bpsad.country pscountry " + - "FROM public.eg_death_dtls bdtl " + - "left join eg_death_father_info bfat on bfat.deathdtlid = bdtl.id " + - "left join eg_death_mother_info bmot on bmot.deathdtlid = bdtl.id " + - "left join eg_death_spouse_info bsps on bsps.deathdtlid = bdtl.id " + - "left join eg_death_permaddr bpmad on bpmad.deathdtlid = bdtl.id " + - "left join eg_death_presentaddr bpsad on bpsad.deathdtlid = bdtl.id"; + "FROM {schema}.eg_death_dtls bdtl " + + "left join {schema}.eg_death_father_info bfat on bfat.deathdtlid = bdtl.id " + + "left join {schema}.eg_death_mother_info bmot on bmot.deathdtlid = bdtl.id " + + "left join {schema}.eg_death_spouse_info bsps on bsps.deathdtlid = bdtl.id " + + "left join {schema}.eg_death_permaddr bpmad on bpmad.deathdtlid = bdtl.id " + + "left join {schema}.eg_death_presentaddr bpsad on bpsad.deathdtlid = bdtl.id"; private static String QUERY_MASTER_ALL = "SELECT bdtl.id deathdtlid, bdtl.tenantid tenantid, registrationno, dateofdeath, counter, gender , age , " + "CASE WHEN gender = '1' THEN 'Male' WHEN gender = '2' THEN 'Female' WHEN gender = '3' THEN 'Transgender' END AS genderstr ," @@ -54,12 +54,12 @@ public class DeathDtlAllQueryBuilder { + "bpsad.houseno pshouseno,bpsad.buildingno psbuildingno,bpsad.streetname psstreetname,bpsad.locality pslocality,bpsad.tehsil pstehsil," + "bpsad.district psdistrict,bpsad.city pscity ,bpsad.state psstate,bpsad.pinno pspinno,bpsad.country pscountry," + "bdtl.aadharno bdtlaadharno ,bfat.aadharno bfataadharno ,bmot.aadharno bmotaadharno , bsps.aadharno bspsaadharno "+ - "FROM public.eg_death_dtls bdtl " + - "left join eg_death_father_info bfat on bfat.deathdtlid = bdtl.id " + - "left join eg_death_mother_info bmot on bmot.deathdtlid = bdtl.id " + - "left join eg_death_permaddr bpmad on bpmad.deathdtlid = bdtl.id " + - "left join eg_death_presentaddr bpsad on bpsad.deathdtlid = bdtl.id "+ - "left join eg_death_spouse_info bsps on bsps.deathdtlid = bdtl.id " ; + "FROM {schema}.eg_death_dtls bdtl " + + "left join {schema}.eg_death_father_info bfat on bfat.deathdtlid = bdtl.id " + + "left join {schema}.eg_death_mother_info bmot on bmot.deathdtlid = bdtl.id " + + "left join {schema}.eg_death_permaddr bpmad on bpmad.deathdtlid = bdtl.id " + + "left join {schema}.eg_death_presentaddr bpsad on bpsad.deathdtlid = bdtl.id "+ + "left join {schema}.eg_death_spouse_info bsps on bsps.deathdtlid = bdtl.id " ; private static final String QUERY_MASTER = "SELECT bdtl.id deathdtlid, tenantid, registrationno, dateofdeath, counter, gender, hospitalname, "+ "CASE WHEN gender = '1' THEN 'Male' WHEN gender = '2' THEN 'Female' WHEN gender = '3' THEN 'Transgender' END AS genderstr ," + @@ -67,15 +67,15 @@ public class DeathDtlAllQueryBuilder { "bfat.firstname bfatfn ,bmot.firstname bmotfn , bdtl.firstname bdtlfn ,bsps.firstname bspsfn , "+ "bfat.middlename bfatmn ,bmot.middlename bmotmn , bdtl.middlename bdtlmn ,bsps.middlename bspsmn , "+ "bfat.lastname bfatln ,bmot.lastname bmotln , bdtl.lastname bdtlln ,bsps.lastname bspsln "+ - "FROM public.eg_death_dtls bdtl " + - "left join eg_death_father_info bfat on bfat.deathdtlid = bdtl.id " + - "left join eg_death_mother_info bmot on bmot.deathdtlid = bdtl.id " + - "left join eg_death_spouse_info bsps on bsps.deathdtlid = bdtl.id " ; + "FROM {schema}.eg_death_dtls bdtl " + + "left join {schema}.eg_death_father_info bfat on bfat.deathdtlid = bdtl.id " + + "left join {schema}.eg_death_mother_info bmot on bmot.deathdtlid = bdtl.id " + + "left join {schema}.eg_death_spouse_info bsps on bsps.deathdtlid = bdtl.id " ; private static String APPLSQUERY ="select breq.deathCertificateNo, breq.createdtime, breq.status, bdtl.registrationno, bdtl.tenantid, " + "concat(COALESCE(bdtl.firstname,'') , ' ', COALESCE(bdtl.middlename,'') ,' ', COALESCE(bdtl.lastname,'')) as name, " + "CASE WHEN breq.lastmodifiedtime/1000 < (extract(epoch from NOW())-?*24*60*60) THEN 'EXPIRED' ELSE breq.filestoreid END as filestoreid " - + "from eg_death_cert_request breq left join eg_death_dtls bdtl on bdtl.id=breq.deathDtlId where " + + "from {schema}.eg_death_cert_request breq left join {schema}.eg_death_dtls bdtl on bdtl.id=breq.deathDtlId where " + "breq.createdby=? order by breq.createdtime DESC "; private final String PAGINATIONWRAPPER = "SELECT * FROM " + @@ -94,7 +94,7 @@ private static void addClauseIfRequired(List values, StringBuilder query public String getDeathCertReq(String consumerCode, RequestInfo requestInfo, List preparedStmtList) { - StringBuilder builder = new StringBuilder("select req.*,(select tenantid from eg_death_dtls dtl where req.deathdtlid=dtl.id) from eg_death_cert_request req"); + StringBuilder builder = new StringBuilder("select req.*,(select tenantid from {schema}.eg_death_dtls dtl where req.deathdtlid=dtl.id) from {schema}.eg_death_cert_request req"); if (consumerCode != null && !consumerCode.isEmpty()) { addClauseIfRequired(preparedStmtList, builder); builder.append(" deathcertificateno=? "); diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/service/DeathService.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/service/DeathService.java index b3189db3aac..804dad16ff0 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/service/DeathService.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/death/service/DeathService.java @@ -122,7 +122,7 @@ public DeathCertificate download(SearchCriteria criteria, RequestInfo requestInf deathCertificate.setEmbeddedUrl(applicationRequest.getDeathCertificate().get(0).getEmbeddedUrl()); deathCertificate.setDateofissue(applicationRequest.getDeathCertificate().get(0).getDateofissue()); deathCertificate.setFilestoreid(pdfResp.getFilestoreIds().get(0)); - repository.updateCounter(deathCertificate.getDeathDtlId()); + repository.updateCounter(deathCertificate.getDeathDtlId(), deathCertificate.getTenantId()); deathCertificate.setApplicationStatus(StatusEnum.FREE_DOWNLOAD); } @@ -137,17 +137,17 @@ public DeathCertificate download(SearchCriteria criteria, RequestInfo requestInf } public DeathCertificate getDeathCertReqByConsumerCode(SearchCriteria criteria, RequestInfo requestInfo) { - return repository.getDeathCertReqByConsumerCode(criteria.getConsumerCode(),requestInfo); + return repository.getDeathCertReqByConsumerCode(criteria.getConsumerCode(),requestInfo, criteria.getTenantId()); } - public List searchApplications(RequestInfoWrapper requestInfoWrapper) { + public List searchApplications(RequestInfoWrapper requestInfoWrapper, SearchCriteria searchCriteria) { List certApplns=null; - certApplns = repository.searchApplications(requestInfoWrapper.getRequestInfo().getUserInfo().getUuid()); + certApplns = repository.searchApplications(requestInfoWrapper.getRequestInfo().getUserInfo().getUuid(), searchCriteria.getTenantId()); for (DeathCertAppln certAppln : certApplns) { if (certAppln.getStatus().equalsIgnoreCase(StatusEnum.PAID.toString())) { try { DeathCertificate cert = repository.getDeathCertReqByConsumerCode(certAppln.getApplicationNumber(), - requestInfoWrapper.getRequestInfo()); + requestInfoWrapper.getRequestInfo(), certAppln.getTenantId()); String uuid = requestInfoWrapper.getRequestInfo().getUserInfo().getUuid(); AuditDetails auditDetails = commUtils.getAuditDetails(uuid, false); cert.getAuditDetails().setLastModifiedBy(auditDetails.getLastModifiedBy()); diff --git a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/utils/BirthDeathConstants.java b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/utils/BirthDeathConstants.java index 33a2aa6b328..535e9ba1042 100644 --- a/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/utils/BirthDeathConstants.java +++ b/municipal-services/birth-death-services/src/main/java/org/bel/birthdeath/utils/BirthDeathConstants.java @@ -164,5 +164,7 @@ public class BirthDeathConstants { public static final String UPDATE_ERROR_MESSAGE = "UPDATE_ERROR"; + public static final String TENANTID_MDC_STRING = "TENANTID"; + } diff --git a/municipal-services/birth-death-services/src/main/resources/application.properties b/municipal-services/birth-death-services/src/main/resources/application.properties index d9a0991f84a..08cac95ff0c 100644 --- a/municipal-services/birth-death-services/src/main/resources/application.properties +++ b/municipal-services/birth-death-services/src/main/resources/application.properties @@ -51,7 +51,8 @@ persister.save.death.topic=save-death-topic persister.update.death.topic=update-death-topic #kafka topics for downloading receipt -kafka.topics.receipt.create=egov.collection.payment-create +kafka.topics.receipt.create.pattern=((^[a-zA-Z]+-)?egov.collection.payment-create) + #idgen configurations egov.idgen.host=http://localhost:8088/ @@ -64,7 +65,7 @@ egov.idgen.deathapplnum.name=death_cert.receipt.id egov.idgen.deathapplnum.format=DT/CB/[cb.name]/[fy:yyyy]/[SEQ_EGOV_COMMON] #mdms configurations -egov.mdms.host=http://localhost:8094 +egov.mdms.host=http://localhost:8081 egov.mdms.search.endpoint=/egov-mdms-service/v1/_search #billing-service diff --git a/municipal-services/birth-death-services/src/main/resources/db/migrate.sh b/municipal-services/birth-death-services/src/main/resources/db/migrate.sh index 43960b25cdb..6b845ac81bb 100644 --- a/municipal-services/birth-death-services/src/main/resources/db/migrate.sh +++ b/municipal-services/birth-death-services/src/main/resources/db/migrate.sh @@ -1,3 +1,11 @@ #!/bin/sh - -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file +baseurl=$DB_URL +echo "the baseurl : $DB_URL" +schemasetter="?currentSchema=" +schemas=$SCHEMA_NAME +echo "the schemas : $schemas" +for schemaname in ${schemas//,/ } +do + echo "the schema name : ${baseurl}${schemasetter}${schemaname}" + flyway -url=${baseurl}${schemasetter}${schemaname} -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate +done diff --git a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210223101852__birth_death_services_ddl.sql b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210223101852__birth_death_services_ddl.sql index 0802cc92905..4942904ccb4 100644 --- a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210223101852__birth_death_services_ddl.sql +++ b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210223101852__birth_death_services_ddl.sql @@ -1,4 +1,4 @@ -CREATE TABLE public.eg_birth_death_hospitals +CREATE TABLE eg_birth_death_hospitals ( id character varying(64) NOT NULL, hospitalname character varying(500) NOT NULL, @@ -6,14 +6,14 @@ CREATE TABLE public.eg_birth_death_hospitals CONSTRAINT eg_birth_death_hospitals_pkey PRIMARY KEY (id) ); -CREATE SEQUENCE public.seq_eg_bnd_br_apl +CREATE SEQUENCE seq_eg_bnd_br_apl INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1; -CREATE TABLE public.eg_birth_dtls +CREATE TABLE eg_birth_dtls ( id character varying(64) NOT NULL, registrationno character varying(64) NOT NULL, @@ -38,12 +38,12 @@ CREATE TABLE public.eg_birth_dtls CONSTRAINT eg_birth_dtls_pkey PRIMARY KEY (id), CONSTRAINT eg_birth_dtls_ukey1 UNIQUE (registrationno, tenantid), CONSTRAINT eg_birth_dtls_fkey1 FOREIGN KEY (hospitalid) - REFERENCES public.eg_birth_death_hospitals (id) MATCH SIMPLE + REFERENCES eg_birth_death_hospitals (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ); -CREATE TABLE public.eg_birth_father_info +CREATE TABLE eg_birth_father_info ( id character varying(64) NOT NULL, firstname character varying(200) , @@ -63,12 +63,12 @@ CREATE TABLE public.eg_birth_father_info birthdtlid character varying(64) NOT NULL, CONSTRAINT eg_birth_father_info_pkey PRIMARY KEY (id), CONSTRAINT eg_birth_father_info_fkey1 FOREIGN KEY (birthdtlid) - REFERENCES public.eg_birth_dtls (id) MATCH SIMPLE + REFERENCES eg_birth_dtls (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ); -CREATE TABLE public.eg_birth_mother_info +CREATE TABLE eg_birth_mother_info ( id character varying(64) NOT NULL, firstname character varying(200) , @@ -88,12 +88,12 @@ CREATE TABLE public.eg_birth_mother_info birthdtlid character varying(64) NOT NULL, CONSTRAINT eg_birth_mother_info_pkey PRIMARY KEY (id), CONSTRAINT eg_birth_mother_info_fkey1 FOREIGN KEY (birthdtlid) - REFERENCES public.eg_birth_dtls (id) MATCH SIMPLE + REFERENCES eg_birth_dtls (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ); -CREATE TABLE public.eg_birth_permaddr +CREATE TABLE eg_birth_permaddr ( id character varying(64) NOT NULL, buildingno character varying(1000) , @@ -113,12 +113,12 @@ CREATE TABLE public.eg_birth_permaddr birthdtlid character varying(64) , CONSTRAINT eg_birth_permaddr_pkey PRIMARY KEY (id), CONSTRAINT eg_birth_permaddr_fkey1 FOREIGN KEY (birthdtlid) - REFERENCES public.eg_birth_dtls (id) MATCH SIMPLE + REFERENCES eg_birth_dtls (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ); -CREATE TABLE public.eg_birth_presentaddr +CREATE TABLE eg_birth_presentaddr ( id character varying(64) NOT NULL, buildingno character varying(1000) , @@ -138,12 +138,12 @@ CREATE TABLE public.eg_birth_presentaddr birthdtlid character varying(64) , CONSTRAINT eg_birth_presentaddr_pkey PRIMARY KEY (id), CONSTRAINT eg_birth_presentaddr_fkey1 FOREIGN KEY (birthdtlid) - REFERENCES public.eg_birth_dtls (id) MATCH SIMPLE + REFERENCES eg_birth_dtls (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ); -CREATE TABLE public.eg_birth_cert_request +CREATE TABLE eg_birth_cert_request ( id character varying(64) NOT NULL, birthcertificateno character varying(25) , @@ -159,12 +159,12 @@ CREATE TABLE public.eg_birth_cert_request dateofissue bigint, CONSTRAINT eg_birth_cert_request_pkey PRIMARY KEY (id), CONSTRAINT eg_birth_cert_request_fkey1 FOREIGN KEY (birthdtlid) - REFERENCES public.eg_birth_dtls (id) MATCH SIMPLE + REFERENCES eg_birth_dtls (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ); -CREATE TABLE public.eg_birth_cert_request_audit +CREATE TABLE eg_birth_cert_request_audit ( id character varying(64) NOT NULL, birthcertificateno character varying(25) , diff --git a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210303142510__birth_death_services_ddl.sql b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210303142510__birth_death_services_ddl.sql index 37c20565392..557038a0257 100644 --- a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210303142510__birth_death_services_ddl.sql +++ b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210303142510__birth_death_services_ddl.sql @@ -1,4 +1,4 @@ -CREATE TABLE public.eg_death_dtls +CREATE TABLE eg_death_dtls ( id character varying(64) NOT NULL, registrationno character varying(64) NOT NULL, @@ -29,12 +29,12 @@ CREATE TABLE public.eg_death_dtls CONSTRAINT eg_death_dtls_pkey PRIMARY KEY (id), CONSTRAINT eg_death_dtls_ukey1 UNIQUE (registrationno, tenantid), CONSTRAINT eg_death_dtls_fkey1 FOREIGN KEY (hospitalid) - REFERENCES public.eg_birth_death_hospitals (id) MATCH SIMPLE + REFERENCES eg_birth_death_hospitals (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ); -CREATE TABLE public.eg_death_father_info +CREATE TABLE eg_death_father_info ( id character varying(64) NOT NULL, firstname character varying(200) , @@ -50,12 +50,12 @@ CREATE TABLE public.eg_death_father_info deathdtlid character varying(64) NOT NULL, CONSTRAINT eg_death_father_info_pkey PRIMARY KEY (id), CONSTRAINT eg_death_father_info_fkey1 FOREIGN KEY (deathdtlid) - REFERENCES public.eg_death_dtls (id) MATCH SIMPLE + REFERENCES eg_death_dtls (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ); -CREATE TABLE public.eg_death_mother_info +CREATE TABLE eg_death_mother_info ( id character varying(64) NOT NULL, firstname character varying(200) , @@ -71,12 +71,12 @@ CREATE TABLE public.eg_death_mother_info deathdtlid character varying(64) NOT NULL, CONSTRAINT eg_death_mother_info_pkey PRIMARY KEY (id), CONSTRAINT eg_death_mother_info_fkey1 FOREIGN KEY (deathdtlid) - REFERENCES public.eg_death_dtls (id) MATCH SIMPLE + REFERENCES eg_death_dtls (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ); -CREATE TABLE public.eg_death_permaddr +CREATE TABLE eg_death_permaddr ( id character varying(64) NOT NULL, buildingno character varying(1000) , @@ -96,12 +96,12 @@ CREATE TABLE public.eg_death_permaddr deathdtlid character varying(64) , CONSTRAINT eg_death_permaddr_pkey PRIMARY KEY (id), CONSTRAINT eg_death_permaddr_fkey1 FOREIGN KEY (deathdtlid) - REFERENCES public.eg_death_dtls (id) MATCH SIMPLE + REFERENCES eg_death_dtls (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ); -CREATE TABLE public.eg_death_presentaddr +CREATE TABLE eg_death_presentaddr ( id character varying(64) NOT NULL, buildingno character varying(1000) , @@ -121,12 +121,12 @@ CREATE TABLE public.eg_death_presentaddr deathdtlid character varying(64) , CONSTRAINT eg_death_presentaddr_pkey PRIMARY KEY (id), CONSTRAINT eg_death_presentaddr_fkey1 FOREIGN KEY (deathdtlid) - REFERENCES public.eg_death_dtls (id) MATCH SIMPLE + REFERENCES eg_death_dtls (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ); -CREATE TABLE public.eg_death_spouse_info +CREATE TABLE eg_death_spouse_info ( id character varying(64) NOT NULL, firstname character varying(200) , @@ -142,12 +142,12 @@ CREATE TABLE public.eg_death_spouse_info deathdtlid character varying(64) , CONSTRAINT eg_death_spouse_info_pkey PRIMARY KEY (id), CONSTRAINT eg_death_spouse_info_fkey1 FOREIGN KEY (deathdtlid) - REFERENCES public.eg_death_dtls (id) MATCH SIMPLE + REFERENCES eg_death_dtls (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ); -CREATE TABLE public.eg_death_cert_request +CREATE TABLE eg_death_cert_request ( id character varying(64) NOT NULL, deathcertificateno character varying(25) NOT NULL, @@ -163,12 +163,12 @@ CREATE TABLE public.eg_death_cert_request dateofissue bigint, CONSTRAINT eg_death_cert_request_pkey PRIMARY KEY (id), CONSTRAINT eg_death_cert_request_fkey1 FOREIGN KEY (deathdtlid) - REFERENCES public.eg_death_dtls (id) MATCH SIMPLE + REFERENCES eg_death_dtls (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ); -CREATE TABLE public.eg_death_cert_request_audit +CREATE TABLE eg_death_cert_request_audit ( id character varying(64) NOT NULL, deathcertificateno character varying(25) NOT NULL, @@ -186,37 +186,37 @@ CREATE TABLE public.eg_death_cert_request_audit CREATE INDEX idx_eg_death_dtls_tenantid - ON public.eg_death_dtls USING btree + ON eg_death_dtls USING btree (tenantid ASC NULLS LAST) ; CREATE INDEX idx_eg_birth_dtls_tenantid - ON public.eg_birth_dtls USING btree + ON eg_birth_dtls USING btree (tenantid ASC NULLS LAST) ; CREATE INDEX idx_eg_birth_father_info_birthdtlid - ON public.eg_birth_father_info USING btree + ON eg_birth_father_info USING btree (birthdtlid ASC NULLS LAST) ; CREATE INDEX idx_eg_birth_mother_info_birthdtlid - ON public.eg_birth_mother_info USING btree + ON eg_birth_mother_info USING btree (birthdtlid ASC NULLS LAST) ; CREATE INDEX idx_eg_birth_permaddr_info_birthdtlid - ON public.eg_birth_permaddr USING btree + ON eg_birth_permaddr USING btree (birthdtlid ASC NULLS LAST) ; CREATE INDEX idx_eg_birth_presentaddr_birthdtlid - ON public.eg_birth_presentaddr USING btree + ON eg_birth_presentaddr USING btree (birthdtlid ASC NULLS LAST) ; CREATE INDEX idx_eg_death_father_info_deathdtlid - ON public.eg_death_father_info USING btree + ON eg_death_father_info USING btree (deathdtlid ASC NULLS LAST) ; CREATE INDEX idx_eg_death_mother_info_deathdtlid - ON public.eg_death_mother_info USING btree + ON eg_death_mother_info USING btree (deathdtlid ASC NULLS LAST) ; CREATE INDEX idx_eg_death_spouse_info_deathdtlid - ON public.eg_death_spouse_info USING btree + ON eg_death_spouse_info USING btree (deathdtlid ASC NULLS LAST) ; CREATE INDEX idx_eg_death_permaddr_info_deathdtlid - ON public.eg_death_permaddr USING btree + ON eg_death_permaddr USING btree (deathdtlid ASC NULLS LAST) ; CREATE INDEX idx_eg_death_presentaddr_deathdtlid - ON public.eg_death_presentaddr USING btree + ON eg_death_presentaddr USING btree (deathdtlid ASC NULLS LAST) ; \ No newline at end of file diff --git a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210331160711__birth_death_services_ddl.sql b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210331160711__birth_death_services_ddl.sql index 3374d6303b7..391ac91f923 100644 --- a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210331160711__birth_death_services_ddl.sql +++ b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210331160711__birth_death_services_ddl.sql @@ -1,4 +1,4 @@ -CREATE TABLE public.eg_birth_dtls_audit +CREATE TABLE eg_birth_dtls_audit ( operation char(1) NOT NULL, stamp timestamp NOT NULL, @@ -41,7 +41,7 @@ CREATE TRIGGER eg_birth_dtls_audit BEFORE UPDATE OR DELETE ON eg_birth_dtls FOR EACH ROW EXECUTE PROCEDURE process_eg_birth_dtls_audit(); -CREATE TABLE public.eg_birth_father_info_audit +CREATE TABLE eg_birth_father_info_audit ( operation char(1) NOT NULL, stamp timestamp NOT NULL, @@ -80,7 +80,7 @@ CREATE TRIGGER eg_birth_father_info_audit BEFORE UPDATE OR DELETE ON eg_birth_father_info FOR EACH ROW EXECUTE PROCEDURE process_eg_birth_father_info_audit(); -CREATE TABLE public.eg_birth_mother_info_audit +CREATE TABLE eg_birth_mother_info_audit ( operation char(1) NOT NULL, stamp timestamp NOT NULL, @@ -119,7 +119,7 @@ CREATE TRIGGER eg_birth_mother_info_audit BEFORE UPDATE OR DELETE ON eg_birth_mother_info FOR EACH ROW EXECUTE PROCEDURE process_eg_birth_mother_info_audit(); -CREATE TABLE public.eg_birth_permaddr_audit +CREATE TABLE eg_birth_permaddr_audit ( operation char(1) NOT NULL, stamp timestamp NOT NULL, @@ -159,7 +159,7 @@ BEFORE UPDATE OR DELETE ON eg_birth_permaddr FOR EACH ROW EXECUTE PROCEDURE process_eg_birth_permaddr_audit(); -CREATE TABLE public.eg_birth_presentaddr_audit +CREATE TABLE eg_birth_presentaddr_audit ( operation char(1) NOT NULL, stamp timestamp NOT NULL, diff --git a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210331170725__birth_death_services_ddl.sql b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210331170725__birth_death_services_ddl.sql index 19de2c60322..e593bde6bf7 100644 --- a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210331170725__birth_death_services_ddl.sql +++ b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210331170725__birth_death_services_ddl.sql @@ -1,4 +1,4 @@ -CREATE TABLE public.eg_death_dtls_audit +CREATE TABLE eg_death_dtls_audit ( operation char(1) NOT NULL, stamp timestamp NOT NULL, @@ -48,7 +48,7 @@ CREATE TRIGGER eg_death_dtls_audit BEFORE UPDATE OR DELETE ON eg_death_dtls FOR EACH ROW EXECUTE PROCEDURE process_eg_death_dtls_audit(); -CREATE TABLE public.eg_death_father_info_audit +CREATE TABLE eg_death_father_info_audit ( operation char(1) NOT NULL, stamp timestamp NOT NULL, @@ -85,7 +85,7 @@ BEFORE UPDATE OR DELETE ON eg_death_father_info FOR EACH ROW EXECUTE PROCEDURE process_eg_death_father_info_audit(); -CREATE TABLE public.eg_death_mother_info_audit +CREATE TABLE eg_death_mother_info_audit ( operation char(1) NOT NULL, stamp timestamp NOT NULL, @@ -122,7 +122,7 @@ BEFORE UPDATE OR DELETE ON eg_death_mother_info FOR EACH ROW EXECUTE PROCEDURE process_eg_death_mother_info_audit(); -CREATE TABLE public.eg_death_permaddr_audit +CREATE TABLE eg_death_permaddr_audit ( operation char(1) NOT NULL, stamp timestamp NOT NULL, @@ -162,7 +162,7 @@ CREATE TRIGGER eg_death_permaddr_audit BEFORE UPDATE OR DELETE ON eg_death_permaddr FOR EACH ROW EXECUTE PROCEDURE process_eg_death_permaddr_audit(); -CREATE TABLE public.eg_death_presentaddr_audit +CREATE TABLE eg_death_presentaddr_audit ( operation char(1) NOT NULL, stamp timestamp NOT NULL, @@ -202,7 +202,7 @@ CREATE TRIGGER eg_death_presentaddr_audit BEFORE UPDATE OR DELETE ON eg_death_presentaddr FOR EACH ROW EXECUTE PROCEDURE process_eg_death_presentaddr_audit(); -CREATE TABLE public.eg_death_spouse_info_audit +CREATE TABLE eg_death_spouse_info_audit ( operation char(1) NOT NULL, stamp timestamp NOT NULL, diff --git a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210402150810__birth_death_services_ddl.sql b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210402150810__birth_death_services_ddl.sql index 793cbf9e32e..64246f14907 100644 --- a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210402150810__birth_death_services_ddl.sql +++ b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210402150810__birth_death_services_ddl.sql @@ -1,20 +1,20 @@ -ALTER TABLE public.eg_birth_permaddr +ALTER TABLE eg_birth_permaddr ALTER COLUMN birthdtlid SET NOT NULL; -ALTER TABLE public.eg_birth_presentaddr +ALTER TABLE eg_birth_presentaddr ALTER COLUMN birthdtlid SET NOT NULL; -ALTER TABLE public.eg_birth_cert_request +ALTER TABLE eg_birth_cert_request ALTER COLUMN birthdtlid SET NOT NULL; -ALTER TABLE public.eg_death_permaddr +ALTER TABLE eg_death_permaddr ALTER COLUMN deathdtlid SET NOT NULL; -ALTER TABLE public.eg_death_presentaddr +ALTER TABLE eg_death_presentaddr ALTER COLUMN deathdtlid SET NOT NULL; -ALTER TABLE public.eg_death_spouse_info +ALTER TABLE eg_death_spouse_info ALTER COLUMN deathdtlid SET NOT NULL; -ALTER TABLE public.eg_death_cert_request +ALTER TABLE eg_death_cert_request ALTER COLUMN deathdtlid SET NOT NULL; \ No newline at end of file diff --git a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210406171810__birth_death_services_ddl.sql b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210406171810__birth_death_services_ddl.sql index a93e0b04d67..17690d1a051 100644 --- a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210406171810__birth_death_services_ddl.sql +++ b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210406171810__birth_death_services_ddl.sql @@ -1,11 +1,11 @@ alter table eg_birth_dtls drop CONSTRAINT eg_birth_dtls_fkey1 ; alter table eg_birth_dtls add CONSTRAINT eg_birth_dtls_fkey1 FOREIGN KEY (hospitalid) - REFERENCES public.eg_birth_death_hospitals (id) MATCH SIMPLE + REFERENCES eg_birth_death_hospitals (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ; alter table eg_death_dtls drop CONSTRAINT eg_death_dtls_fkey1 ; alter table eg_death_dtls add CONSTRAINT eg_death_dtls_fkey1 FOREIGN KEY (hospitalid) - REFERENCES public.eg_birth_death_hospitals (id) MATCH SIMPLE + REFERENCES eg_birth_death_hospitals (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ; \ No newline at end of file diff --git a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210407104650__birth_death_services_ddl.sql b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210407104650__birth_death_services_ddl.sql index e1a8d70c74f..fdb00b673b9 100644 --- a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210407104650__birth_death_services_ddl.sql +++ b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210407104650__birth_death_services_ddl.sql @@ -1,7 +1,7 @@ CREATE INDEX idx_eg_birth_dtls_hospitalid - ON public.eg_birth_dtls USING btree + ON eg_birth_dtls USING btree (hospitalid ASC NULLS LAST) ; CREATE INDEX idx_eg_death_dtls_hospitalid - ON public.eg_death_dtls USING btree + ON eg_death_dtls USING btree (hospitalid ASC NULLS LAST) ; diff --git a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210922125210__birth_death_services_add_source.sql b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210922125210__birth_death_services_add_source.sql index 6f6fa974bf7..36cf9bd888b 100644 --- a/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210922125210__birth_death_services_add_source.sql +++ b/municipal-services/birth-death-services/src/main/resources/db/migration/main/V20210922125210__birth_death_services_add_source.sql @@ -1,7 +1,7 @@ -ALTER TABLE public.eg_birth_cert_request ADD COLUMN source character varying(64) ; +ALTER TABLE eg_birth_cert_request ADD COLUMN source character varying(64) ; -ALTER TABLE public.eg_birth_cert_request_audit ADD COLUMN source character varying(64) ; +ALTER TABLE eg_birth_cert_request_audit ADD COLUMN source character varying(64) ; -ALTER TABLE public.eg_death_cert_request ADD COLUMN source character varying(64) ; +ALTER TABLE eg_death_cert_request ADD COLUMN source character varying(64) ; -ALTER TABLE public.eg_death_cert_request_audit ADD COLUMN source character varying(64) ; \ No newline at end of file +ALTER TABLE eg_death_cert_request_audit ADD COLUMN source character varying(64) ; diff --git a/municipal-services/bpa-calculator/CHANGELOG.md b/municipal-services/bpa-calculator/CHANGELOG.md index 6ddd214cad5..24cf31429ee 100644 --- a/municipal-services/bpa-calculator/CHANGELOG.md +++ b/municipal-services/bpa-calculator/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this module will be documented in this file. ## 1.1.1 - 2023-02-01 +## 1.1.2 - 2023-08-10 + +- Central Instance Library Integration + +## 1.1.1 - 2023-02-01 + - Transition from 1.1.1-beta version to 1.1.1 version ## 1.1.1-beta - 2022-01-13 diff --git a/municipal-services/bpa-calculator/pom.xml b/municipal-services/bpa-calculator/pom.xml index d66fe29d2ef..e4aef50161e 100644 --- a/municipal-services/bpa-calculator/pom.xml +++ b/municipal-services/bpa-calculator/pom.xml @@ -9,7 +9,7 @@ egov.bpa bpa-calculator - 1.1.1-SNAPSHOT + 1.1.2-SNAPSHOT bpa-calculator Demo project for Spring Boot @@ -43,10 +43,6 @@ spring-boot-devtools runtime - - org.springframework.boot - spring-boot-starter-web - org.springframework.kafka spring-kafka @@ -66,7 +62,7 @@ org.egov.services tracer - 2.0.0-SNAPSHOT + 2.1.0-SNAPSHOT org.projectlombok diff --git a/municipal-services/bpa-calculator/src/main/java/org/egov/bpa/calculator/config/BPACalculatorConfig.java b/municipal-services/bpa-calculator/src/main/java/org/egov/bpa/calculator/config/BPACalculatorConfig.java index fdd6f66c0fb..cf5c89f5f37 100644 --- a/municipal-services/bpa-calculator/src/main/java/org/egov/bpa/calculator/config/BPACalculatorConfig.java +++ b/municipal-services/bpa-calculator/src/main/java/org/egov/bpa/calculator/config/BPACalculatorConfig.java @@ -96,13 +96,18 @@ public class BPACalculatorConfig { //MDMS - @Value("${egov.mdms.host}") +// @Value("${egov.mdms.host}") +// private String mdmsHost; +// +// @Value("${egov.mdms.search.endpoint}") +// private String mdmsSearchEndpoint; + + @Value("${mdms.v2.host}") private String mdmsHost; - @Value("${egov.mdms.search.endpoint}") + @Value("${mdms.v2.search.endpoint}") private String mdmsSearchEndpoint; - // Kafka Topics @Value("${persister.save.bpa.calculation.topic}") private String saveTopic; diff --git a/municipal-services/bpa-calculator/src/main/resources/application.properties b/municipal-services/bpa-calculator/src/main/resources/application.properties index 7e0eb272e6e..80a34a29ab7 100644 --- a/municipal-services/bpa-calculator/src/main/resources/application.properties +++ b/municipal-services/bpa-calculator/src/main/resources/application.properties @@ -32,9 +32,10 @@ kafka.topics.update.service=update-bpa-billingslab #mdms urls -egov.mdms.host=https://dev.digit.org -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search - +#egov.mdms.host=https://dev.digit.org +#egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search #BilllingService egov.billingservice.host=https://dev.digit.org diff --git a/municipal-services/bpa-services/CHANGELOG.md b/municipal-services/bpa-services/CHANGELOG.md index a28a2dc81fd..e0ae9e662d6 100755 --- a/municipal-services/bpa-services/CHANGELOG.md +++ b/municipal-services/bpa-services/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this module will be documented in this file. +## 1.1.7 - 2023-08-10 + +- Central Instance Library Integration + ## 1.1.6 - 2023-02-01 - Transition from 1.1.6_beta version to 1.1.6 version diff --git a/municipal-services/bpa-services/pom.xml b/municipal-services/bpa-services/pom.xml index e97af74b963..0a6a0807571 100755 --- a/municipal-services/bpa-services/pom.xml +++ b/municipal-services/bpa-services/pom.xml @@ -10,7 +10,7 @@ org.egov bpa-services - 1.1.6-SNAPSHOT + 1.1.7-SNAPSHOT bpa-services @@ -73,12 +73,12 @@ org.egov.services tracer - 2.0.0-SNAPSHOT + 2.1.0-SNAPSHOT org.egov.services services-common - 1.0.1-SNAPSHOT + 1.1.1-SNAPSHOT org.projectlombok @@ -112,7 +112,12 @@ - + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + repo.egovernments.org eGov ERP Releases Repository diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/BPAApplication.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/BPAApplication.java index 01ec07e4fa2..bd8b6fd8762 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/BPAApplication.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/BPAApplication.java @@ -1,12 +1,13 @@ package org.egov.bpa; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.config.TracerConfiguration; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Import; @SpringBootApplication -@Import({ TracerConfiguration.class }) +@Import({ TracerConfiguration.class, MultiStateInstanceUtil.class }) public class BPAApplication { public static void main(String[] args) { diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/config/BPAConfiguration.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/config/BPAConfiguration.java index 31ecbfdc39a..2169a0d586f 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/config/BPAConfiguration.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/config/BPAConfiguration.java @@ -168,11 +168,17 @@ public void initialize() { private String demandSearchEndpoint; // MDMS - @Value("${egov.mdms.host}") - private String mdmsHost; +// @Value("${egov.mdms.host}") +// private String mdmsHost; +// +// @Value("${egov.mdms.search.endpoint}") +// private String mdmsEndPoint; + + @Value("${mdms.v2.host}") + private String mdmsHost; - @Value("${egov.mdms.search.endpoint}") - private String mdmsEndPoint; + @Value("${mdms.v2.search.endpoint}") + private String mdmsEndPoint; // Allowed Search Parameters @Value("${citizen.allowed.search.params}") @@ -210,8 +216,8 @@ public void initialize() { private Boolean isExternalWorkFlowEnabled; // USER EVENTS - @Value("${egov.ui.app.host}") - private String uiAppHost; + @Value("#{${egov.ui.app.host.map}}") + private Map uiAppHostMap; @Value("${egov.usr.events.create.topic}") private String saveUserEventsTopic; diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/consumer/BPAConsumer.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/consumer/BPAConsumer.java index ea5a74ed67b..7fc20662015 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/consumer/BPAConsumer.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/consumer/BPAConsumer.java @@ -3,7 +3,9 @@ import java.util.HashMap; import org.egov.bpa.service.notification.BPANotificationService; +import org.egov.bpa.util.BPAConstants; import org.egov.bpa.web.model.BPARequest; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; @@ -14,6 +16,8 @@ import lombok.extern.slf4j.Slf4j; +import static org.egov.bpa.util.BPAConstants.TENANTID_MDC_STRING; + @Slf4j @Component public class BPAConsumer { @@ -33,6 +37,10 @@ public void listen(final HashMap record, @Header(KafkaHeaders.RE log.error("Error while listening to value: " + record + " on topic: " + topic + ": " + e); } log.debug("BPA Received: " + bpaRequest.getBPA().getApplicationNo()); + String tenantId = bpaRequest.getBPA().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); notificationService.process(bpaRequest); } } diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/consumer/ReceiptConsumer.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/consumer/ReceiptConsumer.java index fab523d8f37..8aa0e47fd0f 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/consumer/ReceiptConsumer.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/consumer/ReceiptConsumer.java @@ -3,22 +3,34 @@ import java.util.HashMap; import org.egov.bpa.service.PaymentUpdateService; +import org.egov.bpa.util.BPAConstants; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.stereotype.Component; +import static org.egov.bpa.util.BPAConstants.TENANTID_MDC_STRING; + @Component public class ReceiptConsumer { private PaymentUpdateService paymentUpdateService; + + @Value("${state.level.tenant.id}") + private String stateLevelTenantID; @Autowired public ReceiptConsumer(PaymentUpdateService paymentUpdateService) { this.paymentUpdateService = paymentUpdateService; } - @KafkaListener(topics = { "${kafka.topics.receipt.create}" }) + @KafkaListener(topicPattern = "${kafka.topics.receipt.create.pattern}" ) public void listenPayments(final HashMap record) { + + // Adding in MDC so that tracer can add it in header + MDC.put(BPAConstants.TENANTID_MDC_STRING, stateLevelTenantID); + paymentUpdateService.process(record); } } diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/producer/Producer.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/producer/Producer.java index 3d2cecd8543..0a6fee29aaa 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/producer/Producer.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/producer/Producer.java @@ -1,5 +1,6 @@ package org.egov.bpa.producer; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.kafka.CustomKafkaTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -10,7 +11,11 @@ public class Producer { @Autowired private CustomKafkaTemplate kafkaTemplate; - public void push(String topic, Object value) { - kafkaTemplate.send(topic, value); + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + public void push(String tenantId, String topic, Object value) { + String updatedTopic = centralInstanceUtil.getStateSpecificTopicName(tenantId, topic); + kafkaTemplate.send(updatedTopic, value); } } diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/repository/BPARepository.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/repository/BPARepository.java index f45dcc5cdb5..5d536aad958 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/repository/BPARepository.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/repository/BPARepository.java @@ -1,8 +1,5 @@ package org.egov.bpa.repository; -import java.util.ArrayList; -import java.util.List; - import org.egov.bpa.config.BPAConfiguration; import org.egov.bpa.producer.Producer; import org.egov.bpa.repository.querybuilder.BPAQueryBuilder; @@ -11,10 +8,16 @@ import org.egov.bpa.web.model.BPARequest; import org.egov.bpa.web.model.BPASearchCriteria; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.exception.InvalidTenantIdException; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; +import java.util.ArrayList; +import java.util.List; + @Repository public class BPARepository { @@ -33,6 +36,9 @@ public class BPARepository { @Autowired private BPARowMapper rowMapper; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + /** * Pushes the request on save topic through kafka * @@ -40,7 +46,7 @@ public class BPARepository { * The bpa create request */ public void save(BPARequest bpaRequest) { - producer.push(config.getSaveTopic(), bpaRequest); + producer.push(bpaRequest.getBPA().getTenantId(),config.getSaveTopic(), bpaRequest); } /** @@ -62,10 +68,10 @@ public void update(BPARequest bpaRequest, boolean isStateUpdatable) { bpaForStatusUpdate = bpa; } if (bpaForUpdate != null) - producer.push(config.getUpdateTopic(), new BPARequest(requestInfo, bpaForUpdate)); + producer.push(bpaRequest.getBPA().getTenantId(),config.getUpdateTopic(), new BPARequest(requestInfo, bpaForUpdate)); if (bpaForStatusUpdate != null) - producer.push(config.getUpdateWorkflowTopic(), new BPARequest(requestInfo, bpaForStatusUpdate)); + producer.push(bpaRequest.getBPA().getTenantId(),config.getUpdateWorkflowTopic(), new BPARequest(requestInfo, bpaForStatusUpdate)); } @@ -79,6 +85,12 @@ public void update(BPARequest bpaRequest, boolean isStateUpdatable) { public List getBPAData(BPASearchCriteria criteria, List edcrNos) { List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getBPASearchQuery(criteria, preparedStmtList, edcrNos, false); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("EG_PT_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } List BPAData = jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); return BPAData; } @@ -93,13 +105,25 @@ public List getBPAData(BPASearchCriteria criteria, List edcrNos) { public int getBPACount(BPASearchCriteria criteria, List edcrNos) { List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getBPASearchQuery(criteria, preparedStmtList, edcrNos, true); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("EG_PT_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } int count = jdbcTemplate.queryForObject(query, preparedStmtList.toArray(), Integer.class); return count; } - + public List getBPADataForPlainSearch(BPASearchCriteria criteria, List edcrNos) { List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getBPASearchQueryForPlainSearch(criteria, preparedStmtList, edcrNos, false); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("EG_PT_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } List BPAData = jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); return BPAData; } diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/repository/querybuilder/BPAQueryBuilder.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/repository/querybuilder/BPAQueryBuilder.java index 58d7ce6853f..a5d7bd5ee16 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/repository/querybuilder/BPAQueryBuilder.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/repository/querybuilder/BPAQueryBuilder.java @@ -6,24 +6,32 @@ import org.egov.bpa.config.BPAConfiguration; import org.egov.bpa.web.model.BPASearchCriteria; +import org.egov.common.utils.MultiStateInstanceUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; +import java.util.Arrays; +import java.util.Calendar; +import java.util.List; + @Component public class BPAQueryBuilder { + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; - @Autowired - private BPAConfiguration config; + @Autowired + private BPAConfiguration config; private static final String LEFT_OUTER_JOIN_STRING = " LEFT OUTER JOIN "; - private static final String QUERY = "SELECT bpa.*,bpadoc.*,bpa.id as bpa_id,bpa.tenantid as bpa_tenantId,bpa.lastModifiedTime as " - + "bpa_lastModifiedTime,bpa.createdBy as bpa_createdBy,bpa.lastModifiedBy as bpa_lastModifiedBy,bpa.createdTime as " - + "bpa_createdTime,bpa.additionalDetails,bpa.landId as bpa_landId, bpadoc.id as bpa_doc_id, bpadoc.additionalDetails as doc_details, bpadoc.documenttype as bpa_doc_documenttype,bpadoc.filestoreid as bpa_doc_filestore" - + " FROM eg_bpa_buildingplan bpa" - + LEFT_OUTER_JOIN_STRING - + "eg_bpa_document bpadoc ON bpadoc.buildingplanid = bpa.id";; + private static final String QUERY = "SELECT bpa.*,bpadoc.*,bpa.id as bpa_id,bpa.tenantid as bpa_tenantId,bpa.lastModifiedTime as " + + "bpa_lastModifiedTime,bpa.createdBy as bpa_createdBy,bpa.lastModifiedBy as bpa_lastModifiedBy,bpa.createdTime as " + + "bpa_createdTime,bpa.additionalDetails,bpa.landId as bpa_landId, bpadoc.id as bpa_doc_id, bpadoc.additionalDetails as doc_details, bpadoc.documenttype as bpa_doc_documenttype,bpadoc.filestoreid as bpa_doc_filestore" + + " FROM eg_bpa_buildingplan bpa" + + LEFT_OUTER_JOIN_STRING + + "eg_bpa_document bpadoc ON bpadoc.buildingplanid = bpa.id";; private final String paginationWrapper = "SELECT * FROM " + "(SELECT *, DENSE_RANK() OVER (ORDER BY bpa_lastModifiedTime DESC) offset_ FROM " + "({})" @@ -42,8 +50,8 @@ public String getBPASearchQuery(BPASearchCriteria criteria, List prepare StringBuilder builder = new StringBuilder(QUERY); - if (criteria.getTenantId() != null) { - if (criteria.getTenantId().split("\\.").length == 1) { + if (criteria.getTenantId() != null) { + if (criteria.getTenantId().split("\\.").length == 1) { addClauseIfRequired(preparedStmtList, builder); builder.append(" bpa.tenantid like ?"); @@ -183,6 +191,36 @@ public String getBPASearchQuery(BPASearchCriteria criteria, List prepare return addPaginationWrapper(builder.toString(), preparedStmtList, criteria); } + + private String addCountWrapper(String query) { + return countWrapper.replace("{INTERNAL_QUERY}", query); + } + + public String getBPASearchQueryForPlainSearch(BPASearchCriteria criteria, List preparedStmtList, List edcrNos, boolean isCount) { + + StringBuilder builder = new StringBuilder(QUERY); + + if (criteria.getTenantId() != null) { + if (centralInstanceUtil.isTenantIdStateLevel(criteria.getTenantId())) { + + addClauseIfRequired(preparedStmtList, builder); + builder.append(" bpa.tenantid like ?"); + preparedStmtList.add('%' + criteria.getTenantId() + '%'); + } else { + addClauseIfRequired(preparedStmtList, builder); + builder.append(" bpa.tenantid=? "); + preparedStmtList.add(criteria.getTenantId()); + } + } + + + if(isCount) + return addCountWrapper(builder.toString()); + + return addPaginationWrapper(builder.toString(), preparedStmtList, criteria); + + } + /** * @@ -193,16 +231,12 @@ public String getBPASearchQuery(BPASearchCriteria criteria, List prepare */ private String addPaginationWrapper(String query, List preparedStmtList, BPASearchCriteria criteria) { - int limit = config.getDefaultLimit(); - int offset = config.getDefaultOffset(); - String finalQuery = paginationWrapper.replace("{}", query); + int limit = config.getDefaultLimit(); + int offset = config.getDefaultOffset(); + String finalQuery = paginationWrapper.replace("{}", query); - if(criteria.getLimit() == null && criteria.getOffset() == null) { - limit = config.getMaxSearchLimit(); - } - - if (criteria.getLimit() != null && criteria.getLimit() <= config.getMaxSearchLimit()) - limit = criteria.getLimit(); + if (criteria.getLimit() != null && criteria.getLimit() <= config.getMaxSearchLimit()) + limit = criteria.getLimit(); if (criteria.getLimit() != null && criteria.getLimit() > config.getMaxSearchLimit()) { limit = config.getMaxSearchLimit(); @@ -247,48 +281,19 @@ private void addToPreparedStatement(List preparedStmtList, List } - /** - * produce a query input for the multiple values - * @param ids - * @return - */ - private Object createQuery(List ids) { - StringBuilder builder = new StringBuilder(); - int length = ids.size(); - for (int i = 0; i < length; i++) { - builder.append(" ?"); - if (i != length - 1) - builder.append(","); - } - return builder.toString(); - } - - private String addCountWrapper(String query) { - return countWrapper.replace("{INTERNAL_QUERY}", query); - } - - public String getBPASearchQueryForPlainSearch(BPASearchCriteria criteria, List preparedStmtList, List edcrNos, boolean isCount) { - - StringBuilder builder = new StringBuilder(QUERY); - - if (criteria.getTenantId() != null) { - if (criteria.getTenantId().split("\\.").length == 1) { - - addClauseIfRequired(preparedStmtList, builder); - builder.append(" bpa.tenantid like ?"); - preparedStmtList.add('%' + criteria.getTenantId() + '%'); - } else { - addClauseIfRequired(preparedStmtList, builder); - builder.append(" bpa.tenantid=? "); - preparedStmtList.add(criteria.getTenantId()); - } - } - - - if(isCount) - return addCountWrapper(builder.toString()); - - return addPaginationWrapper(builder.toString(), preparedStmtList, criteria); - - } + /** + * produce a query input for the multiple values + * @param ids + * @return + */ + private Object createQuery(List ids) { + StringBuilder builder = new StringBuilder(); + int length = ids.size(); + for (int i = 0; i < length; i++) { + builder.append(" ?"); + if (i != length - 1) + builder.append(","); + } + return builder.toString(); + } } diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/BPAService.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/BPAService.java index 66c048e573e..13c3407909f 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/BPAService.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/BPAService.java @@ -37,6 +37,7 @@ import org.egov.bpa.workflow.WorkflowService; import org.egov.common.contract.request.RequestInfo; import org.egov.common.contract.request.Role; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -105,7 +106,9 @@ public class BPAService { @Autowired private BPAConfiguration config; - + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; /** * does all the validations required to create BPA Record in the system * @param bpaRequest @@ -113,9 +116,9 @@ public class BPAService { */ public BPA create(BPARequest bpaRequest) { RequestInfo requestInfo = bpaRequest.getRequestInfo(); - String tenantId = bpaRequest.getBPA().getTenantId().split("\\.")[0]; + String tenantId = centralInstanceUtil.getStateLevelTenant(bpaRequest.getBPA().getTenantId()); Object mdmsData = util.mDMSCall(requestInfo, tenantId); - if (bpaRequest.getBPA().getTenantId().split("\\.").length == 1) { + if (centralInstanceUtil.isTenantIdStateLevel(bpaRequest.getBPA().getTenantId())) { throw new CustomException(BPAErrorConstants.INVALID_TENANT, " Application cannot be create at StateLevel"); } @@ -143,7 +146,6 @@ public BPA create(BPARequest bpaRequest) { * applies the required vlaidation for OC on Create * @param applicationType * @param values - * @param criteria * @param requestInfo * @param bpaRequest */ @@ -241,7 +243,6 @@ public List search(BPASearchCriteria criteria, RequestInfo requestInfo) { * @param requestInfo * @param landcriteria * @param edcrNos - * @param bpas */ private List getBPACreatedForByMe(BPASearchCriteria criteria, RequestInfo requestInfo,LandSearchCriteria landcriteria,List edcrNos ) { List bpas = null; @@ -376,7 +377,7 @@ public List getBPAFromCriteria(BPASearchCriteria criteria, RequestInfo requ @SuppressWarnings("unchecked") public BPA update(BPARequest bpaRequest) { RequestInfo requestInfo = bpaRequest.getRequestInfo(); - String tenantId = bpaRequest.getBPA().getTenantId().split("\\.")[0]; + String tenantId = centralInstanceUtil.getStateLevelTenant(bpaRequest.getBPA().getTenantId()); Object mdmsData = util.mDMSCall(requestInfo, tenantId); BPA bpa = bpaRequest.getBPA(); diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/EDCRService.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/EDCRService.java index e5dcd94ca5d..d9ab361d3ae 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/EDCRService.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/EDCRService.java @@ -67,6 +67,7 @@ public Map validateEdcrPlan(BPARequest request, Object mdmsData) BPASearchCriteria criteria = new BPASearchCriteria(); criteria.setEdcrNumber(bpa.getEdcrNumber()); + criteria.setTenantId(bpa.getTenantId()); List bpas = bpaRepository.getBPAData(criteria, null); if(bpas.size()>0){ for(int i=0; i getIdList(RequestInfo requestInfo, String tenantId, String /** * enchrich the updateRequest - * + * * @param bpaRequest * @param businessService */ @@ -197,13 +202,13 @@ public void enrichBPAUpdateRequest(BPARequest bpaRequest, BusinessService busine /** * postStatus encrichment to update the status of the workflow to the * application and generating permit and oc number when applicable - * + * * @param bpaRequest */ @SuppressWarnings({ "unchecked", "rawtypes" }) public void postStatusEnrichment(BPARequest bpaRequest) { BPA bpa = bpaRequest.getBPA(); - String tenantId = bpaRequest.getBPA().getTenantId().split("\\.")[0]; + String tenantId = centralInstanceUtil.getStateLevelTenant(bpaRequest.getBPA().getTenantId()); Object mdmsData = util.mDMSCall(bpaRequest.getRequestInfo(), tenantId); BusinessService businessService = workflowService.getBusinessService(bpa, bpaRequest.getRequestInfo(), @@ -278,7 +283,7 @@ public void postStatusEnrichment(BPARequest bpaRequest) { /** * generate the permit and oc number on approval status of the BPA and BPAOC * respectively - * + * * @param bpaRequest * @param state */ @@ -287,10 +292,10 @@ private void generateApprovalNo(BPARequest bpaRequest, String state) { if ((bpa.getBusinessService().equalsIgnoreCase(BPAConstants.BPA_OC_MODULE_CODE) && bpa.getStatus().equalsIgnoreCase(BPAConstants.APPROVED_STATE)) || (!bpa.getBusinessService().equalsIgnoreCase(BPAConstants.BPA_OC_MODULE_CODE) - && ((!bpa.getRiskType().toString().equalsIgnoreCase(BPAConstants.LOW_RISKTYPE) - && state.equalsIgnoreCase(BPAConstants.APPROVED_STATE)) - || (state.equalsIgnoreCase(BPAConstants.DOCVERIFICATION_STATE) && bpa.getRiskType() - .toString().equalsIgnoreCase(BPAConstants.LOW_RISKTYPE))))) { + && ((!bpa.getRiskType().toString().equalsIgnoreCase(BPAConstants.LOW_RISKTYPE) + && state.equalsIgnoreCase(BPAConstants.APPROVED_STATE)) + || (state.equalsIgnoreCase(BPAConstants.DOCVERIFICATION_STATE) && bpa.getRiskType() + .toString().equalsIgnoreCase(BPAConstants.LOW_RISKTYPE))))) { int vailidityInMonths = config.getValidityInMonths(); Calendar calendar = Calendar.getInstance(); bpa.setApprovalDate(Calendar.getInstance().getTimeInMillis()); @@ -342,7 +347,7 @@ private void generateApprovalNo(BPARequest bpaRequest, String state) { /** * handles the skippayment of the BPA when demand is zero - * + * * @param bpaRequest */ public void skipPayment(BPARequest bpaRequest) { @@ -358,7 +363,7 @@ public void skipPayment(BPARequest bpaRequest) { /** * In case of SENDBACKTOCITIZEN enrich the assignee with the owners and creator * of BPA - * + * * @param bpa BPA to be enriched */ public void enrichAssignes(BPA bpa) { @@ -384,7 +389,7 @@ public void enrichAssignes(BPA bpa) { } else if (wf != null && (wf.getAction().equalsIgnoreCase(BPAConstants.ACTION_SEND_TO_ARCHITECT) || (bpa.getStatus().equalsIgnoreCase(BPAConstants.STATUS_CITIZEN_APPROVAL_INPROCESS) - && wf.getAction().equalsIgnoreCase(BPAConstants.ACTION_APPROVE)))) { + && wf.getAction().equalsIgnoreCase(BPAConstants.ACTION_APPROVE)))) { // Adding creator of BPA(Licensee) if (bpa.getAccountId() != null) assignes.add(bpa.getAccountId()); diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/PaymentUpdateService.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/PaymentUpdateService.java index 83752b4cfe5..04cdfcb8c38 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/PaymentUpdateService.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/PaymentUpdateService.java @@ -25,6 +25,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; +import org.slf4j.MDC; + +import static org.egov.bpa.util.BPAConstants.TENANTID_MDC_STRING; @Service @Slf4j @@ -71,6 +74,9 @@ public void process(HashMap record) { List paymentDetails = paymentRequest.getPayment().getPaymentDetails(); String tenantId = paymentRequest.getPayment().getTenantId(); + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + for (PaymentDetail paymentDetail : paymentDetails) { List businessServices = new ArrayList( diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/UserService.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/UserService.java index cc75e3884e4..b587987797b 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/UserService.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/UserService.java @@ -1,5 +1,6 @@ package org.egov.bpa.service; +import com.fasterxml.jackson.databind.ObjectMapper; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @@ -13,12 +14,15 @@ import org.egov.bpa.web.model.user.UserDetailResponse; import org.egov.bpa.web.model.user.UserSearchRequest; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import com.fasterxml.jackson.databind.ObjectMapper; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; @Service public class UserService { @@ -32,6 +36,9 @@ public class UserService { @Autowired private ObjectMapper mapper; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + public UserDetailResponse getUsersForBpas(List bpas) { UserSearchRequest userSearchRequest = new UserSearchRequest(); List ids = new ArrayList(); @@ -151,7 +158,7 @@ public UserDetailResponse getUser(BPASearchCriteria criteria, RequestInfo reques private UserSearchRequest getUserSearchRequest(BPASearchCriteria criteria, RequestInfo requestInfo) { UserSearchRequest userSearchRequest = new UserSearchRequest(); userSearchRequest.setRequestInfo(requestInfo); - userSearchRequest.setTenantId(criteria.getTenantId().split("\\.")[0]); + userSearchRequest.setTenantId(centralInstanceUtil.getStateLevelTenant(criteria.getTenantId())); userSearchRequest.setMobileNumber(criteria.getMobileNumber()); userSearchRequest.setActive(true); userSearchRequest.setUserType(BPAConstants.CITIZEN); @@ -171,7 +178,7 @@ private UserDetailResponse searchByUserName(String userName,String tenantId){ } private String getStateLevelTenant(String tenantId){ - return tenantId.split("\\.")[0]; + return centralInstanceUtil.getStateLevelTenant(tenantId); } /** diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/notification/BPANotificationService.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/notification/BPANotificationService.java index 6e87166189e..9bda3263daa 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/notification/BPANotificationService.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/notification/BPANotificationService.java @@ -18,6 +18,7 @@ import org.egov.bpa.web.model.landInfo.Source; import org.egov.bpa.web.model.user.UserDetailResponse; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.mdms.model.MasterDetail; import org.egov.mdms.model.MdmsCriteria; import org.egov.mdms.model.MdmsCriteriaReq; @@ -44,12 +45,12 @@ public class BPANotificationService { private ServiceRequestRepository serviceRequestRepository; private NotificationUtil util; - + private BPAUtil bpaUtil; @Autowired private UserService userService; - + @Autowired private BPALandService bpalandService; @@ -59,6 +60,9 @@ public class BPANotificationService { @Autowired private EDCRService edcrService; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + @Value("${egov.mdms.host}") private String mdmsHost; @@ -67,7 +71,7 @@ public class BPANotificationService { @Autowired public BPANotificationService(BPAConfiguration config, ServiceRequestRepository serviceRequestRepository, - NotificationUtil util, BPAUtil bpaUtil) { + NotificationUtil util, BPAUtil bpaUtil) { this.config = config; this.serviceRequestRepository = serviceRequestRepository; this.util = util; @@ -76,7 +80,7 @@ public BPANotificationService(BPAConfiguration config, ServiceRequestRepository /** * Creates and send the sms based on the bpaRequest - * + * * @param bpaRequest * The bpaRequest consumed on the kafka topic */ @@ -99,7 +103,7 @@ public void process(BPARequest bpaRequest) { if (config.getIsSMSEnabled()) { enrichSMSRequest(bpaRequest, smsRequests); if (!CollectionUtils.isEmpty(smsRequests)) - util.sendSMS(smsRequests, config.getIsSMSEnabled()); + util.sendSMS(smsRequests, config.getIsSMSEnabled(),""); } } } @@ -109,7 +113,7 @@ public void process(BPARequest bpaRequest) { if (config.getIsUserEventsNotificationEnabled()) { EventRequest eventRequest = getEvents(bpaRequest); if (null != eventRequest) - util.sendEventNotification(eventRequest); + util.sendEventNotification(eventRequest,""); } } } @@ -122,7 +126,7 @@ public void process(BPARequest bpaRequest) { String localizationMessages = util.getLocalizationMessages(tenantId, bpaRequest.getRequestInfo()); String message = util.getEmailCustomizedMsg(bpaRequest.getRequestInfo(), bpaRequest.getBPA(), localizationMessages); List emailRequests = util.createEmailRequest(bpaRequest, message, mapOfPhnoAndEmail,mobileNumberToOwner); - util.sendEmail(emailRequests); + util.sendEmail(emailRequests, tenantId); } } } @@ -131,9 +135,9 @@ public void process(BPARequest bpaRequest) { /** * Creates and registers an event at the egov-user-event service at defined * trigger points as that of sms notifs. - * + * * Assumption - The bpaRequest received will always contain only one BPA. - * + * * @param bpaRequest * @return */ @@ -144,7 +148,7 @@ public EventRequest getEvents(BPARequest bpaRequest) { String localizationMessages = util.getLocalizationMessages(tenantId, bpaRequest.getRequestInfo()); // --need Map edcrResponse = edcrService.getEDCRDetails(bpaRequest.getRequestInfo(), bpaRequest.getBPA()); String applicationType = edcrResponse.get(BPAConstants.APPLICATIONTYPE); - // changes. + // changes. String message = util.getEventsCustomizedMsg(bpaRequest.getRequestInfo(), bpaRequest.getBPA(), edcrResponse, localizationMessages); // --need localization service changes. BPA bpaApplication = bpaRequest.getBPA(); Map mobileNumberToOwner = getUserList(bpaRequest); @@ -174,7 +178,7 @@ public EventRequest getEvents(BPARequest bpaRequest) { String actionLink = config.getPayLink().replace("$mobile", mobile) .replace("$applicationNo", bpaApplication.getApplicationNo()) .replace("$tenantId", bpaApplication.getTenantId()).replace("$businessService", busineService); - actionLink = config.getUiAppHost() + actionLink; + actionLink = util.getUiAppHost(bpaApplication.getTenantId()) + actionLink; ActionItem item = ActionItem.builder().actionUrl(actionLink).code(config.getPayCode()).build(); items.add(item); action = Action.builder().actionUrls(items).build(); @@ -190,7 +194,7 @@ public EventRequest getEvents(BPARequest bpaRequest) { if(status.equals(APPROVED_STATE) && applicationType.equals(BUILDING_PLAN)) { List items = new ArrayList<>(); - String actionLink = config.getUiAppHost() + config.getDownloadPermitOrderLink(); + String actionLink = util.getUiAppHost(bpaRequest.getBPA().getTenantId()) + config.getDownloadPermitOrderLink(); actionLink = actionLink.replace("$applicationNo", bpaRequest.getBPA().getApplicationNo()); ActionItem item = ActionItem.builder().actionUrl(actionLink).code(USREVENTS_EVENT_DOWNLOAD_PERMIT_ORDER_CODE).build(); items.add(item); @@ -199,7 +203,7 @@ public EventRequest getEvents(BPARequest bpaRequest) { if(status.equals(APPROVED_STATE) && applicationType.equals(BUILDING_PLAN_OC)) { List items = new ArrayList<>(); - String actionLink = config.getUiAppHost() + config.getDownloadOccupancyCertificateLink(); + String actionLink = util.getUiAppHost(bpaRequest.getBPA().getTenantId()) + config.getDownloadOccupancyCertificateLink(); actionLink = actionLink.replace("$applicationNo", bpaRequest.getBPA().getApplicationNo()); ActionItem item = ActionItem.builder().actionUrl(actionLink).code(USREVENTS_EVENT_DOWNLOAD_OCCUPANCY_CERTIFICATE_CODE).build(); items.add(item); @@ -224,7 +228,7 @@ public EventRequest getEvents(BPARequest bpaRequest) { /** * Fetches UUIDs of CITIZENs based on the phone number. - * + * * @param mobileNumbers * @param requestInfo * @param tenantId @@ -260,7 +264,7 @@ private Map fetchUserUUIDs(Set mobileNumbers, RequestInf /** * Enriches the smsRequest with the customized messages - * + * * @param bpaRequest * The bpaRequest from kafka topic * @param smsRequests @@ -278,7 +282,7 @@ private void enrichSMSRequest(BPARequest bpaRequest, List smsRequest /** * To get the Users to whom we need to send the sms notifications or event * notifications. - * + * * @param bpaRequest * @return */ @@ -300,24 +304,24 @@ private Map getUserList(BPARequest bpaRequest) { mobileNumberToOwner.put(userDetailResponse.getUser().get(0).getUserName(), userDetailResponse.getUser().get(0).getName()); - + if (bpaRequest.getBPA().getLandInfo() == null) { for (int j = 0; j < landInfo.size(); j++) bpaRequest.getBPA().setLandInfo(landInfo.get(j)); } - + if (!(bpaRequest.getBPA().getWorkflow().getAction().equals(config.getActionsendtocitizen()) && bpaRequest.getBPA().getStatus().equals("INITIATED")) && !(bpaRequest.getBPA().getWorkflow().getAction().equals(config.getActionapprove()) - && bpaRequest.getBPA().getStatus().equals("INPROGRESS"))) { - + && bpaRequest.getBPA().getStatus().equals("INPROGRESS"))) { + bpaRequest.getBPA().getLandInfo().getOwners().forEach(owner -> { - if (owner.getMobileNumber() != null && owner.getIsPrimaryOwner()) { - mobileNumberToOwner.put(owner.getMobileNumber(), owner.getName()); - } + if (owner.getMobileNumber() != null && owner.getIsPrimaryOwner()) { + mobileNumberToOwner.put(owner.getMobileNumber(), owner.getName()); + } }); - + } return mobileNumberToOwner; } @@ -328,7 +332,7 @@ public List fetchChannelList(RequestInfo requestInfo, String tenantId, S uri.append(mdmsHost).append(mdmsUrl); if(StringUtils.isEmpty(tenantId)) return masterData; - MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequestForChannelList(requestInfo, tenantId.split("\\.")[0]); + MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequestForChannelList(requestInfo, centralInstanceUtil.getStateLevelTenant(tenantId)); Filter masterDataFilter = filter( where(MODULE).is(moduleName).and(ACTION).is(action) diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/notification/PaymentNotificationService.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/notification/PaymentNotificationService.java index e6b4daf49a5..7440baf5c2f 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/notification/PaymentNotificationService.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/service/notification/PaymentNotificationService.java @@ -1,22 +1,17 @@ package org.egov.bpa.service.notification; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import com.fasterxml.jackson.databind.ObjectMapper; +import com.jayway.jsonpath.DocumentContext; +import com.jayway.jsonpath.JsonPath; import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; import org.apache.commons.lang.StringUtils; import org.egov.bpa.config.BPAConfiguration; import org.egov.bpa.service.BPAService; import org.egov.bpa.util.BPAConstants; import org.egov.bpa.util.BPAErrorConstants; import org.egov.bpa.util.NotificationUtil; -import org.egov.bpa.web.model.BPA; -import org.egov.bpa.web.model.BPARequest; -import org.egov.bpa.web.model.BPASearchCriteria; -import org.egov.bpa.web.model.EventRequest; -import org.egov.bpa.web.model.SMSRequest; +import org.egov.bpa.web.model.*; import org.egov.common.contract.request.RequestInfo; import org.egov.tracer.model.CustomException; import org.json.JSONObject; @@ -24,11 +19,10 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.DocumentContext; -import com.jayway.jsonpath.JsonPath; - -import net.minidev.json.JSONArray; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; @Service @Slf4j @@ -92,7 +86,7 @@ public void process(HashMap record) { return; Map info = documentContext.read("$.RequestInfo"); RequestInfo requestInfo = mapper.convertValue(info, RequestInfo.class); - + String tenantId = valMap.get(tenantIdKey); if (config.getBusinessService().contains(valMap.get(businessServiceKey))) { BPA bpa = getBPAFromConsumerCode(valMap.get(tenantIdKey), valMap.get(consumerCodeKey), requestInfo, valMap.get(businessServiceKey)); @@ -111,14 +105,14 @@ public void process(HashMap record) { BPARequest bpaRequestMsg = BPARequest.builder().requestInfo(requestInfo).BPA(bpa).build(); smsList.addAll(util.createSMSRequest(bpaRequestMsg,message, mobileNumberToOwner)); - util.sendSMS(smsList, config.getIsSMSEnabled()); + util.sendSMS(smsList, config.getIsSMSEnabled(), tenantId); if (null != config.getIsUserEventsNotificationEnabled()) { if (config.getIsUserEventsNotificationEnabled()) { BPARequest bpaRequest = BPARequest.builder().requestInfo(requestInfo).BPA(bpa).build(); EventRequest eventRequest = bpaNotificationService.getEvents(bpaRequest); if (null != eventRequest) - util.sendEventNotification(eventRequest); + util.sendEventNotification(eventRequest, tenantId); } } } diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/util/BPAConstants.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/util/BPAConstants.java index e6374ad2699..0b6fa0b3da0 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/util/BPAConstants.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/util/BPAConstants.java @@ -389,6 +389,9 @@ public class BPAConstants { public static final String DOWNLOAD_PERMIT_LINK_PLACEHOLDER = "{DOWNLOAD_PERMIT_LINK}"; public static final String PAYMENT_LINK_PLACEHOLDER = "{PAYMENT_LINK}"; + + public static final String TENANTID_MDC_STRING = "TENANTID"; + } diff --git a/municipal-services/bpa-services/src/main/java/org/egov/bpa/util/NotificationUtil.java b/municipal-services/bpa-services/src/main/java/org/egov/bpa/util/NotificationUtil.java index cce498097df..2b244976bde 100755 --- a/municipal-services/bpa-services/src/main/java/org/egov/bpa/util/NotificationUtil.java +++ b/municipal-services/bpa-services/src/main/java/org/egov/bpa/util/NotificationUtil.java @@ -13,6 +13,7 @@ import org.egov.bpa.web.model.collection.PaymentResponse; import org.egov.bpa.web.model.user.UserDetailResponse; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.model.CustomException; import org.json.JSONArray; import org.json.JSONObject; @@ -33,18 +34,18 @@ public class NotificationUtil { private static final String STAKEHOLDER_TYPE = "{STAKEHOLDER_TYPE}"; - private static final String STAKEHOLDER_NAME = "{STAKEHOLDER_NAME}"; + private static final String STAKEHOLDER_NAME = "{STAKEHOLDER_NAME}"; - private static final String AMOUNT_TO_BE_PAID = "{AMOUNT_TO_BE_PAID}"; + private static final String AMOUNT_TO_BE_PAID = "{AMOUNT_TO_BE_PAID}"; - private BPAConfiguration config; + private BPAConfiguration config; private ServiceRequestRepository serviceRequestRepository; private Producer producer; - + private EDCRService edcrService; - + private BPAUtil bpaUtil; private RestTemplate restTemplate; @@ -55,10 +56,13 @@ public class NotificationUtil { @Autowired private ObjectMapper mapper; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + @Autowired public NotificationUtil(BPAConfiguration config, ServiceRequestRepository serviceRequestRepository, - Producer producer, EDCRService edcrService, BPAUtil bpaUtil) { + Producer producer, EDCRService edcrService, BPAUtil bpaUtil) { this.config = config; this.serviceRequestRepository = serviceRequestRepository; this.producer = producer; @@ -75,7 +79,7 @@ public NotificationUtil(BPAConfiguration config, ServiceRequestRepository servic /** * Creates customized message based on bpa - * + * * @param bpa * The bpa for which message is to be sent * @param localizationMessage @@ -86,7 +90,7 @@ public NotificationUtil(BPAConfiguration config, ServiceRequestRepository servic public String getCustomizedMsg(RequestInfo requestInfo, BPA bpa, String localizationMessage) { String message = null, messageTemplate; Map edcrResponse = edcrService.getEDCRDetails(requestInfo, bpa); - + String applicationType = edcrResponse.get(BPAConstants.APPLICATIONTYPE); String serviceType = edcrResponse.get(BPAConstants.SERVICETYPE); @@ -121,7 +125,7 @@ public String getEventsCustomizedMsg(RequestInfo requestInfo, BPA bpa, Map= 2) @@ -235,7 +239,7 @@ public StringBuilder getUri(String tenantId, RequestInfo requestInfo) { /** * Fetches messages from localization service - * + * * @param tenantId * tenantId of the BPA * @param requestInfo @@ -253,7 +257,7 @@ public String getLocalizationMessages(String tenantId, RequestInfo requestInfo) /** * Creates customized message for initiate - * + * * @param bpa * tenantId of the bpa * @param message @@ -273,16 +277,16 @@ private String getInitiatedMsg(BPA bpa, String message, String serviceType) { /** * Send the SMSRequest on the SMSNotification kafka topic - * + * * @param smsRequestList * The list of SMSRequest to be sent */ - public void sendSMS(List smsRequestList, boolean isSMSEnabled) { + public void sendSMS(List smsRequestList, boolean isSMSEnabled, String tenantId) { if (isSMSEnabled) { if (CollectionUtils.isEmpty(smsRequestList)) log.info("Messages from localization couldn't be fetched!"); for (SMSRequest smsRequest : smsRequestList) { - producer.push(config.getSmsNotifTopic(), smsRequest); + producer.push(tenantId,config.getSmsNotifTopic(), smsRequest); log.debug("MobileNumber: " + smsRequest.getMobileNumber() + " Messages: " + smsRequest.getMessage()); } log.info("SMS notifications sent!"); @@ -291,7 +295,7 @@ public void sendSMS(List smsRequestList, bool /** * Creates sms request for the each owners - * + * * @param message * The message for the specific bpa * @param mobileNumberToOwner @@ -311,7 +315,7 @@ public List createSMSRequest(BPARequest bpaRequest,String message, M if (customizedMsg.contains(PAYMENT_LINK_PLACEHOLDER)) { BPA bpa = bpaRequest.getBPA(); String busineService = bpaUtil.getFeeBusinessSrvCode(bpa); - String link = config.getUiAppHost() + config.getPayLink() + String link = getUiAppHost(bpa.getTenantId()) + config.getPayLink() .replace("$applicationNo", bpa.getApplicationNo()).replace("$mobile", entryset.getKey()) .replace("$tenantId", bpa.getTenantId()).replace("$businessService", busineService); link = getShortnerURL(link); @@ -321,15 +325,15 @@ public List createSMSRequest(BPARequest bpaRequest,String message, M } return smsRequest; } - - + + /** * Pushes the event request to Kafka Queue. - * + * * @param request */ - public void sendEventNotification(EventRequest request) { - producer.push(config.getSaveUserEventsTopic(), request); + public void sendEventNotification(EventRequest request, String tenantId) { + producer.push(tenantId,config.getSaveUserEventsTopic(), request); log.debug("STAKEHOLDER:: " + request.getEvents().get(0).getDescription()); } @@ -367,33 +371,129 @@ public String getEmailCustomizedMsg(RequestInfo requestInfo, BPA bpa, String loc } return message; } - public String getStakeHolderDetailsReplaced(RequestInfo requestInfo, BPA bpa, String message) - { - String stakeUUID = bpa.getAuditDetails().getCreatedBy(); - List ownerId = new ArrayList(); - ownerId.add(stakeUUID); - BPASearchCriteria bpaSearchCriteria = new BPASearchCriteria(); - bpaSearchCriteria.setOwnerIds(ownerId); - bpaSearchCriteria.setTenantId(bpa.getTenantId()); - UserDetailResponse userDetailResponse = userService.getUser(bpaSearchCriteria,requestInfo); - if(message.contains(STAKEHOLDER_TYPE)) - {message = message.replace(STAKEHOLDER_TYPE, userDetailResponse.getUser().get(0).getType());} - if(message.contains(STAKEHOLDER_NAME)) - {message = message.replace(STAKEHOLDER_NAME, userDetailResponse.getUser().get(0).getName());} - - return message; + + /** + * Send the EmailRequest on the EmailNotification kafka topic + * + * @param emailRequestList + * The list of EmailRequest to be sent + */ + public void sendEmail(List emailRequestList) { + + if (config.getIsEmailNotificationEnabled()) { + if (CollectionUtils.isEmpty(emailRequestList)) + log.info("Messages from localization couldn't be fetched!"); + for (EmailRequest emailRequest : emailRequestList) { + producer.push("",config.getEmailNotifTopic(), emailRequest); + log.info("Email Request -> "+emailRequest.toString()); + log.info("EMAIL notification sent!"); + } + } + } + + public String getRecepitDownloadLink(BPARequest bpaRequest, String mobileno) { + + String receiptNumber = getReceiptNumber(bpaRequest); + String consumerCode; + consumerCode = bpaRequest.getBPA().getApplicationNo(); + String link = getUiAppHost(bpaRequest.getBPA().getTenantId()) + config.getReceiptDownloadLink(); + link = link.replace("$consumerCode", consumerCode); + link = link.replace("$tenantId", bpaRequest.getBPA().getTenantId()); + link = link.replace("$businessService", bpaRequest.getBPA().getBusinessService()); + link = link.replace("$receiptNumber", receiptNumber); + link = link.replace("$mobile", mobileno); + link = getShortnerURL(link); + log.info(link); + return link; + } + + public String getReceiptNumber(BPARequest bpaRequest){ + String consumerCode,service; + + consumerCode = bpaRequest.getBPA().getApplicationNo(); + service = bpaUtil.getFeeBusinessSrvCode(bpaRequest.getBPA()); + + StringBuilder URL = getcollectionURL(); + URL.append(service).append("/_search").append("?").append("consumerCodes=").append(consumerCode) + .append("&").append("tenantId=").append(bpaRequest.getBPA().getTenantId()); + RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(bpaRequest.getRequestInfo()).build(); + Object response = serviceRequestRepository.fetchResult(URL,requestInfoWrapper); + PaymentResponse paymentResponse = mapper.convertValue(response, PaymentResponse.class); + return paymentResponse.getPayments().get(0).getPaymentDetails().get(0).getReceiptNumber(); + } + + public StringBuilder getcollectionURL() { + StringBuilder builder = new StringBuilder(); + return builder.append(config.getCollectionHost()).append(config.getPaymentSearch()); + } + + public String getLinksReplaced(String message, BPA bpa) + { + if (message.contains(DOWNLOAD_OC_LINK_PLACEHOLDER)) { + String link = getUiAppHost(bpa.getTenantId()) + config.getDownloadOccupancyCertificateLink(); + link = link.replace("$applicationNo", bpa.getApplicationNo()); + link = getShortnerURL(link); + message = message.replace(DOWNLOAD_OC_LINK_PLACEHOLDER, link); + } + + if (message.contains(DOWNLOAD_PERMIT_LINK_PLACEHOLDER)) { + String link = getUiAppHost(bpa.getTenantId()) + config.getDownloadPermitOrderLink(); + link = link.replace("$applicationNo", bpa.getApplicationNo()); + link = getShortnerURL(link); + message = message.replace(DOWNLOAD_PERMIT_LINK_PLACEHOLDER, link); + } + + return message; + } + + public String getLinksRemoved(String message, BPA bpa) + { + if (message.contains(DOWNLOAD_OC_LINK_PLACEHOLDER)) { + message = message.replace(DOWNLOAD_OC_LINK_PLACEHOLDER, ""); } - private String getReplacedMessage(BPA bpa, String message,String serviceType) { + if (message.contains(DOWNLOAD_PERMIT_LINK_PLACEHOLDER)) { + message = message.replace(DOWNLOAD_PERMIT_LINK_PLACEHOLDER, ""); + } + + if (message.contains("{RECEIPT_LINK}")) { + message = message.replace("{RECEIPT_LINK}", ""); + } + + if (message.contains("{PAYMENT_LINK}")) { + message = message.replace("{PAYMENT_LINK}", ""); + } + + return message; + } + + public String getStakeHolderDetailsReplaced(RequestInfo requestInfo, BPA bpa, String message) + { + String stakeUUID = bpa.getAuditDetails().getCreatedBy(); + List ownerId = new ArrayList(); + ownerId.add(stakeUUID); + BPASearchCriteria bpaSearchCriteria = new BPASearchCriteria(); + bpaSearchCriteria.setOwnerIds(ownerId); + bpaSearchCriteria.setTenantId(bpa.getTenantId()); + UserDetailResponse userDetailResponse = userService.getUser(bpaSearchCriteria,requestInfo); + if(message.contains(STAKEHOLDER_TYPE)) + {message = message.replace(STAKEHOLDER_TYPE, userDetailResponse.getUser().get(0).getType());} + if(message.contains(STAKEHOLDER_NAME)) + {message = message.replace(STAKEHOLDER_NAME, userDetailResponse.getUser().get(0).getName());} + + return message; + } + + private String getReplacedMessage(BPA bpa, String message,String serviceType) { if("NEW_CONSTRUCTION".equals(serviceType)) message = message.replace("{2}", "New Construction"); else message = message.replace("{2}", serviceType); - message = message.replace("{3}", bpa.getApplicationNo()); + message = message.replace("{3}", bpa.getApplicationNo()); message = message.replace("{Ulb Name}", capitalize(bpa.getTenantId().split("\\.")[1])); - message = message.replace("{PORTAL_LINK}",config.getUiAppHost()); + message = message.replace("{PORTAL_LINK}",getUiAppHost(bpa.getTenantId())); //CCC - Designaion configurable according to ULB // message = message.replace("CCC",""); return message; @@ -414,10 +514,10 @@ public List createEmailRequest(BPARequest bpaRequest,String messag if (customizedMsg.contains(PAYMENT_LINK_PLACEHOLDER)) { BPA bpa = bpaRequest.getBPA(); String busineService = bpaUtil.getFeeBusinessSrvCode(bpa); - String link = config.getUiAppHost() + config.getPayLink() + String link = getUiAppHost(bpa.getTenantId()) + config.getPayLink() .replace("$applicationNo", bpa.getApplicationNo()).replace("$mobile", entryset.getKey()) .replace("$tenantId", bpa.getTenantId()).replace("$businessService", busineService); - link = getShortnerURL(link); + link = getShortnerURL(link); customizedMsg = customizedMsg.replace(PAYMENT_LINK_PLACEHOLDER, link); } String subject = customizedMsg.substring(customizedMsg.indexOf("

")+4,customizedMsg.indexOf("

")); @@ -435,13 +535,13 @@ public List createEmailRequest(BPARequest bpaRequest,String messag * @param emailRequestList * The list of EmailRequest to be sent */ - public void sendEmail(List emailRequestList) { + public void sendEmail(List emailRequestList, String tenantId) { if (config.getIsEmailNotificationEnabled()) { if (CollectionUtils.isEmpty(emailRequestList)) log.info("Messages from localization couldn't be fetched!"); for (EmailRequest emailRequest : emailRequestList) { - producer.push(config.getEmailNotifTopic(), emailRequest); + producer.push(tenantId, config.getEmailNotifTopic(), emailRequest); log.info("Email Request -> "+emailRequest.toString()); log.info("EMAIL notification sent!"); } @@ -486,42 +586,6 @@ public Map fetchUserEmailIds(Set mobileNumbers, RequestI return mapOfPhnoAndEmailIds; } - public String getRecepitDownloadLink(BPARequest bpaRequest, String mobileno) { - - String receiptNumber = getReceiptNumber(bpaRequest); - String consumerCode; - consumerCode = bpaRequest.getBPA().getApplicationNo(); - String link = config.getUiAppHost() + config.getReceiptDownloadLink(); - link = link.replace("$consumerCode", consumerCode); - link = link.replace("$tenantId", bpaRequest.getBPA().getTenantId()); - link = link.replace("$businessService", bpaRequest.getBPA().getBusinessService()); - link = link.replace("$receiptNumber", receiptNumber); - link = link.replace("$mobile", mobileno); - link = getShortnerURL(link); - log.info(link); - return link; - } - - public String getReceiptNumber(BPARequest bpaRequest){ - String consumerCode,service; - - consumerCode = bpaRequest.getBPA().getApplicationNo(); - service = bpaUtil.getFeeBusinessSrvCode(bpaRequest.getBPA()); - - StringBuilder URL = getcollectionURL(); - URL.append(service).append("/_search").append("?").append("consumerCodes=").append(consumerCode) - .append("&").append("tenantId=").append(bpaRequest.getBPA().getTenantId()); - RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(bpaRequest.getRequestInfo()).build(); - Object response = serviceRequestRepository.fetchResult(URL,requestInfoWrapper); - PaymentResponse paymentResponse = mapper.convertValue(response, PaymentResponse.class); - return paymentResponse.getPayments().get(0).getPaymentDetails().get(0).getReceiptNumber(); - } - - public StringBuilder getcollectionURL() { - StringBuilder builder = new StringBuilder(); - return builder.append(config.getCollectionHost()).append(config.getPaymentSearch()); - } - public String getShortnerURL(String actualURL) { net.minidev.json.JSONObject obj = new net.minidev.json.JSONObject(); obj.put(URL, actualURL); @@ -531,44 +595,10 @@ public String getShortnerURL(String actualURL) { return response.toString(); } - public String getLinksReplaced(String message, BPA bpa) - { - if (message.contains(DOWNLOAD_OC_LINK_PLACEHOLDER)) { - String link = config.getUiAppHost() + config.getDownloadOccupancyCertificateLink(); - link = link.replace("$applicationNo", bpa.getApplicationNo()); - link = getShortnerURL(link); - message = message.replace(DOWNLOAD_OC_LINK_PLACEHOLDER, link); - } - - if (message.contains(DOWNLOAD_PERMIT_LINK_PLACEHOLDER)) { - String link = config.getUiAppHost() + config.getDownloadPermitOrderLink(); - link = link.replace("$applicationNo", bpa.getApplicationNo()); - link = getShortnerURL(link); - message = message.replace(DOWNLOAD_PERMIT_LINK_PLACEHOLDER, link); - } - - return message; - } - - public String getLinksRemoved(String message, BPA bpa) + public String getUiAppHost(String tenantId) { - if (message.contains(DOWNLOAD_OC_LINK_PLACEHOLDER)) { - message = message.replace(DOWNLOAD_OC_LINK_PLACEHOLDER, ""); - } - - if (message.contains(DOWNLOAD_PERMIT_LINK_PLACEHOLDER)) { - message = message.replace(DOWNLOAD_PERMIT_LINK_PLACEHOLDER, ""); - } - - if (message.contains("{RECEIPT_LINK}")) { - message = message.replace("{RECEIPT_LINK}", ""); - } - - if (message.contains("{PAYMENT_LINK}")) { - message = message.replace("{PAYMENT_LINK}", ""); - } - - return message; + String stateLevelTenantId = centralInstanceUtil.getStateLevelTenant(tenantId); + return config.getUiAppHostMap().get(stateLevelTenantId); } public String getApplicationDetailsPageLink(BPARequest bpaRequest, String mobileno) { @@ -576,11 +606,11 @@ public String getApplicationDetailsPageLink(BPARequest bpaRequest, String mobile String receiptNumber = getReceiptNumber(bpaRequest); String applicationNo; applicationNo = bpaRequest.getBPA().getApplicationNo(); - String link = config.getUiAppHost() + config.getApplicationDetailsLink(); + String link = getUiAppHost(bpaRequest.getBPA().getTenantId()) + config.getApplicationDetailsLink(); link = link.replace("$applicationNo", applicationNo); link = getShortnerURL(link); log.info(link); return link; } -} +} \ No newline at end of file diff --git a/municipal-services/bpa-services/src/main/resources/application.properties b/municipal-services/bpa-services/src/main/resources/application.properties index 22004251b51..d06fad24f60 100755 --- a/municipal-services/bpa-services/src/main/resources/application.properties +++ b/municipal-services/bpa-services/src/main/resources/application.properties @@ -102,9 +102,12 @@ egov.idgen.bpa.permitNum.name=bpa.permitnumber egov.idgen.bpa.permitNum.format=PB-BP-[cy:yyyy-MM-dd]-[SEQ_EG_BP_PN] #mdms urls -egov.mdms.host=https://dev.digit.org -#dev -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +#egov.mdms.host=https://dev.digit.org +##dev +#egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search + #local #egov.mdms.search.endpoint=/egov-mdms-service-test/v1/_search #Pagination @@ -123,6 +126,7 @@ egov.ownershipcategory.institutional=INSTITUTIONAL #Receipt kafka.topics.receipt.create=egov.collection.payment-create +kafka.topics.receipt.create.pattern=((^[a-zA-Z]+-)?egov.collection.payment-create) egov.receipt.businessservice=BPA.NC_SAN_FEE,BPA.NC_APP_FEE,BPA.LOW_RISK_PERMIT_FEE,BPA.NC_OC_APP_FEE,BPA.NC_OC_SAN_FEE #Property @@ -173,7 +177,7 @@ egov.tl.min.period=2592000000 #userevents egov.user.event.notification.enabled=true -egov.ui.app.host=https://dev.digit.org +egov.ui.app.host.map={"in":"https://central-instance.digit.org","in.statea":"https://statea.digit.org","pb":"https://dev.digit.org/"} egov.usr.events.create.topic=persist-user-events-async egov.usr.events.pay.link=citizen/otpLogin?mobileNo=$mobile&redirectTo=egov-common/pay?consumerCode=$applicationNo&tenantId=$tenantId&businessService=$businessService egov.usr.events.pay.code=PAY @@ -222,4 +226,10 @@ egov.shortener.url=egov-url-shortening/shortener egov.download.receipt.link=citizen/otpLogin?mobileNo=$mobile&redirectTo=egov-common/download-receipt?status=success&consumerCode=$consumerCode&tenantId=$tenantId&receiptNumber=$receiptNumber&businessService=$businessService&smsLink=true&mobileNo=$mobile egov.download.permit.order.link=digit-ui/citizen/obps/bpa/$applicationNo egov.download.occupancy.certificate.link=digit-ui/citizen/obps/bpa/$applicationNo -egov.bpa.application.details.link=digit-ui/citizen/obps/bpa/$applicationNo \ No newline at end of file +egov.bpa.application.details.link=digit-ui/citizen/obps/bpa/$applicationNo + +# central instance +state.level.tenantid.length=2 +is.environment.central.instance=false +state.level.tenant.id=in.stateb + diff --git a/municipal-services/echallan-calculator/CHANGELOG.md b/municipal-services/echallan-calculator/CHANGELOG.md index 26b9f7087d2..b2df8d8a2f5 100644 --- a/municipal-services/echallan-calculator/CHANGELOG.md +++ b/municipal-services/echallan-calculator/CHANGELOG.md @@ -8,6 +8,17 @@ All notable changes to this module will be documented in this file. ## 1.0.2-beta - 2022-01-13 - Updated to log4j2 version 2.17.1 +## 1.0.3 - 2023-08-10 + +- Central Instance Library Integration + +## 1.0.2 - 2023-02-01 + +- Transition from 1.0.2-beta version to 1.0.2 version + +## 1.0.2-beta - 2022-01-13 +- Updated to log4j2 version 2.17.1 + ## 1.0.1 - 2021-07-26 - RAIN-3169: Added cancel bill api call on challan cancellation diff --git a/municipal-services/echallan-calculator/pom.xml b/municipal-services/echallan-calculator/pom.xml index 3b759ea0d80..31c29bc1e16 100644 --- a/municipal-services/echallan-calculator/pom.xml +++ b/municipal-services/echallan-calculator/pom.xml @@ -9,7 +9,7 @@ org.egov echallan-calculator - 1.0.2-SNAPSHOT + 1.0.3-SNAPSHOT echallan-calculator 2.17.1 @@ -59,7 +59,7 @@ org.egov.services tracer - 2.0.0-SNAPSHOT + 2.1.0-SNAPSHOT org.egov.services diff --git a/municipal-services/echallan-calculator/src/main/java/org/egov/echallancalculation/config/ChallanConfiguration.java b/municipal-services/echallan-calculator/src/main/java/org/egov/echallancalculation/config/ChallanConfiguration.java index 5b79d44a1d2..ded7d6daedf 100644 --- a/municipal-services/echallan-calculator/src/main/java/org/egov/echallancalculation/config/ChallanConfiguration.java +++ b/municipal-services/echallan-calculator/src/main/java/org/egov/echallancalculation/config/ChallanConfiguration.java @@ -132,10 +132,16 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM private Boolean isLocalizationStateLevel; //MDMS - @Value("${egov.mdms.host}") +// @Value("${egov.mdms.host}") +// private String mdmsHost; +// +// @Value("${egov.mdms.search.endpoint}") +// private String mdmsEndPoint; + + @Value("${mdms.v2.host}") private String mdmsHost; - @Value("${egov.mdms.search.endpoint}") + @Value("${mdms.v2.search.endpoint}") private String mdmsEndPoint; @Value("${is.external.workflow.enabled}") diff --git a/municipal-services/echallan-calculator/src/main/resources/application.properties b/municipal-services/echallan-calculator/src/main/resources/application.properties index 3447081d627..d7c503740f7 100644 --- a/municipal-services/echallan-calculator/src/main/resources/application.properties +++ b/municipal-services/echallan-calculator/src/main/resources/application.properties @@ -76,8 +76,10 @@ egov.idgen.challanNum.name=echallan.aplnumber egov.idgen.challanNum.format=CB-CH-[cy:yyyy-MM-dd]-[SEQ_EG_TL_APL] #mdms urls -egov.mdms.host=https://13.71.65.215.nip.io/ -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +#egov.mdms.host=https://13.71.65.215.nip.io/ +#egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search egov.billingservice.host=http://localhost:8081 egov.bill.gen.endpoint=/billing-service/bill/v2/_fetchbill diff --git a/municipal-services/echallan-services/CHANGELOG.md b/municipal-services/echallan-services/CHANGELOG.md index 36384365a98..73360262fa2 100644 --- a/municipal-services/echallan-services/CHANGELOG.md +++ b/municipal-services/echallan-services/CHANGELOG.md @@ -15,6 +15,24 @@ All notable changes to this module will be documented in this file. ## 1.0.4 - 2022-01-13 - Updated to log4j2 version 2.17.1 +## 1.1.1 - 2023-08-10 + +- Central Instance Library Integration + +## 1.1.0 - 2023-02-01 + +- Transition from 1.1.0-beta version to 1.1.0 version + +## 1.1.0-beta - 2022-08-03 +- Added channel based notification + +## 1.0.5 - 2022-03-03 +- Removed unnecessary validation for invalid access. +- Added receipt number based search feature. + +## 1.0.4 - 2022-01-13 +- Updated to log4j2 version 2.17.1 + ## 1.0.3 - 2021-07-26 - Added _count API diff --git a/municipal-services/echallan-services/pom.xml b/municipal-services/echallan-services/pom.xml index 635b31e7bc6..08a2bbe7946 100644 --- a/municipal-services/echallan-services/pom.xml +++ b/municipal-services/echallan-services/pom.xml @@ -9,7 +9,7 @@ org.egov echallan-services - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT echallan-services 2.17.1 @@ -68,15 +68,14 @@ org.egov.services - tracer - 2.0.0-SNAPSHOT + services-common + 1.1.1-SNAPSHOT org.egov.services - services-common - 1.0.1-SNAPSHOT + tracer + 2.1.2-SNAPSHOT - org.projectlombok lombok @@ -93,25 +92,20 @@ org.egov mdms-client - 0.0.2-SNAPSHOT + 0.0.4-SNAPSHOT - + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + repo.egovernments.org eGov ERP Releases Repository https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ - - repo.egovernments.org.snapshots - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ - - - repo.egovernments.org.public - eGov Public Repository Group - https://nexus-repo.egovernments.org/nexus/content/groups/public/ - src/main/java diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/EchallanMain.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/EchallanMain.java index 6dc39773211..6dada84a7d9 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/EchallanMain.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/EchallanMain.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.config.TracerConfiguration; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; @@ -16,7 +17,7 @@ @SpringBootApplication @Component -@Import({ TracerConfiguration.class }) +@Import({ TracerConfiguration.class, MultiStateInstanceUtil.class }) public class EchallanMain { @Value("${app.timezone}") diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/config/ChallanConfiguration.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/config/ChallanConfiguration.java index 005d29691fc..de72e6f2053 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/config/ChallanConfiguration.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/config/ChallanConfiguration.java @@ -11,6 +11,7 @@ import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; +import java.util.Map; import java.util.TimeZone; @@ -125,12 +126,18 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM private Boolean isLocalizationStateLevel; //MDMS - @Value("${egov.mdms.host}") +// @Value("${egov.mdms.host}") +// private String mdmsHost; +// +// @Value("${egov.mdms.search.endpoint}") +// private String mdmsEndPoint; + + @Value("${mdms.v2.host}") private String mdmsHost; - @Value("${egov.mdms.search.endpoint}") + @Value("${mdms.v2.search.endpoint}") private String mdmsEndPoint; - + @Value("${is.external.workflow.enabled}") private Boolean isExternalWorkFlowEnabled; @@ -195,6 +202,9 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM @Value("${state.level.tenant.id}") public String stateLevelTenantId; + @Value("#{${egov.ui.app.host.map}}") + private Map uiAppHostMap; + //collection @Value("${egov.collection.service.host}") private String collectionServiceHost; diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/CancelReceiptConsumer.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/CancelReceiptConsumer.java index f5f122fd3d4..0c829b4e698 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/CancelReceiptConsumer.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/CancelReceiptConsumer.java @@ -1,10 +1,15 @@ package org.egov.echallan.consumer; +import static org.egov.echallan.util.ChallanConstants.TENANTID_MDC_STRING; + import java.util.HashMap; import org.egov.echallan.config.ChallanConfiguration; import org.egov.echallan.repository.ChallanRepository; +import org.egov.echallan.util.ChallanConstants; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; import org.springframework.messaging.handler.annotation.Header; @@ -16,17 +21,24 @@ @Slf4j public class CancelReceiptConsumer { + @Value("${state.level.tenant.id}") + private String stateLevelTenantID; + @Autowired private ChallanRepository challanRepository; @Autowired private ChallanConfiguration config; - - @KafkaListener(topics = {"${kafka.topics.receipt.cancel.name}"}) + + @KafkaListener(topicPattern = "${kafka.topics.receipt.cancel.pattern}") public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try { - if (config.getReceiptCancelTopic().equalsIgnoreCase(topic)) { + if (topic.contains(config.getReceiptCancelTopic())) { log.info("received cancel receipt request--"); + + // Adding in MDC so that tracer can add it in header + MDC.put(ChallanConstants.TENANTID_MDC_STRING, stateLevelTenantID); + challanRepository.updateChallanOnCancelReceipt(record); } } catch (final Exception e) { diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/ChallanConsumer.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/ChallanConsumer.java index b5a356e3a2f..26c1d2e9328 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/ChallanConsumer.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/ChallanConsumer.java @@ -6,6 +6,8 @@ import org.egov.echallan.config.ChallanConfiguration; import org.egov.echallan.model.ChallanRequest; import org.egov.echallan.service.NotificationService; +import org.egov.echallan.util.ChallanConstants; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; @@ -13,6 +15,7 @@ import org.springframework.stereotype.Component; import java.util.HashMap; +import static org.egov.echallan.util.ChallanConstants.TENANTID_MDC_STRING; @Slf4j @@ -29,17 +32,23 @@ public ChallanConsumer(NotificationService notificationService,ChallanConfigurat this.config = config; } - @KafkaListener(topics = {"${persister.save.challan.topic}","${persister.update.challan.topic}"}) + @KafkaListener(topicPattern = "${echallan.kafka.consumer.topic.pattern}") public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try { ObjectMapper mapper = new ObjectMapper(); ChallanRequest challanRequest = new ChallanRequest(); + log.info("Received request to send notification on topic - " + topic); - challanRequest = mapper.convertValue(record, ChallanRequest.class); + challanRequest = mapper.convertValue(record, ChallanRequest.class); - if(topic.equalsIgnoreCase(config.getSaveChallanTopic())) + String tenantId = challanRequest.getChallan().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(ChallanConstants.TENANTID_MDC_STRING, tenantId); + + if(topic.contains(config.getSaveChallanTopic())) notificationService.sendChallanNotification(challanRequest,true); - else if(topic.equalsIgnoreCase(config.getUpdateChallanTopic())) + else if(topic.contains(config.getUpdateChallanTopic())) notificationService.sendChallanNotification(challanRequest,false); } catch (final Exception e) { e.printStackTrace(); diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/FileStoreConsumer.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/FileStoreConsumer.java index 7705df8645f..d8944009a76 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/FileStoreConsumer.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/FileStoreConsumer.java @@ -6,6 +6,8 @@ import org.apache.kafka.common.protocol.types.Field; import org.egov.echallan.model.Challan; import org.egov.echallan.repository.ChallanRepository; +import org.egov.echallan.util.ChallanConstants; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; @@ -28,7 +30,7 @@ public class FileStoreConsumer { @Autowired private ChallanRepository challanRepository; - @KafkaListener(topics = { "${kafka.topics.filestore}" }) + @KafkaListener(topicPattern = "${kafka.topic.pdf.filestore.pattern}") public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try { List> jobMaps = (List>)record.get(KEY_PDF_JOBS); @@ -43,6 +45,10 @@ public void listen(final HashMap record, @Header(KafkaHeaders.RE log.info("Updating filestorid for: "+challans); } }); + String tenantId = challans.get(0).getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(ChallanConstants.TENANTID_MDC_STRING, tenantId); challanRepository.updateFileStoreId(challans); diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/ReceiptConsumer.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/ReceiptConsumer.java index 4003025ddce..a5325781d5a 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/ReceiptConsumer.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/consumer/ReceiptConsumer.java @@ -1,14 +1,18 @@ package org.egov.echallan.consumer; -import lombok.extern.slf4j.Slf4j; +import java.util.HashMap; import org.egov.echallan.service.PaymentUpdateService; +import org.egov.echallan.util.ChallanConstants; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; import org.springframework.messaging.handler.annotation.Header; import org.springframework.stereotype.Component; -import java.util.HashMap; + +import lombok.extern.slf4j.Slf4j; @@ -17,17 +21,23 @@ public class ReceiptConsumer { private PaymentUpdateService paymentUpdateService; + + @Value("${state.level.tenant.id}") + private String stateLevelTenantID; @Autowired public ReceiptConsumer(PaymentUpdateService paymentUpdateService) { this.paymentUpdateService = paymentUpdateService; } - @KafkaListener(topics = {"${kafka.topics.receipt.create}"}) + @KafkaListener(topicPattern = "${kafka.topics.receipt.topic.pattern}") public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { - try { - paymentUpdateService.process(record); - } catch (final Exception e) { + try { + + // Adding in MDC so that tracer can add it in header + MDC.put(ChallanConstants.TENANTID_MDC_STRING, stateLevelTenantID); + paymentUpdateService.process(record); + } catch (final Exception e) { log.error("Error while listening to value: " + record + " on topic: " + topic + ": ", e.getMessage()); } } diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/model/SMSRequest.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/model/SMSRequest.java index e8c1a72aeea..d7688310ff3 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/model/SMSRequest.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/model/SMSRequest.java @@ -11,5 +11,7 @@ public class SMSRequest { private String mobileNumber; private String message; + private String templateId; + private String[] users; -} +} \ No newline at end of file diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/producer/Producer.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/producer/Producer.java index 7dcf9769468..d7815011466 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/producer/Producer.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/producer/Producer.java @@ -1,17 +1,27 @@ package org.egov.echallan.producer; import lombok.extern.slf4j.Slf4j; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.echallan.config.ChallanConfiguration; import org.egov.tracer.kafka.CustomKafkaTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import lombok.extern.slf4j.Slf4j; @Service +@Slf4j public class Producer { @Autowired private CustomKafkaTemplate kafkaTemplate; - public void push(String topic, Object value) { - kafkaTemplate.send(topic, value); + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + public void push(String tenantId, String topic, Object value) { + + String updatedTopic = centralInstanceUtil.getStateSpecificTopicName(tenantId, topic); + log.info("The Kafka topic for the tenantId : " + tenantId + " is : " + updatedTopic); + kafkaTemplate.send(updatedTopic, value); } } diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java index a7549d01efd..31ef2f3f3ea 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java @@ -9,6 +9,8 @@ import java.util.Map; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.exception.InvalidTenantIdException; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.echallan.config.ChallanConfiguration; import org.egov.echallan.model.Challan; import org.egov.echallan.model.ChallanRequest; @@ -17,9 +19,13 @@ import org.egov.echallan.repository.builder.ChallanQueryBuilder; import org.egov.echallan.repository.rowmapper.ChallanCountRowMapper; import org.egov.echallan.repository.rowmapper.ChallanRowMapper; +import org.egov.echallan.util.CommonUtils; import org.egov.echallan.web.models.collection.Bill; import org.egov.echallan.web.models.collection.PaymentDetail; import org.egov.echallan.web.models.collection.PaymentRequest; +import org.egov.tracer.model.CustomException; +import org.slf4j.MDC; + import org.egov.echallan.util.ChallanConstants; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -62,6 +68,9 @@ public class ChallanRepository { @Autowired private ChallanCountRowMapper countRowMapper; + @Autowired + private MultiStateInstanceUtil centralInstanceutil; + @Autowired public ChallanRepository(Producer producer, ChallanConfiguration config,ChallanQueryBuilder queryBuilder, JdbcTemplate jdbcTemplate,ChallanRowMapper rowMapper,RestTemplate restTemplate) { @@ -78,27 +87,34 @@ public ChallanRepository(Producer producer, ChallanConfiguration config,ChallanQ /** * Pushes the request on save topic * - * @param ChallanRequest The challan create request + * @param challanRequest The challan create request */ public void save(ChallanRequest challanRequest) { - producer.push(config.getSaveChallanTopic(), challanRequest); + producer.push(challanRequest.getChallan().getTenantId(),config.getSaveChallanTopic(), challanRequest); } /** * Pushes the request on update topic * - * @param ChallanRequest The challan create request + * @param challanRequest The challan create request */ public void update(ChallanRequest challanRequest) { - producer.push(config.getUpdateChallanTopic(), challanRequest); + producer.push(challanRequest.getChallan().getTenantId(),config.getUpdateChallanTopic(), challanRequest); } public List getChallans(SearchCriteria criteria) { List preparedStmtList = new ArrayList<>(); - String query = queryBuilder.getChallanSearchQuery(criteria, preparedStmtList,false); + String query = queryBuilder.getChallanSearchQuery(criteria, preparedStmtList, false); + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("ECHALLAN_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + List challans = jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); return challans; } @@ -111,7 +127,12 @@ public List getChallans(SearchCriteria criteria) { public int getChallanSearchCount(SearchCriteria criteria) { List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getChallanSearchQuery(criteria, preparedStmtList,true); - + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("ECHALLAN_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } int count = jdbcTemplate.queryForObject(query, preparedStmtList.toArray(), Integer.class); return count; } @@ -126,7 +147,15 @@ public void updateFileStoreId(List challans) { ); }); - jdbcTemplate.batchUpdate(FILESTOREID_UPDATE_SQL,rows); + String query = FILESTOREID_UPDATE_SQL; + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, challans.get(0).getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("ECHALLAN_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + + jdbcTemplate.batchUpdate(query,rows); } @@ -151,6 +180,10 @@ public void updateChallanOnCancelReceipt(HashMap record) { List paymentDetails = paymentRequest.getPayment().getPaymentDetails(); String tenantId = paymentRequest.getPayment().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + List rows = new ArrayList<>(); for (PaymentDetail paymentDetail : paymentDetails) { Bill bill = paymentDetail.getBill(); @@ -158,7 +191,14 @@ public void updateChallanOnCancelReceipt(HashMap record) { bill.getBusinessService()} ); } - jdbcTemplate.batchUpdate(CANCEL_RECEIPT_UPDATE_SQL,rows); + String query = CANCEL_RECEIPT_UPDATE_SQL; + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("ECHALLAN_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + jdbcTemplate.batchUpdate(query,rows); } @@ -173,7 +213,14 @@ public Map fetchChallanCount(String tenantId){ List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getChallanCountQuery(tenantId, preparedStmtList); - + + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("ECHALLAN_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + try { response=jdbcTemplate.query(query, preparedStmtList.toArray(),countRowMapper); }catch(Exception e) { @@ -186,23 +233,43 @@ public Map fetchChallanCount(String tenantId){ public Map fetchDynamicData(String tenantId) { - + List preparedStmtListTotalCollection = new ArrayList<>(); String query = queryBuilder.getTotalCollectionQuery(tenantId, preparedStmtListTotalCollection); - - int totalCollection = jdbcTemplate.queryForObject(query,preparedStmtListTotalCollection.toArray(),Integer.class); - + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("ECHALLAN_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + + Integer totalCollection = jdbcTemplate.queryForObject(query,preparedStmtListTotalCollection.toArray(),Integer.class); + List preparedStmtListTotalServices = new ArrayList<>(); query = queryBuilder.getTotalServicesQuery(tenantId, preparedStmtListTotalServices); - + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("ECHALLAN_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + int totalServices = jdbcTemplate.queryForObject(query,preparedStmtListTotalServices.toArray(),Integer.class); - + Map dynamicData = new HashMap(); - dynamicData.put(ChallanConstants.TOTAL_COLLECTION, totalCollection); + + if(totalCollection!=null) + { + dynamicData.put(ChallanConstants.TOTAL_COLLECTION, totalCollection); + } + else { + dynamicData.put(ChallanConstants.TOTAL_COLLECTION, 0); + } + dynamicData.put(ChallanConstants.TOTAL_SERVICES, totalServices); - + return dynamicData; - + } - + } diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java index 56e84f29d9a..622945f8a3a 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java @@ -2,6 +2,7 @@ import lombok.extern.slf4j.Slf4j; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.echallan.config.ChallanConfiguration; import org.egov.echallan.model.SearchCriteria; import org.springframework.beans.factory.annotation.Autowired; @@ -21,19 +22,24 @@ public ChallanQueryBuilder(ChallanConfiguration config) { this.config = config; } + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + private static final String INNER_JOIN_STRING = " INNER JOIN "; private static final String QUERY = "SELECT challan.*,chaladdr.*,challan.id as challan_id,challan.tenantid as challan_tenantId,challan.lastModifiedTime as " + "challan_lastModifiedTime,challan.createdBy as challan_createdBy,challan.lastModifiedBy as challan_lastModifiedBy,challan.createdTime as " + "challan_createdTime,chaladdr.id as chaladdr_id," + - "challan.accountId as uuid,challan.description as description FROM eg_echallan challan" + "challan.accountId as uuid,challan.description as description FROM {schema}.eg_echallan challan" +INNER_JOIN_STRING - +"eg_challan_address chaladdr ON chaladdr.echallanid = challan.id"; + +"{schema}.eg_challan_address chaladdr ON chaladdr.echallanid = challan.id"; private static final String COUNT_QUERY = "SELECT COUNT(challan.id) " + - "FROM eg_echallan challan" + "FROM {schema}.eg_echallan challan" +INNER_JOIN_STRING - +"eg_challan_address chaladdr ON chaladdr.echallanid = challan.id"; + +"{schema}.eg_challan_address chaladdr ON chaladdr.echallanid = challan.id"; + + private final String paginationWrapper = "SELECT * FROM " + "(SELECT *, DENSE_RANK() OVER (ORDER BY challan_lastModifiedTime DESC , challan_id) offset_ FROM " + @@ -41,15 +47,15 @@ public ChallanQueryBuilder(ChallanConfiguration config) { " result) result_offset " + "WHERE offset_ > ? AND offset_ <= ?"; - public static final String FILESTOREID_UPDATE_SQL = "UPDATE eg_echallan SET filestoreid=? WHERE id=?"; + public static final String FILESTOREID_UPDATE_SQL = "UPDATE {schema}.eg_echallan SET filestoreid=? WHERE id=?"; - public static final String CANCEL_RECEIPT_UPDATE_SQL = "UPDATE eg_echallan SET applicationStatus='ACTIVE' WHERE challanNo=? and businessService=?"; + public static final String CANCEL_RECEIPT_UPDATE_SQL = "UPDATE {schema}.eg_echallan SET applicationStatus='ACTIVE' WHERE challanNo=? and businessService=?"; - public static final String CHALLAN_COUNT_QUERY = "SELECT applicationstatus, count(*) FROM eg_echallan WHERE tenantid "; - - public static final String TOTAL_COLLECTION_QUERY = "SELECT sum(amountpaid) FROM egbs_billdetail_v1 INNER JOIN egcl_paymentdetail ON egbs_billdetail_v1.billid=egcl_paymentdetail.billid INNER JOIN eg_echallan ON consumercode=challanno WHERE eg_echallan.tenantid=? AND eg_echallan.applicationstatus='PAID' AND egcl_paymentdetail.createdtime>? "; - - public static final String TOTAL_SERVICES_QUERY = "SELECT count(distinct(businessservice)) FROM eg_echallan WHERE tenantid=? AND createdtime>? "; + public static final String CHALLAN_COUNT_QUERY = "SELECT applicationstatus, count(*) FROM {schema}.eg_echallan WHERE tenantid "; + + public static final String TOTAL_COLLECTION_QUERY = "SELECT sum(amountpaid) FROM {schema}.egbs_billdetail_v1 INNER JOIN {schema}.egcl_paymentdetail ON egbs_billdetail_v1.billid=egcl_paymentdetail.billid INNER JOIN {schema}.eg_echallan ON consumercode=challanno WHERE eg_echallan.tenantid=? AND eg_echallan.applicationstatus='PAID' AND egcl_paymentdetail.createdtime>? "; + + public static final String TOTAL_SERVICES_QUERY = "SELECT count(distinct(businessservice)) FROM {schema}.eg_echallan WHERE tenantid=? AND createdtime>? "; @@ -83,9 +89,18 @@ public String getChallanSearchQuery(SearchCriteria criteria, List prepar else { if (criteria.getTenantId() != null) { + String tenantId = criteria.getTenantId(); addClauseIfRequired(preparedStmtList, builder); - builder.append(" challan.tenantid=? "); - preparedStmtList.add(criteria.getTenantId()); + + if(centralInstanceUtil.isTenantIdStateLevel(tenantId)){ + builder.append(" challan.tenantid LIKE ? "); + preparedStmtList.add(criteria.getTenantId() + '%'); + } + else{ + builder.append(" challan.tenantid=? "); + preparedStmtList.add(criteria.getTenantId()); + } + } List ids = criteria.getIds(); if (!CollectionUtils.isEmpty(ids)) { @@ -192,7 +207,7 @@ private static void addClauseIfRequired(List values, StringBuilder query public String getChallanCountQuery(String tenantId, List preparedStmtList ) { StringBuilder builder = new StringBuilder(CHALLAN_COUNT_QUERY); - if(tenantId.equalsIgnoreCase(config.stateLevelTenantId)){ + if(centralInstanceUtil.isTenantIdStateLevel(tenantId)){ builder.append("LIKE ? "); preparedStmtList.add(tenantId+"%"); } @@ -206,12 +221,12 @@ public String getChallanCountQuery(String tenantId, List preparedStmtLi public String getTotalCollectionQuery(String tenantId, List preparedStmtListTotalCollection) { - + StringBuilder query = new StringBuilder(""); query.append(TOTAL_COLLECTION_QUERY); - + preparedStmtListTotalCollection.add(tenantId); - + // In order to get data of last 12 months, the months variables is pre-configured in application properties int months = Integer.valueOf(config.getNumberOfMonths()) ; @@ -222,18 +237,17 @@ public String getTotalCollectionQuery(String tenantId, List preparedStmt // Converting the timestamp to milliseconds and adding it to prepared statement list preparedStmtListTotalCollection.add(calendar.getTimeInMillis()); - return query.toString(); } public String getTotalServicesQuery(String tenantId, List preparedStmtListTotalServices) { - + StringBuilder query = new StringBuilder(""); query.append(TOTAL_SERVICES_QUERY); - + preparedStmtListTotalServices.add(tenantId); - + // In order to get data of last 12 months, the months variables is pre-configured in application properties int months = Integer.valueOf(config.getNumberOfMonths()) ; @@ -244,9 +258,9 @@ public String getTotalServicesQuery(String tenantId, List preparedStmtLi // Converting the timestamp to milliseconds and adding it to prepared statement list preparedStmtListTotalServices.add(calendar.getTimeInMillis()); - + return query.toString(); - + } diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/ChallanService.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/ChallanService.java index f7137b9c71a..9bf77b51cd7 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/ChallanService.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/ChallanService.java @@ -143,6 +143,7 @@ public int getCountOfChallansWithOwnerInfo(SearchCriteria criteria,RequestInfo r return count; } public List searchChallans(ChallanRequest request){ + validator.validateSearchRequest(request.getChallan().getTenantId()); SearchCriteria criteria = new SearchCriteria(); List ids = new LinkedList<>(); ids.add(request.getChallan().getId()); diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/NotificationService.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/NotificationService.java index beeb1e54101..0e2f875988d 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/NotificationService.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/NotificationService.java @@ -48,15 +48,15 @@ public class NotificationService { @Value("${egov.mdms.search.endpoint}") private String mdmsUrl; - + private RestTemplate restTemplate; - + private NotificationUtil util; - + private Producer producer; - - private ServiceRequestRepository serviceRequestRepository; - + + private ServiceRequestRepository serviceRequestRepository; + private static final String BUSINESSSERVICE_MDMS_MODULE = "BillingService"; public static final String BUSINESSSERVICE_MDMS_MASTER = "BusinessService"; public static final String BUSINESSSERVICE_CODES_FILTER = "$.[?(@.type=='Adhoc')].code"; @@ -64,7 +64,7 @@ public class NotificationService { public static final String USREVENTS_EVENT_TYPE = "SYSTEMGENERATED"; public static final String USREVENTS_EVENT_NAME = "Challan"; public static final String USREVENTS_EVENT_POSTEDBY = "SYSTEM-CHALLAN"; - + @Autowired public NotificationService(ChallanConfiguration config,RestTemplate restTemplate,NotificationUtil util,Producer producer,ServiceRequestRepository serviceRequestRepository) { this.config = config; @@ -73,9 +73,10 @@ public NotificationService(ChallanConfiguration config,RestTemplate restTemplate this.producer = producer; this.serviceRequestRepository = serviceRequestRepository; } - + public void sendChallanNotification(ChallanRequest challanRequest,boolean isSave) { String action="",code = null; + String tenantId = challanRequest.getChallan().getTenantId(); if (isSave) { action = CREATE_ACTION; @@ -98,7 +99,7 @@ public void sendChallanNotification(ChallanRequest challanRequest,boolean isSave if (config.getIsSMSEnabled()) { enrichSMSRequest(challanRequest, smsRequests, code); if (!CollectionUtils.isEmpty(smsRequests)) - util.sendSMS(smsRequests, config.getIsSMSEnabled()); + util.sendSMS(tenantId, smsRequests, config.getIsSMSEnabled()); } } } @@ -108,7 +109,7 @@ public void sendChallanNotification(ChallanRequest challanRequest,boolean isSave if (config.getIsUserEventEnabled()) { EventRequest eventRequest = getEventsForChallan(challanRequest,isSave); if(null != eventRequest) - util.sendEventNotification(eventRequest); + sendEventNotification(eventRequest, tenantId); } } } @@ -119,15 +120,15 @@ public void sendChallanNotification(ChallanRequest challanRequest,boolean isSave if (config.getIsEmailNotificationEnabled()) { enrichEmailRequest(challanRequest, emailRequests, code.replace(".sms",".email")); if (!CollectionUtils.isEmpty(emailRequests)) - util.sendEmail(emailRequests); + util.sendEmail(tenantId, emailRequests); } } } } private EventRequest getEventsForChallan(ChallanRequest request,boolean isSave) { - List events = new ArrayList<>(); - Challan challan = request.getChallan(); + List events = new ArrayList<>(); + Challan challan = request.getChallan(); String message=""; if(isSave) message = util.getCustomizedMsg(request.getRequestInfo(), challan ,CREATE_CODE_INAPP); @@ -139,31 +140,31 @@ else if(challan.getApplicationStatus()==StatusEnum.PAID) message = util.getCustomizedMsg(request.getRequestInfo(),challan, PAYMENT_CODE_INAPP ); - Map mobileNumberToOwner = new HashMap<>(); - String mobile = challan.getCitizen().getMobileNumber(); - if(mobile!=null) - mobileNumberToOwner.put(mobile,challan.getCitizen().getName()); - - Map mapOfPhnoAndUUIDs = fetchUserUUIDs(mobile, request.getRequestInfo(), request.getChallan().getTenantId()); - if (CollectionUtils.isEmpty(mapOfPhnoAndUUIDs.keySet())) - return null; - - List toUsers = new ArrayList<>(); - toUsers.add(mapOfPhnoAndUUIDs.get(mobile)); - Recepient recepient = Recepient.builder().toUsers(toUsers).toRoles(null).build(); - List payTriggerList = Arrays.asList(config.getPayTriggers().split("[,]")); - Action action = null; - if(payTriggerList.contains(challan.getApplicationStatus().toString())) { - List items = new ArrayList<>(); - String actionLink = config.getPayLink().replace("$mobile", mobile) - .replace("$applicationNo", challan.getChallanNo()) - .replace("$tenantId", challan.getTenantId()) - .replace("$businessService", challan.getBusinessService()); - actionLink = config.getUiAppHost() + actionLink; - ActionItem item = ActionItem.builder().actionUrl(actionLink).code(config.getPayCode()).build(); - items.add(item); - action = Action.builder().actionUrls(items).build(); - } + Map mobileNumberToOwner = new HashMap<>(); + String mobile = challan.getCitizen().getMobileNumber(); + if(mobile!=null) + mobileNumberToOwner.put(mobile,challan.getCitizen().getName()); + + Map mapOfPhnoAndUUIDs = fetchUserUUIDs(mobile, request.getRequestInfo(), request.getChallan().getTenantId()); + if (CollectionUtils.isEmpty(mapOfPhnoAndUUIDs.keySet())) + return null; + + List toUsers = new ArrayList<>(); + toUsers.add(mapOfPhnoAndUUIDs.get(mobile)); + Recepient recepient = Recepient.builder().toUsers(toUsers).toRoles(null).build(); + List payTriggerList = Arrays.asList(config.getPayTriggers().split("[,]")); + Action action = null; + if(payTriggerList.contains(challan.getApplicationStatus().toString())) { + List items = new ArrayList<>(); + String actionLink = config.getPayLink().replace("$mobile", mobile) + .replace("$applicationNo", challan.getChallanNo()) + .replace("$tenantId", challan.getTenantId()) + .replace("$businessService", challan.getBusinessService()); + actionLink = util.getHost(request.getChallan().getTenantId()) + actionLink; + ActionItem item = ActionItem.builder().actionUrl(actionLink).code(config.getPayCode()).build(); + items.add(item); + action = Action.builder().actionUrls(items).build(); + } if(challan.getApplicationStatus()==StatusEnum.PAID) { List items = new ArrayList<>(); PaymentResponse paymentResponse = util.getPaymentObject(request); @@ -173,19 +174,19 @@ else if(challan.getApplicationStatus()==StatusEnum.PAID) action = Action.builder().actionUrls(items).build(); } - events.add(Event.builder().tenantId(challan.getTenantId()).description(message) - .eventType(USREVENTS_EVENT_TYPE).name(USREVENTS_EVENT_NAME) - .postedBy(USREVENTS_EVENT_POSTEDBY).source(Source.WEBAPP).recepient(recepient) - .eventDetails(null).actions(action).build()); - if(!CollectionUtils.isEmpty(events)) { - return EventRequest.builder().requestInfo(request.getRequestInfo()).events(events).build(); - }else { - return null; - } - - - } - + events.add(Event.builder().tenantId(challan.getTenantId()).description(message) + .eventType(USREVENTS_EVENT_TYPE).name(USREVENTS_EVENT_NAME) + .postedBy(USREVENTS_EVENT_POSTEDBY).source(Source.WEBAPP).recepient(recepient) + .eventDetails(null).actions(action).build()); + if(!CollectionUtils.isEmpty(events)) { + return EventRequest.builder().requestInfo(request.getRequestInfo()).events(events).build(); + }else { + return null; + } + + + } + private List fetchBusinessServiceFromMDMS(RequestInfo requestInfo, String tenantId){ List masterData = new ArrayList<>(); @@ -193,7 +194,7 @@ private List fetchBusinessServiceFromMDMS(RequestInfo requestInfo, Strin uri.append(mdmsHost).append(mdmsUrl); if(StringUtils.isEmpty(tenantId)) return masterData; - MdmsCriteriaReq request = getRequestForEvents(requestInfo, tenantId.split("\\.")[0]); + MdmsCriteriaReq request = getRequestForEvents(requestInfo, tenantId.split("\\.")[0] + "." + tenantId.split("\\.")[1]); try { Object response = restTemplate.postForObject(uri.toString(), request, Map.class); masterData = JsonPath.read(response, BUSINESSSERVICE_CODES_JSONPATH); @@ -202,8 +203,8 @@ private List fetchBusinessServiceFromMDMS(RequestInfo requestInfo, Strin } return masterData; } - - + + private MdmsCriteriaReq getRequestForEvents(RequestInfo requestInfo, String tenantId) { MasterDetail masterDetail = org.egov.mdms.model.MasterDetail.builder() .name(BUSINESSSERVICE_MDMS_MASTER).filter(BUSINESSSERVICE_CODES_FILTER).build(); @@ -216,56 +217,35 @@ private MdmsCriteriaReq getRequestForEvents(RequestInfo requestInfo, String tena MdmsCriteria mdmsCriteria = MdmsCriteria.builder().tenantId(tenantId).moduleDetails(moduleDetails).build(); return MdmsCriteriaReq.builder().requestInfo(requestInfo).mdmsCriteria(mdmsCriteria).build(); } - + private Map fetchUserUUIDs(String mobileNumber, RequestInfo requestInfo, String tenantId) { - Map mapOfPhnoAndUUIDs = new HashMap<>(); - StringBuilder uri = new StringBuilder(); - uri.append(config.getUserHost()).append(config.getUserSearchEndpoint()); - Map userSearchRequest = new HashMap<>(); - userSearchRequest.put("RequestInfo", requestInfo); + Map mapOfPhnoAndUUIDs = new HashMap<>(); + StringBuilder uri = new StringBuilder(); + uri.append(config.getUserHost()).append(config.getUserSearchEndpoint()); + Map userSearchRequest = new HashMap<>(); + userSearchRequest.put("RequestInfo", requestInfo); userSearchRequest.put("tenantId", tenantId); userSearchRequest.put("userType", "CITIZEN"); - userSearchRequest.put("userName", mobileNumber); - try { - Object user = serviceRequestRepository.fetchResult(uri, userSearchRequest); - if(null != user) { - List users = JsonPath.read(user, "$.user"); - if(users.size()!=0) { - String uuid = JsonPath.read(user, "$.user[0].uuid"); - mapOfPhnoAndUUIDs.put(mobileNumber, uuid); - } - }else { - log.error("Service returned null while fetching user for username - "+mobileNumber); - } - }catch(Exception e) { - log.error("Exception while fetching user for username - "+mobileNumber); - log.error("Exception trace: ",e); - } - return mapOfPhnoAndUUIDs; - } - - /** - * Enriches the smsRequest with the customized messages - * - * @param challanRequest - * The challanRequest - * @param smsRequestslist - * List of SMSRequets - * @param code - * Notification Template Code - */ - private void enrichSMSRequest(ChallanRequest challanRequest, List smsRequestslist, String code) { - String message = util.getCustomizedMsg(challanRequest.getRequestInfo(), challanRequest.getChallan(), code); - String mobilenumber = challanRequest.getChallan().getCitizen().getMobileNumber(); - - if (message != null && !StringUtils.isEmpty(message)) { - SMSRequest smsRequest = SMSRequest.builder(). - mobileNumber(mobilenumber). - message(message).build(); - smsRequestslist.add(smsRequest); - } else { - log.error("No message configured! Notification will not be sent."); + userSearchRequest.put("userName", mobileNumber); + try { + Object user = serviceRequestRepository.fetchResult(uri, userSearchRequest); + if(null != user) { + List users = JsonPath.read(user, "$.user"); + if(users.size()!=0) { + String uuid = JsonPath.read(user, "$.user[0].uuid"); + mapOfPhnoAndUUIDs.put(mobileNumber, uuid); + } + }else { + log.error("Service returned null while fetching user for username - "+mobileNumber); + } + }catch(Exception e) { + log.error("Exception while fetching user for username - "+mobileNumber); + log.error("Exception trace: ",e); } + return mapOfPhnoAndUUIDs; + } + public void sendEventNotification(EventRequest request, String tenantId) { + producer.push(tenantId, config.getSaveUserEventsTopic(), request); } /** * Enriches the emailRequests with the customized messages @@ -309,4 +289,39 @@ private void enrichEmailRequest(ChallanRequest challanRequest, List smsRequestslist, String code) { + String message = util.getCustomizedMsg(challanRequest.getRequestInfo(), challanRequest.getChallan(), code); + String mobilenumber = challanRequest.getChallan().getCitizen().getMobileNumber(); + + if (message != null && !StringUtils.isEmpty(message)) { + SMSRequest smsRequest = SMSRequest.builder(). + mobileNumber(mobilenumber). + message(message).build(); + smsRequestslist.add(smsRequest); + } else { + log.error("No message configured! Notification will not be sent."); + } + } + /** + * Enriches the emailRequests with the customized messages + * + * @param challanRequest + * The challanRequest + * @param emailRequestList + * List of EmailRequests + * @param code + * Notification Template Code + */ + + } \ No newline at end of file diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/PaymentUpdateService.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/PaymentUpdateService.java index 2af14992506..e12dda68303 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/PaymentUpdateService.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/PaymentUpdateService.java @@ -22,6 +22,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; +import org.slf4j.MDC; + +import static org.egov.echallan.util.ChallanConstants.TENANTID_MDC_STRING; @Service @@ -51,6 +54,11 @@ public void process(HashMap record) { log.info("Process for object"+ record); PaymentRequest paymentRequest = mapper.convertValue(record, PaymentRequest.class); RequestInfo requestInfo = paymentRequest.getRequestInfo(); + String tenantId = paymentRequest.getPayment().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + //Update the challan only when the payment is fully done. if( paymentRequest.getPayment().getTotalAmountPaid().compareTo(paymentRequest.getPayment().getTotalDue())!=0) return; @@ -71,7 +79,7 @@ public void process(HashMap record) { } challans.get(0).setAuditDetails(auditDetails); ChallanRequest request = ChallanRequest.builder().requestInfo(requestInfo).challan(challans.get(0)).build(); - producer.push(config.getUpdateChallanTopic(), request); + producer.push(request.getChallan().getTenantId(),config.getUpdateChallanTopic(), request); } } } catch (Exception e) { diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/util/ChallanConstants.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/util/ChallanConstants.java index 36e997dd34f..25a19a4852e 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/util/ChallanConstants.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/util/ChallanConstants.java @@ -50,6 +50,10 @@ public class ChallanConstants { public static final String LOCALITY_CODE_PATH = "$.TenantBoundary.[*].boundary[?(@.label==\"Locality\")].code"; + public static final String SCHEMA_REPLACE_STRING = "{schema}"; + + public static final String TENANTID_MDC_STRING = "TENANTID"; + // notification constants public static final String CHANNEL_NAME_SMS = "SMS"; @@ -88,7 +92,6 @@ public class ChallanConstants { public static final String PAYMENT_CODE_EMAIL = "echallan.payment.email"; public static final String DOWNLOAD_RECEIPT_CODE = "DOWNLOAD RECEIPT"; - public static final String TOTAL_COLLECTION = "totalCollection"; public static final String TOTAL_SERVICES = "totalServices"; diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/util/CommonUtils.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/util/CommonUtils.java index ae2b049ac5b..911b596c7be 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/util/CommonUtils.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/util/CommonUtils.java @@ -96,5 +96,4 @@ private ModuleDetail getModuleDeatilRequest(String service) { return moduleDtls; } - } diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/util/NotificationUtil.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/util/NotificationUtil.java index d614a1727b2..b81df1aad1b 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/util/NotificationUtil.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/util/NotificationUtil.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.*; +import org.egov.tracer.model.CustomException; import org.egov.echallan.model.*; import org.egov.echallan.producer.Producer; import org.egov.echallan.web.models.collection.PaymentResponse; @@ -22,6 +23,7 @@ import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; import org.egov.echallan.util.ChallanConstants.*; @@ -48,7 +50,7 @@ public class NotificationUtil { public static final String LOCALIZATION_TEMPLATEID_JSONPATH = "$.messages[0].templateId"; public static final String MSG_KEY="message"; public static final String TEMPLATE_KEY="templateId"; -// private static final String CREATE_CODE = "echallan.create.sms"; + // private static final String CREATE_CODE = "echallan.create.sms"; // private static final String UPDATE_CODE = "echallan.update.sms"; // private static final String CANCEL_CODE = "echallan.cancel.sms"; private ChallanConfiguration config; @@ -64,7 +66,7 @@ public class NotificationUtil { @Autowired public NotificationUtil(ChallanConfiguration config, ServiceRequestRepository serviceRequestRepository, - RestTemplate restTemplate, Producer producer) { + RestTemplate restTemplate, Producer producer) { this.config = config; this.serviceRequestRepository = serviceRequestRepository; this.restTemplate = restTemplate; @@ -72,7 +74,7 @@ public NotificationUtil(ChallanConfiguration config, ServiceRequestRepository se } - + private String getReplacedMsg(RequestInfo requestInfo,Challan challan, String message) { if (challan.getApplicationStatus() != Challan.StatusEnum.CANCELLED) { String billDetails = getBillDetails(requestInfo, challan); @@ -82,7 +84,7 @@ private String getReplacedMsg(RequestInfo requestInfo,Challan challan, String me } message = message.replace("{User}",challan.getCitizen().getName()); - message = message.replace("{challanno}", challan.getChallanNo()); + message = message.replace("{challanno}", challan.getChallanNo()); if(message.contains("{ULB}")) message = message.replace("{ULB}", capitalize(challan.getTenantId().split("\\.")[1])); @@ -90,7 +92,7 @@ private String getReplacedMsg(RequestInfo requestInfo,Challan challan, String me String service = String.join(" ", split_array); message = message.replace("{service}", service); - String UIHost = config.getUiAppHost(); + String UIHost = getHost(challan.getTenantId()); String paymentPath = config.getPayLinkSMS(); paymentPath = paymentPath.replace("$consumercode",challan.getChallanNo()); paymentPath = paymentPath.replace("$tenantId",challan.getTenantId()); @@ -99,8 +101,8 @@ private String getReplacedMsg(RequestInfo requestInfo,Challan challan, String me if(message.contains("{Link}")) message = message.replace("{Link}",getShortenedUrl(finalPath)); - return message; - } + return message; + } private String getPaymentMsg(RequestInfo requestInfo,Challan challan, String message) { ChallanRequest challanRequest = new ChallanRequest(requestInfo,challan); @@ -117,7 +119,7 @@ private String getPaymentMsg(RequestInfo requestInfo,Challan challan, String mes if(message.contains("{Online_Receipt_Link}")) message = message.replace("{Online_Receipt_Link}", getRecepitDownloadLink(challanRequest,paymentResponse,challanRequest.getChallan().getCitizen().getMobileNumber())); - if(message.contains("{ULB}")) + if(message.contains("{ULB}")) message = message.replace("{ULB}", capitalize(challan.getTenantId().split("\\.")[1])); return message; @@ -131,17 +133,17 @@ private String formatCodes(String code) { return BUSINESSSERVICELOCALIZATION_CODE_PREFIX + code.toUpperCase(); } - + private String getBillDetails(RequestInfo requestInfo, Challan challan) { LinkedHashMap responseMap = (LinkedHashMap) serviceRequestRepository.fetchResult(getBillUri(challan), new RequestInfoWrapper(requestInfo)); - + String jsonString = new JSONObject(responseMap).toString(); return jsonString; } - + public String getShortenedUrl(String url){ HashMap body = new HashMap<>(); body.put("url",url); @@ -157,7 +159,7 @@ public String getShortenedUrl(String url){ /** * Returns the uri for the localization call - * + * * @param tenantId * TenantId of the challan * @return The uri for localization search call @@ -165,8 +167,8 @@ public String getShortenedUrl(String url){ public StringBuilder getUri(String tenantId, RequestInfo requestInfo) { if (config.getIsLocalizationStateLevel()) - tenantId = tenantId.split("\\.")[0]; - + tenantId = tenantId.split("\\.")[0] + "." + tenantId.split("\\.")[1]; + String locale = NOTIFICATION_LOCALE; if (!StringUtils.isEmpty(requestInfo.getMsgId()) && requestInfo.getMsgId().split("|").length >= 2) locale = requestInfo.getMsgId().split("\\|")[1]; @@ -178,7 +180,7 @@ public StringBuilder getUri(String tenantId, RequestInfo requestInfo) { return uri; } - + private StringBuilder getBillUri(Challan challan) { StringBuilder builder = new StringBuilder(config.getBillingHost()); builder.append(config.getFetchBillEndpoint()); @@ -191,6 +193,22 @@ private StringBuilder getBillUri(Challan challan) { return builder; } + public String getHost(String tenantId){ + log.info("INCOMING TENANTID FOR NOTIF HOST: " + tenantId); + Integer tenantLength = tenantId.split("\\.").length; + String topLevelTenant = tenantId; + if(tenantLength == 3){ + topLevelTenant = tenantId.split("\\.")[0] + "." + tenantId.split("\\.")[1]; + } + log.info(config.getUiAppHostMap().toString()); + log.info(topLevelTenant); + String host = config.getUiAppHostMap().get(topLevelTenant); + if(ObjectUtils.isEmpty(host)){ + throw new CustomException("EG_NOTIF_HOST_ERR", "No host found for tenantid: " + topLevelTenant); + } + return host; + } + public List fetchChannelList(RequestInfo requestInfo, String tenantId, String moduleName, String action){ List masterData = new ArrayList<>(); StringBuilder uri = new StringBuilder(); @@ -241,13 +259,13 @@ private MdmsCriteriaReq getMdmsRequestForChannelList(RequestInfo requestInfo, St * @param emailRequestList * The list of EmailRequest to be sent */ - public void sendEmail(List emailRequestList) { + public void sendEmail(String tenantId, List emailRequestList) { if (config.getIsEmailNotificationEnabled()) { if (CollectionUtils.isEmpty(emailRequestList)) log.debug("Messages from localization couldn't be fetched!"); for (EmailRequest emailRequest : emailRequestList) { - producer.push(config.getEmailNotifTopic(), emailRequest); + producer.push(tenantId, config.getEmailNotifTopic(), emailRequest); log.debug("Email Request -> "+emailRequest.getEmail().toString()); log.debug("EMAIL notification sent!"); } @@ -260,22 +278,18 @@ public void sendEmail(List emailRequestList) { * @param smsRequestList * The list of SMSRequest to be sent */ - public void sendSMS(List smsRequestList, boolean isSMSEnabled) { + public void sendSMS(String tenantId, List smsRequestList, boolean isSMSEnabled) { if (isSMSEnabled) { if (CollectionUtils.isEmpty(smsRequestList)) log.debug("Messages from localization couldn't be fetched!"); for (SMSRequest smsRequest : smsRequestList) { - producer.push(config.getSmsNotifTopic(), smsRequest); + producer.push(tenantId, config.getSmsNotifTopic(), smsRequest); log.debug("MobileNumber: " + smsRequest.getMobileNumber() + " Messages: " + smsRequest.getMessage()); } } } - public void sendEventNotification(EventRequest request) { - producer.push(config.getSaveUserEventsTopic(), request); - } - /** * Fetches email ids of CITIZENs based on the phone number. diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/validator/ChallanValidator.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/validator/ChallanValidator.java index 318904e4d4d..c638b0871c2 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/validator/ChallanValidator.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/validator/ChallanValidator.java @@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.echallan.config.ChallanConfiguration; import org.egov.echallan.model.Amount; import org.egov.echallan.model.Challan; @@ -34,6 +35,9 @@ public class ChallanValidator { @Autowired private ServiceRequestRepository serviceRequestRepository; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + public void validateFields(ChallanRequest request, Object mdmsData) { Challan challan = request.getChallan(); @@ -106,7 +110,7 @@ public void validateFields(ChallanRequest request, Object mdmsData) { } public List getLocalityCodes(String tenantId, RequestInfo requestInfo){ - StringBuilder builder = new StringBuilder(config.getBoundaryHost()); + StringBuilder builder = new StringBuilder(config.getLocationHost()); builder.append(config.getFetchBoundaryEndpoint()); builder.append("?tenantId="); builder.append(tenantId); @@ -159,4 +163,11 @@ public void validateChallanCountRequest(String tenantId){ throw new CustomException(errorMap); } } + + public void validateSearchRequest(String tenantId){ + if(centralInstanceUtil.getIsEnvironmentCentralInstance() && tenantId == null) + throw new CustomException("ECHALLAN_INVALID_SEARCH"," TenantId is mandatory for search "); + else if(centralInstanceUtil.getIsEnvironmentCentralInstance() && tenantId.split("\\.").length < centralInstanceUtil.getStateLevelTenantIdLength()) + throw new CustomException("ECHALLAN_INVALID_SEARCH"," TenantId should be mandatorily " + centralInstanceUtil.getStateLevelTenantIdLength() + " levels for search"); + } } diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/controllers/ChallanController.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/controllers/ChallanController.java index af60200b277..246c0164ea6 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/controllers/ChallanController.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/controllers/ChallanController.java @@ -62,7 +62,6 @@ public ResponseEntity search(@Valid @RequestBody RequestInfoWra int totalAmountCollected = dynamicData.get(ChallanConstants.TOTAL_COLLECTION); int validity = challanService.getChallanValidity(); int totalCount = challanService.countForSearch(criteria,requestInfoWrapper.getRequestInfo()); - ChallanResponse response = ChallanResponse.builder().challans(challans).countOfServices(countOfServices) .totalAmountCollected(totalAmountCollected).validity(validity).totalCount(totalCount) .responseInfo(responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true)) @@ -90,7 +89,7 @@ private ResponseEntity count(@RequestParam("tenantId") String tenantId, @Requ @PostMapping("/_test") public ResponseEntity test( @RequestBody ChallanRequest challanRequest){ - producer.push("update-challan",challanRequest); + producer.push(challanRequest.getChallan().getTenantId(), "update-challan",challanRequest); return new ResponseEntity(HttpStatus.OK); } } diff --git a/municipal-services/echallan-services/src/main/resources/application.properties b/municipal-services/echallan-services/src/main/resources/application.properties index be53317668f..b1e94ef916b 100644 --- a/municipal-services/echallan-services/src/main/resources/application.properties +++ b/municipal-services/echallan-services/src/main/resources/application.properties @@ -78,7 +78,7 @@ egov.user.username.prefix=TL- # common pay and citizen endpoints egov.host.domain.name=https://13.71.65.215.nip.io/ egov.citizen.home.endpoint = /citizen/ -egov.common.pay.endpoint=/citizen/withoutAuth/egov-common/pay?consumerCode=$applicationNo&tenantId=$tenantId +egov.common.pay.endpoint=citizen/withoutAuth/egov-common/pay?consumerCode=$applicationNo&tenantId=$tenantId #Idgen Config egov.idgen.host=http://localhost:8088 @@ -87,8 +87,10 @@ egov.idgen.challanNum.name=echallan.aplnumber egov.idgen.challanNum.format=CB-CH-[cy:yyyy-MM-dd]-[SEQ_EG_TL_APL] #mdms urls -egov.mdms.host=https://13.71.65.215.nip.io/ -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +#egov.mdms.host=https://13.71.65.215.nip.io/ +#egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search #challan Calculator egov.echallan.calculator.host=http://localhost:8078 @@ -124,7 +126,11 @@ egov.allowed.businessServices=TL,BPAREG #userevents egov.user.event.notification.enabled=true egov.ui.app.host=https://13.71.65.215.nip.io/ + +egov.ui.app.host.map={"in":"https://central-instance.digit.org","in.statea":"https://statea.digit.org"} + #egov.usr.events.create.topic=persist-user-events-async + egov.usr.events.pay.link=citizen/otpLogin?mobileNo=$mobile&redirectTo=egov-common/pay?consumerCode=$applicationNo&tenantId=$tenantId&businessService=$businessService egov.usr.events.pay.code=PAY egov.usr.events.pay.triggers=ACTIVE @@ -145,10 +151,18 @@ egov.locality.search.endpoint=/egov-location/location/v11/boundarys/_search state.level.tenant.id=pb +state.level.tenantid.length=1 +is.environment.central.instance=false + +echallan.kafka.consumer.topic.pattern=(save-challan$|update-challan$) +kafka.topics.receipt.topic.pattern=((^[a-zA-Z]+-)?egov.collection.payment-create) +kafka.topics.receipt.cancel.pattern=((^[a-zA-Z]+-)?egov.collection.payment-cancel$) +kafka.topic.pdf.filestore.pattern=(PDF_GEN_CREATE$) + #Collection config egov.collection.service.host=https://dev.digit.org egov.collection.service.search.endpoint=/collection-services/payments/ egov.download.receipt.link=/citizen/otpLogin?mobileNo=$mobile&redirectTo=egov-common/download-receipt?status=success&consumerCode=$consumerCode&tenantId=$tenantId&receiptNumber=$receiptNumber&businessService=$businessService&smsLink=true&mobileNo=$mobile egov.dynamicdata.period=12 -egov.challan.validity=1 \ No newline at end of file +egov.challan.validity=1 diff --git a/municipal-services/echallan-services/src/main/resources/db/migrate.sh b/municipal-services/echallan-services/src/main/resources/db/migrate.sh index 43960b25cdb..f79b7016299 100644 --- a/municipal-services/echallan-services/src/main/resources/db/migrate.sh +++ b/municipal-services/echallan-services/src/main/resources/db/migrate.sh @@ -1,3 +1,11 @@ #!/bin/sh - -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file +baseurl=$DB_URL +echo "the baseurl : $DB_URL" +schemasetter="?currentSchema=" +schemas=$SCHEMA_NAME +echo "the schemas : $schemas" +for schemaname in ${schemas//,/ } +do + echo "the schema name : ${baseurl}${schemasetter}${schemaname}" + flyway -url=${baseurl}${schemasetter}${schemaname} -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate +done \ No newline at end of file diff --git a/municipal-services/egov-user-event/pom.xml b/municipal-services/egov-user-event/pom.xml index fef4e3d472a..ec2f68ba93d 100644 --- a/municipal-services/egov-user-event/pom.xml +++ b/municipal-services/egov-user-event/pom.xml @@ -56,7 +56,7 @@ org.egov.services services-common - 1.0.0 + 1.1.0-SNAPSHOT @@ -97,12 +97,12 @@ org.egov mdms-client - 0.0.2-SNAPSHOT + 0.0.4-SNAPSHOT org.egov.services tracer - 2.0.0-SNAPSHOT + 2.1.0-SNAPSHOT @@ -113,7 +113,12 @@ - + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + repo.egovernments.org eGov ERP Releases Repository diff --git a/municipal-services/egov-user-event/src/main/java/org/egov/userevent/consumer/UserEventsConsumer.java b/municipal-services/egov-user-event/src/main/java/org/egov/userevent/consumer/UserEventsConsumer.java index dd036fcfc99..f74f3066692 100644 --- a/municipal-services/egov-user-event/src/main/java/org/egov/userevent/consumer/UserEventsConsumer.java +++ b/municipal-services/egov-user-event/src/main/java/org/egov/userevent/consumer/UserEventsConsumer.java @@ -40,9 +40,9 @@ public class UserEventsConsumer { public void listen(HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try { EventRequest eventReq = objectMapper.convertValue(record, EventRequest.class); - if(topic.equals(props.getSaveEventsTopic())) { + if(topic.contains(props.getSaveEventsTopic())) { service.createEvents(eventReq, false); - }else if(topic.equals(props.getUpdateEventsTopic())) { + }else if(topic.contains(props.getUpdateEventsTopic())) { service.updateEvents(eventReq); } }catch(Exception e) { diff --git a/municipal-services/firenoc-calculator/CHANGELOG.md b/municipal-services/firenoc-calculator/CHANGELOG.md index 93ee99b862c..cb30e405122 100644 --- a/municipal-services/firenoc-calculator/CHANGELOG.md +++ b/municipal-services/firenoc-calculator/CHANGELOG.md @@ -2,9 +2,13 @@ All notable changes to this module will be documented in this file. -## 1.3.2 - 2023-02-01 +## 1.2.3 - 2023-08-10 -- Transition from 1.3.2-beta version to 1.3.2 version +- Central Instance Library Integration + +## 1.2.2 - 2023-02-01 + +- Transition from 1.2.2-beta version to 1.2.2 version ## 1.2.1 - 2022-01-13 diff --git a/municipal-services/firenoc-calculator/package.json b/municipal-services/firenoc-calculator/package.json index 07a951a93d8..1d54165931d 100644 --- a/municipal-services/firenoc-calculator/package.json +++ b/municipal-services/firenoc-calculator/package.json @@ -1,6 +1,6 @@ { "name": "egov-firenoc-calculator", - "version": "1.2.1", + "version": "1.2.3", "private": true, "description": "Starter project for an ES6 RESTful Express API", "main": "dist", diff --git a/municipal-services/firenoc-calculator/src/controller/calculate.js b/municipal-services/firenoc-calculator/src/controller/calculate.js index ef2ac028334..32a4ccead97 100644 --- a/municipal-services/firenoc-calculator/src/controller/calculate.js +++ b/municipal-services/firenoc-calculator/src/controller/calculate.js @@ -9,7 +9,9 @@ import some from "lodash/some"; const calculalte = async (req, res, pool, next) => { console.log("calculalte"); let errors = validateCalculationReq(req.body); - if (errors.length <= 0) errors = await calculateValidate(req.body, errors); + var header = JSON.parse(JSON.stringify(req.headers)); + + if (errors.length <= 0) errors = await calculateValidate(req.body, errors, header); if (errors.length > 0) { next({ @@ -27,9 +29,9 @@ const calculalte = async (req, res, pool, next) => { res.send(calculalteResponse); }; -const calculateValidate = async (body, errors) => { +const calculateValidate = async (body, errors, header) => { let CalulationCriteria = body.CalulationCriteria; - let mdms = await mdmsData(body.RequestInfo, CalulationCriteria[0].tenantId); + let mdms = await mdmsData(body.RequestInfo, CalulationCriteria[0].tenantId, header); let teantnts = get( mdms, `MdmsRes.${constants.MDMS_MODULENAME_TENANT}.${ diff --git a/municipal-services/firenoc-calculator/src/controller/create.js b/municipal-services/firenoc-calculator/src/controller/create.js index d7e0acdfb80..ccbbd6d03b2 100644 --- a/municipal-services/firenoc-calculator/src/controller/create.js +++ b/municipal-services/firenoc-calculator/src/controller/create.js @@ -10,10 +10,11 @@ import { constants } from "../config/constants"; const create = async (req, res, next) => { console.log("create"); + var header = JSON.parse(JSON.stringify(req.headers)); let errors = []; errors = validateBillingSlabReq(req.body); - if (errors.length <= 0) errors = await createValidate(req.body, errors); + if (errors.length <= 0) errors = await createValidate(req.body, errors, header); if (errors.length > 0) { next({ @@ -55,11 +56,11 @@ const enrichCreateData = reqBody => { return reqBody.BillingSlabs; }; -const createValidate = async (body, errors) => { +const createValidate = async (body, errors, header) => { let BillingSlabs = body.BillingSlabs; for (let i = 0; i < BillingSlabs.length; i++) { let billingSlab = BillingSlabs[i]; - let mdms = await mdmsData(body.RequestInfo, billingSlab.tenantId); + let mdms = await mdmsData(body.RequestInfo, billingSlab.tenantId, header); let Buildingtypes = get( mdms, `MdmsRes.${constants.MDMS_MODULENAME_FIRENOC}.${ diff --git a/municipal-services/firenoc-calculator/src/controller/getbill.js b/municipal-services/firenoc-calculator/src/controller/getbill.js index 57e5eab00b2..0f84e79b298 100644 --- a/municipal-services/firenoc-calculator/src/controller/getbill.js +++ b/municipal-services/firenoc-calculator/src/controller/getbill.js @@ -5,6 +5,7 @@ import { validateBillReq } from "../utils/modelValidation"; const getbill = async (req, res, next) => { console.log("getbill"); const queryObj = JSON.parse(JSON.stringify(req.query)); + var header = JSON.parse(JSON.stringify(req.headers)); let errors = validateBillReq(queryObj); if (errors.length > 0) { @@ -21,7 +22,7 @@ const getbill = async (req, res, next) => { let getbillResponse = {}; let requestInfo = req.body.RequestInfo; let billCriteria = req.query; - getbillResponse = await generateBill(requestInfo, billCriteria); + getbillResponse = await generateBill(requestInfo, billCriteria, header); getbillResponse.ResponseInfo = requestInfoToResponseInfo(requestInfo, true); res.send(getbillResponse); }; diff --git a/municipal-services/firenoc-calculator/src/controller/search.js b/municipal-services/firenoc-calculator/src/controller/search.js index a810fc2e66e..c3d5ee34daf 100644 --- a/municipal-services/firenoc-calculator/src/controller/search.js +++ b/municipal-services/firenoc-calculator/src/controller/search.js @@ -1,5 +1,6 @@ import { requestInfoToResponseInfo, upadteForAuditDetails } from "../utils"; import { validateBillingSlabSearch } from "../utils/modelValidation"; +import { replaceSchemaPlaceholder } from "../utils/index"; const search = async (req, res, pool, next) => { console.log("search"); @@ -34,9 +35,8 @@ const search = async (req, res, pool, next) => { export default search; export const searchService = async (reqestCriteria, searchResponse, pool) => { - const querystring = generateQuery(reqestCriteria); - console.log(querystring); - + var querystring = generateQuery(reqestCriteria); + querystring = replaceSchemaPlaceholder(querystring, reqestCriteria.tenantId); let billingSlabs = []; billingSlabs = await pool .query(querystring) @@ -78,7 +78,7 @@ const popolateSearchResponse = result => { const generateQuery = params => { let queryString = - "select tenantid, id, isactive , firenoctype, buildingusagetype, calculationtype, uom, fromuom, touom, fromdate, todate, rate, createdby, createddate, lastmodifiedby, lastmodifieddate from eg_firenoc_billingslab where "; + "select tenantid, id, isactive , firenoctype, buildingusagetype, calculationtype, uom, fromuom, touom, fromdate, todate, rate, createdby, createddate, lastmodifiedby, lastmodifieddate from {schema}.eg_firenoc_billingslab where "; queryString = `${queryString} tenantid = '${params.tenantId}'`; if (params.hasOwnProperty("isActive")) { queryString = `${queryString} and isactive = ${params.isActive}`; diff --git a/municipal-services/firenoc-calculator/src/controller/update.js b/municipal-services/firenoc-calculator/src/controller/update.js index e6db31c735b..f105801fa9c 100644 --- a/municipal-services/firenoc-calculator/src/controller/update.js +++ b/municipal-services/firenoc-calculator/src/controller/update.js @@ -10,7 +10,9 @@ import { constants } from "../config/constants"; const update = async (req, res, next) => { console.log("update"); let errors = validateBillingSlabReq(req.body); - if (errors.length <= 0) errors = await updateValidate(req.body, errors); + var header = JSON.parse(JSON.stringify(req.headers)); + + if (errors.length <= 0) errors = await updateValidate(req.body, errors, header); if (errors.length > 0) { next({ @@ -47,11 +49,11 @@ const enrichUpdateData = reqBody => { return reqBody.BillingSlabs; }; -const updateValidate = async (body, errors) => { +const updateValidate = async (body, errors, header) => { let BillingSlabs = body.BillingSlabs; for (let i = 0; i < BillingSlabs.length; i++) { let billingSlab = BillingSlabs[i]; - let mdms = await mdmsData(body.RequestInfo, billingSlab.tenantId); + let mdms = await mdmsData(body.RequestInfo, billingSlab.tenantId, header); let Buildingtypes = get( mdms, `MdmsRes.${constants.MDMS_MODULENAME_FIRENOC}.${ diff --git a/municipal-services/firenoc-calculator/src/envVariables.js b/municipal-services/firenoc-calculator/src/envVariables.js index 93d1dab652d..1e78345c3fb 100644 --- a/municipal-services/firenoc-calculator/src/envVariables.js +++ b/municipal-services/firenoc-calculator/src/envVariables.js @@ -75,7 +75,12 @@ const envVariables = { TRACER_ENABLE_REQUEST_LOGGING: process.env.TRACER_ENABLE_REQUEST_LOGGING || false, HTTP_CLIENT_DETAILED_LOGGING_ENABLED: - process.env.HTTP_CLIENT_DETAILED_LOGGING_ENABLED || false + process.env.HTTP_CLIENT_DETAILED_LOGGING_ENABLED || false, + + // default state // IDEA: + EGOV_DEFAULT_STATE_ID: process.env.EGOV_DEFAULT_STATE_ID || "pb", + STATE_LEVEL_TENANTID_LENGTH: process.env.STATE_LEVEL_TENANTID_LENGTH || 1, + IS_ENVIRONMENT_CENTRAL_INSTANCE: process.env.IS_ENVIRONMENT_CENTRAL_INSTANCE || false }; export default envVariables; diff --git a/municipal-services/firenoc-calculator/src/model/validationReq.js b/municipal-services/firenoc-calculator/src/model/validationReq.js index aa0712f68e1..1712a2f8fdb 100644 --- a/municipal-services/firenoc-calculator/src/model/validationReq.js +++ b/municipal-services/firenoc-calculator/src/model/validationReq.js @@ -169,7 +169,7 @@ const Address = { }, landmark: { description: "additional landmark to help locate the address", - type: ["string", "null"], + type: ["string", "null"] }, city: { description: diff --git a/municipal-services/firenoc-calculator/src/services/calculateService.js b/municipal-services/firenoc-calculator/src/services/calculateService.js index 9742f4bdadf..1a848bd0c9e 100644 --- a/municipal-services/firenoc-calculator/src/services/calculateService.js +++ b/municipal-services/firenoc-calculator/src/services/calculateService.js @@ -8,6 +8,7 @@ import { mdmsData } from "./mdmsService"; export const calculateService = async (req, pool, next) => { let calculalteResponse = {}; + var header = JSON.parse(JSON.stringify(req.headers)); const requestInfo = req.body.RequestInfo; const tenantId = req.body.CalulationCriteria[0].tenantId; @@ -19,7 +20,7 @@ export const calculateService = async (req, pool, next) => { let calculations = await getCalculation(req, pool, next); calculalteResponse.Calculation = calculations; - let a = await generateDemand(requestInfo, tenantId, calculations); + let a = await generateDemand(requestInfo, tenantId, calculations, header); return calculalteResponse; }; @@ -27,6 +28,8 @@ export const calculateService = async (req, pool, next) => { const getCalculation = async (req, pool, next) => { let calculations = []; const requestInfo = req.body.RequestInfo; + var header = JSON.parse(JSON.stringify(req.headers)); + for (let i = 0; i < req.body.CalulationCriteria.length; i++) { let calculateCriteria = req.body.CalulationCriteria[i]; if (calculateCriteria.fireNOC) { @@ -39,7 +42,8 @@ const getCalculation = async (req, pool, next) => { let firefireNocSearchResponseNOC = getFireNoc( requestInfo, applicationNumber, - tenantId + tenantId, + header ); if ( !firefireNocSearchResponseNOC.FireNOCs || @@ -55,7 +59,8 @@ const getCalculation = async (req, pool, next) => { calculateCriteria, requestInfo, pool, - next + next, + header ); calculations.push(calculation); @@ -68,9 +73,10 @@ const calculateForSingleReq = async ( calculateCriteria, requestInfo, pool, - next + next, + header ) => { - let mdms = await mdmsData(requestInfo, calculateCriteria.tenantId); + let mdms = await mdmsData(requestInfo, calculateCriteria.tenantId, header); let mdmsConfig = {}; for (let i = 0; i < mdms.MdmsRes.firenoc.FireNocULBConstats.length; i++) { let constEntry = mdms.MdmsRes.firenoc.FireNocULBConstats[i]; diff --git a/municipal-services/firenoc-calculator/src/services/demandService.js b/municipal-services/firenoc-calculator/src/services/demandService.js index 6b7f270f96a..aa19b9e90a6 100644 --- a/municipal-services/firenoc-calculator/src/services/demandService.js +++ b/municipal-services/firenoc-calculator/src/services/demandService.js @@ -4,18 +4,19 @@ import get from "lodash/get"; import envVariables from "../envVariables"; import { mdmsFiananceYear } from "./mdmsService"; -export const generateDemand = async (requestInfo, tenantId, calculations) => { +export const generateDemand = async (requestInfo, tenantId, calculations, header) => { let consumercodeList = calculations.map(calculation => { return calculation.applicationNumber; }); - let mdms = await mdmsFiananceYear(requestInfo, tenantId); + let mdms = await mdmsFiananceYear(requestInfo, tenantId, header); let createcalculations = []; let updatecalculations = []; let demandsSearch = await searchDemand( requestInfo, tenantId, - consumercodeList + consumercodeList, + header ); let foundConsumerCode = demandsSearch.Demands.map(demand => { return demand.consumerCode; @@ -26,20 +27,21 @@ export const generateDemand = async (requestInfo, tenantId, calculations) => { else createcalculations.push(calculation); }); if (createcalculations.length > 0) { - let cr = await createDemand(requestInfo, createcalculations, mdms); + let cr = await createDemand(requestInfo, createcalculations, mdms, header); } if (updatecalculations.length > 0) { let ud = await updateDemand( requestInfo, updatecalculations, demandsSearch, - mdms + mdms, + header ); } return "uri"; }; -const createDemand = async (requestInfo, calculations, mdms) => { +const createDemand = async (requestInfo, calculations, mdms, header) => { // let financeYear = mdms. let FinancialYearsData = get(mdms, "MdmsRes.egf-master.FinancialYear"); let demands = []; @@ -76,14 +78,29 @@ const createDemand = async (requestInfo, calculations, mdms) => { RequestInfo: requestInfo, Demands: demands }; + + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else + header['tenantId']=demands[0].tenantId; + + headers = header; + var demandCreateResponse = await httpRequest({ hostURL: envVariables.EGOV_BILLINGSERVICE_HOST, endPoint: envVariables.EGOV_DEMAND_CREATE_ENDPOINT, - requestBody: DemandRequest + requestBody: DemandRequest, + headers }); }; -const updateDemand = async (requestInfo, calculations, demandsSearch, mdms) => { +const updateDemand = async (requestInfo, calculations, demandsSearch, mdms, header) => { let FinancialYearsData = get(mdms, "MdmsRes.egf-master.FinancialYear"); let demandMap = {}; @@ -129,40 +146,85 @@ const updateDemand = async (requestInfo, calculations, demandsSearch, mdms) => { RequestInfo: requestInfo, Demands: demands }; + + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else + header['tenantId']=demands[0].tenantId; + + headers = header; + var demandUpdateResponse = await httpRequest({ hostURL: envVariables.EGOV_BILLINGSERVICE_HOST, endPoint: envVariables.EGOV_DEMAND_UPDATE_ENDPOINT, - requestBody: DemandRequest + requestBody: DemandRequest, + headers }); }; -const searchDemand = async (requestInfo, tenantId, consumercodeList) => { +const searchDemand = async (requestInfo, tenantId, consumercodeList, header) => { let uri = generateDemandSearchURL(); uri = uri.replace("{1}", tenantId); uri = uri.replace("{2}", envVariables.BUSINESSSERVICE); uri = uri.replace("{3}", consumercodeList.join(",")); let requestBody = { RequestInfo: requestInfo }; + + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else + header['tenantId']=tenantId; + + headers = header; + var demandsSearch = null; demandsSearch = await httpRequest({ hostURL: envVariables.EGOV_BILLINGSERVICE_HOST, endPoint: uri, - requestBody + requestBody, + headers }); return demandsSearch; }; -export const generateBill = async (requestInfo, billCriteria) => { +export const generateBill = async (requestInfo, billCriteria, header) => { const consumerCode = billCriteria.applicationNumber.split(","); const tenantId = billCriteria.tenantId; - let demandsSearch = await searchDemand(requestInfo, tenantId, consumerCode); + let demandsSearch = await searchDemand(requestInfo, tenantId, consumerCode, header); if (demandsSearch.Demands && demandsSearch.Demands.length > 0) { let uri = generateGetBillURL(tenantId, consumerCode); let requestBody = { RequestInfo: requestInfo }; + + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else + header['tenantId']=tenantId; + + headers = header; + var billResponse = await httpRequest({ hostURL: envVariables.EGOV_BILLINGSERVICE_HOST, endPoint: uri, - requestBody + requestBody, + headers }); } else { throw "Invalid Consumer Code "; diff --git a/municipal-services/firenoc-calculator/src/services/firenocService.js b/municipal-services/firenoc-calculator/src/services/firenocService.js index 583dfded4e4..7c1ea81d3ba 100644 --- a/municipal-services/firenoc-calculator/src/services/firenocService.js +++ b/municipal-services/firenoc-calculator/src/services/firenocService.js @@ -2,14 +2,29 @@ import { httpRequest } from "../utils/api"; import { generateFireNOCSearchURL } from "../utils"; import envVariables from "../envVariables"; -export const getFireNoc = async (requestInfo, applciationNumber, tenantId) => { +export const getFireNoc = async (requestInfo, applciationNumber, tenantId, header) => { try { + + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else + header['tenantId']=tenantId; + + headers = header; + const uri = generateFireNOCSearchURL(tenantId, applciationNumber); let requestBody = { RequestInfo: requestInfo }; var fireNocSearchResponse = await httpRequest({ hostURL: envVariables.EGOV_FIRENOC_SERVICE_HOST, endPoint: uri, - requestBody + requestBody, + headers }); } catch (error) { throw "FireNOC Search Error"; diff --git a/municipal-services/firenoc-calculator/src/services/mdmsService.js b/municipal-services/firenoc-calculator/src/services/mdmsService.js index e43998bbbdf..0178c1eed07 100644 --- a/municipal-services/firenoc-calculator/src/services/mdmsService.js +++ b/municipal-services/firenoc-calculator/src/services/mdmsService.js @@ -2,7 +2,7 @@ import { httpRequest } from "../utils/api"; import envVariables from "../envVariables"; import { constants } from "../config/constants"; -export const mdmsData = async (requestInfo = {}, tenantId) => { +export const mdmsData = async (requestInfo = {}, tenantId, header) => { var requestBody = { RequestInfo: requestInfo, MdmsCriteria: { @@ -33,15 +33,30 @@ export const mdmsData = async (requestInfo = {}, tenantId) => { ] } }; + + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else + header['tenantId']=tenantId; + + headers = header; + var mdmsResponse = await httpRequest({ - hostURL: envVariables.EGOV_MDMS_HOST, + hostURL: `${envVariables.EGOV_MDMS_HOST}`, endPoint: `${envVariables.EGOV_MDMS_SEARCH_ENDPOINT}`, - requestBody + requestBody, + headers }); return mdmsResponse; }; -export const mdmsFiananceYear = async (requestInfo = {}, tenantId) => { +export const mdmsFiananceYear = async (requestInfo = {}, tenantId, header) => { var requestBody = { RequestInfo: requestInfo, MdmsCriteria: { @@ -59,10 +74,25 @@ export const mdmsFiananceYear = async (requestInfo = {}, tenantId) => { ] } }; + + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else + header['tenantId']=tenantId; + + headers = header; + var mdmsResponse = await httpRequest({ - hostURL: envVariables.EGOV_MDMS_HOST, + hostURL: `${envVariables.EGOV_MDMS_HOST}`, endPoint: `${envVariables.EGOV_MDMS_SEARCH_ENDPOINT}`, - requestBody + requestBody, + headers }); return mdmsResponse; }; \ No newline at end of file diff --git a/municipal-services/firenoc-calculator/src/utils/index.js b/municipal-services/firenoc-calculator/src/utils/index.js index 4eda63668c5..8dedff87172 100644 --- a/municipal-services/firenoc-calculator/src/utils/index.js +++ b/municipal-services/firenoc-calculator/src/utils/index.js @@ -80,3 +80,15 @@ export const generateFireNOCSearchURL = (tenantId, applicationNumber) => { return url; }; + +export const replaceSchemaPlaceholder = (query, tenantId) => { + let finalQuery = null; + var isCentralInstance = JSON.parse(envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE); + if (tenantId.includes('.') && isCentralInstance) { + let schemaName = tenantId.split('.')[1]; + finalQuery = query.replace(/{schema}/g, schemaName); + } else { + finalQuery = query.replace(/{schema}./g, ""); + } + return finalQuery; +}; \ No newline at end of file diff --git a/municipal-services/firenoc-services/.npmrc b/municipal-services/firenoc-services/.npmrc new file mode 100644 index 00000000000..4fd021952d5 --- /dev/null +++ b/municipal-services/firenoc-services/.npmrc @@ -0,0 +1 @@ +engine-strict=true \ No newline at end of file diff --git a/municipal-services/firenoc-services/CHANGELOG.md b/municipal-services/firenoc-services/CHANGELOG.md index 2fbda90aa9b..91ee580c2ba 100644 --- a/municipal-services/firenoc-services/CHANGELOG.md +++ b/municipal-services/firenoc-services/CHANGELOG.md @@ -3,6 +3,10 @@ # Changelog All notable changes to this module will be documented in this file. +## 1.3.3 - 2023-08-10 + +- Central Instance Library Integration +- ## 1.3.2 - 2023-02-01 - Transition from 1.3.2-beta version to 1.3.2 version diff --git a/municipal-services/firenoc-services/Dockerfile b/municipal-services/firenoc-services/Dockerfile index ecc451b7be2..094888dc43f 100644 --- a/municipal-services/firenoc-services/Dockerfile +++ b/municipal-services/firenoc-services/Dockerfile @@ -11,7 +11,7 @@ RUN npm install RUN npm run build # Create runtime image -FROM node:8.4-alpine +FROM node:14.17.1-alpine WORKDIR /opt/egov diff --git a/municipal-services/firenoc-services/migration/migrate.sh b/municipal-services/firenoc-services/migration/migrate.sh index 43960b25cdb..f79b7016299 100644 --- a/municipal-services/firenoc-services/migration/migrate.sh +++ b/municipal-services/firenoc-services/migration/migrate.sh @@ -1,3 +1,11 @@ #!/bin/sh - -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file +baseurl=$DB_URL +echo "the baseurl : $DB_URL" +schemasetter="?currentSchema=" +schemas=$SCHEMA_NAME +echo "the schemas : $schemas" +for schemaname in ${schemas//,/ } +do + echo "the schema name : ${baseurl}${schemasetter}${schemaname}" + flyway -url=${baseurl}${schemasetter}${schemaname} -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate +done \ No newline at end of file diff --git a/municipal-services/firenoc-services/package.json b/municipal-services/firenoc-services/package.json index 1db9b724f69..c5e7a35e0d7 100644 --- a/municipal-services/firenoc-services/package.json +++ b/municipal-services/firenoc-services/package.json @@ -1,6 +1,6 @@ { "name": "egov-firenoc-services", - "version": "1.3.2", + "version": "1.3.3", "private": true, "description": "Starter project for an ES6 RESTful Express API", "main": "dist", @@ -19,6 +19,7 @@ "sourceType": "module" }, "env": { + "es2020": true, "node": true }, "rules": { @@ -36,9 +37,9 @@ "cross-env": "^5.2.0", "express": "^4.13.3", "express-async-handler": "^1.1.4", - "kafka-node": "^4.1.3", + "kafka-node": "^5.0.0", "morgan": "^1.8.0", - "pg": "^7.6.1", + "pg": "^8.7.1", "random-number": "0.0.9", "resource-router-middleware": "^0.6.0", "swagger-express-validator": "^1.0.0", @@ -47,7 +48,8 @@ "util": "^0.12.0", "uuid": "^3.3.2", "winston": "^3.2.1", - "xss": "^1.0.9" + "xss": "^1.0.9", + "kafkajs": "1.16.0" }, "devDependencies": { "babel-cli": "^6.26.0", @@ -57,7 +59,7 @@ "babel-polyfill": "^6.26.0", "babel-preset-es2015": "^6.24.1", "babel-preset-stage-0": "^6.24.1", - "eslint": "^3.1.1", + "eslint": "^5.15.2", "nodemon": "^1.9.2" } } diff --git a/municipal-services/firenoc-services/src/api/create.js b/municipal-services/firenoc-services/src/api/create.js index 5fc7873c085..c91231fc72c 100644 --- a/municipal-services/firenoc-services/src/api/create.js +++ b/municipal-services/firenoc-services/src/api/create.js @@ -10,16 +10,19 @@ import mdmsData from "../utils/mdmsData"; import { addUUIDAndAuditDetails, updateStatus } from "../utils/create"; import { calculate } from "../services/firenocCalculatorService"; import { validateFireNOCModel } from "../utils/modelValidation"; +import { getUpdatedTopic, getStateSpecificTopicName} from "../utils/index"; import set from "lodash/set"; import get from "lodash/get"; +import { sendFireNOCSMSRequest } from "../utils/notificationUtil"; + const asyncHandler = require("express-async-handler"); export default ({ config }) => { let api = Router(); api.post( "/_create", - asyncHandler(async ({ body }, res, next) => { - let response = await createApiResponse({ body }, res, next); + asyncHandler(async (request, res, next) => { + let response = await createApiResponse(request, res, next); if(response.Errors) res.status(400); res.json(response); @@ -27,15 +30,18 @@ export default ({ config }) => { ); return api; }; -export const createApiResponse = async ({ body }, res, next) => { +export const createApiResponse = async (request, res, next) => { + var body = JSON.parse(JSON.stringify(request.body)); + var header = JSON.parse(JSON.stringify(request.headers)); let payloads = []; //getting mdms data - let mdms = await mdmsData(body.RequestInfo, body.FireNOCs[0].tenantId); + let mdms = await mdmsData(body.RequestInfo, body.FireNOCs[0].tenantId, header); //location data let locationResponse = await getLocationDetails( body.RequestInfo, - body.FireNOCs[0].tenantId + body.FireNOCs[0].tenantId, + header ); set( @@ -58,22 +64,37 @@ export const createApiResponse = async ({ body }, res, next) => { } // console.log(JSON.stringify(mdms)); - body = await addUUIDAndAuditDetails(body, "_create"); + body = await addUUIDAndAuditDetails(body, "_create", header); //console.log("Created Body: "+JSON.stringify(body)); - let workflowResponse = await createWorkFlow(body); + let workflowResponse = await createWorkFlow(body, header); // console.log(JSON.stringify(workflowResponse)); //need to implement notification //calculate call let { FireNOCs, RequestInfo } = body; for (var i = 0; i < FireNOCs.length; i++) { - let firenocResponse = await calculate(FireNOCs[i], RequestInfo); + let firenocResponse = await calculate(FireNOCs[i], RequestInfo, header); } body.FireNOCs = updateStatus(FireNOCs, workflowResponse); + + let topic = envVariables.KAFKA_TOPICS_FIRENOC_CREATE; + let tenantId = body.FireNOCs[0].tenantId; + + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance) + topic = getStateSpecificTopicName(tenantId, topic); + payloads.push({ - topic: envVariables.KAFKA_TOPICS_FIRENOC_CREATE, + topic: topic, messages: JSON.stringify(body) }); + + sendFireNOCSMSRequest(body.FireNOCs, RequestInfo); + + let response = { ResponseInfo: requestInfoToResponseInfo(body.RequestInfo, true), FireNOCs: body.FireNOCs diff --git a/municipal-services/firenoc-services/src/api/search.js b/municipal-services/firenoc-services/src/api/search.js index 0261d6605ad..dbf5d1e1d5c 100644 --- a/municipal-services/firenoc-services/src/api/search.js +++ b/municipal-services/firenoc-services/src/api/search.js @@ -7,6 +7,7 @@ import some from "lodash/some"; import keys from "lodash/keys"; import { actions } from "../utils/search"; import { validateFireNOCSearchModel } from "../utils/modelValidation"; +import { replaceSchemaPlaceholder, replaceSchemaPlaceholderCentralInstance} from "../utils/index"; import envVariables from "../envVariables"; const asyncHandler = require("express-async-handler"); import db from "../db"; @@ -28,9 +29,43 @@ export const searchApiResponse = async (request, next = {}) => { FireNOCs: [] }; const queryObj = JSON.parse(JSON.stringify(request.query)); - //console.log("request", request.query); - //console.log("Query object:"+JSON.stringify(queryObj)); + const header = JSON.parse(JSON.stringify(request.headers)); + + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + // Log and check tenantId + console.log("Received request with tenantId:", header.tenantid); + if (isCentralInstance && !header.tenantid) { + console.error("tenantId is undefined. Please provide a valid tenantId."); + next({ + errorType: "custom", + errorReponse: { + ResponseInfo: requestInfoToResponseInfo(request.body.RequestInfo, true), + Errors: [{ "FIRE_NOC_INVALID_HEADER": "tenantId header is required" }] + } + }); + return; + } + + console.log("Query object:", JSON.stringify(queryObj)); let errors = validateFireNOCSearchModel(queryObj); + + + + var stateLevelTenantIdLength = envVariables.STATE_LEVEL_TENANTID_LENGTH; + if(typeof stateLevelTenantIdLength == "string") + stateLevelTenantIdLength = parseInt(envVariables.STATE_LEVEL_TENANTID_LENGTH); + + if(isCentralInstance && queryObj.tenantId == null){ + let error = {"FIRE_NOC_INVALID_SEARCH":" TenantId is mandatory for search "}; + errors.push(error); + } + else if(isCentralInstance && queryObj.tenantId.split('.').length < stateLevelTenantIdLength){ + let error = {"FIRE_NOC_INVALID_SEARCH":" TenantId should be mandatorily " + stateLevelTenantIdLength + " levels for search"}; + errors.push(error); + } + if (errors.length > 0) { next({ errorType: "custom", @@ -43,7 +78,8 @@ export const searchApiResponse = async (request, next = {}) => { } console.log("QUERY OBJECT --> "+JSON.stringify(queryObj)); let text = - " SELECT * FROM (SELECT FN.uuid as FID,FN.tenantid,FN.fireNOCNumber,FN.provisionfirenocnumber,FN.oldfirenocnumber,FN.dateofapplied,FN.createdBy,FN.createdTime,FN.lastModifiedBy,FN.lastModifiedTime,FD.uuid as firenocdetailsid,FD.action,FD.applicationnumber,FD.fireNOCType,FD.applicationdate,FD.financialYear,FD.firestationid,FD.issuedDate,FD.validFrom,FD.validTo,FD.action,FD.status,FD.channel,FD.propertyid,FD.noofbuildings,FD.additionaldetail,FBA.uuid as puuid,FBA.doorno as pdoorno,FBA.latitude as platitude,FBA.longitude as plongitude,FBA.buildingName as pbuildingname,FBA.addressnumber as paddressnumber,FBA.pincode as ppincode,FBA.locality as plocality,FBA.city as pcity,FBA.street as pstreet,FB.uuid as buildingid ,FB.name as buildingname,FB.usagetype,FO.uuid as ownerid,FO.ownertype,FO.applicantcategory,FO.useruuid,FO.relationship,FUOM.uuid as uomuuid,FUOM.code,FUOM.value,FUOM.activeuom,FBD.uuid as documentuuid,FUOM.active,FBD.documentType,FBD.filestoreid,FBD.documentuid,FBD.createdby as documentCreatedBy,FBD.lastmodifiedby as documentLastModifiedBy,FBD.createdtime as documentCreatedTime,FBD.lastmodifiedtime as documentLastModifiedTime,DENSE_RANK () OVER(ORDER BY FN.uuid) rn FROM eg_fn_firenoc FN JOIN eg_fn_firenocdetail FD ON (FN.uuid = FD.firenocuuid) JOIN eg_fn_address FBA ON (FD.uuid = FBA.firenocdetailsuuid) JOIN eg_fn_owner FO ON (FD.uuid = FO.firenocdetailsuuid) JOIN eg_fn_buidlings FB ON (FD.uuid = FB.firenocdetailsuuid) JOIN eg_fn_buildinguoms FUOM ON (FB.uuid = FUOM.buildinguuid) LEFT OUTER JOIN eg_fn_buildingdocuments FBD on(FB.uuid = FBD.buildinguuid) "; + + " SELECT * FROM (SELECT FN.uuid as FID,FN.tenantid,FN.fireNOCNumber,FN.provisionfirenocnumber,FN.oldfirenocnumber,FN.dateofapplied,FN.createdBy,FN.createdTime,FN.lastModifiedBy,FN.lastModifiedTime,FD.uuid as firenocdetailsid,FD.action,FD.applicationnumber,FD.fireNOCType,FD.applicationdate,FD.financialYear,FD.firestationid,FD.issuedDate,FD.validFrom,FD.validTo,FD.action,FD.status,FD.channel,FD.propertyid,FD.noofbuildings,FD.additionaldetail,FBA.uuid as puuid,FBA.doorno as pdoorno,FBA.latitude as platitude,FBA.longitude as plongitude,FBA.buildingName as pbuildingname,FBA.addressnumber as paddressnumber,FBA.pincode as ppincode,FBA.locality as plocality,FBA.city as pcity,FBA.street as pstreet,FB.uuid as buildingid ,FB.name as buildingname,FB.usagetype,FO.uuid as ownerid,FO.ownertype,FO.applicantcategory,FO.useruuid,FO.relationship,FUOM.uuid as uomuuid,FUOM.code,FUOM.value,FUOM.activeuom,FBD.uuid as documentuuid,FUOM.active,FBD.documentType,FBD.filestoreid,FBD.documentuid,FBD.createdby as documentCreatedBy,FBD.lastmodifiedby as documentLastModifiedBy,FBD.createdtime as documentCreatedTime,FBD.lastmodifiedtime as documentLastModifiedTime,DENSE_RANK () OVER(ORDER BY FN.uuid) rn FROM {schema}.eg_fn_firenoc FN JOIN {schema}.eg_fn_firenocdetail FD ON (FN.uuid = FD.firenocuuid) JOIN {schema}.eg_fn_address FBA ON (FD.uuid = FBA.firenocdetailsuuid) JOIN {schema}.eg_fn_owner FO ON (FD.uuid = FO.firenocdetailsuuid) JOIN {schema}.eg_fn_buidlings FB ON (FD.uuid = FB.firenocdetailsuuid) JOIN {schema}.eg_fn_buildinguoms FUOM ON (FB.uuid = FUOM.buildinguuid) LEFT OUTER JOIN {schema}.eg_fn_buildingdocuments FBD on(FB.uuid = FBD.buildinguuid) "; // FBD.active=true AND FO.active=true AND FUOM.active=true AND"; //if citizen const roles = get(request.body, "RequestInfo.userInfo.roles"); @@ -51,9 +87,9 @@ export const searchApiResponse = async (request, next = {}) => { const isUser = some(roles, { code: "CITIZEN" }) && userUUID; if (isUser) { const mobileNumber = get(request.body, "RequestInfo.userInfo.mobileNumber"); - const tenantId = envVariables.EGOV_DEFAULT_STATE_ID; - - const noFieldsPresent = null == queryObj.applicationNumber + const tenantId = get(request.body, "RequestInfo.userInfo.permanentCity"); + + const noFieldsPresent = null == queryObj.applicationNumber && null == queryObj.createdby; if(noFieldsPresent) { @@ -63,20 +99,24 @@ export const searchApiResponse = async (request, next = {}) => { } queryObj.tenantId = queryObj.tenantId ? queryObj.tenantId : tenantId; - if(queryObj.tenantId == envVariables.EGOV_DEFAULT_STATE_ID) - text = `${text} where FN.tenantid LIKE '${queryObj.tenantId}%' AND`; - else + if(queryObj.tenantId.split('.').length <= stateLevelTenantIdLength){ + text = `${text} where FN.tenantid LIKE '${queryObj.tenantId}%' AND`; // is tenantid statelevel + } + else{ text = `${text} where FN.tenantid = '${queryObj.tenantId}' AND`; + } } else { - if (!isEmpty(queryObj) && !(keys(queryObj).length==2 && + if (!isEmpty(queryObj) && !(keys(queryObj).length==2 && queryObj.hasOwnProperty("offset") && queryObj.hasOwnProperty("limit"))) { text = text + " where "; } if (queryObj.tenantId) { - if(queryObj.tenantId == envVariables.EGOV_DEFAULT_STATE_ID) + if(queryObj.tenantId.split('.').length <= stateLevelTenantIdLength){ text = `${text} FN.tenantid LIKE '${queryObj.tenantId}%' AND`; - else + } + else{ text = `${text} FN.tenantid = '${queryObj.tenantId}' AND`; + } } } // if (queryObj.status) { @@ -88,7 +128,8 @@ export const searchApiResponse = async (request, next = {}) => { // console.log("mobile number"); let userSearchResponse = await searchByMobileNumber( queryObj.mobileNumber, - envVariables.EGOV_DEFAULT_STATE_ID + envVariables.EGOV_DEFAULT_STATE_ID, + header ); //console.log("User Search Response-> " + userSearchResponse); @@ -96,17 +137,16 @@ export const searchApiResponse = async (request, next = {}) => { // if (searchUserUUID) { // // console.log(searchUserUUID); var userSearchResponseJson = JSON.parse(JSON.stringify(userSearchResponse)); - var userUUIDArray = []; - for (var i = 0; i < userSearchResponseJson.user.length; i++) { + var userUUIDArray =[]; + for(var i =0;i " + userUUIDArray.length); - let firenocIdQuery = `SELECT FN.uuid as FID FROM eg_fn_firenoc FN JOIN eg_fn_firenocdetail FD ON (FN.uuid = FD.firenocuuid) JOIN eg_fn_owner FO ON (FD.uuid = FO.firenocdetailsuuid) where `; + let firenocIdQuery = `SELECT FN.uuid as FID FROM {schema}.eg_fn_firenoc FN JOIN {schema}.eg_fn_firenocdetail FD ON (FN.uuid = FD.firenocuuid) JOIN {schema}.eg_fn_owner FO ON (FD.uuid = FO.firenocdetailsuuid) where `; if (queryObj.tenantId) { - if (queryObj.tenantId == envVariables.EGOV_DEFAULT_STATE_ID) { - firenocIdQuery = `${firenocIdQuery} FN.tenantid LIKE '${queryObj.tenantId}%' AND`; + if (queryObj.tenantId.split('.').length <= stateLevelTenantIdLength) { + firenocIdQuery = `${firenocIdQuery} FN.tenantid LIKE '${queryObj.tenantId}%' AND`; //is state level tenantId } else { firenocIdQuery = `${firenocIdQuery} FN.tenantid = '${queryObj.tenantId}' AND`; } @@ -124,17 +164,16 @@ export const searchApiResponse = async (request, next = {}) => { sqlQuery = `${sqlQuery}'${userUUIDArray[j]}'`; sqlQuery = `${sqlQuery}, '${userUUIDArray[j]}'`; - } + } } else sqlQuery = `${sqlQuery}'${queryObj.mobileNumber}'`; - sqlQuery = `${sqlQuery}) AND`; + sqlQuery = `${sqlQuery}) AND`; }*/ + firenocIdQuery = `${firenocIdQuery} FO.useruuid in (`; if (userUUIDArray.length > 0) { - firenocIdQuery = `${firenocIdQuery} FO.useruuid in (`; - for (var j = 0; j < userUUIDArray.length; j++) { if (j == 0) { firenocIdQuery = `${firenocIdQuery}'${userUUIDArray[j]}'`; @@ -142,15 +181,15 @@ export const searchApiResponse = async (request, next = {}) => { firenocIdQuery = `${firenocIdQuery}, '${userUUIDArray[j]}'`; } } - firenocIdQuery = `${firenocIdQuery} )`; - } else firenocIdQuery = `${firenocIdQuery}'${queryObj.mobileNumber}'`; - //firenocIdQuery = `${firenocIdQuery} )`; + firenocIdQuery = `${firenocIdQuery} )`; + + firenocIdQuery = replaceSchemaPlaceholderCentralInstance(firenocIdQuery, queryObj.tenantId); + console.log("Firenoc ID Query -> " + firenocIdQuery); - const dbResponse = await db.query(firenocIdQuery); - //const dbResponse={"rows":[],"err":null}; + const dbResponse = await db.query(firenocIdQuery); let firenocIds = []; console.log("dbResponse" + JSON.stringify(dbResponse)); if (dbResponse.err) { @@ -216,11 +255,18 @@ export const searchApiResponse = async (request, next = {}) => { queryObj.hasOwnProperty("fromDate") && !queryObj.hasOwnProperty("toDate") ) { - sqlQuery = `${sqlQuery} FN.createdtime >= ${queryObj.fromDate} AND`; + sqlQuery = `${sqlQuery} FN.createdtime >= ${queryObj.fromDate} `; } - - + try { + sqlQuery = replaceSchemaPlaceholderCentralInstance(sqlQuery, queryObj.tenantId); + } catch (error) { + var errorResponse = error.response; + logger.error(error.stack || error) ; + throw {message:"TenantId length is not sufficient to replace query schema in a multi state instance :"+(errorResponse ? parseInt(errorResponse.status, 10):error.message)}; + } + + if (!isEmpty(queryObj) && ( queryObj.hasOwnProperty("limit" || queryObj.hasOwnProperty("offset")))) { let offset =0; @@ -259,7 +305,8 @@ export const searchApiResponse = async (request, next = {}) => { ? await mergeSearchResults( dbResponse.rows, request.query, - request.body.RequestInfo + request.body.RequestInfo, + header ) : []; } @@ -281,4 +328,4 @@ export const searchApiResponse = async (request, next = {}) => { // return (response); // } // }); -}; +}; \ No newline at end of file diff --git a/municipal-services/firenoc-services/src/api/update.js b/municipal-services/firenoc-services/src/api/update.js index 07d4b2897e6..3e2b346e09c 100644 --- a/municipal-services/firenoc-services/src/api/update.js +++ b/municipal-services/firenoc-services/src/api/update.js @@ -4,6 +4,7 @@ import envVariables from "../envVariables"; const asyncHandler = require("express-async-handler"); import mdmsData from "../utils/mdmsData"; import { addUUIDAndAuditDetails, updateStatus, enrichAssignees} from "../utils/create"; +import { getUpdatedTopic, getStateSpecificTopicName } from "../utils/index"; import { getApprovedList } from "../utils/update"; import { @@ -22,8 +23,8 @@ export default ({ config }) => { let api = Router(); api.post( "/_update", - asyncHandler(async ({ body }, res, next) => { - let response = await updateApiResponse({ body }, true, next); + asyncHandler(async (request, res, next) => { + let response = await updateApiResponse(request, true, next); if(response.Errors) res.status(400); res.json(response); @@ -31,15 +32,18 @@ export default ({ config }) => { ); return api; }; -export const updateApiResponse = async ({ body }, isExternalCall, next = {}) => { +export const updateApiResponse = async (request, isExternalCall, next = {}) => { //console.log("Update Body: "+JSON.stringify(body)); + var body = JSON.parse(JSON.stringify(request.body)); + var header = JSON.parse(JSON.stringify(request.headers)); let payloads = []; - let mdms = await mdmsData(body.RequestInfo, body.FireNOCs[0].tenantId); + let mdms = await mdmsData(body.RequestInfo, body.FireNOCs[0].tenantId, header); //model validator //location data let locationResponse = await getLocationDetails( body.RequestInfo, - body.FireNOCs[0].tenantId + body.FireNOCs[0].tenantId, + header ); set( @@ -60,7 +64,7 @@ export const updateApiResponse = async ({ body }, isExternalCall, next = {}) => return; } - body = await addUUIDAndAuditDetails(body); + body = await addUUIDAndAuditDetails(body, "_update", header); let { FireNOCs = [], RequestInfo = {} } = body; let errorMap = []; @@ -68,10 +72,10 @@ export const updateApiResponse = async ({ body }, isExternalCall, next = {}) => // let approvedList=await getApprovedList(cloneDeep(body)); //Enrich assignee - body.FireNOCs = await enrichAssignees(FireNOCs, RequestInfo); + body.FireNOCs = await enrichAssignees(FireNOCs, RequestInfo, header); //applay workflow - let workflowResponse = await createWorkFlow(body); + let workflowResponse = await createWorkFlow(body, header); @@ -94,14 +98,28 @@ export const updateApiResponse = async ({ body }, isExternalCall, next = {}) => //calculate call for (var i = 0; i < FireNOCs.length; i++) { - let firenocResponse = await calculate(FireNOCs[i], RequestInfo); + let firenocResponse = await calculate(FireNOCs[i], RequestInfo, header); } body.FireNOCs = updateStatus(FireNOCs, workflowResponse); //console.log("Fire NoC body"+JSON.stringify(body.FireNOCs)); + let topic = envVariables.KAFKA_TOPICS_FIRENOC_UPDATE; + let tenantId = body.FireNOCs[0].tenantId; + + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance) + topic = getStateSpecificTopicName(tenantId, topic); + + payloads.push({ + topic: topic, + messages: JSON.stringify(body) + }); payloads.push({ - topic: envVariables.KAFKA_TOPICS_FIRENOC_UPDATE, + topic: envVariables.KAFKA_TOPICS_FIRENOC_UPDATE_SMS, messages: JSON.stringify(body) }); @@ -112,8 +130,23 @@ export const updateApiResponse = async ({ body }, isExternalCall, next = {}) => // console.log("list length",approvedList.length); if (approvedList.length > 0) { + let topic = envVariables.KAFKA_TOPICS_FIRENOC_WORKFLOW; + let tenantId = body.FireNOCs[0].tenantId; + + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance) + topic = getStateSpecificTopicName(tenantId, topic); + + payloads.push({ + topic: topic, + messages: JSON.stringify({ RequestInfo, FireNOCs: approvedList }) + }); + payloads.push({ - topic: envVariables.KAFKA_TOPICS_FIRENOC_WORKFLOW, + topic: envVariables.KAFKA_TOPICS_FIRENOC_WORKFLOW_SMS, messages: JSON.stringify({ RequestInfo, FireNOCs: approvedList }) }); } diff --git a/municipal-services/firenoc-services/src/envVariables.js b/municipal-services/firenoc-services/src/envVariables.js index bc5443a98fd..4d5dcec101e 100644 --- a/municipal-services/firenoc-services/src/envVariables.js +++ b/municipal-services/firenoc-services/src/envVariables.js @@ -21,12 +21,26 @@ const envVariables = { process.env.KAFKA_TOPICS_FIRENOC_UPDATE || "update-fn-firenoc", KAFKA_TOPICS_FIRENOC_WORKFLOW: process.env.KAFKA_TOPICS_FIRENOC_WORKFLOW || "update-fn-workflow", - KAFKA_TOPICS_RECEIPT_CREATE: - process.env.KAFKA_TOPICS_RECEIPT_CREATE || "egov.collection.payment-create", + KAFKA_TOPICS_RECEIPT_CREATE_REGEX: + process.env.KAFKA_TOPICS_RECEIPT_CREATE_REGEX || /egov.collection.payment-create$/i, KAFKA_TOPICS_NOTIFICATION: process.env.KAFKA_TOPICS_NOTIFICATION || "egov.core.notification.sms", KAFKA_TOPICS_EVENT_NOTIFICATION: - process.env.KAFKA_TOPICS_EVENT_NOTIFICATION || "persist-events-async", + process.env.KAFKA_TOPICS_EVENT_NOTIFICATION || "persist-user-events-async", + + KAFKA_TOPICS_FIRENOC_CREATE_SMS: + process.env.KAFKA_TOPICS_FIRENOC_CREATE_SMS || "save-fn-firenoc-sms", + KAFKA_TOPICS_FIRENOC_UPDATE_SMS: + process.env.KAFKA_TOPICS_FIRENOC_UPDATE_SMS || "update-fn-firenoc-sms", + KAFKA_TOPICS_FIRENOC_WORKFLOW_SMS: + process.env.KAFKA_TOPICS_FIRENOC_WORKFLOW_SMS || "update-fn-workflow-sms", + + KAFKA_TOPICS_FIRENOC_CREATE_SMS_REGEX: + process.env.KAFKA_TOPICS_FIRENOC_CREATE_SMS_REGEX || /save-fn-firenoc-sms$/i, + KAFKA_TOPICS_FIRENOC_UPDATE_SMS_REGEX: + process.env.KAFKA_TOPICS_FIRENOC_UPDATE_SMS_REGEX || /update-fn-firenoc-sms$/i, + KAFKA_TOPICS_FIRENOC_WORKFLOW_SMS_REGEX: + process.env.KAFKA_TOPICS_FIRENOC_WORKFLOW_SMS_REGEX || /update-fn-workflow-sms$/i, //tracer configurations TRACER_ENABLE_REQUEST_LOGGING: @@ -129,6 +143,8 @@ const envVariables = { // default state // IDEA: EGOV_DEFAULT_STATE_ID: process.env.EGOV_DEFAULT_STATE_ID || "pg", + STATE_LEVEL_TENANTID_LENGTH: process.env.STATE_LEVEL_TENANTID_LENGTH || 1, + IS_ENVIRONMENT_CENTRAL_INSTANCE: process.env.IS_ENVIRONMENT_CENTRAL_INSTANCE || false, //pagination configurations EGOV_FN_DEFAULT_OFFSET: process.env.EGOV_FN_DEFAULT_OFFSET || 0, diff --git a/municipal-services/firenoc-services/src/kafka/consumer.js b/municipal-services/firenoc-services/src/kafka/consumer.js index e688a31734b..d0ec51cb3f1 100644 --- a/municipal-services/firenoc-services/src/kafka/consumer.js +++ b/municipal-services/firenoc-services/src/kafka/consumer.js @@ -1,293 +1,307 @@ -const kafka = require("kafka-node"); +const { Kafka, logLevel } = require('kafkajs') import envVariables from "../envVariables"; import producer from "./producer"; import get from "lodash/get"; import set from "lodash/set"; import { searchApiResponse } from "../api/search"; import { updateApiResponse } from "../api/update"; +import { getUpdatedTopic, getStateSpecificTopicName } from "../utils/index"; +import userService from "../services/userService"; // import { httpRequest } from "../api"; -var options = { - // connect directly to kafka broker (instantiates a KafkaClient) - kafkaHost: envVariables.KAFKA_BROKER_HOST, - groupId: "firenoc-consumer-grp", - autoCommit: true, - autoCommitIntervalMs: 5000, - sessionTimeout: 15000, - fetchMaxBytes: 10 * 1024 * 1024, // 10 MB - // An array of partition assignment protocols ordered by preference. 'roundrobin' or 'range' string for - // built ins (see below to pass in custom assignment protocol) - protocol: ["roundrobin"], - // Offsets to use for new groups other options could be 'earliest' or 'none' - // (none will emit an error if no offsets were saved) equivalent to Java client's auto.offset.reset - fromOffset: "latest", - // how to recover from OutOfRangeOffset error (where save offset is past server retention) - // accepts same value as fromOffset - outOfRangeOffset: "earliest" -}; -var consumerGroup = new kafka.ConsumerGroup(options, [ - envVariables.KAFKA_TOPICS_FIRENOC_CREATE, - envVariables.KAFKA_TOPICS_FIRENOC_UPDATE, - envVariables.KAFKA_TOPICS_FIRENOC_WORKFLOW, - envVariables.KAFKA_TOPICS_RECEIPT_CREATE -]); +const kafka = new Kafka({ + logLevel: logLevel.INFO, + brokers: [envVariables.KAFKA_BROKER_HOST], + ssl: false, + clientId: 'example-consumer', +}); + +const consumer = kafka.consumer({ groupId: 'firenoc-consumer-grp' }); console.log("Consumer "); -consumerGroup.on("message", function(message) { - console.log("consumer-topic", message.topic); - // console.log("consumer-value", JSON.parse(message.value)); - const value = JSON.parse(message.value); +const run = async () => { + await consumer.connect() + await consumer.subscribe({ topic: envVariables.KAFKA_TOPICS_RECEIPT_CREATE_REGEX, fromBeginning: true}); + await consumer.subscribe({ topic: envVariables.KAFKA_TOPICS_FIRENOC_CREATE_SMS_REGEX, fromBeginning: true}); + await consumer.subscribe({ topic: envVariables.KAFKA_TOPICS_FIRENOC_UPDATE_SMS_REGEX, fromBeginning: true}); + await consumer.subscribe({ topic: envVariables.KAFKA_TOPICS_FIRENOC_WORKFLOW_SMS_REGEX, fromBeginning: true}); - let payloads = []; - const topic = envVariables.KAFKA_TOPICS_NOTIFICATION; - let smsRequest = {}; - let fireNOCRequest = {}; - let events = []; - let { RequestInfo } = value; + await consumer.run({ + eachMessage: async ({ topic, partition, message }) => { + console.log("consumer-topic",topic); + let value = JSON.parse(message.value); - const sendEventNotificaiton = () => { - let requestPayload = { - // RequestInfo, - events - }; + let payloads = []; + //const topic = envVariables.KAFKA_TOPICS_NOTIFICATION; + let smsRequest = {}; + let fireNOCRequest = {}; + let events = []; + let { RequestInfo } = value; - payloads.push({ - topic: envVariables.KAFKA_TOPICS_EVENT_NOTIFICATION, - messages: JSON.stringify(requestPayload) - }); - // httpRequest({ - // hostURL: envVariables.EGOV_EVENT_HOST, - // endPoint: `${envVariables.EGOV_EVENT_CONTEXT_PATH}${envVariables.EGOV_EVENT_CREATE_ENPOINT}`, - // requestPayload - // }).then( - // function(response) { - // console.log(response); - // }, - // function(error) { - // console.log(error); - // } - // ); - }; + const sendEventNotificaiton = (tenantId) => { + let requestPayload = { + RequestInfo, + events + }; - const sendFireNOCSMSRequest = FireNOCs => { - for (let i = 0; i < FireNOCs.length; i++) { - smsRequest["mobileNumber"] = get( - FireNOCs[i], - "fireNOCDetails.applicantDetails.owners.0.mobileNumber" - ); - let firenocType = - get(FireNOCs[i], "fireNOCDetails.fireNOCType") === "NEW" - ? "new" - : "provision"; + let topic = envVariables.KAFKA_TOPICS_EVENT_NOTIFICATION; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); - let ownerName = get( - FireNOCs[i], - "fireNOCDetails.applicantDetails.owners.0.name" - ); - let uuid = get( - FireNOCs[i], - "fireNOCDetails.applicantDetails.owners.0.uuid" - ); - let applicationNumber = get( - FireNOCs[i], - "fireNOCDetails.applicationNumber" - ); - let fireNOCNumber = get(FireNOCs[i], "fireNOCDetails.validTo"); - let validTo = get(FireNOCs[i], "fireNOCDetails.validTo"); - let tenantId = get(FireNOCs[i], "tenantId"); - switch (FireNOCs[i].fireNOCDetails.status) { - case "INITIATED": - smsRequest[ - "message" - ] = `Dear ${ownerName},Your application for ${firenocType} has been generated. Your application no. is ${applicationNumber}.\n\nEGOVS`; - break; - case "PENDINGPAYMENT": - smsRequest[ - "message" - ] = `Dear ${ownerName},Your application for ${firenocType} has been submitted. Your application no. is ${applicationNumber}. Please pay your NoC Fees online or at your applicable fire office\n\nEGOVS`; - break; - case "DOCUMENTVERIFY": - smsRequest[ - "message" - ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} has been forwarded for document verifier.\n\nEGOVS`; - break; - case "FIELDINSPECTION": - smsRequest[ - "message" - ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} has been forwarded for field inpsection.\n\nEGOVS`; - break; - case "PENDINGAPPROVAL": - smsRequest[ - "message" - ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} has been forwarded for approver.\n\nEGOVS`; - break; - case "APPROVED": - var currentDate = new Date(validTo); - var date = currentDate.getDate(); - var month = currentDate.getMonth(); //Be careful! January is 0 not 1 - var year = currentDate.getFullYear(); + if(isCentralInstance) + topic = getStateSpecificTopicName(tenantId, topic); - var dateString = - date + - "-" + - (month + 1 > 9 ? month + 1 : `0${month + 1}`) + - "-" + - year; + payloads.push({ + topic: topic, + messages: JSON.stringify(requestPayload) + }); + // httpRequest({ + // hostURL: envVariables.EGOV_EVENT_HOST, + // endPoint: `${envVariables.EGOV_EVENT_CONTEXT_PATH}${envVariables.EGOV_EVENT_CREATE_ENPOINT}`, + // requestPayload + // }).then( + // function(response) { + // console.log(response); + // }, + // function(error) { + // console.log(error); + // } + // ); + }; - smsRequest[ - "message" - ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} is approved.And your fire NoC has been generated.Your Fire NoC No. is ${fireNOCNumber}. It is valid till ${dateString}\n\nEGOVS`; - break; - case "CITIZENACTIONREQUIRED-DV": - smsRequest[ - "message" - ] = `Dear ${ownerName}, - Your application for ${firenocType} Fire NOC Certificate with application no. ${applicationNumber} is send back to you for further actions.Please check the comments and Re-submit application through mSeva App or by ULB counter.\n\nEGOVS`; - break; - case "CITIZENACTIONREQUIRED": - smsRequest[ - "message" - ] = `Dear ${ownerName}, - Your application for ${firenocType} Fire NOC Certificate with application no. ${applicationNumber} is send back to you for further actions.Please check the comments and Re-submit application through mSeva App or by ULB counter.\n\nEGOVS`; - break; - case "REJECTED": - smsRequest[ - "message" - ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} has been rejected.To know more details please contact your applicable fire office\n\nEGOVS`; - break; - // case "CANCELLED": - // break; - default: - } - payloads.push({ - topic, - messages: JSON.stringify(smsRequest) - }); - // console.log("smsRequest",smsRequest); - if (smsRequest.message) { - events.push({ - tenantId: tenantId, - eventType: "SYSTEMGENERATED", - description: smsRequest.message, - name: "Firenoc notification", - source: "webapp", - recepient: { - toUsers: [uuid] - } - }); - } - } - // console.log("events",events); - if (events.length > 0) { - sendEventNotificaiton(); - } - }; - const FireNOCPaymentStatus = async value => { - try { - //console.log("Consumer Payment data"+JSON.stringify(value)); - const { Payment, RequestInfo } = value; - let tenantId = get(Payment, "tenantId"); - const { paymentDetails } = Payment; - if (paymentDetails) { - for (var index = 0; index < paymentDetails.length; index++) { - let businessService = get(paymentDetails[index], "businessService"); - if (businessService === envVariables.BUSINESS_SERVICE) { + const sendFireNOCSMSRequest = async FireNOCs => { + let tenantId = get(FireNOCs[0], "tenantId"); + for (let i = 0; i < FireNOCs.length; i++) { + let mobileNumber = get( + FireNOCs[i], + "fireNOCDetails.applicantDetails.owners.0.mobileNumber" + ); + smsRequest["mobileNumber"] = mobileNumber; + let firenocType = + get(FireNOCs[i], "fireNOCDetails.fireNOCType") === "NEW" + ? "new" + : "provision"; + + let ownerName = get( + FireNOCs[i], + "fireNOCDetails.applicantDetails.owners.0.name" + ); + let uuid = get( + FireNOCs[i], + "fireNOCDetails.applicantDetails.owners.0.uuid" + ); let applicationNumber = get( - paymentDetails[index], - "bill.consumerCode" + FireNOCs[i], + "fireNOCDetails.applicationNumber" ); - const query = { - tenantId, - applicationNumber - }; - const body = { RequestInfo }; - const searchRequest = { body, query }; - const searchResponse = await searchApiResponse(searchRequest); - //console.log("search response: "+JSON.stringify(searchResponse)); - const { FireNOCs } = searchResponse; - if (!FireNOCs.length) { - throw "FIRENOC Search error"; + let fireNOCNumber = get(FireNOCs[i], "fireNOCDetails.validTo"); + let validTo = get(FireNOCs[i], "fireNOCDetails.validTo"); + let tenantId = get(FireNOCs[i], "tenantId"); + switch (FireNOCs[i].fireNOCDetails.status) { + case "INITIATED": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} has been generated. Your application no. is ${applicationNumber}.\n\nEGOVS`; + break; + case "PENDINGPAYMENT": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} has been submitted. Your application no. is ${applicationNumber}. Please pay your NoC Fees online or at your applicable fire office\n\nEGOVS`; + break; + case "DOCUMENTVERIFY": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} has been forwarded for document verifier.\n\nEGOVS`; + break; + case "FIELDINSPECTION": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} has been forwarded for field inpsection.\n\nEGOVS`; + break; + case "PENDINGAPPROVAL": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} has been forwarded for approver.\n\nEGOVS`; + break; + case "APPROVED": + var currentDate = new Date(validTo); + var date = currentDate.getDate(); + var month = currentDate.getMonth(); //Be careful! January is 0 not 1 + var year = currentDate.getFullYear(); + + var dateString = + date + + "-" + + (month + 1 > 9 ? month + 1 : `0${month + 1}`) + + "-" + + year; + + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} is approved.And your fire NoC has been generated.Your Fire NoC No. is ${fireNOCNumber}. It is valid till ${dateString}\n\nEGOVS`; + break; + case "CITIZENACTIONREQUIRED": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} Fire NOC Certificate with application no. ${applicationNumber} is send back to you for further actions.Please check the comments and Re-submit application through mSeva App or by ULB counter.\n\nEGOVS`; + break; + case "CITIZENACTIONREQUIRED-DV": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} Fire NOC Certificate with application no. ${applicationNumber} is send back to you for further actions.Please check the comments and Re-submit application through mSeva App or by ULB counter.\n\nEGOVS`; + break; + case "REJECTED": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} has been rejected.To know more details please contact your applicable fire office\n\nEGOVS`; + break; + // case "CANCELLED": + // break; + default: } - for ( - var firenocIndex = 0; - firenocIndex < FireNOCs.length; - firenocIndex++ - ) { - set( - FireNOCs[firenocIndex], - "fireNOCDetails.action", - envVariables.ACTION_PAY + + let topic = envVariables.KAFKA_TOPICS_NOTIFICATION; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance) + topic = getStateSpecificTopicName(tenantId, topic); + + payloads.push({ + topic: topic, + messages: JSON.stringify(smsRequest) + }); + // console.log("smsRequest",JSON.stringify(smsRequest)); + if (smsRequest.message) { + let userSearchReqCriteria = {}; + let userSearchResponse = {}; + let header = { + tenantid:tenantId + }; + userSearchReqCriteria.userName = mobileNumber; + userSearchReqCriteria.active = true; + userSearchReqCriteria.tenantId = envVariables.EGOV_DEFAULT_STATE_ID; + userSearchResponse = await userService.searchUser( + RequestInfo, + userSearchReqCriteria, + header ); + if (get(userSearchResponse, "user", []).length > 0) { + events.push({ + tenantId: tenantId, + eventType: "SYSTEMGENERATED", + description: smsRequest.message, + name: "Firenoc notification", + source: "webapp", + recepient: { + toUsers: [userSearchResponse.user[0].uuid] + } + }); + } + } + } + // console.log("events",events); + if (events.length > 0) { + sendEventNotificaiton(tenantId); + } - for(var index =0; index < RequestInfo.userInfo.roles.length;index++){ - let tenantId = get(RequestInfo.userInfo,"tenantId"); - set(RequestInfo.userInfo.roles[index],"tenantId",tenantId); - //console.log("Workflow TenantId",get(body.RequestInfo.userInfo.roles[index],"tenantId")); + producer.send(payloads, function(err, data) { + if (!err) { + console.log(data); + } else { + console.log(err); } + }); + + }; + const FireNOCPaymentStatus = async value => { + try { + //console.log("Consumer Payment data"+JSON.stringify(value)); + const { Payment, RequestInfo } = value; + let tenantId = get(Payment, "tenantId"); + const { paymentDetails } = Payment; + if (paymentDetails) { + for (var index = 0; index < paymentDetails.length; index++) { + let businessService = get(paymentDetails[index], "businessService"); + if (businessService === envVariables.BUSINESS_SERVICE) { + let applicationNumber = get( + paymentDetails[index], + "bill.consumerCode" + ); + const query = { + tenantId, + applicationNumber + }; + let headers = { + tenantid:tenantId + }; + const body = { RequestInfo }; + const searchRequest = { body, query, headers }; + const searchResponse = await searchApiResponse(searchRequest); + //console.log("search response: "+JSON.stringify(searchResponse)); + const { FireNOCs } = searchResponse; + if (!FireNOCs.length) { + throw "FIRENOC Search error"; + } + for ( + var firenocIndex = 0; + firenocIndex < FireNOCs.length; + firenocIndex++ + ) { + set( + FireNOCs[firenocIndex], + "fireNOCDetails.action", + envVariables.ACTION_PAY + ); + } - const updateBody = { RequestInfo, FireNOCs }; - const updateRequest = { body: updateBody }; - //console.log("update Request: "+JSON.stringify(updateRequest)); - const updateResponse = await updateApiResponse(updateRequest, false); - //console.log("update Response: "+JSON.stringify(updateResponse)); + for(var index =0; index < RequestInfo.userInfo.roles.length;index++){ + let tenantId = get(RequestInfo.userInfo,"tenantId"); + set(RequestInfo.userInfo.roles[index],"tenantId",tenantId); + //console.log("Workflow TenantId",get(body.RequestInfo.userInfo.roles[index],"tenantId")); + } + + const updateBody = { RequestInfo, FireNOCs }; + const updateRequest = { body: updateBody,headers }; + //console.log("update Request: "+JSON.stringify(updateRequest)); + const updateResponse = await updateApiResponse(updateRequest, false); + //console.log("update Response: "+JSON.stringify(updateResponse)); + } + } + } + } catch (error) { + throw error; } + }; + + if(envVariables.KAFKA_TOPICS_RECEIPT_CREATE_REGEX.test(topic)) + FireNOCPaymentStatus(value); + + if(envVariables.KAFKA_TOPICS_FIRENOC_CREATE_SMS_REGEX.test(topic)){ + const { FireNOCs } = value; + sendFireNOCSMSRequest(FireNOCs); } - } - } catch (error) { - throw error; - } - }; - switch (message.topic) { - case envVariables.KAFKA_TOPICS_FIRENOC_CREATE: - { - const { FireNOCs } = value; - sendFireNOCSMSRequest(FireNOCs); - } - break; - case envVariables.KAFKA_TOPICS_FIRENOC_UPDATE: - { - const { FireNOCs } = value; - sendFireNOCSMSRequest(FireNOCs); - } - break; - case envVariables.KAFKA_TOPICS_FIRENOC_WORKFLOW: - { - const { FireNOCs } = value; - sendFireNOCSMSRequest(FireNOCs); - } - break; + if(envVariables.KAFKA_TOPICS_FIRENOC_UPDATE_SMS_REGEX.test(topic)){ + const { FireNOCs } = value; + sendFireNOCSMSRequest(FireNOCs); + } - // case envVariables.KAFKA_TOPICS_RECEIPT_CREATE: - // { - // console.log("reciept hit"); - // } - // break; - case envVariables.KAFKA_TOPICS_RECEIPT_CREATE: - { - FireNOCPaymentStatus(value); - } - break; - } + if(envVariables.KAFKA_TOPICS_FIRENOC_WORKFLOW_SMS_REGEX.test(topic)){ + const { FireNOCs } = value; + sendFireNOCSMSRequest(FireNOCs); + } - producer.send(payloads, function(err, data) { - if (!err) { - console.log(data); - } else { - console.log(err); - } - }); -}); + }, + }) +} -consumerGroup.on("error", function(err) { - console.log("Error:", err); -}); +run().catch(e => console.error(`[example/consumer] ${e.message}`, e)) -consumerGroup.on("offsetOutOfRange", function(err) { - console.log("offsetOutOfRange:", err); -}); -export default consumerGroup; +export default consumer; diff --git a/municipal-services/firenoc-services/src/model/fireNOC.js b/municipal-services/firenoc-services/src/model/fireNOC.js index c4019c951da..2ea450c8ee0 100644 --- a/municipal-services/firenoc-services/src/model/fireNOC.js +++ b/municipal-services/firenoc-services/src/model/fireNOC.js @@ -175,8 +175,9 @@ const Address = { }, landmark: { description: "additional landmark to help locate the address", + valid_htmlData: true, type: ["string", "null"] - }, + }, city: { description: "City of the address. Can be represented by the tenantid itself", diff --git a/municipal-services/firenoc-services/src/services/firenocCalculatorService.js b/municipal-services/firenoc-services/src/services/firenocCalculatorService.js index 22138dcad7f..aa820d2ebbc 100644 --- a/municipal-services/firenoc-services/src/services/firenocCalculatorService.js +++ b/municipal-services/firenoc-services/src/services/firenocCalculatorService.js @@ -1,10 +1,24 @@ import envVariables from "../envVariables"; import { httpRequest } from "../utils/api"; -export const calculate = async (firenoc, requestInfo) => { +export const calculate = async (firenoc, requestInfo, header) => { const tenantId = firenoc.tenantId; const CalulationCriteria = []; CalulationCriteria.push({ fireNOC: firenoc, tenantId }); + + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else + header['tenantId']=tenantId; + + headers = header; + const requestBody = { RequestInfo: requestInfo, CalulationCriteria @@ -14,7 +28,8 @@ export const calculate = async (firenoc, requestInfo) => { endPoint: `${envVariables.EGOV_FN_CALCULATOR_CONTEXT_PATH}${ envVariables.EGOV_FN_CALCULATOR_CALCULATOR_ENPOINT }`, - requestBody + requestBody, + headers }); return calculateResponse; diff --git a/municipal-services/firenoc-services/src/services/userService.js b/municipal-services/firenoc-services/src/services/userService.js index f9ef15f7abd..31803b0393f 100644 --- a/municipal-services/firenoc-services/src/services/userService.js +++ b/municipal-services/firenoc-services/src/services/userService.js @@ -1,15 +1,33 @@ import envVariables from "../envVariables"; import { httpRequest } from "../utils/api"; -export const searchUser = async (requestInfo, userSearchReqCriteria) => { +export const searchUser = async (requestInfo, userSearchReqCriteria, header) => { let requestBody = { RequestInfo: requestInfo, ...userSearchReqCriteria }; + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else{ + header['tenantId'] = userSearchReqCriteria.tenantId; + } + + + headers = header; + + + var userSearchResponse = await httpRequest({ - hostURL: envVariables.EGOV_USER_HOST, + hostURL: `${envVariables.EGOV_USER_HOST}`, endPoint: `${envVariables.EGOV_USER_CONTEXT_PATH}${ envVariables.EGOV_USER_SEARCH_ENDPOINT }`, - requestBody + requestBody, + headers }); //console.log("User search response: "+JSON.stringify(userSearchResponse)); @@ -20,15 +38,30 @@ export const searchUser = async (requestInfo, userSearchReqCriteria) => { return userSearchResponse; }; -export const createUser = async (requestInfo, user) => { +export const createUser = async (requestInfo, user, header, tenantId) => { let requestBody = { RequestInfo: requestInfo, user: user }; + + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else + header['tenantId']= tenantId; + + headers = header; + user.dob=dobConvetion(user.dob); var userCreateResponse = await httpRequest({ hostURL: envVariables.EGOV_USER_HOST, endPoint: `${envVariables.EGOV_USER_CONTEXT_PATH}${ envVariables.EGOV_USER_CREATE_ENDPOINT }`, - requestBody + requestBody, + headers }); var dobFormat = "dd/MM/yyyy"; @@ -37,8 +70,21 @@ export const createUser = async (requestInfo, user) => { return userCreateResponse; }; -export const updateUser = async (requestInfo, user) => { +export const updateUser = async (requestInfo, user, header, tenantId) => { // console.log(user); + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else + header['tenantId'] = tenantId; + + headers = header; + user.dob=dobConvetion(user.dob); // console.info(user.dob); let requestBody = { RequestInfo: requestInfo, user: user }; @@ -47,7 +93,8 @@ export const updateUser = async (requestInfo, user) => { endPoint: `${envVariables.EGOV_USER_CONTEXT_PATH}${ envVariables.EGOV_USER_UPDATE_ENDPOINT }`, - requestBody + requestBody, + headers }); var dobFormat = "yyyy-MM-dd"; diff --git a/municipal-services/firenoc-services/src/utils/create.js b/municipal-services/firenoc-services/src/utils/create.js index 2c64900334a..29b48a2d87c 100644 --- a/municipal-services/firenoc-services/src/utils/create.js +++ b/municipal-services/firenoc-services/src/utils/create.js @@ -5,7 +5,7 @@ import userService from "../services/userService"; import isEmpty from "lodash/isEmpty"; import { status } from "./search"; -export const addUUIDAndAuditDetails = async (request, method = "_update") => { +export const addUUIDAndAuditDetails = async (request, method = "_update", header) => { let { FireNOCs, RequestInfo } = request; //for loop should be replaced new alternative for (var i = 0; i < FireNOCs.length; i++) { @@ -27,7 +27,7 @@ export const addUUIDAndAuditDetails = async (request, method = "_update") => { tenantId: FireNOCs[i].tenantId, format: envVariables.EGOV_APPLICATION_FORMATE } - ]); + ], header); FireNOCs[i].fireNOCDetails.buildings = FireNOCs[ i ].fireNOCDetails.buildings.map(building => { @@ -91,23 +91,24 @@ export const addUUIDAndAuditDetails = async (request, method = "_update") => { userSearchReqCriteria.mobileNumber = owners[owneriter].mobileNumber; userSearchReqCriteria.name = owners[owneriter].name; userSearchReqCriteria.tenantId = envVariables.EGOV_DEFAULT_STATE_ID; - userSearchResponse = await userService.searchUser( RequestInfo, - userSearchReqCriteria + userSearchReqCriteria, + header ); if (get(userSearchResponse, "user", []).length > 0) { userResponse = await userService.updateUser(RequestInfo, { ...userSearchResponse.user[0], ...owners[owneriter] - }); + }, header,userSearchReqCriteria.tenantId); } else{ userResponse = await createUser( RequestInfo, owners[owneriter], - envVariables.EGOV_DEFAULT_STATE_ID + envVariables.EGOV_DEFAULT_STATE_ID, + header ); } @@ -133,13 +134,13 @@ export const addUUIDAndAuditDetails = async (request, method = "_update") => { }; // FireNOCs[i].fireNOCDetails.status = // status[FireNOCs[i].fireNOCDetails.action]; - FireNOCs[i] = await checkApproveRecord(FireNOCs[i], RequestInfo); + FireNOCs[i] = await checkApproveRecord(FireNOCs[i], RequestInfo, header); } request.FireNOCs = FireNOCs; return request; }; -const createUser = async (requestInfo, owner, tenantId) => { +const createUser = async (requestInfo, owner, tenantId, header) => { let userSearchReqCriteria = {}; let userSearchResponse = {}; let userCreateResponse = {}; @@ -150,7 +151,8 @@ const createUser = async (requestInfo, owner, tenantId) => { userSearchReqCriteria.mobileNumber = owner.mobileNumber; userSearchResponse = await userService.searchUser( requestInfo, - userSearchReqCriteria + userSearchReqCriteria, + header ); if (get(userSearchResponse, "user", []).length > 0) { //assign to user @@ -158,7 +160,7 @@ const createUser = async (requestInfo, owner, tenantId) => { userCreateResponse = await userService.updateUser(requestInfo, { ...userSearchResponse.user[0], ...owner - }); + }, header, tenantId); } else { // console.log("user not found"); @@ -168,28 +170,31 @@ const createUser = async (requestInfo, owner, tenantId) => { userCreateResponse = await userService.createUser(requestInfo, { ...userSearchResponse.user[0], ...owner - }); + }, header, + tenantId); // console.log("Create passed"); } } else { //uuid present userSearchReqCriteria.uuid = [owner.uuid]; + userSearchReqCriteria.tenantId = tenantId; userSearchResponse = await userService.searchUser( requestInfo, - userSearchReqCriteria + userSearchReqCriteria, + header ); if (get(userSearchResponse, "user", []).length > 0) { userCreateResponse = await userService.updateUser(requestInfo, { ...userSearchResponse.user[0], ...owner - }); + }, header, tenantId); // console.log("Update passed"); } } return userCreateResponse; }; -const checkApproveRecord = async (fireNoc = {}, RequestInfo) => { +const checkApproveRecord = async (fireNoc = {}, RequestInfo, header) => { if (fireNoc.fireNOCDetails.action == "APPROVE") { let fireNOCNumber = fireNoc.fireNOCNumber; fireNoc.fireNOCNumber = fireNOCNumber @@ -200,7 +205,7 @@ const checkApproveRecord = async (fireNoc = {}, RequestInfo) => { tenantId: fireNoc.tenantId, format: envVariables.EGOV_CIRTIFICATE_FORMATE } - ]); + ], header); fireNoc.fireNOCDetails.validFrom = new Date().getTime(); let validTo = new Date(); validTo.setFullYear(validTo.getFullYear() + 1); @@ -244,7 +249,7 @@ export const updateStatus = (FireNOCs, workflowResponse) => { return FireNOCs; }; -export const enrichAssignees = async (FireNOCs, RequestInfo) => { +export const enrichAssignees = async (FireNOCs, RequestInfo, header) => { for (var i = 0; i < FireNOCs.length; i++) { if(FireNOCs[i].fireNOCDetails.action === 'SENDBACKTOCITIZEN'){ @@ -253,7 +258,7 @@ export const enrichAssignees = async (FireNOCs, RequestInfo) => { for (let owner of owners) assignes.push(owner.uuid); - let uuids = await getUUidFromUserName(owners, RequestInfo); + let uuids = await getUUidFromUserName(owners, RequestInfo, header); if(uuids.length > 0) assignes = [...new Set([...assignes, ...uuids])]; @@ -263,7 +268,7 @@ export const enrichAssignees = async (FireNOCs, RequestInfo) => { return FireNOCs; }; -const getUUidFromUserName = async (owners, RequestInfo) => { +const getUUidFromUserName = async (owners, RequestInfo, header) => { let uuids = []; let mobileNumbers = []; @@ -278,10 +283,10 @@ const getUUidFromUserName = async (owners, RequestInfo) => { userSearchReqCriteria.userName = mobileNumber; userSearchReqCriteria.tenantId = envVariables.EGOV_DEFAULT_STATE_ID; - userSearchResponse = await userService.searchUser( RequestInfo, - userSearchReqCriteria + userSearchReqCriteria, + header ); if (get(userSearchResponse, "user", []).length > 0) { diff --git a/municipal-services/firenoc-services/src/utils/index.js b/municipal-services/firenoc-services/src/utils/index.js index ae0a870cdba..4da1fd947f9 100644 --- a/municipal-services/firenoc-services/src/utils/index.js +++ b/municipal-services/firenoc-services/src/utils/index.js @@ -31,27 +31,56 @@ export const requestInfoToResponseInfo = (requestinfo, success) => { return ResponseInfo; }; -export const addIDGenId = async (requestInfo, idRequests) => { +export const addIDGenId = async (requestInfo, idRequests, header) => { let requestBody = { RequestInfo: requestInfo, idRequests }; + + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else + header['tenantId'] = idRequests[0].tenantId; + + headers = header; + // console.log(JSON.stringify(requestBody)); let idGenResponse = await httpRequest({ hostURL: envVariables.EGOV_IDGEN_HOST, endPoint: `${envVariables.EGOV_IDGEN_CONTEXT_PATH}${ envVariables.EGOV_IDGEN_GENERATE_ENPOINT }`, - requestBody + requestBody, + headers }); // console.log("idgenresponse",idGenResponse); return get(idGenResponse, "idResponses[0].id"); }; -export const getLocationDetails = async (requestInfo, tenantId) => { +export const getLocationDetails = async (requestInfo, tenantId, header) => { let requestBody = { RequestInfo: requestInfo }; + + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else + header['tenantId'] = tenantId; + + headers = header; + // console.log(JSON.stringify(requestBody)); let locationResponse = await httpRequest({ hostURL: envVariables.EGOV_LOCATION_HOST, @@ -62,13 +91,14 @@ export const getLocationDetails = async (requestInfo, tenantId) => { }&boundaryType=${ envVariables.EGOV_LOCATION_BOUNDARY_TYPE_CODE }&tenantId=${tenantId}`, - requestBody + requestBody, + headers }); // console.log("idgenresponse",locationResponse); return locationResponse; }; -export const createWorkFlow = async body => { +export const createWorkFlow = async (body, header) => { //wfDocuments and comment should rework after that let processInstances = body.FireNOCs.map(fireNOC => { return { @@ -100,11 +130,25 @@ export const createWorkFlow = async body => { RequestInfo: body.RequestInfo, ProcessInstances: processInstances }; + + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else + header['tenantId'] = body.FireNOCs[0].tenantId; + + headers = header; //console.log("Workflow requestBody", JSON.stringify(requestBody)); let workflowResponse = await httpRequest({ hostURL: envVariables.EGOV_WORKFLOW_HOST, endPoint: envVariables.EGOV_WORKFLOW_TRANSITION_ENDPOINT, - requestBody + requestBody, + headers }); // console.log("workflowResponse", JSON.stringify(workflowResponse)); return workflowResponse; @@ -127,3 +171,153 @@ export const addQueryArg = (url, queries = []) => { return url; } }; + +export const getUpdatedTopic = (tenantId, topic) => { + let tenants = tenantId.split('.'); + if(tenants.length > 1) + topic = tenants[1] + "-" + topic; + console.log("The Kafka topic for the tenantId : " + tenantId + " is : " + topic); + return topic; +}; + +export const replaceSchemaPlaceholder = (query, tenantId) => { + let finalQuery = null; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if (tenantId.includes('.') && isCentralInstance) { + let schemaName = tenantId.split('.')[1]; + finalQuery = query.replace(/{schema}/g, schemaName); + } else { + finalQuery = query.replace(/{schema}./g, ""); + } + return finalQuery; +}; + +// central-instance configs +let SCHEMA_REPLACE_STRING = "{schema}"; +/* + * Represents the length of the tenantId array when it's split by "." + * + * if the array length is equal or lesser than, then the tennatId belong to state level + * + * else it's tenant level + */ +let stateLevelTenantIdLength = 1; +/* + * Boolean field informing whether the deployed server is a multi-state/central-instance + * + */ +let isEnvironmentCentralInstance = true; +/* + * Index in which to find the schema name in a tenantId split by "." + */ +let stateSchemaIndexPositionInTenantId = 1; +/** +* Method to fetch the state name from the tenantId +* +* @param query +* @param tenantId +* @return +*/ +export const replaceSchemaPlaceholderCentralInstance = (query, tenantId) => { +console.log("query : "+query); +console.log(" tenantId :" + tenantId); +let finalQuery = null; +var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; +if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); +console.log(" IsCentralInstance :" + isCentralInstance); +if (tenantId.includes(".") && isCentralInstance) { + if (stateSchemaIndexPositionInTenantId >= tenantId.length) { + throw new InvalidTenantIdException( + "The tenantId length is smaller than the defined schema index in tenantId for central instance"); + } + let schemaName = tenantId.split(".")[stateSchemaIndexPositionInTenantId]; + console.log(" schemaName :" + schemaName); + finalQuery = query.replace(/{schema}/g, schemaName); +} else { + finalQuery = query.replace(/{schema}./g, ""); +} +return finalQuery; +} + +/** +* Method to determine if the given tenantId belong to tenant or state level in +* the current environment +* +* @param tenantId +* @return +*/ +export const isTenantIdStateLevel = (tenantId) => { + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + if (isCentralInstance) { + let tenantLevel = tenantId.split(".").length; + return tenantLevel <= stateLevelTenantIdLength; +} else { + /* + * if the instance is not multi-state/central-instance then tenant is always + * two level + * + * if tenantId contains "." then it is tenant level + */ + return !tenantId.contains("."); +} +} + +/** +* For central instance if the tenantId size is lesser than state level +* length the same will be returned without splitting +* +* if the tenant-id is longer than the given stateTenantlength then the length of tenant-id +* till state-level index will be returned +* (for example if statetenantlength is 1 and tenant-id is 'in.statea.tenantx'. the returned tenant-id will be in.statea) +* +* @param tenantId +* @return +*/ +export const getStateLevelTenant =(tenantId) => { + +const tenantArray = tenantId.split("."); +let stateTenant = tenantArray[0]; +var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; +if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); +if (isCentralInstance) { + if (stateLevelTenantIdLength < tenantArray.length) { + for (let i = 1; i < stateLevelTenantIdLength; i++) + stateTenant = stateTenant.concat(".").concat(tenantArray[i]); + } else { + stateTenant = tenantId; + } +} +return stateTenant; +}; + +/** +* method to prefix the state specific tag to the topic names +* +* @param tenantId +* @param topic +* @return +*/ +export const getStateSpecificTopicName = (tenantId, topic) => { + +let updatedTopic = topic; +var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; +if(typeof isCentralInstance == "string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); +if (isCentralInstance) { + const tenants = tenantId.split("."); + if (tenants.length > 1) + updatedTopic = tenants[stateSchemaIndexPositionInTenantId] + ("-") + (topic); + +} + +console.log("isCentralInstance - "+isCentralInstance); +console.log("The Kafka topic for the tenantId : " + tenantId + " is : " + updatedTopic); +return updatedTopic; +}; \ No newline at end of file diff --git a/municipal-services/firenoc-services/src/utils/mdmsData.js b/municipal-services/firenoc-services/src/utils/mdmsData.js index b0eb44f9076..26fc100412a 100644 --- a/municipal-services/firenoc-services/src/utils/mdmsData.js +++ b/municipal-services/firenoc-services/src/utils/mdmsData.js @@ -1,7 +1,20 @@ import { httpRequest } from "./api"; import envVariables from "../envVariables"; -export default async (requestInfo = {},tenantId) => { +export default async (requestInfo = {},tenantId, header) => { + let headers; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance){ + header['tenantId']=header.tenantid; + } + else + header['tenantId'] = tenantId; + + headers = header; + var requestBody = { RequestInfo: requestInfo, MdmsCriteria: { @@ -33,7 +46,8 @@ export default async (requestInfo = {},tenantId) => { endPoint: `${envVariables.EGOV_MDMS_CONTEXT_PATH}${ envVariables.EGOV_MDMS_SEARCH_ENPOINT }`, - requestBody + requestBody, + headers }); return mdmsResponse; }; diff --git a/municipal-services/firenoc-services/src/utils/modelValidation.js b/municipal-services/firenoc-services/src/utils/modelValidation.js index 4ca6b81073a..9b6323e61f2 100644 --- a/municipal-services/firenoc-services/src/utils/modelValidation.js +++ b/municipal-services/firenoc-services/src/utils/modelValidation.js @@ -37,6 +37,7 @@ export const validateFireNOCModel = (data, mdmsData) => { ajv.addKeyword("valid_htmlData", { validate: function(schema, data) { + if (data == null) return true; return (xss(data)==data) ? true : false; }, errors: false @@ -92,7 +93,7 @@ export const validateFireNOCModel = (data, mdmsData) => { // }, // errors: false // }); - + let validate = ajv.compile(fireNOCSchema); var valid = validate(data); let errors = []; @@ -104,6 +105,7 @@ export const validateFireNOCModel = (data, mdmsData) => { export const validateFireNOCSearchModel = data => { const ajv = getAjvInstance(); + let validate = ajv.compile(fireNOCSearchSchema); var valid = validate(data); let errors = []; diff --git a/municipal-services/firenoc-services/src/utils/notificationUtil.js b/municipal-services/firenoc-services/src/utils/notificationUtil.js new file mode 100644 index 00000000000..a88771190bb --- /dev/null +++ b/municipal-services/firenoc-services/src/utils/notificationUtil.js @@ -0,0 +1,177 @@ +import envVariables from "../envVariables"; +import producer from "../kafka/producer"; +import get from "lodash/get"; +import set from "lodash/set"; +import { getUpdatedTopic, getStateSpecificTopicName } from "../utils/index"; +import userService from "../services/userService"; + +let payloads = []; +let smsRequest = {}; +let events = []; + +const sendEventNotificaiton = (tenantId) => { + let requestPayload = { + RequestInfo, + events + }; + + let topic = envVariables.KAFKA_TOPICS_EVENT_NOTIFICATION; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance) + topic = getStateSpecificTopicName(tenantId, topic); + + payloads.push({ + topic: topic, + messages: JSON.stringify(requestPayload) + }); + }; + +export const sendFireNOCSMSRequest = async (FireNOCs, RequestInfo) => { + let tenantId = get(FireNOCs[0], "tenantId"); + for (let i = 0; i < FireNOCs.length; i++) { + let mobileNumber = get( + FireNOCs[i], + "fireNOCDetails.applicantDetails.owners.0.mobileNumber" + ); + smsRequest["mobileNumber"] = mobileNumber; + let firenocType = + get(FireNOCs[i], "fireNOCDetails.fireNOCType") === "NEW" + ? "new" + : "provision"; + + let ownerName = get( + FireNOCs[i], + "fireNOCDetails.applicantDetails.owners.0.name" + ); + let uuid = get( + FireNOCs[i], + "fireNOCDetails.applicantDetails.owners.0.uuid" + ); + let applicationNumber = get( + FireNOCs[i], + "fireNOCDetails.applicationNumber" + ); + let fireNOCNumber = get(FireNOCs[i], "fireNOCDetails.validTo"); + let validTo = get(FireNOCs[i], "fireNOCDetails.validTo"); + let tenantId = get(FireNOCs[i], "tenantId"); + switch (FireNOCs[i].fireNOCDetails.status) { + case "INITIATED": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} has been generated. Your application no. is ${applicationNumber}.\n\nEGOVS`; + break; + case "PENDINGPAYMENT": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} has been submitted. Your application no. is ${applicationNumber}. Please pay your NoC Fees online or at your applicable fire office\n\nEGOVS`; + break; + case "DOCUMENTVERIFY": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} has been forwarded for document verifier.\n\nEGOVS`; + break; + case "FIELDINSPECTION": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} has been forwarded for field inpsection.\n\nEGOVS`; + break; + case "PENDINGAPPROVAL": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} has been forwarded for approver.\n\nEGOVS`; + break; + case "APPROVED": + var currentDate = new Date(validTo); + var date = currentDate.getDate(); + var month = currentDate.getMonth(); //Be careful! January is 0 not 1 + var year = currentDate.getFullYear(); + + var dateString = + date + + "-" + + (month + 1 > 9 ? month + 1 : `0${month + 1}`) + + "-" + + year; + + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} is approved.And your fire NoC has been generated.Your Fire NoC No. is ${fireNOCNumber}. It is valid till ${dateString}\n\nEGOVS`; + break; + case "CITIZENACTIONREQUIRED": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} Fire NOC Certificate with application no. ${applicationNumber} is send back to you for further actions.Please check the comments and Re-submit application through mSeva App or by ULB counter.\n\nEGOVS`; + break; + case "CITIZENACTIONREQUIRED": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} Fire NOC Certificate with application no. ${applicationNumber} is send back to you for further actions.Please check the comments and Re-submit application through mSeva App or by ULB counter.\n\nEGOVS`; + break; + case "REJECTED": + smsRequest[ + "message" + ] = `Dear ${ownerName},Your application for ${firenocType} with application no. is ${applicationNumber} has been rejected.To know more details please contact your applicable fire office\n\nEGOVS`; + break; + // case "CANCELLED": + // break; + default: + } + + let topic = envVariables.KAFKA_TOPICS_NOTIFICATION; + var isCentralInstance = envVariables.IS_ENVIRONMENT_CENTRAL_INSTANCE; + if(typeof isCentralInstance =="string") + isCentralInstance = (isCentralInstance.toLowerCase() == "true"); + + if(isCentralInstance) + topic = getStateSpecificTopicName(tenantId, topic); + + payloads.push({ + topic: topic, + messages: JSON.stringify(smsRequest) + }); + // console.log("smsRequest",smsRequest); + if (smsRequest.message) { + let userSearchReqCriteria = {}; + let userSearchResponse = {}; + let header = { + tenantid:tenantId + }; + userSearchReqCriteria.userName = mobileNumber; + userSearchReqCriteria.active = true; + userSearchReqCriteria.tenantId = envVariables.EGOV_DEFAULT_STATE_ID; + userSearchResponse = await userService.searchUser( + RequestInfo, + userSearchReqCriteria, + header + ); + if (get(userSearchResponse, "user", []).length > 0) { + events.push({ + tenantId: tenantId, + eventType: "SYSTEMGENERATED", + description: smsRequest.message, + name: "Firenoc notification", + source: "webapp", + recepient: { + toUsers: [userSearchResponse.user[0].uuid] + } + }); + } + } + } + // console.log("events",events); + if (events.length > 0) { + sendEventNotificaiton(tenantId); + } + + producer.send(payloads, function(err, data) { + if (!err) { + console.log(data); + } else { + console.log(err); + } + }); + }; + diff --git a/municipal-services/firenoc-services/src/utils/search.js b/municipal-services/firenoc-services/src/utils/search.js index 3ef8ca83511..3fa85756e05 100644 --- a/municipal-services/firenoc-services/src/utils/search.js +++ b/municipal-services/firenoc-services/src/utils/search.js @@ -13,7 +13,7 @@ const intConversion = string => { return string ? parseInt(string) : null; }; -const fireNOCRowMapper = async (row, mapper = {}) => { +const fireNOCRowMapper = async (row, mapper = {}, header) => { let fireNoc = isEmpty(mapper) ? {} : mapper; fireNoc.id = row.fid; fireNoc.tenantId = row.tenantid; @@ -29,7 +29,8 @@ const fireNOCRowMapper = async (row, mapper = {}) => { }; let owners = await fireNocOwnersRowMapper( row, - get(fireNoc, "fireNOCDetails.applicantDetails.owners", []) + get(fireNoc, "fireNOCDetails.applicantDetails.owners", []), + header ); let fireNOCDetails = { id: row.firenocdetailsid, @@ -83,7 +84,7 @@ const fireNOCRowMapper = async (row, mapper = {}) => { return fireNoc; }; -const fireNocOwnersRowMapper = async (row, mapper = []) => { +const fireNocOwnersRowMapper = async (row, mapper = [], header) => { let ownerIndex = findIndex(mapper, { useruuid: row.useruuid }); let ownerObject = { id: row.ownerid, @@ -105,7 +106,7 @@ const fireNocOwnersRowMapper = async (row, mapper = []) => { } else { let user = {}; if (row.useruuid) { - user = await searchUser(requestInfo, row.useruuid); + user = await searchUser(requestInfo, row.useruuid, header, envVariables.EGOV_DEFAULT_STATE_ID); } user = { ...ownerObject, @@ -178,17 +179,17 @@ const fireNocApplicationDocumentsRowMapper = (row, mapper = []) => { return mapper; }; -export const mergeSearchResults = async (response, query = {}, reqInfo) => { +export const mergeSearchResults = async (response, query = {}, reqInfo, header) => { requestInfo = reqInfo; let result = []; for (var i = 0; i < response.length; i++) { let fireNoc = {}; let index = findIndex(result, { id: response[i].fid }); if (index != -1) { - fireNoc = await fireNOCRowMapper(response[i], result[index]); + fireNoc = await fireNOCRowMapper(response[i], result[index], header); result[index] = fireNoc; } else { - fireNoc = await fireNOCRowMapper(response[i]); + fireNoc = await fireNOCRowMapper(response[i], {}, header); result.push(fireNoc); } } @@ -203,26 +204,30 @@ const removeEmpty = obj => { }); }; -const searchUser = async (requestInfo, uuid) => { +const searchUser = async (requestInfo, uuid, header, tenantId) => { let userSearchReqCriteria = {}; let userSearchResponse = {}; userSearchReqCriteria.uuid = [uuid]; + userSearchReqCriteria.tenantId = tenantId; userSearchResponse = await userService.searchUser( requestInfo, - userSearchReqCriteria + userSearchReqCriteria, + header ); let users = get(userSearchResponse, "user", []); return users.length ? users[0] : {}; }; -export const searchByMobileNumber = async (mobileNumber, tenantId) => { +export const searchByMobileNumber = async (mobileNumber, tenantId, header) => { var userSearchReqCriteria = {}; userSearchReqCriteria.userType = "CITIZEN"; userSearchReqCriteria.tenantId = tenantId; userSearchReqCriteria.mobileNumber = mobileNumber; + var userSearchResponse = await userService.searchUser( requestInfo, - userSearchReqCriteria + userSearchReqCriteria, + header ); return userSearchResponse; }; diff --git a/municipal-services/fsm-calculator/CHANGELOG.md b/municipal-services/fsm-calculator/CHANGELOG.md index 55fedf30350..bd640a7bacd 100644 --- a/municipal-services/fsm-calculator/CHANGELOG.md +++ b/municipal-services/fsm-calculator/CHANGELOG.md @@ -1,10 +1,12 @@ # Changelog All notable changes to this module will be documented in this file. -## 1.3.0 - 2023-03-15 -- Enhance the demand generate Process . +## 1.2.0 - 2023-03-31 +- Enhance the demand generate Process. - Generating demand on every time when the trip is update. - Added validation not to complete the application from ulb side before completing the all payment. +- Minimum part payment is configural i.e should be fixed or percentage calculation and calculation done based on the mdms config value +- Minimum cancellation fee is configural i.e should be fixed or percentage calculation and calculation done based on the mdms config value ## 1.1.0-beta - 2022-03-29 diff --git a/municipal-services/fsm-calculator/pom.xml b/municipal-services/fsm-calculator/pom.xml index a0333e91e58..73be852dbd4 100644 --- a/municipal-services/fsm-calculator/pom.xml +++ b/municipal-services/fsm-calculator/pom.xml @@ -10,7 +10,7 @@ org.egov fsm-calculator - 1.3.0-SNAPSHOT + 1.2.0-SNAPSHOT fsm-calculator Demo project for Spring Boot diff --git a/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/config/CalculatorConfig.java b/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/config/CalculatorConfig.java index 5ffeace532b..96940ce14f3 100644 --- a/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/config/CalculatorConfig.java +++ b/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/config/CalculatorConfig.java @@ -59,12 +59,18 @@ public class CalculatorConfig { private String cancellationFeeType; // MDMS - @Value("${egov.mdms.host}") - private String mdmsHost; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsSearchEndpoint; - +// @Value("${egov.mdms.host}") +// private String mdmsHost; +// +// @Value("${egov.mdms.search.endpoint}") +// private String mdmsSearchEndpoint; + + @Value("${mdms.v2.host}") + private String mdmsHost; + + @Value("${mdms.v2.search.endpoint}") + private String mdmsSearchEndpoint; + @Value("${egov.bill.fetch.endpoint}") private String fetchBillEndpoint; diff --git a/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/services/BillingService.java b/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/services/BillingService.java index 6c276fe3024..b6ecccd8eec 100644 --- a/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/services/BillingService.java +++ b/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/services/BillingService.java @@ -38,8 +38,13 @@ public BillResponse fetchBill(FSM fsmRequest, RequestInfo requestInfo) { try { - Optional response = serviceRequestRepository.fetchApiResult(uri, - RequestInfoWrapper.builder().requestInfo(requestInfo).build()); + Optional response = Optional.empty(); + try { + response = serviceRequestRepository.fetchApiResult(uri, + RequestInfoWrapper.builder().requestInfo(requestInfo).build()); + } catch (Exception e) { + response = Optional.of(new LinkedHashMap()); + } if (response.isPresent()) { LinkedHashMap responseMap = (LinkedHashMap) response.get(); diff --git a/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/services/CalculationService.java b/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/services/CalculationService.java index 7bf6d84c6c4..42467b97a75 100644 --- a/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/services/CalculationService.java +++ b/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/services/CalculationService.java @@ -309,7 +309,7 @@ private BigDecimal tripAmountDetails(FSM fsm, BigDecimal amount, SlumEnum slumNa : new HashMap<>(); if (oldAdditionalDetails != null || oldAdditionalDetails != null && oldAdditionalDetails.get("tripAmount") != null) { - amount = BigDecimal.valueOf(Double.valueOf((String) oldAdditionalDetails.get("tripAmount"))); + amount = BigDecimal.valueOf(Double.valueOf(String.valueOf(oldAdditionalDetails.get("tripAmount")))); // fetch advance amount from fsm application } else { diff --git a/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/services/FSMService.java b/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/services/FSMService.java index c2a56269b7f..5e9f7de41bd 100644 --- a/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/services/FSMService.java +++ b/municipal-services/fsm-calculator/src/main/java/org/egov/fsm/calculator/services/FSMService.java @@ -33,7 +33,7 @@ public FSM getFsmApplication(RequestInfo requestInfo, String tenantId, String ap url.append(tenantId); url.append("&"); - url.append("applicationNo="); + url.append("applicationNos="); url.append(applicationNo); LinkedHashMap responseMap = null; diff --git a/municipal-services/fsm-calculator/src/main/resources/application.properties b/municipal-services/fsm-calculator/src/main/resources/application.properties index 7a8f927051c..d97eb5262df 100644 --- a/municipal-services/fsm-calculator/src/main/resources/application.properties +++ b/municipal-services/fsm-calculator/src/main/resources/application.properties @@ -48,9 +48,10 @@ persister.save.billing.slab.topic=save-fsm-billing-slab persister.update.billing.slab.topic=update-fsm-billing-slab #mdms urls -egov.mdms.host=http://localhost:8094 -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search - +#egov.mdms.host=http://localhost:8094 +#egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search #BilllingService egov.billingservice.host=http://localhost:8088 diff --git a/municipal-services/fsm/src/main/java/org/egov/fsm/config/FSMConfiguration.java b/municipal-services/fsm/src/main/java/org/egov/fsm/config/FSMConfiguration.java index 8fd7b0d2c8a..52bd01c3c76 100755 --- a/municipal-services/fsm/src/main/java/org/egov/fsm/config/FSMConfiguration.java +++ b/municipal-services/fsm/src/main/java/org/egov/fsm/config/FSMConfiguration.java @@ -145,12 +145,18 @@ public void initialize() { private String demandSearchEndpoint; // MDMS - @Value("${egov.mdms.host}") - private String mdmsHost; +// @Value("${egov.mdms.host}") +// private String mdmsHost; +// +// @Value("${egov.mdms.search.endpoint}") +// private String mdmsEndPoint; - @Value("${egov.mdms.search.endpoint}") - private String mdmsEndPoint; + @Value("${mdms.v2.host}") + private String mdmsHost; + @Value("${mdms.v2.search.endpoint}") + private String mdmsEndPoint; + // Allowed Search Parameters @Value("${citizen.allowed.search.params}") private String allowedCitizenSearchParameters; diff --git a/municipal-services/fsm/src/main/java/org/egov/fsm/repository/querybuilder/FSMQueryBuilder.java b/municipal-services/fsm/src/main/java/org/egov/fsm/repository/querybuilder/FSMQueryBuilder.java index 85d5867f8c4..e10ddb7ac45 100755 --- a/municipal-services/fsm/src/main/java/org/egov/fsm/repository/querybuilder/FSMQueryBuilder.java +++ b/municipal-services/fsm/src/main/java/org/egov/fsm/repository/querybuilder/FSMQueryBuilder.java @@ -19,7 +19,7 @@ public class FSMQueryBuilder { private static final String QUERY = "select count(*) OVER() AS full_count,fsm.*,fsm_address.*,fsm_geo.*,fsm_pit.*,fsm.id as fsm_id, fsm.createdby as fsm_createdby," + " fsm.lastmodifiedby as fsm_lastmodifiedby, fsm.createdtime as fsm_createdtime, fsm.lastmodifiedtime as fsm_lastmodifiedtime," - + " fsm.additionaldetails,fsm_address.id as fsm_address_id,fsm_geo.id as fsm_geo_id," + + " fsm.additionaldetails,fsm_address.id as fsm_address_id, fsm_address.additionaldetails as addressAdditionalDetails, fsm_geo.id as fsm_geo_id," + " fsm_pit.id as fsm_pit_id, fsm_pit.additionalDetails as fsm_pit_additionalDetails" + " FROM eg_fsm_application fsm" + " INNER JOIN eg_fsm_address fsm_address on fsm_address.fsm_id = fsm.id" @@ -51,11 +51,26 @@ public String getFSMSearchQuery(FSMSearchCriteria criteria, String dsoId, List applicationNumber = criteria.getApplicationNos(); - if (!CollectionUtils.isEmpty(applicationNumber)) { + if (!CollectionUtils.isEmpty(applicationNumber) && (applicationNumber.stream() + .filter(checkappnumber -> checkappnumber.length() > 0).findFirst().orElse(null) != null)) { + boolean flag = false; addClauseIfRequired(preparedStmtList, builder); - builder.append(" fsm.applicationNo IN (").append(createQuery(applicationNumber)).append(")"); - addToPreparedStatement(preparedStmtList, applicationNumber); + builder.append(" ( "); + for (String applicationno : applicationNumber) { + + if (flag) + builder.append(" OR "); + builder.append(" UPPER(fsm.applicationNo) like ?"); + preparedStmtList.add('%' + org.apache.commons.lang3.StringUtils.upperCase(applicationno) + '%'); + builder.append(" ESCAPE '_' "); + flag = true; + + } + builder.append(" ) "); } List applicationStatus = criteria.getApplicationStatus(); diff --git a/municipal-services/fsm/src/main/java/org/egov/fsm/repository/rowmapper/FSMRowMapper.java b/municipal-services/fsm/src/main/java/org/egov/fsm/repository/rowmapper/FSMRowMapper.java index 0a13fd3af86..cdb0bce1ab7 100755 --- a/municipal-services/fsm/src/main/java/org/egov/fsm/repository/rowmapper/FSMRowMapper.java +++ b/municipal-services/fsm/src/main/java/org/egov/fsm/repository/rowmapper/FSMRowMapper.java @@ -110,7 +110,7 @@ private void addChildrenToProperty(ResultSet rs, FSM fsm) throws SQLException { .plotNo(rs.getString("plotno")).district(rs.getString("district")).region(rs.getString("region")) .state(rs.getString("state")).country(rs.getString("country")).landmark(rs.getString("landmark")) .geoLocation(geoLocation).pincode(rs.getString("pincode")).doorNo(rs.getString("doorno")) - .id(rs.getString("fsm_address_id")).additionalDetails(rs.getString("additionalDetails")) + .id(rs.getString("fsm_address_id")).additionalDetails(getAdditionalDetail("addressAdditionalDetails", rs)) .street(rs.getString("street")).slumName(rs.getString("slumname")) .tenantId(rs.getString(FSMConstants.TENANT_ID)).locality(locality).auditDetails(auditdetails).build(); PitDetail pitDetail = PitDetail.builder().height(rs.getDouble("height")).width(rs.getDouble("width")) diff --git a/municipal-services/fsm/src/main/java/org/egov/fsm/service/BoundaryService.java b/municipal-services/fsm/src/main/java/org/egov/fsm/service/BoundaryService.java index 7439c6134ee..2e1d7cd5416 100644 --- a/municipal-services/fsm/src/main/java/org/egov/fsm/service/BoundaryService.java +++ b/municipal-services/fsm/src/main/java/org/egov/fsm/service/BoundaryService.java @@ -1,8 +1,11 @@ package org.egov.fsm.service; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; +import org.apache.commons.lang3.StringUtils; import org.egov.fsm.config.FSMConfiguration; import org.egov.fsm.repository.ServiceRequestRepository; import org.egov.fsm.util.FSMErrorConstants; @@ -17,6 +20,10 @@ import org.springframework.util.CollectionUtils; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; @@ -68,7 +75,20 @@ public void getAreaType(FSMRequest request, String hierarchyTypeCode) { if (hierarchyTypeCode != null) { uri.append("&").append("hierarchyTypeCode=").append(hierarchyTypeCode); } - uri.append("&").append("boundaryType=").append("Locality"); + uri.append("&").append("boundaryType="); + + Object additionalDetail = fsm.getAddress().getAdditionalDetails(); + Map additionalDetails = null; + if (additionalDetail instanceof Map) { + additionalDetails = additionalDetail != null ? (Map) additionalDetail : new HashMap<>(); + } + if (additionalDetails != null && additionalDetails.get("boundaryType") != null) { + String boundaryType = (String) additionalDetails.get("boundaryType"); + uri.append(boundaryType); + } else { + + uri.append("Locality"); + } uri.append("&").append("codes=").append(fsm.getAddress().getLocality().getCode()); RequestInfoWrapper wrapper = RequestInfoWrapper.builder().requestInfo(request.getRequestInfo()).build(); @@ -79,9 +99,9 @@ public void getAreaType(FSMRequest request, String hierarchyTypeCode) { "The response from location service is empty or null"); } - String jsonString = new JSONObject(responseMap).toString(); + String jsonString1 = new JSONObject(responseMap).toString(); - DocumentContext context = JsonPath.parse(jsonString); + DocumentContext context = JsonPath.parse(jsonString1); List boundaryResponse = context.read("$..boundary[?(@.code==\"{}\")]".replace("{}",fsm.getAddress().getLocality().getCode())); diff --git a/municipal-services/fsm/src/main/java/org/egov/fsm/service/FSMService.java b/municipal-services/fsm/src/main/java/org/egov/fsm/service/FSMService.java index 4ab0ef2ea2d..f2d153c2188 100644 --- a/municipal-services/fsm/src/main/java/org/egov/fsm/service/FSMService.java +++ b/municipal-services/fsm/src/main/java/org/egov/fsm/service/FSMService.java @@ -1,5 +1,6 @@ package org.egov.fsm.service; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; @@ -7,6 +8,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.HashMap; import java.util.Objects; import java.util.TimeZone; import java.util.function.Function; @@ -125,7 +127,10 @@ public FSM create(FSMRequest fsmRequest) { wfIntegrator.callWorkFlow(fsmRequest); repository.save(fsmRequest); - if (fsmRequest.getFsm().getAdvanceAmount()!=null && fsmRequest.getFsm().getAdvanceAmount().intValue()>0) { + Double tripAmount = wfIntegrator.getAdditionalDetails(fsmRequest.getFsm().getAdditionalDetails()); + + if ((fsmRequest.getFsm().getAdvanceAmount() != null && fsmRequest.getFsm().getAdvanceAmount().intValue() > 0) + || tripAmount > 0) { calculationService.addCalculation(fsmRequest, FSMConstants.APPLICATION_FEE); } @@ -163,17 +168,20 @@ public FSM update(FSMRequest fsmRequest) { List fsms = fsmResponse.getFsm(); String businessServiceName = null; + + Double tripAmount = wfIntegrator.getAdditionalDetails(fsm.getAdditionalDetails()); if (FSMConstants.FSM_PAYMENT_PREFERENCE_POST_PAY.equalsIgnoreCase(fsmRequest.getFsm().getPaymentPreference())) businessServiceName = FSMConstants.FSM_POST_PAY_BUSINESSSERVICE; - else if (fsm.getAdvanceAmount() == null && fsm.getPaymentPreference()==null) + else if (FSMConstants.FSM_PAYMENT_PREFERENCE_PRE_PAY + .equalsIgnoreCase(fsmRequest.getFsm().getPaymentPreference())) + businessServiceName = FSMConstants.FSM_BUSINESSSERVICE; + else if (fsm.getAdvanceAmount() == null && fsm.getPaymentPreference() == null && tripAmount <= 0) businessServiceName = FSMConstants.FSM_ZERO_PRICE_SERVICE; - else if (fsm.getAdvanceAmount().intValue() == 0) - businessServiceName = FSMConstants.FSM_LATER_PAY_SERVICE; - else if (fsm.getAdvanceAmount().intValue() > 0) + else if (fsm.getAdvanceAmount() != null && fsm.getAdvanceAmount().intValue() > 0) businessServiceName = FSMConstants.FSM_ADVANCE_PAY_BUSINESSSERVICE; else - businessServiceName = FSMConstants.FSM_BUSINESSSERVICE; + businessServiceName = FSMConstants.FSM_LATER_PAY_SERVICE; BusinessService businessService = workflowService.getBusinessService(fsm, fsmRequest.getRequestInfo(), businessServiceName, null); @@ -218,7 +226,10 @@ private void callDSORejectCompleteFeedBackPaySend(FSMRequest fsmRequest, Object private void callApplicationAndAssignDsoAndAccept(FSMRequest fsmRequest, FSM oldFSM) { - if (fsmRequest.getFsm().getAdvanceAmount()!=null && fsmRequest.getFsm().getAdvanceAmount().intValue()>0 + Double tripAmount = wfIntegrator.getAdditionalDetails(fsmRequest.getFsm().getAdditionalDetails()); + + if (((fsmRequest.getFsm().getAdvanceAmount() != null && fsmRequest.getFsm().getAdvanceAmount().intValue() > 0) + || tripAmount > 0) && fsmRequest.getWorkflow().getAction().equalsIgnoreCase(FSMConstants.WF_ACTION_SUBMIT)) { handleApplicationSubmit(fsmRequest); } @@ -346,7 +357,9 @@ private void callVehicleTripService(FSMRequest fsmRequest, FSM fsm, FSM oldFSM) } if (fsmRequest.getWorkflow().getAction().equalsIgnoreCase(FSMConstants.WF_ACTION_UPDATE)) { - if(fsmRequest.getFsm().getAdvanceAmount()!=null) { + Double tripAmount = wfIntegrator.getAdditionalDetails(fsmRequest.getFsm().getAdditionalDetails()); + + if (fsmRequest.getFsm().getAdvanceAmount() != null || tripAmount > 0) { calculationService.addCalculation(fsmRequest, FSMConstants.APPLICATION_FEE); } @@ -402,19 +415,25 @@ private void handleFSMComplete(FSMRequest fsmRequest) { }); fsmRequest.getWorkflow().setAssignes(uuidList); - if (fsmRequest.getFsm().getPaymentPreference() != null - && !(FSMConstants.FSM_PAYMENT_PREFERENCE_POST_PAY - .equalsIgnoreCase(fsmRequest.getFsm().getPaymentPreference())) - && fsmRequest.getFsm().getAdvanceAmount() == null) { - vehicleTripService.vehicleTripReadyForDisposal(fsmRequest); - - } else + /** + * SM-2181 + * + * + * if (fsmRequest.getFsm().getPaymentPreference() != null && + * !(FSMConstants.FSM_PAYMENT_PREFERENCE_POST_PAY + * .equalsIgnoreCase(fsmRequest.getFsm().getPaymentPreference())) && + * fsmRequest.getFsm().getAdvanceAmount() == null) { + * vehicleTripService.vehicleTripReadyForDisposal(fsmRequest); + * + * } else + */ vehicleTripService.updateVehicleTrip(fsmRequest); RequestInfo requestInfo = fsmRequest.getRequestInfo(); BillResponse billResponse = billingService.fetchBill(fsm, requestInfo); log.info("BillResponse from Service", billResponse); - if (billResponse != null && !billResponse.getBill().isEmpty()) { + if (billResponse != null && (!billResponse.getBill().isEmpty() + && billResponse.getBill().get(0).getTotalAmount().compareTo(new BigDecimal(0)) > 0)) { throw new CustomException(FSMErrorConstants.BILL_IS_PENDING, " Can not close the application since bill amount is pending."); } @@ -534,7 +553,9 @@ private void checkRoleInValidateSearch(RequestInfo requestInfo, FSMSearchCriteri dsoService.getVendor(vendorSearchCriteria, requestInfo); - } else if (criteria.tenantIdOnly()) { + } + // SM-1981 My Application list fixed for DSO number + if (criteria.tenantIdOnly()) { criteria.setMobileNumber(requestInfo.getUserInfo().getMobileNumber()); } } diff --git a/municipal-services/fsm/src/main/java/org/egov/fsm/service/UserService.java b/municipal-services/fsm/src/main/java/org/egov/fsm/service/UserService.java index 0100dce9b30..ff3ff278f3d 100644 --- a/municipal-services/fsm/src/main/java/org/egov/fsm/service/UserService.java +++ b/municipal-services/fsm/src/main/java/org/egov/fsm/service/UserService.java @@ -64,25 +64,45 @@ public void manageApplicant(FSMRequest fsmRequest) { if (userDetailResponse != null || !userDetailResponse.getUser().isEmpty()) { log.info("User Exists!!!" + userDetailResponse.getUser().get(0)); if (!userDetailResponse.getUser().isEmpty()) { - Boolean foundUser = Boolean.FALSE; + Boolean foundUser = Boolean.FALSE, isCitizenRegisteredOnCitizPortal = Boolean.FALSE; + for (int j = 0; j < userDetailResponse.getUser().size(); j++) { + User user = userDetailResponse.getUser().get(j); + if (user.getUserName().equalsIgnoreCase(user.getMobileNumber()) + && user.getName().equalsIgnoreCase(applicant.getName())) { + // found user with mobilenumber and username same and name as equal + //condition gets executed when logged-in citizen applies for application. + + if (applicant != null && applicant.getGender() != null) { + user.setGender(applicant.getGender()); + } + + applicant = user; + foundUser = Boolean.TRUE; + isCitizenRegisteredOnCitizPortal = Boolean.TRUE; + break; + } + } + if (!isCitizenRegisteredOnCitizPortal) { for (int j = 0; j < userDetailResponse.getUser().size(); j++) { User user = userDetailResponse.getUser().get(j); if (!user.getUserName().equalsIgnoreCase(user.getMobileNumber()) + && user.getMobileNumber().equalsIgnoreCase(applicant.getMobileNumber()) && user.getName().equalsIgnoreCase(applicant.getName())) { // found user with mobilenumber and username not same and name as equal to the // applicnat name provided by ui // then consider that user as applicant + if (applicant != null && applicant.getGender() != null) { + user.setGender(applicant.getGender()); + } applicant = user; foundUser = Boolean.TRUE; break; } } + } // users exists with mobile number but non of them have the same name, then // create new user - if (foundUser) { - log.info("foundUser is "+ foundUser); - if(fsm.getCitizen().getEmailId()!=null) - applicant.setEmailId(fsm.getCitizen().getEmailId()); + if (!foundUser) { applicantDetailResponse = createApplicant(applicant, fsmRequest.getRequestInfo(), Boolean.FALSE); applicant = applicantDetailResponse.getUser().get(0); @@ -104,6 +124,9 @@ public void manageApplicant(FSMRequest fsmRequest) { applicant = applicantDetailResponse.getUser().get(0); } + if (fsm.getCitizen() != null && fsm.getCitizen().getGender() != null) { + applicant.setGender(fsm.getCitizen().getGender()); + } fsm.setCitizen(applicant); } else { diff --git a/municipal-services/fsm/src/main/java/org/egov/fsm/service/VehicleTripService.java b/municipal-services/fsm/src/main/java/org/egov/fsm/service/VehicleTripService.java index 1c367ae808a..8746e0012d5 100644 --- a/municipal-services/fsm/src/main/java/org/egov/fsm/service/VehicleTripService.java +++ b/municipal-services/fsm/src/main/java/org/egov/fsm/service/VehicleTripService.java @@ -64,7 +64,11 @@ public void scheduleVehicleTrip(FSMRequest fsmRequest, FSM oldFsmResult) { postPayRequestForTripUpdate(remainingNumberOfTrips, increaseTrip, fsmRequest, fsm); } - else if (fsmRequest.getWorkflow().getAction().equalsIgnoreCase(FSMConstants.WF_ACTION_UPDATE)) { + else if (fsmRequest.getFsm().getAdvanceAmount() == null && fsmRequest.getFsm().getPaymentPreference() != null + + && !(FSMConstants.FSM_PAYMENT_PREFERENCE_POST_PAY + .equalsIgnoreCase(fsmRequest.getFsm().getPaymentPreference())) + || fsmRequest.getWorkflow().getAction().equalsIgnoreCase(FSMConstants.WF_ACTION_UPDATE)) { prePayRequestForTripUpdate(remainingNumberOfTrips, increaseTrip, fsmRequest, fsm, oldNumberOfTrips); @@ -82,7 +86,7 @@ private void prePayRequestForTripUpdate(Integer remainingNumberOfTrips, boolean vehicleId = vehicleTripsForApplication.get(0).getVehicle().getId(); } - if (vehicleId != fsmRequest.getFsm().getVehicleId()) { + if (vehicleId !=null && !vehicleId.equalsIgnoreCase(fsmRequest.getFsm().getVehicleId())) { decreaseTripWhileUpdate(fsmRequest, fsm, oldNumberOfTrips); increaseUpdateTripDetails(fsmRequest.getFsm().getNoOfTrips(), fsmRequest, fsm); @@ -160,14 +164,14 @@ private void updateCreatedVehicleTrip(FSMRequest fsmRequest, VehicleTripResponse List vehicleTripsList, StringBuilder createUri) { log.debug("WORKFLOW ACTION==> " + fsmRequest.getWorkflow().getAction()); - if (fsmRequest.getWorkflow().getAction().equalsIgnoreCase(FSMConstants.WF_ACTION_UPDATE)) { + log.debug("Vehicle Trip Request call ::" + vehicleTripResponse); VehicleTripRequest tripRequest = VehicleTripRequest.builder().vehicleTrip(vehicleTripsList) .requestInfo(fsmRequest.getRequestInfo()) .workflow(Workflow.builder().action(FSMConstants.TRIP_READY_FOR_DISPOSAL).build()).build(); serviceRequestRepository.fetchResult(createUri, tripRequest); - } + } diff --git a/municipal-services/fsm/src/main/java/org/egov/fsm/validator/FSMValidator.java b/municipal-services/fsm/src/main/java/org/egov/fsm/validator/FSMValidator.java index b489a7bb2a3..18d19461d6c 100644 --- a/municipal-services/fsm/src/main/java/org/egov/fsm/validator/FSMValidator.java +++ b/municipal-services/fsm/src/main/java/org/egov/fsm/validator/FSMValidator.java @@ -61,6 +61,10 @@ public class FSMValidator { public void validateCreate(FSMRequest fsmRequest, Object mdmsData) { mdmsValidator.validateMdmsData(mdmsData); FSM fsm = fsmRequest.getFsm(); + + if (!StringUtils.isEmpty(fsm.getPaymentPreference())) { + validatePaymentPreference(fsm.getPaymentPreference()); + } if (fsmRequest.getRequestInfo().getUserInfo().getType().equalsIgnoreCase(FSMConstants.CITIZEN)) { validateCitizenDetails(fsm, fsmRequest); @@ -87,6 +91,17 @@ public void validateCreate(FSMRequest fsmRequest, Object mdmsData) { validateNoOfTrips(fsmRequest, mdmsData); } + private void validatePaymentPreference(String paymentPreference) { + Map errorMap = new HashMap<>(); + + if (!paymentPreference.isEmpty()) { + errorMap.put(FSMErrorConstants.INVALID_PAYMENT_PREFERENCE, "Payment Preference is invalid"); + } + + if (!errorMap.isEmpty()) + throw new CustomException(errorMap); + } + private void validateEmployeeData(FSM fsm, FSMRequest fsmRequest, Object mdmsData) { User applicant = fsm.getCitizen(); if (applicant == null || StringUtils.isEmpty(applicant.getName()) diff --git a/municipal-services/fsm/src/main/java/org/egov/fsm/workflow/WorkflowIntegrator.java b/municipal-services/fsm/src/main/java/org/egov/fsm/workflow/WorkflowIntegrator.java index a2fd64a8720..c6c76fc26ed 100644 --- a/municipal-services/fsm/src/main/java/org/egov/fsm/workflow/WorkflowIntegrator.java +++ b/municipal-services/fsm/src/main/java/org/egov/fsm/workflow/WorkflowIntegrator.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Map; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; import org.egov.fsm.config.FSMConfiguration; import org.egov.fsm.util.FSMConstants; import org.egov.fsm.util.FSMErrorConstants; @@ -87,17 +89,21 @@ public void callWorkFlow(FSMRequest fsmRequest) { JSONObject obj = new JSONObject(); obj.put(BUSINESSIDKEY, fsm.getApplicationNo()); obj.put(TENANTIDKEY, wfTenantId); + + Double tripAmount = getAdditionalDetails(fsm.getAdditionalDetails()); if (FSMConstants.FSM_PAYMENT_PREFERENCE_POST_PAY.equalsIgnoreCase(fsmRequest.getFsm().getPaymentPreference())) { obj.put(BUSINESSSERVICEKEY, FSMConstants.FSM_POST_PAY_BUSINESSSERVICE); - } else if (fsm.getAdvanceAmount() == null && fsm.getPaymentPreference()==null) { + } else if (FSMConstants.FSM_PAYMENT_PREFERENCE_PRE_PAY + .equalsIgnoreCase(fsmRequest.getFsm().getPaymentPreference())) { + obj.put(BUSINESSSERVICEKEY, FSMConstants.FSM_BUSINESSSERVICE); + } else if (fsm.getAdvanceAmount() == null && fsm.getPaymentPreference() == null && tripAmount <= 0) { obj.put(BUSINESSSERVICEKEY, FSMConstants.FSM_ZERO_PRICE_SERVICE); - } else if (fsm.getAdvanceAmount().intValue() == 0) { - obj.put(BUSINESSSERVICEKEY, FSMConstants.FSM_LATER_PAY_SERVICE); - } else if (fsm.getAdvanceAmount().intValue() > 0) { + } else if (fsm.getAdvanceAmount() != null && fsm.getAdvanceAmount().intValue() > 0) { obj.put(BUSINESSSERVICEKEY, FSMConstants.FSM_ADVANCE_PAY_BUSINESSSERVICE); - } else - obj.put(BUSINESSSERVICEKEY, FSMConstants.FSM_BUSINESSSERVICE); + } else { + obj.put(BUSINESSSERVICEKEY, FSMConstants.FSM_LATER_PAY_SERVICE); + } obj.put(MODULENAMEKEY, MODULENAMEVALUE); obj.put(ACTIONKEY, fsmRequest.getWorkflow().getAction()); @@ -160,4 +166,36 @@ public void callWorkFlow(FSMRequest fsmRequest) { fsm.setApplicationStatus(idStatusMap.get(fsm.getApplicationNo())); } + + /** + * Method to return additionalDetails as a Map + * + * @param additionalDetails + */ + public Double getAdditionalDetails(Object additionalDetails) { + + ObjectMapper mapper = new ObjectMapper(); + Map fsmAdditionalDetails = new HashMap<>(); + + if (additionalDetails instanceof ObjectNode) { + fsmAdditionalDetails = mapper.convertValue(additionalDetails, Map.class); + } else if (additionalDetails instanceof Map) { + fsmAdditionalDetails = (Map) additionalDetails; + } + + Double tripAmount = Double.valueOf(0.0); + + if (fsmAdditionalDetails != null && fsmAdditionalDetails.get("tripAmount") != null) { + Object tripAmountObj = fsmAdditionalDetails.get("tripAmount"); + if (tripAmountObj instanceof String) { + tripAmount = Double.valueOf((String) tripAmountObj); + } else if (tripAmountObj instanceof Integer) { + tripAmount = Double.valueOf((Integer) tripAmountObj); + } + } + + return tripAmount; + } + + } \ No newline at end of file diff --git a/municipal-services/fsm/src/main/resources/application.properties b/municipal-services/fsm/src/main/resources/application.properties index 0d00a2dee3e..ab2055c85d7 100644 --- a/municipal-services/fsm/src/main/resources/application.properties +++ b/municipal-services/fsm/src/main/resources/application.properties @@ -92,9 +92,11 @@ egov.idgen.fsm.applicationNum.name=fsm.aplnumber egov.idgen.fsm.applicationNum.format=[CITY.CODE]-FSM-[cy:yyyy-MM-dd]-[SEQ_EGOV_FSM] #mdms urls -egov.mdms.host=http://localhost:8094 -#dev -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +#egov.mdms.host=http://localhost:8094 +##dev +#egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search #local #egov.mdms.search.endpoint=/egov-mdms-service-test/v1/_search #Pagination diff --git a/municipal-services/fsm/src/main/resources/db/migration/main/V20202412090311.1__fsm_initial.sql b/municipal-services/fsm/src/main/resources/db/migration/main/V20202412090311.1__fsm_initial.sql index ac0d31c36c0..4bb23f8bc6b 100644 --- a/municipal-services/fsm/src/main/resources/db/migration/main/V20202412090311.1__fsm_initial.sql +++ b/municipal-services/fsm/src/main/resources/db/migration/main/V20202412090311.1__fsm_initial.sql @@ -117,11 +117,11 @@ CREATE INDEX IF NOT EXISTS index_tenant_eg_fsm_pit_detail ON eg_fsm_pit_detai ); -CREATE INDEX IF NOT EXISTS index_fsm_id_eg_fsm_pit_detail ON eg_fsm_pit_detail -( - fms_id +-- CREATE INDEX IF NOT EXISTS index_fsm_id_eg_fsm_pit_detail ON eg_fsm_pit_detail +-- ( +-- fms_id -); +-- ); CREATE TABLE IF NOT EXISTS eg_fsm_pit_detail_auditlog( diff --git a/municipal-services/fsm/src/main/resources/db/migration/main/V20210722202135__fsm_apply.sql b/municipal-services/fsm/src/main/resources/db/migration/main/V20210722202135__fsm_apply.sql index c6fe9c36048..2c0a96ddcaa 100644 --- a/municipal-services/fsm/src/main/resources/db/migration/main/V20210722202135__fsm_apply.sql +++ b/municipal-services/fsm/src/main/resources/db/migration/main/V20210722202135__fsm_apply.sql @@ -1,7 +1,7 @@ -ALTER TABLE eg_fsm_application ADD COLUMN applicationtype character varying(256) DEFAULT 'ADHOC' NOT NULL; +ALTER TABLE eg_fsm_application ADD COLUMN IF NOT EXISTS applicationtype character varying(256) DEFAULT 'ADHOC' NOT NULL; -ALTER TABLE eg_fsm_application_auditlog ADD COLUMN applicationtype character varying(256) DEFAULT 'ADHOC' NOT NULL; +ALTER TABLE eg_fsm_application_auditlog ADD COLUMN IF NOT EXISTS applicationtype character varying(256) DEFAULT 'ADHOC' NOT NULL; -ALTER TABLE eg_fsm_application ADD COLUMN oldapplicationno character varying(256) DEFAULT NULL; +ALTER TABLE eg_fsm_application ADD COLUMN IF NOT EXISTS oldapplicationno character varying(256) DEFAULT NULL; -ALTER TABLE eg_fsm_application_auditlog ADD COLUMN oldapplicationno character varying(256) DEFAULT NULL; +ALTER TABLE eg_fsm_application_auditlog ADD COLUMN IF NOT EXISTS oldapplicationno character varying(256) DEFAULT NULL; diff --git a/municipal-services/fsm/src/main/resources/db/migration/main/V20210801150303.1__fsm_ddl.sql b/municipal-services/fsm/src/main/resources/db/migration/main/V20210801150303.1__fsm_ddl.sql index 455f3a28170..0c07d7e7d8f 100644 --- a/municipal-services/fsm/src/main/resources/db/migration/main/V20210801150303.1__fsm_ddl.sql +++ b/municipal-services/fsm/src/main/resources/db/migration/main/V20210801150303.1__fsm_ddl.sql @@ -1,6 +1,6 @@ ALTER TABLE eg_fsm_pit_detail - ADD COLUMN fsm_id character varying(64) NOT NULL, - DROP COLUMN fms_id; + ADD COLUMN IF NOT EXISTS fsm_id character varying(64) NOT NULL, + DROP COLUMN IF EXISTS fms_id; ALTER TABLE eg_fsm_pit_detail_auditlog - ADD COLUMN fsm_id character varying(64) NOT NULL; \ No newline at end of file + ADD COLUMN IF NOT EXISTS fsm_id character varying(64) NOT NULL; diff --git a/municipal-services/fsm/src/main/resources/db/migration/main/V20211119464303.1__fsm_ddl.sql b/municipal-services/fsm/src/main/resources/db/migration/main/V20211119464303.1__fsm_ddl.sql index 598dfdbb966..1aa01cfe717 100644 --- a/municipal-services/fsm/src/main/resources/db/migration/main/V20211119464303.1__fsm_ddl.sql +++ b/municipal-services/fsm/src/main/resources/db/migration/main/V20211119464303.1__fsm_ddl.sql @@ -1,2 +1,2 @@ ALTER TABLE eg_fsm_application_auditlog - DROP COLUMN pit_id ; \ No newline at end of file + DROP COLUMN IF EXISTS pit_id ; diff --git a/municipal-services/fsm/src/main/resources/db/migration/main/V20212602121628.1__appl_seq.sql b/municipal-services/fsm/src/main/resources/db/migration/main/V20212602121628.1__appl_seq.sql index 7b57079bed4..f96b501ad33 100644 --- a/municipal-services/fsm/src/main/resources/db/migration/main/V20212602121628.1__appl_seq.sql +++ b/municipal-services/fsm/src/main/resources/db/migration/main/V20212602121628.1__appl_seq.sql @@ -1 +1 @@ -CREATE SEQUENCE "SEQ_EGOV_FSM" INCREMENT 1; \ No newline at end of file +CREATE SEQUENCE IF NOT EXISTS "SEQ_EGOV_FSM" INCREMENT 1; diff --git a/municipal-services/fsm/src/main/resources/db/migration/main/V20212701150416.1__vehicle_type.sql b/municipal-services/fsm/src/main/resources/db/migration/main/V20212701150416.1__vehicle_type.sql index 84ab851db3e..f469b0bed57 100644 --- a/municipal-services/fsm/src/main/resources/db/migration/main/V20212701150416.1__vehicle_type.sql +++ b/municipal-services/fsm/src/main/resources/db/migration/main/V20212701150416.1__vehicle_type.sql @@ -1,2 +1,2 @@ -ALTER TABLE eg_fsm_application ADD COLUMN vehicletype character varying(64); -ALTER TABLE eg_fsm_pit_detail_auditlog ADD COLUMN vehicletype character varying(64) ; \ No newline at end of file +ALTER TABLE eg_fsm_application ADD COLUMN IF NOT EXISTS vehicletype character varying(64); +ALTER TABLE eg_fsm_pit_detail_auditlog ADD COLUMN IF NOT EXISTS vehicletype character varying(64) ; diff --git a/municipal-services/fsm/src/main/resources/db/migration/main/V20212801151329.1__pit_diameter.sql b/municipal-services/fsm/src/main/resources/db/migration/main/V20212801151329.1__pit_diameter.sql index eaf9351171b..fe2223070ca 100644 --- a/municipal-services/fsm/src/main/resources/db/migration/main/V20212801151329.1__pit_diameter.sql +++ b/municipal-services/fsm/src/main/resources/db/migration/main/V20212801151329.1__pit_diameter.sql @@ -1,2 +1,2 @@ -ALTER TABLE eg_fsm_pit_detail ADD COLUMN diameter character varying(64); -ALTER TABLE eg_fsm_pit_detail_auditlog ADD COLUMN diameter character varying(64) ; \ No newline at end of file +ALTER TABLE eg_fsm_pit_detail ADD COLUMN IF NOT EXISTS diameter character varying(64); +ALTER TABLE eg_fsm_pit_detail_auditlog ADD COLUMN IF NOT EXISTS diameter character varying(64) ; diff --git a/municipal-services/fsm/src/main/resources/db/migration/main/V20212801170416.1__vehicle_type.sql b/municipal-services/fsm/src/main/resources/db/migration/main/V20212801170416.1__vehicle_type.sql index 0502c2b865f..82513581e62 100644 --- a/municipal-services/fsm/src/main/resources/db/migration/main/V20212801170416.1__vehicle_type.sql +++ b/municipal-services/fsm/src/main/resources/db/migration/main/V20212801170416.1__vehicle_type.sql @@ -1,3 +1,3 @@ -ALTER TABLE eg_fsm_pit_detail_auditlog DROP COLUMN vehicletype ; -ALTER TABLE eg_fsm_application_auditlog ADD COLUMN vehicletype character varying(64) ; +ALTER TABLE eg_fsm_pit_detail_auditlog DROP COLUMN IF EXISTS vehicletype ; +ALTER TABLE eg_fsm_application_auditlog ADD COLUMN IF NOT EXISTS vehicletype character varying(64) ; diff --git a/municipal-services/fsm/src/main/resources/db/migration/main/V20220802200248__fsm_payment_preference.sql b/municipal-services/fsm/src/main/resources/db/migration/main/V20220802200248__fsm_payment_preference.sql index 3d3a3eb98a5..0fcaf0e5691 100644 --- a/municipal-services/fsm/src/main/resources/db/migration/main/V20220802200248__fsm_payment_preference.sql +++ b/municipal-services/fsm/src/main/resources/db/migration/main/V20220802200248__fsm_payment_preference.sql @@ -1,2 +1,2 @@ -ALTER TABLE eg_fsm_application ADD COLUMN paymentpreference character varying(64); -ALTER TABLE eg_fsm_application_auditlog ADD COLUMN paymentpreference character varying(64) ; \ No newline at end of file +ALTER TABLE eg_fsm_application ADD COLUMN IF NOT EXISTS paymentpreference character varying(64); +ALTER TABLE eg_fsm_application_auditlog ADD COLUMN IF NOT EXISTS paymentpreference character varying(64) ; diff --git a/municipal-services/fsm/src/main/resources/db/migration/main/V20221801010916__fsm_vehicle_capacity.sql b/municipal-services/fsm/src/main/resources/db/migration/main/V20221801010916__fsm_vehicle_capacity.sql index 147ca13f688..181f2a0d8a0 100644 --- a/municipal-services/fsm/src/main/resources/db/migration/main/V20221801010916__fsm_vehicle_capacity.sql +++ b/municipal-services/fsm/src/main/resources/db/migration/main/V20221801010916__fsm_vehicle_capacity.sql @@ -1,2 +1,2 @@ -ALTER TABLE eg_fsm_application ADD COLUMN vehiclecapacity character varying(64); -ALTER TABLE eg_fsm_application_auditlog ADD COLUMN vehiclecapacity character varying(64) ; \ No newline at end of file +ALTER TABLE eg_fsm_application ADD COLUMN IF NOT EXISTS vehiclecapacity character varying(64); +ALTER TABLE eg_fsm_application_auditlog ADD COLUMN IF NOT EXISTS vehiclecapacity character varying(64) ; diff --git a/municipal-services/fsm/src/main/resources/db/migration/main/V20221804092454__fsm_drop_column_payment_received.sql b/municipal-services/fsm/src/main/resources/db/migration/main/V20221804092454__fsm_drop_column_payment_received.sql index 3e19ec36f8b..86d21f2d38d 100644 --- a/municipal-services/fsm/src/main/resources/db/migration/main/V20221804092454__fsm_drop_column_payment_received.sql +++ b/municipal-services/fsm/src/main/resources/db/migration/main/V20221804092454__fsm_drop_column_payment_received.sql @@ -1,2 +1,2 @@ -ALTER TABLE eg_fsm_application DROP COLUMN receivedpayment ; -ALTER TABLE eg_fsm_application_auditlog DROP COLUMN receivedpayment ; \ No newline at end of file +ALTER TABLE eg_fsm_application DROP COLUMN IF EXISTS receivedpayment ; +ALTER TABLE eg_fsm_application_auditlog DROP COLUMN IF EXISTS receivedpayment ; diff --git a/municipal-services/fsm/src/main/resources/db/migration/main/V20229102210823__fsm_advance_amount.sql b/municipal-services/fsm/src/main/resources/db/migration/main/V20229102210823__fsm_advance_amount.sql index 677d316d0d2..981901871f6 100644 --- a/municipal-services/fsm/src/main/resources/db/migration/main/V20229102210823__fsm_advance_amount.sql +++ b/municipal-services/fsm/src/main/resources/db/migration/main/V20229102210823__fsm_advance_amount.sql @@ -1,3 +1,2 @@ -ALTER TABLE eg_fsm_application ADD COLUMN advanceAmount numeric(12,2) ; -ALTER TABLE eg_fsm_application_auditlog ADD COLUMN advanceAmount numeric(12,2); - +ALTER TABLE eg_fsm_application ADD COLUMN IF NOT EXISTS advanceAmount numeric(12,2) ; +ALTER TABLE eg_fsm_application_auditlog ADD COLUMN IF NOT EXISTS advanceAmount numeric(12,2); diff --git a/municipal-services/fsm/src/main/resources/fsm -api-spec.yaml b/municipal-services/fsm/src/main/resources/fsm -api-spec.yaml new file mode 100644 index 00000000000..e838c8e9299 --- /dev/null +++ b/municipal-services/fsm/src/main/resources/fsm -api-spec.yaml @@ -0,0 +1,996 @@ +--- +openapi: 3.0.1 +info: + title: OpenAPI definition + version: v0 +servers: +- url: http://localhost:9098/fsm + description: Generated server url +paths: + "/plantmap/v1/_update": + post: + tags: + - plant-mapping-controller + operationId: update + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/PlantMappingRequest" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/PlantMappingResponse" + "/plantmap/v1/_create": + post: + tags: + - plant-mapping-controller + operationId: create + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/PlantMappingRequest" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/PlantMappingResponse" + "/plantmap/v1/_search": + post: + tags: + - plant-mapping-controller + operationId: search + requestBody: + content: + application/json: + schema: + type: object + properties: + requestInfoWrapper: + "$ref": "#/components/schemas/RequestInfoWrapper" + criteria: + "$ref": "#/components/schemas/PlantMappingSearchCriteria" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/PlantMappingResponse" + "/v1/_update": + post: + tags: + - fsm-controller + operationId: update_1 + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/FSMRequest" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/FSMResponse" + "/v1/_create": + post: + tags: + - fsm-controller + operationId: create_1 + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/FSMRequest" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/FSMResponse" + "/v1/_search": + post: + tags: + - fsm-controller + operationId: search_1 + requestBody: + content: + application/json: + schema: + type: object + properties: + requestInfoWrapper: + "$ref": "#/components/schemas/RequestInfoWrapper" + criteria: + "$ref": "#/components/schemas/FSMSearchCriteria" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/FSMResponse" + "/v1/_audit": + post: + tags: + - fsm-controller + operationId: audit + requestBody: + content: + application/json: + schema: + type: object + properties: + requestInfoWrapper: + "$ref": "#/components/schemas/RequestInfoWrapper" + criteria: + "$ref": "#/components/schemas/FSMAuditSearchCriteria" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/FSMAuditResponse" + "/v1/_getapplicationsforperiodic": + post: + tags: + - fsm-controller + operationId: getFSMApplicationsForPeriodicServices + parameters: + - name: tenantId + in: query + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/RequestInfoWrapper" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/PeriodicApplicationResponse" + "/v1/_createperiodicapplications": + post: + tags: + - fsm-controller + operationId: createPeriodicApplications + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/PeriodicApplicationRequest" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/PeriodicApplicationResponse" + "/v1/_schedular": + post: + tags: + - fsm-controller + operationId: schedulePeriodicApplications + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/RequestInfoWrapper" + responses: + '200': + description: default response + "/v1/_plainsearch": + post: + tags: + - fsm-controller + operationId: plainsearch + requestBody: + content: + application/json: + schema: + type: object + properties: + requestInfoWrapper: + "$ref": "#/components/schemas/RequestInfoWrapper" + criteria: + "$ref": "#/components/schemas/FSMSearchCriteria" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/FSMResponse" + "/v1/fetchApplicationIds": + post: + tags: + - fsm-inbox-controller + operationId: fetchApplicationIds + requestBody: + content: + application/json: + schema: + type: object + properties: + requestInfoWrapper: + "$ref": "#/components/schemas/RequestInfoWrapper" + criteria: + "$ref": "#/components/schemas/VehicleTripSearchCriteria" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/VehicleCustomResponse" +components: + schemas: + AuditDetails: + type: object + properties: + createdBy: + type: string + lastModifiedBy: + type: string + createdTime: + type: integer + format: int64 + lastModifiedTime: + type: integer + format: int64 + PlainAccessRequest: + type: object + properties: + recordId: + type: string + plainRequestFields: + type: array + items: + type: string + PlantMapping: + required: + - tenantId + type: object + properties: + id: + type: string + employeeUuid: + maxLength: 64 + minLength: 0 + type: string + plantCode: + maxLength: 64 + minLength: 0 + type: string + tenantId: + maxLength: 64 + minLength: 2 + type: string + auditDetails: + "$ref": "#/components/schemas/AuditDetails" + status: + type: string + enum: + - ACTIVE + - INACTIVE + PlantMappingRequest: + type: object + properties: + RequestInfo: + "$ref": "#/components/schemas/RequestInfo" + plantMapping: + "$ref": "#/components/schemas/PlantMapping" + RequestInfo: + type: object + properties: + apiId: + type: string + ver: + type: string + ts: + type: integer + format: int64 + action: + type: string + did: + type: string + key: + type: string + msgId: + type: string + authToken: + type: string + correlationId: + type: string + plainAccessRequest: + "$ref": "#/components/schemas/PlainAccessRequest" + userInfo: + "$ref": "#/components/schemas/User" + Role: + type: object + properties: + id: + type: integer + format: int64 + name: + maxLength: 128 + minLength: 0 + type: string + code: + maxLength: 50 + minLength: 0 + type: string + tenantId: + maxLength: 256 + minLength: 0 + type: string + User: + type: object + properties: + id: + type: integer + format: int64 + userName: + maxLength: 180 + minLength: 0 + type: string + name: + maxLength: 250 + minLength: 0 + type: string + type: + maxLength: 50 + minLength: 0 + type: string + mobileNumber: + maxLength: 150 + minLength: 0 + type: string + emailId: + maxLength: 300 + minLength: 0 + type: string + roles: + type: array + items: + "$ref": "#/components/schemas/Role" + tenantId: + maxLength: 256 + minLength: 0 + type: string + uuid: + maxLength: 36 + minLength: 0 + type: string + PlantMappingResponse: + type: object + properties: + responseInfo: + "$ref": "#/components/schemas/ResponseInfo" + plantMapping: + type: array + items: + "$ref": "#/components/schemas/PlantMapping" + ResponseInfo: + type: object + properties: + apiId: + type: string + ver: + type: string + ts: + type: integer + format: int64 + resMsgId: + type: string + msgId: + type: string + status: + type: string + RequestInfoWrapper: + type: object + properties: + RequestInfo: + "$ref": "#/components/schemas/RequestInfo" + PlantMappingSearchCriteria: + type: object + properties: + empty: + type: boolean + tenantId: + type: string + plantCode: + type: string + employeeUuid: + type: array + items: + type: string + ids: + type: array + items: + type: string + Address: + type: object + properties: + tenantId: + type: string + doorNo: + maxLength: 256 + minLength: 0 + type: string + plotNo: + maxLength: 64 + minLength: 0 + type: string + id: + type: string + landmark: + maxLength: 1024 + minLength: 0 + type: string + city: + type: string + district: + type: string + region: + maxLength: 64 + minLength: 0 + type: string + state: + maxLength: 64 + minLength: 0 + type: string + country: + maxLength: 64 + minLength: 0 + type: string + pincode: + maxLength: 6 + minLength: 0 + pattern: "^[1-9]{1}[0-9]{5}$" + type: string + additionalDetails: + type: object + auditDetails: + "$ref": "#/components/schemas/AuditDetails" + buildingName: + maxLength: 64 + minLength: 0 + type: string + street: + maxLength: 256 + minLength: 0 + type: string + slumName: + type: string + locality: + "$ref": "#/components/schemas/Boundary" + geoLocation: + "$ref": "#/components/schemas/GeoLocation" + Boundary: + required: + - code + - name + type: object + properties: + code: + type: string + name: + type: string + label: + type: string + latitude: + type: string + longitude: + type: string + children: + type: array + items: + "$ref": "#/components/schemas/Boundary" + materializedPath: + type: string + Document: + type: object + properties: + id: + maxLength: 64 + minLength: 0 + type: string + documentType: + type: string + fileStore: + type: string + documentUid: + maxLength: 64 + minLength: 0 + type: string + additionalDetails: + type: object + Driver: + type: object + properties: + id: + type: string + tenantId: + maxLength: 64 + minLength: 0 + type: string + name: + maxLength: 128 + minLength: 0 + type: string + owner: + "$ref": "#/components/schemas/User" + ownerId: + maxLength: 64 + minLength: 0 + type: string + additionalDetails: + type: object + description: + type: string + licenseNumber: + type: string + vendor: + "$ref": "#/components/schemas/Vendor" + status: + type: string + enum: + - ACTIVE + - INACTIVE + - DISABLED + auditDetails: + "$ref": "#/components/schemas/AuditDetails" + vendorDriverStatus: + type: string + enum: + - ACTIVE + - INACTIVE + - DISABLED + FSM: + required: + - tenantId + type: object + properties: + citizen: + "$ref": "#/components/schemas/User" + id: + type: string + tenantId: + maxLength: 64 + minLength: 2 + type: string + applicationNo: + type: string + description: + type: string + accountId: + type: string + additionalDetails: + type: object + applicationStatus: + type: string + source: + type: string + sanitationtype: + type: string + propertyUsage: + type: string + vehicleType: + type: string + noOfTrips: + type: integer + format: int32 + vehicleCapacity: + type: string + status: + type: string + enum: + - ACTIVE + - INACTIVE + vehicleId: + type: string + vehicle: + "$ref": "#/components/schemas/Vehicle" + dsoId: + type: string + dso: + "$ref": "#/components/schemas/Vendor" + possibleServiceDate: + type: integer + format: int64 + pitDetail: + "$ref": "#/components/schemas/PitDetail" + address: + "$ref": "#/components/schemas/Address" + auditDetails: + "$ref": "#/components/schemas/AuditDetails" + wasteCollected: + type: number + format: double + completedOn: + type: integer + format: int64 + advanceAmount: + type: number + applicationType: + type: string + oldApplicationNo: + type: string + paymentPreference: + type: string + FSMRequest: + type: object + properties: + RequestInfo: + "$ref": "#/components/schemas/RequestInfo" + fsm: + "$ref": "#/components/schemas/FSM" + workflow: + "$ref": "#/components/schemas/Workflow" + GeoLocation: + type: object + properties: + id: + type: string + latitude: + type: number + format: double + longitude: + type: number + format: double + additionalDetails: + type: object + PitDetail: + type: object + properties: + type: + type: string + id: + type: string + tenantId: + type: string + height: + maximum: 99.9 + exclusiveMaximum: false + type: number + format: double + length: + maximum: 99.9 + exclusiveMaximum: false + type: number + format: double + width: + maximum: 99.9 + exclusiveMaximum: false + type: number + format: double + diameter: + maximum: 99.9 + exclusiveMaximum: false + type: number + format: double + distanceFromRoad: + type: number + format: double + auditDetails: + "$ref": "#/components/schemas/AuditDetails" + additionalDetails: + type: object + Vehicle: + type: object + properties: + id: + type: string + tenantId: + type: string + registrationNumber: + type: string + model: + type: string + type: + type: string + tankCapacity: + type: number + format: double + suctionType: + type: string + pollutionCertiValidTill: + type: integer + format: int64 + InsuranceCertValidTill: + type: integer + format: int64 + fitnessValidTill: + type: integer + format: int64 + roadTaxPaidTill: + type: integer + format: int64 + gpsEnabled: + type: boolean + additionalDetails: + type: object + source: + type: string + ownerId: + type: string + status: + type: string + enum: + - ACTIVE + - INACTIVE + owner: + "$ref": "#/components/schemas/User" + auditDetails: + "$ref": "#/components/schemas/AuditDetails" + Vendor: + type: object + properties: + id: + type: string + tenantId: + type: string + name: + type: string + address: + "$ref": "#/components/schemas/Address" + owner: + "$ref": "#/components/schemas/User" + vehicles: + type: array + items: + "$ref": "#/components/schemas/Vehicle" + drivers: + type: array + items: + "$ref": "#/components/schemas/Driver" + additionalDetails: + type: object + source: + type: string + description: + type: string + ownerId: + type: string + status: + type: string + enum: + - ACTIVE + - INACTIVE + auditDetails: + "$ref": "#/components/schemas/AuditDetails" + Workflow: + type: object + properties: + action: + type: string + assignes: + type: array + items: + type: string + comments: + type: string + verificationDocuments: + type: array + items: + "$ref": "#/components/schemas/Document" + rating: + type: integer + format: int32 + FSMResponse: + required: + - fsm + - responseInfo + type: object + properties: + totalCount: + type: integer + format: int32 + responseInfo: + "$ref": "#/components/schemas/ResponseInfo" + fsm: + type: array + items: + "$ref": "#/components/schemas/FSM" + workflow: + "$ref": "#/components/schemas/Workflow" + FSMSearchCriteria: + type: object + properties: + empty: + type: boolean + offset: + type: integer + format: int32 + limit: + type: integer + format: int32 + tenantId: + type: string + mobileNumber: + type: string + applicationStatus: + type: array + items: + type: string + locality: + type: array + items: + type: string + ownerIds: + type: array + items: + type: string + fromDate: + type: integer + format: int64 + toDate: + type: integer + format: int64 + applicationNos: + type: array + items: + type: string + applicationType: + type: string + oldApplicationNos: + type: array + items: + type: string + ids: + type: array + items: + type: string + sortBy: + type: string + enum: + - applicationStatus + - applicationNumber + - propertyUsage + - vehicle + - locality + - createdTime + sortOrder: + type: string + enum: + - ASC + - DESC + FSMAuditSearchCriteria: + type: object + properties: + tenantId: + type: string + applicationNo: + type: string + id: + type: string + FSMAudit: + type: object + properties: + who: + type: string + when: + type: integer + format: int64 + what: + type: object + additionalProperties: + type: object + FSMAuditResponse: + type: object + properties: + responseInfo: + "$ref": "#/components/schemas/ResponseInfo" + fsmAudit: + type: array + items: + "$ref": "#/components/schemas/FSMAudit" + PeriodicApplicationResponse: + type: object + properties: + responseInfo: + "$ref": "#/components/schemas/ResponseInfo" + applicationNoList: + type: array + items: + type: string + PeriodicApplicationRequest: + type: object + properties: + tenantId: + type: string + RequestInfo: + "$ref": "#/components/schemas/RequestInfo" + applicationNoList: + type: array + items: + type: string + VehicleTripSearchCriteria: + type: object + properties: + empty: + type: boolean + offset: + type: integer + format: int32 + limit: + type: integer + format: int32 + tenantId: + type: string + businessService: + type: string + ids: + type: array + items: + type: string + vehicleIds: + type: array + items: + type: string + tripOwnerIds: + type: array + items: + type: string + driverIds: + type: array + items: + type: string + applicationStatus: + type: array + items: + type: string + refernceNos: + type: array + items: + type: string + applicationNos: + type: array + items: + type: string + sortBy: + type: string + enum: + - APPLICATIONSTATUS + - APPLICATIONINO + - VEHICLE + - REFERENCENO + - CREATEDTIME + - TRIPSTARTTIME + - TRIPENDTIME + sortOrder: + type: string + enum: + - ASC + - DESC + VehicleCustomResponse: + type: object + properties: + responseInfo: + "$ref": "#/components/schemas/ResponseInfo" + applicationStatusCount: + type: array + items: + type: object + additionalProperties: + type: object + applicationIds: + type: array + items: + type: string \ No newline at end of file diff --git a/municipal-services/fsm/src/main/resources/fsm.yaml b/municipal-services/fsm/src/main/resources/fsm.yaml new file mode 100644 index 00000000000..e838c8e9299 --- /dev/null +++ b/municipal-services/fsm/src/main/resources/fsm.yaml @@ -0,0 +1,996 @@ +--- +openapi: 3.0.1 +info: + title: OpenAPI definition + version: v0 +servers: +- url: http://localhost:9098/fsm + description: Generated server url +paths: + "/plantmap/v1/_update": + post: + tags: + - plant-mapping-controller + operationId: update + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/PlantMappingRequest" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/PlantMappingResponse" + "/plantmap/v1/_create": + post: + tags: + - plant-mapping-controller + operationId: create + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/PlantMappingRequest" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/PlantMappingResponse" + "/plantmap/v1/_search": + post: + tags: + - plant-mapping-controller + operationId: search + requestBody: + content: + application/json: + schema: + type: object + properties: + requestInfoWrapper: + "$ref": "#/components/schemas/RequestInfoWrapper" + criteria: + "$ref": "#/components/schemas/PlantMappingSearchCriteria" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/PlantMappingResponse" + "/v1/_update": + post: + tags: + - fsm-controller + operationId: update_1 + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/FSMRequest" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/FSMResponse" + "/v1/_create": + post: + tags: + - fsm-controller + operationId: create_1 + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/FSMRequest" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/FSMResponse" + "/v1/_search": + post: + tags: + - fsm-controller + operationId: search_1 + requestBody: + content: + application/json: + schema: + type: object + properties: + requestInfoWrapper: + "$ref": "#/components/schemas/RequestInfoWrapper" + criteria: + "$ref": "#/components/schemas/FSMSearchCriteria" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/FSMResponse" + "/v1/_audit": + post: + tags: + - fsm-controller + operationId: audit + requestBody: + content: + application/json: + schema: + type: object + properties: + requestInfoWrapper: + "$ref": "#/components/schemas/RequestInfoWrapper" + criteria: + "$ref": "#/components/schemas/FSMAuditSearchCriteria" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/FSMAuditResponse" + "/v1/_getapplicationsforperiodic": + post: + tags: + - fsm-controller + operationId: getFSMApplicationsForPeriodicServices + parameters: + - name: tenantId + in: query + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/RequestInfoWrapper" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/PeriodicApplicationResponse" + "/v1/_createperiodicapplications": + post: + tags: + - fsm-controller + operationId: createPeriodicApplications + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/PeriodicApplicationRequest" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/PeriodicApplicationResponse" + "/v1/_schedular": + post: + tags: + - fsm-controller + operationId: schedulePeriodicApplications + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/RequestInfoWrapper" + responses: + '200': + description: default response + "/v1/_plainsearch": + post: + tags: + - fsm-controller + operationId: plainsearch + requestBody: + content: + application/json: + schema: + type: object + properties: + requestInfoWrapper: + "$ref": "#/components/schemas/RequestInfoWrapper" + criteria: + "$ref": "#/components/schemas/FSMSearchCriteria" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/FSMResponse" + "/v1/fetchApplicationIds": + post: + tags: + - fsm-inbox-controller + operationId: fetchApplicationIds + requestBody: + content: + application/json: + schema: + type: object + properties: + requestInfoWrapper: + "$ref": "#/components/schemas/RequestInfoWrapper" + criteria: + "$ref": "#/components/schemas/VehicleTripSearchCriteria" + responses: + '200': + description: default response + content: + "*/*": + schema: + "$ref": "#/components/schemas/VehicleCustomResponse" +components: + schemas: + AuditDetails: + type: object + properties: + createdBy: + type: string + lastModifiedBy: + type: string + createdTime: + type: integer + format: int64 + lastModifiedTime: + type: integer + format: int64 + PlainAccessRequest: + type: object + properties: + recordId: + type: string + plainRequestFields: + type: array + items: + type: string + PlantMapping: + required: + - tenantId + type: object + properties: + id: + type: string + employeeUuid: + maxLength: 64 + minLength: 0 + type: string + plantCode: + maxLength: 64 + minLength: 0 + type: string + tenantId: + maxLength: 64 + minLength: 2 + type: string + auditDetails: + "$ref": "#/components/schemas/AuditDetails" + status: + type: string + enum: + - ACTIVE + - INACTIVE + PlantMappingRequest: + type: object + properties: + RequestInfo: + "$ref": "#/components/schemas/RequestInfo" + plantMapping: + "$ref": "#/components/schemas/PlantMapping" + RequestInfo: + type: object + properties: + apiId: + type: string + ver: + type: string + ts: + type: integer + format: int64 + action: + type: string + did: + type: string + key: + type: string + msgId: + type: string + authToken: + type: string + correlationId: + type: string + plainAccessRequest: + "$ref": "#/components/schemas/PlainAccessRequest" + userInfo: + "$ref": "#/components/schemas/User" + Role: + type: object + properties: + id: + type: integer + format: int64 + name: + maxLength: 128 + minLength: 0 + type: string + code: + maxLength: 50 + minLength: 0 + type: string + tenantId: + maxLength: 256 + minLength: 0 + type: string + User: + type: object + properties: + id: + type: integer + format: int64 + userName: + maxLength: 180 + minLength: 0 + type: string + name: + maxLength: 250 + minLength: 0 + type: string + type: + maxLength: 50 + minLength: 0 + type: string + mobileNumber: + maxLength: 150 + minLength: 0 + type: string + emailId: + maxLength: 300 + minLength: 0 + type: string + roles: + type: array + items: + "$ref": "#/components/schemas/Role" + tenantId: + maxLength: 256 + minLength: 0 + type: string + uuid: + maxLength: 36 + minLength: 0 + type: string + PlantMappingResponse: + type: object + properties: + responseInfo: + "$ref": "#/components/schemas/ResponseInfo" + plantMapping: + type: array + items: + "$ref": "#/components/schemas/PlantMapping" + ResponseInfo: + type: object + properties: + apiId: + type: string + ver: + type: string + ts: + type: integer + format: int64 + resMsgId: + type: string + msgId: + type: string + status: + type: string + RequestInfoWrapper: + type: object + properties: + RequestInfo: + "$ref": "#/components/schemas/RequestInfo" + PlantMappingSearchCriteria: + type: object + properties: + empty: + type: boolean + tenantId: + type: string + plantCode: + type: string + employeeUuid: + type: array + items: + type: string + ids: + type: array + items: + type: string + Address: + type: object + properties: + tenantId: + type: string + doorNo: + maxLength: 256 + minLength: 0 + type: string + plotNo: + maxLength: 64 + minLength: 0 + type: string + id: + type: string + landmark: + maxLength: 1024 + minLength: 0 + type: string + city: + type: string + district: + type: string + region: + maxLength: 64 + minLength: 0 + type: string + state: + maxLength: 64 + minLength: 0 + type: string + country: + maxLength: 64 + minLength: 0 + type: string + pincode: + maxLength: 6 + minLength: 0 + pattern: "^[1-9]{1}[0-9]{5}$" + type: string + additionalDetails: + type: object + auditDetails: + "$ref": "#/components/schemas/AuditDetails" + buildingName: + maxLength: 64 + minLength: 0 + type: string + street: + maxLength: 256 + minLength: 0 + type: string + slumName: + type: string + locality: + "$ref": "#/components/schemas/Boundary" + geoLocation: + "$ref": "#/components/schemas/GeoLocation" + Boundary: + required: + - code + - name + type: object + properties: + code: + type: string + name: + type: string + label: + type: string + latitude: + type: string + longitude: + type: string + children: + type: array + items: + "$ref": "#/components/schemas/Boundary" + materializedPath: + type: string + Document: + type: object + properties: + id: + maxLength: 64 + minLength: 0 + type: string + documentType: + type: string + fileStore: + type: string + documentUid: + maxLength: 64 + minLength: 0 + type: string + additionalDetails: + type: object + Driver: + type: object + properties: + id: + type: string + tenantId: + maxLength: 64 + minLength: 0 + type: string + name: + maxLength: 128 + minLength: 0 + type: string + owner: + "$ref": "#/components/schemas/User" + ownerId: + maxLength: 64 + minLength: 0 + type: string + additionalDetails: + type: object + description: + type: string + licenseNumber: + type: string + vendor: + "$ref": "#/components/schemas/Vendor" + status: + type: string + enum: + - ACTIVE + - INACTIVE + - DISABLED + auditDetails: + "$ref": "#/components/schemas/AuditDetails" + vendorDriverStatus: + type: string + enum: + - ACTIVE + - INACTIVE + - DISABLED + FSM: + required: + - tenantId + type: object + properties: + citizen: + "$ref": "#/components/schemas/User" + id: + type: string + tenantId: + maxLength: 64 + minLength: 2 + type: string + applicationNo: + type: string + description: + type: string + accountId: + type: string + additionalDetails: + type: object + applicationStatus: + type: string + source: + type: string + sanitationtype: + type: string + propertyUsage: + type: string + vehicleType: + type: string + noOfTrips: + type: integer + format: int32 + vehicleCapacity: + type: string + status: + type: string + enum: + - ACTIVE + - INACTIVE + vehicleId: + type: string + vehicle: + "$ref": "#/components/schemas/Vehicle" + dsoId: + type: string + dso: + "$ref": "#/components/schemas/Vendor" + possibleServiceDate: + type: integer + format: int64 + pitDetail: + "$ref": "#/components/schemas/PitDetail" + address: + "$ref": "#/components/schemas/Address" + auditDetails: + "$ref": "#/components/schemas/AuditDetails" + wasteCollected: + type: number + format: double + completedOn: + type: integer + format: int64 + advanceAmount: + type: number + applicationType: + type: string + oldApplicationNo: + type: string + paymentPreference: + type: string + FSMRequest: + type: object + properties: + RequestInfo: + "$ref": "#/components/schemas/RequestInfo" + fsm: + "$ref": "#/components/schemas/FSM" + workflow: + "$ref": "#/components/schemas/Workflow" + GeoLocation: + type: object + properties: + id: + type: string + latitude: + type: number + format: double + longitude: + type: number + format: double + additionalDetails: + type: object + PitDetail: + type: object + properties: + type: + type: string + id: + type: string + tenantId: + type: string + height: + maximum: 99.9 + exclusiveMaximum: false + type: number + format: double + length: + maximum: 99.9 + exclusiveMaximum: false + type: number + format: double + width: + maximum: 99.9 + exclusiveMaximum: false + type: number + format: double + diameter: + maximum: 99.9 + exclusiveMaximum: false + type: number + format: double + distanceFromRoad: + type: number + format: double + auditDetails: + "$ref": "#/components/schemas/AuditDetails" + additionalDetails: + type: object + Vehicle: + type: object + properties: + id: + type: string + tenantId: + type: string + registrationNumber: + type: string + model: + type: string + type: + type: string + tankCapacity: + type: number + format: double + suctionType: + type: string + pollutionCertiValidTill: + type: integer + format: int64 + InsuranceCertValidTill: + type: integer + format: int64 + fitnessValidTill: + type: integer + format: int64 + roadTaxPaidTill: + type: integer + format: int64 + gpsEnabled: + type: boolean + additionalDetails: + type: object + source: + type: string + ownerId: + type: string + status: + type: string + enum: + - ACTIVE + - INACTIVE + owner: + "$ref": "#/components/schemas/User" + auditDetails: + "$ref": "#/components/schemas/AuditDetails" + Vendor: + type: object + properties: + id: + type: string + tenantId: + type: string + name: + type: string + address: + "$ref": "#/components/schemas/Address" + owner: + "$ref": "#/components/schemas/User" + vehicles: + type: array + items: + "$ref": "#/components/schemas/Vehicle" + drivers: + type: array + items: + "$ref": "#/components/schemas/Driver" + additionalDetails: + type: object + source: + type: string + description: + type: string + ownerId: + type: string + status: + type: string + enum: + - ACTIVE + - INACTIVE + auditDetails: + "$ref": "#/components/schemas/AuditDetails" + Workflow: + type: object + properties: + action: + type: string + assignes: + type: array + items: + type: string + comments: + type: string + verificationDocuments: + type: array + items: + "$ref": "#/components/schemas/Document" + rating: + type: integer + format: int32 + FSMResponse: + required: + - fsm + - responseInfo + type: object + properties: + totalCount: + type: integer + format: int32 + responseInfo: + "$ref": "#/components/schemas/ResponseInfo" + fsm: + type: array + items: + "$ref": "#/components/schemas/FSM" + workflow: + "$ref": "#/components/schemas/Workflow" + FSMSearchCriteria: + type: object + properties: + empty: + type: boolean + offset: + type: integer + format: int32 + limit: + type: integer + format: int32 + tenantId: + type: string + mobileNumber: + type: string + applicationStatus: + type: array + items: + type: string + locality: + type: array + items: + type: string + ownerIds: + type: array + items: + type: string + fromDate: + type: integer + format: int64 + toDate: + type: integer + format: int64 + applicationNos: + type: array + items: + type: string + applicationType: + type: string + oldApplicationNos: + type: array + items: + type: string + ids: + type: array + items: + type: string + sortBy: + type: string + enum: + - applicationStatus + - applicationNumber + - propertyUsage + - vehicle + - locality + - createdTime + sortOrder: + type: string + enum: + - ASC + - DESC + FSMAuditSearchCriteria: + type: object + properties: + tenantId: + type: string + applicationNo: + type: string + id: + type: string + FSMAudit: + type: object + properties: + who: + type: string + when: + type: integer + format: int64 + what: + type: object + additionalProperties: + type: object + FSMAuditResponse: + type: object + properties: + responseInfo: + "$ref": "#/components/schemas/ResponseInfo" + fsmAudit: + type: array + items: + "$ref": "#/components/schemas/FSMAudit" + PeriodicApplicationResponse: + type: object + properties: + responseInfo: + "$ref": "#/components/schemas/ResponseInfo" + applicationNoList: + type: array + items: + type: string + PeriodicApplicationRequest: + type: object + properties: + tenantId: + type: string + RequestInfo: + "$ref": "#/components/schemas/RequestInfo" + applicationNoList: + type: array + items: + type: string + VehicleTripSearchCriteria: + type: object + properties: + empty: + type: boolean + offset: + type: integer + format: int32 + limit: + type: integer + format: int32 + tenantId: + type: string + businessService: + type: string + ids: + type: array + items: + type: string + vehicleIds: + type: array + items: + type: string + tripOwnerIds: + type: array + items: + type: string + driverIds: + type: array + items: + type: string + applicationStatus: + type: array + items: + type: string + refernceNos: + type: array + items: + type: string + applicationNos: + type: array + items: + type: string + sortBy: + type: string + enum: + - APPLICATIONSTATUS + - APPLICATIONINO + - VEHICLE + - REFERENCENO + - CREATEDTIME + - TRIPSTARTTIME + - TRIPENDTIME + sortOrder: + type: string + enum: + - ASC + - DESC + VehicleCustomResponse: + type: object + properties: + responseInfo: + "$ref": "#/components/schemas/ResponseInfo" + applicationStatusCount: + type: array + items: + type: object + additionalProperties: + type: object + applicationIds: + type: array + items: + type: string \ No newline at end of file diff --git a/municipal-services/inbox/src/main/java/org/egov/inbox/service/InboxService.java b/municipal-services/inbox/src/main/java/org/egov/inbox/service/InboxService.java index 8aaa2ced3b2..8e6f9deac12 100644 --- a/municipal-services/inbox/src/main/java/org/egov/inbox/service/InboxService.java +++ b/municipal-services/inbox/src/main/java/org/egov/inbox/service/InboxService.java @@ -857,6 +857,10 @@ public InboxResponse fetchInboxData(InboxSearchCriteria criteria, RequestInfo re statusCountMap= aggregateStatusCountMap; //log.info("removeStatusCountMap:: "+ new Gson().toJson(statusCountMap)); + if(moduleSearchCriteria.containsKey("mobileNumber") || moduleSearchCriteria.containsKey("applicationNos")) + { + totalCount = inboxes.size(); + } } log.info("statusCountMap size :::: " + statusCountMap.size()); diff --git a/municipal-services/inbox/src/main/resources/application.properties b/municipal-services/inbox/src/main/resources/application.properties index 4f23e25a563..f3272c3afc7 100644 --- a/municipal-services/inbox/src/main/resources/application.properties +++ b/municipal-services/inbox/src/main/resources/application.properties @@ -94,7 +94,6 @@ egov.dashboard.analytics.getchartv2.path=/dashboard-analytics/dashboard/getChart egov.mdms.host=http://localhost:8073 egov.mdms.search.endpoint=/egov-mdms-service/v1/_search - services.esindexer.host=http://elasticsearch-data-v1.es-cluster:9200/ egov.services.esindexer.host.search=/_search management.health.elasticsearch.enabled=false diff --git a/municipal-services/land-services/CHANGELOG.md b/municipal-services/land-services/CHANGELOG.md index 1b2cd5aacc1..f9085fc7dee 100644 --- a/municipal-services/land-services/CHANGELOG.md +++ b/municipal-services/land-services/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this module will be documented in this file. +## 1.0.5 - 2023-08-10 + +- Central Instance Library Integration +- ## 1.0.4 - 2023-02-01 - Transition from 1.0.4-beta version to 1.0.4 version diff --git a/municipal-services/land-services/pom.xml b/municipal-services/land-services/pom.xml index 8f3331420cd..aefdaead90a 100644 --- a/municipal-services/land-services/pom.xml +++ b/municipal-services/land-services/pom.xml @@ -9,7 +9,7 @@ org.egov land-services - 1.0.4-SNAPSHOT + 1.0.5-SNAPSHOT land-services 2.17.1 @@ -59,6 +59,10 @@ jsoup 1.10.2 + + org.springframework.boot + spring-boot-starter-data-jpa + org.flywaydb flyway-core @@ -71,12 +75,12 @@ org.egov.services tracer - 2.0.0-SNAPSHOT + 2.1.0-SNAPSHOT org.egov.services services-common - 1.0.1-SNAPSHOT + 1.1.1-SNAPSHOT org.projectlombok @@ -99,12 +103,17 @@ org.egov mdms-client - 0.0.2-SNAPSHOT + 0.0.4-SNAPSHOT compile - + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + repo.egovernments.org eGov ERP Releases Repository diff --git a/municipal-services/land-services/src/main/java/org/egov/land/LandServicesApplication.java b/municipal-services/land-services/src/main/java/org/egov/land/LandServicesApplication.java index eb7b90de9da..63aa7ded76f 100644 --- a/municipal-services/land-services/src/main/java/org/egov/land/LandServicesApplication.java +++ b/municipal-services/land-services/src/main/java/org/egov/land/LandServicesApplication.java @@ -1,12 +1,13 @@ package org.egov.land; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.config.TracerConfiguration; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Import; @SpringBootApplication -@Import({ TracerConfiguration.class }) +@Import({ TracerConfiguration.class, MultiStateInstanceUtil.class}) public class LandServicesApplication { public static void main(String[] args) { diff --git a/municipal-services/land-services/src/main/java/org/egov/land/producer/Producer.java b/municipal-services/land-services/src/main/java/org/egov/land/producer/Producer.java index 177f97b4493..9533f6857c2 100644 --- a/municipal-services/land-services/src/main/java/org/egov/land/producer/Producer.java +++ b/municipal-services/land-services/src/main/java/org/egov/land/producer/Producer.java @@ -1,17 +1,26 @@ package org.egov.land.producer; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.kafka.CustomKafkaTemplate; //import org.egov.tracer.kafka.CustomKafkaTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service +@Slf4j public class Producer { @Autowired private CustomKafkaTemplate kafkaTemplate; - public void push(String topic, Object value) { - kafkaTemplate.send(topic, value); + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + public void push(String tenantId, String topic, Object value) { + String updatedTopic = centralInstanceUtil.getStateSpecificTopicName(tenantId, topic); + log.info("The Kafka topic for the tenantId : " + tenantId + " is : " + updatedTopic); + + kafkaTemplate.send(updatedTopic, value); } } diff --git a/municipal-services/land-services/src/main/java/org/egov/land/repository/LandRepository.java b/municipal-services/land-services/src/main/java/org/egov/land/repository/LandRepository.java index 4cba772deab..004fe061bc7 100644 --- a/municipal-services/land-services/src/main/java/org/egov/land/repository/LandRepository.java +++ b/municipal-services/land-services/src/main/java/org/egov/land/repository/LandRepository.java @@ -3,6 +3,8 @@ import java.util.ArrayList; import java.util.List; +import org.egov.common.exception.InvalidTenantIdException; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.land.config.LandConfiguration; import org.egov.land.producer.Producer; import org.egov.land.repository.querybuilder.LandQueryBuilder; @@ -10,6 +12,7 @@ import org.egov.land.web.models.LandInfo; import org.egov.land.web.models.LandInfoRequest; import org.egov.land.web.models.LandSearchCriteria; +import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; @@ -36,18 +39,21 @@ public class LandRepository { @Autowired private LandRowMapper rowMapper; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + /** * Pushes the request on save topic through kafka * * @param bpaRequest * The landinfo create request */ - public void save(LandInfoRequest landRequest) { - producer.push(config.getSaveLandInfoTopic(), landRequest); + public void save(String tenantId, LandInfoRequest landRequest) { + producer.push(tenantId, config.getSaveLandInfoTopic(), landRequest); } - public void update(LandInfoRequest landRequest) { - producer.push(config.getUpdateLandInfoTopic(), landRequest); + public void update(String tenantId, LandInfoRequest landRequest) { + producer.push(tenantId, config.getUpdateLandInfoTopic(), landRequest); } /** @@ -60,6 +66,12 @@ public void update(LandInfoRequest landRequest) { public List getLandInfoData(LandSearchCriteria criteria) { List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getLandInfoSearchQuery(criteria, preparedStmtList); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("LAND_SEARCH_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } List landInfoData = jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); if(!CollectionUtils.isEmpty(landInfoData)) { log.debug("Received data from Query.."); diff --git a/municipal-services/land-services/src/main/java/org/egov/land/repository/querybuilder/LandQueryBuilder.java b/municipal-services/land-services/src/main/java/org/egov/land/repository/querybuilder/LandQueryBuilder.java index 58fb5efc0d1..c2dbc48d2b3 100644 --- a/municipal-services/land-services/src/main/java/org/egov/land/repository/querybuilder/LandQueryBuilder.java +++ b/municipal-services/land-services/src/main/java/org/egov/land/repository/querybuilder/LandQueryBuilder.java @@ -25,13 +25,13 @@ public class LandQueryBuilder { + "landInfoowner.id as landInfoowner_id,landInfoowner.uuid as landInfoowner_uuid,landInfoowner.status as ownerstatus,landInfo.landuniqueregno as land_regno," + "landInstitution.type as land_inst_type, landInstitution.id as land_inst_id, " + "landInfounit.id as landInfo_un_id, landInfodoc.id as landInfo_doc_id,landInfodoc.documenttype as landInfo_doc_documenttype,landInfodoc.filestoreid as landInfo_doc_filestore" - + " FROM eg_land_landInfo landInfo" + INNER_JOIN_STRING - + "eg_land_Address landInfoaddress ON landInfoaddress.landInfoId = landInfo.id" + LEFT_OUTER_JOIN_STRING - + "eg_land_institution landInstitution ON landInstitution.landInfoId = landInfo.id" + INNER_JOIN_STRING - + "eg_land_ownerInfo landInfoowner ON landInfoowner.landInfoId = landInfo.id AND landInfoowner.status = true " + LEFT_OUTER_JOIN_STRING - + "eg_land_unit landInfounit ON landInfounit.landInfoId = landInfo.id" + LEFT_OUTER_JOIN_STRING - + "eg_land_document landInfodoc ON landInfodoc.landInfoId = landInfo.id" + LEFT_OUTER_JOIN_STRING - + "eg_land_GeoLocation landInfogeolocation ON landInfogeolocation.addressid = landInfoaddress.id";; + + " FROM {schema}.eg_land_landInfo landInfo" + INNER_JOIN_STRING + + "{schema}.eg_land_Address landInfoaddress ON landInfoaddress.landInfoId = landInfo.id" + LEFT_OUTER_JOIN_STRING + + "{schema}.eg_land_institution landInstitution ON landInstitution.landInfoId = landInfo.id" + INNER_JOIN_STRING + + "{schema}.eg_land_ownerInfo landInfoowner ON landInfoowner.landInfoId = landInfo.id AND landInfoowner.status = true " + LEFT_OUTER_JOIN_STRING + + "{schema}.eg_land_unit landInfounit ON landInfounit.landInfoId = landInfo.id" + LEFT_OUTER_JOIN_STRING + + "{schema}.eg_land_document landInfodoc ON landInfodoc.landInfoId = landInfo.id" + LEFT_OUTER_JOIN_STRING + + "{schema}.eg_land_GeoLocation landInfogeolocation ON landInfogeolocation.addressid = landInfoaddress.id";; private final String paginationWrapper = "SELECT * FROM " + "(SELECT *, DENSE_RANK() OVER (ORDER BY landInfo_lastModifiedTime DESC) offset_ FROM " + "({})" diff --git a/municipal-services/land-services/src/main/java/org/egov/land/service/LandService.java b/municipal-services/land-services/src/main/java/org/egov/land/service/LandService.java index a8e1e7efaa7..6444ac72100 100644 --- a/municipal-services/land-services/src/main/java/org/egov/land/service/LandService.java +++ b/municipal-services/land-services/src/main/java/org/egov/land/service/LandService.java @@ -63,7 +63,7 @@ public LandInfo create(@Valid LandInfoRequest landRequest) { owner.setStatus(false); } }); - repository.save(landRequest); + repository.save(landRequest.getLandInfo().getTenantId(), landRequest); return landRequest.getLandInfo(); } @@ -93,7 +93,7 @@ public LandInfo update(@Valid LandInfoRequest landRequest) { } }); - repository.update(landRequest); + repository.update(landRequest.getLandInfo().getTenantId(), landRequest); List activeOwnerList = new ArrayList(); if(landRequest.getLandInfo().getOwners().size()>1) { landRequest.getLandInfo().getOwners().forEach(owner -> { diff --git a/municipal-services/land-services/src/main/java/org/egov/land/service/LandUserService.java b/municipal-services/land-services/src/main/java/org/egov/land/service/LandUserService.java index 984fde9357a..0aee5d07c63 100644 --- a/municipal-services/land-services/src/main/java/org/egov/land/service/LandUserService.java +++ b/municipal-services/land-services/src/main/java/org/egov/land/service/LandUserService.java @@ -15,6 +15,7 @@ import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.land.config.LandConfiguration; import org.egov.land.repository.ServiceRequestRepository; import org.egov.land.util.LandConstants; @@ -48,6 +49,9 @@ public class LandUserService { @Autowired private ObjectMapper mapper; + @Autowired + MultiStateInstanceUtil centralInstanceUtil; + public void manageUser(LandInfoRequest landRequest) { LandInfo landInfo = landRequest.getLandInfo(); @Valid RequestInfo requestInfo = landRequest.getRequestInfo(); @@ -57,7 +61,7 @@ public void manageUser(LandInfoRequest landRequest) { if (owner.getMobileNumber() != null) { if (owner.getTenantId() == null) { - owner.setTenantId(landInfo.getTenantId().split("\\.")[0]); + owner.setTenantId(centralInstanceUtil.getStateLevelTenant(landInfo.getTenantId())); } userDetailResponse = userExists(owner, requestInfo); @@ -109,7 +113,7 @@ private Role getCitizenRole() { private UserDetailResponse userExists(OwnerInfo owner, @Valid RequestInfo requestInfo) { UserSearchRequest userSearchRequest = new UserSearchRequest(); - userSearchRequest.setTenantId(owner.getTenantId().split("\\.")[0]); + userSearchRequest.setTenantId(centralInstanceUtil.getStateLevelTenant(owner.getTenantId())); userSearchRequest.setMobileNumber(owner.getMobileNumber()); if(!StringUtils.isEmpty(owner.getUuid())) { List uuids = new ArrayList(); @@ -283,7 +287,7 @@ public UserDetailResponse getUser(LandSearchCriteria criteria, RequestInfo reque private UserSearchRequest getUserSearchRequest(LandSearchCriteria criteria, RequestInfo requestInfo) { UserSearchRequest userSearchRequest = new UserSearchRequest(); userSearchRequest.setRequestInfo(requestInfo); - userSearchRequest.setTenantId(criteria.getTenantId().split("\\.")[0]); + userSearchRequest.setTenantId(centralInstanceUtil.getStateLevelTenant(criteria.getTenantId())); userSearchRequest.setMobileNumber(criteria.getMobileNumber()); userSearchRequest.setActive(true); userSearchRequest.setUserType(LandConstants.CITIZEN); diff --git a/municipal-services/land-services/src/main/resources/application.properties b/municipal-services/land-services/src/main/resources/application.properties index 8c728c47f13..4ac85e03c0c 100644 --- a/municipal-services/land-services/src/main/resources/application.properties +++ b/municipal-services/land-services/src/main/resources/application.properties @@ -6,10 +6,10 @@ app.timezone=UTC spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/testing_changes +spring.datasource.url=jdbc:postgresql://localhost:5432/land -spring.datasource.username=postgres -spring.datasource.password=chinni +spring.datasource.username=land +spring.datasource.password=land spring.datasource.platform=postgresql @@ -17,10 +17,10 @@ spring.datasource.platform=postgresql ##----------------------------- FLYWAY CONFIGURATIONS -----------------------------# -spring.flyway.url=jdbc:postgresql://localhost:5432/testing_changes +spring.flyway.url=jdbc:postgresql://localhost:5432/land -spring.flyway.user=postgres -spring.flyway.password=chinni +spring.flyway.user=land +spring.flyway.password=land spring.flyway.table=public spring.flyway.baseline-on-migrate=true spring.flyway.outOfOrder=true diff --git a/municipal-services/land-services/src/main/resources/db/migrate.sh b/municipal-services/land-services/src/main/resources/db/migrate.sh index 54d07c0940a..f79b7016299 100644 --- a/municipal-services/land-services/src/main/resources/db/migrate.sh +++ b/municipal-services/land-services/src/main/resources/db/migrate.sh @@ -1,3 +1,11 @@ #!/bin/sh - -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate +baseurl=$DB_URL +echo "the baseurl : $DB_URL" +schemasetter="?currentSchema=" +schemas=$SCHEMA_NAME +echo "the schemas : $schemas" +for schemaname in ${schemas//,/ } +do + echo "the schema name : ${baseurl}${schemasetter}${schemaname}" + flyway -url=${baseurl}${schemasetter}${schemaname} -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate +done \ No newline at end of file diff --git a/municipal-services/noc-services/CHANGELOG.md b/municipal-services/noc-services/CHANGELOG.md index 58c1cf61618..ebfce15b727 100755 --- a/municipal-services/noc-services/CHANGELOG.md +++ b/municipal-services/noc-services/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this module will be documented in this file. +## 1.0.6 - 2023-08-10 + +- Central Instance Library Integration + ## 1.0.5 - 2023-02-01 - Transition from 1.0.5-beta version to 1.0.5 version diff --git a/municipal-services/noc-services/bin/pom.xml b/municipal-services/noc-services/bin/pom.xml index b1df108cca5..880e0a85d87 100755 --- a/municipal-services/noc-services/bin/pom.xml +++ b/municipal-services/noc-services/bin/pom.xml @@ -100,7 +100,12 @@ test - + + + repo.egovernments.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + repo.egovernments.org eGov ERP Releases Repository diff --git a/municipal-services/noc-services/pom.xml b/municipal-services/noc-services/pom.xml index 6baaad6ff99..6e7756f9130 100755 --- a/municipal-services/noc-services/pom.xml +++ b/municipal-services/noc-services/pom.xml @@ -5,7 +5,7 @@ noc-services jar noc-services - 1.0.5-SNAPSHOT + 1.0.6-SNAPSHOT 2.17.1 1.8 @@ -76,12 +76,12 @@ org.egov.services tracer - 2.0.0-SNAPSHOT + 2.1.0-SNAPSHOT org.egov.services services-common - 1.0.1-SNAPSHOT + 1.1.1-SNAPSHOT org.projectlombok @@ -108,7 +108,7 @@ org.egov mdms-client - 0.0.2-SNAPSHOT + 0.0.4-SNAPSHOT compile diff --git a/municipal-services/noc-services/src/main/java/org/egov/noc/NOCApplication.java b/municipal-services/noc-services/src/main/java/org/egov/noc/NOCApplication.java index b7fdb0de62c..6108ebf30dd 100755 --- a/municipal-services/noc-services/src/main/java/org/egov/noc/NOCApplication.java +++ b/municipal-services/noc-services/src/main/java/org/egov/noc/NOCApplication.java @@ -39,13 +39,14 @@ */ package org.egov.noc; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.config.TracerConfiguration; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Import; @SpringBootApplication -@Import({ TracerConfiguration.class }) +@Import({ TracerConfiguration.class, MultiStateInstanceUtil.class }) public class NOCApplication { public static void main(String[] args) { diff --git a/municipal-services/noc-services/src/main/java/org/egov/noc/consumer/NOCConsumer.java b/municipal-services/noc-services/src/main/java/org/egov/noc/consumer/NOCConsumer.java index 3002be1e525..057afcfcfa2 100755 --- a/municipal-services/noc-services/src/main/java/org/egov/noc/consumer/NOCConsumer.java +++ b/municipal-services/noc-services/src/main/java/org/egov/noc/consumer/NOCConsumer.java @@ -3,7 +3,9 @@ import java.util.HashMap; import org.egov.noc.service.notification.NOCNotificationService; +import org.egov.noc.util.NOCConstants; import org.egov.noc.web.model.NocRequest; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; @@ -32,6 +34,10 @@ public void listen(final HashMap record, @Header(KafkaHeaders.RE log.error("Error while listening to value: " + record + " on topic: " + topic + ": " + e); } log.debug("BPA Received: " + nocRequest.getNoc().getApplicationNo()); + + // Adding in MDC so that tracer can add it in header + MDC.put(NOCConstants.TENANTID_MDC_STRING, nocRequest.getNoc().getTenantId()); + notificationService.process(nocRequest); } } diff --git a/municipal-services/noc-services/src/main/java/org/egov/noc/producer/Producer.java b/municipal-services/noc-services/src/main/java/org/egov/noc/producer/Producer.java index 0e1f08694cf..64beeab3efe 100755 --- a/municipal-services/noc-services/src/main/java/org/egov/noc/producer/Producer.java +++ b/municipal-services/noc-services/src/main/java/org/egov/noc/producer/Producer.java @@ -1,5 +1,6 @@ package org.egov.noc.producer; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.kafka.CustomKafkaTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -10,7 +11,11 @@ public class Producer { @Autowired private CustomKafkaTemplate kafkaTemplate; - public void push(String topic, Object value) { - kafkaTemplate.send(topic, value); + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + public void push(String tenantId, String topic, Object value) { + String updatedTopic = centralInstanceUtil.getStateSpecificTopicName(tenantId, topic); + kafkaTemplate.send(updatedTopic, value); } } diff --git a/municipal-services/noc-services/src/main/java/org/egov/noc/repository/NOCRepository.java b/municipal-services/noc-services/src/main/java/org/egov/noc/repository/NOCRepository.java index 3c2bfa10a17..3c0b8b66ea3 100755 --- a/municipal-services/noc-services/src/main/java/org/egov/noc/repository/NOCRepository.java +++ b/municipal-services/noc-services/src/main/java/org/egov/noc/repository/NOCRepository.java @@ -1,5 +1,7 @@ package org.egov.noc.repository; +import org.egov.common.exception.InvalidTenantIdException; +import org.egov.common.utils.MultiStateInstanceUtil; import java.util.ArrayList; import java.util.List; @@ -11,10 +13,14 @@ import org.egov.noc.web.model.Noc; import org.egov.noc.web.model.NocRequest; import org.egov.noc.web.model.NocSearchCriteria; +import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; +import java.util.ArrayList; +import java.util.List; + @Repository @Slf4j public class NOCRepository { @@ -33,13 +39,16 @@ public class NOCRepository { @Autowired private NocRowMapper rowMapper; - + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + /** * push the nocRequest object to the producer on the save topic * @param nocRequest */ public void save(NocRequest nocRequest) { - producer.push(config.getSaveTopic(), nocRequest); + producer.push(nocRequest.getNoc().getTenantId(),config.getSaveTopic(), nocRequest); } /** @@ -50,9 +59,9 @@ public void save(NocRequest nocRequest) { public void update(NocRequest nocRequest, boolean isStateUpdatable) { log.info("Pushing NOC record with application status - "+nocRequest.getNoc().getApplicationStatus()); if (isStateUpdatable) { - producer.push(config.getUpdateTopic(), nocRequest); + producer.push(nocRequest.getNoc().getTenantId(),config.getUpdateTopic(), nocRequest); } else { - producer.push(config.getUpdateWorkflowTopic(), nocRequest); + producer.push(nocRequest.getNoc().getTenantId(),config.getUpdateWorkflowTopic(), nocRequest); } } /** @@ -64,6 +73,12 @@ public void update(NocRequest nocRequest, boolean isStateUpdatable) { public List getNocData(NocSearchCriteria criteria) { List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getNocSearchQuery(criteria, preparedStmtList, false); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("EG_NOC_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } List nocList = jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); return nocList; } @@ -77,6 +92,12 @@ public List getNocData(NocSearchCriteria criteria) { public Integer getNocCount(NocSearchCriteria criteria) { List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getNocSearchQuery(criteria, preparedStmtList, true); + try { + query = centralInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("EG_NOC_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } int count = jdbcTemplate.queryForObject(query, preparedStmtList.toArray(), Integer.class); return count; } diff --git a/municipal-services/noc-services/src/main/java/org/egov/noc/repository/builder/NocQueryBuilder.java b/municipal-services/noc-services/src/main/java/org/egov/noc/repository/builder/NocQueryBuilder.java index ac0cd8de36f..13c132aca71 100755 --- a/municipal-services/noc-services/src/main/java/org/egov/noc/repository/builder/NocQueryBuilder.java +++ b/municipal-services/noc-services/src/main/java/org/egov/noc/repository/builder/NocQueryBuilder.java @@ -26,8 +26,8 @@ public class NocQueryBuilder { + "noc_lastModifiedTime,noc.createdBy as noc_createdBy,noc.lastModifiedBy as noc_lastModifiedBy,noc.createdTime as " + "noc_createdTime,noc.additionalDetails,noc.landId as noc_landId, nocdoc.id as noc_doc_id, nocdoc.additionalDetails as doc_details, " + "nocdoc.documenttype as noc_doc_documenttype,nocdoc.filestoreid as noc_doc_filestore" - + " FROM eg_noc noc LEFT OUTER JOIN " - + "eg_noc_document nocdoc ON nocdoc.nocid = noc.id WHERE 1=1 "; + + " FROM {schema}.eg_noc noc LEFT OUTER JOIN " + + "{schema}.eg_noc_document nocdoc ON nocdoc.nocid = noc.id WHERE 1=1 "; private final String paginationWrapper = "SELECT * FROM " + "(SELECT *, DENSE_RANK() OVER (ORDER BY noc_lastModifiedTime DESC) offset_ FROM " + "({})" @@ -74,7 +74,6 @@ public String getNocSearchQuery(NocSearchCriteria criteria, List prepare addToPreparedStatement(preparedStmtList, applicationNos); } } - String approvalNo = criteria.getNocNo(); if (approvalNo != null) { @@ -88,7 +87,6 @@ public String getNocSearchQuery(NocSearchCriteria criteria, List prepare addToPreparedStatement(preparedStmtList, approvalNos); } } - String source = criteria.getSource(); if (source!=null) { @@ -112,7 +110,6 @@ public String getNocSearchQuery(NocSearchCriteria criteria, List prepare addToPreparedStatement(preparedStmtList, sourceRefIds); } } - String nocType = criteria.getNocType(); if (nocType!=null) { diff --git a/municipal-services/noc-services/src/main/java/org/egov/noc/service/NOCService.java b/municipal-services/noc-services/src/main/java/org/egov/noc/service/NOCService.java index d7a9ec23860..e9d70ee880e 100755 --- a/municipal-services/noc-services/src/main/java/org/egov/noc/service/NOCService.java +++ b/municipal-services/noc-services/src/main/java/org/egov/noc/service/NOCService.java @@ -1,15 +1,9 @@ package org.egov.noc.service; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.noc.config.NOCConfiguration; import org.egov.noc.repository.NOCRepository; import org.egov.noc.repository.ServiceRequestRepository; @@ -35,9 +29,7 @@ import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; -import com.fasterxml.jackson.databind.ObjectMapper; - -import lombok.extern.slf4j.Slf4j; +import java.util.*; @Service @Slf4j @@ -70,13 +62,15 @@ public class NOCService { @Autowired private ObjectMapper mapper; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; /** * entry point from controller, takes care of next level logic from controller to create NOC application * @param nocRequest * @return */ public List create(NocRequest nocRequest) { - String tenantId = nocRequest.getNoc().getTenantId().split("\\.")[0]; + String tenantId = centralInstanceUtil.getStateLevelTenant(nocRequest.getNoc().getTenantId()); Object mdmsData = nocUtil.mDMSCall(nocRequest.getRequestInfo(), tenantId); Map additionalDetails = nocValidator.getOrValidateBussinessService(nocRequest.getNoc(), mdmsData); nocValidator.validateCreate(nocRequest, mdmsData); @@ -96,7 +90,7 @@ public List create(NocRequest nocRequest) { */ @SuppressWarnings({ "rawtypes", "unchecked" }) public List update(NocRequest nocRequest) { - String tenantId = nocRequest.getNoc().getTenantId().split("\\.")[0]; + String tenantId = centralInstanceUtil.getStateLevelTenant(nocRequest.getNoc().getTenantId()); Object mdmsData = nocUtil.mDMSCall(nocRequest.getRequestInfo(), tenantId); Map additionalDetails ; if(!ObjectUtils.isEmpty(nocRequest.getNoc().getAdditionalDetails())) { @@ -133,7 +127,7 @@ public List update(NocRequest nocRequest) { /** * entry point from controller,applies the quired fileters and encrich search criteria and * return the noc application matching the search criteria - * @param nocRequest + * @param criteria * @return */ public List search(NocSearchCriteria criteria, RequestInfo requestInfo) { @@ -275,6 +269,7 @@ public List search(NocSearchCriteria criteria, RequestInfo requestInfo) { public Noc getNocForUpdate(NocRequest nocRequest) { List ids = Arrays.asList(nocRequest.getNoc().getId()); NocSearchCriteria criteria = new NocSearchCriteria(); + criteria.setTenantId(nocRequest.getNoc().getTenantId()); criteria.setIds(ids); List nocList = search(criteria, nocRequest.getRequestInfo()); if (CollectionUtils.isEmpty(nocList) ) { diff --git a/municipal-services/noc-services/src/main/java/org/egov/noc/service/UserService.java b/municipal-services/noc-services/src/main/java/org/egov/noc/service/UserService.java index c7ffc8429a5..903f02ec2c5 100755 --- a/municipal-services/noc-services/src/main/java/org/egov/noc/service/UserService.java +++ b/municipal-services/noc-services/src/main/java/org/egov/noc/service/UserService.java @@ -1,12 +1,8 @@ package org.egov.noc.service; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.List; - +import com.fasterxml.jackson.databind.ObjectMapper; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.noc.config.NOCConfiguration; import org.egov.noc.repository.ServiceRequestRepository; import org.egov.noc.web.model.NocSearchCriteria; @@ -17,7 +13,11 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import com.fasterxml.jackson.databind.ObjectMapper; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; @Service public class UserService { @@ -31,6 +31,9 @@ public class UserService { @Autowired private ObjectMapper mapper; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + /** * Call search in user service based on ownerids from criteria * @@ -59,7 +62,7 @@ public UserResponse getUser(NocSearchCriteria criteria, RequestInfo requestInfo) private UserSearchRequest getUserSearchRequest(NocSearchCriteria criteria, RequestInfo requestInfo) { UserSearchRequest userSearchRequest = new UserSearchRequest(); userSearchRequest.setRequestInfo(requestInfo); - userSearchRequest.setTenantId(criteria.getTenantId().split("\\.")[0]); + userSearchRequest.setTenantId(centralInstanceUtil.getStateLevelTenant(criteria.getTenantId())); userSearchRequest.setActive(true); /* userSearchRequest.setUserType("CITIZEN"); */ if (!CollectionUtils.isEmpty(criteria.getOwnerIds())) diff --git a/municipal-services/noc-services/src/main/java/org/egov/noc/service/notification/NOCNotificationService.java b/municipal-services/noc-services/src/main/java/org/egov/noc/service/notification/NOCNotificationService.java index 44ef5f98722..c9957e4d11b 100755 --- a/municipal-services/noc-services/src/main/java/org/egov/noc/service/notification/NOCNotificationService.java +++ b/municipal-services/noc-services/src/main/java/org/egov/noc/service/notification/NOCNotificationService.java @@ -1,11 +1,6 @@ package org.egov.noc.service.notification; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - +import lombok.extern.slf4j.Slf4j; import org.egov.noc.config.NOCConfiguration; import org.egov.noc.repository.ServiceRequestRepository; import org.egov.noc.service.UserService; @@ -18,7 +13,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import lombok.extern.slf4j.Slf4j; +import java.util.*; @Slf4j @Service @@ -44,7 +39,7 @@ public NOCNotificationService(NOCConfiguration config, NotificationUtil util, /** * Creates and send the sms based on the NOCRequest * - * @param request + * @param nocRequest * The NOCRequest listenend on the kafka topic */ public void process(NocRequest nocRequest) { @@ -53,7 +48,7 @@ public void process(NocRequest nocRequest) { if (config.getIsSMSEnabled()) { enrichSMSRequest(nocRequest, smsRequests); if (!CollectionUtils.isEmpty(smsRequests)) - util.sendSMS(smsRequests, config.getIsSMSEnabled()); + util.sendSMS(nocRequest.getNoc().getTenantId(),smsRequests, config.getIsSMSEnabled()); } } } @@ -61,7 +56,7 @@ public void process(NocRequest nocRequest) { /** * Enriches the smsRequest with the customized messages * - * @param request + * @param nocRequest * The bpaRequest from kafka topic * @param smsRequests * List of SMSRequets diff --git a/municipal-services/noc-services/src/main/java/org/egov/noc/util/NOCConstants.java b/municipal-services/noc-services/src/main/java/org/egov/noc/util/NOCConstants.java index 73379c023f2..dd83155292b 100755 --- a/municipal-services/noc-services/src/main/java/org/egov/noc/util/NOCConstants.java +++ b/municipal-services/noc-services/src/main/java/org/egov/noc/util/NOCConstants.java @@ -78,5 +78,7 @@ public class NOCConstants { public static final String AIRPORT_NOC_TYPE = "AIRPORT_AUTHORITY"; public static final String PARSING_ERROR = "PARSING_ERROR"; + + public static final String TENANTID_MDC_STRING = "TENANTID"; } diff --git a/municipal-services/noc-services/src/main/java/org/egov/noc/util/NotificationUtil.java b/municipal-services/noc-services/src/main/java/org/egov/noc/util/NotificationUtil.java index 7af1a99f490..9ac3e9bb09c 100755 --- a/municipal-services/noc-services/src/main/java/org/egov/noc/util/NotificationUtil.java +++ b/municipal-services/noc-services/src/main/java/org/egov/noc/util/NotificationUtil.java @@ -1,12 +1,10 @@ package org.egov.noc.util; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - +import com.jayway.jsonpath.JsonPath; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.noc.config.NOCConfiguration; import org.egov.noc.producer.Producer; import org.egov.noc.repository.ServiceRequestRepository; @@ -16,14 +14,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; -import static org.egov.noc.util.NOCConstants.ACTION_STATUS_CREATED; -import static org.egov.noc.util.NOCConstants.ACTION_STATUS_INITIATED; -import static org.egov.noc.util.NOCConstants.ACTION_STATUS_REJECTED; -import static org.egov.noc.util.NOCConstants.ACTION_STATUS_APPROVED; -import com.jayway.jsonpath.JsonPath; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; -import lombok.extern.slf4j.Slf4j; +import static org.egov.noc.util.NOCConstants.*; @Component @Slf4j @@ -38,6 +35,8 @@ public class NotificationUtil { @Autowired private ServiceRequestRepository serviceRequestRepository; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; /** @@ -46,12 +45,12 @@ public class NotificationUtil { * @param smsRequestList * The list of SMSRequest to be sent */ - public void sendSMS(List smsRequestList, boolean isSMSEnabled) { + public void sendSMS(String tenantId, List smsRequestList, boolean isSMSEnabled) { if (isSMSEnabled) { if (CollectionUtils.isEmpty(smsRequestList)) log.info("Messages from localization couldn't be fetched!"); for (SMSRequest smsRequest : smsRequestList) { - producer.push(config.getSmsNotifTopic(), smsRequest); + producer.push(tenantId, config.getSmsNotifTopic(), smsRequest); log.info("MobileNumber: " + smsRequest.getMobileNumber() + " Messages: " + smsRequest.getMessage()); } } @@ -62,7 +61,7 @@ public void sendSMS(List smsRequestList, boolean isSMSEnabled) { * * @param message * The message for the specific noc - * @param mobileNumberToOwnerName + * @param mobileNumberToOwner * Map of mobileNumber to OwnerName * @return List of SMSRequest */ @@ -83,7 +82,7 @@ public List createSMSRequest(String message, Map mob */ public StringBuilder getUri(String tenantId, RequestInfo requestInfo) { if (config.getIsLocalizationStateLevel()) - tenantId = tenantId.split("\\.")[0]; + tenantId = centralInstanceUtil.getStateLevelTenant(tenantId); String locale = "en_IN"; if (!StringUtils.isEmpty(requestInfo.getMsgId()) && requestInfo.getMsgId().split("|").length >= 2) locale = requestInfo.getMsgId().split("\\|")[1]; diff --git a/municipal-services/noc-services/src/main/resources/application.properties b/municipal-services/noc-services/src/main/resources/application.properties index aa30b0e3c67..20444ee07db 100755 --- a/municipal-services/noc-services/src/main/resources/application.properties +++ b/municipal-services/noc-services/src/main/resources/application.properties @@ -93,4 +93,4 @@ noc.offline.doc.required = false #fuzzy search egov.noc.fuzzysearch.isFuzzyEnabled=true -management.endpoints.web.base-path=/ \ No newline at end of file +management.endpoints.web.base-path=/ diff --git a/municipal-services/pgr-services/CHANGELOG.md b/municipal-services/pgr-services/CHANGELOG.md index 433a8adceda..9503e33787d 100644 --- a/municipal-services/pgr-services/CHANGELOG.md +++ b/municipal-services/pgr-services/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this module will be documented in this file. +## 1.1.8 - 2023-08-10 + +- Central Instance Library Integration +- ## 1.1.7 - 2023-02-01 - Transition from 1.1.7-beta version to 1.1.7 version diff --git a/municipal-services/pgr-services/pom.xml b/municipal-services/pgr-services/pom.xml index a9746f2fd2a..5f5e9c7e3e2 100644 --- a/municipal-services/pgr-services/pom.xml +++ b/municipal-services/pgr-services/pom.xml @@ -4,7 +4,7 @@ pgr-services jar pgr-services - 1.1.7 + 1.1.8 2.17.1 1.8 @@ -80,12 +80,16 @@ org.egov.services tracer - 2.0.0-SNAPSHOT + 2.1.0-SNAPSHOT org.egov.services services-common - 1.0.1-SNAPSHOT + 1.1.1-SNAPSHOT + + + org.flywaydb + flyway-core org.projectlombok @@ -112,14 +116,9 @@ org.egov mdms-client - 0.0.2-SNAPSHOT + 0.0.4-SNAPSHOT compile - - - org.flywaydb - flyway-core - com.itextpdf itext7-core @@ -128,6 +127,11 @@ + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + repo.egovernments.org eGov ERP Releases Repository diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/PGRApp.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/PGRApp.java index a2305a810b8..b5e44eca4e5 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/PGRApp.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/PGRApp.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.config.TracerConfiguration; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; @@ -15,7 +16,7 @@ @SpringBootApplication @ComponentScan(basePackages = { "org.egov.pgr", "org.egov.pgr.web.controllers" , "org.egov.pgr.config"}) -@Import({ TracerConfiguration.class }) +@Import({TracerConfiguration.class, MultiStateInstanceUtil.class}) public class PGRApp { @Value("${app.timezone}") diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/config/PGRConfiguration.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/config/PGRConfiguration.java index 220b44de1a2..b72afa5d3f2 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/config/PGRConfiguration.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/config/PGRConfiguration.java @@ -15,6 +15,7 @@ import javax.annotation.PostConstruct; import java.util.List; +import java.util.Map; import java.util.TimeZone; @Component @@ -120,10 +121,10 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM //MDMS - @Value("${egov.mdms.host}") + @Value("${mdms.v2.host}") private String mdmsHost; - @Value("${egov.mdms.search.endpoint}") + @Value("${mdms.v2.search.endpoint}") private String mdmsEndPoint; //HRMS @@ -167,8 +168,8 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM @Value("${egov.url.shortner.endpoint}") private String urlShortnerEndpoint; - @Value("${egov.ui.app.host}") - private String uiAppHost; + @Value("#{${egov.ui.app.host.map}}") + private Map uiAppHostMap; @Value("${egov.pgr.events.rate.link}") private String rateLink; @@ -200,20 +201,27 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM @Value("${persister.save.transition.wf.topic}") private String workflowSaveTopic; - @Value("${pgr.statelevel.tenantid}") - private String tenantId; - @Value("${persister.save.transition.wf.migration.topic}") private String batchWorkflowSaveTopic; @Value("${pgr.business.level.sla}") private Long businessLevelSla; + @Value("${egov.dynamicdata.period}") private String numberOfDays; - + @Value("${egov.complaints.category}") private String complaintTypes; + // central-instance configs + + @Value("${state.level.tenantid.length}") + private Integer stateLevelTenantIdLength; + + @Value("${is.environment.central.instance}") + private Boolean isEnvironmentCentralInstance; + + } diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/consumer/MigrationConsumer.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/consumer/MigrationConsumer.java index 1e12fb16aa2..9e8e1750212 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/consumer/MigrationConsumer.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/consumer/MigrationConsumer.java @@ -3,8 +3,11 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.egov.pgr.service.MigrationService; +import org.egov.pgr.util.PGRConstants; import org.egov.pgr.web.models.pgrV1.ServiceResponse; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; import org.springframework.messaging.handler.annotation.Header; @@ -12,6 +15,10 @@ import java.util.HashMap; +@ConditionalOnProperty( + value="migration.enabled", + havingValue = "true", + matchIfMissing = false) @Slf4j @Component public class MigrationConsumer { @@ -30,6 +37,10 @@ public void listen(final HashMap record, @Header(KafkaHeaders.RE try { log.info("Received migration request " + record); ServiceResponse serviceResponse = mapper.convertValue(record,ServiceResponse.class); + + // Adding in MDC so that tracer can add it in header + MDC.put(PGRConstants.TENANTID_MDC_STRING, serviceResponse.getServices().get(0).getTenantId()); + migrationService.migrate(serviceResponse); } catch (Exception e){ diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/consumer/NotificationConsumer.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/consumer/NotificationConsumer.java index 7a9f55d303a..143916876ff 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/consumer/NotificationConsumer.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/consumer/NotificationConsumer.java @@ -4,18 +4,22 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.egov.pgr.service.NotificationService; +import org.egov.pgr.util.PGRConstants; import org.egov.pgr.web.models.ServiceRequest; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; import org.springframework.messaging.handler.annotation.Header; +import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; import java.util.HashMap; import static org.apache.kafka.common.requests.FetchMetadata.log; +import static org.egov.pgr.util.PGRConstants.TENANTID_MDC_STRING; -@Service +@Component @Slf4j public class NotificationConsumer { @Autowired @@ -26,17 +30,22 @@ public class NotificationConsumer { /** - * Consumes the water connection record and send notification + * Consumes record and send notification * * @param record * @param topic */ - @KafkaListener(topics = { "${pgr.kafka.create.topic}" ,"${pgr.kafka.update.topic}"}) + @KafkaListener(topicPattern = "${pgr.kafka.notification.topic.pattern}") public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try { ServiceRequest request = mapper.convertValue(record, ServiceRequest.class); + String tenantId = request.getService().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(PGRConstants.TENANTID_MDC_STRING, tenantId); + notificationService.process(request, topic); } catch (Exception ex) { StringBuilder builder = new StringBuilder("Error while listening to value: ").append(record) diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/producer/Producer.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/producer/Producer.java index a10e762a7a0..15337fb999c 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/producer/Producer.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/producer/Producer.java @@ -1,6 +1,8 @@ package org.egov.pgr.producer; import lombok.extern.slf4j.Slf4j; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.pgr.config.PGRConfiguration; import org.egov.tracer.kafka.CustomKafkaTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; @@ -13,7 +15,13 @@ public class Producer { @Autowired private CustomKafkaTemplate kafkaTemplate; - public void push(String topic, Object value) { - kafkaTemplate.send(topic, value); + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + public void push(String tenantId, String topic, Object value) { + + String updatedTopic = centralInstanceUtil.getStateSpecificTopicName(tenantId, topic); + log.info("The Kafka topic for the tenantId : " + tenantId + " is : " + updatedTopic); + kafkaTemplate.send(updatedTopic, value); } } diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/repository/PGRRepository.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/repository/PGRRepository.java index 77b9acbf744..aa140a48ab0 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/repository/PGRRepository.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/repository/PGRRepository.java @@ -3,11 +3,14 @@ import lombok.extern.slf4j.Slf4j; import org.egov.pgr.repository.rowmapper.PGRQueryBuilder; import org.egov.pgr.repository.rowmapper.PGRRowMapper; +import org.egov.pgr.util.PGRUtils; import org.egov.pgr.util.PGRConstants; import org.egov.pgr.web.models.ServiceWrapper; import org.egov.pgr.web.models.RequestSearchCriteria; import org.egov.pgr.web.models.Service; import org.egov.pgr.web.models.Workflow; +import org.egov.tracer.model.CustomException; +import org.egov.common.exception.InvalidTenantIdException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; @@ -29,14 +32,20 @@ public class PGRRepository { private JdbcTemplate jdbcTemplate; + private PGRUtils utils; + + @Autowired - public PGRRepository(PGRQueryBuilder queryBuilder, PGRRowMapper rowMapper, JdbcTemplate jdbcTemplate) { + public PGRRepository(PGRQueryBuilder queryBuilder, PGRRowMapper rowMapper, JdbcTemplate jdbcTemplate, PGRUtils utils) { this.queryBuilder = queryBuilder; this.rowMapper = rowMapper; this.jdbcTemplate = jdbcTemplate; + this.utils = utils; } + + /** * searches services based on search criteria and then wraps it into serviceWrappers * @param criteria @@ -61,8 +70,16 @@ public List getServiceWrappers(RequestSearchCriteria criteria){ * @return */ public List getServices(RequestSearchCriteria criteria) { + + String tenantId = criteria.getTenantId(); List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getPGRSearchQuery(criteria, preparedStmtList); + try { + query = utils.replaceSchemaPlaceholder(query, tenantId); + } catch (Exception e) { + throw new CustomException("PGR_UPDATE_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } List services = jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); return services; } @@ -73,8 +90,16 @@ public List getServices(RequestSearchCriteria criteria) { * @return */ public Integer getCount(RequestSearchCriteria criteria) { + + String tenantId = criteria.getTenantId(); List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getCountQuery(criteria, preparedStmtList); + try { + query = utils.replaceSchemaPlaceholder(query, tenantId); + } catch (Exception e) { + throw new CustomException("PGR_REQUEST_COUNT_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } Integer count = jdbcTemplate.queryForObject(query, preparedStmtList.toArray(), Integer.class); return count; } @@ -83,12 +108,22 @@ public Integer getCount(RequestSearchCriteria criteria) { public Map fetchDynamicData(String tenantId) { List preparedStmtListCompalintsResolved = new ArrayList<>(); String query = queryBuilder.getResolvedComplaints(tenantId,preparedStmtListCompalintsResolved ); - + try { + query = utils.replaceSchemaPlaceholder(query, tenantId); + } catch (Exception e) { + throw new CustomException("PGR_SEARCH_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } int complaintsResolved = jdbcTemplate.queryForObject(query,preparedStmtListCompalintsResolved.toArray(),Integer.class); List preparedStmtListAverageResolutionTime = new ArrayList<>(); query = queryBuilder.getAverageResolutionTime(tenantId, preparedStmtListAverageResolutionTime); - + try { + query = utils.replaceSchemaPlaceholder(query, tenantId); + } catch (Exception e) { + throw new CustomException("PGR_SEARCH_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } int averageResolutionTime = jdbcTemplate.queryForObject(query, preparedStmtListAverageResolutionTime.toArray(),Integer.class); Map dynamicData = new HashMap(); diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/repository/rowmapper/PGRQueryBuilder.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/repository/rowmapper/PGRQueryBuilder.java index b3855d4e3f8..00211666b59 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/repository/rowmapper/PGRQueryBuilder.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/repository/rowmapper/PGRQueryBuilder.java @@ -16,7 +16,7 @@ @Repository public class PGRQueryBuilder { - + private PGRConfiguration config; @Autowired @@ -34,15 +34,15 @@ public PGRQueryBuilder(PGRConfiguration config) { private static final String QUERY = "select ser.*,ads.*," + QUERY_ALIAS+ - " from eg_pgr_service_v2 ser INNER JOIN eg_pgr_address_v2 ads" + + " from {schema}.eg_pgr_service_v2 ser INNER JOIN {schema}.eg_pgr_address_v2 ads" + " ON ads.parentId = ser.id "; - private static final String COUNT_WRAPPER = "select count(*) from ({INTERNAL_QUERY}) as count"; - - private static final String RESOLVED_COMPLAINTS_QUERY = "select count(*) from eg_pgr_service_v2 where applicationstatus='CLOSEDAFTERRESOLUTION' and tenantid=? and lastmodifiedtime>? "; - - private static final String AVERAGE_RESOLUTION_TIME_QUERY = "select round(avg(lastmodifiedtime-createdtime)/86400000) from eg_pgr_service_v2 where applicationstatus='CLOSEDAFTERRESOLUTION' and tenantid=? "; - + private static final String COUNT_WRAPPER = "select count(*) from ({INTERNAL_QUERY}) as count"; + + private static final String RESOLVED_COMPLAINTS_QUERY = "select count(*) from {schema}.eg_pgr_service_v2 where applicationstatus='CLOSEDAFTERRESOLUTION' and tenantid=? and lastmodifiedtime>? "; + + private static final String AVERAGE_RESOLUTION_TIME_QUERY = "select round(avg(lastmodifiedtime-createdtime)/86400000) from {schema}.eg_pgr_service_v2 where applicationstatus='CLOSEDAFTERRESOLUTION' and tenantid=? "; + public String getPGRSearchQuery(RequestSearchCriteria criteria, List preparedStmtList) { @@ -63,7 +63,7 @@ public String getPGRSearchQuery(RequestSearchCriteria criteria, List pre String[] tenantIdChunks = tenantId.split("\\."); - if (tenantIdChunks.length == 1) { + if (tenantIdChunks.length == config.getStateLevelTenantIdLength()) { addClauseIfRequired(preparedStmtList, builder); builder.append(" ser.tenantid LIKE ? "); preparedStmtList.add(criteria.getTenantId() + '%'); @@ -221,7 +221,6 @@ private void addToPreparedStatement(List preparedStmtList, Collection preparedStmtListComplaintsResolved) { - StringBuilder query = new StringBuilder(""); query.append(RESOLVED_COMPLAINTS_QUERY); diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/service/MigrationService.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/service/MigrationService.java index 9aa4b353ae1..eac90a08f78 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/service/MigrationService.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/service/MigrationService.java @@ -15,6 +15,8 @@ import org.egov.pgr.web.models.workflow.*; import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; @@ -26,11 +28,18 @@ import static org.egov.pgr.util.PGRConstants.PGR_BUSINESSSERVICE; import static org.egov.pgr.util.PGRConstants.PGR_MODULENAME; +@ConditionalOnProperty( + value="migration.enabled", + havingValue = "true", + matchIfMissing = false) @Component @Slf4j public class MigrationService { + @Value("${pgr.statelevel.tenantid}") + private String statelevelTenantIdForMigration; + @Autowired private MigrationUtils migrationUtils; @@ -74,8 +83,8 @@ public class MigrationService { @PostConstruct private void setStatusToUUIDMap(){ - this.statusToUUIDMap = migrationUtils.getStatusToUUIDMap(config.getTenantId()); - this.serviceCodeToSLA = migrationUtils.getServiceCodeToSLAMap(config.getTenantId()); + this.statusToUUIDMap = migrationUtils.getStatusToUUIDMap(statelevelTenantIdForMigration); + this.serviceCodeToSLA = migrationUtils.getServiceCodeToSLAMap(statelevelTenantIdForMigration); } @@ -183,6 +192,8 @@ private Map transform(List servicesV1, List actionInfos = idToActionMap.get(serviceV1.getServiceRequestId()); Map actionUuidToSlaMap = getActionUUidToSLAMap(actionInfos, serviceV1.getServiceCode()); @@ -202,8 +213,8 @@ private Map transform(List servicesV1, List> finalMessage = getFinalMessage(request, topic, applicationStatus); - log.info("final Message is -========" + finalMessage); String citizenMobileNumber = request.getService().getCitizen().getMobileNumber(); String employeeMobileNumber = null; @@ -104,47 +110,45 @@ else if(applicationStatus.equalsIgnoreCase(PENDINGATLME) && action.equalsIgnoreC employeeMobileNumber = fetchUserByUUID(request.getService().getAuditDetails().getCreatedBy(), request.getRequestInfo(), request.getService().getTenantId()).getMobileNumber(); } - if(!StringUtils.isEmpty(finalMessage)){ + if(!StringUtils.isEmpty(finalMessage)) { if (config.getIsUserEventsNotificationEnabled() != null && config.getIsUserEventsNotificationEnabled()) { - log.info("in Event Generation code!!!"); - for (Map.Entry> entry : finalMessage.entrySet()) { - for(String msg : entry.getValue()) { + for (Map.Entry> entry : finalMessage.entrySet()) { + for (String msg : entry.getValue()) { EventRequest eventRequest = enrichEventRequest(request, msg); if (eventRequest != null) { - notificationUtil.sendEventNotification(eventRequest); + notificationUtil.sendEventNotification(tenantId, eventRequest); } } } } if (config.getIsSMSEnabled() != null && config.getIsSMSEnabled()) { - for (Map.Entry> entry : finalMessage.entrySet()) { - if(entry.getKey().equalsIgnoreCase(CITIZEN)) { - for(String msg : entry.getValue()) { + for (Map.Entry> entry : finalMessage.entrySet()) { + + if (entry.getKey().equalsIgnoreCase(CITIZEN)) { + for (String msg : entry.getValue()) { List smsRequests = new ArrayList<>(); smsRequests = enrichSmsRequest(citizenMobileNumber, msg); if (!CollectionUtils.isEmpty(smsRequests)) { - notificationUtil.sendSMS(smsRequests); + notificationUtil.sendSMS(tenantId, smsRequests); } } - } - else { - for(String msg : entry.getValue()) { + } else { + for (String msg : entry.getValue()) { List smsRequests = new ArrayList<>(); smsRequests = enrichSmsRequest(employeeMobileNumber, msg); if (!CollectionUtils.isEmpty(smsRequests)) { - notificationUtil.sendSMS(smsRequests); + notificationUtil.sendSMS(tenantId, smsRequests); } } } } - } - - } + } + } } catch (Exception ex) { log.error("Error occured while processing the record from topic : " + topic, ex); @@ -731,8 +735,8 @@ private EventRequest enrichEventRequest(ServiceRequest request, String finalMess String reopenUrl = config.getReopenLink(); rateLink = rateUrl.replace("{application-id}", request.getService().getServiceRequestId()); reopenLink = reopenUrl.replace("{application-id}", request.getService().getServiceRequestId()); - rateLink = config.getUiAppHost() + rateLink; - reopenLink = config.getUiAppHost() + reopenLink; + rateLink = getUiAppHost(tenantId) + rateLink; + reopenLink = getUiAppHost(tenantId) + reopenLink; ActionItem rateItem = ActionItem.builder().actionUrl(rateLink).code(config.getRateCode()).build(); ActionItem reopenItem = ActionItem.builder().actionUrl(reopenLink).code(config.getReopenCode()).build(); items.add(rateItem); @@ -801,4 +805,10 @@ private User getInternalMicroserviceUser(String tenantId) return userInfo; } + public String getUiAppHost(String tenantId) + { + String stateLevelTenantId = centralInstanceUtil.getStateLevelTenant(tenantId); + return config.getUiAppHostMap().get(stateLevelTenantId); + } + } \ No newline at end of file diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/service/PGRService.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/service/PGRService.java index ca33b881e23..f67d65336c7 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/service/PGRService.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/service/PGRService.java @@ -66,11 +66,12 @@ public PGRService(EnrichmentService enrichmentService, UserService userService, * @return */ public ServiceRequest create(ServiceRequest request){ + String tenantId = request.getService().getTenantId(); Object mdmsData = mdmsUtils.mDMSCall(request); validator.validateCreate(request, mdmsData); enrichmentService.enrichCreateRequest(request); workflowService.updateWorkflowStatus(request); - producer.push(config.getCreateTopic(),request); + producer.push(tenantId,config.getCreateTopic(),request); return request; } @@ -125,11 +126,12 @@ public List search(RequestInfo requestInfo, RequestSearchCriteri * @return */ public ServiceRequest update(ServiceRequest request){ + String tenantId = request.getService().getTenantId(); Object mdmsData = mdmsUtils.mDMSCall(request); validator.validateUpdate(request, mdmsData); enrichmentService.enrichUpdateRequest(request); workflowService.updateWorkflowStatus(request); - producer.push(config.getUpdateTopic(),request); + producer.push(tenantId,config.getUpdateTopic(),request); return request; } diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/NotificationUtil.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/NotificationUtil.java index 3fc68a98a0c..f6ef0ea5ca8 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/NotificationUtil.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/NotificationUtil.java @@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.pgr.config.PGRConfiguration; import org.egov.pgr.producer.Producer; import org.egov.pgr.repository.ServiceRequestRepository; @@ -35,6 +36,10 @@ public class NotificationUtil { @Autowired private RestTemplate restTemplate; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + /** * * @param tenantId Tenant ID @@ -58,9 +63,10 @@ public String getLocalizationMessages(String tenantId, RequestInfo requestInfo,S */ public StringBuilder getUri(String tenantId, RequestInfo requestInfo, String module) { - if (config.getIsLocalizationStateLevel()) - tenantId = tenantId.split("\\.")[0]; - + /*if (config.getIsLocalizationStateLevel()) + tenantId= centralInstanceUtil.getStateLevelTenant(tenantId);*/ + tenantId= centralInstanceUtil.getStateLevelTenant(tenantId); + log.info("tenantId after calling central instance method :"+ tenantId); String locale = NOTIFICATION_LOCALE; if (!StringUtils.isEmpty(requestInfo.getMsgId()) && requestInfo.getMsgId().split("|").length >= 2) locale = requestInfo.getMsgId().split("\\|")[1]; @@ -130,14 +136,14 @@ public String getDefaultMsg(String roles, String localizationMessage) { * Send the SMSRequest on the SMSNotification kafka topic * @param smsRequestList The list of SMSRequest to be sent */ - public void sendSMS(List smsRequestList) { + public void sendSMS(String tenantId, List smsRequestList) { if (config.getIsSMSEnabled()) { if (CollectionUtils.isEmpty(smsRequestList)) { log.info("Messages from localization couldn't be fetched!"); return; } for (SMSRequest smsRequest : smsRequestList) { - producer.push(config.getSmsNotifTopic(), smsRequest); + producer.push(tenantId,config.getSmsNotifTopic(), smsRequest); log.info("Messages: " + smsRequest.getMessage()); } } @@ -148,8 +154,8 @@ public void sendSMS(List smsRequestList) { * * @param request EventRequest Object */ - public void sendEventNotification(EventRequest request) { - producer.push(config.getSaveUserEventsTopic(), request); + public void sendEventNotification(String tenantId, EventRequest request) { + producer.push(tenantId,config.getSaveUserEventsTopic(), request); log.info("Events added to send:: " + request.getEvents()); } diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/PGRConstants.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/PGRConstants.java index 7fca7ceb972..9100511f4b6 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/PGRConstants.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/PGRConstants.java @@ -140,12 +140,17 @@ public class PGRConstants { public static final String MDMS_DATA_SLA_KEYWORD = "slaHours"; public static final String COMPLAINTS_RESOLVED = "complaintsResolved"; - + public static final String AVERAGE_RESOLUTION_TIME = "averageResolutionTime"; + public static final String TENANTID_MDC_STRING = "TENANTID"; + + public static String SCHEMA_REPLACE_STRING = "{schema}"; + public static final String DESIGNATION = "designation"; public static final String DEPARTMENT = "department"; + } diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/PGRUtils.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/PGRUtils.java index 431dad257ca..c368bc39f9e 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/PGRUtils.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/PGRUtils.java @@ -1,13 +1,24 @@ package org.egov.pgr.util; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.pgr.web.models.AuditDetails; import org.egov.pgr.web.models.Service; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import static org.egov.pgr.util.PGRConstants.SCHEMA_REPLACE_STRING; + @Component public class PGRUtils { + private MultiStateInstanceUtil multiStateInstanceUtil; + + @Autowired + public PGRUtils(MultiStateInstanceUtil multiStateInstanceUtil) { + this.multiStateInstanceUtil = multiStateInstanceUtil; + } /** * Method to return auditDetails for create/update flows @@ -25,4 +36,24 @@ public AuditDetails getAuditDetails(String by, Service service, Boolean isCreate .createdTime(service.getAuditDetails().getCreatedTime()).lastModifiedTime(time).build(); } + /** + * Method to fetch the state name from the tenantId + * + * @param query + * @param tenantId + * @return + */ + public String replaceSchemaPlaceholder(String query, String tenantId) { + + String finalQuery = null; + + try { + finalQuery = multiStateInstanceUtil.replaceSchemaPlaceholder(query, tenantId); + } + catch (Exception e){ + throw new CustomException("INVALID_TENANTID","Invalid tenantId: "+tenantId); + } + return finalQuery; + } + } diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/UserUtils.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/UserUtils.java index a103ae080ea..ad1b0b3f82f 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/UserUtils.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/util/UserUtils.java @@ -1,7 +1,9 @@ package org.egov.pgr.util; import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; import org.egov.common.contract.request.Role; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.pgr.config.PGRConfiguration; import org.egov.pgr.repository.ServiceRequestRepository; import org.egov.pgr.web.models.User; @@ -18,6 +20,7 @@ import java.util.List; @Component +@Slf4j public class UserUtils { @@ -27,6 +30,9 @@ public class UserUtils { private PGRConfiguration config; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + @Autowired public UserUtils(ObjectMapper mapper, ServiceRequestRepository serviceRequestRepository, PGRConfiguration config) { this.mapper = mapper; @@ -128,7 +134,9 @@ private Role getCitizenRole(String tenantId){ } public String getStateLevelTenant(String tenantId){ - return tenantId.split("\\.")[0]; + /* return tenantId.split("\\.")[0];*/ + log.info("tenantId"+ tenantId); + return centralInstanceUtil.getStateLevelTenant(tenantId); } diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/validator/ServiceRequestValidator.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/validator/ServiceRequestValidator.java index 0505d9423d2..43ff0df3f68 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/validator/ServiceRequestValidator.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/validator/ServiceRequestValidator.java @@ -58,11 +58,12 @@ public void validateCreate(ServiceRequest request, Object mdmsData){ public void validateUpdate(ServiceRequest request, Object mdmsData){ String id = request.getService().getId(); + String tenantId = request.getService().getTenantId(); validateSource(request.getService().getSource()); validateMDMS(request, mdmsData); validateDepartment(request, mdmsData); validateReOpen(request); - RequestSearchCriteria criteria = RequestSearchCriteria.builder().ids(Collections.singleton(id)).build(); + RequestSearchCriteria criteria = RequestSearchCriteria.builder().ids(Collections.singleton(id)).tenantId(tenantId).build(); criteria.setIsPlainSearch(false); List serviceWrappers = repository.getServiceWrappers(criteria); @@ -228,7 +229,7 @@ private void validateSearchParam(RequestInfo requestInfo, RequestSearchCriteria if(requestInfo.getUserInfo().getType().equalsIgnoreCase("EMPLOYEE" ) && criteria.isEmpty()) throw new CustomException("INVALID_SEARCH","Search without params is not allowed"); - if(requestInfo.getUserInfo().getType().equalsIgnoreCase("EMPLOYEE") && criteria.getTenantId().split("\\.").length == 1){ + if(requestInfo.getUserInfo().getType().equalsIgnoreCase("EMPLOYEE") && criteria.getTenantId().split("\\.").length == config.getStateLevelTenantIdLength()){ throw new CustomException("INVALID_SEARCH", "Employees cannot perform state level searches."); } diff --git a/municipal-services/pgr-services/src/main/java/org/egov/pgr/web/controllers/MigrationController.java b/municipal-services/pgr-services/src/main/java/org/egov/pgr/web/controllers/MigrationController.java index 17906846825..0e75484977f 100644 --- a/municipal-services/pgr-services/src/main/java/org/egov/pgr/web/controllers/MigrationController.java +++ b/municipal-services/pgr-services/src/main/java/org/egov/pgr/web/controllers/MigrationController.java @@ -4,6 +4,7 @@ import org.egov.pgr.service.MigrationService; import org.egov.pgr.web.models.pgrV1.ServiceResponse; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestBody; @@ -15,6 +16,10 @@ import java.io.IOException; import java.util.Map; +@ConditionalOnProperty( + value="migration.enabled", + havingValue = "true", + matchIfMissing = false) @RestController @RequestMapping("/migration") @Slf4j diff --git a/municipal-services/pgr-services/src/main/resources/application.properties b/municipal-services/pgr-services/src/main/resources/application.properties index a73071ee46d..cc1c318aef4 100644 --- a/municipal-services/pgr-services/src/main/resources/application.properties +++ b/municipal-services/pgr-services/src/main/resources/application.properties @@ -50,8 +50,8 @@ egov.localization.search.endpoint=/_search egov.localization.statelevel=true #mdms urls -egov.mdms.host=https://dev.digit.org -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search #hrms urls egov.hrms.host=https://dev.digit.org @@ -97,9 +97,10 @@ kafka.topics.notification.sms=egov.core.notification.sms mseva.mobile.app.download.link=https://play.google.com/store/apps/details?id=org.egovernment.mseva.citizen egov.pgr.events.rate.link=digit-ui/citizen/pgr/rate/{application-id} egov.pgr.events.reopen.link=digit-ui/citizen/pgr/reopen/{application-id} + egov.usr.events.rate.code=RATE egov.usr.events.reopen.code=REOPEN -egov.ui.app.host=https://dev.digit.org +egov.ui.app.host.map={"in":"https://central-instance.digit.org","in.statea":"https://statea.digit.org"} #url shortner egov.url.shortner.host=https://dev.digit.org @@ -115,13 +116,21 @@ allowed.source=whatsapp,web,mobile,RB Bot #Migration persister.save.transition.wf.topic=save-wf-transitions pgr.kafka.migration.topic=pgr-migration -pgr.statelevel.tenantid=pb +#pgr.statelevel.tenantid=pb pgr.business.level.sla=432000000 +migration.enabled = false #Persist batches of records in migration pgr.kafka.migration.persister.topic = save-pgr-request-batch persister.save.transition.wf.migration.topic=save-wf-transitions-batch + +# central-instance configs +state.level.tenantid.length=1 +is.environment.central.instance=false + +pgr.kafka.notification.topic.pattern=((^[a-zA-Z]+-)?save-pgr-request|(^[a-zA-Z]+-)?update-pgr-request) + management.endpoints.web.base-path=/ egov.dynamicdata.period=30 -egov.complaints.category=13 \ No newline at end of file +egov.complaints.category=13 diff --git a/municipal-services/pgr-services/src/main/resources/db/migrate.sh b/municipal-services/pgr-services/src/main/resources/db/migrate.sh index 43960b25cdb..6b845ac81bb 100644 --- a/municipal-services/pgr-services/src/main/resources/db/migrate.sh +++ b/municipal-services/pgr-services/src/main/resources/db/migrate.sh @@ -1,3 +1,11 @@ #!/bin/sh - -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file +baseurl=$DB_URL +echo "the baseurl : $DB_URL" +schemasetter="?currentSchema=" +schemas=$SCHEMA_NAME +echo "the schemas : $schemas" +for schemaname in ${schemas//,/ } +do + echo "the schema name : ${baseurl}${schemasetter}${schemaname}" + flyway -url=${baseurl}${schemasetter}${schemaname} -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate +done diff --git a/municipal-services/property-services/CHANGELOG.md b/municipal-services/property-services/CHANGELOG.md index 0f801304038..2baa73a9cbc 100644 --- a/municipal-services/property-services/CHANGELOG.md +++ b/municipal-services/property-services/CHANGELOG.md @@ -1,6 +1,10 @@ All notable changes to this module will be documented in this file. +## 1.2.2 - 2023-08-10 + +- Central Instance Library Integration + ## 1.2.1-beta - 2023-04-11 - Added citizen feedback notifications for create, update and mutate flows diff --git a/municipal-services/property-services/pom.xml b/municipal-services/property-services/pom.xml index c72cf3eb8a4..de54daace4e 100644 --- a/municipal-services/property-services/pom.xml +++ b/municipal-services/property-services/pom.xml @@ -11,7 +11,7 @@ org.egov property-services - 1.2.1-beta-SNAPSHOT + 1.2.2-SNAPSHOT egov-pt-registry 2.17.1 @@ -90,7 +90,7 @@ org.egov mdms-client - 0.0.2-SNAPSHOT + 0.0.4-SNAPSHOT org.jsoup @@ -115,19 +115,9 @@ - repo.egovernments.org - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ - - - repo.egovernments.org.snapshots - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ - - - repo.egovernments.org.public - eGov Public Repository Group - https://nexus-repo.egovernments.org/nexus/content/groups/public/ + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/PropertyApplication.java b/municipal-services/property-services/src/main/java/org/egov/pt/PropertyApplication.java index 583877d7403..b2d501d52a4 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/PropertyApplication.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/PropertyApplication.java @@ -3,6 +3,7 @@ import java.util.TimeZone; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.encryption.config.EncryptionConfiguration; import org.egov.tracer.config.TracerConfiguration; import org.springframework.beans.factory.annotation.Value; @@ -18,7 +19,9 @@ @SpringBootApplication @ComponentScan(basePackages = { "org.egov.pt", "org.egov.pt.web.controllers" , "org.egov.pt.config","org.egov.pt.repository"}) -@Import({ TracerConfiguration.class, EncryptionConfiguration.class }) + + +@Import({ TracerConfiguration.class, MultiStateInstanceUtil.class, EncryptionConfiguration.class }) public class PropertyApplication { @Value("${app.timezone}") diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/config/PropertyConfiguration.java b/municipal-services/property-services/src/main/java/org/egov/pt/config/PropertyConfiguration.java index b27b47d7342..6639d1e2a63 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/config/PropertyConfiguration.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/config/PropertyConfiguration.java @@ -1,7 +1,12 @@ package org.egov.pt.config; -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.*; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; + +import javax.annotation.PostConstruct; + import org.egov.tracer.config.TracerConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -10,11 +15,12 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; +import com.fasterxml.jackson.databind.ObjectMapper; -import java.math.BigDecimal; -import java.util.List; -import java.util.TimeZone; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; @Import({TracerConfiguration.class}) @@ -118,6 +124,9 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM @Value("${kafka.topics.receipt.create}") private String receiptTopic; + @Value("${kafka.topics.receipt.create.pattern}") + private String receiptTopicPattern; + @Value("${kafka.topics.notification.pg.save.txns}") private String pgTopic; @@ -185,8 +194,8 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM @Value("${egov.localization.fallback.locale}") private String fallBackLocale; //USER EVENTS - @Value("${egov.ui.app.host}") - private String uiAppHost; + @Value("#{${egov.ui.app.host.map}}") + private Map uiAppHostMap; @Value("${egov.usr.events.create.topic}") private String saveUserEventsTopic; @@ -257,11 +266,11 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM // ##### mdms - @Value("${egov.mdms.host}") + @Value("${mdms.v2.host}") private String mdmsHost; - @Value("${egov.mdms.search.endpoint}") - private String mdmsEndpoint; + @Value("${mdms.v2.search.endpoint}") + private String mdmsEndPoint; // Billing-Service diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/consumer/FileStoreConsumer.java b/municipal-services/property-services/src/main/java/org/egov/pt/consumer/FileStoreConsumer.java index 01b48b364e7..fcabc85e5b3 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/consumer/FileStoreConsumer.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/consumer/FileStoreConsumer.java @@ -25,8 +25,10 @@ import org.egov.pt.models.enums.Status; import org.egov.pt.producer.PropertyProducer; import org.egov.pt.repository.PropertyRepository; +import org.egov.pt.util.PTConstants; import org.egov.pt.web.contracts.PropertyRequest; import org.egov.tracer.model.CustomException; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; @@ -66,6 +68,9 @@ public void listen(final HashMap record, @Header(KafkaHeaders.RE String tenantId = (String) job.get(KEY_PDF_TENANT_ID); String documentType = (String) job.get(KEY_PDF_DOCUMENTTYPE); + // Adding in MDC so that tracer can add it in header + MDC.put(PTConstants.TENANTID_MDC_STRING, tenantId); + if(StringUtils.isEmpty(documentType)) throw new CustomException("INVALID_DOCUMENTTYPE","Document Type cannot be null or empty string"); @@ -85,7 +90,7 @@ public void listen(final HashMap record, @Header(KafkaHeaders.RE RequestInfo requestInfo = new RequestInfo(); PropertyRequest propertyRequest = PropertyRequest.builder().requestInfo(requestInfo).property(property).build(); - producer.push(config.getUpdateDocumentTopic(),propertyRequest); + producer.push(tenantId, config.getUpdateDocumentTopic(),propertyRequest); log.info("Updating document for: "+id); } diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/consumer/NotificationConsumer.java b/municipal-services/property-services/src/main/java/org/egov/pt/consumer/NotificationConsumer.java index 9398a3698ae..bcd5e6dc415 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/consumer/NotificationConsumer.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/consumer/NotificationConsumer.java @@ -10,6 +10,7 @@ import org.egov.pt.util.PTConstants; import org.egov.pt.web.contracts.AssessmentRequest; import org.egov.pt.web.contracts.PropertyRequest; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; @@ -20,6 +21,8 @@ import lombok.extern.slf4j.Slf4j; +import static org.egov.pt.util.PTConstants.TENANTID_MDC_STRING; + @Component @Slf4j public class NotificationConsumer { @@ -36,24 +39,31 @@ public class NotificationConsumer { @Autowired private NotificationService notifService; - @KafkaListener(topics = {"${egov.pt.assessment.create.topic}", - "${egov.pt.assessment.update.topic}", - "${persister.update.property.topic}", - "${persister.save.property.topic}"}) + @KafkaListener(topicPattern = "${pt.kafka.notification.topic.pattern}") public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try { - if (topic.equalsIgnoreCase(configs.getCreateAssessmentTopic()) || topic.equalsIgnoreCase(configs.getUpdateAssessmentTopic())) { + if (topic.contains(configs.getCreateAssessmentTopic()) || topic.contains(configs.getUpdateAssessmentTopic())) { AssessmentRequest request = mapper.convertValue(record, AssessmentRequest.class); + + String tenantId = request.getAssessment().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(PTConstants.TENANTID_MDC_STRING, tenantId); + assessmentNotificationService.process(topic, request); - } else if (topic.equalsIgnoreCase(configs.getSavePropertyTopic()) || topic.equalsIgnoreCase(configs.getUpdatePropertyTopic())) { + + } else if (topic.contains(configs.getSavePropertyTopic()) || topic.contains(configs.getUpdatePropertyTopic())) { PropertyRequest request = mapper.convertValue(record, PropertyRequest.class); + String tenantId = request.getProperty().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); - if (!request.getProperty().isOldDataEncryptionRequest()) { - if (PTConstants.MUTATION_PROCESS_CONSTANT.equalsIgnoreCase(request.getProperty().getCreationReason().toString())) { + if (PTConstants.MUTATION_PROCESS_CONSTANT.contains(request.getProperty().getCreationReason().toString())) { notifService.sendNotificationForMutation(request); } else { @@ -61,7 +71,7 @@ public void listen(final HashMap record, @Header(KafkaHeaders.RE notifService.sendNotificationForUpdate(request); } } - } + } catch (final Exception e) { diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/consumer/PropertyNotificationConsumer.java b/municipal-services/property-services/src/main/java/org/egov/pt/consumer/PropertyNotificationConsumer.java deleted file mode 100644 index 48e3f2e694b..00000000000 --- a/municipal-services/property-services/src/main/java/org/egov/pt/consumer/PropertyNotificationConsumer.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.egov.pt.consumer; - -import org.egov.pt.service.NotificationService; -import org.egov.pt.service.PaymentNotificationService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class PropertyNotificationConsumer { - - @Autowired - private NotificationService notificationService; - - - @Autowired - private PaymentNotificationService paymentNotificationService; - - @Autowired - private ObjectMapper mapper; - - -// @KafkaListener(topics = {"${persister.save.property.topic}","${persister.update.property.topic}"}) -// public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { -// -// PropertyRequest propertyRequest = new PropertyRequest(); -// try { -// -// log.debug("Consuming record: " + record); -// propertyRequest = mapper.convertValue(record, PropertyRequest.class); -// } catch (final Exception e) { -// -// log.error("Error while listening to value: " + record + " on topic: " + topic + ": " + e); -// } -// -// log.info("property Received: "+propertyRequest.getProperty().getPropertyId()); -// -// Source source = propertyRequest.getProperty().getSource(); -// -// if (source == null || !source.equals(Source.DATA_MIGRATION)) -// notificationService.process(propertyRequest,topic); -// } -// -// -// @KafkaListener(topics = {"${kafka.topics.notification.fullpayment}","${kafka.topics.notification.pg.save.txns}"}) -// public void listenPayments(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { -// -// paymentNotificationService.process(record,topic); -// } -// - - - - -} diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/consumer/ReceiptConsumer.java b/municipal-services/property-services/src/main/java/org/egov/pt/consumer/ReceiptConsumer.java index 4063d204882..bbd2ff7502b 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/consumer/ReceiptConsumer.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/consumer/ReceiptConsumer.java @@ -5,7 +5,10 @@ import org.egov.pt.config.PropertyConfiguration; import org.egov.pt.service.PaymentNotificationService; import org.egov.pt.service.PaymentUpdateService; +import org.egov.pt.util.PTConstants; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; import org.springframework.messaging.handler.annotation.Header; @@ -22,15 +25,23 @@ public class ReceiptConsumer { @Autowired private PropertyConfiguration config; + + @Value("${state.level.tenant.id}") + private String stateLevelTenantID; - @KafkaListener(topics = {"${kafka.topics.receipt.create}","${kafka.topics.notification.pg.save.txns}"}) - public void listenPayments(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { + @KafkaListener(topicPattern = "${kafka.topics.receipt.create.pattern}") + public void listenPayments(final HashMap record, + @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { - if(topic.equalsIgnoreCase(config.getReceiptTopic())){ - paymentUpdateService.process(record); - paymentNotificationService.process(record, topic); - } - else paymentNotificationService.process(record, topic); + if (topic.matches(config.getReceiptTopicPattern())) { - } + // Adding in MDC so that tracer can add it in header + + MDC.put(PTConstants.TENANTID_MDC_STRING, stateLevelTenantID); + + paymentUpdateService.process(record); + paymentNotificationService.process(record, config.getReceiptTopic()); + } + + } } diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/consumer/ReceiptConsumerSaveTax.java b/municipal-services/property-services/src/main/java/org/egov/pt/consumer/ReceiptConsumerSaveTax.java new file mode 100644 index 00000000000..bf937fc9052 --- /dev/null +++ b/municipal-services/property-services/src/main/java/org/egov/pt/consumer/ReceiptConsumerSaveTax.java @@ -0,0 +1,40 @@ +package org.egov.pt.consumer; + +import java.util.HashMap; + +import org.egov.pt.config.PropertyConfiguration; +import org.egov.pt.service.PaymentNotificationService; +import org.egov.pt.service.PaymentUpdateService; +import org.egov.pt.util.PTConstants; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.kafka.support.KafkaHeaders; +import org.springframework.messaging.handler.annotation.Header; +import org.springframework.stereotype.Component; + +@Component +public class ReceiptConsumerSaveTax { + + @Autowired + private PaymentUpdateService paymentUpdateService; + + @Autowired + private PaymentNotificationService paymentNotificationService; + + @Autowired + private PropertyConfiguration config; + + @Value("${state.level.tenant.id}") + private String stateLevelTenantID; + + @KafkaListener( topics = {"${kafka.topics.notification.pg.save.txns}"}) + public void listenPayments(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { + + // Adding in MDC so that tracer can add it in header + MDC.put(PTConstants.TENANTID_MDC_STRING, stateLevelTenantID); + + paymentNotificationService.processTransaction(record, topic); + } +} diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/producer/PropertyProducer.java b/municipal-services/property-services/src/main/java/org/egov/pt/producer/PropertyProducer.java index e725681d8bb..42754ad964c 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/producer/PropertyProducer.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/producer/PropertyProducer.java @@ -1,10 +1,10 @@ - package org.egov.pt.producer; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.pt.models.Property; import org.egov.pt.util.EncryptionDecryptionUtil; -import org.egov.pt.util.PTConstants; import org.egov.pt.web.contracts.PropertyRequest; +import org.egov.pt.web.contracts.SMSRequest; import org.egov.tracer.kafka.CustomKafkaTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -20,13 +20,23 @@ public class PropertyProducer { @Autowired private EncryptionDecryptionUtil encryptionDecryptionUtil; - - public void push(String topic, Object value) { - kafkaTemplate.send(topic, value); + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + public void push(String tenantId, String topic, Object value) { + + String updatedTopic = centralInstanceUtil.getStateSpecificTopicName(tenantId, topic); + log.info("The Kafka topic for the tenantId : " + tenantId + " is : " + updatedTopic); + kafkaTemplate.send(updatedTopic, value); } public void pushAfterEncrytpion(String topic, PropertyRequest request) { - request.setProperty(encryptionDecryptionUtil.encryptObject(request.getProperty(), PTConstants.PROPERTY_MODEL, Property.class)); - push(topic, request); + request.setProperty(encryptionDecryptionUtil.encryptObject(request.getProperty(), "Property", Property.class)); + push(request.getProperty().getTenantId(),topic, request); } + + + + } diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/repository/AssessmentRepository.java b/municipal-services/property-services/src/main/java/org/egov/pt/repository/AssessmentRepository.java index a211f4e5ba9..0488eae8002 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/repository/AssessmentRepository.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/repository/AssessmentRepository.java @@ -1,11 +1,15 @@ package org.egov.pt.repository; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.egov.common.exception.InvalidTenantIdException; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.pt.models.Assessment; import org.egov.pt.models.AssessmentSearchCriteria; -import org.egov.pt.models.Property; -import org.egov.pt.models.PropertyCriteria; import org.egov.pt.repository.builder.AssessmentQueryBuilder; import org.egov.pt.repository.rowmapper.AssessmentRowMapper; import org.egov.tracer.model.CustomException; @@ -13,11 +17,11 @@ import org.springframework.jdbc.core.SingleColumnRowMapper; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.stereotype.Repository; - -import lombok.extern.slf4j.Slf4j; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; +import lombok.extern.slf4j.Slf4j; + @Repository @Slf4j public class AssessmentRepository { @@ -31,11 +35,20 @@ public class AssessmentRepository { @Autowired private AssessmentRowMapper rowMapper; + @Autowired + private MultiStateInstanceUtil centralInstanceutil; + public List getAssessments(AssessmentSearchCriteria criteria){ Map preparedStatementValues = new HashMap<>(); List assessments = new ArrayList<>(); String query = queryBuilder.getSearchQuery(criteria, preparedStatementValues); + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("EG_PT_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } log.info("Query: "+query); log.debug("preparedStatementValues: "+preparedStatementValues); assessments = namedParameterJdbcTemplate.query(query, preparedStatementValues, rowMapper); @@ -54,9 +67,14 @@ public List fetchAssessmentNumbers(AssessmentSearchCriteria criteria) { preparedStatementValues.put("offset", criteria.getOffset()); preparedStatementValues.put("limit", criteria.getLimit()); builder.append(orderbyClause); - return namedParameterJdbcTemplate.query(builder.toString(), - preparedStatementValues, - new SingleColumnRowMapper<>(String.class)); + String query; + try { + query = centralInstanceutil.replaceSchemaPlaceholder(builder.toString(), criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("EG_PT_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + return namedParameterJdbcTemplate.query(query, preparedStatementValues, new SingleColumnRowMapper<>(String.class)); } public List getAssessmentPlainSearch(AssessmentSearchCriteria criteria) { diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/repository/PropertyRepository.java b/municipal-services/property-services/src/main/java/org/egov/pt/repository/PropertyRepository.java index 9d164bacc5f..f1643e281db 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/repository/PropertyRepository.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/repository/PropertyRepository.java @@ -10,14 +10,14 @@ import lombok.extern.slf4j.Slf4j; import org.egov.common.contract.request.RequestInfo; -import org.egov.pt.models.EncryptionCount; -import org.egov.pt.models.OwnerInfo; -import org.egov.pt.models.Property; -import org.egov.pt.models.PropertyCriteria; +import org.egov.common.exception.InvalidTenantIdException; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.encryption.config.EncProperties; +import org.egov.pt.config.PropertyConfiguration; +import org.egov.pt.models.*; import org.egov.pt.models.user.User; import org.egov.pt.models.user.UserDetailResponse; import org.egov.pt.models.user.UserSearchRequest; -import org.egov.pt.models.PropertyAudit; import org.egov.pt.repository.builder.PropertyQueryBuilder; import org.egov.pt.repository.rowmapper.EncryptionCountRowMapper; import org.egov.pt.repository.rowmapper.OpenPropertyRowMapper; @@ -27,6 +27,7 @@ import org.egov.pt.repository.rowmapper.PropertyAuditEncRowMapper; import org.egov.pt.service.UserService; import org.egov.pt.util.PropertyUtil; +import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.SingleColumnRowMapper; @@ -48,46 +49,55 @@ public class PropertyRepository { @Autowired private PropertyRowMapper rowMapper; - + @Autowired private PropertySearchRowMapper rowSearchMapper; - + @Autowired private OpenPropertyRowMapper openRowMapper; - + @Autowired private PropertyAuditRowMapper auditRowMapper; - + @Autowired private PropertyUtil util; - - @Autowired - private UserService userService; + + @Autowired + private MultiStateInstanceUtil centralUtil; + + @Autowired + private UserService userService; @Autowired private EncryptionCountRowMapper encryptionCountRowMapper; @Autowired private PropertyAuditEncRowMapper propertyAuditEncRowMapper; - + private EncProperties config; + public List getPropertyIds(Set ownerIds, String tenantId) { List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getPropertyIdsQuery(ownerIds, tenantId, preparedStmtList); + try { + query = centralUtil.replaceSchemaPlaceholder(query, tenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("EG_PT_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } return jdbcTemplate.queryForList(query, preparedStmtList.toArray(), String.class); } public List getProperties(PropertyCriteria criteria, Boolean isApiOpen, Boolean isPlainSearch) { List preparedStmtList = new ArrayList<>(); - String query; - - if(criteria.getIsDefaulterNoticeSearch()) - query=queryBuilder.getPropertySearchQueryForDeafauterNotice(criteria,preparedStmtList); - else - query=queryBuilder.getPropertySearchQuery(criteria, preparedStmtList, isPlainSearch, false); - - log.info("Query for Property search is " + query + " with parameters " + preparedStmtList.toArray().toString()); + String query = queryBuilder.getPropertySearchQuery(criteria, preparedStmtList, isPlainSearch, false); + try { + query = centralUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("EG_PT_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } if (isApiOpen) return jdbcTemplate.query(query, preparedStmtList.toArray(), openRowMapper); if(criteria.getIsDefaulterNoticeSearch()) @@ -100,30 +110,31 @@ public List getPropertyIds(PropertyCriteria criteria) { List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getPropertySearchQuery(criteria, preparedStmtList, false, true); + try { + query = centralUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("EG_PT_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } return jdbcTemplate.query(query, preparedStmtList.toArray(), new SingleColumnRowMapper<>()); } - public List getPropertiesForBulkSearch(PropertyCriteria criteria, Boolean isPlainSearch) { + public List getPropertiesForBulkSearch(PropertyCriteria criteria, String schemaTenantId, Boolean isPlainSearch) { List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getPropertyQueryForBulkSearch(criteria, preparedStmtList, isPlainSearch); - return jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); - } - - private String createQuery(Set ids) { - StringBuilder builder = new StringBuilder(); - int length = ids.size(); - for (int i = 0; i < length; i++) { - builder.append(" ?"); - if (i != length - 1) - builder.append(","); + try { + query = centralUtil.replaceSchemaPlaceholder(query, schemaTenantId); + } catch (InvalidTenantIdException e) { + throw new CustomException("EG_PT_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); } - return builder.toString(); + return jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); } public List fetchIds(PropertyCriteria criteria, Boolean isPlainSearch) { - + List preparedStmtList = new ArrayList<>(); - String basequery = "select id from eg_pt_property"; + String basequery = "select id from {schema}.eg_pt_property"; StringBuilder builder = new StringBuilder(basequery); if(isPlainSearch) { @@ -146,7 +157,14 @@ public List fetchIds(PropertyCriteria criteria, Boolean isPlainSearch) { builder.append(orderbyClause); preparedStmtList.add(criteria.getOffset()); preparedStmtList.add(criteria.getLimit()); - return jdbcTemplate.query(builder.toString(), preparedStmtList.toArray(), new SingleColumnRowMapper<>(String.class)); + String query; + try { + query = centralUtil.replaceSchemaPlaceholder(builder.toString(), criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("EG_PT_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + return jdbcTemplate.query(query, preparedStmtList.toArray(), new SingleColumnRowMapper<>(String.class)); } /** * Returns list of properties based on the given propertyCriteria with owner @@ -159,7 +177,10 @@ public List fetchIds(PropertyCriteria criteria, Boolean isPlainSearch) { public List getPropertiesWithOwnerInfo(PropertyCriteria criteria, RequestInfo requestInfo, Boolean isInternal) { List properties; - + + if(criteria.getTenantId() == null) + { criteria.setTenantId(config.getStateLevelTenantId()); } + Boolean isOpenSearch = isInternal ? false : util.isPropertySearchOpen(requestInfo.getUserInfo()); if (criteria.isAudit() && !isOpenSearch) { @@ -181,36 +202,42 @@ public List getPropertiesWithOwnerInfo(PropertyCriteria criteria, Requ util.enrichOwner(userDetailResponse, properties, isOpenSearch); return properties; } - + private List getPropertyAudit(PropertyCriteria criteria) { String query = queryBuilder.getpropertyAuditQuery(); + try { + query = centralUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("EG_PT_AS_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } return jdbcTemplate.query(query, criteria.getPropertyIds().toArray(), auditRowMapper); } /** - * + * * Method to enrich property search criteria with user based criteria info - * - * If no info found based on user criteria boolean true will be returned so that empty list can be returned - * + * + * If no info found based on user criteria boolean true will be returned so that empty list can be returned + * * else returns false to continue the normal flow - * + * * The enrichment of object is done this way(instead of directly applying in the search query) to fetch multiple owners related to property at once - * + * * @param criteria * @param requestInfo * @return */ public Boolean enrichCriteriaFromUser(PropertyCriteria criteria, RequestInfo requestInfo) { - + Set ownerIds = new HashSet(); - + if(!CollectionUtils.isEmpty(criteria.getOwnerIds())) ownerIds.addAll(criteria.getOwnerIds()); criteria.setOwnerIds(null); - + String userTenant = criteria.getTenantId(); if(criteria.getTenantId() == null) userTenant = requestInfo.getUserInfo().getTenantId(); @@ -226,16 +253,15 @@ public Boolean enrichCriteriaFromUser(PropertyCriteria criteria, RequestInfo req // fetching property id from owner table and enriching criteria ownerIds.addAll(userDetailResponse.getUser().stream().map(User::getUuid).collect(Collectors.toSet())); - + if (criteria.getIsCitizen()!=null && criteria.getMobileNumber()!=null) { for (OwnerInfo user : userDetailResponse.getUser()) { if (user.getAlternatemobilenumber()!=null && user.getAlternatemobilenumber().equalsIgnoreCase(criteria.getMobileNumber())) { ownerIds.remove(user.getUuid()); } - + } } - // only used to eliminate property-ids which does not have the owner List propertyIds = getPropertyIds(ownerIds, userTenant); @@ -267,23 +293,33 @@ public Boolean enrichCriteriaFromUser(PropertyCriteria criteria, RequestInfo req } public Integer getCount(PropertyCriteria propertyCriteria, RequestInfo requestInfo) { - - List preparedStmtList = new ArrayList<>(); - String query = queryBuilder.getPropertySearchQuery(propertyCriteria, preparedStmtList, false, false); - Integer count = jdbcTemplate.queryForObject(query, preparedStmtList.toArray(), Integer.class); - return count; - } + + List preparedStmtList = new ArrayList<>(); + String query = queryBuilder.getPropertySearchQuery(propertyCriteria, preparedStmtList, false, false); + Integer count = jdbcTemplate.queryForObject(query, preparedStmtList.toArray(), Integer.class); + return count; + } /** Method to find the total count of applications present in dB */ public Integer getTotalApplications(PropertyCriteria criteria) { - List preparedStatement = new ArrayList<>(); - String query = queryBuilder.getTotalApplicationsCountQueryString(criteria, preparedStatement); + String query = queryBuilder.getTotalApplicationsCountQueryString(criteria); if (query == null) return 0; - Integer count = jdbcTemplate.queryForObject(query, preparedStatement.toArray(), Integer.class); + Integer count = jdbcTemplate.queryForObject(query, Integer.class); return count; } - + + private String createQuery(Set ids) { + StringBuilder builder = new StringBuilder(); + int length = ids.size(); + for (int i = 0; i < length; i++) { + builder.append(" ?"); + if (i != length - 1) + builder.append(","); + } + return builder.toString(); + } + private void addToPreparedStatement(List preparedStmtList, Set ids) { ids.forEach(id -> { preparedStmtList.add(id); diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/repository/builder/AssessmentQueryBuilder.java b/municipal-services/property-services/src/main/java/org/egov/pt/repository/builder/AssessmentQueryBuilder.java index 1261406b56a..5086aa9e130 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/repository/builder/AssessmentQueryBuilder.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/repository/builder/AssessmentQueryBuilder.java @@ -27,7 +27,7 @@ public class AssessmentQueryBuilder { + "doc.id as doc_id, doc.entityid as doc_entityid, doc.documentType as doc_documenttype, doc.fileStoreId as doc_filestoreid, doc.documentuid as doc_documentuid, " + "doc.status as doc_status, doc.tenantid as doc_tenantid, " + "doc.createdby as doc_createdby, doc.createdtime as doc_createdtime, doc.lastmodifiedby as doc_lastmodifiedby, doc.lastmodifiedtime as doc_lastmodifiedtime " - + "FROM eg_pt_asmt_assessment asmt LEFT OUTER JOIN eg_pt_asmt_unitusage us ON asmt.id = us.assessmentId LEFT OUTER JOIN eg_pt_asmt_document doc ON asmt.id = doc.entityid "; + + "FROM {schema}.eg_pt_asmt_assessment asmt LEFT OUTER JOIN {schema}.eg_pt_asmt_unitusage us ON asmt.id = us.assessmentId LEFT OUTER JOIN {schema}.eg_pt_asmt_document doc ON asmt.id = doc.entityid "; private final String paginationWrapper = "SELECT * FROM " diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/repository/builder/OldPropertyQueryBuilder.java b/municipal-services/property-services/src/main/java/org/egov/pt/repository/builder/OldPropertyQueryBuilder.java deleted file mode 100644 index 03b9c5d1199..00000000000 --- a/municipal-services/property-services/src/main/java/org/egov/pt/repository/builder/OldPropertyQueryBuilder.java +++ /dev/null @@ -1,114 +0,0 @@ -package org.egov.pt.repository.builder; - -import java.util.*; -import org.apache.commons.lang3.StringUtils; -import org.egov.pt.config.PropertyConfiguration; -import org.egov.pt.models.oldProperty.OldPropertyCriteria; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -@Component -public class OldPropertyQueryBuilder { - - @Autowired - private PropertyConfiguration config; - - private static final String INNER_JOIN_STRING = "INNER JOIN"; - private static final String LEFT_OUTER_JOIN_STRING = "LEFT OUTER JOIN"; - - private static final String QUERY = "SELECT pt.*,ptdl.*,address.*,owner.*,doc.*,unit.*,insti.*," - + " pt.propertyid as propertyid,ptdl.assessmentnumber as propertydetailid,doc.id as documentid,unit.id as unitid," - + "address.id as addresskeyid,insti.id as instiid,pt.additionalDetails as pt_additionalDetails," - + "ownerdoc.id as ownerdocid,ownerdoc.documenttype as ownerdocType,ownerdoc.filestore as ownerfileStore," - + "ownerdoc.documentuid as ownerdocuid,ptdl.additionalDetails as ptdl_additionalDetails," - + "ptdl.createdby as assesscreatedby,ptdl.lastModifiedBy as assesslastModifiedBy,ptdl.createdTime as assesscreatedTime," - + "ptdl.lastModifiedTime as assesslastModifiedTime," - + "ptdl.status as propertydetailstatus, unit.occupancyDate as unitoccupancyDate," - + "insti.name as institutionname,insti.type as institutiontype,insti.tenantid as institenantId," - + "ownerdoc.userid as docuserid,ownerdoc.propertydetail as docassessmentnumber," - + "unit.usagecategorymajor as unitusagecategorymajor,unit.usagecategoryminor as unitusagecategoryminor" - + " FROM eg_pt_property_v2 pt " + INNER_JOIN_STRING - + " eg_pt_propertydetail_v2 ptdl ON pt.propertyid =ptdl.property " + INNER_JOIN_STRING - + " eg_pt_owner_v2 owner ON ptdl.assessmentnumber=owner.propertydetail " + INNER_JOIN_STRING - + " eg_pt_address_v2 address on address.property=pt.propertyid " + LEFT_OUTER_JOIN_STRING - + " eg_pt_unit_v2 unit ON ptdl.assessmentnumber=unit.propertydetail " + LEFT_OUTER_JOIN_STRING - + " eg_pt_document_propertydetail_v2 doc ON ptdl.assessmentnumber=doc.propertydetail " - + LEFT_OUTER_JOIN_STRING + " eg_pt_document_owner_v2 ownerdoc ON ownerdoc.userid=owner.userid " - + LEFT_OUTER_JOIN_STRING + " eg_pt_institution_v2 insti ON ptdl.assessmentnumber=insti.propertydetail " - + " WHERE "; - - private static final String LIKE_QUERY = "SELECT pt.*,ptdl.*,address.*,owner.*,doc.*,unit.*,insti.*," - + " pt.propertyid as ptid,ptdl.assessmentnumber as propertydetailid,doc.id as documentid,unit.id as unitid," - + "address.id as addresskeyid,insti.id as instiid,pt.additionalDetails as pt_additionalDetails," - + "ownerdoc.id as ownerdocid,ownerdoc.documenttype as ownerdocType,ownerdoc.filestore as ownerfileStore," - + "ownerdoc.documentuid as ownerdocuid, ptdl.additionalDetails as ptdl_additionalDetails," - + "ptdl.createdby as assesscreatedby,ptdl.lastModifiedBy as assesslastModifiedBy,ptdl.createdTime as assesscreatedTime," - + "ptdl.lastModifiedTime as assesslastModifiedTime," - + "ptdl.status as propertydetailstatus, unit.occupancyDate as unitoccupancyDate," - + "insti.name as institutionname,insti.type as institutiontype,insti.tenantid as institenantId," - + "ownerdoc.userid as docuserid,ownerdoc.propertydetail as docassessmentnumber," - + "unit.usagecategorymajor as unitusagecategorymajor,unit.usagecategoryminor as unitusagecategoryminor," - + "pt.lastModifiedTime as propertylastModifiedTime,pt.createdby as propertyCreatedby," - + "pt.lastModifiedBy as propertyModifiedBy,pt.createdTime as propertyCreatedTime " - + " FROM eg_pt_property_v2 pt " + INNER_JOIN_STRING - + " eg_pt_propertydetail_v2 ptdl ON pt.propertyid =ptdl.property " + INNER_JOIN_STRING - + " eg_pt_owner_v2 owner ON ptdl.assessmentnumber=owner.propertydetail " + INNER_JOIN_STRING - + " eg_pt_address_v2 address on address.property=pt.propertyid " + LEFT_OUTER_JOIN_STRING - + " eg_pt_unit_v2 unit ON ptdl.assessmentnumber=unit.propertydetail " + LEFT_OUTER_JOIN_STRING - + " eg_pt_document_propertydetail_v2 doc ON ptdl.assessmentnumber=doc.propertydetail " - + LEFT_OUTER_JOIN_STRING + " eg_pt_document_owner_v2 ownerdoc ON ownerdoc.userid=owner.userid " - + LEFT_OUTER_JOIN_STRING + " eg_pt_institution_v2 insti ON ptdl.assessmentnumber=insti.propertydetail " - + " WHERE "; - - private final String paginationWrapper = "SELECT * FROM " - + "(SELECT *, DENSE_RANK() OVER (ORDER BY ptid) offset_ FROM " + "({})" + " result) result_offset " - + "WHERE offset_ > ? AND offset_ <= ?"; - - - - - - public String getPropertyLikeQuery(OldPropertyCriteria criteria, List preparedStmtList,long initialPoint) { - StringBuilder builder = new StringBuilder(LIKE_QUERY); - String tenatId = config.getStateLevelTenantId(); - if(!StringUtils.isEmpty(criteria.getTenantId())) { - if(criteria.getTenantId().equals(tenatId)) { - builder.append("pt.tenantid LIKE ? "); - preparedStmtList.add(tenatId+"%"); - }else { - builder.append("pt.tenantid = ? "); - preparedStmtList.add(criteria.getTenantId()); - } - }else { - builder.append("pt.tenantid LIKE ? "); - preparedStmtList.add(tenatId+"%"); - } - /*String id = criteria.getIds().stream().findFirst().get(); - builder.append("AND pt.propertyid LIKE ?"); - preparedStmtList.add(id);*/ - - return addPaginationWrapper(builder.toString(), preparedStmtList, criteria,initialPoint); - - } - - private String addPaginationWrapper(String query, List preparedStmtList, OldPropertyCriteria criteria,long initialPoint) { - Long limit = config.getDefaultLimit(); - Long offset = config.getDefaultOffset(); - String finalQuery = paginationWrapper.replace("{}", query); - - if (criteria.getLimit() != null && criteria.getLimit() <= config.getMaxSearchLimit()) - limit = criteria.getLimit(); - - if (criteria.getLimit() != null && criteria.getLimit() > config.getMaxSearchLimit()) - limit = config.getMaxSearchLimit(); - - offset = initialPoint; - - preparedStmtList.add(offset); - preparedStmtList.add(limit + offset); - - return finalQuery; - } - -} diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/repository/builder/OldPropertyQueryBulider.java b/municipal-services/property-services/src/main/java/org/egov/pt/repository/builder/OldPropertyQueryBulider.java new file mode 100644 index 00000000000..d2970f5a3ac --- /dev/null +++ b/municipal-services/property-services/src/main/java/org/egov/pt/repository/builder/OldPropertyQueryBulider.java @@ -0,0 +1,109 @@ +package org.egov.pt.repository.builder; + +import java.util.*; +import org.apache.commons.lang3.StringUtils; +import org.egov.pt.config.PropertyConfiguration; +import org.egov.pt.models.oldProperty.OldPropertyCriteria; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class OldPropertyQueryBulider { + + @Autowired + private PropertyConfiguration config; + + private static final String INNER_JOIN_STRING = "INNER JOIN"; + private static final String LEFT_OUTER_JOIN_STRING = "LEFT OUTER JOIN"; + + private static final String QUERY = "SELECT pt.*,ptdl.*,address.*,owner.*,doc.*,unit.*,insti.*," + + " pt.propertyid as propertyid,ptdl.assessmentnumber as propertydetailid,doc.id as documentid,unit.id as unitid," + + "address.id as addresskeyid,insti.id as instiid,pt.additionalDetails as pt_additionalDetails," + + "ownerdoc.id as ownerdocid,ownerdoc.documenttype as ownerdocType,ownerdoc.filestore as ownerfileStore," + + "ownerdoc.documentuid as ownerdocuid,ptdl.additionalDetails as ptdl_additionalDetails," + + "ptdl.createdby as assesscreatedby,ptdl.lastModifiedBy as assesslastModifiedBy,ptdl.createdTime as assesscreatedTime," + + "ptdl.lastModifiedTime as assesslastModifiedTime," + + "ptdl.status as propertydetailstatus, unit.occupancyDate as unitoccupancyDate," + + "insti.name as institutionname,insti.type as institutiontype,insti.tenantid as institenantId," + + "ownerdoc.userid as docuserid,ownerdoc.propertydetail as docassessmentnumber," + + "unit.usagecategorymajor as unitusagecategorymajor,unit.usagecategoryminor as unitusagecategoryminor" + + " FROM eg_pt_property_v2 pt " + INNER_JOIN_STRING + + " eg_pt_propertydetail_v2 ptdl ON pt.propertyid =ptdl.property " + INNER_JOIN_STRING + + " eg_pt_owner_v2 owner ON ptdl.assessmentnumber=owner.propertydetail " + INNER_JOIN_STRING + + " eg_pt_address_v2 address on address.property=pt.propertyid " + LEFT_OUTER_JOIN_STRING + + " eg_pt_unit_v2 unit ON ptdl.assessmentnumber=unit.propertydetail " + LEFT_OUTER_JOIN_STRING + + " eg_pt_document_propertydetail_v2 doc ON ptdl.assessmentnumber=doc.propertydetail " + + LEFT_OUTER_JOIN_STRING + " eg_pt_document_owner_v2 ownerdoc ON ownerdoc.userid=owner.userid " + + LEFT_OUTER_JOIN_STRING + " eg_pt_institution_v2 insti ON ptdl.assessmentnumber=insti.propertydetail " + + " WHERE "; + + private static final String LIKE_QUERY = "SELECT pt.*,ptdl.*,address.*,owner.*,doc.*,unit.*,insti.*," + + " pt.propertyid as ptid,ptdl.assessmentnumber as propertydetailid,doc.id as documentid,unit.id as unitid," + + "address.id as addresskeyid,insti.id as instiid,pt.additionalDetails as pt_additionalDetails," + + "ownerdoc.id as ownerdocid,ownerdoc.documenttype as ownerdocType,ownerdoc.filestore as ownerfileStore," + + "ownerdoc.documentuid as ownerdocuid, ptdl.additionalDetails as ptdl_additionalDetails," + + "ptdl.createdby as assesscreatedby,ptdl.lastModifiedBy as assesslastModifiedBy,ptdl.createdTime as assesscreatedTime," + + "ptdl.lastModifiedTime as assesslastModifiedTime," + + "ptdl.status as propertydetailstatus, unit.occupancyDate as unitoccupancyDate," + + "insti.name as institutionname,insti.type as institutiontype,insti.tenantid as institenantId," + + "ownerdoc.userid as docuserid,ownerdoc.propertydetail as docassessmentnumber," + + "unit.usagecategorymajor as unitusagecategorymajor,unit.usagecategoryminor as unitusagecategoryminor," + + "pt.lastModifiedTime as propertylastModifiedTime,pt.createdby as propertyCreatedby," + + "pt.lastModifiedBy as propertyModifiedBy,pt.createdTime as propertyCreatedTime " + + " FROM eg_pt_property_v2 pt " + INNER_JOIN_STRING + + " eg_pt_propertydetail_v2 ptdl ON pt.propertyid =ptdl.property " + INNER_JOIN_STRING + + " eg_pt_owner_v2 owner ON ptdl.assessmentnumber=owner.propertydetail " + INNER_JOIN_STRING + + " eg_pt_address_v2 address on address.property=pt.propertyid " + LEFT_OUTER_JOIN_STRING + + " eg_pt_unit_v2 unit ON ptdl.assessmentnumber=unit.propertydetail " + LEFT_OUTER_JOIN_STRING + + " eg_pt_document_propertydetail_v2 doc ON ptdl.assessmentnumber=doc.propertydetail " + + LEFT_OUTER_JOIN_STRING + " eg_pt_document_owner_v2 ownerdoc ON ownerdoc.userid=owner.userid " + + LEFT_OUTER_JOIN_STRING + " eg_pt_institution_v2 insti ON ptdl.assessmentnumber=insti.propertydetail " + + " WHERE "; + + private final String paginationWrapper = "SELECT * FROM " + + "(SELECT *, DENSE_RANK() OVER (ORDER BY ptid) offset_ FROM " + "({})" + " result) result_offset " + + "WHERE offset_ > ? AND offset_ <= ?"; + + + public String getPropertyLikeQuery(OldPropertyCriteria criteria, List preparedStmtList, long initialPoint) { + StringBuilder builder = new StringBuilder(LIKE_QUERY); + String tenatId = config.getStateLevelTenantId(); + if (!StringUtils.isEmpty(criteria.getTenantId())) { + if (criteria.getTenantId().equals(tenatId)) { + builder.append("pt.tenantid LIKE ? "); + preparedStmtList.add(tenatId + "%"); + } else { + builder.append("pt.tenantid = ? "); + preparedStmtList.add(criteria.getTenantId()); + } + } else { + builder.append("pt.tenantid LIKE ? "); + preparedStmtList.add(tenatId + "%"); + } + /*String id = criteria.getIds().stream().findFirst().get(); + builder.append("AND pt.propertyid LIKE ?"); + preparedStmtList.add(id);*/ + + return addPaginationWrapper(builder.toString(), preparedStmtList, criteria, initialPoint); + + } + + private String addPaginationWrapper(String query, List preparedStmtList, OldPropertyCriteria criteria, long initialPoint) { + Long limit = config.getDefaultLimit(); + Long offset = config.getDefaultOffset(); + String finalQuery = paginationWrapper.replace("{}", query); + + if (criteria.getLimit() != null && criteria.getLimit() <= config.getMaxSearchLimit()) + limit = criteria.getLimit(); + + if (criteria.getLimit() != null && criteria.getLimit() > config.getMaxSearchLimit()) + limit = config.getMaxSearchLimit(); + + offset = initialPoint; + + preparedStmtList.add(offset); + preparedStmtList.add(limit + offset); + + return finalQuery; + } +} \ No newline at end of file diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/repository/builder/PropertyQueryBuilder.java b/municipal-services/property-services/src/main/java/org/egov/pt/repository/builder/PropertyQueryBuilder.java index f77c7565249..ce8041a15a0 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/repository/builder/PropertyQueryBuilder.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/repository/builder/PropertyQueryBuilder.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Set; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.pt.config.PropertyConfiguration; import org.egov.pt.models.PropertyCriteria; import org.egov.pt.models.enums.Status; @@ -12,37 +13,34 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; @Component public class PropertyQueryBuilder { - + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + @Autowired private PropertyConfiguration config; - + private static final String SELECT = "SELECT "; private static final String INNER_JOIN = "INNER JOIN"; private static final String LEFT_JOIN = "LEFT OUTER JOIN"; - private static final String AND_QUERY = " AND "; - - private static final String PROPERTY_DEFAULTER_SEARCH="select * from (SELECT property.id as pid, property.propertyid, property.tenantid as ptenantid, surveyid, accountid, oldpropertyid, property.status as propertystatus, acknowldgementnumber, propertytype, ownershipcategory,property.usagecategory as pusagecategory, creationreason, nooffloors, landarea, property.superbuiltuparea as propertysbpa, linkedproperties, source, channel, property.createdby as pcreatedby, property.lastmodifiedby as plastmodifiedby, property.createdtime as pcreatedtime, property.lastmodifiedtime as plastmodifiedtime, property.additionaldetails as padditionaldetails, (CASE WHEN property.status='ACTIVE' then 0 WHEN property.status='INWORKFLOW' then 1 WHEN property.status='INACTIVE' then 2 ELSE 3 END) as statusorder, address.tenantid as adresstenantid, address.id as addressid, address.propertyid as addresspid, latitude, longitude, doorno, plotno, buildingname, street, landmark, city, pincode, locality, district, region, state, country, address.createdby as addresscreatedby, address.lastmodifiedby as addresslastmodifiedby, address.createdtime as addresscreatedtime, address.lastmodifiedtime as addresslastmodifiedtime, address.additionaldetails as addressadditionaldetails, owner.tenantid as owntenantid, ownerInfoUuid, owner.propertyid as ownpropertyid, userid, owner.status as ownstatus,owner.additionaldetails as oadditionaldetails, isprimaryowner, ownertype, ownershippercentage, owner.institutionid as owninstitutionid, relationship, owner.createdby as owncreatedby, owner.createdtime as owncreatedtime,owner.lastmodifiedby as ownlastmodifiedby, owner.lastmodifiedtime as ownlastmodifiedtime, unit.id as unitid, unit.tenantid as unittenantid, unit.propertyid as unitpid, floorno, unittype, unit.usagecategory as unitusagecategory, occupancytype, occupancydate, carpetarea, builtuparea, plintharea, unit.superbuiltuparea as unitspba, arv, constructiontype, constructiondate, dimensions, unit.active as isunitactive, unit.createdby as unitcreatedby, unit.createdtime as unitcreatedtime, unit.lastmodifiedby as unitlastmodifiedby, unit.lastmodifiedtime as unitlastmodifiedtime FROM EG_PT_PROPERTY property INNER JOIN EG_PT_ADDRESS address ON property.id = address.propertyid INNER JOIN EG_PT_OWNER owner ON property.id = owner.propertyid LEFT OUTER JOIN EG_PT_UNIT unit ON property.id = unit.propertyid WHERE property.tenantId= ? AND property.usagecategory like ? AND address.locality = ? AND owner.status = ? AND property.status = ?) as propertydata" - + " LEFT OUTER JOIN (select consumercode,sum(taxdue) as taxDue,STRING_AGG(year || '(Rs.' || taxdue || ')',',') as taxDueYear from ( select d.consumercode, (to_char((To_timestamp(d.taxperiodfrom/1000) at time Zone 'Asia/Kolkata'),'YYYY') || '-' || to_char((To_timestamp(d.taxperiodto/1000) at time Zone 'Asia/Kolkata'),'YY')) as year , sum(dd.taxamount)-sum(dd.collectionamount) as taxdue from egbs_demanddetail_v1 dd, egbs_demand_v1 d " - + " where dd.demandid=d.id and d.status!='CANCELLED' and dd.tenantid='pg.citya' and d.tenantid='pg.citya' and (to_char((To_timestamp(d.taxperiodfrom/1000) at time Zone 'Asia/Kolkata'),'YYYY') || '-' || to_char((To_timestamp(d.taxperiodto/1000) at time Zone 'Asia/Kolkata'),'YY')) != ? group by d.consumercode,(to_char((To_timestamp(d.taxperiodfrom/1000) at time Zone 'Asia/Kolkata'),'YYYY') || '-' || to_char((To_timestamp(d.taxperiodto/1000) at time Zone 'Asia/Kolkata'),'YY'))) tax where taxDue>0 group by tax.consumercode) as taxdata on propertydata.propertyid=taxdata.consumercode"; - - private static String PROEPRTY_AUDIT_QUERY = "select property from eg_pt_property_audit where propertyid=?"; - private static String PROPERTY_AUDIT_ENC_QUERY = "select * from eg_pt_property_audit where propertyid=?"; + private static String PROEPRTY_AUDIT_QUERY = "select property from {schema}.eg_pt_property_audit where propertyid=?"; - private static String PROEPRTY_ID_QUERY = "select propertyid from eg_pt_property where id in (select propertyid from eg_pt_owner where userid IN {replace} AND status='ACTIVE') "; + private static String PROEPRTY_ID_QUERY = "select propertyid from {schema}.eg_pt_property where id in (select propertyid from {schema}.eg_pt_owner where userid IN {replace} AND status='ACTIVE')"; private static String REPLACE_STRING = "{replace}"; - + private static String WITH_CLAUSE_QUERY = " WITH propertyresult AS ({replace}) SELECT * FROM propertyresult " - + "INNER JOIN (SELECT propertyid, min(statusorder) as minorder FROM propertyresult GROUP BY propertyid) as minresult " - + "ON minresult.propertyid=propertyresult.propertyid AND minresult.minorder=propertyresult.statusorder"; - + + "INNER JOIN (SELECT propertyid, min(statusorder) as minorder FROM propertyresult GROUP BY propertyid) as minresult " + + "ON minresult.propertyid=propertyresult.propertyid AND minresult.minorder=propertyresult.statusorder"; + + + // Select query - // Select query - private static String propertySelectValues = "property.id as pid, property.propertyid, property.tenantid as ptenantid, surveyid, accountid, oldpropertyid, property.status as propertystatus, acknowldgementnumber, propertytype, ownershipcategory,property.usagecategory as pusagecategory, creationreason, nooffloors, landarea, property.superbuiltuparea as propertysbpa, linkedproperties, source, channel, property.createdby as pcreatedby, property.lastmodifiedby as plastmodifiedby, property.createdtime as pcreatedtime," + " property.lastmodifiedtime as plastmodifiedtime, property.additionaldetails as padditionaldetails, (CASE WHEN property.status='ACTIVE' then 0 WHEN property.status='INWORKFLOW' then 1 WHEN property.status='INACTIVE' then 2 ELSE 3 END) as statusorder, "; @@ -55,58 +53,57 @@ public class PropertyQueryBuilder { private static String ownerSelectValues = "owner.tenantid as owntenantid, ownerInfoUuid, owner.propertyid as ownpropertyid, userid, owner.status as ownstatus, isprimaryowner, ownertype, ownershippercentage, owner.institutionid as owninstitutionid, relationship, owner.createdby as owncreatedby, owner.createdtime as owncreatedtime,owner.lastmodifiedby as ownlastmodifiedby, owner.lastmodifiedtime as ownlastmodifiedtime,owner.additionaldetails as oadditionaldetails, "; private static String ownerDocSelectValues = " owndoc.id as owndocid, owndoc.tenantid as owndoctenantid, owndoc.entityid as owndocentityId, owndoc.documenttype as owndoctype, owndoc.filestoreid as owndocfilestore, owndoc.documentuid as owndocuid, owndoc.status as owndocstatus, "; - + private static String UnitSelectValues = "unit.id as unitid, unit.tenantid as unittenantid, unit.propertyid as unitpid, floorno, unittype, unit.usagecategory as unitusagecategory, occupancytype, occupancydate, carpetarea, builtuparea, plintharea, unit.superbuiltuparea as unitspba, arv, constructiontype, constructiondate, dimensions, unit.active as isunitactive, unit.createdby as unitcreatedby, unit.createdtime as unitcreatedtime, unit.lastmodifiedby as unitlastmodifiedby, unit.lastmodifiedtime as unitlastmodifiedtime "; - private static final String TOTAL_APPLICATIONS_COUNT_QUERY = "select count(*) from eg_pt_property where tenantid = ?;"; - - private static final String QUERY = SELECT - - + propertySelectValues - - + addressSelectValues - - + institutionSelectValues - + private static final String TOTAL_APPLICATIONS_COUNT_QUERY = "select count(*) from eg_pt_property where tenantid = '{}';"; + + private static final String QUERY = SELECT + + + propertySelectValues + + + addressSelectValues + + + institutionSelectValues + + propertyDocSelectValues - - + ownerSelectValues - - + ownerDocSelectValues - + + + ownerSelectValues + + + ownerDocSelectValues + + UnitSelectValues - + " FROM EG_PT_PROPERTY property " - - + INNER_JOIN + " EG_PT_ADDRESS address ON property.id = address.propertyid " - - + LEFT_JOIN + " EG_PT_INSTITUTION institution ON property.id = institution.propertyid " - - + LEFT_JOIN + " EG_PT_DOCUMENT pdoc ON property.id = pdoc.entityid " - - + INNER_JOIN + " EG_PT_OWNER owner ON property.id = owner.propertyid " - - + LEFT_JOIN + " EG_PT_DOCUMENT owndoc ON owner.ownerinfouuid = owndoc.entityid " - - + LEFT_JOIN + " EG_PT_UNIT unit ON property.id = unit.propertyid "; - + + " FROM {schema}.eg_pt_PROPERTY property " + + + INNER_JOIN + " {schema}.eg_pt_ADDRESS address ON property.id = address.propertyid " + + + LEFT_JOIN + " {schema}.eg_pt_INSTITUTION institution ON property.id = institution.propertyid " + + + LEFT_JOIN + " {schema}.eg_pt_DOCUMENT pdoc ON property.id = pdoc.entityid " + + + INNER_JOIN + " {schema}.eg_pt_OWNER owner ON property.id = owner.propertyid " + + + LEFT_JOIN + " {schema}.eg_pt_DOCUMENT owndoc ON owner.ownerinfouuid = owndoc.entityid " + + + LEFT_JOIN + " {schema}.eg_pt_UNIT unit ON property.id = unit.propertyid "; private static final String ID_QUERY = SELECT - + " property.id FROM EG_PT_PROPERTY property " + + " property.id FROM {schema}.eg_pt_PROPERTY property " - + INNER_JOIN + " EG_PT_ADDRESS address ON property.id = address.propertyid " + + INNER_JOIN + " {schema}.eg_pt_ADDRESS address ON property.id = address.propertyid " - + LEFT_JOIN + " EG_PT_INSTITUTION institution ON property.id = institution.propertyid " + + LEFT_JOIN + " {schema}.eg_pt_INSTITUTION institution ON property.id = institution.propertyid " - + LEFT_JOIN + " EG_PT_DOCUMENT pdoc ON property.id = pdoc.entityid " + + LEFT_JOIN + " {schema}.eg_pt_DOCUMENT pdoc ON property.id = pdoc.entityid " - + INNER_JOIN + " EG_PT_OWNER owner ON property.id = owner.propertyid " + + INNER_JOIN + " {schema}.eg_pt_OWNER owner ON property.id = owner.propertyid " - + LEFT_JOIN + " EG_PT_DOCUMENT owndoc ON owner.ownerinfouuid = owndoc.entityid " + + LEFT_JOIN + " {schema}.eg_pt_DOCUMENT owndoc ON owner.ownerinfouuid = owndoc.entityid " + + + LEFT_JOIN + " {schema}.eg_pt_UNIT unit ON property.id = unit.propertyid "; - + LEFT_JOIN + " EG_PT_UNIT unit ON property.id = unit.propertyid "; - private static final String COUNT_QUERY = SELECT + " count(distinct property.id) FROM EG_PT_PROPERTY property " @@ -122,17 +119,20 @@ public class PropertyQueryBuilder { + LEFT_JOIN + " EG_PT_DOCUMENT owndoc ON owner.ownerinfouuid = owndoc.entityid " + LEFT_JOIN + " EG_PT_UNIT unit ON property.id = unit.propertyid "; - + + private final String paginationWrapper = "SELECT * FROM " + "(SELECT *, DENSE_RANK() OVER (ORDER BY plastmodifiedtime DESC, pid) offset_ FROM " + "({})" + " result) result_offset " + "WHERE offset_ > ? AND offset_ <= ?"; private static final String LATEST_EXECUTED_MIGRATION_QUERY = "select * from eg_pt_enc_audit where tenantid = ? order by createdTime desc limit 1;"; + private String PROPERTY_AUDIT_ENC_QUERY; + private String PROPERTY_DEFAULTER_SEARCH; private String addPaginationWrapper(String query, List preparedStmtList, PropertyCriteria criteria) { - - + + Long limit = config.getDefaultLimit(); Long offset = config.getDefaultOffset(); String finalQuery = paginationWrapper.replace("{}", query); @@ -151,41 +151,41 @@ private String addPaginationWrapper(String query, List preparedStmtList, return finalQuery; } - + public String getPropertySearchQueryForDeafauterNotice (PropertyCriteria criteria, List preparedStmtList) { - - Boolean isEmpty = null == criteria.getLocality() || - null == criteria.getPropertyType() || criteria.getTenantId()==null; - - if(isEmpty) - throw new CustomException("EG_PT_SEARCH_ERROR"," Please provide tenant, locality, propertyType for the property search for defaulter notice"); - String currYearS; - - int currYear=((new Date().getYear())+1900); - int currmonth=((new Date().getMonth())+1); - if(currmonth>=1 && currmonth <=3) - currYearS= (String.valueOf(currYear-1))+"-"+ (String.valueOf(currYear).substring(2,4)); - else - currYearS=(String.valueOf(currYear))+"-"+ (String.valueOf(currYear+1).substring(2,4)); - - - StringBuilder builder= new StringBuilder(PROPERTY_DEFAULTER_SEARCH); - preparedStmtList.add(criteria.getTenantId()); - if(criteria.getPropertyType().equals("ALL")) - preparedStmtList.add("%%"); - else - preparedStmtList.add("%"+criteria.getPropertyType().toUpperCase()+"%"); - preparedStmtList.add(criteria.getLocality()); - preparedStmtList.add(Status.ACTIVE.toString()); - preparedStmtList.add(Status.ACTIVE.toString()); - preparedStmtList.add(currYearS); - - return builder.toString(); + + Boolean isEmpty = null == criteria.getLocality() || + null == criteria.getPropertyType() || criteria.getTenantId()==null; + + if(isEmpty) + throw new CustomException("EG_PT_SEARCH_ERROR"," Please provide tenant, locality, propertyType for the property search for defaulter notice"); + String currYearS; + + int currYear=((new Date().getYear())+1900); + int currmonth=((new Date().getMonth())+1); + if(currmonth>=1 && currmonth <=3) + currYearS= (String.valueOf(currYear-1))+"-"+ (String.valueOf(currYear).substring(2,4)); + else + currYearS=(String.valueOf(currYear))+"-"+ (String.valueOf(currYear+1).substring(2,4)); + + + StringBuilder builder= new StringBuilder(PROPERTY_DEFAULTER_SEARCH); + preparedStmtList.add(criteria.getTenantId()); + if(criteria.getPropertyType().equals("ALL")) + preparedStmtList.add("%%"); + else + preparedStmtList.add("%"+criteria.getPropertyType().toUpperCase()+"%"); + preparedStmtList.add(criteria.getLocality()); + preparedStmtList.add(Status.ACTIVE.toString()); + preparedStmtList.add(Status.ACTIVE.toString()); + preparedStmtList.add(currYearS); + + return builder.toString(); } /** - * + * * @param criteria * @param preparedStmtList * @return @@ -193,59 +193,43 @@ public String getPropertySearchQueryForDeafauterNotice (PropertyCriteria criteri public String getPropertySearchQuery(PropertyCriteria criteria, List preparedStmtList,Boolean isPlainSearch, Boolean onlyIds) { Boolean isEmpty = CollectionUtils.isEmpty(criteria.getPropertyIds()) - && CollectionUtils.isEmpty(criteria.getAcknowledgementIds()) - && CollectionUtils.isEmpty(criteria.getOldpropertyids()) - && CollectionUtils.isEmpty(criteria.getUuids()) - && null == criteria.getMobileNumber() - && null == criteria.getName() - && null == criteria.getDoorNo() - && null == criteria.getOldPropertyId() - && null == criteria.getDocumentNumbers() - && null == criteria.getLocality() - && null == criteria.getPropertyType() - && (null == criteria.getFromDate() && null == criteria.getToDate()) - && CollectionUtils.isEmpty(criteria.getCreationReason()); - + && CollectionUtils.isEmpty(criteria.getAcknowledgementIds()) + && CollectionUtils.isEmpty(criteria.getOldpropertyids()) + && CollectionUtils.isEmpty(criteria.getUuids()) + && null == criteria.getMobileNumber() + && null == criteria.getName() + && null == criteria.getDoorNo() + && null == criteria.getOldPropertyId() + && (null == criteria.getFromDate() && null == criteria.getToDate()) + && CollectionUtils.isEmpty(criteria.getCreationReason()); + if(isEmpty) throw new CustomException("EG_PT_SEARCH_ERROR"," No criteria given for the property search"); - + + String tenantId = criteria.getTenantId(); StringBuilder builder; if (onlyIds) builder = new StringBuilder(ID_QUERY); - + else if (criteria.getIsRequestForCount()) { builder = new StringBuilder(COUNT_QUERY); - + } else builder = new StringBuilder(QUERY); - if(isPlainSearch) - { + if (isPlainSearch) { + Set tenantIds = criteria.getTenantIds(); - if(!CollectionUtils.isEmpty(tenantIds)) - { - addClauseIfRequired(preparedStmtList,builder); + if (!CollectionUtils.isEmpty(tenantIds)) { + addClauseIfRequired(preparedStmtList, builder); builder.append("property.tenantid IN (").append(createQuery(tenantIds)).append(")"); - addToPreparedStatement(preparedStmtList,tenantIds); - } - } - else - { - String tenantId = criteria.getTenantId(); - - if (tenantId != null) { - if (tenantId.equalsIgnoreCase(config.getStateLevelTenantId())) { - addClauseIfRequired(preparedStmtList,builder); - builder.append(" property.tenantId LIKE ? "); - preparedStmtList.add(tenantId + '%'); - } else { - addClauseIfRequired(preparedStmtList,builder); - builder.append(" property.tenantId= ? "); - preparedStmtList.add(tenantId); - } + addToPreparedStatement(preparedStmtList, tenantIds); } + } else if (tenantId != null) { + appendTenantIdToQuery(preparedStmtList, tenantId, builder, "property"); } + if (criteria.getFromDate() != null) { addClauseIfRequired(preparedStmtList,builder); @@ -273,8 +257,8 @@ else if (criteria.getIsRequestForCount()) { }); addClauseIfRequired(preparedStmtList,builder); builder.append(" property.status IN ( ") - .append(createQuery(statusStringList)) - .append(" )"); + .append(createQuery(statusStringList)) + .append(" )"); addToPreparedStatement(preparedStmtList, statusStringList); } @@ -284,7 +268,7 @@ else if (criteria.getIsRequestForCount()) { builder.append("property.creationreason IN ( ").append(createQuery(creationReasonsList)).append(" )"); addToPreparedStatement(preparedStmtList, creationReasonsList); } - + Set documentNumberList = criteria.getDocumentNumbers(); if(!CollectionUtils.isEmpty(documentNumberList)){ @@ -292,8 +276,8 @@ else if (criteria.getIsRequestForCount()) { builder.append(" property.status='ACTIVE' and owndoc.status='ACTIVE' and owndoc.documentuid IN ( ").append(createQuery(documentNumberList)).append(" )"); addToPreparedStatement(preparedStmtList, documentNumberList); } - - + + if (null != criteria.getLocality()) { addClauseIfRequired(preparedStmtList,builder); @@ -314,7 +298,7 @@ else if (criteria.getIsRequestForCount()) { builder.append("property.propertyid IN (").append(createQuery(propertyIds)).append(")"); addToPreparedStatementWithUpperCase(preparedStmtList, propertyIds); } - + Set acknowledgementIds = criteria.getAcknowledgementIds(); if (!CollectionUtils.isEmpty(acknowledgementIds)) { @@ -322,7 +306,7 @@ else if (criteria.getIsRequestForCount()) { builder.append("property.acknowldgementnumber IN (").append(createQuery(acknowledgementIds)).append(")"); addToPreparedStatementWithUpperCase(preparedStmtList, acknowledgementIds); } - + Set uuids = criteria.getUuids(); if (!CollectionUtils.isEmpty(uuids)) { @@ -338,24 +322,43 @@ else if (criteria.getIsRequestForCount()) { builder.append("property.oldpropertyid IN (").append(createQuery(oldpropertyids)).append(")"); addToPreparedStatement(preparedStmtList, oldpropertyids); } - - /* + + /* * Condition to evaluate if owner is active. * Inactive owners should never be shown in results - */ - + */ + addClauseIfRequired(preparedStmtList,builder); builder.append("owner.status = ?"); preparedStmtList.add(Status.ACTIVE.toString()); - + String withClauseQuery = WITH_CLAUSE_QUERY.replace(REPLACE_STRING, builder); if (onlyIds || criteria.getIsRequestForCount()) return builder.toString(); - else + else return addPaginationWrapper(withClauseQuery, preparedStmtList, criteria); } + private void appendTenantIdToQuery(List preparedStmtList, String tenantId, StringBuilder builder, String tableName) { + + if (centralInstanceUtil.isTenantIdStateLevel(tenantId)) { + + addClauseIfRequired(preparedStmtList, builder); + if (!StringUtils.isEmpty(tableName)) + builder.append(tableName).append("."); + builder.append(" tenantId LIKE ? "); + preparedStmtList.add(tenantId + '%'); + } else { + + addClauseIfRequired(preparedStmtList, builder); + if (!StringUtils.isEmpty(tableName)) + builder.append(tableName).append("."); + builder.append(" tenantId= ? "); + preparedStmtList.add(tenantId); + } + } + public String getPropertyQueryForBulkSearch(PropertyCriteria criteria, List preparedStmtList,Boolean isPlainSearch) { @@ -367,49 +370,30 @@ public String getPropertyQueryForBulkSearch(PropertyCriteria criteria, List tenantIds = criteria.getTenantIds(); - if(!CollectionUtils.isEmpty(tenantIds)) - { - addClauseIfRequired(preparedStmtList,builder); + if (!CollectionUtils.isEmpty(tenantIds)) { + addClauseIfRequired(preparedStmtList, builder); builder.append("property.tenantid IN (").append(createQuery(tenantIds)).append(")"); - addToPreparedStatement(preparedStmtList,tenantIds); - } - } - else - { - String tenantId = criteria.getTenantId(); - if (tenantId != null) { - if (tenantId.equalsIgnoreCase(config.getStateLevelTenantId())) { - addClauseIfRequired(preparedStmtList,builder); - builder.append(" property.tenantId LIKE ? "); - preparedStmtList.add(tenantId + '%'); - } else { - addClauseIfRequired(preparedStmtList,builder); - builder.append(" property.tenantId= ? "); - preparedStmtList.add(tenantId); - } + addToPreparedStatement(preparedStmtList, tenantIds); } + } else if (criteria.getTenantId() != null) { + appendTenantIdToQuery(preparedStmtList, criteria.getTenantId(), builder, "property"); } - if (criteria.getFromDate() != null) - { - addClauseIfRequired(preparedStmtList,builder); - // If user does NOT specify toDate, take today's date as the toDate by default + + if (criteria.getFromDate() != null) { + + addClauseIfRequired(preparedStmtList, builder); + /* + * If user does NOT specify toDate, take today's date as the toDate by default + */ if (criteria.getToDate() == null) - { criteria.setToDate(Instant.now().toEpochMilli()); - } builder.append("property.createdTime BETWEEN ? AND ?"); preparedStmtList.add(criteria.getFromDate()); preparedStmtList.add(criteria.getToDate()); - } - else - { - if(criteria.getToDate()!=null) - { - throw new CustomException("INVALID SEARCH", "From Date should be mentioned first"); - } + } else if (criteria.getToDate() != null) { + throw new CustomException("INVALID SEARCH", "From Date should be mentioned first"); } Set propertyIds = criteria.getPropertyIds(); @@ -437,18 +421,7 @@ public String getPropertyIdsQuery(Set ownerIds, String tenantId, List preparedStmtList, Set i preparedStmtList.add(id); }); } - + private void addToPreparedStatementWithUpperCase(List preparedStmtList, Set ids) { ids.forEach(id -> { preparedStmtList.add(id.toUpperCase()); @@ -486,11 +459,10 @@ private static void addClauseIfRequired(List values,StringBuilder queryS public String getpropertyAuditQuery() { return PROEPRTY_AUDIT_QUERY; } - - public String getTotalApplicationsCountQueryString(PropertyCriteria criteria, List preparedStatement) { - preparedStatement.add(criteria.getTenantId()); - return TOTAL_APPLICATIONS_COUNT_QUERY; - } + + public String getTotalApplicationsCountQueryString(PropertyCriteria criteria) { + return TOTAL_APPLICATIONS_COUNT_QUERY.replace("{}",criteria.getTenantId()); + } public String getLastExecutionDetail(PropertyCriteria criteria, List preparedStatement) { preparedStatement.add(criteria.getTenantId()); @@ -500,5 +472,4 @@ public String getLastExecutionDetail(PropertyCriteria criteria, List pre public String getpropertyAuditEncQuery() { return PROPERTY_AUDIT_ENC_QUERY; } - } diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/repository/rowmapper/OpenPropertyRowMapper.java b/municipal-services/property-services/src/main/java/org/egov/pt/repository/rowmapper/OpenPropertyRowMapper.java index b85c407db67..4fba1e4242c 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/repository/rowmapper/OpenPropertyRowMapper.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/repository/rowmapper/OpenPropertyRowMapper.java @@ -45,7 +45,6 @@ public List extractData(ResultSet rs) throws SQLException, DataAccessE .auditDetails(auditdetails) .build(); - setPropertyInfo(currentProperty, rs, tenanId, propertyUuId, address); addChildrenToProperty(rs, currentProperty); propertyMap.put(propertyUuId, currentProperty); diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/repository/rowmapper/PropertyRowMapper.java b/municipal-services/property-services/src/main/java/org/egov/pt/repository/rowmapper/PropertyRowMapper.java index 54a7a679791..5e8eda0e1d8 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/repository/rowmapper/PropertyRowMapper.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/repository/rowmapper/PropertyRowMapper.java @@ -83,7 +83,7 @@ public List extractData(ResultSet rs) throws SQLException, DataAccessE String linkIdString = rs.getString("linkedProperties"); if (!StringUtils.isEmpty(linkIdString)) linkedProperties = Arrays.asList(linkIdString.split(",")); - + currentProperty = Property.builder() .source(org.egov.pt.models.enums.Source.fromValue(rs.getString("source"))) .creationReason(CreationReason.fromValue(rs.getString("creationReason"))) @@ -101,7 +101,6 @@ public List extractData(ResultSet rs) throws SQLException, DataAccessE .build(); - setPropertyInfo(currentProperty, rs, tenanId, propertyUuId, linkedProperties, address); addChildrenToProperty(rs, currentProperty); propertyMap.put(propertyUuId, currentProperty); } diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/service/AssessmentNotificationService.java b/municipal-services/property-services/src/main/java/org/egov/pt/service/AssessmentNotificationService.java index cc771fb7a39..0736de6fb42 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/service/AssessmentNotificationService.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/service/AssessmentNotificationService.java @@ -1,8 +1,14 @@ package org.egov.pt.service; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + import lombok.extern.slf4j.Slf4j; +import org.apache.http.client.utils.URIBuilder; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.pt.config.PropertyConfiguration; import org.egov.pt.models.Assessment; import org.egov.pt.models.Property; @@ -36,17 +42,21 @@ public class AssessmentNotificationService { private PropertyService propertyService; private PropertyConfiguration config; - + private BillingService billingService; + private MultiStateInstanceUtil centralInstanceUtil; + private UnmaskingUtil unmaskingUtil; @Autowired - public AssessmentNotificationService(NotificationUtil util, PropertyService propertyService, PropertyConfiguration config,BillingService billingService,UnmaskingUtil unmaskingUtil ) { + public AssessmentNotificationService(NotificationUtil util, PropertyService propertyService, PropertyConfiguration config,BillingService billingService, MultiStateInstanceUtil centralInstanceUtil, UnmaskingUtil unmaskingUtil) { + this.util = util; this.propertyService = propertyService; this.config = config; this.billingService = billingService; + this.centralInstanceUtil = centralInstanceUtil; this.unmaskingUtil = unmaskingUtil; } @@ -57,9 +67,9 @@ public void process(String topicName, AssessmentRequest assessmentRequest){ String tenantId = assessment.getTenantId(); PropertyCriteria criteria = PropertyCriteria.builder().tenantId(tenantId) - .propertyIds(Collections.singleton(assessment.getPropertyId())) - .isSearchInternal(Boolean.TRUE) - .build(); + .propertyIds(Collections.singleton(assessment.getPropertyId())) + .isSearchInternal(Boolean.TRUE) + .build(); List properties = propertyService.searchProperty(criteria, requestInfo); @@ -77,7 +87,7 @@ public void process(String topicName, AssessmentRequest assessmentRequest){ List smsRequests = enrichSMSRequest(topicName, assessmentRequest, property); if(configuredChannelNamesForAssessment.contains(CHANNEL_NAME_SMS)) { - util.sendSMS(smsRequests); + util.sendSMS(smsRequests, tenantId); } if(configuredChannelNamesForAssessment.contains(CHANNEL_NAME_EVENT)) { @@ -86,12 +96,12 @@ public void process(String topicName, AssessmentRequest assessmentRequest){ isActionReq = true; List events = util.enrichEvent(smsRequests, requestInfo, tenantId, property, isActionReq); - util.sendEventNotification(new EventRequest(requestInfo, events)); + util.sendEventNotification(new EventRequest(requestInfo, events), tenantId); } if(configuredChannelNamesForAssessment.contains(CHANNEL_NAME_EMAIL) ){ List emailRequests = util.createEmailRequestFromSMSRequests(requestInfo,smsRequests,tenantId); - util.sendEmail(emailRequests); + util.sendEmail(emailRequests, tenantId); } if (dueAmount!=null && dueAmount.compareTo(BigDecimal.ZERO)>0) { @@ -101,42 +111,43 @@ public void process(String topicName, AssessmentRequest assessmentRequest){ enrichSMSRequestForDues(smsRequestsList, assessmentRequest, property); if(configuredChannelNames.contains(CHANNEL_NAME_SMS)) { - util.sendSMS(smsRequestsList); + util.sendSMS(smsRequestsList, tenantId); } if(configuredChannelNames.contains(CHANNEL_NAME_EVENT)) { Boolean isActionRequired = true; List eventsList = util.enrichEvent(smsRequestsList, requestInfo, tenantId, property, isActionRequired); - util.sendEventNotification(new EventRequest(requestInfo, eventsList)); + util.sendEventNotification(new EventRequest(requestInfo, eventsList), tenantId); } if(configuredChannelNames.contains(CHANNEL_NAME_EMAIL) ){ List emailRequests = util.createEmailRequestFromSMSRequests(requestInfo,smsRequests,tenantId); - util.sendEmail(emailRequests); - } + util.sendEmail(emailRequests, tenantId); } + } } private void enrichSMSRequestForDues(List smsRequests, AssessmentRequest assessmentRequest, - Property property) { - - String tenantId = assessmentRequest.getAssessment().getTenantId(); - String localizationMessages = util.getLocalizationMessages(tenantId,assessmentRequest.getRequestInfo()); - - String messageTemplate = util.getMessageTemplate(DUES_NOTIFICATION, localizationMessages); - - if(messageTemplate.contains(NOTIFICATION_PROPERTYID)) + Property property) { + + String tenantId = assessmentRequest.getAssessment().getTenantId(); + String stateLevelTenantId = centralInstanceUtil.getStateLevelTenant(tenantId); + String localizationMessages = util.getLocalizationMessages(tenantId,assessmentRequest.getRequestInfo()); + + String messageTemplate = util.getMessageTemplate(DUES_NOTIFICATION, localizationMessages); + + if(messageTemplate.contains(NOTIFICATION_PROPERTYID)) messageTemplate = messageTemplate.replace(NOTIFICATION_PROPERTYID, property.getPropertyId()); if(messageTemplate.contains(NOTIFICATION_FINANCIALYEAR)) messageTemplate = messageTemplate.replace(NOTIFICATION_FINANCIALYEAR, assessmentRequest.getAssessment().getFinancialYear()); - + if(messageTemplate.contains(NOTIFICATION_PAYMENT_LINK)){ - String UIHost = config.getUiAppHost(); + String UIHost = config.getUiAppHostMap().get(stateLevelTenantId); String paymentPath = config.getPayLinkSMS(); paymentPath = paymentPath.replace("$consumercode",property.getPropertyId()); paymentPath = paymentPath.replace("$tenantId",property.getTenantId()); @@ -146,30 +157,30 @@ private void enrichSMSRequestForDues(List smsRequests, AssessmentReq messageTemplate = messageTemplate.replace(NOTIFICATION_PAYMENT_LINK,util.getShortenedUrl(finalPath)); } - + Map mobileNumberToOwner = new HashMap<>(); property.getOwners().forEach(owner -> { if(owner.getMobileNumber()!=null) mobileNumberToOwner.put(owner.getMobileNumber(),owner.getName()); if(owner.getAlternatemobilenumber() !=null && !owner.getAlternatemobilenumber().equalsIgnoreCase(owner.getMobileNumber()) ) { - mobileNumberToOwner.put(owner.getAlternatemobilenumber() ,owner.getName()); + mobileNumberToOwner.put(owner.getAlternatemobilenumber() ,owner.getName()); } }); - + List smsRequestsForDues = util.createSMSRequest(messageTemplate,mobileNumberToOwner); - + smsRequests.addAll(smsRequestsForDues); - - - } - /** + + } + + /** * Enriches the smsRequest with the customized messages * @param request The tradeLicenseRequest from kafka topic * @param smsRequests List of SMSRequets */ private List enrichSMSRequest(String topicName, AssessmentRequest request, Property property){ - + String tenantId = request.getAssessment().getTenantId(); String localizationMessages = util.getLocalizationMessages(tenantId,request.getRequestInfo()); String message = getCustomizedMsg(topicName, request, property, localizationMessages); @@ -181,7 +192,7 @@ private List enrichSMSRequest(String topicName, AssessmentRequest re if(owner.getMobileNumber()!=null) mobileNumberToOwner.put(owner.getMobileNumber(),owner.getName()); if(owner.getAlternatemobilenumber() !=null && !owner.getAlternatemobilenumber().equalsIgnoreCase(owner.getMobileNumber()) ) { - mobileNumberToOwner.put(owner.getAlternatemobilenumber() ,owner.getName()); + mobileNumberToOwner.put(owner.getAlternatemobilenumber() ,owner.getName()); } }); return util.createSMSRequest(message,mobileNumberToOwner); @@ -233,6 +244,7 @@ private String getCustomizedMsg(String topicName, AssessmentRequest request, Pro private String customize(Assessment assessment, Property property, String msgCode, String localizationMessages){ String messageTemplate = util.getMessageTemplate(msgCode, localizationMessages); + String stateLevelTenantId = centralInstanceUtil.getStateLevelTenant(property.getTenantId()); if(messageTemplate.contains(NOTIFICATION_ASSESSMENTNUMBER)) messageTemplate = messageTemplate.replace(NOTIFICATION_ASSESSMENTNUMBER, assessment.getAssessmentNumber()); @@ -251,7 +263,7 @@ private String customize(Assessment assessment, Property property, String msgCod if(messageTemplate.contains(NOTIFICATION_PAYMENT_LINK)){ - String UIHost = config.getUiAppHost(); + String UIHost = config.getUiAppHostMap().get(stateLevelTenantId); String paymentPath = config.getPayLinkSMS(); paymentPath = paymentPath.replace("$consumercode",property.getPropertyId()); paymentPath = paymentPath.replace("$tenantId",property.getTenantId()); diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/service/AssessmentService.java b/municipal-services/property-services/src/main/java/org/egov/pt/service/AssessmentService.java index 735cd6a8651..2f1925485a2 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/service/AssessmentService.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/service/AssessmentService.java @@ -73,7 +73,8 @@ public AssessmentService(AssessmentValidator validator, PropertyProducer produce * @return */ public Assessment createAssessment(AssessmentRequest request) { - + + String tenantId = request.getAssessment().getTenantId(); Property property = utils.getPropertyForAssessment(request); validator.validateAssessmentCreate(request, property); assessmentEnrichmentService.enrichAssessmentCreate(request); @@ -88,7 +89,7 @@ public Assessment createAssessment(AssessmentRequest request) { else { calculationService.calculateTax(request, property); } - producer.push(props.getCreateAssessmentTopic(), request); + producer.push(tenantId, props.getCreateAssessmentTopic(), request); return request.getAssessment(); } @@ -102,6 +103,7 @@ public Assessment createAssessment(AssessmentRequest request) { */ public Assessment updateAssessment(AssessmentRequest request) { + String tenantId = request.getAssessment().getTenantId(); Assessment assessment = request.getAssessment(); RequestInfo requestInfo = request.getRequestInfo(); Property property = utils.getPropertyForAssessment(request); @@ -125,7 +127,7 @@ public Assessment updateAssessment(AssessmentRequest request) { assessmentEnrichmentService.enrichAssessmentUpdate(request, property); /* calculationService.getMutationFee(); - producer.push(topic1,request);*/ + producer.push(tenantId, topic1,request);*/ } ProcessInstanceRequest workflowRequest = new ProcessInstanceRequest(requestInfo, Collections.singletonList(assessment.getWorkflow())); State state = workflowService.callWorkFlow(workflowRequest); @@ -136,7 +138,7 @@ public Assessment updateAssessment(AssessmentRequest request) { if(assessment.getWorkflow().getState().getState().equalsIgnoreCase(config.getDemandTriggerState())) calculationService.calculateTax(request, property); - producer.push(props.getUpdateAssessmentTopic(), request); + producer.push(tenantId, props.getUpdateAssessmentTopic(), request); /* @@ -147,7 +149,7 @@ public Assessment updateAssessment(AssessmentRequest request) { * } * * else { - * producer.push(stateUpdateTopic, request); + * producer.push(tenantId, stateUpdateTopic, request); * * } * @@ -158,7 +160,7 @@ public Assessment updateAssessment(AssessmentRequest request) { } else if(!config.getIsAssessmentWorkflowEnabled()){ calculationService.calculateTax(request, property); - producer.push(props.getUpdateAssessmentTopic(), request); + producer.push(tenantId, props.getUpdateAssessmentTopic(), request); } return request.getAssessment(); } diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/service/FuzzySearchService.java b/municipal-services/property-services/src/main/java/org/egov/pt/service/FuzzySearchService.java index b7f6323be0a..52d00a24ebc 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/service/FuzzySearchService.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/service/FuzzySearchService.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.JsonPath; import org.egov.common.contract.request.RequestInfo; +import org.egov.pt.config.PropertyConfiguration; import org.egov.pt.models.Property; import org.egov.pt.models.PropertyCriteria; import org.egov.pt.repository.ElasticSearchRepository; @@ -29,16 +30,21 @@ public class FuzzySearchService { private PropertyRepository propertyRepository; + private PropertyConfiguration config; + @Autowired - public FuzzySearchService(ElasticSearchRepository elasticSearchRepository, ObjectMapper mapper, PropertyRepository repository) { + public FuzzySearchService(ElasticSearchRepository elasticSearchRepository, ObjectMapper mapper, PropertyRepository repository,PropertyConfiguration config) { this.elasticSearchRepository = elasticSearchRepository; this.mapper = mapper; this.propertyRepository = repository; + this.config=config; } public List getProperties(RequestInfo requestInfo, PropertyCriteria criteria) { + if(criteria.getTenantId() == null) + { criteria.setTenantId(config.getStateLevelTenantId()); } List idsFromDB = propertyRepository.getPropertyIds(criteria); diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/service/MigrationService.java b/municipal-services/property-services/src/main/java/org/egov/pt/service/MigrationService.java index 6d75430b234..2d2e5c657ff 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/service/MigrationService.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/service/MigrationService.java @@ -1,11 +1,9 @@ package org.egov.pt.service; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.jayway.jsonpath.JsonPath; -import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.egov.common.contract.request.RequestInfo; import org.egov.mdms.model.MasterDetail; @@ -19,22 +17,18 @@ import org.egov.pt.models.enums.*; import org.egov.pt.models.oldProperty.*; //import org.egov.pt.models.oldProperty.PropertyCriteria; -import org.egov.pt.models.user.UserDetailResponse; import org.egov.pt.models.user.UserSearchRequest; import org.egov.pt.producer.PropertyProducer; import org.egov.pt.repository.AssessmentRepository; import org.egov.pt.repository.ServiceRequestRepository; -import org.egov.pt.repository.builder.OldPropertyQueryBuilder; -import org.egov.pt.repository.builder.PropertyQueryBuilder; +import org.egov.pt.repository.builder.OldPropertyQueryBulider; import org.egov.pt.repository.rowmapper.MigrationCountRowMapper; import org.egov.pt.repository.rowmapper.OldPropertyRowMapper; -import org.egov.pt.repository.rowmapper.PropertyRowMapper; import org.egov.pt.util.AssessmentUtils; import org.egov.pt.util.ErrorConstants; import org.egov.pt.util.PTConstants; import org.egov.pt.validator.AssessmentValidator; import org.egov.pt.validator.PropertyMigrationValidator; -import org.egov.pt.validator.PropertyValidator; import org.egov.pt.web.contracts.*; import org.egov.pt.web.contracts.RequestInfoWrapper; import org.egov.tracer.model.CustomException; @@ -47,7 +41,6 @@ import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.ResourceAccessException; import org.springframework.web.client.RestTemplate; import java.math.BigDecimal; @@ -87,7 +80,7 @@ public class MigrationService { private RestTemplate restTemplate; @Autowired - private OldPropertyQueryBuilder queryBuilder; + private OldPropertyQueryBulider queryBuilder; @Autowired private JdbcTemplate jdbcTemplate; @@ -230,7 +223,7 @@ public Map initiatemigration(RequestInfoWrapper requestInfoWrapp migrationCount.setTenantid(propertyCriteria.getTenantId()); migrationCount.setRecordCount(Long.valueOf(startBatch+batchSizeInput)); PropertyMigrationCountRequest request = PropertyMigrationCountRequest.builder().requestInfo(requestInfo).migrationCount(migrationCount).build(); - producer.push(config.getMigartionBatchCountTopic(), request); + producer.push("",config.getMigartionBatchCountTopic(), request); startBatch = startBatch+batchSizeInput; propertyCriteria.setOffset(Long.valueOf(startBatch)); @@ -255,16 +248,12 @@ private void addResponseToMap(List properties, Map res /*public List searchOldPropertyFromURL(org.egov.pt.web.contracts.RequestInfoWrapper requestInfoWrapper,String tenantId,int i,Integer batchSize){ - - StringBuilder url = new StringBuilder(ptHost).append(oldPropertySearchEndpoint).append(URL_PARAMS_SEPARATER) .append(TENANT_ID_FIELD_FOR_SEARCH_URL).append(tenantId) .append(SEPARATER).append(OFFSET_FIELD_FOR_SEARCH_URL) .append(i).append(SEPARATER) .append(LIMIT_FIELD_FOR_SEARCH_URL).append(batchSize); OldPropertyResponse res = mapper.convertValue(fetchResult(url, requestInfoWrapper), OldPropertyResponse.class); - - return res.getProperties(); }*/ @@ -565,7 +554,7 @@ public int compare(PropertyDetail pd1, PropertyDetail pd2) { log.error("Error while migrating prperty data of " + property.getPropertyId(), e); } - producer.push(config.getSavePropertyTopic(), request); + producer.push("",config.getSavePropertyTopic(), request); properties.add(property); @@ -921,7 +910,7 @@ public void migrateAssesment(PropertyDetail propertyDetail, Property property, R errorMap.put(assessment.getAssessmentNumber(), String.valueOf(e)); } //assessmentRequestList.add(request); - producer.push(config.getCreateAssessmentTopic(), request); + producer.push("",config.getCreateAssessmentTopic(), request); } public Map addAssessmentPenaltyandRebate(Map assessmentAdditionalDetail,PropertyDetail propertyDetail){ @@ -993,7 +982,7 @@ private Map> fetchMaster(RequestInfo requestInfo, String te */ public Map> getAttributeValues(String tenantId, String moduleName, List names, String filter,String jsonpath, RequestInfo requestInfo){ - StringBuilder uri = new StringBuilder(config.getMdmsHost()).append(config.getMdmsEndpoint()); + StringBuilder uri = new StringBuilder(config.getMdmsHost()).append(config.getMdmsEndPoint()); MdmsCriteriaReq criteriaReq = prepareMdMsRequest(tenantId,moduleName,names,filter,requestInfo); Optional response = restRepo.fetchResult(uri, criteriaReq); @@ -1079,7 +1068,7 @@ private void validateMDMSData(String[] masterNames,Map> code public void sendDataToAssessmentCreateTopic(List assessmentRequestList){ for(AssessmentRequest assessmentRequest: assessmentRequestList) - producer.push(config.getCreateAssessmentTopic(), assessmentRequest); + producer.push("",config.getCreateAssessmentTopic(), assessmentRequest); } public Object propertyfetchResult(StringBuilder uri, Object request) { diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/service/NotificationService.java b/municipal-services/property-services/src/main/java/org/egov/pt/service/NotificationService.java index f9412e1267e..ef31080783f 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/service/NotificationService.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/service/NotificationService.java @@ -1,7 +1,13 @@ package org.egov.pt.service; import java.math.BigDecimal; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; import com.jayway.jsonpath.Filter; @@ -30,6 +36,11 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.springframework.web.client.RestTemplate; + +import com.jayway.jsonpath.JsonPath; + +import lombok.extern.slf4j.Slf4j; import static org.egov.pt.util.PTConstants.*; import lombok.extern.slf4j.Slf4j; @@ -161,7 +172,7 @@ public void sendNotificationForUpdate(PropertyRequest propertyRequest) { private String getMsgForUpdate(Property property, String msgCode, String completeMsgs, String createUpdateReplaceString) { String url = notifUtil.getShortenedUrl( - configs.getUiAppHost().concat(configs.getViewPropertyLink() + notifUtil.getHost(property.getTenantId()).concat(configs.getViewPropertyLink() .replace(NOTIFICATION_PROPERTYID, property.getPropertyId()) .replace(NOTIFICATION_TENANTID, property.getTenantId()))); @@ -187,6 +198,36 @@ private String getMsgForMutation (Property property, String CompleteMsgs, String return notifUtil.getMessageTemplate(statusCode, CompleteMsgs).replace(urlCode, url); } + /** + * Prepares and return url for mutation view screen + * + * @param property + * @return + */ + private String getMutationUrl(Property property) { + + return notifUtil.getShortenedUrl( + notifUtil.getHost(property.getTenantId()).concat(configs.getViewMutationLink() + .replace(NOTIFICATION_APPID, property.getAcknowldgementNumber()) + .replace(NOTIFICATION_TENANTID, property.getTenantId()))); + } + + /** + * Prepares and return url for property view screen + * + * @param property + * @return + */ + private String getPayUrl(Property property) { + + return notifUtil.getShortenedUrl(notifUtil.getHost(property.getTenantId()) + .concat(configs.getPayLink() + .replace(EVENT_PAY_BUSINESSSERVICE, MUTATION_BUSINESSSERVICE) + .replace(EVENT_PAY_PROPERTYID, property.getAcknowldgementNumber()) + .replace(EVENT_PAY_TENANTID, property.getTenantId()))); + } + + /** * replaces common variable for all messages * @@ -294,28 +335,34 @@ private void prepareMsgAndSend(PropertyRequest request, String msg, String state if (owner.getMobileNumber() != null) mobileNumberToOwner.put(owner.getMobileNumber(), owner.getName()); mobileNumbers.add(owner.getMobileNumber()); - }); - + }); //EMAIL block TBD +// Map mapOfPhnoAndEmail = notifUtil.fetchUserEmailIds(mobileNumbers, requestInfo, tenantId); +// String messageTemplate = fetchContentFromLocalization(request.getRequestInfo(), tenantId, "rainmaker-pt", "PT_NOTIFICATION_EMAIL"); +// messageTemplate = messageTemplate.replace("{MESSAGE}",msg); +// messageTemplate = messageTemplate.replace(NOTIFICATION_OWNERNAME,NOTIFICATION_EMAIL); List smsRequests = notifUtil.createSMSRequest(msg, mobileNumberToOwner); + notifUtil.sendSMS(smsRequests, property.getTenantId()); if(configuredChannelNames.contains(CHANNEL_NAME_SMS)){ - notifUtil.sendSMS(smsRequests); - + notifUtil.sendSMS(smsRequests, tenantId); + } + if(configuredChannelNames.contains(CHANNEL_NAME_EVENT)){ Boolean isActionReq = false; if(state.equalsIgnoreCase(PT_CORRECTION_PENDING)) isActionReq = true; List events = notifUtil.enrichEvent(smsRequests, requestInfo, property.getTenantId(), property, isActionReq); - notifUtil.sendEventNotification(new EventRequest(requestInfo, events)); + notifUtil.sendEventNotification(new EventRequest(requestInfo, events), tenantId); } if(configuredChannelNames.contains(CHANNEL_NAME_EMAIL)){ List emailRequests = notifUtil.createEmailRequestFromSMSRequests(requestInfo,smsRequests, tenantId); - notifUtil.sendEmail(emailRequests); + notifUtil.sendEmail(emailRequests, tenantId); } } - private String fetchContentFromLocalization(RequestInfo requestInfo, String tenantId, String module, String code){ + private String fetchContentFromLocalization(RequestInfo requestInfo, String tenantId, String module, String code) { + String message = null; List codes = new ArrayList<>(); List messages = new ArrayList<>(); @@ -381,6 +428,7 @@ private void prepareMsgAndSendToBothNumbers(PropertyRequest request, Property pr String msg, Map uuidToMobileNumber) { Property property = request.getProperty(); + String tenantId = property.getTenantId(); RequestInfo requestInfo = request.getRequestInfo(); List configuredChannelNames = notifUtil.fetchChannelList(requestInfo, request.getProperty().getTenantId(), PTConstants.PT_BUSINESSSERVICE, ACTION_UPDATE_MOBILE); Set mobileNumbers = new HashSet<>(); @@ -399,20 +447,20 @@ private void prepareMsgAndSendToBothNumbers(PropertyRequest request, Property pr if(configuredChannelNames.contains(CHANNEL_NAME_SMS)) { List smsRequests = notifUtil.createSMSRequest(customizedMsg, mobileNumberToOwner); - notifUtil.sendSMS(smsRequests); + notifUtil.sendSMS(smsRequests, tenantId); } if(configuredChannelNames.contains(CHANNEL_NAME_EVENT)) { Boolean isActionReq = true; List smsRequests = notifUtil.createSMSRequest(customizedMsg, mobileNumberToOwner); List events = notifUtil.enrichEvent(smsRequests, requestInfo, property.getTenantId(), property, isActionReq); - notifUtil.sendEventNotification(new EventRequest(requestInfo, events)); + notifUtil.sendEventNotification(new EventRequest(requestInfo, events), tenantId); } if(configuredChannelNames.contains(CHANNEL_NAME_EMAIL)) { Map mapOfPhnoAndEmail = notifUtil.fetchUserEmailIds(mobileNumbers, requestInfo, request.getProperty().getTenantId()); List emailRequests = notifUtil.createEmailRequest(requestInfo, customizedMsg, mapOfPhnoAndEmail); - notifUtil.sendEmail(emailRequests); + notifUtil.sendEmail(emailRequests, tenantId); } } }); @@ -436,6 +484,7 @@ private void prepareMsgAndSendToAlternateNumber(PropertyRequest request, Propert Map uuidToAlternateMobileNumber) { Property property = request.getProperty(); + String tenantId = property.getTenantId(); RequestInfo requestInfo = request.getRequestInfo(); List configuredChannelNames = notifUtil.fetchChannelList(request.getRequestInfo(), request.getProperty().getTenantId(), PTConstants.PT_BUSINESSSERVICE, PTConstants.ACTION_ALTERNATE_MOBILE); Set mobileNumbers = new HashSet<>(); @@ -451,20 +500,20 @@ private void prepareMsgAndSendToAlternateNumber(PropertyRequest request, Propert if(configuredChannelNames.contains(CHANNEL_NAME_SMS)) { List smsRequests = notifUtil.createSMSRequest(customizedMsg, mobileNumberToOwner); - notifUtil.sendSMS(smsRequests); + notifUtil.sendSMS(smsRequests, tenantId); } if(configuredChannelNames.contains(CHANNEL_NAME_EVENT)) { Boolean isActionReq = true; List smsRequests = notifUtil.createSMSRequest(customizedMsgForApp, mobileNumberToOwner); List events = notifUtil.enrichEvent(smsRequests, requestInfo, property.getTenantId(), property, isActionReq); - notifUtil.sendEventNotification(new EventRequest(requestInfo, events)); + notifUtil.sendEventNotification(new EventRequest(requestInfo, events), tenantId); } if(configuredChannelNames.contains(CHANNEL_NAME_EMAIL)) { Map mapOfPhnoAndEmail = notifUtil.fetchUserEmailIds(mobileNumbers, requestInfo, request.getProperty().getTenantId()); List emailRequests = notifUtil.createEmailRequest(requestInfo, customizedMsg, mapOfPhnoAndEmail); - notifUtil.sendEmail(emailRequests); + notifUtil.sendEmail(emailRequests, tenantId); } } }); @@ -493,7 +542,7 @@ private void sendNotificationForCitizenFeedback(Property property, String locali }); List smsRequests = notifUtil.createSMSRequest(citizenFeedackMessage, mobileNumberToOwner); - notifUtil.sendSMS(smsRequests); + notifUtil.sendSMS(smsRequests, property.getTenantId()); } diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/service/PaymentNotificationService.java b/municipal-services/property-services/src/main/java/org/egov/pt/service/PaymentNotificationService.java index d9441aa3d1a..72753d185d5 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/service/PaymentNotificationService.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/service/PaymentNotificationService.java @@ -1,5 +1,27 @@ package org.egov.pt.service; +import static org.egov.pt.util.PTConstants.ACTION_FOR_PAYMENT_FAILURE; +import static org.egov.pt.util.PTConstants.ACTION_PAID; +import static org.egov.pt.util.PTConstants.CHANNEL_NAME_EMAIL; +import static org.egov.pt.util.PTConstants.CHANNEL_NAME_EVENT; +import static org.egov.pt.util.PTConstants.CHANNEL_NAME_SMS; +import static org.egov.pt.util.PTConstants.DOWNLOAD_MUTATION_RECEIPT_CODE; +import static org.egov.pt.util.PTConstants.MUTATION_BUSINESSSERVICE; +import static org.egov.pt.util.PTConstants.MUTATION_PROCESS_CONSTANT; +import static org.egov.pt.util.PTConstants.NOTIFICATION_OLDPROPERTYID_ABSENT; +import static org.egov.pt.util.PTConstants.NOTIFICATION_PAYMENT_FAIL; +import static org.egov.pt.util.PTConstants.NOTIFICATION_PAYMENT_OFFLINE; +import static org.egov.pt.util.PTConstants.NOTIFICATION_PAYMENT_ONLINE; +import static org.egov.pt.util.PTConstants.NOTIFICATION_PAYMENT_PARTIAL_OFFLINE; +import static org.egov.pt.util.PTConstants.NOTIFICATION_PAYMENT_PARTIAL_ONLINE; +import static org.egov.pt.util.PTConstants.ONLINE_PAYMENT_MODE; +import static org.egov.pt.util.PTConstants.PAY_PENDING_PAYMENT_CODE; +import static org.egov.pt.util.PTConstants.PT_BUSINESSSERVICE; +import static org.egov.pt.util.PTConstants.PT_TAX_FAIL; +import static org.egov.pt.util.PTConstants.PT_TAX_FULL; +import static org.egov.pt.util.PTConstants.PT_TAX_PARTIAL; +import static org.egov.pt.util.PTConstants.TENANTID_MDC_STRING; + import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collections; @@ -32,10 +54,12 @@ import org.egov.pt.web.contracts.EmailRequest; import org.egov.pt.web.contracts.SMSRequest; import org.egov.tracer.model.CustomException; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.springframework.web.client.RestTemplate; import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.JsonPath; @@ -101,6 +125,9 @@ public void processTransaction(HashMap record, String topic){ Transaction transaction = transactionRequest.getTransaction(); String tenantId = transaction.getTenantId(); + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + if(transaction.getTxnStatus().equals(Transaction.TxnStatusEnum.FAILURE)){ String localizationMessages = util.getLocalizationMessages(tenantId,requestInfo); @@ -147,20 +174,20 @@ public void processTransaction(HashMap record, String topic){ } if(configuredChannelNames.contains(CHANNEL_NAME_SMS)) { - util.sendSMS(smsRequests); + util.sendSMS(smsRequests, tenantId); } if(configuredChannelNames.contains(CHANNEL_NAME_EVENT)) { List events = new LinkedList<>(); if (null == propertyConfiguration.getIsUserEventsNotificationEnabled() || propertyConfiguration.getIsUserEventsNotificationEnabled()) { events.addAll(getEvents(smsRequests, requestInfo, property, false,valMap)); - util.sendEventNotification(new EventRequest(requestInfo, events)); + util.sendEventNotification(new EventRequest(requestInfo, events), tenantId); } } if(configuredChannelNames.contains(CHANNEL_NAME_EMAIL)) { List emailRequests = util.createEmailRequestFromSMSRequests(requestInfo,smsRequests,tenantId); - util.sendEmail(emailRequests); + util.sendEmail(emailRequests, tenantId); } } else return; @@ -191,6 +218,9 @@ public void processPaymentTopic(HashMap record, String topic){ String transactionNumber = paymentRequest.getPayment().getTransactionNumber(); List configuredChannelNames = util.fetchChannelList(requestInfo, tenantId, PT_BUSINESSSERVICE, ACTION_PAID); + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + List ptPaymentDetails = new LinkedList<>(); paymentDetails.forEach(paymentDetail -> { @@ -259,18 +289,19 @@ public void processPaymentTopic(HashMap record, String topic){ } } + if(configuredChannelNames.contains(CHANNEL_NAME_SMS)) { - util.sendSMS(smsRequests); + util.sendSMS(smsRequests, tenantId); } if(configuredChannelNames.contains(CHANNEL_NAME_EVENT)) { if (!CollectionUtils.isEmpty(events)) - util.sendEventNotification(new EventRequest(requestInfo, events)); + util.sendEventNotification(new EventRequest(requestInfo, events), tenantId); } if(configuredChannelNames.contains(CHANNEL_NAME_EMAIL)) { List emailRequests = util.createEmailRequestFromSMSRequests(requestInfo,smsRequests,tenantId); - util.sendEmail(emailRequests); + util.sendEmail(emailRequests, tenantId); } } @@ -429,7 +460,7 @@ private String getCustomizedMessage(Map valMap,String message,Str } private String getReceiptLink(Map valMap,String mobileNumber){ - StringBuilder builder = new StringBuilder(propertyConfiguration.getUiAppHost()); + StringBuilder builder = new StringBuilder(util.getHost(valMap.get("tenantId"))); builder.append(propertyConfiguration.getReceiptDownloadLink()); String link = builder.toString(); link = link.replace("$consumerCode", valMap.get("propertyId")); @@ -441,8 +472,9 @@ private String getReceiptLink(Map valMap,String mobileNumber){ return link; } - private String getReceiptLinkForInApp(Map valMap,String mobileNumber, String businessService){ - StringBuilder builder = new StringBuilder(propertyConfiguration.getUiAppHost()); + private String getReceiptLinkForInApp(Map valMap,String mobileNumber, String businessService, String tenantId){ + + StringBuilder builder = new StringBuilder(propertyConfiguration.getUiAppHostMap().get(tenantId)); builder.append(propertyConfiguration.getUserEventReceiptDownloadLink()); String link = builder.toString(); link = link.replace("$consumerCode", valMap.get("propertyId")); @@ -464,6 +496,7 @@ private String getCustomizedOnlinePaymentMessage(String message,Map",valMap.get("financialYear")); return message; } @@ -479,6 +512,7 @@ private String getCustomizedOfflinePaymentMessage(String message,Map",valMap.get("financialYear")); return message; } @@ -492,6 +526,7 @@ private String getCustomizedPaymentFailMessage(String message,Map message = message.replace("{insert amount to pay}",valMap.get("txnAmount")); message = message.replace("{insert ID}",valMap.get("propertyId")); // message = message.replace("{FY}",valMap.get("financialYear")); +// message = message.replace("",valMap.get("financialYear")); return message; } @@ -543,7 +578,7 @@ private SMSRequest getSMSRequestsWithoutReceipt(String mobileNumber, String cust String finalMessage = customizedMessage.replace("$mobile", mobileNumber); if (customizedMessage.contains("{receipt download link}")) { - finalMessage = finalMessage.replace("Click on the link to download payment receipt getEvents(List smsRequests, RequestInfo requestIn Set mobileNumbers = smsRequests.stream().map(SMSRequest::getMobileNumber).collect(Collectors.toSet()); String customizedMessage = smsRequests.get(0).getMessage(); + String tenantId = property.getTenantId(); Map mapOfPhnoAndUUIDs = util.fetchUserUUIDs(mobileNumbers,requestInfo, property.getTenantId()); + if (CollectionUtils.isEmpty(mapOfPhnoAndUUIDs.keySet()) || StringUtils.isEmpty(customizedMessage)) return null; List events = new ArrayList<>(); @@ -591,7 +628,8 @@ public List getEvents(List smsRequests, RequestInfo requestIn .replace("$tenantId", property.getTenantId()) .replace("$businessService" , businessService); - actionLink = propertyConfiguration.getUiAppHost() + actionLink; + actionLink = util.getHost(property.getTenantId()) + actionLink; + ActionItem item = ActionItem.builder().actionUrl(actionLink).code(PAY_PENDING_PAYMENT_CODE).build(); items.add(item); @@ -599,7 +637,7 @@ public List getEvents(List smsRequests, RequestInfo requestIn if(customizedMessage.contains("{receipt download link}")) { - String actionLink = getReceiptLinkForInApp(valMap, mobile,businessService); + String actionLink = getReceiptLinkForInApp(valMap, mobile, businessService, tenantId); ActionItem item = ActionItem.builder().actionUrl(actionLink).code(DOWNLOAD_MUTATION_RECEIPT_CODE).build(); items.add(item); } @@ -621,7 +659,7 @@ public List getEvents(List smsRequests, RequestInfo requestIn private String getPaymentLink(Map valMap){ - StringBuilder builder = new StringBuilder(propertyConfiguration.getUiAppHost()); + StringBuilder builder = new StringBuilder(util.getHost(valMap.get("tenantId"))); builder.append(propertyConfiguration.getPayLink()); String url = builder.toString(); url = url.replace("$propertyId", valMap.get("propertyId")); diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/service/PaymentUpdateService.java b/municipal-services/property-services/src/main/java/org/egov/pt/service/PaymentUpdateService.java index 8bf0649024e..8c88913d5f2 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/service/PaymentUpdateService.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/service/PaymentUpdateService.java @@ -20,6 +20,7 @@ import org.egov.pt.util.PropertyUtil; import org.egov.pt.web.contracts.PropertyRequest; import org.egov.tracer.model.CustomException; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -27,6 +28,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Sets; +import static org.egov.pt.util.PTConstants.TENANTID_MDC_STRING; + @Service @Slf4j public class PaymentUpdateService { @@ -67,6 +70,9 @@ public void process(HashMap record) { List paymentDetails = paymentRequest.getPayment().getPaymentDetails(); String tenantId = paymentRequest.getPayment().getTenantId(); + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + for (PaymentDetail paymentDetail : paymentDetails) { Boolean isModuleMutation = paymentDetail.getBusinessService().equalsIgnoreCase(config.getMutationWfName()); @@ -118,7 +124,7 @@ private void updateWorkflowForMutationPayment(RequestInfo requestInfo, String te property.setWorkflow(wfRequest.getProcessInstances().get(0)); property.getWorkflow().setState(state); updateRequest.getProperty().setStatus(Status.fromValue(state.getApplicationStatus())); - producer.push(config.getUpdatePropertyTopic(), updateRequest); + producer.push(tenantId, config.getUpdatePropertyTopic(), updateRequest); notifService.sendNotificationForMtPayment(updateRequest, bill.getTotalAmount()); }); } diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/service/PropertyEncryptionService.java b/municipal-services/property-services/src/main/java/org/egov/pt/service/PropertyEncryptionService.java index 6f7d5386f56..4f58f6bd890 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/service/PropertyEncryptionService.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/service/PropertyEncryptionService.java @@ -1,31 +1,25 @@ package org.egov.pt.service; -import com.jayway.jsonpath.JsonPath; -import lombok.extern.slf4j.Slf4j; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + import org.egov.common.contract.request.RequestInfo; -import org.egov.mdms.model.MasterDetail; -import org.egov.mdms.model.MdmsCriteria; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.egov.mdms.model.ModuleDetail; import org.egov.pt.config.PropertyConfiguration; -import org.egov.pt.models.EncryptionCount; import org.egov.pt.models.Property; import org.egov.pt.models.PropertyCriteria; -import org.egov.pt.models.PropertyAudit; import org.egov.pt.producer.PropertyProducer; import org.egov.pt.repository.PropertyRepository; -import org.egov.pt.repository.ServiceRequestRepository; -import org.egov.pt.util.*; +import org.egov.pt.util.EncryptionDecryptionUtil; import org.egov.pt.web.contracts.PropertyRequest; -import org.egov.pt.web.contracts.PropertyResponse; -import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; -import java.util.*; -import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; /* Encrypts Property Address data(street, doorNo, landmark) for existing records */ @Slf4j @@ -47,9 +41,6 @@ public class PropertyEncryptionService { @Autowired EncryptionDecryptionUtil encryptionDecryptionUtil; - @Autowired - private PropertyUtil propertyUtil; - @Value("${encryption.batch.value}") private Integer batchSize; @@ -58,9 +49,6 @@ public class PropertyEncryptionService { private Integer countPushed = 0; - @Autowired - private ServiceRequestRepository serviceRequestRepository; - /** * Initiates property data encryption * @@ -80,30 +68,14 @@ public List updateOldData(PropertyCriteria criteria, RequestInfo reque */ public List updateBatchCriteria(RequestInfo requestInfo, PropertyCriteria criteria) { List propertyList = new ArrayList<>(); - Set tenantIds = new HashSet<>(); - if (CollectionUtils.isEmpty(criteria.getTenantIds())) { - //mdms call for tenantIds in case tenantIds array is not sent in criteria - tenantIds = getAllTenantsFromMdms(requestInfo); - } else - tenantIds = criteria.getTenantIds(); - List finalPropertyList = new LinkedList<>(); - for (String tenantId : tenantIds) { - criteria.setTenantIds(Collections.singleton(tenantId)); - criteria.setTenantId(tenantId); - EncryptionCount encryptionCount = repository.getLastExecutionDetail(criteria); + if (StringUtils.isEmpty(criteria.getLimit())) + criteria.setLimit(Long.valueOf(batchSize)); - if (criteria.getLimit() == null) - criteria.setLimit(Long.valueOf(batchSize)); + if (StringUtils.isEmpty(criteria.getOffset())) + criteria.setOffset(Long.valueOf(batchOffset)); - if (encryptionCount.getRecordCount() != null) - criteria.setOffset(encryptionCount.getBatchOffset() + encryptionCount.getRecordCount()); - else if (criteria.getOffset() == null) - criteria.setOffset(Long.valueOf(batchOffset)); - - propertyList = initiateEncryption(requestInfo, criteria); - finalPropertyList.addAll(propertyList); - } - return finalPropertyList; + propertyList = initiateEncryption(requestInfo, criteria); + return propertyList; } /** @@ -117,13 +89,10 @@ public List initiateEncryption(RequestInfo requestInfo, PropertyCriter List finalPropertyList = new LinkedList<>(); Map responseMap = new HashMap<>(); - EncryptionCount encryptionCount; - Integer startBatch = Math.toIntExact(criteria.getOffset()); Integer batchSizeInput = Math.toIntExact(criteria.getLimit()); Integer count = repository.getTotalApplications(criteria); - Map map = new HashMap<>(); log.info("Count: " + count); log.info("startbatch: " + startBatch); @@ -131,54 +100,26 @@ public List initiateEncryption(RequestInfo requestInfo, PropertyCriter while (startBatch < count) { long startTime = System.nanoTime(); List propertyList = new LinkedList<>(); - List encryptedPropertyList = new LinkedList<>(); + propertyList = propertyService.searchPropertyPlainSearch(criteria, requestInfo); try { - propertyList = propertyService.searchPropertyPlainSearch(criteria, requestInfo); - countPushed = 0; - - PropertyResponse propertyResponse = new PropertyResponse(); for (Property property : propertyList) { /* encrypt here */ - property = encryptionDecryptionUtil.encryptObject(property, PTConstants.PROPERTY_MODEL, Property.class); - //search properties in audit table and encrypt them - encryptPropertyAuditData(requestInfo, property.getPropertyId()); + property = encryptionDecryptionUtil.encryptObject(property, "Property", Property.class); PropertyRequest request = PropertyRequest.builder() .requestInfo(requestInfo) .property(property) .build(); - - property.setAuditDetails(propertyUtil.getAuditDetails(requestInfo.getUserInfo().getUuid(), false)); - property.setOldDataEncryptionRequest(Boolean.TRUE); - /* Fix me up - * Duplicate proprtyids getting persisted in eg_pt_id_enc_audit table - * */ - producer.push(config.getUpdatePropertyEncTopic(), request); +//TODO FIXME check if enc works on multiinstance + producer.push(criteria.getTenantId(), config.getUpdatePropertyTopic(), request); countPushed++; - encryptedPropertyList.add(property); - map.put("message", "Encryption successfull till batchOffset : " + criteria.getOffset() + ". Records encrypted in current batch : " + countPushed - + ". Properties encrypted: " + (propertyList.stream().map(Property::getPropertyId)).collect(Collectors.toList())); + /* decrypt here */ + property = encryptionDecryptionUtil.decryptObject(property, "Property", Property.class, requestInfo); } } catch (Exception e) { - map.put("message", "Encryption failed at batchOffset : " + startBatch + " with message : " + e.getMessage() + ". Records encrypted in current batch : " + countPushed - + ". Properties encrypted: " + (propertyList.stream().map(Property::getPropertyId)).collect(Collectors.toList())); + log.error("Encryption failed at batch count of : " + startBatch); log.error("Encryption failed at batch count : " + startBatch + "=>" + e.getMessage()); - - encryptionCount = EncryptionCount.builder() - .tenantid(criteria.getTenantId()) - .limit(Long.valueOf(criteria.getLimit())) - .id(UUID.randomUUID().toString()) - .batchOffset(Long.valueOf(startBatch)) - .createdTime(System.currentTimeMillis()) - .recordCount(Long.valueOf(countPushed)) - .message(map.get("message")) - .encryptiontime(System.currentTimeMillis()) - .build(); - - producer.push(config.getEncryptionStatusTopic(), encryptionCount); - - finalPropertyList.addAll(encryptedPropertyList); return finalPropertyList; } @@ -187,23 +128,10 @@ public List initiateEncryption(RequestInfo requestInfo, PropertyCriter long elapsetime = endtime - startTime; log.debug("\n\nBatch elapsed time: " + elapsetime + "\n\n"); - encryptionCount = EncryptionCount.builder() - .tenantid(criteria.getTenantId()) - .limit(Long.valueOf(criteria.getLimit())) - .id(UUID.randomUUID().toString()) - .batchOffset(Long.valueOf(startBatch)) - .createdTime(System.currentTimeMillis()) - .recordCount(Long.valueOf(countPushed)) - .message(map.get("message")) - .encryptiontime(System.currentTimeMillis()) - .build(); - - producer.push(config.getEncryptionStatusTopic(), encryptionCount); - startBatch = startBatch + batchSizeInput; criteria.setOffset(Long.valueOf(startBatch)); log.info("Property Count pushed into kafka topic:" + countPushed); - finalPropertyList.addAll(encryptedPropertyList); + finalPropertyList.addAll(propertyList); } criteria.setOffset(Long.valueOf(batchOffset)); @@ -211,56 +139,4 @@ public List initiateEncryption(RequestInfo requestInfo, PropertyCriter } - /** - * @param requestInfo RequestInfo Object - * @return MdmsCriteria - */ - private Set getAllTenantsFromMdms(RequestInfo requestInfo) { - - String tenantId = (requestInfo.getUserInfo().getTenantId()); - List tenantsModuleMasters = new ArrayList<>(Arrays.asList("tenants")); - String jsonPath = PTConstants.TENANTS_JSONPATH_ROOT; - - MasterDetail mstrDetail = MasterDetail.builder().name(PTConstants.TENANTS_MASTER_ROOT) - .filter("$.*").build(); - ModuleDetail moduleDetail = ModuleDetail.builder().moduleName(PTConstants.TENANT_MASTER_MODULE) - .masterDetails(Arrays.asList(mstrDetail)).build(); - MdmsCriteria mdmsCriteria = MdmsCriteria.builder().moduleDetails(Arrays.asList(moduleDetail)).tenantId(tenantId) - .build(); - MdmsCriteriaReq mdmsCriteriaReq = MdmsCriteriaReq.builder().requestInfo(requestInfo).mdmsCriteria(mdmsCriteria).build(); - StringBuilder uri = new StringBuilder(config.getMdmsHost()).append(config.getMdmsEndpoint()); - try { - Optional result = serviceRequestRepository.fetchResult(uri, mdmsCriteriaReq); - List> jsonOutput = new ArrayList<>(); - if (result.isPresent()) - jsonOutput = JsonPath.read(result.get(), jsonPath); - - Set state = new HashSet(); - for (Map json : jsonOutput) { - state.add((String) json.get("code")); - } - return state; - } catch (Exception e) { - throw new CustomException(ErrorConstants.INVALID_TENANT_ID_MDMS_KEY, ErrorConstants.INVALID_TENANT_ID_MDMS_MSG); - } - } - - - /** - * @param requestInfo RequestInfo Object - * @param propertyId - */ - private void encryptPropertyAuditData(RequestInfo requestInfo, String propertyId) { - List propertiesInAudit; - PropertyCriteria criteria = new PropertyCriteria(); - criteria.setPropertyIds(Collections.singleton(propertyId)); - propertiesInAudit = repository.getPropertyAuditForEnc(criteria); - - for (PropertyAudit propertyAudit : propertiesInAudit) { - propertyAudit.setAuditcreatedTime(System.currentTimeMillis()); - propertyAudit.setProperty(encryptionDecryptionUtil.encryptObject(propertyAudit.getProperty(), PTConstants.PROPERTY_MODEL, Property.class)); - producer.push(config.getUpdatePropertyAuditEncTopic(), propertyAudit); - } - } - } diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/service/PropertyService.java b/municipal-services/property-services/src/main/java/org/egov/pt/service/PropertyService.java index c86c86a68bb..66eca000e56 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/service/PropertyService.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/service/PropertyService.java @@ -1,14 +1,7 @@ package org.egov.pt.service; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; import javax.validation.Valid; @@ -47,16 +40,16 @@ @Slf4j @Service public class PropertyService { - + @Autowired private BillingService billingService; - + @Autowired private UnmaskingUtil unmaskingUtil; @Autowired private PropertyProducer producer; - + @Autowired private NotificationService notifService; @@ -103,6 +96,7 @@ public Property createProperty(PropertyRequest request) { propertyValidator.validateCreateRequest(request); enrichmentService.enrichCreateRequest(request); + String tenantId = request.getProperty().getTenantId(); userService.createUser(request); if (config.getIsWorkflowEnabled() && !request.getProperty().getCreationReason().equals(CreationReason.DATA_UPLOAD)) { @@ -115,7 +109,7 @@ public Property createProperty(PropertyRequest request) { /* Fix this. * For FUZZY-search, This code to be un-commented when privacy is enabled - + //Push PLAIN data to fuzzy search index producer.push(config.getSavePropertyFuzzyTopic(), request); * @@ -142,46 +136,46 @@ public Property createProperty(PropertyRequest request) { * @return List of updated properties */ public Property updateProperty(PropertyRequest request) { - + Property propertyFromSearch = unmaskingUtil.getPropertyUnmasked(request); propertyValidator.validateCommonUpdateInformation(request, propertyFromSearch); boolean isRequestForOwnerMutation = CreationReason.MUTATION.equals(request.getProperty().getCreationReason()); - + boolean isNumberDifferent = checkIsRequestForMobileNumberUpdate(request, propertyFromSearch); - + boolean isRequestForStatusChange=CreationReason.STATUS.equals(request.getProperty().getCreationReason()); if (isRequestForOwnerMutation) processOwnerMutation(request, propertyFromSearch); else if(isNumberDifferent) processMobileNumberUpdate(request, propertyFromSearch); - + else { if(isRequestForStatusChange) { - BillResponse billResponse = billingService.fetchBill(request.getProperty(), request.getRequestInfo()); - - BigDecimal dueAmount= new BigDecimal("0"); - if (billResponse != null && billResponse.getBill()!= null && billResponse.getBill().size()>=1) - { - dueAmount = billResponse.getBill().get(0).getTotalAmount(); - } - - log.info("No. of Active Bills==="+ ((billResponse != null && billResponse.getBill()!= null && billResponse.getBill().size()>=1)?billResponse.getBill().size(): "0")); - log.info("Amount Due is "+ dueAmount); - if(dueAmount.compareTo(BigDecimal.ZERO)>0) - throw new CustomException("EG_PT_ERROR_ACTIVE_BILL_PRESENT", - "Clear Pending dues before De-Enumerating the property"); - + BillResponse billResponse = billingService.fetchBill(request.getProperty(), request.getRequestInfo()); + + BigDecimal dueAmount= new BigDecimal("0"); + if (billResponse != null && billResponse.getBill()!= null && billResponse.getBill().size()>=1) + { + dueAmount = billResponse.getBill().get(0).getTotalAmount(); + } + + log.info("No. of Active Bills==="+ ((billResponse != null && billResponse.getBill()!= null && billResponse.getBill().size()>=1)?billResponse.getBill().size(): "0")); + log.info("Amount Due is "+ dueAmount); + if(dueAmount.compareTo(BigDecimal.ZERO)>0) + throw new CustomException("EG_PT_ERROR_ACTIVE_BILL_PRESENT", + "Clear Pending dues before De-Enumerating the property"); + else - processPropertyUpdate(request, propertyFromSearch); - + processPropertyUpdate(request, propertyFromSearch); + } else { - processPropertyUpdate(request, propertyFromSearch); + processPropertyUpdate(request, propertyFromSearch); } } @@ -194,7 +188,7 @@ else if(isNumberDifferent) /* Fix this. * For FUZZY-search, This code to be un-commented when privacy is enabled - + //Push PLAIN data to fuzzy search index producer.push(config.getSavePropertyFuzzyTopic(), fuzzyPropertyRequest); * @@ -203,58 +197,59 @@ else if(isNumberDifferent) /* decrypt here */ return encryptionDecryptionUtil.decryptObject(request.getProperty(), PTConstants.PROPERTY_MODEL, Property.class, request.getRequestInfo()); } - + /* Method to check if the update request is for updating owner mobile numbers */ - + private boolean checkIsRequestForMobileNumberUpdate(PropertyRequest request, Property propertyFromSearch) { Map uuidToMobileNumber = new HashMap (); List owners = propertyFromSearch.getOwners(); - + for(OwnerInfo owner : owners) { uuidToMobileNumber.put(owner.getUuid(), owner.getMobileNumber()); } - + List ownersFromRequest = request.getProperty().getOwners(); - + Boolean isNumberDifferent = false; - + for(OwnerInfo owner : ownersFromRequest) { if(uuidToMobileNumber.containsKey(owner.getUuid()) && !uuidToMobileNumber.get(owner.getUuid()).equals(owner.getMobileNumber())) { isNumberDifferent = true; break; } } - + return isNumberDifferent; } - + /* Method to process owner mobile number update */ - + private void processMobileNumberUpdate(PropertyRequest request, Property propertyFromSearch) { - - if (CreationReason.CREATE.equals(request.getProperty().getCreationReason())) { - userService.createUser(request); - } else { - updateOwnerMobileNumbers(request,propertyFromSearch); - } - - enrichmentService.enrichUpdateRequest(request, propertyFromSearch); - util.mergeAdditionalDetails(request, propertyFromSearch); - producer.pushAfterEncrytpion(config.getUpdatePropertyTopic(), request); + + if (CreationReason.CREATE.equals(request.getProperty().getCreationReason())) { + userService.createUser(request); + } else { + updateOwnerMobileNumbers(request,propertyFromSearch); + } + + enrichmentService.enrichUpdateRequest(request, propertyFromSearch); + util.mergeAdditionalDetails(request, propertyFromSearch); + producer.pushAfterEncrytpion(config.getUpdatePropertyTopic(), request); } /** - * Method to process Property update + * Method to process Property update * * @param request * @param propertyFromSearch */ private void processPropertyUpdate(PropertyRequest request, Property propertyFromSearch) { + String tenantId = request.getProperty().getTenantId(); propertyValidator.validateRequestForUpdate(request, propertyFromSearch); if (CreationReason.CREATE.equals(request.getProperty().getCreationReason())) { userService.createUser(request); @@ -308,23 +303,23 @@ private void processPropertyUpdate(PropertyRequest request, Property propertyFro producer.pushAfterEncrytpion(config.getUpdatePropertyTopic(), request); } } - + /* Method to update owners mobile number */ private void updateOwnerMobileNumbers(PropertyRequest request, Property propertyFromSearch) { - - + + Map uuidToMobileNumber = new HashMap (); List owners = propertyFromSearch.getOwners(); - + for(OwnerInfo owner : owners) { uuidToMobileNumber.put(owner.getUuid(), owner.getMobileNumber()); } - + userService.updateUserMobileNumber(request, uuidToMobileNumber); - notifService.sendNotificationForMobileNumberUpdate(request, propertyFromSearch,uuidToMobileNumber); + notifService.sendNotificationForMobileNumberUpdate(request, propertyFromSearch,uuidToMobileNumber); } /** @@ -335,6 +330,7 @@ private void updateOwnerMobileNumbers(PropertyRequest request, Property property */ private void processOwnerMutation(PropertyRequest request, Property propertyFromSearch) { + String tenantId = request.getProperty().getTenantId(); propertyValidator.validateMutation(request, propertyFromSearch); userService.createUserForMutation(request, !propertyFromSearch.getStatus().equals(Status.INWORKFLOW)); enrichmentService.enrichAssignes(request.getProperty()); @@ -390,6 +386,7 @@ private void processOwnerMutation(PropertyRequest request, Property propertyFrom private void terminateWorkflowAndReInstatePreviousRecord(PropertyRequest request, Property propertyFromSearch) { + String tenantId = request.getProperty().getTenantId(); /* current record being rejected */ producer.pushAfterEncrytpion(config.getUpdatePropertyTopic(), request); @@ -414,11 +411,11 @@ private void terminateWorkflowAndReInstatePreviousRecord(PropertyRequest request producer.pushAfterEncrytpion(config.getUpdatePropertyTopic(), request); } - - + + public List enrichProperty(List properties, RequestInfo requestInfo) { - log.info("In Fetch Bill for Defaulter notice +++++++++++++++++++"); + log.info("In Fetch Bill for Defaulter notice +++++++++++++++++++"); BillResponse billResponse=new BillResponse(); List defaulterProperties=new ArrayList<>(); @@ -461,7 +458,7 @@ public List enrichProperty(List properties, RequestInfo requ int fromYear=new Date(fromDate).getYear()+1900; int toYear=new Date(toDate).getYear()+1900; assessmentYear=assessmentYear==null? fromYear+"-"+toYear+"(Rs."+bd.getAmount()+")": - assessmentYear.concat(",").concat(fromYear+"-"+toYear+"(Rs."+bd.getAmount()+")"); + assessmentYear.concat(",").concat(fromYear+"-"+toYear+"(Rs."+bd.getAmount()+")"); } property.setDueAmountYear(assessmentYear); @@ -469,11 +466,11 @@ public List enrichProperty(List properties, RequestInfo requ } } - log.info("Property Id "+property.getPropertyId() + " added in defaulter notice with Due " +property.getDueAmount() + " for year " +property.getDueAmountYear()); + log.info("Property Id "+property.getPropertyId() + " added in defaulter notice with Due " +property.getDueAmount() + " for year " +property.getDueAmountYear()); } return defaulterProperties; - + } /** @@ -514,6 +511,8 @@ public List searchProperty(PropertyCriteria criteria, RequestInfo requ log.info("In Property Search before filtering"); filterPropertiesForUser(properties, criteria.getOwnerIds()); + log.info("After filtering properties for user"); + log.info("Properties after filtering: {}", properties); } else { properties = repository.getPropertiesWithOwnerInfo(criteria, requestInfo, false); } @@ -524,11 +523,18 @@ public List searchProperty(PropertyCriteria criteria, RequestInfo requ } /* Decrypt here */ - if(criteria.getIsSearchInternal()) + if(criteria.getIsSearchInternal()) return encryptionDecryptionUtil.decryptObject(properties, PTConstants.PROPERTY_DECRYPT_MODEL, Property.class, requestInfo); else if(!criteria.getIsRequestForOldDataEncryption()) return encryptionDecryptionUtil.decryptObject(properties, PTConstants.PROPERTY_MODEL, Property.class, requestInfo); + /* Decrypt here */ + if(criteria.getIsSearchInternal()) + return encryptionDecryptionUtil.decryptObject(properties, "PropertyDecrypDisabled", Property.class, requestInfo); + else if(!criteria.getIsRequestForOldDataEncryption()) + return encryptionDecryptionUtil.decryptObject(properties, "Property", Property.class, requestInfo); + + return properties; } @@ -562,7 +568,12 @@ public List searchPropertyPlainSearch(PropertyCriteria criteria, Reque List getPropertiesPlainSearch(PropertyCriteria criteria, RequestInfo requestInfo) { - + String schemaTenantId = null; + if(criteria.getTenantId()!=null){ + schemaTenantId = criteria.getTenantId(); + } else if (!CollectionUtils.isEmpty(criteria.getTenantIds())) { + schemaTenantId = criteria.getTenantIds().iterator().next(); + } if (criteria.getLimit() != null && criteria.getLimit() > config.getMaxSearchLimit()) criteria.setLimit(config.getMaxSearchLimit()); if(criteria.getLimit()==null) @@ -586,7 +597,7 @@ List getPropertiesPlainSearch(PropertyCriteria criteria, RequestInfo r propertyCriteria.setUuids(new HashSet<>(uuids)); } propertyCriteria.setLimit(criteria.getLimit()); - List properties = repository.getPropertiesForBulkSearch(propertyCriteria, true); + List properties = repository.getPropertiesForBulkSearch(propertyCriteria, schemaTenantId, true); if(properties.isEmpty()) return Collections.emptyList(); Set ownerIds = properties.stream().map(Property::getOwners).flatMap(List::stream) @@ -600,42 +611,42 @@ List getPropertiesPlainSearch(PropertyCriteria criteria, RequestInfo r } public Property addAlternateNumber(PropertyRequest request) { - + Property propertyFromSearch = unmaskingUtil.getPropertyUnmasked(request); propertyValidator.validateAlternateMobileNumberInformation(request, propertyFromSearch); userService.createUserForAlternateNumber(request); - - request.getProperty().setAlternateUpdated(true); - + + request.getProperty().setAlternateUpdated(true); + Map uuidToAlternateMobileNumber = new HashMap (); List owners = propertyFromSearch.getOwners(); - + for(OwnerInfo owner : owners) { - + if(owner.getAlternatemobilenumber()!=null) { - uuidToAlternateMobileNumber.put(owner.getUuid(), owner.getAlternatemobilenumber()); + uuidToAlternateMobileNumber.put(owner.getUuid(), owner.getAlternatemobilenumber()); } else { uuidToAlternateMobileNumber.put(owner.getUuid(), " "); } } - - notifService.sendNotificationForAlternateNumberUpdate(request, propertyFromSearch,uuidToAlternateMobileNumber); - + + notifService.sendNotificationForAlternateNumberUpdate(request, propertyFromSearch,uuidToAlternateMobileNumber); + //enrichmentService.enrichUpdateRequest(request, propertyFromSearch); util.mergeAdditionalDetails(request, propertyFromSearch); - + producer.pushAfterEncrytpion(config.getUpdatePropertyTopic(), request); - + request.getProperty().setWorkflow(null); - + return request.getProperty(); } - + public Integer count(RequestInfo requestInfo, @Valid PropertyCriteria propertyCriteria) { propertyCriteria.setIsInboxSearch(false); - Integer count = repository.getCount(propertyCriteria, requestInfo); - return count; + Integer count = repository.getCount(propertyCriteria, requestInfo); + return count; } } diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/util/CommonUtils.java b/municipal-services/property-services/src/main/java/org/egov/pt/util/CommonUtils.java index f0992ea5902..d3692ca24d7 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/util/CommonUtils.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/util/CommonUtils.java @@ -124,7 +124,7 @@ public List getIdList(RequestInfo requestInfo, String tenantId, String i */ public Map> getAttributeValues(String tenantId, String moduleName, List names, String filter,String jsonpath, RequestInfo requestInfo){ - StringBuilder uri = new StringBuilder(configs.getMdmsHost()).append(configs.getMdmsEndpoint()); + StringBuilder uri = new StringBuilder(configs.getMdmsHost()).append(configs.getMdmsEndPoint()); MdmsCriteriaReq criteriaReq = prepareMdMsRequest(tenantId,moduleName,names,filter,requestInfo); Optional response = restRepo.fetchResult(uri, criteriaReq); diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/util/NotificationUtil.java b/municipal-services/property-services/src/main/java/org/egov/pt/util/NotificationUtil.java index 07356041b1a..f221cba56fe 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/util/NotificationUtil.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/util/NotificationUtil.java @@ -1,13 +1,27 @@ package org.egov.pt.util; -import com.jayway.jsonpath.Filter; -import com.jayway.jsonpath.JsonPath; +import static com.jayway.jsonpath.Criteria.where; +import static com.jayway.jsonpath.Filter.filter; +import static org.egov.pt.util.PTConstants.*; +import static org.egov.pt.util.PTConstants.FEEDBACK_URL; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; import org.egov.common.contract.request.Role; import org.egov.common.contract.request.User; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.mdms.model.MasterDetail; import org.egov.mdms.model.MdmsCriteria; import org.egov.mdms.model.MdmsCriteriaReq; @@ -16,7 +30,12 @@ import org.egov.pt.models.OwnerInfo; import org.egov.pt.models.Property; import org.egov.pt.models.enums.CreationReason; -import org.egov.pt.models.event.*; +import org.egov.pt.models.event.Action; +import org.egov.pt.models.event.ActionItem; +import org.egov.pt.models.event.Event; +import org.egov.pt.models.event.EventRequest; +import org.egov.pt.models.event.Recepient; +import org.egov.pt.models.event.Source; import org.egov.pt.models.user.UserDetailResponse; import org.egov.pt.models.user.UserSearchRequest; import org.egov.pt.producer.PropertyProducer; @@ -33,12 +52,9 @@ import org.springframework.util.CollectionUtils; import org.springframework.web.client.RestTemplate; -import java.util.*; -import java.util.stream.Collectors; +import com.jayway.jsonpath.Filter; +import com.jayway.jsonpath.JsonPath; -import static com.jayway.jsonpath.Criteria.where; -import static com.jayway.jsonpath.Filter.filter; -import static org.egov.pt.util.PTConstants.*; @Slf4j @@ -46,24 +62,22 @@ public class NotificationUtil { - + @Autowired private ServiceRequestRepository serviceRequestRepository; + @Autowired private PropertyConfiguration config; private PropertyProducer producer; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + @Autowired private RestTemplate restTemplate; private UserService userService; - - @Value("${egov.mdms.host}") - private String mdmsHost; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsUrl; - @Autowired public NotificationUtil(ServiceRequestRepository serviceRequestRepository, PropertyConfiguration config, PropertyProducer producer, RestTemplate restTemplate,UserService userService) { @@ -76,7 +90,15 @@ public NotificationUtil(ServiceRequestRepository serviceRequestRepository, Prope + @Value("${egov.mdms.host}") + private String mdmsHost; + + @Value("${egov.mdms.search.endpoint}") + private String mdmsUrl; + public NotificationUtil(PropertyProducer producer) { + this.producer = producer; + } /** * Extracts message for the specific code @@ -113,7 +135,7 @@ public String getMessageTemplate(String notificationCode, String localizationMes * @return Localization messages for the module */ public String getLocalizationMessages(String tenantId, RequestInfo requestInfo) { - + String locale = NOTIFICATION_LOCALE; Boolean isRetryNeeded = false; String jsonString = null; @@ -121,21 +143,21 @@ public String getLocalizationMessages(String tenantId, RequestInfo requestInfo) if (!StringUtils.isEmpty(requestInfo.getMsgId()) && requestInfo.getMsgId().split("\\|").length >= 2) { locale = requestInfo.getMsgId().split("\\|")[1]; - isRetryNeeded = true; - } + isRetryNeeded = true; + } - responseMap = (LinkedHashMap) serviceRequestRepository.fetchResult(getUri(tenantId, requestInfo, locale), requestInfo).get(); - jsonString = new JSONObject(responseMap).toString(); + responseMap = (LinkedHashMap) serviceRequestRepository.fetchResult(getUri(tenantId, requestInfo, locale), requestInfo).get(); + jsonString = new JSONObject(responseMap).toString(); - if (StringUtils.isEmpty(jsonString) && isRetryNeeded) { + if (StringUtils.isEmpty(jsonString) && isRetryNeeded) { - responseMap = (LinkedHashMap) serviceRequestRepository.fetchResult(getUri(tenantId, requestInfo, NOTIFICATION_LOCALE), requestInfo).get(); - jsonString = new JSONObject(responseMap).toString(); - if(StringUtils.isEmpty(jsonString)) - throw new CustomException("EG_PT_LOCALE_ERROR","Localisation values not found for Property notifications"); - } - return jsonString; - } + responseMap = (LinkedHashMap) serviceRequestRepository.fetchResult(getUri(tenantId, requestInfo, NOTIFICATION_LOCALE), requestInfo).get(); + jsonString = new JSONObject(responseMap).toString(); + if(StringUtils.isEmpty(jsonString)) + throw new CustomException("EG_PT_LOCALE_ERROR","Localisation values not found for Property notifications"); + } + return jsonString; + } /** @@ -169,7 +191,7 @@ public StringBuilder getUri(String tenantId, RequestInfo requestInfo, String loc * @return List of SMSRequest */ public List createSMSRequest(String message, Map mobileNumberToOwnerName) { - + List smsRequest = new LinkedList<>(); for (Map.Entry entryset : mobileNumberToOwnerName.entrySet()) { String customizedMsg = message.replace(NOTIFICATION_OWNERNAME, entryset.getValue()); @@ -185,13 +207,13 @@ public List createSMSRequest(String message, Map mob * @param smsRequestList * The list of SMSRequest to be sent */ - public void sendSMS(List smsRequestList) { - + public void sendSMS(List smsRequestList, String tenantId) { + if (config.getIsSMSNotificationEnabled()) { if (CollectionUtils.isEmpty(smsRequestList)) log.info("Messages from localization couldn't be fetched!"); for (SMSRequest smsRequest : smsRequestList) { - producer.push(config.getSmsNotifTopic(), smsRequest); + producer.push("",config.getSmsNotifTopic(), smsRequest); log.info("Sending SMS notification: "); log.info("MobileNumber: " + smsRequest.getMobileNumber() + " Messages: " + smsRequest.getMessage()); } @@ -208,7 +230,7 @@ public void sendSMS(List smsRequestList) { * @return */ public Map fetchUserUUIDs(Set mobileNumbers, RequestInfo requestInfo, String tenantId) { - + Map mapOfPhnoAndUUIDs = new HashMap<>(); StringBuilder uri = new StringBuilder(); uri.append(config.getUserHost()).append(config.getUserSearchEndpoint()); @@ -240,9 +262,9 @@ public Map fetchUserUUIDs(Set mobileNumbers, RequestInfo * * @param request */ - public void sendEventNotification(EventRequest request) { + public void sendEventNotification(EventRequest request,String tenantId) { log.info("EVENT notification sent!"); - producer.push(config.getSaveUserEventsTopic(), request); + producer.push("",config.getSaveUserEventsTopic(), request); } @@ -299,6 +321,9 @@ public List createEmailRequestFromSMSRequests(RequestInfo requestI String message = mobileNumberToMsg.get(entryset.getKey()); String customizedMsg = message; + if(StringUtils.isEmpty(message)) + log.info("Email ID is empty, no notification will be sent "); + if(message.contains(NOTIFICATION_EMAIL)) customizedMsg = customizedMsg.replace(NOTIFICATION_EMAIL, entryset.getValue()); @@ -324,14 +349,14 @@ public List createEmailRequestFromSMSRequests(RequestInfo requestI * @param emailRequestList * The list of EmailRequest to be sent */ - public void sendEmail(List < EmailRequest > emailRequestList) { + public void sendEmail(List emailRequestList, String tenantId) { if (config.getIsEmailNotificationEnabled()) { if (CollectionUtils.isEmpty(emailRequestList)) log.info("Messages from localization couldn't be fetched!"); for (EmailRequest emailRequest: emailRequestList) { if (!StringUtils.isEmpty(emailRequest.getEmail().getBody())) { - producer.push(config.getEmailNotifTopic(), emailRequest); + producer.push(tenantId, config.getEmailNotifTopic(), emailRequest); log.info("Sending EMAIL notification! "); log.info("Email Id: " + emailRequest.getEmail().toString()); } else { @@ -366,7 +391,7 @@ public Map fetchUserEmailIds(Set mobileNumbers, RequestI if(null != user) { if(JsonPath.read(user, "$.user[0].emailId")!=null) { String email = JsonPath.read(user, "$.user[0].emailId"); - mapOfPhnoAndEmailIds.put(mobileNo, email); + mapOfPhnoAndEmailIds.put(mobileNo, email); } }else { log.error("Service returned null while fetching user for username - "+mobileNo); @@ -381,7 +406,7 @@ public Map fetchUserEmailIds(Set mobileNumbers, RequestI } /** * Method to shortent the url - * returns the same url if shortening fails + * returns the same url if shortening fails * @param url */ public String getShortenedUrl(String url){ @@ -400,146 +425,141 @@ public String getShortenedUrl(String url){ } /** - * - * @param requestInfo - * @param smsRequests - */ - public List enrichEvent(List smsRequests, RequestInfo requestInfo, String tenantId, Property property, Boolean isActionReq){ - - List events = new ArrayList<>(); - Set mobileNumbers = smsRequests.stream().map(SMSRequest :: getMobileNumber).collect(Collectors.toSet()); - Map mapOfPhnoAndUUIDs = new HashMap<>(); - - for(String mobileNumber:mobileNumbers) { - UserDetailResponse userDetailResponse = fetchUserByUUID(mobileNumber, requestInfo, property.getTenantId()); - try - { - OwnerInfo user= (OwnerInfo) userDetailResponse.getUser().get(0); - mapOfPhnoAndUUIDs.put(user.getMobileNumber(),user.getUuid()); - } - catch(Exception e) { - log.error("Exception while fetching user object: ",e); - } - } - - if (CollectionUtils.isEmpty(mapOfPhnoAndUUIDs.keySet())) { - log.error("UUIDs Not found for Mobilenumbers"); - } - - Map mobileNumberToMsg = smsRequests.stream().collect(Collectors.toMap(SMSRequest::getMobileNumber, SMSRequest::getMessage)); - mobileNumbers.forEach(mobileNumber -> { - - List toUsers = new ArrayList<>(); - toUsers.add(mapOfPhnoAndUUIDs.get(mobileNumber)); - Recepient recepient = Recepient.builder().toUsers(toUsers).toRoles(null).build(); - - Action action = null; - if(isActionReq){ - List items = new ArrayList<>(); - String msg = smsRequests.get(0).getMessage(); - log.info("Message is for Event" + msg); - String actionLink = ""; - if(msg.contains(PT_CORRECTION_PENDING)){ - - String url = config.getUserEventViewPropertyLink(); - if (property.getCreationReason().equals(CreationReason.MUTATION)) { - url = config.getUserEventViewMutationLink(); - } - - actionLink = url.replace("$mobileNo", mobileNumber) - .replace("$tenantId", tenantId) - .replace("$propertyId" , property.getPropertyId()) - .replace("$applicationNumber" , property.getAcknowldgementNumber()); - actionLink = config.getUiAppHost() + actionLink; - log.info("actionLink is" + actionLink); - - ActionItem item = ActionItem.builder().actionUrl(actionLink).code(VIEW_APPLICATION_CODE).build(); - items.add(item); - } - - if(msg.contains(ASMT_USER_EVENT_PAY)){ - actionLink = config.getPayLink().replace("$mobile", mobileNumber) - .replace("$propertyId", property.getPropertyId()) - .replace("$tenantId", property.getTenantId()) - .replace("$businessService" , PT_BUSINESSSERVICE); - - log.info("3 pay link "+config.getPayLink()); - log.info(" 2 actionLink is" + actionLink); - - actionLink = config.getUiAppHost() + actionLink; - log.info(" 1 actionLink is" + actionLink); - - ActionItem item = ActionItem.builder().actionUrl(actionLink).code(config.getPayCode()).build(); - items.add(item); - } - if(msg.contains(PT_ALTERNATE_NUMBER) || msg.contains(PT_OLD_MOBILENUMBER) || msg.contains(VIEW_PROPERTY)){ - actionLink = config.getViewPropertyLink() - .replace(NOTIFICATION_PROPERTYID, property.getPropertyId()) - .replace(NOTIFICATION_TENANTID, property.getTenantId()); - - actionLink = config.getUiAppHost() + actionLink; - log.info("actionLink is" + actionLink); - - ActionItem item = ActionItem.builder().actionUrl(actionLink).code(VIEW_PROPERTY_CODE).build(); - items.add(item); - } - - if(msg.contains(TRACK_APPLICATION)){ - actionLink = config.getViewPropertyLink() - .replace(NOTIFICATION_PROPERTYID, property.getPropertyId()) - .replace(NOTIFICATION_TENANTID, property.getTenantId()); - - actionLink = config.getUiAppHost() + actionLink; - log.info("actionLink is" + actionLink); - - ActionItem item = ActionItem.builder().actionUrl(actionLink).code(VIEW_PROPERTY_CODE).build(); - items.add(item); - } - - if(msg.contains(TRACK_APPLICATION) && msg.contains("{MTURL}")){ - actionLink = getMutationUrl(property); - ActionItem item = ActionItem.builder().actionUrl(actionLink).code(TRACK_APPLICATION_CODE).build(); - items.add(item); - } - - if(msg.contains(NOTIFICATION_PAY_LINK)){ - actionLink = getPayUrl(property); - log.info("actionLink is" + actionLink); - - ActionItem item = ActionItem.builder().actionUrl(actionLink).code(NOTIFICATION_PAY_LINK).build(); - items.add(item); - } - - if(msg.contains(MT_RECEIPT_STRING)) - { - actionLink = getMutationUrl(property); - log.info("actionLink is" + actionLink); - - ActionItem item = ActionItem.builder().actionUrl(actionLink).code(DOWNLOAD_MUTATION_RECEIPT_CODE).build(); - items.add(item); - } - - if(msg.contains(MT_CERTIFICATE_STRING)) - { - actionLink = getMutationUrl(property); - log.info("actionLink is" + actionLink); - - ActionItem item = ActionItem.builder().actionUrl(actionLink).code(DOWNLOAD_MUTATION_CERTIFICATE_CODE).build(); - items.add(item); - } - - action = Action.builder().actionUrls(items).build(); - } - - String description = removeForInAppMessage(mobileNumberToMsg.get(mobileNumber)); - events.add(Event.builder().tenantId(tenantId).description(description) - .eventType(USREVENTS_EVENT_TYPE).name(USREVENTS_EVENT_NAME) - .postedBy(USREVENTS_EVENT_POSTEDBY).source(Source.WEBAPP).recepient(recepient) - .eventDetails(null).actions(action).build()); - - }); - return events; - } + * + * @param requestInfo + * @param smsRequests + */ + public List enrichEvent(List smsRequests, RequestInfo requestInfo, String tenantId, Property property, Boolean isActionReq){ + + List events = new ArrayList<>(); + Set mobileNumbers = smsRequests.stream().map(SMSRequest :: getMobileNumber).collect(Collectors.toSet()); + Map mapOfPhnoAndUUIDs = new HashMap<>(); + + for(String mobileNumber:mobileNumbers) { + UserDetailResponse userDetailResponse = fetchUserByUUID(mobileNumber, requestInfo, property.getTenantId()); + try + { + OwnerInfo user= (OwnerInfo) userDetailResponse.getUser().get(0); + mapOfPhnoAndUUIDs.put(user.getMobileNumber(),user.getUuid()); + } + catch(Exception e) { + log.error("Exception while fetching user object: ",e); + } + } + + if (CollectionUtils.isEmpty(mapOfPhnoAndUUIDs.keySet())) { + log.error("UUIDs Not found for Mobilenumbers"); + } + + Map mobileNumberToMsg = smsRequests.stream().collect(Collectors.toMap(SMSRequest::getMobileNumber, SMSRequest::getMessage)); + mobileNumbers.forEach(mobileNumber -> { + + List toUsers = new ArrayList<>(); + toUsers.add(mapOfPhnoAndUUIDs.get(mobileNumber)); + Recepient recepient = Recepient.builder().toUsers(toUsers).toRoles(null).build(); + + Action action = null; + if(isActionReq){ + List items = new ArrayList<>(); + String msg = smsRequests.get(0).getMessage(); + log.info("Message is for Event" + msg); + String actionLink = ""; + if(msg.contains(PT_CORRECTION_PENDING)){ + + String url = config.getUserEventViewPropertyLink(); + if (property.getCreationReason().equals(CreationReason.MUTATION)) { + url = config.getUserEventViewMutationLink(); + } + + actionLink = url.replace("$mobileNo", mobileNumber) + .replace("$tenantId", tenantId) + .replace("$propertyId" , property.getPropertyId()) + .replace("$applicationNumber" , property.getAcknowldgementNumber()); + + actionLink = config.getUiAppHostMap().get(tenantId) + actionLink; + log.info("actionLink is" + actionLink); + ActionItem item = ActionItem.builder().actionUrl(actionLink).code(VIEW_APPLICATION_CODE).build(); + items.add(item); + } + + if(msg.contains(ASMT_USER_EVENT_PAY)){ + actionLink = config.getPayLink().replace("$mobile", mobileNumber) + .replace("$propertyId", property.getPropertyId()) + .replace("$tenantId", property.getTenantId()) + .replace("$businessService" , PT_BUSINESSSERVICE); + + log.info("3 pay link "+config.getPayLink()); + log.info(" 2 actionLink is" + actionLink); + + actionLink = config.getUiAppHostMap().get(tenantId) + actionLink; + log.info(" 1 actionLink is" + actionLink); + ActionItem item = ActionItem.builder().actionUrl(actionLink).code(config.getPayCode()).build(); + items.add(item); + } + if(msg.contains(PT_ALTERNATE_NUMBER) || msg.contains(PT_OLD_MOBILENUMBER) || msg.contains(VIEW_PROPERTY)){ + actionLink = config.getViewPropertyLink() + .replace(NOTIFICATION_PROPERTYID, property.getPropertyId()) + .replace(NOTIFICATION_TENANTID, property.getTenantId()); + + actionLink = config.getUiAppHostMap().get(tenantId) + actionLink; + ActionItem item = ActionItem.builder().actionUrl(actionLink).code(VIEW_PROPERTY_CODE).build(); + items.add(item); + } + + if(msg.contains(TRACK_APPLICATION)){ + actionLink = config.getViewPropertyLink() + .replace(NOTIFICATION_PROPERTYID, property.getPropertyId()) + .replace(NOTIFICATION_TENANTID, property.getTenantId()); + + actionLink = config.getUiAppHostMap().get(tenantId) + actionLink; + ActionItem item = ActionItem.builder().actionUrl(actionLink).code(VIEW_PROPERTY_CODE).build(); + items.add(item); + } + + if(msg.contains(TRACK_APPLICATION) && msg.contains("{MTURL}")){ + actionLink = getMutationUrl(property); + ActionItem item = ActionItem.builder().actionUrl(actionLink).code(TRACK_APPLICATION_CODE).build(); + items.add(item); + } + + if(msg.contains(NOTIFICATION_PAY_LINK)){ + actionLink = getPayUrl(property); + log.info("actionLink is" + actionLink); + + ActionItem item = ActionItem.builder().actionUrl(actionLink).code(NOTIFICATION_PAY_LINK).build(); + items.add(item); + } + + if(msg.contains(MT_RECEIPT_STRING)) + { + actionLink = getMutationUrl(property); + log.info("actionLink is" + actionLink); + + ActionItem item = ActionItem.builder().actionUrl(actionLink).code(DOWNLOAD_MUTATION_RECEIPT_CODE).build(); + items.add(item); + } + + if(msg.contains(MT_CERTIFICATE_STRING)) + { + actionLink = getMutationUrl(property); + log.info("actionLink is" + actionLink); + + ActionItem item = ActionItem.builder().actionUrl(actionLink).code(DOWNLOAD_MUTATION_CERTIFICATE_CODE).build(); + items.add(item); + } + + action = Action.builder().actionUrls(items).build(); + } + + String description = removeForInAppMessage(mobileNumberToMsg.get(mobileNumber)); + events.add(Event.builder().tenantId(tenantId).description(description) + .eventType(USREVENTS_EVENT_TYPE).name(USREVENTS_EVENT_NAME) + .postedBy(USREVENTS_EVENT_POSTEDBY).source(Source.WEBAPP).recepient(recepient) + .eventDetails(null).actions(action).build()); + + }); + return events; + } /** * Method to remove certain lines from SMS templates @@ -583,7 +603,7 @@ private String removeForInAppMessage(String message) public List fetchChannelList(RequestInfo requestInfo, String tenantId, String moduleName, String action){ List masterData = new ArrayList<>(); StringBuilder uri = new StringBuilder(); - uri.append(mdmsHost).append(mdmsUrl); + uri.append(config.getMdmsHost()).append(config.getMdmsEndPoint()); if(StringUtils.isEmpty(tenantId)) return masterData; MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequestForChannelList(requestInfo, tenantId.split("\\.")[0]); @@ -603,14 +623,15 @@ public List fetchChannelList(RequestInfo requestInfo, String tenantId, S } private MdmsCriteriaReq getMdmsRequestForChannelList(RequestInfo requestInfo, String tenantId){ + MasterDetail masterDetail = new MasterDetail(); - masterDetail.setName(CHANNEL_LIST); + masterDetail.setName(PTConstants.CHANNEL_LIST); List masterDetailList = new ArrayList<>(); masterDetailList.add(masterDetail); ModuleDetail moduleDetail = new ModuleDetail(); moduleDetail.setMasterDetails(masterDetailList); - moduleDetail.setModuleName(CHANNEL); + moduleDetail.setModuleName(PTConstants.CHANNEL); List moduleDetailList = new ArrayList<>(); moduleDetailList.add(moduleDetail); @@ -625,6 +646,11 @@ private MdmsCriteriaReq getMdmsRequestForChannelList(RequestInfo requestInfo, St return mdmsCriteriaReq; } + public String getHost(String tenantId) { + String stateLevelTenantId = centralInstanceUtil.getStateLevelTenant(tenantId); + return config.getUiAppHostMap().get(stateLevelTenantId); + } + /** * Prepares and return url for mutation view screen * @@ -634,9 +660,9 @@ private MdmsCriteriaReq getMdmsRequestForChannelList(RequestInfo requestInfo, St public String getMutationUrl(Property property) { return getShortenedUrl( - config.getUiAppHost().concat(config.getViewMutationLink() + config.getUiAppHostMap().get(property.getTenantId()).concat(config.getViewMutationLink() .replace(NOTIFICATION_APPID, property.getAcknowldgementNumber()) - .replace(NOTIFICATION_TENANTID, property.getTenantId()))); + .replace(NOTIFICATION_TENANTID, centralInstanceUtil.getStateLevelTenant(property.getTenantId())))); } /** @@ -647,9 +673,9 @@ public String getMutationUrl(Property property) { */ public String getPayUrl(Property property) { return getShortenedUrl( - config.getUiAppHost().concat(config.getPayLink().replace(EVENT_PAY_BUSINESSSERVICE,MUTATION_BUSINESSSERVICE) + config.getUiAppHostMap().get(property.getTenantId()).concat(config.getPayLink().replace(EVENT_PAY_BUSINESSSERVICE,MUTATION_BUSINESSSERVICE) .replace(EVENT_PAY_PROPERTYID, property.getAcknowldgementNumber()) - .replace(EVENT_PAY_TENANTID, property.getTenantId()))); + .replace(EVENT_PAY_TENANTID, centralInstanceUtil.getStateLevelTenant(property.getTenantId())))); } /** @@ -694,11 +720,19 @@ public User getInternalMicroserviceUser(String tenantId) return userInfo; } - + + /** + * Method to prepare msg for citizen feedback notification + * + * @param property + * @param completeMsgs + * @param serviceType + * @return + */ public String getMsgForCitizenFeedbackNotification(Property property, String completeMsgs, String serviceType) { String msgCode = null, redirectLink = null, creationreason=null; - String feedbackUrl = config.getUiAppHost()+config.getCitizenFeedbackLink(); + String feedbackUrl = config.getUiAppHostMap().get(property.getTenantId()).concat(config.getCitizenFeedbackLink()); switch (serviceType) { @@ -741,5 +775,4 @@ public String getMsgForCitizenFeedbackNotification(Property property, String com property.getAcknowldgementNumber()).replace(FEEDBACK_URL, getShortenedUrl(feedbackUrl)); } - } diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/util/PTConstants.java b/municipal-services/property-services/src/main/java/org/egov/pt/util/PTConstants.java index 007654acc9e..3e0e50be1d1 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/util/PTConstants.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/util/PTConstants.java @@ -11,6 +11,8 @@ private PTConstants() {} public static final String PT_TYPE_VACANT = "VACANT"; + public static String SCHEMA_REPLACE_STRING = "{schema}"; + public static final String PT_TYPE_SHAREDPROPERTY = "SHAREDPROPERTY"; public static final String PT_TYPE_BUILTUP = "BUILTUP"; @@ -403,6 +405,8 @@ private PTConstants() {} public static final String PAY_ONLINE_STRING = "Click on the URL to view the details and pay online {PAYMENT_LINK}"; + public static final String TENANTID_MDC_STRING = "TENANTID"; + public static final String PT_ONLINE_STRING = "You can pay your Property Tax online here - {PAYMENT_LINK}"; public static final String MT_TRACK_APPLICATION_STRING ="You can track your application on the link given below - {MTURL} Thank you"; diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/util/PropertyUtil.java b/municipal-services/property-services/src/main/java/org/egov/pt/util/PropertyUtil.java index bf998faf429..aef4ddfea05 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/util/PropertyUtil.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/util/PropertyUtil.java @@ -269,7 +269,7 @@ public List getCopyOfOwners(List owners) { public JSONObject getWnsPTworkflowConfig(PropertyRequest request){ List masterName = Arrays.asList( "PTWorkflow"); - Map> codes = getAttributeValues(configs.getStateLevelTenantId(), PTConstants.MDMS_PT_MOD_NAME,masterName , "$.*",PTConstants.JSONPATH_CODES, request.getRequestInfo()); + Map> codes = getAttributeValues(request.getProperty().getTenantId(), PTConstants.MDMS_PT_MOD_NAME,masterName , "$.*",PTConstants.JSONPATH_CODES, request.getRequestInfo()); JSONObject obj = new JSONObject(codes); JSONArray configArray = obj.getJSONArray("PTWorkflow"); JSONObject response = new JSONObject(); @@ -279,6 +279,4 @@ public JSONObject getWnsPTworkflowConfig(PropertyRequest request){ } return response; } - - } diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/validator/PropertyValidator.java b/municipal-services/property-services/src/main/java/org/egov/pt/validator/PropertyValidator.java index 0940b65bf70..beabf13bb25 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/validator/PropertyValidator.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/validator/PropertyValidator.java @@ -11,6 +11,7 @@ import org.egov.common.contract.request.RequestInfo; import org.egov.common.contract.request.User; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.pt.config.PropertyConfiguration; import org.egov.pt.models.ConstructionDetail; import org.egov.pt.models.GeoLocation; @@ -55,6 +56,9 @@ public class PropertyValidator { @Autowired private PropertyConfiguration configs; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + @Autowired private PropertyService service; @@ -559,6 +563,16 @@ public void validatePropertyCriteria(PropertyCriteria criteria,RequestInfo reque List allowedParams = null; + if (centralInstanceUtil.getIsEnvironmentCentralInstance() && criteria.getTenantId() == null) { + + throw new CustomException("EG_PT_INVALID_SEARCH", " TenantId is mandatory for search "); + } else if (centralInstanceUtil.getIsEnvironmentCentralInstance() + && criteria.getTenantId().split("\\.").length < centralInstanceUtil.getStateLevelTenantIdLength()) { + + throw new CustomException("EG_PT_INVALID_SEARCH", + " TenantId should be mandatorily " + centralInstanceUtil.getStateLevelTenantIdLength() + " levels for search"); + } + User user = requestInfo.getUserInfo(); String userType = user.getType(); Boolean isUserCitizen = "CITIZEN".equalsIgnoreCase(userType); @@ -603,9 +617,6 @@ public void validatePropertyCriteria(PropertyCriteria criteria,RequestInfo reque else { - if(criteria.getTenantId() == null) - throw new CustomException("EG_PT_INVALID_SEARCH"," TenantId is mandatory for search by " + userType); - if(criteria.getTenantId() != null && isCriteriaEmpty) throw new CustomException("EG_PT_INVALID_SEARCH"," Search is not allowed on empty Criteria, Atleast one criteria should be provided with tenantId for " + userType); diff --git a/municipal-services/property-services/src/main/java/org/egov/pt/web/controllers/PropertyController.java b/municipal-services/property-services/src/main/java/org/egov/pt/web/controllers/PropertyController.java index ba86459f549..911d1043f50 100644 --- a/municipal-services/property-services/src/main/java/org/egov/pt/web/controllers/PropertyController.java +++ b/municipal-services/property-services/src/main/java/org/egov/pt/web/controllers/PropertyController.java @@ -1,12 +1,7 @@ package org.egov.pt.web.controllers; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; +import java.util.*; import javax.validation.Valid; @@ -50,9 +45,6 @@ public class PropertyController { @Autowired private ResponseInfoFactory responseInfoFactory; - @Autowired - private MigrationService migrationService; - @Autowired private PropertyValidator propertyValidator; @@ -64,28 +56,29 @@ public class PropertyController { @Autowired PropertyEncryptionService propertyEncryptionService; + private MigrationService migrationService; @PostMapping("/_create") public ResponseEntity create(@Valid @RequestBody PropertyRequest propertyRequest) { - for(OwnerInfo owner:propertyRequest.getProperty().getOwners()) - { - if(!owner.getOwnerType().equals("NONE")) - { - for(Document document:owner.getDocuments()) - if(document.getDocumentType().contains("OWNER.SPECIALCATEGORYPROOF")) - { - PropertyCriteria propertyCriteria=new PropertyCriteria(); - propertyCriteria.setTenantId(owner.getTenantId()); - propertyCriteria.setDocumentNumbers(new HashSet<>(Arrays.asList(document.getDocumentUid()))); - List properties=propertyService.searchProperty(propertyCriteria,propertyRequest.getRequestInfo()); - if(!properties.isEmpty()) - throw new CustomException(null,"Document numbers added in Owner Information is already present in the system."); - - } - - } - } + for(OwnerInfo owner:propertyRequest.getProperty().getOwners()) + { + if(!owner.getOwnerType().equals("NONE")) + { + for(Document document:owner.getDocuments()) + if(document.getDocumentType().contains("OWNER.SPECIALCATEGORYPROOF")) + { + PropertyCriteria propertyCriteria=new PropertyCriteria(); + propertyCriteria.setTenantId(owner.getTenantId()); + propertyCriteria.setDocumentNumbers(new HashSet<>(Arrays.asList(document.getDocumentUid()))); + List properties=propertyService.searchProperty(propertyCriteria,propertyRequest.getRequestInfo()); + if(!properties.isEmpty()) + throw new CustomException(null,"Document numbers added in Owner Information is already present in the system."); + + } + + } + } Property property = propertyService.createProperty(propertyRequest); ResponseInfo resInfo = responseInfoFactory.createResponseInfoFromRequestInfo(propertyRequest.getRequestInfo(), true); PropertyResponse response = PropertyResponse.builder() @@ -99,25 +92,25 @@ public ResponseEntity create(@Valid @RequestBody PropertyReque @PostMapping("/_update") public ResponseEntity update(@Valid @RequestBody PropertyRequest propertyRequest) { - for(OwnerInfo owner:propertyRequest.getProperty().getOwners()) - { - if(!owner.getOwnerType().equals("NONE")) - { - for(Document document:owner.getDocuments()) - if(document.getDocumentType().contains("OWNER.SPECIALCATEGORYPROOF")) - { - PropertyCriteria propertyCriteria=new PropertyCriteria(); - propertyCriteria.setTenantId(owner.getTenantId()); - propertyCriteria.setDocumentNumbers(new HashSet<>(Arrays.asList(document.getDocumentUid()))); - List properties=propertyService.searchProperty(propertyCriteria,propertyRequest.getRequestInfo()); - if(!properties.isEmpty()) - throw new CustomException(null,"Document numbers added in Owner Information is already present in the system."); - - } - - } - } - + for(OwnerInfo owner:propertyRequest.getProperty().getOwners()) + { + if(!owner.getOwnerType().equals("NONE")) + { + for(Document document:owner.getDocuments()) + if(document.getDocumentType().contains("OWNER.SPECIALCATEGORYPROOF")) + { + PropertyCriteria propertyCriteria=new PropertyCriteria(); + propertyCriteria.setTenantId(owner.getTenantId()); + propertyCriteria.setDocumentNumbers(new HashSet<>(Arrays.asList(document.getDocumentUid()))); + List properties=propertyService.searchProperty(propertyCriteria,propertyRequest.getRequestInfo()); + if(!properties.isEmpty()) + throw new CustomException(null,"Document numbers added in Owner Information is already present in the system."); + + } + + } + } + Property property = propertyService.updateProperty(propertyRequest); ResponseInfo resInfo = responseInfoFactory.createResponseInfoFromRequestInfo(propertyRequest.getRequestInfo(), true); PropertyResponse response = PropertyResponse.builder() @@ -135,26 +128,29 @@ public ResponseEntity search(@Valid @RequestBody RequestInfoWr if(!configs.getIsInboxSearchAllowed() || !propertyCriteria.getIsInboxSearch()){ propertyValidator.validatePropertyCriteria(propertyCriteria, requestInfoWrapper.getRequestInfo()); } - - List properties = new ArrayList(); - Integer count = 0; - + + List properties = new ArrayList(); + Integer count = 0; + if (propertyCriteria.getIsRequestForCount()) { - count = propertyService.count(requestInfoWrapper.getRequestInfo(), propertyCriteria); - + count = propertyService.count(requestInfoWrapper.getRequestInfo(), propertyCriteria); + }else { - properties = propertyService.searchProperty(propertyCriteria,requestInfoWrapper.getRequestInfo()); + properties = propertyService.searchProperty(propertyCriteria,requestInfoWrapper.getRequestInfo()); } - - log.info("Property count after search"+properties.size()); - + + if(properties != null) + log.info("Property count after search"+properties.size()); + else + log.info("Property count after search"+count); + PropertyResponse response = PropertyResponse.builder() - .responseInfo( + .responseInfo( responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true)) - .properties(properties) - .count(count) + .properties(properties) + .count(count) .build(); - + return new ResponseEntity<>(response, HttpStatus.OK); } @@ -180,7 +176,7 @@ public ResponseEntity plainsearch(@Valid @RequestBody RequestI @Valid @ModelAttribute PropertyCriteria propertyCriteria) { List properties = propertyService.searchPropertyPlainSearch(propertyCriteria, requestInfoWrapper.getRequestInfo()); PropertyResponse response = PropertyResponse.builder().properties(properties).responseInfo( - responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true)) + responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true)) .build(); return new ResponseEntity<>(response, HttpStatus.OK); } @@ -194,9 +190,9 @@ public ResponseEntity plainsearch(@Valid @RequestBody RequestI // .build(); // return new ResponseEntity<>(response, HttpStatus.OK); // } - + @PostMapping("/_addAlternateNumber") - public ResponseEntity _addAlternateNumber(@Valid @RequestBody PropertyRequest propertyRequest) { + public ResponseEntity _addAlternateNumber(@Valid @RequestBody PropertyRequest propertyRequest) { Property property = propertyService.addAlternateNumber(propertyRequest); ResponseInfo resInfo = responseInfoFactory.createResponseInfoFromRequestInfo(propertyRequest.getRequestInfo(), true); PropertyResponse response = PropertyResponse.builder() @@ -208,11 +204,11 @@ public ResponseEntity _addAlternateNumber(@Valid @RequestBody @PostMapping("/fuzzy/_search") public ResponseEntity fuzzySearch(@Valid @RequestBody RequestInfoWrapper requestInfoWrapper, - @Valid @ModelAttribute PropertyCriteria fuzzySearchCriteria) { + @Valid @ModelAttribute PropertyCriteria fuzzySearchCriteria) { List properties = fuzzySearchService.getProperties(requestInfoWrapper.getRequestInfo(), fuzzySearchCriteria); PropertyResponse response = PropertyResponse.builder().properties(properties).responseInfo( - responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true)) + responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true)) .build(); return new ResponseEntity<>(response, HttpStatus.OK); } @@ -227,11 +223,11 @@ public ResponseEntity fuzzySearch(@Valid @RequestBody RequestI /* To be executed only once */ @RequestMapping(value = "/_encryptOldData", method = RequestMethod.POST) public ResponseEntity encryptOldData(@Valid @RequestBody RequestInfoWrapper requestInfoWrapper, - @Valid @ModelAttribute PropertyCriteria propertyCriteria) { + @Valid @ModelAttribute PropertyCriteria propertyCriteria) { throw new CustomException("EG_PT_ENC_OLD_DATA_ERROR", "The encryption of old data is disabled"); - /* Un-comment the below code to enable Privacy */ - + /* Un-comment the below code to enable Privacy */ + // propertyCriteria.setIsRequestForOldDataEncryption(Boolean.TRUE); // List properties = propertyEncryptionService.updateOldData(propertyCriteria, requestInfoWrapper.getRequestInfo()); // PropertyResponse response = PropertyResponse.builder().properties(properties).responseInfo( diff --git a/municipal-services/property-services/src/main/resources/application.properties b/municipal-services/property-services/src/main/resources/application.properties index e4c910ff276..0a43329bf37 100644 --- a/municipal-services/property-services/src/main/resources/application.properties +++ b/municipal-services/property-services/src/main/resources/application.properties @@ -61,11 +61,13 @@ egov.pt.assessment.create.topic=save-pt-assessment egov.pt.assessment.update.topic=update-pt-assessment kafka.topics.receipt.create=egov.collection.payment-create +kafka.topics.receipt.create.pattern=((^[a-zA-Z]+-)?egov.collection.payment-create) + persister.migration.batch.count.topic=migartion-batch-count #idgen configs -egov.idgen.host=https://dev.digit.org/ +egov.idgen.host=https://stateb.digit.org/ egov.idgen.path=egov-idgen/id/_generate egov.idgen.ack.name=pt.acknowledgementnumber egov.idgen.ack.format=PB-AC-[cy:yyyy-MM-dd]-[SEQ_EG_PT_ACK] @@ -114,7 +116,7 @@ egov.user.update.path=/_updatenovalidate egov.internal.microservice.user.uuid=4fef6612-07a8-4751-97e9-0e0ac0687ebe #location config -egov.location.host=https://dev.digit.org +egov.location.host=https://stateb.digit.org egov.location.context.path=/egov-location/location/v11/ egov.location.endpoint=/boundarys/_search @@ -125,7 +127,7 @@ egov.calculation.endpoint=/_calculate egov.calculation.mutation.endpoint=/mutation/_calculate #Localization config -egov.localization.host=https://dev.digit.org +egov.localization.host=https://stateb.digit.org egov.localization.context.path=/localization/messages/v1 egov.localization.search.endpoint=/_search egov.localization.statelevel=true @@ -133,8 +135,8 @@ egov.localization.fallback.locale=en_IN #mdms urls -egov.mdms.host=https://dev.digit.org -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search egov.enc.host = http://egov-enc-service:8080 @@ -171,7 +173,7 @@ pt.search.pagination.max.search.limit=5000 #user-event configs egov.user.event.notification.enabled=true -egov.ui.app.host=https://dev.digit.org +egov.ui.app.host.map={"in":"https://central-instance.digit.org","in.statea":"https://statea.digit.org","pb":"https://qa.digit.org/"} egov.usr.events.create.topic=persist-user-events-async egov.usr.events.pay.link=digit-ui/citizen/payment/my-bills/$businessService/$propertyId?tenantId=$tenantId egov.usr.events.pay.code=PAY @@ -189,8 +191,8 @@ assessment.workflow.trigger.object=UnitUsage assessment.workflow.demand.trigger=APPROVED #url shortner -egov.url.shortner.host=http://egov-url-shortening.egov:8080 -egov.url.shortner.endpoint=/egov-url-shortening/shortener +egov.url.shortner.host=http://egov-url-shortening:8080 +egov.url.shortner.endpoint=/eus/shortener #oldProperty Plain search egov.oldProperty.search = /pt-services-v2/property/_plainsearch @@ -233,3 +235,8 @@ persister.update.property.oldData.topic=update-property-encryption persister.update.property.audit.oldData.topic=update-property-audit-enc egov.integration.system.user.uuid=3b666f31-92c2-4e74-8122-300494b8e978 + +# central-instance configs +state.level.tenantid.length=2 +is.environment.central.instance=false +pt.kafka.notification.topic.pattern=((^[a-zA-Z]+-)?save-pt-assessment|(^[a-zA-Z]+-)?update-pt-assessment|(^[a-zA-Z]+-)?save-property-registry|(^[a-zA-Z]+-)?update-property-registry) diff --git a/municipal-services/property-services/src/main/resources/db/migrate.sh b/municipal-services/property-services/src/main/resources/db/migrate.sh index 43960b25cdb..6b845ac81bb 100644 --- a/municipal-services/property-services/src/main/resources/db/migrate.sh +++ b/municipal-services/property-services/src/main/resources/db/migrate.sh @@ -1,3 +1,11 @@ #!/bin/sh - -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file +baseurl=$DB_URL +echo "the baseurl : $DB_URL" +schemasetter="?currentSchema=" +schemas=$SCHEMA_NAME +echo "the schemas : $schemas" +for schemaname in ${schemas//,/ } +do + echo "the schema name : ${baseurl}${schemasetter}${schemaname}" + flyway -url=${baseurl}${schemasetter}${schemaname} -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate +done diff --git a/municipal-services/pt-calculator-v2/CHANGELOG.md b/municipal-services/pt-calculator-v2/CHANGELOG.md index fdf1296f369..6dab2edcc76 100644 --- a/municipal-services/pt-calculator-v2/CHANGELOG.md +++ b/municipal-services/pt-calculator-v2/CHANGELOG.md @@ -1,7 +1,14 @@ # Changelog -All notable changes to this module will be documented in this file. +All notable changes to this module will be documented in this file.\ + +## 1.1.6 - 2023-08-10 + +- Central Instance Library Integration + +## 1.1.5-beta - 2022-01-13 +- Updated to log4j2 version 2.17.1 ## 1.1.5-beta - 2022-01-13 - Updated to log4j2 version 2.17.1 diff --git a/municipal-services/pt-calculator-v2/pom.xml b/municipal-services/pt-calculator-v2/pom.xml index 64c4fd7e93a..0d7eef79712 100644 --- a/municipal-services/pt-calculator-v2/pom.xml +++ b/municipal-services/pt-calculator-v2/pom.xml @@ -5,7 +5,7 @@ pt-calculator-v2 jar egov-pt-calculator - 1.1.5_beta-SNAPSHOT + 1.1.6-SNAPSHOT 2.17.1 1.8 @@ -134,7 +134,7 @@ org.egov.services tracer - 2.0.0-SNAPSHOT + 2.1.0-SNAPSHOT org.egov.services @@ -162,7 +162,12 @@ validation-api - + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + repo.egovernments.org eGov ERP Releases Repository diff --git a/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/consumer/CalculationReqConsumer.java b/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/consumer/CalculationReqConsumer.java index 6fbe8423dd1..ed534bfc8ca 100644 --- a/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/consumer/CalculationReqConsumer.java +++ b/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/consumer/CalculationReqConsumer.java @@ -1,23 +1,26 @@ package org.egov.pt.calculator.consumer; -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.extern.slf4j.Slf4j; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + import org.egov.pt.calculator.service.DemandService; +import org.egov.pt.calculator.util.CalculatorConstants; import org.egov.pt.calculator.util.CalculatorUtils; import org.egov.pt.calculator.util.Configurations; import org.egov.pt.calculator.web.models.CalculationReq; import org.egov.pt.calculator.web.models.property.Property; import org.egov.pt.calculator.web.models.property.PropertyRequest; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; +import com.fasterxml.jackson.databind.ObjectMapper; + +import lombok.extern.slf4j.Slf4j; //@Service @@ -42,6 +45,9 @@ public void listen(final HashMap record, @Header(KafkaHeaders.RE PropertyRequest propertyRequest = mapper.convertValue(record, PropertyRequest.class); List propertiesForDemandGen = new LinkedList<>(); List propertiesNotForDemandGen = new LinkedList<>(); + + // Adding in MDC so that tracer can add it in header + MDC.put(CalculatorConstants.TENANTID_MDC_STRING, propertyRequest.getProperties().get(0).getTenantId()); propertyRequest.getProperties().forEach(property -> { if(!config.getSourcesToBeIgnored().contains(property.getPropertyDetails().get(0).getSource())) diff --git a/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/producer/Producer.java b/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/producer/Producer.java index 76a30264e5f..17c85d02f33 100644 --- a/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/producer/Producer.java +++ b/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/producer/Producer.java @@ -3,6 +3,7 @@ import lombok.extern.slf4j.Slf4j; import org.egov.tracer.kafka.CustomKafkaTemplate; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.stereotype.Service; @@ -13,8 +14,21 @@ public class Producer { @Autowired private CustomKafkaTemplate kafkaTemplate; - public void push(String topic, Object value) { - kafkaTemplate.send(topic, value); + @Value("${is.environment.central.instance}") + private Boolean isEnvironmentCentralInstance; + + public void push(String tenantId,String topic, Object value) { + + + String updatedTopic = topic; + if (isEnvironmentCentralInstance) { + + String[] tenants = tenantId.split("\\."); + if (tenants.length > 1) + updatedTopic = tenants[1].concat("-").concat(topic); + } + + kafkaTemplate.send(updatedTopic, value); } } diff --git a/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/service/BillingSlabService.java b/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/service/BillingSlabService.java index b85efb41783..735c85a5ca7 100644 --- a/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/service/BillingSlabService.java +++ b/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/service/BillingSlabService.java @@ -50,13 +50,15 @@ public class BillingSlabService { public BillingSlabRes createBillingSlab(BillingSlabReq billingSlabReq) { enrichBillingSlabForCreate(billingSlabReq); - producer.push(configurations.getBillingSlabSavePersisterTopic(), billingSlabReq); + String tenantId = billingSlabReq.getBillingSlab().get(0).getTenantId(); + producer.push(tenantId,configurations.getBillingSlabSavePersisterTopic(), billingSlabReq); return billingSlabUtils.getBillingSlabResponse(billingSlabReq); } public BillingSlabRes updateBillingSlab(BillingSlabReq billingSlabReq) { enrichBillingSlabForUpdate(billingSlabReq); - producer.push(configurations.getBillingSlabUpdatePersisterTopic(), billingSlabReq); + String tenantId = billingSlabReq.getBillingSlab().get(0).getTenantId(); + producer.push(tenantId,configurations.getBillingSlabUpdatePersisterTopic(), billingSlabReq); return billingSlabUtils.getBillingSlabResponse(billingSlabReq); } diff --git a/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/service/MutationBillingSlabService.java b/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/service/MutationBillingSlabService.java index 6c83193e1e7..d3dfd2faa3e 100644 --- a/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/service/MutationBillingSlabService.java +++ b/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/service/MutationBillingSlabService.java @@ -41,13 +41,15 @@ public class MutationBillingSlabService { public MutationBillingSlabRes createBillingSlab(MutationBillingSlabReq billingSlabReq) { enrichBillingSlabForCreate(billingSlabReq); - producer.push(configurations.getMutationbillingSlabSavePersisterTopic(), billingSlabReq); + String tenantId = billingSlabReq.getBillingSlab().get(0).getTenantId(); + producer.push(tenantId,configurations.getMutationbillingSlabSavePersisterTopic(), billingSlabReq); return billingSlabUtils.getMutationBillingSlabResponse(billingSlabReq); } public MutationBillingSlabRes updateBillingSlab(MutationBillingSlabReq billingSlabReq) { enrichBillingSlabForUpdate(billingSlabReq); - producer.push(configurations.getMutationbillingSlabUpdatePersisterTopic(), billingSlabReq); + String tenantId = billingSlabReq.getBillingSlab().get(0).getTenantId(); + producer.push(tenantId,configurations.getMutationbillingSlabUpdatePersisterTopic(), billingSlabReq); return billingSlabUtils.getMutationBillingSlabResponse(billingSlabReq); } diff --git a/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/util/CalculatorConstants.java b/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/util/CalculatorConstants.java index c57cfa8545d..19a5122d0ac 100644 --- a/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/util/CalculatorConstants.java +++ b/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/util/CalculatorConstants.java @@ -378,4 +378,5 @@ private CalculatorConstants() { + public static final String TENANTID_MDC_STRING = "TENANTID"; } diff --git a/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/util/Configurations.java b/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/util/Configurations.java index 5ba11e92ea4..278dded9073 100644 --- a/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/util/Configurations.java +++ b/municipal-services/pt-calculator-v2/src/main/java/org/egov/pt/calculator/util/Configurations.java @@ -30,10 +30,10 @@ public class Configurations { public Integer mutationDeadlineMonth; //MDMS - @Value("${egov.mdms.host}") + @Value("${mdms.v2.host}") private String mdmsHost; - @Value("${egov.mdms.search.endpoint}") + @Value("${mdms.v2.search.endpoint}") private String mdmsEndpoint; diff --git a/municipal-services/pt-calculator-v2/src/main/resources/application.properties b/municipal-services/pt-calculator-v2/src/main/resources/application.properties index b31d60a009f..686d4b3ddb4 100644 --- a/municipal-services/pt-calculator-v2/src/main/resources/application.properties +++ b/municipal-services/pt-calculator-v2/src/main/resources/application.properties @@ -62,6 +62,10 @@ management.endpoints.web.base-path=/ egov.mdms.host=https://dev.digit.org egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +#mdms urls +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search + # Billing Service url egov.billingservice.host=https://dev.digit.org @@ -149,4 +153,6 @@ egov.localization.search.endpoint=/_search #sms -kafka.topics.notification.sms=egov.core.notification.sms \ No newline at end of file +kafka.topics.notification.sms=egov.core.notification.sms +is.environment.central.instance=false +state.level.tenantid.length=2 diff --git a/municipal-services/pt-services-v2/src/main/java/org/egov/pt/config/PropertyConfiguration.java b/municipal-services/pt-services-v2/src/main/java/org/egov/pt/config/PropertyConfiguration.java index 9fb265d6666..912385232a3 100644 --- a/municipal-services/pt-services-v2/src/main/java/org/egov/pt/config/PropertyConfiguration.java +++ b/municipal-services/pt-services-v2/src/main/java/org/egov/pt/config/PropertyConfiguration.java @@ -204,7 +204,12 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM @Value("${egov.url.shortener.endpoint}") private String shortenerEndpoint; + // MDMS + @Value("${egov.mdms.v2.host}") + private String mdmsHost; + @Value("${egov.mdms.search.endpoint}") + private String mdmsEndpoint; diff --git a/municipal-services/pt-services-v2/src/main/java/org/egov/pt/validator/PropertyValidator.java b/municipal-services/pt-services-v2/src/main/java/org/egov/pt/validator/PropertyValidator.java index 583c96f0b45..78ebc43612e 100644 --- a/municipal-services/pt-services-v2/src/main/java/org/egov/pt/validator/PropertyValidator.java +++ b/municipal-services/pt-services-v2/src/main/java/org/egov/pt/validator/PropertyValidator.java @@ -51,14 +51,6 @@ public class PropertyValidator { @Autowired private ServiceRequestRepository serviceRequestRepository; - @Value("${egov.mdms.host}") - private String mdmsHost; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsEndpoint; - - - /** * Validate the masterData and ctizenInfo of the given propertyRequest * @param request PropertyRequest for create @@ -125,7 +117,7 @@ private void validateMasterData(PropertyRequest request){ * */ private Map> getAttributeValues(String tenantId, String moduleName, List names, String filter,String jsonpath, RequestInfo requestInfo){ - StringBuilder uri = new StringBuilder(mdmsHost).append(mdmsEndpoint); + StringBuilder uri = new StringBuilder(propertyConfiguration.getMdmsHost()).append(propertyConfiguration.getMdmsEndpoint()); MdmsCriteriaReq criteriaReq = propertyUtil.prepareMdMsRequest(tenantId,moduleName,names,filter,requestInfo); try { Object result = serviceRequestRepository.fetchResult(uri, criteriaReq); diff --git a/municipal-services/pt-services-v2/src/main/resources/application.properties b/municipal-services/pt-services-v2/src/main/resources/application.properties index a22f28cdb95..9626799db10 100644 --- a/municipal-services/pt-services-v2/src/main/resources/application.properties +++ b/municipal-services/pt-services-v2/src/main/resources/application.properties @@ -55,8 +55,8 @@ persister.demand.based.dead.letter.topic.batch=pt-dead-letter-topic-batch persister.demand.based.dead.letter.topic.single=pt-dead-letter-topic-single #mdms urls -egov.mdms.host=https://dev.digit.org -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +egov.mdms.v2.host=https://dev.digit.org +egov.mdms.search.endpoint=/mdms-v2/v1/_search #idgen configs diff --git a/municipal-services/sw-calculator/CHANGELOG.MD b/municipal-services/sw-calculator/CHANGELOG.MD index 57065da4c65..eb8945bec52 100644 --- a/municipal-services/sw-calculator/CHANGELOG.MD +++ b/municipal-services/sw-calculator/CHANGELOG.MD @@ -1,6 +1,10 @@ # Change log All notable changes to this module will be documented in this file. +## 1.4.4 - 2023-08-10 + +- Central Instance Library Integration + ## 1.4.3 - 2023-02-01 - Transition from 1.4.3-beta version to 1.4.3 version diff --git a/municipal-services/sw-calculator/pom.xml b/municipal-services/sw-calculator/pom.xml index a93768ae21c..27b8a5dfa59 100644 --- a/municipal-services/sw-calculator/pom.xml +++ b/municipal-services/sw-calculator/pom.xml @@ -6,7 +6,7 @@ org.egov sw-calculator - 1.4.3-SNAPSHOT + 1.4.4-SNAPSHOT sw_service_calculation Demo project for Spring Boot @@ -69,7 +69,7 @@ org.egov.services services-common - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT org.projectlombok @@ -105,7 +105,7 @@ org.egov.services tracer - 2.0.0-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/config/SWCalculationConfiguration.java b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/config/SWCalculationConfiguration.java index 38b83b30353..1c4971090f3 100644 --- a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/config/SWCalculationConfiguration.java +++ b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/config/SWCalculationConfiguration.java @@ -31,11 +31,17 @@ public class SWCalculationConfiguration { private String taxPeriodSearchEndpoint; // MDMS - @Value("${egov.mdms.host}") - private String mdmsHost; +// @Value("${egov.mdms.host}") +// private String mdmsHost; +// +// @Value("${egov.mdms.search.endpoint}") +// private String mdmsEndPoint; + + @Value("${mdms.v2.host}") + private String mdmsHost; - @Value("${egov.mdms.search.endpoint}") - private String mdmsEndPoint; + @Value("${mdms.v2.search.endpoint}") + private String mdmsEndPoint; // sewerage Registry @Value("${egov.sw.host}") diff --git a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/constants/SWCalculationConstant.java b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/constants/SWCalculationConstant.java index f67d91155a3..f83d2c2a5b1 100644 --- a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/constants/SWCalculationConstant.java +++ b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/constants/SWCalculationConstant.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Map; import org.egov.swcalculation.web.models.DemandStatus; @@ -381,5 +382,9 @@ public class SWCalculationConstant { public static final String PENDING_FOR_DISCONNECTION_EXECUTION = "PENDING_FOR_DISCONNECTION_EXECUTION"; public static final String DISCONNECTION_EXECUTED = "DISCONNECTION_EXECUTED"; + + public static final String TENANTID_MDC_STRING = "TENANTID"; + + public static Map masterMap; } diff --git a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/consumer/BillingNotificationConsumer.java b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/consumer/BillingNotificationConsumer.java index a6a66699231..fd75a913588 100644 --- a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/consumer/BillingNotificationConsumer.java +++ b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/consumer/BillingNotificationConsumer.java @@ -2,8 +2,11 @@ import java.util.HashMap; +import org.egov.swcalculation.constants.SWCalculationConstant; import org.egov.swcalculation.service.PaymentNotificationService; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; import org.springframework.messaging.handler.annotation.Header; @@ -19,11 +22,17 @@ public class BillingNotificationConsumer { @Autowired PaymentNotificationService service; + @Value("${state.level.tenant.id}") + private String stateLevelTenantID; @KafkaListener(topics = { "${kafka.topics.billgen.topic}" }) public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try { log.info("Consuming record: " + record); + + // Adding in MDC so that tracer can add it in header + MDC.put(SWCalculationConstant.TENANTID_MDC_STRING, stateLevelTenantID); + service.process(record, topic); } catch (final Exception e) { StringBuilder builder = new StringBuilder(); diff --git a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/consumer/DemandGenerationConsumer.java b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/consumer/DemandGenerationConsumer.java index 231fe26e6aa..a6488998b95 100644 --- a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/consumer/DemandGenerationConsumer.java +++ b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/consumer/DemandGenerationConsumer.java @@ -5,6 +5,8 @@ import org.egov.swcalculation.validator.SWCalculationWorkflowValidator; import org.egov.swcalculation.web.models.CalculationCriteria; import org.egov.swcalculation.web.models.CalculationReq; +import org.slf4j.MDC; +import org.egov.swcalculation.constants.SWCalculationConstant; import org.egov.swcalculation.producer.SWCalculationProducer; import org.egov.swcalculation.service.BulkDemandAndBillGenService; import org.egov.swcalculation.service.MasterDataService; @@ -43,6 +45,8 @@ public class DemandGenerationConsumer { @Value("${kafka.topics.bulk.bill.generation.audit}") private String bulkBillGenAuditTopic; + @Value("${state.level.tenant.id}") + private String stateLevelTenantID; /** * Listen the topic for processing the batch records. * @@ -52,6 +56,10 @@ public class DemandGenerationConsumer { public void processMessage(Map consumerRecord, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try{ CalculationReq calculationReq = mapper.convertValue(consumerRecord, CalculationReq.class); + + // Adding in MDC so that tracer can add it in header + MDC.put(SWCalculationConstant.TENANTID_MDC_STRING, stateLevelTenantID); + log.info(" Bulk bill Consumerbatch records log for batch : " + calculationReq.getMigrationCount().getOffset() + " Count is : " + calculationReq.getMigrationCount().getLimit()); diff --git a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/consumer/DemandNotificationConsumer.java b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/consumer/DemandNotificationConsumer.java index ead0c630871..23226f5812b 100644 --- a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/consumer/DemandNotificationConsumer.java +++ b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/consumer/DemandNotificationConsumer.java @@ -3,7 +3,9 @@ import java.util.HashMap; import org.egov.swcalculation.config.SWCalculationConfiguration; +import org.egov.swcalculation.constants.SWCalculationConstant; import org.egov.swcalculation.web.models.DemandNotificationObj; +import org.slf4j.MDC; import org.egov.swcalculation.service.SewerageDemandNotificationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; @@ -37,6 +39,10 @@ public void listen(final HashMap record, @Header(KafkaHeaders.RE try { DemandNotificationObj demandNotificationObj = mapper.convertValue(record, DemandNotificationObj.class); String tenantId= demandNotificationObj.getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(SWCalculationConstant.TENANTID_MDC_STRING, tenantId); + if (sWCalculationConfiguration.getIsLocalizationStateLevel()) tenantId = tenantId.split("\\.")[0]; demandNotificationObj.setTenantId(tenantId); diff --git a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/service/DemandService.java b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/service/DemandService.java index a8384f46c0c..536067564a2 100644 --- a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/service/DemandService.java +++ b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/service/DemandService.java @@ -31,25 +31,8 @@ import org.egov.swcalculation.util.CalculatorUtils; import org.egov.swcalculation.util.SWCalculationUtil; import org.egov.swcalculation.validator.SWCalculationWorkflowValidator; -import org.egov.swcalculation.web.models.BulkBillCriteria; -import org.egov.swcalculation.web.models.Calculation; -import org.egov.swcalculation.web.models.CalculationCriteria; -import org.egov.swcalculation.web.models.CalculationReq; -import org.egov.swcalculation.web.models.Demand; +import org.egov.swcalculation.web.models.*; import org.egov.swcalculation.web.models.Demand.StatusEnum; -import org.egov.swcalculation.web.models.DemandDetail; -import org.egov.swcalculation.web.models.DemandDetailAndCollection; -import org.egov.swcalculation.web.models.DemandNotificationObj; -import org.egov.swcalculation.web.models.DemandRequest; -import org.egov.swcalculation.web.models.DemandResponse; -import org.egov.swcalculation.web.models.GetBillCriteria; -import org.egov.swcalculation.web.models.MigrationCount; -import org.egov.swcalculation.web.models.Property; -import org.egov.swcalculation.web.models.RequestInfoWrapper; -import org.egov.swcalculation.web.models.SewerageConnection; -import org.egov.swcalculation.web.models.SewerageConnectionRequest; -import org.egov.swcalculation.web.models.TaxHeadEstimate; -import org.egov.swcalculation.web.models.TaxPeriod; import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; @@ -61,6 +44,8 @@ import lombok.extern.slf4j.Slf4j; import net.minidev.json.JSONArray; +import static org.egov.swcalculation.constants.SWCalculationConstant.ONE_TIME_FEE_SERVICE_FIELD; + @Service @Slf4j public class DemandService { @@ -121,13 +106,13 @@ public class DemandService { private EnrichmentService enrichmentService; private Object calculationReq; - + private SewerageConnectionRequest request; + private RequestInfo requestInfo; /** * Creates or updates Demand * - * @param requestInfo The RequestInfo of the calculation request * @param calculations The Calculation Objects for which demand has to be generated or updated */ public List generateDemand(CalculationReq request, List calculations, @@ -158,7 +143,7 @@ public List generateDemand(CalculationReq request, List cal } List demands = searchDemand(tenantId, consumerCodes, fromDateSearch, toDateSearch, request.getRequestInfo(), null, - request.getIsDisconnectionRequest(),request.getIsReconnectionRequest()); + request.getDisconnectRequest()); Set connectionNumbersFromDemands = new HashSet<>(); if (!CollectionUtils.isEmpty(demands)) connectionNumbersFromDemands = demands.stream().map(Demand::getConsumerCode) @@ -167,9 +152,9 @@ public List generateDemand(CalculationReq request, List cal // If demand already exists add it updateCalculations else // createCalculations for (Calculation calculation : calculations) { - if (request.getIsDisconnectionRequest() != null && request.getIsDisconnectionRequest()) { + if (request.getDisconnectRequest() != null && request.getDisconnectRequest()) { demands = searchDemandForDisconnectionRequest(calculation.getTenantId(), consumerCodes, null, - toDateSearch, request.getRequestInfo(), null, request.getIsDisconnectionRequest()); + toDateSearch, request.getRequestInfo(), null, request.getDisconnectRequest()); if (!CollectionUtils.isEmpty(demands) && !(demands.get(0).getDemandDetails().get(0).getCollectionAmount().doubleValue() == 0.0)) { createCalculations.add(calculation); @@ -189,24 +174,22 @@ public List generateDemand(CalculationReq request, List cal } List createdDemands = new ArrayList<>(); if (!CollectionUtils.isEmpty(createCalculations)) - createdDemands = createDemand(request, createCalculations, masterMap, isForConnectionNo); + createdDemands = createDemand(request.getRequestInfo(), createCalculations, masterMap, isForConnectionNo); if (!CollectionUtils.isEmpty(updateCalculations)) - createdDemands = updateDemandForCalculation(request, updateCalculations, fromDate, toDate, isForConnectionNo, - request.getIsDisconnectionRequest(),request.getIsReconnectionRequest()); + createdDemands = updateDemandForCalculation(request.getRequestInfo(), updateCalculations, fromDate, toDate, isForConnectionNo, + request.getDisconnectRequest()); return createdDemands; } /** * Creates demand for the given list of calculations * - * @param requestInfo - * The RequestInfo of the calculation request * @param calculations * List of calculation object * @return Demands that are created */ - private List createDemand(CalculationReq calculationReq, List calculations, + private List createDemand(RequestInfo requestInfo, List calculations, Map masterMap,boolean isForConnectionNO) { List demands = new LinkedList<>(); Set sewerageConnectionIds = new HashSet<>(); @@ -221,7 +204,7 @@ private List createDemand(CalculationReq calculationReq, List createDemand(CalculationReq calculationReq, List demandDetails = new LinkedList<>(); calculation.getTaxHeadEstimates().forEach(taxHeadEstimate -> { @@ -249,8 +232,7 @@ private List createDemand(CalculationReq calculationReq, List additionalDetailsMap = new HashMap<>(); additionalDetailsMap.put("propertyId", property.getPropertyId()); @@ -262,16 +244,14 @@ private List createDemand(CalculationReq calculationReq, List demandRes = demandRepository.saveDemand(calculationReq.getRequestInfo(), demands,notificationObj); - if(calculationReq.getIsReconnectionRequest()) - fetchBillForReconnect(demandRes, calculationReq.getRequestInfo(), masterMap); - else if(isForConnectionNO && !calculationReq.getIsReconnectionRequest()) - fetchBill(demandRes, calculationReq.getRequestInfo(),masterMap); + List demandRes = demandRepository.saveDemand(requestInfo, demands,notificationObj); + if(isForConnectionNO) + fetchBill(demandRes, requestInfo,masterMap); return demandRes; } @@ -493,9 +473,9 @@ public void addRoundOffTaxHead(String tenantId, List demandDetails * @return List of demands for the given consumerCode */ public List searchDemand(String tenantId, Set consumerCodes, Long taxPeriodFrom, Long taxPeriodTo, - RequestInfo requestInfo, Boolean isDemandPaid, Boolean isDisconnectionRequest ,Boolean isReconnectionRequest) { + RequestInfo requestInfo, Boolean isDemandPaid, Boolean isDisconnectionRequest) { Object result = serviceRequestRepository.fetchResult(getDemandSearchURL(tenantId, consumerCodes, taxPeriodFrom, taxPeriodTo, isDemandPaid, - isDisconnectionRequest,isReconnectionRequest), + isDisconnectionRequest), RequestInfoWrapper.builder().requestInfo(requestInfo).build()); DemandResponse response; try { @@ -516,12 +496,9 @@ public List searchDemand(String tenantId, Set consumerCodes, Lon * @return demand search url */ public StringBuilder getDemandSearchURL(String tenantId, Set consumerCodes, Long taxPeriodFrom, Long taxPeriodTo, Boolean isDemandPaid, - Boolean isDisconnectionRequest, Boolean isReconnectionRequest) { - + Boolean isDisconnectionRequest) { StringBuilder url = new StringBuilder(configs.getBillingServiceHost()); String businessService = taxPeriodFrom == null && !isDisconnectionRequest ? ONE_TIME_FEE_SERVICE_FIELD : configs.getBusinessService(); - if(isReconnectionRequest) - businessService="SWReconnection"; url.append(configs.getDemandSearchEndPoint()); url.append("?"); url.append("tenantId="); @@ -559,8 +536,8 @@ public StringBuilder getDemandSearchURL(String tenantId, Set consumerCod * List of calculation object * @return Demands that are updated */ - private List updateDemandForCalculation(CalculationReq request, List calculations, - Long fromDate, Long toDate, boolean isForConnectionNo, Boolean isDisconnectionRequest, Boolean isReconnectionRequest) { + private List updateDemandForCalculation(RequestInfo requestInfo, List calculations, + Long fromDate, Long toDate, boolean isForConnectionNo, Boolean isDisconnectionRequest) { List demands = new LinkedList<>(); Long fromDateSearch = isForConnectionNo ? fromDate : null; @@ -574,10 +551,10 @@ private List updateDemandForCalculation(CalculationReq request, List searchResult = new ArrayList<>(); if (isDisconnectionRequest) searchResult = searchDemandForDisconnectionRequest(calculation.getTenantId(), consumerCodes, null, toDateSearch, - request.getRequestInfo(), null, isDisconnectionRequest); + requestInfo, null, isDisconnectionRequest); else - searchResult = searchDemand(calculation.getTenantId(), consumerCodes, fromDateSearch, toDateSearch, request.getRequestInfo(), - null, isDisconnectionRequest,isReconnectionRequest); + searchResult = searchDemand(calculation.getTenantId(), consumerCodes, fromDateSearch, toDateSearch, requestInfo, + null, isDisconnectionRequest); if (CollectionUtils.isEmpty(searchResult)) throw new CustomException("EG_SW_INVALID_DEMAND_UPDATE", "No demand exists for Number: " @@ -606,7 +583,7 @@ private List updateDemandForCalculation(CalculationReq request, List searchDemandForDisconnectionRequest(String tenantId, Set consumerCodes, Long fromDateSearch, Long toDateSearch, RequestInfo requestInfo, Boolean isDemandPaid, Boolean isDisconnectionRequest) { List demandList = searchDemand(tenantId, consumerCodes, null, toDateSearch, requestInfo, - null, isDisconnectionRequest ,false); + null, isDisconnectionRequest); if (!CollectionUtils.isEmpty(demandList)) { //Sorting the demandList in descending order to pick the latest demand generated demandList = demandList.stream().sorted(Comparator.comparing(Demand::getTaxPeriodTo) @@ -1238,6 +1214,5 @@ List searchDemandForDisconnectionRequest(String tenantId, Set co } return demandList; } - } diff --git a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/service/SWCalculationServiceImpl.java b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/service/SWCalculationServiceImpl.java index 572d16b537f..e1fa1ca5549 100644 --- a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/service/SWCalculationServiceImpl.java +++ b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/service/SWCalculationServiceImpl.java @@ -14,42 +14,29 @@ import java.math.BigDecimal; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; +import com.fasterxml.jackson.databind.ObjectMapper; +import net.minidev.json.JSONArray; import org.egov.common.contract.request.RequestInfo; import org.egov.swcalculation.constants.SWCalculationConstant; -import org.egov.swcalculation.repository.SewerageCalculatorDao; import org.egov.swcalculation.util.CalculatorUtils; -import org.egov.swcalculation.util.SWCalculationUtil; import org.egov.swcalculation.util.SewerageCessUtil; -import org.egov.swcalculation.web.models.AdhocTaxReq; -import org.egov.swcalculation.web.models.BulkBillCriteria; -import org.egov.swcalculation.web.models.Calculation; -import org.egov.swcalculation.web.models.CalculationCriteria; -import org.egov.swcalculation.web.models.CalculationReq; -import org.egov.swcalculation.web.models.Demand; -import org.egov.swcalculation.web.models.DemandDetail; -import org.egov.swcalculation.web.models.Property; -import org.egov.swcalculation.web.models.SewerageConnection; -import org.egov.swcalculation.web.models.SewerageConnectionRequest; -import org.egov.swcalculation.web.models.TaxHeadCategory; -import org.egov.swcalculation.web.models.TaxHeadEstimate; -import org.egov.swcalculation.web.models.TaxHeadMaster; +import org.egov.swcalculation.web.models.*; +import org.egov.swcalculation.repository.SewerageCalculatorDao; +import org.egov.swcalculation.util.SWCalculationUtil; import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import com.fasterxml.jackson.databind.ObjectMapper; - import lombok.extern.slf4j.Slf4j; import net.minidev.json.JSONArray; +import static org.egov.swcalculation.constants.SWCalculationConstant.*; +import static org.egov.swcalculation.web.models.TaxHeadCategory.CHARGES; + @Service @Slf4j public class SWCalculationServiceImpl implements SWCalculationService { @@ -90,39 +77,31 @@ public class SWCalculationServiceImpl implements SWCalculationService { public List getCalculation(CalculationReq request) { List calculations; boolean connectionRequest = false; - Map masterMap; - if (request.getIsDisconnectionRequest()!= null && request.getIsDisconnectionRequest()) { + if (request.getDisconnectRequest()!= null && request.getDisconnectRequest()) { // Calculate and create demand for connection - connectionRequest = request.getIsDisconnectionRequest(); - masterMap = mDataService.loadMasterData(request.getRequestInfo(), + connectionRequest = request.getDisconnectRequest(); + Map masterMap = mDataService.loadMasterData(request.getRequestInfo(), request.getCalculationCriteria().get(0).getTenantId()); calculations = getCalculations(request, masterMap); - + demandService.generateDemand(request, calculations, masterMap, connectionRequest); + unsetSewerageConnection(calculations); } else if (request.getIsconnectionCalculation()) { connectionRequest = request.getIsconnectionCalculation(); - masterMap = mDataService.loadMasterData(request.getRequestInfo(), + Map masterMap = mDataService.loadMasterData(request.getRequestInfo(), request.getCalculationCriteria().get(0).getTenantId()); calculations = getCalculations(request, masterMap); - + demandService.generateDemand(request, calculations, masterMap, connectionRequest); + unsetSewerageConnection(calculations); - } - else if (request.getIsReconnectionRequest()) - { - connectionRequest = (!request.getIsReconnectionRequest()); - masterMap = mDataService.loadExemptionMaster(request.getRequestInfo(), - request.getCalculationCriteria().get(0).getTenantId()); - calculations = getReconnectionFeeCalculation(request, masterMap); - log.info("In reconnection request connectionRequest" + connectionRequest); - } - else { + } else { // Calculate and create demand for application - masterMap = mDataService.loadExemptionMaster(request.getRequestInfo(), + Map masterData = mDataService.loadExemptionMaster(request.getRequestInfo(), request.getCalculationCriteria().get(0).getTenantId()); - calculations = getFeeCalculation(request, masterMap); - connectionRequest = request.getIsconnectionCalculation(); + calculations = getFeeCalculation(request, masterData); + demandService.generateDemand(request, calculations, masterData, + request.getIsconnectionCalculation()); + unsetSewerageConnection(calculations); } - demandService.generateDemand(request, calculations, masterMap,connectionRequest); - unsetSewerageConnection(calculations); return calculations; } diff --git a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/web/controller/SWCalculationController.java b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/web/controller/SWCalculationController.java index a041e18c86c..3f56a8abd0d 100644 --- a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/web/controller/SWCalculationController.java +++ b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/web/controller/SWCalculationController.java @@ -2,10 +2,14 @@ +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.validation.Valid; +import org.egov.swcalculation.service.PaymentNotificationService; +import org.egov.swcalculation.web.models.*; import org.egov.swcalculation.service.DemandService; import org.egov.swcalculation.service.SWCalculationService; import org.egov.swcalculation.service.SWCalculationServiceImpl; @@ -24,11 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import lombok.Builder; import lombok.Getter; diff --git a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/web/models/CalculationReq.java b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/web/models/CalculationReq.java index 03622e219e3..91b9406eac7 100644 --- a/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/web/models/CalculationReq.java +++ b/municipal-services/sw-calculator/src/main/java/org/egov/swcalculation/web/models/CalculationReq.java @@ -48,6 +48,13 @@ public class CalculationReq { @JsonProperty("isDisconnectionRequest") private Boolean isDisconnectionRequest=Boolean.FALSE; + @JsonProperty("disconnectRequest") + private Boolean disconnectRequest = false; + + /* + * Used by the bulk bill generator to send batch information through kafka + */ + private MigrationCount migrationCount; @Builder.Default @JsonProperty("isReconnectionRequest") @@ -57,7 +64,7 @@ public class CalculationReq { /* * Used by the bulk bill generator to send batch information through kafka */ - private MigrationCount migrationCount; + public CalculationReq addCalulationCriteriaItem(CalculationCriteria calulationCriteriaItem) { this.calculationCriteria.add(calulationCriteriaItem); diff --git a/municipal-services/sw-calculator/src/main/resources/application.properties b/municipal-services/sw-calculator/src/main/resources/application.properties index 40850607aa9..37f290d179a 100644 --- a/municipal-services/sw-calculator/src/main/resources/application.properties +++ b/municipal-services/sw-calculator/src/main/resources/application.properties @@ -57,9 +57,10 @@ egov.sewerageservice.pagination.default.limit=50 egov.sewerageservice.pagination.default.offset=0 #mdms urls -egov.mdms.host=http://localhost:8094/ -egov.mdms.search.endpoint=egov-mdms-service/v1/_search - +#egov.mdms.host=http://localhost:8094/ +#egov.mdms.search.endpoint=egov-mdms-service/v1/_search +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search ##----------------------------- WATER AND SEWARAGE URL ------------------------------# egov.sw.host=http://localhost:8090 @@ -122,4 +123,8 @@ kafka.topics.bulk.bill.generation.audit=bulk-bill-generator-audit-sw bulk.demand.batch.value=1000 bulk.demand.offset.value=0 -egov.internal.microservice.user.uuid=b5b2ac70-d347-4339-98f0-5349ce25f99f \ No newline at end of file +egov.internal.microservice.user.uuid=b5b2ac70-d347-4339-98f0-5349ce25f99f + +spring.kafka.listener.missing-topics-fatal=false + +state.level.tenant.id=in.stateb diff --git a/municipal-services/sw-services/CHANGELOG.MD b/municipal-services/sw-services/CHANGELOG.MD index 93395ba47cf..d1ada309f5e 100644 --- a/municipal-services/sw-services/CHANGELOG.MD +++ b/municipal-services/sw-services/CHANGELOG.MD @@ -2,6 +2,10 @@ All notable changes to this module will be documented in this file. +## 1.7.5 - 2023-08-10 + +- Central Instance Library Integration +- ## 1.7.4 - 2023-01-31 - Improved encryptOldData api with resume functionality diff --git a/municipal-services/sw-services/pom.xml b/municipal-services/sw-services/pom.xml index 40dcbebef84..0a1b6dfaef5 100644 --- a/municipal-services/sw-services/pom.xml +++ b/municipal-services/sw-services/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 com.example sw-services - 1.7.4-SNAPSHOT + 1.7.5-SNAPSHOT sw_service Demo project for Spring Boot @@ -121,14 +120,14 @@ org.egov mdms-client - 0.0.2-SNAPSHOT + 0.0.4-SNAPSHOT compile org.egov.services tracer - 2.1.2-SNAPSHOT + 2.1.1-SNAPSHOT org.springframework.boot @@ -138,19 +137,14 @@ - repo.egovernments.org - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - repo.egovernments.org.snapshots + repo.egovernments.org eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ - - - repo.egovernments.org.public - eGov Public Repository Group - https://nexus-repo.egovernments.org/nexus/content/groups/public/ + https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/SwServiceApplication.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/SwServiceApplication.java index bb060158b70..eb17c38be43 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/SwServiceApplication.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/SwServiceApplication.java @@ -2,6 +2,7 @@ import java.util.TimeZone; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.encryption.config.EncryptionConfiguration; import org.egov.tracer.config.TracerConfiguration; import org.springframework.beans.factory.annotation.Value; @@ -15,9 +16,9 @@ import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; -@SpringBootApplication(scanBasePackages = "org.egov.swservice") +@SpringBootApplication(scanBasePackages = "org.egov") @EnableAutoConfiguration -@Import({ TracerConfiguration.class, EncryptionConfiguration.class }) +@Import({ TracerConfiguration.class, MultiStateInstanceUtil.class, EncryptionConfiguration.class }) public class SwServiceApplication{ @Value("${app.timezone}") private String timeZone; diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/config/SWConfiguration.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/config/SWConfiguration.java index 55c3b91bdb4..5a327918930 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/config/SWConfiguration.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/config/SWConfiguration.java @@ -1,5 +1,7 @@ package org.egov.swservice.config; +import java.util.Map; + import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -16,10 +18,8 @@ @Builder @Component -public class SWConfiguration { - - @Value("${egov.sewerageservice.pagination.default.limit}") - private Integer defaultLimit; +public class SWConfiguration { @Value("${egov.sewerageservice.pagination.default.limit}") +private Integer defaultLimit; @Value("${egov.sewerageservice.pagination.default.offset}") private Integer defaultOffset; @@ -93,7 +93,7 @@ public class SWConfiguration { @Value("${egov.usr.events.create.topic}") private String saveUserEventsTopic; - + @Value("${egov.user.event.notification.enabled}") private Boolean isUserEventsNotificationEnabled; @@ -116,7 +116,7 @@ public class SWConfiguration { @Value("${egov.internal.microservice.user.uuid}") private String egovInternalMicroserviceUserUuid; - + // sewerage connection Calculator @Value("${egov.sw.calculation.host}") private String calculatorHost; @@ -128,7 +128,6 @@ public class SWConfiguration { private String receiptBusinessservice; // sewerage notification links configuration - @Value("${sw.mseva.app.link}") private String mSevaAppLink; @@ -200,23 +199,33 @@ public class SWConfiguration { @Value("${state.level.tenant.id}") private String stateLevelTenantId; - - @Value("${reconnection.sw.workflow.name}") - private String swWorkflowReconnectionName; //mdms - @Value("${egov.mdms.host}") +// @Value("${egov.mdms.host}") +// private String mdmsHost; +// +// @Value("${egov.mdms.search.endpoint}") +// private String mdmsUrl; + + @Value("${mdms.v2.host}") private String mdmsHost; - @Value("${egov.mdms.search.endpoint}") + @Value("${mdms.v2.search.endpoint}") private String mdmsUrl; + + @Value("${egov.url.shortner.host}") + private String urlShortnerHost; @Value("${egov.disconnect.businessservice}") private String disconnectBusinessServiceName; - + @Value("${egov.reconnect.businessservice}") private String reconnectBusinessServiceName; + // central-instance configs + @Value("#{${egov.ui.app.host.map}}") + private Map uiAppHostMap; + @Value("${egov.idgen.sdcid.name}") private String sewerageDisconnectionIdGenName; diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/EditWorkflowNotificationConsumer.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/EditWorkflowNotificationConsumer.java index c4359a67c3f..76b4d7903cb 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/EditWorkflowNotificationConsumer.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/EditWorkflowNotificationConsumer.java @@ -1,16 +1,20 @@ package org.egov.swservice.consumer; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; + import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; -import org.egov.common.contract.request.Role; import org.egov.swservice.service.DiffService; import org.egov.swservice.service.SewerageService; import org.egov.swservice.service.SewerageServiceImpl; import org.egov.swservice.util.EncryptionDecryptionUtil; -import org.egov.swservice.web.models.OwnerInfo; +import org.egov.swservice.util.SWConstants; import org.egov.swservice.web.models.SearchCriteria; import org.egov.swservice.web.models.SewerageConnection; import org.egov.swservice.web.models.SewerageConnectionRequest; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; @@ -22,6 +26,9 @@ import java.util.List; import static org.egov.swservice.util.SWConstants.*; +import lombok.extern.slf4j.Slf4j; +import com.fasterxml.jackson.databind.ObjectMapper; + @Slf4j @Service @@ -48,11 +55,16 @@ public class EditWorkflowNotificationConsumer { * @param record - Received record from Kafka * @param topic - Received Topic Name */ - @KafkaListener(topics = { "${sw.editnotification.topic}" }) + @KafkaListener(topicPattern = "${sw.kafka.edit.notification.topic.pattern}") public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try { SewerageConnectionRequest sewerageConnectionRequest = mapper.convertValue(record, SewerageConnectionRequest.class); + String tenantId = sewerageConnectionRequest.getSewerageConnection().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(SWConstants.TENANTID_MDC_STRING, tenantId); + SewerageConnection sewerageConnection = sewerageConnectionRequest.getSewerageConnection(); SearchCriteria criteria = SearchCriteria.builder().applicationNumber(Collections.singleton(sewerageConnection.getApplicationNo())) .tenantId(sewerageConnection.getTenantId()).isInternalCall(Boolean.TRUE).build(); diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/FileStoreIdsConsumer.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/FileStoreIdsConsumer.java index f2f7c97dc60..11a1626dda5 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/FileStoreIdsConsumer.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/FileStoreIdsConsumer.java @@ -4,6 +4,7 @@ import org.egov.swservice.web.models.SewerageConnectionRequest; import org.egov.swservice.service.PdfFileStoreService; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; @@ -14,6 +15,8 @@ import lombok.extern.slf4j.Slf4j; +import static org.egov.swservice.util.SWConstants.TENANTID_MDC_STRING; + @Service @Slf4j public class FileStoreIdsConsumer { @@ -30,11 +33,16 @@ public class FileStoreIdsConsumer { * @param record - Received record from Kafka * @param topic - Received Topic Name */ - @KafkaListener(topics = { "${sw.consume.filestoreids.topic}" }) + @KafkaListener(topicPattern = "${sw.kafka.filestore.topic.pattern}") public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try { SewerageConnectionRequest sewerageConnectionRequest = mapper.convertValue(record, SewerageConnectionRequest.class); + String tenantId = sewerageConnectionRequest.getSewerageConnection().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + pdfService.process(sewerageConnectionRequest, topic); } catch (Exception ex) { StringBuilder builder = new StringBuilder("Error while listening to value: ").append(record) diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/ReceiptConsumer.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/ReceiptConsumer.java index e7cec29d193..f68ead55952 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/ReceiptConsumer.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/ReceiptConsumer.java @@ -3,7 +3,10 @@ import java.util.HashMap; import org.egov.swservice.service.PaymentUpdateService; +import org.egov.swservice.util.SWConstants; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.stereotype.Component; @@ -12,8 +15,15 @@ public class ReceiptConsumer { @Autowired private PaymentUpdateService paymentUpdateService; - @KafkaListener(topics = {"${kafka.topics.receipt.create}"}) + @Value("${state.level.tenant.id}") + private String stateLevelTenantID; + + @KafkaListener(topicPattern = "${kafka.topics.receipt.topic.pattern}") public void listenPayments(final HashMap record) { + + // Adding in MDC so that tracer can add it in header + MDC.put(SWConstants.TENANTID_MDC_STRING, stateLevelTenantID); + paymentUpdateService.process(record); } } diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/WorkflowNotificationConsumer.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/WorkflowNotificationConsumer.java index ace11194f93..c56fc92729c 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/WorkflowNotificationConsumer.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/consumer/WorkflowNotificationConsumer.java @@ -5,6 +5,7 @@ import org.egov.common.contract.request.Role; import org.egov.swservice.service.SewerageService; import org.egov.swservice.service.WorkflowNotificationService; +import org.slf4j.MDC; import org.egov.swservice.util.EncryptionDecryptionUtil; import org.egov.swservice.util.SWConstants; import org.egov.swservice.web.models.OwnerInfo; @@ -21,6 +22,8 @@ import static org.egov.swservice.util.SWConstants.*; +import static org.egov.swservice.util.SWConstants.TENANTID_MDC_STRING; + @Service @Slf4j public class WorkflowNotificationConsumer { @@ -35,7 +38,6 @@ public class WorkflowNotificationConsumer { private EncryptionDecryptionUtil encryptionDecryptionUtil; @Autowired private ObjectMapper mapper; - /** * Consumes the sewerage connection record and send notification * @@ -44,12 +46,16 @@ public class WorkflowNotificationConsumer { * @param topic - Received Topic Name */ - @KafkaListener(topics = { "${egov.sewarageservice.createconnection.topic}", "${egov.sewarageservice.updateconnection.topic}", - "${egov.sewerageservice.updatesewerageconnection.workflow.topic}" }) + @KafkaListener(topicPattern = "${sw.kafka.consumer.topic.pattern}") public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try { SewerageConnectionRequest sewerageConnectionRequest = mapper.convertValue(record, SewerageConnectionRequest.class); + String tenantId = sewerageConnectionRequest.getSewerageConnection().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + SewerageConnection sewerageConnection = sewerageConnectionRequest.getSewerageConnection(); String applicationStatus = sewerageConnection.getApplicationStatus(); if (!SWConstants.NOTIFICATION_ENABLE_FOR_STATUS.contains(sewerageConnection.getProcessInstance().getAction()+"_"+applicationStatus)) { diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/producer/SewarageConnectionProducer.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/producer/SewarageConnectionProducer.java index d220d445cde..3d81b69e643 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/producer/SewarageConnectionProducer.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/producer/SewarageConnectionProducer.java @@ -1,18 +1,31 @@ package org.egov.swservice.producer; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.kafka.CustomKafkaTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import lombok.extern.slf4j.Slf4j; + @Service +@Slf4j public class SewarageConnectionProducer { @Autowired private CustomKafkaTemplate kafkaTemplate; - public void push(String topic, Object value) { + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + /*public void push(String topic, Object value) { kafkaTemplate.send(topic, value); + }*/ + + public void push(String tenantId, String topic, Object value) { + String updatedTopic = centralInstanceUtil.getStateSpecificTopicName(tenantId, topic); + log.info("The Kafka topic for the tenantId : " + tenantId + " is : " + updatedTopic); + kafkaTemplate.send(updatedTopic, value); } } diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/repository/SewerageDaoImpl.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/repository/SewerageDaoImpl.java index 64b13e15a8e..b7ebcd76106 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/repository/SewerageDaoImpl.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/repository/SewerageDaoImpl.java @@ -7,19 +7,23 @@ import org.egov.common.contract.request.RequestInfo; import org.egov.common.contract.request.Role; -import org.egov.common.contract.request.User; +import org.egov.common.exception.InvalidTenantIdException; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.swservice.config.SWConfiguration; + +import org.egov.swservice.repository.rowmapper.EncryptionCountRowMapper; +import org.egov.swservice.repository.rowmapper.OpenSewerageRowMapper; +import org.egov.swservice.web.models.*; import org.egov.swservice.producer.SewarageConnectionProducer; import org.egov.swservice.repository.builder.SWQueryBuilder; -import org.egov.swservice.repository.rowmapper.EncryptionCountRowMapper; import org.egov.swservice.repository.rowmapper.OpenSewerageRowMapper; import org.egov.swservice.repository.rowmapper.SewerageRowMapper; import org.egov.swservice.util.SWConstants; -import org.egov.swservice.web.models.Connection; -import org.egov.swservice.web.models.EncryptionCount; import org.egov.swservice.web.models.SearchCriteria; import org.egov.swservice.web.models.SewerageConnection; import org.egov.swservice.web.models.SewerageConnectionRequest; +import org.egov.common.contract.request.User; +import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.jdbc.core.JdbcTemplate; @@ -50,6 +54,8 @@ public class SewerageDaoImpl implements SewerageDao { private SWConfiguration swConfiguration; @Autowired + private MultiStateInstanceUtil centralInstanceutil; + private EncryptionCountRowMapper encryptionCountRowMapper; @Value("${egov.sewarageservice.createconnection.topic}") @@ -66,7 +72,7 @@ public class SewerageDaoImpl implements SewerageDao { @Override public void saveSewerageConnection(SewerageConnectionRequest sewerageConnectionRequest) { - sewarageConnectionProducer.push(createSewarageConnection, sewerageConnectionRequest); + sewarageConnectionProducer.push(sewerageConnectionRequest.getSewerageConnection().getTenantId(),createSewarageConnection, sewerageConnectionRequest); } @Override @@ -75,6 +81,14 @@ public List getSewerageConnectionList(SearchCriteria criteri String query = swQueryBuilder.getSearchQueryString(criteria, preparedStatement, requestInfo); if (query == null) return Collections.emptyList(); + + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("SW_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + Boolean isOpenSearch = isSearchOpen(requestInfo.getUserInfo()); List sewerageConnectionList = new ArrayList<>(); if(isOpenSearch) @@ -96,10 +110,16 @@ public Integer getSewerageConnectionsCount(SearchCriteria criteria, RequestInfo if (query == null) return 0; + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("SW_SEARCH_COUNT_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } Integer count = jdbcTemplate.queryForObject(query, preparedStatement.toArray(), Integer.class); return count; } - + public Boolean isSearchOpen(User userInfo) { return userInfo.getType().equalsIgnoreCase("SYSTEM") @@ -107,58 +127,66 @@ public Boolean isSearchOpen(User userInfo) { } public void updateSewerageConnection(SewerageConnectionRequest sewerageConnectionRequest, - boolean isStateUpdatable) { + boolean isStateUpdatable) { String reqAction = sewerageConnectionRequest.getSewerageConnection().getProcessInstance().getAction(); if (isStateUpdatable) { if (SWConstants.EXECUTE_DISCONNECTION.equalsIgnoreCase(reqAction)) { sewerageConnectionRequest.getSewerageConnection().setStatus(Connection.StatusEnum.INACTIVE); } - if ((sewerageConnectionRequest.isReconnectRequest() || sewerageConnectionRequest.getSewerageConnection().getApplicationType().equalsIgnoreCase(SWConstants.SEWERAGE_RECONNECTION)) && SWConstants.ACTIVATE_CONNECTION_CONST.equalsIgnoreCase(reqAction)) { - sewerageConnectionRequest.getSewerageConnection().setStatus(Connection.StatusEnum.ACTIVE); - } - sewarageConnectionProducer.push(updateSewarageConnection, sewerageConnectionRequest); - } else { - sewarageConnectionProducer.push(swConfiguration.getWorkFlowUpdateTopic(), sewerageConnectionRequest); + sewarageConnectionProducer.push(sewerageConnectionRequest.getSewerageConnection().getTenantId(), updateSewarageConnection, sewerageConnectionRequest); + } else if (SWConstants.EXECUTE_DISCONNECTION.equalsIgnoreCase(sewerageConnectionRequest.getSewerageConnection().getProcessInstance().getAction())) { + sewerageConnectionRequest.getSewerageConnection().setStatus(Connection.StatusEnum.INACTIVE); + sewarageConnectionProducer.push(sewerageConnectionRequest.getSewerageConnection().getTenantId(), updateSewarageConnection, sewerageConnectionRequest); + } else { + sewarageConnectionProducer.push(sewerageConnectionRequest.getSewerageConnection().getTenantId(), swConfiguration.getWorkFlowUpdateTopic(), sewerageConnectionRequest); } } /** * push object for edit notification - * + * * @param sewerageConnectionRequest - Sewerage Connection Request Object */ public void pushForEditNotification(SewerageConnectionRequest sewerageConnectionRequest, boolean isStateUpdatable) { if (isStateUpdatable && !SWConstants.EDIT_NOTIFICATION_STATE .contains(sewerageConnectionRequest.getSewerageConnection().getProcessInstance().getAction())) { - sewarageConnectionProducer.push(swConfiguration.getEditNotificationTopic(), sewerageConnectionRequest); + sewarageConnectionProducer.push(sewerageConnectionRequest.getSewerageConnection().getTenantId(),swConfiguration.getEditNotificationTopic(), sewerageConnectionRequest); } } /** * Enrich file store Id's - * + * * @param sewerageConnectionRequest - Sewerage Connection Request Object */ public void enrichFileStoreIds(SewerageConnectionRequest sewerageConnectionRequest) { - sewarageConnectionProducer.push(swConfiguration.getFileStoreIdsTopic(), sewerageConnectionRequest); + sewarageConnectionProducer.push(sewerageConnectionRequest.getSewerageConnection().getTenantId(),swConfiguration.getFileStoreIdsTopic(), sewerageConnectionRequest); } /** * Save file store Id's - * + * * @param sewerageConnectionRequest - Sewerage Connection Request Object */ public void saveFileStoreIds(SewerageConnectionRequest sewerageConnectionRequest) { - sewarageConnectionProducer.push(swConfiguration.getSaveFileStoreIdsTopic(), sewerageConnectionRequest); + sewarageConnectionProducer.push(sewerageConnectionRequest.getSewerageConnection().getTenantId(),swConfiguration.getSaveFileStoreIdsTopic(), sewerageConnectionRequest); } - + @Override public List getSewerageConnectionPlainSearchList(SearchCriteria criteria, RequestInfo requestInfo) { List preparedStatement = new ArrayList<>(); String query = swQueryBuilder.getSearchQueryStringForPlainSearch(criteria, preparedStatement, requestInfo); if (query == null) return Collections.emptyList(); + + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("SW_PLAINSEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + log.info("\nFinal Query ::" + query); Boolean isOpenSearch = isSearchOpen(requestInfo.getUserInfo()); List sewerageConnectionList = new ArrayList<>(); @@ -178,7 +206,7 @@ public List getSewerageConnectionPlainSearchList(SearchCrite /* Method to push the encrypted data to the 'update' topic */ @Override public void updateOldSewerageConnections(SewerageConnectionRequest sewerageConnectionRequest) { - sewarageConnectionProducer.push(updateOldDataEncTopic, sewerageConnectionRequest); + sewarageConnectionProducer.push(sewerageConnectionRequest.getSewerageConnection().getTenantId(), updateSewarageConnection, sewerageConnectionRequest); } @@ -189,6 +217,14 @@ public Integer getTotalApplications(SearchCriteria criteria) { String query = swQueryBuilder.getTotalApplicationsCountQueryString(criteria, preparedStatement); if (query == null) return 0; + + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("SW_ENCRYPTION_TOTAL_APPLICATION_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + Integer count = jdbcTemplate.queryForObject(query, preparedStatement.toArray(), Integer.class); return count; } @@ -196,7 +232,7 @@ public Integer getTotalApplications(SearchCriteria criteria) { /* Method to push the old data encryption status to the 'ws-enc-audit' topic */ @Override public void updateEncryptionStatus(EncryptionCount encryptionCount) { - sewarageConnectionProducer.push(encryptionStatusTopic, encryptionCount); + sewarageConnectionProducer.push(encryptionCount.getTenantid(), encryptionStatusTopic, encryptionCount); } /* Method to find the last execution details in dB */ @@ -212,5 +248,4 @@ public EncryptionCount getLastExecutionDetail(SearchCriteria criteria) { EncryptionCount encryptionCount = jdbcTemplate.query(query, preparedStatement.toArray(), encryptionCountRowMapper); return encryptionCount; } - } diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/repository/builder/SWQueryBuilder.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/repository/builder/SWQueryBuilder.java index 8c34be20bc7..2faf437e3b1 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/repository/builder/SWQueryBuilder.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/repository/builder/SWQueryBuilder.java @@ -1,11 +1,14 @@ package org.egov.swservice.repository.builder; +import static org.egov.swservice.util.SWConstants.SEARCH_TYPE_CONNECTION; + import java.util.HashSet; import java.util.List; import java.util.Set; import org.apache.commons.lang.StringUtils; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.swservice.config.SWConfiguration; import org.egov.swservice.service.UserService; import org.egov.swservice.util.SewerageServicesUtil; @@ -15,8 +18,6 @@ import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; -import static org.egov.swservice.util.SWConstants.SEARCH_TYPE_CONNECTION; - @Component public class SWQueryBuilder { @@ -29,6 +30,9 @@ public class SWQueryBuilder { @Autowired private UserService userService; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + private static final String INNER_JOIN_STRING = "INNER JOIN"; private static final String LEFT_OUTER_JOIN_STRING = " LEFT OUTER JOIN "; @@ -43,32 +47,32 @@ public class SWQueryBuilder { + " conn.adhocpenaltyreason, conn.adhocpenaltycomment, conn.adhocrebatereason, conn.adhocrebatecomment, conn.applicationType, conn.channel, conn.dateEffectiveFrom," + " conn.locality, conn.isoldapplication, conn.roadtype, conn.disconnectionreason, conn.isDisconnectionTemporary, sc.disconnectionExecutionDate, document.id as doc_Id, document.documenttype, document.filestoreid, document.active as doc_active, plumber.id as plumber_id, plumber.name as plumber_name, plumber.licenseno," + " roadcuttingInfo.id as roadcutting_id, roadcuttingInfo.roadtype as roadcutting_roadtype, roadcuttingInfo.roadcuttingarea as roadcutting_roadcuttingarea, roadcuttingInfo.roadcuttingarea as roadcutting_roadcuttingarea, roadcuttingInfo.active as roadcutting_active," - + " plumber.mobilenumber as plumber_mobileNumber, plumber.gender as plumber_gender, plumber.fatherorhusbandname, plumber.correspondenceaddress, plumber.relationship, " + holderSelectValues - + " FROM eg_sw_connection conn " - + INNER_JOIN_STRING - + " eg_sw_service sc ON sc.connection_id = conn.id" + + " plumber.mobilenumber as plumber_mobileNumber, plumber.gender as plumber_gender, plumber.fatherorhusbandname, plumber.correspondenceaddress, plumber.relationship, " + holderSelectValues + + " FROM {schema}.eg_sw_connection conn " + + INNER_JOIN_STRING + + " {schema}.eg_sw_service sc ON sc.connection_id = conn.id" + LEFT_OUTER_JOIN_STRING - + "eg_sw_applicationdocument document ON document.swid = conn.id" + + "{schema}.eg_sw_applicationdocument document ON document.swid = conn.id" + LEFT_OUTER_JOIN_STRING - + "eg_sw_plumberinfo plumber ON plumber.swid = conn.id" + + "{schema}.eg_sw_plumberinfo plumber ON plumber.swid = conn.id" + LEFT_OUTER_JOIN_STRING - + "eg_sw_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + + "{schema}.eg_sw_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + LEFT_OUTER_JOIN_STRING - + "eg_sw_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.swid = conn.id AND roadcuttingInfo.active != 'INACTIVE'"; - - private final static String SEARCH_COUNT_QUERY = " FROM eg_sw_connection conn " - + INNER_JOIN_STRING - + " eg_sw_service sc ON sc.connection_id = conn.id" + + "{schema}.eg_sw_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.swid = conn.id AND roadcuttingInfo.active != 'INACTIVE'"; + + private final static String SEARCH_COUNT_QUERY = " FROM {schema}.eg_sw_connection conn " + + INNER_JOIN_STRING + + " {schema}.eg_sw_service sc ON sc.connection_id = conn.id" + LEFT_OUTER_JOIN_STRING - + "eg_sw_applicationdocument document ON document.swid = conn.id" + + "{schema}.eg_sw_applicationdocument document ON document.swid = conn.id" + LEFT_OUTER_JOIN_STRING - + "eg_sw_plumberinfo plumber ON plumber.swid = conn.id" + + "{schema}.eg_sw_plumberinfo plumber ON plumber.swid = conn.id" + LEFT_OUTER_JOIN_STRING - + "eg_sw_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + + "{schema}.eg_sw_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + LEFT_OUTER_JOIN_STRING - + "eg_sw_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.swid = conn.id"; + + "{schema}.eg_sw_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.swid = conn.id"; - private static final String TOTAL_APPLICATIONS_COUNT_QUERY = "select count(*) from eg_sw_connection where tenantid = ?;"; + private static final String TOTAL_APPLICATIONS_COUNT_QUERY = "select count(*) from {schema}.eg_sw_connection where tenantid = ?;"; private final String paginationWrapper = "SELECT * FROM " + "(SELECT *, DENSE_RANK() OVER (ORDER BY sc_appCreatedDate DESC) offset_ FROM " + @@ -96,7 +100,6 @@ public String getSearchQueryString(SearchCriteria criteria, List prepare if (criteria.isEmpty()) return null; Set propertyIds = new HashSet<>(); - if (criteria.getIsCountCall() == null) criteria.setIsCountCall(Boolean.FALSE); @@ -126,7 +129,6 @@ else if (criteria.getIsCountCall() && !StringUtils.isEmpty(criteria.getSearchTyp propertyIdsPresent = true; } } - Set uuids = null; if(!StringUtils.isEmpty(criteria.getMobileNumber()) || !StringUtils.isEmpty(criteria.getOwnerName()) || !StringUtils.isEmpty(criteria.getDoorNo())) { @@ -155,8 +157,8 @@ else if (criteria.getIsCountCall() && !StringUtils.isEmpty(criteria.getSearchTyp /* * to return empty result for mobilenumber empty result */ - if (!StringUtils.isEmpty(criteria.getMobileNumber()) - && !StringUtils.isEmpty(criteria.getDoorNo()) && !StringUtils.isEmpty(criteria.getOwnerName()) && + if (!StringUtils.isEmpty(criteria.getMobileNumber()) + && !StringUtils.isEmpty(criteria.getDoorNo()) && !StringUtils.isEmpty(criteria.getOwnerName()) && CollectionUtils.isEmpty(criteria.getPropertyIds()) && CollectionUtils.isEmpty(criteria.getUserIds()) && CollectionUtils.isEmpty(criteria.getApplicationNumber()) && StringUtils.isEmpty(criteria.getPropertyId()) && CollectionUtils.isEmpty(criteria.getConnectionNumber()) && CollectionUtils.isEmpty(criteria.getIds())) { @@ -164,8 +166,9 @@ else if (criteria.getIsCountCall() && !StringUtils.isEmpty(criteria.getSearchTyp } if (!StringUtils.isEmpty(criteria.getTenantId())) { + String tenantId = criteria.getTenantId(); addClauseIfRequired(preparedStatement, query); - if(criteria.getTenantId().equalsIgnoreCase(config.getStateLevelTenantId())){ + if(centralInstanceUtil.isTenantIdStateLevel(tenantId)){ query.append(" conn.tenantid LIKE ? "); preparedStatement.add(criteria.getTenantId() + '%'); } @@ -173,6 +176,7 @@ else if (criteria.getIsCountCall() && !StringUtils.isEmpty(criteria.getSearchTyp query.append(" conn.tenantid = ? "); preparedStatement.add(criteria.getTenantId()); } + } if (!StringUtils.isEmpty(criteria.getPropertyId()) && (StringUtils.isEmpty(criteria.getMobileNumber()) @@ -203,13 +207,11 @@ else if (criteria.getIsCountCall() && !StringUtils.isEmpty(criteria.getSearchTyp query.append(" conn.connectionno IN (").append(createQuery(criteria.getConnectionNumber())).append(")"); addToPreparedStatement(preparedStatement, criteria.getConnectionNumber()); } - if (!StringUtils.isEmpty(criteria.getStatus())) { addClauseIfRequired(preparedStatement, query); query.append(" conn.status = ? "); preparedStatement.add(criteria.getStatus()); } - // Added clause to support multiple applicationNumbers search if (!CollectionUtils.isEmpty(criteria.getApplicationNumber())) { addClauseIfRequired(preparedStatement, query); @@ -226,7 +228,6 @@ else if (criteria.getIsCountCall() && !StringUtils.isEmpty(criteria.getSearchTyp addToPreparedStatement(preparedStatement, criteria.getApplicationStatus()); } } - if (criteria.getFromDate() != null) { addClauseIfRequired(preparedStatement, query); query.append(" sc.appCreatedDate >= ? "); @@ -272,7 +273,6 @@ else if (criteria.getIsCountCall()) if (query.toString().contains("WHERE")) return addPaginationWrapper(query.toString(), preparedStatement, criteria); } - return query.toString(); } @@ -284,7 +284,6 @@ public String getSearchCountQueryString(SearchCriteria criteria, List pr else return query; } - private void addClauseIfRequired(List values, StringBuilder queryString) { if (values.isEmpty()) queryString.append(" WHERE "); @@ -345,16 +344,15 @@ private void addORClauseIfRequired(List values, StringBuilder queryStrin queryString.append(" OR"); } } - public String getSearchQueryStringForPlainSearch(SearchCriteria criteria, List preparedStatement, RequestInfo requestInfo) { if(criteria.isEmpty()) return null; StringBuilder query = new StringBuilder(SEWERAGE_SEARCH_QUERY); - + if (!StringUtils.isEmpty(criteria.getTenantId())) { addClauseIfRequired(preparedStatement, query); - if(criteria.getTenantId().equalsIgnoreCase(config.getStateLevelTenantId())){ + if(centralInstanceUtil.isTenantIdStateLevel(criteria.getTenantId())){ query.append(" conn.tenantid LIKE ? "); preparedStatement.add(criteria.getTenantId() + '%'); } @@ -363,18 +361,18 @@ public String getSearchQueryStringForPlainSearch(SearchCriteria criteria, List preparedStatement) { preparedStatement.add(criteria.getTenantId()); - return TOTAL_APPLICATIONS_COUNT_QUERY; + return TOTAL_APPLICATIONS_COUNT_QUERY.replace("{}",criteria.getTenantId()); } private String addPaginationWrapperForPlainSearch(String query, List preparedStmtList, SearchCriteria criteria) { @@ -407,7 +405,12 @@ private String addPaginationWrapperForPlainSearch(String query, List pre } public String getLastExecutionDetail(SearchCriteria criteria, List preparedStatement) { - preparedStatement.add(criteria.getTenantId()); + if(centralInstanceUtil.isTenantIdStateLevel(criteria.getTenantId())){ + preparedStatement.add(criteria.getTenantId() + '%'); + } + else{ + preparedStatement.add(criteria.getTenantId()); + } return LATEST_EXECUTED_MIGRATION_QUERY; } diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/service/CalculationService.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/service/CalculationService.java index b7895ac692e..c0bef82a356 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/service/CalculationService.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/service/CalculationService.java @@ -2,20 +2,20 @@ import java.math.BigDecimal; import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.request.Role; import org.egov.swservice.config.SWConfiguration; -import org.egov.swservice.repository.ServiceRequestRepository; import org.egov.swservice.repository.SewerageDao; import org.egov.swservice.util.SWConstants; +import org.egov.swservice.web.models.*; +import org.egov.swservice.repository.ServiceRequestRepository; import org.egov.swservice.util.SewerageServicesUtil; -import org.egov.swservice.web.models.CalculationCriteria; -import org.egov.swservice.web.models.CalculationReq; -import org.egov.swservice.web.models.CalculationRes; -import org.egov.swservice.web.models.Property; -import org.egov.swservice.web.models.RequestInfoWrapper; -import org.egov.swservice.web.models.SewerageConnectionRequest; import org.egov.swservice.web.models.collection.Bill; import org.egov.swservice.web.models.collection.BillResponse; import org.egov.swservice.workflow.WorkflowIntegrator; @@ -27,6 +27,9 @@ import lombok.extern.slf4j.Slf4j; +import static org.egov.swservice.util.SWConstants.PENDING_FOR_PAYMENT_STATUS_CODE; +import static org.egov.swservice.util.SWConstants.WORKFLOW_NODUE_COMMENT; + @Service @Slf4j public class CalculationService { diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/service/EditNotificationService.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/service/EditNotificationService.java index 3d65c968382..465b25e8312 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/service/EditNotificationService.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/service/EditNotificationService.java @@ -67,7 +67,7 @@ public void sendEditNotification(SewerageConnectionRequest request) { if (config.getIsUserEventsNotificationEnabled() != null && config.getIsUserEventsNotificationEnabled()) { EventRequest eventRequest = getEventRequest(request, property); if (eventRequest != null) { - notificationUtil.sendEventNotification(eventRequest); + notificationUtil.sendEventNotification(eventRequest, property.getTenantId()); } } } @@ -76,7 +76,7 @@ public void sendEditNotification(SewerageConnectionRequest request) { if (config.getIsSMSEnabled() != null && config.getIsSMSEnabled()) { List smsRequests = getSmsRequest(request, property); if (!CollectionUtils.isEmpty(smsRequests)) { - notificationUtil.sendSMS(smsRequests); + notificationUtil.sendSMS(smsRequests, request.getSewerageConnection().getTenantId()); } } } diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/service/EnrichmentService.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/service/EnrichmentService.java index db817fcdf13..2966d286695 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/service/EnrichmentService.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/service/EnrichmentService.java @@ -116,8 +116,8 @@ public void enrichSewerageConnection(SewerageConnectionRequest sewerageConnectio sewerageConnectionRequest.getSewerageConnection().setAdditionalDetails(additionalDetail); // Setting ApplicationType String applicationType=null; - - + + if(reqType==SWConstants.CREATE_APPLICATION) { applicationType=SWConstants.NEW_SEWERAGE_CONNECTION; } @@ -473,9 +473,14 @@ public List filterConnections(List conne if (creationDate1.compareTo(creationDate2) == -1) { connectionHashMap.put(connection.getConnectionNo(), connection); } - } else if(connection.getApplicationStatus().equals(SWConstants.MODIFIED_FINAL_STATE)) { + } else if (connection.getApplicationStatus().equals(SWConstants.MODIFIED_FINAL_STATE)) { connectionHashMap.put(connection.getConnectionNo(), connection); - } + } else { + if(connection.getApplicationStatus().equals(SWConstants + .DISCONNECTION_FINAL_STATE)) { + connectionHashMap.put(connection.getConnectionNo(), connection); + } + } } } }); @@ -613,7 +618,7 @@ public void enrichDocumentDetails(List sewerageConnectionLis auditObject.put("accessBy", requestInfo.getUserInfo().getUuid()); auditObject.put("purpose",DOCUMENT_ACCESS_AUDIT_MSG); - producer.push(config.getDocumentAuditTopic(), auditObject); + producer.push(propertyCriteria.getTenantId(), config.getDocumentAuditTopic(), auditObject); } } @@ -647,5 +652,4 @@ public OwnerInfo getConnectionHolderDetailsForUpdateCall(SewerageConnection sewe enrichConnectionHolderInfo(userDetailResponse, sewerageConnectionList, requestInfo); return userDetailResponse.getUser().get(0); } - } diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/service/PaymentUpdateService.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/service/PaymentUpdateService.java index 54b39b6e9d7..580ecc118cd 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/service/PaymentUpdateService.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/service/PaymentUpdateService.java @@ -22,6 +22,7 @@ import org.egov.swservice.web.models.workflow.ProcessInstance; import org.egov.swservice.workflow.WorkflowIntegrator; import org.egov.tracer.model.CustomException; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -35,6 +36,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import static org.egov.swservice.util.SWConstants.TENANTID_MDC_STRING; import static org.egov.swservice.util.SWConstants.*; @Slf4j @@ -83,6 +85,10 @@ public class PaymentUpdateService { public void process(HashMap record) { try { PaymentRequest paymentRequest = mapper.convertValue(record, PaymentRequest.class); + String tenantId = paymentRequest.getPayment().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); boolean isServiceMatched = false; for (PaymentDetail paymentDetail : paymentRequest.getPayment().getPaymentDetails()) { if (paymentDetail.getBusinessService().equalsIgnoreCase(config.getReceiptBusinessservice()) || @@ -241,7 +247,7 @@ public void sendPaymentNotification(SewerageConnectionRequest sewerageConnection if (config.getIsUserEventsNotificationEnabled() != null && config.getIsUserEventsNotificationEnabled()) { EventRequest eventRequest = getEventRequest(sewerageConnectionRequest, property, paymentDetail); if (eventRequest != null) { - notificationUtil.sendEventNotification(eventRequest); + notificationUtil.sendEventNotification(eventRequest, property.getTenantId()); } } } @@ -249,7 +255,7 @@ public void sendPaymentNotification(SewerageConnectionRequest sewerageConnection if (config.getIsSMSEnabled() != null && config.getIsSMSEnabled()) { List smsRequests = getSmsRequest(sewerageConnectionRequest, property, paymentDetail); if (!CollectionUtils.isEmpty(smsRequests)) { - notificationUtil.sendSMS(smsRequests); + notificationUtil.sendSMS(smsRequests, property.getTenantId()); } } } @@ -258,7 +264,7 @@ public void sendPaymentNotification(SewerageConnectionRequest sewerageConnection if (config.getIsEmailNotificationEnabled() != null && config.getIsEmailNotificationEnabled()) { List emailRequests = getEmailRequest(sewerageConnectionRequest, property, paymentDetail); if (!CollectionUtils.isEmpty(emailRequests)) { - notificationUtil.sendEmail(emailRequests); + notificationUtil.sendEmail(emailRequests, property.getTenantId()); } } } diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/service/PdfFileStoreService.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/service/PdfFileStoreService.java index 13c7305bc62..66eb792d62b 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/service/PdfFileStoreService.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/service/PdfFileStoreService.java @@ -7,7 +7,9 @@ import java.util.Optional; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.swservice.config.SWConfiguration; +import org.egov.swservice.util.NotificationUtil; import org.egov.swservice.web.models.Calculation; import org.egov.swservice.web.models.CalculationCriteria; import org.egov.swservice.web.models.CalculationReq; @@ -58,6 +60,12 @@ public class PdfFileStoreService { @Autowired private ValidateProperty validateProperty; + @Autowired + private NotificationUtil notificationUtil; + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + String tenantIdReplacer = "$tenantId"; String fileStoreIdsReplacer = "$.filestoreIds"; String urlReplacer = "url"; @@ -126,8 +134,11 @@ public String getFileStoreId(SewerageConnectionRequest sewerageConnectionRequest sewerageObject.put(sla, slaDays.divide(BigDecimal.valueOf(SWConstants.DAYS_CONST))); sewerageObject.put(slaDate, slaDays.add( new BigDecimal(System.currentTimeMillis()))); - String[] tenantDetails = property.getTenantId().split("\\."); - String tenantId = tenantDetails[0]; + String[] tenantDetails = property.getTenantId().split("\\."); + String tenantId = property.getTenantId(); + if(tenantDetails.length > centralInstanceUtil.getStateLevelTenantIdLength()){ + tenantId = tenantDetails[0] + "." + tenantDetails[1]; + } if(tenantDetails.length > 1) { sewerageObject.put(tenantName, tenantDetails[1].toUpperCase()); diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/service/SewerageServiceImpl.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/service/SewerageServiceImpl.java index 8bb612b5de6..90de6d70027 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/service/SewerageServiceImpl.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/service/SewerageServiceImpl.java @@ -23,6 +23,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; @@ -208,6 +209,8 @@ private void validateReconnectionRequest(SewerageConnectionRequest sewerageConne * @return List of matching sewerage connection */ public List search(SearchCriteria criteria, RequestInfo requestInfo) { + sewerageConnectionValidator.validateSearch(criteria); + //Creating copies of apiPlainAcessRequests for decryption process //Any decryption process returns the requestInfo with only the already used plain Access Request fields PlainAccessRequest apiPlainAccessRequest = null, apiPlainAccessRequestCopy = null; @@ -264,7 +267,7 @@ public List getSewerageConnectionsList(SearchCriteria criter } /** - * + * * @param criteria * SewerageConnectionSearchCriteria contains search criteria on * sewerage connection @@ -276,14 +279,6 @@ public Integer countAllSewerageApplications(SearchCriteria criteria, RequestInfo return getSewerageConnectionsCount(criteria, requestInfo); } - /** - * - * @param criteria SewerageConnectionSearchCriteria contains search criteria - * on sewerage connection - * @param requestInfo - Request Info Object - * @return Count of List of matching sewerage connection - */ - public Integer getSewerageConnectionsCount(SearchCriteria criteria, RequestInfo requestInfo) { return sewerageDao.getSewerageConnectionsCount(criteria, requestInfo); } @@ -320,7 +315,7 @@ else if (sewerageConnectionRequest.isReconnectRequest() || sewerageConnectionReq BusinessService businessService = workflowService.getBusinessService(config.getBusinessServiceValue(), sewerageConnectionRequest.getSewerageConnection().getTenantId(), sewerageConnectionRequest.getRequestInfo()); - SewerageConnection searchResult = getConnectionForUpdateRequest( + SewerageConnection searchResult = getConnectionForUpdateRequest(sewerageConnectionRequest.getSewerageConnection().getTenantId(), sewerageConnectionRequest.getSewerageConnection().getId(), sewerageConnectionRequest.getRequestInfo()); Boolean isStateUpdatable = sewerageServicesUtil.getStatusForUpdate(businessService, previousApplicationStatus); @@ -347,6 +342,22 @@ else if (sewerageConnectionRequest.isReconnectRequest() || sewerageConnectionReq enrichmentService.enrichFileStoreIds(sewerageConnectionRequest); enrichmentService.postStatusEnrichment(sewerageConnectionRequest); + /* encrypt here */ + sewerageConnectionRequest.setSewerageConnection(encryptConnectionDetails(sewerageConnectionRequest.getSewerageConnection())); + + /* encrypt here for connection holder details */ + sewerageConnectionRequest.setSewerageConnection(encryptConnectionHolderDetails(sewerageConnectionRequest.getSewerageConnection())); + + sewerageDao.updateSewerageConnection(sewerageConnectionRequest, isStateUpdatable); + + if (!StringUtils.isEmpty(sewerageConnectionRequest.getSewerageConnection().getTenantId())) + criteria.setTenantId(sewerageConnectionRequest.getSewerageConnection().getTenantId()); + enrichmentService.enrichProcessInstance(Arrays.asList(sewerageConnectionRequest.getSewerageConnection()), criteria, sewerageConnectionRequest.getRequestInfo()); + + /* decrypt here */ + sewerageConnectionRequest.setSewerageConnection(decryptConnectionDetails(sewerageConnectionRequest.getSewerageConnection(), sewerageConnectionRequest.getRequestInfo())); + + /* encrypt here */ sewerageConnectionRequest.setSewerageConnection(encryptConnectionDetails(sewerageConnectionRequest.getSewerageConnection())); /* encrypt here for connection holder details */ @@ -366,7 +377,6 @@ else if (sewerageConnectionRequest.isReconnectRequest() || sewerageConnectionReq private List updateSewerageConnectionForDisconnectFlow(SewerageConnectionRequest sewerageConnectionRequest) { SearchCriteria criteria = new SearchCriteria(); - sewerageConnectionValidator.validateSewerageConnection(sewerageConnectionRequest, SWConstants.DISCONNECT_CONNECTION); mDMSValidator.validateMasterData(sewerageConnectionRequest, SWConstants.DISCONNECT_CONNECTION); Property property = validateProperty.getOrValidateProperty(sewerageConnectionRequest); @@ -378,7 +388,7 @@ private List updateSewerageConnectionForDisconnectFlow(Sewer BusinessService businessService = workflowService.getBusinessService(config.getDisconnectBusinessServiceName(), sewerageConnectionRequest.getSewerageConnection().getTenantId(), sewerageConnectionRequest.getRequestInfo()); - SewerageConnection searchResult = getConnectionForUpdateRequest( + SewerageConnection searchResult = getConnectionForUpdateRequest(sewerageConnectionRequest.getSewerageConnection().getTenantId(), sewerageConnectionRequest.getSewerageConnection().getId(), sewerageConnectionRequest.getRequestInfo()); Boolean isStateUpdatable = sewerageServicesUtil.getStatusForUpdate(businessService, previousApplicationStatus); @@ -405,6 +415,9 @@ private List updateSewerageConnectionForDisconnectFlow(Sewer } // Call workflow wfIntegrator.callWorkFlow(sewerageConnectionRequest, property); + // Enrich file store Id After payment + enrichmentService.enrichFileStoreIds(sewerageConnectionRequest); + enrichmentService.postStatusEnrichment(sewerageConnectionRequest); /* encrypt here */ sewerageConnectionRequest.setSewerageConnection(encryptConnectionDetails(sewerageConnectionRequest.getSewerageConnection())); @@ -446,7 +459,7 @@ private List updateSewerageConnectionForReconnectFlow(Sewera BusinessService businessService = workflowService.getBusinessService(config.getReconnectBusinessServiceName(), sewerageConnectionRequest.getSewerageConnection().getTenantId(), sewerageConnectionRequest.getRequestInfo()); - SewerageConnection searchResult = getConnectionForUpdateRequest( + SewerageConnection searchResult = getConnectionForUpdateRequest(sewerageConnectionRequest.getSewerageConnection().getTenantId(), sewerageConnectionRequest.getSewerageConnection().getId(), sewerageConnectionRequest.getRequestInfo()); Boolean isStateUpdatable = sewerageServicesUtil.getStatusForUpdate(businessService, previousApplicationStatus); @@ -508,10 +521,11 @@ private List updateSewerageConnectionForReconnectFlow(Sewera * @param requestInfo - Request Info Object * @return sewerage connection */ - public SewerageConnection getConnectionForUpdateRequest(String id, RequestInfo requestInfo) { + public SewerageConnection getConnectionForUpdateRequest(String tenantId, String id, RequestInfo requestInfo) { SearchCriteria criteria = new SearchCriteria(); Set ids = new HashSet<>(Arrays.asList(id)); criteria.setIds(ids); + criteria.setTenantId(tenantId); List connections = getSewerageConnectionsList(criteria, requestInfo); if (CollectionUtils.isEmpty(connections)) { StringBuilder builder = new StringBuilder(); @@ -531,6 +545,7 @@ private List getAllSewerageApplications(SewerageConnectionRe SearchCriteria criteria = SearchCriteria.builder() .connectionNumber(Stream.of(sewerageConnection.getConnectionNo().toString()).collect(Collectors.toSet())).isCountCall(false) .build(); + criteria.setTenantId(sewerageConnection.getTenantId()); if(sewerageConnectionRequest.isDisconnectRequest() || !StringUtils.isEmpty(sewerageConnection.getConnectionNo())) criteria.setIsInternalCall(true); @@ -554,7 +569,7 @@ private List modifySewerageConnection(SewerageConnectionRequ BusinessService businessService = workflowService.getBusinessService(config.getModifySWBusinessServiceName(), sewerageConnectionRequest.getSewerageConnection().getTenantId(), sewerageConnectionRequest.getRequestInfo()); - SewerageConnection searchResult = getConnectionForUpdateRequest( + SewerageConnection searchResult = getConnectionForUpdateRequest(sewerageConnectionRequest.getSewerageConnection().getTenantId(), sewerageConnectionRequest.getSewerageConnection().getId(), sewerageConnectionRequest.getRequestInfo()); Boolean isStateUpdatable = sewerageServicesUtil.getStatusForUpdate(businessService, previousApplicationStatus); @@ -587,7 +602,8 @@ private List modifySewerageConnection(SewerageConnectionRequ } public void markOldApplication(SewerageConnectionRequest sewerageConnectionRequest) { - if (sewerageConnectionRequest.getSewerageConnection().getProcessInstance().getAction().equalsIgnoreCase(APPROVE_CONNECTION)) { + String action = sewerageConnectionRequest.getSewerageConnection().getProcessInstance().getAction(); + if (action.equalsIgnoreCase(APPROVE_CONNECTION) || action.equalsIgnoreCase(EXECUTE_DISCONNECTION)) { String currentModifiedApplicationNo = sewerageConnectionRequest.getSewerageConnection().getApplicationNo(); List sewerageConnectionList = getAllSewerageApplications(sewerageConnectionRequest); @@ -602,7 +618,6 @@ public void markOldApplication(SewerageConnectionRequest sewerageConnectionReque } } } - public List plainSearch(SearchCriteria criteria, RequestInfo requestInfo) { criteria.setIsSkipLevelSearch(Boolean.TRUE); List sewerageConnectionList = getSewerageConnectionsPlainSearchList(criteria, requestInfo); @@ -611,7 +626,6 @@ public List plainSearch(SearchCriteria criteria, RequestInfo enrichmentService.enrichConnectionHolderDeatils(sewerageConnectionList, criteria, requestInfo); return sewerageConnectionList; } - public List getSewerageConnectionsPlainSearchList(SearchCriteria criteria, RequestInfo requestInfo) { return sewerageDao.getSewerageConnectionPlainSearchList(criteria, requestInfo); } diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/service/WorkflowNotificationService.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/service/WorkflowNotificationService.java index 0b277321b4e..c163e7e652b 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/service/WorkflowNotificationService.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/service/WorkflowNotificationService.java @@ -9,8 +9,11 @@ import org.apache.commons.lang.StringUtils; import org.egov.common.contract.request.RequestInfo; import org.egov.common.contract.request.User; +import org.egov.common.utils.MultiStateInstanceUtil; + import org.egov.swservice.config.SWConfiguration; import org.egov.swservice.repository.ServiceRequestRepository; +import org.egov.swservice.util.EncryptionDecryptionUtil; import org.egov.swservice.util.NotificationUtil; import org.egov.swservice.util.SWConstants; import org.egov.swservice.util.SewerageServicesUtil; @@ -65,6 +68,9 @@ public class WorkflowNotificationService { @Autowired private UserService userService; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + String tenantIdReplacer = "$tenantId"; String urlReplacer = "url"; String requestInfoReplacer = "RequestInfo"; @@ -108,7 +114,7 @@ public void process(SewerageConnectionRequest request, String topic) { if (config.getIsUserEventsNotificationEnabled() != null && config.getIsUserEventsNotificationEnabled()) { EventRequest eventRequest = getEventRequest(request, topic, property, applicationStatus); if (eventRequest != null) { - notificationUtil.sendEventNotification(eventRequest); + notificationUtil.sendEventNotification(eventRequest, property.getTenantId()); } } } @@ -117,7 +123,7 @@ public void process(SewerageConnectionRequest request, String topic) { if (config.getIsSMSEnabled() != null && config.getIsSMSEnabled()) { List smsRequests = getSmsRequest(request, topic, property, applicationStatus); if (!CollectionUtils.isEmpty(smsRequests)) { - notificationUtil.sendSMS(smsRequests); + notificationUtil.sendSMS(smsRequests, property.getTenantId()); } } } @@ -125,7 +131,7 @@ public void process(SewerageConnectionRequest request, String topic) { if (config.getIsEmailNotificationEnabled() != null && config.getIsEmailNotificationEnabled()) { List emailRequests = getEmailRequest(request, topic, property, applicationStatus); if (!CollectionUtils.isEmpty(emailRequests)) { - notificationUtil.sendEmail(emailRequests); + notificationUtil.sendEmail(emailRequests, property.getTenantId()); } }} @@ -284,18 +290,20 @@ public Action getActionForEventNotification(Map mobileNumberAndM actionLink = config.getNotificationUrl() + config.getViewHistoryLink(); actionLink = actionLink.replace(applicationNumberReplacer, sewerageConnectionRequest.getSewerageConnection().getApplicationNo()); } + if (code.equalsIgnoreCase("DOWNLOAD RECEIPT")) { actionLink = config.getNotificationUrl() + config.getMyPaymentsLink(); } if (code.equalsIgnoreCase("View History Link")) { - actionLink = config.getNotificationUrl() + config.getViewHistoryLink(); + actionLink = notificationUtil.getHost(property.getTenantId()) + config.getViewHistoryLink(); actionLink = actionLink.replace(mobileNoReplacer, mobileNumber); actionLink = actionLink.replace(applicationNumberReplacer, sewerageConnectionRequest.getSewerageConnection().getApplicationNo()); actionLink = actionLink.replace(tenantIdReplacer, property.getTenantId()); } if (code.equalsIgnoreCase("Connection Detail Page")) { - actionLink = config.getNotificationUrl() + config.getConnectionDetailsLink(); + actionLink = notificationUtil.getHost(property.getTenantId()) + config.getConnectionDetailsLink(); +// actionLink = config.getNotificationUrl() + config.getConnectionDetailsLink(); actionLink = actionLink.replace(applicationNumberReplacer, sewerageConnectionRequest.getSewerageConnection().getApplicationNo()); } ActionItem item = ActionItem.builder().actionUrl(actionLink).code(code).build(); @@ -366,7 +374,6 @@ private List getSmsRequest(SewerageConnectionRequest sewerageConnect } }); - //send the notification to the connection holders if(!CollectionUtils.isEmpty(sewerageConnectionRequest.getSewerageConnection().getConnectionHolders())) { sewerageConnectionRequest.getSewerageConnection().getConnectionHolders().forEach(holder -> { @@ -547,7 +554,8 @@ public Map getMessageForMobileNumber(Map mobileN sewerageServicesUtil.getShortenedURL(config.getMSevaAppLink())); if (messageToReplace.contains("{View History Link}")) { - String historyLink = config.getNotificationUrl() + config.getViewHistoryLink(); + + String historyLink = notificationUtil.getHost(property.getTenantId()) + config.getViewHistoryLink(); historyLink = historyLink.replace(mobileNoReplacer, mobileAndName.getKey()); historyLink = historyLink.replace(applicationNumberReplacer, sewerageConnectionRequest.getSewerageConnection().getApplicationNo()); @@ -569,9 +577,12 @@ public Map getMessageForMobileNumber(Map mobileN sewerageServicesUtil.getShortenedURL(config.getNotificationUrl()));*/ if (messageToReplace.contains("{connection details page}")) { - String connectionDetaislLink = config.getNotificationUrl() + config.getConnectionDetailsLink(); + + String connectionDetaislLink = notificationUtil.getHost(property.getTenantId()) + config.getConnectionDetailsLink(); +// String connectionDetaislLink = config.getNotificationUrl() + config.getConnectionDetailsLink(); connectionDetaislLink = connectionDetaislLink.replace(applicationNumberReplacer, sewerageConnectionRequest.getSewerageConnection().getApplicationNo()); + connectionDetaislLink = connectionDetaislLink.replace(tenantIdReplacer, property.getTenantId()); messageToReplace = messageToReplace.replace("{connection details page}", sewerageServicesUtil.getShortenedURL(connectionDetaislLink)); } @@ -722,7 +733,8 @@ private String getApplicationDownloaderLink(SewerageConnectionRequest sewerageCo sewerageObject.put(serviceFee, calResponse.getCalculation().get(0).getCharge()); sewerageObject.put(tax, calResponse.getCalculation().get(0).getTaxAmount()); sewerageObject.put(propertyKey, property); - String tenantId = property.getTenantId().split("\\.")[0]; +// String tenantId = property.getTenantId().split("\\.")[0]; + String tenantId = centralInstanceUtil.getStateLevelTenant(property.getTenantId()); String fileStoreId = getFielStoreIdFromPDFService(sewerageObject, sewerageConnectionRequest.getRequestInfo(), tenantId); return getApplicationDownloadLink(tenantId, fileStoreId); diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/util/NotificationUtil.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/util/NotificationUtil.java index ef476064a50..47fdccbc1bd 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/util/NotificationUtil.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/util/NotificationUtil.java @@ -5,8 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; + +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.common.contract.request.Role; import org.egov.common.contract.request.User; + import org.egov.mdms.model.MasterDetail; import org.egov.mdms.model.MdmsCriteria; import org.egov.mdms.model.MdmsCriteriaReq; @@ -17,6 +20,9 @@ import org.egov.swservice.web.models.EmailRequest; import org.egov.swservice.web.models.EventRequest; import org.egov.swservice.web.models.SMSRequest; + +import org.egov.tracer.model.CustomException; + import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -28,6 +34,9 @@ import static com.jayway.jsonpath.Criteria.where; import static com.jayway.jsonpath.Filter.filter; import static org.egov.swservice.util.SWConstants.*; +import static org.egov.swservice.util.SWConstants.EMAIL_MESSAGE; + +import org.springframework.util.ObjectUtils; @Component @Slf4j @@ -45,6 +54,8 @@ public class NotificationUtil { @Autowired private RestTemplate restTemplate; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; /** * Returns the uri for the localization call @@ -56,7 +67,8 @@ public class NotificationUtil { public StringBuilder getUri(String tenantId, RequestInfo requestInfo) { if (config.getIsLocalizationStateLevel()) - tenantId = tenantId.split("\\.")[0]; + tenantId = centralInstanceUtil.getStateLevelTenant(tenantId); +// tenantId = tenantId.split("\\.")[0] + "." + tenantId.split("\\.")[1]; String locale = SWConstants.NOTIFICATION_LOCALE; if (!StringUtils.isEmpty(requestInfo.getMsgId()) && requestInfo.getMsgId().split("|").length >= 2) @@ -112,12 +124,12 @@ public String getMessageTemplate(String notificationCode, String localizationMes * @param smsRequestList * The list of SMSRequest to be sent */ - public void sendSMS(List smsRequestList) { + public void sendSMS(List smsRequestList, String tenantId) { if (config.getIsSMSEnabled()) { if (CollectionUtils.isEmpty(smsRequestList)) log.info("Messages from localization couldn't be fetched!"); for (SMSRequest smsRequest : smsRequestList) { - producer.push(config.getSmsNotifTopic(), smsRequest); + producer.push(tenantId, config.getSmsNotifTopic(), smsRequest); StringBuilder builder = new StringBuilder(); builder.append(" Messages: ") .append(smsRequest.getMessage()); @@ -211,9 +223,9 @@ public String getCustomizedMsgForInApp(String action, String applicationStatus, * * @param request - Event Request Object */ - public void sendEventNotification(EventRequest request) { + public void sendEventNotification(EventRequest request, String tenantId) { log.info("Pushing Event: " + request.toString()); - producer.push(config.getSaveUserEventsTopic(), request); + producer.push(tenantId, config.getSaveUserEventsTopic(), request); } /** @@ -231,13 +243,13 @@ public String getCustomizedMsg(String code, String localizationMessage) { * @param emailRequestList * The list of EmailRequest to be sent */ - public void sendEmail(List emailRequestList) { + public void sendEmail(List emailRequestList, String tenantId) { if (config.getIsEmailNotificationEnabled()) { if (CollectionUtils.isEmpty(emailRequestList)) log.info("Messages from localization couldn't be fetched!"); for (EmailRequest emailRequest : emailRequestList) { - producer.push(config.getEmailNotifTopic(), emailRequest); + producer.push(tenantId, config.getEmailNotifTopic(), emailRequest); log.info("Email Request -> "+emailRequest.toString()); log.info("EMAIL notification sent!"); } @@ -285,7 +297,7 @@ public List fetchChannelList(RequestInfo requestInfo, String tenantId, S uri.append(config.getMdmsHost()).append(config.getMdmsUrl()); if(StringUtils.isEmpty(tenantId)) return masterData; - MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequestForChannelList(requestInfo, tenantId.split("\\.")[0]); + MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequestForChannelList(requestInfo, centralInstanceUtil.getStateLevelTenant(tenantId)); Filter masterDataFilter = filter( where(MODULECONSTANT).is(moduleName).and(ACTION).is(action) @@ -300,7 +312,7 @@ public List fetchChannelList(RequestInfo requestInfo, String tenantId, S return masterData; } - private MdmsCriteriaReq getMdmsRequestForChannelList(RequestInfo requestInfo, String tenantId){ + private MdmsCriteriaReq getMdmsRequestForChannelList(RequestInfo requestInfo, String tenantId) { MasterDetail masterDetail = new MasterDetail(); masterDetail.setName(CHANNEL_LIST); List masterDetailList = new ArrayList<>(); @@ -323,6 +335,16 @@ private MdmsCriteriaReq getMdmsRequestForChannelList(RequestInfo requestInfo, St return mdmsCriteriaReq; } + public String getHost(String tenantId) { + String topLevelTenant = tenantId; + topLevelTenant = centralInstanceUtil.getStateLevelTenant(tenantId); + String host = (config.getUiAppHostMap().get(topLevelTenant)); + if (ObjectUtils.isEmpty(host)) { + throw new CustomException("EG_NOTIF_HOST_ERR", "No host found for tenantid: " + topLevelTenant); + } + return host; + } + /** * * @param tenantId diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/util/SWConstants.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/util/SWConstants.java index 866943abee8..58b09d5f388 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/util/SWConstants.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/util/SWConstants.java @@ -224,7 +224,6 @@ private SWConstants() { "connectionCategory", "connectionType", "documentType", "fileStoreId", "licenseNo")); public static final String SUBMIT_APPLICATION_CONST = "SUBMIT_APPLICATION"; - public static final List IGNORE_CLASS_ADDED = Collections.unmodifiableList(Arrays.asList("PlumberInfo")); public static final String PENDING_FOR_CONNECTION_ACTIVATION = "PENDING_FOR_CONNECTION_ACTIVATION"; @@ -299,7 +298,14 @@ private SWConstants() { public static final String CHANNEL_LIST = "channelList"; public static final String CHANNEL = "Channel"; - + + public static String SCHEMA_REPLACE_STRING = "{schema}"; + + public static final String TENANTID_MDC_STRING = "TENANTID"; + + public static final List TOPICS_TO_AVOID = Collections.unmodifiableList(Arrays.asList("editnotificationsewerage", "sw-filestoreids-process")); + + public static final String ACTIVE = "ACTIVE"; public static final String EXECUTE_DISCONNECTION = "EXECUTE_DISCONNECTION"; @@ -323,7 +329,6 @@ private SWConstants() { public static final String WNS_PLUMBER_PLAIN_DECRYPTION_MODEL = "WnSConnectionPlumberDecrypDisabled"; - public static final String WNS_PLUMBER_ENCRYPTION_MODEL = "WnSConnectionPlumber"; public static final String URL_PARAMS_SEPARATER = "?"; diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/util/SewerageServicesUtil.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/util/SewerageServicesUtil.java index 41dbe6d4008..d88fe876b13 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/util/SewerageServicesUtil.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/util/SewerageServicesUtil.java @@ -99,6 +99,10 @@ public List propertySearch(SewerageConnectionRequest sewerageConnectio propertyCriteria.setTenantId(sewerageConnectionRequest.getSewerageConnection().getTenantId()); propertyCriteria.setLocality(addDetail.get(localityCode).toString()); } + if (sewerageConnectionRequest.getRequestInfo().getUserInfo() != null + && "CITIZEN".equalsIgnoreCase(sewerageConnectionRequest.getRequestInfo().getUserInfo().getType())) { + propertyCriteria.setTenantId(sewerageConnectionRequest.getSewerageConnection().getTenantId()); + } Object result = serviceRequestRepository.fetchResult( getPropertyURL(propertyCriteria), RequestInfoWrapper.builder().requestInfo(sewerageConnectionRequest.getRequestInfo()).build()); @@ -238,7 +242,7 @@ public StringBuilder getEstimationURL() { public String getShortenedURL(String actualURL) { JSONObject obj = new JSONObject(); obj.put(URL, actualURL); - String url = config.getNotificationUrl() + config.getShortenerURL(); + String url = config.getUrlShortnerHost() + config.getShortenerURL(); Object response = serviceRequestRepository.getShortningURL(new StringBuilder(url), obj); return response.toString(); diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/validator/SewerageConnectionValidator.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/validator/SewerageConnectionValidator.java index 8ce376c6588..fdde341e3d9 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/validator/SewerageConnectionValidator.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/validator/SewerageConnectionValidator.java @@ -5,7 +5,11 @@ import java.util.List; import java.util.Map; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.swservice.config.SWConfiguration; +import org.egov.swservice.web.models.SearchCriteria; import org.egov.swservice.util.EncryptionDecryptionUtil; + import org.egov.swservice.util.SWConstants; import org.egov.swservice.web.models.OwnerInfo; import org.egov.swservice.web.models.SewerageConnection; @@ -30,9 +34,16 @@ public class SewerageConnectionValidator { @Autowired private SewerageFieldValidator sewerageFieldValidator; + @Autowired + private SWConfiguration configs; + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + @Autowired EncryptionDecryptionUtil encryptionDecryptionUtil; + /**Used strategy pattern for avoiding multiple if else condition * * @param sewerageConnectionRequest SewarageConnectionRequest is request for create or update @@ -180,4 +191,11 @@ public void validateConnectionStatus(List previousConnection throw new CustomException(errorMap); } + public void validateSearch(SearchCriteria criteria){ + if(centralInstanceUtil.getIsEnvironmentCentralInstance() && criteria.getTenantId() == null) + throw new CustomException("EG_SW_INVALID_SEARCH"," TenantId is mandatory for search "); + else if(centralInstanceUtil.getIsEnvironmentCentralInstance() && criteria.getTenantId().split("\\.").length < centralInstanceUtil.getStateLevelTenantIdLength()) + throw new CustomException("EG_SW_INVALID_SEARCH"," TenantId should be mandatorily " + centralInstanceUtil.getStateLevelTenantIdLength() + " levels for search"); + } + } diff --git a/municipal-services/sw-services/src/main/java/org/egov/swservice/validator/ValidateProperty.java b/municipal-services/sw-services/src/main/java/org/egov/swservice/validator/ValidateProperty.java index 36f896b6a29..be8718bab0a 100644 --- a/municipal-services/sw-services/src/main/java/org/egov/swservice/validator/ValidateProperty.java +++ b/municipal-services/sw-services/src/main/java/org/egov/swservice/validator/ValidateProperty.java @@ -4,6 +4,7 @@ import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.swservice.util.SewerageServicesUtil; import org.egov.swservice.web.models.Property; import org.egov.swservice.web.models.SewerageConnection; @@ -30,6 +31,9 @@ public class ValidateProperty { @Autowired private MDMSValidator mdmsValidator; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + /** * * @param property @@ -79,7 +83,8 @@ public void validatePropertyForConnection(List sewerageConne }); } public JSONObject getWnsPTworkflowConfig(RequestInfo requestInfo, String tenantId){ - tenantId = tenantId.split("\\.")[0]; + //tenantId = tenantId.split("\\.")[0]; + tenantId = centralInstanceUtil.getStateLevelTenant(tenantId); List propertyModuleMasters = new ArrayList<>(Arrays.asList("PTWorkflow")); Map> codes = mdmsValidator.getAttributeValues(tenantId,PROPERTY_MASTER_MODULE, propertyModuleMasters, "$.*", PROPERTY_JSONPATH_ROOT,requestInfo); diff --git a/municipal-services/sw-services/src/main/resources/application.properties b/municipal-services/sw-services/src/main/resources/application.properties index 41d7c092c53..0952a61c7ed 100644 --- a/municipal-services/sw-services/src/main/resources/application.properties +++ b/municipal-services/sw-services/src/main/resources/application.properties @@ -13,8 +13,10 @@ egov.property.createendpoint=property-services/property/_create egov.property.searchendpoint=property-services/property/_search #mdms urls -egov.mdms.host=http://localhost:8094/ -egov.mdms.search.endpoint=egov-mdms-service/v1/_search +#egov.mdms.host=http://localhost:8094/ +#egov.mdms.search.endpoint=egov-mdms-service/v1/_search +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search # KAFKA SERVER CONFIGURATIONS kafka.config.bootstrap_server_config=localhost:9092 @@ -152,20 +154,29 @@ egov.sewerageservice.savefilestoreIds=save-sw-filestoreids logging.level.org.egov.swservice=DEBUG -egov.collection.host=http://collection-services.egov:8080/ +egov.collection.host=http://collection-services.digit:8080/ egov.collectiom.payment.search=collection-services/payments/ spring.kafka.listener.missing-topics-fatal=false + +sw.kafka.consumer.topic.pattern=((^[a-zA-Z]+-)?save-sw-connection|(^[a-zA-Z]+-)?update-sw-connection|(^[a-zA-Z]+-)?update-sw-workflow) +sw.kafka.edit.notification.topic.pattern=((^[a-zA-Z]+-)?editnotificationsewerage) +sw.kafka.filestore.topic.pattern=((^[a-zA-Z]+-)?sw-filestoreids-process) +kafka.topics.receipt.topic.pattern=((^[a-zA-Z]+-)?egov.collection.payment-create) +egov.ui.app.host.map={"in":"https://central-instance.digit.org","in.statea":"https://statea.digit.org","pb":"https://dev.digit.org/"} +egov.url.shortner.host=http://egov-url-shortening.digit:8080/ + +# central instance +state.level.tenantid.length=2 +is.environment.central.instance=false state.level.tenant.id=pb + egov.disconnect.businessservice=DisconnectSWConnection egov.reconnect.businessservice=SWReconnection - - egov.receipt.disconnection.businessservice.topic=SW egov.sewerage.connection.document.access.audit.kafka.topic=egov-document-access - spring.main.allow-bean-definition-overriding=true #--------enable/disable ABAC in encryption----------# sewerage.decryption.abac.enabled=true @@ -177,4 +188,4 @@ encryption.offset.value=0 #-------Persister topics for oldDataEncryption-------# egov.sewerageservice.oldDataEncryptionStatus.topic=sw-enc-audit -egov.sewerageservice.update.oldData.topic=update-sw-encryption \ No newline at end of file +egov.sewerageservice.update.oldData.topic=update-sw-encryption diff --git a/municipal-services/sw-services/src/main/resources/db/migrate.sh b/municipal-services/sw-services/src/main/resources/db/migrate.sh index 54d07c0940a..f79b7016299 100644 --- a/municipal-services/sw-services/src/main/resources/db/migrate.sh +++ b/municipal-services/sw-services/src/main/resources/db/migrate.sh @@ -1,3 +1,11 @@ #!/bin/sh - -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate +baseurl=$DB_URL +echo "the baseurl : $DB_URL" +schemasetter="?currentSchema=" +schemas=$SCHEMA_NAME +echo "the schemas : $schemas" +for schemaname in ${schemas//,/ } +do + echo "the schema name : ${baseurl}${schemasetter}${schemaname}" + flyway -url=${baseurl}${schemasetter}${schemaname} -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate +done \ No newline at end of file diff --git a/municipal-services/sw-services/src/main/resources/db/migration/ddl/V20211012130012__sw_add_foreignkey_constraints.sql b/municipal-services/sw-services/src/main/resources/db/migration/ddl/V20211012130012__sw_add_foreignkey_constraints.sql new file mode 100644 index 00000000000..429a20840d2 --- /dev/null +++ b/municipal-services/sw-services/src/main/resources/db/migration/ddl/V20211012130012__sw_add_foreignkey_constraints.sql @@ -0,0 +1,5 @@ +ALTER TABLE eg_sw_applicationdocument DROP CONSTRAINT fk_eg_sw_applicationdocument_eg_sw_connection_id; +ALTER TABLE eg_sw_plumberinfo DROP CONSTRAINT fk_eg_sw_plumberinfo_eg_sw_connection_id; + +ALTER TABLE eg_sw_applicationdocument ADD CONSTRAINT fk_eg_sw_applicationdocument_swid_eg_sw_connection_id FOREIGN KEY (swid) REFERENCES eg_sw_connection (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; +ALTER TABLE eg_sw_plumberinfo ADD CONSTRAINT fk_eg_sw_plumberinfo_swid_eg_sw_connection_id FOREIGN KEY (swid) REFERENCES eg_sw_connection (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE; \ No newline at end of file diff --git a/municipal-services/tl-calculator/CHANGELOG.md b/municipal-services/tl-calculator/CHANGELOG.md index 577acd5cfc9..4df3a52e575 100644 --- a/municipal-services/tl-calculator/CHANGELOG.md +++ b/municipal-services/tl-calculator/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this module will be documented in this file. +## 1.1.6 - 2023-08-10 + +- Central Instance Library Integration +- ## 1.1.5 - 2023-02-01 - Transition from 1.1.5-beta version to 1.1.5 version diff --git a/municipal-services/tl-calculator/pom.xml b/municipal-services/tl-calculator/pom.xml index 6b8fe5d2366..e0931001a8c 100644 --- a/municipal-services/tl-calculator/pom.xml +++ b/municipal-services/tl-calculator/pom.xml @@ -9,7 +9,7 @@ org.egov tl-calculator - 1.1.5-SNAPSHOT + 1.1.6-SNAPSHOT tl-calculator 2.17.1 @@ -47,10 +47,6 @@ spring-boot-devtools runtime - - org.springframework.boot - spring-boot-starter-web - org.springframework.kafka spring-kafka @@ -95,6 +91,11 @@ + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + repo.egovernments.org eGov ERP Releases Repository diff --git a/municipal-services/tl-calculator/src/main/java/org/egov/tlcalculator/config/TLCalculatorConfigs.java b/municipal-services/tl-calculator/src/main/java/org/egov/tlcalculator/config/TLCalculatorConfigs.java index 90fee61786b..7cc8e201817 100644 --- a/municipal-services/tl-calculator/src/main/java/org/egov/tlcalculator/config/TLCalculatorConfigs.java +++ b/municipal-services/tl-calculator/src/main/java/org/egov/tlcalculator/config/TLCalculatorConfigs.java @@ -87,10 +87,10 @@ public class TLCalculatorConfigs { //MDMS - @Value("${egov.mdms.host}") + @Value("${mdms.v2.host}") private String mdmsHost; - @Value("${egov.mdms.search.endpoint}") + @Value("${mdms.v2.search.endpoint}") private String mdmsSearchEndpoint; diff --git a/municipal-services/tl-calculator/src/main/java/org/egov/tlcalculator/utils/BillingslabUtils.java b/municipal-services/tl-calculator/src/main/java/org/egov/tlcalculator/utils/BillingslabUtils.java index 58fd7fa2137..a368ce7ced4 100644 --- a/municipal-services/tl-calculator/src/main/java/org/egov/tlcalculator/utils/BillingslabUtils.java +++ b/municipal-services/tl-calculator/src/main/java/org/egov/tlcalculator/utils/BillingslabUtils.java @@ -14,10 +14,10 @@ @Component public class BillingslabUtils { - @Value("${egov.mdms.host}") - private String mdmsHost; + @Value("${mdms.v2.host}") + private String mdmsHost; - @Value("${egov.mdms.search.endpoint}") + @Value("${mdms.v2.search.endpoint}") private String mdmsEndpoint; /** diff --git a/municipal-services/tl-calculator/src/main/resources/application.properties b/municipal-services/tl-calculator/src/main/resources/application.properties index 056ac012ad6..eee715a1d24 100644 --- a/municipal-services/tl-calculator/src/main/resources/application.properties +++ b/municipal-services/tl-calculator/src/main/resources/application.properties @@ -51,9 +51,8 @@ kafka.topics.update.service=update-tl-billingslab #mdms urls -egov.mdms.host=https://dev.digit.org -#egov.mdms.search.endpoint=/egov-mdms-service/v1/_search -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search #BilllingService @@ -95,4 +94,4 @@ persister.save.tl.calculation.topic=save-tl-calculation egov.tl.calculationtype.tradetype.default=SUM egov.tl.calculationtype.accessory.default=SUM -id.timezone=Asia/Kolkata \ No newline at end of file +id.timezone=Asia/Kolkata diff --git a/municipal-services/tl-services/CHANGELOG.md b/municipal-services/tl-services/CHANGELOG.md index 4113eafcf90..0fdab723f07 100644 --- a/municipal-services/tl-services/CHANGELOG.md +++ b/municipal-services/tl-services/CHANGELOG.md @@ -2,6 +2,10 @@ # Changelog All notable changes to this module will be documented in this file. +## 1.1.9 - 2023-08-10 + +- Central Instance Library Integration + ## 1.1.8 - 2023-02-01 - Transition from 1.1.8-beta version to 1.1.8 version diff --git a/municipal-services/tl-services/pom.xml b/municipal-services/tl-services/pom.xml index f0fa06be515..1b5fce09156 100644 --- a/municipal-services/tl-services/pom.xml +++ b/municipal-services/tl-services/pom.xml @@ -9,7 +9,7 @@ org.egov tl-services - 1.1.8-SNAPSHOT + 1.1.9-SNAPSHOT tl-services 2.17.1 @@ -88,7 +88,6 @@ org.postgresql postgresql - 42.2.2.jre7 org.egov @@ -97,7 +96,12 @@ compile - + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + repo.egovernments.org eGov ERP Releases Repository diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/Main.java b/municipal-services/tl-services/src/main/java/org/egov/tl/Main.java index fe4a34bf0c2..dd80581c0a7 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/Main.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/Main.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.config.TracerConfiguration; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; @@ -16,7 +17,7 @@ @SpringBootApplication @ComponentScan(basePackages = { "org.egov.tl", "org.egov.tl.web.controllers" , "org.egov.tl.config"}) -@Import({ TracerConfiguration.class }) +@Import({TracerConfiguration.class, MultiStateInstanceUtil.class}) public class Main { @Value("${app.timezone}") diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/config/TLConfiguration.java b/municipal-services/tl-services/src/main/java/org/egov/tl/config/TLConfiguration.java index 3c9bc5f30e8..53b79181dc4 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/config/TLConfiguration.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/config/TLConfiguration.java @@ -11,6 +11,7 @@ import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; +import java.util.Map; import java.util.TimeZone; @@ -203,10 +204,10 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM //MDMS - @Value("${egov.mdms.host}") + @Value("${mdms.v2.host}") private String mdmsHost; - @Value("${egov.mdms.search.endpoint}") + @Value("${mdms.v2.search.endpoint}") private String mdmsEndPoint; @@ -250,8 +251,8 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM private String tlBusinessServices; //USER EVENTS - @Value("${egov.ui.app.host}") - private String uiAppHost; + @Value("#{${egov.ui.app.host.map}}") + private Map uiAppHostMap; @Value("${egov.usr.events.create.topic}") private String saveUserEventsTopic; @@ -331,6 +332,14 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM @Value("${id.timezone}") private String egovAppTimeZone; + + // central-instance configs + + @Value("${state.level.tenantid.length}") + private Integer stateLevelTenantIdLength; + + @Value("${is.environment.central.instance}") + private Boolean isEnvironmentCentralInstance; //receipt @Value("${notification.url}") @@ -348,6 +357,4 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM @Value("${egov.tl.calculator.billingSlab.endpoint}") private String billingSlabEndPoint; - - } diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/consumer/ReceiptConsumer.java b/municipal-services/tl-services/src/main/java/org/egov/tl/consumer/ReceiptConsumer.java index 1266de2c735..afdc111c40e 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/consumer/ReceiptConsumer.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/consumer/ReceiptConsumer.java @@ -1,16 +1,15 @@ package org.egov.tl.consumer; -import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.HashMap; + import org.egov.tl.service.PaymentUpdateService; import org.egov.tl.service.notification.PaymentNotificationService; +import org.egov.tl.util.TLConstants; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; import org.springframework.stereotype.Component; -import org.springframework.stereotype.Service; - -import java.util.HashMap; @Component public class ReceiptConsumer { @@ -18,6 +17,9 @@ public class ReceiptConsumer { private PaymentUpdateService paymentUpdateService; private PaymentNotificationService paymentNotificationService; + + @Value("${state.level.tenant.id}") + private String stateLevelTenantID; @Autowired @@ -28,8 +30,12 @@ public ReceiptConsumer(PaymentUpdateService paymentUpdateService, PaymentNotific - @KafkaListener(topics = {"${kafka.topics.receipt.create}"}) + @KafkaListener(topicPattern = "${kafka.topics.receipt.topic.pattern}") public void listenPayments(final HashMap record) { + + // Adding in MDC so that tracer can add it in header + MDC.put(TLConstants.TENANTID_MDC_STRING, stateLevelTenantID); + paymentUpdateService.process(record); paymentNotificationService.process(record); } diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/consumer/TradeLicenseConsumer.java b/municipal-services/tl-services/src/main/java/org/egov/tl/consumer/TradeLicenseConsumer.java index ae70096330c..fa185c8192b 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/consumer/TradeLicenseConsumer.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/consumer/TradeLicenseConsumer.java @@ -6,6 +6,7 @@ import org.egov.tl.service.notification.TLNotificationService; import org.egov.tl.util.TradeUtil; import org.egov.tl.web.models.TradeLicenseRequest; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; @@ -13,6 +14,7 @@ import org.springframework.stereotype.Component; import java.util.HashMap; +import static org.egov.tl.util.TLConstants.TENANTID_MDC_STRING; import static org.egov.tl.util.TLConstants.businessService_BPA; import static org.egov.tl.util.TLConstants.businessService_TL; @@ -31,7 +33,7 @@ public TradeLicenseConsumer(TLNotificationService notificationService, TradeLice this.tradeLicenseService = tradeLicenseService; } - @KafkaListener(topics = {"${persister.update.tradelicense.topic}","${persister.save.tradelicense.topic}","${persister.update.tradelicense.workflow.topic}"}) + @KafkaListener(topicPattern = "${tl.kafka.notification.topic.pattern}") public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { ObjectMapper mapper = new ObjectMapper(); TradeLicenseRequest tradeLicenseRequest = new TradeLicenseRequest(); @@ -42,6 +44,12 @@ public void listen(final HashMap record, @Header(KafkaHeaders.RE } if (!tradeLicenseRequest.getLicenses().isEmpty()) { String businessService = tradeLicenseRequest.getLicenses().get(0).getBusinessService(); + + String tenantId = tradeLicenseRequest.getLicenses().get(0).getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + if (businessService == null) businessService = businessService_TL; switch (businessService) { diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/producer/Producer.java b/municipal-services/tl-services/src/main/java/org/egov/tl/producer/Producer.java index 985e8f7e3a7..c6e1528ac9f 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/producer/Producer.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/producer/Producer.java @@ -1,19 +1,32 @@ package org.egov.tl.producer; -import lombok.extern.slf4j.Slf4j; +import org.egov.tl.config.TLConfiguration; import org.egov.tracer.kafka.CustomKafkaTemplate; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.kafka.core.KafkaTemplate; import org.springframework.stereotype.Service; +import lombok.extern.slf4j.Slf4j; + @Service @Slf4j public class Producer { + + @Autowired + private TLConfiguration configs; @Autowired private CustomKafkaTemplate kafkaTemplate; - public void push(String topic, Object value) { - kafkaTemplate.send(topic, value); - } + public void push(String tenantId, String topic, Object value) { + + String updatedTopic = topic; + if (configs.getIsEnvironmentCentralInstance()) { + + String[] tenants = tenantId.split("\\."); + if (tenants.length > 1) + updatedTopic = tenants[1].concat("-").concat(topic); + } + log.info("The Kafka topic for the tenantId : " + tenantId + " is : " + updatedTopic); + kafkaTemplate.send(updatedTopic, value); + } } diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/repository/TLRepository.java b/municipal-services/tl-services/src/main/java/org/egov/tl/repository/TLRepository.java index c102426617b..af4bd83c564 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/repository/TLRepository.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/repository/TLRepository.java @@ -1,23 +1,34 @@ package org.egov.tl.repository; -import lombok.extern.slf4j.Slf4j; +import static org.egov.tl.util.TLConstants.ACTION_ADHOC; + +import java.util.*; + import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tl.config.TLConfiguration; import org.egov.tl.producer.Producer; import org.egov.tl.repository.builder.TLQueryBuilder; import org.egov.tl.repository.rowmapper.TLRowMapper; +import org.egov.tl.util.TradeUtil; +import org.egov.tl.web.models.Accessory; +import org.egov.tl.web.models.Document; +import org.egov.tl.web.models.TradeLicense; +import org.egov.tl.web.models.TradeLicenseRequest; +import org.egov.tl.web.models.TradeLicenseSearchCriteria; +import org.egov.tl.web.models.TradeUnit; +import org.egov.tl.web.models.User; import org.egov.tl.util.TLConstants; import org.egov.tl.web.models.*; import org.egov.tl.workflow.WorkflowService; +import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.SingleColumnRowMapper; import org.springframework.stereotype.Repository; import org.springframework.util.CollectionUtils; -import java.util.*; - -import static org.egov.tl.util.TLConstants.ACTION_ADHOC; +import lombok.extern.slf4j.Slf4j; @Slf4j @@ -36,28 +47,44 @@ public class TLRepository { private WorkflowService workflowService; + private TradeUtil utils; + + private MultiStateInstanceUtil multiStateInstanceUtil; @Autowired - public TLRepository(JdbcTemplate jdbcTemplate, TLQueryBuilder queryBuilder, TLRowMapper rowMapper, - Producer producer, TLConfiguration config, WorkflowService workflowService) { + public TLRepository(JdbcTemplate jdbcTemplate, TLQueryBuilder queryBuilder, TLRowMapper rowMapper, Producer producer, + TLConfiguration config, WorkflowService workflowService, TradeUtil utils, + MultiStateInstanceUtil multiStateInstanceUtil) { this.jdbcTemplate = jdbcTemplate; this.queryBuilder = queryBuilder; this.rowMapper = rowMapper; this.producer = producer; this.config = config; this.workflowService = workflowService; + this.utils = utils; + this.multiStateInstanceUtil = multiStateInstanceUtil; } + + + + /** * Searhces license in databse * * @param criteria The tradeLicense Search criteria * @return List of TradeLicense from seach */ - public List getLicenses(TradeLicenseSearchCriteria criteria) { + public List getLicenses(TradeLicenseSearchCriteria criteria,String tenantId) { List preparedStmtList = new ArrayList<>(); - String query = queryBuilder.getTLSearchQuery(criteria, preparedStmtList,false); + String query = queryBuilder.getTLSearchQuery(criteria, preparedStmtList, false); + try { + query = multiStateInstanceUtil.replaceSchemaPlaceholder(query, tenantId); + } + catch (Exception e){ + throw new CustomException("INVALID_TENANTID","Invalid tenantId: "+tenantId); + } List licenses = jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); sortChildObjectsById(licenses); return licenses; @@ -66,23 +93,41 @@ public List getLicenses(TradeLicenseSearchCriteria criteria) { public int getLicenseCount(TradeLicenseSearchCriteria criteria) { List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getTLSearchQuery(criteria, preparedStmtList,true); + try { + query = multiStateInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } + catch (Exception e){ + throw new CustomException("INVALID_TENANTID","Invalid tenantId: "+criteria.getTenantId()); + } int licenseCount = jdbcTemplate.queryForObject(query,preparedStmtList.toArray(),Integer.class); return licenseCount; } - + public Map getApplicationsCount(TradeLicenseSearchCriteria criteria) { List preparedStmtListIssued = new ArrayList<>(); String query = queryBuilder.getApplicationsCountQuery(criteria, preparedStmtListIssued, TLConstants.APPLICATION_TYPE_NEW); + try { + query = multiStateInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } + catch (Exception e){ + throw new CustomException("INVALID_TENANTID","Invalid tenantId: "+criteria.getTenantId()); + } int issuedCount = jdbcTemplate.queryForObject(query,preparedStmtListIssued.toArray(),Integer.class); - + List preparedStmtListRenewal = new ArrayList<>(); query = queryBuilder.getApplicationsCountQuery(criteria, preparedStmtListRenewal, TLConstants.APPLICATION_TYPE_RENEWAL); + try { + query = multiStateInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } + catch (Exception e){ + throw new CustomException("INVALID_TENANTID","Invalid tenantId: "+criteria.getTenantId()); + } int renewedCount = jdbcTemplate.queryForObject(query,preparedStmtListRenewal.toArray(),Integer.class); - + Map countsMap = new HashMap(); countsMap.put(TLConstants.ISSUED_COUNT, issuedCount); countsMap.put(TLConstants.RENEWED_COUNT, renewedCount); - + return countsMap; } @@ -92,8 +137,7 @@ public Map getApplicationsCount(TradeLicenseSearchCriteria crite * @param tradeLicenseRequest The tradeLciense create request */ public void save(TradeLicenseRequest tradeLicenseRequest) { - log.info("going to persist " +tradeLicenseRequest); - producer.push(config.getSaveTopic(), tradeLicenseRequest); + producer.push(tradeLicenseRequest.getLicenses().get(0).getTenantId(), config.getSaveTopic(), tradeLicenseRequest); } /** * Pushes the update request to update topic or on workflow topic depending on the status @@ -121,13 +165,13 @@ else if(license.getAction().equalsIgnoreCase(ACTION_ADHOC)) } if (!CollectionUtils.isEmpty(licensesForUpdate)) - producer.push(config.getUpdateTopic(), new TradeLicenseRequest(requestInfo, licensesForUpdate)); + producer.push(licensesForUpdate.get(0).getTenantId(), config.getUpdateTopic(), new TradeLicenseRequest(requestInfo, licensesForUpdate)); if (!CollectionUtils.isEmpty(licesnsesForStatusUpdate)) - producer.push(config.getUpdateWorkflowTopic(), new TradeLicenseRequest(requestInfo, licesnsesForStatusUpdate)); + producer.push(licesnsesForStatusUpdate.get(0).getTenantId(), config.getUpdateWorkflowTopic(), new TradeLicenseRequest(requestInfo, licesnsesForStatusUpdate)); if(!licensesForAdhocChargeUpdate.isEmpty()) - producer.push(config.getUpdateAdhocTopic(),new TradeLicenseRequest(requestInfo,licensesForAdhocChargeUpdate)); + producer.push(licensesForAdhocChargeUpdate.get(0).getTenantId(), config.getUpdateAdhocTopic(),new TradeLicenseRequest(requestInfo,licensesForAdhocChargeUpdate)); } @@ -160,7 +204,15 @@ private void sortChildObjectsById(List tradeLicenses){ public List getPlainLicenseSearch(TradeLicenseSearchCriteria criteria) { List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getTLPlainSearchQuery(criteria, preparedStmtList); + try { + log.info("Tenant ID:: " + criteria.getTenantId()); + query= multiStateInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } + catch (Exception e){ + throw new CustomException("INVALID_TENANTID","Invalid tenantId: "+criteria.getTenantId()); + } log.info("Query: " + query); + log.info("preparedStmtList: "+preparedStmtList); List licenses = jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); sortChildObjectsById(licenses); return licenses; @@ -171,12 +223,15 @@ public List fetchTradeLicenseIds(TradeLicenseSearchCriteria criteria){ List preparedStmtList = new ArrayList<>(); preparedStmtList.add(criteria.getOffset()); preparedStmtList.add(criteria.getLimit()); - - return jdbcTemplate.query("SELECT id from eg_tl_tradelicense ORDER BY createdtime offset " + - " ? " + - "limit ? ", - preparedStmtList.toArray(), - new SingleColumnRowMapper<>(String.class)); + String query = queryBuilder.TRADELICENSEIDQUERY; + try { + log.info("Tenant ID: " + criteria.getTenantId()); + query= multiStateInstanceUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } + catch (Exception e){ + throw new CustomException("INVALID_TENANTID","Invalid tenantId: "+criteria.getTenantId()); + } + return jdbcTemplate.query(query, preparedStmtList.toArray(), new SingleColumnRowMapper<>(String.class)); } public List fetchTradeLicenseTenantIds(){ diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/repository/builder/TLQueryBuilder.java b/municipal-services/tl-services/src/main/java/org/egov/tl/repository/builder/TLQueryBuilder.java index 88763eeb1b1..d41bbd2679d 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/repository/builder/TLQueryBuilder.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/repository/builder/TLQueryBuilder.java @@ -1,25 +1,20 @@ package org.egov.tl.repository.builder; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.extern.slf4j.Slf4j; +import java.util.Arrays; +import java.util.Calendar; +import java.util.List; + import org.egov.tl.config.TLConfiguration; import org.egov.tl.util.TLConstants; import org.egov.tl.web.models.*; import org.egov.tracer.model.CustomException; import org.postgresql.util.PGobject; +import org.egov.tl.web.models.TradeLicenseSearchCriteria; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.dao.DataAccessException; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; -import java.io.IOException; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.*; - -@Slf4j @Component public class TLQueryBuilder { @@ -56,25 +51,25 @@ public TLQueryBuilder(TLConfiguration config) { "tlownerdoc.userid as docuserid,tlownerdoc.tradeLicenseDetailId as doctradelicensedetailid,tlownerdoc.id as ownerdocid,"+ "tlownerdoc.documenttype as ownerdocType,tlownerdoc.filestoreid as ownerfileStoreId,tlownerdoc.documentuid as ownerdocuid,tlownerdoc.active as ownerdocactive," + " tlinsti.id as instiid,tlinsti.name as authorisedpersonname,tlinsti.type as institutiontype,tlinsti.tenantid as institenantId,tlinsti.active as instiactive, "+ - " tlinsti.instituionname as instiinstituionname, tlinsti.contactno as insticontactno, tlinsti.organisationregistrationno as instiorganisationregistrationno, tlinsti.address as instiaddress FROM eg_tl_tradelicense tl" + " tlinsti.instituionname as instiinstituionname, tlinsti.contactno as insticontactno, tlinsti.organisationregistrationno as instiorganisationregistrationno, tlinsti.address as instiaddress FROM {schema}.eg_tl_tradelicense tl" +INNER_JOIN_STRING - +"eg_tl_tradelicensedetail tld ON tld.tradelicenseid = tl.id" + +"{schema}.eg_tl_tradelicensedetail tld ON tld.tradelicenseid = tl.id" +INNER_JOIN_STRING - +"eg_tl_address tladdress ON tladdress.tradelicensedetailid = tld.id" + +"{schema}.eg_tl_address tladdress ON tladdress.tradelicensedetailid = tld.id" +INNER_JOIN_STRING - +"eg_tl_owner tlowner ON tlowner.tradelicensedetailid = tld.id" + +"{schema}.eg_tl_owner tlowner ON tlowner.tradelicensedetailid = tld.id" +INNER_JOIN_STRING - +"eg_tl_tradeunit tlunit ON tlunit.tradelicensedetailid = tld.id" + +"{schema}.eg_tl_tradeunit tlunit ON tlunit.tradelicensedetailid = tld.id" +LEFT_OUTER_JOIN_STRING - +"eg_tl_accessory tlacc ON tlacc.tradelicensedetailid = tld.id" + +"{schema}.eg_tl_accessory tlacc ON tlacc.tradelicensedetailid = tld.id" +LEFT_OUTER_JOIN_STRING - +"eg_tl_document_owner tlownerdoc ON tlownerdoc.userid = tlowner.id" + +"{schema}.eg_tl_document_owner tlownerdoc ON tlownerdoc.userid = tlowner.id" +LEFT_OUTER_JOIN_STRING - +"eg_tl_applicationdocument tlapldoc ON tlapldoc.tradelicensedetailid = tld.id" + +"{schema}.eg_tl_applicationdocument tlapldoc ON tlapldoc.tradelicensedetailid = tld.id" +LEFT_OUTER_JOIN_STRING - +"eg_tl_verificationdocument tlverdoc ON tlverdoc.tradelicensedetailid = tld.id" + +"{schema}.eg_tl_verificationdocument tlverdoc ON tlverdoc.tradelicensedetailid = tld.id" +LEFT_OUTER_JOIN_STRING - +"eg_tl_institution tlinsti ON tlinsti.tradelicensedetailid = tld.id "; + +"{schema}.eg_tl_institution tlinsti ON tlinsti.tradelicensedetailid = tld.id "; private final String paginationWrapper = "SELECT * FROM " + @@ -260,24 +255,24 @@ private void addRenewalCriteria(StringBuilder builder, List preparedStmt addClauseIfRequired(preparedStmtList, builder); /* SELECT NewTL applications which do not have any renewal applications yet */ - builder.append(" (tl.licensenumber NOT IN (SELECT licensenumber from eg_tl_tradelicense WHERE UPPER(applicationtype) = ? AND licensenumber IS NOT NULL) OR ("); + builder.append(" (tl.licensenumber NOT IN (SELECT licensenumber from {schema}.eg_tl_tradelicense WHERE UPPER(applicationtype) = ? AND licensenumber IS NOT NULL) OR ("); /*SELECT applications which have application type as renewal, and having the latest financial year among all the renewal application * for that particular license number*/ - builder.append(" tl.applicationtype = ? and ? > tl.financialyear AND tl.financialyear = (select max(financialyear) from eg_tl_tradelicense where licensenumber=tl.licensenumber) )))"); + builder.append(" tl.applicationtype = ? and ? > tl.financialyear AND tl.financialyear = (select max(financialyear) from {schema}.eg_tl_tradelicense where licensenumber=tl.licensenumber) )))"); /* SELECT applications which are manually expired after their real expiry date, and which is having the latest financial year from among all the applications for that particular license number*/ - builder.append(" OR ( tl.status = ? AND tl.financialyear = (select max(financialyear) from eg_tl_tradelicense where licensenumber=tl.licensenumber) ))) "); + builder.append(" OR ( tl.status = ? AND tl.financialyear = (select max(financialyear) from {schema}.eg_tl_tradelicense where licensenumber=tl.licensenumber) ))) "); /* SELECT those applications for which there exist a rejected application for the current financial year, and financial year of this application should be just before that of the rejected application*/ - builder.append("OR ( tl.financialyear= (select max(financialyear) from eg_tl_tradelicense where licensenumber=tl.licensenumber and licensenumber in ( select licensenumber from eg_tl_tradelicense where status=? and financialyear=? ) and status<>? ) "); + builder.append("OR ( tl.financialyear= (select max(financialyear) from {schema}.eg_tl_tradelicense where licensenumber=tl.licensenumber and licensenumber in ( select licensenumber from {schema}.eg_tl_tradelicense where status=? and financialyear=? ) and status<>? ) "); /*set status (approved) and validTo(before current timestamp) conditions*/ builder.append(" AND (tl.status IN (?,?) ) AND tl.validTo <= ? ) ) "); preparedStmtList.add(TLConstants.APPLICATION_TYPE_RENEWAL); preparedStmtList.add(TLConstants.APPLICATION_TYPE_RENEWAL); - preparedStmtList.add(Integer.toString(Calendar.getInstance().get(Calendar.YEAR))); + preparedStmtList.add(Integer.toString(Calendar.getInstance().get(Calendar.YEAR))); preparedStmtList.add(TLConstants.STATUS_MANUALLYEXPIRED); preparedStmtList.add(TLConstants.STATUS_REJECTED); preparedStmtList.add(criteria.getFinancialYear()); @@ -366,62 +361,61 @@ public String getTLPlainSearchQuery(TradeLicenseSearchCriteria criteria, List preparedStmtList, String applicationType) { - + StringBuilder query = new StringBuilder(""); - + if(criteria.getAccountId()!=null) { - query.append("select count(*) from eg_tl_tradelicense where tenantid = (select tl.tenantid from eg_tl_tradelicense tl INNER JOIN eg_tl_tradelicensedetail tld ON tld.tradelicenseid = tl.id INNER JOIN eg_tl_owner tlowner on tlowner.tradelicensedetailid = tld.id where tl.accountid=? "); + query.append("select count(*) from {schema}.eg_tl_tradelicense where tenantid = (select tl.tenantid from {schema}.eg_tl_tradelicense tl INNER JOIN {schema}.eg_tl_tradelicensedetail tld ON tld.tradelicenseid = tl.id INNER JOIN {schema}.eg_tl_owner tlowner on tlowner.tradelicensedetailid = tld.id where tl.accountid=? "); preparedStmtList.add(criteria.getAccountId()); - + List ownerIds = criteria.getOwnerIds(); - + if(!CollectionUtils.isEmpty(ownerIds)) { - + query.append(" OR (tlowner.id IN (").append(createQuery(ownerIds)).append(")"); addToPreparedStatement(preparedStmtList,ownerIds); - + query.append(" AND tlowner.active = ? )"); preparedStmtList.add(true); - } - + } + query.append("and tl.businessservice= ? limit 1) and createdtime> ? AND applicationtype= ? "); - + preparedStmtList.add(TLConstants.TRADE_LICENSE_MODULE_CODE); - - + + } - + else if(criteria.getTenantId()!=null) { - query.append("select count(*) from eg_tl_tradelicense where tenantid = ? and createdtime > ? AND applicationtype= ? "); + query.append("select count(*) from {schema}.eg_tl_tradelicense where tenantid = ? and createdtime > ? AND applicationtype= ? "); preparedStmtList.add(criteria.getTenantId()); } - + // In order to get data of last 12 months, the months variables is pre-configured in application properties int months = Integer.valueOf(config.getNumberOfMonths()) ; - + Calendar calendar = Calendar.getInstance(); - + // To subtract 12 months from current time, we are adding -12 to the calendar instance, as subtract function is not in-built calendar.add(Calendar.MONTH, -1*months); - + // Converting the timestamp to milliseconds and adding it to prepared statement list preparedStmtList.add(calendar.getTimeInMillis()); - + preparedStmtList.add(applicationType); - + addClauseIfRequired(preparedStmtList, query); query.append(" businessservice = ? "); preparedStmtList.add(TLConstants.TRADE_LICENSE_MODULE_CODE); - - + + return query.toString(); - - - } + } + public final String TRADELICENSEIDQUERY = "SELECT id from {schema}.eg_tl_tradelicense ORDER BY createdtime offset ? limit ? "; } diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/service/EnrichmentService.java b/municipal-services/tl-services/src/main/java/org/egov/tl/service/EnrichmentService.java index 1109e4613fd..80c89789599 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/service/EnrichmentService.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/service/EnrichmentService.java @@ -510,10 +510,16 @@ private void setLicenseNumberAndIssueDate(TradeLicenseRequest request,List record) { try { PaymentRequest paymentRequest = mapper.convertValue(record,PaymentRequest.class); RequestInfo requestInfo = paymentRequest.getRequestInfo(); - List paymentDetails = paymentRequest.getPayment().getPaymentDetails(); String tenantId = paymentRequest.getPayment().getTenantId(); + List paymentDetails = paymentRequest.getPayment().getPaymentDetails(); + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + + for(PaymentDetail paymentDetail : paymentDetails){ if (paymentDetail.getBusinessService().equalsIgnoreCase(businessService_TL) || paymentDetail.getBusinessService().equalsIgnoreCase(businessService_BPA)) { TradeLicenseSearchCriteria searchCriteria = new TradeLicenseSearchCriteria(); diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/service/TLBatchService.java b/municipal-services/tl-services/src/main/java/org/egov/tl/service/TLBatchService.java index 926666e9a7a..2f804aee983 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/service/TLBatchService.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/service/TLBatchService.java @@ -1,6 +1,13 @@ package org.egov.tl.service; -import lombok.extern.slf4j.Slf4j; +import static org.egov.tl.util.TLConstants.ACTION_EXPIRE; +import static org.egov.tl.util.TLConstants.DEFAULT_WORKFLOW; +import static org.egov.tl.util.TLConstants.JOB_EXPIRY; +import static org.egov.tl.util.TLConstants.JOB_SMS_REMINDER; +import static org.egov.tl.util.TLConstants.STATUS_APPROVED; + +import java.util.*; + import org.egov.common.contract.request.RequestInfo; import org.egov.tl.config.TLConfiguration; import org.egov.tl.producer.Producer; @@ -15,9 +22,7 @@ import org.springframework.util.StringUtils; import com.jayway.jsonpath.JsonPath; -import java.util.*; - -import static org.egov.tl.util.TLConstants.*; +import lombok.extern.slf4j.Slf4j; @Slf4j @@ -106,7 +111,7 @@ public void getLicensesAndPerformAction(String serviceName, String jobName, Requ log.info("current Offset: "+offSet); - List licensesFromRepository = repository.getLicenses(criteria); + List licensesFromRepository = repository.getLicenses(criteria, tenantIdFromRepository); if(CollectionUtils.isEmpty(licensesFromRepository)) break; @@ -177,11 +182,11 @@ private void sendReminderSMS(RequestInfo requestInfo, List license smsRequests.addAll(util.createSMSRequest(message,mobileNumberToOwner)); } catch (Exception e){ - producer.push(config.getReminderErrorTopic(), license); + producer.push(licenses.get(0).getTenantId(), config.getReminderErrorTopic(), license); } } - util.sendSMS(smsRequests, config.getIsReminderEnabled()); + util.sendSMS(smsRequests, config.getIsReminderEnabled(), tenantId); } @@ -211,11 +216,11 @@ private void sendReminderEmail(RequestInfo requestInfo, List licen } catch (Exception e){ - producer.push(config.getReminderErrorTopic(), license); + producer.push(tenantId, config.getReminderErrorTopic(), license); } } - util.sendEmail(emailRequests, config.getIsReminderEnabled()); + util.sendEmail(emailRequests, config.getIsReminderEnabled(), tenantId); } @@ -235,10 +240,10 @@ private void expireLicenses(RequestInfo requestInfo, List licenses workflowIntegrator.callWorkFlow(new TradeLicenseRequest(requestInfo, licenses)); - producer.push(config.getUpdateWorkflowTopic(), new TradeLicenseRequest(requestInfo, licenses)); + producer.push(licenses.get(0).getTenantId(), config.getUpdateWorkflowTopic(), new TradeLicenseRequest(requestInfo, licenses)); } catch (Exception e){ - producer.push(config.getExpiryErrorTopic(), licenses); + producer.push(licenses.get(0).getTenantId(), config.getExpiryErrorTopic(), licenses); } diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/service/TradeLicenseService.java b/municipal-services/tl-services/src/main/java/org/egov/tl/service/TradeLicenseService.java index 6b1de1b9bf6..ac7b0b52105 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/service/TradeLicenseService.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/service/TradeLicenseService.java @@ -109,15 +109,19 @@ public List create(TradeLicenseRequest tradeLicenseRequest,String Object mdmsData = util.mDMSCall(tradeLicenseRequest.getRequestInfo(), tradeLicenseRequest.getLicenses().get(0).getTenantId()); Object billingSlabs = util.getBillingSlabs(tradeLicenseRequest.getRequestInfo(), tradeLicenseRequest.getLicenses().get(0).getTenantId()); actionValidator.validateCreateRequest(tradeLicenseRequest); - switch(businessServicefromPath) - { + switch (businessServicefromPath) { case businessService_BPA: validateMobileNumberUniqueness(tradeLicenseRequest); break; } enrichmentService.enrichTLCreateRequest(tradeLicenseRequest, mdmsData); tlValidator.validateCreate(tradeLicenseRequest, mdmsData, billingSlabs); - log.info("request is " + tradeLicenseRequest); + switch(businessServicefromPath) + { + case businessService_BPA: + validateMobileNumberUniqueness(tradeLicenseRequest); + break; + } userService.createUser(tradeLicenseRequest, false); calculationService.addCalculation(tradeLicenseRequest); @@ -294,14 +298,14 @@ public int countLicenses(TradeLicenseSearchCriteria criteria, RequestInfo reques } public Map countApplications(TradeLicenseSearchCriteria criteria, RequestInfo requestInfo, String serviceFromPath, HttpHeaders headers){ - + criteria.setBusinessService(serviceFromPath); - + Map licenseCount = repository.getApplicationsCount(criteria); - + return licenseCount; } - + public void checkEndStateAndAddBPARoles(TradeLicenseRequest tradeLicenseRequest) { List endstates = tradeUtil.getBPAEndState(tradeLicenseRequest); @@ -319,7 +323,8 @@ public void checkEndStateAndAddBPARoles(TradeLicenseRequest tradeLicenseRequest) } public List getLicensesFromMobileNumber(TradeLicenseSearchCriteria criteria, RequestInfo requestInfo){ - + + String tenantId = criteria.getTenantId(); List licenses = new LinkedList<>(); boolean isEmpty = enrichWithUserDetails(criteria,requestInfo); @@ -329,7 +334,7 @@ public List getLicensesFromMobileNumber(TradeLicenseSearchCriteria } //Get all tradeLicenses with ownerInfo enriched from user service - licenses = getLicensesWithOwnerInfo(criteria,requestInfo); + licenses = getLicensesWithOwnerInfo(tenantId,criteria,requestInfo); return licenses; } @@ -341,7 +346,21 @@ public List getLicensesFromMobileNumber(TradeLicenseSearchCriteria * @return List of tradeLicense for the given criteria */ public List getLicensesWithOwnerInfo(TradeLicenseSearchCriteria criteria,RequestInfo requestInfo){ - List licenses = repository.getLicenses(criteria); + List licenses = repository.getLicenses(criteria, criteria.getTenantId()); + if(licenses.isEmpty()) + return Collections.emptyList(); + licenses = enrichmentService.enrichTradeLicenseSearch(licenses,criteria,requestInfo); + return licenses; + } + + /** + * Returns the tradeLicense with enrivhed owners from user servise + * @param criteria The object containing the paramters on which to search + * @param requestInfo The search request's requestInfo + * @return List of tradeLicense for the given criteria + */ + public List getLicensesWithOwnerInfo(String stateTenantId,TradeLicenseSearchCriteria criteria,RequestInfo requestInfo){ + List licenses = repository.getLicenses(criteria, stateTenantId); if(licenses.isEmpty()) return Collections.emptyList(); licenses = enrichmentService.enrichTradeLicenseSearch(licenses,criteria,requestInfo); @@ -380,7 +399,7 @@ public List getLicensesWithOwnerInfo(TradeLicenseRequest request){ criteria.setIds(ids); criteria.setBusinessService(request.getLicenses().get(0).getBusinessService()); - List licenses = repository.getLicenses(criteria); + List licenses = repository.getLicenses(criteria, request.getLicenses().get(0).getTenantId()); if(licenses.isEmpty()) return Collections.emptyList(); @@ -497,8 +516,11 @@ public List plainSearch(TradeLicenseSearchCriteria criteria, Reque return Collections.emptyList(); criteria.setIds(ids); + log.info("Before criteria {}",criteria.getTenantId()); TradeLicenseSearchCriteria idsCriteria = TradeLicenseSearchCriteria.builder().ids(ids).build(); + idsCriteria.setTenantId(criteria.getTenantId()); + log.info("After criteria {}",idsCriteria.getTenantId()); licenses = repository.getPlainLicenseSearch(idsCriteria); @@ -538,7 +560,7 @@ public boolean enrichWithUserDetails(TradeLicenseSearchCriteria criteria, Reques criteria.setTenantId(null); } - licenses = repository.getLicenses(criteria); + licenses = repository.getLicenses(criteria, criteria.getTenantId()); if(licenses.size()==0){ return true; diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/service/notification/EditNotificationService.java b/municipal-services/tl-services/src/main/java/org/egov/tl/service/notification/EditNotificationService.java index 48b9538c5dd..c002d4d9391 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/service/notification/EditNotificationService.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/service/notification/EditNotificationService.java @@ -40,7 +40,7 @@ public void sendEditNotification(TradeLicenseRequest request, Map record, String busine Map info = documentContext.read("$.RequestInfo"); RequestInfo requestInfo = mapper.convertValue(info, RequestInfo.class); + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, valMap.get(tenantIdKey)); + if(valMap.get(businessServiceKey).equalsIgnoreCase(config.getBusinessServiceTL())||valMap.get(businessServiceKey).equalsIgnoreCase(config.getBusinessServiceBPA())){ TradeLicense license = getTradeLicenseFromConsumerCode(valMap.get(tenantIdKey),valMap.get(consumerCodeKey), requestInfo,valMap.get(businessServiceKey)); @@ -121,7 +125,7 @@ public void processBusinessService(HashMap record, String busine if (applicationType.equals(APPLICATION_TYPE_RENEWAL)) { String localizationMessages = tlRenewalNotificationUtil.getLocalizationMessages(license.getTenantId(), requestInfo); List smsRequests = getSMSRequests(license, valMap, localizationMessages); - util.sendSMS(smsRequests, config.getIsTLSMSEnabled()); + util.sendSMS(smsRequests, config.getIsTLSMSEnabled(), valMap.get(tenantIdKey)); //message = tlRenewalNotificationUtil.getOwnerPaymentMsg(license,valMap,localizationMessages); // Event Flow @@ -135,7 +139,7 @@ public void processBusinessService(HashMap record, String busine } else { String localizationMessages = util.getLocalizationMessages(license.getTenantId(), requestInfo); List smsRequests = getSMSRequests(license, valMap, localizationMessages); - util.sendSMS(smsRequests, config.getIsTLSMSEnabled()); + util.sendSMS(smsRequests, config.getIsTLSMSEnabled(), valMap.get(tenantIdKey)); // Event Flow String message = util.getOwnerPaymentMsg(license,valMap,localizationMessages); @@ -168,7 +172,7 @@ public void processBusinessService(HashMap record, String busine List smsList = new ArrayList<>(); smsList.addAll(bpaNotificationUtil.createSMSRequestForBPA(message, mobileNumberToOwner,license,receiptno)); - util.sendSMS(smsList, config.getIsBPASMSEnabled()); + util.sendSMS(smsList, config.getIsBPASMSEnabled(),valMap.get(tenantIdKey)); } if (!CollectionUtils.isEmpty(configuredChannelNames) && configuredChannelNames.contains(CHANNEL_NAME_EVENT)) @@ -200,7 +204,7 @@ public void processBusinessService(HashMap record, String busine List emailRequestsForBPA = new LinkedList<>(); emailRequestsForBPA.addAll(bpaNotificationUtil.createEmailRequestForBPA(requestInfo,message, mobileNumberToEmail,license,receiptno)); if (!CollectionUtils.isEmpty(emailRequestsForBPA)) - util.sendEmail(emailRequestsForBPA, config.getIsEmailNotificationEnabledForBPA()); + util.sendEmail(emailRequestsForBPA, config.getIsEmailNotificationEnabledForBPA(), tenantId); } break; diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/service/notification/TLNotificationService.java b/municipal-services/tl-services/src/main/java/org/egov/tl/service/notification/TLNotificationService.java index a9f34074d30..8bd04836472 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/service/notification/TLNotificationService.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/service/notification/TLNotificationService.java @@ -5,6 +5,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.mdms.model.MasterDetail; import org.egov.mdms.model.MdmsCriteria; import org.egov.mdms.model.MdmsCriteriaReq; @@ -47,24 +48,28 @@ public class TLNotificationService { private TLRenewalNotificationUtil tlRenewalNotificationUtil; - private PropertyUtil propertyUtil; + private MultiStateInstanceUtil centralInstanceUtil; - @Value("${egov.mdms.host}") + private PropertyUtil propertyUtil; + + @Value("${mdms.v2.host}") private String mdmsHost; - @Value("${egov.mdms.search.endpoint}") + @Value("${mdms.v2.search.endpoint}") private String mdmsUrl; @Autowired private RestTemplate restTemplate; @Autowired - public TLNotificationService(TLConfiguration config, ServiceRequestRepository serviceRequestRepository, NotificationUtil util, BPANotificationUtil bpaNotificationUtil, TLRenewalNotificationUtil tlRenewalNotificationUtil, PropertyUtil propertyUtil) { + public TLNotificationService(TLConfiguration config, ServiceRequestRepository serviceRequestRepository, NotificationUtil util, BPANotificationUtil bpaNotificationUtil, TLRenewalNotificationUtil tlRenewalNotificationUtil + , MultiStateInstanceUtil centralInstanceUtil, PropertyUtil propertyUtil) { this.config = config; this.serviceRequestRepository = serviceRequestRepository; this.util = util; this.bpaNotificationUtil = bpaNotificationUtil; this.tlRenewalNotificationUtil = tlRenewalNotificationUtil; + this.centralInstanceUtil = centralInstanceUtil; this.propertyUtil = propertyUtil; } @@ -112,12 +117,12 @@ public void process(TradeLicenseRequest request) { log.info("Message to be sent: ", message); smsRequestsPT.addAll(propertyUtil.createPropertySMSRequest(message, property)); if (!CollectionUtils.isEmpty(smsRequestsPT)) - util.sendSMS(smsRequestsPT, true); + util.sendSMS(smsRequestsPT, true, tenantId); } enrichSMSRequest(request, smsRequestsTL, configuredChannelList); if (!CollectionUtils.isEmpty(smsRequestsTL)) - util.sendSMS(smsRequestsTL, true); + util.sendSMS(smsRequestsTL, true, request.getLicenses().get(0).getTenantId()); } if (config.getIsUserEventsNotificationEnabledForTL()) { @@ -133,7 +138,6 @@ public void process(TradeLicenseRequest request) { if (null != eventRequest) util.sendEventNotification(eventRequest); } - List emailRequests = new LinkedList<>(); if (config.getIsEmailNotificationEnabled()) { if (!propertyId.isEmpty() && ACTION_STATUS_INITIATED.equalsIgnoreCase(ACTION_STATUS)) { @@ -148,13 +152,14 @@ public void process(TradeLicenseRequest request) { String message = propertyUtil.getPropertySearchMsg(license, localizationMessages, CHANNEL_NAME_EMAIL, String.valueOf(request.getLicenses().get(0).getTradeLicenseDetail().getAdditionalDetail().get(PROPERTY_ID)), source); emailRequestsPT.addAll(propertyUtil.createPropertyEmailRequest(request.getRequestInfo(), message, mapOfPhnoAndEmail, property)); if (!CollectionUtils.isEmpty(emailRequestsPT)) - util.sendEmail(emailRequestsPT, config.getIsEmailNotificationEnabled()); + util.sendEmail(emailRequestsPT, config.getIsEmailNotificationEnabled(), tenantId); } + Map mapOfPhnoAndEmail = util.fetchUserEmailIds(mobileNumbers, requestInfo, tenantId); enrichEmailRequest(request, emailRequests, mapOfPhnoAndEmail, configuredChannelList); if (!CollectionUtils.isEmpty(emailRequests)) - util.sendEmail(emailRequests, config.getIsEmailNotificationEnabled()); + util.sendEmail(emailRequests, config.getIsEmailNotificationEnabled(), tenantId); } break; @@ -166,7 +171,7 @@ public void process(TradeLicenseRequest request) { if (config.getIsBPASMSEnabled()) { enrichSMSRequest(request, smsRequestsBPA,configuredChannelList); if (!CollectionUtils.isEmpty(smsRequestsBPA)) - util.sendSMS(smsRequestsBPA, true); + util.sendSMS(smsRequestsBPA, true, request.getLicenses().get(0).getTenantId()); } } if (null != config.getIsUserEventsNotificationEnabledForBPA()) { @@ -182,7 +187,7 @@ public void process(TradeLicenseRequest request) { Map mapOfPhnoAndEmail = util.fetchUserEmailIds(mobileNumbers, requestInfo, tenantId); enrichEmailRequest(request, emailRequestsForBPA, mapOfPhnoAndEmail, configuredChannelList); if (!CollectionUtils.isEmpty(emailRequestsForBPA)) - util.sendEmail(emailRequestsForBPA, config.getIsEmailNotificationEnabledForBPA()); + util.sendEmail(emailRequestsForBPA, config.getIsEmailNotificationEnabledForBPA(), tenantId); } } break; @@ -341,7 +346,7 @@ private EventRequest getEventsForTL(TradeLicenseRequest request) { .replace("$applicationNo", license.getApplicationNumber()) .replace("$tenantId", license.getTenantId()) .replace("$businessService", license.getBusinessService()); - actionLink = config.getUiAppHost() + actionLink; + actionLink = util.getHost(license.getTenantId()) + actionLink; ActionItem item = ActionItem.builder().actionUrl(actionLink).code(config.getPayCode()).build(); items.add(item); action = Action.builder().actionUrls(items).build(); @@ -351,7 +356,7 @@ private EventRequest getEventsForTL(TradeLicenseRequest request) { String actionLink = config.getViewApplicationLink().replace("$mobile", mobile) .replace("$applicationNo", license.getApplicationNumber()) .replace("$tenantId", license.getTenantId()); - actionLink = config.getUiAppHost() + actionLink; + actionLink = util.getHost(license.getTenantId()) + actionLink; ActionItem item = ActionItem.builder().actionUrl(actionLink).code(config.getViewApplicationCode()).build(); items.add(item); action = Action.builder().actionUrls(items).build(); @@ -422,7 +427,7 @@ public EventRequest getEventsForBPA(TradeLicenseRequest request, boolean isStatu .replace("$applicationNo", license.getApplicationNumber()) .replace("$tenantId", license.getTenantId()) .replace("$businessService", license.getBusinessService());; - actionLink = config.getUiAppHost() + actionLink; + actionLink = util.getHost(license.getTenantId()) + actionLink; ActionItem item = ActionItem.builder().actionUrl(actionLink).code(config.getPayCode()).build(); items.add(item); action = Action.builder().actionUrls(items).build(); @@ -430,7 +435,7 @@ public EventRequest getEventsForBPA(TradeLicenseRequest request, boolean isStatu if (license.getStatus().equals(APPROVED_STATUS)) { List items = new ArrayList<>(); - String actionLink = config.getUiAppHost(); + String actionLink = util.getHost(tenantId); ActionItem item = ActionItem.builder().actionUrl(actionLink).code(config.getPortalUrlCode()).build(); items.add(item); action = Action.builder().actionUrls(items).build(); @@ -452,9 +457,6 @@ public EventRequest getEventsForBPA(TradeLicenseRequest request, boolean isStatu } - - - /** * Fetches Channel List based on the module name and action. * @@ -474,7 +476,7 @@ public Map fetchChannelList(RequestInfo requestInfo, String tena if(StringUtils.isEmpty(tenantId)) return map; - MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequestForChannelList(requestInfo, tenantId.split("\\.")[0]); + MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequestForChannelList(requestInfo, centralInstanceUtil.getStateLevelTenant(tenantId)); Filter masterDataFilter = filter( where(MODULENAME).is(moduleName) diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/util/BPANotificationUtil.java b/municipal-services/tl-services/src/main/java/org/egov/tl/util/BPANotificationUtil.java index 0a1827c35d3..79d4793b3fa 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/util/BPANotificationUtil.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/util/BPANotificationUtil.java @@ -429,7 +429,7 @@ public String getRecepitDownloadLink(TradeLicense license, String mobileno,Strin String consumerCode; consumerCode = license.getApplicationNumber(); - String link = config.getUiAppHost() + config.getReceiptDownloadLink(); + String link = notificationUtil.getHost(license.getTenantId()) + config.getReceiptDownloadLink(); link = link.replace("$consumerCode", consumerCode); link = link.replace("$tenantId", license.getTenantId()); link = link.replace("$businessService", license.getBusinessService()); @@ -480,8 +480,9 @@ public EventRequest getEventsForBPA(TradeLicenseRequest request, boolean isStatu String actionLink = config.getPayLink().replace("$mobile", mobile) .replace("$applicationNo", license.getApplicationNumber()) .replace("$tenantId", license.getTenantId()) - .replace("$businessService", license.getBusinessService());; - actionLink = config.getUiAppHost() + actionLink; + .replace("$businessService", license.getBusinessService()); + String UIHost = notificationUtil.getHost(license.getTenantId()); + actionLink = UIHost + actionLink; ActionItem item = ActionItem.builder().actionUrl(actionLink).code(config.getPayCode()).build(); items.add(item); action = Action.builder().actionUrls(items).build(); diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/util/NotificationUtil.java b/municipal-services/tl-services/src/main/java/org/egov/tl/util/NotificationUtil.java index b2491dbc84b..9fb25dd7ade 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/util/NotificationUtil.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/util/NotificationUtil.java @@ -23,6 +23,26 @@ import java.text.SimpleDateFormat; import java.util.*; +import org.apache.commons.lang3.StringUtils; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.tl.config.TLConfiguration; +import org.egov.tl.producer.Producer; +import org.egov.tl.repository.ServiceRequestRepository; +import org.egov.tl.service.CalculationService; +import org.egov.tl.web.models.*; +import org.egov.tl.web.models.calculation.CalculationRes; +import org.egov.tl.web.models.calculation.TaxHeadEstimate; +import org.egov.tracer.model.CustomException; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; +import org.springframework.web.client.RestTemplate; + +import com.jayway.jsonpath.JsonPath; + import static org.egov.tl.util.TLConstants.*; import static org.springframework.util.StringUtils.capitalize; @@ -40,6 +60,8 @@ public class NotificationUtil { private CalculationService calculationService; + private MultiStateInstanceUtil centralInstanceUtil; + @Autowired public NotificationUtil(TLConfiguration config, ServiceRequestRepository serviceRequestRepository, Producer producer, RestTemplate restTemplate,CalculationService calculationService) { this.config = config; @@ -221,6 +243,7 @@ public String getEmailCustomizedMsg(RequestInfo requestInfo, TradeLicense licens * @return customized message with replaced placeholders * */ private String getReplacedMessage(TradeLicense license, String messageTemplate) { + String UIHost = getHost(license.getTenantId()); String message = messageTemplate.replace("YYYY", license.getBusinessService()); message = message.replace("ZZZZ", license.getApplicationNumber()); @@ -228,7 +251,7 @@ private String getReplacedMessage(TradeLicense license, String messageTemplate) message = message.replace("RRRR", license.getLicenseNumber()); } message = message.replace("XYZ", capitalize(license.getTenantId().split("\\.")[1])); - message = message.replace("{PORTAL_LINK}",config.getUiAppHost()); + message = message.replace("{PORTAL_LINK}",UIHost); //CCC - Designaion configurable according to ULB // message = message.replace("CCC",""); @@ -267,7 +290,7 @@ String getMessageTemplate(String notificationCode, String localizationMessage) { public StringBuilder getUri(String tenantId, RequestInfo requestInfo) { if (config.getIsLocalizationStateLevel()) - tenantId = tenantId.split("\\.")[0]; + tenantId = tenantId.split("\\.")[0] + "." + tenantId.split("\\.")[1]; String locale = NOTIFICATION_LOCALE; if (!StringUtils.isEmpty(requestInfo.getMsgId()) && requestInfo.getMsgId().split("|").length >= 2) @@ -308,7 +331,7 @@ public String getLocalizationMessages(String tenantId, RequestInfo requestInfo) * @return customized message for initiate */ private String getInitiatedMsg(TradeLicense license, String message) { - // message = message.replace("{1}",license.); + // message = message.replace("<1>",license.); message = message.replace("{2}", license.getTradeName()); message = message.replace("{3}", license.getApplicationNumber()); @@ -377,7 +400,7 @@ private String getApprovedMsg(TradeLicense license, BigDecimal amountToBePaid, S message = message.replace("{3}", amountToBePaid.toString()); - String UIHost = config.getUiAppHost(); + String UIHost = getHost(license.getTenantId()); String paymentPath = config.getPayLinkSMS(); paymentPath = paymentPath.replace("$consumercode",license.getApplicationNumber()); @@ -546,12 +569,12 @@ public String getReminderMsg(TradeLicense license, String localizationMessages) * @param smsRequestList * The list of SMSRequest to be sent */ - public void sendSMS(List smsRequestList, boolean isSMSEnabled) { + public void sendSMS(List smsRequestList, boolean isSMSEnabled, String tenantId) { if (isSMSEnabled) { if (CollectionUtils.isEmpty(smsRequestList)) log.info("Messages from localization couldn't be fetched!"); for (SMSRequest smsRequest : smsRequestList) { - producer.push(config.getSmsNotifTopic(), smsRequest); + producer.push(tenantId, config.getSmsNotifTopic(), smsRequest); log.info("SMS SENT!"); } } @@ -591,12 +614,12 @@ public List createEmailRequest(RequestInfo requestInfo,String mess * @param emailRequestList * The list of EmailRequest to be sent */ - public void sendEmail(List emailRequestList, boolean isEmailEnabled) { + public void sendEmail(List emailRequestList, boolean isEmailEnabled, String tenantId) { if (isEmailEnabled) { if (CollectionUtils.isEmpty(emailRequestList)) log.info("Messages from localization couldn't be fetched!"); for (EmailRequest emailRequest : emailRequestList) { - producer.push(config.getEmailNotifTopic(), emailRequest); + producer.push(tenantId ,config.getEmailNotifTopic(), emailRequest); log.info("EMAIL notification sent!"); } } @@ -737,7 +760,7 @@ private String getEditMsg(TradeLicense license, String message) { * @param request */ public void sendEventNotification(EventRequest request) { - producer.push(config.getSaveUserEventsTopic(), request); + producer.push("", config.getSaveUserEventsTopic(), request); } @@ -798,6 +821,15 @@ public Map fetchUserEmailIds(Set mobileNumbers, RequestI return mapOfPhnoAndEmailIds; } + public String getHost(String tenantId){ + log.info("INCOMING TENANTID FOR NOTIF HOST: " + tenantId); + String stateLevelTenantId = centralInstanceUtil.getStateLevelTenant(tenantId); + String host = config.getUiAppHostMap().get(stateLevelTenantId); + if(ObjectUtils.isEmpty(host)){ + throw new CustomException("EG_NOTIF_HOST_ERR", "No host found for tenantid: " + stateLevelTenantId); + } + return host; + } /** * Fetches UUIDs of CITIZENs based on the phone number. @@ -833,5 +865,4 @@ public Map fetchUserUUIDs(Set mobileNumbers, RequestInfo } return mapOfPhnoAndUUIDs; } - } diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/util/TLConstants.java b/municipal-services/tl-services/src/main/java/org/egov/tl/util/TLConstants.java index dd8bc715372..ada9c80b849 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/util/TLConstants.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/util/TLConstants.java @@ -1,16 +1,17 @@ package org.egov.tl.util; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.springframework.stereotype.Component; + @Component public class TLConstants { + public static String SCHEMA_REPLACE_STRING = "{schema}"; + public static final String businessService_TL = "TL"; public static final String businessService_DIRECT_RENEWAL = "DIRECTRENEWAL"; @@ -396,6 +397,8 @@ public class TLConstants { public static final String TL_BUSINESSSERVICE = "TL"; + public static final String TENANTID_MDC_STRING = "TENANTID"; + //Expired notification public static final String ACTION_STATUS_EXPIRED = "EXPIRE_EXPIRED"; diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/util/TLRenewalNotificationUtil.java b/municipal-services/tl-services/src/main/java/org/egov/tl/util/TLRenewalNotificationUtil.java index 2a771fba273..774d3e87187 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/util/TLRenewalNotificationUtil.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/util/TLRenewalNotificationUtil.java @@ -1,25 +1,51 @@ package org.egov.tl.util; -import com.jayway.jsonpath.JsonPath; -import lombok.extern.slf4j.Slf4j; +import static org.egov.tl.util.TLConstants.ACTION_CANCEL_CANCELLED; +import static org.egov.tl.util.TLConstants.ACTION_FORWARD_CITIZENACTIONREQUIRED; +import static org.egov.tl.util.TLConstants.ACTION_SENDBACKTOCITIZEN_FIELDINSPECTION; +import static org.egov.tl.util.TLConstants.ACTION_STATUS_APPLIED; +import static org.egov.tl.util.TLConstants.ACTION_STATUS_FIELDINSPECTION; +import static org.egov.tl.util.TLConstants.ACTION_STATUS_INITIATED; +import static org.egov.tl.util.TLConstants.ACTION_STATUS_PENDINGAPPROVAL; +import static org.egov.tl.util.TLConstants.ACTION_STATUS_REJECTED; +import static org.egov.tl.util.TLConstants.ACTION_STATUS_RENEWAL_APPROVED; +import static org.egov.tl.util.TLConstants.ACTION_STATUS_RENEWAL_INITIATE_APPROVED; +import static org.egov.tl.util.TLConstants.BILL_AMOUNT_JSONPATH; +import static org.egov.tl.util.TLConstants.DEFAULT_OBJECT_MODIFIED_MSG; +import static org.egov.tl.util.TLConstants.NOTIFICATION_LOCALE; +import static org.egov.tl.util.TLConstants.PAYMENT_LINK_PLACEHOLDER; +import static org.egov.tl.util.TLConstants.TRADE_LICENSE_MODULE_CODE; +import static org.egov.tl.util.TLConstants.businessService_TL; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + import org.apache.commons.lang3.StringUtils; -import org.apache.http.client.utils.URIBuilder; import org.egov.common.contract.request.RequestInfo; import org.egov.tl.config.TLConfiguration; import org.egov.tl.producer.Producer; import org.egov.tl.repository.ServiceRequestRepository; -import org.egov.tl.web.models.*; +import org.egov.tl.web.models.Difference; +import org.egov.tl.web.models.EventRequest; +import org.egov.tl.web.models.RequestInfoWrapper; +import org.egov.tl.web.models.SMSRequest; +import org.egov.tl.web.models.TradeLicense; import org.egov.tracer.model.CustomException; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; -import java.math.BigDecimal; -import java.util.*; +import com.jayway.jsonpath.JsonPath; import static org.egov.tl.util.TLConstants.*; import static org.springframework.util.StringUtils.capitalize; +import lombok.extern.slf4j.Slf4j; @Component @Slf4j @@ -197,6 +223,8 @@ public String getEmailCustomizedMsg(RequestInfo requestInfo, TradeLicense licens } private String getReplacedMessage(TradeLicense license, String messageTemplate) { + String UIHost = notificationUtil.getHost(license.getTenantId()); + String message = messageTemplate.replace("YYYY", license.getBusinessService()); message = message.replace("ZZZZ", license.getApplicationNumber()); @@ -204,7 +232,7 @@ private String getReplacedMessage(TradeLicense license, String messageTemplate) message = message.replace("RRRR", license.getLicenseNumber()); } message = message.replace("XYZ", capitalize(license.getTenantId().split("\\.")[1])); - message = message.replace("{PORTAL_LINK}",config.getUiAppHost()); + message = message.replace("{PORTAL_LINK}",UIHost); //CCC - Designaion configurable according to ULB // message = message.replace("CCC",""); return message; @@ -241,7 +269,7 @@ private String getMessageTemplate(String notificationCode, String localizationMe public StringBuilder getUri(String tenantId, RequestInfo requestInfo) { if (config.getIsLocalizationStateLevel()) - tenantId = tenantId.split("\\.")[0]; + tenantId = tenantId.split("\\.")[0] + "." + tenantId.split("\\.")[1]; String locale = NOTIFICATION_LOCALE; if (!StringUtils.isEmpty(requestInfo.getMsgId()) && requestInfo.getMsgId().split("|").length >= 2) @@ -336,7 +364,7 @@ private String getApprovedMsg(TradeLicense license, BigDecimal amountToBePaid, S String date = epochToDate(license.getValidTo()); message = message.replace("{4}", date); - String UIHost = config.getUiAppHost(); + String UIHost = notificationUtil.getHost(license.getTenantId()); String paymentPath = config.getPayLinkSMS(); paymentPath = paymentPath.replace("$consumercode",license.getApplicationNumber()); @@ -507,7 +535,7 @@ public void sendSMS(List smsRequestList, boolean isSMSEnabled) { if (CollectionUtils.isEmpty(smsRequestList)) log.info("Messages from localization couldn't be fetched!"); for (SMSRequest smsRequest : smsRequestList) { - producer.push(config.getSmsNotifTopic(), smsRequest); + producer.push("",config.getSmsNotifTopic(), smsRequest); log.info("SMS Sent! MobileNumber: " + smsRequest.getMobileNumber() + " Messages: " + smsRequest.getMessage()); } } @@ -633,7 +661,7 @@ private String getEditMsg(TradeLicense license, String message) { * @param request */ public void sendEventNotification(EventRequest request) { - producer.push(config.getSaveUserEventsTopic(), request); + producer.push("", config.getSaveUserEventsTopic(), request); } } diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/util/TradeUtil.java b/municipal-services/tl-services/src/main/java/org/egov/tl/util/TradeUtil.java index 4d1dafa3a1d..625357f2140 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/util/TradeUtil.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/util/TradeUtil.java @@ -1,7 +1,13 @@ package org.egov.tl.util; -import com.jayway.jsonpath.JsonPath; -import lombok.extern.slf4j.Slf4j; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; import org.egov.mdms.model.MasterDetail; @@ -19,10 +25,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.*; +import com.jayway.jsonpath.JsonPath; + +import lombok.extern.slf4j.Slf4j; import static org.egov.tl.util.TLConstants.*; -import static org.egov.tl.util.TLConstants.COMMON_MASTERS_MODULE; @Component @Slf4j @@ -406,4 +413,4 @@ public String mDMSCallForStateName(RequestInfo requestInfo, String tenantId) { return state; } -} \ No newline at end of file +} diff --git a/municipal-services/tl-services/src/main/java/org/egov/tl/validator/TLValidator.java b/municipal-services/tl-services/src/main/java/org/egov/tl/validator/TLValidator.java index c7ca98b86a1..10cd8da0c79 100644 --- a/municipal-services/tl-services/src/main/java/org/egov/tl/validator/TLValidator.java +++ b/municipal-services/tl-services/src/main/java/org/egov/tl/validator/TLValidator.java @@ -1,18 +1,30 @@ package org.egov.tl.validator; -import com.jayway.jsonpath.JsonPath; +import static org.egov.tl.util.TLConstants.businessService_BPA; +import static org.egov.tl.util.TLConstants.businessService_TL; + +import java.util.Arrays; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; + import org.apache.commons.lang.StringUtils; import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.Role; import org.egov.tl.config.TLConfiguration; import org.egov.tl.repository.TLRepository; -import org.egov.tl.service.TradeLicenseService; import org.egov.tl.service.UserService; -import org.egov.tl.util.BPAConstants; import org.egov.tl.util.TLConstants; import org.egov.tl.util.TradeUtil; -import org.egov.tl.web.models.*; -import org.egov.tl.web.models.user.UserDetailResponse; +import org.egov.tl.web.models.OwnerInfo; +import org.egov.tl.web.models.TradeLicense; +import org.egov.tl.web.models.TradeLicenseRequest; +import org.egov.tl.web.models.TradeLicenseSearchCriteria; +import org.egov.tl.web.models.TradeUnit; import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -32,7 +44,7 @@ public class TLValidator { private TLRepository tlRepository; - private TLConfiguration config; + private TLConfiguration configs; private PropertyValidator propertyValidator; @@ -52,7 +64,7 @@ public class TLValidator { public TLValidator(TLRepository tlRepository, TLConfiguration config, PropertyValidator propertyValidator, MDMSValidator mdmsValidator, TradeUtil tradeUtil,UserService userService) { this.tlRepository = tlRepository; - this.config = config; + this.configs = config; this.propertyValidator = propertyValidator; this.mdmsValidator = mdmsValidator; this.tradeUtil = tradeUtil; @@ -177,10 +189,10 @@ private void valideDates(TradeLicenseRequest request ,Object mdmsData){ } if(license.getLicenseType().toString().equalsIgnoreCase(TradeLicense.LicenseTypeEnum.TEMPORARY.toString())) { Long startOfDay = getStartOfDay(); - if (!config.getIsPreviousTLAllowed() && license.getValidFrom() != null + if (!configs.getIsPreviousTLAllowed() && license.getValidFrom() != null && license.getValidFrom() < startOfDay) throw new CustomException("INVALID FROM DATE", "The validFrom date cannot be less than CurrentDate"); - if ((license.getValidFrom() != null && license.getValidTo() != null) && (license.getValidTo() - license.getValidFrom()) < config.getMinPeriod()) + if ((license.getValidFrom() != null && license.getValidTo() != null) && (license.getValidTo() - license.getValidFrom()) < configs.getMinPeriod()) throw new CustomException("INVALID PERIOD", "The license should be applied for minimum of 30 days"); } }); @@ -191,7 +203,7 @@ private void valideDates(TradeLicenseRequest request ,Object mdmsData){ * @return time in millis */ private Long getStartOfDay(){ - Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(config.getEgovAppTimeZone())); + Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(configs.getEgovAppTimeZone())); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); @@ -208,12 +220,12 @@ private void validateInstitution(TradeLicenseRequest request){ List licenses = request.getLicenses(); licenses.forEach(license -> { if(license.getTradeLicenseDetail().getInstitution()!=null && - !license.getTradeLicenseDetail().getSubOwnerShipCategory().contains(config.getInstitutional())) + !license.getTradeLicenseDetail().getSubOwnerShipCategory().contains(configs.getInstitutional())) throw new CustomException("INVALID REQUEST","The institution object should be null for ownershipCategory " +license.getTradeLicenseDetail().getSubOwnerShipCategory()); if(license.getTradeLicenseDetail().getInstitution()==null && - license.getTradeLicenseDetail().getSubOwnerShipCategory().contains(config.getInstitutional())) + license.getTradeLicenseDetail().getSubOwnerShipCategory().contains(configs.getInstitutional())) throw new CustomException("INVALID REQUEST","The institution object cannot be null for ownershipCategory " +license.getTradeLicenseDetail().getSubOwnerShipCategory()); @@ -263,7 +275,7 @@ public void validateRenewal(TradeLicenseRequest request){ criteria.setStatus(statuses); criteria.setBusinessService(request.getLicenses().get(0).getBusinessService()); criteria.setLicenseNumbers(licenseNumbers); - List searchResult = tlRepository.getLicenses(criteria); + List searchResult = tlRepository.getLicenses(criteria, request.getLicenses().get(0).getTenantId()); Map licenseMap = new HashMap<>(); searchResult.forEach(license -> { @@ -557,6 +569,12 @@ private void compareIdList(List searchIds,List updateIds,Map documentFileStoreIds = new LinkedList(); + List documentFileStoreIds = new LinkedList<>(); request.getLicenses().forEach(license -> { if(license.getTradeLicenseDetail().getApplicationDocuments()!=null){ license.getTradeLicenseDetail().getApplicationDocuments().forEach( @@ -683,12 +701,6 @@ private void validateOwnerActiveStatus(TradeLicenseRequest request){ if(!errorMap.isEmpty()) throw new CustomException(errorMap); } - - - - - - } diff --git a/municipal-services/tl-services/src/main/resources/application.properties b/municipal-services/tl-services/src/main/resources/application.properties index e3100539155..fd47173895c 100644 --- a/municipal-services/tl-services/src/main/resources/application.properties +++ b/municipal-services/tl-services/src/main/resources/application.properties @@ -6,15 +6,15 @@ app.timezone=UTC spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/rainmaker_tl +spring.datasource.url=jdbc:postgresql://localhost:5432/devdb spring.datasource.username=postgres -spring.datasource.password=postgres +spring.datasource.password=123 ##----------------------------- FLYWAY CONFIGURATIONS ------------------------------# -spring.flyway.url=jdbc:postgresql://localhost:5432/rainmaker_tl +spring.flyway.url=jdbc:postgresql://localhost:5432/devdb spring.flyway.user=postgres -spring.flyway.password=postgres +spring.flyway.password=123 spring.flyway.table=public spring.flyway.baseline-on-migrate=true spring.flyway.outOfOrder=true @@ -100,8 +100,8 @@ egov.idgen.bpareg.licensenumber.name=bpareg.licensenumber egov.idgen.bpareg.licensenumber.format=PB-SK-[cy:yyyy-MM-dd]-[SEQ_EG_PT_LN] #mdms urls -egov.mdms.host=https://dev.digit.org -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search #Pagination egov.tl.default.offset=0 @@ -174,8 +174,8 @@ egov.allowed.businessServices=TL,BPAREG egov.user.event.notification.enabledForTL=true egov.user.event.notification.enabledForTLRenewal=true egov.user.event.notification.enabledForBPA=true -egov.ui.app.host=https://qa.digit.org/ -egov.msg.pay.link=digit-ui/citizen/payment/my-bills/$businessservice/$consumercode?tenantId=$tenantId +egov.ui.app.host.map={"in":"https://central-instance.digit.org","in.statea":"https://statea.digit.org"} +egov.msg.pay.link=digit-ui/citizen/withoutAuth/egov-common/pay?consumerCode=$consumercode&tenantId=$tenantId&businessService=$businessservice egov.usr.events.create.topic=persist-user-events-async egov.usr.events.pay.link=citizen/otpLogin?mobileNo=$mobile&redirectTo=digit-ui/citizen/payment/my-bills/$businessService/$applicationNo?tenantId=$tenantId egov.usr.events.pay.code=PAY @@ -185,6 +185,7 @@ egov.usr.events.pay.triggers=PENDINGPAYMENT egov.usr.events.view.application.triggers=CITIZENACTIONREQUIRED egov.usr.events.view.application.link=citizen/otpLogin?mobileNo=$mobile&redirectTo=digit-ui/citizen/tl/tradelicence/application/$applicationNo/$tenantId egov.usr.events.view.application.code=VIEW +egov.ui.app.host=https://qa.digit.org/ #Reminder @@ -202,5 +203,14 @@ id.timezone=IST #1 day renewal.pending.interval = 86400000 egov.tl.businessservices=NewTL,DIRECTRENEWAL,EDITRENEWAL + +# central-instance configs +state.level.tenantid.length=2 +is.environment.central.instance=false +tl.kafka.notification.topic.pattern=((^[a-zA-Z]+-)?update-tl-tradelicense|(^[a-zA-Z]+-)?save-tl-tradelicense|(^[a-zA-Z]+-)?update-tl-workflow) +kafka.topics.receipt.topic.pattern=((^[a-zA-Z]+-)?egov.collection.payment-create) +state.level.tenant.id=in.stateb + egov.applicationcount.period=12 egov.application.validity=1 + diff --git a/municipal-services/tl-services/src/main/resources/db/migrate.sh b/municipal-services/tl-services/src/main/resources/db/migrate.sh index 43960b25cdb..6b845ac81bb 100644 --- a/municipal-services/tl-services/src/main/resources/db/migrate.sh +++ b/municipal-services/tl-services/src/main/resources/db/migrate.sh @@ -1,3 +1,11 @@ #!/bin/sh - -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file +baseurl=$DB_URL +echo "the baseurl : $DB_URL" +schemasetter="?currentSchema=" +schemas=$SCHEMA_NAME +echo "the schemas : $schemas" +for schemaname in ${schemas//,/ } +do + echo "the schema name : ${baseurl}${schemasetter}${schemaname}" + flyway -url=${baseurl}${schemasetter}${schemaname} -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate +done diff --git a/municipal-services/vehicle/CHANGELOG.md b/municipal-services/vehicle/CHANGELOG.md index 1009a9fcb0c..1ed69efed6b 100644 --- a/municipal-services/vehicle/CHANGELOG.md +++ b/municipal-services/vehicle/CHANGELOG.md @@ -2,11 +2,11 @@ # Changelog All notable changes to this module will be documented in this file. -## 1.3.0 - 2023-03-15 +## 1.3.0 - 2023-03-31 - - Introduced seperate tab for vehicle - - Seperated the Apis -Create, update and search - - linking and delinking of vehicle introduced seperatly. + - Introduced seperate tab for vehicle. + - Seperated the Apis -Create, update and search. + - vehicle linking and delinking with vendor introduced seperatly. ## 1.2.0 - 2022-08-04 diff --git a/municipal-services/vehicle/src/main/java/org/egov/vehicle/repository/querybuilder/QueryBuilder.java b/municipal-services/vehicle/src/main/java/org/egov/vehicle/repository/querybuilder/QueryBuilder.java index 8ee53ab5ef5..0d0ef207bbf 100644 --- a/municipal-services/vehicle/src/main/java/org/egov/vehicle/repository/querybuilder/QueryBuilder.java +++ b/municipal-services/vehicle/src/main/java/org/egov/vehicle/repository/querybuilder/QueryBuilder.java @@ -195,11 +195,27 @@ public String getSearchQuery(@Valid VehicleSearchCriteria criteria, List addToPreparedStatement(preparedStmtList, type); } + /* + * Enable part search by registrationNumber of vehicle + */ + List registrationNumber = criteria.getRegistrationNumber(); - if (!CollectionUtils.isEmpty(registrationNumber)) { + if (!CollectionUtils.isEmpty(registrationNumber) && (registrationNumber.stream() + .filter(checkregnumber -> checkregnumber.length() > 0).findFirst().orElse(null) != null)) { + boolean flag = false; addClauseIfRequired(preparedStmtList, builder); - builder.append(" registrationNumber IN (").append(createQuery(registrationNumber)).append(")"); - addToPreparedStatement(preparedStmtList, registrationNumber); + builder.append(" ( "); + for (String registrationno : registrationNumber) { + if (flag) + builder.append(" OR "); + builder.append(" UPPER(registrationNumber) like ?"); + preparedStmtList.add( + '%' + net.logstash.logback.encoder.org.apache.commons.lang.StringUtils.upperCase(registrationno) + + '%'); + builder.append(" ESCAPE '_' "); + flag = true; + } + builder.append(" ) "); } List ids = criteria.getIds(); diff --git a/municipal-services/vehicle/src/main/java/org/egov/vehicle/service/UserService.java b/municipal-services/vehicle/src/main/java/org/egov/vehicle/service/UserService.java index 5c1eefddc66..83e7785a4ff 100644 --- a/municipal-services/vehicle/src/main/java/org/egov/vehicle/service/UserService.java +++ b/municipal-services/vehicle/src/main/java/org/egov/vehicle/service/UserService.java @@ -18,6 +18,7 @@ import org.egov.tracer.model.CustomException; import org.egov.vehicle.config.VehicleConfiguration; import org.egov.vehicle.repository.ServiceRequestRepository; +import org.egov.vehicle.repository.VehicleRepository; import org.egov.vehicle.trip.util.VehicleTripConstants; import org.egov.vehicle.util.Constants; import org.egov.vehicle.util.VehicleErrorConstants; @@ -50,23 +51,65 @@ public class UserService { @Autowired private ObjectMapper mapper; + @Autowired + private VehicleRepository repository; + /** * * @param vendorRequest */ @SuppressWarnings("null") - public void manageOwner(VehicleRequest vendorRequest) { + public void manageOwner(VehicleRequest vehicleRequest, boolean isUpdate) { - Vehicle vehicle = vendorRequest.getVehicle(); + Vehicle vehicle = vehicleRequest.getVehicle(); User owner = vehicle.getOwner(); UserDetailResponse userDetailResponse = null; if (owner != null) { userDetailResponse = userExists(owner); - if (userDetailResponse != null && !CollectionUtils.isEmpty(userDetailResponse.getUser())) { - owner = userDetailResponse.getUser().get(0); - } else { - owner = createVehicleOwner(owner, vendorRequest.getRequestInfo()); + + if (userDetailResponse != null && !CollectionUtils.isEmpty(userDetailResponse.getUser()) && !isUpdate) { + + Boolean notFoundUser = Boolean.FALSE; + for (int j = 0; j < userDetailResponse.getUser().size(); j++) { + User user = userDetailResponse.getUser().get(j); + + if ((user.getUserName().equalsIgnoreCase(user.getMobileNumber()) + && user.getName().equalsIgnoreCase(owner.getName())) + || user.getName().equalsIgnoreCase(owner.getName())) { + // found user with mobilenumber username not same and name as equal to the + // applicnat name provided by ui + // then consider that user as applicant + owner = user; + break; + } else { + notFoundUser = Boolean.TRUE; + } + + } + // users exists with mobile number but non of them have the same Name so create new + // user + if (notFoundUser) { + owner = createVehicleOwner(owner, vehicleRequest.getRequestInfo()); + + } + + else { + if (!isUpdate) { + // User with mobile number itself not found then create new user and consider + // the new user as applicant. + owner = createVehicleOwner(owner, vehicleRequest.getRequestInfo()); + } else { + + HashMap errorMap = new HashMap<>(); + owner = updateUserDetails(owner, vehicleRequest.getRequestInfo(), errorMap); + + } + } + + HashMap errorMap = new HashMap<>(); + updateUserDetails(owner, vehicleRequest.getRequestInfo(), errorMap); + } vehicle.setOwner(owner); @@ -77,6 +120,22 @@ public void manageOwner(VehicleRequest vendorRequest) { } + private User updateUserDetails(User vehicleInfo, RequestInfo requestInfo, HashMap errorMap) { + User userUpdated = new User(); + UserRequest userRequest = UserRequest.builder().user(vehicleInfo).requestInfo(requestInfo).build(); + StringBuilder uri = new StringBuilder(); + uri.append(config.getUserHost()).append(config.getUserContextPath()).append(config.getUserUpdateEndpoint()); + UserDetailResponse userResponse = ownerCall(userRequest, uri); + if (userResponse != null && !userResponse.getUser().isEmpty()) { + userUpdated = userResponse.getUser().get(0); + } else { + errorMap.put(VehicleErrorConstants.INVALID_VEHICLE_OWNER, + "Unable to Update UserDetails to the existing Vehicle !"); + } + return userUpdated; + + } + /** * create Employee in HRMS for Vendor owner * @@ -99,7 +158,9 @@ private User createVehicleOwner(User owner, RequestInfo requestInfo) { addUserDefaultFields(owner.getTenantId(), null, owner); StringBuilder uri = new StringBuilder(config.getUserHost()).append(config.getUserContextPath()) .append(config.getUserCreateEndpoint()); + setUserName(owner); + owner.setType(Constants.CITIZEN); UserDetailResponse userDetailResponse = userCall(new UserRequest(requestInfo, owner), uri); log.debug("owner created --> " + userDetailResponse.getUser().get(0).getUuid()); @@ -131,7 +192,7 @@ private void addUserDefaultFields(String tenantId, Role role, User applicant) { */ private void setUserName(User owner) { String uuid = UUID.randomUUID().toString(); - owner.setUserName(owner.getMobileNumber()); + owner.setUserName(uuid); owner.setUuid(uuid); } @@ -181,6 +242,9 @@ public UserDetailResponse userExists(User owner) { if (!StringUtils.isEmpty(owner.getMobileNumber())) { ownerSearchRequest.setMobileNumber(owner.getMobileNumber()); } + if (!StringUtils.isEmpty(owner.getName())) { + ownerSearchRequest.setName(owner.getName()); + } StringBuilder uri = new StringBuilder(config.getUserHost()).append(config.getUserSearchEndpoint()); return ownerCall(ownerSearchRequest, uri); diff --git a/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/service/VehicleLogEnrichmentService.java b/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/service/VehicleLogEnrichmentService.java index 8902d8c69aa..81822199e4b 100644 --- a/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/service/VehicleLogEnrichmentService.java +++ b/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/service/VehicleLogEnrichmentService.java @@ -4,6 +4,8 @@ import java.util.List; import java.util.ListIterator; import java.util.UUID; +import java.util.Map; +import java.util.HashMap; import java.util.stream.Collectors; import org.egov.common.contract.request.RequestInfo; @@ -83,6 +85,17 @@ public void setInsertData(VehicleTripRequest request) { } else { addVehicle(vehicleTrip); } + } + else { + Object additionalDetailsObject = vehicleTrip.getAdditionalDetails(); + Map vehicleTripAdditionalDetails = additionalDetailsObject != null + ? (Map) additionalDetailsObject : new HashMap<>(); + //Updates the tripdetails.volume as volumeCarried in case of Un-registered Vehicle logs + if (vehicleTripAdditionalDetails.get("vehicleNumber") != null && vehicleTrip.getVolumeCarried() != null + && (vehicleTrip.getTripDetails().get(0).getVolume() == null + || vehicleTrip.getTripDetails().get(0).getVolume() == 0)) { + vehicleTrip.getTripDetails().get(0).setVolume(vehicleTrip.getVolumeCarried()); + } } }); diff --git a/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/service/VehicleTripService.java b/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/service/VehicleTripService.java index e7121edc23e..e722cd92901 100644 --- a/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/service/VehicleTripService.java +++ b/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/service/VehicleTripService.java @@ -60,7 +60,7 @@ public List create(VehicleTripRequest request) { throw new CustomException(VehicleTripConstants.CREATE_VEHICLETRIP_ERROR, "vehicleTrip not found in the Request" + request.getVehicleTrip()); } - validator.validateCreateOrUpdateRequest(request); + // validator.validateCreateOrUpdateRequest(request); vehicleLogEnrichmentService.setInsertData(request); wfIntegrator.callWorkFlow(request); vehicleLogRepository.save(request); diff --git a/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/validator/VehicleTripValidator.java b/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/validator/VehicleTripValidator.java index 72768dfc23d..b21482fe075 100644 --- a/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/validator/VehicleTripValidator.java +++ b/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/validator/VehicleTripValidator.java @@ -79,11 +79,12 @@ public void validateCreateOrUpdateRequest(VehicleTripRequest request) { } else { - if (vehicleTrip.getTripStartTime() <= 0 || vehicleTrip.getTripEndTime() <= 0 - || vehicleTrip.getTripStartTime() > vehicleTrip.getTripEndTime()) { - throw new CustomException(VehicleTripConstants.INVALID_TRIDETAIL_ERROR, - "Trip Start and End Time are invalid: "); - } + /** + * if (vehicleTrip.getTripStartTime() <= 0 || vehicleTrip.getTripEndTime() <= 0 + * || vehicleTrip.getTripStartTime() > vehicleTrip.getTripEndTime()) { throw new + * CustomException(VehicleTripConstants.INVALID_TRIDETAIL_ERROR, "Trip Start and + * End Time are invalid: "); } + */ if (vehicleTrip.getVolumeCarried() == null || vehicleTrip.getVolumeCarried() <= 0) { throw new CustomException(VehicleTripConstants.INVALID_VOLUME, "Invalid volume carried"); @@ -269,9 +270,11 @@ private void callBusinessServiceToDispose(VehicleTrip vehicleTrip, VehicleTripRe throw new CustomException(VehicleTripConstants.VOLUME_GRT_CAPACITY, "Waster collected is greater than vehicle Capcity"); } + /* if (vehicleTrip.getTripEndTime() <= 0) { throw new CustomException(VehicleTripConstants.INVALID_TRIP_ENDTIME, "Invalid Trip end time"); } + */ validateTripInOutTime(vehicleTrip, vehicleTrip.getTripDetails().get(0)); @@ -398,12 +401,13 @@ private void validateTripInOutTime(VehicleTrip requestVehicleTrip, VehicleTripDe if (response.getVehicleTrip() != null && !CollectionUtils.isEmpty(response.getVehicleTrip())) { response.getVehicleTrip().forEach(vehicletrip -> { - if (requestVehicleTrip.getTripStartTime() <= vehicletrip.getTripEndTime()) { + /* if (requestVehicleTrip.getTripStartTime() <= vehicletrip.getTripEndTime()) { throw new CustomException(VehicleTripConstants.INVALID_TRIDETAIL_ERROR, "Current Trip Start time: " + requestVehicleTrip.getTripStartTime() + "should be after the previous trip end time : " + requestVehicleTrip.getTripEndTime()); } + */ }); } } diff --git a/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/web/model/VehicleTrip.java b/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/web/model/VehicleTrip.java index f603370df14..ead081340d7 100644 --- a/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/web/model/VehicleTrip.java +++ b/municipal-services/vehicle/src/main/java/org/egov/vehicle/trip/web/model/VehicleTrip.java @@ -27,7 +27,7 @@ /** * Request schema of VehicleTrip. */ -@Validated +// @Validated @javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-12-23T12:08:13.326Z[GMT]") @Builder diff --git a/municipal-services/vehicle/src/main/java/org/egov/vehicle/util/VehicleErrorConstants.java b/municipal-services/vehicle/src/main/java/org/egov/vehicle/util/VehicleErrorConstants.java index ff8936e5392..97ae36c04ec 100644 --- a/municipal-services/vehicle/src/main/java/org/egov/vehicle/util/VehicleErrorConstants.java +++ b/municipal-services/vehicle/src/main/java/org/egov/vehicle/util/VehicleErrorConstants.java @@ -17,4 +17,6 @@ private VehicleErrorConstants() { public static final String INVALID_OWNER_ERROR = "INVALID_OWNER_ERROR"; public static final String INVALID_VEHICLE_OWNER = "INVALID_VEHICLE_OWNER"; public static final String UPDATE_ERROR = "UPDATE_ERROR"; + public static final String ALREADY_DRIVER_EXIST = "ALREADY_DRIVER_EXIST"; + public static final String VEHICLE_ERROR_MESSAGE = "Vehicle with the same mobile number already exist"; } diff --git a/municipal-services/vehicle/src/main/java/org/egov/vehicle/validator/Validator.java b/municipal-services/vehicle/src/main/java/org/egov/vehicle/validator/Validator.java index 9d8b214a7dd..02e33683c8d 100644 --- a/municipal-services/vehicle/src/main/java/org/egov/vehicle/validator/Validator.java +++ b/municipal-services/vehicle/src/main/java/org/egov/vehicle/validator/Validator.java @@ -57,7 +57,7 @@ public void validateCreateOrUpdate(VehicleRequest vehicleRequest, Object mdmsDat } mdmsValidator.validateVehicleType(vehicleRequest); mdmsValidator.validateSuctionType(vehicle.getSuctionType()); - userService.manageOwner(vehicleRequest); + userService.manageOwner(vehicleRequest,isUpdate); } diff --git a/municipal-services/vehicle/src/main/java/org/egov/vehicle/web/model/Vehicle.java b/municipal-services/vehicle/src/main/java/org/egov/vehicle/web/model/Vehicle.java index bde4eefc2f1..f32b3f14f6c 100755 --- a/municipal-services/vehicle/src/main/java/org/egov/vehicle/web/model/Vehicle.java +++ b/municipal-services/vehicle/src/main/java/org/egov/vehicle/web/model/Vehicle.java @@ -1,5 +1,6 @@ package org.egov.vehicle.web.model; +import javax.validation.Valid; import javax.validation.constraints.Size; import org.egov.vehicle.web.model.user.User; @@ -124,6 +125,7 @@ public static StatusEnum fromValue(String text) { private StatusEnum status = null; @JsonProperty("owner") + @Valid private User owner = null; @JsonProperty("auditDetails") diff --git a/municipal-services/vehicle/src/main/java/org/egov/vehicle/web/model/VehicleRequest.java b/municipal-services/vehicle/src/main/java/org/egov/vehicle/web/model/VehicleRequest.java index 742d408919b..c7ba72fd470 100755 --- a/municipal-services/vehicle/src/main/java/org/egov/vehicle/web/model/VehicleRequest.java +++ b/municipal-services/vehicle/src/main/java/org/egov/vehicle/web/model/VehicleRequest.java @@ -9,6 +9,8 @@ import lombok.Data; import lombok.NoArgsConstructor; +import javax.validation.Valid; + @Builder @AllArgsConstructor @NoArgsConstructor @@ -18,6 +20,7 @@ public class VehicleRequest { @JsonProperty("RequestInfo") private RequestInfo RequestInfo = null; + @Valid @JsonProperty("vehicle") private Vehicle vehicle; diff --git a/municipal-services/vehicle/src/main/java/org/egov/vehicle/web/model/user/User.java b/municipal-services/vehicle/src/main/java/org/egov/vehicle/web/model/user/User.java index af42bdc40a2..0cbaa0f6903 100644 --- a/municipal-services/vehicle/src/main/java/org/egov/vehicle/web/model/user/User.java +++ b/municipal-services/vehicle/src/main/java/org/egov/vehicle/web/model/user/User.java @@ -29,179 +29,178 @@ public class User { @JsonProperty("id") - private Long id; - - @SafeHtml - @Size(max=64) - @JsonProperty("uuid") - private String uuid; - - @Size(max=64) - @SafeHtml - @JsonProperty("userName") - private String userName; - - @Size(max=64) - @SafeHtml - @JsonProperty("password") - private String password; - - @SafeHtml - @JsonProperty("salutation") - private String salutation; - - @NotNull - @SafeHtml - @Size(max=100) - @Pattern(regexp = "^[a-zA-Z0-9 \\-'`\\.]*$", message = "Invalid name. Only alphabets and special characters -, ',`, .") - @JsonProperty("name") - private String name; - - @NotNull - @SafeHtml - @JsonProperty("gender") - private String gender; - - @NotNull - @SafeHtml - @Pattern(regexp = "^[0-9]{10}$", message = "MobileNumber should be 10 digit number") - @JsonProperty("mobileNumber") - private String mobileNumber; - - @Size(max=128) - @SafeHtml - @NotNull - @JsonProperty("emailId") - private String emailId; - - @Size(max=50) - @SafeHtml - @JsonProperty("altContactNumber") - private String altContactNumber; - - @Size(max=10) - @SafeHtml - @JsonProperty("pan") - private String pan; - - @Pattern(regexp = "^[0-9]{12}$", message = "AdharNumber should be 12 digit number") - @SafeHtml - @JsonProperty("aadhaarNumber") - private String aadhaarNumber; - - @Size(max=300) - @SafeHtml - @JsonProperty("permanentAddress") - private String permanentAddress; - - @Size(max=300) - @JsonProperty("permanentCity") - private String permanentCity; - - @Size(max=10) - @SafeHtml - @JsonProperty("permanentPinCode") - private String permanentPincode; - - @Size(max=300) - @SafeHtml - @JsonProperty("correspondenceCity") - private String correspondenceCity; - - @Size(max=10) - @SafeHtml - @JsonProperty("correspondencePinCode") - private String correspondencePincode; - - @Size(max=300) - @SafeHtml - @JsonProperty("correspondenceAddress") - private String correspondenceAddress; - - @JsonProperty("active") - private Boolean active; - - @NotNull - @JsonProperty("dob") - private Long dob; - - @JsonProperty("pwdExpiryDate") - private Long pwdExpiryDate; - - @Size(max=16) - @SafeHtml - @JsonProperty("locale") - private String locale; - - @Size(max=50) - @SafeHtml - @JsonProperty("type") - private String type; - - @Size(max=36) - @SafeHtml - @JsonProperty("signature") - private String signature; - - @JsonProperty("accountLocked") - private Boolean accountLocked; - - @JsonProperty("roles") - @Valid - private List roles; - - @NotNull - @SafeHtml - @Size(max=100) - @JsonProperty("fatherOrHusbandName") - private String fatherOrHusbandName; - - @NotNull - @JsonProperty("relationship") - private GuardianRelation relationship; - - - public enum GuardianRelation { - FATHER, MOTHER, HUSBAND, OTHER; - } - - @Size(max=32) - @SafeHtml - @JsonProperty("bloodGroup") - private String bloodGroup; - - @Size(max=300) - @SafeHtml - @JsonProperty("identificationMark") - private String identificationMark; - - @Size(max=36) - @JsonProperty("photo") - private String photo; - - @Size(max=64) - @SafeHtml - @JsonProperty("createdBy") - private String createdBy; - - @JsonProperty("createdDate") - private Long createdDate; - - @Size(max=64) - @SafeHtml - @JsonProperty("lastModifiedBy") - private String lastModifiedBy; - - @JsonProperty("lastModifiedDate") - private Long lastModifiedDate; - - @SafeHtml - @JsonProperty("otpReference") - private String otpReference; - - @Size(max=256) - @SafeHtml - @NonNull - @JsonProperty("tenantId") - private String tenantId; + private Long id; + + @SafeHtml + @Size(max = 64) + @JsonProperty("uuid") + private String uuid; + + @Size(max = 64) + @SafeHtml + @JsonProperty("userName") + private String userName; + + @Size(max = 64) + @SafeHtml + @JsonProperty("password") + private String password; + + @SafeHtml + @JsonProperty("salutation") + private String salutation; + + @NotNull + @SafeHtml + @Size(max = 100) + @Pattern(regexp = "^[a-zA-Z0-9 \\-'`\\.]*$", message = "Invalid name. Only alphabets and special characters -, ',`, .") + @JsonProperty("name") + private String name; + + @NotNull + @SafeHtml + @JsonProperty("gender") + private String gender; + + @NotNull + @SafeHtml + @Pattern(regexp = "^[0-9]{10}$", message = "MobileNumber should be 10 digit number") + @JsonProperty("mobileNumber") + private String mobileNumber; + + @Size(max = 128) + @SafeHtml + // @NotNull + @JsonProperty("emailId") + private String emailId; + + @Size(max = 50) + @SafeHtml + @JsonProperty("altContactNumber") + private String altContactNumber; + + @Size(max = 10) + @SafeHtml + @JsonProperty("pan") + private String pan; + + @Pattern(regexp = "^[0-9]{12}$", message = "AdharNumber should be 12 digit number") + @SafeHtml + @JsonProperty("aadhaarNumber") + private String aadhaarNumber; + + @Size(max = 300) + @SafeHtml + @JsonProperty("permanentAddress") + private String permanentAddress; + + @Size(max = 300) + @JsonProperty("permanentCity") + private String permanentCity; + + @Size(max = 10) + @SafeHtml + @JsonProperty("permanentPinCode") + private String permanentPincode; + + @Size(max = 300) + @SafeHtml + @JsonProperty("correspondenceCity") + private String correspondenceCity; + + @Size(max = 10) + @SafeHtml + @JsonProperty("correspondencePinCode") + private String correspondencePincode; + + @Size(max = 300) + @SafeHtml + @JsonProperty("correspondenceAddress") + private String correspondenceAddress; + + @JsonProperty("active") + private Boolean active; + + // @NotNull + @JsonProperty("dob") + private Long dob; + + @JsonProperty("pwdExpiryDate") + private Long pwdExpiryDate; + + @Size(max = 16) + @SafeHtml + @JsonProperty("locale") + private String locale; + + @Size(max = 50) + @SafeHtml + @JsonProperty("type") + private String type; + + @Size(max = 36) + @SafeHtml + @JsonProperty("signature") + private String signature; + + @JsonProperty("accountLocked") + private Boolean accountLocked; + + @JsonProperty("roles") + @Valid + private List roles; + + // @NotNull + @SafeHtml + @Size(max = 100) + @JsonProperty("fatherOrHusbandName") + private String fatherOrHusbandName; + + // @NotNull + @JsonProperty("relationship") + private GuardianRelation relationship; + + public enum GuardianRelation { + FATHER, MOTHER, HUSBAND, OTHER; + } + + @Size(max = 32) + @SafeHtml + @JsonProperty("bloodGroup") + private String bloodGroup; + + @Size(max = 300) + @SafeHtml + @JsonProperty("identificationMark") + private String identificationMark; + + @Size(max = 36) + @JsonProperty("photo") + private String photo; + + @Size(max = 64) + @SafeHtml + @JsonProperty("createdBy") + private String createdBy; + + @JsonProperty("createdDate") + private Long createdDate; + + @Size(max = 64) + @SafeHtml + @JsonProperty("lastModifiedBy") + private String lastModifiedBy; + + @JsonProperty("lastModifiedDate") + private Long lastModifiedDate; + + @SafeHtml + @JsonProperty("otpReference") + private String otpReference; + + @Size(max = 256) + @SafeHtml + @NonNull + @JsonProperty("tenantId") + private String tenantId; } diff --git a/municipal-services/vehicle/src/main/resources/application.properties b/municipal-services/vehicle/src/main/resources/application.properties index ccf6ccd87bc..bd41cc2fe11 100644 --- a/municipal-services/vehicle/src/main/resources/application.properties +++ b/municipal-services/vehicle/src/main/resources/application.properties @@ -80,7 +80,7 @@ citizen.allowed.search.params=ids,status,mobileNumber,offset,limit,ownerId,regis employee.allowed.search.params=ids,status,mobileNumber,offset,limit,ownerId,registrationNumber,type,model,suctionType,vehicleOwner,tankCapacity egov.vehicle.default.limit=20 egov.vehicle.default.offset=0 -egov.vehicle.max.limit=100 +egov.vehicle.max.limit=200 # wf url diff --git a/municipal-services/vehicle/src/main/resources/db/migration/main/V20210106110600__vehicle_initial.sql b/municipal-services/vehicle/src/main/resources/db/migration/main/V20210106110600__vehicle_initial.sql index ef54fcb1ba7..adf5981b785 100755 --- a/municipal-services/vehicle/src/main/resources/db/migration/main/V20210106110600__vehicle_initial.sql +++ b/municipal-services/vehicle/src/main/resources/db/migration/main/V20210106110600__vehicle_initial.sql @@ -22,22 +22,22 @@ lastmodifiedtime bigint, CONSTRAINT pk_eg_vehicle PRIMARY KEY (id) ); -CREATE INDEX index_id_eg_vehicle ON eg_vehicle +CREATE INDEX IF NOT EXISTS index_id_eg_vehicle ON eg_vehicle (id); -CREATE INDEX index_regnum_eg_vehicle ON eg_vehicle +CREATE INDEX IF NOT EXISTS index_regnum_eg_vehicle ON eg_vehicle (registrationNumber); -CREATE INDEX index_owner_eg_vehicle ON eg_vehicle +CREATE INDEX IF NOT EXISTS index_owner_eg_vehicle ON eg_vehicle (owner_id); -CREATE INDEX eg_vehicle_suctype_index ON eg_vehicle +CREATE INDEX IF NOT EXISTS eg_vehicle_suctype_index ON eg_vehicle (suctionType); -CREATE INDEX eg_vehicle_status_index ON eg_vehicle +CREATE INDEX IF NOT EXISTS eg_vehicle_status_index ON eg_vehicle (status); -CREATE INDEX index_tenant_eg_vehicle ON eg_vehicle +CREATE INDEX IF NOT EXISTS index_tenant_eg_vehicle ON eg_vehicle (tenantid); CREATE TABLE IF NOT EXISTS eg_vehicle_auditlog( @@ -62,5 +62,5 @@ lastmodifiedby character varying(64), createdtime bigint, lastmodifiedtime bigint ); -CREATE INDEX index_id_eg_vehicle_auditlog ON eg_vehicle_auditlog +CREATE INDEX IF NOT EXISTS index_id_eg_vehicle_auditlog ON eg_vehicle_auditlog (id); \ No newline at end of file diff --git a/municipal-services/vehicle/src/main/resources/db/migration/main/V20223105113254__update_null_vehicle_status.sql b/municipal-services/vehicle/src/main/resources/db/migration/main/V20223105113254__update_null_vehicle_status.sql index a2913a3f527..0f35f863cae 100644 --- a/municipal-services/vehicle/src/main/resources/db/migration/main/V20223105113254__update_null_vehicle_status.sql +++ b/municipal-services/vehicle/src/main/resources/db/migration/main/V20223105113254__update_null_vehicle_status.sql @@ -2,4 +2,4 @@ UPDATE eg_vehicle set status='ACTIVE', lastmodifiedby='SAN-1098', lastmodifiedtime=extract(epoch from current_timestamp )*1000 - where status is null; \ No newline at end of file + where status is null; diff --git a/municipal-services/vendor/CHANGELOG.md b/municipal-services/vendor/CHANGELOG.md index 85ef430fb9c..ea477f37839 100644 --- a/municipal-services/vendor/CHANGELOG.md +++ b/municipal-services/vendor/CHANGELOG.md @@ -2,11 +2,11 @@ # Changelog All notable changes to this module will be documented in this file. -## 1.3.0 - 2023-03-15 +## 1.3.0 - 2023-03-31 - - Introduced seperate tab for vendor and driver - - Seperated the Apis -Create, update and search for both vendor and vehicle - - linking and delinking of driver with vendor introduced seperatly + - Introduced seperate tab for vendor and driver. + - Seperated the Apis -Create, update and search for both vendor and driver. + - linking and delinking of driver with vendor introduced seperatly. ## 1.2.0 - 2022-08-04 diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/config/VendorConfiguration.java b/municipal-services/vendor/src/main/java/org/egov/vendor/config/VendorConfiguration.java index a6c7cc725d8..7c386b82f3f 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/config/VendorConfiguration.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/config/VendorConfiguration.java @@ -17,23 +17,19 @@ @Component public class VendorConfiguration { - - // Persister Config @Value("${persister.save.vendor.topic}") private String saveTopic; - @Value("${persister.update.vendor.topic}") private String updateTopic; - + @Value("${persister.save.driver.topic}") private String saveDriverTopic; - @Value("${persister.update.driver.topic}") private String updateDriverTopic; - + @Value("${persister.save.vendordrivervehicle.topic}") private String saveVendorVehicleDriverTopic; @@ -48,10 +44,9 @@ public class VendorConfiguration { @Value("${egov.user.host}") private String userHost; - @Value("${egov.user.context.path}") + @Value("${egov.user.context.path}") private String userContextPath; - - + @Value("${egov.user.create.path}") private String userCreateEndpoint; @@ -60,18 +55,17 @@ public class VendorConfiguration { @Value("${egov.user.update.path}") private String userUpdateEndpoint; - + @Value("${egov.user.username.prefix}") private String usernamePrefix; - + // Vehicle Configuration @Value("${egov.vehicle.host}") private String vehicleHost; - @Value("${egov.vehicle.context.path}") + @Value("${egov.vehicle.context.path}") private String vehicleContextPath; - - + @Value("${egov.vehicle.create.endpoint}") private String vehicleCreateEndpoint; @@ -80,12 +74,11 @@ public class VendorConfiguration { @Value("${egov.vehicle.update.endpoint}") private String vehicleUpdateEndpoint; - - + @Value("${egov.hrms.host}") private String employeeHost; - @Value("${egov.hrms.context.path}") + @Value("${egov.hrms.context.path}") private String employeeContextPath; @Value("${egov.hrms.create.path}") private String employeeCreateEndpoint; @@ -111,15 +104,11 @@ public class VendorConfiguration { @Value("${egov.location.hierarchyTypeCode}") private String hierarchyTypeCode; - - - @Value("${employee.allowed.search.params}") private String allowedEmployeeSearchParameters; - + @Value("${citizen.allowed.search.params}") private String allowedCitizenSearchParameters; - @Value("${egov.vendorregistory.default.limit}") private Integer defaultLimit; @@ -142,4 +131,13 @@ public class VendorConfiguration { @Value("${dso.driver.role.name}") private String dsoDriverRoleName; + @Value("${citizen.role}") + private String citizenRole; + + @Value("${citizen.role.name}") + private String citizenRoleName; + + @Value("${vendor.driver.mobile.number}") + private String driverMobileNumberIncrement; + } diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/driver/repository/DriverRepository.java b/municipal-services/vendor/src/main/java/org/egov/vendor/driver/repository/DriverRepository.java index 06c52fcd419..e31fc82dfde 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/driver/repository/DriverRepository.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/driver/repository/DriverRepository.java @@ -63,4 +63,13 @@ public List fetchDriverIdsWithNoVendor(@Valid DriverSearchCriteria crite return jdbcTemplate.query(query, preparedStmtList.toArray(), new SingleColumnRowMapper<>(String.class)); } + public String getdriverSeqMobileNum(String seqDriverMobileNumber) { + List preparedStmtList = new ArrayList<>(); + + String query = driverQueryBuilder.getSeqDriverMobileNumber(seqDriverMobileNumber, preparedStmtList); + + return jdbcTemplate.queryForObject(query, preparedStmtList.toArray(), String.class); + + } + } diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/driver/repository/querybuilder/DriverQueryBuilder.java b/municipal-services/vendor/src/main/java/org/egov/vendor/driver/repository/querybuilder/DriverQueryBuilder.java index 7b204b5356a..ed4f1d921c1 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/driver/repository/querybuilder/DriverQueryBuilder.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/driver/repository/querybuilder/DriverQueryBuilder.java @@ -4,6 +4,7 @@ import javax.validation.Valid; +import org.apache.commons.lang3.StringUtils; import org.egov.vendor.config.VendorConfiguration; import org.egov.vendor.driver.web.model.DriverSearchCriteria; import org.egov.vendor.web.model.VendorSearchCriteria; @@ -23,6 +24,7 @@ public class DriverQueryBuilder { + "(SELECT *, DENSE_RANK() OVER (ORDER BY SORT_BY SORT_ORDER) offset_ FROM " + "({})" + " result) result_offset " + "limit ? offset ?"; private static final String DRIVER_NO_VENDOR_QUERY = " SELECT DISTINCT (driver.id) FROM EG_DRIVER driver LEFT JOIN eg_vendor_driver vendor_driver ON driver.id=vendor_driver.driver_id"; + private static final String DRIVER_SEQ_MOBILE_NUMBER_QUERY = " SELECT nextval"; public String getDriverSearchQuery(DriverSearchCriteria criteria, List preparedStmtList) { StringBuilder builder = new StringBuilder(QUERY); @@ -38,13 +40,29 @@ public String getDriverSearchQuery(DriverSearchCriteria criteria, List p preparedStmtList.add(criteria.getTenantId()); } + /* + * Enable part search with DriverName + */ + List driverName = criteria.getName(); - if (!CollectionUtils.isEmpty(driverName)) { + if (!CollectionUtils.isEmpty(driverName) + && (driverName.stream().filter(name -> name.length() > 0).findFirst().orElse(null) != null)) { + boolean flag = false; addClauseIfRequired(preparedStmtList, builder); - builder.append(" driver.name IN (").append(createQuery(driverName)).append(")"); - addToPreparedStatement(preparedStmtList, driverName); - + builder.append(" ( "); + for (String drivername : driverName) { + + if (flag) + builder.append(" OR "); + builder.append(" LOWER(driver.name) like ?"); + preparedStmtList.add('%' + StringUtils.lowerCase(drivername) + '%'); + builder.append(" ESCAPE '_' "); + flag = true; + + } + builder.append(" ) "); } + List ownerIds = criteria.getOwnerIds(); if (!CollectionUtils.isEmpty(ownerIds)) { addClauseIfRequired(preparedStmtList, builder); @@ -73,19 +91,18 @@ private String addPaginationWrapper(String query, List preparedStmtList, int limit = config.getDefaultLimit(); int offset = config.getDefaultOffset(); String finalQuery = PAGINATION_WRAPPER.replace("{}", query); - - if (criteria.getSortBy()!=null) { + + if (criteria.getSortBy() != null) { finalQuery = finalQuery.replace("SORT_BY", criteria.getSortBy().toString()); } else { finalQuery = finalQuery.replace("SORT_BY", "createdTime"); } - - if (criteria.getSortOrder()!=null) { + + if (criteria.getSortOrder() != null) { finalQuery = finalQuery.replace("SORT_ORDER", criteria.getSortOrder().toString()); } else { finalQuery = finalQuery.replace("SORT_ORDER", " DESC "); } - if (criteria.getLimit() != null && criteria.getLimit() <= config.getMaxSearchLimit()) limit = criteria.getLimit(); @@ -148,4 +165,11 @@ public String getDriverIdsWithNoVendorQuery(@Valid DriverSearchCriteria criteria return builder.toString(); } + public String getSeqDriverMobileNumber(String seqDriverMobileNumber, List preparedStmtList) { + + StringBuilder builder = new StringBuilder(DRIVER_SEQ_MOBILE_NUMBER_QUERY); + builder.append("('" + seqDriverMobileNumber + "')"); + return builder.toString(); + } + } diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/driver/service/DriverEnrichmentService.java b/municipal-services/vendor/src/main/java/org/egov/vendor/driver/service/DriverEnrichmentService.java index a0c6257865c..161368f2a3d 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/driver/service/DriverEnrichmentService.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/driver/service/DriverEnrichmentService.java @@ -1,8 +1,7 @@ package org.egov.vendor.driver.service; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; +import java.util.*; +import java.util.stream.Collectors; import org.egov.common.contract.request.RequestInfo; import org.egov.vendor.driver.web.model.Driver; @@ -11,6 +10,7 @@ import org.egov.vendor.service.VendorService; import org.egov.vendor.util.VendorUtil; import org.egov.vendor.web.model.AuditDetails; +import org.egov.vendor.web.model.user.User; import org.egov.vendor.web.model.user.UserDetailResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -76,17 +76,23 @@ public void enrichUpdate(DriverRequest driverRequest) { public void enrichDriverSearch(List driverList, RequestInfo requestInfo, String tenantId) { + List ownerIds = driverList.stream().map(Driver::getOwnerId).collect(Collectors.toList()); + + DriverSearchCriteria driverSearchCriteria = new DriverSearchCriteria(); + driverSearchCriteria.setIds(ownerIds); + driverSearchCriteria.setTenantId(tenantId); + UserDetailResponse userResponse = userService.getUsers(driverSearchCriteria, requestInfo); + Map ownerIDUserResponseMap = new HashMap<>(); + + if (userResponse != null && !CollectionUtils.isEmpty(userResponse.getUser())) + { + userResponse.getUser().forEach(user -> ownerIDUserResponseMap.put(user.getUuid(), user)); + } + driverList.forEach(driver -> { - DriverSearchCriteria driverSearchCriteria = new DriverSearchCriteria(); - List ownerIds = new ArrayList<>(); - ownerIds.add(driver.getOwnerId()); - driverSearchCriteria.setIds(ownerIds); - driverSearchCriteria.setTenantId(tenantId); - UserDetailResponse userResponse = userService.getUsers(driverSearchCriteria, requestInfo); - if (userResponse != null && !CollectionUtils.isEmpty(userResponse.getUser())) { - driver.setOwner(userResponse.getUser().get(0)); - } + driver.setOwner(ownerIDUserResponseMap.get(driver.getOwnerId())); }); + } } diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/driver/service/DriverService.java b/municipal-services/vendor/src/main/java/org/egov/vendor/driver/service/DriverService.java index c0dd74d474f..a9132ca0c8a 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/driver/service/DriverService.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/driver/service/DriverService.java @@ -6,6 +6,7 @@ import org.egov.common.contract.request.RequestInfo; import org.egov.tracer.model.CustomException; +import org.egov.vendor.config.VendorConfiguration; import org.egov.vendor.driver.repository.DriverRepository; import org.egov.vendor.driver.web.model.Driver; import org.egov.vendor.driver.web.model.DriverRequest; @@ -32,24 +33,36 @@ public class DriverService { @Autowired private DriverUserService userService; + @Autowired + private VendorConfiguration config; + public Driver create(DriverRequest driverRequest) { if (driverRequest.getDriver().getTenantId().split("\\.").length == 1) { throw new CustomException("Invalid TenantId", " Application cannot be create at StateLevel"); } - userService.manageDrivers(driverRequest); + driverRequest.getDriver().getOwner() + .setMobileNumber(driverRepository.getdriverSeqMobileNum(getSeqDriverMobileNumber())); + userService.manageDrivers(driverRequest, true); enrichmentService.enrichCreate(driverRequest); driverRepository.save(driverRequest); return driverRequest.getDriver(); } + /* + * This method is to increment mobile number each time driver is created + */ + private String getSeqDriverMobileNumber() { + return config.getDriverMobileNumberIncrement(); + } + public Driver update(DriverRequest driverRequest) { if (driverRequest.getDriver().getTenantId().split("\\.").length == 1) { throw new CustomException("Invalid TenantId", " Application cannot be updated at StateLevel"); } - userService.manageDrivers(driverRequest); + userService.manageDrivers(driverRequest, false); enrichmentService.enrichUpdate(driverRequest); driverRepository.update(driverRequest); return driverRequest.getDriver(); diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/driver/service/DriverUserService.java b/municipal-services/vendor/src/main/java/org/egov/vendor/driver/service/DriverUserService.java index 89635dbd54b..eb915e665a6 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/driver/service/DriverUserService.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/driver/service/DriverUserService.java @@ -10,16 +10,17 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.UUID; -import javax.validation.Valid; - import org.egov.common.contract.request.RequestInfo; import org.egov.common.contract.request.Role; import org.egov.tracer.model.CustomException; import org.egov.vendor.config.VendorConfiguration; +import org.egov.vendor.driver.repository.DriverRepository; import org.egov.vendor.driver.web.model.Driver; import org.egov.vendor.driver.web.model.DriverRequest; +import org.egov.vendor.driver.web.model.DriverResponse; import org.egov.vendor.driver.web.model.DriverSearchCriteria; import org.egov.vendor.repository.ServiceRequestRepository; import org.egov.vendor.util.VendorConstants; @@ -50,12 +51,16 @@ public class DriverUserService { @Autowired private ObjectMapper mapper; + @Autowired + private DriverRepository driverRepository; + /** * * @param driverRequest + * @param isCreateOrUpdate */ @SuppressWarnings("null") - public void manageDrivers(DriverRequest driverRequest) { + public void manageDrivers(DriverRequest driverRequest, boolean isCreateOrUpdate) { Driver driver = driverRequest.getDriver(); RequestInfo requestInfo = driverRequest.getRequestInfo(); User driverInfo = driver.getOwner(); @@ -64,7 +69,7 @@ public void manageDrivers(DriverRequest driverRequest) { UserDetailResponse userDetailResponse = null; if (driverInfo != null && driverInfo.getMobileNumber() != null) { - driverInfoMobileNumber(driverInfo, requestInfo, errorMap, driver, driverRequest); + driverInfoMobileNumber(driverInfo, requestInfo, errorMap, driver, driverRequest, isCreateOrUpdate); } else { log.debug("MobileNo is not provided in Application."); @@ -75,17 +80,53 @@ public void manageDrivers(DriverRequest driverRequest) { if (!errorMap.isEmpty()) { throw new CustomException(errorMap); } + licenseExistCheck(driverRequest); + } + private void licenseExistCheck(DriverRequest driverRequest) { + DriverResponse driverResponse = driverRepository.getDriverData(new DriverSearchCriteria()); + + Optional driver = Optional.ofNullable(driverResponse) + .map(DriverResponse::getDriver) + .orElse(Collections.emptyList()) + .stream() + .filter(driverIdAndLicenseNumCheck -> + driverIdAndLicenseNumCheck.getLicenseNumber().equalsIgnoreCase(driverRequest.getDriver().getLicenseNumber()) + && !driverIdAndLicenseNumCheck.getId().equalsIgnoreCase(driverRequest.getDriver().getId())) + .findFirst(); + + if (driver.isPresent()) { + throw new CustomException("Invalid LicenseNumber", " Driver with the same license number already exist"); + } } private void driverInfoMobileNumber(User driverInfo, RequestInfo requestInfo, HashMap errorMap, - Driver driver, DriverRequest driverRequest) { - UserDetailResponse userDetailResponse = userExists(driverInfo); + Driver driver, DriverRequest driverRequest, boolean isCreateOrUpdate) { + UserDetailResponse userDetailResponse = userExists(driverInfo);// 1 user + User foundDriver = null; if (userDetailResponse != null && !CollectionUtils.isEmpty(userDetailResponse.getUser())) { - for (int i = 0; i < userDetailResponse.getUser().size(); i++) { + if (driver.getOwner().getMobileNumber().equals(userDetailResponse.getUser().get(i).getMobileNumber()) + && !userDetailResponse.getUser().get(i).getUuid() + .equals(driverRequest.getDriver().getOwner().getUuid())) { + + userDetailResponse.getUser().get(i).getRoles().forEach(getAllRoles -> { + + if (getAllRoles.getCode().equals(VendorConstants.FSM_DRIVER)) { + log.debug("Driver with the same mobile number already exist."); + errorMap.put(VendorErrorConstants.MOBILE_NUMBER_ALREADY_EXIST, + "Driver with the same mobile number already exist "); + + } + if (!errorMap.isEmpty()) { + throw new CustomException(errorMap); + } + }); + + } + if (isRoleAvailale(userDetailResponse.getUser().get(i), config.getDsoDriver(), driver.getTenantId()) == Boolean.TRUE) { foundDriver = userDetailResponse.getUser().get(i); @@ -99,11 +140,13 @@ private void driverInfoMobileNumber(User driverInfo, RequestInfo requestInfo, Ha updateUserDetails(driverInfo, requestInfo, errorMap); } - } else { + } else if (isCreateOrUpdate) { foundDriver = createDriver(driverInfo, requestInfo); + driverRequest.getDriver().setOwner(foundDriver); + } else { + updateUserDetails(driverInfo, requestInfo, errorMap); + driverRequest.getDriver().setOwner(driverRequest.getDriver().getOwner()); } - - driverRequest.getDriver().setOwner(foundDriver); } private User updateUserDetails(User driverInfo, RequestInfo requestInfo, HashMap errorMap) { @@ -196,7 +239,7 @@ else if (uri.toString().contains(config.getUserCreateEndpoint())) /** * create Employee in HRMS for Vendor owner * - * @param owner + * @param driver * @param requestInfo * @return */ diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/driver/web/controller/VendorDriverContoller.java b/municipal-services/vendor/src/main/java/org/egov/vendor/driver/web/controller/VendorDriverContoller.java index d271ad192ab..d6f9b57f453 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/driver/web/controller/VendorDriverContoller.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/driver/web/controller/VendorDriverContoller.java @@ -36,7 +36,7 @@ public class VendorDriverContoller { private ResponseInfoFactory responseInfoFactory; @PostMapping(value = "/_create") - public ResponseEntity create(@Valid @RequestBody DriverRequest driverRequest) { + public ResponseEntity create(@Valid @RequestBody DriverRequest driverRequest) throws Exception { vendorUtil.defaultJsonPathConfig(); Driver driver = driverService.create(driverRequest); List driverList = new ArrayList<>(); diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/repository/querybuilder/VendorQueryBuilder.java b/municipal-services/vendor/src/main/java/org/egov/vendor/repository/querybuilder/VendorQueryBuilder.java index 39b5b6fee4f..e82c94c633e 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/repository/querybuilder/VendorQueryBuilder.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/repository/querybuilder/VendorQueryBuilder.java @@ -3,6 +3,7 @@ import java.util.List; import java.util.stream.Collectors; +import org.apache.commons.lang3.StringUtils; import org.egov.vendor.config.VendorConfiguration; import org.egov.vendor.web.model.VendorSearchCriteria; import org.springframework.beans.factory.annotation.Autowired; @@ -104,14 +105,28 @@ public String getVendorSearchQuery(VendorSearchCriteria criteria, List p preparedStmtList.add(criteria.getTenantId()); } + /* + * Enable part search with VendorName + */ + List vendorName = criteria.getName(); - if (!CollectionUtils.isEmpty(vendorName)) { + if (!CollectionUtils.isEmpty(vendorName) + && (vendorName.stream().filter(name -> name.length() > 0).findFirst().orElse(null) != null)) { List vendorNametoLowerCase = criteria.getName().stream().map(String::toLowerCase) .collect(Collectors.toList()); + boolean flag = false; addClauseIfRequired(preparedStmtList, builder); - builder.append(" LOWER(vendor.name) IN (").append(createQuery(vendorNametoLowerCase)).append(")"); - addToPreparedStatement(preparedStmtList, vendorNametoLowerCase); - + builder.append(" ( "); + for (String vendorname : vendorNametoLowerCase) { + if (flag) + builder.append(" OR "); + builder.append(" LOWER(vendor.name) like ?"); + preparedStmtList.add('%' + StringUtils.lowerCase(vendorname) + '%'); + builder.append(" ESCAPE '_' "); + + flag = true; + } + builder.append(" ) "); } List ownerIds = criteria.getOwnerIds(); if (!CollectionUtils.isEmpty(ownerIds)) { diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/service/EnrichmentService.java b/municipal-services/vendor/src/main/java/org/egov/vendor/service/EnrichmentService.java index 87e917dfc55..67880ca717d 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/service/EnrichmentService.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/service/EnrichmentService.java @@ -113,8 +113,7 @@ private void enrichDriverInfoRequest(VendorRequest vendorRequest, AuditDetails a /** * enrich the vendor update request with the required data * - * @param fsmRequest - * @param mdmsData + * @param vendorRequest */ public void enrichUpdate(VendorRequest vendorRequest) { RequestInfo requestInfo = vendorRequest.getRequestInfo(); diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/service/UserService.java b/municipal-services/vendor/src/main/java/org/egov/vendor/service/UserService.java index 2b1f599bf8f..e6379af0b04 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/service/UserService.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/service/UserService.java @@ -83,7 +83,7 @@ public void manageOwner(VendorRequest vendorRequest) { foundOwner = userDetailResponse.getUser().get(i); } } - foundOwnerDetails(userDetailResponse, foundOwner, requestInfo); + owner = foundOwnerDetails(userDetailResponse, foundOwner, requestInfo); } else { owner = createVendorOwner(owner, vendorRequest.getRequestInfo()); @@ -98,6 +98,49 @@ public void manageOwner(VendorRequest vendorRequest) { } + /** + * + * @param vendorRequest + * @param requestInfo + */ + @SuppressWarnings("null") + public void vendorMobileExistanceCheck(VendorRequest vendorRequest, RequestInfo requestInfo) { + + Vendor vendor = vendorRequest.getVendor(); + User owner = vendor.getOwner(); + + UserDetailResponse userDetailResponse = null; + + if (owner != null) { + + userDetailResponse = userExists(owner); + if (userDetailResponse != null && !CollectionUtils.isEmpty(userDetailResponse.getUser())) { + + // validateVendorExists(userDetailResponse.getUser()); + List ownerIds = userDetailResponse.getUser().stream().map(User::getUuid) + .collect(Collectors.toList()); + int count = vendorRepository.getExistingVenodrsCount(ownerIds); + log.debug("userDetailResponse SIZE==>" + userDetailResponse.getUser().size()); + + for (int i = 0; i < userDetailResponse.getUser().size(); i++) { + if (count > 0 + && vendorRequest.getVendor().getOwner().getMobileNumber() + .equals(userDetailResponse.getUser().get(i).getMobileNumber()) + && !userDetailResponse.getUser().get(i).getUuid() + .equals(vendorRequest.getVendor().getOwner().getUuid())) { + List roleCodes = userDetailResponse.getUser().get(i).getRoles().stream() + .map(Role::getCode).collect(Collectors.toList()); + if (roleCodes.contains(config.getDsoRole())) { + throw new CustomException(VendorErrorConstants.ALREADY_VENDOR_EXIST, + VendorErrorConstants.VENDOR_ERROR_MESSAGE); + } + + } + } + } + } + } + private User foundOwnerDetails(UserDetailResponse userDetailResponse, User foundOwner, RequestInfo requestInfo) { User owner = new User(); if (!userDetailResponse.getUser().isEmpty() && foundOwner == null) { @@ -120,7 +163,7 @@ private User foundOwnerDetails(UserDetailResponse userDetailResponse, User found return owner; } - private void validateVendorExists(List user) { + public void validateVendorExists(List user) { List ownerIds = user.stream().map(User::getUuid).collect(Collectors.toList()); int count = vendorRepository.getExistingVenodrsCount(ownerIds); @@ -220,8 +263,13 @@ private User createVendorOwner(User owner, RequestInfo requestInfo) { if (owner.getRoles() != null) { owner.getRoles().add(getRolObj(config.getDsoRole(), config.getDsoRoleName())); + owner.getRoles().add(getRolObj(config.getCitizenRole(), config.getCitizenRoleName())); } else { - owner.setRoles(Arrays.asList(getRolObj(config.getDsoRole(), config.getDsoRoleName()))); + List roles = new ArrayList<>(); + roles.add(getRolObj(config.getDsoRole(), config.getDsoRoleName())); + roles.add(getRolObj(config.getCitizenRole(), config.getCitizenRoleName())); + owner.setRoles(roles); + } addUserDefaultFields(owner.getTenantId(), null, owner); @@ -293,7 +341,7 @@ else if (uri.toString().contains(config.getUserCreateEndpoint())) /** * create Employee in HRMS for Vendor owner * - * @param owner + * @param driver * @param requestInfo * @return */ diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/service/VendorService.java b/municipal-services/vendor/src/main/java/org/egov/vendor/service/VendorService.java index 5ba80d351eb..1f8c80e483a 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/service/VendorService.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/service/VendorService.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import javax.validation.Valid; @@ -14,6 +15,7 @@ import org.egov.vendor.driver.web.model.Driver; import org.egov.vendor.repository.VendorRepository; import org.egov.vendor.util.VendorConstants; +import org.egov.vendor.util.VendorErrorConstants; import org.egov.vendor.util.VendorUtil; import org.egov.vendor.validator.VendorValidator; import org.egov.vendor.web.model.Vendor; @@ -66,7 +68,7 @@ public Vendor create(VendorRequest vendorRequest) { throw new CustomException("Invalid TenantId", " Application cannot be create at StateLevel"); } Object mdmsData = util.mDMSCall(requestInfo, tenantId); - vendorValidator.validateCreateOrUpdateRequest(vendorRequest, mdmsData, true); + vendorValidator.validateCreateOrUpdateRequest(vendorRequest, mdmsData, true, requestInfo); enrichmentService.enrichCreate(vendorRequest); vendorRepository.save(vendorRequest); return vendorRequest.getVendor(); @@ -127,7 +129,7 @@ public Vendor update(VendorRequest vendorRequest) { } Object mdmsData = util.mDMSCall(requestInfo, tenantId); - vendorValidator.validateCreateOrUpdateRequest(vendorRequest, mdmsData, false); + vendorValidator.validateCreateOrUpdateRequest(vendorRequest, mdmsData, false, requestInfo); enrichmentService.enrichUpdate(vendorRequest); updateVendor(vendorRequest, tenantId); diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/util/VendorConstants.java b/municipal-services/vendor/src/main/java/org/egov/vendor/util/VendorConstants.java index 0e5c43951bb..127979da0bf 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/util/VendorConstants.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/util/VendorConstants.java @@ -57,5 +57,6 @@ private VendorConstants() { public static final String ILLEGAL_ARGUMENT_EXCEPTION = "IllegalArgumentException"; public static final String TENANT_ID_MANDATORY = "TenantId is mandatory in search"; public static final String DISABLED = "DISABLED"; + public static final String FSM_DRIVER = "FSM_DRIVER"; } diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/util/VendorErrorConstants.java b/municipal-services/vendor/src/main/java/org/egov/vendor/util/VendorErrorConstants.java index 690a3be84a1..b3afd671a76 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/util/VendorErrorConstants.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/util/VendorErrorConstants.java @@ -20,4 +20,5 @@ private VendorErrorConstants() { public static final String INVALID_TENANT_ID_MDMS_KEY = "INVALID_TENANT_ID_MDMS_KEY"; public static final String INVALID_TENANT_ID_MDMS_MSG = "INVALID_TENANT_ID_MDMS_MSG"; public static final String INVALID_OWNER_ERROR_MESSAGE = "Dob, relationShip, relation ship name and gender are mandaotry !"; + public static final String MOBILE_NUMBER_ALREADY_EXIST = "MOBILE_NUMBER_ALREADY_EXIST"; } diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/validator/VendorValidator.java b/municipal-services/vendor/src/main/java/org/egov/vendor/validator/VendorValidator.java index 5c8cc1c875b..96b37451297 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/validator/VendorValidator.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/validator/VendorValidator.java @@ -114,8 +114,10 @@ private void searchOnIdVehicleRegId(VendorSearchCriteria criteria, List /** * * @param vendorRequest + * @param requestInfo */ - public void validateCreateOrUpdateRequest(VendorRequest vendorRequest, Object mdmsData, boolean isCreate) { + public void validateCreateOrUpdateRequest(VendorRequest vendorRequest, Object mdmsData, boolean isCreate, + RequestInfo requestInfo) { mdmsValidator.validateMdmsData(mdmsData); mdmsValidator.validateAgencyType(vendorRequest); @@ -123,7 +125,9 @@ public void validateCreateOrUpdateRequest(VendorRequest vendorRequest, Object md boundaryService.getAreaType(vendorRequest, config.getHierarchyTypeCode()); vehicleService.manageVehicle(vendorRequest); - + if (!isCreate) { + userService.vendorMobileExistanceCheck(vendorRequest, requestInfo); + } if (isCreate) { ownerService.manageOwner(vendorRequest); } else { diff --git a/municipal-services/vendor/src/main/java/org/egov/vendor/web/model/user/User.java b/municipal-services/vendor/src/main/java/org/egov/vendor/web/model/user/User.java index 987416dd6b7..7bcb70c1276 100644 --- a/municipal-services/vendor/src/main/java/org/egov/vendor/web/model/user/User.java +++ b/municipal-services/vendor/src/main/java/org/egov/vendor/web/model/user/User.java @@ -62,9 +62,9 @@ public class User { @JsonProperty("gender") private String gender; - @NotNull + // @NotNull @SafeHtml - @Pattern(regexp = "^[0-9]{10}$", message = "MobileNumber should be 10 digit number") + // @Pattern(regexp = "^[0-9]{10}$", message = "MobileNumber should be 10 digit number") @JsonProperty("mobileNumber") private String mobileNumber; diff --git a/municipal-services/vendor/src/main/resources/application.properties b/municipal-services/vendor/src/main/resources/application.properties index fbc1dcbdd31..d7c8fd7837e 100644 --- a/municipal-services/vendor/src/main/resources/application.properties +++ b/municipal-services/vendor/src/main/resources/application.properties @@ -10,13 +10,13 @@ spring.datasource.driver-class-name=org.postgresql.Driver spring.datasource.url=jdbc:postgresql://localhost:5432/fsm_dev spring.datasource.username=postgres -spring.datasource.password=postgres +spring.datasource.password=usertest spring.datasource.platform=postgresql ##----------------------------- FLYWAY CONFIGURATIONS -----------------------------# spring.flyway.url=jdbc:postgresql://localhost:5432/fsm_dev spring.flyway.user=postgres -spring.flyway.password=postgres +spring.flyway.password=usertest spring.flyway.table=public_vendor spring.flyway.baseline-on-migrate=true spring.flyway.outOfOrder=true @@ -110,4 +110,7 @@ logging.level.org.hibernate= ERROR dso.role=FSM_DSO dso.driver=FSM_DRIVER dso.role.name=DSO -dso.driver.role.name=DSO Driver role \ No newline at end of file +dso.driver.role.name=DSO Driver role +citizen.role=CITIZEN +citizen.role.name=Citizen +vendor.driver.mobile.number=seq_driver_mobile_number diff --git a/municipal-services/vendor/src/main/resources/db/migration/main/V20230404230257__driverMobileSeqIncrement.sql b/municipal-services/vendor/src/main/resources/db/migration/main/V20230404230257__driverMobileSeqIncrement.sql new file mode 100644 index 00000000000..874a5010413 --- /dev/null +++ b/municipal-services/vendor/src/main/resources/db/migration/main/V20230404230257__driverMobileSeqIncrement.sql @@ -0,0 +1 @@ +CREATE SEQUENCE IF NOT EXISTS seq_driver_mobile_number START WITH 1111111111 INCREMENT 1 ; \ No newline at end of file diff --git a/municipal-services/vendor/src/main/resources/db/migration/main/V20230412114645__updateVendorRole.sql b/municipal-services/vendor/src/main/resources/db/migration/main/V20230412114645__updateVendorRole.sql new file mode 100644 index 00000000000..5c00dc22f9a --- /dev/null +++ b/municipal-services/vendor/src/main/resources/db/migration/main/V20230412114645__updateVendorRole.sql @@ -0,0 +1,3 @@ +insert into eg_userrole_v1 (role_code,role_tenantid,user_id,user_tenantid,lastmodifieddate) +select 'CITIZEN', role_tenantid, user_id, user_tenantid, current_timestamp from eg_userrole_v1 +where role_code='FSM_DSO' and user_id not in (select user_id from eg_userrole_v1 where role_code = 'CITIZEN'); diff --git a/municipal-services/ws-calculator/CHANGELOG.MD b/municipal-services/ws-calculator/CHANGELOG.MD index 78cf4c35bac..8a9c1a0cac7 100644 --- a/municipal-services/ws-calculator/CHANGELOG.MD +++ b/municipal-services/ws-calculator/CHANGELOG.MD @@ -1,6 +1,10 @@ # Change log All notable changes to this module will be documented in this file. +## 1.4.4 - 2023-08-10 + +- Central Instance Library Integration +- ## 1.4.3 - 2023-02-01 - Transition from 1.4.3-beta version to 1.4.3 version diff --git a/municipal-services/ws-calculator/pom.xml b/municipal-services/ws-calculator/pom.xml index d7025898db3..e123cea825f 100644 --- a/municipal-services/ws-calculator/pom.xml +++ b/municipal-services/ws-calculator/pom.xml @@ -5,7 +5,7 @@ org.egov ws-calculator - 1.4.3-SNAPSHOT + 1.4.4-SNAPSHOT ws-calculation Demo project for Spring Boot @@ -63,7 +63,7 @@ org.egov.services services-common - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT org.projectlombok @@ -114,7 +114,7 @@ org.egov.services tracer - 2.0.0-SNAPSHOT + 2.1.0-SNAPSHOT org.springframework.boot diff --git a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/config/WSCalculationConfiguration.java b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/config/WSCalculationConfiguration.java index b5410521448..6681736a6fa 100644 --- a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/config/WSCalculationConfiguration.java +++ b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/config/WSCalculationConfiguration.java @@ -1,15 +1,10 @@ package org.egov.wscalculation.config; -import java.math.BigDecimal; - +import lombok.*; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; +import java.math.BigDecimal; @Getter @Setter @@ -20,83 +15,64 @@ @Component public class WSCalculationConfiguration { - @Value("${egov.ws.search.meterReading.pagination.default.limit}") - private Integer meterReadingDefaultLimit; + @Value("${egov.ws.search.meterReading.pagination.default.limit}") + private Integer meterReadingDefaultLimit; - @Value("${egov.ws_calculation.meterReading.default.offset}") - private Integer meterReadingDefaultOffset; + @Value("${egov.ws_calculation.meterReading.default.offset}") + private Integer meterReadingDefaultOffset; - /* - * Calculator Configs - */ + /* + * Calculator Configs + */ - // billing service - @Value("${egov.billingservice.host}") - private String billingServiceHost; + // billing service + @Value("${egov.billingservice.host}") + private String billingServiceHost; - @Value("${egov.taxhead.search.endpoint}") - private String taxheadsSearchEndpoint; + @Value("${egov.taxhead.search.endpoint}") + private String taxheadsSearchEndpoint; - @Value("${egov.taxperiod.search.endpoint}") - private String taxPeriodSearchEndpoint; + @Value("${egov.taxperiod.search.endpoint}") + private String taxPeriodSearchEndpoint; - @Value("${egov.demand.create.endpoint}") - private String demandCreateEndPoint; + @Value("${egov.demand.create.endpoint}") + private String demandCreateEndPoint; - @Value("${egov.demand.update.endpoint}") - private String demandUpdateEndPoint; + @Value("${egov.demand.update.endpoint}") + private String demandUpdateEndPoint; - @Value("${egov.demand.search.endpoint}") - private String demandSearchEndPoint; - - @Value("${egov.bill.fetch.endpoint}") - private String fetchBillEndPoint; - - @Value("${egov.demand.billexpirytime}") - private Long demandBillExpiryTime; + @Value("${egov.demand.search.endpoint}") + private String demandSearchEndPoint; - @Value("${egov.bill.gen.endpoint}") - private String billGenEndPoint; + @Value("${egov.bill.fetch.endpoint}") + private String fetchBillEndPoint; - // MDMS - @Value("${egov.mdms.host}") - private String mdmsHost; + @Value("${egov.demand.billexpirytime}") + private Long demandBillExpiryTime; - @Value("${egov.mdms.search.endpoint}") - private String mdmsEndPoint; - - @Value("${egov.bill.gen.endpoint}") - private String billGenerateEndpoint; + @Value("${egov.bill.gen.endpoint}") + private String billGenEndPoint; - // water demand configs + @Value("${egov.mdms.host}") + private String mdmsHost; - @Value("${ws.module.code}") - private String wsModuleCode; + @Value("${egov.mdms.search.endpoint}") + private String mdmsEndPoint; - @Value("${ws.module.minpayable.amount}") - private Integer ptMinAmountPayable; + @Value("${mdms.v2.host}") + private String mdms2Host; - @Value("${ws.financialyear.start.month}") - private String financialYearStartMonth; - - - @Value("${egov.demand.businessservice}") - private String businessService; - - @Value("${egov.demand.minimum.payable.amount}") - private BigDecimal minimumPayableAmount; - - //water Registry - @Value("${egov.ws.host}") - private String waterConnectionHost; - - @Value("${egov.wc.search.endpoint}") - private String waterConnectionSearchEndPoint; - - //Demand Topic - @Value("${ws.calculator.demand.successful.topic}") - private String onDemandsSaved; + @Value("${mdms.v2.search.endpoint}") + private String mdms2EndPoint; + + @Value("${egov.bill.gen.endpoint}") + private String billGenerateEndpoint; + + // water demand configs + + @Value("${ws.module.code}") + private String wsModuleCode; @Value("${ws.calculator.demand.failed}") private String onDemandsFailure; @@ -118,82 +94,108 @@ public class WSCalculationConfiguration { //SMS @Value("${kafka.topics.notification.sms}") private String smsNotifTopic; + @Value("${ws.module.minpayable.amount}") + private Integer ptMinAmountPayable; - @Value("${notification.sms.enabled}") - private Boolean isSMSEnabled; - - @Value("${notification.sms.link}") - private String smsNotificationLink; - - @Value("${notification.email.enabled}") - private Boolean isEmailEnabled; - - //Email - @Value("${kafka.topics.notification.mail.name}") - private String emailNotifyTopic; - - //User Configuration - @Value("${egov.user.host}") - private String userHost; + @Value("${ws.financialyear.start.month}") + private String financialYearStartMonth; - @Value("${egov.user.context.path}") - private String userContextPath; + @Value("${egov.demand.businessservice}") + private String businessService; - @Value("${egov.user.search.path}") - private String userSearchEndpoint; - - //payment - @Value("${egov.usr.events.pay.triggers}") - private String billgenTopic; - - - //USER EVENTS - @Value("${egov.ui.app.host}") - private String uiAppHost; - - @Value("${egov.usr.events.create.topic}") - private String saveUserEventsTopic; - - @Value("${egov.usr.events.pay.link}") - private String payLink; - - @Value("${egov.usr.events.pay.code}") - private String payCode; - - @Value("${egov.user.event.notification.enabled}") - private Boolean isUserEventsNotificationEnabled; + @Value("${egov.demand.minimum.payable.amount}") + private BigDecimal minimumPayableAmount; - @Value("${kafka.topics.billgen.topic}") - private String payTriggers; - - @Value("${egov.watercalculatorservice.createdemand.topic}") - private String createDemand; - - @Value("${ws.demand.based.batch.size}") - private Integer batchSize; - - @Value("${persister.demand.based.dead.letter.topic.batch}") - private String deadLetterTopicBatch; + //water Registry + @Value("${egov.ws.host}") + private String waterConnectionHost; - @Value("${persister.demand.based.dead.letter.topic.single}") - private String deadLetterTopicSingle; - - - @Value("${notification.url}") - private String notificationUrl; + @Value("${egov.wc.search.endpoint}") + private String waterConnectionSearchEndPoint; - @Value("${egov.shortener.url}") - private String shortenerURL; - - @Value("${egov.property.service.host}") - private String propertyHost; + //Demand Topic + @Value("${ws.calculator.demand.successful.topic}") + private String onDemandsSaved; + + @Value("${notification.sms.enabled}") + private Boolean isSMSEnabled; + + @Value("${notification.sms.link}") + private String smsNotificationLink; + + @Value("${notification.email.enabled}") + private Boolean isEmailEnabled; + + //Email + @Value("${kafka.topics.notification.mail.name}") + private String emailNotifyTopic; + + //User Configuration + @Value("${egov.user.host}") + private String userHost; + + @Value("${egov.user.context.path}") + private String userContextPath; + + + @Value("${egov.user.search.path}") + private String userSearchEndpoint; + + //payment + @Value("${egov.usr.events.pay.triggers}") + private String billgenTopic; + + + //USER EVENTS + @Value("${egov.ui.app.host}") + private String uiAppHost; + + @Value("${egov.usr.events.create.topic}") + private String saveUserEventsTopic; + + @Value("${egov.usr.events.pay.link}") + private String payLink; + + @Value("${egov.usr.events.pay.code}") + private String payCode; + + @Value("${egov.user.event.notification.enabled}") + private Boolean isUserEventsNotificationEnabled; + + @Value("${kafka.topics.billgen.topic}") + private String payTriggers; + + @Value("${egov.watercalculatorservice.createdemand.topic}") + private String createDemand; + + @Value("${ws.demand.based.batch.size}") + private Integer batchSize; + + @Value("${persister.demand.based.dead.letter.topic.batch}") + private String deadLetterTopicBatch; + + @Value("${persister.demand.based.dead.letter.topic.single}") + private String deadLetterTopicSingle; + + + @Value("${notification.url}") + private String notificationUrl; + + @Value("${egov.shortener.url}") + private String shortenerURL; + + @Value("${egov.property.service.host}") + private String propertyHost; + + @Value("${egov.property.searchendpoint}") + private String searchPropertyEndPoint; - @Value("${egov.property.searchendpoint}") - private String searchPropertyEndPoint; + @Value("${workflow.workDir.path}") + private String workflowHost; - @Value("${workflow.workDir.path}") - private String workflowHost; + @Value("${state.level.tenant.id}") + private String stateLevelTenantId; @Value("${workflow.process.search.path}") private String searchWorkflowProcessEndPoint; diff --git a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/constants/WSCalculationConstant.java b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/constants/WSCalculationConstant.java index f26183551ce..eab0d98c360 100644 --- a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/constants/WSCalculationConstant.java +++ b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/constants/WSCalculationConstant.java @@ -358,5 +358,7 @@ public class WSCalculationConstant { public static final String MODIFY_WATER_CONNECTION = "MODIFY_WATER_CONNECTION"; public static final String DISCONNECT_WATER_CONNECTION = "DISCONNECT_WATER_CONNECTION"; + + public static final String TENANTID_MDC_STRING = "TENANTID"; } diff --git a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/consumer/BillingNotificationConsumer.java b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/consumer/BillingNotificationConsumer.java index 2437713fce7..76e70e9b6d5 100644 --- a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/consumer/BillingNotificationConsumer.java +++ b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/consumer/BillingNotificationConsumer.java @@ -2,8 +2,11 @@ import java.util.HashMap; +import org.egov.wscalculation.constants.WSCalculationConstant; import org.egov.wscalculation.service.PaymentNotificationService; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; import org.springframework.messaging.handler.annotation.Header; @@ -17,6 +20,9 @@ public class BillingNotificationConsumer { @Autowired PaymentNotificationService paymentService; + + @Value("${state.level.tenant.id}") + private String stateLevelTenantID; /** * @@ -25,6 +31,10 @@ public class BillingNotificationConsumer { */ @KafkaListener(topics = { "${kafka.topics.billgen.topic}" }) public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { + + // Adding in MDC so that tracer can add it in header + MDC.put(WSCalculationConstant.TENANTID_MDC_STRING, stateLevelTenantID); + log.info("Consuming record: " + record); paymentService.process(record, topic); } diff --git a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/consumer/DemandGenerationConsumer.java b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/consumer/DemandGenerationConsumer.java index bd8ce94bfd0..1df481dbac9 100644 --- a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/consumer/DemandGenerationConsumer.java +++ b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/consumer/DemandGenerationConsumer.java @@ -10,6 +10,8 @@ import org.egov.wscalculation.validator.WSCalculationWorkflowValidator; import org.egov.wscalculation.web.models.*; import org.egov.wscalculation.web.models.CalculationReq; +import org.slf4j.MDC; +import org.egov.wscalculation.constants.WSCalculationConstant; import org.egov.wscalculation.producer.WSCalculationProducer; import org.egov.wscalculation.service.BulkDemandAndBillGenService; import org.egov.wscalculation.service.MasterDataService; @@ -42,6 +44,9 @@ public class DemandGenerationConsumer { @Value("${kafka.topics.bulk.bill.generation.audit}") private String bulkBillGenAuditTopic; + + @Value("${state.level.tenant.id}") + private String stateLevelTenantID; /** @@ -57,6 +62,10 @@ public void processMessage(Map consumerRecord, @Header(KafkaHead log.info(" Bulk bill Consumerbatch records log for batch : " + calculationReq.getMigrationCount().getOffset() + "Count is : " + calculationReq.getMigrationCount().getLimit()); + + // Adding in MDC so that tracer can add it in header + MDC.put(WSCalculationConstant.TENANTID_MDC_STRING, stateLevelTenantID); + generateDemandInBatch(calculationReq); }catch (final Exception e){ log.error("KAFKA_PROCESS_ERROR", e); diff --git a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/consumer/DemandNotificationConsumer.java b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/consumer/DemandNotificationConsumer.java index e2f70d3e01a..785afff4fb9 100644 --- a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/consumer/DemandNotificationConsumer.java +++ b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/consumer/DemandNotificationConsumer.java @@ -5,7 +5,9 @@ import java.util.HashMap; import org.egov.wscalculation.config.WSCalculationConfiguration; +import org.egov.wscalculation.constants.WSCalculationConstant; import org.egov.wscalculation.web.models.DemandNotificationObj; +import org.slf4j.MDC; import org.egov.wscalculation.service.DemandNotificationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; @@ -43,6 +45,9 @@ public void listen(final HashMap request, @Header(KafkaHeaders.R tenantId = tenantId.split("\\.")[0]; notificationObj.setTenantId(tenantId); + // Adding in MDC so that tracer can add it in header + MDC.put(WSCalculationConstant.TENANTID_MDC_STRING, tenantId); + // notificationService.process(notificationObj, topic); } catch (final Exception e) { log.error("Error while listening to value: " + request + " on topic: " + topic + ": " + e); diff --git a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/WSCalculationServiceImpl.java b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/WSCalculationServiceImpl.java index 8f2288b0593..eaee8259aeb 100644 --- a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/WSCalculationServiceImpl.java +++ b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/WSCalculationServiceImpl.java @@ -110,6 +110,11 @@ public List getCalculation(CalculationReq request) { masterMap = masterDataService.loadMasterData(request.getRequestInfo(), request.getCalculationCriteria().get(0).getTenantId()); calculations = getCalculations(request, masterMap); + } else if (request.getIsconnectionCalculation()) { + connectionRequest = request.getIsconnectionCalculation(); + masterMap = masterDataService.loadMasterData(request.getRequestInfo(), + request.getCalculationCriteria().get(0).getTenantId()); + calculations = getCalculations(request, masterMap); } else if (request.getIsReconnectionRequest()) { connectionRequest = (!request.getIsReconnectionRequest()); @@ -275,7 +280,7 @@ public Calculation getCalculation(RequestInfo requestInfo, CalculationCriteria c .taxHeadEstimates(estimates).billingSlabIds(billingSlabIds).connectionNo(criteria.getConnectionNo()).applicationNO(criteria.getApplicationNo()) .build(); } - + /** * * @param request would be calculations request diff --git a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/validator/WSCalculationWorkflowValidator.java b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/validator/WSCalculationWorkflowValidator.java index e2348ac4188..c26f64848d9 100644 --- a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/validator/WSCalculationWorkflowValidator.java +++ b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/validator/WSCalculationWorkflowValidator.java @@ -3,6 +3,7 @@ import lombok.extern.slf4j.Slf4j; import org.egov.common.contract.request.RequestInfo; import org.egov.tracer.model.CustomException; +import org.egov.wscalculation.config.WSCalculationConfiguration; import org.egov.wscalculation.constants.MRConstants; import org.egov.wscalculation.constants.WSCalculationConstant; import org.egov.wscalculation.util.CalculatorUtil; @@ -16,10 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; -import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.*; @Component @@ -32,6 +30,9 @@ public class WSCalculationWorkflowValidator { @Autowired private MDMSValidator mdmsValidator; + @Autowired + private WSCalculationConfiguration config; + public Boolean applicationValidation(RequestInfo requestInfo,String tenantId,String connectionNo, Boolean genratedemand){ Map errorMap = new HashMap<>(); List waterConnectionList = util.getWaterConnection(requestInfo,connectionNo,tenantId); @@ -142,7 +143,7 @@ public Boolean propertyWorkflowValidation(RequestInfo requestInfo, String tenant return isApplicationApproved; } public JSONObject getWnsPTworkflowConfig(RequestInfo requestInfo, String tenantId){ - tenantId = tenantId.split("\\.")[0]; + tenantId = config.getStateLevelTenantId(); List propertyModuleMasters = new ArrayList<>(Arrays.asList("PTWorkflow")); Map> codes = mdmsValidator.getAttributeValues(tenantId,MRConstants.PROPERTY_MASTER_MODULE, propertyModuleMasters, "$.*", MRConstants.PROPERTY_JSONPATH_ROOT,requestInfo); diff --git a/municipal-services/ws-calculator/src/main/resources/application.properties b/municipal-services/ws-calculator/src/main/resources/application.properties index 244acd8c8b6..44435af0a6b 100644 --- a/municipal-services/ws-calculator/src/main/resources/application.properties +++ b/municipal-services/ws-calculator/src/main/resources/application.properties @@ -13,6 +13,8 @@ egov.meterservice.createmeterconnection=save-ws-meter #mdms urls egov.mdms.host=http://localhost:8088/ egov.mdms.search.endpoint=egov-mdms-service/v1/_search +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search # KAFKA SERVER CONFIGURATIONS kafka.config.bootstrap_server_config=localhost:9092 @@ -127,3 +129,8 @@ bulk.demand.batch.value=1000 bulk.demand.offset.value=0 egov.internal.microservice.user.uuid=b5b2ac70-d347-4339-98f0-5349ce25f99f + +spring.kafka.listener.missing-topics-fatal=false + +#Central Instance +state.level.tenant.id=pb diff --git a/municipal-services/ws-services/CHANGELOG.MD b/municipal-services/ws-services/CHANGELOG.MD index 146c95b576e..21c8eb35633 100644 --- a/municipal-services/ws-services/CHANGELOG.MD +++ b/municipal-services/ws-services/CHANGELOG.MD @@ -1,6 +1,10 @@ # Change log All notable changes to this module will be documented in this file. +## 1.7.5 - 2023-08-10 + +- Central Instance Library Integration + ## 1.7.4 - 2023-01-31 - Improved encryptOldData api with resume functionality diff --git a/municipal-services/ws-services/pom.xml b/municipal-services/ws-services/pom.xml index 1aa8fce201a..e8f5bec0f50 100644 --- a/municipal-services/ws-services/pom.xml +++ b/municipal-services/ws-services/pom.xml @@ -5,7 +5,7 @@ ws-services jar water-services - 1.7.4-SNAPSHOT + 1.7.5-SNAPSHOT 2.17.1 1.8 @@ -65,11 +65,13 @@ javers-core 3.1.0 + org.egov.services tracer - 2.1.2-SNAPSHOT + 2.1.1-SNAPSHOT + org.egov.services services-common @@ -110,12 +112,11 @@ org.postgresql postgresql - 42.2.2.jre7 org.egov mdms-client - 0.0.2-SNAPSHOT + 0.0.4-SNAPSHOT compile @@ -129,21 +130,16 @@ + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + repo.egovernments.org eGov ERP Releases Repository https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ - - repo.egovernments.org.snapshots - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ - - - repo.egovernments.org.public - eGov Public Repository Group - https://nexus-repo.egovernments.org/nexus/content/groups/public/ - src/main/java diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/WaterConnectionApplication.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/WaterConnectionApplication.java index 9c4ea6ece93..269368b73b8 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/WaterConnectionApplication.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/WaterConnectionApplication.java @@ -2,7 +2,9 @@ import java.util.TimeZone; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.encryption.config.EncryptionConfiguration; + import org.egov.tracer.config.TracerConfiguration; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; @@ -15,9 +17,9 @@ import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; -@SpringBootApplication(scanBasePackages = "org.egov.waterconnection") +@SpringBootApplication(scanBasePackages = "org.egov") @EnableAutoConfiguration -@Import({ TracerConfiguration.class, EncryptionConfiguration.class }) +@Import({ TracerConfiguration.class, MultiStateInstanceUtil.class, EncryptionConfiguration.class }) public class WaterConnectionApplication{ @Value("${app.timezone}") private String timeZone; diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/config/WSConfiguration.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/config/WSConfiguration.java index 573202ca7cc..19515d63e88 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/config/WSConfiguration.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/config/WSConfiguration.java @@ -9,6 +9,8 @@ import lombok.NoArgsConstructor; import lombok.Setter; +import java.util.Map; + @Getter @Setter @AllArgsConstructor @@ -141,6 +143,9 @@ public class WSConfiguration { @Value("${ws.meterreading.create.topic}") private String createMeterReading; + @Value("${ws.meterreading.create.topic.pattern}") + private String createMeterReadingPattern; + @Value("${ws.meterreading.create.endpoint}") private String createMeterReadingEndpoint; @@ -209,45 +214,35 @@ public class WSConfiguration { @Value("${egov.collection.host}") private String collectionHost; - - @Value("${reconnection.ws.workflow.name}") - private String wsWorkflowReconnectionName; @Value("${state.level.tenant.id}") private String stateLevelTenantId; //mdms - @Value("${egov.mdms.host}") +// @Value("${egov.mdms.host}") +// private String mdmsHost; +// +// @Value("${egov.mdms.search.endpoint}") +// private String mdmsUrl; + + @Value("${mdms.v2.host}") private String mdmsHost; - @Value("${egov.mdms.search.endpoint}") + @Value("${mdms.v2.search.endpoint}") private String mdmsUrl; @Value("${egov.disconnect.businessservice}") private String disconnectBusinessServiceName; - @Value("${egov.reconnect.businessservice}") - private String reconnectBusinessServiceName; - @Value("${egov.idgen.wdcid.name}") private String waterDisconnectionIdGenName; @Value("${egov.idgen.wdcid.format}") private String waterDisconnectionIdGenFormat; - + @Value("${egov.receipt.disconnection.businessservice.topic}") private String receiptDisconnectionBusinessservice; - @Value("${egov.receipt.reconnection.businessservice.topic}") - private String receiptReconnectionBusinessservice; - - /* - * @Value("${egov.idgen.wrcid.name}") private String waterReconnectionIdGenName; - * - * @Value("${egov.idgen.wrcid.format}") private String - * waterResconnectionIdGenFormat; - */ - @Value("${egov.water.connection.document.access.audit.kafka.topic}") private String documentAuditTopic; @@ -257,4 +252,11 @@ public class WSConfiguration { @Value("${egov.fetch.bill.endpoint}") private String fetchBillEndPoint; + // central-instance configs + @Value("#{${egov.ui.app.host.map}}") + private Map uiAppHostMap; + + @Value("${egov.url.shortner.host}") + private String urlShortnerHost; + } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/constants/WCConstants.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/constants/WCConstants.java index b75507baefa..a1a130bdf89 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/constants/WCConstants.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/constants/WCConstants.java @@ -139,7 +139,7 @@ private WCConstants() { public static final List NOTIFICATION_ENABLE_FOR_STATUS = Collections - .unmodifiableList(Arrays.asList(INITIATE_INITIATED, REJECT_REJECTED, + .unmodifiableList(Arrays.asList( REJECT_REJECTED, SEND_BACK_TO_CITIZEN_PENDING_FOR_CITIZEN_ACTION, SEND_BACK_FOR_DO_PENDING_FOR_DOCUMENT_VERIFICATION, SEND_BACK_PENDING_FOR_FIELD_INSPECTION, VERIFY_AND_FORWORD_PENDING_FOR_FIELD_INSPECTION, VERIFY_AND_FORWARD_PENDING_APPROVAL_FOR_CONNECTION, APPROVE_FOR_CONNECTION_PENDING_FOR_PAYMENT, @@ -377,4 +377,10 @@ private WCConstants() { public static final String TENANTS_JSONPATH_ROOT = "$.MdmsRes.tenant.tenants"; + public static String SCHEMA_REPLACE_STRING = "{schema}"; + + public static final String TENANTID_MDC_STRING = "TENANTID"; + + public static final List TOPICS_TO_AVOID = Collections.unmodifiableList(Arrays.asList("create-meter-reading","editnotification", "ws-filestoreids-process")); + } \ No newline at end of file diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/EditWorkFlowNotificationConsumer.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/EditWorkFlowNotificationConsumer.java index 83e1b6fefd7..18197fc5586 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/EditWorkFlowNotificationConsumer.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/EditWorkFlowNotificationConsumer.java @@ -20,7 +20,8 @@ import java.util.HashMap; import java.util.List; -import static org.egov.waterconnection.constants.WCConstants.*; +import org.slf4j.MDC; +import static org.egov.waterconnection.constants.WCConstants.TENANTID_MDC_STRING; @Slf4j @Service @@ -44,10 +45,15 @@ public class EditWorkFlowNotificationConsumer { * @param record Received Topic Record * @param topic Name of the Topic */ - @KafkaListener(topics = { "${ws.editnotification.topic}"}) + @KafkaListener(topicPattern = "${ws.kafka.edit.notification.topic.pattern}") public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try { WaterConnectionRequest waterConnectionRequest = mapper.convertValue(record, WaterConnectionRequest.class); + String tenantId = waterConnectionRequest.getWaterConnection().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + WaterConnection waterConnection = waterConnectionRequest.getWaterConnection(); SearchCriteria criteria = SearchCriteria.builder().applicationNumber(Collections.singleton(waterConnection.getApplicationNo())) .tenantId(waterConnectionRequest.getWaterConnection().getTenantId()).isInternalCall(Boolean.TRUE).build(); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/FileStoreIdsConsumer.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/FileStoreIdsConsumer.java index afcaf81ca57..8bdfab614c5 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/FileStoreIdsConsumer.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/FileStoreIdsConsumer.java @@ -2,6 +2,7 @@ import java.util.HashMap; +import org.egov.waterconnection.constants.WCConstants; import org.egov.waterconnection.web.models.WaterConnectionRequest; import org.egov.waterconnection.service.PdfFileStoreService; import org.springframework.beans.factory.annotation.Autowired; @@ -13,6 +14,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; +import org.slf4j.MDC; +import static org.egov.waterconnection.constants.WCConstants.TENANTID_MDC_STRING; + @Service @Slf4j @@ -30,10 +34,15 @@ public class FileStoreIdsConsumer { * @param record Received Topic Record in HashMap format * @param topic Name of the Topic */ - @KafkaListener(topics = { "${ws.consume.filestoreids.topic}" }) + @KafkaListener(topicPattern = "${ws.kafka.filestore.topic.pattern}") public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try { WaterConnectionRequest waterConnectionRequest = mapper.convertValue(record, WaterConnectionRequest.class); + String tenantId = waterConnectionRequest.getWaterConnection().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + pdfService.process(waterConnectionRequest, topic); } catch (Exception ex) { StringBuilder builder = new StringBuilder("Error while listening to value: ").append(record) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/MeterReadingConsumer.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/MeterReadingConsumer.java index 8740fe803a5..37fd6180117 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/MeterReadingConsumer.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/MeterReadingConsumer.java @@ -5,6 +5,7 @@ import org.egov.waterconnection.constants.WCConstants; import org.egov.waterconnection.web.models.WaterConnectionRequest; import org.egov.waterconnection.service.MeterReadingService; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.support.KafkaHeaders; @@ -16,6 +17,8 @@ import lombok.extern.slf4j.Slf4j; +import static org.egov.waterconnection.constants.WCConstants.TENANTID_MDC_STRING; + @Service @Slf4j public class MeterReadingConsumer { @@ -32,11 +35,16 @@ public class MeterReadingConsumer { * @param record * @param topic */ - @KafkaListener(topics = { "${ws.meterreading.create.topic}" }) + @KafkaListener(topicPattern = "${ws.meterreading.create.topic.pattern}") public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { try { log.info("Received request to add Meter Reading on topic - " + topic); WaterConnectionRequest waterConnectionRequest = mapper.convertValue(record, WaterConnectionRequest.class); + String tenantId = waterConnectionRequest.getWaterConnection().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + if (!StringUtils.isEmpty(waterConnectionRequest.getWaterConnection().getConnectionType()) && WCConstants.METERED_CONNECTION .equalsIgnoreCase(waterConnectionRequest.getWaterConnection().getConnectionType())) { diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/ReceiptConsumer.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/ReceiptConsumer.java index 32f511f409a..d3636902dc9 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/ReceiptConsumer.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/ReceiptConsumer.java @@ -1,9 +1,13 @@ package org.egov.waterconnection.consumer; +import static org.egov.waterconnection.constants.WCConstants.TENANTID_MDC_STRING; + import java.util.HashMap; import org.egov.waterconnection.service.PaymentUpdateService; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.stereotype.Component; @@ -12,8 +16,15 @@ public class ReceiptConsumer { @Autowired private PaymentUpdateService paymentUpdateService; - @KafkaListener(topics = {"${kafka.topics.receipt.create}"}) - public void listenPayments(final HashMap record) { - paymentUpdateService.process(record); - } + @Value("${state.level.tenant.id}") + private String stateLevelTenantID; + + @KafkaListener(topicPattern = "${kafka.topics.receipt.topic.pattern}") + public void listenPayments(final HashMap record) { + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, stateLevelTenantID); + + paymentUpdateService.process(record); + } } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/WorkflowNotificationConsumer.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/WorkflowNotificationConsumer.java index c6324e4b832..d8f9fc23123 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/WorkflowNotificationConsumer.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/consumer/WorkflowNotificationConsumer.java @@ -1,5 +1,6 @@ package org.egov.waterconnection.consumer; +import org.egov.waterconnection.service.MeterReadingService; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.egov.common.contract.request.Role; @@ -7,9 +8,9 @@ import org.egov.waterconnection.service.WaterService; import org.egov.waterconnection.service.WaterServiceImpl; import org.egov.waterconnection.service.WorkflowNotificationService; +import org.slf4j.MDC; import org.egov.waterconnection.util.EncryptionDecryptionUtil; import org.egov.waterconnection.web.models.OwnerInfo; -import org.egov.waterconnection.web.models.SearchCriteria; import org.egov.waterconnection.web.models.WaterConnection; import org.egov.waterconnection.web.models.WaterConnectionRequest; import org.springframework.beans.factory.annotation.Autowired; @@ -31,6 +32,9 @@ public class WorkflowNotificationConsumer { @Autowired WorkflowNotificationService workflowNotificationService; + @Autowired + private MeterReadingService meterReadingService; + @Autowired WaterService waterService; @@ -49,11 +53,16 @@ public class WorkflowNotificationConsumer { * @param record * @param topic */ - @KafkaListener(topics = { "${egov.waterservice.createwaterconnection.topic}" ,"${egov.waterservice.updatewaterconnection.topic}", "${egov.waterservice.updatewaterconnection.workflow.topic}"}) + @KafkaListener(topicPattern = "${ws.kafka.consumer.topic.pattern}") public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { log.info("Record received in update Water connectuion is"+ record); try { WaterConnectionRequest waterConnectionRequest = mapper.convertValue(record, WaterConnectionRequest.class); + String tenantId = waterConnectionRequest.getWaterConnection().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + WaterConnection waterConnection = waterConnectionRequest.getWaterConnection(); String applicationStatus = waterConnection.getApplicationStatus(); if (!WCConstants.NOTIFICATION_ENABLE_FOR_STATUS.contains(waterConnection.getProcessInstance().getAction() + "_" + applicationStatus)) { @@ -73,7 +82,6 @@ public void listen(final HashMap record, @Header(KafkaHeaders.RE waterConnectionRequest.setWaterConnection(encryptionDecryptionUtil.decryptObject(waterConnection, WNS_PLUMBER_PLAIN_DECRYPTION_MODEL, WaterConnection.class, waterConnectionRequest.getRequestInfo())); } - log.info("waterConnectionRequest is "+ waterConnectionRequest); if (!waterConnectionRequest.isOldDataEncryptionRequest()) workflowNotificationService.process(waterConnectionRequest, topic); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/producer/WaterConnectionProducer.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/producer/WaterConnectionProducer.java index ab26574768b..718510c6ccd 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/producer/WaterConnectionProducer.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/producer/WaterConnectionProducer.java @@ -1,16 +1,31 @@ package org.egov.waterconnection.producer; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.kafka.CustomKafkaTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import lombok.extern.slf4j.Slf4j; + +import static org.egov.waterconnection.constants.WCConstants.TOPICS_TO_AVOID; @Service +@Slf4j public class WaterConnectionProducer { @Autowired private CustomKafkaTemplate kafkaTemplate; - public void push(String topic, Object value) { + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + /*public void push(String topic, Object value) { kafkaTemplate.send(topic, value); + }*/ + + public void push(String tenantId, String topic, Object value) { + + String updatedTopic = centralInstanceUtil.getStateSpecificTopicName(tenantId, topic); + log.info("The Kafka topic for the tenantId : " + tenantId + " is : " + updatedTopic); + kafkaTemplate.send(updatedTopic, value); } } \ No newline at end of file diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java index 2a311ed17a0..ba663bc6bc8 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java @@ -10,6 +10,9 @@ import org.egov.common.contract.request.RequestInfo; import org.egov.common.contract.request.Role; import org.egov.common.contract.request.User; +import org.egov.common.exception.InvalidTenantIdException; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.tracer.model.CustomException; import org.egov.waterconnection.config.WSConfiguration; import org.egov.waterconnection.constants.WCConstants; import org.egov.waterconnection.repository.rowmapper.EncryptionCountRowMapper; @@ -30,23 +33,23 @@ @Repository public class WaterDaoImpl implements WaterDao { - @Autowired - private WaterConnectionProducer waterConnectionProducer; + @Autowired + private WaterConnectionProducer waterConnectionProducer; - @Autowired - private JdbcTemplate jdbcTemplate; + @Autowired + private JdbcTemplate jdbcTemplate; - @Autowired - private WsQueryBuilder wsQueryBuilder; + @Autowired + private WsQueryBuilder wsQueryBuilder; - @Autowired - private WaterRowMapper waterRowMapper; + @Autowired + private WaterRowMapper waterRowMapper; - @Autowired - private OpenWaterRowMapper openWaterRowMapper; - - @Autowired - private WSConfiguration wsConfiguration; + @Autowired + private OpenWaterRowMapper openWaterRowMapper; + + @Autowired + private WSConfiguration wsConfiguration; @Autowired private EncryptionCountRowMapper encryptionCountRowMapper; @@ -63,199 +66,240 @@ public class WaterDaoImpl implements WaterDao { @Value("${egov.waterservice.update.oldData.topic}") private String updateOldDataEncTopic; - @Override - public void saveWaterConnection(WaterConnectionRequest waterConnectionRequest) { - waterConnectionProducer.push(createWaterConnection, waterConnectionRequest); - } + @Autowired + private MultiStateInstanceUtil centralInstanceutil; @Override - public List getWaterConnectionList(SearchCriteria criteria, - RequestInfo requestInfo) { - - List waterConnectionList = new ArrayList<>(); - List preparedStatement = new ArrayList<>(); - String query = wsQueryBuilder.getSearchQueryString(criteria, preparedStatement, requestInfo); - - log.info("Search Query" + query); - log.info("Parameters for search Query:: " + preparedStatement.toString()); - if (query == null) - return Collections.emptyList(); - Boolean isOpenSearch = isSearchOpen(requestInfo.getUserInfo()); - - if(isOpenSearch) - waterConnectionList = jdbcTemplate.query(query, preparedStatement.toArray(), - openWaterRowMapper); - else - waterConnectionList = jdbcTemplate.query(query, preparedStatement.toArray(), - waterRowMapper); - if (waterConnectionList == null) - return Collections.emptyList(); - return waterConnectionList; - } - - public Integer getWaterConnectionsCount(SearchCriteria criteria, RequestInfo requestInfo) { - List preparedStatement = new ArrayList<>(); - String query = wsQueryBuilder.getSearchCountQueryString(criteria, preparedStatement, requestInfo); - - if (query == null) - return 0; - - Integer count = jdbcTemplate.queryForObject(query, preparedStatement.toArray(), Integer.class); - return count; - } - - @Override - public void updateWaterConnection(WaterConnectionRequest waterConnectionRequest, boolean isStateUpdatable) { - String reqAction = waterConnectionRequest.getWaterConnection().getProcessInstance().getAction(); - if (isStateUpdatable) { - if (WCConstants.EXECUTE_DISCONNECTION.equalsIgnoreCase(reqAction)) { - waterConnectionRequest.getWaterConnection().setStatus(Connection.StatusEnum.INACTIVE); - } - if ((waterConnectionRequest.isReconnectRequest() || waterConnectionRequest.getWaterConnection().getApplicationType().equalsIgnoreCase(WCConstants.WATER_RECONNECTION)) && WCConstants.ACTIVATE_CONNECTION_CONST.equalsIgnoreCase(reqAction)) { - waterConnectionRequest.getWaterConnection().setStatus(Connection.StatusEnum.ACTIVE); - } - waterConnectionProducer.push(updateWaterConnection, waterConnectionRequest); - } else { - waterConnectionProducer.push(wsConfiguration.getWorkFlowUpdateTopic(), waterConnectionRequest); - } - } - - /** - * push object to create meter reading - * - * @param waterConnectionRequest - */ - public void postForMeterReading(WaterConnectionRequest waterConnectionRequest) { - log.info("Posting request to kafka topic - " + wsConfiguration.getCreateMeterReading()); - waterConnectionProducer.push(wsConfiguration.getCreateMeterReading(), waterConnectionRequest); - } - - /** - * push object for edit notification - * - * @param waterConnectionRequest - */ - public void pushForEditNotification(WaterConnectionRequest waterConnectionRequest, boolean isStateUpdatable) { - if (isStateUpdatable && !WCConstants.EDIT_NOTIFICATION_STATE - .contains(waterConnectionRequest.getWaterConnection().getProcessInstance().getAction())) { - waterConnectionProducer.push(wsConfiguration.getEditNotificationTopic(), waterConnectionRequest); - } - } - - /** - * Enrich file store Id's - * - * @param waterConnectionRequest - */ - public void enrichFileStoreIds(WaterConnectionRequest waterConnectionRequest) { - waterConnectionProducer.push(wsConfiguration.getFileStoreIdsTopic(), waterConnectionRequest); - } - - /** - * Save file store Id's - * - * @param waterConnectionRequest - */ - public void saveFileStoreIds(WaterConnectionRequest waterConnectionRequest) { - waterConnectionProducer.push(wsConfiguration.getSaveFileStoreIdsTopic(), waterConnectionRequest); - } - - public Boolean isSearchOpen(User userInfo) { - - return userInfo.getType().equalsIgnoreCase("SYSTEM") - && userInfo.getRoles().stream().map(Role::getCode).collect(Collectors.toSet()).contains("ANONYMOUS"); - } - - @Override - public WaterConnectionResponse getWaterConnectionListForPlainSearch(SearchCriteria criteria, RequestInfo requestInfo) { - - List waterConnectionList = new ArrayList<>(); - List preparedStatement = new ArrayList<>(); - - Set ids = new HashSet(); - List connectionIds = null; - if (criteria.getIds() != null && !criteria.getIds().isEmpty()) - ids = criteria.getIds(); - else - connectionIds = fetchWaterConIds(criteria); - - if(connectionIds!=null && connectionIds.size()>0) { + public void saveWaterConnection(WaterConnectionRequest waterConnectionRequest) { + waterConnectionProducer.push(waterConnectionRequest.getWaterConnection().getTenantId(), createWaterConnection, waterConnectionRequest); + } + + @Override + public List getWaterConnectionList(SearchCriteria criteria, + RequestInfo requestInfo) { + + List waterConnectionList = new ArrayList<>(); + List preparedStatement = new ArrayList<>(); + String query = wsQueryBuilder.getSearchQueryString(criteria, preparedStatement, requestInfo); + + if (query == null) + return Collections.emptyList(); + + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("WS_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + + Boolean isOpenSearch = isSearchOpen(requestInfo.getUserInfo()); + + if (isOpenSearch) + waterConnectionList = jdbcTemplate.query(query, preparedStatement.toArray(), + openWaterRowMapper); + else + waterConnectionList = jdbcTemplate.query(query, preparedStatement.toArray(), + waterRowMapper); + if (waterConnectionList == null) + return Collections.emptyList(); + return waterConnectionList; + } + + public Integer getWaterConnectionsCount(SearchCriteria criteria, RequestInfo requestInfo) { + List preparedStatement = new ArrayList<>(); + String query = wsQueryBuilder.getSearchCountQueryString(criteria, preparedStatement, requestInfo); + + if (query == null) + return 0; + + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("WS_SEARCH_COUNT_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + + Integer count = jdbcTemplate.queryForObject(query, preparedStatement.toArray(), Integer.class); + return count; + } + + @Override + public void updateWaterConnection(WaterConnectionRequest waterConnectionRequest, boolean isStateUpdatable) { + String reqAction = waterConnectionRequest.getWaterConnection().getProcessInstance().getAction(); + if (isStateUpdatable) { + if (WCConstants.EXECUTE_DISCONNECTION.equalsIgnoreCase(reqAction)) { + waterConnectionRequest.getWaterConnection().setStatus(Connection.StatusEnum.INACTIVE); + } + waterConnectionProducer.push(waterConnectionRequest.getWaterConnection().getTenantId(), updateWaterConnection, waterConnectionRequest); + } else { + waterConnectionProducer.push(waterConnectionRequest.getWaterConnection().getTenantId(), wsConfiguration.getWorkFlowUpdateTopic(), waterConnectionRequest); + } + } + + /** + * push object to create meter reading + * + * @param waterConnectionRequest + */ + public void postForMeterReading(WaterConnectionRequest waterConnectionRequest) { + log.info("Posting request to kafka topic - " + wsConfiguration.getCreateMeterReading()); + waterConnectionProducer.push(waterConnectionRequest.getWaterConnection().getTenantId(), wsConfiguration.getCreateMeterReading(), waterConnectionRequest); + } + + /** + * push object for edit notification + * + * @param waterConnectionRequest + */ + public void pushForEditNotification(WaterConnectionRequest waterConnectionRequest, boolean isStateUpdatable) { + if (isStateUpdatable && !WCConstants.EDIT_NOTIFICATION_STATE + .contains(waterConnectionRequest.getWaterConnection().getProcessInstance().getAction())) { + waterConnectionProducer.push(waterConnectionRequest.getWaterConnection().getTenantId(), wsConfiguration.getEditNotificationTopic(), waterConnectionRequest); + } + } + + /** + * Enrich file store Id's + * + * @param waterConnectionRequest + */ + public void enrichFileStoreIds(WaterConnectionRequest waterConnectionRequest) { + waterConnectionProducer.push(waterConnectionRequest.getWaterConnection().getTenantId(), wsConfiguration.getFileStoreIdsTopic(), waterConnectionRequest); + } + + /** + * Save file store Id's + * + * @param waterConnectionRequest + */ + public void saveFileStoreIds(WaterConnectionRequest waterConnectionRequest) { + waterConnectionProducer.push(waterConnectionRequest.getWaterConnection().getTenantId(), wsConfiguration.getSaveFileStoreIdsTopic(), waterConnectionRequest); + } + + public Boolean isSearchOpen(User userInfo) { + + return userInfo.getType().equalsIgnoreCase("SYSTEM") + && userInfo.getRoles().stream().map(Role::getCode).collect(Collectors.toSet()).contains("ANONYMOUS"); + } + + @Override + public WaterConnectionResponse getWaterConnectionListForPlainSearch(SearchCriteria criteria, RequestInfo requestInfo) { + + List waterConnectionList = new ArrayList<>(); + List preparedStatement = new ArrayList<>(); + + Set ids = new HashSet(); + List connectionIds = null; + if (criteria.getIds() != null && !criteria.getIds().isEmpty()) + ids = criteria.getIds(); + else + connectionIds = fetchWaterConIds(criteria); + + if (connectionIds != null && connectionIds.size() > 0) { // for (String id : connectionIds) { - ids.addAll(connectionIds); + ids.addAll(connectionIds); // } - } - if (ids.isEmpty()) - return new WaterConnectionResponse(); - - criteria.setIds(ids); - - String query = wsQueryBuilder.getSearchQueryStringForPlainSearch(criteria, preparedStatement, requestInfo); - - if (query == null) - return null; - - Boolean isOpenSearch = isSearchOpen(requestInfo.getUserInfo()); - WaterConnectionResponse connectionResponse = new WaterConnectionResponse(); - if (isOpenSearch) { - waterConnectionList = jdbcTemplate.query(query, preparedStatement.toArray(), openWaterRowMapper); - connectionResponse = WaterConnectionResponse.builder().waterConnection(waterConnectionList) - .totalCount(openWaterRowMapper.getFull_count()).build(); - } else { - waterConnectionList = jdbcTemplate.query(query, preparedStatement.toArray(), waterRowMapper); - connectionResponse = WaterConnectionResponse.builder().waterConnection(waterConnectionList) - .totalCount(waterRowMapper.getFull_count()).build(); - } - return connectionResponse; - } - - public List fetchWaterConIds(SearchCriteria criteria) { - List preparedStmtList = new ArrayList<>(); - preparedStmtList.add(criteria.getOffset()); - preparedStmtList.add(criteria.getLimit()); - - List ids = jdbcTemplate.query("SELECT id from eg_ws_connection ORDER BY createdtime offset " + - " ? " + - "limit ? ", - preparedStmtList.toArray(), - new SingleColumnRowMapper<>(String.class)); - return ids; - } - - /* Method to push the encrypted data to the 'update' topic */ - @Override - public void updateOldWaterConnections(WaterConnectionRequest waterConnectionRequest) { - waterConnectionProducer.push(updateOldDataEncTopic, waterConnectionRequest); - } - - /* Method to find the total count of applications present in dB */ - @Override - public Integer getTotalApplications(SearchCriteria criteria) { - List preparedStatement = new ArrayList<>(); - String query = wsQueryBuilder.getTotalApplicationsCountQueryString(criteria, preparedStatement); - if (query == null) - return 0; - Integer count = jdbcTemplate.queryForObject(query, preparedStatement.toArray(), Integer.class); - return count; - } - - /* Method to push the old data encryption status to the 'ws-enc-audit' topic */ - @Override - public void updateEncryptionStatus(EncryptionCount encryptionCount) { - waterConnectionProducer.push(encryptionStatusTopic, encryptionCount); - } - - /* Method to find the last execution details in dB */ - @Override - public EncryptionCount getLastExecutionDetail(SearchCriteria criteria) { - - List preparedStatement = new ArrayList<>(); - String query = wsQueryBuilder.getLastExecutionDetail(criteria, preparedStatement); - - log.info("\nQuery executed:" + query); - if (query == null) - return null; - EncryptionCount encryptionCount = jdbcTemplate.query(query, preparedStatement.toArray(), encryptionCountRowMapper); - return encryptionCount; - } + } + if (ids.isEmpty()) + return new WaterConnectionResponse(); + + criteria.setIds(ids); + + String query = wsQueryBuilder.getSearchQueryStringForPlainSearch(criteria, preparedStatement, requestInfo); + + if (query == null) + return null; + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("WS_PLAINSEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + + Boolean isOpenSearch = isSearchOpen(requestInfo.getUserInfo()); + WaterConnectionResponse connectionResponse = new WaterConnectionResponse(); + if (isOpenSearch) { + waterConnectionList = jdbcTemplate.query(query, preparedStatement.toArray(), openWaterRowMapper); + connectionResponse = WaterConnectionResponse.builder().waterConnection(waterConnectionList) + .totalCount(openWaterRowMapper.getFull_count()).build(); + } else { + waterConnectionList = jdbcTemplate.query(query, preparedStatement.toArray(), waterRowMapper); + connectionResponse = WaterConnectionResponse.builder().waterConnection(waterConnectionList) + .totalCount(waterRowMapper.getFull_count()).build(); + } + return connectionResponse; + } + + public List fetchWaterConIds(SearchCriteria criteria) { + List preparedStmtList = new ArrayList<>(); + preparedStmtList.add(criteria.getOffset()); + preparedStmtList.add(criteria.getLimit()); + + String query; + try { + query = centralInstanceutil.replaceSchemaPlaceholder("SELECT id from {schema}.eg_ws_connection ORDER BY createdtime offset " + + " ? " + + "limit ? ", criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("WS_WATERCONNECTION_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + List ids = jdbcTemplate.query(query, + preparedStmtList.toArray(), + new SingleColumnRowMapper<>(String.class)); + return ids; + } + + /* Method to push the encrypted data to the 'update' topic */ + @Override + public void updateOldWaterConnections(WaterConnectionRequest waterConnectionRequest) { + waterConnectionProducer.push(waterConnectionRequest.getWaterConnection().getTenantId(), updateWaterConnection, waterConnectionRequest); + } + + /* Method to find the total count of applications present in dB */ + @Override + public Integer getTotalApplications(SearchCriteria criteria) { + + List preparedStatement = new ArrayList<>(); + String query = wsQueryBuilder.getTotalApplicationsCountQueryString(criteria, preparedStatement); + if (query == null) + return 0; + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("WS_ENCRYPTION_TOTAL_APPLICATION_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + + Integer count = jdbcTemplate.queryForObject(query, preparedStatement.toArray(), Integer.class); + return count; + } + + /* Method to push the old data encryption status to the 'ws-enc-audit' topic */ + @Override + public void updateEncryptionStatus(EncryptionCount encryptionCount) { + waterConnectionProducer.push(encryptionCount.getTenantid(), encryptionStatusTopic, encryptionCount); + } + + /* Method to find the last execution details in dB */ + @Override + public EncryptionCount getLastExecutionDetail(SearchCriteria criteria) { + + List preparedStatement = new ArrayList<>(); + String query = wsQueryBuilder.getLastExecutionDetail(criteria, preparedStatement); + + try { + query = centralInstanceutil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + } catch (InvalidTenantIdException e) { + throw new CustomException("WS_ENCRYPTION_TOTAL_APPLICATION_SEARCH_TENANTID_ERROR", + "TenantId length is not sufficient to replace query schema in a multi state instance"); + } + + log.info("\nQuery executed:" + query); + if (query == null) + return null; + EncryptionCount encryptionCount = jdbcTemplate.query(query, preparedStatement.toArray(), encryptionCountRowMapper); + return encryptionCount; + } } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java index b2e82e93be9..5e3015c23e3 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java @@ -1,10 +1,13 @@ package org.egov.waterconnection.repository.builder; +import static org.egov.waterconnection.constants.WCConstants.SEARCH_TYPE_CONNECTION; + import java.util.HashSet; import java.util.List; import java.util.Set; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.waterconnection.config.WSConfiguration; import org.egov.waterconnection.service.UserService; import org.egov.waterconnection.util.WaterServicesUtil; @@ -15,8 +18,6 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import static org.egov.waterconnection.constants.WCConstants.SEARCH_TYPE_CONNECTION; - @Component public class WsQueryBuilder { @@ -29,6 +30,10 @@ public class WsQueryBuilder { @Autowired private UserService userService; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + private static final String INNER_JOIN_STRING = "INNER JOIN"; private static final String LEFT_OUTER_JOIN_STRING = " LEFT OUTER JOIN "; // private static final String Offset_Limit_String = "OFFSET ? LIMIT ?"; @@ -47,31 +52,31 @@ public class WsQueryBuilder { + " plumber.name as plumber_name, plumber.licenseno, roadcuttingInfo.id as roadcutting_id, roadcuttingInfo.roadtype as roadcutting_roadtype, roadcuttingInfo.roadcuttingarea as roadcutting_roadcuttingarea, roadcuttingInfo.roadcuttingarea as roadcutting_roadcuttingarea," + " roadcuttingInfo.active as roadcutting_active, plumber.mobilenumber as plumber_mobileNumber, plumber.gender as plumber_gender, plumber.fatherorhusbandname, plumber.correspondenceaddress," + " plumber.relationship, " + holderSelectValues - + " FROM eg_ws_connection conn " + + " FROM {schema}.eg_ws_connection conn " + INNER_JOIN_STRING - +" eg_ws_service wc ON wc.connection_id = conn.id" + + " {schema}.eg_ws_service wc ON wc.connection_id = conn.id" + LEFT_OUTER_JOIN_STRING - + "eg_ws_applicationdocument document ON document.wsid = conn.id" + + "{schema}.eg_ws_applicationdocument document ON document.wsid = conn.id" + LEFT_OUTER_JOIN_STRING - + "eg_ws_plumberinfo plumber ON plumber.wsid = conn.id" - + LEFT_OUTER_JOIN_STRING - + "eg_ws_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + + "{schema}.eg_ws_plumberinfo plumber ON plumber.wsid = conn.id" + + LEFT_OUTER_JOIN_STRING + + "{schema}.eg_ws_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + LEFT_OUTER_JOIN_STRING - + "eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id AND roadcuttingInfo.active != 'INACTIVE'"; + + "{schema}.eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id AND roadcuttingInfo.active != 'INACTIVE'" ; - private static final String SEARCH_COUNT_QUERY = " FROM eg_ws_connection conn " + private static final String SEARCH_COUNT_QUERY = " FROM {schema}.eg_ws_connection conn " + INNER_JOIN_STRING - +" eg_ws_service wc ON wc.connection_id = conn.id" + +" {schema}.eg_ws_service wc ON wc.connection_id = conn.id" + + LEFT_OUTER_JOIN_STRING + + "{schema}.eg_ws_applicationdocument document ON document.wsid = conn.id" + LEFT_OUTER_JOIN_STRING - + "eg_ws_applicationdocument document ON document.wsid = conn.id" + + "{schema}.eg_ws_plumberinfo plumber ON plumber.wsid = conn.id" + LEFT_OUTER_JOIN_STRING - + "eg_ws_plumberinfo plumber ON plumber.wsid = conn.id" - + LEFT_OUTER_JOIN_STRING - + "eg_ws_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + + "{schema}.eg_ws_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + LEFT_OUTER_JOIN_STRING - + "eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id"; + + "{schema}.eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id"; - private static final String TOTAL_APPLICATIONS_COUNT_QUERY = "select count(*) from eg_ws_connection where tenantid = ?;"; + private static final String TOTAL_APPLICATIONS_COUNT_QUERY = "select count(*) from {schema}.eg_ws_connection where tenantid = ?;"; private static final String PAGINATION_WRAPPER = "SELECT * FROM " + "(SELECT *, DENSE_RANK() OVER (ORDER BY wc_appCreatedDate DESC) offset_ FROM " + @@ -85,7 +90,7 @@ public class WsQueryBuilder { private static final String ORDER_BY_COUNT_CLAUSE= " ORDER BY appCreatedDate DESC"; - private static final String LATEST_EXECUTED_MIGRATION_QUERY = "select * from eg_ws_enc_audit where tenantid = ? order by createdTime desc limit 1;"; + private static final String LATEST_EXECUTED_MIGRATION_QUERY = "select * from {schema}.eg_ws_enc_audit where tenantid = ? order by createdTime desc limit 1;"; /** * @@ -172,8 +177,9 @@ else if (criteria.getIsCountCall() && !StringUtils.isEmpty(criteria.getSearchTyp } if (!StringUtils.isEmpty(criteria.getTenantId())) { + String tenantId = criteria.getTenantId(); addClauseIfRequired(preparedStatement, query); - if(criteria.getTenantId().equalsIgnoreCase(config.getStateLevelTenantId())){ + if (centralInstanceUtil.isTenantIdStateLevel(tenantId)) { query.append(" conn.tenantid LIKE ? "); preparedStatement.add(criteria.getTenantId() + '%'); } @@ -364,7 +370,7 @@ public String getSearchQueryStringForPlainSearch(SearchCriteria criteria, List preparedStatement, SearchCriteria criteria) { if (!StringUtils.isEmpty(criteria.getTenantId())) { addClauseIfRequired(preparedStatement, query); - if (criteria.getTenantId().equalsIgnoreCase(config.getStateLevelTenantId())) { + if (centralInstanceUtil.isTenantIdStateLevel(criteria.getTenantId())) { query.append(" conn.tenantid LIKE ? "); preparedStatement.add('%' + criteria.getTenantId() + '%'); } else { @@ -374,7 +380,7 @@ public StringBuilder applyFiltersForPlainSearch(StringBuilder query, List preparedStmtList, SearchCriteria criteria) { String string = addOrderByClauseForPlainSearch(criteria); StringBuilder queryString = new StringBuilder(query); @@ -421,7 +427,7 @@ private String addOrderByClauseForPlainSearch(SearchCriteria criteria) { public String getTotalApplicationsCountQueryString(SearchCriteria criteria, List preparedStatement) { preparedStatement.add(criteria.getTenantId()); - return TOTAL_APPLICATIONS_COUNT_QUERY; + return TOTAL_APPLICATIONS_COUNT_QUERY.replace("{}",criteria.getTenantId()); } public String getLastExecutionDetail(SearchCriteria criteria, List preparedStatement) { diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/CalculationService.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/CalculationService.java index 036134b4012..042cddff5ca 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/CalculationService.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/CalculationService.java @@ -151,8 +151,8 @@ public boolean fetchBillForReconnect(String tenantId, String connectionNo, Reque } return isNoPayment; } - - private StringBuilder getFetchBillURL(String tenantId, String connectionNo) { + + private StringBuilder getFetchBillURLForReconnect(String tenantId, String connectionNo) { return new StringBuilder().append(config.getBillingServiceHost()) .append(config.getFetchBillEndPoint()).append(WCConstants.URL_PARAMS_SEPARATER) @@ -160,10 +160,10 @@ private StringBuilder getFetchBillURL(String tenantId, String connectionNo) { .append(WCConstants.SEPARATER).append(WCConstants.CONSUMER_CODE_SEARCH_FIELD_NAME) .append(connectionNo).append(WCConstants.SEPARATER) .append(WCConstants.BUSINESSSERVICE_FIELD_FOR_SEARCH_URL) - .append(WCConstants.WATER_TAX_SERVICE_CODE); + .append("WSReconnection"); } - - private StringBuilder getFetchBillURLForReconnect(String tenantId, String connectionNo) { + + private StringBuilder getFetchBillURL(String tenantId, String connectionNo) { return new StringBuilder().append(config.getBillingServiceHost()) .append(config.getFetchBillEndPoint()).append(WCConstants.URL_PARAMS_SEPARATER) @@ -171,6 +171,6 @@ private StringBuilder getFetchBillURLForReconnect(String tenantId, String connec .append(WCConstants.SEPARATER).append(WCConstants.CONSUMER_CODE_SEARCH_FIELD_NAME) .append(connectionNo).append(WCConstants.SEPARATER) .append(WCConstants.BUSINESSSERVICE_FIELD_FOR_SEARCH_URL) - .append("WSReconnection"); + .append(WCConstants.WATER_TAX_SERVICE_CODE); } } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/EditNotificationService.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/EditNotificationService.java index 20a9eda7e43..7ab3890e1cc 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/EditNotificationService.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/EditNotificationService.java @@ -45,6 +45,7 @@ public class EditNotificationService { public void sendEditNotification(WaterConnectionRequest request) { + try { String applicationStatus = request.getWaterConnection().getApplicationStatus(); List configuredChannelNames = notificationUtil.fetchChannelList(request.getRequestInfo(), request.getWaterConnection().getTenantId(), WATER_SERVICE_BUSINESS_ID, request.getWaterConnection().getProcessInstance().getAction()); @@ -61,15 +62,16 @@ public void sendEditNotification(WaterConnectionRequest request) { if (config.getIsUserEventsNotificationEnabled() != null && config.getIsUserEventsNotificationEnabled()) { EventRequest eventRequest = getEventRequest(request, property); if (eventRequest != null) { - notificationUtil.sendEventNotification(eventRequest); + notificationUtil.sendEventNotification(eventRequest, property.getTenantId()); } } } + if(configuredChannelNames.contains(CHANNEL_NAME_SMS)){ if (config.getIsSMSEnabled() != null && config.getIsSMSEnabled()) { List smsRequests = getSmsRequest(request, property); if (!CollectionUtils.isEmpty(smsRequests)) { - notificationUtil.sendSMS(smsRequests); + notificationUtil.sendSMS(smsRequests, property.getTenantId()); } }} } catch (Exception ex) { diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/EnrichmentService.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/EnrichmentService.java index ab690ec35a7..1ec3fba93eb 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/EnrichmentService.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/EnrichmentService.java @@ -84,7 +84,6 @@ public class EnrichmentService { @Autowired private UnmaskingUtil unmaskingUtil; - /** * Enrich water connection * @@ -121,8 +120,8 @@ public void enrichWaterConnection(WaterConnectionRequest waterConnectionRequest, waterConnectionRequest.getWaterConnection().setAdditionalDetails(additionalDetail); //Setting ApplicationType String applicationType=null; - - + + if(reqType==WCConstants.CREATE_APPLICATION) { applicationType=WCConstants.NEW_WATER_CONNECTION; } @@ -497,13 +496,17 @@ public List filterConnections(List connectionL if (creationDate1.compareTo(creationDate2) == -1) { connectionHashMap.put(connection.getConnectionNo(), connection); } - } else if (connection.getApplicationStatus().equals(WCConstants.MODIFIED_FINAL_STATE )) { + } else if (connection.getApplicationStatus().equals(WCConstants.MODIFIED_FINAL_STATE)) { + connectionHashMap.put(connection.getConnectionNo(), connection); + } else { + if (connection.getApplicationStatus().equals(WCConstants + .DISCONNECTION_FINAL_STATE)) { connectionHashMap.put(connection.getConnectionNo(), connection); } } } - }); + }}); return new ArrayList(connectionHashMap.values()); } @@ -628,7 +631,8 @@ public void enrichDocumentDetails(List waterConnectionList, Sea auditObject.put("accessBy", requestInfo.getUserInfo().getUuid()); auditObject.put("purpose",DOCUMENT_ACCESS_AUDIT_MSG); - producer.push(config.getDocumentAuditTopic(), auditObject); + producer.push(propertyCriteria.getTenantId(),config.getDocumentAuditTopic(), auditObject); + } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/MeterReadingService.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/MeterReadingService.java index eac0429703e..2250452830b 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/MeterReadingService.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/MeterReadingService.java @@ -1,27 +1,25 @@ package org.egov.waterconnection.service; -import java.math.BigDecimal; -import java.time.Instant; -import java.time.LocalDate; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.util.HashMap; - +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; import org.egov.waterconnection.constants.WCConstants; +import org.egov.waterconnection.repository.ServiceRequestRepository; +import org.egov.waterconnection.util.WaterServicesUtil; import org.egov.waterconnection.web.models.MeterConnectionRequest; import org.egov.waterconnection.web.models.MeterReading; import org.egov.waterconnection.web.models.MeterReading.MeterStatusEnum; import org.egov.waterconnection.web.models.MeterReadingResponse; import org.egov.waterconnection.web.models.WaterConnectionRequest; -import org.egov.waterconnection.repository.ServiceRequestRepository; -import org.egov.waterconnection.util.WaterServicesUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; -import com.fasterxml.jackson.databind.ObjectMapper; - -import lombok.extern.slf4j.Slf4j; +import java.math.BigDecimal; +import java.time.Instant; +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.HashMap; @Service @Slf4j @@ -57,6 +55,7 @@ public void process(WaterConnectionRequest request, String topic) { .generateDemand(Boolean.FALSE).lastReading(initialMeterReading.doubleValue()) .lastReadingDate(request.getWaterConnection().getConnectionExecutionDate().longValue()) .build()).requestInfo(request.getRequestInfo()).build(); + log.info("METER READING CREATE ----> \n"+req.toString()); Object response = serviceRequestRepository.fetchResult(waterServiceUtil.getMeterReadingCreateURL(), req); MeterReadingResponse readingResponse = mapper.convertValue(response, MeterReadingResponse.class); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/PaymentUpdateService.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/PaymentUpdateService.java index 043e1033161..23573332978 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/PaymentUpdateService.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/PaymentUpdateService.java @@ -8,6 +8,7 @@ import org.egov.common.contract.request.RequestInfo; import org.egov.common.contract.request.Role; import org.egov.common.contract.request.User; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.model.CustomException; import org.egov.waterconnection.config.WSConfiguration; import org.egov.waterconnection.constants.WCConstants; @@ -22,6 +23,7 @@ import org.egov.waterconnection.web.models.users.UserDetailResponse; import org.egov.waterconnection.web.models.workflow.ProcessInstance; import org.egov.waterconnection.workflow.WorkflowIntegrator; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -35,7 +37,6 @@ import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; - import static org.egov.waterconnection.constants.WCConstants.*; import static org.egov.waterconnection.constants.WCConstants.PENDING_FOR_PAYMENT_STATUS_CODE; @@ -75,19 +76,27 @@ public class PaymentUpdateService { @Autowired private WaterServicesUtil waterServiceUtil; + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + /** * After payment change the application status * - * @param record - * payment request + * @param record payment request */ public void process(HashMap record) { try { PaymentRequest paymentRequest = mapper.convertValue(record, PaymentRequest.class); + String tenantId = paymentRequest.getPayment().getTenantId(); + + // Adding in MDC so that tracer can add it in header + MDC.put(TENANTID_MDC_STRING, tenantId); + boolean isServiceMatched = false; for (PaymentDetail paymentDetail : paymentRequest.getPayment().getPaymentDetails()) { if (WCConstants.WATER_SERVICE_BUSINESS_ID.equals(paymentDetail.getBusinessService()) || - paymentDetail.getBusinessService().equalsIgnoreCase(config.getReceiptBusinessservice()) || paymentDetail.getBusinessService().equalsIgnoreCase(config.getReconnectBusinessServiceName())) { + paymentDetail.getBusinessService().equalsIgnoreCase(config.getReceiptBusinessservice())) { isServiceMatched = true; } } @@ -104,7 +113,7 @@ public void process(HashMap record) { .connectionNumber(Stream.of(paymentDetail.getBill().getConsumerCode().toString()).collect(Collectors.toSet())) .applicationStatus(Collections.singleton(PENDING_FOR_PAYMENT_STATUS_CODE)).build(); } - if (paymentDetail.getBusinessService().equalsIgnoreCase(config.getReceiptReconnectionBusinessservice()) || paymentDetail.getBusinessService().equalsIgnoreCase(config.getReceiptBusinessservice())) { + if (paymentDetail.getBusinessService().equalsIgnoreCase(config.getReceiptBusinessservice())) { criteria = SearchCriteria.builder() .tenantId(paymentRequest.getPayment().getTenantId()) .applicationNumber(Stream.of(paymentDetail.getBill().getConsumerCode().toString()).collect(Collectors.toSet())).build(); @@ -122,10 +131,10 @@ public void process(HashMap record) { throw new CustomException("INVALID_RECEIPT", "More than one application found on consumerCode " + criteria.getApplicationNumber()); } - waterConnections.forEach(waterConnection -> waterConnection.getProcessInstance().setAction((WCConstants.ACTION_PAY))); + waterConnections.forEach(waterConnection -> waterConnection.getProcessInstance() + .setAction((WCConstants.ACTION_PAY))); WaterConnectionRequest waterConnectionRequest = WaterConnectionRequest.builder() - .waterConnection(connection).requestInfo(paymentRequest.getRequestInfo()) - .build(); + .waterConnection(connection).requestInfo(paymentRequest.getRequestInfo()).build(); try { log.info("WaterConnection Request " + mapper.writeValueAsString(waterConnectionRequest)); } catch (Exception ex) { @@ -138,8 +147,6 @@ public void process(HashMap record) { RequestInfo requestInfo = waterConnectionRequest.getRequestInfo(); Role role = Role.builder().code("SYSTEM_PAYMENT").tenantId(property.getTenantId()).build(); requestInfo.getUserInfo().getRoles().add(role); - if(paymentDetail.getBusinessService().equalsIgnoreCase(config.getReconnectBusinessServiceName())) - waterConnectionRequest.setReconnectRequest(true); wfIntegrator.callWorkFlow(waterConnectionRequest, property); enrichmentService.enrichFileStoreIds(waterConnectionRequest); repo.updateWaterConnection(waterConnectionRequest, false); @@ -173,8 +180,7 @@ private User fetchUser(String uuid, RequestInfo requestInfo) { log.error("error occured while parsing user info", e); } if (CollectionUtils.isEmpty(users)) { - throw new CustomException("INVALID_SEARCH_ON_USER", - "No user found on given criteria!!!"); + throw new CustomException("INVALID_SEARCH_ON_USER", "No user found on given criteria!!!"); } return mapper.convertValue(users.get(0), User.class); } @@ -197,8 +203,8 @@ public void sendNotificationForPayment(PaymentRequest paymentRequest) { return; for (PaymentDetail paymentDetail : paymentRequest.getPayment().getPaymentDetails()) { log.info("Consuming Business Service : {}", paymentDetail.getBusinessService()); - if (WCConstants.WATER_SERVICE_BUSINESS_ID.equals(paymentDetail.getBusinessService()) || - config.getReceiptBusinessservice().equals(paymentDetail.getBusinessService())) { + if (WCConstants.WATER_SERVICE_BUSINESS_ID.equals(paymentDetail.getBusinessService()) + || config.getReceiptBusinessservice().equals(paymentDetail.getBusinessService())) { SearchCriteria criteria = new SearchCriteria(); if (WCConstants.WATER_SERVICE_BUSINESS_ID.equals(paymentDetail.getBusinessService())) { criteria = SearchCriteria.builder() @@ -213,12 +219,14 @@ public void sendNotificationForPayment(PaymentRequest paymentRequest) { List waterConnections = waterService.search(criteria, paymentRequest.getRequestInfo()); if (CollectionUtils.isEmpty(waterConnections)) { - throw new CustomException("INVALID_RECEIPT", - "No waterConnection found for the consumerCode " + paymentDetail.getBill().getConsumerCode()); + throw new CustomException("INVALID_RECEIPT", "No waterConnection found for the consumerCode " + + paymentDetail.getBill().getConsumerCode()); } - Collections.sort(waterConnections, Comparator.comparing(wc -> wc.getAuditDetails().getLastModifiedTime())); + Collections.sort(waterConnections, + Comparator.comparing(wc -> wc.getAuditDetails().getLastModifiedTime())); long count = waterConnections.stream().count(); - Optional connections = Optional.of(waterConnections.stream().skip(count - 1).findFirst().get()); + Optional connections = Optional + .of(waterConnections.stream().skip(count - 1).findFirst().get()); WaterConnectionRequest waterConnectionRequest = WaterConnectionRequest.builder() .waterConnection(connections.get()).requestInfo(paymentRequest.getRequestInfo()) .build(); @@ -244,33 +252,39 @@ public void sendPaymentNotification(WaterConnectionRequest waterConnectionReques waterConnectionRequest.getRequestInfo().setUserInfo(userInfoCopy); List configuredChannelNames = notificationUtil.fetchChannelList(waterConnectionRequest.getRequestInfo(), waterConnectionRequest.getWaterConnection().getTenantId(), WATER_SERVICE_BUSINESS_ID, waterConnectionRequest.getWaterConnection().getProcessInstance().getAction()); + String tenantId = centralInstanceUtil.getStateLevelTenant(property.getTenantId()); - if(configuredChannelNames.contains(CHANNEL_NAME_EVENT)) { + if (configuredChannelNames.contains(CHANNEL_NAME_EVENT)) { if (config.getIsUserEventsNotificationEnabled() != null && config.getIsUserEventsNotificationEnabled()) { EventRequest eventRequest = getEventRequest(waterConnectionRequest, property, paymentDetail); if (eventRequest != null) { - notificationUtil.sendEventNotification(eventRequest); + notificationUtil.sendEventNotification(eventRequest, tenantId); } } } - if(configuredChannelNames.contains(CHANNEL_NAME_SMS)) { + + if (configuredChannelNames.contains(CHANNEL_NAME_SMS)) { if (config.getIsSMSEnabled() != null && config.getIsSMSEnabled()) { List smsRequests = getSmsRequest(waterConnectionRequest, property, paymentDetail); if (!CollectionUtils.isEmpty(smsRequests)) { - notificationUtil.sendSMS(smsRequests); + notificationUtil.sendSMS(smsRequests, tenantId); } + } } + if(configuredChannelNames.contains(CHANNEL_NAME_EMAIL)) { if (config.getIsEmailNotificationEnabled() != null && config.getIsEmailNotificationEnabled()) { List emailRequests = getEmailRequest(waterConnectionRequest, property, paymentDetail); if (!CollectionUtils.isEmpty(emailRequests)) { - notificationUtil.sendEmail(emailRequests); + notificationUtil.sendEmail(emailRequests, tenantId); } } } + } + /** * * @param request @@ -563,8 +577,8 @@ private Map replacePaymentInfo(Map mobileAndMess String link = config.getNotificationUrl() + config.getMyPaymentsLink(); link = link.replace("$consumerCode", paymentDetail.getBill().getConsumerCode()); link = link.replace("$tenantId", paymentDetail.getTenantId()); - link = link.replace("$businessService",paymentDetail.getBusinessService()); - link = link.replace("$receiptNumber",paymentDetail.getReceiptNumber()); + link = link.replace("$businessService", paymentDetail.getBusinessService()); + link = link.replace("$receiptNumber", paymentDetail.getReceiptNumber()); link = link.replace("$mobile", mobAndMesg.getKey()); link = waterServiceUtil.getShortnerURL(link); message = message.replace("{receipt download link}",link); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/PdfFileStoreService.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/PdfFileStoreService.java index f4af5f20ec4..4a7f979465a 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/PdfFileStoreService.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/PdfFileStoreService.java @@ -7,9 +7,11 @@ import java.util.Optional; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.model.CustomException; import org.egov.waterconnection.config.WSConfiguration; import org.egov.waterconnection.constants.WCConstants; +import org.egov.waterconnection.util.NotificationUtil; import org.egov.waterconnection.web.models.Calculation; import org.egov.waterconnection.web.models.CalculationCriteria; import org.egov.waterconnection.web.models.CalculationReq; @@ -58,6 +60,12 @@ public class PdfFileStoreService { @Autowired private ValidateProperty validateProperty; + @Autowired + private NotificationUtil notificationUtil; + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + String tenantIdReplacer = "$tenantId"; String fileStoreIdsReplacer = "$.filestoreIds"; String urlReplacer = "url"; @@ -121,8 +129,11 @@ public String getFileStoreId(WaterConnectionRequest waterConnectionRequest, Prop waterConnectionRequest.getRequestInfo(),applicationStatus, config.getBusinessServiceValue()); waterObject.put(sla, slaDays.divide(BigDecimal.valueOf(WCConstants.DAYS_CONST))); waterObject.put(slaDate, slaDays.add(new BigDecimal(System.currentTimeMillis()))); - String[] tenantDetails = property.getTenantId().split("\\."); - String tenantId = tenantDetails[0]; + String[] tenantDetails = property.getTenantId().split("\\."); + String tenantId = property.getTenantId(); + if(tenantDetails.length > centralInstanceUtil.getStateLevelTenantIdLength()){ + tenantId = tenantDetails[0] + "." + tenantDetails[1]; + } if(tenantDetails.length > 1) { waterObject.put(tenantName, tenantDetails[1].toUpperCase()); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterService.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterService.java index 0e79578ae29..6c8de5d9f47 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterService.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterService.java @@ -17,7 +17,7 @@ public interface WaterService { Integer countAllWaterApplications(SearchCriteria criteria, RequestInfo requestInfo); List updateWaterConnection(WaterConnectionRequest waterConnectionRequest); - + WaterConnectionResponse plainSearch(SearchCriteria criteria, RequestInfo requestInfo); } \ No newline at end of file diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java index aef040fc3c9..1a0dcb4329b 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java @@ -1,5 +1,11 @@ package org.egov.waterconnection.service; +import static org.egov.waterconnection.constants.WCConstants.APPROVE_CONNECTION; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import lombok.extern.slf4j.Slf4j; import org.egov.common.contract.request.PlainAccessRequest; @@ -17,12 +23,12 @@ import org.egov.waterconnection.validator.ValidateProperty; import org.egov.waterconnection.validator.WaterConnectionValidator; import org.egov.waterconnection.web.models.*; -import org.egov.waterconnection.web.models.Connection.StatusEnum; import org.egov.waterconnection.web.models.workflow.BusinessService; import org.egov.waterconnection.web.models.workflow.ProcessInstance; import org.egov.waterconnection.workflow.WorkflowIntegrator; import org.egov.waterconnection.workflow.WorkflowService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; @@ -216,6 +222,9 @@ private void validateReconnectionRequest(WaterConnectionRequest waterConnectionR */ public List search(SearchCriteria criteria, RequestInfo requestInfo) { List waterConnectionList; + + waterConnectionValidator.validateSearch(criteria); + //Creating copies of apiPlainAcessRequests for decryption process //Any decryption process returns the requestInfo with only the already used plain Access Request fields @@ -312,9 +321,6 @@ public List updateWaterConnection(WaterConnectionRequest waterC if(waterConnectionRequest.isDisconnectRequest() || waterConnectionRequest.getWaterConnection().getApplicationType().equalsIgnoreCase(WCConstants.DISCONNECT_WATER_CONNECTION)) { return updateWaterConnectionForDisconnectFlow(waterConnectionRequest); } - else if (waterConnectionRequest.isReconnectRequest() || waterConnectionRequest.getWaterConnection().getApplicationType().equalsIgnoreCase(WCConstants.WATER_RECONNECTION)) { - return updateWaterConnectionForReconnectFlow(waterConnectionRequest); - } SearchCriteria criteria = new SearchCriteria(); log.info("con" + wsUtil.isModifyConnectionRequest(waterConnectionRequest)); log.info("isDisconnection" +waterConnectionRequest.getWaterConnection().getIsDisconnectionTemporary()); @@ -328,7 +334,8 @@ else if (waterConnectionRequest.isReconnectRequest() || waterConnectionRequest.g validateProperty.validatePropertyFields(property,waterConnectionRequest.getRequestInfo()); BusinessService businessService = workflowService.getBusinessService(waterConnectionRequest.getWaterConnection().getTenantId(), waterConnectionRequest.getRequestInfo(), config.getBusinessServiceValue()); - WaterConnection searchResult = getConnectionForUpdateRequest(waterConnectionRequest.getWaterConnection().getId(), waterConnectionRequest.getRequestInfo()); + + WaterConnection searchResult = getConnectionForUpdateRequest(waterConnectionRequest.getWaterConnection().getTenantId(), waterConnectionRequest.getWaterConnection().getId(), waterConnectionRequest.getRequestInfo()); boolean isPlumberSwapped = unmaskingUtil.getUnmaskedPlumberInfo(waterConnectionRequest.getWaterConnection().getPlumberInfo(), searchResult.getPlumberInfo()); if (isPlumberSwapped) @@ -390,7 +397,7 @@ public List updateWaterConnectionForDisconnectFlow(WaterConnect validateProperty.validatePropertyFields(property,waterConnectionRequest.getRequestInfo()); BusinessService businessService = workflowService.getBusinessService(waterConnectionRequest.getWaterConnection().getTenantId(), waterConnectionRequest.getRequestInfo(), config.getDisconnectBusinessServiceName()); - WaterConnection searchResult = getConnectionForUpdateRequest(waterConnectionRequest.getWaterConnection().getId(), waterConnectionRequest.getRequestInfo()); + WaterConnection searchResult = getConnectionForUpdateRequest(waterConnectionRequest.getWaterConnection().getTenantId(),waterConnectionRequest.getWaterConnection().getId(), waterConnectionRequest.getRequestInfo()); boolean isPlumberSwapped = unmaskingUtil.getUnmaskedPlumberInfo(waterConnectionRequest.getWaterConnection().getPlumberInfo(), searchResult.getPlumberInfo()); if (isPlumberSwapped) @@ -423,7 +430,11 @@ public List updateWaterConnectionForDisconnectFlow(WaterConnect //Call workflow wfIntegrator.callWorkFlow(waterConnectionRequest, property); //check for edit and send edit notification - //waterDaoImpl.pushForEditNotification(waterConnectionRequest, isStateUpdatable); + waterDaoImpl.pushForEditNotification(waterConnectionRequest, isStateUpdatable); + //Enrich file store Id After payment + enrichmentService.enrichFileStoreIds(waterConnectionRequest); +// userService.createUser(waterConnectionRequest); + enrichmentService.postStatusEnrichment(waterConnectionRequest); /* encrypt here */ waterConnectionRequest.setWaterConnection(encryptConnectionDetails(waterConnectionRequest.getWaterConnection())); @@ -449,78 +460,7 @@ public List updateWaterConnectionForDisconnectFlow(WaterConnect return Arrays.asList(waterConnectionRequest.getWaterConnection()); } - - public List updateWaterConnectionForReconnectFlow(WaterConnectionRequest waterConnectionRequest) { - - SearchCriteria criteria = new SearchCriteria(); - - waterConnectionValidator.validateWaterConnection(waterConnectionRequest, WCConstants.RECONNECTION); - mDMSValidator.validateMasterData(waterConnectionRequest,WCConstants.RECONNECTION ); - - Property property = validateProperty.getOrValidateProperty(waterConnectionRequest); - validateProperty.validatePropertyFields(property,waterConnectionRequest.getRequestInfo()); - BusinessService businessService = workflowService.getBusinessService(waterConnectionRequest.getWaterConnection().getTenantId(), - waterConnectionRequest.getRequestInfo(), config.getReconnectBusinessServiceName()); - WaterConnection searchResult = getConnectionForUpdateRequest(waterConnectionRequest.getWaterConnection().getId(), waterConnectionRequest.getRequestInfo()); - - boolean isPlumberSwapped = unmaskingUtil.getUnmaskedPlumberInfo(waterConnectionRequest.getWaterConnection().getPlumberInfo(), searchResult.getPlumberInfo()); - if (isPlumberSwapped) - waterConnectionRequest.setWaterConnection(encryptionDecryptionUtil.decryptObject(waterConnectionRequest.getWaterConnection(), "WnSConnectionPlumberDecrypDisabled", WaterConnection.class, waterConnectionRequest.getRequestInfo())); - - String previousApplicationStatus = workflowService.getApplicationStatus(waterConnectionRequest.getRequestInfo(), - waterConnectionRequest.getWaterConnection().getApplicationNo(), - waterConnectionRequest.getWaterConnection().getTenantId(), - config.getReconnectBusinessServiceName()); - - boolean isStateUpdatable = waterServiceUtil.getStatusForUpdate(businessService, previousApplicationStatus); - - enrichmentService.enrichUpdateWaterConnection(waterConnectionRequest); - actionValidator.validateUpdateRequest(waterConnectionRequest, businessService, previousApplicationStatus); - waterConnectionValidator.validateUpdate(waterConnectionRequest, searchResult, WCConstants.RECONNECTION); - userService.updateUser(waterConnectionRequest, searchResult); - //call calculator service to generate the demand for one time fee - //if(!waterConnectionRequest.getWaterConnection().getIsDisconnectionTemporary()) - calculationService.calculateFeeAndGenerateDemand(waterConnectionRequest, property); - //check whether amount is due - boolean isNoPayment = false; - WaterConnection waterConnection = waterConnectionRequest.getWaterConnection(); - ProcessInstance processInstance = waterConnection.getProcessInstance(); - if (WCConstants.APPROVE_CONNECTION_CONST.equalsIgnoreCase(processInstance.getAction()) ) { - isNoPayment = calculationService.fetchBillForReconnect(waterConnection.getTenantId(), waterConnection.getApplicationNo(), waterConnectionRequest.getRequestInfo()); - if (isNoPayment) { - processInstance.setComment(WORKFLOW_NO_PAYMENT_CODE); - } - } - //Call workflow - wfIntegrator.callWorkFlow(waterConnectionRequest, property); - //check for edit and send edit notification - //waterDaoImpl.pushForEditNotification(waterConnectionRequest, isStateUpdatable); - - /* encrypt here */ - waterConnectionRequest.setWaterConnection(encryptConnectionDetails(waterConnectionRequest.getWaterConnection())); - /* encrypt here for connection holder details */ - waterConnectionRequest.setWaterConnection(encryptConnectionHolderDetails(waterConnectionRequest.getWaterConnection())); - - waterDao.updateWaterConnection(waterConnectionRequest, isStateUpdatable); - - // setting oldApplication Flag - markOldApplication(waterConnectionRequest); -// enrichmentService.postForMeterReading(waterConnectionRequest, WCConstants.DISCONNECT_CONNECTION); - if (!StringUtils.isEmpty(waterConnectionRequest.getWaterConnection().getTenantId())) - criteria.setTenantId(waterConnectionRequest.getWaterConnection().getTenantId()); - enrichmentService.enrichProcessInstance(Arrays.asList(waterConnectionRequest.getWaterConnection()), criteria, waterConnectionRequest.getRequestInfo()); - - //Updating the workflow from approve for disconnection to pending for disconnection execution when there are no dues - if(WCConstants.APPROVE_CONNECTION_CONST.equalsIgnoreCase(processInstance.getAction()) && isNoPayment){ - paymentUpdateService.noPaymentWorkflow(waterConnectionRequest, property, waterConnectionRequest.getRequestInfo()); - } - - /* decrypt here */ - waterConnectionRequest.setWaterConnection(decryptConnectionDetails(waterConnectionRequest.getWaterConnection(), waterConnectionRequest.getRequestInfo())); - - return Arrays.asList(waterConnectionRequest.getWaterConnection()); - } - + /** * Search Water connection to be update * @@ -528,10 +468,11 @@ public List updateWaterConnectionForReconnectFlow(WaterConnecti * @param requestInfo * @return water connection */ - public WaterConnection getConnectionForUpdateRequest(String id, RequestInfo requestInfo) { + public WaterConnection getConnectionForUpdateRequest(String tenantId, String id, RequestInfo requestInfo) { Set ids = new HashSet<>(Arrays.asList(id)); SearchCriteria criteria = new SearchCriteria(); criteria.setIds(ids); + criteria.setTenantId(tenantId); List connections = getWaterConnectionsList(criteria, requestInfo); if (CollectionUtils.isEmpty(connections)) { StringBuilder builder = new StringBuilder(); @@ -543,9 +484,11 @@ public WaterConnection getConnectionForUpdateRequest(String id, RequestInfo requ } private List getAllWaterApplications(WaterConnectionRequest waterConnectionRequest) { + WaterConnection waterConnection = waterConnectionRequest.getWaterConnection(); SearchCriteria criteria = SearchCriteria.builder() .connectionNumber(Stream.of(waterConnection.getConnectionNo().toString()).collect(Collectors.toSet())).build(); + criteria.setTenantId(waterConnection.getTenantId()); if(waterConnectionRequest.isDisconnectRequest() || !StringUtils.isEmpty(waterConnection.getConnectionNo())) criteria.setIsInternalCall(true); @@ -558,7 +501,7 @@ private List updateWaterConnectionForModifyFlow(WaterConnection BusinessService businessService = workflowService.getBusinessService( waterConnectionRequest.getWaterConnection().getTenantId(), waterConnectionRequest.getRequestInfo(), config.getModifyWSBusinessServiceName()); - WaterConnection searchResult = getConnectionForUpdateRequest( + WaterConnection searchResult = getConnectionForUpdateRequest(waterConnectionRequest.getWaterConnection().getTenantId(), waterConnectionRequest.getWaterConnection().getId(), waterConnectionRequest.getRequestInfo()); boolean isPlumberSwapped = unmaskingUtil.getUnmaskedPlumberInfo(waterConnectionRequest.getWaterConnection().getPlumberInfo(), searchResult.getPlumberInfo()); @@ -598,7 +541,8 @@ private List updateWaterConnectionForModifyFlow(WaterConnection } public void markOldApplication(WaterConnectionRequest waterConnectionRequest) { - if (waterConnectionRequest.getWaterConnection().getProcessInstance().getAction().equalsIgnoreCase(APPROVE_CONNECTION)) { + String action = waterConnectionRequest.getWaterConnection().getProcessInstance().getAction(); + if (action.equalsIgnoreCase(APPROVE_CONNECTION) || action.equalsIgnoreCase(EXECUTE_DISCONNECTION)) { String currentModifiedApplicationNo = waterConnectionRequest.getWaterConnection().getApplicationNo(); List previousConnectionsList = getAllWaterApplications(waterConnectionRequest); @@ -691,7 +635,6 @@ private WaterConnection encryptConnectionHolderDetails(WaterConnection waterConn return waterConnection; } - /** * Decrypts waterConnection details * diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WorkflowNotificationService.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WorkflowNotificationService.java index 79b4924c22c..32b3f74e2e1 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WorkflowNotificationService.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WorkflowNotificationService.java @@ -13,7 +13,9 @@ import org.egov.waterconnection.config.WSConfiguration; import org.egov.waterconnection.constants.WCConstants; import org.egov.waterconnection.repository.ServiceRequestRepository; +import org.egov.waterconnection.util.EncryptionDecryptionUtil; import org.egov.waterconnection.util.NotificationUtil; +import org.egov.waterconnection.util.UnmaskingUtil; import org.egov.waterconnection.util.WaterServicesUtil; import org.egov.waterconnection.validator.ValidateProperty; import org.egov.waterconnection.web.models.*; @@ -27,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.egov.common.utils.MultiStateInstanceUtil; import java.time.Instant; import java.time.LocalDate; @@ -38,6 +41,8 @@ import static org.egov.waterconnection.constants.WCConstants.*; +import static org.egov.waterconnection.constants.WCConstants.*; + @Service @Slf4j public class WorkflowNotificationService { @@ -66,6 +71,15 @@ public class WorkflowNotificationService { @Autowired private UserService userService; + @Autowired + private UnmaskingUtil unmaskingUtil; + + @Autowired + private EncryptionDecryptionUtil encryptionDecryptionUtil; + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + String tenantIdReplacer = "$tenantId"; String urlReplacer = "url"; String requestInfoReplacer = "RequestInfo"; @@ -82,8 +96,7 @@ public class WorkflowNotificationService { String applicationKey = "$applicationkey"; String propertyKey = "property"; String businessService = "WS.ONE_TIME_FEE"; - - + String tenantName = "tenantName"; /** * @@ -92,6 +105,7 @@ public class WorkflowNotificationService { */ public void process(WaterConnectionRequest request, String topic) { try { + String tenantId = request.getWaterConnection().getTenantId(); log.info("In process of consumer to generate notifications"); String applicationStatus = request.getWaterConnection().getApplicationStatus(); List configuredChannelNames=new ArrayList(); @@ -111,21 +125,21 @@ public void process(WaterConnectionRequest request, String topic) { if (config.getIsUserEventsNotificationEnabled() != null && config.getIsUserEventsNotificationEnabled()) { EventRequest eventRequest = getEventRequest(request, topic, property, applicationStatus); if (eventRequest != null) { - notificationUtil.sendEventNotification(eventRequest); + notificationUtil.sendEventNotification(eventRequest, tenantId); } }} if(configuredChannelNames.contains(CHANNEL_NAME_SMS)){ if (config.getIsSMSEnabled() != null && config.getIsSMSEnabled()) { List smsRequests = getSmsRequest(request, topic, property, applicationStatus); if (!CollectionUtils.isEmpty(smsRequests)) { - notificationUtil.sendSMS(smsRequests); + notificationUtil.sendSMS(smsRequests, tenantId); } }} if(configuredChannelNames.contains(CHANNEL_NAME_EMAIL)){ if (config.getIsEmailNotificationEnabled() != null && config.getIsEmailNotificationEnabled()) { List emailRequests = getEmailRequest(request, topic, property, applicationStatus); if (!CollectionUtils.isEmpty(emailRequests)) { - notificationUtil.sendEmail(emailRequests); + notificationUtil.sendEmail(emailRequests, tenantId); } }} } catch (Exception ex) { @@ -717,7 +731,8 @@ private String getApplicationDownloadLink(WaterConnectionRequest waterConnection waterObject.put(serviceFee, calResponse.getCalculation().get(0).getCharge()); waterObject.put(tax, calResponse.getCalculation().get(0).getTaxAmount()); waterObject.put(propertyKey, property); - String tenantId = property.getTenantId().split("\\.")[0]; + //String tenantId = property.getTenantId().split("\\.")[0]; + String tenantId = centralInstanceUtil.getStateLevelTenant(property.getTenantId()); String fileStoreId = getFielStoreIdFromPDFService(waterObject, waterConnectionRequest.getRequestInfo(), tenantId); return getApplicationDownloadLink(tenantId, fileStoreId); } catch (Exception ex) { @@ -784,7 +799,7 @@ private String getApplicationDownloadLink(String tenantId, String fileStoreId) { } } - public Map setRecepitDownloadLink(Map mobileNumberAndMessage, + public Map setRecepitDownloadLink(Map mobileNumberAndMessage, WaterConnectionRequest waterConnectionRequest, String message, Property property) { Map messageToReturn = new HashMap<>(); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/util/NotificationUtil.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/util/NotificationUtil.java index 7c7222bef2c..e966c6601d4 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/util/NotificationUtil.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/util/NotificationUtil.java @@ -6,12 +6,16 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; + +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.common.contract.request.Role; import org.egov.common.contract.request.User; + import org.egov.mdms.model.MasterDetail; import org.egov.mdms.model.MdmsCriteria; import org.egov.mdms.model.MdmsCriteriaReq; import org.egov.mdms.model.ModuleDetail; +import org.egov.tracer.model.CustomException; import org.egov.waterconnection.config.WSConfiguration; import org.egov.waterconnection.constants.WCConstants; import org.egov.waterconnection.producer.WaterConnectionProducer; @@ -32,6 +36,8 @@ import static com.jayway.jsonpath.Filter.filter; import static org.egov.waterconnection.constants.WCConstants.*; +import org.springframework.util.ObjectUtils; + @Component @Slf4j public class NotificationUtil { @@ -53,6 +59,9 @@ public class NotificationUtil { @Autowired private UserService userService; + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; /** * Returns the uri for the localization call * @@ -62,9 +71,10 @@ public class NotificationUtil { */ public StringBuilder getUri(String tenantId, RequestInfo requestInfo) { - if (config.getIsLocalizationStateLevel()) - tenantId = tenantId.split("\\.")[0]; - + if (config.getIsLocalizationStateLevel()) { + tenantId = centralInstanceUtil.getStateLevelTenant(tenantId); +// tenantId = tenantId.split("\\.")[0] + "." + tenantId.split("\\.")[1]; + } String locale = WCConstants.NOTIFICATION_LOCALE; if (!StringUtils.isEmpty(requestInfo.getMsgId()) && requestInfo.getMsgId().split("|").length >= 2) locale = requestInfo.getMsgId().split("\\|")[1]; @@ -119,15 +129,15 @@ public String getMessageTemplate(String notificationCode, String localizationMes * Send the SMSRequest on the SMSNotification kafka topic * @param smsRequestList The list of SMSRequest to be sent */ - public void sendSMS(List smsRequestList) { + public void sendSMS(List smsRequestList, String tenantId) { if (config.getIsSMSEnabled()) { if (CollectionUtils.isEmpty(smsRequestList)) { log.info("Messages from localization couldn't be fetched!"); return; } for (SMSRequest smsRequest : smsRequestList) { - producer.push(config.getSmsNotifTopic(), smsRequest); - log.info("SMS Sent! Messages: " + smsRequest.getMessage()); + producer.push(tenantId, config.getSmsNotifTopic(), smsRequest); + log.info("Messages: " + smsRequest.getMessage()); } } } @@ -226,9 +236,9 @@ public String getCustomizedMsg(String code, String localizationMessage) { * * @param request EventRequest Object */ - public void sendEventNotification(EventRequest request) { + public void sendEventNotification(EventRequest request, String tenantId) { log.info("Pushing Event: " + request.toString()); - producer.push(config.getSaveUserEventsTopic(), request); + producer.push(tenantId, config.getSaveUserEventsTopic(), request); } public List createEmailRequest(WaterConnectionRequest waterConnectionRequest, String message, Map mobileNumberToEmailId) { @@ -256,13 +266,13 @@ public List createEmailRequest(WaterConnectionRequest waterConnect * @param emailRequestList * The list of EmailRequest to be sent */ - public void sendEmail(List emailRequestList) { + public void sendEmail(List emailRequestList, String tenantId) { if (config.getIsEmailNotificationEnabled()) { if (CollectionUtils.isEmpty(emailRequestList)) log.info("Messages from localization couldn't be fetched!"); for (EmailRequest emailRequest : emailRequestList) { - producer.push(config.getEmailNotifTopic(), emailRequest); + producer.push(tenantId, config.getEmailNotifTopic(), emailRequest); log.info("Email Request -> "+emailRequest.toString()); log.info("EMAIL notification sent!"); } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/util/WaterServicesUtil.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/util/WaterServicesUtil.java index 090aa7977de..906789dcef7 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/util/WaterServicesUtil.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/util/WaterServicesUtil.java @@ -116,6 +116,10 @@ public List propertySearch(WaterConnectionRequest waterConnectionReque propertyCriteria.setTenantId(waterConnectionRequest.getWaterConnection().getTenantId()); propertyCriteria.setLocality(addDetail.get(localityCode).toString()); } + if (waterConnectionRequest.getRequestInfo().getUserInfo() != null + && "CITIZEN".equalsIgnoreCase(waterConnectionRequest.getRequestInfo().getUserInfo().getType())) { + propertyCriteria.setTenantId(waterConnectionRequest.getWaterConnection().getTenantId()); + } Object result = serviceRequestRepository.fetchResult( getPropertyURL(propertyCriteria), RequestInfoWrapper.builder().requestInfo(waterConnectionRequest.getRequestInfo()).build()); @@ -305,7 +309,7 @@ public StringBuilder getMeterReadingCreateURL() { public String getShortnerURL(String actualURL) { JSONObject obj = new JSONObject(); obj.put(URL, actualURL); - String url = config.getNotificationUrl() + config.getShortenerURL(); + String url = config.getUrlShortnerHost() + config.getShortenerURL(); Object response = serviceRequestRepository.getShorteningURL(new StringBuilder(url), obj); return response.toString(); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/validator/ValidateProperty.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/validator/ValidateProperty.java index 33c3325edca..b47932741d3 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/validator/ValidateProperty.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/validator/ValidateProperty.java @@ -3,6 +3,7 @@ import java.util.*; import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.model.CustomException; import org.egov.waterconnection.constants.WCConstants; import org.egov.waterconnection.util.WaterServicesUtil; @@ -23,6 +24,10 @@ public class ValidateProperty { @Autowired private MDMSValidator mdmsValidator; + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + /** * * @param property Property Objects @@ -62,7 +67,8 @@ public Property getOrValidateProperty(WaterConnectionRequest waterConnectionRequ } public JSONObject getWnsPTworkflowConfig(RequestInfo requestInfo,String tenantId){ - tenantId = tenantId.split("\\.")[0]; + //tenantId = tenantId.split("\\.")[0]; + tenantId = centralInstanceUtil.getStateLevelTenant(tenantId); List propertyModuleMasters = new ArrayList<>(Arrays.asList("PTWorkflow")); Map> codes = mdmsValidator.getAttributeValues(tenantId,WCConstants.PROPERTY_MASTER_MODULE, propertyModuleMasters, "$.*", WCConstants.PROPERTY_JSONPATH_ROOT,requestInfo); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/validator/WaterConnectionValidator.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/validator/WaterConnectionValidator.java index b9dbcf67d55..0ab719686c3 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/validator/WaterConnectionValidator.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/validator/WaterConnectionValidator.java @@ -5,13 +5,19 @@ import java.util.List; import java.util.Map; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.model.CustomException; +import org.egov.waterconnection.config.WSConfiguration; import org.egov.waterconnection.constants.WCConstants; import org.egov.waterconnection.service.MeterInfoValidator; import org.egov.waterconnection.service.PropertyValidator; import org.egov.waterconnection.service.WaterFieldValidator; + +import org.egov.waterconnection.web.models.SearchCriteria; + import org.egov.waterconnection.util.EncryptionDecryptionUtil; import org.egov.waterconnection.web.models.OwnerInfo; + import org.egov.waterconnection.web.models.ValidatorResult; import org.egov.waterconnection.web.models.WaterConnection; import org.egov.waterconnection.web.models.WaterConnectionRequest; @@ -38,6 +44,12 @@ public class WaterConnectionValidator { @Autowired private MeterInfoValidator meterInfoValidator; + @Autowired + private WSConfiguration configs; + + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + @Autowired EncryptionDecryptionUtil encryptionDecryptionUtil; @@ -197,4 +209,11 @@ public void validateConnectionStatus(List previousConnectionsLi throw new CustomException(errorMap); } + public void validateSearch(SearchCriteria criteria){ + if(centralInstanceUtil.getIsEnvironmentCentralInstance() && criteria.getTenantId() == null) + throw new CustomException("EG_WS_INVALID_SEARCH"," TenantId is mandatory for search "); + else if(centralInstanceUtil.getIsEnvironmentCentralInstance() && criteria.getTenantId().split("\\.").length < centralInstanceUtil.getStateLevelTenantIdLength()) + throw new CustomException("EG_WS_INVALID_SEARCH"," TenantId should be mandatorily " + centralInstanceUtil.getStateLevelTenantIdLength() + " levels for search"); } + +} diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/workflow/WorkflowIntegrator.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/workflow/WorkflowIntegrator.java index 2a98bdd0c82..91fa327b5ff 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/workflow/WorkflowIntegrator.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/workflow/WorkflowIntegrator.java @@ -64,10 +64,6 @@ public void callWorkFlow(WaterConnectionRequest waterConnectionRequest, Property || (waterConnectionRequest.getWaterConnection().getApplicationStatus().equalsIgnoreCase(WCConstants.PENDING_FOR_PAYMENT_STATUS_CODE) && waterConnectionRequest.getWaterConnection().getApplicationNo().contains(WCConstants.APPLICATION_DISCONNECTION_CODE))) { wfBusinessServiceName = config.getDisconnectBusinessServiceName(); - } - else if((waterConnectionRequest.isReconnectRequest() || waterConnectionRequest.getWaterConnection().getApplicationType().equalsIgnoreCase(WCConstants.WATER_RECONNECTION)) - || (waterConnectionRequest.getWaterConnection().getApplicationStatus().equalsIgnoreCase(WCConstants.DISCONNECTION_FINAL_STATE))) { - wfBusinessServiceName = config.getWsWorkflowReconnectionName(); } else if(wsUtil.isModifyConnectionRequest(waterConnectionRequest)) { wfBusinessServiceName = config.getModifyWSBusinessServiceName(); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/workflow/WorkflowService.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/workflow/WorkflowService.java index 4cf2450fe44..45a1f1afd77 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/workflow/WorkflowService.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/workflow/WorkflowService.java @@ -1,7 +1,6 @@ package org.egov.waterconnection.workflow; import java.math.BigDecimal; - import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; diff --git a/municipal-services/ws-services/src/main/resources/application.properties b/municipal-services/ws-services/src/main/resources/application.properties index cffe1b00074..615d0406dc3 100644 --- a/municipal-services/ws-services/src/main/resources/application.properties +++ b/municipal-services/ws-services/src/main/resources/application.properties @@ -14,8 +14,10 @@ egov.property.searchendpoint=property-services/property/_search #mdms urls -egov.mdms.host=http://localhost:8094/ -egov.mdms.search.endpoint=egov-mdms-service/v1/_search +#egov.mdms.host=http://localhost:8094/ +#egov.mdms.search.endpoint=egov-mdms-service/v1/_search +mdms.v2.host=https://dev.digit.org +mdms.v2.search.endpoint=/mdms-v2/v1/_search # KAFKA SERVER CONFIGURATIONS kafka.config.bootstrap_server_config=localhost:9092 @@ -48,6 +50,7 @@ egov.waterservice.savefilestoreIds.topic=save-ws-filestoreids #create meter reading topic ws.meterreading.create.topic=create-meter-reading +ws.meterreading.create.topic.pattern=((^[a-zA-Z]+-)?create-meter-reading) #Edit Notification topic ws.editnotification.topic=editnotification @@ -92,9 +95,6 @@ is.external.workflow.enabled=true create.ws.workflow.name=NewWS1 modify.ws.workflow.name=ModifyWSConnection reconnection.ws.workflow.name=WSReconnection - - -# wf url workflow.workDir.path=https://dev.digit.org/ workflow.context.path=https://dev.digit.org/ workflow.transition.path=egov-workflow-v2/egov-wf/process/_transition @@ -166,13 +166,22 @@ logging.level.org.egov.waterconnection=DEBUG spring.kafka.listener.missing-topics-fatal=false +ws.kafka.consumer.topic.pattern=((^[a-zA-Z]+-)?save-ws-connection|(^[a-zA-Z]+-)?update-ws-connection|(^[a-zA-Z]+-)?update-ws-workflow) +ws.kafka.edit.notification.topic.pattern=((^[a-zA-Z]+-)?editnotification) +ws.kafka.filestore.topic.pattern=((^[a-zA-Z]+-)?ws-filestoreids-process) +kafka.topics.receipt.topic.pattern=((^[a-zA-Z]+-)?egov.collection.payment-create) +egov.ui.app.host.map={"in":"https://central-instance.digit.org","in.statea":"https://statea.digit.org","pb":"https://dev.digit.org/"} +egov.url.shortner.host=http://egov-url-shortening.egov:8080/ + +#central instance +state.level.tenantid.length=2 +is.environment.central.instance=false state.level.tenant.id=pb + + egov.disconnect.businessservice=DisconnectWSConnection -egov.reconnect.businessservice=WSReconnection egov.receipt.disconnection.businessservice.topic=WS -egov.receipt.reconnection.businessservice.topic=WSReconnection egov.water.connection.document.access.audit.kafka.topic=egov-document-access - spring.main.allow-bean-definition-overriding=true #--------enable/disable ABAC in encryption----------# water.decryption.abac.enabled=true @@ -184,4 +193,4 @@ encryption.offset.value=0 #-------Persister topics for oldDataEncryption-------# egov.waterservice.oldDataEncryptionStatus.topic=ws-enc-audit -egov.waterservice.update.oldData.topic=update-ws-encryption \ No newline at end of file +egov.waterservice.update.oldData.topic=update-ws-encryption diff --git a/municipal-services/ws-services/src/main/resources/db/migrate.sh b/municipal-services/ws-services/src/main/resources/db/migrate.sh index 54d07c0940a..f79b7016299 100644 --- a/municipal-services/ws-services/src/main/resources/db/migrate.sh +++ b/municipal-services/ws-services/src/main/resources/db/migrate.sh @@ -1,3 +1,11 @@ #!/bin/sh - -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate +baseurl=$DB_URL +echo "the baseurl : $DB_URL" +schemasetter="?currentSchema=" +schemas=$SCHEMA_NAME +echo "the schemas : $schemas" +for schemaname in ${schemas//,/ } +do + echo "the schema name : ${baseurl}${schemasetter}${schemaname}" + flyway -url=${baseurl}${schemasetter}${schemaname} -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate +done \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/pom.xml b/tutorials/backend-developer-guide/btr-services/pom.xml index af972eba557..9aac623e7d1 100644 --- a/tutorials/backend-developer-guide/btr-services/pom.xml +++ b/tutorials/backend-developer-guide/btr-services/pom.xml @@ -13,7 +13,7 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE + 1.5.9.RELEASE src/main/java diff --git a/utilities/egov-pdf/CHANGELOG.md b/utilities/egov-pdf/CHANGELOG.md index 8bcda0ba4ea..7fe89c57493 100644 --- a/utilities/egov-pdf/CHANGELOG.md +++ b/utilities/egov-pdf/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this module will be documented in this file. +## 1.2.1 - 2023-09-13 + +- Central Instance Library Integration + ## 1.2.0 - 2023-02-02 - Transition from 1.2.0-beta version to 1.2.0 version diff --git a/utilities/egov-pdf/package.json b/utilities/egov-pdf/package.json index 15e502387da..dadc0b9e883 100644 --- a/utilities/egov-pdf/package.json +++ b/utilities/egov-pdf/package.json @@ -1,6 +1,6 @@ { "name": "egov-pdf", - "version": "1.2.0", + "version": "1.2.1", "private": true, "main": "index.js", "scripts": { diff --git a/utilities/egov-pdf/src/api.js b/utilities/egov-pdf/src/api.js index 2961930b3b6..e65c05a4c1c 100644 --- a/utilities/egov-pdf/src/api.js +++ b/utilities/egov-pdf/src/api.js @@ -427,6 +427,13 @@ async function getPropertyDeatils(requestinfo,tenantId,propertyIds,connectionnoT async function create_pdf(tenantId, key, data, requestinfo) { + let headers = { + // Add your desired headers here + "content-type": "application/json;charset=UTF-8", + accept: "application/json, text/plain, */*", + "TENANTID":tenantId + }; + return await axios({ responseType: "stream", method: "post", @@ -436,6 +443,33 @@ async function create_pdf(tenantId, key, data, requestinfo) { tenantId: tenantId, key: key, }, + headers: headers, // Include the headers in the request + }); +} + +async function create_pdf_and_upload(tenantId, key, data, requestinfo) { + return await axios({ + //responseType: "stream", + method: "post", + url: url.resolve(config.host.pdf, config.paths.pdf_create_upload), + data: Object.assign(requestinfo, data), + params: { + tenantId: tenantId, + key: key, + }, + }); +} + +async function create_pdf_and_upload(tenantId, key, data, requestinfo) { + return await axios({ + //responseType: "stream", + method: "post", + url: url.resolve(config.host.pdf, config.paths.pdf_create_upload), + data: Object.assign(requestinfo, data), + params: { + tenantId: tenantId, + key: key, + }, }); } diff --git a/utilities/egov-pdf/src/routes/wns.js b/utilities/egov-pdf/src/routes/wns.js index 4bec0a7f402..eff5a296d60 100644 --- a/utilities/egov-pdf/src/routes/wns.js +++ b/utilities/egov-pdf/src/routes/wns.js @@ -438,8 +438,7 @@ router.post( bussinessService: bussinessService, isConsolidated: isConsolidated, consumerCode: consumerCode, - jobid: jobid, - propertyId: propertyId + jobid: jobid }; try { diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.CancerCess b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.CancerCess new file mode 100644 index 00000000000..df57031e61e --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.CancerCess @@ -0,0 +1,89 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.CancerCess", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY" + ], + "x-unique": [ + "fromFY" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ChargeSlabs b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ChargeSlabs new file mode 100644 index 00000000000..439dd94ba1d --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ChargeSlabs @@ -0,0 +1,79 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.ChargeSlabs", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "floorNo", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "floorNo": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.CommonFieldsConfig b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.CommonFieldsConfig new file mode 100644 index 00000000000..b0267702ec3 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.CommonFieldsConfig @@ -0,0 +1,141 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.CommonFieldsConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "head", + "body" + ], + "x-unique": [ + "head" + ], + "properties": { + "body": { + "type": "array", + "items": { + "type": "object", + "required": [ + "route", + "component", + "nextStep", + "key", + "texts" + ], + "properties": { + "key": { + "type": "string" + }, + "type": { + "type": "string" + }, + "route": { + "type": "string" + }, + "texts": { + "type": "object", + "required": [ + "header", + "cardText" + ], + "properties": { + "header": { + "type": "string" + }, + "cardText": { + "type": "string" + }, + "nextText": { + "type": "string" + }, + "skipText": { + "type": "string" + }, + "headerCaption": { + "type": "string" + }, + "submitBarLabel": { + "type": "string" + }, + "skipAndContinueText": { + "type": "string" + } + }, + "additionalProperties": false + }, + "nextStep": { + "type": "string" + }, + "component": { + "type": "string" + }, + "isMandatory": { + "type": "boolean", + "default": true + }, + "withoutLabel": { + "type": "boolean", + "default": true + }, + "hideInEmployee": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + } + }, + "head": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ConstructionSubType b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ConstructionSubType new file mode 100644 index 00000000000..addc206f0b8 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ConstructionSubType @@ -0,0 +1,78 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.ConstructionSubType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ConstructionType b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ConstructionType new file mode 100644 index 00000000000..a27175aac72 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ConstructionType @@ -0,0 +1,78 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.ConstructionType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Documents b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Documents new file mode 100644 index 00000000000..e898bb49b9f --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Documents @@ -0,0 +1,208 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.Documents", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "documentType", + "required", + "active", + "hasDropdown", + "additionalDetails", + "dropdownData", + "description" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "required": { + "type": "boolean", + "default": false + }, + "description": { + "type": "string" + }, + "hasDropdown": { + "type": "boolean", + "default": true + }, + "documentType": { + "type": "string" + }, + "dropdownData": { + "type": "array", + "items": { + "type": "object", + "required": [ + "code", + "active" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + }, + "digit-citizen": { + "type": "boolean", + "default": true + }, + "additionalDetails": { + "type": "object", + "required": [ + "enabledActions" + ], + "properties": { + "enabledActions": { + "type": "object", + "required": [ + "assess", + "reassess", + "update", + "create" + ], + "properties": { + "assess": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "create": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "update": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "reassess": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.DuesOnPTMutation b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.DuesOnPTMutation new file mode 100644 index 00000000000..298c2009df8 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.DuesOnPTMutation @@ -0,0 +1,83 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.DuesOnPTMutation", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "module", + "code", + "enabled", + "fetchConsumerUrl", + "fecthBillUrl" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "module": { + "type": "string" + }, + "enabled": { + "type": "boolean", + "default": true + }, + "fecthBillUrl": { + "type": "string" + }, + "fetchConsumerUrl": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.FireCess b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.FireCess new file mode 100644 index 00000000000..9b84195c158 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.FireCess @@ -0,0 +1,115 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.FireCess", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "dynamicFirecess", + "dynamicRates" + ], + "x-unique": [ + "fromFY" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "dynamicRates": { + "type": "object", + "required": [ + "firecess_inflammable", + "firecess_building_height", + "firecess_category_major" + ], + "properties": { + "firecess_inflammable": { + "type": "integer" + }, + "firecess_category_major": { + "type": "integer" + }, + "firecess_building_height": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "dynamicFirecess": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Floor b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Floor new file mode 100644 index 00000000000..ad195844e24 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Floor @@ -0,0 +1,79 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.Floor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "description", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Interest b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Interest new file mode 100644 index 00000000000..0708776952f --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Interest @@ -0,0 +1,95 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.Interest", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "startingDay" + ], + "x-unique": [ + "fromFY", + "startingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "startingDay": { + "type": "string", + "format": "date" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MapConfig b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MapConfig new file mode 100644 index 00000000000..2a88768a742 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MapConfig @@ -0,0 +1,81 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.MapConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "defaultConfig" + ], + "x-unique": [ + "defaultConfig" + ], + "properties": { + "defaultConfig": { + "type": "object", + "required": [ + "lat", + "lng" + ], + "properties": { + "lat": { + "type": "number", + "default": 31.6160638 + }, + "lng": { + "type": "number", + "default": 74.8978579 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationDocuments b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationDocuments new file mode 100644 index 00000000000..f8d579367b8 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationDocuments @@ -0,0 +1,110 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.MutationDocuments", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "documentType", + "required", + "active", + "hasDropdown", + "dropdownData", + "description" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": false + }, + "required": { + "type": "boolean", + "default": false + }, + "description": { + "type": "string" + }, + "hasDropdown": { + "type": "boolean", + "default": false + }, + "documentType": { + "type": "string" + }, + "dropdownData": { + "type": "array", + "items": { + "type": "object", + "required": [ + "code", + "active" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationPenalty b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationPenalty new file mode 100644 index 00000000000..e771453acbe --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationPenalty @@ -0,0 +1,94 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.MutationPenalty", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "startingDay", + "mutationPaymentPeriodInMonth" + ], + "x-unique": [ + "fromFY", + "startingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "startingDay": { + "type": "string", + "format": "date" + }, + "mutationPaymentPeriodInMonth": { + "type": "string", + "default": "06" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationReason b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationReason new file mode 100644 index 00000000000..7e37d9c5bb7 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationReason @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.MutationReason", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationRebate b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationRebate new file mode 100644 index 00000000000..52f104c2cc4 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationRebate @@ -0,0 +1,94 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.MutationRebate", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "endingDay", + "mutationPaymentPeriodInMonth" + ], + "x-unique": [ + "fromFY", + "endingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "endingDay": { + "type": "string", + "format": "date" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "mutationPaymentPeriodInMonth": { + "type": "string", + "default": "06" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OccupancyType b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OccupancyType new file mode 100644 index 00000000000..27c6dc5a71d --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OccupancyType @@ -0,0 +1,74 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.OccupancyType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerShipCategory b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerShipCategory new file mode 100644 index 00000000000..0922855cb20 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerShipCategory @@ -0,0 +1,75 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.OwnerShipCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerType b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerType new file mode 100644 index 00000000000..36b62fd740c --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerType @@ -0,0 +1,107 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.OwnerType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": "object", + "required": [ + "rate" + ], + "properties": { + "rate": { + "type": [ + "number", + "null" + ] + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerTypeDocument b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerTypeDocument new file mode 100644 index 00000000000..02438a9e82f --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerTypeDocument @@ -0,0 +1,85 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.OwnerTypeDocument", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "ownerTypeCode", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "ownerTypeCode": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "ownerTypeCode", + "schemaCode": "PropertyTax.OwnerType" + } + ], + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PTApplication b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PTApplication new file mode 100644 index 00000000000..acd0ba64989 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PTApplication @@ -0,0 +1,78 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.PTApplication", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "creationReason", + "businessService", + "action", + "editAction" + ], + "x-unique": [ + "businessService" + ], + "properties": { + "action": { + "type": "string" + }, + "editAction": { + "type": "string" + }, + "creationReason": { + "type": "string" + }, + "businessService": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PTWorkflow b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PTWorkflow new file mode 100644 index 00000000000..da70968ba03 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PTWorkflow @@ -0,0 +1,81 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.PTWorkflow", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "businessService", + "initialAction", + "inWorkflowStatusAllowed", + "enable" + ], + "x-unique": [ + "businessService", + "initialAction" + ], + "properties": { + "enable": { + "type": "boolean", + "default": false + }, + "initialAction": { + "type": "string" + }, + "businessService": { + "type": "string" + }, + "inWorkflowStatusAllowed": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Penalty b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Penalty new file mode 100644 index 00000000000..bc3542e4afb --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Penalty @@ -0,0 +1,88 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.Penalty", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "startingDay" + ], + "x-unique": [ + "fromFY", + "startingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "startingDay": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertyConfiguration b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertyConfiguration new file mode 100644 index 00000000000..f56ca478c85 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertyConfiguration @@ -0,0 +1,85 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.PropertyConfiguration", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "Mutation", + "id" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "number" + }, + "Mutation": { + "type": "object", + "required": [ + "RegistrationDetails", + "MutationDetails" + ], + "properties": { + "MutationDetails": { + "type": "boolean", + "default": true + }, + "RegistrationDetails": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertySubType b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertySubType new file mode 100644 index 00000000000..f567407790e --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertySubType @@ -0,0 +1,85 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.PropertySubType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "propertyType" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "propertyType": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "propertyType", + "schemaCode": "PropertyTax.PropertyType" + } + ], + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertyType b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertyType new file mode 100644 index 00000000000..86aec8049ce --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertyType @@ -0,0 +1,78 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.PropertyType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "propertyType": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ReasonForTransfer b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ReasonForTransfer new file mode 100644 index 00000000000..99994dbcb0a --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ReasonForTransfer @@ -0,0 +1,75 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.ReasonForTransfer", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Rebate b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Rebate new file mode 100644 index 00000000000..ef0bb9f1b9a --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Rebate @@ -0,0 +1,89 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.Rebate", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "endingDay" + ], + "x-unique": [ + "fromFY", + "endingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "endingDay": { + "type": "string", + "format": "date" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.RentalDetails b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.RentalDetails new file mode 100644 index 00000000000..b1271afaf8b --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.RentalDetails @@ -0,0 +1,75 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.RentalDetails", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.SubOwnerShipCategory b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.SubOwnerShipCategory new file mode 100644 index 00000000000..73ce49abcfc --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.SubOwnerShipCategory @@ -0,0 +1,85 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition":{ + "tenantId": "pg", + "code": "PropertyTax.SubOwnerShipCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "ownerShipCategory" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "ownerShipCategory": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "ownerShipCategory", + "schemaCode": "PropertyTax.OwnerShipCategory" + } + ], + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UpdateNumber b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UpdateNumber new file mode 100644 index 00000000000..69251b4928c --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UpdateNumber @@ -0,0 +1,139 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.UpdateNumber", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "invalidPattern", + "invalidNumber", + "warningEnabled", + "skipEnabled", + "documents" + ], + "x-unique": [ + "invalidNumber" + ], + "properties": { + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "active", + "code", + "description", + "documentType", + "dropdownData", + "hasDropdown", + "required", + "inputProps", + "maxFileSize" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean" + }, + "required": { + "type": "boolean", + "default": false + }, + "inputProps": { + "type": "object", + "required": [ + "accept" + ], + "properties": { + "accept": { + "type": "string" + } + }, + "additionalProperties": false + }, + "description": { + "type": "string" + }, + "hasDropdown": { + "type": "boolean", + "default": false + }, + "maxFileSize": { + "type": "integer" + }, + "documentType": { + "type": "string" + }, + "dropdownData": { + "type": "array" + } + }, + "additionalProperties": false + } + }, + "skipEnabled": { + "type": "boolean", + "default": true + }, + "invalidNumber": { + "type": "string" + }, + "invalidPattern": { + "type": "string" + }, + "warningEnabled": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategory b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategory new file mode 100644 index 00000000000..da9c55f6e68 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategory @@ -0,0 +1,106 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.UsageCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": "object", + "properties": { + "rate": { + "type": [ + "number", + "null" + ], + "default": 0 + }, + "maxAmount": { + "type": [ + "number", + "null" + ], + "default": 0 + }, + "flatAmount": { + "type": [ + "number", + "null" + ], + "default": 0 + } + } + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryDetail b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryDetail new file mode 100644 index 00000000000..8aefa7d4091 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryDetail @@ -0,0 +1,112 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.UsageCategoryDetail", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "usageCategorySubMinor", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": [ + "object", + "null" + ], + "required": [ + "rate", + "maxAmount", + "flatAmount" + ], + "properties": { + "rate": { + "type": "number" + }, + "maxAmount": { + "type": "number" + }, + "flatAmount": { + "type": "number" + } + } + }, + "usageCategorySubMinor": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "usageCategorySubMinor", + "schemaCode": "PropertyTax.UsageCategorySubMinor" + } + ], + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryMajor b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryMajor new file mode 100644 index 00000000000..b76adc3f1cc --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryMajor @@ -0,0 +1,80 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.UsageCategoryMajor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryMinor b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryMinor new file mode 100644 index 00000000000..a30008fec5b --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryMinor @@ -0,0 +1,111 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.UsageCategoryMinor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY", + "usageCategoryMajor", + "exemption" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": "object", + "required": [ + "rate", + "maxAmount", + "flatAmount" + ], + "properties": { + "rate": { + "type": "integer" + }, + "maxAmount": { + "type": "integer" + }, + "flatAmount": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "usageCategoryMajor": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "usageCategoryMajor", + "schemaCode": "PropertyTax.UsageCategoryMajor" + } + ], + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategorySubMinor b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategorySubMinor new file mode 100644 index 00000000000..fed6200feee --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategorySubMinor @@ -0,0 +1,114 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.UsageCategorySubMinor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY", + "usageCategoryMinor", + "exemption" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": [ + "object", + "null" + ], + "required": [ + "rate", + "maxAmount", + "flatAmount" + ], + "properties": { + "rate": { + "type": "integer" + }, + "maxAmount": { + "type": "integer" + }, + "flatAmount": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "usageCategoryMinor": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "usageCategoryMinor", + "schemaCode": "PropertyTax.UsageCategoryMinor" + } + ], + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.ComplainClosingTime b/utilities/mdms-migration/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.ComplainClosingTime new file mode 100644 index 00000000000..0ae18de37f4 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.ComplainClosingTime @@ -0,0 +1,67 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "RAINMAKER-PGR.ComplainClosingTime", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "ComplainMaxIdleTime" + ], + "x-unique": [ + "ComplainMaxIdleTime" + ], + "properties": { + "ComplainMaxIdleTime": { + "type": "number", + "default": 3600000, + "minimum": 0 + } + } + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.ServiceDefs b/utilities/mdms-migration/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.ServiceDefs new file mode 100644 index 00000000000..74bfa2239f8 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.ServiceDefs @@ -0,0 +1,100 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "RAINMAKER-PGR.ServiceDefs", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "serviceCode", + "name", + "keywords", + "department", + "slaHours", + "menuPath", + "active" + ], + "x-unique": [ + "serviceCode" + ], + "properties": { + "name": { + "type": "string" + }, + "order": { + "type": "integer" + }, + "active": { + "type": "boolean" + }, + "keywords": { + "type": "string" + }, + "menuPath": { + "type": "string" + }, + "slaHours": { + "type": "integer", + "default": 336, + "minimum": 1 + }, + "department": { + "type": "string" + }, + "serviceCode": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "department", + "schemaCode": "common-masters.Department" + } + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.UIConstants b/utilities/mdms-migration/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.UIConstants new file mode 100644 index 00000000000..b3164262bac --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.UIConstants @@ -0,0 +1,73 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "id": "c00c7744-8bff-48af-b659-45a85884d948", + "tenantId": "pg", + "code": "RAINMAKER-PGR.UIConstants", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "REOPENSLA" + ], + "x-unique": [ + "REOPENSLA" + ], + "properties": { + "REOPENSLA": { + "type": "integer", + "default": 432000000 + } + } + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1702379477350, + "lastModifiedTime": 1702379477350 + } + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.AccessoriesCategory b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.AccessoriesCategory new file mode 100644 index 00000000000..84ed270fff7 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.AccessoriesCategory @@ -0,0 +1,78 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.AccessoriesCategory", + "description": null, + "definition": { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "uom": { + "type": [ + "string", + "null" + ] + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false, + "required": [ + "code", + "active", + "uom" + ], + "x-unique": [ + "code" + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.ApplicationType b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.ApplicationType new file mode 100644 index 00000000000..bff673628da --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.ApplicationType @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.ApplicationType", + "description": null, + "definition": { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false, + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Documents b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Documents new file mode 100644 index 00000000000..e486fdd9d1a --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Documents @@ -0,0 +1,105 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.Documents", + "description": null, + "definition": { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "documentType": { + "type": "string" + }, + "required": { + "type": "boolean", + "default": true + }, + "active": { + "type": "boolean", + "default": true + }, + "dropdownData": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false, + "required": [ + "code", + "active" + ] + } + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "code", + "documentType", + "required", + "active", + "dropdownData", + "description" + ], + "x-unique": [ + "code" + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Penalty b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Penalty new file mode 100644 index 00000000000..9ec7ed8edaf --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Penalty @@ -0,0 +1,89 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.Penalty", + "description": null, + "definition": { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "rate": { + "type": "integer", + "default": 10, + "minimum": 0 + }, + "minAmount": { + "type": "number", + "minimum": 0 + }, + "flatAmount": { + "type": "number", + "minimum": 0 + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "startingDay": { + "type": "string", + "format": "date" + } + }, + "additionalProperties": false, + "required": [ + "rate", + "minAmount", + "flatAmount", + "fromFY", + "startingDay" + ], + "x-unique": [ + "fromFY", + "startingDay" + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Rebate b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Rebate new file mode 100644 index 00000000000..f86e67f6767 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Rebate @@ -0,0 +1,90 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.Rebate", + "description": null, + "definition": { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "rate": { + "type": "integer", + "minimum": 0 + }, + "maxAmount": { + "type": [ + "null", + "integer" + ], + "minimum": 0 + }, + "flatAmount": { + "type": "number", + "minimum": 0 + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "endingDay": { + "type": "string", + "format": "date" + } + }, + "additionalProperties": false, + "required": [ + "rate", + "flatAmount", + "fromFY", + "endingDay" + ], + "x-unique": [ + "fromFY", + "endingDay" + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.ReminderPeriods b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.ReminderPeriods new file mode 100644 index 00000000000..076eba5dfbc --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.ReminderPeriods @@ -0,0 +1,77 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.ReminderPeriods", + "description": null, + "definition": { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "tenantId": { + "type": "string" + }, + "reminderInterval": { + "type": "integer", + "default": 691200000 + } + }, + "additionalProperties": false, + "required": [ + "tenantId", + "reminderInterval" + ], + "x-unique": [ + "tenantId" + ], + "x-ref-schema": [ + { + "fieldPath": "tenantId", + "schemaCode": "tenant.tenantInfo" + } + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.TradeRenewal b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.TradeRenewal new file mode 100644 index 00000000000..c1c95f64c1f --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.TradeRenewal @@ -0,0 +1,68 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.TradeRenewal", + "description": null, + "definition": { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "renewalPeriod": { + "type": "integer", + "default": 7889400000, + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "renewalPeriod" + ], + "x-unique": [ + "renewalPeriod" + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.TradeType b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.TradeType new file mode 100644 index 00000000000..e09795f7bd3 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.TradeType @@ -0,0 +1,133 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.TradeType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "applicationDocument", + "verificationDocument", + "active", + "type" + ], + "x-unique": [ + "code" + ], + "properties": { + "uom": { + "type": [ + "null", + "string" + ] + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "active": { + "type": "boolean" + }, + "validityPeriod": { + "type": [ + "null", + "integer" + ] + }, + "applicationDocument": { + "type": "array", + "items": { + "type": [ + "object", + "string" + ], + "required": [], + "properties": { + "documentList": { + "type": "array", + "items": { + "type": "string" + } + }, + "applicationType": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "verificationDocument": { + "type": [ + "array", + "null" + ] + }, + "restrictions": { + "type": "object", + "properties": { + "maxPlotArea": { + "type": "integer" + }, + "maxBulidingheight": { + "type": "integer" + }, + "maxFloors": { + "type": "integer" + } + } + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CancelCurrentBillReasons b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CancelCurrentBillReasons new file mode 100644 index 00000000000..3d39f04ed2a --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CancelCurrentBillReasons @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.CancelCurrentBillReasons", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CancelReceiptReason b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CancelReceiptReason new file mode 100644 index 00000000000..8a0e29b0379 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CancelReceiptReason @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.CancelReceiptReason", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CensusYear b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CensusYear new file mode 100644 index 00000000000..d028dd9522f --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CensusYear @@ -0,0 +1,74 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.CensusYear", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "tenantId", + "name", + "code" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "tenantId": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CitizenConsentForm b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CitizenConsentForm new file mode 100644 index 00000000000..55b5880fe59 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CitizenConsentForm @@ -0,0 +1,103 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.CitizenConsentForm", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "isCitizenConsentFormEnabled", + "checkBoxLabels", + "id" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "number" + }, + "checkBoxLabels": { + "type": "array", + "items": { + "type": "object", + "required": [ + "linkPrefix", + "link", + "linkId", + "linkPostfix", + "en_IN" + ], + "properties": { + "link": { + "type": "string" + }, + "en_IN": { + "type": "string" + }, + "linkId": { + "type": "string" + }, + "linkPrefix": { + "type": "string" + }, + "linkPostfix": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "isCitizenConsentFormEnabled": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CommonInboxConfig b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CommonInboxConfig new file mode 100644 index 00000000000..52b020d6ffa --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CommonInboxConfig @@ -0,0 +1,108 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.CommonInboxConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "moduleName", + "BusinessService", + "roles", + "active", + "locality", + "localityModule", + "redirectConfig" + ], + "x-unique": [ + "BusinessService" + ], + "properties": { + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "active": { + "type": "boolean", + "default": true + }, + "locality": { + "type": "boolean", + "default": true + }, + "moduleName": { + "type": "string" + }, + "localityModule": { + "type": "string" + }, + "redirectConfig": { + "type": "object", + "required": [ + "INITIATED", + "DEFAULT" + ], + "properties": { + "DEFAULT": { + "type": "string" + }, + "INITIATED": { + "type": "string" + } + }, + "additionalProperties": false + }, + "BusinessService": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CronJobAPIConfig b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CronJobAPIConfig new file mode 100644 index 00000000000..cd4b8b563c9 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.CronJobAPIConfig @@ -0,0 +1,104 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.CronJobAPIConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "jobName", + "active", + "method", + "url", + "payload", + "header" + ], + "x-unique": [ + "url" + ], + "properties": { + "url": { + "type": "string" + }, + "active": { + "type": "string" + }, + "header": { + "type": "object", + "required": [ + "Content-Type" + ], + "properties": { + "Content-Type": { + "type": "string" + } + }, + "additionalProperties": false + }, + "method": { + "type": "string" + }, + "jobName": { + "type": "string" + }, + "payload": { + "type": "object", + "required": [ + "RequestInfo" + ], + "properties": { + "RequestInfo": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.Department b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.Department new file mode 100644 index 00000000000..f3d8ce424de --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.Department @@ -0,0 +1,75 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.Department", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.Designation b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.Designation new file mode 100644 index 00000000000..528031ecf1f --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.Designation @@ -0,0 +1,79 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.Designation", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "name", + "description", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.DocumentType b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.DocumentType new file mode 100644 index 00000000000..2816b84da5a --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.DocumentType @@ -0,0 +1,80 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.DocumentType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "maxFileSize": { + "type": "number" + }, + "allowedFormat": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.GenderType b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.GenderType new file mode 100644 index 00000000000..83a4ca14a69 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.GenderType @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.GenderType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.IdFormat b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.IdFormat new file mode 100644 index 00000000000..8cc3ea82b7b --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.IdFormat @@ -0,0 +1,70 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.IdFormat", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "format", + "idname" + ], + "x-unique": [ + "idname" + ], + "properties": { + "format": { + "type": "string" + }, + "idname": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.OwnerShipCategory b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.OwnerShipCategory new file mode 100644 index 00000000000..0ae1ddb0332 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.OwnerShipCategory @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.OwnerShipCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.OwnerType b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.OwnerType new file mode 100644 index 00000000000..41c03a9a54a --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.OwnerType @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.OwnerType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.StateInfo b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.StateInfo new file mode 100644 index 00000000000..4c225aac601 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.StateInfo @@ -0,0 +1,152 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.StateInfo", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "qrCodeURL", + "bannerUrl", + "logoUrl", + "logoUrlWhite", + "statelogo", + "hasLocalisation", + "defaultUrl", + "languages", + "localizationModules" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "logoUrl": { + "type": "string" + }, + "bannerUrl": { + "type": "string" + }, + "languages": { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "qrCodeURL": { + "type": "string" + }, + "statelogo": { + "type": "string" + }, + "defaultUrl": { + "type": "object", + "required": [ + "citizen", + "employee" + ], + "properties": { + "citizen": { + "type": "string" + }, + "employee": { + "type": "string" + } + }, + "additionalProperties": false + }, + "logoUrlWhite": { + "type": "string" + }, + "hasLocalisation": { + "type": "boolean", + "default": true + }, + "localizationModules": { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.StructureType b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.StructureType new file mode 100644 index 00000000000..4679296a3cf --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.StructureType @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.StructureType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.TablePaginationOptions b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.TablePaginationOptions new file mode 100644 index 00000000000..64efcfdf153 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.TablePaginationOptions @@ -0,0 +1,77 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.TablePaginationOptions", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rowsPerPageOptions", + "defaultValue", + "id" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "number" + }, + "defaultValue": { + "type": "integer" + }, + "rowsPerPageOptions": { + "type": "array", + "items": { + "type": "integer" + } + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.UOM b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.UOM new file mode 100644 index 00000000000..fac57a12d58 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.UOM @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.UOM", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.UomCategory b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.UomCategory new file mode 100644 index 00000000000..c132baeb7b5 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.UomCategory @@ -0,0 +1,94 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.UomCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "id", + "tenantId", + "uomCategory", + "name", + "code", + "description", + "fromDate", + "toDate" + ], + "x-unique": [ + "code" + ], + "properties": { + "id": { + "type": "integer" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "toDate": { + "type": "integer" + }, + "fromDate": { + "type": "integer" + }, + "tenantId": { + "type": "string" + }, + "description": { + "type": "string" + }, + "uomCategory": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.Uomm b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.Uomm new file mode 100644 index 00000000000..e714b742f44 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.Uomm @@ -0,0 +1,99 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.Uom", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "id", + "tenantId", + "code", + "description", + "uomCategory", + "baseUom", + "fromDate", + "toDate", + "conversionFactor" + ], + "x-unique": [ + "code" + ], + "properties": { + "id": { + "type": "integer" + }, + "code": { + "type": "string" + }, + "toDate": { + "type": "integer" + }, + "baseUom": { + "type": "boolean", + "default": true + }, + "fromDate": { + "type": "integer" + }, + "tenantId": { + "type": "string" + }, + "description": { + "type": "string" + }, + "uomCategory": { + "type": "string" + }, + "conversionFactor": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.bdTemplate b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.bdTemplate new file mode 100644 index 00000000000..07b15b8ec72 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.bdTemplate @@ -0,0 +1,70 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.bdTemplate", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "template", + "code" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "template": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.uiCommonPay b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.uiCommonPay new file mode 100644 index 00000000000..722241ec549 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.uiCommonPay @@ -0,0 +1,120 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.uiCommonPay", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "headerBandLabel", + "receiptKey", + "billKey", + "cancelReceipt", + "cancelBill", + "arrears", + "buttons" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "arrears": { + "type": "boolean", + "default": true + }, + "billKey": { + "type": "string" + }, + "buttons": { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "citizenUrl", + "employeeUrl" + ], + "properties": { + "label": { + "type": "string" + }, + "citizenUrl": { + "type": "string" + }, + "employeeUrl": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "pdfModule": { + "type": "string" + }, + "cancelBill": { + "type": "boolean", + "default": true + }, + "receiptKey": { + "type": "string" + }, + "cancelReceipt": { + "type": "boolean", + "default": true + }, + "headerBandLabel": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.wfSlaConfig b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.wfSlaConfig new file mode 100644 index 00000000000..83c3102dc85 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/Schema creation curls/common-masters/common-masters.wfSlaConfig @@ -0,0 +1,82 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.wfSlaConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "id", + "slotPercentage", + "positiveSlabColor", + "negativeSlabColor", + "middleSlabColor" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "integer" + }, + "slotPercentage": { + "type": "integer" + }, + "middleSlabColor": { + "type": "string" + }, + "negativeSlabColor": { + "type": "string" + }, + "positiveSlabColor": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data CancelCurrentBillReasons.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data CancelCurrentBillReasons.postman_collection new file mode 100644 index 00000000000..8f3e5286b99 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data CancelCurrentBillReasons.postman_collection @@ -0,0 +1,139 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"INCORRECT_PERSONAL_INFO\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INCORRECT_PROPERTY_DETAILS\",", + " \"active\": true", + " },{", + " \"code\": \"INCORRECT_CONNECTION_DETAILS\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OTHER\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.CancelCurrentBillReasons\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.CancelCurrentBillReasons", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.CancelCurrentBillReasons" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ComplainClosingTime.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ComplainClosingTime.postman_collection new file mode 100644 index 00000000000..18a7889b3c8 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ComplainClosingTime.postman_collection @@ -0,0 +1,127 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"ComplainMaxIdleTime\": 3600000", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"RAINMAKER-PGR.ComplainClosingTime\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/RAINMAKER-PGR.ComplainClosingTime", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "RAINMAKER-PGR.ComplainClosingTime" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ComplainMaxIdleTime.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ComplainMaxIdleTime.postman_collection new file mode 100644 index 00000000000..18a7889b3c8 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ComplainMaxIdleTime.postman_collection @@ -0,0 +1,127 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"ComplainMaxIdleTime\": 3600000", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"RAINMAKER-PGR.ComplainClosingTime\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/RAINMAKER-PGR.ComplainClosingTime", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "RAINMAKER-PGR.ComplainClosingTime" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ConstructionSubType.postman_collection.json b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ConstructionSubType.postman_collection.json new file mode 100644 index 00000000000..705ee696ea0 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ConstructionSubType.postman_collection.json @@ -0,0 +1,142 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"id\": \"1\",", + " \"name\": \"Pucca\",", + " \"code\": \"PUCCA\",", + " \"active\": true", + " },", + " {", + " \"id\": \"2\",", + " \"name\": \"Semi-Pucca\",", + " \"code\": \"SEMIPUCCA\",", + " \"active\": true", + " },", + " {", + " \"id\": \"3\",", + " \"name\": \"Kuccha\",", + " \"code\": \"KUCCHA\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.ConstructionSubType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.ConstructionSubType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.ConstructionSubType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ConstructionType.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ConstructionType.postman_collection new file mode 100644 index 00000000000..627ba7f56a0 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ConstructionType.postman_collection @@ -0,0 +1,142 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"id\": \"1\",", + " \"name\": \"Pucca\",", + " \"code\": \"PUCCA\",", + " \"active\": true", + " },", + " {", + " \"id\": \"2\",", + " \"name\": \"Semi-Pucca\",", + " \"code\": \"SEMIPUCCA\",", + " \"active\": true", + " },", + " {", + " \"id\": \"3\",", + " \"name\": \"Kuccha\",", + " \"code\": \"KUCCHA\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.ConstructionType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.ConstructionType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.ConstructionType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Documents.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Documents.postman_collection new file mode 100644 index 00000000000..1c3f88ecdc6 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Documents.postman_collection @@ -0,0 +1,539 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"OWNER.ADDRESSPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"digit-citizen\":true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"enabledActions\": {", + " \"assess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"reassess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"update\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"create\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " }", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.ELECTRICITYBILL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.WATERBILL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.GASBILL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.AADHAAR\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.VOTERID\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.DRIVING\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.PASSPORT\",", + " \"active\": false", + " }", + " ],", + " \"description\": \"OWNER.ADDRESSPROOF.ADDRESSPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"digit-citizen\":true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"enabledActions\": {", + " \"assess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"reassess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"update\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"create\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " }", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.AADHAAR\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.VOTERID\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.DRIVING\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.PAN\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.PASSPORT\",", + " \"active\": false", + " }", + " ],", + " \"description\": \"OWNER.IDENTITYPROOF.IDENTITYPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"digit-citizen\":true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"enabledActions\": {", + " \"assess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"reassess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"update\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " },", + " \"create\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " }", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.SALEDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.GIFTDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.PATTACERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.REGISTEREDWILLDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.PARTITIONDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.COURTDECREE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.PROPERTYAUCTION\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.SUCCESSIONORDEATHCERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.FAMILYSETTLEMENT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.UNREGISTEREDWILLDEED\",", + " ", + " \"active\": true", + " }", + " ],", + " \"description\": \"OWNER.REGISTRATIONPROOF.REGISTRATIONPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"digit-citizen\":true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"filterCondition\": {", + " \"filterValue\": [", + " \"NONE\",", + " null", + " ],", + " \"jsonPath\": \"Properties[0].propertyDetails[0].owners\",", + " \"onArray\": true,", + " \"arrayAttribute\": \"ownerType\",", + " \"formDataPath\": [\"owners\"],", + " \"formArrayAttrPath\": [\"ownerType\", \"code\"]", + " },", + " \"dropdownFilter\": {", + " \"parentArrayJsonPath\": \"Properties[0].propertyDetails[0].owners\",", + " \"parentJsonpath\": \"ownerType\",", + " \"onArray\": true,", + " \"formArrayAttrPath\": [\"ownerType\", \"code\"],", + " \"formDataPath\": [\"owners\"]", + " },", + " \"enabledActions\": {", + " \"assess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"reassess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"update\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"create\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " }", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.SERVICEDOCUMENT\",", + " \"active\": true,", + " \"parentValue\": [", + " \"FREEDOMFIGHTER\",", + " \"DEFENSE\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.HANDICAPCERTIFICATE\",", + " \"active\": true,", + " \"parentValue\": [", + " \"HANDICAPPED\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.BPLDOCUMENT\",", + " \"active\": true,", + " \"parentValue\": [", + " \"BPL\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.DEATHCERTIFICATE\",", + " \"active\": true,", + " \"parentValue\": [", + " \"WIDOW\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.GENERALID\",", + " \"active\": true,", + " \"parentValue\": [", + " \"GENERAL\"", + " ]", + " }", + " ],", + " \"description\": \"OWNER.SPECIALCATEGORYPROOF.SPECIALCATEGORYPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.USAGEPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"digit-citizen\":true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"dropdownFilter\": {", + " \"parentJsonpath\": \"Properties[0].propertyDetails[0].usageCategoryMinor\",", + " \"formDataPath\": [\"usageCategoryMinor\",\"code\"]", + " },", + " \"enabledActions\": {", + " \"assess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"reassess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"update\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " },", + " \"create\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " }", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.USAGEPROOF.ELECTRICITYBILL\",", + " \"active\": true,", + " \"parentValue\": [", + " null,", + " \"OFFICESPACE\",", + " \"OTHERS\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.USAGEPROOF.TRADELICENCE\",", + " \"active\": true,", + " \"parentValue\": [", + " \"INDUSTRIAL\",", + " \"COMMERCIAL\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.USAGEPROOF.INSTITUTEREGISTRATIONDOCUMENT\",", + " \"active\": true,", + " \"parentValue\": [", + " \"INSTITUTIONAL\"", + " ]", + " }", + " ],", + " \"description\": \"OWNER.USAGEPROOF.USAGEPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.CONSTRUCTIONPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"digit-citizen\":true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"filterCondition\": {", + " \"filterValue\": [", + " \"VACANT\"", + " ],", + " \"jsonPath\": \"Properties[0].propertyDetails[0].propertyType\",", + " \"formDataPath\":[\"propertyType\",\"code\"],", + " \"onArray\": false", + " },", + " \"enabledActions\": {", + " \"assess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"reassess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"update\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " },", + " \"create\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " }", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.CONSTRUCTIONPROOF.BPACERTIFICATE\",", + " \"active\": true", + " }", + " ],", + " \"description\": \"OWNER.CONSTRUCTIONPROOF.CONSTRUCTIONPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.OCCUPANCYPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": true,", + " \"active\": true,", + " \"digit-citizen\":true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"filterCondition\": {", + " \"filterValue\": [", + " \"SELFOCCUPIED\",", + " \"UNOCCUPIED\"", + " ],", + " \"jsonPath\": \"Properties[0].propertyDetails[0].units\",", + " \"onArray\": true,", + " \"arrayAttribute\": \"occupancyType\",", + " \"formDataPath\": [\"units\"],", + " \"formArrayAttrPath\": [\"occupancyType\"]", + " },", + " \"enabledActions\": {", + " \"assess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"reassess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"update\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " },", + " \"create\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " }", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.OCCUPANCYPROOF.RENTAGREEMENT\",", + " \"active\": true", + " }", + " ],", + " \"description\": \"OWNER.OCCUPANCYPROOF.OCCUPANCYPROOF_DESCRIPTION\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.Documents\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.Documents", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.Documents" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data DuesOnPTMutation.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data DuesOnPTMutation.postman_collection new file mode 100644 index 00000000000..6944ce9feb7 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data DuesOnPTMutation.postman_collection @@ -0,0 +1,138 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"module\": \"WS\",", + " \"code\": \"WS\",", + " \"enabled\": true,", + " \"fetchConsumerUrl\": \"ws-services/wc/_search\",", + " \"fecthBillUrl\": \"billing-service/bill/v2/_fetchbill\"", + " },", + " {", + " \"module\": \"SW\",", + " \"code\": \"SW\",", + " \"enabled\": true,", + " \"fetchConsumerUrl\": \"sw-services/swc/_search\",", + " \"fecthBillUrl\": \"billing-service/bill/v2/_fetchbill\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.DuesOnPTMutation\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.DuesOnPTMutation", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.DuesOnPTMutation" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data FireCess.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data FireCess.postman_collection new file mode 100644 index 00000000000..bb9f847ed8e --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data FireCess.postman_collection @@ -0,0 +1,137 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"rate\": 0,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"maxAmount\": null,", + " \"fromFY\": \"2014-15\",", + " \"dynamicFirecess\": true,", + " \"dynamicRates\": {", + " \"firecess_inflammable\": 5,", + " \"firecess_building_height\": 2,", + " \"firecess_category_major\": 5", + " }", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.FireCess\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.FireCess", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.FireCess" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Floor.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Floor.postman_collection new file mode 100644 index 00000000000..87f765e5e3d --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Floor.postman_collection @@ -0,0 +1,226 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Fourth Basement\",", + " \"code\": \"-4\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Third Basement\",", + " \"code\": \"-3\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Second Basement\",", + " \"code\": \"-2\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"First Basement\",", + " \"code\": \"-1\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Ground Floor\",", + " \"code\": \"0\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"First Floor\",", + " \"code\": \"1\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Second Floor\",", + " \"code\": \"2\",", + " \"description\": \"property unoccupied\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Third Floor\",", + " \"code\": \"3\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Fourth Floor\",", + " \"code\": \"4\",", + " \"description\": \"property unoccupied\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Fifth Floor\",", + " \"code\": \"5\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Sixth Floor\",", + " \"code\": \"6\",", + " \"description\": \"property unoccupied\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Seventh Floor\",", + " \"code\": \"7\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Eighth Floor\",", + " \"code\": \"8\",", + " \"description\": \"property unoccupied\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Nineth Floor\",", + " \"code\": \"9\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Tenth Floor\",", + " \"code\": \"10\",", + " \"description\": \"property unoccupied\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Eleventh Floor\",", + " \"code\": \"11\",", + " \"description\": \"property unoccupied\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Twelveth Floor\",", + " \"code\": \"12\",", + " \"description\": \"property unoccupied\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.Floor\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.Floor", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.Floor" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Interest.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Interest.postman_collection new file mode 100644 index 00000000000..0aa11086940 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Interest.postman_collection @@ -0,0 +1,172 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"rate\": 18,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"maxAmount\": null,", + " \"fromFY\": \"2015-16\",", + " \"startingDay\": \"1/01/2016\"", + " },", + " {", + " \"rate\": 12,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"maxAmount\": null,", + " \"fromFY\": \"2015-16\",", + " \"startingDay\": \"1/04/2016\"", + " },", + " {", + " \"rate\": 4,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"maxAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"01/04/2019\"", + " },", + " {", + " \"rate\": 9,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"maxAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"11/12/2018\"", + " },", + " {", + " \"rate\": 10,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"maxAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"01/01/2024\"", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"maxAmount\": null,", + " \"fromFY\": \"2023-24\",", + " \"startingDay\": \"01/04/2024\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.Interest\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.Interest", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.Interest" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MapConfig.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MapConfig.postman_collection new file mode 100644 index 00000000000..d5110ab9a54 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MapConfig.postman_collection @@ -0,0 +1,130 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"defaultConfig\": {", + " \"lat\": 31.6160638,", + " \"lng\": 74.8978579", + " }", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.MapConfig\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.MapConfig", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.MapConfig" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationDocuments.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationDocuments.postman_collection new file mode 100644 index 00000000000..dba16f8c720 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationDocuments.postman_collection @@ -0,0 +1,310 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"OWNER.ADDRESSPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": true,", + " \"active\": true,", + " \"hasDropdown\": true,", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.ELECTRICITYBILL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.WATERBILL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.GASBILL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.AADHAAR\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.VOTERID\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.DRIVING\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.PASSPORT\",", + " \"active\": false", + " }", + " ],", + " \"description\": \"OWNER.ADDRESSPROOF.ADDRESSPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"hasDropdown\": true,", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.AADHAAR\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.VOTERID\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.DRIVING\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.PAN\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.PASSPORT\",", + " \"active\": false", + " }", + " ],", + " \"description\": \"OWNER.IDENTITYPROOF.IDENTITYPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT\",", + " \"documentType\": \"OWNER\",", + " \"required\": true,", + " \"active\": true,", + " \"hasDropdown\": true,", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.SALEDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.GIFTDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.PATTACERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.REGISTEREDWILLDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.PARTITIONDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.COURTDECREE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.PROPERTYAUCTION\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.SUCCESSIONORDEATHCERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.FAMILYSETTLEMENT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.UNREGISTEREDWILLDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.CORRECTIONINNAME\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.CHANGEINOWNERSPECIALCATEGORY\",", + " \"active\": true", + " }", + " ],", + " \"description\": \"OWNER.TRANSFERREASONDOCUMENT.TRANSFERREASONDOCUMENT_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"filterCondition\": {", + " \"filterValue\": [", + " \"NONE\"", + " ],", + " \"jsonPath\": \"Property.ownersTemp\",", + " \"onArray\": true,", + " \"arrayAttribute\": \"ownerType\"", + " },", + " \"dropdownFilter\": {", + " \"parentArrayJsonPath\": \"Property.ownersTemp\",", + " \"parentJsonpath\": \"ownerType\"", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.SERVICEDOCUMENT\",", + " \"active\": true,", + " \"parentValue\": [", + " \"FREEDOMFIGHTER\",", + " \"DEFENSE\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.HANDICAPCERTIFICATE\",", + " \"active\": true,", + " \"parentValue\": [", + " \"HANDICAPPED\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.BPLDOCUMENT\",", + " \"active\": true,", + " \"parentValue\": [", + " \"BPL\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.DEATHCERTIFICATE\",", + " \"active\": true,", + " \"parentValue\": [", + " \"WIDOW\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.GENERALID\",", + " \"active\": true,", + " \"parentValue\": [", + " \"GENERAL\"", + " ]", + " }", + " ],", + " \"description\": \"OWNER.SPECIALCATEGORYPROOF.SPECIALCATEGORYPROOF_DESCRIPTION\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.MutationDocuments\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.MutationDocuments", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.MutationDocuments" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationPenalty.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationPenalty.postman_collection new file mode 100644 index 00000000000..5aa4bbf5d3e --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationPenalty.postman_collection @@ -0,0 +1,165 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"rate\": 10,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"1/01/2018\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2015-16\",", + " \"startingDay\": \"1/04/2016\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + "", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"11/12/2018\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2019-20\",", + " \"startingDay\": \"26/09/2019\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2020-21\",", + " \"startingDay\": \"26/09/2020\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.MutationPenalty\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.MutationPenalty", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.MutationPenalty" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationReason.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationReason.postman_collection new file mode 100644 index 00000000000..c7096f32ad9 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationReason.postman_collection @@ -0,0 +1,172 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"SALEDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"GIFTDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"PATTACERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"REGISTEREDWILLDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"PARTITIONDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"COURTDECREE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"PROPERTYAUCTION\",", + " \"active\": true", + " },", + " {", + " \"code\": \"SUCCESSIONORDEATHCERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"FAMILYSETTLEMENT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"UNREGISTEREDWILLDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"CORRECTIONINNAME\",", + " \"active\": true", + " },", + " {", + " \"code\": \"CHANGEINOWNERSPECIALCATEGORY\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.MutationReason\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.MutationReason", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.MutationReason" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationRebate.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationRebate.postman_collection new file mode 100644 index 00000000000..68df34a8e6f --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationRebate.postman_collection @@ -0,0 +1,149 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"rate\": 10,", + " \"maxAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"endingDay\": \"25/09\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + "", + " },", + " {", + " \"rate\": 10,", + " \"maxAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2019-20\",", + " \"endingDay\": \"25/09\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + " },", + " {", + " \"rate\": 10,", + " \"maxAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2020-21\",", + " \"endingDay\": \"26/09\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.MutationRebate\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.MutationRebate", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.MutationRebate" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OccupancyType.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OccupancyType.postman_collection new file mode 100644 index 00000000000..bd7e253f8f6 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OccupancyType.postman_collection @@ -0,0 +1,139 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Tenanted/ Rented\",", + " \"code\": \"RENTED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Self-Occupied\",", + " \"code\": \"SELFOCCUPIED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Unoccupied\",", + " \"code\": \"UNOCCUPIED\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.OccupancyType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.OccupancyType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.OccupancyType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerShipCategory.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerShipCategory.postman_collection new file mode 100644 index 00000000000..c3e45b52935 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerShipCategory.postman_collection @@ -0,0 +1,175 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Individual(s)\",", + " \"code\": \"INDIVIDUAL\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Institutional - Private \",", + " \"code\": \"INSTITUTIONALPRIVATE\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Institutional - Government\",", + " \"code\": \"INSTITUTIONALGOVERNMENT\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Individual - SingleOwner\",", + " \"code\": \"INDIVIDUAL.SINGLEOWNER\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Multiple Owners\",", + " \"code\": \"INDIVIDUAL.MULTIPLEOWNERS\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Private Company\",", + " \"code\": \"INSTITUTIONALPRIVATE.PRIVATECOMPANY\",", + " \"active\": true", + " },", + " {", + " \"name\": \"NGO\",", + " \"code\": \"INSTITUTIONALPRIVATE.NGO\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Private Trust\",", + " \"code\": \"INSTITUTIONALPRIVATE.PRIVATETRUST\",", + " \"active\": true", + " },", + " ", + " {", + " \"name\": \"ULB Government\",", + " \"code\": \"INSTITUTIONALGOVERNMENT.ULBGOVERNMENT\",", + " \"active\": true", + " },", + " {", + " \"name\": \"State Government\",", + " \"code\": \"INSTITUTIONALGOVERNMENT.STATEGOVERNMENT\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.OwnerShipCategory\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.OwnerShipCategory", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.OwnerShipCategory" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerType.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerType.postman_collection new file mode 100644 index 00000000000..46b0b7fb501 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerType.postman_collection @@ -0,0 +1,196 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Freedom Fighter\",", + " \"code\": \"FREEDOMFIGHTER\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": null,", + " \"flatAmount\": null", + " }", + " },", + " {", + " \"name\": \"Widow\",", + " \"code\": \"WIDOW\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": null,", + " \"maxAmount\": null,", + " \"flatAmount\": 5000.0", + " }", + " },", + " {", + " \"name\": \"Handicapped Person\",", + " \"code\": \"HANDICAPPED\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": null,", + " \"maxAmount\": null,", + " \"flatAmount\": 5000.0", + " }", + " },", + " {", + " \"name\": \"Below Poverty Line\",", + " \"code\": \"BPL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100.0,", + " \"maxAmount\": null,", + " \"flatAmount\": null", + " }", + " },", + " {", + " \"name\": \"Defense Personnel\",", + " \"code\": \"DEFENSE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100.0,", + " \"maxAmount\": null,", + " \"flatAmount\": null", + " }", + " },", + " {", + " \"name\": \"General\",", + " \"code\": \"GENERAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100.0,", + " \"maxAmount\": null,", + " \"flatAmount\": null", + " }", + " },", + " {", + " \"name\": \"None of the above\",", + " \"code\": \"NONE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.OwnerType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.OwnerType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.OwnerType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerTypeDocument.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerTypeDocument.postman_collection new file mode 100644 index 00000000000..a4ac7caf026 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerTypeDocument.postman_collection @@ -0,0 +1,161 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Certificate issued by DC/ Competent Authority\",", + " \"code\": \"COMPETENTAUTHORITY\",", + " \"ownerTypeCode\": \"FREEDOMFIGHTER\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Death Certificate\",", + " \"code\": \"DEATHCERTIFICATE\",", + " \"ownerTypeCode\": \"WIDOW\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Certificate of Handicap by the competent authority\",", + " \"code\": \"HANDICAPCERTIFICATE\",", + " \"ownerTypeCode\": \"HANDICAPPED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"BPL card\",", + " \"code\": \"BPLCARD\",", + " \"ownerTypeCode\": \"BPL\",", + " \"active\": true", + " ", + " },", + " {", + " \"name\": \"Defence ID proof\",", + " \"code\": \"DEFENCEID\",", + " \"ownerTypeCode\": \"DEFENSE\",", + " \"active\": true", + " },", + " {", + " \"name\": \"General ID proof\",", + " \"code\": \"GENERALID\",", + " \"ownerTypeCode\": \"GENERAL\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.OwnerTypeDocument\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.OwnerTypeDocument", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.OwnerTypeDocument" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PTApplication.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PTApplication.postman_collection new file mode 100644 index 00000000000..803585904f9 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PTApplication.postman_collection @@ -0,0 +1,146 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"creationReason\": \"MUTATION\",", + " \"businessService\": \"PT.MUTATION\",", + " \"action\": \"OPEN\",", + " \"editAction\": \"REOPEN\"", + " },", + " {", + " \"creationReason\": \"CREATE\",", + " \"businessService\": \"PT.CREATE\",", + " \"action\": \"OPEN\",", + " \"editAction\": \"REOPEN\"", + " }, {", + " \"creationReason\": \"UPDATE\",", + " \"businessService\": \"PT.UPDATE\",", + " \"action\": \"OPEN\",", + " \"editAction\": \"REOPEN\"", + " }, {", + " \"creationReason\": \"LEGACY_ENTRY\",", + " \"businessService\": \"PT.LEGACY\",", + " \"action\": \"OPEN\",", + " \"editAction\": \"REOPEN\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.PTApplication\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.PTApplication", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.PTApplication" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PTWorkflow.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PTWorkflow.postman_collection new file mode 100644 index 00000000000..2ca6635ada9 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PTWorkflow.postman_collection @@ -0,0 +1,136 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"businessService\":\"PT.CREATEWITHWNS\",", + " \"initialAction\":\"OPEN\",", + " \"inWorkflowStatusAllowed\":false,", + " \"enable\":false", + " },", + " {", + " \"businessService\":\"PT.CREATE\",", + " \"initialAction\":\"open\",", + " \"inWorkflowStatusAllowed\":true,", + " \"enable\":true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.PTWorkflow\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.PTWorkflow", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.PTWorkflow" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Penalty.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Penalty.postman_collection new file mode 100644 index 00000000000..7dabd7acae1 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Penalty.postman_collection @@ -0,0 +1,152 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"rate\": 10,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"1/01/2018\"", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2015-16\",", + " \"startingDay\": \"1/04/2016\"", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"11/12/2018\"", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2023-24\",", + " \"startingDay\": \"31/12/2023\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.Penalty\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.Penalty", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.Penalty" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PropertyAge.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PropertyAge.postman_collection new file mode 100644 index 00000000000..b8aa44ed283 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PropertyAge.postman_collection @@ -0,0 +1,139 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"less than 10 year\",", + " \"code\": \"<10year\",", + " \"active\": true", + " },", + " {", + " \"name\": \"greater than 15 year \",", + " \"code\": \">15year\",", + " \"active\": true", + " },", + " {", + " \"name\": \"greater than 25 year\",", + " \"code\": \">25year\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.PropertyAge\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.PropertyAge", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.PropertyAge" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PropertyType.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PropertyType.postman_collection new file mode 100644 index 00000000000..ef4c94e4927 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PropertyType.postman_collection @@ -0,0 +1,146 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Vacant Land\",", + " \"code\": \"VACANT\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Built Up\",", + " \"code\": \"BUILTUP\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Flat/Part of the building\",", + " \"code\": \"BUILTUP.SHAREDPROPERTY\",", + " \"active\": true,", + " \"propertyType\": \"BUILTUP\"", + " },", + " {", + " \"name\": \"Independent Building\",", + " \"code\": \"BUILTUP.INDEPENDENTPROPERTY\",", + " \"active\": true,", + " \"propertyType\": \"BUILTUP\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.PropertyType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.PropertyType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.PropertyType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ReasonForTransfer.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ReasonForTransfer.postman_collection new file mode 100644 index 00000000000..3236c82183d --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ReasonForTransfer.postman_collection @@ -0,0 +1,184 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Sale Deed\",", + " \"code\": \"SALEDEED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Gift Deed\",", + " \"code\": \"GIFTDEED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Patta Certificate\",", + " \"code\": \"PATTACERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Registered will deed\",", + " \"code\": \"REGISTEREDWILLDEED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Partition Deed\",", + " \"code\": \"PARTITIONDEED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Court Decree\",", + " \"code\": \"COURTDECREE\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Property Auction\",", + " \"code\": \"PROPERTYAUCTION\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Succession or Death Certificate\",", + " \"code\": \"SUCCESSIONORDEATHCERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Family Settlement\",", + " \"code\": \"FAMILYSETTLEMENT\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Unregistered Will deed\",", + " \"code\": \"UNREGISTEREDWILLDEED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Correction in Name\",", + " \"code\": \"CORRECTIONINNAME\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Change in Owner Special Category\",", + " \"code\": \"CHANGEINOWNERSPECIALCATEGORY\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.ReasonForTransfer\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.ReasonForTransfer", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.ReasonForTransfer" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data RentalDetails.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data RentalDetails.postman_collection new file mode 100644 index 00000000000..1046702b7c6 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data RentalDetails.postman_collection @@ -0,0 +1,129 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Tax is 7.5% of the annual rent for the rented part of the property.\",", + " \"code\": \"7_5_PERCENTTAX\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.RentalDetails\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.RentalDetails", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.RentalDetails" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data SubOwnerShipCategory.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data SubOwnerShipCategory.postman_collection new file mode 100644 index 00000000000..48612004ca1 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data SubOwnerShipCategory.postman_collection @@ -0,0 +1,190 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Single Owner\",", + " \"code\": \"SINGLEOWNER\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INDIVIDUAL\"", + " },", + " {", + " \"name\": \"Multiple Owners\",", + " \"code\": \"MULTIPLEOWNERS\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INDIVIDUAL\"", + " },", + " {", + " \"name\": \"Private Company\",", + " \"code\": \"PRIVATECOMPANY\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALPRIVATE\"", + " },", + " {", + " \"name\": \"NGO\",", + " \"code\": \"NGO\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALPRIVATE\"", + " },", + " {", + " \"name\": \"Private Trust\",", + " \"code\": \"PRIVATETRUST\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALPRIVATE\"", + " },", + " {", + " \"name\": \"Private Board\",", + " \"code\": \"PRIVATEBOARD\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALPRIVATE\"", + " },", + " {", + " \"name\": \"ULB Government\",", + " \"code\": \"ULBGOVERNMENT\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALGOVERNMENT\"", + " },", + " {", + " \"name\": \"State Government\",", + " \"code\": \"STATEGOVERNMENT\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALGOVERNMENT\"", + " },", + " {", + " \"name\": \"Central Government\",", + " \"code\": \"CENTRALGOVERNMENT\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALGOVERNMENT\"", + " },", + " {", + " \"name\": \"Others - Private Instituition\",", + " \"code\": \"OTHERSPRIVATEINSTITUITION\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALPRIVATE\"", + " },", + " {", + " \"name\": \"Others - Government Instituition\",", + " \"code\": \"OTHERGOVERNMENTINSTITUITION\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALGOVERNMENT\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.SubOwnerShipCategory\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.SubOwnerShipCategory", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.SubOwnerShipCategory" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UpdateNumber.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UpdateNumber.postman_collection new file mode 100644 index 00000000000..703367f17dc --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UpdateNumber.postman_collection @@ -0,0 +1,158 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"invalidPattern\": \"^[6789][0-9]{9}$\",", + " \"invalidNumber\": \"9999999999\",", + " \"warningEnabled\": true,", + " \"skipEnabled\": true,", + " \"documents\": [", + " {", + " \"active\": true,", + " \"code\": \"OWNER.DULYSIGNED\",", + " \"description\": \"OWNER.DULYSIGNED_DESCRIPTION\",", + " \"documentType\": \"DULYSIGNED\",", + " \"dropdownData\": [],", + " \"hasDropdown\": false,", + " \"required\": false,", + " \"inputProps\": {", + " \"accept\": \"image/*, .pdf, .png, .jpeg\"", + " },", + " \"maxFileSize\": 5000", + " },", + " {", + " \"active\": true,", + " \"code\": \"OWNER.IDENTITYPROOF\",", + " \"description\": \"OWNER.IDENTITYPROOF_DESCRIPTION\",", + " \"documentType\": \"IDENTITYPROOF\",", + " \"dropdownData\": [],", + " \"hasDropdown\": false,", + " \"required\": false,", + " \"inputProps\": {", + " \"accept\": \"image/*, .pdf, .png, .jpeg\"", + " },", + " \"maxFileSize\": 5000", + " }", + " ]", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.UpdateNumber\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.UpdateNumber", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.UpdateNumber" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategoryMajor.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategoryMajor.postman_collection new file mode 100644 index 00000000000..9014c05bc3f --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategoryMajor.postman_collection @@ -0,0 +1,142 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Residential\",", + " \"code\": \"RESIDENTIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"NonResidential\",", + " \"code\": \"NONRESIDENTIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Mixed\",", + " \"code\": \"MIXED\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.UsageCategoryMajor\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.UsageCategoryMajor", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.UsageCategoryMajor" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategoryMinor.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategoryMinor.postman_collection new file mode 100644 index 00000000000..67717fc1632 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategoryMinor.postman_collection @@ -0,0 +1,172 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Commercial\",", + " \"code\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"usageCategoryMajor\": \"NONRESIDENTIAL\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Industrial\",", + " \"code\": \"INDUSTRIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"usageCategoryMajor\": \"NONRESIDENTIAL\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Institutional\",", + " \"code\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"usageCategoryMajor\": \"NONRESIDENTIAL\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Others\",", + " \"code\": \"OTHERS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"usageCategoryMajor\": \"NONRESIDENTIAL\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.UsageCategoryMinor\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.UsageCategoryMinor", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.UsageCategoryMinor" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategorySubMinor.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategorySubMinor.postman_collection new file mode 100644 index 00000000000..88db09dd553 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategorySubMinor.postman_collection @@ -0,0 +1,384 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Retail\",", + " \"code\": \"RETAIL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Hotels\",", + " \"code\": \"HOTELS\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Office Space\",", + " \"code\": \"OFFICESPACE\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Event Space \",", + " \"code\": \"EVENTSPACE\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Food Joints\",", + " \"code\": \"FOODJOINTS\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Statutory\",", + " \"code\": \"STATUTORY\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Entertainment\",", + " \"code\": \"ENTERTAINMENT\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Medical Facility\",", + " \"code\": \"MEDICALFACILITY\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Other Commercial Usage \",", + " \"code\": \"OTHERCOMMERCIALSUBMINOR\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Godown / Warehouse\",", + " \"code\": \"WAREHOUSE\",", + " \"usageCategoryMinor\": \"INDUSTRIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Manufacturing Facility\",", + " \"code\": \"MANUFACTURINGFACILITY\",", + " \"usageCategoryMinor\": \"INDUSTRIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Other Industrial Usage \",", + " \"code\": \"OTHERINDUSTRIALSUBMINOR\",", + " \"usageCategoryMinor\": \"INDUSTRIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Educational\",", + " \"code\": \"EDUCATIONAL\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Educational(govt. aided)\",", + " \"code\": \"EDUCATIONALGOVAIDED\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Recreational Space\",", + " \"code\": \"RECREATIONAL\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Others(care giving facilities)\",", + " \"code\": \"HOMESFORSPECIALCARE\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Religious Instituition\",", + " \"code\": \"RELIGIOUSINSTITUTION\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Stray Animal Care Center\",", + " \"code\": \"ANIMALCARE\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Historical Building\",", + " \"code\": \"HISTORICAL\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Public Facility\",", + " \"code\": \"PUBLICFACILITY\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Other Institutional Usage \",", + " \"code\": \"OTHERINSTITUTIONALSUBMINOR\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Public Spaces\",", + " \"code\": \"PUBLICSPACES\",", + " \"usageCategoryMinor\": \"OTHERS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": null", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.UsageCategorySubMinor\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.UsageCategorySubMinor", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.UsageCategorySubMinor" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data. UsageCategorypostman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data. UsageCategorypostman_collection new file mode 100644 index 00000000000..b7cdebee4af --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data. UsageCategorypostman_collection @@ -0,0 +1,794 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Residential\",", + " \"code\": \"RESIDENTIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"NonResidential\",", + " \"code\": \"NONRESIDENTIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Mixed\",", + " \"code\": \"MIXED\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Commercial\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Industrial\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Institutional\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Other Non-Residential\",", + " \"code\": \"NONRESIDENTIAL.OTHERS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Retail\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Hotels\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.HOTELS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Office Space\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.OFFICESPACE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Food Joints\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.FOODJOINTS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Educational\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Educational(govt. aided)\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONALGOVAIDED\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Recreational Space\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RECREATIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Others(care giving facilities)\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.HOMESFORSPECIALCARE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Other Institutional Usage \",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.OTHERINSTITUTIONALSUBMINOR\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Public Facility\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.PUBLICFACILITY\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Religious Instituition\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RELIGIOUSINSTITUTION\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Godown/Warehouse\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.WAREHOUSE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Other Commercial Usage\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.OTHERCOMMERCIALSUBMINOR\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Manufacturing Facility\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.MANUFACTURINGFACILITY\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Showroom\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.SHOWROOM\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Malls\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.MALLS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"AC Restaurant\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.FOODJOINTS.ACRESTAURANT\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Non AC Restaurant\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.FOODJOINTS.NONACRESTAURANT\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Grocery Store\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.GROCERY\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Godown/Warehouse\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.WAREHOUSE.WAREHOUSE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Manufacturing Facility\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.MANUFACTURINGFACILITY.MANUFACTURINGFACILITY\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"College\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONAL.COLLEGES\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Community Hall\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.PUBLICFACILITY.COMMUNITYHALL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Pharmacy\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.PHARMACY\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Marriage Palace\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.EVENTSPACE.MARRIAGEPALACE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Multiplex \",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.ENTERTAINMENT.MULTIPLEX\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Movie Theatre\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.ENTERTAINMENT.MOVIETHEATRE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Statutory Organisation\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.STATUTORY.STATUTORYORGANISATION\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Private Hospital\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.MEDICALFACILITY.PVTHOSPITAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Private Dispensary\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.MEDICALFACILITY.PVTDISPENSARY\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Other Commercial Usage \",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.OTHERCOMMERCIALSUBMINOR.OTHERCOMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Other Industrial Usage \",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.OTHERINDUSTRIALSUBMINOR.OTHERINDUSTRIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"School\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONAL.SCHOOL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Training Institute\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONAL.TRAININGINSTITUTES\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Polytechnic\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONAL.POLYTECHNICS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Other Private Educational Institute\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONAL.OTHEREDUCATIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Govt. Aided Educational Institute\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONALGOVAIDED.GOVAIDEDEDUCATIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Others \",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.OTHERINSTITUTIONALSUBMINOR.OTHERINSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Sports Stadium\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RECREATIONAL.SPORTSSTADIUM\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Social Club\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RECREATIONAL.SOCIALCLUB\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Golf Club \",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RECREATIONAL.GOLFCLUB\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Orphanage\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.HOMESFORSPECIALCARE.ORPHANAGE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Old Age Homes\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.HOMESFORSPECIALCARE.OLDAGEHOMES\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Home for the disabled / destitute\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.HOMESFORSPECIALCARE.DISABLEDHOME\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Stray Animal Care Center\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.HOMESFORSPECIALCARE.ANIMALCARE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Govt. Hospital & Dispensary\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.PUBLICFACILITY.GOVTHOSPITAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Religious\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RELIGIOUSINSTITUITION.RELIGIOUS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Historical Building\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.HISTORICAL.HISTORICAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Public Libraries\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.PUBLICFACILITY.LIBRARIES\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Cremation/ Burial Ground\",", + " \"code\": \"NONRESIDENTIAL.OTHERS.PUBLICSPACES.CREMATION/BURIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Office Spaces\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.OFFICESPACES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Medical facility\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.MEDICALFACILITY\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Manufacturing Facility\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.MANUFACTURINGFACILITIES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Others\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.OTHERS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Religious\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RELIGIOUS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Public Spaces\",", + " \"code\": \"NONRESIDENTIAL.OTHERS.PUBLICSPACES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Educational (Govt. aided)\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONALGOVT\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Grocery & Supermarkets\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.GROCERY&SUPERMARKETS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Establishment in Malls\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.ESTABLISHMENTINMALLS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Establishment in Multiplex\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.ESTABLISHMENTINMULTIPLEX\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Other Retail Stores\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.OTHERRETAILSTORES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"2 Star or below\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.HOTELS.2STARORBELOW\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"3 Star and Above\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.HOTELS.3STARANDABOVE\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Resorts\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.HOTELS.RESORTS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Office spaces\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.OFFICESPACES.OFFICESPACES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Community Halls\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.EVENTSPACES.COMMUNITYHALLS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Other Food Outlets\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.FOODJOINTS.OTHERFOODOUTLETS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Gaming Centre\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.ENTERTAINMENT.GAMINGCENTRE\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Hospital\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.MEDICALFACILITY.HOSPITAL\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Dispensary\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.MEDICALFACILITY.DISPENSARY\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Other Storage Facilities\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.WAREHOUSE.OTHERSTORAGEFACILITIES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Industries\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.MANUFACTURINGFACILITIES.INDUSTRIES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Orphanage\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.OTHERS.ORPHANAGE\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Old age homes\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.OTHERS.OLDAGEHOMES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Stray Animal Care Center\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.OTHERS.STRAYANIMALCARECENTER\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Home for the disabled\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.OTHERS.HOMEFORTHEDISABLED\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Bus Stands & Railway Station\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.PUBLICFACILITY.BUSSTANDS&RAILWAYSTATION\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Religious\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RELIGIOUS.RELIGIOUS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Parks\",", + " \"code\": \"NONRESIDENTIAL.OTHERS.PUBLICSPACES.PARKS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"School\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONALGOVT.SCHOOL\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Colleges\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONALGOVT.COLLEGES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Training Institutes\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONALGOVT.TRAININGINSTITUTES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Polytechnics\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONALGOVT.POLYTECHNICS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.UsageCategory\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.UsageCategory", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.UsageCategory" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/PropertyTax.CancerCess b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/PropertyTax.CancerCess new file mode 100644 index 00000000000..84f7a895922 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/PropertyTax.CancerCess @@ -0,0 +1,38 @@ +curl --location 'http://localhost:8094/mdms-v2/v2/_create/PropertyTax.CancerCess' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "action": null, + "did": null, + "key": null, + "msgId": "search with from and to values", + "authToken": "dfcca143-b5a6-4726-b5cd-c2c949cb0f2b", + "correlationId": null, + "userInfo": { + "id": "1", + "userName": null, + "name": null, + "type": null, + "mobileNumber": null, + "emailId": null, + "roles": null, + "uuid": "40dceade-992d-4a8f-8243-19dda76a4171" + } + }, + "Mdms": { + "tenantId": "pg", + "schemaCode": "PropertyTax.CancerCess", + "data": { + "rate": 5, + "minAmount": null, + "flatAmount": null, + "maxAmount": null, + "fromFY": "2015-16" + }, + "isActive": true + } +}' + diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/PropertyTax.ChargeSlabs b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/PropertyTax.ChargeSlabs new file mode 100644 index 00000000000..2f3bf86a190 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/PT/PropertyTax.ChargeSlabs @@ -0,0 +1,36 @@ +curl --location 'http://localhost:8094/mdms-v2/v2/_create/PropertyTax.ChargeSlabs' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "action": null, + "did": null, + "key": null, + "msgId": "search with from and to values", + "authToken": "dfcca143-b5a6-4726-b5cd-c2c949cb0f2b", + "correlationId": null, + "userInfo": { + "id": "1", + "userName": null, + "name": null, + "type": null, + "mobileNumber": null, + "emailId": null, + "roles": null, + "uuid": "40dceade-992d-4a8f-8243-19dda76a4171" + } + }, + "Mdms": { + "tenantId": "pg", + "schemaCode": "PropertyTax.ChargeSlabs", + "data": { + "name": "2 / Sq.Yards", + "code": "PT_CHARGE_SLAB_0", + "floorNo": 0, + "active": true + }, + "isActive": true + } +}' diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy AccessoriesCategory.postman_collection.json b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy AccessoriesCategory.postman_collection.json new file mode 100644 index 00000000000..ce7b393813f --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy AccessoriesCategory.postman_collection.json @@ -0,0 +1,149 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"ACC-1\",", + " \"uom\": \"HP\",", + " \"active\": true", + " },", + " {", + " \"code\": \"ACC-2\",", + " \"uom\": \"HP\",", + " \"active\": true", + " },", + " {", + " \"code\": \"ACC-3\",", + " \"uom\": \"HP\",", + " \"active\": true", + " },", + " {", + " \"code\": \"ACC-4\",", + " \"uom\": null,", + " \"active\": true", + " },", + " {", + " \"code\": \"ACC-5\",", + " \"uom\": null,", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.AccessoriesCategory\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.AccessoriesCategory", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.AccessoriesCategory" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy ApplicationType.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy ApplicationType.postman_collection new file mode 100644 index 00000000000..2b28befdf22 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy ApplicationType.postman_collection @@ -0,0 +1,132 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"APPLICATIONTYPE.NEW\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPLICATIONTYPE.RENEWAL\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.ApplicationType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.ApplicationType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.ApplicationType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Documents.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Documents.postman_collection new file mode 100644 index 00000000000..d7510c45cbf --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Documents.postman_collection @@ -0,0 +1,149 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"OWNER.OWNERIDPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": true,", + " \"active\": true,", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.OWNERIDPROOF\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.OWNERSHIPPROOF\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.OWNERPHOTO\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.OLDLICENCENO\",", + " \"active\": false", + " }", + " ],", + " \"description\": \"OWNER.OWNERIDPROOF.OWNERIDPROOF_DESCRIPTION\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.Documents\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.Documents", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.Documents" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Penalty.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Penalty.postman_collection new file mode 100644 index 00000000000..819a3e8deb3 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Penalty.postman_collection @@ -0,0 +1,160 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"rate\": 10,", + " \"minAmount\": 0.0,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"1/09/2018\"", + " },", + " {", + " \"rate\": 10,", + " \"minAmount\": 0.0,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2015-16\",", + " \"startingDay\": \"1/04/2016\"", + "", + " },", + " {", + " \"rate\": 10,", + " \"minAmount\": 0.0,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"1/09/2018\"", + " },", + " {", + " \"rate\": 10,", + " \"minAmount\": 0.0,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2019-20\",", + " \"startingDay\": \"1/09/2019\"", + " },", + " {", + " \"rate\": 10,", + " \"minAmount\": 0.0,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2020-21\",", + " \"startingDay\": \"1/09/2020\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.Penalty\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.Penalty", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.Penalty" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Rebate.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Rebate.postman_collection new file mode 100644 index 00000000000..5865cca562b --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Rebate.postman_collection @@ -0,0 +1,146 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"rate\": 10,", + " \"maxAmount\": null,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2018-19\",", + " \"endingDay\": \"31/03\"", + "", + " },", + " {", + " \"rate\": 10,", + " \"maxAmount\": null,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2019-20\",", + " \"endingDay\": \"31/03\"", + " },", + " {", + " \"rate\": 10,", + " \"maxAmount\": null,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2020-21\",", + " \"endingDay\": \"31/03\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.Rebate\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.Rebate", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.Rebate" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy ReminderPeriods.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy ReminderPeriods.postman_collection new file mode 100644 index 00000000000..ad0a75058da --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy ReminderPeriods.postman_collection @@ -0,0 +1,136 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"tenantId\": \"pg.citya\",", + " \"reminderInterval\": 691200000", + " },", + " {", + " \"tenantId\": \"pg.cityb\",", + " \"reminderInterval\": 12345", + " },", + " {", + " \"tenantId\": \"pg.cityc\",", + " \"reminderInterval\": 12345 ", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.ReminderPeriods\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.ReminderPeriods", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.ReminderPeriods" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy TradeRenewal.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy TradeRenewal.postman_collection new file mode 100644 index 00000000000..3292d0a64c8 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy TradeRenewal.postman_collection @@ -0,0 +1,127 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"renewalPeriod\": 7889400000", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.TradeRenewal\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.TradeRenewal", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.TradeRenewal" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy TradeType.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy TradeType.postman_collection new file mode 100644 index 00000000000..a9a84b81311 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy TradeType.postman_collection @@ -0,0 +1,6260 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Any other manufacturing or store house or plane of business not specified elsewhere form offersive or unwholees smell noise or smoke arise\",", + " \"code\": \"GOODS.MANUFACTURE.TST-1\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Atta Chakki\",", + " \"code\": \"GOODS.MANUFACTURE.TST-2\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Bitumen\",", + " \"code\": \"GOODS.MANUFACTURE.TST-10\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Blacksmith\",", + " \"code\": \"GOODS.MANUFACTURE.TST-11\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Brick Field Brick Kiln\",", + " \"code\": \"GOODS.MANUFACTURE.TST-12\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Bricks or tiles by hand power\",", + " \"code\": \"GOODS.MANUFACTURE.TST-13\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Bricks or tiles by mechanical power\",", + " \"code\": \"GOODS.MANUFACTURE.TST-14\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Charcoal Kiln\",", + " \"code\": \"GOODS.MANUFACTURE.TST-15\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Coaching centers\",", + " \"code\": \"GOODS.MANUFACTURE.TST-16\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Coppersmithy\",", + " \"code\": \"GOODS.MANUFACTURE.TST-17\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Desi Sharab\",", + " \"code\": \"GOODS.MANUFACTURE.TST-18\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dyeing Printing and Bleaching of Cloth Yarn Leather\",", + " \"code\": \"GOODS.MANUFACTURE.TST-19\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Electroplating\",", + " \"code\": \"GOODS.MANUFACTURE.TST-20\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Flour Mills\",", + " \"code\": \"GOODS.MANUFACTURE.TST-21\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Ghee\",", + " \"code\": \"GOODS.MANUFACTURE.TST-22\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Glass Bevelling ,Cutting ,Polishing\",", + " \"code\": \"GOODS.MANUFACTURE.TST-23\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Goldsmith,Sliver smith\",", + " \"code\": \"GOODS.MANUFACTURE.TST-24\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Grinding Edibles by Mechanical Process\",", + " \"code\": \"GOODS.MANUFACTURE.TST-25\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hemp\",", + " \"code\": \"GOODS.MANUFACTURE.TST-26\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Insecticide or disinfectents\",", + " \"code\": \"GOODS.MANUFACTURE.TST-27\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Jewelers\",", + " \"code\": \"GOODS.MANUFACTURE.TST-28\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Bone meat and Bone powder\",", + " \"code\": \"GOODS.RETAIL.TST-29\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"fish meat and churby\",", + " \"code\": \"GOODS.RETAIL.TST-30\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Building material construction building on hire\",", + " \"code\": \"GOODS.RETAIL.TST-31\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Item made with cement\",", + " \"code\": \"GOODS.RETAIL.TST-32\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"mentholated and denture spirit\",", + " \"code\": \"GOODS.RETAIL.TST-33\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Biri leaves\",", + " \"code\": \"GOODS.RETAIL.TST-34\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"fuel wood coke and hard coke katch kola\",", + " \"code\": \"GOODS.RETAIL.TST-35\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"teak wood other than fuel wood\",", + " \"code\": \"GOODS.RETAIL.TST-36\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"coal\",", + " \"code\": \"GOODS.RETAIL.TST-37\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"fuel wood\",", + " \"code\": \"GOODS.RETAIL.TST-38\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"A store for less than gross match up to 20\",", + " \"code\": \"GOODS.RETAIL.TST-39\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"cement\",", + " \"code\": \"GOODS.RETAIL.TST-40\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"cloth containing nylon terelene synthetic yarn Terri wool woolen\",", + " \"code\": \"GOODS.RETAIL.TST-41\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Druggist Mats and Coconut fibers\",", + " \"code\": \"GOODS.RETAIL.TST-42\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"rubber tires vehicle\",", + " \"code\": \"GOODS.RETAIL.TST-43\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Medicine and drugs\",", + " \"code\": \"GOODS.RETAIL.TST-44\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"optical Surgical goods\",", + " \"code\": \"GOODS.RETAIL.TST-45\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"machinery goods, Vbelts\",", + " \"code\": \"GOODS.RETAIL.TST-46\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"sanitary fitting \",", + " \"code\": \"GOODS.RETAIL.TST-47\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Karyana and Desi medicine\",", + " \"code\": \"GOODS.RETAIL.TST-48\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"two wheelers\",", + " \"code\": \"GOODS.RETAIL.TST-49\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"four wheelers\",", + " \"code\": \"GOODS.RETAIL.TST-50\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Panja, Kassi\",", + " \"code\": \"GOODS.RETAIL.TST-51\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"LPG Gas Cylinder and other Gas cylinder\",", + " \"code\": \"GOODS.RETAIL.TST-52\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"transformer\",", + " \"code\": \"GOODS.RETAIL.TST-53\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Muniyari General store\",", + " \"code\": \"GOODS.RETAIL.TST-54\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Watch showroom and shops\",", + " \"code\": \"GOODS.RETAIL.TST-55\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dynamite Carbonate\",", + " \"code\": \"GOODS.RETAIL.TST-56\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Nitro mixure, Sulpher Phosphors\",", + " \"code\": \"GOODS.RETAIL.TST-57\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Rags\",", + " \"code\": \"GOODS.RETAIL.TST-58\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"new By cycles and spare parts\",", + " \"code\": \"GOODS.RETAIL.TST-59\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Lottery stall and shop\",", + " \"code\": \"GOODS.RETAIL.TST-60\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Temporary stall any item\",", + " \"code\": \"GOODS.RETAIL.TST-61\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Any exhibition in Marriage palace Dharamshala,Hotel,Open place for promotion purpose\",", + " \"code\": \"GOODS.RETAIL.TST-62\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cylinder and other than LPG cylinder\",", + " \"code\": \"GOODS.RETAIL.TST-63\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"LPG Gas\",", + " \"code\": \"GOODS.RETAIL.TST-64\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"hoof horns\",", + " \"code\": \"GOODS.RETAIL.TST-65\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"raw wool and raw cotton\",", + " \"code\": \"GOODS.RETAIL.TST-66\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"skin\",", + " \"code\": \"GOODS.RETAIL.TST-67\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"yarn other than waste yarn\",", + " \"code\": \"GOODS.RETAIL.TST-68\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Skin and tallow\",", + " \"code\": \"GOODS.RETAIL.TST-69\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Camper\",", + " \"code\": \"GOODS.RETAIL.TST-70\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Resin dinner batter otherwise known as real\",", + " \"code\": \"GOODS.RETAIL.TST-71\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Kemp\",", + " \"code\": \"GOODS.RETAIL.TST-72\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"straw\",", + " \"code\": \"GOODS.RETAIL.TST-73\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Nytromixer, sulpher ,phosphorus blasting powder\",", + " \"code\": \"GOODS.RETAIL.TST-74\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"bamboos\",", + " \"code\": \"GOODS.RETAIL.TST-75\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"dry Leaves and articles made thereof Boedi Leaves\",", + " \"code\": \"GOODS.RETAIL.TST-76\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"English wine and Beer Bar\",", + " \"code\": \"GOODS.RETAIL.TST-77\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"All kinds Hosiery Machines run by Electric Motors and oil Engines\",", + " \"code\": \"GOODS.RETAIL.TST-78\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Groceries and items domestic\",", + " \"code\": \"GOODS.RETAIL.TST-79\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Furniture\",", + " \"code\": \"GOODS.RETAIL.TST-80\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cattle Feed\",", + " \"code\": \"GOODS.RETAIL.TST-81\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Fireworks\",", + " \"code\": \"GOODS.RETAIL.TST-82\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Store for unslacked lime\",", + " \"code\": \"GOODS.RETAIL.TST-83\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hydrogenated oil sugar\",", + " \"code\": \"GOODS.RETAIL.TST-84\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Matchboxes\",", + " \"code\": \"GOODS.RETAIL.TST-85\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Fireworks\",", + " \"code\": \"GOODS.RETAIL.TST-86\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"tor XRay films\",", + " \"code\": \"GOODS.RETAIL.TST-87\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Ahata\",", + " \"code\": \"GOODS.RETAIL.TST-88\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dessi Sharab\",", + " \"code\": \"GOODS.RETAIL.TST-89\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"plywood modeling, mica and glass\",", + " \"code\": \"GOODS.RETAIL.TST-90\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hosiery Goods\",", + " \"code\": \"GOODS.RETAIL.TST-91\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Bardana Store\",", + " \"code\": \"GOODS.RETAIL.TST-92\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Celluloid Plastic goods\",", + " \"code\": \"GOODS.RETAIL.TST-93\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"tor tar coal and Bitumen\",", + " \"code\": \"GOODS.RETAIL.TST-94\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"mobile, computer\",", + " \"code\": \"GOODS.RETAIL.TST-95\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"vegetable oil and hydrogenated oil shops\",", + " \"code\": \"GOODS.RETAIL.TST-96\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"electronic goods \",", + " \"code\": \"GOODS.RETAIL.TST-97\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"paper and goods made including books and magazines\",", + " \"code\": \"GOODS.RETAIL.TST-98\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Silk Cloths and Art Silk\",", + " \"code\": \"GOODS.RETAIL.TST-99\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"gun powder and cartridges\",", + " \"code\": \"GOODS.RETAIL.TST-100\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Plywood, Mica\",", + " \"code\": \"GOODS.RETAIL.TST-101\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Candle, Dhoop, Aggarwatti\",", + " \"code\": \"GOODS.RETAIL.TST-102\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dynamo, Batteries and spare parts thereof\",", + " \"code\": \"GOODS.RETAIL.TST-103\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Vartan, Crockery and Gift house\",", + " \"code\": \"GOODS.RETAIL.TST-104\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hessian Cloth Jute and goods made thereof, Packing stuff\",", + " \"code\": \"GOODS.RETAIL.TST-105\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Gold and Silver jewelries, Goldsmith\",", + " \"code\": \"GOODS.RETAIL.TST-106\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"flowers\",", + " \"code\": \"GOODS.RETAIL.TST-107\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Grass, Chara, Bhusa, Kay Powder and Turri\",", + " \"code\": \"GOODS.RETAIL.TST-108\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Oil seeds, fodder, Seeds and Cotton seeds\",", + " \"code\": \"GOODS.RETAIL.TST-109\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Leather goods Leather foam Rexon and articles\",", + " \"code\": \"GOODS.RETAIL.TST-110\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Tyre ,Tube\",", + " \"code\": \"GOODS.RETAIL.TST-111\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Insecticides, Patricides and Fertilizers\",", + " \"code\": \"GOODS.RETAIL.TST-112\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Sirki, Bann, Khazoor, Patta, Munj, Ropes and Nylon Ropes\",", + " \"code\": \"GOODS.RETAIL.TST-113\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"marble, cutting, grinding dressing polishing\",", + " \"code\": \"GOODS.RETAIL.TST-114\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Video Cassettes\",", + " \"code\": \"GOODS.RETAIL.TST-115\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"photographic films\",", + " \"code\": \"GOODS.RETAIL.TST-116\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Audio cassettes\",", + " \"code\": \"GOODS.RETAIL.TST-117\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Electric goods\",", + " \"code\": \"GOODS.RETAIL.TST-118\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Tobacco, Zarda\",", + " \"code\": \"GOODS.RETAIL.TST-221\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Leather goods Leather foam Rexon and articles\",", + " \"code\": \"GOODS.RETAIL.TST-222\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Vegetable oil and hydrogenated oil\",", + " \"code\": \"GOODS.RETAIL.TST-223\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cloth containing nylon terelene synthetic yarn Terri wool woolen\",", + " \"code\": \"GOODS.RETAIL.TST-224\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"paints turpentine all kinds spirits colours varnish thinner oil their trading\",", + " \"code\": \"GOODS.WHOLESALE.TST-119\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"For working power looms\",", + " \"code\": \"GOODS.WHOLESALE.TST-120\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"mentholated and denture spirit\",", + " \"code\": \"GOODS.WHOLESALE.TST-121\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Kerosene oil, Mobil oil crude oil grease and all kinds lubricant oil\",", + " \"code\": \"GOODS.WHOLESALE.TST-122\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"plywood modeling mica and glass\",", + " \"code\": \"GOODS.WHOLESALE.TST-123\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"fuel wood coke and hard coke katch kola\",", + " \"code\": \"GOODS.WHOLESALE.TST-124\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"teak wood other than fuel wood\",", + " \"code\": \"GOODS.WHOLESALE.TST-125\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"coal\",", + " \"code\": \"GOODS.WHOLESALE.TST-126\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"fuel wood\",", + " \"code\": \"GOODS.WHOLESALE.TST-127\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"cement\",", + " \"code\": \"GOODS.WHOLESALE.TST-128\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Bardana Store\",", + " \"code\": \"GOODS.WHOLESALE.TST-129\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Celluloid Plastic goods\",", + " \"code\": \"GOODS.WHOLESALE.TST-130\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"tor tar coal and Bitumen\",", + " \"code\": \"GOODS.WHOLESALE.TST-131\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"mobile computer\",", + " \"code\": \"GOODS.WHOLESALE.TST-132\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"sanitary fitting including GI CI Pipes SW Pipes AC Pipes Cement Pipes\",", + " \"code\": \"GOODS.WHOLESALE.TST-133\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Beer Bar\",", + " \"code\": \"GOODS.WHOLESALE.TST-134\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"English Wine and Beer Wholesale\",", + " \"code\": \"GOODS.WHOLESALE.TST-135\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"electronic goods and spare\",", + " \"code\": \"GOODS.WHOLESALE.TST-136\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"paper and goods made thereof including books and magazines\",", + " \"code\": \"GOODS.WHOLESALE.TST-137\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Silk Cloths and Art Silk\",", + " \"code\": \"GOODS.WHOLESALE.TST-138\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"gun powder and cartridges\",", + " \"code\": \"GOODS.WHOLESALE.TST-139\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Beer Bar\",", + " \"code\": \"GOODS.WHOLESALE.TST-140\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"English Wine and Beer Wholesale\",", + " \"code\": \"GOODS.WHOLESALE.TST-141\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Candle Dhoop Aggarwatti\",", + " \"code\": \"GOODS.WHOLESALE.TST-142\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"waste paper bags\",", + " \"code\": \"GOODS.WHOLESALE.TST-143\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"LPG Gas Cylinder and other Gas cylinder\",", + " \"code\": \"GOODS.WHOLESALE.TST-144\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dynamo Batteries\",", + " \"code\": \"GOODS.WHOLESALE.TST-145\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"transformer\",", + " \"code\": \"GOODS.WHOLESALE.TST-146\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Vartan Crockery and Gift house\",", + " \"code\": \"GOODS.WHOLESALE.TST-147\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hessian Cloth Jute and goods made thereof Packing stuff\",", + " \"code\": \"GOODS.WHOLESALE.TST-148\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Petrol Diesel \",", + " \"code\": \"GOODS.WHOLESALE.TST-149\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Gold and Silver jewelries Goldsmith\",", + " \"code\": \"GOODS.WHOLESALE.TST-150\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"flowers\",", + " \"code\": \"GOODS.WHOLESALE.TST-151\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Grass Chara Bhusa Kay Powder and Turri\",", + " \"code\": \"GOODS.WHOLESALE.TST-152\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Oil seeds fodder Seeds and Cotton seeds\",", + " \"code\": \"GOODS.WHOLESALE.TST-153\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cylinder and other than LPG cylinder\",", + " \"code\": \"GOODS.WHOLESALE.TST-154\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Leather goods Leather foam Rexon and articles\",", + " \"code\": \"GOODS.WHOLESALE.TST-155\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"TyreTube\",", + " \"code\": \"GOODS.WHOLESALE.TST-156\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"shuttering and pad materials for hire purposes\",", + " \"code\": \"GOODS.WHOLESALE.TST-157\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"cotton in pressed bales\",", + " \"code\": \"GOODS.WHOLESALE.TST-158\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"cloth in pressed bales\",", + " \"code\": \"GOODS.WHOLESALE.TST-159\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"raw wool and raw cotton\",", + " \"code\": \"GOODS.WHOLESALE.TST-160\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"yarn other than waste yarn\",", + " \"code\": \"GOODS.WHOLESALE.TST-161\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Insecticides Patricides and Fertilizers\",", + " \"code\": \"GOODS.WHOLESALE.TST-162\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Sirki Bann Khazoor Patta Munj Ropes and Nylon Ropes\",", + " \"code\": \"GOODS.WHOLESALE.TST-163\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"cold store\",", + " \"code\": \"GOODS.WHOLESALE.TST-164\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"marble cutting grinding dressing polishing\",", + " \"code\": \"GOODS.WHOLESALE.TST-165\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Any other store house place business not specified elsewhere\",", + " \"code\": \"GOODS.WHOLESALE.TST-166\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Video Cassettes\",", + " \"code\": \"GOODS.WHOLESALE.TST-167\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"photographic films\",", + " \"code\": \"GOODS.WHOLESALE.TST-168\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Audio cassettes\",", + " \"code\": \"GOODS.WHOLESALE.TST-169\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Electric goods\",", + " \"code\": \"GOODS.WHOLESALE.TST-170\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cattle Feed\",", + " \"code\": \"GOODS.WHOLESALE.TST-171\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"fireworks\",", + " \"code\": \"GOODS.WHOLESALE.TST-172\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Any other store house not specified elsewhere from which offensive unwholesome smell noise smoke\",", + " \"code\": \"GOODS.WHOLESALE.TST-173\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Kerosene oil Whole\",", + " \"code\": \"GOODS.WHOLESALE.TST-174\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hydrogenated oil sugars\",", + " \"code\": \"GOODS.WHOLESALE.TST-175\",", + " \"uom\": \"GALLONS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Non Dangerous Petroleum Product\",", + " \"code\": \"GOODS.WHOLESALE.TST-176\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Non Dangerous Petroleum Product\",", + " \"code\": \"GOODS.WHOLESALE.TST-177\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"fireworks\",", + " \"code\": \"GOODS.WHOLESALE.TST-178\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"carton\",", + " \"code\": \"GOODS.WHOLESALE.TST-179\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"English wine\",", + " \"code\": \"GOODS.WHOLESALE.TST-180\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dessi Sharab\",", + " \"code\": \"GOODS.WHOLESALE.TST-181\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hosiery Goods\",", + " \"code\": \"GOODS.WHOLESALE.TST-182\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Atta Chakki\",", + " \"code\": \"SERVICES.GBS.TST-183\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Printing Press\",", + " \"code\": \"SERVICES.GBS.TST-184\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Tent House\",", + " \"code\": \"SERVICES.GBS.TST-185\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cinema films\",", + " \"code\": \"SERVICES.GBS.TST-186\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Aluminium door fitting fabrivations\",", + " \"code\": \"SERVICES.GBS.TST-187\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cable operator\",", + " \"code\": \"SERVICES.GBS.TST-188\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cinema Hall\",", + " \"code\": \"SERVICES.GBS.TST-189\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Circuses, fair magic show\",", + " \"code\": \"SERVICES.GBS.TST-190\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dhabha\",", + " \"code\": \"SERVICES.GBS.TST-191\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Diesel engine services\",", + " \"code\": \"SERVICES.GBS.TST-192\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dry cleaning\",", + " \"code\": \"SERVICES.GBS.TST-193\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hotel,Restaurant\",", + " \"code\": \"SERVICES.GBS.TST-194\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"junk dealer\",", + " \"code\": \"SERVICES.GBS.TST-195\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"motel\",", + " \"code\": \"SERVICES.GBS.TST-196\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Nursing home private hospital ultra sound ,CT scan centers\",", + " \"code\": \"SERVICES.GBS.TST-197\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Public Model School\",", + " \"code\": \"SERVICES.GBS.TST-198\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Service Station, Workshop\",", + " \"code\": \"SERVICES.GBS.TST-199\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Testing Lab\",", + " \"code\": \"SERVICES.GBS.TST-200\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Watch repair\",", + " \"code\": \"SERVICES.GBS.TST-201\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Welding set\",", + " \"code\": \"SERVICES.GBS.TST-202\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"All Dhaba, Tea shop and Halwai shop\",", + " \"code\": \"SERVICES.NGBS.TST-203\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"All Hotels, Restaurant,Beer,Bar\",", + " \"code\": \"SERVICES.NGBS.TST-204\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Barbers Shop\",", + " \"code\": \"SERVICES.NGBS.TST-205\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Beauty Parlour\",", + " \"code\": \"SERVICES.NGBS.TST-206\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cinema Circus\",", + " \"code\": \"SERVICES.NGBS.TST-207\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Computer coaching,training coaching center and cyber cafe\",", + " \"code\": \"SERVICES.NGBS.TST-208\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"gym fitness center\",", + " \"code\": \"SERVICES.NGBS.TST-209\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Laundry Shop\",", + " \"code\": \"SERVICES.NGBS.TST-210\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Marriage Palaces\",", + " \"code\": \"SERVICES.NGBS.TST-211\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\": \"Nursing Homes, Private Hospital, Ultra Sound, CT Scan Centre\",", + " \"code\": \"SERVICES.NGBS.TST-212\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Painter, Flex printing, printing press Screen printing\",", + " \"code\": \"SERVICES.NGBS.TST-213\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Poultry Forms\",", + " \"code\": \"SERVICES.NGBS.TST-214\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Printing press\",", + " \"code\": \"SERVICES.NGBS.TST-215\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"property dealer\",", + " \"code\": \"SERVICES.NGBS.TST-216\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"shop tailoring running with electronic instrument\",", + " \"code\": \"SERVICES.NGBS.TST-217\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Transport and Booking Agency\",", + " \"code\": \"SERVICES.NGBS.TST-218\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Workshop\",", + " \"code\": \"SERVICES.NGBS.TST-219\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"code\": \"ARCHITECT.CLASSA\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"EXPERIENCEPROOF\"", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"BPA\",", + " \"validityPeriod\": 5", + " },", + " {", + " \"code\": \"BUILDER.CLASSA\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"EXPERIENCEPROOF\"", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"BPA\",", + " \"validityPeriod\": 5", + " },", + " {", + " \"code\": \"ENGINEER.CLASSA\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"EXPERIENCEPROOF\"", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"BPA\",", + " \"validityPeriod\": 5,", + " \"restrictions\":{", + " \"maxPlotArea\":500,", + " \"maxBulidingheight\":15,", + " \"maxFloors\":3", + " }", + " },", + " {", + " \"code\": \"STRUCTURALENGINEER.CLASSA\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"EXPERIENCEPROOF\"", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"BPA\",", + " \"validityPeriod\": 5", + " },", + " {", + " \"code\": \"TOWNPLANNER.CLASSA\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"EXPERIENCEPROOF\"", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"BPA\",", + " \"validityPeriod\": 5", + " },", + " {", + " \"code\": \"SUPERVISOR.CLASSA\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"EXPERIENCEPROOF\"", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"BPA\",", + " \"validityPeriod\": 5,", + " \"restrictions\":{", + " \"maxPlotArea\":100,", + " \"maxBulidingheight\":10,", + " \"maxFloors\":2", + " }", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.TradeType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.TradeType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.TradeType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CancelReceiptReason.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CancelReceiptReason.postman_collection new file mode 100644 index 00000000000..c3fb303d16c --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CancelReceiptReason.postman_collection @@ -0,0 +1,136 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"ERRORRECEIPT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"CHEQUEBOUNCE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OTHER\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.CancelReceiptReason\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.CancelReceiptReason", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.CancelReceiptReason" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CommonInboxConfig.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CommonInboxConfig.postman_collection new file mode 100644 index 00000000000..0ca70a648b3 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CommonInboxConfig.postman_collection @@ -0,0 +1,296 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"moduleName\": \"PT\",", + " \"BusinessService\": \"PT.CREATE\",", + " \"roles\": [\"PT_CEMP\", \"PT_DOC_VERIFIER\",\"PT_FIELD_INSPECTOR\",\"PT_APPROVER\"],", + " \"active\": false,", + " \"locality\":false,", + " \"localityModule\":\"property-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/property-tax/application-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&type=property\",", + " \"DEFAULT\": \"/employee/property-tax/application-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&type=property\"", + " }", + " },", + " {", + " \"moduleName\": \"TL\",", + " \"BusinessService\": \"NewTL\",", + " \"roles\": [\"TL_CEMP\", \"TL_DOC_VERIFIER\",\"TL_APPROVER\",\"TL_FIELD_INSPECTOR\"],", + " \"active\": false,", + " \"locality\":false,", + " \"localityModule\":\"tl-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/tradelicence/apply?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/tradelicence/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },", + " {", + " \"moduleName\": \"PT\",", + " \"BusinessService\": \"PT.UPDATE\",", + " \"roles\": [\"PT_CEMP\", \"PT_DOC_VERIFIER\",\"PT_FIELD_INSPECTOR\",\"PT_APPROVER\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"property-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/property-tax/application-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&type=updateProperty\",", + " \"DEFAULT\": \"/employee/property-tax/application-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&type=updateProperty\"", + " }", + " },", + " {", + " \"moduleName\": \"PT\",", + " \"BusinessService\": \"PT.MUTATION\",", + " \"roles\": [\"PT_CEMP\", \"PT_DOC_VERIFIER\",\"PT_FIELD_INSPECTOR\",\"PT_APPROVER\"],", + " \"active\": false,", + " \"locality\":false,", + " \"localityModule\":\"property-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/pt-mutation/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/pt-mutation/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },", + " {", + " \"moduleName\": \"TL\",", + " \"BusinessService\": \"DIRECTRENEWAL\",", + " \"roles\": [\"TL_CEMP\", \"TL_DOC_VERIFIER\",\"TL_APPROVER\",\"TL_FIELD_INSPECTOR\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"tl-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/tradelicence/apply?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/tradelicence/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },", + " {", + " \"moduleName\": \"TL\",", + " \"BusinessService\": \"EDITRENEWAL\",", + " \"roles\": [\"TL_CEMP\", \"TL_DOC_VERIFIER\",\"TL_APPROVER\",\"TL_FIELD_INSPECTOR\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"tl-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/tradelicence/apply?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/tradelicence/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },", + " {", + " \"moduleName\": \"FireNoc\",", + " \"BusinessService\": \"FIRENOC\",", + " \"roles\": [\"NOC_CEMP\", \"NOC_DOC_VERIFIER\",\"NOC_FIELD_INSPECTOR\",\"FIRE_NOC_APPROVER\",\"NOC_APPROVER\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"fireNoc\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/fire-noc/apply?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/fire-noc/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },{", + " \"moduleName\": \"BPA\",", + " \"BusinessService\": \"BPA\",", + " \"roles\": [\"BPA_ARCHITECT\", \"BPA_ENGINEER\",\"BPA_BUILDER\",\"BPA_STRUCTURALENGINEER\",\"BPA_TOWNPLANNER\",\"BPA_SUPERVISOR\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"bpa-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/egov-bpa/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/egov-bpa/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },{", + " \"moduleName\": \"BPA\",", + " \"BusinessService\": \"BPA_OC\",", + " \"roles\": [\"BPA_ARCHITECT\", \"BPA_ENGINEER\",\"BPA_BUILDER\",\"BPA_STRUCTURALENGINEER\",\"BPA_TOWNPLANNER\",\"BPA_SUPERVISOR\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"bpa-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/oc-bpa/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/oc-bpa/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },{", + " \"moduleName\": \"BPA\",", + " \"BusinessService\": \"NOC-SERVICES\",", + " \"roles\": [\"NOC_CEMP\", \"NOC_DOC_VERIFIER\",\"NOC_FIELD_INSPECTOR\",\"FIRE_NOC_APPROVER\",\"NOC_APPROVER\"],", + " \"active\": false,", + " \"locality\":false,", + " \"localityModule\":\"noc-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/noc/apply?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/noc/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },{", + " \"moduleName\": \"WNS\",", + " \"BusinessService\": \"NewWS1\",", + " \"roles\": [\"WS_CEMP\", \"WS_DOC_VERIFIER\",\"WS_FIELD_INSPECTOR\",\"WS_APPROVER\",\"WS_CLERK\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"ws-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=WATER\",", + " \"DEFAULT\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=WATER\"", + " }", + " },{", + " \"moduleName\": \"WNS\",", + " \"BusinessService\": \"NewSW1\",", + " \"roles\": [\"SW_CEMP\", \"SW_DOC_VERIFIER\",\"SW_FIELD_INSPECTOR\",\"SW_APPROVER\",\"SW_CLERK\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"sw-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=SEWERAGE\",", + " \"DEFAULT\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=SEWERAGE\"", + " }", + " },{", + " \"moduleName\": \"WNS\",", + " \"BusinessService\": \"ModifyWSConnection\",", + " \"roles\": [\"WS_CEMP\",\"WS_APPROVER\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"ws-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=WATER&mode=MODIFY\",", + " \"DEFAULT\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=WATER&mode=MODIFY\"", + " }", + " },{", + " \"moduleName\": \"WNS\",", + " \"BusinessService\": \"ModifySWConnection\",", + " \"roles\":[\"SW_CEMP\",\"SW_APPROVER\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"sw-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=SEWERAGE&mode=MODIFY\",", + " \"DEFAULT\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=SEWERAGE&mode=MODIFY\"", + " }", + " },{", + " \"moduleName\": \"PGR\",", + " \"BusinessService\": \"PGR\",", + " \"roles\":[\"GRO\",\"DGRO\",\"PGR_LME\",\"SUPERVISOR\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"pgr-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/digit-ui/employee/pgr/complaint/details/^WFBID^\",", + " \"DEFAULT\":\"/digit-ui/employee/pgr/complaint/details/^WFBID^\"", + " }", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.CommonInboxConfig\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.CommonInboxConfig", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.CommonInboxConfig" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CronJobAPIConfig.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CronJobAPIConfig.postman_collection new file mode 100644 index 00000000000..b38f644adc5 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CronJobAPIConfig.postman_collection @@ -0,0 +1,196 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"jobName\": \"daily\",", + " \"active\": \"true\",", + " \"method\": \"POST\",", + " \"url\": \"http://tl-services.egov:8080/tl-services/v1/TL/Expiry/_batch\",", + " \"payload\": {", + " \"RequestInfo\": \"{DEFAULT_REQUESTINFO}\"", + " },", + " \"header\": {", + " \"Content-Type\": \"application/json\"", + " }", + " },", + " {", + " \"jobName\": \"daily\",", + " \"active\": \"false\",", + " \"method\": \"POST\",", + " \"url\": \"http://tl-services.egov:8080/tl-services/v1/TL/Reminder/_batch\",", + " \"payload\": {", + " \"RequestInfo\": \"{DEFAULT_REQUESTINFO}\"", + " },", + " \"header\": {", + " \"Content-Type\": \"application/json\"", + " }", + " },", + " {", + " \"jobName\": \"daily\",", + " \"active\": \"false\",", + " \"method\": \"POST\",", + " \"url\": \"http://ws-calculator.egov:8080/ws-calculator/waterCalculator/_jobscheduler\",", + " \"payload\": {", + " \"RequestInfo\": \"{DEFAULT_REQUESTINFO}\"", + " },", + " \"header\": {", + " \"Content-Type\": \"application/json\"", + " }", + " },", + " {", + " \"jobName\": \"daily\",", + " \"active\": \"false\",", + " \"method\": \"POST\",", + " \"url\": \"http://sw-calculator.egov:8080/sw-calculator/sewerageCalculator/_jobscheduler\",", + " \"payload\": {", + " \"RequestInfo\": \"{DEFAULT_REQUESTINFO}\"", + " },", + " \"header\": {", + " \"Content-Type\": \"application/json\"", + " }", + " },", + " {", + " \"jobName\": \"daily\",", + " \"active\": \"false\",", + " \"method\": \"POST\",", + " \"url\": \"http://xstate-chatbot.egov:8080/xstate-chatbot/reminder\",", + " \"payload\": {", + " \"RequestInfo\": \"{DEFAULT_REQUESTINFO}\"", + " },", + " \"header\": {", + " \"Content-Type\": \"application/json\"", + " }", + " },", + " \t {", + " \"jobName\": \"daily\",", + " \"active\": \"true\",", + " \"method\": \"POST\",", + " \"url\": \"http://fsm.egov:8080/fsm/v1/_schedular\",", + " \"payload\": {", + " \"RequestInfo\": \"{DEFAULT_REQUESTINFO}\"", + " },", + " \"header\": {", + " \"Content-Type\": \"application/json\"", + " }", + "\t }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.CronJobAPIConfig\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.CronJobAPIConfig", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.CronJobAPIConfig" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data Department.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data Department.postman_collection new file mode 100644 index 00000000000..dbdaf8d960a --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data Department.postman_collection @@ -0,0 +1,189 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Street Lights\",", + " \"code\": \"DEPT_1\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Building & Roads\",", + " \"code\": \"DEPT_2\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Health & Sanitation\",", + " \"code\": \"DEPT_3\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Operation & Maintenance\",", + " \"code\": \"DEPT_4\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Horticulture\",", + " \"code\": \"DEPT_5\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Building Branch\",", + " \"code\": \"DEPT_6\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Citizen service desk\",", + " \"code\": \"DEPT_7\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Complaint Cell\",", + " \"code\": \"DEPT_8\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Executive Branch\",", + " \"code\": \"DEPT_9\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Others\",", + " \"code\": \"DEPT_10\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Tax Branch\",", + " \"code\": \"DEPT_13\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Accounts Branch\",", + " \"code\": \"DEPT_25\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Works Branch\",", + " \"code\": \"DEPT_35\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.Department\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.Department", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.Department" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data Designation.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data Designation.postman_collection new file mode 100644 index 00000000000..ee48f92d462 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data Designation.postman_collection @@ -0,0 +1,298 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"DESIG_01\",", + " \"name\": \"Superintending Engineer ( B&R)\",", + " \"description\": \"Superintending Engineer ( B&R)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_02\",", + " \"name\": \"Corporation Engineer (B&R)\",", + " \"description\": \"Corporation Engineer (B&R)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_03\",", + " \"name\": \"Asst. Engineer ( B&R)\",", + " \"description\": \"Asst. Engineer ( B&R)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_04\",", + " \"name\": \"Junior Engineer ( B&R)\",", + " \"description\": \"Junior Engineer ( B&R)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_05\",", + " \"name\": \"Land Scape Officer\",", + " \"description\": \"Land Scape Officer\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_06\",", + " \"name\": \"Superintending Engineer ( O&M)\",", + " \"description\": \"Superintending Engineer ( O&M)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_07\",", + " \"name\": \"Corporation Engineer (O&M)\",", + " \"description\": \"Corporation Engineer (O&M)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_08\",", + " \"name\": \"Asst. Engineer ( O&M)\",", + " \"description\": \"Asst. Engineer ( O&M)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_09\",", + " \"name\": \"Junior Engineer ( O&M)\",", + " \"description\": \"Junior Engineer ( O&M)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_10\",", + " \"name\": \"Superintending Engineer ( Light)\",", + " \"description\": \"Superintending Engineer ( Light)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_11\",", + " \"name\": \"Corporation Engineer (Light)\",", + " \"description\": \"Corporation Engineer (Light)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_12\",", + " \"name\": \"Junior Engineer ( Light)\",", + " \"description\": \"Junior Engineer ( Light)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_13\",", + " \"name\": \"Health Officer\",", + " \"description\": \"Health Officer\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_14\",", + " \"name\": \"Medical Officer\",", + " \"description\": \"Medical Officer\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_15\",", + " \"name\": \"Chief Sanitary Inspector\",", + " \"description\": \"Mechanical Oversear\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_16\",", + " \"name\": \"Sainitary Inspector\",", + " \"description\": \"Clerk\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_17\",", + " \"name\": \"Sainitary Supervisor\",", + " \"description\": \"Accountant\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_18\",", + " \"name\": \"Senior Town Planner\",", + " \"description\": \"Senior Town Planner\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_19\",", + " \"name\": \"Municipal Town Planner\",", + " \"description\": \"Municipal Town Planner\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_20\",", + " \"name\": \"Asst. Town Planner\",", + " \"description\": \"Asst. Town Planner\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_21\",", + " \"name\": \"Building Inspector\",", + " \"description\": \"Building Inspector\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_22\",", + " \"name\": \"Junior Enginer ( Horticulutre)\",", + " \"description\": \"Junior Enginer ( Horticulutre)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_23\",", + " \"name\": \"Citizen service representative\",", + " \"description\": \"Citizen service representative\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Deputy Controller Finance and Accounts\",", + " \"description\": \"Deputy Controller Finance and Accounts\",", + " \"code\": \"DESIG_1001\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Accountant\",", + " \"description\": \"Accountant\",", + " \"code\": \"DESIG_58\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_24\",", + " \"name\": \"Assistant Commissioner\",", + " \"description\": \"Assistant Commissioner\",", + " \"active\": true", + " }, ", + " {", + " \"name\": \"Superintendent\",", + " \"description\": \"Superintendent\",", + " \"code\": \"DESIG_47\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Accounts Officer\",", + " \"description\": \"Accounts Officer\",", + " \"code\": \"AO\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Commissioner\",", + " \"description\": \"Commissioner\",", + " \"code\": \"COMM\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.Designation\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.Designation", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.Designation" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data DocumentType.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data DocumentType.postman_collection new file mode 100644 index 00000000000..f9e387ba047 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data DocumentType.postman_collection @@ -0,0 +1,287 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"APPL.IDENTITYPROOF.AADHAAR\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.IDENTITYPROOF.PASSPORT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.IDENTITYPROOF.DRIVINGLICENSE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.ADDRESSPROOF.ELECTRICITYBILL\",", + " \"active\": true", + " },{", + " \"code\": \"APPL.ADDRESSPROOF.PASSPORT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.LTR.LTR\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.TDP.TDP\",", + " \"active\": true", + " },{", + " \"code\": \"APPL.LAC.LAC\",", + " \"active\": true", + " },{", + " \"code\": \"APPL.SSC.SSC\",", + " \"active\": true", + " },{", + " \"code\": \"APPL.LSVS.LSVS\",", + " \"active\": true", + " },{", + " \"code\": \"BPD.SITP.SITP\",", + " \"active\": true", + " },{", + " \"code\": \"BPD.RP.RP\",", + " \"active\": true", + " },{", + " \"code\": \"BPD.FP.FP\",", + " \"active\": true", + " },{", + " \"code\": \"BPD.SCP.SCP\",", + " \"active\": true", + " },{", + " \"code\": \"BPD.EP.EP\",", + " \"active\": true", + " },{", + " \"code\": \"BPD.SECP.SECP\",", + " \"active\": true", + " },{", + " \"code\": \"BPD.PP.PP\",", + " \"active\": true", + " },", + " {", + " \"code\": \"NOC.FIRE.CERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"NOC.AGRICULTURE.LANDUSE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"NOC.AGRICULTURE_WATERBODY.FTL\",", + " \"active\": true", + " },{", + " \"code\": \"FI.FIR.FIR\",", + " \"active\": true", + " },", + " {", + " \"code\": \"FI.SINS.SINS\",", + " \"active\": true", + " },{", + " \"code\": \"FI.SISS.SISS\",", + " \"active\": true", + " },", + " {", + " \"code\": \"FI.SIES.SIES\",", + " \"active\": true", + " },{", + " \"code\": \"FI.SIWS.SIWS\",", + " \"active\": true", + " },", + " {", + " \"code\": \"NOC.AIRPORT.CERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.BUILDING_DIAGRAM.SECTION_PLAN\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.BUILDING_DIAGRAM.ELEVATION_PLAN\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.BUILDING_DIAGRAM.FLOOR_PLAN\",", + " \"active\": true", + " },{", + " \"code\": \"APPL.LOCALBODY.MUNCIPAL_APPROVAL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.LOCALBODY.PANCHAYAT_APPROVAL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.LOCALBODY.DTCP_APPROVAL\",", + " \"active\": true", + " },", + " {", + " \"code\" : \"OWNERIDPROOF\",", + " \"allowedFormat\" : [\"image/*\", \".pdf\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 6000", + " },", + " {", + " \"code\" : \"OWNERSHIPPROOF\",", + " \"allowedFormat\" : [\"image/*\", \".pdf\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 6000", + " },", + " {", + " \"code\" : \"OWNERPHOTO\",", + " \"allowedFormat\" : [\"image/*\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 3000", + " },", + " {", + " \"code\" : \"OLDLICENCENO\",", + " \"allowedFormat\" : [\"image/*\", \".pdf\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 6000", + " },", + " {", + " \"code\": \"COURTORDER\",", + " \"active\": true,", + " \"allowedFormat\" : [\"image/*\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 3000", + " },", + " {", + " \"code\": \"SELFDECLARATION\",", + " \"active\": true,", + " \"allowedFormat\" : [\"image/*\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 3000", + " },", + " {", + " \"code\": \"GOVTNOTIFICATION\",", + " \"active\": true,", + " \"allowedFormat\" : [\"image/*\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 3000", + " },", + " {", + " \"code\": \"OFFICENOTEORDER\",", + " \"active\": true,", + " \"allowedFormat\" : [\"image/*\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 3000", + " },", + " {", + " \"code\": \"GOVTNOTIFICATION\",", + " \"active\": true,", + " \"allowedFormat\" : [\"image/*\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 3000", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.DocumentType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.DocumentType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.DocumentType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data GenderType.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data GenderType.postman_collection new file mode 100644 index 00000000000..3fe3535c4ad --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data GenderType.postman_collection @@ -0,0 +1,139 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"MALE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"FEMALE\",", + " \"active\": true", + " },{", + " \"code\": \"TRANSGENDER\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OTHERS\",", + " \"active\": false", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.GenderType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.GenderType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.GenderType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data IdFormat.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data IdFormat.postman_collection new file mode 100644 index 00000000000..d298a97389f --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data IdFormat.postman_collection @@ -0,0 +1,840 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"watercharges.metered.receipt.id\"", + " },", + " {", + " \"format\": \"BILL-[SEQ_EGOV_COMMON_TEST_AUTOCRE]\",", + " \"idname\": \"billnumberid\"", + " },", + " {", + " \"format\": \"PT/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"pt.receipt.id\"", + " },", + " {", + " \"format\": \"TL/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tl.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"watercharges.nonmetered.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"firenoc.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.no_dues_certificate.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.electricity_chungi.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.hoardings.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.unipolls.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.municipal_shops_rent.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.land_rent.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.tower_rent.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.parking_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.jamin_theka.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"admn.election_rally_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"admn.parking_during_election.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"admn.road_show.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.advance_provident_fund.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"st.stationary_not_income.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"st.expenditure_santitation_not_income.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.santitation_dumping_garbage.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.telecom_tower_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.electricity.code_chungi.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.draftsmen_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.compremasing_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.building_planner_renew.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.naksha_samjota_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.naksha_changes.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.license_fees_building_branch.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.naksha_renew_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.alteration_additional_charge.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.2_year_time_limit_of_renewal_building_naksha.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.leave_encashment_and_gratuty.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.plastic_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.rehri_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.challan_for_misuse_of_water.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.dengue_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.littering_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"snt.licence_pure_food.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.misc_challans.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.regularisation_of_buildings.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"wf.contractor_enlistment.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"wf.tenderformfee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tb.advertisement_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tb.tehbazaari.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.pf_transfer_(accounts).receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.ts1_copy_register_for_old_survey.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.transfer_property_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"admn.rti.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"admn.no_dues_certificate.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.architect_license_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tb.challan_under_section_156.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.grants_cheque.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.no_due_certificate_electriCITY.CODE.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.registery_and_bank_loan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.sbm_garbage_plastic_polythene_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"snt.dead_animals_contract.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.gpf.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.cpf_received_check.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.tower_installation.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.tower_annual_rent.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"css.cow_cess.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.cattle_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tb.rehri_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"lcf.manual_rikshaw.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.dairy_animals_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.bidi_&_cigrette_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.community_centre_booking_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.commercial_use_of_municipal_land.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.street_vendor.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.construction_waste.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.demolition_waste.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"snt.clean_safai_sanitation.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"om.plumber_license_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.light_wala_board.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.wall_paint_advertisement.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"om.water_connection_disconnection_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.noc_completion_of_building_approval.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.recovery_employee_contractor.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.house_tax.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.hadud_certificate_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.no_due_certificate_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.colony_sambandhi_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.naksha_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"wf.ofc_permission_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.economics_weaker_section_scheme_charges.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.economics_weaker_section_projects_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"om.sewerage_disconnection_connection_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.provident_fund_processing_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"css.labor_cess.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.others_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.water_charges.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.under_development_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.change_of_land_use_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.development_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.malba_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.boundary_wall_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.building_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"om.road_cut_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"admn.parking_booking_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.canopy_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.outdoor_media_display_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.test_munadi_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.property_tax_2013-14.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.noc_fee.receipt.id\"", + " },", + " {", + " \"format\": \"[cy:MM]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON\",", + " \"idname\": \"rev_grants.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.fire_tender_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.fire_call_report_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.fire_noc_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.bus_adda_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.rain_harvesting_charges.receipt.id\"", + " },", + " {", + " \"format\": \"PG-AC-[cy:yyyy-MM-dd]-[SEQ_EG_PT_ACK]\",", + " \"idname\": \"pt.acknowledgementnumber\"", + " },", + " {", + " \"format\": \"PG-AS-[cy:yyyy-MM-dd]-[SEQ_EG_PT_ASSM]\",", + " \"idname\": \"pt.assessmentnumber\"", + " },", + " {", + " \"format\": \"PG-PT-[CITY.CODE]-[SEQ_EG_PT_PTID]\",", + " \"idname\": \"pt.propertyid\"", + " },", + " {", + " \"format\": \"PG-BP-[cy:yyyy-MM-dd]-[SEQ_EG_BP_APN]\",", + " \"idname\": \"egov.idgen.bpa.applicationNum\"", + " },", + " {", + " \"format\": \"BR/ENG/[cy:yyyy]/[SEQ_EG_PT_LN]\",", + " \"idname\": \"egov.idgen.bpa.englicensenumber\"", + " },", + " {", + " \"format\": \"BR/STR/[cy:yyyy]/[SEQ_EG_PT_LN]\",", + " \"idname\": \"egov.idgen.bpa.strlicensenumber\"", + " },", + " {", + " \"format\": \"BR/TP/[cy:yyyy]/[SEQ_EG_PT_LN]\",", + " \"idname\": \"egov.idgen.bpa.tplicensenumber\"", + " },", + " {", + " \"format\": \"BR/SUP/[cy:yyyy]/[SEQ_EG_PT_LN]\",", + " \"idname\": \"egov.idgen.bpa.suplicensenumber\"", + " },", + " {", + " \"format\": \"BR/ARCT/[cy:yyyy]/[SEQ_EG_PT_LN]\",", + " \"idname\": \"egov.idgen.bpa.arlicensenumber\"", + " },", + " {", + " \"format\": \"BR/BLD/[cy:yyyy]/[SEQ_EG_PT_LN]\",", + " \"idname\": \"egov.idgen.bpa.bdlicensenumber\"", + " },", + " {", + " \"format\": \"BPAREG/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"bpareg.receipt.id\"", + " },", + " {", + " \"format\": \"BPA/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"bpa.nc_app_fee.receipt.id\"", + " },", + " {", + " \"format\": \"BPA/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"bpa.nc_san_fee.receipt.id\"", + " },", + " {", + " \"format\": \"PG-MU-[cy:yyyy-MM-dd]-[SEQ_EG_PT_ASSM]\",", + " \"idname\": \"pt.mutation.receipt.id\"", + " },", + " {", + " \"format\": \"PG-MT-[CITY]-[SEQ_EG_PT_MUTATION]\",", + " \"idname\": \"pt.mutation.number\"", + " },", + " {", + " \"format\": \"WS/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_WS_CON_[TENANT_ID]]\",", + " \"idname\": \"waterservice.connection.id\"", + " },", + " {", + " \"format\": \"SW/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_SW_CON_[TENANT_ID]]\",", + " \"idname\": \"sewerageservice.connection.id\"", + " },", + " {", + " \"format\": \"WS/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_WS_BILL_RCPT_[TENANT_ID]]\",", + " \"idname\": \"ws.receipt.id\"", + " },", + " {", + " \"format\": \"SW/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_SW_BILL_RCPT_[TENANT_ID]]\",", + " \"idname\": \"sw.receipt.id\"", + " },", + " {", + " \"format\": \"WS_AP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_WS_APP_[TENANT_ID]]\",", + " \"idname\": \"waterservice.application.id\"", + " },", + " {", + " \"format\": \"SW_AP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_SW_APP_[TENANT_ID]]\",", + " \"idname\": \"sewerageservice.application.id\"", + " },", + " {", + " \"format\": \"WS.OTP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_WS_FEE_RCPT_[TENANT_ID]]\",", + " \"idname\": \"ws.one_time_fee.receipt.id\"", + " },", + " {", + " \"format\": \"WS.OTP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_WS_FEE_RCPT_[TENANT_ID]]\",", + " \"idname\": \"wsreconnection.receipt.id\"", + " },", + "\t\t{", + " \"format\": \"SW.OTP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_SW_FEE_RCPT_[TENANT_ID]]\",", + " \"idname\": \"swreconnection.receipt.id\"", + " },", + " {", + " \"format\": \"SW.OTP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_SW_FEE_RCPT_[TENANT_ID]]\",", + " \"idname\": \"sw.one_time_fee.receipt.id\"", + " },", + " {", + " \"format\": \"PG-BP-[cy:yyyy-MM-dd]-[SEQ_EG_BP_APN]\",", + " \"idname\": \"bpa.low_risk_permit_fee.receipt.id\"", + " },", + " {", + " \"format\": \"BPA/OC/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"bpa.nc_oc_app_fee.receipt.id\"", + " },", + " {", + " \"format\": \"BPA/OC/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"bpa.nc_oc_san_fee.receipt.id\"", + " },", + " {", + " \"format\": \"PG-NOCSRV-[cy:yyyy-MM-dd]-[SEQ_EG_NOC_APN]\",", + " \"idname\": \"noc.application.number\"", + " },", + " {", + " \"format\": \"PG-PGR-[cy:yyyy-MM-dd]-[SEQ_EG_PGR_ID]\",", + " \"idname\": \"pgr.servicerequestid\"", + " },", + " {", + " \"idname\": \"bs.amendment.id\",", + " \"format\": \"NOTETYPE-CONSUMERCODE-[SEQ_BS_MUTATION_[tenant_id]]\"", + " },", + " {", + " \"format\": \"FSM/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON[TENANT_ID]]\",", + " \"idname\": \"fsm.trip_charges.receipt.id\"", + " },", + " {", + " \"idname\": \"fsm.aplnumber\",", + " \"format\": \"[CITY.CODE]-FSM-[cy:yyyy-MM-dd]-[SEQ_EGOV_FSM]\"", + " },", + " {", + " \"idname\": \"echallan.aplnumber\",", + " \"format\": \"PG-CH-[cy:yyyy-MM-dd]-[SEQ_EG_CH_APL]\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.gas_balloon_advertisement.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.property_tax_2013_14.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.property tax_dishonoured_cheque_payment.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.sale_of_land.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.service_tax_gst_of_rent_of_mc_properties.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.street_vendor_icard_certificate_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.tender_earnest_money_deposit_refundable fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.security_deposit_fee_refundable fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.collection_and_demolition_waste_challan_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.burning_of_waste_challan_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.sub_division_charges_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.information_certificate_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.building_safety_certificate_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.dispensary_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.license_fee_slaughter_house.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.candy_fee_slaughter_house.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.conservancy_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.street_light_pole_transfer_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.sale_of_compost_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.sale_of_recyclable_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.dog_registration.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.swimming_pool_and_gymnactics_hall_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"lcf.rehri_rickshaw_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"lcf.trade_license_fee.receipt.id\"", + " },", + " {", + " \"format\": \"DOC-[cy:yyyy-MM-dd]-[SEQ_EG_DOC_ID]\",", + " \"idname\": \"du.documentid\"", + " },", + " {", + " \"format\": \"PG-SK-[cy:yyyy-MM-dd]-[SEQ_EG_TL_APL]\",", + " \"idname\": \"bpareg.aplnumber\"", + " },", + " {", + " \"format\": \"PG-SK-[cy:yyyy-MM-dd]-[SEQ_EG_PT_LN]\",", + " \"idname\": \"bpareg.licensenumber\"", + " },", + " {", + " \"format\": \"PG-BP-[cy:yyyy-MM-dd]-[SEQ_EG_BP_APN]\",", + " \"idname\": \"bpa.aplnumber\"", + " },", + " {", + " \"format\": \"PG-BP-[CITY.CODE]-[SEQ_EG_BP_PN]\",", + " \"idname\": \"bpa.permitnumber\"", + " },", + " {", + " \"format\": \"BR/[CITY.CODE]/[cb.name]/[fy:yyyy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"birth_cert.receipt.id\"", + " },", + " {", + " \"format\": \"DT/[CITY.CODE]/[cb.name]/[fy:yyyy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"death_cert.receipt.id\"", + " },", + " {", + " \"format\": \"WS_AP/[CITY.CODE]/[fy:yyyy-yy]/DC-[SEQ_WS_APP_[TENANT_ID]]\",", + " \"idname\": \"waterservice.disconnection.id\"", + " },", + " {", + " \"format\": \"SW_AP/[CITY.CODE]/[fy:yyyy-yy]/DC-[SEQ_SW_APP_[TENANT_ID]]\",", + " \"idname\": \"sewerageservice.disconnection.id\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.IdFormat\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.IdFormat", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.IdFormat" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data OwnerShipCategory.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data OwnerShipCategory.postman_collection new file mode 100644 index 00000000000..f22701c7b0c --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data OwnerShipCategory.postman_collection @@ -0,0 +1,168 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"INDIVIDUAL.SINGLEOWNER\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INDIVIDUAL.MULTIPLEOWNERS\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALPRIVATE.PRIVATECOMPANY\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALPRIVATE.NGO\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALPRIVATE.PRIVATETRUST\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALPRIVATE.PRIVATEBOARD\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALPRIVATE.OTHERSPRIVATEINSTITUITION\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALGOVERNMENT.ULBGOVERNMENT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALGOVERNMENT.STATEGOVERNMENT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALGOVERNMENT.CENTRALGOVERNMENT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALGOVERNMENT.OTHERGOVERNMENTINSTITUITION\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.OwnerShipCategory\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.OwnerShipCategory", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.OwnerShipCategory" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data OwnerType.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data OwnerType.postman_collection new file mode 100644 index 00000000000..b3b1e78679f --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data OwnerType.postman_collection @@ -0,0 +1,148 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"FREEDOMFIGHTER\",", + " \"active\": true", + " },", + " {", + " \"code\": \"WIDOW\",", + " \"active\": true", + " },", + " {", + " \"code\": \"HANDICAPPED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"BPL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DEFENSE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"NONE\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.OwnerType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.OwnerType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.OwnerType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data StateInfo.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data StateInfo.postman_collection new file mode 100644 index 00000000000..f70b3fd591e --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data StateInfo.postman_collection @@ -0,0 +1,202 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Demo\",", + " \"code\": \"pg\",", + " \"qrCodeURL\":\"https://lh3.googleusercontent.com/-311gz2-xcHw/X6KRNSQTkWI/AAAAAAAAAKU/JmHSj-6rKPMVFbo6oL5x4JhYTTg8-UHmwCK8BGAsYHg/s0/2020-11-04.png\",", + " \"bannerUrl\": \"https://upyog-assets.s3.ap-south-1.amazonaws.com/bannerImage.png\",", + " \"logoUrl\": \"https://in-egov-assets.s3.ap-south-1.amazonaws.com/nugp.png\",", + " \"logoUrlWhite\": \"https://in-egov-assets.s3.ap-south-1.amazonaws.com/nugp.png\",", + " \"statelogo\":\"https://s3.ap-south-1.amazonaws.com/pg-egov-assets/pg.citya/logo.png\",", + " \"hasLocalisation\": true,", + " \"defaultUrl\": {", + " \"citizen\": \"/user/register\",", + " \"employee\": \"/user/login\"", + " },", + " \"languages\": [", + " {", + " \"label\": \"ENGLISH\",", + " \"value\": \"en_IN\"", + " },", + " {", + " \"label\": \"हिंदी\",", + " \"value\": \"hi_IN\"", + " }", + " ],", + " \"localizationModules\": [", + " {", + " \"label\": \"rainmaker-abg\",", + " \"value\": \"rainmaker-abg\"", + " },", + " {", + " \"label\": \"rainmaker-common\",", + " \"value\": \"rainmaker-common\"", + " },", + " {", + " \"label\": \"rainmaker-noc\",", + " \"value\": \"rainmaker-noc\"", + " },", + " {", + " \"label\": \"rainmaker-pt\",", + " \"value\": \"rainmaker-pt\"", + " },", + " {", + " \"label\": \"rainmaker-uc\",", + " \"value\": \"rainmaker-uc\"", + " },", + " {", + " \"label\": \"rainmaker-pgr\",", + " \"value\": \"rainmaker-pgr\"", + " },", + " {", + " \"label\": \"rainmaker-tl\",", + " \"value\": \"rainmaker-tl\"", + " },", + " {", + " \"label\": \"rainmaker-hr\",", + " \"value\": \"rainmaker-hr\"", + " },", + " {", + " \"label\": \"rainmaker-test\",", + " \"value\": \"rainmaker-test\"", + " },", + " {", + " \"label\": \"finance-erp\",", + " \"value\": \"finance-erp\"", + " },", + " {", + " \"label\": \"rainmaker-receipt\",", + " \"value\": \"rainmaker-receipt\"", + " },", + " {", + " \"label\": \"rainmaker-dss\",", + " \"value\": \"rainmaker-dss\"", + " },", + " {", + " \"label\": \"rainmaker-fsm\",", + " \"value\": \"rainmaker-fsm\"", + " }", + " ]", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.StateInfo\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.StateInfo", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.StateInfo" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data StructureType.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data StructureType.postman_collection new file mode 100644 index 00000000000..13d7a78a1c4 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data StructureType.postman_collection @@ -0,0 +1,140 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"IMMOVABLE.PUCCA\",", + " \"active\": true", + " },", + " {", + " \"code\": \"IMMOVABLE.KUTCHA\",", + " \"active\": true", + " },", + " {", + " \"code\": \"MOVABLE.HDV\",", + " \"active\": true", + " },", + " {", + " \"code\": \"MOVABLE.MDV\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.StructureType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.StructureType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.StructureType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data UOM.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data UOM.postman_collection new file mode 100644 index 00000000000..a8df561b473 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data UOM.postman_collection @@ -0,0 +1,136 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"GALLONS\",", + " \"active\": true", + " },", + " {", + " \"code\": \"GROSSUNITS\",", + " \"active\": true", + " },", + " {", + " \"code\": \"HP\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.UOM\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.UOM", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.UOM" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data uiCommonPay.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data uiCommonPay.postman_collection new file mode 100644 index 00000000000..a6f6db08a41 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data uiCommonPay.postman_collection @@ -0,0 +1,2502 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"FSM.TRIP_CHARGES\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"receiptKey\": \"fsm-receipt\",", + " \"billKey\": \"fsm-receipt\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"pdfModule\":\"PAYMENT\",", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/inbox\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FSM\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"receiptKey\": \"fsm-receipt\",", + " \"billKey\": \"fsm-receipt\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"pdfModule\":\"PAYMENT\",", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/inbox\"", + " }", + " ]", + " },", + " {", + " \"code\": \"PT\",", + " \"headerBandLabel\": \"PT_COMMON_TABLE_COL_PT_ID\",", + " \"receiptKey\": \"property-receipt\",", + " \"billKey\": \"property-bill\",", + " \"pdfModule\":\"PT\",", + " \"cancelReceipt\": true,", + " \"cancelBill\": false,", + " \"arrears\": true,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/property-tax\",", + " \"employeeUrl\": \"/pt-mutation/propertySearch\"", + " }", + " ]", + " },", + " {", + " \"code\": \"PT.MUTATION\",", + " \"headerBandLabel\": \"PTM_COMMON_TABLE_COL_PT_ID\",", + " \"receiptKey\": \"property-receipt\",", + " \"billKey\": \"property-bill\",", + " \"pdfModule\":\"PT\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/property-tax\",", + " \"employeeUrl\": \"/pt-mutation/propertySearch\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TL\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"receiptKey\": \"tradelicense-receipt\",", + " \"billKey\": \"tradelicense-bill\",", + " \"pdfModule\":\"TL\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/tradelicense-citizen/home\",", + " \"employeeUrl\": \"/tradelicence/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"BPA.NC_APP_FEE\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/bpastakeholder-citizen/home\",", + " \"employeeUrl\": \"/egov-bpa/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"BPA.NC_SAN_FEE\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/bpastakeholder-citizen/home\",", + " \"employeeUrl\": \"/egov-bpa/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"BPA.LOW_RISK_PERMIT_FEE\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/bpastakeholder-citizen/home\",", + " \"employeeUrl\": \"/egov-bpa/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"DEFAULT\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/inbox\"", + " }", + " ]", + " },", + " {", + " \"code\": \"BPAREG\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"bpa-receipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/bpastakeholder-citizen/home\",", + " \"employeeUrl\": \"/bpastakeholder/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"WS\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"WNS\",", + " \"receiptKey\": \"ws-onetime-receipt\",", + " \"billKey\": \"ws-bill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": true,", + " \"arrears\": true,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/wns-citizen/home\",", + " \"employeeUrl\": \"/wns/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"SW\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"WNS\",", + " \"receiptKey\": \"ws-onetime-receipt\",", + " \"billKey\": \"ws-bill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": true,", + " \"arrears\": true,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/wns-citizen/home\",", + " \"employeeUrl\": \"/wns/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"WS.ONE_TIME_FEE\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_APPLICATION_CODE\",", + " \"pdfModule\":\"WNS\",", + " \"receiptKey\": \"ws-onetime-receipt\",", + " \"billKey\": \"ws-bill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/wns-citizen/home\",", + " \"employeeUrl\": \"/wns/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"SW.ONE_TIME_FEE\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_APPLICATION_CODE\",", + " \"pdfModule\":\"WNS\",", + " \"receiptKey\": \"ws-onetime-receipt\",", + " \"billKey\": \"ws-bill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/wns-citizen/home\",", + " \"employeeUrl\": \"/wns/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FIRENOC\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/fire-noc/home\",", + " \"employeeUrl\": \"/fire-noc/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADVT.Hoardings\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TX.No_Dues_Certificate\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TX.Electricity_Chungi\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TX.TS1_copy_register_for_old_survey\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TX.Transfer_Property_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TX.House_Tax\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TX.Property_tax_2013_14\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TX.Property Tax_Dishonoured_Cheque_Payment\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADVT.Unipolls\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADVT.Light_Wala_Board\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADVT.Wall_Paint_Advertisement\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADVT.Canopy_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADVT.Outdoor_Media_Display_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Municipal_Shops_Rent\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Land_Rent\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Tower_Rent\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Parking_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Jamin_Theka\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Tower_Installation\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Tower_Annual_Rent\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Community_Centre_Booking_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Commercial_Use_of_Municipal_Land\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Street_Vendor\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Sale_of_Land\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Service_Tax_GST_of_Rent_of_MC_Properties\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Street_vendor_ICARD_Certificate_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADMN.Election_rally_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADMN.Parking_during_election\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADMN.Road_show\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADMN.RTI\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADMN.No_Dues_Certificate\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADMN.Parking_Booking_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.Advance_Provident_Fund\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.PF_transfer_(Accounts)\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.Recovery_employee/contractor\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.Grants_cheque\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.GPF\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.CPF_received_check\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.Provident_Fund_Processing_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.Tender_Earnest_Money_Deposit_Refundable fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.Security_Deposit_Fee_Refundable Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ST.Stationary_Not_Income\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ST.Expenditure_santitation_Not_Income\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Santitation_dumping_garbage\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Plastic_Challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Rehri_Challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Challan_for_Misuse_of_Water\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Dengue_Challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Littering_Challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.SBM_garbage_plastic_polythene_challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Cattle_Challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Dairy_Animals_Challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Bidi_&_Cigrette_Challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Collection_and_Demolition_Waste_Challan_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Burning_of_Waste_Challan_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Telecom_tower_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Draftsmen_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Building_planner_renew\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.License_fees_building_branch\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Leave_encashment_and_gratuty\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Architect_license_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Construction_Waste\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Demolition_Waste\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Composition_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Naksha_samjota_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Naksha_changes\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.NOC/Completion_of_building_approval\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Alteration_additional_charge\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.2_year_time_limit_of_Renewal_Building_Naksha\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Regularisation_of_Buildings\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Hadud_Certificate_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.No_Dues_Certificate\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Colony_Sambandhi_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Naksha_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Building_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Boundary_Wall_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Malba_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Development_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Change_of_Land_Use_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Under_Development_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Economic_Weaker_Section_Scheme_Charges\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Economic_Weaker_Section_Projects_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Rain_Harvesting_Charges\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Sub_division_charges_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Information_Certificate_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Building_safety_Certificate_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OM.Water_connection/disconnection_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OM.Plumber_License_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OM.Water_connection_disconnection_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OM.Road_Cut_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"SNT.Licence_Pure_food\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"SNT.Dead_animals_contract\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"SNT.clean_safai_sanitation\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Misc_Challans\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.No_due_certificate_electricity\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.registery_and_bank_loan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Water_Charges\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Other_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.NOC_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Fire_NOC_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Fire_Tender_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Fire_Call_Report_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Bus_Adda_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Dispensary_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.License_fee_Slaughter_House\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Candy_fee_Slaughter_House\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Conservancy_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Street_Light_Pole_Transfer_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Sale_of_Compost_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Sale_of_Recyclable_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Dog_Registration\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Swimming_Pool_And_Gymnactics_Hall_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"WF.Contractor_Enlistment\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"WF.Tender Form Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"WF.OFC_Permission_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TB.Advertisement_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TB.Tehbazaari\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TB.Challan_Under_section_156_121_etc\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CSS.cow_cess\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CSS.Labor_Cess\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"LCF.Manual_Rikshaw\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"LCF.Rehri_Rickshaw_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"LCF.Trade_License_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"BIRTH_CERT\",", + " \"headerBandLabel\": \"PAYMENT_BND_CONSUMER_CODE\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/inbox\"", + " }", + " ]", + " },", + " {", + " \"code\": \"DEATH_CERT\",", + " \"headerBandLabel\": \"PAYMENT_BND_CONSUMER_CODE\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/inbox\"", + " }", + " ]", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.uiCommonPay\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.uiCommonPay", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.uiCommonPay" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data wfSlaConfig.postman_collection b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data wfSlaConfig.postman_collection new file mode 100644 index 00000000000..dadb0666705 --- /dev/null +++ b/utilities/mdms-migration/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data wfSlaConfig.postman_collection @@ -0,0 +1,131 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"id\": 1,", + " \"slotPercentage\" : 33,", + " \"positiveSlabColor\" : \"#4CAF50\",", + " \"negativeSlabColor\" : \"#F44336\",", + " \"middleSlabColor\" : \"#EEA73A\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.wfSlaConfig\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.wfSlaConfig", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.wfSlaConfig" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration/Schema Definitions/BillingService.BusinessService.json b/utilities/mdms-migration/Schema Definitions/BillingService.BusinessService.json new file mode 100644 index 00000000000..c760129bd1f --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/BillingService.BusinessService.json @@ -0,0 +1,88 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "f25a130a-586e-4a32-8331-dec3d11e2bd5", + "tenantId": "pg", + "code": "BillingService.BusinessService", + "description": "BillingService BusinessService", + "definition": { + "type": "object", + "title": "Generated schema for Root", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "businessService", + "code", + "collectionModesNotAllowed", + "partPaymentAllowed", + "isAdvanceAllowed" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "billGineiURL": { + "type": "string" + }, + "businessService": { + "type": "string" + }, + "demandUpdateTime": { + "type": "number", + "default": 86400000 + }, + "isAdvanceAllowed": { + "type": "boolean", + "deault": false + }, + "minAmountPayable": { + "type": "number", + "default": 100 + }, + "partPaymentAllowed": { + "type": "boolean", + "deault": true + }, + "isBillAmendmentEnabled": { + "type": "boolean", + "deault": true + }, + "isVoucherCreationEnabled": { + "type": "boolean", + "deault": true + }, + "collectionModesNotAllowed": { + "type": "array", + "items": { + "enum": [ + "DD", + "OFFLINE_NEFT", + "OFFLINE_RTGS", + "POSTAL_ORDER" + ], + "type": "string" + } + } + }, + "x-ref-schema": [] + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1702884549384, + "lastModifiedTime": 1702884549384 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/BillingService.TaxHeadMaster.json b/utilities/mdms-migration/Schema Definitions/BillingService.TaxHeadMaster.json new file mode 100644 index 00000000000..8a9836f6968 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/BillingService.TaxHeadMaster.json @@ -0,0 +1,76 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "f45d0a4f-b17a-4325-a236-cd67af741c09", + "tenantId": "pg", + "code": "BillingService.TaxHeadMaster", + "description": "BillingService TaxHeadMaster", + "definition": { + "type": "object", + "title": "Generated schema for Root", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "category", + "service", + "name", + "code", + "isDebit", + "isActualDemand", + "order" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "order": { + "type": "string" + }, + "isDebit": { + "type": "boolean", + "deault": true + }, + "service": { + "type": "string" + }, + "category": { + "type": "string" + }, + "isRequired": { + "type": "boolean" + }, + "isActualDemand": { + "type": "boolean", + "deault": true + } + }, + "x-ref-schema": [ + { + "fieldPath": "service", + "schemaCode": "BillingService.BusinessService" + } + ] + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1702897702259, + "lastModifiedTime": 1702897702259 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/BillingService.TaxPeriod.json b/utilities/mdms-migration/Schema Definitions/BillingService.TaxPeriod.json new file mode 100644 index 00000000000..150f2c3ee9d --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/BillingService.TaxPeriod.json @@ -0,0 +1,70 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "4270ea1c-667d-41d4-a1e3-6b0f9b86d217", + "tenantId": "pg", + "code": "BillingService.TaxPeriod", + "description": "BillingService TaxPeriod", + "definition": { + "type": "object", + "title": "Generated schema for Root", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "fromDate", + "toDate", + "periodCycle", + "service", + "code", + "financialYear" + ], + "x-unique": [ + "code", + "financialYear" + ], + "properties": { + "code": { + "type": "string" + }, + "toDate": { + "type": "number" + }, + "service": { + "type": "string" + }, + "fromDate": { + "type": "number" + }, + "periodCycle": { + "type": "string", + "default": "ANNUAL" + }, + "financialYear": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + } + }, + "x-ref-schema": [ + { + "fieldPath": "service", + "schemaCode": "BillingService.BusinessService" + } + ] + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1702884035862, + "lastModifiedTime": 1702884035862 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.CancerCess.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.CancerCess.json new file mode 100644 index 00000000000..e91eba5d7f3 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.CancerCess.json @@ -0,0 +1,64 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "6ec21766-b11a-4e2e-bc44-77b804f54bdc", + "tenantId": "pg", + "code": "PropertyTax.CancerCess", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY" + ], + "x-unique": [ + "fromFY" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917108, + "lastModifiedTime": 1701259917108 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.ChargeSlabs.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.ChargeSlabs.json new file mode 100644 index 00000000000..ae574f61a60 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.ChargeSlabs.json @@ -0,0 +1,54 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "c28f21b1-4661-4bdb-9e51-4912599ddcde", + "tenantId": "pg", + "code": "PropertyTax.ChargeSlabs", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "floorNo", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "floorNo": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259915448, + "lastModifiedTime": 1701259915448 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.CommonFieldsConfig.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.CommonFieldsConfig.json new file mode 100644 index 00000000000..293a60255c2 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.CommonFieldsConfig.json @@ -0,0 +1,116 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "26aed672-5d5a-4280-a70a-ce784802d285", + "tenantId": "pg", + "code": "PropertyTax.CommonFieldsConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "head", + "body" + ], + "x-unique": [ + "head" + ], + "properties": { + "body": { + "type": "array", + "items": { + "type": "object", + "required": [ + "route", + "component", + "nextStep", + "key", + "texts" + ], + "properties": { + "key": { + "type": "string" + }, + "type": { + "type": "string" + }, + "route": { + "type": "string" + }, + "texts": { + "type": "object", + "required": [ + "header", + "cardText" + ], + "properties": { + "header": { + "type": "string" + }, + "cardText": { + "type": "string" + }, + "nextText": { + "type": "string" + }, + "skipText": { + "type": "string" + }, + "headerCaption": { + "type": "string" + }, + "submitBarLabel": { + "type": "string" + }, + "skipAndContinueText": { + "type": "string" + } + }, + "additionalProperties": false + }, + "nextStep": { + "type": "string" + }, + "component": { + "type": "string" + }, + "isMandatory": { + "type": "boolean", + "default": true + }, + "withoutLabel": { + "type": "boolean", + "default": true + }, + "hideInEmployee": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + } + }, + "head": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259916236, + "lastModifiedTime": 1701259916236 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.ConstructionSubType.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.ConstructionSubType.json new file mode 100644 index 00000000000..488e3335b7b --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.ConstructionSubType.json @@ -0,0 +1,53 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "98840150-2d15-4515-966b-1c694249fbe3", + "tenantId": "pg", + "code": "PropertyTax.ConstructionSubType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701338549283, + "lastModifiedTime": 1701338549283 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.ConstructionType.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.ConstructionType.json new file mode 100644 index 00000000000..c435af6b101 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.ConstructionType.json @@ -0,0 +1,53 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "cd8cb36f-e3a8-482c-85c4-766e7a246ff7", + "tenantId": "pg", + "code": "PropertyTax.ConstructionType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701339920159, + "lastModifiedTime": 1701339920159 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.Documents.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.Documents.json new file mode 100644 index 00000000000..cc92f1a041b --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.Documents.json @@ -0,0 +1,183 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "89a816d6-2bc9-4cdb-a7d7-ebb36d84f0e4", + "tenantId": "pg", + "code": "PropertyTax.Documents", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "documentType", + "required", + "active", + "hasDropdown", + "additionalDetails", + "dropdownData", + "description" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "required": { + "type": "boolean", + "default": false + }, + "description": { + "type": "string" + }, + "hasDropdown": { + "type": "boolean", + "default": true + }, + "documentType": { + "type": "string" + }, + "dropdownData": { + "type": "array", + "items": { + "type": "object", + "required": [ + "code", + "active" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + }, + "digit-citizen": { + "type": "boolean", + "default": true + }, + "additionalDetails": { + "type": "object", + "required": [ + "enabledActions" + ], + "properties": { + "enabledActions": { + "type": "object", + "required": [ + "assess", + "reassess", + "update", + "create" + ], + "properties": { + "assess": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "create": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "update": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "reassess": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701340167673, + "lastModifiedTime": 1701340167673 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.DuesOnPTMutation.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.DuesOnPTMutation.json new file mode 100644 index 00000000000..b8039f05671 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.DuesOnPTMutation.json @@ -0,0 +1,58 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "36d9d63d-1710-471f-909b-7c464103a64c", + "tenantId": "pg", + "code": "PropertyTax.DuesOnPTMutation", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "module", + "code", + "enabled", + "fetchConsumerUrl", + "fecthBillUrl" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "module": { + "type": "string" + }, + "enabled": { + "type": "boolean", + "default": true + }, + "fecthBillUrl": { + "type": "string" + }, + "fetchConsumerUrl": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917371, + "lastModifiedTime": 1701259917371 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.FireCess.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.FireCess.json new file mode 100644 index 00000000000..6bbe64e5545 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.FireCess.json @@ -0,0 +1,90 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "6ce89ab3-cc44-428f-9386-2570761ae553", + "tenantId": "pg", + "code": "PropertyTax.FireCess", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "dynamicFirecess", + "dynamicRates" + ], + "x-unique": [ + "fromFY" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "dynamicRates": { + "type": "object", + "required": [ + "firecess_inflammable", + "firecess_building_height", + "firecess_category_major" + ], + "properties": { + "firecess_inflammable": { + "type": "integer" + }, + "firecess_category_major": { + "type": "integer" + }, + "firecess_building_height": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "dynamicFirecess": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917492, + "lastModifiedTime": 1701259917492 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.Floor.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.Floor.json new file mode 100644 index 00000000000..d31668a4d03 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.Floor.json @@ -0,0 +1,54 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "fd9a1b5e-a790-4ee2-80ff-7d15b0ad7d01", + "tenantId": "pg", + "code": "PropertyTax.Floor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "description", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917822, + "lastModifiedTime": 1701259917822 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.Interest.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.Interest.json new file mode 100644 index 00000000000..f7622bc7a2a --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.Interest.json @@ -0,0 +1,70 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "bf5a652c-4581-4c86-854d-1857f9ef9976", + "tenantId": "pg", + "code": "PropertyTax.Interest", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "startingDay" + ], + "x-unique": [ + "fromFY", + "startingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "startingDay": { + "type": "string", + "format": "date" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259918249, + "lastModifiedTime": 1701259918249 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.MapConfig.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.MapConfig.json new file mode 100644 index 00000000000..c59735b1010 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.MapConfig.json @@ -0,0 +1,56 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "b44df265-435c-46f7-ac4e-2c0439159ef8", + "tenantId": "pg", + "code": "PropertyTax.MapConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "defaultConfig" + ], + "x-unique": [ + "defaultConfig" + ], + "properties": { + "defaultConfig": { + "type": "object", + "required": [ + "lat", + "lng" + ], + "properties": { + "lat": { + "type": "number", + "default": 31.6160638 + }, + "lng": { + "type": "number", + "default": 74.8978579 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259916969, + "lastModifiedTime": 1701259916969 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.MutationDocuments.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.MutationDocuments.json new file mode 100644 index 00000000000..b549fde442d --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.MutationDocuments.json @@ -0,0 +1,85 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "b2d040bc-eb72-4b8d-a4c6-622672525929", + "tenantId": "pg", + "code": "PropertyTax.MutationDocuments", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "documentType", + "required", + "active", + "hasDropdown", + "dropdownData", + "description" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": false + }, + "required": { + "type": "boolean", + "default": false + }, + "description": { + "type": "string" + }, + "hasDropdown": { + "type": "boolean", + "default": false + }, + "documentType": { + "type": "string" + }, + "dropdownData": { + "type": "array", + "items": { + "type": "object", + "required": [ + "code", + "active" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259916724, + "lastModifiedTime": 1701259916724 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.MutationPenalty.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.MutationPenalty.json new file mode 100644 index 00000000000..f00f5f09284 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.MutationPenalty.json @@ -0,0 +1,69 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "350c6b68-2c9e-43f0-9c10-c0150b35684e", + "tenantId": "pg", + "code": "PropertyTax.MutationPenalty", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "startingDay", + "mutationPaymentPeriodInMonth" + ], + "x-unique": [ + "fromFY", + "startingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "startingDay": { + "type": "string", + "format": "date" + }, + "mutationPaymentPeriodInMonth": { + "type": "string", + "default": "06" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917321, + "lastModifiedTime": 1701259917321 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.MutationReason.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.MutationReason.json new file mode 100644 index 00000000000..0be965526e9 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.MutationReason.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "1b6bd580-24c0-4796-99ca-d366bcf4022a", + "tenantId": "pg", + "code": "PropertyTax.MutationReason", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259915400, + "lastModifiedTime": 1701259915400 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.MutationRebate.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.MutationRebate.json new file mode 100644 index 00000000000..06d72be3953 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.MutationRebate.json @@ -0,0 +1,69 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "032789b6-3dc9-4b2e-8fa5-185ad31e3d9a", + "tenantId": "pg", + "code": "PropertyTax.MutationRebate", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "endingDay", + "mutationPaymentPeriodInMonth" + ], + "x-unique": [ + "fromFY", + "endingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "endingDay": { + "type": "string", + "format": "date" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "mutationPaymentPeriodInMonth": { + "type": "string", + "default": "06" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917630, + "lastModifiedTime": 1701259917630 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.OccupancyType.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.OccupancyType.json new file mode 100644 index 00000000000..99c2f6937bd --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.OccupancyType.json @@ -0,0 +1,49 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "9588f2a3-45cc-4b34-bd78-dc233e5f5876", + "tenantId": "pg", + "code": "PropertyTax.OccupancyType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917444, + "lastModifiedTime": 1701259917444 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.OwnerShipCategory.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.OwnerShipCategory.json new file mode 100644 index 00000000000..7eb6f7bfafe --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.OwnerShipCategory.json @@ -0,0 +1,50 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "be03f448-22ee-49da-92e9-f1c2002a3b28", + "tenantId": "pg", + "code": "PropertyTax.OwnerShipCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259915274, + "lastModifiedTime": 1701259915274 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.OwnerType.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.OwnerType.json new file mode 100644 index 00000000000..5b812cabc0b --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.OwnerType.json @@ -0,0 +1,82 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "1d07f8a9-c340-4390-b5cf-3b82d916f469", + "tenantId": "pg", + "code": "PropertyTax.OwnerType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": "object", + "required": [ + "rate" + ], + "properties": { + "rate": { + "type": [ + "number", + "null" + ] + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701331769401, + "lastModifiedTime": 1701331769401 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.OwnerTypeDocument.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.OwnerTypeDocument.json new file mode 100644 index 00000000000..cdfcc53be3a --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.OwnerTypeDocument.json @@ -0,0 +1,60 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "ca6cea00-6f1a-4986-b646-910aad3d53aa", + "tenantId": "pg", + "code": "PropertyTax.OwnerTypeDocument", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "ownerTypeCode", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "ownerTypeCode": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "ownerTypeCode", + "schemaCode": "PropertyTax.OwnerType" + } + ], + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259916188, + "lastModifiedTime": 1701259916188 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.PTApplication.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.PTApplication.json new file mode 100644 index 00000000000..493c0308b85 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.PTApplication.json @@ -0,0 +1,53 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "11b940e7-ef0b-4d7f-8b8f-5f59d035d096", + "tenantId": "pg", + "code": "PropertyTax.PTApplication", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "creationReason", + "businessService", + "action", + "editAction" + ], + "x-unique": [ + "businessService" + ], + "properties": { + "action": { + "type": "string" + }, + "editAction": { + "type": "string" + }, + "creationReason": { + "type": "string" + }, + "businessService": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917673, + "lastModifiedTime": 1701259917673 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.PTWorkflow.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.PTWorkflow.json new file mode 100644 index 00000000000..71885d00bee --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.PTWorkflow.json @@ -0,0 +1,56 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "13d901bb-8365-43c1-a8b0-f148a40d3a4c", + "tenantId": "pg", + "code": "PropertyTax.PTWorkflow", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "businessService", + "initialAction", + "inWorkflowStatusAllowed", + "enable" + ], + "x-unique": [ + "businessService", + "initialAction" + ], + "properties": { + "enable": { + "type": "boolean", + "default": false + }, + "initialAction": { + "type": "string" + }, + "businessService": { + "type": "string" + }, + "inWorkflowStatusAllowed": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259916679, + "lastModifiedTime": 1701259916679 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.Penalty.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.Penalty.json new file mode 100644 index 00000000000..654c4285a4f --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.Penalty.json @@ -0,0 +1,63 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "0261b344-4cd8-4a62-b28d-dbd3c116eaf3", + "tenantId": "pg", + "code": "PropertyTax.Penalty", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "startingDay" + ], + "x-unique": [ + "fromFY", + "startingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "startingDay": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259918068, + "lastModifiedTime": 1701259918068 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.PropertyConfiguration.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.PropertyConfiguration.json new file mode 100644 index 00000000000..fab40309b43 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.PropertyConfiguration.json @@ -0,0 +1,60 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "81c87311-c7e0-419f-bcc2-192699d30979", + "tenantId": "pg", + "code": "PropertyTax.PropertyConfiguration", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "Mutation", + "id" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "number" + }, + "Mutation": { + "type": "object", + "required": [ + "RegistrationDetails", + "MutationDetails" + ], + "properties": { + "MutationDetails": { + "type": "boolean", + "default": true + }, + "RegistrationDetails": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701345004111, + "lastModifiedTime": 1701345004111 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.PropertySubType.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.PropertySubType.json new file mode 100644 index 00000000000..c56b25ea812 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.PropertySubType.json @@ -0,0 +1,60 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "f15661aa-951c-49ed-97f9-d4707c585f92", + "tenantId": "pg", + "code": "PropertyTax.PropertySubType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "propertyType" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "propertyType": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "propertyType", + "schemaCode": "PropertyTax.PropertyType" + } + ], + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259918019, + "lastModifiedTime": 1701259918019 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.PropertyType.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.PropertyType.json new file mode 100644 index 00000000000..3a1418644bd --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.PropertyType.json @@ -0,0 +1,53 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "80680e06-1d02-41e1-9253-537d86c30847", + "tenantId": "pg", + "code": "PropertyTax.PropertyType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "propertyType": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701339234915, + "lastModifiedTime": 1701339234915 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.ReasonForTransfer.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.ReasonForTransfer.json new file mode 100644 index 00000000000..5e18260913a --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.ReasonForTransfer.json @@ -0,0 +1,50 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "bf310527-c23c-46cd-a61f-d460b2a917f7", + "tenantId": "pg", + "code": "PropertyTax.ReasonForTransfer", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259916779, + "lastModifiedTime": 1701259916779 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.Rebate.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.Rebate.json new file mode 100644 index 00000000000..de988e402b2 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.Rebate.json @@ -0,0 +1,64 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "68213cc0-ed30-40dd-ae87-20bf0628647c", + "tenantId": "pg", + "code": "PropertyTax.Rebate", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "endingDay" + ], + "x-unique": [ + "fromFY", + "endingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "endingDay": { + "type": "string", + "format": "date" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259918368, + "lastModifiedTime": 1701259918368 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.RentalDetails.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.RentalDetails.json new file mode 100644 index 00000000000..d30d1a76eb1 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.RentalDetails.json @@ -0,0 +1,50 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "8a753a66-b755-4c2b-8b1d-16585c344af1", + "tenantId": "pg", + "code": "PropertyTax.RentalDetails", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259915520, + "lastModifiedTime": 1701259915520 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.SubOwnerShipCategory.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.SubOwnerShipCategory.json new file mode 100644 index 00000000000..812d5e4a3e3 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.SubOwnerShipCategory.json @@ -0,0 +1,60 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "bd1aef7c-b2a7-430f-86b0-9557537b7ae4", + "tenantId": "pg", + "code": "PropertyTax.SubOwnerShipCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "ownerShipCategory" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "ownerShipCategory": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "ownerShipCategory", + "schemaCode": "PropertyTax.OwnerShipCategory" + } + ], + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259915355, + "lastModifiedTime": 1701259915355 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.UpdateNumber.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.UpdateNumber.json new file mode 100644 index 00000000000..8cd618d5a7c --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.UpdateNumber.json @@ -0,0 +1,114 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "bc66009a-1033-4974-a74d-25404ee38d0b", + "tenantId": "pg", + "code": "PropertyTax.UpdateNumber", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "invalidPattern", + "invalidNumber", + "warningEnabled", + "skipEnabled", + "documents" + ], + "x-unique": [ + "invalidNumber" + ], + "properties": { + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "active", + "code", + "description", + "documentType", + "dropdownData", + "hasDropdown", + "required", + "inputProps", + "maxFileSize" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean" + }, + "required": { + "type": "boolean", + "default": false + }, + "inputProps": { + "type": "object", + "required": [ + "accept" + ], + "properties": { + "accept": { + "type": "string" + } + }, + "additionalProperties": false + }, + "description": { + "type": "string" + }, + "hasDropdown": { + "type": "boolean", + "default": false + }, + "maxFileSize": { + "type": "integer" + }, + "documentType": { + "type": "string" + }, + "dropdownData": { + "type": "array" + } + }, + "additionalProperties": false + } + }, + "skipEnabled": { + "type": "boolean", + "default": true + }, + "invalidNumber": { + "type": "string" + }, + "invalidPattern": { + "type": "string" + }, + "warningEnabled": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259916409, + "lastModifiedTime": 1701259916409 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategory.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategory.json new file mode 100644 index 00000000000..e6354e96abc --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategory.json @@ -0,0 +1,81 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "a3a6e46a-5748-450b-8b76-4f94c0547280", + "tenantId": "pg", + "code": "PropertyTax.UsageCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": "object", + "properties": { + "rate": { + "type": [ + "number", + "null" + ], + "default": 0 + }, + "maxAmount": { + "type": [ + "number", + "null" + ], + "default": 0 + }, + "flatAmount": { + "type": [ + "number", + "null" + ], + "default": 0 + } + } + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701337092564, + "lastModifiedTime": 1701337092564 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategoryDetail.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategoryDetail.json new file mode 100644 index 00000000000..7feb3b120d9 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategoryDetail.json @@ -0,0 +1,87 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "032cb2ed-3009-4a28-853f-46bb25dbf97e", + "tenantId": "pg", + "code": "PropertyTax.UsageCategoryDetail", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "usageCategorySubMinor", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": [ + "object", + "null" + ], + "required": [ + "rate", + "maxAmount", + "flatAmount" + ], + "properties": { + "rate": { + "type": "number" + }, + "maxAmount": { + "type": "number" + }, + "flatAmount": { + "type": "number" + } + } + }, + "usageCategorySubMinor": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "usageCategorySubMinor", + "schemaCode": "PropertyTax.UsageCategorySubMinor" + } + ], + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701340660487, + "lastModifiedTime": 1701340660487 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategoryMajor.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategoryMajor.json new file mode 100644 index 00000000000..ae1cb812d5b --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategoryMajor.json @@ -0,0 +1,55 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "4bdf0517-9860-4eae-9033-844ab280fc5c", + "tenantId": "pg", + "code": "PropertyTax.UsageCategoryMajor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917161, + "lastModifiedTime": 1701259917161 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategoryMinor.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategoryMinor.json new file mode 100644 index 00000000000..279a45497bf --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategoryMinor.json @@ -0,0 +1,86 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "585e05c9-cd66-4f69-97fa-174daacfe1e6", + "tenantId": "pg", + "code": "PropertyTax.UsageCategoryMinor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY", + "usageCategoryMajor", + "exemption" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": "object", + "required": [ + "rate", + "maxAmount", + "flatAmount" + ], + "properties": { + "rate": { + "type": "integer" + }, + "maxAmount": { + "type": "integer" + }, + "flatAmount": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "usageCategoryMajor": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "usageCategoryMajor", + "schemaCode": "PropertyTax.UsageCategoryMajor" + } + ], + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259918324, + "lastModifiedTime": 1701259918324 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategorySubMinor.json b/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategorySubMinor.json new file mode 100644 index 00000000000..57459f70cba --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/PropertyTax.UsageCategorySubMinor.json @@ -0,0 +1,89 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "edf9cbe9-1aec-417a-9720-2747106e5ec0", + "tenantId": "pg", + "code": "PropertyTax.UsageCategorySubMinor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY", + "usageCategoryMinor", + "exemption" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": [ + "object", + "null" + ], + "required": [ + "rate", + "maxAmount", + "flatAmount" + ], + "properties": { + "rate": { + "type": "integer" + }, + "maxAmount": { + "type": "integer" + }, + "flatAmount": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "usageCategoryMinor": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "usageCategoryMinor", + "schemaCode": "PropertyTax.UsageCategoryMinor" + } + ], + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701340461780, + "lastModifiedTime": 1701340461780 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/RAINMAKER-PGR.ComplainClosingTime.json b/utilities/mdms-migration/Schema Definitions/RAINMAKER-PGR.ComplainClosingTime.json new file mode 100644 index 00000000000..49249ffbb42 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/RAINMAKER-PGR.ComplainClosingTime.json @@ -0,0 +1,42 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "b21ee8fc-6d8f-4cd0-abc2-ce85ad155dc2", + "tenantId": "pg", + "code": "RAINMAKER-PGR.ComplainClosingTime", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "ComplainMaxIdleTime" + ], + "x-unique": [ + "ComplainMaxIdleTime" + ], + "properties": { + "ComplainMaxIdleTime": { + "type": "number", + "default": 3600000, + "minimum": 0 + } + } + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701861456327, + "lastModifiedTime": 1701861456327 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/RAINMAKER-PGR.ServiceDefs.json b/utilities/mdms-migration/Schema Definitions/RAINMAKER-PGR.ServiceDefs.json new file mode 100644 index 00000000000..d28884da8e0 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/RAINMAKER-PGR.ServiceDefs.json @@ -0,0 +1,75 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "39613db9-c401-4c89-99c1-967754001c24", + "tenantId": "pg", + "code": "RAINMAKER-PGR.ServiceDefs", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "serviceCode", + "name", + "keywords", + "department", + "slaHours", + "menuPath", + "active" + ], + "x-unique": [ + "serviceCode" + ], + "properties": { + "name": { + "type": "string" + }, + "order": { + "type": "integer" + }, + "active": { + "type": "boolean" + }, + "keywords": { + "type": "string" + }, + "menuPath": { + "type": "string" + }, + "slaHours": { + "type": "integer", + "default": 336, + "minimum": 1 + }, + "department": { + "type": "string" + }, + "serviceCode": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "department", + "schemaCode": "common-masters.Department" + } + ] + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701865847685, + "lastModifiedTime": 1701865847685 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/RAINMAKER-PGR.UIConstants.json b/utilities/mdms-migration/Schema Definitions/RAINMAKER-PGR.UIConstants.json new file mode 100644 index 00000000000..c475f724f29 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/RAINMAKER-PGR.UIConstants.json @@ -0,0 +1,41 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "c00c7744-8bff-48af-b659-45a85884d948", + "tenantId": "pg", + "code": "RAINMAKER-PGR.UIConstants", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "REOPENSLA" + ], + "x-unique": [ + "REOPENSLA" + ], + "properties": { + "REOPENSLA": { + "type": "integer", + "default": 432000000 + } + } + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1702379477350, + "lastModifiedTime": 1702379477350 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/TradeLicense.AccessoriesCategory.json b/utilities/mdms-migration/Schema Definitions/TradeLicense.AccessoriesCategory.json new file mode 100644 index 00000000000..0044e851803 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/TradeLicense.AccessoriesCategory.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"code":{"type":"string"},"uom":{"type":["string","null"],"enum":["HP"]},"active":{"type":"boolean","default":true}},"additionalProperties":false,"required":["code","uom","active"],"x-unique":["code"]} diff --git a/utilities/mdms-migration/Schema Definitions/TradeLicense.ApplicationType.json b/utilities/mdms-migration/Schema Definitions/TradeLicense.ApplicationType.json new file mode 100644 index 00000000000..55b4be805d6 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/TradeLicense.ApplicationType.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"code":{"type":"string"},"active":{"type":"boolean","default":true}},"additionalProperties":false,"required":["code","active"],"x-unique":["code"]} diff --git a/utilities/mdms-migration/Schema Definitions/TradeLicense.Documents.json b/utilities/mdms-migration/Schema Definitions/TradeLicense.Documents.json new file mode 100644 index 00000000000..550ca913393 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/TradeLicense.Documents.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"code":{"type":"string"},"documentType":{"type":"string"},"required":{"type":"boolean","default":true},"active":{"type":"boolean","default":true},"dropdownData":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"active":{"type":"boolean","default":false}},"additionalProperties":false,"required":["code","active"]}},"description":{"type":"string"}},"additionalProperties":false,"required":["code","documentType","required","active","dropdownData","description"],"x-unique":["code"]} diff --git a/utilities/mdms-migration/Schema Definitions/TradeLicense.Penalty.json b/utilities/mdms-migration/Schema Definitions/TradeLicense.Penalty.json new file mode 100644 index 00000000000..cd04e201db0 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/TradeLicense.Penalty.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"rate":{"type":"integer","default":10,"minimum":0},"minAmount":{"type":"number","minimum":0},"flatAmount":{"type":"number","minimum":0},"fromFY":{"type":"string","pattern":"^\\d\\d\\d\\d-\\d\\d$"},"startingDay":{"type":"string","format":"date"}},"additionalProperties":false,"required":["rate","minAmount","flatAmount","fromFY","startingDay"],"x-unique":["fromFY","startingDay"]} diff --git a/utilities/mdms-migration/Schema Definitions/TradeLicense.Rebate.json b/utilities/mdms-migration/Schema Definitions/TradeLicense.Rebate.json new file mode 100644 index 00000000000..cd32a49cf62 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/TradeLicense.Rebate.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"rate":{"type":"integer","minimum":0},"maxAmount":{"type":["null","integer"],"minimum":0},"flatAmount":{"type":"number","minimum":0},"fromFY":{"type":"string","pattern":"^\\d\\d\\d\\d-\\d\\d$"},"endingDay":{"type":"string","format":"date"}},"additionalProperties":false,"required":["rate","flatAmount","fromFY","endingDay"],"x-unique":["fromFY","endingDay"]} diff --git a/utilities/mdms-migration/Schema Definitions/TradeLicense.ReminderPeriods.json b/utilities/mdms-migration/Schema Definitions/TradeLicense.ReminderPeriods.json new file mode 100644 index 00000000000..2c31716972b --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/TradeLicense.ReminderPeriods.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"tenantId":{"type":"string"},"reminderInterval":{"type":"integer","default":691200000}},"additionalProperties":false,"required":["tenantId","reminderInterval"],"x-unique":["tenantId"],"x-ref-schema":[{"fieldPath":"tenantId","schemaCode":"tenant.tenantInfo"}]} diff --git a/utilities/mdms-migration/Schema Definitions/TradeLicense.TradeRenewal.json b/utilities/mdms-migration/Schema Definitions/TradeLicense.TradeRenewal.json new file mode 100644 index 00000000000..4ea64a653a3 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/TradeLicense.TradeRenewal.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"renewalPeriod":{"type":"integer","default":7889400000,"minimum":0}},"additionalProperties":false,"required":["renewalPeriod"],"x-unique":["renewalPeriod"]} diff --git a/utilities/mdms-migration/Schema Definitions/TradeLicense.TradeType.json b/utilities/mdms-migration/Schema Definitions/TradeLicense.TradeType.json new file mode 100644 index 00000000000..98a1b39b873 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/TradeLicense.TradeType.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"name":{"type":"string"},"code":{"type":"string"},"uom":{"type":"null"},"applicationDocument":{"type":"array","items":{"type":"object","properties":{"applicationType":{"type":"string"},"documentList":{"type":"array","items":{"type":"string"}}},"additionalProperties":false,"required":["applicationType","documentList"]}},"verificationDocument":{"type":"array"},"active":{"type":"boolean"},"type":{"type":"string"},"validityPeriod":{"type":"null"}},"additionalProperties":false,"required":["name","code","applicationDocument","verificationDocument","active","type"],"x-unique":["code"]} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.CancelCurrentBillReasons.json b/utilities/mdms-migration/Schema Definitions/common-masters.CancelCurrentBillReasons.json new file mode 100644 index 00000000000..ff3266bcdd1 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.CancelCurrentBillReasons.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "bbc1347b-0d21-47e1-8072-98592889f242", + "tenantId": "pg", + "code": "common-masters.CancelCurrentBillReasons", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795474, + "lastModifiedTime": 1701688795474 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.CancelReceiptReason.json b/utilities/mdms-migration/Schema Definitions/common-masters.CancelReceiptReason.json new file mode 100644 index 00000000000..736575a8722 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.CancelReceiptReason.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "6c84fe12-b5ce-4ae5-b3ab-0656b29e6583", + "tenantId": "pg", + "code": "common-masters.CancelReceiptReason", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795725, + "lastModifiedTime": 1701688795725 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.CensusYear.json b/utilities/mdms-migration/Schema Definitions/common-masters.CensusYear.json new file mode 100644 index 00000000000..87391eb4b64 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.CensusYear.json @@ -0,0 +1,49 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "7ba893ec-9fb6-4c52-98a1-59b1694e7e11", + "tenantId": "pg", + "code": "common-masters.CensusYear", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "tenantId", + "name", + "code" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "tenantId": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795772, + "lastModifiedTime": 1701688795772 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.CitizenConsentForm.json b/utilities/mdms-migration/Schema Definitions/common-masters.CitizenConsentForm.json new file mode 100644 index 00000000000..5f472444e4c --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.CitizenConsentForm.json @@ -0,0 +1,78 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "71c0a97b-6ad0-4be1-a7a0-c377e60d99fb", + "tenantId": "pg", + "code": "common-masters.CitizenConsentForm", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "isCitizenConsentFormEnabled", + "checkBoxLabels", + "id" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "number" + }, + "checkBoxLabels": { + "type": "array", + "items": { + "type": "object", + "required": [ + "linkPrefix", + "link", + "linkId", + "linkPostfix", + "en_IN" + ], + "properties": { + "link": { + "type": "string" + }, + "en_IN": { + "type": "string" + }, + "linkId": { + "type": "string" + }, + "linkPrefix": { + "type": "string" + }, + "linkPostfix": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "isCitizenConsentFormEnabled": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701704352680, + "lastModifiedTime": 1701704352680 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.CommonInboxConfig.json b/utilities/mdms-migration/Schema Definitions/common-masters.CommonInboxConfig.json new file mode 100644 index 00000000000..8c4494a7751 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.CommonInboxConfig.json @@ -0,0 +1,83 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "a01e5988-223a-4ca3-98df-45dc9aeefef7", + "tenantId": "pg", + "code": "common-masters.CommonInboxConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "moduleName", + "BusinessService", + "roles", + "active", + "locality", + "localityModule", + "redirectConfig" + ], + "x-unique": [ + "BusinessService" + ], + "properties": { + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "active": { + "type": "boolean", + "default": true + }, + "locality": { + "type": "boolean", + "default": true + }, + "moduleName": { + "type": "string" + }, + "localityModule": { + "type": "string" + }, + "redirectConfig": { + "type": "object", + "required": [ + "INITIATED", + "DEFAULT" + ], + "properties": { + "DEFAULT": { + "type": "string" + }, + "INITIATED": { + "type": "string" + } + }, + "additionalProperties": false + }, + "BusinessService": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795229, + "lastModifiedTime": 1701688795229 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.CronJobAPIConfig.json b/utilities/mdms-migration/Schema Definitions/common-masters.CronJobAPIConfig.json new file mode 100644 index 00000000000..ece664f2351 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.CronJobAPIConfig.json @@ -0,0 +1,79 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "4dd4d4cb-b538-4fa1-b84e-9abb0bb3eff8", + "tenantId": "pg", + "code": "common-masters.CronJobAPIConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "jobName", + "active", + "method", + "url", + "payload", + "header" + ], + "x-unique": [ + "url" + ], + "properties": { + "url": { + "type": "string" + }, + "active": { + "type": "string" + }, + "header": { + "type": "object", + "required": [ + "Content-Type" + ], + "properties": { + "Content-Type": { + "type": "string" + } + }, + "additionalProperties": false + }, + "method": { + "type": "string" + }, + "jobName": { + "type": "string" + }, + "payload": { + "type": "object", + "required": [ + "RequestInfo" + ], + "properties": { + "RequestInfo": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688796119, + "lastModifiedTime": 1701688796119 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.Department.json b/utilities/mdms-migration/Schema Definitions/common-masters.Department.json new file mode 100644 index 00000000000..a13e51baabb --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.Department.json @@ -0,0 +1,50 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "e9f2bee6-689f-4bbe-a85f-4b3fb4b3e64a", + "tenantId": "pg", + "code": "common-masters.Department", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795871, + "lastModifiedTime": 1701688795871 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.Designation.json b/utilities/mdms-migration/Schema Definitions/common-masters.Designation.json new file mode 100644 index 00000000000..ca0cad2be48 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.Designation.json @@ -0,0 +1,54 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "b769ada5-aa6f-4c67-923a-22453ddc764d", + "tenantId": "pg", + "code": "common-masters.Designation", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "name", + "description", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795321, + "lastModifiedTime": 1701688795321 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.DocumentType.json b/utilities/mdms-migration/Schema Definitions/common-masters.DocumentType.json new file mode 100644 index 00000000000..6d88dd1d5b0 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.DocumentType.json @@ -0,0 +1,55 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "1906dbe5-0743-4fa8-be30-a03c8b5253fe", + "tenantId": "pg", + "code": "common-masters.DocumentType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "maxFileSize": { + "type": "number" + }, + "allowedFormat": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701690259579, + "lastModifiedTime": 1701690259579 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.GenderType.json b/utilities/mdms-migration/Schema Definitions/common-masters.GenderType.json new file mode 100644 index 00000000000..49e25000276 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.GenderType.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "8b7f8572-b9a5-438c-9e4e-bc96d00e8ac4", + "tenantId": "pg", + "code": "common-masters.GenderType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795278, + "lastModifiedTime": 1701688795278 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.IdFormat.json b/utilities/mdms-migration/Schema Definitions/common-masters.IdFormat.json new file mode 100644 index 00000000000..26dd6869206 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.IdFormat.json @@ -0,0 +1,45 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "cf89c8d0-3a2e-4596-9b33-a0a502e98198", + "tenantId": "pg", + "code": "common-masters.IdFormat", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "format", + "idname" + ], + "x-unique": [ + "idname" + ], + "properties": { + "format": { + "type": "string" + }, + "idname": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795683, + "lastModifiedTime": 1701688795683 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.OwnerShipCategory.json b/utilities/mdms-migration/Schema Definitions/common-masters.OwnerShipCategory.json new file mode 100644 index 00000000000..211dc615793 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.OwnerShipCategory.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "0cabf550-3c9a-4056-ad7f-8cd10e34e5ce", + "tenantId": "pg", + "code": "common-masters.OwnerShipCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795517, + "lastModifiedTime": 1701688795517 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.OwnerType.json b/utilities/mdms-migration/Schema Definitions/common-masters.OwnerType.json new file mode 100644 index 00000000000..35dc0ccfecf --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.OwnerType.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "dfbbdbae-542d-459d-8d53-f86ed3dc90f5", + "tenantId": "pg", + "code": "common-masters.OwnerType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688796080, + "lastModifiedTime": 1701688796080 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.StateInfo.json b/utilities/mdms-migration/Schema Definitions/common-masters.StateInfo.json new file mode 100644 index 00000000000..4e219e7d807 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.StateInfo.json @@ -0,0 +1,127 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "a88ed5d4-a77f-4de9-a575-edcd6c5da72f", + "tenantId": "pg", + "code": "common-masters.StateInfo", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "qrCodeURL", + "bannerUrl", + "logoUrl", + "logoUrlWhite", + "statelogo", + "hasLocalisation", + "defaultUrl", + "languages", + "localizationModules" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "logoUrl": { + "type": "string" + }, + "bannerUrl": { + "type": "string" + }, + "languages": { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "qrCodeURL": { + "type": "string" + }, + "statelogo": { + "type": "string" + }, + "defaultUrl": { + "type": "object", + "required": [ + "citizen", + "employee" + ], + "properties": { + "citizen": { + "type": "string" + }, + "employee": { + "type": "string" + } + }, + "additionalProperties": false + }, + "logoUrlWhite": { + "type": "string" + }, + "hasLocalisation": { + "type": "boolean", + "default": true + }, + "localizationModules": { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795828, + "lastModifiedTime": 1701688795828 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.StructureType.json b/utilities/mdms-migration/Schema Definitions/common-masters.StructureType.json new file mode 100644 index 00000000000..a0408c5f13b --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.StructureType.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "e46da27a-908f-4e87-808b-4630f1eeef52", + "tenantId": "pg", + "code": "common-masters.StructureType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795562, + "lastModifiedTime": 1701688795562 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.TablePaginationOptions.json b/utilities/mdms-migration/Schema Definitions/common-masters.TablePaginationOptions.json new file mode 100644 index 00000000000..365de7f8e6f --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.TablePaginationOptions.json @@ -0,0 +1,52 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "f2684c7b-c5ab-4d61-8427-6327b8026e61", + "tenantId": "pg", + "code": "common-masters.TablePaginationOptions", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rowsPerPageOptions", + "defaultValue", + "id" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "number" + }, + "defaultValue": { + "type": "integer" + }, + "rowsPerPageOptions": { + "type": "array", + "items": { + "type": "integer" + } + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701703757454, + "lastModifiedTime": 1701703757454 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.UOM.json b/utilities/mdms-migration/Schema Definitions/common-masters.UOM.json new file mode 100644 index 00000000000..cb60a74b0ff --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.UOM.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "8d7d0dfd-3280-4efc-acbe-b3c1399769b7", + "tenantId": "pg", + "code": "common-masters.UOM", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688796040, + "lastModifiedTime": 1701688796040 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.Uom.json b/utilities/mdms-migration/Schema Definitions/common-masters.Uom.json new file mode 100644 index 00000000000..cb60a74b0ff --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.Uom.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "8d7d0dfd-3280-4efc-acbe-b3c1399769b7", + "tenantId": "pg", + "code": "common-masters.UOM", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688796040, + "lastModifiedTime": 1701688796040 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.UomCategory.json b/utilities/mdms-migration/Schema Definitions/common-masters.UomCategory.json new file mode 100644 index 00000000000..4547e964470 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.UomCategory.json @@ -0,0 +1,69 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "cab11077-809b-4511-b60d-07e733031b6c", + "tenantId": "pg", + "code": "common-masters.UomCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "id", + "tenantId", + "uomCategory", + "name", + "code", + "description", + "fromDate", + "toDate" + ], + "x-unique": [ + "code" + ], + "properties": { + "id": { + "type": "integer" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "toDate": { + "type": "integer" + }, + "fromDate": { + "type": "integer" + }, + "tenantId": { + "type": "string" + }, + "description": { + "type": "string" + }, + "uomCategory": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795915, + "lastModifiedTime": 1701688795915 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.bdTemplate.json b/utilities/mdms-migration/Schema Definitions/common-masters.bdTemplate.json new file mode 100644 index 00000000000..3856a17c1e0 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.bdTemplate.json @@ -0,0 +1,45 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "1fc6055e-1cfe-45f2-92f5-7025be877633", + "tenantId": "pg", + "code": "common-masters.bdTemplate", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "template", + "code" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "template": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701690897009, + "lastModifiedTime": 1701690897009 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.uiCommonPay.json b/utilities/mdms-migration/Schema Definitions/common-masters.uiCommonPay.json new file mode 100644 index 00000000000..a9088b567e4 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.uiCommonPay.json @@ -0,0 +1,95 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "26212c7a-382b-495c-9737-046015ab8c9f", + "tenantId": "pg", + "code": "common-masters.uiCommonPay", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "headerBandLabel", + "receiptKey", + "billKey", + "cancelReceipt", + "cancelBill", + "arrears", + "buttons" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "arrears": { + "type": "boolean", + "default": true + }, + "billKey": { + "type": "string" + }, + "buttons": { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "citizenUrl", + "employeeUrl" + ], + "properties": { + "label": { + "type": "string" + }, + "citizenUrl": { + "type": "string" + }, + "employeeUrl": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "pdfModule": { + "type": "string" + }, + "cancelBill": { + "type": "boolean", + "default": true + }, + "receiptKey": { + "type": "string" + }, + "cancelReceipt": { + "type": "boolean", + "default": true + }, + "headerBandLabel": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701689641898, + "lastModifiedTime": 1701689641898 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/common-masters.wfSlaConfig.json b/utilities/mdms-migration/Schema Definitions/common-masters.wfSlaConfig.json new file mode 100644 index 00000000000..b1336e3c820 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/common-masters.wfSlaConfig.json @@ -0,0 +1,57 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "df4ce9bd-5b77-418a-b8a0-e8d155b45148", + "tenantId": "pg", + "code": "common-masters.wfSlaConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "id", + "slotPercentage", + "positiveSlabColor", + "negativeSlabColor", + "middleSlabColor" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "integer" + }, + "slotPercentage": { + "type": "integer" + }, + "middleSlabColor": { + "type": "string" + }, + "negativeSlabColor": { + "type": "string" + }, + "positiveSlabColor": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701706144465, + "lastModifiedTime": 1701706144465 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/egf-master.FinancialYear.json b/utilities/mdms-migration/Schema Definitions/egf-master.FinancialYear.json new file mode 100644 index 00000000000..f2f9e833fc4 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/egf-master.FinancialYear.json @@ -0,0 +1,99 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "89bdaffd-3444-4079-9200-00f2d7828a7b", + "tenantId": "pg", + "code": "egf-master.FinancialYear", + "description": "egf-master FinancialYear", + "definition": { + "type": "object", + "title": "Generated schema for Root", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "tenantId", + "finYearRange", + "name", + "code", + "startingDate", + "endingDate", + "active", + "isActiveForPosting", + "isClosed", + "transferClosingBalance", + "module" + ], + "x-unique": [ + "module" + ], + "properties": { + "code": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "name": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "active": { + "type": "boolean", + "default": true + }, + "module": { + "enum": [ + "PT", + "TL", + "WS", + "SW", + "FIRENOC" + ], + "type": "string" + }, + "isClosed": { + "type": "boolean", + "default": false + }, + "tenantId": { + "enum": [ + "pg" + ], + "type": "string", + "default": "pg" + }, + "endingDate": { + "type": "number" + }, + "finYearRange": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "startingDate": { + "type": "number" + }, + "isActiveForPosting": { + "type": "boolean", + "default": true + }, + "transferClosingBalance": { + "type": "boolean", + "default": false + } + } + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1702903008889, + "lastModifiedTime": 1702903008889 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/tenant.assessmentconfig.json b/utilities/mdms-migration/Schema Definitions/tenant.assessmentconfig.json new file mode 100644 index 00000000000..10de029e6c9 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/tenant.assessmentconfig.json @@ -0,0 +1,53 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "cb104b96-1b3c-4dc0-8489-7125e3adc82c", + "tenantId": "pg", + "code": "tenant.assessmentconfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "tenant", + "enabled", + "financialyear", + "isRented" + ], + "x-unique": [ + "tenant" + ], + "properties": { + "tenant": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "isRented": { + "type": "boolean" + }, + "financialyear": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "lastModifiedBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "createdTime": 1701255395766, + "lastModifiedTime": 1701255395766 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/tenant.citymodule.json b/utilities/mdms-migration/Schema Definitions/tenant.citymodule.json new file mode 100644 index 00000000000..9109676cb3a --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/tenant.citymodule.json @@ -0,0 +1,73 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "7a21c080-4533-48d2-a841-69f19c9bf9f7", + "tenantId": "pg", + "code": "tenant.citymodule", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "module", + "code", + "bannerImage", + "active", + "order", + "tenants" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "order": { + "type": "integer" + }, + "active": { + "type": "boolean" + }, + "module": { + "type": "string" + }, + "tenants": { + "type": "array", + "items": { + "type": "object", + "required": [ + "code" + ], + "properties": { + "code": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "bannerImage": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "lastModifiedBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "createdTime": 1701255395898, + "lastModifiedTime": 1701255395898 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/tenant.footer.json b/utilities/mdms-migration/Schema Definitions/tenant.footer.json new file mode 100644 index 00000000000..b881e43b665 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/tenant.footer.json @@ -0,0 +1,85 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "5a86cbc2-ec6b-4af4-856b-9485f8079939", + "tenantId": "pg", + "code": "tenant.footer", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "service", + "receiptFooterContent", + "billFooterContent" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "service": { + "type": "string" + }, + "billFooterContent": { + "type": "array", + "items": { + "type": "object", + "required": [ + "disclaimer", + "order" + ], + "properties": { + "order": { + "type": "string" + }, + "disclaimer": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "receiptFooterContent": { + "type": "array", + "items": { + "type": "object", + "required": [ + "disclaimer", + "order" + ], + "properties": { + "order": { + "type": "string" + }, + "disclaimer": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "lastModifiedBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "createdTime": 1701255396172, + "lastModifiedTime": 1701255396172 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/tenant.nationalInfo.json b/utilities/mdms-migration/Schema Definitions/tenant.nationalInfo.json new file mode 100644 index 00000000000..f4b30777abb --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/tenant.nationalInfo.json @@ -0,0 +1,61 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "cd042e65-7017-467f-b210-3cb09fab09ef", + "tenantId": "pg", + "code": "tenant.nationalInfo", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "stateCode", + "stateName", + "code", + "name", + "active", + "module" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean" + }, + "module": { + "type": "string" + }, + "stateCode": { + "type": "string" + }, + "stateName": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "lastModifiedBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "createdTime": 1701255396070, + "lastModifiedTime": 1701255396070 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/tenant.reassessmentconfig.json b/utilities/mdms-migration/Schema Definitions/tenant.reassessmentconfig.json new file mode 100644 index 00000000000..298199555b8 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/tenant.reassessmentconfig.json @@ -0,0 +1,48 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "905efc40-2518-4cb8-ab96-73a816865ea1", + "tenantId": "pg", + "code": "tenant.reassessmentconfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "tenant", + "financialyear" + ], + "x-unique": [ + "tenant" + ], + "properties": { + "tenant": { + "type": "array", + "items": { + "type": "string" + } + }, + "financialyear": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "lastModifiedBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "createdTime": 1701255396281, + "lastModifiedTime": 1701255396281 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/tenant.tenantInfo.json b/utilities/mdms-migration/Schema Definitions/tenant.tenantInfo.json new file mode 100644 index 00000000000..6ea86a26ec8 --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/tenant.tenantInfo.json @@ -0,0 +1,72 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "7082bef0-30b1-4d38-92f2-cc6ae7cb7bb9", + "tenantId": "pg", + "code": "tenant.tenantInfo", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "districtCode", + "population", + "malePopulation", + "femalePopultion", + "workingPopulation", + "literacyRate", + "languagesSpoken" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "population": { + "type": "string" + }, + "districtCode": { + "type": "string" + }, + "literacyRate": { + "type": "string" + }, + "malePopulation": { + "type": "string" + }, + "femalePopultion": { + "type": "string" + }, + "languagesSpoken": { + "type": "array", + "items": { + "type": "string" + } + }, + "workingPopulation": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "lastModifiedBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "createdTime": 1701255396323, + "lastModifiedTime": 1701255396323 + } + } + ] +} diff --git a/utilities/mdms-migration/Schema Definitions/tenant.tenants.json b/utilities/mdms-migration/Schema Definitions/tenant.tenants.json new file mode 100644 index 00000000000..7b5dac552db --- /dev/null +++ b/utilities/mdms-migration/Schema Definitions/tenant.tenants.json @@ -0,0 +1,134 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "56dc1892-6ea1-4e4f-a610-1e3632dc7645", + "tenantId": "pg", + "code": "tenant.tenants", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "name", + "description", + "logoId", + "imageId", + "type", + "city", + "contactNumber", + "helpLineNumber" + ], + "x-unique": [ + "code" + ], + "properties": { + "city": { + "type": "object", + "required": [ + "name", + "districtCode", + "districtName", + "regionName", + "ulbGrade", + "longitude", + "latitude", + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "captcha": { + "type": "null" + }, + "latitude": { + "type": "number" + }, + "ulbGrade": { + "type": "string" + }, + "localName": { + "type": "null" + }, + "longitude": { + "type": "number" + }, + "regionName": { + "type": "string" + }, + "districtCode": { + "type": "string" + }, + "districtName": { + "type": "string" + }, + "shapeFileLocation": { + "type": "null" + } + }, + "additionalProperties": false + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "logoId": { + "type": "string" + }, + "address": { + "type": "null" + }, + "emailId": { + "type": "null" + }, + "imageId": { + "type": "string" + }, + "domainUrl": { + "type": "null" + }, + "twitterUrl": { + "type": "null" + }, + "description": { + "type": "string" + }, + "facebookUrl": { + "type": "null" + }, + "contactNumber": { + "type": "string" + }, + "helpLineNumber": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "lastModifiedBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "createdTime": 1701255396489, + "lastModifiedTime": 1701255396489 + } + } + ] +} diff --git a/utilities/mdms-migration/mdms-migration-toolkit.yaml b/utilities/mdms-migration/mdms-migration-toolkit.yaml new file mode 100644 index 00000000000..cec4119af4a --- /dev/null +++ b/utilities/mdms-migration/mdms-migration-toolkit.yaml @@ -0,0 +1,111 @@ +openapi: 3.0.1 +info: + title: MDMS Migration Toolkit APIs + description: APIs to migrate MDMS data from Git to RDBMS. + contact: + name: eGov + email: info@egovernments.org + version: 1.0.1 +paths: + /schema/v1/_migrate: + post: + summary: Migrate schema definitions from existing masters + description: | + Generate and migrate schema definitions from existing masters + operationId: migrateSchemaDefinition + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SchemaMigrationRequest' + responses: + '200': + description: OK + '400': + description: Invalid input. + content: + '*/*': + schema: + $ref: "https://raw.githubusercontent.com/egovernments/DIGIT-Specs/master/Common%20Services/common-contract.yaml#/components/schemas/ErrorRes" + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + /data/v1/_migrate: + post: + summary: Migrate master data + operationId: migrateMasterData + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MasterDataMigrationRequest' + responses: + '200': + description: OK + content: + '*/*': + schema: + type: object + '400': + description: Invalid input. + content: + '*/*': + schema: + $ref: "https://raw.githubusercontent.com/egovernments/DIGIT-Specs/master/Common%20Services/common-contract.yaml#/components/schemas/ErrorRes" + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found +components: + schemas: + SchemaMigrationCriteria: + required: + - tenantId + type: object + properties: + moduleName: + maxLength: 100 + minLength: 2 + type: string + description: Module name of the master whose schema has to be migrated + tenantId: + type: string + description: Unique Identifier of the tenant, Like AP, AP.Kurnool etc. + example: pb.amritsar + MasterDataMigrationCriteria: + required: + - tenantId + type: object + properties: + moduleName: + maxLength: 100 + minLength: 2 + type: string + description: Module name of the master which has to be migrated + tenantId: + type: string + description: Unique Identifier of the tenant, Like AP, AP.Kurnool etc. + example: pb.amritsar + MasterDataMigrationRequest: + required: + - actions + - requestInfo + type: object + properties: + masterDataMigrationCriteria: + $ref: '#/components/schemas/MasterDataMigrationCriteria' + requestInfo: + $ref: 'https://raw.githubusercontent.com/egovernments/DIGIT-Specs/master/Common%20Services/common-contract.yaml#/components/schemas/RequestInfo' + SchemaMigrationRequest: + title: SchemaMigrationRequest + type: object + properties: + schemaMigrationCriteria: + $ref: '#/components/schemas/SchemaMigrationCriteria' + requestInfo: + $ref: "https://raw.githubusercontent.com/egovernments/DIGIT-Specs/master/Common%20Services/common-contract.yaml#/components/schemas/RequestInfo" \ No newline at end of file diff --git a/utilities/mdms-migration/output/README.md b/utilities/mdms-migration/output/README.md new file mode 100644 index 00000000000..a2e8a9f7b84 --- /dev/null +++ b/utilities/mdms-migration/output/README.md @@ -0,0 +1,18 @@ +# Swagger generated server + +Spring Boot Server + + +## Overview +This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. +By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. +This is an example of building a swagger-enabled server in Java using the SpringBoot framework. + +The underlying library integrating swagger to SpringBoot is [springfox](https://github.com/springfox/springfox) + +Start your server as an simple java application + +You can view the api documentation in swagger-ui by pointing to +http://localhost:8080/ + +Change default port value in application.properties \ No newline at end of file diff --git a/utilities/mdms-migration/output/pom.xml b/utilities/mdms-migration/output/pom.xml new file mode 100644 index 00000000000..2beffb9b206 --- /dev/null +++ b/utilities/mdms-migration/output/pom.xml @@ -0,0 +1,139 @@ + + 4.0.0 + org.egov + mdms-migration-toolkit + jar + mdms-migration-toolkit + 1.0.0 + + 1.8 + ${java.version} + ${java.version} + + + org.springframework.boot + spring-boot-starter-parent + 2.2.6.RELEASE + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.flywaydb + flyway-core + + + org.postgresql + postgresql + 42.2.2.jre7 + + + org.springframework.boot + spring-boot-starter-test + test + + + + io.swagger + swagger-core + 1.5.18 + + + io.swagger.core.v3 + swagger-annotations + 2.2.8 + + + + + org.egov.services + tracer + 2.1.2-SNAPSHOT + + + org.egov.services + digit-models + 1.0.0-SNAPSHOT + + + org.egov + mdms-client + 0.0.2-SNAPSHOT + compile + + + org.projectlombok + lombok + true + + + com.github.saasquatch + json-schema-inferrer + 0.2.0 + + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + + javax.validation + validation-api + + + org.egov.services + services-common + 1.1.2-SNAPSHOT + + + + + + repo.egovernments.org + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ + + + repo.egovernments.org.snapshots + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ + + + repo.egovernments.org.public + eGov Public Repository Group + https://nexus-repo.egovernments.org/nexus/content/groups/public/ + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + + + jitpack.io + https://jitpack.io + + + diff --git a/utilities/mdms-migration/output/src/main/java/digit/Main.java b/utilities/mdms-migration/output/src/main/java/digit/Main.java new file mode 100644 index 00000000000..9e5ace22113 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/Main.java @@ -0,0 +1,21 @@ +package digit; + + +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Import; + +@Import({TracerConfiguration.class}) +@SpringBootApplication +@ComponentScan(basePackages = {"digit", "digit.web.controllers", "digit.config"}) +public class Main { + + + public static void main(String[] args) throws Exception { + SpringApplication.run(Main.class, args); + } + +} + \ No newline at end of file diff --git a/utilities/mdms-migration/output/src/main/java/digit/config/Configuration.java b/utilities/mdms-migration/output/src/main/java/digit/config/Configuration.java new file mode 100644 index 00000000000..b655433ceb5 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/config/Configuration.java @@ -0,0 +1,90 @@ +package digit.config; + +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Import; +import org.springframework.stereotype.Component; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Component +@Data +@Import({TracerConfiguration.class}) +@NoArgsConstructor +@AllArgsConstructor +@Setter +@Getter +public class Configuration { + + + // User Config + @Value("${egov.user.host}") + private String userHost; + + @Value("${egov.user.context.path}") + private String userContextPath; + + @Value("${egov.user.create.path}") + private String userCreateEndpoint; + + @Value("${egov.user.search.path}") + private String userSearchEndpoint; + + @Value("${egov.user.update.path}") + private String userUpdateEndpoint; + + + //Idgen Config + @Value("${egov.idgen.host}") + private String idGenHost; + + @Value("${egov.idgen.path}") + private String idGenPath; + + + //Workflow Config + @Value("${egov.workflow.host}") + private String wfHost; + + @Value("${egov.workflow.transition.path}") + private String wfTransitionPath; + + @Value("${egov.workflow.businessservice.search.path}") + private String wfBusinessServiceSearchPath; + + @Value("${egov.workflow.processinstance.search.path}") + private String wfProcessInstanceSearchPath; + + + //MDMS + @Value("${egov.mdms.host}") + private String mdmsHost; + + @Value("${egov.mdms.search.endpoint}") + private String mdmsEndPoint; + + + //HRMS + @Value("${egov.hrms.host}") + private String hrmsHost; + + @Value("${egov.hrms.search.endpoint}") + private String hrmsEndPoint; + + + //URLShortening + @Value("${egov.url.shortner.host}") + private String urlShortnerHost; + + @Value("${egov.url.shortner.endpoint}") + private String urlShortnerEndpoint; + + + //SMSNotification + @Value("${egov.sms.notification.topic}") + private String smsNotificationTopic; +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/config/MainConfiguration.java b/utilities/mdms-migration/output/src/main/java/digit/config/MainConfiguration.java new file mode 100644 index 00000000000..d4436296da0 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/config/MainConfiguration.java @@ -0,0 +1,56 @@ +package digit.config; + +import java.util.TimeZone; + +import javax.annotation.PostConstruct; + +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.saasquatch.jsonschemainferrer.AdditionalPropertiesPolicies; +import com.saasquatch.jsonschemainferrer.JsonSchemaInferrer; +import com.saasquatch.jsonschemainferrer.RequiredPolicies; +import com.saasquatch.jsonschemainferrer.SpecVersion; + + +@Import({TracerConfiguration.class}) +@Configuration +public class MainConfiguration { + + @Value("${app.timezone}") + private String timeZone; + + @PostConstruct + public void initialize() { + TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); + } + + @Bean + public JsonSchemaInferrer jsonSchemaInferrer() { + return JsonSchemaInferrer.newBuilder() + .setSpecVersion(SpecVersion.DRAFT_07) + .setAdditionalPropertiesPolicy(AdditionalPropertiesPolicies.notAllowed()) + .setRequiredPolicy(RequiredPolicies.nonNullCommonFields()) + .build(); + } + + + public ObjectMapper objectMapper() { + return new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES).setTimeZone(TimeZone.getTimeZone(timeZone)); + } + + @Bean + @Autowired + public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectMapper) { + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + converter.setObjectMapper(objectMapper); + return converter; + } +} \ No newline at end of file diff --git a/utilities/mdms-migration/output/src/main/java/digit/constants/ErrorCodes.java b/utilities/mdms-migration/output/src/main/java/digit/constants/ErrorCodes.java new file mode 100644 index 00000000000..ce78a67912e --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/constants/ErrorCodes.java @@ -0,0 +1,13 @@ +package digit.constants; + +public class ErrorCodes { + public static final String IO_ERROR_CODE = "IO_ERROR"; + + public static final String IO_WRITE_ERROR_MESSAGE = "Error while writing to file"; + + public static final String IO_READ_ERROR_MESSAGE = "Error occurred while reading schema json content from file: "; + + public static final String MASTER_DATA_MIGRATION_ERROR_CODE = "MASTER_DATA_MIGRATION_ERROR"; + + public static final String MASTER_DATA_MIGRATION_TENANTID_DOES_NOT_EXIST_ERROR_MESSAGE = "Master data does not exist for tenantId - "; +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/constants/MDMSMigrationToolkitConstants.java b/utilities/mdms-migration/output/src/main/java/digit/constants/MDMSMigrationToolkitConstants.java new file mode 100644 index 00000000000..aba8593d20a --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/constants/MDMSMigrationToolkitConstants.java @@ -0,0 +1,7 @@ +package digit.constants; + +public class MDMSMigrationToolkitConstants { + public static final String JSON_EXTENSION = ".json"; + + public static final String DOT_SEPARATOR = "."; +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/kafka/Consumer.java b/utilities/mdms-migration/output/src/main/java/digit/kafka/Consumer.java new file mode 100644 index 00000000000..5e9f99db180 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/kafka/Consumer.java @@ -0,0 +1,20 @@ +package digit.kafka; + +import java.util.HashMap; + +import org.springframework.stereotype.Component; + +@Component +public class Consumer { + + /* + * Uncomment the below line to start consuming record from kafka.topics.consumer + * Value of the variable kafka.topics.consumer should be overwritten in application.properties + */ + //@KafkaListener(topics = {"kafka.topics.consumer"}) + public void listen(final HashMap record) { + + //TODO + + } +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/kafka/Producer.java b/utilities/mdms-migration/output/src/main/java/digit/kafka/Producer.java new file mode 100644 index 00000000000..88d028ba6aa --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/kafka/Producer.java @@ -0,0 +1,21 @@ +package digit.kafka; + +import org.egov.tracer.kafka.CustomKafkaTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import lombok.extern.slf4j.Slf4j; + +// NOTE: If tracer is disabled change CustomKafkaTemplate to KafkaTemplate in autowiring + +@Service +@Slf4j +public class Producer { + + @Autowired + private CustomKafkaTemplate kafkaTemplate; + + public void push(String topic, Object value) { + kafkaTemplate.send(topic, value); + } +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/repository/ServiceRequestRepository.java b/utilities/mdms-migration/output/src/main/java/digit/repository/ServiceRequestRepository.java new file mode 100644 index 00000000000..8b1b127ca56 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/repository/ServiceRequestRepository.java @@ -0,0 +1,47 @@ +package digit.repository; + + +import java.util.Map; + +import org.egov.tracer.model.ServiceCallException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +import lombok.extern.slf4j.Slf4j; + +@Repository +@Slf4j +public class ServiceRequestRepository { + + private ObjectMapper mapper; + + private RestTemplate restTemplate; + + + @Autowired + public ServiceRequestRepository(ObjectMapper mapper, RestTemplate restTemplate) { + this.mapper = mapper; + this.restTemplate = restTemplate; + } + + + public Object fetchResult(StringBuilder uri, Object request) { + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + Object response = null; + try { + response = restTemplate.postForObject(uri.toString(), request, Map.class); + }catch(HttpClientErrorException e) { + log.error("External Service threw an Exception: ",e); + throw new ServiceCallException(e.getResponseBodyAsString()); + }catch(Exception e) { + log.error("Exception while fetching from searcher: ",e); + } + + return response; + } +} \ No newline at end of file diff --git a/utilities/mdms-migration/output/src/main/java/digit/service/MDMSApplicationRunnerImpl.java b/utilities/mdms-migration/output/src/main/java/digit/service/MDMSApplicationRunnerImpl.java new file mode 100644 index 00000000000..7cb69251e4f --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/service/MDMSApplicationRunnerImpl.java @@ -0,0 +1,206 @@ +package digit.service; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.PostConstruct; + +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.jayway.jsonpath.JsonPath; + +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; + + +@Component +@Slf4j +public class MDMSApplicationRunnerImpl { + + @Autowired + public ResourceLoader resourceLoader; + + @Value("${egov.mdms.conf.path}") + public String mdmsFileDirectory; + + @Value("${masters.config.url}") + public String masterConfigUrl; + + @Value("${egov.mdms.stopOnAnyConfigError:true}") + public boolean stopOnAnyConfigError; + + private static Map>> tenantMap = new HashMap<>(); + + private static Map> masterConfigMap = new HashMap<>(); + + ObjectMapper objectMapper = new ObjectMapper(); + + @PostConstruct + public void run() { + try { + log.info("Reading files from: " + mdmsFileDirectory); + LinkedList errorFilesList = new LinkedList<>(); + if (!StringUtils.isEmpty(masterConfigUrl)) + readMdmsConfigFiles(masterConfigUrl); + readFiles(mdmsFileDirectory, errorFilesList); + log.info("List Of Files which has Error while parsing " + errorFilesList); + if (!errorFilesList.isEmpty() && stopOnAnyConfigError) { + log.info("Stopping as all files could not be loaded"); + System.exit(1); + } + } catch (Exception e) { + log.error("Exception while loading yaml files: ", e); + } + + } + + public void readFiles(String baseFolderPath, LinkedList errorList) { + File folder = new File(baseFolderPath); + File[] listOfFiles = folder.listFiles(); + if (listOfFiles != null) { + for (File file : listOfFiles) { + if (file.isFile()) { + String name = file.getName(); + String fileExtension = FilenameUtils.getExtension(file.getAbsolutePath()).toLowerCase(); + + + if (fileExtension.equalsIgnoreCase("json") + || fileExtension.equalsIgnoreCase("yaml") + || fileExtension.equalsIgnoreCase("yml") + ) { + log.debug("Reading file....:- " + file.getAbsolutePath()); + try { + Map jsonMap = objectMapper.readValue(file, new TypeReference>() { + @Override + public Type getType() { + return super.getType(); + } + }); + prepareTenantMap(jsonMap); + } catch (Exception e) { + log.error("Error occurred while loading file", e); + errorList.add(file.getAbsolutePath()); + } + } + } else if (file.isDirectory()) { + readFiles(file.getAbsolutePath(), errorList); + } + } + } + } + + public void prepareTenantMap(Map map) { + + String tenantId = (String) map.get("tenantId"); + String moduleName = (String) map.get("moduleName"); + Set masterKeys = map.keySet(); + String nonMasterKeys = "tenantId,moduleName"; + List ignoreKey = new ArrayList<>(Arrays.asList(nonMasterKeys.split(","))); + masterKeys.removeAll(ignoreKey); + boolean isMergeAllowed; + Map masterDataMap = new HashMap<>(); + Iterator masterKeyIterator = masterKeys.iterator(); + String masterName = null; + JSONArray masterDataJsonArray = null; + while (masterKeyIterator.hasNext()) { + masterName = masterKeyIterator.next(); + try { + masterDataJsonArray = JsonPath.read(objectMapper.writeValueAsString(map.get(masterName)), + "$"); + } catch (JsonProcessingException e) { + log.error("Error while parsing file", e); + } + + if (!tenantMap.containsKey(tenantId)) { + Map> moduleMap = new HashMap<>(); + moduleMap.put(moduleName, masterDataMap); + tenantMap.put(tenantId, moduleMap); + } else { + Map> tenantModule = tenantMap.get(tenantId); + + if (!tenantModule.containsKey(moduleName)) { + tenantModule.put(moduleName, masterDataMap); + } else { + Map moduleMaster = tenantModule.get(moduleName); + isMergeAllowed = isMergeAllowedForMaster(moduleName, masterName); + + if (!moduleMaster.containsKey(masterName)) { + masterDataMap.put(masterName, masterDataJsonArray); + moduleMaster.putAll(masterDataMap); + tenantModule.put(moduleName, moduleMaster); + } else if (moduleMaster.containsKey(masterName) && isMergeAllowed) { + JSONArray existingMasterDataJsonArray = moduleMaster.get(masterName); + existingMasterDataJsonArray.merge(masterDataJsonArray); + } else if ((moduleMaster.containsKey(masterName) && !isMergeAllowed)) { + log.error("merge is not allowed for master ++" + moduleName + " " + masterName); + } + } + tenantMap.put(tenantId, tenantModule); + } + masterDataMap.put(masterName, masterDataJsonArray); + } + } + + public void readMdmsConfigFiles(String masterConfigUrl) { + log.info("Loading master configs from: " + masterConfigUrl); + Resource resource = resourceLoader.getResource(masterConfigUrl); + InputStream inputStream = null; + try { + inputStream = resource.getInputStream(); + masterConfigMap = objectMapper.readValue(inputStream, new TypeReference>>() { + }); + } catch (IOException e) { + log.error("Exception while fetching service map for: ", e); + } finally { + IOUtils.closeQuietly(inputStream); + } + + //log.info("the Master config Map : " + masterConfigMap); + } + + public boolean isMergeAllowedForMaster(String moduleName, String masterName) { + boolean isMergeAllowed = false; + + if (masterConfigMap.containsKey(moduleName) && masterConfigMap.get(moduleName).containsKey(masterName)) { + Object masterData = masterConfigMap.get(moduleName).get(masterName); + if (masterData != null) { + try { + isMergeAllowed = JsonPath.read(objectMapper.writeValueAsString(masterData), + "$.isMergeAllowed"); + } catch (Exception ignored) { + } + } + } + return isMergeAllowed; + } + + + public static Map>> getTenantMap() { + return tenantMap; + } + + public static Map> getMasterConfigMap() { + return masterConfigMap; + } + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/service/MasterDataMigrationService.java b/utilities/mdms-migration/output/src/main/java/digit/service/MasterDataMigrationService.java new file mode 100644 index 00000000000..f3454f69029 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/service/MasterDataMigrationService.java @@ -0,0 +1,105 @@ +package digit.service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.validation.Valid; + +import org.egov.common.utils.AuditDetailsEnrichmentUtil; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import digit.models.coremodels.AuditDetails; +import digit.util.FileReader; +import digit.web.models.MasterDataMigrationRequest; +import digit.web.models.Mdms; +import digit.web.models.MdmsRequest; +import net.minidev.json.JSONArray; + +@Service +public class MasterDataMigrationService { + + @Autowired + private FileReader fileReader; + + @Autowired + private ObjectMapper objectMapper; + + @Autowired + private RestTemplate restTemplate; + + @Value("${master.schema.files.dir}") + public String schemaFilesDirectory; + + /** + * This methods accepts master data migration request and triggers + * creation of MDMS objects + * @param masterDataMigrationRequest + */ + public void migrateMasterData(@Valid MasterDataMigrationRequest masterDataMigrationRequest) { + + // Get Master Data map + Map>> tenantMap = MDMSApplicationRunnerImpl.getTenantMap(); + + // Get tenantId from request + String tenantId = masterDataMigrationRequest.getMasterDataMigrationCriteria().getTenantId(); + + // Build audit details for mdms objects creation + AuditDetails auditDetails = new AuditDetails(); + RequestInfo requestInfo = masterDataMigrationRequest.getRequestInfo(); + AuditDetailsEnrichmentUtil.enrichAuditDetails(auditDetails, requestInfo, Boolean.TRUE); + + List masterDataList = new ArrayList<>(); + + // Check if master data is present for the incoming tenantId. + if (tenantMap.containsKey(tenantId)) { + tenantMap.get(tenantId).keySet().forEach(module -> { + tenantMap.get(tenantId).get(module).keySet().forEach(master -> { + + // Get master data array for current module and master + JSONArray masterDataJsonArray = MDMSApplicationRunnerImpl + .getTenantMap() + .get(tenantId) + .get(module) + .get(master); + + // Build MDMS objects + masterDataJsonArray.forEach(masterDatum -> { + // Convert JSONArray member to JsonNode + JsonNode masterDatumJsonNode = objectMapper.valueToTree(masterDatum); + + // Build MDMS objects + Mdms mdms = Mdms.builder() + .schemaCode(module + DOT_SEPARATOR + master) + .data(masterDatumJsonNode) + .isActive(Boolean.TRUE) + .tenantId(tenantId) + .uniqueIdentifier(UUID.randomUUID().toString()) + .auditDetails(auditDetails) + .build(); + + MdmsRequest mdmsRequest = MdmsRequest.builder() + .mdms(mdms) + .requestInfo(requestInfo) + .build(); + + // TODO - Make call to MDMS Service with the created request + restTemplate.postForObject("http://localhost:8094/mdms-v2/v2/_create/" + mdmsRequest.getMdms().getSchemaCode(), mdmsRequest, Map.class); + }); + }); + }); + } else { + throw new CustomException(MASTER_DATA_MIGRATION_ERROR_CODE, MASTER_DATA_MIGRATION_TENANTID_DOES_NOT_EXIST_ERROR_MESSAGE + masterDataMigrationRequest.getMasterDataMigrationCriteria().getTenantId()); + } + + } + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/service/SchemaDefinitionMigrationService.java b/utilities/mdms-migration/output/src/main/java/digit/service/SchemaDefinitionMigrationService.java new file mode 100644 index 00000000000..be85db70aba --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/service/SchemaDefinitionMigrationService.java @@ -0,0 +1,113 @@ +package digit.service; + +import static digit.constants.MDMSMigrationToolkitConstants.DOT_SEPARATOR; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.saasquatch.jsonschemainferrer.*; + +import digit.repository.ServiceRequestRepository; +import digit.util.FileReader; +import digit.util.FileWriter; +import digit.web.models.SchemaDefinition; +import digit.web.models.SchemaDefinitionRequest; +import digit.web.models.SchemaMigrationRequest; +import net.minidev.json.JSONArray; + +@Service +public class SchemaDefinitionMigrationService { + + @Autowired + private ObjectMapper objectMapper; + + @Autowired + private FileWriter fileWriter; + + @Autowired + private FileReader fileReader; + + @Autowired + private JsonSchemaInferrer inferrer; + + @Value("${master.schema.files.dir}") + public String schemaFilesDirectory; + + @Autowired + private ServiceRequestRepository serviceRequestRepository; + + private Map schemaCodeToSchemaJsonMap; + + public void beginMigration(SchemaMigrationRequest schemaMigrationRequest) { + // Fetch schema code to schema definition map + Map schemaCodeVsSchemaDefinitionMap = fileReader.readFiles(schemaFilesDirectory); + + List schemaDefinitionPOJOs = new ArrayList<>(); + + // Go through each schemas and generate SchemaDefinition DTOs + schemaCodeVsSchemaDefinitionMap.keySet().forEach(schemaCode -> { + SchemaDefinition schemaDefinition = SchemaDefinition.builder() + .tenantId(schemaMigrationRequest.getSchemaMigrationCriteria().getTenantId()) + .isActive(Boolean.TRUE) + .code(schemaCode) + .definition(schemaCodeVsSchemaDefinitionMap.get(schemaCode)) + .id(UUID.randomUUID().toString()) + .build(); + schemaDefinitionPOJOs.add(schemaDefinition); + }); + + schemaDefinitionPOJOs.forEach(schemaDefinition -> { + SchemaDefinitionRequest schemaDefinitionRequest = SchemaDefinitionRequest.builder() + .requestInfo(schemaMigrationRequest.getRequestInfo()) + .schemaDefinition(schemaDefinition) + .build(); + + // Send it to kafka/make API calls to MDMS service schema APIs + serviceRequestRepository.fetchResult(new StringBuilder("http://localhost:8094/mdms-v2/schema/v1/_create"), schemaDefinitionRequest); + }); + } + + + public void generateSchemaDefinition() { + Map>> tenantMap = MDMSApplicationRunnerImpl.getTenantMap(); + + schemaCodeToSchemaJsonMap = new HashMap<>(); + + // Traverse tenantMap across the tenants, modules and masters to generate schema for each master + tenantMap.keySet().forEach(tenantId -> { + tenantMap.get(tenantId).keySet().forEach(module -> { + tenantMap.get(tenantId).get(module).keySet().forEach(master -> { + JSONArray masterDataJsonArray = MDMSApplicationRunnerImpl + .getTenantMap() + .get(tenantId) + .get(module) + .get(master); + + if (!masterDataJsonArray.isEmpty()) { + // Convert master data to JsonNode + JsonNode jsonNode = objectMapper.convertValue(masterDataJsonArray.get(0), JsonNode.class); + + // Feed the converted master data to jsonSchemaInferrer for generating schema + JsonNode schemaNode = inferrer.inferForSample(jsonNode); + + // Populate schemaCodeToSchemaJsonMap + schemaCodeToSchemaJsonMap.put(module + DOT_SEPARATOR + master, schemaNode); + + // Write generated schema definition to files with the name in module.master format + fileWriter.writeJsonToFile(schemaNode, module + DOT_SEPARATOR + master); + } + + }); + }); + }); + } +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/util/FileReader.java b/utilities/mdms-migration/output/src/main/java/digit/util/FileReader.java new file mode 100644 index 00000000000..e1b543ab294 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/util/FileReader.java @@ -0,0 +1,46 @@ +package digit.util; + +import static digit.constants.ErrorCodes.IO_ERROR_CODE; +import static digit.constants.ErrorCodes.IO_READ_ERROR_MESSAGE; +import static digit.constants.MDMSMigrationToolkitConstants.JSON_EXTENSION; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component +public class FileReader { + + @Autowired + private ObjectMapper objectMapper; + + public Map readFiles(String directoryPath){ + File folder = new File(directoryPath); + File[] listOfFiles = folder.listFiles(); + + Map schemaCodeVsSchemaDefinitionMap = new HashMap<>(); + + Arrays.stream(listOfFiles).forEach(file -> { + String schemaCode = file.getName().replace(JSON_EXTENSION, ""); + JsonNode schemaDefinition = null; + try { + schemaDefinition = objectMapper.readValue(file, JsonNode.class); + } catch (IOException e) { + throw new CustomException(IO_ERROR_CODE, IO_READ_ERROR_MESSAGE + file.getName()); + } + schemaCodeVsSchemaDefinitionMap.put(schemaCode, schemaDefinition); + }); + + return schemaCodeVsSchemaDefinitionMap; + + } +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/util/FileWriter.java b/utilities/mdms-migration/output/src/main/java/digit/util/FileWriter.java new file mode 100644 index 00000000000..720befdaf68 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/util/FileWriter.java @@ -0,0 +1,35 @@ +package digit.util; + +import static digit.constants.ErrorCodes.IO_ERROR_CODE; +import static digit.constants.ErrorCodes.IO_WRITE_ERROR_MESSAGE; +import static digit.constants.MDMSMigrationToolkitConstants.JSON_EXTENSION; + +import java.io.File; + +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component +public class FileWriter { + + @Autowired + private ObjectMapper objectMapper; + + @Value("${master.schema.files.dir}") + private String masterSchemaFilesDirectory; + + public void writeJsonToFile(JsonNode content, String fileName) { + try { + objectMapper.writeValue(new File(masterSchemaFilesDirectory + fileName + JSON_EXTENSION), content); + }catch (Exception e){ + throw new CustomException(IO_ERROR_CODE, IO_WRITE_ERROR_MESSAGE); + } + + } + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/util/IdgenUtil.java b/utilities/mdms-migration/output/src/main/java/digit/util/IdgenUtil.java new file mode 100644 index 00000000000..31d8d8fc2e9 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/util/IdgenUtil.java @@ -0,0 +1,50 @@ +package digit.util; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import digit.config.Configuration; +import digit.models.coremodels.IdGenerationRequest; +import digit.models.coremodels.IdGenerationResponse; +import digit.models.coremodels.IdRequest; +import digit.models.coremodels.IdResponse; +import digit.repository.ServiceRequestRepository; + +@Component +public class IdgenUtil { + + @Autowired + private ObjectMapper mapper; + + @Autowired + private ServiceRequestRepository restRepo; + + @Autowired + private Configuration configs; + + public List getIdList(RequestInfo requestInfo, String tenantId, String idName, String idformat, Integer count) { + List reqList = new ArrayList<>(); + for (int i = 0; i < count; i++) { + reqList.add(IdRequest.builder().idName(idName).format(idformat).tenantId(tenantId).build()); + } + + IdGenerationRequest request = IdGenerationRequest.builder().idRequests(reqList).requestInfo(requestInfo).build(); + StringBuilder uri = new StringBuilder(configs.getIdGenHost()).append(configs.getIdGenPath()); + IdGenerationResponse response = mapper.convertValue(restRepo.fetchResult(uri, request), IdGenerationResponse.class); + + List idResponses = response.getIdResponses(); + + if (CollectionUtils.isEmpty(idResponses)) + throw new CustomException("IDGEN ERROR", "No ids returned from idgen Service"); + + return idResponses.stream().map(IdResponse::getId).collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/utilities/mdms-migration/output/src/main/java/digit/util/MdmsUtil.java b/utilities/mdms-migration/output/src/main/java/digit/util/MdmsUtil.java new file mode 100644 index 00000000000..455c6585113 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/util/MdmsUtil.java @@ -0,0 +1,83 @@ +package digit.util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.egov.mdms.model.MasterDetail; +import org.egov.mdms.model.MdmsCriteria; +import org.egov.mdms.model.MdmsCriteriaReq; +import org.egov.mdms.model.MdmsResponse; +import org.egov.mdms.model.ModuleDetail; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import digit.config.Configuration; +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; + +@Slf4j +@Component +public class MdmsUtil { + + @Autowired + private RestTemplate restTemplate; + + @Autowired + private ObjectMapper mapper; + + @Autowired + private Configuration configs; + + + + + public Map> fetchMdmsData(RequestInfo requestInfo, String tenantId, String moduleName, + List masterNameList) { + StringBuilder uri = new StringBuilder(); + uri.append(configs.getMdmsHost()).append(configs.getMdmsEndPoint()); + MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequest(requestInfo, tenantId, moduleName, masterNameList); + Object response = new HashMap<>(); + int rate = 0; + MdmsResponse mdmsResponse = new MdmsResponse(); + try { + response = restTemplate.postForObject(uri.toString(), mdmsCriteriaReq, Map.class); + mdmsResponse = mapper.convertValue(response, MdmsResponse.class); + }catch(Exception e) { + log.error("Exception occurred while fetching category lists from mdms: ",e); + } + + return mdmsResponse.getMdmsRes(); + //log.info(ulbToCategoryListMap.toString()); + } + + private MdmsCriteriaReq getMdmsRequest(RequestInfo requestInfo, String tenantId, + String moduleName, List masterNameList) { + List masterDetailList = new ArrayList<>(); + for(String masterName: masterNameList) { + MasterDetail masterDetail = new MasterDetail(); + masterDetail.setName(masterName); + masterDetailList.add(masterDetail); + } + + ModuleDetail moduleDetail = new ModuleDetail(); + moduleDetail.setMasterDetails(masterDetailList); + moduleDetail.setModuleName(moduleName); + List moduleDetailList = new ArrayList<>(); + moduleDetailList.add(moduleDetail); + + MdmsCriteria mdmsCriteria = new MdmsCriteria(); + mdmsCriteria.setTenantId(tenantId.split("\\.")[0]); + mdmsCriteria.setModuleDetails(moduleDetailList); + + MdmsCriteriaReq mdmsCriteriaReq = new MdmsCriteriaReq(); + mdmsCriteriaReq.setMdmsCriteria(mdmsCriteria); + mdmsCriteriaReq.setRequestInfo(requestInfo); + + return mdmsCriteriaReq; + } +} \ No newline at end of file diff --git a/utilities/mdms-migration/output/src/main/java/digit/util/ResponseInfoFactory.java b/utilities/mdms-migration/output/src/main/java/digit/util/ResponseInfoFactory.java new file mode 100644 index 00000000000..19c02cd3a93 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/util/ResponseInfoFactory.java @@ -0,0 +1,25 @@ +package digit.util; + +import org.springframework.stereotype.Component; + +import digit.web.models.ResponseInfo; + +@Component +public class ResponseInfoFactory { + + public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { + + final String apiId = requestInfo != null ? requestInfo.getApiId() : ""; + final String ver = requestInfo != null ? requestInfo.getVer() : ""; + Long ts = null; + if(requestInfo!=null) + ts = requestInfo.getTs(); + final String resMsgId = "uief87324"; // FIXME : Hard-coded + final String msgId = requestInfo != null ? requestInfo.getMsgId() : ""; + final String responseStatus = success ? "successful" : "failed"; + + return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId) + .status(responseStatus).build(); + } + +} \ No newline at end of file diff --git a/utilities/mdms-migration/output/src/main/java/digit/util/UrlShortenerUtil.java b/utilities/mdms-migration/output/src/main/java/digit/util/UrlShortenerUtil.java new file mode 100644 index 00000000000..e6d0b2df9cd --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/util/UrlShortenerUtil.java @@ -0,0 +1,40 @@ +package digit.util; + +import java.util.HashMap; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import digit.config.Configuration; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Component +public class UrlShortenerUtil { + + @Autowired + private RestTemplate restTemplate; + + @Autowired + private Configuration configs; + + + public String getShortenedUrl(String url){ + + HashMap body = new HashMap<>(); + body.put("url",url); + StringBuilder builder = new StringBuilder(configs.getUrlShortnerHost()); + builder.append(configs.getUrlShortnerEndpoint()); + String res = restTemplate.postForObject(builder.toString(), body, String.class); + + if(StringUtils.isEmpty(res)){ + log.error("URL_SHORTENING_ERROR", "Unable to shorten url: " + url); + return url; + } + else return res; + } + + +} \ No newline at end of file diff --git a/utilities/mdms-migration/output/src/main/java/digit/util/UserUtil.java b/utilities/mdms-migration/output/src/main/java/digit/util/UserUtil.java new file mode 100644 index 00000000000..6d754552c4f --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/util/UserUtil.java @@ -0,0 +1,140 @@ +package digit.util; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Collections; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; + +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import digit.config.Configuration; +import digit.models.coremodels.UserDetailResponse; +import digit.models.coremodels.user.Role; +import digit.models.coremodels.user.User; +import digit.models.coremodels.user.enums.UserType; +import digit.repository.ServiceRequestRepository; + +@Component +public class UserUtil { + + @Autowired + private ObjectMapper mapper; + + @Autowired + private ServiceRequestRepository serviceRequestRepository; + + @Autowired + private Configuration configs; + + + @Autowired + public UserUtil(ObjectMapper mapper, ServiceRequestRepository serviceRequestRepository) { + this.mapper = mapper; + this.serviceRequestRepository = serviceRequestRepository; + } + + /** + * Returns UserDetailResponse by calling user service with given uri and object + * @param userRequest Request object for user service + * @param uri The address of the endpoint + * @return Response from user service as parsed as userDetailResponse + */ + + public UserDetailResponse userCall(Object userRequest, StringBuilder uri) { + String dobFormat = null; + if(uri.toString().contains(configs.getUserSearchEndpoint()) || uri.toString().contains(configs.getUserUpdateEndpoint())) + dobFormat="yyyy-MM-dd"; + else if(uri.toString().contains(configs.getUserCreateEndpoint())) + dobFormat = "dd/MM/yyyy"; + try{ + LinkedHashMap responseMap = (LinkedHashMap)serviceRequestRepository.fetchResult(uri, userRequest); + parseResponse(responseMap,dobFormat); + UserDetailResponse userDetailResponse = mapper.convertValue(responseMap,UserDetailResponse.class); + return userDetailResponse; + } + catch(IllegalArgumentException e) + { + throw new CustomException("IllegalArgumentException","ObjectMapper not able to convertValue in userCall"); + } + } + + + /** + * Parses date formats to long for all users in responseMap + * @param responseMap LinkedHashMap got from user api response + */ + + public void parseResponse(LinkedHashMap responseMap, String dobFormat){ + List users = (List)responseMap.get("user"); + String format1 = "dd-MM-yyyy HH:mm:ss"; + if(users!=null){ + users.forEach( map -> { + map.put("createdDate",dateTolong((String)map.get("createdDate"),format1)); + if((String)map.get("lastModifiedDate")!=null) + map.put("lastModifiedDate",dateTolong((String)map.get("lastModifiedDate"),format1)); + if((String)map.get("dob")!=null) + map.put("dob",dateTolong((String)map.get("dob"),dobFormat)); + if((String)map.get("pwdExpiryDate")!=null) + map.put("pwdExpiryDate",dateTolong((String)map.get("pwdExpiryDate"),format1)); + } + ); + } + } + + /** + * Converts date to long + * @param date date to be parsed + * @param format Format of the date + * @return Long value of date + */ + private Long dateTolong(String date,String format){ + SimpleDateFormat f = new SimpleDateFormat(format); + Date d = null; + try { + d = f.parse(date); + } catch (ParseException e) { + throw new CustomException("INVALID_DATE_FORMAT","Failed to parse date format in user"); + } + return d.getTime(); + } + + /** + * enriches the userInfo with statelevel tenantId and other fields + * The function creates user with username as mobile number. + * @param mobileNumber + * @param tenantId + * @param userInfo + */ + public void addUserDefaultFields(String mobileNumber,String tenantId, User userInfo, UserType userType){ + Role role = getCitizenRole(tenantId); + userInfo.setRoles(Collections.singleton(role)); + userInfo.setType(userType); + userInfo.setUsername(mobileNumber); + userInfo.setTenantId(getStateLevelTenant(tenantId)); + userInfo.setActive(true); + } + + /** + * Returns role object for citizen + * @param tenantId + * @return + */ + private Role getCitizenRole(String tenantId){ + Role role = Role.builder().build(); + role.setCode("CITIZEN"); + role.setName("Citizen"); + role.setTenantId(getStateLevelTenant(tenantId)); + return role; + } + + public String getStateLevelTenant(String tenantId){ + return tenantId.split("\\.")[0]; + } + +} \ No newline at end of file diff --git a/utilities/mdms-migration/output/src/main/java/digit/util/WorkflowUtil.java b/utilities/mdms-migration/output/src/main/java/digit/util/WorkflowUtil.java new file mode 100644 index 00000000000..3dcc6897983 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/util/WorkflowUtil.java @@ -0,0 +1,183 @@ +package digit.util; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import digit.config.Configuration; +import digit.models.coremodels.BusinessService; +import digit.models.coremodels.BusinessServiceResponse; +import digit.models.coremodels.ProcessInstance; +import digit.models.coremodels.ProcessInstanceRequest; +import digit.models.coremodels.ProcessInstanceResponse; +import digit.models.coremodels.RequestInfoWrapper; +import digit.models.coremodels.State; +import digit.models.coremodels.Workflow; +import digit.repository.ServiceRequestRepository; + +@Service +public class WorkflowUtil { + + @Autowired + private ServiceRequestRepository repository; + + @Autowired + private ObjectMapper mapper; + + @Autowired + private Configuration configs; + + + + /** + * Searches the BussinessService corresponding to the businessServiceCode + * Returns applicable BussinessService for the given parameters + * @param requestInfo + * @param tenantId + * @param businessServiceCode + * @return + */ + public BusinessService getBusinessService(RequestInfo requestInfo, String tenantId, String businessServiceCode) { + + StringBuilder url = getSearchURLWithParams(tenantId, businessServiceCode); + RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); + Object result = repository.fetchResult(url, requestInfoWrapper); + BusinessServiceResponse response = null; + try { + response = mapper.convertValue(result, BusinessServiceResponse.class); + } catch (IllegalArgumentException e) { + throw new CustomException("PARSING ERROR", "Failed to parse response of workflow business service search"); + } + + if (CollectionUtils.isEmpty(response.getBusinessServices())) + throw new CustomException("BUSINESSSERVICE_NOT_FOUND", "The businessService " + businessServiceCode + " is not found"); + + return response.getBusinessServices().get(0); + } + + /** + * Calls the workflow service with the given action and updates the status + * Returns the updated status of the application + * @param requestInfo + * @param tenantId + * @param businessId + * @param businessServiceCode + * @param workflow + * @param wfModuleName + * @return + */ + public String updateWorkflowStatus(RequestInfo requestInfo, String tenantId, + String businessId, String businessServiceCode, Workflow workflow, String wfModuleName) { + ProcessInstance processInstance = getProcessInstanceForWorkflow(requestInfo, tenantId, businessId, + businessServiceCode, workflow, wfModuleName); + ProcessInstanceRequest workflowRequest = new ProcessInstanceRequest(requestInfo, Collections.singletonList(processInstance)); + State state = callWorkFlow(workflowRequest); + + return state.getApplicationStatus(); + } + + /** + * Creates url for search based on given tenantId and businessServices + * @param tenantId + * @param businessService + * @return + */ + private StringBuilder getSearchURLWithParams(String tenantId, String businessService) { + StringBuilder url = new StringBuilder(configs.getWfHost()); + url.append(configs.getWfBusinessServiceSearchPath()); + url.append("?tenantId="); + url.append(tenantId); + url.append("&businessServices="); + url.append(businessService); + return url; + } + + /** + * Enriches ProcessInstance Object for Workflow + * @param requestInfo + * @param tenantId + * @param businessId + * @param businessServiceCode + * @param workflow + * @param wfModuleName + * @return + */ + private ProcessInstance getProcessInstanceForWorkflow(RequestInfo requestInfo, String tenantId, + String businessId, String businessServiceCode, Workflow workflow, String wfModuleName) { + + ProcessInstance processInstance = new ProcessInstance(); + processInstance.setBusinessId(businessId); + processInstance.setAction(workflow.getAction()); + processInstance.setModuleName(wfModuleName); + processInstance.setTenantId(tenantId); + processInstance.setBusinessService(getBusinessService(requestInfo, tenantId, businessServiceCode).getBusinessService()); + processInstance.setDocuments(workflow.getVerificationDocuments()); + processInstance.setComment(workflow.getComments()); + + if(!CollectionUtils.isEmpty(workflow.getAssignes())) { + List users = new ArrayList<>(); + + workflow.getAssignes().forEach(uuid -> { + User user = new User(); + user.setUuid(uuid); + users.add(user); + }); + + processInstance.setAssignes(users); + } + + return processInstance; + } + + /** + * Gets the workflow corresponding to the processInstance + * @param processInstances + * @return + */ + public Map getWorkflow(List processInstances) { + + Map businessIdToWorkflow = new HashMap<>(); + + processInstances.forEach(processInstance -> { + List userIds = null; + + if(!CollectionUtils.isEmpty(processInstance.getAssignes())){ + userIds = processInstance.getAssignes().stream().map(User::getUuid).collect(Collectors.toList()); + } + + Workflow workflow = Workflow.builder() + .action(processInstance.getAction()) + .assignes(userIds) + .comments(processInstance.getComment()) + .verificationDocuments(processInstance.getDocuments()) + .build(); + + businessIdToWorkflow.put(processInstance.getBusinessId(), workflow); + }); + + return businessIdToWorkflow; + } + + /** + * Method to take the ProcessInstanceRequest as parameter and set resultant status + * @param workflowReq + * @return + */ + private State callWorkFlow(ProcessInstanceRequest workflowReq) { + ProcessInstanceResponse response = null; + StringBuilder url = new StringBuilder(configs.getWfHost().concat(configs.getWfTransitionPath())); + Object optional = repository.fetchResult(url, workflowReq); + response = mapper.convertValue(optional, ProcessInstanceResponse.class); + return response.getProcessInstances().get(0).getState(); + } +} \ No newline at end of file diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/controllers/DataApiController.java b/utilities/mdms-migration/output/src/main/java/digit/web/controllers/DataApiController.java new file mode 100644 index 00000000000..a206097f9a0 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/controllers/DataApiController.java @@ -0,0 +1,40 @@ +package digit.web.controllers; + + +import javax.validation.Valid; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import digit.service.MasterDataMigrationService; +import digit.web.models.MasterDataMigrationRequest; + +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Controller +@RequestMapping(value = "/data") +public class DataApiController { + + private final ObjectMapper objectMapper; + + private final MasterDataMigrationService masterDataMigrationService; + + @Autowired + public DataApiController(ObjectMapper objectMapper, MasterDataMigrationService masterDataMigrationService) { + this.objectMapper = objectMapper; + this.masterDataMigrationService = masterDataMigrationService; + } + + @RequestMapping(value = "/v1/_migrate", method = RequestMethod.POST) + public ResponseEntity migrateMasterData(@Valid @RequestBody MasterDataMigrationRequest body) { + masterDataMigrationService.migrateMasterData(body); + return new ResponseEntity<>(HttpStatus.ACCEPTED); + } + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/controllers/SchemaApiController.java b/utilities/mdms-migration/output/src/main/java/digit/web/controllers/SchemaApiController.java new file mode 100644 index 00000000000..0b5ad03814c --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/controllers/SchemaApiController.java @@ -0,0 +1,49 @@ +package digit.web.controllers; + + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import digit.service.SchemaDefinitionMigrationService; +import digit.web.models.SchemaMigrationRequest; + +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@RestController +@RequestMapping(value = "/schema") +public class SchemaApiController { + + private final ObjectMapper objectMapper; + + private final HttpServletRequest request; + + private final SchemaDefinitionMigrationService schemaDefinitionMigrationService; + + @Autowired + public SchemaApiController(ObjectMapper objectMapper, HttpServletRequest request, SchemaDefinitionMigrationService schemaDefinitionMigrationService) { + this.objectMapper = objectMapper; + this.request = request; + this.schemaDefinitionMigrationService = schemaDefinitionMigrationService; + } + + @PostMapping(value = "/v1/_generate") + public ResponseEntity generateSchemaDefinition() { + schemaDefinitionMigrationService.generateSchemaDefinition(); + return new ResponseEntity<>(HttpStatus.ACCEPTED); + } + + @PostMapping(value = "/v1/_migrate") + public ResponseEntity migrateSchemaDefinition(@RequestBody SchemaMigrationRequest schemaMigrationRequest) { + schemaDefinitionMigrationService.beginMigration(schemaMigrationRequest); + return new ResponseEntity<>(HttpStatus.ACCEPTED); + } + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/Error.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/Error.java new file mode 100644 index 00000000000..933951d200b --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/Error.java @@ -0,0 +1,56 @@ +package digit.web.models; + +import java.util.ArrayList; +import java.util.List; + +import javax.validation.constraints.NotNull; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * Error object will be returned as a part of reponse body in conjunction with ResponseInfo as part of ErrorResponse whenever the request processing status in the ResponseInfo is FAILED. HTTP return in this scenario will usually be HTTP 400. + */ +@Schema(description = "Error object will be returned as a part of reponse body in conjunction with ResponseInfo as part of ErrorResponse whenever the request processing status in the ResponseInfo is FAILED. HTTP return in this scenario will usually be HTTP 400.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Error { + @JsonProperty("code") + @NotNull + + private String code = null; + + @JsonProperty("message") + @NotNull + + private String message = null; + + @JsonProperty("description") + + private String description = null; + + @JsonProperty("params") + + private List params = null; + + + public Error addParamsItem(String paramsItem) { + if (this.params == null) { + this.params = new ArrayList<>(); + } + this.params.add(paramsItem); + return this; + } + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/ErrorRes.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/ErrorRes.java new file mode 100644 index 00000000000..c37966358a7 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/ErrorRes.java @@ -0,0 +1,49 @@ +package digit.web.models; + +import java.util.ArrayList; +import java.util.List; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * All APIs will return ErrorRes in case of failure which will carry ResponseInfo as metadata and Error object as actual representation of error. In case of bulk apis, some apis may chose to return the array of Error objects to indicate individual failure. + */ +@Schema(description = "All APIs will return ErrorRes in case of failure which will carry ResponseInfo as metadata and Error object as actual representation of error. In case of bulk apis, some apis may chose to return the array of Error objects to indicate individual failure.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ErrorRes { + @JsonProperty("ResponseInfo") + @NotNull + + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("Errors") + @Valid + private List errors = null; + + + public ErrorRes addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/MasterDataMigrationCriteria.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/MasterDataMigrationCriteria.java new file mode 100644 index 00000000000..e94e0a17a9b --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/MasterDataMigrationCriteria.java @@ -0,0 +1,32 @@ +package digit.web.models; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * MasterDataMigrationCriteria + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MasterDataMigrationCriteria { + + @JsonProperty("tenantId") + @NotNull + @Size(min = 2, max = 100) + private String tenantId = null; + + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/MasterDataMigrationRequest.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/MasterDataMigrationRequest.java new file mode 100644 index 00000000000..0c2d06e08bc --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/MasterDataMigrationRequest.java @@ -0,0 +1,35 @@ +package digit.web.models; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * MasterDataMigrationRequest + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MasterDataMigrationRequest { + @JsonProperty("masterDataMigrationCriteria") + @Valid + private MasterDataMigrationCriteria masterDataMigrationCriteria = null; + + @JsonProperty("requestInfo") + @NotNull + @Valid + private RequestInfo requestInfo = null; + + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/Mdms.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/Mdms.java new file mode 100644 index 00000000000..8459e45ff24 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/Mdms.java @@ -0,0 +1,47 @@ +package digit.web.models; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; + +import digit.models.coremodels.AuditDetails; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Mdms { + @JsonProperty("tenantId") + @NotNull + @Size(min = 2, max = 128) + private String tenantId = null; + + @JsonProperty("schemaCode") + @Size(min = 2, max = 128) + private String schemaCode = null; + + @JsonProperty("uniqueIdentifier") + @Size(min = 2, max = 128) + private String uniqueIdentifier = null; + + @JsonProperty("data") + @NotNull + private JsonNode data = null; + + @JsonProperty("isActive") + private Boolean isActive = true; + + @JsonProperty("auditDetails") + @Valid + private AuditDetails auditDetails = null; +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/MdmsRequest.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/MdmsRequest.java new file mode 100644 index 00000000000..b23f94c8a7b --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/MdmsRequest.java @@ -0,0 +1,29 @@ +package digit.web.models; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsRequest { + + @JsonProperty("RequestInfo") + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("Mdms") + @Valid + private Mdms mdms = null; + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/RequestInfoWrapper.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/RequestInfoWrapper.java new file mode 100644 index 00000000000..32368e4c292 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/RequestInfoWrapper.java @@ -0,0 +1,22 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class RequestInfoWrapper { + + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + +} \ No newline at end of file diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/ResponseInfo.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/ResponseInfo.java new file mode 100644 index 00000000000..c0fe3183cdd --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/ResponseInfo.java @@ -0,0 +1,87 @@ +package digit.web.models; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * ResponseInfo should be used to carry metadata information about the response from the server. apiId, ver and msgId in ResponseInfo should always correspond to the same values in respective request's RequestInfo. + */ +@Schema(description = "ResponseInfo should be used to carry metadata information about the response from the server. apiId, ver and msgId in ResponseInfo should always correspond to the same values in respective request's RequestInfo.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ResponseInfo { + @JsonProperty("apiId") + @NotNull + + @Size(max=128) private String apiId = null; + + @JsonProperty("ver") + @NotNull + + @Size(max=32) private String ver = null; + + @JsonProperty("ts") + @NotNull + + private Long ts = null; + + @JsonProperty("resMsgId") + + @Size(max=256) private String resMsgId = null; + + @JsonProperty("msgId") + + @Size(max=256) private String msgId = null; + + /** + * status of request processing - to be enhanced in futuer to include INPROGRESS + */ + public enum StatusEnum { + SUCCESSFUL("SUCCESSFUL"), + + FAILED("FAILED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } @JsonProperty("status") + @NotNull + + private StatusEnum status = null; + + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/Role.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/Role.java new file mode 100644 index 00000000000..515969a2e53 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/Role.java @@ -0,0 +1,45 @@ +package digit.web.models; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * minimal representation of the Roles in the system to be carried along in UserInfo with RequestInfo meta data. Actual authorization service to extend this to have more role related attributes + */ +@Schema(description = "minimal representation of the Roles in the system to be carried along in UserInfo with RequestInfo meta data. Actual authorization service to extend this to have more role related attributes ") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Role { + @JsonProperty("tenantId") + @NotNull + + private String tenantId = null; + + @JsonProperty("id") + + private String id = null; + + @JsonProperty("name") + + @Size(max=64) private String name = null; + + @JsonProperty("description") + + private String description = null; + + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinition.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinition.java new file mode 100644 index 00000000000..f2e402931a6 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinition.java @@ -0,0 +1,59 @@ +package digit.web.models; + + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; + +import digit.models.coremodels.AuditDetails; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class SchemaDefinition { + + @JsonProperty("id") + @Size(min = 2, max = 128) + private String id = null; + + @JsonProperty("tenantId") + @NotNull + @Size(min = 2, max = 128) + private String tenantId = null; + + @JsonProperty("code") + @NotNull + @Size(min = 2, max = 128) + private String code = null; + + @JsonProperty("description") + + @Size(min = 2, max = 512) + private String description = null; + + @JsonProperty("definition") + @NotNull + private JsonNode definition = null; + + @JsonProperty("isActive") + + private Boolean isActive = true; + + @JsonProperty("auditDetails") + @Valid + private AuditDetails auditDetails = null; + +} \ No newline at end of file diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinitionRequest.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinitionRequest.java new file mode 100644 index 00000000000..37067d0c773 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinitionRequest.java @@ -0,0 +1,32 @@ +package digit.web.models; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class SchemaDefinitionRequest { + @JsonProperty("RequestInfo") + @NotNull + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("SchemaDefinition") + @NotNull + @Valid + private SchemaDefinition schemaDefinition = null; +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinitionResponse.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinitionResponse.java new file mode 100644 index 00000000000..cd109af58db --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaDefinitionResponse.java @@ -0,0 +1,47 @@ +package digit.web.models; + +import java.util.ArrayList; +import java.util.List; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * Response from server + */ +@Schema(description = "Response from server") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SchemaDefinitionResponse { + @JsonProperty("ResponseInfo") + + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("SchemaDefinitions") + @Valid + private List schemaDefinitions = null; + + + public SchemaDefinitionResponse addSchemaDefinitionsItem(SchemaDefinition schemaDefinitionsItem) { + if (this.schemaDefinitions == null) { + this.schemaDefinitions = new ArrayList<>(); + } + this.schemaDefinitions.add(schemaDefinitionsItem); + return this; + } + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaMigrationCriteria.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaMigrationCriteria.java new file mode 100644 index 00000000000..19f71dd57c8 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaMigrationCriteria.java @@ -0,0 +1,29 @@ +package digit.web.models; + +import javax.validation.constraints.NotNull; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * SchemaMigrationCriteria + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SchemaMigrationCriteria { + + @JsonProperty("tenantId") + @NotNull + private String tenantId = null; + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaMigrationRequest.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaMigrationRequest.java new file mode 100644 index 00000000000..0fcf47741c1 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/SchemaMigrationRequest.java @@ -0,0 +1,33 @@ +package digit.web.models; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * SchemaMigrationRequest + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SchemaMigrationRequest { + + @JsonProperty("requestInfo") + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("schemaMigrationCriteria") + @Valid + private SchemaMigrationCriteria schemaMigrationCriteria = null; + +} diff --git a/utilities/mdms-migration/output/src/main/java/digit/web/models/User.java b/utilities/mdms-migration/output/src/main/java/digit/web/models/User.java new file mode 100644 index 00000000000..dcbc037b459 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/java/digit/web/models/User.java @@ -0,0 +1,199 @@ +package digit.web.models; + +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * This is acting ID token of the authenticated user on the server. Any value provided by the clients will be ignored and actual user based on authtoken will be used on the server. + */ +@Schema(description = "This is acting ID token of the authenticated user on the server. Any value provided by the clients will be ignored and actual user based on authtoken will be used on the server.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class User { + @JsonProperty("tenantId") + @NotNull + + private String tenantId = null; + + @JsonProperty("id") + + private Integer id = null; + + @JsonProperty("uuid") + + private String uuid = null; + + @JsonProperty("userName") + @NotNull + + private String userName = null; + + @JsonProperty("mobileNumber") + + private String mobileNumber = null; + + @JsonProperty("emailId") + + private String emailId = null; + + @JsonProperty("roles") + @NotNull + @Valid + private List roles = new ArrayList<>(); + + @JsonProperty("salutation") + + private String salutation = null; + + @JsonProperty("name") + + private String name = null; + + @JsonProperty("gender") + + private String gender = null; + + @JsonProperty("alternateMobileNumber") + + private String alternateMobileNumber = null; + + @JsonProperty("altContactNumber") + + private String altContactNumber = null; + + @JsonProperty("pan") + + private String pan = null; + + @JsonProperty("aadhaarNumber") + + private String aadhaarNumber = null; + + @JsonProperty("permanentAddress") + + @Size(max=300) private String permanentAddress = null; + + @JsonProperty("permanentCity") + + @Size(max=300) private String permanentCity = null; + + @JsonProperty("permanentPincode") + + @Size(max=6) private String permanentPincode = null; + + @JsonProperty("correspondenceCity") + + @Size(max=50) private String correspondenceCity = null; + + @JsonProperty("correspondencePincode") + + @Size(max=6) private String correspondencePincode = null; + + @JsonProperty("correspondenceAddress") + + @Size(max=300) private String correspondenceAddress = null; + + @JsonProperty("active") + + private Boolean active = null; + + @JsonProperty("locale") + + @Size(max=10) private String locale = null; + + @JsonProperty("type") + + @Size(max=20) private String type = null; + + @JsonProperty("accountLocked") + + private Boolean accountLocked = null; + + @JsonProperty("accountLockedDate") + + private Long accountLockedDate = null; + + @JsonProperty("fatherOrHusbandName") + + @Size(max=100) private String fatherOrHusbandName = null; + + @JsonProperty("relationship") + + @Size(max=20) private String relationship = null; + + @JsonProperty("signature") + + private String signature = null; + + @JsonProperty("bloodGroup") + + @Size(max=3) private String bloodGroup = null; + + @JsonProperty("photo") + + private String photo = null; + + @JsonProperty("identificationMark") + + private String identificationMark = null; + + @JsonProperty("createdBy") + + private Long createdBy = null; + + @JsonProperty("password") + + private String password = null; + + @JsonProperty("otpReference") + + private String otpReference = null; + + @JsonProperty("lastModifiedBy") + + private Long lastModifiedBy = null; + + @JsonProperty("createdDate") + + @Valid + private LocalDate createdDate = null; + + @JsonProperty("lastModifiedDate") + + @Valid + private LocalDate lastModifiedDate = null; + + @JsonProperty("dob") + + private Long dob = null; + + @JsonProperty("pwdExpiryDate") + + private Long pwdExpiryDate = null; + + + public User addRolesItem(Role rolesItem) { + this.roles.add(rolesItem); + return this; + } + +} diff --git a/utilities/mdms-migration/output/src/main/resources/application.properties b/utilities/mdms-migration/output/src/main/resources/application.properties new file mode 100644 index 00000000000..90d7b3e72c9 --- /dev/null +++ b/utilities/mdms-migration/output/src/main/resources/application.properties @@ -0,0 +1,90 @@ +server.contextPath=/mdms-migration-toolkit +server.servlet.context-path=/mdms-migration-toolkit +server.port=8080 +app.timezone=UTC + +#DATABASE CONFIGURATION +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url=jdbc:postgresql://localhost:5432/postgres +spring.datasource.username=postgres +spring.datasource.password=postgres + +#FLYWAY CONFIGURATION +spring.flyway.url=jdbc:postgresql://localhost:5432/postgres +spring.flyway.user=postgres +spring.flyway.password=postgres +spring.flyway.table=public +spring.flyway.baseline-on-migrate=true +spring.flyway.outOfOrder=true +spring.flyway.locations=classpath:/db/migration/main +spring.flyway.enabled=false + +# KAFKA SERVER CONFIGURATIONS +kafka.config.bootstrap_server_config=localhost:9092 +spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.group-id=mdms-migration-toolkit +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.listener.missing-topics-fatal=false +spring.kafka.consumer.properties.spring.json.use.type.headers=false + +# KAFKA CONSUMER CONFIGURATIONS +kafka.consumer.config.auto_commit=true +kafka.consumer.config.auto_commit_interval=100 +kafka.consumer.config.session_timeout=15000 +kafka.consumer.config.auto_offset_reset=earliest +# KAFKA PRODUCER CONFIGURATIONS +kafka.producer.config.retries_config=0 +kafka.producer.config.batch_size_config=16384 +kafka.producer.config.linger_ms_config=1 +kafka.producer.config.buffer_memory_config=33554432 + +#Localization config +egov.localization.host=https://dev.digit.org +egov.localization.workDir.path=/localization/messages/v1 +egov.localization.context.path=/localization/messages/v1 +egov.localization.search.endpoint=/_search +egov.localization.statelevel=true + +#mdms urls +egov.mdms.host=https://dev.digit.org +egov.mdms.search.endpoint=/egov-mdms-service/v1/_search + +#hrms urls +egov.hrms.host=https://dev.digit.org +egov.hrms.search.endpoint=/egov-hrms/employees/_search + +#User config +egov.user.host=https://dev.digit.org +egov.user.context.path=/user/users +egov.user.create.path=/_createnovalidate +egov.user.search.path=/user/_search +egov.user.update.path=/_updatenovalidate + +#Idgen Config +egov.idgen.host=https://dev.digit.org/ +egov.idgen.path=egov-idgen/id/_generate + +#Workflow config +is.workflow.enabled=true +egov.workflow.host=https://dev.digit.org +egov.workflow.transition.path=/egov-workflow-v2/egov-wf/process/_transition +egov.workflow.businessservice.search.path=/egov-workflow-v2/egov-wf/businessservice/_search +egov.workflow.processinstance.search.path=/egov-workflow-v2/egov-wf/process/_search + +#url shortner +egov.url.shortner.host=https://dev.digit.org +egov.url.shortner.endpoint=/egov-url-shortening/shortener + +egov.sms.notification.topic=egov.core.notification.sms +kafka.topics.receipt.create=dss-collection + +# The value of the following field should be changed to service specific name +kafka.topics.consumer=service-consumer-topic + +#egov.mdms.conf.path=/D:/MDMS/health-campaign-mdms/data +egov.mdms.conf.path=C:/Users/Palak Garg/Desktop/New folder/ukd-mdms-data/data +masters.config.url=https://raw.githubusercontent.com/egovernments/egov-mdms-data/DEV/master-config.json +egov.mdms.stopOnAnyConfigError=true +master.schema.files.dir=C:/Users/Palak Garg/Desktop/New folder/schema \ No newline at end of file diff --git a/utilities/mdms-migration/output/src/test/java/digit/TestConfiguration.java b/utilities/mdms-migration/output/src/test/java/digit/TestConfiguration.java new file mode 100644 index 00000000000..c3371253d38 --- /dev/null +++ b/utilities/mdms-migration/output/src/test/java/digit/TestConfiguration.java @@ -0,0 +1,16 @@ +package digit; + +import static org.mockito.Mockito.mock; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.kafka.core.KafkaTemplate; + +@Configuration +public class TestConfiguration { + @Bean + @SuppressWarnings("unchecked") + public KafkaTemplate kafkaTemplate() { + return mock(KafkaTemplate.class); + } +} \ No newline at end of file diff --git a/utilities/mdms-migration/output/src/test/java/digit/web/controllers/DataApiControllerTest.java b/utilities/mdms-migration/output/src/test/java/digit/web/controllers/DataApiControllerTest.java new file mode 100644 index 00000000000..aefd590b197 --- /dev/null +++ b/utilities/mdms-migration/output/src/test/java/digit/web/controllers/DataApiControllerTest.java @@ -0,0 +1,44 @@ +package digit.web.controllers; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.context.annotation.Import; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; + +import digit.TestConfiguration; + +/** +* API tests for DataApiController +*/ +@Ignore +@RunWith(SpringRunner.class) +@WebMvcTest(DataApiController.class) +@Import(TestConfiguration.class) +public class DataApiControllerTest { + + @Autowired + private MockMvc mockMvc; + + @Test + public void migrateMasterDataSuccess() throws Exception { + mockMvc.perform(post("/data/v1/_migrate").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + } + + @Test + public void migrateMasterDataFailure() throws Exception { + mockMvc.perform(post("/data/v1/_migrate").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isBadRequest()); + } + +} diff --git a/utilities/mdms-migration/output/src/test/java/digit/web/controllers/SchemaApiControllerTest.java b/utilities/mdms-migration/output/src/test/java/digit/web/controllers/SchemaApiControllerTest.java new file mode 100644 index 00000000000..2171e508735 --- /dev/null +++ b/utilities/mdms-migration/output/src/test/java/digit/web/controllers/SchemaApiControllerTest.java @@ -0,0 +1,44 @@ +package digit.web.controllers; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.context.annotation.Import; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; + +import digit.TestConfiguration; + +/** +* API tests for SchemaApiController +*/ +@Ignore +@RunWith(SpringRunner.class) +@WebMvcTest(SchemaApiController.class) +@Import(TestConfiguration.class) +public class SchemaApiControllerTest { + + @Autowired + private MockMvc mockMvc; + + @Test + public void migrateSchemaDefinitionSuccess() throws Exception { + mockMvc.perform(post("/schema/v1/_migrate").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + } + + @Test + public void migrateSchemaDefinitionFailure() throws Exception { + mockMvc.perform(post("/schema/v1/_migrate").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isBadRequest()); + } + +}