From 28b475195a900eeec53eae8f5d22919ec2f3526f Mon Sep 17 00:00:00 2001 From: Taniya-eGov Date: Mon, 8 Jul 2024 11:05:00 +0530 Subject: [PATCH 001/133] added currentmonthRoundOff and totalRoundOff in mapOfDemandDetailList --- .../egov/demand/service/DemandService.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java b/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java index acc049f64..afbccf943 100644 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java +++ b/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java @@ -720,11 +720,20 @@ public int compare(Demand d1, Demand d2) { BigDecimal netdue = BigDecimal.ZERO; BigDecimal netDueWithPenalty = BigDecimal.ZERO; BigDecimal totalApplicablePenalty =BigDecimal.ZERO; + BigDecimal currentmonthRoundOff=BigDecimal.ZERO; + BigDecimal totalRoundOff=BigDecimal.ZERO; currentmonthBill = currentMonthDemandDetailList.stream() .filter(dd -> dd.getTaxHeadMasterCode().equals("10101")) // filter by taxHeadCode .map(dd -> dd.getTaxAmount().subtract(dd.getCollectionAmount())) // map to the balance between taxAmount and collectedAmount .reduce(BigDecimal.ZERO, BigDecimal::add); + + currentmonthRoundOff = currentMonthDemandDetailList.stream() + .filter(dd -> dd.getTaxHeadMasterCode().equals("WS_Round_Off")) // filter by taxHeadCode + .map(dd -> dd.getTaxAmount().subtract(dd.getCollectionAmount())) // map to the balance between taxAmount and collectedAmount + .reduce(BigDecimal.ZERO, BigDecimal::add); + log.info("currentmonthRoundOff::::"+currentmonthRoundOff); + log.info("currentMonthDemandDetailList::::"+currentMonthDemandDetailList); currentMonthPenalty = currentMonthDemandDetailList.stream() .filter(dd -> dd.getTaxHeadMasterCode().equals("WS_TIME_PENALTY")) // filter by taxHeadCode @@ -732,7 +741,8 @@ public int compare(Demand d1, Demand d2) { .reduce(BigDecimal.ZERO, BigDecimal::add); log.info("currentMonthDemandDetailListafter::::"+currentMonthDemandDetailList); log.info("currentMonthPenalty" + currentMonthPenalty); - currentmonthTotalDue = currentmonthBill.add(currentMonthPenalty); + currentmonthTotalDue = currentmonthBill.add(currentMonthPenalty).add(currentmonthRoundOff); + log.info("currentmonthTotalDue" + currentmonthTotalDue); if(currentMonthPenalty.equals(BigDecimal.ZERO)) { List masterDetails = new ArrayList<>(); MasterDetail masterDetail = new MasterDetail("Penalty", "[?(@)]"); @@ -759,7 +769,13 @@ public int compare(Demand d1, Demand d2) { //Tax headcode for WScharges,legacypenalty,legacyarea - List taxHeadCodesToFilterWithoutPenalty = Arrays.asList("10102", "10201", "10101"); + List taxHeadCodesToFilterWithoutPenalty = Arrays.asList("10102", "10201", "10101","WS_Round_Off"); + + // Initialize the variable for the sum of taxAmount - collectedAmount specifically for WS_Round_Off + totalRoundOff = remainingMonthDemandDetailList.stream() + .filter(dd -> "WS_Round_Off".equals(dd.getTaxHeadMasterCode())) // Filter specifically for WS_Round_Off + .map(dd -> dd.getTaxAmount().subtract(dd.getCollectionAmount())) // Calculate taxAmount - collectedAmount + .reduce(BigDecimal.ZERO, BigDecimal::add); // Sum all results // Initialize the variable for the sum of taxAmount - collectedAmount for the filtered tax head codes totalAreas = remainingMonthDemandDetailList.stream() @@ -772,7 +788,7 @@ public int compare(Demand d1, Demand d2) { .map(dd -> dd.getTaxAmount().subtract(dd.getCollectionAmount())) // map to the balance between taxAmount and collectedAmount .reduce(BigDecimal.ZERO, BigDecimal::add); - totalAreasWithPenalty = totalAreas.add(penaltyInRemainingMonth); + totalAreasWithPenalty = totalAreas.add(penaltyInRemainingMonth).add(totalRoundOff); From 279971f38f1eacd5a90feaf9e5b74dc78f26b1b0 Mon Sep 17 00:00:00 2001 From: Taniya-eGov Date: Mon, 8 Jul 2024 15:54:55 +0530 Subject: [PATCH 002/133] updated DemandService --- .../org/egov/demand/model/AggregatedDemandDetailResponse.java | 4 ++++ .../src/main/java/org/egov/demand/service/DemandService.java | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/AggregatedDemandDetailResponse.java b/business-services/billing-service/src/main/java/org/egov/demand/model/AggregatedDemandDetailResponse.java index 523548b53..071818e20 100644 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/AggregatedDemandDetailResponse.java +++ b/business-services/billing-service/src/main/java/org/egov/demand/model/AggregatedDemandDetailResponse.java @@ -29,10 +29,14 @@ public class AggregatedDemandDetailResponse { private BigDecimal currentmonthTotalDue; + private BigDecimal currentmonthRoundOff; + private BigDecimal totalAreas; private BigDecimal totalAreasWithPenalty; + private BigDecimal totalRoundOff; + private BigDecimal netdue; private BigDecimal netDueWithPenalty; diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java b/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java index afbccf943..596f7283a 100644 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java +++ b/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java @@ -788,7 +788,7 @@ public int compare(Demand d1, Demand d2) { .map(dd -> dd.getTaxAmount().subtract(dd.getCollectionAmount())) // map to the balance between taxAmount and collectedAmount .reduce(BigDecimal.ZERO, BigDecimal::add); - totalAreasWithPenalty = totalAreas.add(penaltyInRemainingMonth).add(totalRoundOff); + totalAreasWithPenalty = totalAreas.add(penaltyInRemainingMonth); @@ -824,8 +824,10 @@ public int compare(Demand d1, Demand d2) { .currentmonthBill(currentmonthBill) .currentMonthPenalty(currentMonthPenalty) .currentmonthTotalDue(currentmonthTotalDue) + .currentmonthRoundOff(currentmonthRoundOff) .totalAreas(totalAreas) .totalAreasWithPenalty(totalAreasWithPenalty) + .totalRoundOff(totalRoundOff) .netdue(netdue) .netDueWithPenalty(netDueWithPenalty) .advanceAdjusted(advanceAdjusted) From b6f6417dbfa44882c3455d9c2e144b0ce21b6096 Mon Sep 17 00:00:00 2001 From: Taniya-eGov Date: Mon, 8 Jul 2024 16:40:01 +0530 Subject: [PATCH 003/133] Updated name for totalAreasRoundOff --- .../egov/demand/model/AggregatedDemandDetailResponse.java | 2 +- .../main/java/org/egov/demand/service/DemandService.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/AggregatedDemandDetailResponse.java b/business-services/billing-service/src/main/java/org/egov/demand/model/AggregatedDemandDetailResponse.java index 071818e20..dd554e5a8 100644 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/AggregatedDemandDetailResponse.java +++ b/business-services/billing-service/src/main/java/org/egov/demand/model/AggregatedDemandDetailResponse.java @@ -35,7 +35,7 @@ public class AggregatedDemandDetailResponse { private BigDecimal totalAreasWithPenalty; - private BigDecimal totalRoundOff; + private BigDecimal totalAreasRoundOff; private BigDecimal netdue; diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java b/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java index 596f7283a..47728c986 100644 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java +++ b/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java @@ -721,7 +721,7 @@ public int compare(Demand d1, Demand d2) { BigDecimal netDueWithPenalty = BigDecimal.ZERO; BigDecimal totalApplicablePenalty =BigDecimal.ZERO; BigDecimal currentmonthRoundOff=BigDecimal.ZERO; - BigDecimal totalRoundOff=BigDecimal.ZERO; + BigDecimal totalAreasRoundOff=BigDecimal.ZERO; currentmonthBill = currentMonthDemandDetailList.stream() .filter(dd -> dd.getTaxHeadMasterCode().equals("10101")) // filter by taxHeadCode @@ -772,7 +772,7 @@ public int compare(Demand d1, Demand d2) { List taxHeadCodesToFilterWithoutPenalty = Arrays.asList("10102", "10201", "10101","WS_Round_Off"); // Initialize the variable for the sum of taxAmount - collectedAmount specifically for WS_Round_Off - totalRoundOff = remainingMonthDemandDetailList.stream() + totalAreasRoundOff = remainingMonthDemandDetailList.stream() .filter(dd -> "WS_Round_Off".equals(dd.getTaxHeadMasterCode())) // Filter specifically for WS_Round_Off .map(dd -> dd.getTaxAmount().subtract(dd.getCollectionAmount())) // Calculate taxAmount - collectedAmount .reduce(BigDecimal.ZERO, BigDecimal::add); // Sum all results @@ -815,7 +815,7 @@ public int compare(Demand d1, Demand d2) { if(remainingAdvance !=BigDecimal.ZERO && currentmonthBill !=BigDecimal.ZERO && advanceAdjusted.equals(BigDecimal.ZERO)) { } - netdue = currentmonthBill.add(totalAreas).add(remainingAdvance); + netdue = currentmonthBill.add(totalAreas).add(remainingAdvance).add(currentmonthRoundOff); netDueWithPenalty = currentmonthTotalDue.add(totalAreasWithPenalty).add(remainingAdvance); //BigDecimal currentMonthBill @@ -827,7 +827,7 @@ public int compare(Demand d1, Demand d2) { .currentmonthRoundOff(currentmonthRoundOff) .totalAreas(totalAreas) .totalAreasWithPenalty(totalAreasWithPenalty) - .totalRoundOff(totalRoundOff) + .totalAreasRoundOff(totalAreasRoundOff) .netdue(netdue) .netDueWithPenalty(netDueWithPenalty) .advanceAdjusted(advanceAdjusted) From d728c12f78da1c67d7eafb11568baec9a560232a Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Mon, 8 Jul 2024 18:18:47 +0530 Subject: [PATCH 004/133] HRMS Search change by Nipun --- .../packages/modules/hrms/src/components/hrmscard.js | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js index 455ddb85b..a3e960151 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js @@ -78,6 +78,7 @@ const HRMSCard = () => { { label: t("HR_SEARCH_USER"), link: `/${window?.contextPath}/employee/hrms/search-user`, + roles:["DIV_ADMIN","STATE_ADMIN"] }, { label: t("HR_HOME_SEARCH_RESULTS_HEADING"), From de2fcff75289038af52440dee64c659d1fdd6d62 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Tue, 9 Jul 2024 15:47:20 +0530 Subject: [PATCH 005/133] Dropdown City Selection is optimized --- .../modules/core/src/components/ChangeCity.js | 66 +++++++++---------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js index c41abeb61..a52ec9415 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js @@ -10,30 +10,24 @@ const stringReplaceAll = (str = "", searcher = "", replaceWith = "") => { return str; }; - - const ChangeCity = (prop) => { const [dropDownData, setDropDownData] = useState({ label: `TENANT_TENANTS_${stringReplaceAll(Digit.SessionStorage.get("Employee.tenantId"), ".", "_")?.toUpperCase()}`, value: Digit.SessionStorage.get("Employee.tenantId"), }); const [selectCityData, setSelectCityData] = useState([]); - const [selectedCity, setSelectedCity] = useState([]); //selectedCities?.[0]?.value const history = useHistory(); const isDropdown = prop.dropdown || false; let selectedCities = []; - const uuids = [prop.userDetails?.info?.uuid]; - const { data: userData, isUserDataLoading } = Digit.Hooks.useUserSearch(Digit.ULBService.getStateId(), { uuid: uuids }, {}); - // setSelectedCity(userData?.data?.user[0]?.roles) - - - const { data: data = {}, isLoading } = + const uuids = [prop.userDetails?.info?.uuid]; + const { data: userData, isUserDataLoading } = Digit.Hooks.useUserSearch(Digit.ULBService.getStateId(), { uuid: uuids }, {}); + const { data: mdmsData = {}, isLoading: isMdmsLoading } = Digit.Hooks.hrms.useHrmsMDMS(Digit.ULBService.getCurrentTenantId(), "egov-hrms", "HRMSRolesandDesignation") || {}; const handleChangeCity = (city) => { const loggedInData = Digit.SessionStorage.get("citizen.userRequestObject"); - const filteredRoles = Digit.SessionStorage.get("citizen.userRequestObject")?.info?.roles?.filter((role) => role.tenantId === city.value); + const filteredRoles = loggedInData?.info?.roles?.filter((role) => role.tenantId === city.value); if (filteredRoles?.length > 0) { loggedInData.info.roles = filteredRoles; loggedInData.info.tenantId = city?.value; @@ -50,39 +44,40 @@ const ChangeCity = (prop) => { }; useEffect(() => { - const userloggedValues = Digit.SessionStorage.get("citizen.userRequestObject"); - let teantsArray = [],filteredArray = []; - userData?.user[0].roles?.forEach((role) => teantsArray.push(role.tenantId)); - let unique = teantsArray.filter((item, i, ar) => ar.indexOf(item) === i); - unique?.forEach((uniCode) => { + const tenantId = Digit.SessionStorage.get("Employee.tenantId"); + + if (!tenantId || !mdmsData?.MdmsRes?.["tenant"]["tenants"] || isUserDataLoading || isMdmsLoading) { + return; + } + + const tenantIds = userData?.user[0].roles?.map((role) => role.tenantId); + + const filteredArray = mdmsData.MdmsRes["tenant"]["tenants"].filter((item) => { + if (item.code !== "pb") { // Exclude "pb" tenants + return tenantIds.includes(item.code); + } else { + return item.code === tenantId; // Include "pb" tenants matching tenantId + } + }).map((item) => ({ + label: item.code !== "pb" + ? `${prop?.t(Digit.Utils.locale.convertToLocale(item?.divisionCode, "EGOV_LOCATION_DIVISION"))} - ${prop?.t( + `TENANT_TENANTS_${stringReplaceAll(item.code, ".", "_")?.toUpperCase()}` + )}` + : `TENANT_TENANTS_${stringReplaceAll(item.code, ".", "_")?.toUpperCase()}`, + value: item.code, + })); - data?.MdmsRes?.["tenant"]["tenants"]?.map((items) => { - if (items?.code !== "pb" && items?.code === uniCode) { - filteredArray.push({ - label: `${prop?.t(Digit.Utils.locale.convertToLocale(items?.divisionCode, "EGOV_LOCATION_DIVISION"))} - ${prop?.t( - `TENANT_TENANTS_${stringReplaceAll(uniCode, ".", "_")?.toUpperCase()}` - )}`, - value: uniCode, - }); - } else if (items?.code === "pb" && items?.code === uniCode) { - filteredArray.push({ - label: `TENANT_TENANTS_${stringReplaceAll(uniCode, ".", "_")?.toUpperCase()}`, - value: uniCode, - }); - } - }); - }); - selectedCities = filteredArray?.filter((select) => select.value == Digit.SessionStorage.get("Employee.tenantId")); setSelectCityData(filteredArray); + selectedCities = filteredArray.filter((select) => select.value === tenantId); - }, [dropDownData, data?.MdmsRes]); + }, [dropDownData, mdmsData?.MdmsRes, userData, isUserDataLoading, isMdmsLoading]); return (
0 ? selectCityData : [{ label: "Loading...", value: "" }]} selected={dropDownData} optionKey={"label"} select={handleChangeCity} @@ -90,7 +85,6 @@ const ChangeCity = (prop) => { />
); - }; -export default ChangeCity; \ No newline at end of file +export default ChangeCity; From efed9eeb9bd8f4f6a1896659a653e871c942a389 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 15 Jul 2024 11:48:01 +0530 Subject: [PATCH 006/133] ISTE-224 --- .../repository/WaterDaoImpl.java | 45 ++++++++-- .../repository/builder/WsQueryBuilder.java | 18 ++++ .../rowmapper/LedgerReportRowMapper.java | 85 +++++++++++++++++++ .../waterconnection/service/WaterService.java | 2 + .../service/WaterServiceImpl.java | 25 ++++++ .../web/controller/WaterController.java | 9 ++ .../web/models/LedgerReport.java | 63 ++++++++++++++ .../web/models/LedgerReportResponse.java | 17 ++++ 8 files changed, 258 insertions(+), 6 deletions(-) create mode 100644 municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java create mode 100644 municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java create mode 100644 municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReportResponse.java 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 84f89fff7..06ab1b1c4 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 @@ -1,6 +1,7 @@ package org.egov.waterconnection.repository; import java.math.BigDecimal; +import java.time.LocalDate; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -49,6 +50,9 @@ @Repository public class WaterDaoImpl implements WaterDao { + @Autowired + private LedgerReportRowMapper ledgerReportRowMapper; + @Autowired private DemandNotGeneratedRowMapper demandNotGeneratedRowMapper; @@ -669,17 +673,46 @@ public List getInactiveConsumerReport(Long monthStar return inactiveConsumerReportList; } - public List getConsumersByPreviousMeterReading(Long previousMeterReading, String tenantId) - { - StringBuilder query=new StringBuilder(wsQueryBuilder.DEMAND_NOT_GENERATED_QUERY); + public List getConsumersByPreviousMeterReading(Long previousMeterReading, String tenantId) { + StringBuilder query = new StringBuilder(wsQueryBuilder.DEMAND_NOT_GENERATED_QUERY); - List preparedStatement=new ArrayList<>(); + List preparedStatement = new ArrayList<>(); preparedStatement.add(tenantId); preparedStatement.add(previousMeterReading); preparedStatement.add(tenantId); - log.info("Query for consumer demand not generated "+ query +" prepared statement "+ preparedStatement); - List consumersDemandNotGeneratedList=jdbcTemplate.query(query.toString(),preparedStatement.toArray(),demandNotGeneratedRowMapper); + log.info("Query for consumer demand not generated " + query + " prepared statement " + preparedStatement); + List consumersDemandNotGeneratedList = jdbcTemplate.query(query.toString(), preparedStatement.toArray(), demandNotGeneratedRowMapper); return consumersDemandNotGeneratedList; } + + public List getLedgerReport(String consumercode, String tenantId, Integer limit, Integer offset,String startDate,String endDate) { + StringBuilder query = new StringBuilder(wsQueryBuilder.LEDGER_REPORT_QUERY); + + List preparedStatement = new ArrayList<>(); + preparedStatement.add(consumercode); + preparedStatement.add(tenantId); + + Integer newlimit = wsConfiguration.getDefaultLimit(); + Integer newoffset = wsConfiguration.getDefaultOffset(); + if (limit == null && offset == null) + newlimit = wsConfiguration.getMaxLimit(); + if (limit != null && limit <= wsConfiguration.getMaxLimit()) + newlimit = limit; + if (limit != null && limit >= wsConfiguration.getMaxLimit()) + newlimit = wsConfiguration.getMaxLimit(); + + if (offset != null) + newoffset = offset; + + if (newlimit > 0) { + query.append(" offset ? limit ? ;"); + preparedStatement.add(newoffset); + preparedStatement.add(newlimit); + } + + log.info("Query of ledger report:" + query + "and prepared statement" + preparedStatement); + List ledgerReportList = jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); + return ledgerReportList; + } } 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 58ec99739..a7a327c11 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 @@ -176,6 +176,24 @@ public class WsQueryBuilder { "(select distinct consumercode from egbs_demand_v1 d inner join egbs_demanddetail_v1 dd on dd.demandid = d.id " + "where dd.taxheadcode='10101' and d.status ='ACTIVE' and d.businessservice='WS' and " + "d.tenantid=?) order by connectionno;"; + + public static final String LEDGER_REPORT_QUERY = "SELECT conn.connectionno as connectionNo,conn.oldconnectionno," + + "to_timestamp(dem.taxperiodfrom/1000)::date as startdate,to_timestamp(dem.taxperiodto/1000)::date as enddate," + + "to_timestamp(dem.createdtime/1000)::date as demandGenerationDate," + + "dd.taxheadcode as code,dd.taxamount as taxamount," + + "COALESCE(SUM(p.totaldue), 0) as due,COALESCE(SUM(p.totalamountpaid), 0) as paid," + + "MAX(to_timestamp(p.transactiondate/1000))::date as collectiondate," + + "MAX(pd.receiptnumber) as receiptno" + + "FROM eg_ws_connection conn INNER JOIN eg_ws_connectionholder connectionholder " + + "ON connectionholder.connectionid = conn.id " + + "INNER JOIN egbs_demand_v1 dem ON dem.consumercode = conn.connectionno INNER JOIN " + + "egbs_demanddetail_v1 dd ON dd.demandid = dem.id LEFT JOIN egbs_billdetail_v1 bd " + + "ON bd.demandid = dem.id LEFT JOIN egcl_paymentdetail pd ON pd.billid = bd.billid " + + "LEFT JOIN egcl_payment p ON p.id = pd.paymentid AND p.tenantid = 'pb.poohlahjgfid' " + + "AND p.instrumentstatus = 'APPROVED' AND p.paymentstatus NOT IN ('CANCELLED') " + + "WHERE dem.consumercode = ? AND conn.tenantId = ? AND conn.status = 'Active' AND dem.status = 'ACTIVE' " + + "GROUP BY conn.connectionno, conn.oldconnectionno,dem.id, dem.taxperiodfrom, " + + "dem.taxperiodto, dem.createdtime, dd.taxheadcode, dd.taxamount ORDER BY startdate, code, collectiondate;"; /** * diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java new file mode 100644 index 000000000..0cfb1ba2e --- /dev/null +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -0,0 +1,85 @@ +package org.egov.waterconnection.repository.rowmapper; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.egov.waterconnection.service.UserService; +import org.egov.waterconnection.web.models.LedgerReport; +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.math.BigDecimal; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.time.temporal.ChronoUnit; + + +@Component +public class LedgerReportRowMapper implements ResultSetExtractor> { + + @Autowired + private ObjectMapper objectMapper; + + @Autowired + private UserService userService; + + @Override + public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { + List ledgerReportList = new ArrayList<>(); + Map ledgerReports = new HashMap<>(); + BigDecimal previousBalanceLeft = BigDecimal.ZERO; + BigDecimal arrears = BigDecimal.ZERO; + + while (resultSet.next()) { + LocalDate date = resultSet.getDate("enddate").toLocalDate(); + String monthAndYear = date.format(DateTimeFormatter.ofPattern("MMMMyyyy")); + + String code = resultSet.getString("code"); + + BigDecimal taxamount = resultSet.getBigDecimal("taxamount"); + + LocalDate demandGenerationDateLocal = resultSet.getDate("demandgenerationdate").toLocalDate(); + String demandGenerationDate = demandGenerationDateLocal.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + + LedgerReport ledgerReport = ledgerReports.getOrDefault(monthAndYear, new LedgerReport(monthAndYear)); + + if (code.equals("10102")) { + ledgerReport.setArrears(taxamount); + ledgerReport.setMonthAndYear(monthAndYear); + arrears = resultSet.getBigDecimal("due").subtract(resultSet.getBigDecimal("paid")); + } else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { + ledgerReport.setPenalty(taxamount); + BigDecimal amount = ledgerReports.get(monthAndYear).getTaxamount() != null ? ledgerReports.get(monthAndYear).getTaxamount() : BigDecimal.ZERO; + ledgerReport.setTotalForCurrentMonth(taxamount.add(amount)); + ledgerReport.setTotal_due_amount(ledgerReport.getTotalForCurrentMonth().add(ledgerReport.getArrears())); + ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); + previousBalanceLeft = ledgerReport.getBalanceLeft(); + } else if (code.equals("10101")) { + ledgerReport.setMonthAndYear(monthAndYear); + ledgerReport.setDemandGenerationDate(demandGenerationDate); + ledgerReport.setTaxamount(taxamount); + ledgerReport.setTotalForCurrentMonth(ledgerReport.getTaxamount().add(ledgerReport.getPenalty())); + ledgerReport.setDueDate(demandGenerationDateLocal.plus(10, ChronoUnit.DAYS).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + ledgerReport.setPenaltyAppliedDate(demandGenerationDateLocal.plus(11, ChronoUnit.DAYS).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + ledgerReport.setCollectionDate(resultSet.getDate("collectiondate") != null ? resultSet.getDate("collectiondate").toLocalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) : null); + ledgerReport.setReceiptNo(resultSet.getString("receiptno")); + ledgerReport.setPaid(resultSet.getBigDecimal("paid")); + if (arrears.equals(BigDecimal.ZERO)) { + ledgerReport.setArrears(previousBalanceLeft); + } else { + ledgerReport.setArrears(arrears); + arrears = BigDecimal.ZERO; + } + ledgerReport.setTotal_due_amount(ledgerReport.getTotalForCurrentMonth().add(ledgerReport.getArrears())); + ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); + previousBalanceLeft = ledgerReport.getBalanceLeft(); + } + ledgerReports.put(monthAndYear, ledgerReport); + } + ledgerReportList.addAll(ledgerReports.values()); + return ledgerReportList; + } +} 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 e4c9ed73b..a4b75bb4f 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 @@ -54,4 +54,6 @@ List collectionReport(String paymentStartDate, String paym List inactiveConsumerReport(String monthStartDate,String monthEndDate,String tenantId, @Valid Integer offset, @Valid Integer limit, RequestInfo requestInfo); WaterConnectionResponse getConsumersWithDemandNotGenerated(String previousMeterReading, String tenantId,RequestInfo requestInfo); + + List ledgerReport(String consumercode, String tenantId, Integer offset, Integer limit,String year); } 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 ba0803984..c557ba753 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 @@ -8,6 +8,7 @@ import java.text.SimpleDateFormat; import java.time.*; import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; import java.time.temporal.TemporalAdjusters; import java.util.ArrayList; import java.util.Arrays; @@ -862,4 +863,28 @@ public WaterConnectionResponse getConsumersWithDemandNotGenerated(String previou SearchCriteria criteria=SearchCriteria.builder().connectionNoSet(connectionNo).tenantId(tenantId).build(); return search(criteria,requestInfo); } + + @Override + public List ledgerReport(String consumercode, String tenantId, Integer offset, Integer limit, String year) { + String[] years = year.split("-"); + if (years.length != 2) { + throw new IllegalArgumentException("Invalid fiscal year format"); + } + int startYear = Integer.parseInt(years[0]); + int endYear = Integer.parseInt(years[1]); + + if (endYear != startYear + 1) { + throw new IllegalArgumentException("Invalid fiscal year range"); + } + + LocalDate startDate = LocalDate.of(startYear, 4, 1); + LocalDate endDate = LocalDate.of(endYear, 3, 31); + + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + String formattedStartDate = startDate.format(formatter); + String formattedEndDate = endDate.format(formatter); + + List list = waterDaoImpl.getLedgerReport(consumercode, tenantId, limit, offset, formattedStartDate, formattedEndDate); + return list; + } } \ No newline at end of file diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java index f4da10f1f..f999739d2 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java @@ -244,4 +244,13 @@ public ResponseEntity getConsumersWithDemandNotGenerate return new ResponseEntity<>(response, HttpStatus.OK); } + @PostMapping("/ledger-report") + public ResponseEntity getLedgerReport(@Valid @RequestBody RequestInfoWrapper requestInfoWrapper, @RequestParam String consumercode, @RequestParam String tenantId, @RequestParam Integer offset, @RequestParam Integer limit, @RequestParam String year) { + List list = waterService.ledgerReport(consumercode, tenantId, offset, limit,year); + LedgerReportResponse response = LedgerReportResponse.builder().ledgerReport(list). + responseInfo(responseInfoFactory. + createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true)).build(); + return new ResponseEntity<>(response, HttpStatus.OK); + } + } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java new file mode 100644 index 000000000..19b37e7eb --- /dev/null +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java @@ -0,0 +1,63 @@ +package org.egov.waterconnection.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import java.math.BigDecimal; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class LedgerReport +{ + @JsonProperty("month") + private String monthAndYear; + + @JsonProperty("demandGenerationDate") + private String demandGenerationDate; + + @JsonProperty("monthlyCharges") + private BigDecimal taxamount; + + @JsonProperty("penalty") + private BigDecimal penalty; + + @JsonProperty("totalForCurrentMonth") + private BigDecimal totalForCurrentMonth; + + @JsonProperty("previousMonthBalance") + private BigDecimal arrears; + + @JsonProperty("totalDues") + private BigDecimal total_due_amount; + + @JsonProperty("dueDateOfPayment") + private String dueDate; + + @JsonProperty("penaltyAppliedOnDate") + private String penaltyAppliedDate; + + @JsonProperty("paymentCollectionDate") + private String collectionDate; + + @JsonProperty("receiptNo") + private String receiptNo; + + @JsonProperty("amountPaid") + private BigDecimal paid; + + @JsonProperty("balanceLeft") + private BigDecimal balanceLeft; + + public LedgerReport(String monthAndYear) + { + this.monthAndYear = monthAndYear; + this.taxamount = BigDecimal.ZERO; + this.penalty = BigDecimal.ZERO; + this.totalForCurrentMonth = BigDecimal.ZERO; + this.paid = BigDecimal.ZERO; + this.balanceLeft = BigDecimal.ZERO; + + } +} diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReportResponse.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReportResponse.java new file mode 100644 index 000000000..187ead3f3 --- /dev/null +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReportResponse.java @@ -0,0 +1,17 @@ +package org.egov.waterconnection.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Builder; +import org.egov.common.contract.response.ResponseInfo; + +import java.util.List; + +@Builder +public class LedgerReportResponse +{ + @JsonProperty("ledgerReport") + private List ledgerReport; + + @JsonProperty("responseInfo") + private ResponseInfo responseInfo = null; +} From e350362f213315fcfce446eada720c44af535021 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 15 Jul 2024 12:21:53 +0530 Subject: [PATCH 007/133] ISTE-224 --- .../waterconnection/repository/builder/WsQueryBuilder.java | 2 +- .../repository/rowmapper/LedgerReportRowMapper.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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 a7a327c11..d7cdb6025 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 @@ -183,7 +183,7 @@ public class WsQueryBuilder { "dd.taxheadcode as code,dd.taxamount as taxamount," + "COALESCE(SUM(p.totaldue), 0) as due,COALESCE(SUM(p.totalamountpaid), 0) as paid," + "MAX(to_timestamp(p.transactiondate/1000))::date as collectiondate," + - "MAX(pd.receiptnumber) as receiptno" + + "MAX(pd.receiptnumber) as receiptno " + "FROM eg_ws_connection conn INNER JOIN eg_ws_connectionholder connectionholder " + "ON connectionholder.connectionid = conn.id " + "INNER JOIN egbs_demand_v1 dem ON dem.consumercode = conn.connectionno INNER JOIN " + diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 0cfb1ba2e..8cc3bf438 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -1,6 +1,7 @@ package org.egov.waterconnection.repository.rowmapper; import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; import org.egov.waterconnection.service.UserService; import org.egov.waterconnection.web.models.LedgerReport; import org.springframework.beans.factory.annotation.Autowired; @@ -17,6 +18,7 @@ import java.time.temporal.ChronoUnit; +@Slf4j @Component public class LedgerReportRowMapper implements ResultSetExtractor> { @@ -77,6 +79,7 @@ public List extractData(ResultSet resultSet) throws SQLException, ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); previousBalanceLeft = ledgerReport.getBalanceLeft(); } + log.info("Data inserted into map "+ledgerReport.toString()); ledgerReports.put(monthAndYear, ledgerReport); } ledgerReportList.addAll(ledgerReports.values()); From 9fbd2da1fc3f4ffc977f1774bd5c9c545a3becbb Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 15 Jul 2024 12:41:41 +0530 Subject: [PATCH 008/133] ISTE-224 --- .../egov/waterconnection/repository/builder/WsQueryBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d7cdb6025..89ca5c842 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 @@ -193,7 +193,7 @@ public class WsQueryBuilder { "AND p.instrumentstatus = 'APPROVED' AND p.paymentstatus NOT IN ('CANCELLED') " + "WHERE dem.consumercode = ? AND conn.tenantId = ? AND conn.status = 'Active' AND dem.status = 'ACTIVE' " + "GROUP BY conn.connectionno, conn.oldconnectionno,dem.id, dem.taxperiodfrom, " + - "dem.taxperiodto, dem.createdtime, dd.taxheadcode, dd.taxamount ORDER BY startdate, code, collectiondate;"; + "dem.taxperiodto, dem.createdtime, dd.taxheadcode, dd.taxamount ORDER BY startdate, code, collectiondate"; /** * From 291385fd22f0b432e52e247454f553d9f173a7ef Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 15 Jul 2024 14:20:28 +0530 Subject: [PATCH 009/133] ISTE-224 --- .../repository/builder/WsQueryBuilder.java | 6 ++-- .../rowmapper/LedgerReportRowMapper.java | 29 +++++++++++++++++++ .../web/controller/WaterController.java | 6 ++-- .../web/models/LedgerReport.java | 12 ++++++++ .../web/models/LedgerReportResponse.java | 6 ++++ 5 files changed, 53 insertions(+), 6 deletions(-) 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 89ca5c842..33a3fad8f 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 @@ -177,7 +177,7 @@ public class WsQueryBuilder { "where dd.taxheadcode='10101' and d.status ='ACTIVE' and d.businessservice='WS' and " + "d.tenantid=?) order by connectionno;"; - public static final String LEDGER_REPORT_QUERY = "SELECT conn.connectionno as connectionNo,conn.oldconnectionno," + + public static final String LEDGER_REPORT_QUERY = "SELECT connectionholder.userid as uuid,conn.connectionno as connectionNo,conn.oldconnectionno," + "to_timestamp(dem.taxperiodfrom/1000)::date as startdate,to_timestamp(dem.taxperiodto/1000)::date as enddate," + "to_timestamp(dem.createdtime/1000)::date as demandGenerationDate," + "dd.taxheadcode as code,dd.taxamount as taxamount," + @@ -192,8 +192,8 @@ public class WsQueryBuilder { "LEFT JOIN egcl_payment p ON p.id = pd.paymentid AND p.tenantid = 'pb.poohlahjgfid' " + "AND p.instrumentstatus = 'APPROVED' AND p.paymentstatus NOT IN ('CANCELLED') " + "WHERE dem.consumercode = ? AND conn.tenantId = ? AND conn.status = 'Active' AND dem.status = 'ACTIVE' " + - "GROUP BY conn.connectionno, conn.oldconnectionno,dem.id, dem.taxperiodfrom, " + - "dem.taxperiodto, dem.createdtime, dd.taxheadcode, dd.taxamount ORDER BY startdate, code, collectiondate"; + "GROUP BY conn.connectionno, conn.oldconnectionno,connectionholder.userid,dem.id, dem.taxperiodfrom, " + + "dem.taxperiodto, dem.createdtime, dd.taxheadcode, dd.taxamount ORDER BY enddate, code, collectiondate"; /** * diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 8cc3bf438..5c54f7154 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -4,6 +4,9 @@ import lombok.extern.slf4j.Slf4j; import org.egov.waterconnection.service.UserService; import org.egov.waterconnection.web.models.LedgerReport; +import org.egov.waterconnection.web.models.OwnerInfo; +import org.egov.waterconnection.web.models.users.UserDetailResponse; +import org.egov.waterconnection.web.models.users.UserSearchRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.ResultSetExtractor; @@ -79,10 +82,36 @@ public List extractData(ResultSet resultSet) throws SQLException, ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); previousBalanceLeft = ledgerReport.getBalanceLeft(); } + ledgerReport.setConnectionNo(resultSet.getString("connectionno")); + ledgerReport.setOldConnectionNo(resultSet.getString("oldconnectionno")); + ledgerReport.setUserId(resultSet.getString("uuid")); log.info("Data inserted into map "+ledgerReport.toString()); ledgerReports.put(monthAndYear, ledgerReport); } ledgerReportList.addAll(ledgerReports.values()); + if(!ledgerReportList.isEmpty()) + { + enrichConnectionHolderDetails(ledgerReportList); + } return ledgerReportList; } + + private void enrichConnectionHolderDetails(List ledgerReportList) { + Set connectionHolderIds = new HashSet<>(); + for (LedgerReport ledgerReport : ledgerReportList) { + connectionHolderIds.add(ledgerReport.getUserId()); + } + UserSearchRequest userSearchRequest = new UserSearchRequest(); + userSearchRequest.setUuid(connectionHolderIds); + UserDetailResponse userDetailResponse = userService.getUser(userSearchRequest); + enrichConnectionHolderInfo(userDetailResponse, ledgerReportList); + } + + private void enrichConnectionHolderInfo(UserDetailResponse userDetailResponse, + List ledgerReportList) { + List connectionHolderInfos = userDetailResponse.getUser(); + Map userIdToConnectionHolderMap = new HashMap<>(); + connectionHolderInfos.forEach(user -> userIdToConnectionHolderMap.put(user.getUuid(), user)); + ledgerReportList.forEach(ledgerReport-> ledgerReport.setConsumerName(userIdToConnectionHolderMap.get(ledgerReport.getUserId()).getName())); + } } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java index f999739d2..ec38dad65 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java @@ -246,10 +246,10 @@ public ResponseEntity getConsumersWithDemandNotGenerate @PostMapping("/ledger-report") public ResponseEntity getLedgerReport(@Valid @RequestBody RequestInfoWrapper requestInfoWrapper, @RequestParam String consumercode, @RequestParam String tenantId, @RequestParam Integer offset, @RequestParam Integer limit, @RequestParam String year) { - List list = waterService.ledgerReport(consumercode, tenantId, offset, limit,year); + List list = waterService.ledgerReport(consumercode, tenantId, offset, limit, year); LedgerReportResponse response = LedgerReportResponse.builder().ledgerReport(list). - responseInfo(responseInfoFactory. - createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true)).build(); + responseInfo(responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true)). + tenantName(tenantId).financialYear(year).build(); return new ResponseEntity<>(response, HttpStatus.OK); } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java index 19b37e7eb..0920da6cf 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java @@ -50,6 +50,18 @@ public class LedgerReport @JsonProperty("balanceLeft") private BigDecimal balanceLeft; + @JsonProperty("consumerName") + private String consumerName = null; + + @JsonProperty("connectionNo") + private String connectionNo = null; + + @JsonProperty("oldConnectionNo") + private String oldConnectionNo = null; + + @JsonProperty("userId") + private String userId = null; + public LedgerReport(String monthAndYear) { this.monthAndYear = monthAndYear; diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReportResponse.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReportResponse.java index 187ead3f3..fe59ade95 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReportResponse.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReportResponse.java @@ -12,6 +12,12 @@ public class LedgerReportResponse @JsonProperty("ledgerReport") private List ledgerReport; + @JsonProperty("tenantName") + private String tenantName; + + @JsonProperty("financialYear") + private String financialYear; + @JsonProperty("responseInfo") private ResponseInfo responseInfo = null; } From e072b1893430f53ac27e619a73589e002a88b9d7 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Mon, 15 Jul 2024 15:48:31 +0530 Subject: [PATCH 010/133] ISTE-210 FIx --- .../libraries/src/services/elements/MDMS.js | 23 +++++++++++++++++++ .../src/services/molecules/Store/service.js | 15 +++--------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js index c7d1037a8..a12327f6e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js @@ -63,6 +63,21 @@ const initRequestBody = (tenantId) => ({ ], }, }); +const initRequestBodyWithOutTenent = (tenantId) => ({ + MdmsCriteria: { + tenantId, + moduleDetails: [ + { + moduleName: "common-masters", + masterDetails: [{ name: "Department" }, { name: "Designation" }, { name: "StateInfo" }, { name: "wfSlaConfig" }, { name: "uiHomePage" }], + }, + { + moduleName: "DIGIT-UI", + masterDetails: [{ name: "ApiCachingSettings" }], + }, + ], + }, +}); const getCriteria = (tenantId, moduleDetails) => { return { @@ -1478,6 +1493,14 @@ export const MdmsService = { useCache: true, params: { tenantId: stateCode }, }), + initWithOutTenent: (stateCode) => + ServiceRequest({ + serviceName: "mdmsInit", + url: Urls.MDMS, + data: initRequestBodyWithOutTenent(stateCode), + useCache: true, + params: { tenantId: stateCode }, + }), call: (tenantId, details) => { return new Promise((resolve, reject) => debouncedCall( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Store/service.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Store/service.js index 6debb8dae..fa911c4e0 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Store/service.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Store/service.js @@ -55,9 +55,10 @@ export const StoreService = { return await Promise.all(allBoundries); }, digitInitData: async (stateCode, enabledModules) => { - const { MdmsRes } = await MdmsService.init(stateCode); + const { MdmsRes } = await MdmsService.init(stateCode); const stateInfo = MdmsRes["common-masters"]?.StateInfo?.[0] || {}; const uiHomePage = MdmsRes["common-masters"]?.uiHomePage?.[0] || {}; + const localities = {}; const revenue_localities = {}; const initData = { @@ -80,22 +81,12 @@ export const StoreService = { initData.selectedLanguage = Digit.SessionStorage.get("locale") || initData?.languages[2] ? initData?.languages[2]?.value : initData?.languages[1]?.value; - ApiCacheService.saveSetting(MdmsRes["DIGIT-UI"]?.ApiCachingSettings); - - const moduleTenants = initData?.modules - .map((module) => module.tenants) - .flat() - .reduce((unique, ele) => (unique.find((item) => item.code === ele.code) ? unique : [...unique, ele]), []); - initData.tenants = MdmsRes?.tenant?.tenants - // ?.filter((x) => x.pgrEnabled) + initData.tenants = MdmsRes?.tenant?.tenants .map((tenant) => ({ i18nKey: `TENANT_TENANTS_${tenant.code.replace(".", "_").toUpperCase()}`, ...tenant, })); - // .filter((item) => !!moduleTenants.find((mt) => mt.code === item.code)) - // .map((tenant) => ({ i18nKey: `TENANT_TENANTS_${tenant.code.replace(".", "_").toUpperCase()}`, ...tenant })); - await LocalizationService.getLocale({ modules: [`rainmaker-common`], locale: initData.selectedLanguage, From 67f7a2a1fc872d9f01e229c6d2221f1c6941300a Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Mon, 15 Jul 2024 15:55:32 +0530 Subject: [PATCH 011/133] ISTE-238 Fix --- .../packages/react-components/src/atoms/TopBar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js index c26314496..f3ffeca78 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js @@ -45,7 +45,7 @@ const TopBar = ({
{!hideNotificationIconOnSomeUrlsWhenNotLoggedIn ? changeLanguage : null} - {!hideNotificationIconOnSomeUrlsWhenNotLoggedIn ? ( + {/* {!hideNotificationIconOnSomeUrlsWhenNotLoggedIn ? (
{notificationCountLoaded && notificationCount ? ( @@ -54,7 +54,7 @@ const TopBar = ({ ) : null}
- ) : null} + ) : null} */}
From 08454d97c66beccc2c1e8b411d19396cb0855b96 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Mon, 15 Jul 2024 16:34:45 +0530 Subject: [PATCH 012/133] ISTE-239 --- .../example/src/UICustomizations.js | 18 +++++++++++++----- .../modules/payment/src/components/OpenView.js | 17 +++++++++++++---- .../payment/src/configs/UICustomizations.js | 17 +++++++++++++---- 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js b/frontend/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js index 4addde2b4..07152552d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js +++ b/frontend/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js @@ -8,11 +8,19 @@ var Digit = window.Digit || {}; function anonymizeHalfString(input) { - // Calculate the midpoint of the string - const midpoint = Math.ceil(input.length / 2); - - // Replace the first 50% of the string with asterisks - const anonymized = "*".repeat(midpoint) + input.substring(midpoint); + // Initialize an empty string to store the anonymized output + let anonymized = ""; + // Loop through each character in the input string + for (let i = 0; i < input.length; i++) { + // Check if the index (i) is even (0, 2, 4, ...) + if (i % 2 === 0) { + // Append the original character (keep it) + anonymized += input[i]; + } else { + // Append an asterisk to mask the alternate character + anonymized += "*"; + } + } return anonymized; } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js index baafe512d..0fe64d4f3 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js @@ -5,11 +5,20 @@ import { makePayment } from "../utils/payGov"; import $ from "jquery"; function anonymizeHalfString(input) { - // Calculate the midpoint of the string - const midpoint = Math.ceil(input.length / 2); + // Initialize an empty string to store the anonymized output + let anonymized = ""; - // Replace the first 50% of the string with asterisks - const anonymized = "*".repeat(midpoint) + input.substring(midpoint); + // Loop through each character in the input string + for (let i = 0; i < input.length; i++) { + // Check if the index (i) is even (0, 2, 4, ...) + if (i % 2 === 0) { + // Append the original character (keep it) + anonymized += input[i]; + } else { + // Append an asterisk to mask the alternate character + anonymized += "*"; + } + } return anonymized; } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js index 2a8e0bd33..42894d61a 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js @@ -3,11 +3,20 @@ import _ from "lodash"; import React from "react"; function anonymizeHalfString(input) { - // Calculate the midpoint of the string - const midpoint = Math.ceil(input.length / 2); + // Initialize an empty string to store the anonymized output + let anonymized = ""; - // Replace the first 50% of the string with asterisks - const anonymized = "*".repeat(midpoint) + input.substring(midpoint); + // Loop through each character in the input string + for (let i = 0; i < input.length; i++) { + // Check if the index (i) is even (0, 2, 4, ...) + if (i % 2 === 0) { + // Append the original character (keep it) + anonymized += input[i]; + } else { + // Append an asterisk to mask the alternate character + anonymized += "*"; + } + } return anonymized; } From fccf62f5be16a2943d84729b64b6e24fc6aabfa5 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Mon, 15 Jul 2024 16:49:09 +0530 Subject: [PATCH 013/133] ISTE-240 -Fix --- .../payment/src/components/OpenView.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js index 0fe64d4f3..d0f3432e4 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js @@ -264,18 +264,15 @@ const OpenView = () => { /> )} + + + + + + + {bill ? ( - <> - {/* - */} + <> Date: Mon, 15 Jul 2024 17:39:59 +0530 Subject: [PATCH 014/133] ISTE-244-Fix --- .../packages/modules/payment/src/components/OpenView.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js index d0f3432e4..e1613c371 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js @@ -326,7 +326,7 @@ const OpenView = () => { {payments && payments.map((payment) => { return ( - + { {/* {displayMenu ? : null} */} - + {showToast && ( Date: Tue, 16 Jul 2024 11:09:06 +0530 Subject: [PATCH 015/133] ISTE-224 --- .../repository/WaterDaoImpl.java | 6 ++--- .../rowmapper/LedgerReportRowMapper.java | 25 +++++++++++++++---- .../service/WaterServiceImpl.java | 10 ++++---- .../web/models/LedgerReport.java | 9 ++++--- 4 files changed, 33 insertions(+), 17 deletions(-) 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 06ab1b1c4..c776d4aa9 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 @@ -686,7 +686,7 @@ public List getConsumersByPreviousMeterReading(Long return consumersDemandNotGeneratedList; } - public List getLedgerReport(String consumercode, String tenantId, Integer limit, Integer offset,String startDate,String endDate) { + public List getLedgerReport(String consumercode, String tenantId, Integer limit, Integer offset, LocalDate startDate, LocalDate endDate) { StringBuilder query = new StringBuilder(wsQueryBuilder.LEDGER_REPORT_QUERY); List preparedStatement = new ArrayList<>(); @@ -712,7 +712,7 @@ public List getLedgerReport(String consumercode, String tenantId, } log.info("Query of ledger report:" + query + "and prepared statement" + preparedStatement); - List ledgerReportList = jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); - return ledgerReportList; + ledgerReportRowMapper = new LedgerReportRowMapper(startDate,endDate); + return jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); } } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 5c54f7154..1e41f5a5d 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -31,6 +31,14 @@ public class LedgerReportRowMapper implements ResultSetExtractor extractData(ResultSet resultSet) throws SQLException, DataAccessException { List ledgerReportList = new ArrayList<>(); @@ -85,12 +93,19 @@ public List extractData(ResultSet resultSet) throws SQLException, ledgerReport.setConnectionNo(resultSet.getString("connectionno")); ledgerReport.setOldConnectionNo(resultSet.getString("oldconnectionno")); ledgerReport.setUserId(resultSet.getString("uuid")); - log.info("Data inserted into map "+ledgerReport.toString()); + ledgerReport.setCode(code); + log.info("Data inserted into map " + ledgerReport.toString()); ledgerReports.put(monthAndYear, ledgerReport); } - ledgerReportList.addAll(ledgerReports.values()); - if(!ledgerReportList.isEmpty()) - { + for (Map.Entry entry : ledgerReports.entrySet()) { + LocalDate endDate = LocalDate.parse(entry.getKey(), DateTimeFormatter.ofPattern("MMMMyyyy")); + String code = entry.getValue().getCode(); + if (!endDate.isBefore(startDate) && !endDate.isAfter(this.endDate) && code.equals("10101")) { + ledgerReportList.add(entry.getValue()); + } + } +// ledgerReportList.addAll(ledgerReports.values()); + if (!ledgerReportList.isEmpty()) { enrichConnectionHolderDetails(ledgerReportList); } return ledgerReportList; @@ -112,6 +127,6 @@ private void enrichConnectionHolderInfo(UserDetailResponse userDetailResponse, List connectionHolderInfos = userDetailResponse.getUser(); Map userIdToConnectionHolderMap = new HashMap<>(); connectionHolderInfos.forEach(user -> userIdToConnectionHolderMap.put(user.getUuid(), user)); - ledgerReportList.forEach(ledgerReport-> ledgerReport.setConsumerName(userIdToConnectionHolderMap.get(ledgerReport.getUserId()).getName())); + ledgerReportList.forEach(ledgerReport -> ledgerReport.setConsumerName(userIdToConnectionHolderMap.get(ledgerReport.getUserId()).getName())); } } 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 c557ba753..a187bbc72 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 @@ -878,13 +878,13 @@ public List ledgerReport(String consumercode, String tenantId, Int } LocalDate startDate = LocalDate.of(startYear, 4, 1); - LocalDate endDate = LocalDate.of(endYear, 3, 31); + LocalDate endDate = LocalDate.of(startYear + 1, 3, 31); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); - String formattedStartDate = startDate.format(formatter); - String formattedEndDate = endDate.format(formatter); +// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); +// String formattedStartDate = startDate.format(formatter); +// String formattedEndDate = endDate.format(formatter); - List list = waterDaoImpl.getLedgerReport(consumercode, tenantId, limit, offset, formattedStartDate, formattedEndDate); + List list = waterDaoImpl.getLedgerReport(consumercode, tenantId, limit, offset, startDate, endDate); return list; } } \ No newline at end of file diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java index 0920da6cf..60561d3d4 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java @@ -9,14 +9,16 @@ @AllArgsConstructor @NoArgsConstructor @Builder -public class LedgerReport -{ +public class LedgerReport { @JsonProperty("month") private String monthAndYear; @JsonProperty("demandGenerationDate") private String demandGenerationDate; + @JsonProperty("code") + private String code; + @JsonProperty("monthlyCharges") private BigDecimal taxamount; @@ -62,8 +64,7 @@ public class LedgerReport @JsonProperty("userId") private String userId = null; - public LedgerReport(String monthAndYear) - { + public LedgerReport(String monthAndYear) { this.monthAndYear = monthAndYear; this.taxamount = BigDecimal.ZERO; this.penalty = BigDecimal.ZERO; From ee7496d7bbdf01c3d81fe4ae3b50ece0572b09b1 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Tue, 16 Jul 2024 12:29:44 +0530 Subject: [PATCH 016/133] ISTE-245 --- .../packages/css/src/pages/employee/index.scss | 16 ++++++++++++++++ .../payment/src/configs/UICustomizations.js | 8 ++++++++ .../modules/payment/src/pages/citizen/index.js | 9 ++++++--- .../react-components/src/atoms/TopBar.js | 14 +++++++++++--- 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss index 5aad56dd9..bc930dd15 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss @@ -477,8 +477,24 @@ .hamburger-span { display: none; } + + } + @media (min-width: 780px) { + .city{ + object-fit: fill !important; + height: 48px !important; + width: 48px !important; + } } } + + .hambuger-back-wrapper .city{ + border-radius: 5px !important; + object-fit: contain !important; + } + + + } @screen dt { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js index 42894d61a..f9d91f8da 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js @@ -76,6 +76,14 @@ export const UICustomizations = { // delete data.params; return data; }, + MobileDetailsOnClick: (row, tenantId) => { + let link; + Object.keys(row).map((key) => { + if (key === "MASTERS_WAGESEEKER_ID") + link = `/${window.contextPath}/employee/masters/view-wageseeker?tenantId=${tenantId}&wageseekerId=${row[key]}`; + }); + return link; + }, additionalCustomizations: (row, key, column, value, t, searchResult) => { switch (key) { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/pages/citizen/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/pages/citizen/index.js index afd0a64f9..3dfd31f61 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/pages/citizen/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/pages/citizen/index.js @@ -15,10 +15,13 @@ const CitizenApp = ({ path }) => { return ( -
+ margin: "0 auto", + marginTop:"2rem", + }} + > {!excludeBackBtn?.some(url => location.pathname.includes(url)) && {t("CS_COMMON_BACK")}}
In Open Payment Module
} /> diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js index f3ffeca78..554ac6188 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js @@ -29,18 +29,26 @@ const TopBar = ({ // return ; // } // }; + + + const url = window.location.pathname; // Get the current URL pathname + const isPaymentPath = url.includes('/payment/'); // Check for payment path + + const paymentlogoUrl = isPaymentPath + ? window?.globalConfigs?.getConfig?.("LOGO_URL") // Show payment logo if path matches + : logoUrl; return (
- {isMobile && } + {isMobile && !isPaymentPath && } -

{cityOfCitizenShownBesideLogo}

+ {!isPaymentPath &&

{cityOfCitizenShownBesideLogo}

}
From 68fd5de20f8f8bcf67be945435b9c6f9be2a6789 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 16 Jul 2024 14:55:26 +0530 Subject: [PATCH 017/133] ISTE-224 --- .../org/egov/waterconnection/repository/WaterDaoImpl.java | 4 +++- .../repository/rowmapper/LedgerReportRowMapper.java | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) 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 c776d4aa9..c69c38028 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 @@ -712,7 +712,9 @@ public List getLedgerReport(String consumercode, String tenantId, } log.info("Query of ledger report:" + query + "and prepared statement" + preparedStatement); - ledgerReportRowMapper = new LedgerReportRowMapper(startDate,endDate); + ledgerReportRowMapper = new LedgerReportRowMapper(); + ledgerReportRowMapper.setStartDate(startDate); + ledgerReportRowMapper.setEndDate(endDate); return jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); } } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 1e41f5a5d..ac7dc5705 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -34,8 +34,11 @@ public class LedgerReportRowMapper implements ResultSetExtractor Date: Tue, 16 Jul 2024 14:57:18 +0530 Subject: [PATCH 018/133] ISTE-224 --- .../org/egov/waterconnection/repository/WaterDaoImpl.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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 c69c38028..51be94739 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 @@ -50,10 +50,7 @@ @Repository public class WaterDaoImpl implements WaterDao { - @Autowired - private LedgerReportRowMapper ledgerReportRowMapper; - - @Autowired + @Autowired private DemandNotGeneratedRowMapper demandNotGeneratedRowMapper; @Autowired @@ -712,7 +709,7 @@ public List getLedgerReport(String consumercode, String tenantId, } log.info("Query of ledger report:" + query + "and prepared statement" + preparedStatement); - ledgerReportRowMapper = new LedgerReportRowMapper(); + LedgerReportRowMapper ledgerReportRowMapper = new LedgerReportRowMapper(); ledgerReportRowMapper.setStartDate(startDate); ledgerReportRowMapper.setEndDate(endDate); return jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); From ee0e5070400d354302cd3fdadbbc0925fd1fece2 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 16 Jul 2024 15:40:31 +0530 Subject: [PATCH 019/133] ISTE-224 --- .../repository/rowmapper/LedgerReportRowMapper.java | 6 +++++- .../org/egov/waterconnection/service/WaterServiceImpl.java | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index ac7dc5705..5dc6bc48d 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -16,6 +16,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.time.LocalDate; +import java.time.YearMonth; import java.time.format.DateTimeFormatter; import java.util.*; import java.time.temporal.ChronoUnit; @@ -101,7 +102,10 @@ public List extractData(ResultSet resultSet) throws SQLException, ledgerReports.put(monthAndYear, ledgerReport); } for (Map.Entry entry : ledgerReports.entrySet()) { - LocalDate endDate = LocalDate.parse(entry.getKey(), DateTimeFormatter.ofPattern("MMMMyyyy")); + String monthAndYear = entry.getKey(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMMyyyy", Locale.ENGLISH); + YearMonth yearMonth = YearMonth.parse(monthAndYear, formatter); + LocalDate endDate = yearMonth.atDay(1); String code = entry.getValue().getCode(); if (!endDate.isBefore(startDate) && !endDate.isAfter(this.endDate) && code.equals("10101")) { ledgerReportList.add(entry.getValue()); 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 a187bbc72..330b380ae 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 @@ -873,9 +873,9 @@ public List ledgerReport(String consumercode, String tenantId, Int int startYear = Integer.parseInt(years[0]); int endYear = Integer.parseInt(years[1]); - if (endYear != startYear + 1) { - throw new IllegalArgumentException("Invalid fiscal year range"); - } +// if (endYear != startYear + 1) { +// throw new IllegalArgumentException("Invalid fiscal year range"); +// } LocalDate startDate = LocalDate.of(startYear, 4, 1); LocalDate endDate = LocalDate.of(startYear + 1, 3, 31); From d19315d9bdc377a75e574fff0f655ef26fddf924 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 16 Jul 2024 17:16:43 +0530 Subject: [PATCH 020/133] ISTE-224 --- .../rowmapper/LedgerReportRowMapper.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 5dc6bc48d..af5f7da77 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -32,15 +32,17 @@ public class LedgerReportRowMapper implements ResultSetExtractor extractData(ResultSet resultSet) throws SQLException, } for (Map.Entry entry : ledgerReports.entrySet()) { String monthAndYear = entry.getKey(); + log.info("Month and year from map "+monthAndYear); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMMyyyy", Locale.ENGLISH); YearMonth yearMonth = YearMonth.parse(monthAndYear, formatter); LocalDate endDate = yearMonth.atDay(1); String code = entry.getValue().getCode(); - if (!endDate.isBefore(startDate) && !endDate.isAfter(this.endDate) && code.equals("10101")) { + if (!endDate.isBefore(startDateLocalDate) && !endDate.isAfter(endDateLocalDate) && code.equals("10101")) { ledgerReportList.add(entry.getValue()); } } + log.info("ledger report list"+ledgerReportList); // ledgerReportList.addAll(ledgerReports.values()); if (!ledgerReportList.isEmpty()) { enrichConnectionHolderDetails(ledgerReportList); From 1af44f1774c2db3ba4d894409625ebade7fb72e2 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Tue, 16 Jul 2024 18:09:35 +0530 Subject: [PATCH 021/133] ISTE-241 and ISTE-240 --- .../payment/src/components/OpenView.js | 150 +++++++++++++----- 1 file changed, 111 insertions(+), 39 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js index e1613c371..eafb508c4 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js @@ -47,7 +47,7 @@ const OpenView = () => { const requestCriteriaForConnectionSearch = { url: "/ws-services/wc/_search?", - params: { tenantId:queryParams.tenantId,businessService:queryParams.businessService, connectionNumber: queryParams.consumerCode,isOpenPaymentSearch:true }, + params: { tenantId: queryParams.tenantId, businessService: queryParams.businessService, connectionNumber: queryParams.consumerCode, isOpenPaymentSearch: true }, body: {}, options: { userService: false, @@ -66,7 +66,7 @@ const OpenView = () => { const requestCriteriaForPayments = { url: "/collection-services/payments/WS/_search", - params: {consumerCodes:queryParams.consumerCode,tenantId:queryParams.tenantId,businessService:queryParams.businessService}, + params: { consumerCodes: queryParams.consumerCode, tenantId: queryParams.tenantId, businessService: queryParams.businessService }, body: {}, options: { userService: false, @@ -87,10 +87,41 @@ const OpenView = () => { }, }; - const { isLoading: isLoadingPayments, data: payments, isFetching: isFetchingPayments, error: isErrorPayments } = Digit.Hooks.useCustomAPIHook( - requestCriteriaForPayments + const requestCriteriaForOnlineTransactions = { + url: "/pg-service/transaction/v1/_search", + params: { consumerCodes: queryParams.consumerCode, tenantId: queryParams.tenantId, businessService: queryParams.businessService }, + body: {}, + options: { + userService: false, + auth: false, + }, + config: { + enabled: !!queryParams.consumerCode && !!queryParams.tenantId, + select: (data) => { + const onlineTransactions = data?.Transaction; + + if (!onlineTransactions) { + return null; // Handle undefined or null data gracefully + } + + // Sort onlineTransactions in descending order by createdTime + onlineTransactions.sort((a, b) => b.auditDetails.createdTime - a.auditDetails.createdTime); + + // Return the desired number of latest transactions (up to 5) + return onlineTransactions.slice(0, Math.min(onlineTransactions.length, 5)); + }, + }, + }; + + const { isLoading: isLoadingTransactions, data: onlineTransactions, isFetching: isFetchingTransactions, error: isErrorTransactions } = Digit.Hooks.useCustomAPIHook( + requestCriteriaForOnlineTransactions ); + // const { isLoading: isLoadingPayments, data: payments, isFetching: isFetchingPayments, error: isErrorPayments } = Digit.Hooks.useCustomAPIHook( + // requestCriteriaForPayments + // ); + + const arrears = bill?.billDetails ?.sort((a, b) => b.fromPeriod - a.fromPeriod) @@ -207,10 +238,41 @@ const OpenView = () => { } }; - if (isLoading || isLoadingPayments || isLoadingConnection) { + if (isLoading || isLoadingTransactions || isLoadingConnection) { return ; } + + function convertEpochToDateString(epochTime) { + const date = new Date(epochTime); + + // Extract components + const day = date.getDate(); + const month = date.getMonth() + 1; // Months are zero-indexed + const year = date.getFullYear(); + let hours = date.getHours(); + const minutes = date.getMinutes(); + const seconds = date.getSeconds(); + + // Determine AM/PM + const ampm = hours >= 12 ? 'PM' : 'AM'; + + // Convert to 12-hour format + hours = hours % 12; + hours = hours ? hours : 12; // the hour '0' should be '12' + + // Pad minutes and seconds with leading zeros + const minutesPadded = minutes < 10 ? '0' + minutes : minutes; + const secondsPadded = seconds < 10 ? '0' + seconds : seconds; + + // Format date and time + const formattedDate = `${day} July ${year} at ${hours}:${minutesPadded}:${secondsPadded} ${ampm}`; + + return formattedDate; + } + + + return ( <>
@@ -264,15 +326,19 @@ const OpenView = () => { /> )} - - + +
+ {t("ES_PAYMENT_TAXHEADS")} +
+ + + - {bill ? ( - <> + <> { )} - {payments && ( + {onlineTransactions && (
{t("OP_CONSUMER_RECEIPTS")}
)} - {payments && - payments.map((payment) => { - return ( - - - - - - {/* */} - - - ); - })} + {onlineTransactions && onlineTransactions.map((item) => { + return ( + + + + + + + + + + + + ); + }) + } {/* {displayMenu ? : null} */} - + {showToast && ( Date: Wed, 17 Jul 2024 11:36:32 +0530 Subject: [PATCH 022/133] ISTE-240 -FIX --- .../packages/css/src/pages/employee/index.scss | 10 +++++----- .../packages/react-components/src/atoms/TopBar.js | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss index bc930dd15..49985abca 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss @@ -477,20 +477,20 @@ .hamburger-span { display: none; } - - } - @media (min-width: 780px) { .city{ - object-fit: fill !important; height: 48px !important; width: 48px !important; + padding: 0px !important; } + } + } .hambuger-back-wrapper .city{ + object-fit: scale-down !important; border-radius: 5px !important; - object-fit: contain !important; + padding: 1px 15px !important; } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js index 554ac6188..5e691659c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js @@ -40,7 +40,8 @@ const TopBar = ({ return (
-
+
{isMobile && !isPaymentPath && } mSeva + { isPaymentPath && } {!isPaymentPath &&

{cityOfCitizenShownBesideLogo}

}
From 2821baed00e31363ee9f533cf888a480f70017a0 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 17 Jul 2024 15:49:18 +0530 Subject: [PATCH 023/133] ISTE-229 --- .../repository/builder/WsQueryBuilder.java | 13 +--- .../rowmapper/LedgerReportRowMapper.java | 65 ++++++++++--------- .../web/models/LedgerReport.java | 28 ++++---- 3 files changed, 50 insertions(+), 56 deletions(-) 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 33a3fad8f..a6121a2e6 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 @@ -180,20 +180,13 @@ public class WsQueryBuilder { public static final String LEDGER_REPORT_QUERY = "SELECT connectionholder.userid as uuid,conn.connectionno as connectionNo,conn.oldconnectionno," + "to_timestamp(dem.taxperiodfrom/1000)::date as startdate,to_timestamp(dem.taxperiodto/1000)::date as enddate," + "to_timestamp(dem.createdtime/1000)::date as demandGenerationDate," + - "dd.taxheadcode as code,dd.taxamount as taxamount," + - "COALESCE(SUM(p.totaldue), 0) as due,COALESCE(SUM(p.totalamountpaid), 0) as paid," + - "MAX(to_timestamp(p.transactiondate/1000))::date as collectiondate," + - "MAX(pd.receiptnumber) as receiptno " + + "dd.taxheadcode as code,dd.taxamount as taxamount " + "FROM eg_ws_connection conn INNER JOIN eg_ws_connectionholder connectionholder " + "ON connectionholder.connectionid = conn.id " + "INNER JOIN egbs_demand_v1 dem ON dem.consumercode = conn.connectionno INNER JOIN " + - "egbs_demanddetail_v1 dd ON dd.demandid = dem.id LEFT JOIN egbs_billdetail_v1 bd " + - "ON bd.demandid = dem.id LEFT JOIN egcl_paymentdetail pd ON pd.billid = bd.billid " + - "LEFT JOIN egcl_payment p ON p.id = pd.paymentid AND p.tenantid = 'pb.poohlahjgfid' " + - "AND p.instrumentstatus = 'APPROVED' AND p.paymentstatus NOT IN ('CANCELLED') " + + "egbs_demanddetail_v1 dd ON dd.demandid = dem.id " + "WHERE dem.consumercode = ? AND conn.tenantId = ? AND conn.status = 'Active' AND dem.status = 'ACTIVE' " + - "GROUP BY conn.connectionno, conn.oldconnectionno,connectionholder.userid,dem.id, dem.taxperiodfrom, " + - "dem.taxperiodto, dem.createdtime, dd.taxheadcode, dd.taxamount ORDER BY enddate, code, collectiondate"; + "ORDER BY startdate"; /** * diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index af5f7da77..901da7828 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -49,8 +49,8 @@ public void setEndDate(LocalDate endDate) { public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { List ledgerReportList = new ArrayList<>(); Map ledgerReports = new HashMap<>(); - BigDecimal previousBalanceLeft = BigDecimal.ZERO; - BigDecimal arrears = BigDecimal.ZERO; +// BigDecimal previousBalanceLeft = BigDecimal.ZERO; +// BigDecimal arrears = BigDecimal.ZERO; while (resultSet.next()) { LocalDate date = resultSet.getDate("enddate").toLocalDate(); @@ -66,16 +66,17 @@ public List extractData(ResultSet resultSet) throws SQLException, LedgerReport ledgerReport = ledgerReports.getOrDefault(monthAndYear, new LedgerReport(monthAndYear)); if (code.equals("10102")) { - ledgerReport.setArrears(taxamount); - ledgerReport.setMonthAndYear(monthAndYear); - arrears = resultSet.getBigDecimal("due").subtract(resultSet.getBigDecimal("paid")); - } else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { +// ledgerReport.setArrears(taxamount); +// ledgerReport.setMonthAndYear(monthAndYear); +// arrears = resultSet.getBigDecimal("due").subtract(resultSet.getBigDecimal("paid")); + } + else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { ledgerReport.setPenalty(taxamount); BigDecimal amount = ledgerReports.get(monthAndYear).getTaxamount() != null ? ledgerReports.get(monthAndYear).getTaxamount() : BigDecimal.ZERO; ledgerReport.setTotalForCurrentMonth(taxamount.add(amount)); ledgerReport.setTotal_due_amount(ledgerReport.getTotalForCurrentMonth().add(ledgerReport.getArrears())); - ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); - previousBalanceLeft = ledgerReport.getBalanceLeft(); +// ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); +// previousBalanceLeft = ledgerReport.getBalanceLeft(); } else if (code.equals("10101")) { ledgerReport.setMonthAndYear(monthAndYear); ledgerReport.setDemandGenerationDate(demandGenerationDate); @@ -83,39 +84,39 @@ public List extractData(ResultSet resultSet) throws SQLException, ledgerReport.setTotalForCurrentMonth(ledgerReport.getTaxamount().add(ledgerReport.getPenalty())); ledgerReport.setDueDate(demandGenerationDateLocal.plus(10, ChronoUnit.DAYS).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); ledgerReport.setPenaltyAppliedDate(demandGenerationDateLocal.plus(11, ChronoUnit.DAYS).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); - ledgerReport.setCollectionDate(resultSet.getDate("collectiondate") != null ? resultSet.getDate("collectiondate").toLocalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) : null); - ledgerReport.setReceiptNo(resultSet.getString("receiptno")); - ledgerReport.setPaid(resultSet.getBigDecimal("paid")); - if (arrears.equals(BigDecimal.ZERO)) { - ledgerReport.setArrears(previousBalanceLeft); - } else { - ledgerReport.setArrears(arrears); - arrears = BigDecimal.ZERO; - } +// ledgerReport.setCollectionDate(resultSet.getDate("collectiondate") != null ? resultSet.getDate("collectiondate").toLocalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) : null); +// ledgerReport.setReceiptNo(resultSet.getString("receiptno")); +// ledgerReport.setPaid(resultSet.getBigDecimal("paid")); +// if (arrears.equals(BigDecimal.ZERO)) { +// ledgerReport.setArrears(previousBalanceLeft); +// } else { +// ledgerReport.setArrears(arrears); +// arrears = BigDecimal.ZERO; +// } ledgerReport.setTotal_due_amount(ledgerReport.getTotalForCurrentMonth().add(ledgerReport.getArrears())); - ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); - previousBalanceLeft = ledgerReport.getBalanceLeft(); +// ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); +// previousBalanceLeft = ledgerReport.getBalanceLeft(); + ledgerReport.setCode(code); } ledgerReport.setConnectionNo(resultSet.getString("connectionno")); ledgerReport.setOldConnectionNo(resultSet.getString("oldconnectionno")); ledgerReport.setUserId(resultSet.getString("uuid")); - ledgerReport.setCode(code); log.info("Data inserted into map " + ledgerReport.toString()); ledgerReports.put(monthAndYear, ledgerReport); } - for (Map.Entry entry : ledgerReports.entrySet()) { - String monthAndYear = entry.getKey(); - log.info("Month and year from map "+monthAndYear); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMMyyyy", Locale.ENGLISH); - YearMonth yearMonth = YearMonth.parse(monthAndYear, formatter); - LocalDate endDate = yearMonth.atDay(1); - String code = entry.getValue().getCode(); - if (!endDate.isBefore(startDateLocalDate) && !endDate.isAfter(endDateLocalDate) && code.equals("10101")) { - ledgerReportList.add(entry.getValue()); - } - } +// for (Map.Entry entry : ledgerReports.entrySet()) { +// String monthAndYear = entry.getKey(); +// log.info("Month and year from map "+monthAndYear); +// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMMyyyy", Locale.ENGLISH); +// YearMonth yearMonth = YearMonth.parse(monthAndYear, formatter); +// LocalDate endDate = yearMonth.atDay(1); +// String code = entry.getValue().getCode(); +// if (!endDate.isBefore(startDateLocalDate) && !endDate.isAfter(endDateLocalDate) && code.equals("10101")) { +// ledgerReportList.add(entry.getValue()); +// } +// } + ledgerReportList.addAll(ledgerReports.values()); log.info("ledger report list"+ledgerReportList); -// ledgerReportList.addAll(ledgerReports.values()); if (!ledgerReportList.isEmpty()) { enrichConnectionHolderDetails(ledgerReportList); } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java index 60561d3d4..119c10cdd 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java @@ -17,7 +17,7 @@ public class LedgerReport { private String demandGenerationDate; @JsonProperty("code") - private String code; + private String code=null; @JsonProperty("monthlyCharges") private BigDecimal taxamount; @@ -40,17 +40,17 @@ public class LedgerReport { @JsonProperty("penaltyAppliedOnDate") private String penaltyAppliedDate; - @JsonProperty("paymentCollectionDate") - private String collectionDate; - - @JsonProperty("receiptNo") - private String receiptNo; - - @JsonProperty("amountPaid") - private BigDecimal paid; - - @JsonProperty("balanceLeft") - private BigDecimal balanceLeft; +// @JsonProperty("paymentCollectionDate") +// private String collectionDate; +// +// @JsonProperty("receiptNo") +// private String receiptNo; +// +// @JsonProperty("amountPaid") +// private BigDecimal paid; +// +// @JsonProperty("balanceLeft") +// private BigDecimal balanceLeft; @JsonProperty("consumerName") private String consumerName = null; @@ -69,8 +69,8 @@ public LedgerReport(String monthAndYear) { this.taxamount = BigDecimal.ZERO; this.penalty = BigDecimal.ZERO; this.totalForCurrentMonth = BigDecimal.ZERO; - this.paid = BigDecimal.ZERO; - this.balanceLeft = BigDecimal.ZERO; +// this.paid = BigDecimal.ZERO; +// this.balanceLeft = BigDecimal.ZERO; } } From db0d337dd13caf082739b66e283591b397952341 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 17 Jul 2024 16:35:56 +0530 Subject: [PATCH 024/133] ISTE-229 --- .../repository/WaterDaoImpl.java | 4 +- .../rowmapper/LedgerReportRowMapper.java | 82 +++++++++---------- .../web/models/DemandLedgerReport.java | 67 +++++++++++++++ .../web/models/LedgerReport.java | 71 ++-------------- .../web/models/PaymentLedgerReport.java | 28 +++++++ 5 files changed, 144 insertions(+), 108 deletions(-) create mode 100644 municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java create mode 100644 municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java 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 51be94739..be1456beb 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 @@ -710,8 +710,8 @@ public List getLedgerReport(String consumercode, String tenantId, log.info("Query of ledger report:" + query + "and prepared statement" + preparedStatement); LedgerReportRowMapper ledgerReportRowMapper = new LedgerReportRowMapper(); - ledgerReportRowMapper.setStartDate(startDate); - ledgerReportRowMapper.setEndDate(endDate); +// ledgerReportRowMapper.setStartDate(startDate); +// ledgerReportRowMapper.setEndDate(endDate); return jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); } } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 901da7828..6ff8fa266 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -32,25 +32,25 @@ public class LedgerReportRowMapper implements ResultSetExtractor extractData(ResultSet resultSet) throws SQLException, DataAccessException { List ledgerReportList = new ArrayList<>(); Map ledgerReports = new HashMap<>(); -// BigDecimal previousBalanceLeft = BigDecimal.ZERO; -// BigDecimal arrears = BigDecimal.ZERO; + BigDecimal previousBalanceLeft = BigDecimal.ZERO; + BigDecimal arrears = BigDecimal.ZERO; while (resultSet.next()) { LocalDate date = resultSet.getDate("enddate").toLocalDate(); @@ -63,44 +63,44 @@ public List extractData(ResultSet resultSet) throws SQLException, LocalDate demandGenerationDateLocal = resultSet.getDate("demandgenerationdate").toLocalDate(); String demandGenerationDate = demandGenerationDateLocal.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); - LedgerReport ledgerReport = ledgerReports.getOrDefault(monthAndYear, new LedgerReport(monthAndYear)); + LedgerReport ledgerReport = ledgerReports.getOrDefault(monthAndYear, new LedgerReport()); if (code.equals("10102")) { -// ledgerReport.setArrears(taxamount); -// ledgerReport.setMonthAndYear(monthAndYear); -// arrears = resultSet.getBigDecimal("due").subtract(resultSet.getBigDecimal("paid")); + ledgerReport.getDemand().setArrears(taxamount); + ledgerReport.getDemand().setMonthAndYear(monthAndYear); + arrears = resultSet.getBigDecimal("due").subtract(resultSet.getBigDecimal("paid")); } else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { - ledgerReport.setPenalty(taxamount); - BigDecimal amount = ledgerReports.get(monthAndYear).getTaxamount() != null ? ledgerReports.get(monthAndYear).getTaxamount() : BigDecimal.ZERO; - ledgerReport.setTotalForCurrentMonth(taxamount.add(amount)); - ledgerReport.setTotal_due_amount(ledgerReport.getTotalForCurrentMonth().add(ledgerReport.getArrears())); + ledgerReport.getDemand().setPenalty(taxamount); + BigDecimal amount = ledgerReports.get(monthAndYear).getDemand().getTaxamount() != null ? ledgerReports.get(monthAndYear).getDemand().getTaxamount() : BigDecimal.ZERO; + ledgerReport.getDemand().setTotalForCurrentMonth(taxamount.add(amount)); + ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears())); // ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); // previousBalanceLeft = ledgerReport.getBalanceLeft(); } else if (code.equals("10101")) { - ledgerReport.setMonthAndYear(monthAndYear); - ledgerReport.setDemandGenerationDate(demandGenerationDate); - ledgerReport.setTaxamount(taxamount); - ledgerReport.setTotalForCurrentMonth(ledgerReport.getTaxamount().add(ledgerReport.getPenalty())); - ledgerReport.setDueDate(demandGenerationDateLocal.plus(10, ChronoUnit.DAYS).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); - ledgerReport.setPenaltyAppliedDate(demandGenerationDateLocal.plus(11, ChronoUnit.DAYS).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + ledgerReport.getDemand().setMonthAndYear(monthAndYear); + ledgerReport.getDemand().setDemandGenerationDate(demandGenerationDate); + ledgerReport.getDemand().setTaxamount(taxamount); + ledgerReport.getDemand().setTotalForCurrentMonth(ledgerReport.getDemand().getTaxamount().add(ledgerReport.getDemand().getPenalty())); + ledgerReport.getDemand().setDueDate(demandGenerationDateLocal.plus(10, ChronoUnit.DAYS).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + ledgerReport.getDemand().setPenaltyAppliedDate(demandGenerationDateLocal.plus(11, ChronoUnit.DAYS).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); // ledgerReport.setCollectionDate(resultSet.getDate("collectiondate") != null ? resultSet.getDate("collectiondate").toLocalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) : null); // ledgerReport.setReceiptNo(resultSet.getString("receiptno")); // ledgerReport.setPaid(resultSet.getBigDecimal("paid")); -// if (arrears.equals(BigDecimal.ZERO)) { -// ledgerReport.setArrears(previousBalanceLeft); -// } else { -// ledgerReport.setArrears(arrears); -// arrears = BigDecimal.ZERO; -// } - ledgerReport.setTotal_due_amount(ledgerReport.getTotalForCurrentMonth().add(ledgerReport.getArrears())); + if (arrears.equals(BigDecimal.ZERO)) { + ledgerReport.getDemand().setArrears(previousBalanceLeft); + } else { + ledgerReport.getDemand().setArrears(arrears); + arrears = BigDecimal.ZERO; + } + ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears())); // ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); // previousBalanceLeft = ledgerReport.getBalanceLeft(); - ledgerReport.setCode(code); + ledgerReport.getDemand().setCode(code); } - ledgerReport.setConnectionNo(resultSet.getString("connectionno")); - ledgerReport.setOldConnectionNo(resultSet.getString("oldconnectionno")); - ledgerReport.setUserId(resultSet.getString("uuid")); + ledgerReport.getDemand().setConnectionNo(resultSet.getString("connectionno")); + ledgerReport.getDemand().setOldConnectionNo(resultSet.getString("oldconnectionno")); + ledgerReport.getDemand().setUserId(resultSet.getString("uuid")); log.info("Data inserted into map " + ledgerReport.toString()); ledgerReports.put(monthAndYear, ledgerReport); } @@ -126,7 +126,7 @@ else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { private void enrichConnectionHolderDetails(List ledgerReportList) { Set connectionHolderIds = new HashSet<>(); for (LedgerReport ledgerReport : ledgerReportList) { - connectionHolderIds.add(ledgerReport.getUserId()); + connectionHolderIds.add(ledgerReport.getDemand().getUserId()); } UserSearchRequest userSearchRequest = new UserSearchRequest(); userSearchRequest.setUuid(connectionHolderIds); @@ -139,6 +139,6 @@ private void enrichConnectionHolderInfo(UserDetailResponse userDetailResponse, List connectionHolderInfos = userDetailResponse.getUser(); Map userIdToConnectionHolderMap = new HashMap<>(); connectionHolderInfos.forEach(user -> userIdToConnectionHolderMap.put(user.getUuid(), user)); - ledgerReportList.forEach(ledgerReport -> ledgerReport.setConsumerName(userIdToConnectionHolderMap.get(ledgerReport.getUserId()).getName())); + ledgerReportList.forEach(ledgerReport -> ledgerReport.getDemand().setConsumerName(userIdToConnectionHolderMap.get(ledgerReport.getDemand().getUserId()).getName())); } } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java new file mode 100644 index 000000000..d19963424 --- /dev/null +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java @@ -0,0 +1,67 @@ +package org.egov.waterconnection.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class DemandLedgerReport { + + @JsonProperty("consumerName") + private String consumerName = null; + + @JsonProperty("connectionNo") + private String connectionNo = null; + + @JsonProperty("oldConnectionNo") + private String oldConnectionNo = null; + + @JsonProperty("userId") + private String userId = null; + + @JsonProperty("month") + private String monthAndYear; + + @JsonProperty("demandGenerationDate") + private String demandGenerationDate; + + @JsonProperty("code") + private String code = null; + + @JsonProperty("monthlyCharges") + private BigDecimal taxamount; + + @JsonProperty("penalty") + private BigDecimal penalty; + + @JsonProperty("totalForCurrentMonth") + private BigDecimal totalForCurrentMonth; + + @JsonProperty("previousMonthBalance") + private BigDecimal arrears; + + @JsonProperty("totalDues") + private BigDecimal total_due_amount; + + @JsonProperty("dueDateOfPayment") + private String dueDate; + + @JsonProperty("penaltyAppliedOnDate") + private String penaltyAppliedDate; + + public DemandLedgerReport(String monthAndYear) { + this.monthAndYear = monthAndYear; + this.taxamount = BigDecimal.ZERO; + this.penalty = BigDecimal.ZERO; + this.totalForCurrentMonth = BigDecimal.ZERO; + this.arrears = BigDecimal.ZERO; + this.total_due_amount = BigDecimal.ZERO; + } +} diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java index 119c10cdd..57d834c2e 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java @@ -3,74 +3,15 @@ import com.fasterxml.jackson.annotation.JsonProperty; import lombok.*; -import java.math.BigDecimal; - @Data @AllArgsConstructor @NoArgsConstructor @Builder -public class LedgerReport { - @JsonProperty("month") - private String monthAndYear; - - @JsonProperty("demandGenerationDate") - private String demandGenerationDate; - - @JsonProperty("code") - private String code=null; - - @JsonProperty("monthlyCharges") - private BigDecimal taxamount; - - @JsonProperty("penalty") - private BigDecimal penalty; - - @JsonProperty("totalForCurrentMonth") - private BigDecimal totalForCurrentMonth; - - @JsonProperty("previousMonthBalance") - private BigDecimal arrears; - - @JsonProperty("totalDues") - private BigDecimal total_due_amount; - - @JsonProperty("dueDateOfPayment") - private String dueDate; - - @JsonProperty("penaltyAppliedOnDate") - private String penaltyAppliedDate; - -// @JsonProperty("paymentCollectionDate") -// private String collectionDate; -// -// @JsonProperty("receiptNo") -// private String receiptNo; -// -// @JsonProperty("amountPaid") -// private BigDecimal paid; -// -// @JsonProperty("balanceLeft") -// private BigDecimal balanceLeft; - - @JsonProperty("consumerName") - private String consumerName = null; - - @JsonProperty("connectionNo") - private String connectionNo = null; - - @JsonProperty("oldConnectionNo") - private String oldConnectionNo = null; - - @JsonProperty("userId") - private String userId = null; - - public LedgerReport(String monthAndYear) { - this.monthAndYear = monthAndYear; - this.taxamount = BigDecimal.ZERO; - this.penalty = BigDecimal.ZERO; - this.totalForCurrentMonth = BigDecimal.ZERO; -// this.paid = BigDecimal.ZERO; -// this.balanceLeft = BigDecimal.ZERO; +public class LedgerReport +{ + @JsonProperty("demand") + private DemandLedgerReport demand; - } + @JsonProperty("payment") + private PaymentLedgerReport payment; } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java new file mode 100644 index 000000000..d65890620 --- /dev/null +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java @@ -0,0 +1,28 @@ +package org.egov.waterconnection.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class PaymentLedgerReport +{ + @JsonProperty("paymentCollectionDate") + private String collectionDate; + + @JsonProperty("receiptNo") + private String receiptNo; + + @JsonProperty("amountPaid") + private BigDecimal paid; + + @JsonProperty("balanceLeft") + private BigDecimal balanceLeft; +} From 4630df8cae66cf210225e388ef4c58e5b7344a8e Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 18 Jul 2024 11:49:10 +0530 Subject: [PATCH 025/133] ledger report view added and API call function added --- .../lib/components/dashboard/bills_table.dart | 88 ++++++++++++++----- .../household_register_provider.dart | 20 ++++- 2 files changed, 83 insertions(+), 25 deletions(-) diff --git a/frontend/mgramseva/lib/components/dashboard/bills_table.dart b/frontend/mgramseva/lib/components/dashboard/bills_table.dart index c0836879c..ce3494071 100644 --- a/frontend/mgramseva/lib/components/dashboard/bills_table.dart +++ b/frontend/mgramseva/lib/components/dashboard/bills_table.dart @@ -184,27 +184,56 @@ class _BillsTable extends State { Widget _generateColumnRow( BuildContext context, int index, String input, constraints, - {TextStyle? style}) { - return Container( - child: Row( - children: [ - Expanded( - child: Text( - ApplicationLocalizations.of(context).translate(input), - style: style, - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), - ) - ], - ), - width: widget.leftColumnWidth, - height: widget.tableData[index].tableRow.first.label.length > 28 - ? columnRowIncreasedHeight(index) - : columnRowFixedHeight, - padding: EdgeInsets.only(left: 17, right: 5, top: 6, bottom: 6), - alignment: Alignment.centerLeft, - ); + {TextStyle? style, int? i}) { + var data = widget.tableData[index].tableRow[i ?? 0]; + if (i != null) { + return InkWell( + onTap: (){ + data.callBack!(data); + }, + child: Container( + child: Row( + children: [ + Expanded( + child: Text( + ApplicationLocalizations.of(context).translate(input), + style: style, + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ) + ], + ), + width: widget.leftColumnWidth, + height: widget.tableData[index].tableRow.first.label.length > 28 + ? columnRowIncreasedHeight(index) + : columnRowFixedHeight, + padding: EdgeInsets.only(left: 17, right: 5, top: 6, bottom: 6), + alignment: Alignment.centerLeft, + ), + ); + } else { + return Container( + child: Row( + children: [ + Expanded( + child: Text( + ApplicationLocalizations.of(context).translate(input), + style: style, + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ) + ], + ), + width: widget.leftColumnWidth, + height: widget.tableData[index].tableRow.first.label.length > 28 + ? columnRowIncreasedHeight(index) + : columnRowFixedHeight, + padding: EdgeInsets.only(left: 17, right: 5, top: 6, bottom: 6), + alignment: Alignment.centerLeft, + ); + } } Widget _generateRightHandSideColumnRow(BuildContext context, int index) { @@ -213,9 +242,20 @@ class _BillsTable extends State { return LayoutBuilder(builder: (context, constraints) { var list = []; for (int i = 1; i < data.tableRow.length; i++) { - list.add(_generateColumnRow( - context, index, data.tableRow[i].label, constraints, - style: data.tableRow[i].style)); + if (data.tableRow[i].label == "View") { + log("${data.tableRow[i].label}"); + list.add( + _generateColumnRow( + context, index, data.tableRow[i].label, constraints, + style: data.tableRow[i].style, i: i), + ); + } else { + list.add( + _generateColumnRow( + context, index, data.tableRow[i].label, constraints, + style: data.tableRow[i].style), + ); + } } return Container( color: index % 2 == 0 ? const Color(0xffEEEEEE) : Colors.white, diff --git a/frontend/mgramseva/lib/providers/household_register_provider.dart b/frontend/mgramseva/lib/providers/household_register_provider.dart index a9008d0c7..a3a669931 100644 --- a/frontend/mgramseva/lib/providers/household_register_provider.dart +++ b/frontend/mgramseva/lib/providers/household_register_provider.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:mgramseva/model/connection/water_connection.dart'; @@ -238,7 +239,8 @@ class HouseholdRegisterProvider with ChangeNotifier { : null, callBack: onSort), TableHeader(i18.householdRegister.ACTIVE_INACTIVE, - isSortingRequired: false, apiKey: 'status'), + isSortingRequired: false, apiKey: 'leadgerReport'), + TableHeader("Ledger", apiKey: '/viewLeadger') ]; List get collectionHeaderListOLd => [ TableHeader(i18.common.CONNECTION_ID, @@ -293,6 +295,7 @@ class HouseholdRegisterProvider with ChangeNotifier { ? sortBy!.isAscending : null, callBack: onSort), + ]; List getCollectionsData(List list) { @@ -415,6 +418,15 @@ class HouseholdRegisterProvider with ChangeNotifier { Constants.CONNECTION_STATUS.last ? ColorCodes.ACTIVE_COL : ColorCodes.INACTIVE_COL)), + TableData( + '${'View'}', + apiKey: "viewLeadgerKey", + callBack: viewLeadger, + style: TextStyle( + decoration: TextDecoration.underline, + color: Colors.blue + ), + ), ]); } @@ -427,6 +439,12 @@ class HouseholdRegisterProvider with ChangeNotifier { 'mode': 'collect', 'status': waterConnection?.status }); + } + viewLeadger(TableData tableData) { + log("Call Ledger View Here"); + + + } onSort(TableHeader header) { From 611b995d5560b07b6e58fd3a17a0ccbf0591eebb Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 18 Jul 2024 13:13:04 +0530 Subject: [PATCH 026/133] ISTE-186 --- .../components/pageComponents/jurisdiction.js | 81 +++++++++++++++---- 1 file changed, 66 insertions(+), 15 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js index 0a4290de8..1474eb067 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js @@ -180,24 +180,72 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { }; const handleAddUnit = () => { - setjurisdictions((prev) => [ - ...prev, - { - key: prev.length + 1, - hierarchy: null, - boundaryType: null, - boundary: null, - division: null, - divisionBoundary: [], - roles: [], - }, - ]); + if(STATE_ADMIN){ + if(!isEdit){ + setjurisdictions((prev) => [ + ...prev, + { + key: prev.length + 1, + hierarchy: null, + boundaryType: null, + boundary: null, + division: null, + divisionBoundary: [], + roles: [], + }, + ]); + setjurisdictions((prev) => prev.map((unit, index) => ({ ...unit, key: index }))); + }else{ + setJuristictionsData((prev) => [ + ...prev, + { + key: prev.length + 1, + hierarchy: null, + boundaryType: null, + boundary: null, + division: null, + divisionBoundary: [], + roles: [], + }, + ]); + setJuristictionsData((prev) => prev.map((unit, index) => ({ ...unit, key: index }))); + } + + }else{ + setjurisdictions((prev) => [ + ...prev, + { + key: prev.length + 1, + hierarchy: null, + boundaryType: null, + boundary: null, + division: null, + divisionBoundary: [], + roles: [], + }, + ]); + setjurisdictions((prev) => prev.map((unit, index) => ({ ...unit, key: index }))); + + } + + + }; const handleRemoveUnit = (unit) => { if(STATE_ADMIN){ - const updatedJurisdictionsData = jurisdictionsData.filter( - (element) => element.key !== unit.key - ); + let updatedJurisdictionsData = []; + if(!isEdit){ + updatedJurisdictionsData = jurisdictions.filter( + (element) => element.key !== unit.key + ); + } + else{ + updatedJurisdictionsData = jurisdictionsData.filter( + (element) => element.key !== unit.key + ); + } + + setJuristictionsData(updatedJurisdictionsData); setjurisdictions(updatedJurisdictionsData) if (FormData.errors?.Jurisdictions?.type == unit.key) { @@ -206,6 +254,8 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { reviseIndexKeys(); } + + else{ if (unit.id) { let res = { @@ -270,6 +320,7 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { if (isLoading && isUserDataLoading) { return ; } + console.log((isEdit && STATE_ADMIN),"isEdit && STATE_ADMIN"); return (
{isEdit && STATE_ADMIN ? ( From d0bc522eed09b967af740cdef8341319467ed9d6 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 18 Jul 2024 14:23:41 +0530 Subject: [PATCH 027/133] ISTE-275,246,243,ISTE-254, --- .../packages/css/src/pages/employee/index.scss | 3 +++ .../modules/payment/src/components/OpenView.js | 2 +- .../modules/payment/src/configs/OpenSearchConfig.js | 2 +- .../packages/react-components/src/atoms/TopBar.js | 13 ++++++++----- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss index 49985abca..e10cd0479 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss @@ -369,6 +369,9 @@ fill: theme(colors.white); } } + display: flex; + justify-content: center; + align-items: center; } @media (min-width: 640px) { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js index eafb508c4..2a205725f 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js @@ -331,7 +331,7 @@ const OpenView = () => {
- {t("ES_PAYMENT_TAXHEADS")} + {t("ES_PAYMENT_DETAILS_HEADER")}
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/OpenSearchConfig.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/OpenSearchConfig.js index 628cf3cbb..f11871aae 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/OpenSearchConfig.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/OpenSearchConfig.js @@ -180,7 +180,7 @@ export const OpenSearchConfig = { // "showActionBarMobileCard": true, // "actionButtonLabelMobileCard": "TQM_VIEW_RESULTS", "enableGlobalSearch": false, - "enableColumnSort": true, + "enableColumnSort": false, "resultsJsonPath": "WaterConnection", "tableClassName":"table pqm-table" }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js index 5e691659c..e92ae2e43 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js @@ -37,11 +37,14 @@ const TopBar = ({ const paymentlogoUrl = isPaymentPath ? window?.globalConfigs?.getConfig?.("LOGO_URL") // Show payment logo if path matches : logoUrl; + console.log(isPaymentPath,"isPaymentPath"); return (
-
+
{isMobile && !isPaymentPath && } mSeva - { isPaymentPath && } - {!isPaymentPath &&

{cityOfCitizenShownBesideLogo}

} + {isPaymentPath && } + {!isPaymentPath &&

{cityOfCitizenShownBesideLogo}

}
- {!hideNotificationIconOnSomeUrlsWhenNotLoggedIn ? changeLanguage : null} + {!hideNotificationIconOnSomeUrlsWhenNotLoggedIn || isPaymentPath ? changeLanguage : null} {/* {!hideNotificationIconOnSomeUrlsWhenNotLoggedIn ? (
{notificationCountLoaded && notificationCount ? ( From e70ce6c63b366850071bbc885064a34068300f20 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 19 Jul 2024 11:48:36 +0530 Subject: [PATCH 028/133] ISTE-229 --- .../repository/WaterDaoImpl.java | 9 +++-- .../rowmapper/LedgerReportRowMapper.java | 34 ++++++++++++------- .../waterconnection/service/WaterService.java | 3 +- .../service/WaterServiceImpl.java | 4 +-- .../web/controller/WaterController.java | 3 +- .../web/models/LedgerReportResponse.java | 3 +- 6 files changed, 35 insertions(+), 21 deletions(-) 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 be1456beb..3aa52dcb8 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 @@ -50,6 +50,8 @@ @Repository public class WaterDaoImpl implements WaterDao { + @Autowired + private LedgerReportRowMapper ledgerReportRowMapper; @Autowired private DemandNotGeneratedRowMapper demandNotGeneratedRowMapper; @@ -683,7 +685,7 @@ public List getConsumersByPreviousMeterReading(Long return consumersDemandNotGeneratedList; } - public List getLedgerReport(String consumercode, String tenantId, Integer limit, Integer offset, LocalDate startDate, LocalDate endDate) { + public List> getLedgerReport(String consumercode, String tenantId, Integer limit, Integer offset, LocalDate startDate, LocalDate endDate) { StringBuilder query = new StringBuilder(wsQueryBuilder.LEDGER_REPORT_QUERY); List preparedStatement = new ArrayList<>(); @@ -709,9 +711,10 @@ public List getLedgerReport(String consumercode, String tenantId, } log.info("Query of ledger report:" + query + "and prepared statement" + preparedStatement); - LedgerReportRowMapper ledgerReportRowMapper = new LedgerReportRowMapper(); +// LedgerReportRowMapper ledgerReportRowMapper = new LedgerReportRowMapper(); // ledgerReportRowMapper.setStartDate(startDate); // ledgerReportRowMapper.setEndDate(endDate); - return jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); + List> ledgerReportList= jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); + return ledgerReportList; } } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 6ff8fa266..f65d6a0bc 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -24,7 +24,7 @@ @Slf4j @Component -public class LedgerReportRowMapper implements ResultSetExtractor> { +public class LedgerReportRowMapper implements ResultSetExtractor>> { @Autowired private ObjectMapper objectMapper; @@ -46,8 +46,8 @@ public class LedgerReportRowMapper implements ResultSetExtractor extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List ledgerReportList = new ArrayList<>(); + public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { + List> monthlyRecordsList = new ArrayList<>(); Map ledgerReports = new HashMap<>(); BigDecimal previousBalanceLeft = BigDecimal.ZERO; BigDecimal arrears = BigDecimal.ZERO; @@ -115,30 +115,38 @@ else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { // ledgerReportList.add(entry.getValue()); // } // } - ledgerReportList.addAll(ledgerReports.values()); - log.info("ledger report list"+ledgerReportList); - if (!ledgerReportList.isEmpty()) { - enrichConnectionHolderDetails(ledgerReportList); + for (Map.Entry entry : ledgerReports.entrySet()) { + Map record = new HashMap<>(); + record.put(entry.getKey(), entry.getValue()); + monthlyRecordsList.add(record); } - return ledgerReportList; + log.info("ledger report list"+monthlyRecordsList); + if (!monthlyRecordsList.isEmpty()) { + enrichConnectionHolderDetails(monthlyRecordsList); + } + return monthlyRecordsList; } - private void enrichConnectionHolderDetails(List ledgerReportList) { + private void enrichConnectionHolderDetails(List> monthlyRecordsList) { Set connectionHolderIds = new HashSet<>(); - for (LedgerReport ledgerReport : ledgerReportList) { + for (Map record : monthlyRecordsList) { + LedgerReport ledgerReport = (LedgerReport) record.values().iterator().next(); connectionHolderIds.add(ledgerReport.getDemand().getUserId()); } UserSearchRequest userSearchRequest = new UserSearchRequest(); userSearchRequest.setUuid(connectionHolderIds); UserDetailResponse userDetailResponse = userService.getUser(userSearchRequest); - enrichConnectionHolderInfo(userDetailResponse, ledgerReportList); + enrichConnectionHolderInfo(userDetailResponse, monthlyRecordsList); } private void enrichConnectionHolderInfo(UserDetailResponse userDetailResponse, - List ledgerReportList) { + List> monthlyRecordsList) { List connectionHolderInfos = userDetailResponse.getUser(); Map userIdToConnectionHolderMap = new HashMap<>(); connectionHolderInfos.forEach(user -> userIdToConnectionHolderMap.put(user.getUuid(), user)); - ledgerReportList.forEach(ledgerReport -> ledgerReport.getDemand().setConsumerName(userIdToConnectionHolderMap.get(ledgerReport.getDemand().getUserId()).getName())); + for (Map record : monthlyRecordsList) { + LedgerReport ledgerReport = (LedgerReport) record.values().iterator().next(); + ledgerReport.getDemand().setConsumerName(userIdToConnectionHolderMap.get(ledgerReport.getDemand().getUserId()).getName()); + } } } 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 a4b75bb4f..7b4ea5072 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 @@ -1,6 +1,7 @@ package org.egov.waterconnection.service; import java.util.List; +import java.util.Map; import javax.validation.Valid; @@ -55,5 +56,5 @@ List collectionReport(String paymentStartDate, String paym WaterConnectionResponse getConsumersWithDemandNotGenerated(String previousMeterReading, String tenantId,RequestInfo requestInfo); - List ledgerReport(String consumercode, String tenantId, Integer offset, Integer limit,String year); + List> ledgerReport(String consumercode, String tenantId, Integer offset, Integer limit, String year); } 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 330b380ae..f81c5ff8f 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 @@ -865,7 +865,7 @@ public WaterConnectionResponse getConsumersWithDemandNotGenerated(String previou } @Override - public List ledgerReport(String consumercode, String tenantId, Integer offset, Integer limit, String year) { + public List> ledgerReport(String consumercode, String tenantId, Integer offset, Integer limit, String year) { String[] years = year.split("-"); if (years.length != 2) { throw new IllegalArgumentException("Invalid fiscal year format"); @@ -884,7 +884,7 @@ public List ledgerReport(String consumercode, String tenantId, Int // String formattedStartDate = startDate.format(formatter); // String formattedEndDate = endDate.format(formatter); - List list = waterDaoImpl.getLedgerReport(consumercode, tenantId, limit, offset, startDate, endDate); + List> list = waterDaoImpl.getLedgerReport(consumercode, tenantId, limit, offset, startDate, endDate); return list; } } \ No newline at end of file diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java index ec38dad65..5feb250cf 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java @@ -1,6 +1,7 @@ package org.egov.waterconnection.web.controller; import java.util.List; +import java.util.Map; import javax.validation.Valid; @@ -246,7 +247,7 @@ public ResponseEntity getConsumersWithDemandNotGenerate @PostMapping("/ledger-report") public ResponseEntity getLedgerReport(@Valid @RequestBody RequestInfoWrapper requestInfoWrapper, @RequestParam String consumercode, @RequestParam String tenantId, @RequestParam Integer offset, @RequestParam Integer limit, @RequestParam String year) { - List list = waterService.ledgerReport(consumercode, tenantId, offset, limit, year); + List> list = waterService.ledgerReport(consumercode, tenantId, offset, limit, year); LedgerReportResponse response = LedgerReportResponse.builder().ledgerReport(list). responseInfo(responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true)). tenantName(tenantId).financialYear(year).build(); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReportResponse.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReportResponse.java index fe59ade95..0d00ce4cd 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReportResponse.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReportResponse.java @@ -5,12 +5,13 @@ import org.egov.common.contract.response.ResponseInfo; import java.util.List; +import java.util.Map; @Builder public class LedgerReportResponse { @JsonProperty("ledgerReport") - private List ledgerReport; + private List> ledgerReport; @JsonProperty("tenantName") private String tenantName; From e83483455e2c82c6b617414f596e782fadd28024 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 19 Jul 2024 13:35:49 +0530 Subject: [PATCH 029/133] ISTE-229 --- .../org/egov/waterconnection/repository/WaterDaoImpl.java | 4 +++- .../repository/builder/WsQueryBuilder.java | 1 + .../egov/waterconnection/service/WaterServiceImpl.java | 8 ++++---- .../org/egov/waterconnection/web/models/LedgerReport.java | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) 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 3aa52dcb8..91dfae71e 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 @@ -685,12 +685,14 @@ public List getConsumersByPreviousMeterReading(Long return consumersDemandNotGeneratedList; } - public List> getLedgerReport(String consumercode, String tenantId, Integer limit, Integer offset, LocalDate startDate, LocalDate endDate) { + public List> getLedgerReport(String consumercode, String tenantId, Integer limit, Integer offset, Long startDateTime, Long endDateTime) { StringBuilder query = new StringBuilder(wsQueryBuilder.LEDGER_REPORT_QUERY); List preparedStatement = new ArrayList<>(); preparedStatement.add(consumercode); preparedStatement.add(tenantId); + preparedStatement.add(startDateTime); + preparedStatement.add(endDateTime); Integer newlimit = wsConfiguration.getDefaultLimit(); Integer newoffset = wsConfiguration.getDefaultOffset(); 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 a6121a2e6..ee0ad7a30 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 @@ -186,6 +186,7 @@ public class WsQueryBuilder { "INNER JOIN egbs_demand_v1 dem ON dem.consumercode = conn.connectionno INNER JOIN " + "egbs_demanddetail_v1 dd ON dd.demandid = dem.id " + "WHERE dem.consumercode = ? AND conn.tenantId = ? AND conn.status = 'Active' AND dem.status = 'ACTIVE' " + + "AND taxperiodfrom>=? AND taxperiodto<=? "+ "ORDER BY startdate"; /** 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 f81c5ff8f..9938c3335 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 @@ -880,11 +880,11 @@ public List> ledgerReport(String consumercode, String tenant LocalDate startDate = LocalDate.of(startYear, 4, 1); LocalDate endDate = LocalDate.of(startYear + 1, 3, 31); -// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); -// String formattedStartDate = startDate.format(formatter); -// String formattedEndDate = endDate.format(formatter); + Long startDateTime = LocalDateTime.of(startDate.getYear(), startDate.getMonth(), startDate.getDayOfMonth(), 0, 0, 0) + .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + Long endDateTime = LocalDateTime.of(endDate,LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); - List> list = waterDaoImpl.getLedgerReport(consumercode, tenantId, limit, offset, startDate, endDate); + List> list = waterDaoImpl.getLedgerReport(consumercode, tenantId, limit, offset, startDateTime, endDateTime); return list; } } \ No newline at end of file diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java index 57d834c2e..6785faeb2 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java @@ -10,8 +10,8 @@ public class LedgerReport { @JsonProperty("demand") - private DemandLedgerReport demand; + private DemandLedgerReport demand=null; @JsonProperty("payment") - private PaymentLedgerReport payment; + private PaymentLedgerReport payment=null; } From 8185a337c58c390f9c014ecfec973f9daac86c24 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 19 Jul 2024 13:38:33 +0530 Subject: [PATCH 030/133] ISTE-229 --- .../org/egov/waterconnection/web/models/LedgerReport.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java index 6785faeb2..501b17bba 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java @@ -10,8 +10,8 @@ public class LedgerReport { @JsonProperty("demand") - private DemandLedgerReport demand=null; + private DemandLedgerReport demand=new DemandLedgerReport(); @JsonProperty("payment") - private PaymentLedgerReport payment=null; + private PaymentLedgerReport payment=new PaymentLedgerReport(); } From 824fdec2d0b4f114a6733a484ed86d95e2241044 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 19 Jul 2024 14:06:11 +0530 Subject: [PATCH 031/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index f65d6a0bc..9a87090b4 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -72,7 +72,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce } else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { ledgerReport.getDemand().setPenalty(taxamount); - BigDecimal amount = ledgerReports.get(monthAndYear).getDemand().getTaxamount() != null ? ledgerReports.get(monthAndYear).getDemand().getTaxamount() : BigDecimal.ZERO; + BigDecimal amount = ledgerReport.getDemand().getTaxamount() != null ? ledgerReports.get(monthAndYear).getDemand().getTaxamount() : BigDecimal.ZERO; ledgerReport.getDemand().setTotalForCurrentMonth(taxamount.add(amount)); ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears())); // ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); From ce54eda99cbc047601d71824cd8ed1abbd711985 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 19 Jul 2024 15:11:58 +0530 Subject: [PATCH 032/133] ISTE-229 --- .../repository/WaterDaoImpl.java | 3 +- .../rowmapper/LedgerReportRowMapper.java | 44 ++++++++++++++++--- .../waterconnection/service/WaterService.java | 2 +- .../service/WaterServiceImpl.java | 4 +- .../web/controller/WaterController.java | 2 +- .../web/models/LedgerReport.java | 2 +- 6 files changed, 45 insertions(+), 12 deletions(-) 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 91dfae71e..f5b6a71a6 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 @@ -685,7 +685,7 @@ public List getConsumersByPreviousMeterReading(Long return consumersDemandNotGeneratedList; } - public List> getLedgerReport(String consumercode, String tenantId, Integer limit, Integer offset, Long startDateTime, Long endDateTime) { + public List> getLedgerReport(String consumercode, String tenantId, Integer limit, Integer offset, Long startDateTime, Long endDateTime,RequestInfoWrapper requestInfoWrapper) { StringBuilder query = new StringBuilder(wsQueryBuilder.LEDGER_REPORT_QUERY); List preparedStatement = new ArrayList<>(); @@ -716,6 +716,7 @@ public List> getLedgerReport(String consumercode, String ten // LedgerReportRowMapper ledgerReportRowMapper = new LedgerReportRowMapper(); // ledgerReportRowMapper.setStartDate(startDate); // ledgerReportRowMapper.setEndDate(endDate); + ledgerReportRowMapper.addPaymentDetails(consumercode,tenantId,requestInfoWrapper); List> ledgerReportList= jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); return ledgerReportList; } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 9a87090b4..3c523ead6 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -2,9 +2,14 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; +import org.egov.waterconnection.repository.ServiceRequestRepository; import org.egov.waterconnection.service.UserService; +import org.egov.waterconnection.util.WaterServicesUtil; +import org.egov.waterconnection.web.models.DemandLedgerReport; import org.egov.waterconnection.web.models.LedgerReport; import org.egov.waterconnection.web.models.OwnerInfo; +import org.egov.waterconnection.web.models.RequestInfoWrapper; +import org.egov.waterconnection.web.models.collection.PaymentResponse; import org.egov.waterconnection.web.models.users.UserDetailResponse; import org.egov.waterconnection.web.models.users.UserSearchRequest; import org.springframework.beans.factory.annotation.Autowired; @@ -32,6 +37,15 @@ public class LedgerReportRowMapper implements ResultSetExtractor> extractData(ResultSet resultSet) throws SQLExce LedgerReport ledgerReport = ledgerReports.getOrDefault(monthAndYear, new LedgerReport()); + if (ledgerReport.getDemand() == null) { + ledgerReport.setDemand(new DemandLedgerReport()); + } + if (code.equals("10102")) { - ledgerReport.getDemand().setArrears(taxamount); + ledgerReport.getDemand().setArrears(taxamount != null ? taxamount : BigDecimal.ZERO); ledgerReport.getDemand().setMonthAndYear(monthAndYear); - arrears = resultSet.getBigDecimal("due").subtract(resultSet.getBigDecimal("paid")); + arrears = (resultSet.getBigDecimal("due") != null ? resultSet.getBigDecimal("due") : BigDecimal.ZERO) + .subtract(resultSet.getBigDecimal("paid") != null ? resultSet.getBigDecimal("paid") : BigDecimal.ZERO); } else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { - ledgerReport.getDemand().setPenalty(taxamount); - BigDecimal amount = ledgerReport.getDemand().getTaxamount() != null ? ledgerReports.get(monthAndYear).getDemand().getTaxamount() : BigDecimal.ZERO; - ledgerReport.getDemand().setTotalForCurrentMonth(taxamount.add(amount)); - ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears())); + ledgerReport.getDemand().setPenalty(taxamount != null ? taxamount : BigDecimal.ZERO); + BigDecimal amount = ledgerReport.getDemand().getTaxamount() != null ? ledgerReport.getDemand().getTaxamount() : BigDecimal.ZERO; + ledgerReport.getDemand().setTotalForCurrentMonth((taxamount != null ? taxamount : BigDecimal.ZERO).add(amount)); + ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears() != null ? ledgerReport.getDemand().getArrears() : BigDecimal.ZERO)); // ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); // previousBalanceLeft = ledgerReport.getBalanceLeft(); } else if (code.equals("10101")) { @@ -97,6 +116,7 @@ else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { // ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); // previousBalanceLeft = ledgerReport.getBalanceLeft(); ledgerReport.getDemand().setCode(code); + String consumerCode=resultSet.getString("connectionno"); } ledgerReport.getDemand().setConnectionNo(resultSet.getString("connectionno")); ledgerReport.getDemand().setOldConnectionNo(resultSet.getString("oldconnectionno")); @@ -149,4 +169,16 @@ private void enrichConnectionHolderInfo(UserDetailResponse userDetailResponse, ledgerReport.getDemand().setConsumerName(userIdToConnectionHolderMap.get(ledgerReport.getDemand().getUserId()).getName()); } } + + public void addPaymentDetails(String consumerCode,String tenantId,RequestInfoWrapper requestInfoWrapper) + { + String service = "WS"; + StringBuilder URL = waterServiceUtil.getcollectionURL(); + URL.append(service).append("/_search").append("?").append("consumerCodes=").append(consumerCode) + .append("&").append("tenantId=").append(tenantId); +// RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(waterConnectionRequest.getRequestInfo()).build(); + Object response = serviceRequestRepository.fetchResult(URL,requestInfoWrapper); + PaymentResponse paymentResponse = mapper.convertValue(response, PaymentResponse.class); +// return paymentResponse.getPayments().get(0).getPaymentDetails().get(0).getReceiptNumber(); + } } 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 7b4ea5072..0ab401e9c 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 @@ -56,5 +56,5 @@ List collectionReport(String paymentStartDate, String paym WaterConnectionResponse getConsumersWithDemandNotGenerated(String previousMeterReading, String tenantId,RequestInfo requestInfo); - List> ledgerReport(String consumercode, String tenantId, Integer offset, Integer limit, String year); + List> ledgerReport(String consumercode, String tenantId, Integer offset, Integer limit, String year,RequestInfoWrapper requestInfoWrapper); } 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 9938c3335..270a4cfcc 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 @@ -865,7 +865,7 @@ public WaterConnectionResponse getConsumersWithDemandNotGenerated(String previou } @Override - public List> ledgerReport(String consumercode, String tenantId, Integer offset, Integer limit, String year) { + public List> ledgerReport(String consumercode, String tenantId, Integer offset, Integer limit, String year,RequestInfoWrapper requestInfoWrapper) { String[] years = year.split("-"); if (years.length != 2) { throw new IllegalArgumentException("Invalid fiscal year format"); @@ -884,7 +884,7 @@ public List> ledgerReport(String consumercode, String tenant .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); Long endDateTime = LocalDateTime.of(endDate,LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); - List> list = waterDaoImpl.getLedgerReport(consumercode, tenantId, limit, offset, startDateTime, endDateTime); + List> list = waterDaoImpl.getLedgerReport(consumercode, tenantId, limit, offset, startDateTime, endDateTime,requestInfoWrapper); return list; } } \ No newline at end of file diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java index 5feb250cf..655cca28d 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java @@ -247,7 +247,7 @@ public ResponseEntity getConsumersWithDemandNotGenerate @PostMapping("/ledger-report") public ResponseEntity getLedgerReport(@Valid @RequestBody RequestInfoWrapper requestInfoWrapper, @RequestParam String consumercode, @RequestParam String tenantId, @RequestParam Integer offset, @RequestParam Integer limit, @RequestParam String year) { - List> list = waterService.ledgerReport(consumercode, tenantId, offset, limit, year); + List> list = waterService.ledgerReport(consumercode, tenantId, offset, limit, year,requestInfoWrapper); LedgerReportResponse response = LedgerReportResponse.builder().ledgerReport(list). responseInfo(responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true)). tenantName(tenantId).financialYear(year).build(); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java index 501b17bba..be7596f12 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java @@ -10,7 +10,7 @@ public class LedgerReport { @JsonProperty("demand") - private DemandLedgerReport demand=new DemandLedgerReport(); + private DemandLedgerReport demand=null; @JsonProperty("payment") private PaymentLedgerReport payment=new PaymentLedgerReport(); From 40d3b97bc012368218b8ee9664a670ff7577134a Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 22 Jul 2024 11:22:40 +0530 Subject: [PATCH 033/133] ISTE-229 --- .../repository/WaterDaoImpl.java | 8 +- .../repository/builder/WsQueryBuilder.java | 4 +- .../rowmapper/LedgerReportRowMapper.java | 74 ++++++++++++++----- .../web/models/DemandLedgerReport.java | 6 +- .../web/models/LedgerReport.java | 4 +- 5 files changed, 67 insertions(+), 29 deletions(-) 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 f5b6a71a6..172bcd231 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 @@ -37,6 +37,7 @@ import org.egov.waterconnection.web.models.WaterConnection; import org.egov.waterconnection.web.models.WaterConnectionRequest; import org.egov.waterconnection.web.models.WaterConnectionResponse; +import org.egov.waterconnection.web.models.collection.Payment; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.jdbc.core.JdbcTemplate; @@ -713,10 +714,11 @@ public List> getLedgerReport(String consumercode, String ten } log.info("Query of ledger report:" + query + "and prepared statement" + preparedStatement); -// LedgerReportRowMapper ledgerReportRowMapper = new LedgerReportRowMapper(); -// ledgerReportRowMapper.setStartDate(startDate); + LedgerReportRowMapper ledgerReportRowMapper = new LedgerReportRowMapper(); + ledgerReportRowMapper.setTenantId(tenantId); // ledgerReportRowMapper.setEndDate(endDate); - ledgerReportRowMapper.addPaymentDetails(consumercode,tenantId,requestInfoWrapper); +// List payments=ledgerReportRowMapper.addPaymentDetails(consumercode,tenantId,requestInfoWrapper); + List> ledgerReportList= jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); return ledgerReportList; } 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 ee0ad7a30..30a4a65f3 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 @@ -178,8 +178,8 @@ public class WsQueryBuilder { "d.tenantid=?) order by connectionno;"; public static final String LEDGER_REPORT_QUERY = "SELECT connectionholder.userid as uuid,conn.connectionno as connectionNo,conn.oldconnectionno," + - "to_timestamp(dem.taxperiodfrom/1000)::date as startdate,to_timestamp(dem.taxperiodto/1000)::date as enddate," + - "to_timestamp(dem.createdtime/1000)::date as demandGenerationDate," + + "dem.taxperiodfrom as startdate,dem.taxperiodto as enddate," + + "dem.createdtime as demandGenerationDate," + "dd.taxheadcode as code,dd.taxamount as taxamount " + "FROM eg_ws_connection conn INNER JOIN eg_ws_connectionholder connectionholder " + "ON connectionholder.connectionid = conn.id " + diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 3c523ead6..f9158aa02 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -5,10 +5,8 @@ import org.egov.waterconnection.repository.ServiceRequestRepository; import org.egov.waterconnection.service.UserService; import org.egov.waterconnection.util.WaterServicesUtil; -import org.egov.waterconnection.web.models.DemandLedgerReport; -import org.egov.waterconnection.web.models.LedgerReport; -import org.egov.waterconnection.web.models.OwnerInfo; -import org.egov.waterconnection.web.models.RequestInfoWrapper; +import org.egov.waterconnection.web.models.*; +import org.egov.waterconnection.web.models.collection.Payment; import org.egov.waterconnection.web.models.collection.PaymentResponse; import org.egov.waterconnection.web.models.users.UserDetailResponse; import org.egov.waterconnection.web.models.users.UserSearchRequest; @@ -20,8 +18,10 @@ import java.math.BigDecimal; import java.sql.ResultSet; import java.sql.SQLException; +import java.time.Instant; import java.time.LocalDate; import java.time.YearMonth; +import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.*; import java.time.temporal.ChronoUnit; @@ -46,13 +46,12 @@ public class LedgerReportRowMapper implements ResultSetExtractor> extractData(ResultSet resultSet) throws SQLExce BigDecimal arrears = BigDecimal.ZERO; while (resultSet.next()) { - LocalDate date = resultSet.getDate("enddate").toLocalDate(); + Long dateLong = resultSet.getLong("enddate"); + LocalDate date = Instant.ofEpochMilli(dateLong).atZone(ZoneId.systemDefault()).toLocalDate(); String monthAndYear = date.format(DateTimeFormatter.ofPattern("MMMMyyyy")); String code = resultSet.getString("code"); BigDecimal taxamount = resultSet.getBigDecimal("taxamount"); - LocalDate demandGenerationDateLocal = resultSet.getDate("demandgenerationdate").toLocalDate(); - String demandGenerationDate = demandGenerationDateLocal.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + Long demandGenerationDateLong= resultSet.getLong("demandgenerationdate"); + LocalDate demandGenerationDateLocal = Instant.ofEpochMilli(demandGenerationDateLong).atZone(ZoneId.systemDefault()).toLocalDate(); +// String demandGenerationDate = demandGenerationDateLocal.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); LedgerReport ledgerReport = ledgerReports.getOrDefault(monthAndYear, new LedgerReport()); @@ -98,11 +99,13 @@ else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { // previousBalanceLeft = ledgerReport.getBalanceLeft(); } else if (code.equals("10101")) { ledgerReport.getDemand().setMonthAndYear(monthAndYear); - ledgerReport.getDemand().setDemandGenerationDate(demandGenerationDate); + ledgerReport.getDemand().setDemandGenerationDate(demandGenerationDateLong); ledgerReport.getDemand().setTaxamount(taxamount); ledgerReport.getDemand().setTotalForCurrentMonth(ledgerReport.getDemand().getTaxamount().add(ledgerReport.getDemand().getPenalty())); - ledgerReport.getDemand().setDueDate(demandGenerationDateLocal.plus(10, ChronoUnit.DAYS).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); - ledgerReport.getDemand().setPenaltyAppliedDate(demandGenerationDateLocal.plus(11, ChronoUnit.DAYS).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + long dueDateMillis = demandGenerationDateLocal.plus(10, ChronoUnit.DAYS).atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); + long penaltyAppliedDateMillis = demandGenerationDateLocal.plus(11, ChronoUnit.DAYS).atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); + ledgerReport.getDemand().setDueDate(dueDateMillis); + ledgerReport.getDemand().setPenaltyAppliedDate(penaltyAppliedDateMillis); // ledgerReport.setCollectionDate(resultSet.getDate("collectiondate") != null ? resultSet.getDate("collectiondate").toLocalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) : null); // ledgerReport.setReceiptNo(resultSet.getString("receiptno")); // ledgerReport.setPaid(resultSet.getBigDecimal("paid")); @@ -116,7 +119,7 @@ else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { // ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); // previousBalanceLeft = ledgerReport.getBalanceLeft(); ledgerReport.getDemand().setCode(code); - String consumerCode=resultSet.getString("connectionno"); +// String consumerCode=resultSet.getString("connectionno"); } ledgerReport.getDemand().setConnectionNo(resultSet.getString("connectionno")); ledgerReport.getDemand().setOldConnectionNo(resultSet.getString("oldconnectionno")); @@ -143,6 +146,7 @@ else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { log.info("ledger report list"+monthlyRecordsList); if (!monthlyRecordsList.isEmpty()) { enrichConnectionHolderDetails(monthlyRecordsList); + addPaymentToLedger(monthlyRecordsList); } return monthlyRecordsList; } @@ -170,15 +174,45 @@ private void enrichConnectionHolderInfo(UserDetailResponse userDetailResponse, } } - public void addPaymentDetails(String consumerCode,String tenantId,RequestInfoWrapper requestInfoWrapper) + public List addPaymentDetails(String consumerCode) { String service = "WS"; StringBuilder URL = waterServiceUtil.getcollectionURL(); URL.append(service).append("/_search").append("?").append("consumerCodes=").append(consumerCode) .append("&").append("tenantId=").append(tenantId); // RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(waterConnectionRequest.getRequestInfo()).build(); - Object response = serviceRequestRepository.fetchResult(URL,requestInfoWrapper); + Object response = serviceRequestRepository.fetchResult(URL,null); PaymentResponse paymentResponse = mapper.convertValue(response, PaymentResponse.class); -// return paymentResponse.getPayments().get(0).getPaymentDetails().get(0).getReceiptNumber(); + return paymentResponse.getPayments(); + } + + private void addPaymentToLedger(List> monthlyRecordList) + { + for(Map record:monthlyRecordList) + { + LedgerReport ledgerReport=(LedgerReport) record.values().iterator().next(); + String consumerCode = ledgerReport.getDemand().getConnectionNo(); + List payments=addPaymentDetails(consumerCode); + + for(Payment payment:payments) + { + Long transactionDateLong = payment.getTransactionDate(); + LocalDate transactionDate = Instant.ofEpochMilli(transactionDateLong).atZone(ZoneId.systemDefault()).toLocalDate(); + String transactionMonthAndYear = transactionDate.format(DateTimeFormatter.ofPattern("MMMMyyyy")); + + if (ledgerReport.getDemand().getMonthAndYear().equals(transactionMonthAndYear)) { + PaymentLedgerReport paymentLedgerReport = new PaymentLedgerReport(); + paymentLedgerReport.setCollectionDate(transactionDate.toString()); + paymentLedgerReport.setReceiptNo(payment.getPaymentDetails().get(0).getReceiptNumber()); + paymentLedgerReport.setPaid(payment.getTotalAmountPaid()); + paymentLedgerReport.setBalanceLeft(ledgerReport.getDemand().getTotal_due_amount().subtract(payment.getTotalAmountPaid())); + + if (ledgerReport.getPayment() == null) { + ledgerReport.setPayment(new ArrayList<>()); + } + ledgerReport.getPayment().add(paymentLedgerReport); + } + } + } } } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java index d19963424..d2cf89ed8 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java @@ -30,7 +30,7 @@ public class DemandLedgerReport { private String monthAndYear; @JsonProperty("demandGenerationDate") - private String demandGenerationDate; + private Long demandGenerationDate; @JsonProperty("code") private String code = null; @@ -51,10 +51,10 @@ public class DemandLedgerReport { private BigDecimal total_due_amount; @JsonProperty("dueDateOfPayment") - private String dueDate; + private Long dueDate; @JsonProperty("penaltyAppliedOnDate") - private String penaltyAppliedDate; + private Long penaltyAppliedDate; public DemandLedgerReport(String monthAndYear) { this.monthAndYear = monthAndYear; diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java index be7596f12..7d1fcb4fd 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java @@ -3,6 +3,8 @@ import com.fasterxml.jackson.annotation.JsonProperty; import lombok.*; +import java.util.List; + @Data @AllArgsConstructor @NoArgsConstructor @@ -13,5 +15,5 @@ public class LedgerReport private DemandLedgerReport demand=null; @JsonProperty("payment") - private PaymentLedgerReport payment=new PaymentLedgerReport(); + private List payment=null; } From 01e54c8783da8119a1233c8c9fe9eb80db77fead Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 22 Jul 2024 12:47:17 +0530 Subject: [PATCH 034/133] ISTE-229 --- .../rowmapper/LedgerReportRowMapper.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index f9158aa02..c8e8fb2e1 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -83,6 +83,10 @@ public List> extractData(ResultSet resultSet) throws SQLExce if (ledgerReport.getDemand() == null) { ledgerReport.setDemand(new DemandLedgerReport()); } + if(ledgerReport.getPayment()==null) + { + ledgerReport.setPayment(new ArrayList<>()); + } if (code.equals("10102")) { ledgerReport.getDemand().setArrears(taxamount != null ? taxamount : BigDecimal.ZERO); @@ -155,7 +159,22 @@ private void enrichConnectionHolderDetails(List> monthlyReco Set connectionHolderIds = new HashSet<>(); for (Map record : monthlyRecordsList) { LedgerReport ledgerReport = (LedgerReport) record.values().iterator().next(); - connectionHolderIds.add(ledgerReport.getDemand().getUserId()); + if (ledgerReport == null) { + log.error("LedgerReport is null for record: {}", record); + continue; + } + + DemandLedgerReport demandLedgerReport = ledgerReport.getDemand(); + if (demandLedgerReport == null) { + log.error("DemandLedgerReport is null for LedgerReport: {}", ledgerReport); + continue; + } + String userId = demandLedgerReport.getUserId(); + if (userId == null) { + log.error("UserId is null for DemandLedgerReport: {}", demandLedgerReport); + continue; + } + connectionHolderIds.add(userId); } UserSearchRequest userSearchRequest = new UserSearchRequest(); userSearchRequest.setUuid(connectionHolderIds); From d8b0c032c60fdffe94297bb7bf200eeac7e3461a Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 22 Jul 2024 13:34:36 +0530 Subject: [PATCH 035/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index c8e8fb2e1..9d5135d8f 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -160,18 +160,18 @@ private void enrichConnectionHolderDetails(List> monthlyReco for (Map record : monthlyRecordsList) { LedgerReport ledgerReport = (LedgerReport) record.values().iterator().next(); if (ledgerReport == null) { - log.error("LedgerReport is null for record: {}", record); + log.info("LedgerReport is null for record: {}", record); continue; } DemandLedgerReport demandLedgerReport = ledgerReport.getDemand(); if (demandLedgerReport == null) { - log.error("DemandLedgerReport is null for LedgerReport: {}", ledgerReport); + log.info("DemandLedgerReport is null for LedgerReport: {}", ledgerReport); continue; } String userId = demandLedgerReport.getUserId(); if (userId == null) { - log.error("UserId is null for DemandLedgerReport: {}", demandLedgerReport); + log.info("UserId is null for DemandLedgerReport: {}", demandLedgerReport); continue; } connectionHolderIds.add(userId); From c9454dec723679caf8710ab4145d8fd7c2b5e8a9 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 22 Jul 2024 13:55:53 +0530 Subject: [PATCH 036/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 1 + .../main/java/org/egov/waterconnection/service/UserService.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 9d5135d8f..0a367cc32 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -178,6 +178,7 @@ private void enrichConnectionHolderDetails(List> monthlyReco } UserSearchRequest userSearchRequest = new UserSearchRequest(); userSearchRequest.setUuid(connectionHolderIds); + log.info("User search request"+userSearchRequest.getUuid().toString()); UserDetailResponse userDetailResponse = userService.getUser(userSearchRequest); enrichConnectionHolderInfo(userDetailResponse, monthlyRecordsList); } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/UserService.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/UserService.java index ec0abab7b..c15f1ea0d 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/UserService.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/UserService.java @@ -234,6 +234,7 @@ else if (uri.toString().contains(configuration.getUserCreateEndPoint())) dobFormat = "dd/MM/yyyy"; try { LinkedHashMap responseMap = (LinkedHashMap) serviceRequestRepository.fetchResult(uri, userRequest); + log.info("line 237 "+responseMap.toString()); if (!CollectionUtils.isEmpty(responseMap)) { parseResponse(responseMap, dobFormat); return mapper.convertValue(responseMap, UserDetailResponse.class); @@ -407,6 +408,7 @@ private void setOwnerFields(OwnerInfo holderInfo, UserDetailResponse userDetailR public UserDetailResponse getUser(UserSearchRequest userSearchRequest) { StringBuilder uri = new StringBuilder(configuration.getUserHost()) .append(configuration.getUserSearchEndpoint()); + log.info("uri is "+uri); UserDetailResponse userDetailResponse = userCall(userSearchRequest, uri); return userDetailResponse; } From cc99548cb69d7d7988528fad4d6dba3b385d5827 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 22 Jul 2024 15:20:05 +0530 Subject: [PATCH 037/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 4 ++-- .../egov/waterconnection/web/models/PaymentLedgerReport.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 0a367cc32..a50b08351 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -178,7 +178,7 @@ private void enrichConnectionHolderDetails(List> monthlyReco } UserSearchRequest userSearchRequest = new UserSearchRequest(); userSearchRequest.setUuid(connectionHolderIds); - log.info("User search request"+userSearchRequest.getUuid().toString()); + log.info("User search request"+userSearchRequest); UserDetailResponse userDetailResponse = userService.getUser(userSearchRequest); enrichConnectionHolderInfo(userDetailResponse, monthlyRecordsList); } @@ -222,7 +222,7 @@ private void addPaymentToLedger(List> monthlyRecordList) if (ledgerReport.getDemand().getMonthAndYear().equals(transactionMonthAndYear)) { PaymentLedgerReport paymentLedgerReport = new PaymentLedgerReport(); - paymentLedgerReport.setCollectionDate(transactionDate.toString()); + paymentLedgerReport.setCollectionDate(transactionDateLong); paymentLedgerReport.setReceiptNo(payment.getPaymentDetails().get(0).getReceiptNumber()); paymentLedgerReport.setPaid(payment.getTotalAmountPaid()); paymentLedgerReport.setBalanceLeft(ledgerReport.getDemand().getTotal_due_amount().subtract(payment.getTotalAmountPaid())); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java index d65890620..e0d53496b 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java @@ -15,7 +15,7 @@ public class PaymentLedgerReport { @JsonProperty("paymentCollectionDate") - private String collectionDate; + private Long collectionDate; @JsonProperty("receiptNo") private String receiptNo; From 611f7bf77ba8cd4fa202c30d85fbf55fbeeea2c8 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 22 Jul 2024 15:23:36 +0530 Subject: [PATCH 038/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index a50b08351..bdfa5a961 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -91,8 +91,8 @@ public List> extractData(ResultSet resultSet) throws SQLExce if (code.equals("10102")) { ledgerReport.getDemand().setArrears(taxamount != null ? taxamount : BigDecimal.ZERO); ledgerReport.getDemand().setMonthAndYear(monthAndYear); - arrears = (resultSet.getBigDecimal("due") != null ? resultSet.getBigDecimal("due") : BigDecimal.ZERO) - .subtract(resultSet.getBigDecimal("paid") != null ? resultSet.getBigDecimal("paid") : BigDecimal.ZERO); +// arrears = (resultSet.getBigDecimal("due") != null ? resultSet.getBigDecimal("due") : BigDecimal.ZERO) +// .subtract(resultSet.getBigDecimal("paid") != null ? resultSet.getBigDecimal("paid") : BigDecimal.ZERO); } else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { ledgerReport.getDemand().setPenalty(taxamount != null ? taxamount : BigDecimal.ZERO); From fbc4af7a0463f7b2f1a8e10bc6a1bc320973770b Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 22 Jul 2024 15:30:58 +0530 Subject: [PATCH 039/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index bdfa5a961..214bd43c0 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -149,7 +149,7 @@ else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { } log.info("ledger report list"+monthlyRecordsList); if (!monthlyRecordsList.isEmpty()) { - enrichConnectionHolderDetails(monthlyRecordsList); +// enrichConnectionHolderDetails(monthlyRecordsList); addPaymentToLedger(monthlyRecordsList); } return monthlyRecordsList; From d1d9a4694ef3a5abdd0780bf9caf42b2386a4542 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 22 Jul 2024 15:47:43 +0530 Subject: [PATCH 040/133] ISTE-229 --- .../rowmapper/LedgerReportRowMapper.java | 34 +++++++++---------- .../web/models/PaymentLedgerReport.java | 2 +- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 214bd43c0..5b1001b2f 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -74,7 +74,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce BigDecimal taxamount = resultSet.getBigDecimal("taxamount"); - Long demandGenerationDateLong= resultSet.getLong("demandgenerationdate"); + Long demandGenerationDateLong = resultSet.getLong("demandgenerationdate"); LocalDate demandGenerationDateLocal = Instant.ofEpochMilli(demandGenerationDateLong).atZone(ZoneId.systemDefault()).toLocalDate(); // String demandGenerationDate = demandGenerationDateLocal.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); @@ -83,8 +83,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce if (ledgerReport.getDemand() == null) { ledgerReport.setDemand(new DemandLedgerReport()); } - if(ledgerReport.getPayment()==null) - { + if (ledgerReport.getPayment() == null) { ledgerReport.setPayment(new ArrayList<>()); } @@ -93,8 +92,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce ledgerReport.getDemand().setMonthAndYear(monthAndYear); // arrears = (resultSet.getBigDecimal("due") != null ? resultSet.getBigDecimal("due") : BigDecimal.ZERO) // .subtract(resultSet.getBigDecimal("paid") != null ? resultSet.getBigDecimal("paid") : BigDecimal.ZERO); - } - else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { + } else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { ledgerReport.getDemand().setPenalty(taxamount != null ? taxamount : BigDecimal.ZERO); BigDecimal amount = ledgerReport.getDemand().getTaxamount() != null ? ledgerReport.getDemand().getTaxamount() : BigDecimal.ZERO; ledgerReport.getDemand().setTotalForCurrentMonth((taxamount != null ? taxamount : BigDecimal.ZERO).add(amount)); @@ -147,7 +145,7 @@ else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { record.put(entry.getKey(), entry.getValue()); monthlyRecordsList.add(record); } - log.info("ledger report list"+monthlyRecordsList); + log.info("ledger report list" + monthlyRecordsList); if (!monthlyRecordsList.isEmpty()) { // enrichConnectionHolderDetails(monthlyRecordsList); addPaymentToLedger(monthlyRecordsList); @@ -178,7 +176,7 @@ private void enrichConnectionHolderDetails(List> monthlyReco } UserSearchRequest userSearchRequest = new UserSearchRequest(); userSearchRequest.setUuid(connectionHolderIds); - log.info("User search request"+userSearchRequest); + log.info("User search request" + userSearchRequest); UserDetailResponse userDetailResponse = userService.getUser(userSearchRequest); enrichConnectionHolderInfo(userDetailResponse, monthlyRecordsList); } @@ -194,28 +192,28 @@ private void enrichConnectionHolderInfo(UserDetailResponse userDetailResponse, } } - public List addPaymentDetails(String consumerCode) - { + public List addPaymentDetails(String consumerCode) { String service = "WS"; StringBuilder URL = waterServiceUtil.getcollectionURL(); URL.append(service).append("/_search").append("?").append("consumerCodes=").append(consumerCode) .append("&").append("tenantId=").append(tenantId); // RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(waterConnectionRequest.getRequestInfo()).build(); - Object response = serviceRequestRepository.fetchResult(URL,null); + Object response = serviceRequestRepository.fetchResult(URL, null); PaymentResponse paymentResponse = mapper.convertValue(response, PaymentResponse.class); return paymentResponse.getPayments(); } - private void addPaymentToLedger(List> monthlyRecordList) - { - for(Map record:monthlyRecordList) - { - LedgerReport ledgerReport=(LedgerReport) record.values().iterator().next(); + private void addPaymentToLedger(List> monthlyRecordList) { + for (Map record : monthlyRecordList) { + LedgerReport ledgerReport = (LedgerReport) record.values().iterator().next(); + if (ledgerReport.getDemand() == null) { + log.info("DemandLedgerReport is null for LedgerReport: {}", ledgerReport); + continue; + } String consumerCode = ledgerReport.getDemand().getConnectionNo(); - List payments=addPaymentDetails(consumerCode); + List payments = addPaymentDetails(consumerCode); - for(Payment payment:payments) - { + for (Payment payment : payments) { Long transactionDateLong = payment.getTransactionDate(); LocalDate transactionDate = Instant.ofEpochMilli(transactionDateLong).atZone(ZoneId.systemDefault()).toLocalDate(); String transactionMonthAndYear = transactionDate.format(DateTimeFormatter.ofPattern("MMMMyyyy")); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java index e0d53496b..62ba31adc 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java @@ -18,7 +18,7 @@ public class PaymentLedgerReport private Long collectionDate; @JsonProperty("receiptNo") - private String receiptNo; + private String receiptNo=null; @JsonProperty("amountPaid") private BigDecimal paid; From 7c5909122dd0c54770721090b073448d637235b8 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 22 Jul 2024 15:49:49 +0530 Subject: [PATCH 041/133] ISTE-229 --- .../java/org/egov/waterconnection/repository/WaterDaoImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 172bcd231..901a4c80b 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 @@ -714,7 +714,7 @@ public List> getLedgerReport(String consumercode, String ten } log.info("Query of ledger report:" + query + "and prepared statement" + preparedStatement); - LedgerReportRowMapper ledgerReportRowMapper = new LedgerReportRowMapper(); +// LedgerReportRowMapper ledgerReportRowMapper = new LedgerReportRowMapper(); ledgerReportRowMapper.setTenantId(tenantId); // ledgerReportRowMapper.setEndDate(endDate); // List payments=ledgerReportRowMapper.addPaymentDetails(consumercode,tenantId,requestInfoWrapper); From bcf8c7b38fbb2962452ddfc30e538ad0e657e0bb Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 22 Jul 2024 16:03:50 +0530 Subject: [PATCH 042/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 5b1001b2f..97361b92e 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -159,18 +159,15 @@ private void enrichConnectionHolderDetails(List> monthlyReco LedgerReport ledgerReport = (LedgerReport) record.values().iterator().next(); if (ledgerReport == null) { log.info("LedgerReport is null for record: {}", record); - continue; } DemandLedgerReport demandLedgerReport = ledgerReport.getDemand(); if (demandLedgerReport == null) { log.info("DemandLedgerReport is null for LedgerReport: {}", ledgerReport); - continue; } String userId = demandLedgerReport.getUserId(); if (userId == null) { log.info("UserId is null for DemandLedgerReport: {}", demandLedgerReport); - continue; } connectionHolderIds.add(userId); } @@ -199,6 +196,7 @@ public List addPaymentDetails(String consumerCode) { .append("&").append("tenantId=").append(tenantId); // RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(waterConnectionRequest.getRequestInfo()).build(); Object response = serviceRequestRepository.fetchResult(URL, null); + log.info(response.toString()); PaymentResponse paymentResponse = mapper.convertValue(response, PaymentResponse.class); return paymentResponse.getPayments(); } @@ -208,7 +206,6 @@ private void addPaymentToLedger(List> monthlyRecordList) { LedgerReport ledgerReport = (LedgerReport) record.values().iterator().next(); if (ledgerReport.getDemand() == null) { log.info("DemandLedgerReport is null for LedgerReport: {}", ledgerReport); - continue; } String consumerCode = ledgerReport.getDemand().getConnectionNo(); List payments = addPaymentDetails(consumerCode); From 82341108cd666029392725438c316d6a3936c4f1 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 22 Jul 2024 16:16:15 +0530 Subject: [PATCH 043/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 97361b92e..e9d0c5956 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -196,8 +196,9 @@ public List addPaymentDetails(String consumerCode) { .append("&").append("tenantId=").append(tenantId); // RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(waterConnectionRequest.getRequestInfo()).build(); Object response = serviceRequestRepository.fetchResult(URL, null); - log.info(response.toString()); + log.info("line 199 response "+response.toString()); PaymentResponse paymentResponse = mapper.convertValue(response, PaymentResponse.class); + log.info("paymnent response"+paymentResponse); return paymentResponse.getPayments(); } @@ -208,6 +209,7 @@ private void addPaymentToLedger(List> monthlyRecordList) { log.info("DemandLedgerReport is null for LedgerReport: {}", ledgerReport); } String consumerCode = ledgerReport.getDemand().getConnectionNo(); + log.info("consumer code is "+consumerCode); List payments = addPaymentDetails(consumerCode); for (Payment payment : payments) { From f7ad73791939c80c6def150efad8186be244c339 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 22 Jul 2024 16:28:20 +0530 Subject: [PATCH 044/133] ISTE-229 --- .../waterconnection/repository/WaterDaoImpl.java | 1 + .../repository/rowmapper/LedgerReportRowMapper.java | 12 ++++++------ .../waterconnection/web/models/LedgerReport.java | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) 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 901a4c80b..598bfd3e9 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 @@ -716,6 +716,7 @@ public List> getLedgerReport(String consumercode, String ten log.info("Query of ledger report:" + query + "and prepared statement" + preparedStatement); // LedgerReportRowMapper ledgerReportRowMapper = new LedgerReportRowMapper(); ledgerReportRowMapper.setTenantId(tenantId); + ledgerReportRowMapper.setRequestInfo(requestInfoWrapper); // ledgerReportRowMapper.setEndDate(endDate); // List payments=ledgerReportRowMapper.addPaymentDetails(consumercode,tenantId,requestInfoWrapper); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index e9d0c5956..ed508fdb9 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -47,16 +47,16 @@ public class LedgerReportRowMapper implements ResultSetExtractor> extractData(ResultSet resultSet) throws SQLException, DataAccessException { @@ -195,7 +195,7 @@ public List addPaymentDetails(String consumerCode) { URL.append(service).append("/_search").append("?").append("consumerCodes=").append(consumerCode) .append("&").append("tenantId=").append(tenantId); // RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(waterConnectionRequest.getRequestInfo()).build(); - Object response = serviceRequestRepository.fetchResult(URL, null); + Object response = serviceRequestRepository.fetchResult(URL, requestInfoWrapper); log.info("line 199 response "+response.toString()); PaymentResponse paymentResponse = mapper.convertValue(response, PaymentResponse.class); log.info("paymnent response"+paymentResponse); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java index 7d1fcb4fd..3dac0232e 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import lombok.*; +import java.util.ArrayList; import java.util.List; @Data @@ -15,5 +16,5 @@ public class LedgerReport private DemandLedgerReport demand=null; @JsonProperty("payment") - private List payment=null; + private List payment=new ArrayList<>(); } From 3bd19e7b1d2544c90a95c386bd681868e57806b8 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 23 Jul 2024 13:17:39 +0530 Subject: [PATCH 045/133] ISTE-229 --- .../waterconnection/repository/WaterDaoImpl.java | 16 ++++++++++++++++ .../repository/builder/WsQueryBuilder.java | 7 +++++++ .../rowmapper/LedgerReportRowMapper.java | 14 +++++++++++++- 3 files changed, 36 insertions(+), 1 deletion(-) 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 598bfd3e9..d2c83a476 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 @@ -720,7 +720,23 @@ public List> getLedgerReport(String consumercode, String ten // ledgerReportRowMapper.setEndDate(endDate); // List payments=ledgerReportRowMapper.addPaymentDetails(consumercode,tenantId,requestInfoWrapper); + StringBuilder taxAmountQuery=new StringBuilder(wsQueryBuilder.TAX_AMOUNT_QUERY); + List taxAmountParams=new ArrayList<>(); + taxAmountParams.add(consumercode); + taxAmountParams.add(startDateTime); + BigDecimal taxAmountResult = jdbcTemplate.queryForObject(taxAmountQuery.toString(), taxAmountParams.toArray(), BigDecimal.class); + + StringBuilder totalAmountPaidQuery = new StringBuilder(wsQueryBuilder.TOTAL_AMOUNT_PAID_QUERY); + List totalAmountPaidParams = new ArrayList<>(); + totalAmountPaidParams.add(consumercode); + totalAmountPaidParams.add(startDateTime); + BigDecimal totalAmountPaidResult = jdbcTemplate.queryForObject(totalAmountPaidQuery.toString(), totalAmountPaidParams.toArray(), BigDecimal.class); + + ledgerReportRowMapper.setTaxAmountResult(taxAmountResult); + ledgerReportRowMapper.setTotalAmountPaidResult(totalAmountPaidResult); + List> ledgerReportList= jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); + return ledgerReportList; } } 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 30a4a65f3..f02ebeb87 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 @@ -188,6 +188,13 @@ public class WsQueryBuilder { "WHERE dem.consumercode = ? AND conn.tenantId = ? AND conn.status = 'Active' AND dem.status = 'ACTIVE' " + "AND taxperiodfrom>=? AND taxperiodto<=? "+ "ORDER BY startdate"; + + public static final String TAX_AMOUNT_QUERY="SELECT SUM(taxamount) FROM egbs_demanddetail_v1 WHERE " + + "demandid IN (SELECT id FROM egbs_demand_v1 WHERE consumercode = ? AND taxperiodfrom < ?);"; + + public static final String TOTAL_AMOUNT_PAID_QUERY="SELECT SUM(totalamountpaid) FROM egcl_payment WHERE " + + "id IN (SELECT paymentid FROM egcl_paymentdetail WHERE billid IN " + + "(SELECT billid FROM egbs_billdetail_v1 WHERE consumercode = ?)) AND createdtime < ?;"; /** * diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index ed508fdb9..466bd498f 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -48,6 +48,8 @@ public class LedgerReportRowMapper implements ResultSetExtractor> extractData(ResultSet resultSet) throws SQLException, DataAccessException { List> monthlyRecordsList = new ArrayList<>(); @@ -112,7 +124,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce // ledgerReport.setReceiptNo(resultSet.getString("receiptno")); // ledgerReport.setPaid(resultSet.getBigDecimal("paid")); if (arrears.equals(BigDecimal.ZERO)) { - ledgerReport.getDemand().setArrears(previousBalanceLeft); + ledgerReport.getDemand().setArrears(taxAmountForArrers.subtract(totalAmountPaidForArrers)); } else { ledgerReport.getDemand().setArrears(arrears); arrears = BigDecimal.ZERO; From 4b6aad35a53bf4328d551a80f582bbffb1a6a93e Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 23 Jul 2024 15:37:02 +0530 Subject: [PATCH 046/133] ISTE-229 --- .../repository/WaterDaoImpl.java | 14 ++-- .../rowmapper/LedgerReportRowMapper.java | 68 +++++++++++++------ .../web/models/PaymentLedgerReport.java | 4 +- 3 files changed, 58 insertions(+), 28 deletions(-) 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 d2c83a476..03d074763 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 @@ -720,11 +720,11 @@ public List> getLedgerReport(String consumercode, String ten // ledgerReportRowMapper.setEndDate(endDate); // List payments=ledgerReportRowMapper.addPaymentDetails(consumercode,tenantId,requestInfoWrapper); - StringBuilder taxAmountQuery=new StringBuilder(wsQueryBuilder.TAX_AMOUNT_QUERY); - List taxAmountParams=new ArrayList<>(); - taxAmountParams.add(consumercode); - taxAmountParams.add(startDateTime); - BigDecimal taxAmountResult = jdbcTemplate.queryForObject(taxAmountQuery.toString(), taxAmountParams.toArray(), BigDecimal.class); +// StringBuilder taxAmountQuery=new StringBuilder(wsQueryBuilder.TAX_AMOUNT_QUERY); +// List taxAmountParams=new ArrayList<>(); +// taxAmountParams.add(consumercode); +// taxAmountParams.add(startDateTime); +// BigDecimal taxAmountResult = jdbcTemplate.queryForObject(taxAmountQuery.toString(), taxAmountParams.toArray(), BigDecimal.class); StringBuilder totalAmountPaidQuery = new StringBuilder(wsQueryBuilder.TOTAL_AMOUNT_PAID_QUERY); List totalAmountPaidParams = new ArrayList<>(); @@ -732,8 +732,8 @@ public List> getLedgerReport(String consumercode, String ten totalAmountPaidParams.add(startDateTime); BigDecimal totalAmountPaidResult = jdbcTemplate.queryForObject(totalAmountPaidQuery.toString(), totalAmountPaidParams.toArray(), BigDecimal.class); - ledgerReportRowMapper.setTaxAmountResult(taxAmountResult); - ledgerReportRowMapper.setTotalAmountPaidResult(totalAmountPaidResult); +// ledgerReportRowMapper.setTaxAmountResult(taxAmountResult); +// ledgerReportRowMapper.setTotalAmountPaidResult(totalAmountPaidResult); List> ledgerReportList= jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 466bd498f..c440715ef 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.egov.waterconnection.repository.ServiceRequestRepository; +import org.egov.waterconnection.repository.builder.WsQueryBuilder; import org.egov.waterconnection.service.UserService; import org.egov.waterconnection.util.WaterServicesUtil; import org.egov.waterconnection.web.models.*; @@ -12,6 +13,7 @@ import org.egov.waterconnection.web.models.users.UserSearchRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.ResultSetExtractor; import org.springframework.stereotype.Component; @@ -46,10 +48,16 @@ public class LedgerReportRowMapper implements ResultSetExtractor> extractData(ResultSet resultSet) throws SQLException, DataAccessException { List> monthlyRecordsList = new ArrayList<>(); Map ledgerReports = new HashMap<>(); BigDecimal previousBalanceLeft = BigDecimal.ZERO; - BigDecimal arrears = BigDecimal.ZERO; +// BigDecimal totalAmountForArrears = taxAmountForArrers != null ? taxAmountForArrers : BigDecimal.ZERO; +// BigDecimal amountPaidForArrears = totalAmountPaidForArrers != null ? totalAmountPaidForArrers : BigDecimal.ZERO; + BigDecimal arrears =BigDecimal.ZERO; while (resultSet.next()) { Long dateLong = resultSet.getLong("enddate"); @@ -115,7 +125,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce ledgerReport.getDemand().setMonthAndYear(monthAndYear); ledgerReport.getDemand().setDemandGenerationDate(demandGenerationDateLong); ledgerReport.getDemand().setTaxamount(taxamount); - ledgerReport.getDemand().setTotalForCurrentMonth(ledgerReport.getDemand().getTaxamount().add(ledgerReport.getDemand().getPenalty())); + ledgerReport.getDemand().setTotalForCurrentMonth(ledgerReport.getDemand().getTaxamount().add(ledgerReport.getDemand().getPenalty()!=null ? ledgerReport.getDemand().getPenalty() : BigDecimal.ZERO)); long dueDateMillis = demandGenerationDateLocal.plus(10, ChronoUnit.DAYS).atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); long penaltyAppliedDateMillis = demandGenerationDateLocal.plus(11, ChronoUnit.DAYS).atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); ledgerReport.getDemand().setDueDate(dueDateMillis); @@ -123,12 +133,16 @@ public List> extractData(ResultSet resultSet) throws SQLExce // ledgerReport.setCollectionDate(resultSet.getDate("collectiondate") != null ? resultSet.getDate("collectiondate").toLocalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) : null); // ledgerReport.setReceiptNo(resultSet.getString("receiptno")); // ledgerReport.setPaid(resultSet.getBigDecimal("paid")); - if (arrears.equals(BigDecimal.ZERO)) { - ledgerReport.getDemand().setArrears(taxAmountForArrers.subtract(totalAmountPaidForArrers)); - } else { - ledgerReport.getDemand().setArrears(arrears); - arrears = BigDecimal.ZERO; - } +// if (arrears.equals(BigDecimal.ZERO)) { +// } else { +// ledgerReport.getDemand().setArrears(arrears); +// arrears = BigDecimal.ZERO; +// } + Long startDate = resultSet.getLong("startdate"); + String connectionno=resultSet.getString("connectionno"); + BigDecimal taxAmountResult = getMonthlyTaxAmount(startDate,connectionno); + BigDecimal totalAmountPaidResult = getMonthlyTotalAmountPaid(startDate,connectionno); + ledgerReport.getDemand().setArrears(taxAmountResult.subtract(totalAmountPaidResult)); ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears())); // ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); // previousBalanceLeft = ledgerReport.getBalanceLeft(); @@ -244,4 +258,20 @@ private void addPaymentToLedger(List> monthlyRecordList) { } } } + + private BigDecimal getMonthlyTaxAmount(Long startDate, String consumerCode) { + StringBuilder taxAmountQuery=new StringBuilder(wsQueryBuilder.TAX_AMOUNT_QUERY); + List taxAmountParams=new ArrayList<>(); + taxAmountParams.add(consumerCode); + taxAmountParams.add(startDate); + return jdbcTemplate.queryForObject(taxAmountQuery.toString(), taxAmountParams.toArray(), BigDecimal.class); + } + + private BigDecimal getMonthlyTotalAmountPaid(Long startDate, String consumerCode) { + StringBuilder totalAmountPaidQuery = new StringBuilder(wsQueryBuilder.TOTAL_AMOUNT_PAID_QUERY); + List totalAmountPaidParams = new ArrayList<>(); + totalAmountPaidParams.add(consumerCode); + totalAmountPaidParams.add(startDate); + return jdbcTemplate.queryForObject(totalAmountPaidQuery.toString(), totalAmountPaidParams.toArray(), BigDecimal.class); + } } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java index 62ba31adc..692bf7672 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/PaymentLedgerReport.java @@ -21,8 +21,8 @@ public class PaymentLedgerReport private String receiptNo=null; @JsonProperty("amountPaid") - private BigDecimal paid; + private BigDecimal paid= BigDecimal.ZERO; @JsonProperty("balanceLeft") - private BigDecimal balanceLeft; + private BigDecimal balanceLeft=BigDecimal.ZERO; } From 22cc939089cd036c37db4e95fad0cfb008bdb850 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 23 Jul 2024 15:42:22 +0530 Subject: [PATCH 047/133] ISTE-229 --- .../waterconnection/repository/WaterDaoImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 03d074763..96178dfe9 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 @@ -725,12 +725,12 @@ public List> getLedgerReport(String consumercode, String ten // taxAmountParams.add(consumercode); // taxAmountParams.add(startDateTime); // BigDecimal taxAmountResult = jdbcTemplate.queryForObject(taxAmountQuery.toString(), taxAmountParams.toArray(), BigDecimal.class); - - StringBuilder totalAmountPaidQuery = new StringBuilder(wsQueryBuilder.TOTAL_AMOUNT_PAID_QUERY); - List totalAmountPaidParams = new ArrayList<>(); - totalAmountPaidParams.add(consumercode); - totalAmountPaidParams.add(startDateTime); - BigDecimal totalAmountPaidResult = jdbcTemplate.queryForObject(totalAmountPaidQuery.toString(), totalAmountPaidParams.toArray(), BigDecimal.class); +// +// StringBuilder totalAmountPaidQuery = new StringBuilder(wsQueryBuilder.TOTAL_AMOUNT_PAID_QUERY); +// List totalAmountPaidParams = new ArrayList<>(); +// totalAmountPaidParams.add(consumercode); +// totalAmountPaidParams.add(startDateTime); +// BigDecimal totalAmountPaidResult = jdbcTemplate.queryForObject(totalAmountPaidQuery.toString(), totalAmountPaidParams.toArray(), BigDecimal.class); // ledgerReportRowMapper.setTaxAmountResult(taxAmountResult); // ledgerReportRowMapper.setTotalAmountPaidResult(totalAmountPaidResult); From b29c34a2ce987a9ec0f38f79749fb129a290b178 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 23 Jul 2024 16:41:33 +0530 Subject: [PATCH 048/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index c440715ef..5933d8eb7 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -264,7 +264,10 @@ private BigDecimal getMonthlyTaxAmount(Long startDate, String consumerCode) { List taxAmountParams=new ArrayList<>(); taxAmountParams.add(consumerCode); taxAmountParams.add(startDate); - return jdbcTemplate.queryForObject(taxAmountQuery.toString(), taxAmountParams.toArray(), BigDecimal.class); + BigDecimal ans= jdbcTemplate.queryForObject(taxAmountQuery.toString(), taxAmountParams.toArray(), BigDecimal.class); + if(ans!=null) + return ans; + return BigDecimal.ZERO; } private BigDecimal getMonthlyTotalAmountPaid(Long startDate, String consumerCode) { @@ -272,6 +275,9 @@ private BigDecimal getMonthlyTotalAmountPaid(Long startDate, String consumerCode List totalAmountPaidParams = new ArrayList<>(); totalAmountPaidParams.add(consumerCode); totalAmountPaidParams.add(startDate); - return jdbcTemplate.queryForObject(totalAmountPaidQuery.toString(), totalAmountPaidParams.toArray(), BigDecimal.class); + BigDecimal ans=jdbcTemplate.queryForObject(totalAmountPaidQuery.toString(), totalAmountPaidParams.toArray(), BigDecimal.class); + if(ans!=null) + return ans; + return BigDecimal.ZERO; } } From 368bc82bb58e59bf7eec7d929e70c0ff6399a2a9 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 23 Jul 2024 17:25:25 +0530 Subject: [PATCH 049/133] ISTE-229 --- .../rowmapper/LedgerReportRowMapper.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 5933d8eb7..0f358b17f 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -144,9 +144,9 @@ public List> extractData(ResultSet resultSet) throws SQLExce BigDecimal totalAmountPaidResult = getMonthlyTotalAmountPaid(startDate,connectionno); ledgerReport.getDemand().setArrears(taxAmountResult.subtract(totalAmountPaidResult)); ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears())); + ledgerReport.getPayment(). // ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); // previousBalanceLeft = ledgerReport.getBalanceLeft(); - ledgerReport.getDemand().setCode(code); // String consumerCode=resultSet.getString("connectionno"); } ledgerReport.getDemand().setConnectionNo(resultSet.getString("connectionno")); @@ -242,19 +242,25 @@ private void addPaymentToLedger(List> monthlyRecordList) { Long transactionDateLong = payment.getTransactionDate(); LocalDate transactionDate = Instant.ofEpochMilli(transactionDateLong).atZone(ZoneId.systemDefault()).toLocalDate(); String transactionMonthAndYear = transactionDate.format(DateTimeFormatter.ofPattern("MMMMyyyy")); - + PaymentLedgerReport paymentLedgerReport = new PaymentLedgerReport(); if (ledgerReport.getDemand().getMonthAndYear().equals(transactionMonthAndYear)) { - PaymentLedgerReport paymentLedgerReport = new PaymentLedgerReport(); paymentLedgerReport.setCollectionDate(transactionDateLong); paymentLedgerReport.setReceiptNo(payment.getPaymentDetails().get(0).getReceiptNumber()); paymentLedgerReport.setPaid(payment.getTotalAmountPaid()); paymentLedgerReport.setBalanceLeft(ledgerReport.getDemand().getTotal_due_amount().subtract(payment.getTotalAmountPaid())); + } + else + { + paymentLedgerReport.setCollectionDate(null); + paymentLedgerReport.setReceiptNo(null); + paymentLedgerReport.setPaid(BigDecimal.ZERO); + paymentLedgerReport.setBalanceLeft(ledgerReport.getDemand().getTotal_due_amount().subtract(payment.getTotalAmountPaid())); + } - if (ledgerReport.getPayment() == null) { - ledgerReport.setPayment(new ArrayList<>()); - } - ledgerReport.getPayment().add(paymentLedgerReport); + if (ledgerReport.getPayment() == null) { + ledgerReport.setPayment(new ArrayList<>()); } + ledgerReport.getPayment().add(paymentLedgerReport); } } } From 6f2069fb9e51559d422fdcfb1224c6c642f50c6c Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 23 Jul 2024 17:25:56 +0530 Subject: [PATCH 050/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 1 - 1 file changed, 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 0f358b17f..e2dffa268 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -144,7 +144,6 @@ public List> extractData(ResultSet resultSet) throws SQLExce BigDecimal totalAmountPaidResult = getMonthlyTotalAmountPaid(startDate,connectionno); ledgerReport.getDemand().setArrears(taxAmountResult.subtract(totalAmountPaidResult)); ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears())); - ledgerReport.getPayment(). // ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); // previousBalanceLeft = ledgerReport.getBalanceLeft(); // String consumerCode=resultSet.getString("connectionno"); From 2eca768bd412a0cc7f21e1e33b1f7856423540de Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 24 Jul 2024 10:58:26 +0530 Subject: [PATCH 051/133] ISTE-229 --- .../rowmapper/LedgerReportRowMapper.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index e2dffa268..6f4b53d45 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -248,13 +248,13 @@ private void addPaymentToLedger(List> monthlyRecordList) { paymentLedgerReport.setPaid(payment.getTotalAmountPaid()); paymentLedgerReport.setBalanceLeft(ledgerReport.getDemand().getTotal_due_amount().subtract(payment.getTotalAmountPaid())); } - else - { - paymentLedgerReport.setCollectionDate(null); - paymentLedgerReport.setReceiptNo(null); - paymentLedgerReport.setPaid(BigDecimal.ZERO); - paymentLedgerReport.setBalanceLeft(ledgerReport.getDemand().getTotal_due_amount().subtract(payment.getTotalAmountPaid())); - } +// else +// { +// paymentLedgerReport.setCollectionDate(null); +// paymentLedgerReport.setReceiptNo(null); +// paymentLedgerReport.setPaid(BigDecimal.ZERO); +// paymentLedgerReport.setBalanceLeft(ledgerReport.getDemand().getTotal_due_amount().subtract(payment.getTotalAmountPaid())); +// } if (ledgerReport.getPayment() == null) { ledgerReport.setPayment(new ArrayList<>()); From 251fd7c08f9193e4fc122d32c6a596a2f091c47a Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 24 Jul 2024 11:50:04 +0530 Subject: [PATCH 052/133] ISTE-229 --- .../rowmapper/LedgerReportRowMapper.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 6f4b53d45..13e868115 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -236,30 +236,36 @@ private void addPaymentToLedger(List> monthlyRecordList) { String consumerCode = ledgerReport.getDemand().getConnectionNo(); log.info("consumer code is "+consumerCode); List payments = addPaymentDetails(consumerCode); - + boolean paymentMatched=false; for (Payment payment : payments) { Long transactionDateLong = payment.getTransactionDate(); LocalDate transactionDate = Instant.ofEpochMilli(transactionDateLong).atZone(ZoneId.systemDefault()).toLocalDate(); String transactionMonthAndYear = transactionDate.format(DateTimeFormatter.ofPattern("MMMMyyyy")); - PaymentLedgerReport paymentLedgerReport = new PaymentLedgerReport(); if (ledgerReport.getDemand().getMonthAndYear().equals(transactionMonthAndYear)) { + PaymentLedgerReport paymentLedgerReport = new PaymentLedgerReport(); paymentLedgerReport.setCollectionDate(transactionDateLong); paymentLedgerReport.setReceiptNo(payment.getPaymentDetails().get(0).getReceiptNumber()); paymentLedgerReport.setPaid(payment.getTotalAmountPaid()); paymentLedgerReport.setBalanceLeft(ledgerReport.getDemand().getTotal_due_amount().subtract(payment.getTotalAmountPaid())); + if (ledgerReport.getPayment() == null) { + ledgerReport.setPayment(new ArrayList<>()); + } + ledgerReport.getPayment().add(paymentLedgerReport); } -// else -// { -// paymentLedgerReport.setCollectionDate(null); -// paymentLedgerReport.setReceiptNo(null); -// paymentLedgerReport.setPaid(BigDecimal.ZERO); -// paymentLedgerReport.setBalanceLeft(ledgerReport.getDemand().getTotal_due_amount().subtract(payment.getTotalAmountPaid())); -// } + paymentMatched=true; + } + if(!paymentMatched) + { + PaymentLedgerReport defaultPaymentLedgerReport = new PaymentLedgerReport(); + defaultPaymentLedgerReport.setCollectionDate(null); + defaultPaymentLedgerReport.setReceiptNo("N/A"); + defaultPaymentLedgerReport.setPaid(BigDecimal.ZERO); + defaultPaymentLedgerReport.setBalanceLeft(ledgerReport.getDemand().getTotal_due_amount()); if (ledgerReport.getPayment() == null) { ledgerReport.setPayment(new ArrayList<>()); } - ledgerReport.getPayment().add(paymentLedgerReport); + ledgerReport.getPayment().add(defaultPaymentLedgerReport); } } } From a6b5533f589eeb22bb1cb2c362850c4165dda461 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 24 Jul 2024 12:40:33 +0530 Subject: [PATCH 053/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 13e868115..d7b48173e 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -251,8 +251,8 @@ private void addPaymentToLedger(List> monthlyRecordList) { ledgerReport.setPayment(new ArrayList<>()); } ledgerReport.getPayment().add(paymentLedgerReport); + paymentMatched=true; } - paymentMatched=true; } if(!paymentMatched) { From 0728cddb89687cdbcada6b47db90af1a7eda6b97 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 24 Jul 2024 14:09:21 +0530 Subject: [PATCH 054/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index d7b48173e..e3445889a 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -109,12 +109,13 @@ public List> extractData(ResultSet resultSet) throws SQLExce ledgerReport.setPayment(new ArrayList<>()); } - if (code.equals("10102")) { - ledgerReport.getDemand().setArrears(taxamount != null ? taxamount : BigDecimal.ZERO); - ledgerReport.getDemand().setMonthAndYear(monthAndYear); +// if (code.equals("10102")) { +// ledgerReport.getDemand().setArrears(taxamount != null ? taxamount : BigDecimal.ZERO); +// ledgerReport.getDemand().setMonthAndYear(monthAndYear); // arrears = (resultSet.getBigDecimal("due") != null ? resultSet.getBigDecimal("due") : BigDecimal.ZERO) // .subtract(resultSet.getBigDecimal("paid") != null ? resultSet.getBigDecimal("paid") : BigDecimal.ZERO); - } else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { +// } else + if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { ledgerReport.getDemand().setPenalty(taxamount != null ? taxamount : BigDecimal.ZERO); BigDecimal amount = ledgerReport.getDemand().getTaxamount() != null ? ledgerReport.getDemand().getTaxamount() : BigDecimal.ZERO; ledgerReport.getDemand().setTotalForCurrentMonth((taxamount != null ? taxamount : BigDecimal.ZERO).add(amount)); From e13a3f0f9ede522eb6a516e25a877726c5c41093 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 24 Jul 2024 15:15:18 +0530 Subject: [PATCH 055/133] ISTE-229 --- .../rowmapper/LedgerReportRowMapper.java | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index e3445889a..085c8e6ed 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -85,7 +85,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce BigDecimal previousBalanceLeft = BigDecimal.ZERO; // BigDecimal totalAmountForArrears = taxAmountForArrers != null ? taxAmountForArrers : BigDecimal.ZERO; // BigDecimal amountPaidForArrears = totalAmountPaidForArrers != null ? totalAmountPaidForArrers : BigDecimal.ZERO; - BigDecimal arrears =BigDecimal.ZERO; + BigDecimal arrears = BigDecimal.ZERO; while (resultSet.next()) { Long dateLong = resultSet.getLong("enddate"); @@ -115,7 +115,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce // arrears = (resultSet.getBigDecimal("due") != null ? resultSet.getBigDecimal("due") : BigDecimal.ZERO) // .subtract(resultSet.getBigDecimal("paid") != null ? resultSet.getBigDecimal("paid") : BigDecimal.ZERO); // } else - if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { + if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { ledgerReport.getDemand().setPenalty(taxamount != null ? taxamount : BigDecimal.ZERO); BigDecimal amount = ledgerReport.getDemand().getTaxamount() != null ? ledgerReport.getDemand().getTaxamount() : BigDecimal.ZERO; ledgerReport.getDemand().setTotalForCurrentMonth((taxamount != null ? taxamount : BigDecimal.ZERO).add(amount)); @@ -126,7 +126,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce ledgerReport.getDemand().setMonthAndYear(monthAndYear); ledgerReport.getDemand().setDemandGenerationDate(demandGenerationDateLong); ledgerReport.getDemand().setTaxamount(taxamount); - ledgerReport.getDemand().setTotalForCurrentMonth(ledgerReport.getDemand().getTaxamount().add(ledgerReport.getDemand().getPenalty()!=null ? ledgerReport.getDemand().getPenalty() : BigDecimal.ZERO)); + ledgerReport.getDemand().setTotalForCurrentMonth(ledgerReport.getDemand().getTaxamount().add(ledgerReport.getDemand().getPenalty() != null ? ledgerReport.getDemand().getPenalty() : BigDecimal.ZERO)); long dueDateMillis = demandGenerationDateLocal.plus(10, ChronoUnit.DAYS).atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); long penaltyAppliedDateMillis = demandGenerationDateLocal.plus(11, ChronoUnit.DAYS).atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); ledgerReport.getDemand().setDueDate(dueDateMillis); @@ -140,9 +140,9 @@ public List> extractData(ResultSet resultSet) throws SQLExce // arrears = BigDecimal.ZERO; // } Long startDate = resultSet.getLong("startdate"); - String connectionno=resultSet.getString("connectionno"); - BigDecimal taxAmountResult = getMonthlyTaxAmount(startDate,connectionno); - BigDecimal totalAmountPaidResult = getMonthlyTotalAmountPaid(startDate,connectionno); + String connectionno = resultSet.getString("connectionno"); + BigDecimal taxAmountResult = getMonthlyTaxAmount(startDate, connectionno); + BigDecimal totalAmountPaidResult = getMonthlyTotalAmountPaid(startDate, connectionno); ledgerReport.getDemand().setArrears(taxAmountResult.subtract(totalAmountPaidResult)); ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears())); // ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); @@ -168,7 +168,9 @@ public List> extractData(ResultSet resultSet) throws SQLExce // } for (Map.Entry entry : ledgerReports.entrySet()) { Map record = new HashMap<>(); - record.put(entry.getKey(), entry.getValue()); + if (entry.getValue().getDemand().getCode().equals("10101")) { + record.put(entry.getKey(), entry.getValue()); + } monthlyRecordsList.add(record); } log.info("ledger report list" + monthlyRecordsList); @@ -222,9 +224,9 @@ public List addPaymentDetails(String consumerCode) { .append("&").append("tenantId=").append(tenantId); // RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(waterConnectionRequest.getRequestInfo()).build(); Object response = serviceRequestRepository.fetchResult(URL, requestInfoWrapper); - log.info("line 199 response "+response.toString()); + log.info("line 199 response " + response.toString()); PaymentResponse paymentResponse = mapper.convertValue(response, PaymentResponse.class); - log.info("paymnent response"+paymentResponse); + log.info("paymnent response" + paymentResponse); return paymentResponse.getPayments(); } @@ -235,9 +237,9 @@ private void addPaymentToLedger(List> monthlyRecordList) { log.info("DemandLedgerReport is null for LedgerReport: {}", ledgerReport); } String consumerCode = ledgerReport.getDemand().getConnectionNo(); - log.info("consumer code is "+consumerCode); + log.info("consumer code is " + consumerCode); List payments = addPaymentDetails(consumerCode); - boolean paymentMatched=false; + boolean paymentMatched = false; for (Payment payment : payments) { Long transactionDateLong = payment.getTransactionDate(); LocalDate transactionDate = Instant.ofEpochMilli(transactionDateLong).atZone(ZoneId.systemDefault()).toLocalDate(); @@ -252,11 +254,10 @@ private void addPaymentToLedger(List> monthlyRecordList) { ledgerReport.setPayment(new ArrayList<>()); } ledgerReport.getPayment().add(paymentLedgerReport); - paymentMatched=true; + paymentMatched = true; } } - if(!paymentMatched) - { + if (!paymentMatched) { PaymentLedgerReport defaultPaymentLedgerReport = new PaymentLedgerReport(); defaultPaymentLedgerReport.setCollectionDate(null); defaultPaymentLedgerReport.setReceiptNo("N/A"); @@ -272,12 +273,12 @@ private void addPaymentToLedger(List> monthlyRecordList) { } private BigDecimal getMonthlyTaxAmount(Long startDate, String consumerCode) { - StringBuilder taxAmountQuery=new StringBuilder(wsQueryBuilder.TAX_AMOUNT_QUERY); - List taxAmountParams=new ArrayList<>(); + StringBuilder taxAmountQuery = new StringBuilder(wsQueryBuilder.TAX_AMOUNT_QUERY); + List taxAmountParams = new ArrayList<>(); taxAmountParams.add(consumerCode); taxAmountParams.add(startDate); - BigDecimal ans= jdbcTemplate.queryForObject(taxAmountQuery.toString(), taxAmountParams.toArray(), BigDecimal.class); - if(ans!=null) + BigDecimal ans = jdbcTemplate.queryForObject(taxAmountQuery.toString(), taxAmountParams.toArray(), BigDecimal.class); + if (ans != null) return ans; return BigDecimal.ZERO; } @@ -287,8 +288,8 @@ private BigDecimal getMonthlyTotalAmountPaid(Long startDate, String consumerCode List totalAmountPaidParams = new ArrayList<>(); totalAmountPaidParams.add(consumerCode); totalAmountPaidParams.add(startDate); - BigDecimal ans=jdbcTemplate.queryForObject(totalAmountPaidQuery.toString(), totalAmountPaidParams.toArray(), BigDecimal.class); - if(ans!=null) + BigDecimal ans = jdbcTemplate.queryForObject(totalAmountPaidQuery.toString(), totalAmountPaidParams.toArray(), BigDecimal.class); + if (ans != null) return ans; return BigDecimal.ZERO; } From b01e0612a84ce80790815e42fae1a049ba2b2a0e Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 24 Jul 2024 15:15:56 +0530 Subject: [PATCH 056/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 085c8e6ed..581860f02 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -109,13 +109,12 @@ public List> extractData(ResultSet resultSet) throws SQLExce ledgerReport.setPayment(new ArrayList<>()); } -// if (code.equals("10102")) { -// ledgerReport.getDemand().setArrears(taxamount != null ? taxamount : BigDecimal.ZERO); -// ledgerReport.getDemand().setMonthAndYear(monthAndYear); -// arrears = (resultSet.getBigDecimal("due") != null ? resultSet.getBigDecimal("due") : BigDecimal.ZERO) -// .subtract(resultSet.getBigDecimal("paid") != null ? resultSet.getBigDecimal("paid") : BigDecimal.ZERO); -// } else - if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { + if (code.equals("10102")) { + ledgerReport.getDemand().setArrears(taxamount != null ? taxamount : BigDecimal.ZERO); + ledgerReport.getDemand().setMonthAndYear(monthAndYear); + arrears = (resultSet.getBigDecimal("due") != null ? resultSet.getBigDecimal("due") : BigDecimal.ZERO) + .subtract(resultSet.getBigDecimal("paid") != null ? resultSet.getBigDecimal("paid") : BigDecimal.ZERO); + } else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { ledgerReport.getDemand().setPenalty(taxamount != null ? taxamount : BigDecimal.ZERO); BigDecimal amount = ledgerReport.getDemand().getTaxamount() != null ? ledgerReport.getDemand().getTaxamount() : BigDecimal.ZERO; ledgerReport.getDemand().setTotalForCurrentMonth((taxamount != null ? taxamount : BigDecimal.ZERO).add(amount)); From 1feb67489235e8c161731b95d7bef8d0f3e4d8bb Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 24 Jul 2024 15:45:32 +0530 Subject: [PATCH 057/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 581860f02..b0a36d164 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -112,8 +112,8 @@ public List> extractData(ResultSet resultSet) throws SQLExce if (code.equals("10102")) { ledgerReport.getDemand().setArrears(taxamount != null ? taxamount : BigDecimal.ZERO); ledgerReport.getDemand().setMonthAndYear(monthAndYear); - arrears = (resultSet.getBigDecimal("due") != null ? resultSet.getBigDecimal("due") : BigDecimal.ZERO) - .subtract(resultSet.getBigDecimal("paid") != null ? resultSet.getBigDecimal("paid") : BigDecimal.ZERO); +// arrears = (resultSet.getBigDecimal("due") != null ? resultSet.getBigDecimal("due") : BigDecimal.ZERO) +// .subtract(resultSet.getBigDecimal("paid") != null ? resultSet.getBigDecimal("paid") : BigDecimal.ZERO); } else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { ledgerReport.getDemand().setPenalty(taxamount != null ? taxamount : BigDecimal.ZERO); BigDecimal amount = ledgerReport.getDemand().getTaxamount() != null ? ledgerReport.getDemand().getTaxamount() : BigDecimal.ZERO; From 3a8a234473af3e6eadb9c2d4c1a72302e1d8eaf6 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 24 Jul 2024 16:31:49 +0530 Subject: [PATCH 058/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index b0a36d164..d8f438cff 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -167,7 +167,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce // } for (Map.Entry entry : ledgerReports.entrySet()) { Map record = new HashMap<>(); - if (entry.getValue().getDemand().getCode().equals("10101")) { + if (entry.getValue().getDemand().getTaxamount()!=null) { record.put(entry.getKey(), entry.getValue()); } monthlyRecordsList.add(record); From 3d3d2bfdfe5b9a816090e427ff706aebd082552f Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Thu, 25 Jul 2024 11:50:48 +0530 Subject: [PATCH 059/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index d8f438cff..fa4aaec07 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -169,8 +169,8 @@ public List> extractData(ResultSet resultSet) throws SQLExce Map record = new HashMap<>(); if (entry.getValue().getDemand().getTaxamount()!=null) { record.put(entry.getKey(), entry.getValue()); + monthlyRecordsList.add(record); } - monthlyRecordsList.add(record); } log.info("ledger report list" + monthlyRecordsList); if (!monthlyRecordsList.isEmpty()) { @@ -223,9 +223,9 @@ public List addPaymentDetails(String consumerCode) { .append("&").append("tenantId=").append(tenantId); // RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(waterConnectionRequest.getRequestInfo()).build(); Object response = serviceRequestRepository.fetchResult(URL, requestInfoWrapper); - log.info("line 199 response " + response.toString()); + log.info("line 226 response " + response.toString()); PaymentResponse paymentResponse = mapper.convertValue(response, PaymentResponse.class); - log.info("paymnent response" + paymentResponse); + log.info("paymnent response" + paymentResponse.toString()); return paymentResponse.getPayments(); } From 7dd84a3e368dbfad2e24daece8006f87d7694f28 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Thu, 25 Jul 2024 13:26:07 +0530 Subject: [PATCH 060/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index fa4aaec07..42cf75213 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -177,6 +177,19 @@ public List> extractData(ResultSet resultSet) throws SQLExce // enrichConnectionHolderDetails(monthlyRecordsList); addPaymentToLedger(monthlyRecordsList); } + monthlyRecordsList.sort(new Comparator>() { + @Override + public int compare(Map o1, Map o2) { + String monthAndYear1 = (String) o1.keySet().iterator().next(); + String monthAndYear2 = (String) o2.keySet().iterator().next(); + + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMMyyyy", Locale.ENGLISH); + YearMonth yearMonth1 = YearMonth.parse(monthAndYear1, formatter); + YearMonth yearMonth2 = YearMonth.parse(monthAndYear2, formatter); + + return yearMonth1.compareTo(yearMonth2); + } + }); return monthlyRecordsList; } From 1d3fe03976d6cd8e3222a78e540a81007c26980a Mon Sep 17 00:00:00 2001 From: palak-egov Date: Fri, 26 Jul 2024 13:08:50 +0530 Subject: [PATCH 061/133] ISTE-274 --- .../egov/hrms/EgovEmployeeApplication.java | 33 +++ .../egov/hrms/config/PropertiesManager.java | 35 +++ .../repository/ElasticSearchRepository.java | 85 ++++++++ .../hrms/repository/EmployeeQueryBuilder.java | 2 +- .../hrms/repository/EmployeeRepository.java | 2 +- .../repository/FuzzySearchQueryBuilder.java | 201 ++++++++++++++++++ .../egov/hrms/service/EmployeeService.java | 9 + .../egov/hrms/service/FuzzySearchService.java | 104 +++++++++ .../org/egov/hrms/utils/HRMSConstants.java | 7 + .../web/contract/EmployeeSearchCriteria.java | 6 +- .../src/main/resources/application.properties | 33 ++- 11 files changed, 506 insertions(+), 11 deletions(-) create mode 100644 business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java create mode 100644 business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java create mode 100644 business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java 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 df126f012..aca1d4b2f 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 @@ -55,6 +55,10 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import javax.net.ssl.*; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + @SpringBootApplication @ComponentScan(basePackages = { "org.egov.hrms", "org.egov.hrms.web.controllers" , "org.egov.hrms.config"}) @Import(TracerConfiguration.class) @@ -76,7 +80,36 @@ public ObjectMapper getObjectMapper() { return objectMapper; } + public static void trustSelfSignedSSL() { + try { + SSLContext ctx = SSLContext.getInstance("TLS"); + X509TrustManager tm = new X509TrustManager() { + public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException { + } + + public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException { + } + + public X509Certificate[] getAcceptedIssuers() { + return null; + } + }; + ctx.init(null, new TrustManager[]{tm}, null); + SSLContext.setDefault(ctx); + + // Disable hostname verification + HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { + public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) { + return true; + } + }); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + public static void main(String[] args) { + trustSelfSignedSSL(); 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 e9adc7abb..99ad9107a 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 @@ -125,4 +125,39 @@ public class PropertiesManager { @Value("${egov.hrms.max.pagination.limit}") public Integer hrmsMaxLimit; + + // FuzzyConfigs + @Value("${hrms.search.pagination.default.limit}") + public Long defaultLimit; + + @Value("${hrms.search.pagination.default.offset}") + public Long defaultOffset; + + @Value("${hrms.search.pagination.max.search.limit}") + public Long searchLimit; + + @Value("${hrms.search.pagination.max.search.limit}") + private Long maxSearchLimit; + + @Value("${hrms.fuzzy.search.is.wildcard}") + private Boolean isSearchWildcardBased; + + @Value("${hrms.search.name.fuziness}") + private String nameFuziness; + + // es configs + @Value("${elasticsearch.host}") + private String esHost; + + @Value("${hrms.es.index}") + private String esPTIndex; + + @Value("${elasticsearch.search.endpoint}") + private String esSearchEndpoint; + + @Value("${egov.es.username}") + private String userName; + + @Value("${egov.es.password}") + private String password; } \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java new file mode 100644 index 000000000..34f7e82f4 --- /dev/null +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java @@ -0,0 +1,85 @@ +package org.egov.hrms.repository; + +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.egov.hrms.config.PropertiesManager; +import org.egov.hrms.web.contract.EmployeeSearchCriteria; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Repository; +import org.springframework.web.client.RestTemplate; + +import java.util.Base64; +import java.util.List; + +@Slf4j +@Repository +public class ElasticSearchRepository { + private PropertiesManager config; + + private FuzzySearchQueryBuilder queryBuilder; + + private RestTemplate restTemplate; + + private ObjectMapper mapper; + + @Autowired + public ElasticSearchRepository(PropertiesManager config, FuzzySearchQueryBuilder queryBuilder, RestTemplate restTemplate, ObjectMapper mapper) { + this.config = config; + this.queryBuilder = queryBuilder; + this.restTemplate = restTemplate; + this.mapper = mapper; + } + + public Object fuzzySearchEmployees(EmployeeSearchCriteria criteria, List uuids) { + + + String url = getESURL(); + + String searchQuery = queryBuilder.getFuzzySearchQuery(criteria, uuids); + + HttpHeaders headers = new HttpHeaders(); + headers.add("Authorization", getESEncodedCredentials()); + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + log.info("Headers: " + headers.toString()); +// headers.setContentType(MediaType.APPLICATION_JSON); + HttpEntity requestEntity = new HttpEntity<>(searchQuery, headers); + ResponseEntity response = null; + try { + response = restTemplate.postForEntity(url, requestEntity, Object.class); + + } catch (Exception e) { + e.printStackTrace(); + throw new CustomException("ES_ERROR","Failed to fetch data from ES"); + } + + return response.getBody(); + + } + + + /** + * Generates elasticsearch search url from application properties + * + * @return + */ + private String getESURL() { + + StringBuilder builder = new StringBuilder(config.getEsHost()); + builder.append(config.getEsPTIndex()); + builder.append(config.getEsSearchEndpoint()); + + return builder.toString(); + } + + public String getESEncodedCredentials() { + String credentials = config.getUserName() + ":" + config.getPassword(); + byte[] credentialsBytes = credentials.getBytes(); + byte[] base64CredentialsBytes = Base64.getEncoder().encode(credentialsBytes); + return "Basic " + new String(base64CredentialsBytes); + } +} 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 8812b302b..61f55da39 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 @@ -105,7 +105,7 @@ public String paginationClause(EmployeeSearchCriteria criteria, StringBuilder bu pagination = pagination.replace("$offset", "0"); if(null != criteria.getLimit()){ - Integer limit = criteria.getLimit() + criteria.getOffset(); + Long limit = criteria.getLimit() + criteria.getOffset(); pagination = pagination.replace("$limit", limit.toString()); } else 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 6062a0733..d0c8c10a0 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 @@ -70,7 +70,7 @@ public List fetchEmployees(EmployeeSearchCriteria criteria, RequestInf return employees; } - private List fetchEmployeesforAssignment(EmployeeSearchCriteria criteria, RequestInfo requestInfo) { + public List fetchEmployeesforAssignment(EmployeeSearchCriteria criteria, RequestInfo requestInfo) { List employeesIds = new ArrayList<>(); List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getAssignmentSearchQuery(criteria, preparedStmtList); diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java new file mode 100644 index 000000000..36416b399 --- /dev/null +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java @@ -0,0 +1,201 @@ +package org.egov.hrms.repository; + +import com.fasterxml.jackson.core.JsonProcessingException; +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 lombok.extern.slf4j.Slf4j; +import org.egov.hrms.config.PropertiesManager; +import org.egov.hrms.web.contract.EmployeeSearchCriteria; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; +import org.springframework.util.CollectionUtils; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; + +@Repository +@Slf4j +public class FuzzySearchQueryBuilder { + private ObjectMapper mapper; + + private PropertiesManager config; + + @Autowired + public FuzzySearchQueryBuilder(ObjectMapper mapper, PropertiesManager config) { + this.mapper = mapper; + this.config = config; + } + + private static final String BASE_QUERY = "{\n" + + " \"from\": {{OFFSET}},\n" + + " \"size\": {{LIMIT}},\n" + + " \"sort\": {\n" + + " \"_score\": {\n" + + " \"order\": \"desc\"\n" + + " }\n" + + " },\n" + + " \"query\": {\n" + + " }\n" + + "}"; + + private static final String fuzzyQueryTemplate = "{\n" + + " \"match\": {\n" + + " \"{{VAR}}\": {\n" + + " \"query\": \"{{PARAM}}\",\n" + + " \"fuzziness\": \"{{FUZZINESS}}\"\n" + + " }\n" + + " }\n" + + " }"; + + private static final String wildCardQueryTemplate = "{\n" + + " \"query_string\": {\n" + + " \"default_field\": \"{{VAR}}\",\n" + + " \"query\": \"*{{PARAM}}*\"\n" + + " }\n" + + " }"; + + private static final String filterTemplate = "\"filter\": { " + + " }"; + + public String getFuzzySearchQuery(EmployeeSearchCriteria criteria, List ids) { + String finalQuery; + + try { + // Generate base query with pagination + String baseQuery = addPagination(criteria); + JsonNode node = mapper.readTree(baseQuery); + ObjectNode rootNode = (ObjectNode) node; + ObjectNode insideMatch = (ObjectNode) rootNode.get("query"); + + // Ensure the "bool" node is present + ObjectNode boolNode = (ObjectNode) insideMatch.get("bool"); + if (boolNode == null) { + boolNode = mapper.createObjectNode(); + insideMatch.set("bool", boolNode); + } + + // Initialize the "must" array if it's not present + ArrayNode mustArray = (ArrayNode) boolNode.get("must"); + if (mustArray == null) { + mustArray = mapper.createArrayNode(); + boolNode.set("must", mustArray); + } + + // Add fuzzy search clause for name if present in criteria + if (criteria.getName() != null) { + mustArray.add(getInnerNode(criteria.getName(), "Data.user.name", config.getNameFuziness())); + } + + // Add filter by IDs if the list is not empty + if (!CollectionUtils.isEmpty(ids)) { + ObjectNode idsFilterNode = mapper.createObjectNode(); + idsFilterNode.set("terms", mapper.convertValue(new HashMap>() {{ + put("Data.id.keyword", ids); + }}, JsonNode.class)); + boolNode.set("filter", idsFilterNode); + } + + // Add filter for tenantId + if (criteria.getTenantId() != null) { + ObjectNode tenantFilterNode = mapper.createObjectNode(); + if (criteria.getTenantIds()!=null) { + // Handle tenantId as a list + JsonNode tenantIdNode = mapper.convertValue(new HashMap>() {{ + put("Data.tenantId", (List) criteria.getTenantIds()); + }}, JsonNode.class); + tenantFilterNode.set("terms", tenantIdNode); + } else { + // Handle tenantId as a single value + JsonNode tenantIdNode = mapper.convertValue(new HashMap() {{ + put("Data.tenantId", criteria.getTenantId()); + }}, JsonNode.class); + tenantFilterNode.set("term", tenantIdNode); + } + boolNode.set("filter", tenantFilterNode); + } + + // Add filter for roles + if (criteria.getRoles()!=null) { + ArrayNode roleFilterArray = mapper.createArrayNode(); + for (String role : criteria.getRoles()) { + ObjectNode roleMatchNode = mapper.createObjectNode(); + roleMatchNode.set("match", mapper.convertValue(new HashMap() {{ + put("Data.user.roles.code", role); + }}, JsonNode.class)); + roleFilterArray.add(roleMatchNode); + } + ObjectNode roleBoolNode = mapper.createObjectNode(); + roleBoolNode.set("bool", mapper.convertValue(new HashMap() {{ + put("should", roleFilterArray); + }}, JsonNode.class)); + mustArray.add(roleBoolNode); + } + + // Convert the final JSON node back to a string + finalQuery = mapper.writeValueAsString(node); + } catch (Exception e) { + log.error("ES_ERROR", e); + throw new CustomException("JSONNODE_ERROR", "Failed to build JSON query for fuzzy search"); + } + + log.info("finalQuery {}",finalQuery); + return finalQuery; + } + + private JsonNode getInnerNode(String param, String var, String fuziness) throws JsonProcessingException { + + String template; + if(config.getIsSearchWildcardBased()) + template = wildCardQueryTemplate; + else + template = fuzzyQueryTemplate; + String innerQuery = template.replace("{{PARAM}}",getEscapedString(param)); + innerQuery = innerQuery.replace("{{VAR}}",var); + + if(!config.getIsSearchWildcardBased()) + innerQuery = innerQuery.replace("{{FUZZINESS}}", fuziness); + + JsonNode innerNode = mapper.readTree(innerQuery); + return innerNode; + } + + private String addPagination(EmployeeSearchCriteria criteria) { + + Long limit = config.getDefaultLimit(); + Long offset = config.getDefaultOffset(); + + if (criteria.getLimit() != null && criteria.getLimit() <= config.getMaxSearchLimit()) + limit = criteria.getLimit(); + + if (criteria.getLimit() != null && criteria.getLimit() > config.getMaxSearchLimit()) + limit = config.getMaxSearchLimit(); + + if (criteria.getOffset() != null) + offset = criteria.getOffset(); + + String baseQuery = BASE_QUERY.replace("{{OFFSET}}", offset.toString()); + baseQuery = baseQuery.replace("{{LIMIT}}", limit.toString()); + + return baseQuery; + } + + /** + * Escapes special characters in given string + * @param inputString + * @return + */ + private String getEscapedString(String inputString){ + final String[] metaCharacters = {"\\","/","^","$","{","}","[","]","(",")",".","*","+","?","|","<",">","-","&","%"}; + for (int i = 0 ; i < metaCharacters.length ; i++) { + if (inputString.contains(metaCharacters[i])) { + inputString = inputString.replace(metaCharacters[i], "\\\\" + metaCharacters[i]); + } + } + return inputString; + } +} 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 b8d5bbb0d..f105cc7c7 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 @@ -104,6 +104,9 @@ public class EmployeeService { @Autowired private ObjectMapper objectMapper; + @Autowired + private FuzzySearchService fuzzySearchService; + /** * Service method for create employee. Does following: * 1. Sets ids to all the objects using idgen service. @@ -138,11 +141,17 @@ public EmployeeResponse create(EmployeeRequest employeeRequest) { * @return */ public EmployeeResponse search(EmployeeSearchCriteria criteria, RequestInfo requestInfo) { + boolean userChecked = false; /*if(null == criteria.getIsActive() || criteria.getIsActive()) criteria.setIsActive(true); else criteria.setIsActive(false);*/ + if(criteria.getName()!=null){ + List fuzzyEmployees = fuzzySearchService.getEmployees(requestInfo, criteria); + return EmployeeResponse.builder().responseInfo(factory.createResponseInfoFromRequestInfo(requestInfo, true)) + .employees(fuzzyEmployees).build(); + } Map mapOfUsers = new HashMap(); if(!StringUtils.isEmpty(criteria.getPhone()) || !CollectionUtils.isEmpty(criteria.getRoles())) { Map userSearchCriteria = new HashMap<>(); diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java new file mode 100644 index 000000000..7c833f829 --- /dev/null +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java @@ -0,0 +1,104 @@ +package org.egov.hrms.service; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.jayway.jsonpath.JsonPath; +import org.egov.common.contract.request.RequestInfo; +import org.egov.hrms.config.PropertiesManager; +import org.egov.hrms.model.Employee; +import org.egov.hrms.repository.ElasticSearchRepository; +import org.egov.hrms.repository.EmployeeRepository; +import org.egov.hrms.web.contract.EmployeeSearchCriteria; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.*; + +import static org.egov.hrms.utils.HRMSConstants.ES_DATA_PATH; + +@Service +public class FuzzySearchService { + @Autowired + private ElasticSearchRepository elasticSearchRepository; + @Autowired + private ObjectMapper mapper; + @Autowired + private EmployeeRepository employeeRepository; + @Autowired + private PropertiesManager config; + + public List getEmployees(RequestInfo requestInfo, EmployeeSearchCriteria criteria) { + + if(criteria.getTenantId() == null) + { criteria.setTenantId(config.getStateLevelTenantId()); } + + List idsFromDB = employeeRepository.fetchEmployeesforAssignment(criteria,requestInfo); + +// if(CollectionUtils.isEmpty(idsFromDB)) +// return new LinkedList<>(); + + validateFuzzySearchCriteria(criteria); + + Object esResponse = elasticSearchRepository.fuzzySearchEmployees(criteria, idsFromDB); + + Map> tenantIdToPropertyId = getTenantIdToPropertyIdMap(esResponse); + + List employees = new LinkedList<>(); + + for (Map.Entry> entry : tenantIdToPropertyId.entrySet()) { + String tenantId = entry.getKey(); + Set propertyIds = entry.getValue(); + +// EmployeeSearchCriteria employeeSearchCriteria = EmployeeSearchCriteria.builder().tenantId(tenantId).propertyIds(propertyIds).build(); + + employees.addAll(employeeRepository.fetchEmployees(criteria,requestInfo)); + + } + +// List orderedProperties = orderByESScore(properties, esResponse); + + return employees; + } + private void validateFuzzySearchCriteria(EmployeeSearchCriteria criteria){ + + if(criteria.getName() == null) + throw new CustomException("INVALID_SEARCH_CRITERIA","The search criteria is invalid"); + + } + private Map> getTenantIdToPropertyIdMap(Object esResponse) { + + List> data; + Map> tenantIdToPropertyIds = new LinkedHashMap<>(); + + + try { + data = JsonPath.read(esResponse, ES_DATA_PATH); + + + if (!CollectionUtils.isEmpty(data)) { + + for (Map map : data) { + + String tenantId = JsonPath.read(map, "$.tenantData.code"); + String propertyId = JsonPath.read(map, "$.propertyId"); + + if (tenantIdToPropertyIds.containsKey(tenantId)) + tenantIdToPropertyIds.get(tenantId).add(propertyId); + else { + Set propertyIds = new HashSet<>(); + propertyIds.add(propertyId); + tenantIdToPropertyIds.put(tenantId, propertyIds); + } + + } + + } + + } catch (Exception e) { + throw new CustomException("PARSING_ERROR", "Failed to extract propertyIds from es response"); + } + + return tenantIdToPropertyIds; + } +} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java index 645f6f288..994ee578d 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java @@ -53,4 +53,11 @@ public class HRMSConstants { public static final String HRMS_USER_SERACH_CRITERIA_USERTYPE = "EMPLOYEE"; public static final String HRMS_USER_SERACH_CRITERIA_USERTYPE_CODE = "userType"; + // Fuzzy Search + public static final String ES_DATA_PATH = "$..Data"; + + public static final String ES_DATA_TENANTID_PATH = "$.tenantData.code"; + + public static final String ES_DATA_PROPERTYID_PATH = "$.propertyId"; + } 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 eed0dd147..61915301c 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 @@ -56,9 +56,11 @@ public class EmployeeSearchCriteria { public String phone; - public Integer offset; + public Long offset; - public Integer limit; + public Long limit; + + private String name; public boolean isCriteriaEmpty(EmployeeSearchCriteria criteria) { diff --git a/business-services/egov-hrms/src/main/resources/application.properties b/business-services/egov-hrms/src/main/resources/application.properties index 71a102711..00e297d63 100644 --- a/business-services/egov-hrms/src/main/resources/application.properties +++ b/business-services/egov-hrms/src/main/resources/application.properties @@ -1,18 +1,18 @@ #---------------------------- DATABASE CONFIGURATIONS -----------------------------# spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/egov_hrms +spring.datasource.url=jdbc:postgresql://localhost:5432/demo spring.datasource.username=postgres -spring.datasource.password=postgres +spring.datasource.password=123 #----------------------------- FLYWAY CONFIGURATIONS ------------------------------# -spring.flyway.url=jdbc:postgresql://localhost:5432/egov_hrms +spring.flyway.url=jdbc:postgresql://localhost:5432/demo spring.flyway.user=postgres -spring.flyway.password=postgres -#spring.flyway.table=hr_employee_schema_version +spring.flyway.password=123 +spring.flyway.table=hr_employee_schema_version spring.flyway.baseline-on-migrate=true spring.flyway.outOfOrder=true spring.flyway.locations=classpath:/db/migration/main,db/migration/seed -spring.flyway.enabled=true +spring.flyway.enabled=false #--------------------------- PATH & PORT CONFIGURATIONS ---------------------------# server.contextPath=/egov-hrms @@ -73,10 +73,29 @@ egov.hrms.default.pwd.length=8 open.search.enabled.roles=SUPERUSER egov.pwd.allowed.special.characters=@#$% +#FuzzySearch +hrms.search.pagination.default.limit=50 +hrms.search.pagination.default.offset=0 +hrms.search.pagination.max.search.limit=5000 +hrms.fuzzy.search.is.wildcard=true +hrms.search.name.fuziness=2 + +#Elastic serach Properties +elasticsearch.host=http://localhost:9200/ +elasticsearch.search.endpoint=/_search +egov.es.username=elastic +egov.es.password=EQYBhZhfrXeOA5IIqiHHCSlN +hrms.es.index=hrmsindex + #------------------------------ KAFKA CONFIGURATIONS ------------------------------# # KAFKA SERVER CONFIGURATIONS -spring.kafka.bootstrap.servers=localhost:9092 +#spring.kafka.bootstrap.servers=localhost:9092 spring.kafka.consumer.properties.spring.json.use.type.headers=false +kafka.enabled=false +spring.kafka.bootstrap.servers=none +spring.kafka.consumer.enable-auto-commit=false +spring.kafka.producer.enabled=false +spring.profiles.active=local # SPRING KAFKA CONSUMER CONFIGURATIONS spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer From 63542a5f22430fdd0ef9127c1ef727001bc1c02a Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Fri, 26 Jul 2024 14:07:10 +0530 Subject: [PATCH 062/133] ISTE-237 - FIX --- .../css/src/pages/employee/index.scss | 41 +++++++++++++++++ .../react-components/src/atoms/TopBar.js | 44 +++++++++++++++++-- 2 files changed, 82 insertions(+), 3 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss index e10cd0479..759978759 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss @@ -350,6 +350,47 @@ } } +.dropdown-user .dropbtn{ + color: white; + font-size: 1rem; + margin: 10px; + background-color: #efefef00; +} +.dropdown-user { + position: relative; /* Make the dropdown relative to its container */ + display: inline-block; +} + +.dropdown-user-overlay { + position: absolute; /* Position the overlay absolutely relative to the dropdown */ + top: 100%; /* Position the overlay below the button */ + left: 0; /* Align the overlay to the left of the button */ + background-color: #f1f1f1; /* Set background color */ + min-width: 160px; /* Set minimum width */ + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); /* Add shadow */ + z-index: 1; /* Set z-index to display on top of other elements */ + display: none; /* Hide by default */ +} + +.dropdown-user-content { + padding: 0; /* Remove default padding from ul */ + list-style: none; /* Remove default list style */ +} + +.dropdown-user-content li { + border-bottom: solid 1px !important; + border-color: black !important; + padding: 12px 12px; /* Add padding to list items */ +} +.dropdown-user-link { + text-decoration: none !important; /* Remove underline from links inside list items */ +} + +.dropdown-user:hover .dropdown-user-overlay { + display: block; /* Show overlay on hover */ +} + + .RightMostTopBarOptions { @apply flex; .EventNotificationWrapper { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js index e92ae2e43..0abdaeeee 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js @@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react"; import PropTypes from "prop-types"; import Hamburger from "./Hamburger"; import { NotificationBell } from "./svgindex"; -import { useLocation } from "react-router-dom"; +import { useLocation, Link } from "react-router-dom"; import BackButton from "./BackButton"; const TopBar = ({ @@ -20,6 +20,11 @@ const TopBar = ({ hideNotificationIconOnSomeUrlsWhenNotLoggedIn, changeLanguage, }) => { + const [isOpen, setIsOpen] = useState(false); + + const handleClick = () => { + setIsOpen(!isOpen); + }; const { pathname } = useLocation(); // const showHaburgerorBackButton = () => { @@ -37,7 +42,7 @@ const TopBar = ({ const paymentlogoUrl = isPaymentPath ? window?.globalConfigs?.getConfig?.("LOGO_URL") // Show payment logo if path matches : logoUrl; - console.log(isPaymentPath,"isPaymentPath"); + console.log(isPaymentPath, "isPaymentPath"); return (
@@ -57,7 +62,36 @@ const TopBar = ({
- {!hideNotificationIconOnSomeUrlsWhenNotLoggedIn || isPaymentPath ? changeLanguage : null} + +
+ + {isOpen && ( +
+
    +
  • + Admin Login +
  • +
  • + Employee Login +
  • +
+
+ )} +
+ + {!hideNotificationIconOnSomeUrlsWhenNotLoggedIn || isPaymentPath ? changeLanguage : null} + {/* {!hideNotificationIconOnSomeUrlsWhenNotLoggedIn ? (
{notificationCountLoaded && notificationCount ? ( @@ -68,6 +102,10 @@ const TopBar = ({
) : null} */} +
+ +
+
From b54476494df940c2248db8b1bf9f47282df0bbd1 Mon Sep 17 00:00:00 2001 From: Palak Garg <86659286+palak-egov@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:39:03 +0530 Subject: [PATCH 063/133] ISTE-274 (#863) --- .../egov/hrms/EgovEmployeeApplication.java | 33 +++ .../egov/hrms/config/PropertiesManager.java | 35 +++ .../repository/ElasticSearchRepository.java | 85 ++++++++ .../hrms/repository/EmployeeQueryBuilder.java | 2 +- .../hrms/repository/EmployeeRepository.java | 2 +- .../repository/FuzzySearchQueryBuilder.java | 201 ++++++++++++++++++ .../egov/hrms/service/EmployeeService.java | 9 + .../egov/hrms/service/FuzzySearchService.java | 104 +++++++++ .../org/egov/hrms/utils/HRMSConstants.java | 7 + .../web/contract/EmployeeSearchCriteria.java | 6 +- .../src/main/resources/application.properties | 33 ++- 11 files changed, 506 insertions(+), 11 deletions(-) create mode 100644 business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java create mode 100644 business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java create mode 100644 business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java 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 df126f012..aca1d4b2f 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 @@ -55,6 +55,10 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import javax.net.ssl.*; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + @SpringBootApplication @ComponentScan(basePackages = { "org.egov.hrms", "org.egov.hrms.web.controllers" , "org.egov.hrms.config"}) @Import(TracerConfiguration.class) @@ -76,7 +80,36 @@ public ObjectMapper getObjectMapper() { return objectMapper; } + public static void trustSelfSignedSSL() { + try { + SSLContext ctx = SSLContext.getInstance("TLS"); + X509TrustManager tm = new X509TrustManager() { + public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException { + } + + public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException { + } + + public X509Certificate[] getAcceptedIssuers() { + return null; + } + }; + ctx.init(null, new TrustManager[]{tm}, null); + SSLContext.setDefault(ctx); + + // Disable hostname verification + HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { + public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) { + return true; + } + }); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + public static void main(String[] args) { + trustSelfSignedSSL(); 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 e9adc7abb..99ad9107a 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 @@ -125,4 +125,39 @@ public class PropertiesManager { @Value("${egov.hrms.max.pagination.limit}") public Integer hrmsMaxLimit; + + // FuzzyConfigs + @Value("${hrms.search.pagination.default.limit}") + public Long defaultLimit; + + @Value("${hrms.search.pagination.default.offset}") + public Long defaultOffset; + + @Value("${hrms.search.pagination.max.search.limit}") + public Long searchLimit; + + @Value("${hrms.search.pagination.max.search.limit}") + private Long maxSearchLimit; + + @Value("${hrms.fuzzy.search.is.wildcard}") + private Boolean isSearchWildcardBased; + + @Value("${hrms.search.name.fuziness}") + private String nameFuziness; + + // es configs + @Value("${elasticsearch.host}") + private String esHost; + + @Value("${hrms.es.index}") + private String esPTIndex; + + @Value("${elasticsearch.search.endpoint}") + private String esSearchEndpoint; + + @Value("${egov.es.username}") + private String userName; + + @Value("${egov.es.password}") + private String password; } \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java new file mode 100644 index 000000000..34f7e82f4 --- /dev/null +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java @@ -0,0 +1,85 @@ +package org.egov.hrms.repository; + +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.egov.hrms.config.PropertiesManager; +import org.egov.hrms.web.contract.EmployeeSearchCriteria; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Repository; +import org.springframework.web.client.RestTemplate; + +import java.util.Base64; +import java.util.List; + +@Slf4j +@Repository +public class ElasticSearchRepository { + private PropertiesManager config; + + private FuzzySearchQueryBuilder queryBuilder; + + private RestTemplate restTemplate; + + private ObjectMapper mapper; + + @Autowired + public ElasticSearchRepository(PropertiesManager config, FuzzySearchQueryBuilder queryBuilder, RestTemplate restTemplate, ObjectMapper mapper) { + this.config = config; + this.queryBuilder = queryBuilder; + this.restTemplate = restTemplate; + this.mapper = mapper; + } + + public Object fuzzySearchEmployees(EmployeeSearchCriteria criteria, List uuids) { + + + String url = getESURL(); + + String searchQuery = queryBuilder.getFuzzySearchQuery(criteria, uuids); + + HttpHeaders headers = new HttpHeaders(); + headers.add("Authorization", getESEncodedCredentials()); + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + log.info("Headers: " + headers.toString()); +// headers.setContentType(MediaType.APPLICATION_JSON); + HttpEntity requestEntity = new HttpEntity<>(searchQuery, headers); + ResponseEntity response = null; + try { + response = restTemplate.postForEntity(url, requestEntity, Object.class); + + } catch (Exception e) { + e.printStackTrace(); + throw new CustomException("ES_ERROR","Failed to fetch data from ES"); + } + + return response.getBody(); + + } + + + /** + * Generates elasticsearch search url from application properties + * + * @return + */ + private String getESURL() { + + StringBuilder builder = new StringBuilder(config.getEsHost()); + builder.append(config.getEsPTIndex()); + builder.append(config.getEsSearchEndpoint()); + + return builder.toString(); + } + + public String getESEncodedCredentials() { + String credentials = config.getUserName() + ":" + config.getPassword(); + byte[] credentialsBytes = credentials.getBytes(); + byte[] base64CredentialsBytes = Base64.getEncoder().encode(credentialsBytes); + return "Basic " + new String(base64CredentialsBytes); + } +} 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 8812b302b..61f55da39 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 @@ -105,7 +105,7 @@ public String paginationClause(EmployeeSearchCriteria criteria, StringBuilder bu pagination = pagination.replace("$offset", "0"); if(null != criteria.getLimit()){ - Integer limit = criteria.getLimit() + criteria.getOffset(); + Long limit = criteria.getLimit() + criteria.getOffset(); pagination = pagination.replace("$limit", limit.toString()); } else 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 6062a0733..d0c8c10a0 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 @@ -70,7 +70,7 @@ public List fetchEmployees(EmployeeSearchCriteria criteria, RequestInf return employees; } - private List fetchEmployeesforAssignment(EmployeeSearchCriteria criteria, RequestInfo requestInfo) { + public List fetchEmployeesforAssignment(EmployeeSearchCriteria criteria, RequestInfo requestInfo) { List employeesIds = new ArrayList<>(); List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getAssignmentSearchQuery(criteria, preparedStmtList); diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java new file mode 100644 index 000000000..36416b399 --- /dev/null +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java @@ -0,0 +1,201 @@ +package org.egov.hrms.repository; + +import com.fasterxml.jackson.core.JsonProcessingException; +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 lombok.extern.slf4j.Slf4j; +import org.egov.hrms.config.PropertiesManager; +import org.egov.hrms.web.contract.EmployeeSearchCriteria; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; +import org.springframework.util.CollectionUtils; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; + +@Repository +@Slf4j +public class FuzzySearchQueryBuilder { + private ObjectMapper mapper; + + private PropertiesManager config; + + @Autowired + public FuzzySearchQueryBuilder(ObjectMapper mapper, PropertiesManager config) { + this.mapper = mapper; + this.config = config; + } + + private static final String BASE_QUERY = "{\n" + + " \"from\": {{OFFSET}},\n" + + " \"size\": {{LIMIT}},\n" + + " \"sort\": {\n" + + " \"_score\": {\n" + + " \"order\": \"desc\"\n" + + " }\n" + + " },\n" + + " \"query\": {\n" + + " }\n" + + "}"; + + private static final String fuzzyQueryTemplate = "{\n" + + " \"match\": {\n" + + " \"{{VAR}}\": {\n" + + " \"query\": \"{{PARAM}}\",\n" + + " \"fuzziness\": \"{{FUZZINESS}}\"\n" + + " }\n" + + " }\n" + + " }"; + + private static final String wildCardQueryTemplate = "{\n" + + " \"query_string\": {\n" + + " \"default_field\": \"{{VAR}}\",\n" + + " \"query\": \"*{{PARAM}}*\"\n" + + " }\n" + + " }"; + + private static final String filterTemplate = "\"filter\": { " + + " }"; + + public String getFuzzySearchQuery(EmployeeSearchCriteria criteria, List ids) { + String finalQuery; + + try { + // Generate base query with pagination + String baseQuery = addPagination(criteria); + JsonNode node = mapper.readTree(baseQuery); + ObjectNode rootNode = (ObjectNode) node; + ObjectNode insideMatch = (ObjectNode) rootNode.get("query"); + + // Ensure the "bool" node is present + ObjectNode boolNode = (ObjectNode) insideMatch.get("bool"); + if (boolNode == null) { + boolNode = mapper.createObjectNode(); + insideMatch.set("bool", boolNode); + } + + // Initialize the "must" array if it's not present + ArrayNode mustArray = (ArrayNode) boolNode.get("must"); + if (mustArray == null) { + mustArray = mapper.createArrayNode(); + boolNode.set("must", mustArray); + } + + // Add fuzzy search clause for name if present in criteria + if (criteria.getName() != null) { + mustArray.add(getInnerNode(criteria.getName(), "Data.user.name", config.getNameFuziness())); + } + + // Add filter by IDs if the list is not empty + if (!CollectionUtils.isEmpty(ids)) { + ObjectNode idsFilterNode = mapper.createObjectNode(); + idsFilterNode.set("terms", mapper.convertValue(new HashMap>() {{ + put("Data.id.keyword", ids); + }}, JsonNode.class)); + boolNode.set("filter", idsFilterNode); + } + + // Add filter for tenantId + if (criteria.getTenantId() != null) { + ObjectNode tenantFilterNode = mapper.createObjectNode(); + if (criteria.getTenantIds()!=null) { + // Handle tenantId as a list + JsonNode tenantIdNode = mapper.convertValue(new HashMap>() {{ + put("Data.tenantId", (List) criteria.getTenantIds()); + }}, JsonNode.class); + tenantFilterNode.set("terms", tenantIdNode); + } else { + // Handle tenantId as a single value + JsonNode tenantIdNode = mapper.convertValue(new HashMap() {{ + put("Data.tenantId", criteria.getTenantId()); + }}, JsonNode.class); + tenantFilterNode.set("term", tenantIdNode); + } + boolNode.set("filter", tenantFilterNode); + } + + // Add filter for roles + if (criteria.getRoles()!=null) { + ArrayNode roleFilterArray = mapper.createArrayNode(); + for (String role : criteria.getRoles()) { + ObjectNode roleMatchNode = mapper.createObjectNode(); + roleMatchNode.set("match", mapper.convertValue(new HashMap() {{ + put("Data.user.roles.code", role); + }}, JsonNode.class)); + roleFilterArray.add(roleMatchNode); + } + ObjectNode roleBoolNode = mapper.createObjectNode(); + roleBoolNode.set("bool", mapper.convertValue(new HashMap() {{ + put("should", roleFilterArray); + }}, JsonNode.class)); + mustArray.add(roleBoolNode); + } + + // Convert the final JSON node back to a string + finalQuery = mapper.writeValueAsString(node); + } catch (Exception e) { + log.error("ES_ERROR", e); + throw new CustomException("JSONNODE_ERROR", "Failed to build JSON query for fuzzy search"); + } + + log.info("finalQuery {}",finalQuery); + return finalQuery; + } + + private JsonNode getInnerNode(String param, String var, String fuziness) throws JsonProcessingException { + + String template; + if(config.getIsSearchWildcardBased()) + template = wildCardQueryTemplate; + else + template = fuzzyQueryTemplate; + String innerQuery = template.replace("{{PARAM}}",getEscapedString(param)); + innerQuery = innerQuery.replace("{{VAR}}",var); + + if(!config.getIsSearchWildcardBased()) + innerQuery = innerQuery.replace("{{FUZZINESS}}", fuziness); + + JsonNode innerNode = mapper.readTree(innerQuery); + return innerNode; + } + + private String addPagination(EmployeeSearchCriteria criteria) { + + Long limit = config.getDefaultLimit(); + Long offset = config.getDefaultOffset(); + + if (criteria.getLimit() != null && criteria.getLimit() <= config.getMaxSearchLimit()) + limit = criteria.getLimit(); + + if (criteria.getLimit() != null && criteria.getLimit() > config.getMaxSearchLimit()) + limit = config.getMaxSearchLimit(); + + if (criteria.getOffset() != null) + offset = criteria.getOffset(); + + String baseQuery = BASE_QUERY.replace("{{OFFSET}}", offset.toString()); + baseQuery = baseQuery.replace("{{LIMIT}}", limit.toString()); + + return baseQuery; + } + + /** + * Escapes special characters in given string + * @param inputString + * @return + */ + private String getEscapedString(String inputString){ + final String[] metaCharacters = {"\\","/","^","$","{","}","[","]","(",")",".","*","+","?","|","<",">","-","&","%"}; + for (int i = 0 ; i < metaCharacters.length ; i++) { + if (inputString.contains(metaCharacters[i])) { + inputString = inputString.replace(metaCharacters[i], "\\\\" + metaCharacters[i]); + } + } + return inputString; + } +} 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 b8d5bbb0d..f105cc7c7 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 @@ -104,6 +104,9 @@ public class EmployeeService { @Autowired private ObjectMapper objectMapper; + @Autowired + private FuzzySearchService fuzzySearchService; + /** * Service method for create employee. Does following: * 1. Sets ids to all the objects using idgen service. @@ -138,11 +141,17 @@ public EmployeeResponse create(EmployeeRequest employeeRequest) { * @return */ public EmployeeResponse search(EmployeeSearchCriteria criteria, RequestInfo requestInfo) { + boolean userChecked = false; /*if(null == criteria.getIsActive() || criteria.getIsActive()) criteria.setIsActive(true); else criteria.setIsActive(false);*/ + if(criteria.getName()!=null){ + List fuzzyEmployees = fuzzySearchService.getEmployees(requestInfo, criteria); + return EmployeeResponse.builder().responseInfo(factory.createResponseInfoFromRequestInfo(requestInfo, true)) + .employees(fuzzyEmployees).build(); + } Map mapOfUsers = new HashMap(); if(!StringUtils.isEmpty(criteria.getPhone()) || !CollectionUtils.isEmpty(criteria.getRoles())) { Map userSearchCriteria = new HashMap<>(); diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java new file mode 100644 index 000000000..7c833f829 --- /dev/null +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java @@ -0,0 +1,104 @@ +package org.egov.hrms.service; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.jayway.jsonpath.JsonPath; +import org.egov.common.contract.request.RequestInfo; +import org.egov.hrms.config.PropertiesManager; +import org.egov.hrms.model.Employee; +import org.egov.hrms.repository.ElasticSearchRepository; +import org.egov.hrms.repository.EmployeeRepository; +import org.egov.hrms.web.contract.EmployeeSearchCriteria; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.*; + +import static org.egov.hrms.utils.HRMSConstants.ES_DATA_PATH; + +@Service +public class FuzzySearchService { + @Autowired + private ElasticSearchRepository elasticSearchRepository; + @Autowired + private ObjectMapper mapper; + @Autowired + private EmployeeRepository employeeRepository; + @Autowired + private PropertiesManager config; + + public List getEmployees(RequestInfo requestInfo, EmployeeSearchCriteria criteria) { + + if(criteria.getTenantId() == null) + { criteria.setTenantId(config.getStateLevelTenantId()); } + + List idsFromDB = employeeRepository.fetchEmployeesforAssignment(criteria,requestInfo); + +// if(CollectionUtils.isEmpty(idsFromDB)) +// return new LinkedList<>(); + + validateFuzzySearchCriteria(criteria); + + Object esResponse = elasticSearchRepository.fuzzySearchEmployees(criteria, idsFromDB); + + Map> tenantIdToPropertyId = getTenantIdToPropertyIdMap(esResponse); + + List employees = new LinkedList<>(); + + for (Map.Entry> entry : tenantIdToPropertyId.entrySet()) { + String tenantId = entry.getKey(); + Set propertyIds = entry.getValue(); + +// EmployeeSearchCriteria employeeSearchCriteria = EmployeeSearchCriteria.builder().tenantId(tenantId).propertyIds(propertyIds).build(); + + employees.addAll(employeeRepository.fetchEmployees(criteria,requestInfo)); + + } + +// List orderedProperties = orderByESScore(properties, esResponse); + + return employees; + } + private void validateFuzzySearchCriteria(EmployeeSearchCriteria criteria){ + + if(criteria.getName() == null) + throw new CustomException("INVALID_SEARCH_CRITERIA","The search criteria is invalid"); + + } + private Map> getTenantIdToPropertyIdMap(Object esResponse) { + + List> data; + Map> tenantIdToPropertyIds = new LinkedHashMap<>(); + + + try { + data = JsonPath.read(esResponse, ES_DATA_PATH); + + + if (!CollectionUtils.isEmpty(data)) { + + for (Map map : data) { + + String tenantId = JsonPath.read(map, "$.tenantData.code"); + String propertyId = JsonPath.read(map, "$.propertyId"); + + if (tenantIdToPropertyIds.containsKey(tenantId)) + tenantIdToPropertyIds.get(tenantId).add(propertyId); + else { + Set propertyIds = new HashSet<>(); + propertyIds.add(propertyId); + tenantIdToPropertyIds.put(tenantId, propertyIds); + } + + } + + } + + } catch (Exception e) { + throw new CustomException("PARSING_ERROR", "Failed to extract propertyIds from es response"); + } + + return tenantIdToPropertyIds; + } +} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java index 645f6f288..994ee578d 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java @@ -53,4 +53,11 @@ public class HRMSConstants { public static final String HRMS_USER_SERACH_CRITERIA_USERTYPE = "EMPLOYEE"; public static final String HRMS_USER_SERACH_CRITERIA_USERTYPE_CODE = "userType"; + // Fuzzy Search + public static final String ES_DATA_PATH = "$..Data"; + + public static final String ES_DATA_TENANTID_PATH = "$.tenantData.code"; + + public static final String ES_DATA_PROPERTYID_PATH = "$.propertyId"; + } 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 eed0dd147..61915301c 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 @@ -56,9 +56,11 @@ public class EmployeeSearchCriteria { public String phone; - public Integer offset; + public Long offset; - public Integer limit; + public Long limit; + + private String name; public boolean isCriteriaEmpty(EmployeeSearchCriteria criteria) { diff --git a/business-services/egov-hrms/src/main/resources/application.properties b/business-services/egov-hrms/src/main/resources/application.properties index 71a102711..00e297d63 100644 --- a/business-services/egov-hrms/src/main/resources/application.properties +++ b/business-services/egov-hrms/src/main/resources/application.properties @@ -1,18 +1,18 @@ #---------------------------- DATABASE CONFIGURATIONS -----------------------------# spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/egov_hrms +spring.datasource.url=jdbc:postgresql://localhost:5432/demo spring.datasource.username=postgres -spring.datasource.password=postgres +spring.datasource.password=123 #----------------------------- FLYWAY CONFIGURATIONS ------------------------------# -spring.flyway.url=jdbc:postgresql://localhost:5432/egov_hrms +spring.flyway.url=jdbc:postgresql://localhost:5432/demo spring.flyway.user=postgres -spring.flyway.password=postgres -#spring.flyway.table=hr_employee_schema_version +spring.flyway.password=123 +spring.flyway.table=hr_employee_schema_version spring.flyway.baseline-on-migrate=true spring.flyway.outOfOrder=true spring.flyway.locations=classpath:/db/migration/main,db/migration/seed -spring.flyway.enabled=true +spring.flyway.enabled=false #--------------------------- PATH & PORT CONFIGURATIONS ---------------------------# server.contextPath=/egov-hrms @@ -73,10 +73,29 @@ egov.hrms.default.pwd.length=8 open.search.enabled.roles=SUPERUSER egov.pwd.allowed.special.characters=@#$% +#FuzzySearch +hrms.search.pagination.default.limit=50 +hrms.search.pagination.default.offset=0 +hrms.search.pagination.max.search.limit=5000 +hrms.fuzzy.search.is.wildcard=true +hrms.search.name.fuziness=2 + +#Elastic serach Properties +elasticsearch.host=http://localhost:9200/ +elasticsearch.search.endpoint=/_search +egov.es.username=elastic +egov.es.password=EQYBhZhfrXeOA5IIqiHHCSlN +hrms.es.index=hrmsindex + #------------------------------ KAFKA CONFIGURATIONS ------------------------------# # KAFKA SERVER CONFIGURATIONS -spring.kafka.bootstrap.servers=localhost:9092 +#spring.kafka.bootstrap.servers=localhost:9092 spring.kafka.consumer.properties.spring.json.use.type.headers=false +kafka.enabled=false +spring.kafka.bootstrap.servers=none +spring.kafka.consumer.enable-auto-commit=false +spring.kafka.producer.enabled=false +spring.profiles.active=local # SPRING KAFKA CONSUMER CONFIGURATIONS spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer From 3efae562daa0cd4e0cfe33a38c58af8e3dcf3d20 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Mon, 29 Jul 2024 13:37:44 +0530 Subject: [PATCH 064/133] ledger changes --- frontend/mgramseva/lib/env/app_config.dart | 4 +- .../lib/model/reports/leadger_report.dart | 159 +++++++++++++ .../household_register_provider.dart | 4 + .../lib/providers/reports_provider.dart | 68 +++++- frontend/mgramseva/lib/routers/routers.dart | 1 + frontend/mgramseva/lib/routing.dart | 5 + .../screeens/leadger_report/leadger_view.dart | 112 +++++++++ .../leadger_report/ledger_report.dart | 221 ++++++++++++++++++ frontend/mgramseva/lib/services/urls.dart | 1 + frontend/mgramseva/lib/utils/constants.dart | 5 + .../utils/constants/i18_key_constants.dart | 1 + 11 files changed, 577 insertions(+), 4 deletions(-) create mode 100644 frontend/mgramseva/lib/model/reports/leadger_report.dart create mode 100644 frontend/mgramseva/lib/screeens/leadger_report/leadger_view.dart create mode 100644 frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart diff --git a/frontend/mgramseva/lib/env/app_config.dart b/frontend/mgramseva/lib/env/app_config.dart index 94253b5b1..e8eef9d25 100644 --- a/frontend/mgramseva/lib/env/app_config.dart +++ b/frontend/mgramseva/lib/env/app_config.dart @@ -27,9 +27,7 @@ dynamic get apiBaseUrl { } Map devConstants = { - _baseUrl: kIsWeb - ? (window.location.origin) + "/" - : const String.fromEnvironment('BASE_URL'), + _baseUrl:"https://mgramseva-uat.psegs.in/" }; Map stageConstants = { diff --git a/frontend/mgramseva/lib/model/reports/leadger_report.dart b/frontend/mgramseva/lib/model/reports/leadger_report.dart new file mode 100644 index 000000000..513000bab --- /dev/null +++ b/frontend/mgramseva/lib/model/reports/leadger_report.dart @@ -0,0 +1,159 @@ +class LedgerReport { + final List ledgerReport; + final String tenantName; + final String financialYear; + final LeadgeResponseInfo responseInfo; + + LedgerReport({ + required this.ledgerReport, + required this.tenantName, + required this.financialYear, + required this.responseInfo, + }); + + factory LedgerReport.fromJson(Map json) { + return LedgerReport( + ledgerReport: (json['ledgerReport'] as List) + .map((e) => LedgerData.fromJson(e)) + .toList(), + tenantName: json['tenantName'], + financialYear: json['financialYear'], + responseInfo: LeadgeResponseInfo.fromJson(json['responseInfo']), + ); + } +} + +class LedgerData { + final Map months; + + LedgerData({required this.months}); + + factory LedgerData.fromJson(Map json) { + final monthData = {}; + json.forEach((key, value) { + monthData[key] = MonthData.fromJson(value); + }); + return LedgerData(months: monthData); + } +} + +class MonthData { + final LeadgerDemand demand; + final List payment; + + MonthData({required this.demand, required this.payment}); + + factory MonthData.fromJson(Map json) { + return MonthData( + demand: LeadgerDemand.fromJson(json['demand']), + payment: (json['payment'] as List) + .map((e) => LeadgerPayment.fromJson(e)) + .toList(), + ); + } +} + +class LeadgerDemand { + final String consumerName; + final String connectionNo; + final String oldConnectionNo; + final String userId; + final String month; + final int demandGenerationDate; + final String code; + final double monthlyCharges; + final double penalty; + final double totalForCurrentMonth; + final double previousMonthBalance; + final double totalDues; + final int dueDateOfPayment; + final int penaltyAppliedOnDate; + + LeadgerDemand({ + required this.consumerName, + required this.connectionNo, + required this.oldConnectionNo, + required this.userId, + required this.month, + required this.demandGenerationDate, + required this.code, + required this.monthlyCharges, + required this.penalty, + required this.totalForCurrentMonth, + required this.previousMonthBalance, + required this.totalDues, + required this.dueDateOfPayment, + required this.penaltyAppliedOnDate, + }); + + factory LeadgerDemand.fromJson(Map json) { + return LeadgerDemand( + consumerName: json['consumerName'], + connectionNo: json['connectionNo'], + oldConnectionNo: json['oldConnectionNo'], + userId: json['userId'], + month: json['month'], + demandGenerationDate: json['demandGenerationDate'], + code: json['code'], + monthlyCharges: json['monthlyCharges'].toDouble(), + penalty: json['penalty'].toDouble(), + totalForCurrentMonth: json['totalForCurrentMonth'].toDouble(), + previousMonthBalance: json['previousMonthBalance'].toDouble(), + totalDues: json['totalDues'].toDouble(), + dueDateOfPayment: json['dueDateOfPayment'], + penaltyAppliedOnDate: json['penaltyAppliedOnDate'], + ); + } +} + +class LeadgerPayment { + final dynamic paymentCollectionDate; + final String receiptNo; + final double amountPaid; + final double balanceLeft; + + LeadgerPayment({ + required this.paymentCollectionDate, + required this.receiptNo, + required this.amountPaid, + required this.balanceLeft, + }); + + factory LeadgerPayment.fromJson(Map json) { + return LeadgerPayment( + paymentCollectionDate: json['paymentCollectionDate'], + receiptNo: json['receiptNo'], + amountPaid: json['amountPaid'].toDouble(), + balanceLeft: json['balanceLeft'].toDouble(), + ); + } +} + +class LeadgeResponseInfo { + final String apiId; + final String ver; + final dynamic ts; + final String resMsgId; + final String msgId; + final String status; + + LeadgeResponseInfo({ + required this.apiId, + required this.ver, + required this.ts, + required this.resMsgId, + required this.msgId, + required this.status, + }); + + factory LeadgeResponseInfo.fromJson(Map json) { + return LeadgeResponseInfo( + apiId: json['apiId'], + ver: json['ver'], + ts: json['ts'], + resMsgId: json['resMsgId'], + msgId: json['msgId'], + status: json['status'], + ); + } +} diff --git a/frontend/mgramseva/lib/providers/household_register_provider.dart b/frontend/mgramseva/lib/providers/household_register_provider.dart index a3a669931..a83653cd1 100644 --- a/frontend/mgramseva/lib/providers/household_register_provider.dart +++ b/frontend/mgramseva/lib/providers/household_register_provider.dart @@ -441,7 +441,11 @@ class HouseholdRegisterProvider with ChangeNotifier { }); } viewLeadger(TableData tableData) { + log("${ waterConnectionsDetails?.waterConnection?.first.connectionNo}"); log("Call Ledger View Here"); + Navigator.pushNamed(navigatorKey.currentContext!, Routes.LEDGER_REPORTS, + arguments: "${waterConnectionsDetails?.waterConnection?.first.connectionNo}"); + diff --git a/frontend/mgramseva/lib/providers/reports_provider.dart b/frontend/mgramseva/lib/providers/reports_provider.dart index fd169ff9e..538a99afc 100644 --- a/frontend/mgramseva/lib/providers/reports_provider.dart +++ b/frontend/mgramseva/lib/providers/reports_provider.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:mgramseva/model/reports/InactiveConsumerReportData.dart'; @@ -263,7 +264,6 @@ class ReportsProvider with ChangeNotifier { void onChangeOfBillYear(val) { selectedBillYear = val; - print(val.toString()); billingyearCtrl.text = val.toString(); billingcycleCtrl.clear(); selectedBillCycle = null; @@ -422,6 +422,72 @@ class ReportsProvider with ChangeNotifier { return >[]; } + Future getLeadgerReport( + {bool download = false, + int offset = 1, + int limit = 10, + }) async { + try { + var commonProvider = Provider.of( + navigatorKey.currentContext!, + listen: false); + + if (selectedBillYear == null) { + throw Exception('${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.SELECT_BILLING_CYCLE)}'); + } + Map params = { + 'tenantId': commonProvider.userDetails!.selectedtenant!.code, + 'offset': '${offset - 1}', + 'limit': '${download ? -1 : limit}', + // 'consumercode':'${}' + 'year':selectedBillYear + }; + var response = await ReportsRepo().fetchBillReport(params); + if (response != null) { + demandreports = response; + if (download) { + generateExcel( + demandHeaderList + .map((e) => + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(e.label)}') + .toList(), + getDemandsData(demandreports!, isExcel: true) + .map>( + (e) => e.tableRow.map((e) => e.label).toList()) + .toList() ?? + [], + title: + 'DemandReport_${commonProvider.userDetails?.selectedtenant?.code?.substring(3)}_${selectedBillPeriod.toString().replaceAll('/', '_')}', + optionalData: [ + 'Demand Report', + '$selectedBillPeriod', + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(commonProvider.userDetails!.selectedtenant!.code!)}', + '${commonProvider.userDetails?.selectedtenant?.code?.substring(3)}', + 'Downloaded On ${DateFormats.timeStampToDate(DateTime.now().millisecondsSinceEpoch, format: 'dd/MMM/yyyy')}' + ]); + } else { + if (demandreports != null && demandreports!.isNotEmpty) { + this.limit = limit; + this.offset = offset; + this.genericTableData = BillsTableData( + demandHeaderList, getDemandsData(demandreports!)); + } + } + streamController.add(response); + callNotifier(); + } else { + streamController.add('error'); + throw Exception('API Error'); + } + callNotifier(); + } catch (e, s) { + demandreports = []; + ErrorHandler().allExceptionsHandler(navigatorKey.currentContext!, e, s); + streamController.addError('error'); + callNotifier(); + } + } + Future getDemandReport( {bool download = false, int offset = 1, diff --git a/frontend/mgramseva/lib/routers/routers.dart b/frontend/mgramseva/lib/routers/routers.dart index 9ef5818d0..c2d1c0c61 100644 --- a/frontend/mgramseva/lib/routers/routers.dart +++ b/frontend/mgramseva/lib/routers/routers.dart @@ -83,6 +83,7 @@ class Routes { static const String NOTIFICATIONS = '/home/notifications'; static const String REPORTS = '/home/reports'; + static const String LEDGER_REPORTS = '/home/leadger/reports'; static const String PRIVACY_POLICY = '/privacy'; static const String TERMS_OF_USE = '/terms'; static const String PRIVACY_POLICY_S = '/privacy/'; diff --git a/frontend/mgramseva/lib/routing.dart b/frontend/mgramseva/lib/routing.dart index 08b7fb3c3..5a0b86652 100644 --- a/frontend/mgramseva/lib/routing.dart +++ b/frontend/mgramseva/lib/routing.dart @@ -24,6 +24,7 @@ import 'package:mgramseva/screeens/notifications/notification_screen.dart'; import 'package:mgramseva/screeens/password_success/password_success.dart'; import 'package:mgramseva/screeens/privacy_and_terms/PrivacyAndTerms.dart'; import 'package:mgramseva/screeens/profile/edit_profile.dart'; +import 'package:mgramseva/screeens/leadger_report/ledger_report.dart'; import 'package:mgramseva/screeens/reports/reports.dart'; import 'package:mgramseva/screeens/reset_password/reset_password.dart'; import 'package:mgramseva/screeens/reset_password/update_password.dart'; @@ -370,6 +371,10 @@ class Routing { return MaterialPageRoute( builder: (_) => Reports(), settings: RouteSettings(name: Routes.REPORTS)); + case Routes.LEDGER_REPORTS: + return MaterialPageRoute( + builder: (_) => LeadgerReport(), + settings: RouteSettings(name: Routes.LEDGER_REPORTS)); case Routes.PRIVACY_POLICY: bool args = settings.arguments==null?false:settings.arguments as bool; return MaterialPageRoute( diff --git a/frontend/mgramseva/lib/screeens/leadger_report/leadger_view.dart b/frontend/mgramseva/lib/screeens/leadger_report/leadger_view.dart new file mode 100644 index 000000000..14aeb652b --- /dev/null +++ b/frontend/mgramseva/lib/screeens/leadger_report/leadger_view.dart @@ -0,0 +1,112 @@ +import 'dart:developer'; + +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../providers/reports_provider.dart'; +import '../../utils/localization/application_localizations.dart'; + +import 'package:mgramseva/utils/constants/i18_key_constants.dart'; + +import '../../utils/notifiers.dart'; +import '../../utils/testing_keys/testing_keys.dart'; +import '../../widgets/button.dart'; + +class LeadgerReportView extends StatefulWidget { + final Function onViewClick; + + LeadgerReportView({Key? key, required this.onViewClick}) : super(key: key); + + @override + State createState() { + return _LeadgerReportView(); + } +} + +class _LeadgerReportView extends State + with SingleTickerProviderStateMixin { + @override + Widget build(BuildContext context) { + return LayoutBuilder(builder: (context, constraints) { + final isWideScreen = constraints.maxWidth > 700; + final containerMargin = isWideScreen + ? const EdgeInsets.only(top: 5.0, bottom: 5, right: 20, left: 10) + : const EdgeInsets.symmetric(vertical: 5.0, horizontal: 8); + return Consumer(builder: (_, reportProvider, child) { + return Container( + margin: containerMargin, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: constraints.maxWidth > 344?constraints.maxWidth / 2.5:constraints.maxWidth / 3, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "1. ", + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w700), + ), + Expanded( + child: Text( + ApplicationLocalizations.of(context) + .translate(i18.dashboard.LEDGER_REPORTS), + maxLines: 3, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w700), + ), + ), + ], + ), + ), + Row( + children: [ + Container( + width: 50, + child: Button( + ApplicationLocalizations.of(context) + .translate(i18.common.VIEW), + () { + if (reportProvider.selectedBillYear == null) { + Notifiers.getToastMessage( + context, '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', 'ERROR'); + } else { + reportProvider.clearTableData(); + reportProvider.getLeadgerReport(); + widget.onViewClick(true, i18.dashboard.BILL_REPORT); + } + }, + key: Keys.billReport.BILL_REPORT_VIEW_BUTTON, + ), + ), + // SizedBox( + // width: 10, + // ), + // TextButton.icon( + // onPressed: () { + // if (reportProvider.selectedBillPeriod == null) { + // Notifiers.getToastMessage( + // context, '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', 'ERROR'); + // } else { + // reportProvider.getDemandReport(download: true); + // } + // }, + // icon: Icon(Icons.download_sharp), + // label: Text(ApplicationLocalizations.of(context) + // .translate(i18.common.CORE_DOWNLOAD))), + ], + ), + ], + ), + ], + ), + ); + }); + }); + } +} diff --git a/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart b/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart new file mode 100644 index 000000000..a5fc0ca5c --- /dev/null +++ b/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart @@ -0,0 +1,221 @@ +import 'package:flutter/material.dart'; +import 'package:mgramseva/screeens/leadger_report/leadger_view.dart'; +import 'package:mgramseva/screeens/reports/expense_bill_report.dart'; +import 'package:mgramseva/screeens/reports/inactive_consumer_report.dart'; +import 'package:mgramseva/screeens/reports/vendor_report.dart'; +import 'package:mgramseva/screeens/reports/view_table.dart'; +import 'package:provider/provider.dart'; + +import '../../providers/reports_provider.dart'; +import '../../utils/global_variables.dart'; +import '../../utils/localization/application_localizations.dart'; +import '../../utils/testing_keys/testing_keys.dart'; +import '../../widgets/custom_app_bar.dart'; +import '../../widgets/drawer_wrapper.dart'; +import 'package:mgramseva/utils/constants/i18_key_constants.dart'; +import '../../widgets/footer.dart'; +import '../../widgets/home_back.dart'; +import '../../widgets/label_text.dart'; +import '../../widgets/select_field_builder.dart'; +import '../../widgets/side_bar.dart'; +import '../reports/bill_report.dart'; +import '../reports/collection_report.dart'; + +class LeadgerReport extends StatefulWidget { + const LeadgerReport({Key? key}) : super(key: key); + + @override + State createState() { + return _LeadgerReport(); + } +} + +class _LeadgerReport extends State with SingleTickerProviderStateMixin { + ScrollController scrollController = ScrollController(); + var takeScreenShot = false; + bool viewTable = false; + String tableTitle = 'Table Data'; + + @override + void dispose() { + var reportsProvider = Provider.of( + navigatorKey.currentContext!, + listen: false); + reportsProvider.clearBillingSelection(); + super.dispose(); + } + + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) => afterViewBuild()); + } + + afterViewBuild() { + var reportsProvider = Provider.of( + navigatorKey.currentContext!, + listen: false); + reportsProvider.getFinancialYearList(); + reportsProvider.clearBillingSelection(); + reportsProvider.clearBuildTableData(); + reportsProvider.clearTableData(); + + } + + showTable(bool status, String title) { + setState(() { + viewTable = status; + tableTitle = title; + }); + } + + backButtonCallback() { + var reportProvider = Provider.of( + navigatorKey.currentContext!, + listen: false); + if (viewTable == true) { + viewTable = false; + reportProvider.clearBuildTableData(); + } else if (viewTable == false) { + reportProvider.clearBuildTableData(); + Navigator.pop(context); + } + } + + @override + Widget build(BuildContext context) { + // TODO: implement build + return Scaffold( + appBar: CustomAppBar(), + drawer: DrawerWrapper( + Drawer(child: SideBar()), + ), + backgroundColor: Color.fromRGBO(238, 238, 238, 1), + body: LayoutBuilder( + builder: (context, constraints) => Container( + alignment: Alignment.center, + margin: constraints.maxWidth < 760 + ? null + : EdgeInsets.symmetric( + horizontal: MediaQuery.of(context).size.width / 25), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + color: Color.fromRGBO(238, 238, 238, 1), + margin: constraints.maxWidth < 760 + ? null + : EdgeInsets.symmetric( + horizontal: MediaQuery.of(context).size.width / 95), + height: constraints.maxHeight, + child: SingleChildScrollView( + controller: scrollController, + child: viewTable + ? Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + HomeBack( + callback: () { + setState(() { + viewTable = false; + }); + }, + ), + ViewTable( + tableTitle: tableTitle, + scrollController: scrollController, + ), + ], + )) + : Column( + children: [ + HomeBack(), + Card( + margin: EdgeInsets.only(bottom: 2), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(0.0), + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + LabelText(i18.dashboard.LEDGER_REPORTS), + ])), + SizedBox( + height: 30, + ), + Card( + margin: EdgeInsets.only(bottom: 2), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + ), + child: Padding( + padding: const EdgeInsets.only( + top: 15, bottom: 20.0), + child: Column( + children: [ + Consumer( + builder: (_, reportProvider, child) => + Container( + child: Column( + children: [ + SelectFieldBuilder( + i18.demandGenerate + .BILLING_YEAR_LABEL, + reportProvider + .selectedBillYear, + '', + '', + reportProvider + .onChangeOfBillYear, + reportProvider + .getFinancialYearListDropdown( + reportProvider + .billingYearList), + true, + readOnly: false, + controller: reportProvider + .billingyearCtrl, + key: Keys.billReport + .BILL_REPORT_BILLING_YEAR, itemAsString: (i) =>"${ApplicationLocalizations.of(context).translate(i.financialYear)}", + ), + ], + ), + )), + ], + ), + ), + ), + SizedBox( + height: 30, + ), + Card( + margin: EdgeInsets.only(top: 15, bottom: 2), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + ), + child: Padding( + padding: const EdgeInsets.only(bottom: 10.0), + child: Column( + children: [ + LeadgerReportView(onViewClick: showTable), + + ], + ), + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: Footer()) + ], + ), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/frontend/mgramseva/lib/services/urls.dart b/frontend/mgramseva/lib/services/urls.dart index 5fbee2fd2..009b296d4 100644 --- a/frontend/mgramseva/lib/services/urls.dart +++ b/frontend/mgramseva/lib/services/urls.dart @@ -91,6 +91,7 @@ class Url { 'adapter-master-data/project/v1/_search'; ///Reports + static const String LEDGER_REPORT = 'ws-services/wc/ledger-report'; static const String BILL_REPORT = 'ws-services/wc/_billReport'; static const String COLLECTION_REPORT = 'ws-services/wc/_collectionReport'; static const String INACTIVE_CONSUMER_REPORT = diff --git a/frontend/mgramseva/lib/utils/constants.dart b/frontend/mgramseva/lib/utils/constants.dart index ee062d867..2e445c3c4 100644 --- a/frontend/mgramseva/lib/utils/constants.dart +++ b/frontend/mgramseva/lib/utils/constants.dart @@ -104,6 +104,11 @@ class Constants { (i18.dashboard.CORE_REPORTS), Icons.assessment, Routes.REPORTS, {}), + HomeItem( + "LEDGER_REPORTS", + (i18.dashboard.LEDGER_REPORTS), + Icons.table_chart_rounded, + Routes.LEDGER_REPORTS, {}), ]; static List SERVICECATEGORY = [ diff --git a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart index 5f6445386..6b0a3780b 100644 --- a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart +++ b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart @@ -715,6 +715,7 @@ class _DashBoard { 'CORE_GPWSC_DETAILS_AND_RATE_INFO'; String get GPWSC_DETAILS => 'GPWSC_DETAILS'; String get CORE_REPORTS => 'CORE_REPORTS'; + String get LEDGER_REPORTS => 'LEDGER_REPORTS'; String get BILL_REPORT => 'BILL_REPORT'; String get COLLECTION_REPORT => 'COLLECTION_REPORT'; String get VENDOR_REPORT => 'VENDOR_REPORT'; From c7f49e575b464a976908928b9fce3b2596e6c7a0 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Mon, 29 Jul 2024 14:06:18 +0530 Subject: [PATCH 065/133] ISTE -277 FIX --- .../packages/modules/payment/src/components/OpenView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js index 2a205725f..0c3b1daa7 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/components/OpenView.js @@ -89,7 +89,7 @@ const OpenView = () => { const requestCriteriaForOnlineTransactions = { url: "/pg-service/transaction/v1/_search", - params: { consumerCodes: queryParams.consumerCode, tenantId: queryParams.tenantId, businessService: queryParams.businessService }, + params: { consumerCode: queryParams.consumerCode, tenantId: queryParams.tenantId, businessService: queryParams.businessService }, body: {}, options: { userService: false, From fec65b8fd2e67ebe0799157677b45cd9c30e828c Mon Sep 17 00:00:00 2001 From: Palak Garg <86659286+palak-egov@users.noreply.github.com> Date: Mon, 29 Jul 2024 14:33:45 +0530 Subject: [PATCH 066/133] updating es host --- .../egov-hrms/src/main/resources/application.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business-services/egov-hrms/src/main/resources/application.properties b/business-services/egov-hrms/src/main/resources/application.properties index 00e297d63..4e17acf63 100644 --- a/business-services/egov-hrms/src/main/resources/application.properties +++ b/business-services/egov-hrms/src/main/resources/application.properties @@ -81,7 +81,7 @@ hrms.fuzzy.search.is.wildcard=true hrms.search.name.fuziness=2 #Elastic serach Properties -elasticsearch.host=http://localhost:9200/ +elasticsearch.host=http://elasticsearch-data.es-cluster:9200 elasticsearch.search.endpoint=/_search egov.es.username=elastic egov.es.password=EQYBhZhfrXeOA5IIqiHHCSlN @@ -125,4 +125,4 @@ 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 -sms.user.creation.enabled=true \ No newline at end of file +sms.user.creation.enabled=true From 16890bea1dd9a397c8b03ef7364aa54352349077 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 29 Jul 2024 15:27:57 +0530 Subject: [PATCH 067/133] ISTE-229 --- .../repository/WaterDaoImpl.java | 40 +++--- .../repository/builder/WsQueryBuilder.java | 6 +- .../rowmapper/LedgerReportRowMapper.java | 119 ++++-------------- .../service/WaterServiceImpl.java | 23 +--- .../web/models/DemandLedgerReport.java | 34 ++--- 5 files changed, 68 insertions(+), 154 deletions(-) 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 96178dfe9..07a34e42d 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 @@ -2,6 +2,9 @@ import java.math.BigDecimal; import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.ZoneId; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -686,7 +689,21 @@ public List getConsumersByPreviousMeterReading(Long return consumersDemandNotGeneratedList; } - public List> getLedgerReport(String consumercode, String tenantId, Integer limit, Integer offset, Long startDateTime, Long endDateTime,RequestInfoWrapper requestInfoWrapper) { + public List> getLedgerReport(String consumercode, String tenantId, Integer limit, Integer offset, String year,RequestInfoWrapper requestInfoWrapper) { + String[] years = year.split("-"); + if (years.length != 2) { + throw new IllegalArgumentException("Invalid fiscal year format"); + } + int startYear = Integer.parseInt(years[0]); + int endYear = Integer.parseInt(years[1]); + + LocalDate startDate = LocalDate.of(startYear, 4, 1); + LocalDate endDate = LocalDate.of(startYear + 1, 3, 31); + + Long startDateTime = LocalDateTime.of(startDate.getYear(), startDate.getMonth(), startDate.getDayOfMonth(), 0, 0, 0) + .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + Long endDateTime = LocalDateTime.of(endDate, LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + StringBuilder query = new StringBuilder(wsQueryBuilder.LEDGER_REPORT_QUERY); List preparedStatement = new ArrayList<>(); @@ -714,27 +731,10 @@ public List> getLedgerReport(String consumercode, String ten } log.info("Query of ledger report:" + query + "and prepared statement" + preparedStatement); -// LedgerReportRowMapper ledgerReportRowMapper = new LedgerReportRowMapper(); ledgerReportRowMapper.setTenantId(tenantId); ledgerReportRowMapper.setRequestInfo(requestInfoWrapper); -// ledgerReportRowMapper.setEndDate(endDate); -// List payments=ledgerReportRowMapper.addPaymentDetails(consumercode,tenantId,requestInfoWrapper); - -// StringBuilder taxAmountQuery=new StringBuilder(wsQueryBuilder.TAX_AMOUNT_QUERY); -// List taxAmountParams=new ArrayList<>(); -// taxAmountParams.add(consumercode); -// taxAmountParams.add(startDateTime); -// BigDecimal taxAmountResult = jdbcTemplate.queryForObject(taxAmountQuery.toString(), taxAmountParams.toArray(), BigDecimal.class); -// -// StringBuilder totalAmountPaidQuery = new StringBuilder(wsQueryBuilder.TOTAL_AMOUNT_PAID_QUERY); -// List totalAmountPaidParams = new ArrayList<>(); -// totalAmountPaidParams.add(consumercode); -// totalAmountPaidParams.add(startDateTime); -// BigDecimal totalAmountPaidResult = jdbcTemplate.queryForObject(totalAmountPaidQuery.toString(), totalAmountPaidParams.toArray(), BigDecimal.class); - -// ledgerReportRowMapper.setTaxAmountResult(taxAmountResult); -// ledgerReportRowMapper.setTotalAmountPaidResult(totalAmountPaidResult); - + ledgerReportRowMapper.setStartDate(startDate); + ledgerReportRowMapper.setEndDate(endDate); List> ledgerReportList= jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); return ledgerReportList; 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 f02ebeb87..b59d1313b 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 @@ -190,12 +190,12 @@ public class WsQueryBuilder { "ORDER BY startdate"; public static final String TAX_AMOUNT_QUERY="SELECT SUM(taxamount) FROM egbs_demanddetail_v1 WHERE " + - "demandid IN (SELECT id FROM egbs_demand_v1 WHERE consumercode = ? AND taxperiodfrom < ?);"; + "demandid IN (SELECT id FROM egbs_demand_v1 WHERE consumercode = ? AND taxperiodfrom < ? AND status='ACTIVE');"; public static final String TOTAL_AMOUNT_PAID_QUERY="SELECT SUM(totalamountpaid) FROM egcl_payment WHERE " + "id IN (SELECT paymentid FROM egcl_paymentdetail WHERE billid IN " + - "(SELECT billid FROM egbs_billdetail_v1 WHERE consumercode = ?)) AND createdtime < ?;"; - + "(SELECT billid FROM egbs_billdetail_v1 WHERE consumercode = ?)) AND createdtime < ? AND paymentstatus!='CANCELLED';"; + /** * * @param criteria The WaterCriteria diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 42cf75213..016c2c787 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -1,16 +1,14 @@ package org.egov.waterconnection.repository.rowmapper; import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.egov.waterconnection.repository.ServiceRequestRepository; import org.egov.waterconnection.repository.builder.WsQueryBuilder; -import org.egov.waterconnection.service.UserService; import org.egov.waterconnection.util.WaterServicesUtil; import org.egov.waterconnection.web.models.*; import org.egov.waterconnection.web.models.collection.Payment; import org.egov.waterconnection.web.models.collection.PaymentResponse; -import org.egov.waterconnection.web.models.users.UserDetailResponse; -import org.egov.waterconnection.web.models.users.UserSearchRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.JdbcTemplate; @@ -33,12 +31,6 @@ @Component public class LedgerReportRowMapper implements ResultSetExtractor>> { - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private UserService userService; - @Autowired private WaterServicesUtil waterServiceUtil; @@ -56,8 +48,8 @@ public class LedgerReportRowMapper implements ResultSetExtractor> extractData(ResultSet resultSet) throws SQLException, DataAccessException { List> monthlyRecordsList = new ArrayList<>(); Map ledgerReports = new HashMap<>(); - BigDecimal previousBalanceLeft = BigDecimal.ZERO; -// BigDecimal totalAmountForArrears = taxAmountForArrers != null ? taxAmountForArrers : BigDecimal.ZERO; -// BigDecimal amountPaidForArrears = totalAmountPaidForArrers != null ? totalAmountPaidForArrers : BigDecimal.ZERO; - BigDecimal arrears = BigDecimal.ZERO; + YearMonth startMonth=YearMonth.from(startDate); + YearMonth endMonth=YearMonth.from(endDate); + YearMonth currentMonth=startMonth; + + while (!currentMonth.isAfter(endMonth)) { + String monthAndYear = currentMonth.format(DateTimeFormatter.ofPattern("MMMMyyyy")); + LedgerReport ledgerReport = new LedgerReport(); + ledgerReport.setDemand(new DemandLedgerReport()); + ledgerReport.getDemand().setMonthAndYear(monthAndYear); + ledgerReports.put(monthAndYear, ledgerReport); + currentMonth = currentMonth.plusMonths(1); + } while (resultSet.next()) { Long dateLong = resultSet.getLong("enddate"); @@ -98,13 +97,9 @@ public List> extractData(ResultSet resultSet) throws SQLExce Long demandGenerationDateLong = resultSet.getLong("demandgenerationdate"); LocalDate demandGenerationDateLocal = Instant.ofEpochMilli(demandGenerationDateLong).atZone(ZoneId.systemDefault()).toLocalDate(); -// String demandGenerationDate = demandGenerationDateLocal.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); - LedgerReport ledgerReport = ledgerReports.getOrDefault(monthAndYear, new LedgerReport()); + LedgerReport ledgerReport = ledgerReports.get(monthAndYear); - if (ledgerReport.getDemand() == null) { - ledgerReport.setDemand(new DemandLedgerReport()); - } if (ledgerReport.getPayment() == null) { ledgerReport.setPayment(new ArrayList<>()); } @@ -112,15 +107,11 @@ public List> extractData(ResultSet resultSet) throws SQLExce if (code.equals("10102")) { ledgerReport.getDemand().setArrears(taxamount != null ? taxamount : BigDecimal.ZERO); ledgerReport.getDemand().setMonthAndYear(monthAndYear); -// arrears = (resultSet.getBigDecimal("due") != null ? resultSet.getBigDecimal("due") : BigDecimal.ZERO) -// .subtract(resultSet.getBigDecimal("paid") != null ? resultSet.getBigDecimal("paid") : BigDecimal.ZERO); } else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { ledgerReport.getDemand().setPenalty(taxamount != null ? taxamount : BigDecimal.ZERO); BigDecimal amount = ledgerReport.getDemand().getTaxamount() != null ? ledgerReport.getDemand().getTaxamount() : BigDecimal.ZERO; ledgerReport.getDemand().setTotalForCurrentMonth((taxamount != null ? taxamount : BigDecimal.ZERO).add(amount)); ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears() != null ? ledgerReport.getDemand().getArrears() : BigDecimal.ZERO)); -// ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); -// previousBalanceLeft = ledgerReport.getBalanceLeft(); } else if (code.equals("10101")) { ledgerReport.getDemand().setMonthAndYear(monthAndYear); ledgerReport.getDemand().setDemandGenerationDate(demandGenerationDateLong); @@ -130,23 +121,12 @@ public List> extractData(ResultSet resultSet) throws SQLExce long penaltyAppliedDateMillis = demandGenerationDateLocal.plus(11, ChronoUnit.DAYS).atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); ledgerReport.getDemand().setDueDate(dueDateMillis); ledgerReport.getDemand().setPenaltyAppliedDate(penaltyAppliedDateMillis); -// ledgerReport.setCollectionDate(resultSet.getDate("collectiondate") != null ? resultSet.getDate("collectiondate").toLocalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) : null); -// ledgerReport.setReceiptNo(resultSet.getString("receiptno")); -// ledgerReport.setPaid(resultSet.getBigDecimal("paid")); -// if (arrears.equals(BigDecimal.ZERO)) { -// } else { -// ledgerReport.getDemand().setArrears(arrears); -// arrears = BigDecimal.ZERO; -// } Long startDate = resultSet.getLong("startdate"); String connectionno = resultSet.getString("connectionno"); BigDecimal taxAmountResult = getMonthlyTaxAmount(startDate, connectionno); BigDecimal totalAmountPaidResult = getMonthlyTotalAmountPaid(startDate, connectionno); ledgerReport.getDemand().setArrears(taxAmountResult.subtract(totalAmountPaidResult)); ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears())); -// ledgerReport.setBalanceLeft(ledgerReport.getTotal_due_amount().subtract(ledgerReport.getPaid())); -// previousBalanceLeft = ledgerReport.getBalanceLeft(); -// String consumerCode=resultSet.getString("connectionno"); } ledgerReport.getDemand().setConnectionNo(resultSet.getString("connectionno")); ledgerReport.getDemand().setOldConnectionNo(resultSet.getString("oldconnectionno")); @@ -154,17 +134,6 @@ public List> extractData(ResultSet resultSet) throws SQLExce log.info("Data inserted into map " + ledgerReport.toString()); ledgerReports.put(monthAndYear, ledgerReport); } -// for (Map.Entry entry : ledgerReports.entrySet()) { -// String monthAndYear = entry.getKey(); -// log.info("Month and year from map "+monthAndYear); -// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMMyyyy", Locale.ENGLISH); -// YearMonth yearMonth = YearMonth.parse(monthAndYear, formatter); -// LocalDate endDate = yearMonth.atDay(1); -// String code = entry.getValue().getCode(); -// if (!endDate.isBefore(startDateLocalDate) && !endDate.isAfter(endDateLocalDate) && code.equals("10101")) { -// ledgerReportList.add(entry.getValue()); -// } -// } for (Map.Entry entry : ledgerReports.entrySet()) { Map record = new HashMap<>(); if (entry.getValue().getDemand().getTaxamount()!=null) { @@ -174,7 +143,6 @@ public List> extractData(ResultSet resultSet) throws SQLExce } log.info("ledger report list" + monthlyRecordsList); if (!monthlyRecordsList.isEmpty()) { -// enrichConnectionHolderDetails(monthlyRecordsList); addPaymentToLedger(monthlyRecordsList); } monthlyRecordsList.sort(new Comparator>() { @@ -193,48 +161,11 @@ public int compare(Map o1, Map o2) { return monthlyRecordsList; } - private void enrichConnectionHolderDetails(List> monthlyRecordsList) { - Set connectionHolderIds = new HashSet<>(); - for (Map record : monthlyRecordsList) { - LedgerReport ledgerReport = (LedgerReport) record.values().iterator().next(); - if (ledgerReport == null) { - log.info("LedgerReport is null for record: {}", record); - } - - DemandLedgerReport demandLedgerReport = ledgerReport.getDemand(); - if (demandLedgerReport == null) { - log.info("DemandLedgerReport is null for LedgerReport: {}", ledgerReport); - } - String userId = demandLedgerReport.getUserId(); - if (userId == null) { - log.info("UserId is null for DemandLedgerReport: {}", demandLedgerReport); - } - connectionHolderIds.add(userId); - } - UserSearchRequest userSearchRequest = new UserSearchRequest(); - userSearchRequest.setUuid(connectionHolderIds); - log.info("User search request" + userSearchRequest); - UserDetailResponse userDetailResponse = userService.getUser(userSearchRequest); - enrichConnectionHolderInfo(userDetailResponse, monthlyRecordsList); - } - - private void enrichConnectionHolderInfo(UserDetailResponse userDetailResponse, - List> monthlyRecordsList) { - List connectionHolderInfos = userDetailResponse.getUser(); - Map userIdToConnectionHolderMap = new HashMap<>(); - connectionHolderInfos.forEach(user -> userIdToConnectionHolderMap.put(user.getUuid(), user)); - for (Map record : monthlyRecordsList) { - LedgerReport ledgerReport = (LedgerReport) record.values().iterator().next(); - ledgerReport.getDemand().setConsumerName(userIdToConnectionHolderMap.get(ledgerReport.getDemand().getUserId()).getName()); - } - } - public List addPaymentDetails(String consumerCode) { String service = "WS"; StringBuilder URL = waterServiceUtil.getcollectionURL(); URL.append(service).append("/_search").append("?").append("consumerCodes=").append(consumerCode) .append("&").append("tenantId=").append(tenantId); -// RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(waterConnectionRequest.getRequestInfo()).build(); Object response = serviceRequestRepository.fetchResult(URL, requestInfoWrapper); log.info("line 226 response " + response.toString()); PaymentResponse paymentResponse = mapper.convertValue(response, PaymentResponse.class); 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 270a4cfcc..03de8182c 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 @@ -865,26 +865,9 @@ public WaterConnectionResponse getConsumersWithDemandNotGenerated(String previou } @Override - public List> ledgerReport(String consumercode, String tenantId, Integer offset, Integer limit, String year,RequestInfoWrapper requestInfoWrapper) { - String[] years = year.split("-"); - if (years.length != 2) { - throw new IllegalArgumentException("Invalid fiscal year format"); - } - int startYear = Integer.parseInt(years[0]); - int endYear = Integer.parseInt(years[1]); - -// if (endYear != startYear + 1) { -// throw new IllegalArgumentException("Invalid fiscal year range"); -// } - - LocalDate startDate = LocalDate.of(startYear, 4, 1); - LocalDate endDate = LocalDate.of(startYear + 1, 3, 31); - - Long startDateTime = LocalDateTime.of(startDate.getYear(), startDate.getMonth(), startDate.getDayOfMonth(), 0, 0, 0) - .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); - Long endDateTime = LocalDateTime.of(endDate,LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); - - List> list = waterDaoImpl.getLedgerReport(consumercode, tenantId, limit, offset, startDateTime, endDateTime,requestInfoWrapper); + public List> ledgerReport(String consumercode, String tenantId, Integer offset, Integer limit, String year,RequestInfoWrapper requestInfoWrapper) + { + List> list = waterDaoImpl.getLedgerReport(consumercode, tenantId, limit, offset, year,requestInfoWrapper); return list; } } \ No newline at end of file diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java index d2cf89ed8..c7cad175e 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java @@ -30,38 +30,38 @@ public class DemandLedgerReport { private String monthAndYear; @JsonProperty("demandGenerationDate") - private Long demandGenerationDate; + private Long demandGenerationDate= 0L; @JsonProperty("code") private String code = null; @JsonProperty("monthlyCharges") - private BigDecimal taxamount; + private BigDecimal taxamount=BigDecimal.ZERO; @JsonProperty("penalty") - private BigDecimal penalty; + private BigDecimal penalty=BigDecimal.ZERO; @JsonProperty("totalForCurrentMonth") - private BigDecimal totalForCurrentMonth; + private BigDecimal totalForCurrentMonth=BigDecimal.ZERO; @JsonProperty("previousMonthBalance") - private BigDecimal arrears; + private BigDecimal arrears=BigDecimal.ZERO; @JsonProperty("totalDues") - private BigDecimal total_due_amount; + private BigDecimal total_due_amount=BigDecimal.ZERO; @JsonProperty("dueDateOfPayment") - private Long dueDate; + private Long dueDate= 0L; @JsonProperty("penaltyAppliedOnDate") - private Long penaltyAppliedDate; - - public DemandLedgerReport(String monthAndYear) { - this.monthAndYear = monthAndYear; - this.taxamount = BigDecimal.ZERO; - this.penalty = BigDecimal.ZERO; - this.totalForCurrentMonth = BigDecimal.ZERO; - this.arrears = BigDecimal.ZERO; - this.total_due_amount = BigDecimal.ZERO; - } + private Long penaltyAppliedDate=0L; + +// public DemandLedgerReport(String monthAndYear) { +// this.monthAndYear = monthAndYear; +// this.taxamount = BigDecimal.ZERO; +// this.penalty = BigDecimal.ZERO; +// this.totalForCurrentMonth = BigDecimal.ZERO; +// this.arrears = BigDecimal.ZERO; +// this.total_due_amount = BigDecimal.ZERO; +// } } From 72f95784f79a572f4fe7406f549fd94c836d7c8d Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Tue, 30 Jul 2024 00:30:29 +0530 Subject: [PATCH 068/133] ISTE--282 FIX --- .../components/pageComponents/jurisdiction.js | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js index 1474eb067..5ff0f0e2f 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js @@ -231,28 +231,44 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { }; + + function filterJurisdictions(unit, jurisdictions) { + const divisionBoundaryCodes = new Set(unit.divisionBoundary.map(item => item.code)); + return jurisdictions.filter(jurisdiction => { + return !divisionBoundaryCodes.has(jurisdiction.boundary.code); + }); + } const handleRemoveUnit = (unit) => { if(STATE_ADMIN){ - let updatedJurisdictionsData = []; if(!isEdit){ - updatedJurisdictionsData = jurisdictions.filter( + setjurisdictions(jurisdictions.filter( (element) => element.key !== unit.key - ); + )); + setjurisdictions((prev) => prev.map((unit, index) => ({ ...unit, key: index }))); } else{ - updatedJurisdictionsData = jurisdictionsData.filter( + setJuristictionsData(jurisdictionsData.filter( (element) => element.key !== unit.key - ); + )); + let filterJurisdictionsItems = filterJurisdictions(unit,jurisdictions); + setjurisdictions(filterJurisdictionsItems); + setjurisdictions((prev) => prev.map((unit, index) => ({ ...unit, key: index }))); } + // console.log(jurisdictions,"jurisdictions"); + // console.log(jurisdictionsData,"jurisdictionsData"); + // setJuristictionsData((pre) => pre.filter((el) => el.key !== unit.key)); + + - setJuristictionsData(updatedJurisdictionsData); - setjurisdictions(updatedJurisdictionsData) + + + // setjurisdictions(jurisdictions.filter((element) => element.key !== unit.key)); + // setjurisdictions((prev) => prev.filter((el) => el.key !== unit.key)); if (FormData.errors?.Jurisdictions?.type == unit.key) { clearErrors("Jurisdictions"); } reviseIndexKeys(); - } From d603564a444729106ae1171afe89e68106a0cb4e Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Tue, 30 Jul 2024 01:25:31 +0530 Subject: [PATCH 069/133] ISTE-189 - FIX --- frontend/mgramseva/lib/model/demand/demand_list.dart | 2 ++ frontend/mgramseva/lib/model/demand/demand_list.g.dart | 3 +++ 2 files changed, 5 insertions(+) diff --git a/frontend/mgramseva/lib/model/demand/demand_list.dart b/frontend/mgramseva/lib/model/demand/demand_list.dart index 93f894ffe..bacd07f51 100644 --- a/frontend/mgramseva/lib/model/demand/demand_list.dart +++ b/frontend/mgramseva/lib/model/demand/demand_list.dart @@ -143,6 +143,8 @@ class AggragateDemandDetails { double? currentMonthPenalty; @JsonKey(name: "currentmonthTotalDue") double? currentmonthTotalDue; + @JsonKey(name: "currentmonthRoundOff") + double? currentmonthRoundOff; @JsonKey(name: "totalAreas") double? totalAreas; @JsonKey(name: "totalAreasWithPenalty") diff --git a/frontend/mgramseva/lib/model/demand/demand_list.g.dart b/frontend/mgramseva/lib/model/demand/demand_list.g.dart index fa1596193..b94e57d19 100644 --- a/frontend/mgramseva/lib/model/demand/demand_list.g.dart +++ b/frontend/mgramseva/lib/model/demand/demand_list.g.dart @@ -142,6 +142,8 @@ AggragateDemandDetails _$AggragateDemandDetailsFromJson( ..currentMonthPenalty = (json['currentMonthPenalty'] as num?)?.toDouble() ..currentmonthTotalDue = (json['currentmonthTotalDue'] as num?)?.toDouble() + ..currentmonthRoundOff = + (json['currentmonthRoundOff'] as num?)?.toDouble() ..totalAreas = (json['totalAreas'] as num?)?.toDouble() ..totalAreasWithPenalty = (json['totalAreasWithPenalty'] as num?)?.toDouble() @@ -174,6 +176,7 @@ Map _$AggragateDemandDetailsToJson( 'currentmonthBill': instance.currentmonthBill, 'currentMonthPenalty': instance.currentMonthPenalty, 'currentmonthTotalDue': instance.currentmonthTotalDue, + 'currentmonthRoundOff': instance.currentmonthRoundOff, 'totalAreas': instance.totalAreas, 'totalAreasWithPenalty': instance.totalAreasWithPenalty, 'netdue': instance.netdue, From 67cf72bf332529c5ac9c0501ca4e6ea7facb2304 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Tue, 30 Jul 2024 01:34:10 +0530 Subject: [PATCH 070/133] ISTE-251 - FIX --- .../house_connection_and_bill/new_consumer_bill.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/mgramseva/lib/components/house_connection_and_bill/new_consumer_bill.dart b/frontend/mgramseva/lib/components/house_connection_and_bill/new_consumer_bill.dart index 80fb993a6..a1db22d2b 100644 --- a/frontend/mgramseva/lib/components/house_connection_and_bill/new_consumer_bill.dart +++ b/frontend/mgramseva/lib/components/house_connection_and_bill/new_consumer_bill.dart @@ -243,10 +243,15 @@ class NewConsumerBillState extends State { houseHoldProvider.isfirstdemand) getLabelText( i18.common.CORE_ADVANCE_ADJUSTED, + + double.parse(CommonProvider + .getAdvanceAdjustedAmount( + widget + .demandList)) == 0 ? "₹ ${houseHoldProvider.aggDemandItems?.remainingAdvance}" : double.parse(CommonProvider .getAdvanceAdjustedAmount( widget - .demandList)) <= + .demandList)) < 0 ? "₹ ${double.parse(CommonProvider.getAdvanceAdjustedAmount(widget.demandList))}" : '- ₹${double.parse(CommonProvider.getAdvanceAdjustedAmount(widget.demandList))}', From 608910c470dca2dac950a6d68b9e658964881cbb Mon Sep 17 00:00:00 2001 From: Palak Garg <86659286+palak-egov@users.noreply.github.com> Date: Tue, 30 Jul 2024 11:28:33 +0530 Subject: [PATCH 071/133] Update ElasticSearchRepository.java --- .../java/org/egov/hrms/repository/ElasticSearchRepository.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java index 34f7e82f4..767262ca1 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java @@ -44,9 +44,8 @@ public Object fuzzySearchEmployees(EmployeeSearchCriteria criteria, List HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", getESEncodedCredentials()); - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + headers.setContentType(MediaType.APPLICATION_JSON); log.info("Headers: " + headers.toString()); -// headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity requestEntity = new HttpEntity<>(searchQuery, headers); ResponseEntity response = null; try { From bc5c6ef164edd49aa01e8c0b0f6f0d306fab07a3 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 30 Jul 2024 12:17:58 +0530 Subject: [PATCH 072/133] ISTE-229 --- .../rowmapper/LedgerReportRowMapper.java | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 016c2c787..68e06f9cf 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -162,6 +162,8 @@ public int compare(Map o1, Map o2) { } public List addPaymentDetails(String consumerCode) { + if(consumerCode==null) + return null; String service = "WS"; StringBuilder URL = waterServiceUtil.getcollectionURL(); URL.append(service).append("/_search").append("?").append("consumerCodes=").append(consumerCode) @@ -183,21 +185,24 @@ private void addPaymentToLedger(List> monthlyRecordList) { log.info("consumer code is " + consumerCode); List payments = addPaymentDetails(consumerCode); boolean paymentMatched = false; - for (Payment payment : payments) { - Long transactionDateLong = payment.getTransactionDate(); - LocalDate transactionDate = Instant.ofEpochMilli(transactionDateLong).atZone(ZoneId.systemDefault()).toLocalDate(); - String transactionMonthAndYear = transactionDate.format(DateTimeFormatter.ofPattern("MMMMyyyy")); - if (ledgerReport.getDemand().getMonthAndYear().equals(transactionMonthAndYear)) { - PaymentLedgerReport paymentLedgerReport = new PaymentLedgerReport(); - paymentLedgerReport.setCollectionDate(transactionDateLong); - paymentLedgerReport.setReceiptNo(payment.getPaymentDetails().get(0).getReceiptNumber()); - paymentLedgerReport.setPaid(payment.getTotalAmountPaid()); - paymentLedgerReport.setBalanceLeft(ledgerReport.getDemand().getTotal_due_amount().subtract(payment.getTotalAmountPaid())); - if (ledgerReport.getPayment() == null) { - ledgerReport.setPayment(new ArrayList<>()); + if(payments!=null) + { + for (Payment payment : payments) { + Long transactionDateLong = payment.getTransactionDate(); + LocalDate transactionDate = Instant.ofEpochMilli(transactionDateLong).atZone(ZoneId.systemDefault()).toLocalDate(); + String transactionMonthAndYear = transactionDate.format(DateTimeFormatter.ofPattern("MMMMyyyy")); + if (ledgerReport.getDemand().getMonthAndYear().equals(transactionMonthAndYear)) { + PaymentLedgerReport paymentLedgerReport = new PaymentLedgerReport(); + paymentLedgerReport.setCollectionDate(transactionDateLong); + paymentLedgerReport.setReceiptNo(payment.getPaymentDetails().get(0).getReceiptNumber()); + paymentLedgerReport.setPaid(payment.getTotalAmountPaid()); + paymentLedgerReport.setBalanceLeft(ledgerReport.getDemand().getTotal_due_amount().subtract(payment.getTotalAmountPaid())); + if (ledgerReport.getPayment() == null) { + ledgerReport.setPayment(new ArrayList<>()); + } + ledgerReport.getPayment().add(paymentLedgerReport); + paymentMatched = true; } - ledgerReport.getPayment().add(paymentLedgerReport); - paymentMatched = true; } } if (!paymentMatched) { From 16e31259ddf0c1b904e2adee95f0a4a75a82c67d Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Tue, 30 Jul 2024 12:32:14 +0530 Subject: [PATCH 073/133] ledger step 2 --- .../lib/providers/household_register_provider.dart | 8 +++++--- .../mgramseva/lib/providers/reports_provider.dart | 4 ++++ frontend/mgramseva/lib/routing.dart | 6 +++++- .../screeens/household_detail/household_detail.dart | 1 - .../lib/screeens/leadger_report/ledger_report.dart | 13 ++++++++++--- 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/frontend/mgramseva/lib/providers/household_register_provider.dart b/frontend/mgramseva/lib/providers/household_register_provider.dart index a83653cd1..1724e53c8 100644 --- a/frontend/mgramseva/lib/providers/household_register_provider.dart +++ b/frontend/mgramseva/lib/providers/household_register_provider.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:convert'; import 'dart:developer'; import 'package:flutter/material.dart'; @@ -441,10 +442,11 @@ class HouseholdRegisterProvider with ChangeNotifier { }); } viewLeadger(TableData tableData) { - log("${ waterConnectionsDetails?.waterConnection?.first.connectionNo}"); - log("Call Ledger View Here"); + log("Call Ledger View Here"); Navigator.pushNamed(navigatorKey.currentContext!, Routes.LEDGER_REPORTS, - arguments: "${waterConnectionsDetails?.waterConnection?.first.connectionNo}"); + arguments: { + 'waterconnections': waterConnectionsDetails?.waterConnection?.first, + }); diff --git a/frontend/mgramseva/lib/providers/reports_provider.dart b/frontend/mgramseva/lib/providers/reports_provider.dart index 538a99afc..58f9c583a 100644 --- a/frontend/mgramseva/lib/providers/reports_provider.dart +++ b/frontend/mgramseva/lib/providers/reports_provider.dart @@ -65,6 +65,9 @@ class ReportsProvider with ChangeNotifier { genericTableData = BillsTableData([], []); notifyListeners(); } + void updateDefaultDate() { + + } dispose() { streamController.close(); @@ -307,6 +310,7 @@ class ReportsProvider with ChangeNotifier { billingYearList = res; notifyListeners(); streamController.add(billingYearList); + } catch (e, s) { ErrorHandler().allExceptionsHandler(navigatorKey.currentContext!, e, s); streamController.addError('error'); diff --git a/frontend/mgramseva/lib/routing.dart b/frontend/mgramseva/lib/routing.dart index 5a0b86652..f76c6bad1 100644 --- a/frontend/mgramseva/lib/routing.dart +++ b/frontend/mgramseva/lib/routing.dart @@ -373,7 +373,11 @@ class Routing { settings: RouteSettings(name: Routes.REPORTS)); case Routes.LEDGER_REPORTS: return MaterialPageRoute( - builder: (_) => LeadgerReport(), + builder: (_) => LeadgerReport( + waterConnection: settings.arguments != null + ? (settings.arguments as Map)['waterconnections'] + as WaterConnection + : null), settings: RouteSettings(name: Routes.LEDGER_REPORTS)); case Routes.PRIVACY_POLICY: bool args = settings.arguments==null?false:settings.arguments as bool; diff --git a/frontend/mgramseva/lib/screeens/household_detail/household_detail.dart b/frontend/mgramseva/lib/screeens/household_detail/household_detail.dart index 92192c34d..613be4081 100644 --- a/frontend/mgramseva/lib/screeens/household_detail/household_detail.dart +++ b/frontend/mgramseva/lib/screeens/household_detail/household_detail.dart @@ -28,7 +28,6 @@ class HouseholdDetail extends StatefulWidget { final String? mode; final String? status; final WaterConnection? waterConnection; - HouseholdDetail( {Key? key, this.id, this.mode, this.status, this.waterConnection}); @override diff --git a/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart b/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart index a5fc0ca5c..2cb5d5d0d 100644 --- a/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart +++ b/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart @@ -1,4 +1,8 @@ +import 'dart:convert'; +import 'dart:developer'; + import 'package:flutter/material.dart'; +import 'package:mgramseva/model/connection/water_connection.dart'; import 'package:mgramseva/screeens/leadger_report/leadger_view.dart'; import 'package:mgramseva/screeens/reports/expense_bill_report.dart'; import 'package:mgramseva/screeens/reports/inactive_consumer_report.dart'; @@ -22,8 +26,9 @@ import '../reports/bill_report.dart'; import '../reports/collection_report.dart'; class LeadgerReport extends StatefulWidget { - const LeadgerReport({Key? key}) : super(key: key); - + final WaterConnection? waterConnection; + LeadgerReport({Key? key,this.waterConnection}) : super(key: key); + @override State createState() { return _LeadgerReport(); @@ -59,6 +64,8 @@ class _LeadgerReport extends State with SingleTickerProviderState reportsProvider.clearBillingSelection(); reportsProvider.clearBuildTableData(); reportsProvider.clearTableData(); + /*start-from here 3333*/ + reportsProvider.updateDefaultDate(); } @@ -83,7 +90,7 @@ class _LeadgerReport extends State with SingleTickerProviderState } @override - Widget build(BuildContext context) { + Widget build(BuildContext context) { // TODO: implement build return Scaffold( appBar: CustomAppBar(), From 8b23985b30c44af71a21ab067433a5e1e94980d7 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 30 Jul 2024 13:14:09 +0530 Subject: [PATCH 074/133] ISTE-229 --- .../waterconnection/repository/builder/WsQueryBuilder.java | 2 +- .../repository/rowmapper/LedgerReportRowMapper.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) 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 b59d1313b..d53c77fd6 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 @@ -185,7 +185,7 @@ public class WsQueryBuilder { "ON connectionholder.connectionid = conn.id " + "INNER JOIN egbs_demand_v1 dem ON dem.consumercode = conn.connectionno INNER JOIN " + "egbs_demanddetail_v1 dd ON dd.demandid = dem.id " + - "WHERE dem.consumercode = ? AND conn.tenantId = ? AND conn.status = 'Active' AND dem.status = 'ACTIVE' " + + "WHERE dem.consumercode = ? AND conn.tenantId = ? AND dem.status = 'ACTIVE' " + "AND taxperiodfrom>=? AND taxperiodto<=? "+ "ORDER BY startdate"; diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 68e06f9cf..dd1a64cad 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -82,6 +82,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce LedgerReport ledgerReport = new LedgerReport(); ledgerReport.setDemand(new DemandLedgerReport()); ledgerReport.getDemand().setMonthAndYear(monthAndYear); + ledgerReport.getDemand().setConnectionNo(resultSet.getString("connectionno")); ledgerReports.put(monthAndYear, ledgerReport); currentMonth = currentMonth.plusMonths(1); } @@ -136,10 +137,10 @@ public List> extractData(ResultSet resultSet) throws SQLExce } for (Map.Entry entry : ledgerReports.entrySet()) { Map record = new HashMap<>(); - if (entry.getValue().getDemand().getTaxamount()!=null) { +// if (entry.getValue().getDemand().getTaxamount()!=null) { record.put(entry.getKey(), entry.getValue()); monthlyRecordsList.add(record); - } +// } } log.info("ledger report list" + monthlyRecordsList); if (!monthlyRecordsList.isEmpty()) { @@ -171,7 +172,7 @@ public List addPaymentDetails(String consumerCode) { Object response = serviceRequestRepository.fetchResult(URL, requestInfoWrapper); log.info("line 226 response " + response.toString()); PaymentResponse paymentResponse = mapper.convertValue(response, PaymentResponse.class); - log.info("paymnent response" + paymentResponse.toString()); +// log.info("paymnent response" + paymentResponse.toString()); return paymentResponse.getPayments(); } From 53b73b2e10458993fc149c0b72ae2550f3e29183 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 30 Jul 2024 13:47:54 +0530 Subject: [PATCH 075/133] ISTE-229 --- .../egov/waterconnection/repository/WaterDaoImpl.java | 1 + .../repository/rowmapper/LedgerReportRowMapper.java | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) 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 07a34e42d..8316469ff 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 @@ -735,6 +735,7 @@ public List> getLedgerReport(String consumercode, String ten ledgerReportRowMapper.setRequestInfo(requestInfoWrapper); ledgerReportRowMapper.setStartDate(startDate); ledgerReportRowMapper.setEndDate(endDate); + ledgerReportRowMapper.setConsumerCode(consumercode); List> ledgerReportList= jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); return ledgerReportList; diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index dd1a64cad..8b9344de1 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -50,6 +50,7 @@ public class LedgerReportRowMapper implements ResultSetExtractor> extractData(ResultSet resultSet) throws SQLException, DataAccessException { List> monthlyRecordsList = new ArrayList<>(); @@ -82,7 +89,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce LedgerReport ledgerReport = new LedgerReport(); ledgerReport.setDemand(new DemandLedgerReport()); ledgerReport.getDemand().setMonthAndYear(monthAndYear); - ledgerReport.getDemand().setConnectionNo(resultSet.getString("connectionno")); + ledgerReport.getDemand().setConnectionNo(consumerCode); ledgerReports.put(monthAndYear, ledgerReport); currentMonth = currentMonth.plusMonths(1); } @@ -137,10 +144,8 @@ public List> extractData(ResultSet resultSet) throws SQLExce } for (Map.Entry entry : ledgerReports.entrySet()) { Map record = new HashMap<>(); -// if (entry.getValue().getDemand().getTaxamount()!=null) { record.put(entry.getKey(), entry.getValue()); monthlyRecordsList.add(record); -// } } log.info("ledger report list" + monthlyRecordsList); if (!monthlyRecordsList.isEmpty()) { From 9ade4045d552f73313dc02817ec935d0f8ceb291 Mon Sep 17 00:00:00 2001 From: Palak Garg <86659286+palak-egov@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:38:18 +0530 Subject: [PATCH 076/133] Update FuzzySearchService.java --- .../egov/hrms/service/FuzzySearchService.java | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java index 7c833f829..4b0656396 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java @@ -42,22 +42,21 @@ public List getEmployees(RequestInfo requestInfo, EmployeeSearchCriter Object esResponse = elasticSearchRepository.fuzzySearchEmployees(criteria, idsFromDB); - Map> tenantIdToPropertyId = getTenantIdToPropertyIdMap(esResponse); + Map> tenantIdToEmpId = getTenantIdToEmpIdMap(esResponse); List employees = new LinkedList<>(); - for (Map.Entry> entry : tenantIdToPropertyId.entrySet()) { + for (Map.Entry> entry : tenantIdToEmpId.entrySet()) { String tenantId = entry.getKey(); - Set propertyIds = entry.getValue(); + Set empIds = entry.getValue(); + List empList = new ArrayList<>(empIds); -// EmployeeSearchCriteria employeeSearchCriteria = EmployeeSearchCriteria.builder().tenantId(tenantId).propertyIds(propertyIds).build(); + EmployeeSearchCriteria employeeSearchCriteria = EmployeeSearchCriteria.builder().tenantId(tenantId).codes(empList).build(); employees.addAll(employeeRepository.fetchEmployees(criteria,requestInfo)); } -// List orderedProperties = orderByESScore(properties, esResponse); - return employees; } private void validateFuzzySearchCriteria(EmployeeSearchCriteria criteria){ @@ -66,10 +65,10 @@ private void validateFuzzySearchCriteria(EmployeeSearchCriteria criteria){ throw new CustomException("INVALID_SEARCH_CRITERIA","The search criteria is invalid"); } - private Map> getTenantIdToPropertyIdMap(Object esResponse) { + private Map> getTenantIdToEmpIdMap(Object esResponse) { List> data; - Map> tenantIdToPropertyIds = new LinkedHashMap<>(); + Map> tenantIdToEmpIds = new LinkedHashMap<>(); try { @@ -81,14 +80,13 @@ private Map> getTenantIdToPropertyIdMap(Object esResponse) { for (Map map : data) { String tenantId = JsonPath.read(map, "$.tenantData.code"); - String propertyId = JsonPath.read(map, "$.propertyId"); - - if (tenantIdToPropertyIds.containsKey(tenantId)) - tenantIdToPropertyIds.get(tenantId).add(propertyId); + String empId = JsonPath.read(map, "$.code"); + if (tenantIdToEmpIds.containsKey(tenantId)) + tenantIdToEmpIds.get(tenantId).add(empId); else { - Set propertyIds = new HashSet<>(); - propertyIds.add(propertyId); - tenantIdToPropertyIds.put(tenantId, propertyIds); + Set empIds = new HashSet<>(); + empIds.add(empId); + tenantIdToEmpIds.put(tenantId, empIds); } } @@ -96,9 +94,9 @@ private Map> getTenantIdToPropertyIdMap(Object esResponse) { } } catch (Exception e) { - throw new CustomException("PARSING_ERROR", "Failed to extract propertyIds from es response"); + throw new CustomException("PARSING_ERROR", "Failed to extract employeeIds from es response"); } - return tenantIdToPropertyIds; + return tenantIdToEmpIds; } } From b0636b7d651c7e0bf140ad55175f07785a099870 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 30 Jul 2024 15:15:52 +0530 Subject: [PATCH 077/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 8b9344de1..02701f36f 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -182,6 +182,8 @@ public List addPaymentDetails(String consumerCode) { } private void addPaymentToLedger(List> monthlyRecordList) { + BigDecimal runningBalance=BigDecimal.ZERO; + for (Map record : monthlyRecordList) { LedgerReport ledgerReport = (LedgerReport) record.values().iterator().next(); if (ledgerReport.getDemand() == null) { @@ -202,7 +204,16 @@ private void addPaymentToLedger(List> monthlyRecordList) { paymentLedgerReport.setCollectionDate(transactionDateLong); paymentLedgerReport.setReceiptNo(payment.getPaymentDetails().get(0).getReceiptNumber()); paymentLedgerReport.setPaid(payment.getTotalAmountPaid()); - paymentLedgerReport.setBalanceLeft(ledgerReport.getDemand().getTotal_due_amount().subtract(payment.getTotalAmountPaid())); + BigDecimal totalDueAmount=ledgerReport.getDemand().getTotal_due_amount(); + if(totalDueAmount.equals(BigDecimal.ZERO)) + { + paymentLedgerReport.setBalanceLeft(runningBalance); + } + else + { + paymentLedgerReport.setBalanceLeft(totalDueAmount.subtract(paymentLedgerReport.getPaid())); + } + runningBalance=paymentLedgerReport.getBalanceLeft(); if (ledgerReport.getPayment() == null) { ledgerReport.setPayment(new ArrayList<>()); } From 5c6f91d9781b57ad9d80fd56aa970d89c2f1d596 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 30 Jul 2024 15:37:55 +0530 Subject: [PATCH 078/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 02701f36f..9cf24471e 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -182,7 +182,7 @@ public List addPaymentDetails(String consumerCode) { } private void addPaymentToLedger(List> monthlyRecordList) { - BigDecimal runningBalance=BigDecimal.ZERO; +// BigDecimal runningBalance=BigDecimal.ZERO; for (Map record : monthlyRecordList) { LedgerReport ledgerReport = (LedgerReport) record.values().iterator().next(); @@ -207,13 +207,13 @@ private void addPaymentToLedger(List> monthlyRecordList) { BigDecimal totalDueAmount=ledgerReport.getDemand().getTotal_due_amount(); if(totalDueAmount.equals(BigDecimal.ZERO)) { - paymentLedgerReport.setBalanceLeft(runningBalance); + paymentLedgerReport.setBalanceLeft(payment.getTotalDue().subtract(paymentLedgerReport.getPaid())); } else { paymentLedgerReport.setBalanceLeft(totalDueAmount.subtract(paymentLedgerReport.getPaid())); } - runningBalance=paymentLedgerReport.getBalanceLeft(); +// runningBalance=paymentLedgerReport.getBalanceLeft(); if (ledgerReport.getPayment() == null) { ledgerReport.setPayment(new ArrayList<>()); } From 0841114043f3ca9ca41e7642adf8b2a1651e2af8 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Thu, 1 Aug 2024 12:19:59 +0530 Subject: [PATCH 079/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 9cf24471e..2064b02c7 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -81,7 +81,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce List> monthlyRecordsList = new ArrayList<>(); Map ledgerReports = new HashMap<>(); YearMonth startMonth=YearMonth.from(startDate); - YearMonth endMonth=YearMonth.from(endDate); + YearMonth endMonth=YearMonth.now(); YearMonth currentMonth=startMonth; while (!currentMonth.isAfter(endMonth)) { From a7465a9d82d09856df03c61cfb4977f286ee61af Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 1 Aug 2024 13:27:21 +0530 Subject: [PATCH 080/133] Leadger Changes --- .../lib/components/dashboard/bills_table.dart | 90 +++++---- .../lib/model/reports/leadger_report.dart | 178 +++++++++--------- .../household_register_provider.dart | 34 +--- .../lib/providers/reports_provider.dart | 98 ++++++++-- .../lib/repository/reports_repo.dart | 43 +++++ .../screeens/leadger_report/leadger_view.dart | 35 ++-- .../leadger_report/ledger_report.dart | 97 ++++++---- .../lib/screeens/reports/leadger_table.dart | 96 ++++++++++ .../utils/constants/i18_key_constants.dart | 19 ++ .../mgramseva/lib/utils/date_formats.dart | 11 ++ frontend/mgramseva/lib/utils/models.dart | 3 +- .../lib/utils/testing_keys/testing_keys.dart | 1 + .../lib/widgets/select_field_builder.dart | 1 + 13 files changed, 488 insertions(+), 218 deletions(-) create mode 100644 frontend/mgramseva/lib/screeens/reports/leadger_table.dart diff --git a/frontend/mgramseva/lib/components/dashboard/bills_table.dart b/frontend/mgramseva/lib/components/dashboard/bills_table.dart index ce3494071..996cbcb9b 100644 --- a/frontend/mgramseva/lib/components/dashboard/bills_table.dart +++ b/frontend/mgramseva/lib/components/dashboard/bills_table.dart @@ -3,6 +3,7 @@ import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:horizontal_data_table/horizontal_data_table.dart'; +import 'package:mgramseva/utils/constants/i18_key_constants.dart'; import 'package:mgramseva/utils/localization/application_localizations.dart'; import 'package:mgramseva/utils/models.dart'; import 'package:mgramseva/widgets/scroll_parent.dart'; @@ -147,37 +148,63 @@ class _BillsTable extends State { //if greater than 28 characters } + String getCurrentRoutePath(BuildContext context) { + final currentRoute = ModalRoute.of(context)!; + return currentRoute.settings.name ?? ''; +} + Widget _generateFirstColumnRow(BuildContext context, int index) { + return LayoutBuilder(builder: (context, constraints) { + bool showLeadger = getCurrentRoutePath(context) == "/home/householdRegister"; var data = widget.tableData[index].tableRow.first; + return ScrollParent( widget.scrollController, - InkWell( - onTap: () { - if (data.callBack != null) { - data.callBack!(data); - } - }, - child: Container( - decoration: BoxDecoration( - border: Border( - left: tableCellBorder, - bottom: tableCellBorder, - right: tableCellBorder, - )), - child: Text( - ApplicationLocalizations.of(context) - .translate(widget.tableData[index].tableRow.first.label), - style: widget.tableData[index].tableRow.first.style ?? - TextStyle(color: Theme.of(context).primaryColor), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + InkWell( + onTap: () { + if (data.callBack != null) { + data.callBack!(data); + } + }, + child: Container( + decoration: BoxDecoration( + border: Border( + left: tableCellBorder, + bottom: tableCellBorder, + right: tableCellBorder, + )), + child: Text( + ApplicationLocalizations.of(context).translate( + widget.tableData[index].tableRow.first.label), + style: widget.tableData[index].tableRow.first.style ?? + TextStyle(color: Theme.of(context).primaryColor), + ), + width: showLeadger ? widget.leftColumnWidth * 0.55 : widget.leftColumnWidth, + height: + widget.tableData[index].tableRow.first.label.length > 28 + ? columnRowIncreasedHeight(index) + : columnRowFixedHeight, + padding: + EdgeInsets.only(left: 17, right: 5, top: 6, bottom: 6), + alignment: Alignment.centerLeft, + ), ), - width: widget.leftColumnWidth, - height: widget.tableData[index].tableRow.first.label.length > 28 - ? columnRowIncreasedHeight(index) - : columnRowFixedHeight, - padding: EdgeInsets.only(left: 17, right: 5, top: 6, bottom: 6), - alignment: Alignment.centerLeft, - ), + if(showLeadger) + Tooltip( + message: '${i18.dashboard.LEDGER_REPORTS}', + + child: IconButton(onPressed: () { + if (data.iconButtonCallBack != null) { + data.iconButtonCallBack!(data); + } + }, icon: Icon(Icons.insert_chart_outlined)), + ) + ], )); }); } @@ -188,7 +215,7 @@ class _BillsTable extends State { var data = widget.tableData[index].tableRow[i ?? 0]; if (i != null) { return InkWell( - onTap: (){ + onTap: () { data.callBack!(data); }, child: Container( @@ -242,20 +269,13 @@ class _BillsTable extends State { return LayoutBuilder(builder: (context, constraints) { var list = []; for (int i = 1; i < data.tableRow.length; i++) { - if (data.tableRow[i].label == "View") { - log("${data.tableRow[i].label}"); - list.add( - _generateColumnRow( - context, index, data.tableRow[i].label, constraints, - style: data.tableRow[i].style, i: i), - ); - } else { + list.add( _generateColumnRow( context, index, data.tableRow[i].label, constraints, style: data.tableRow[i].style), ); - } + } return Container( color: index % 2 == 0 ? const Color(0xffEEEEEE) : Colors.white, diff --git a/frontend/mgramseva/lib/model/reports/leadger_report.dart b/frontend/mgramseva/lib/model/reports/leadger_report.dart index 513000bab..6a1462958 100644 --- a/frontend/mgramseva/lib/model/reports/leadger_report.dart +++ b/frontend/mgramseva/lib/model/reports/leadger_report.dart @@ -1,33 +1,31 @@ class LedgerReport { - final List ledgerReport; - final String tenantName; - final String financialYear; - final LeadgeResponseInfo responseInfo; + final List? ledgerReport; + final String? tenantName; + final String? financialYear; + final LeadgeResponseInfo? responseInfo; LedgerReport({ - required this.ledgerReport, - required this.tenantName, - required this.financialYear, - required this.responseInfo, + this.ledgerReport, + this.tenantName, + this.financialYear, + this.responseInfo, }); factory LedgerReport.fromJson(Map json) { return LedgerReport( - ledgerReport: (json['ledgerReport'] as List) - .map((e) => LedgerData.fromJson(e)) + ledgerReport: (json['ledgerReport'] as List?) + ?.map((e) => LedgerData.fromJson(e)) .toList(), - tenantName: json['tenantName'], - financialYear: json['financialYear'], + tenantName: json['tenantName'] as String?, + financialYear: json['financialYear'] as String?, responseInfo: LeadgeResponseInfo.fromJson(json['responseInfo']), ); } } class LedgerData { - final Map months; - - LedgerData({required this.months}); - + final Map? months; + LedgerData({this.months}); factory LedgerData.fromJson(Map json) { final monthData = {}; json.forEach((key, value) { @@ -38,122 +36,122 @@ class LedgerData { } class MonthData { - final LeadgerDemand demand; - final List payment; + final LeadgerDemand? demand; + final List? payment; - MonthData({required this.demand, required this.payment}); + MonthData({this.demand, this.payment}); - factory MonthData.fromJson(Map json) { + factory MonthData.fromJson(Map json) { return MonthData( demand: LeadgerDemand.fromJson(json['demand']), - payment: (json['payment'] as List) - .map((e) => LeadgerPayment.fromJson(e)) + payment: (json['payment'] as List?) + ?.map((e) => LeadgerPayment.fromJson(e)) .toList(), ); } } class LeadgerDemand { - final String consumerName; - final String connectionNo; - final String oldConnectionNo; - final String userId; - final String month; - final int demandGenerationDate; - final String code; - final double monthlyCharges; - final double penalty; - final double totalForCurrentMonth; - final double previousMonthBalance; - final double totalDues; - final int dueDateOfPayment; - final int penaltyAppliedOnDate; + final String? consumerName; + final String? connectionNo; + final String? oldConnectionNo; + final String? userId; + final String? month; + final int? demandGenerationDate; + final String? code; + final double? monthlyCharges; + final double? penalty; + final double? totalForCurrentMonth; + final double? previousMonthBalance; + final double? totalDues; + final int? dueDateOfPayment; + final int? penaltyAppliedOnDate; LeadgerDemand({ - required this.consumerName, - required this.connectionNo, - required this.oldConnectionNo, - required this.userId, - required this.month, - required this.demandGenerationDate, - required this.code, - required this.monthlyCharges, - required this.penalty, - required this.totalForCurrentMonth, - required this.previousMonthBalance, - required this.totalDues, - required this.dueDateOfPayment, - required this.penaltyAppliedOnDate, + this.consumerName="", + this.connectionNo, + this.oldConnectionNo="", + this.userId="", + this.month, + this.demandGenerationDate, + this.code="", + this.monthlyCharges, + this.penalty, + this.totalForCurrentMonth, + this.previousMonthBalance, + this.totalDues, + this.dueDateOfPayment, + this.penaltyAppliedOnDate, }); factory LeadgerDemand.fromJson(Map json) { return LeadgerDemand( - consumerName: json['consumerName'], - connectionNo: json['connectionNo'], - oldConnectionNo: json['oldConnectionNo'], - userId: json['userId'], - month: json['month'], - demandGenerationDate: json['demandGenerationDate'], - code: json['code'], - monthlyCharges: json['monthlyCharges'].toDouble(), - penalty: json['penalty'].toDouble(), - totalForCurrentMonth: json['totalForCurrentMonth'].toDouble(), - previousMonthBalance: json['previousMonthBalance'].toDouble(), - totalDues: json['totalDues'].toDouble(), - dueDateOfPayment: json['dueDateOfPayment'], - penaltyAppliedOnDate: json['penaltyAppliedOnDate'], + consumerName: json['consumerName'] as String?, + connectionNo: json['connectionNo'] as String?, + oldConnectionNo: json['oldConnectionNo'] as String?, + userId: json['userId'] as String?, + month: json['month'] as String?, + demandGenerationDate: json['demandGenerationDate'] as int?, + code: json['code'] as String?, + monthlyCharges: json['monthlyCharges'] as double?, + penalty: json['penalty'] as double?, + totalForCurrentMonth: json['totalForCurrentMonth'] as double?, + previousMonthBalance: json['previousMonthBalance'] as double?, + totalDues: json['totalDues'] as double?, + dueDateOfPayment: json['dueDateOfPayment'] as int?, + penaltyAppliedOnDate: json['penaltyAppliedOnDate'] as int?, ); } } class LeadgerPayment { final dynamic paymentCollectionDate; - final String receiptNo; - final double amountPaid; - final double balanceLeft; + final String? receiptNo; + final double? amountPaid; + final double? balanceLeft; LeadgerPayment({ - required this.paymentCollectionDate, - required this.receiptNo, - required this.amountPaid, - required this.balanceLeft, + this.paymentCollectionDate, + this.receiptNo, + this.amountPaid, + this.balanceLeft, }); factory LeadgerPayment.fromJson(Map json) { return LeadgerPayment( paymentCollectionDate: json['paymentCollectionDate'], - receiptNo: json['receiptNo'], - amountPaid: json['amountPaid'].toDouble(), - balanceLeft: json['balanceLeft'].toDouble(), + receiptNo: json['receiptNo'] as String?, + amountPaid: json['amountPaid'] as double?, + balanceLeft: json['balanceLeft'] as double?, ); } } class LeadgeResponseInfo { - final String apiId; - final String ver; + final String? apiId; + final String? ver; final dynamic ts; - final String resMsgId; - final String msgId; - final String status; + final String? resMsgId; + final String? msgId; + final String? status; LeadgeResponseInfo({ - required this.apiId, - required this.ver, - required this.ts, - required this.resMsgId, - required this.msgId, - required this.status, + this.apiId, + this.ver, + this.ts, + this.resMsgId, + this.msgId, + this.status, }); factory LeadgeResponseInfo.fromJson(Map json) { return LeadgeResponseInfo( - apiId: json['apiId'], - ver: json['ver'], + apiId: json['apiId'] as String?, + ver: json['ver'] as String?, ts: json['ts'], - resMsgId: json['resMsgId'], - msgId: json['msgId'], - status: json['status'], + resMsgId: json['resMsgId'] as String?, + msgId: json['msgId'] as String?, + status: json['status'] as String?, ); } } diff --git a/frontend/mgramseva/lib/providers/household_register_provider.dart b/frontend/mgramseva/lib/providers/household_register_provider.dart index 1724e53c8..a92b9a8d0 100644 --- a/frontend/mgramseva/lib/providers/household_register_provider.dart +++ b/frontend/mgramseva/lib/providers/household_register_provider.dart @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; import 'package:mgramseva/model/connection/water_connection.dart'; import 'package:mgramseva/model/connection/water_connections.dart'; import 'package:mgramseva/providers/common_provider.dart'; +import 'package:mgramseva/providers/reports_provider.dart'; import 'package:mgramseva/repository/search_connection_repo.dart'; import 'package:mgramseva/routers/routers.dart'; import 'package:mgramseva/screeens/household_register/household_pdf_creator.dart'; @@ -241,7 +242,7 @@ class HouseholdRegisterProvider with ChangeNotifier { callBack: onSort), TableHeader(i18.householdRegister.ACTIVE_INACTIVE, isSortingRequired: false, apiKey: 'leadgerReport'), - TableHeader("Ledger", apiKey: '/viewLeadger') + // TableHeader("Ledger", apiKey: '/viewLeadger') ]; List get collectionHeaderListOLd => [ TableHeader(i18.common.CONNECTION_ID, @@ -327,9 +328,6 @@ class HouseholdRegisterProvider with ChangeNotifier { } TableDataRow getCollectionRow(WaterConnection connection) { - var commonProvider = Provider.of( - navigatorKey.currentContext!, - listen: false); String? name = truncateWithEllipsis(connection.connectionHolders?.first.name ?? 'NA'); String? fatherName = truncateWithEllipsis( @@ -338,16 +336,9 @@ class HouseholdRegisterProvider with ChangeNotifier { TableData( '${connection.connectionNo?.split('/').first ?? ''}/...${connection.connectionNo?.split('/').last ?? ''} ${connection.connectionType == 'Metered' ? '- M' : ''}', callBack: onClickOfCollectionNo, + iconButtonCallBack: viewLeadger, apiKey: connection.connectionNo), - // TableData( - // '${commonProvider.userDetails?.selectedtenant?.city?.code ?? 'NA'}', - // ), - // TableData( - // '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(connection.tenantId ?? 'NA')}', - // ), - // TableData( - // '${connection.tenantId ?? 'NA'}', - // ), + TableData( '${name ?? 'NA'}', ), @@ -419,15 +410,6 @@ class HouseholdRegisterProvider with ChangeNotifier { Constants.CONNECTION_STATUS.last ? ColorCodes.ACTIVE_COL : ColorCodes.INACTIVE_COL)), - TableData( - '${'View'}', - apiKey: "viewLeadgerKey", - callBack: viewLeadger, - style: TextStyle( - decoration: TextDecoration.underline, - color: Colors.blue - ), - ), ]); } @@ -443,14 +425,12 @@ class HouseholdRegisterProvider with ChangeNotifier { } viewLeadger(TableData tableData) { log("Call Ledger View Here"); + var waterConnection = waterConnectionsDetails?.waterConnection + ?.firstWhere((element) => element.connectionNo == tableData.apiKey); Navigator.pushNamed(navigatorKey.currentContext!, Routes.LEDGER_REPORTS, arguments: { - 'waterconnections': waterConnectionsDetails?.waterConnection?.first, + 'waterconnections': waterConnection, }); - - - - } onSort(TableHeader header) { diff --git a/frontend/mgramseva/lib/providers/reports_provider.dart b/frontend/mgramseva/lib/providers/reports_provider.dart index 58f9c583a..081e7e8da 100644 --- a/frontend/mgramseva/lib/providers/reports_provider.dart +++ b/frontend/mgramseva/lib/providers/reports_provider.dart @@ -1,8 +1,10 @@ import 'dart:async'; +import 'dart:convert'; import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:mgramseva/model/reports/InactiveConsumerReportData.dart'; +import 'package:mgramseva/model/reports/leadger_report.dart'; import 'package:mgramseva/model/reports/vendor_report_data.dart'; import 'package:provider/provider.dart'; import 'package:syncfusion_flutter_xlsio/xlsio.dart'; @@ -35,15 +37,18 @@ class ReportsProvider with ChangeNotifier { var selectedBillYear; var selectedBillPeriod; var selectedBillCycle; + var consumerCode = ''; var billingyearCtrl = TextEditingController(); var billingcycleCtrl = TextEditingController(); List? demandreports; + List? ledgerReport; List? collectionreports; List? inactiveconsumers; List? expenseBillReportData; List? vendorReportData; WaterConnectionCountResponse? waterConnectionCount; BillsTableData genericTableData = BillsTableData([], []); + int limit = 10; int offset = 1; @@ -54,6 +59,7 @@ class ReportsProvider with ChangeNotifier { billingcycleCtrl.clear(); billingyearCtrl.clear(); demandreports = []; + ledgerReport = []; collectionreports = []; inactiveconsumers = []; expenseBillReportData = []; @@ -65,8 +71,15 @@ class ReportsProvider with ChangeNotifier { genericTableData = BillsTableData([], []); notifyListeners(); } - void updateDefaultDate() { - + void updateConsumerCode(val) { + consumerCode = val; + notifyListeners(); + } + + + + void updateDefaultDate(){ + onChangeOfBillYear(getFinancialYearListDropdown(billingYearList).first); } dispose() { @@ -86,6 +99,22 @@ class ReportsProvider with ChangeNotifier { TableHeader(i18.common.CORE_ADVANCE), TableHeader(i18.billDetails.TOTAL_AMOUNT), ]; + List get leadgerHeaderList => [ + TableHeader(i18.common.LEDGER_MONTH), + TableHeader( + i18.common.LEDGER_DEMAND_GENERATION_DATE), + TableHeader(i18.common.LEDGER_MONTHLY_CHARGE), + TableHeader(i18.common.LEDGER_PREV_MONTH_BALANCE), + TableHeader(i18.common.LEDGER_TOTAL_DUE), + TableHeader(i18.common.LEDGER_DUE_DATE_PAYMENT), + TableHeader(i18.common.LEDGER_DATE), + TableHeader(i18.common.LEDGER_RECIPET_NO), + TableHeader(i18.common.LEDGER_AMOUNT), + TableHeader(i18.common.LEDGER_BALANCE), + TableHeader(i18.common.LEDGER_PENALTY_APPLIED_ON_DATE), + TableHeader(i18.common.LEDGER_PENALTY), + TableHeader(i18.common.LEDGER_BALANCE_FOR_THE_MONH), + ]; List get collectionHeaderList => [ TableHeader(i18.common.CONNECTION_ID), @@ -148,6 +177,42 @@ class ReportsProvider with ChangeNotifier { {isExcel = false}) { return list.map((e) => getDemandRow(e, isExcel: isExcel)).toList(); } + List getLedgerData(List list, + {isExcel = false}) { + return list.map((e) => getLedgerRow(e, isExcel: isExcel)).toList(); + } + + +String formatYearMonth(String inputString) { + final length = inputString.length; + if (length < 4) { + return inputString; // Return the original string if length is less than 4 + } else { + return inputString.substring(0, length - 4) + ' - ' + inputString.substring(length - 4); + } +} + + TableDataRow getLedgerRow(LedgerData data, {bool isExcel = false}) { + return TableDataRow([ + TableData( + formatYearMonth('${data.months?.values.first.demand?.month}'), + ), + TableData( + '${DateFormats.leadgerTimeStampToDate(data.months?.values.first.demand?.demandGenerationDate)}'), + TableData('₹ ${data.months?.values.first.demand?.monthlyCharges}'), + TableData('₹ ${data.months?.values.first.demand?.previousMonthBalance}'), + TableData('₹ ${data.months?.values.first.demand?.totalDues}'), + TableData('${DateFormats.leadgerTimeStampToDate(data.months?.values.first.demand?.dueDateOfPayment)}'), + TableData('${DateFormats.leadgerTimeStampToDate( data.months?.values.first.demand?.demandGenerationDate)}'), + TableData('${data.months?.values.first.payment?.first.receiptNo}'), + TableData('₹ ${data.months?.values.first.payment?.first.amountPaid}'), + TableData('₹ ${data.months?.values.first.demand?.previousMonthBalance}'), + TableData('${DateFormats.leadgerTimeStampToDate(data.months?.values.first.demand?.penaltyAppliedOnDate)}'), + TableData('₹ ${data.months?.values.first.demand?.penalty}'), + TableData('₹ ${data.months?.values.first.payment?.first.balanceLeft}'), + ]); + } + TableDataRow getDemandRow(BillReportData data, {bool isExcel = false}) { String? name = CommonMethods.truncateWithEllipsis(20, data.consumerName!); @@ -265,6 +330,11 @@ class ReportsProvider with ChangeNotifier { notifyListeners(); } + updateSelectedBillYear(val){ + selectedBillYear = val; + notifyListeners(); + } + void onChangeOfBillYear(val) { selectedBillYear = val; billingyearCtrl.text = val.toString(); @@ -272,6 +342,7 @@ class ReportsProvider with ChangeNotifier { selectedBillCycle = null; selectedBillPeriod = null; demandreports = []; + ledgerReport = []; collectionreports = []; inactiveconsumers = []; expenseBillReportData = []; @@ -293,6 +364,7 @@ class ReportsProvider with ChangeNotifier { .toString(), dateFormat: "dd/MM/yyyy"); demandreports = []; + ledgerReport = []; collectionreports = []; inactiveconsumers = []; expenseBillReportData = []; @@ -443,40 +515,42 @@ class ReportsProvider with ChangeNotifier { 'tenantId': commonProvider.userDetails!.selectedtenant!.code, 'offset': '${offset - 1}', 'limit': '${download ? -1 : limit}', - // 'consumercode':'${}' - 'year':selectedBillYear + 'consumercode':consumerCode, + 'year':selectedBillYear.financialYear }; - var response = await ReportsRepo().fetchBillReport(params); + var response = await ReportsRepo().fetchLedgerReport(params); if (response != null) { - demandreports = response; + ledgerReport = response; if (download) { generateExcel( demandHeaderList .map((e) => '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(e.label)}') .toList(), - getDemandsData(demandreports!, isExcel: true) + getLedgerData(ledgerReport!, isExcel: true) .map>( (e) => e.tableRow.map((e) => e.label).toList()) .toList() ?? [], title: - 'DemandReport_${commonProvider.userDetails?.selectedtenant?.code?.substring(3)}_${selectedBillPeriod.toString().replaceAll('/', '_')}', + 'LedgerReport_${commonProvider.userDetails?.selectedtenant?.code?.substring(3)}_${selectedBillPeriod.toString().replaceAll('/', '_')}', optionalData: [ - 'Demand Report', + 'Ledger Report', '$selectedBillPeriod', '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(commonProvider.userDetails!.selectedtenant!.code!)}', '${commonProvider.userDetails?.selectedtenant?.code?.substring(3)}', 'Downloaded On ${DateFormats.timeStampToDate(DateTime.now().millisecondsSinceEpoch, format: 'dd/MMM/yyyy')}' ]); } else { - if (demandreports != null && demandreports!.isNotEmpty) { + if (ledgerReport != null && ledgerReport!.isNotEmpty) { this.limit = limit; this.offset = offset; this.genericTableData = BillsTableData( - demandHeaderList, getDemandsData(demandreports!)); + leadgerHeaderList, getLedgerData(ledgerReport!)); + } } + streamController.add(response); callNotifier(); } else { @@ -485,7 +559,7 @@ class ReportsProvider with ChangeNotifier { } callNotifier(); } catch (e, s) { - demandreports = []; + ledgerReport = []; ErrorHandler().allExceptionsHandler(navigatorKey.currentContext!, e, s); streamController.addError('error'); callNotifier(); diff --git a/frontend/mgramseva/lib/repository/reports_repo.dart b/frontend/mgramseva/lib/repository/reports_repo.dart index cc6559857..ec8cce202 100644 --- a/frontend/mgramseva/lib/repository/reports_repo.dart +++ b/frontend/mgramseva/lib/repository/reports_repo.dart @@ -1,4 +1,8 @@ +import 'dart:convert'; +import 'dart:developer'; + import 'package:mgramseva/model/reports/expense_bill_report_data.dart'; +import 'package:mgramseva/model/reports/leadger_report.dart'; import 'package:mgramseva/model/reports/vendor_report_data.dart'; import 'package:mgramseva/services/urls.dart'; import 'package:mgramseva/services/base_service.dart'; @@ -51,6 +55,45 @@ class ReportsRepo extends BaseService{ return billreports; } + Future?> fetchLedgerReport(Map params, + [String? token]) async { + var commonProvider = Provider.of( + navigatorKey.currentContext!, + listen: false); + List? ledgerReports; + final requestInfo = RequestInfo( + APIConstants.API_MODULE_NAME, + APIConstants.API_VERSION, + APIConstants.API_TS, + '_get', + APIConstants.API_DID, + APIConstants.API_KEY, + APIConstants.API_MESSAGE_ID, + commonProvider.userDetails?.accessToken, + commonProvider.userDetails?.userRequest?.toJson()); + var res = await makeRequest( + url: Url.LEDGER_REPORT, + queryParameters: params, + body: { + "RequestInfo":requestInfo + }, + method: RequestType.POST); + + if (res != null && res['ledgerReport'] != null) { + try { + ledgerReports = []; + res['ledgerReport'].forEach((val){ + ledgerReports?.add(LedgerData.fromJson(val)); + }); + } catch (e) { + print(e); + ledgerReports = null; + } + } + return ledgerReports; + } + + Future?> fetchCollectionReport(Map params, [String? token]) async { var commonProvider = Provider.of( diff --git a/frontend/mgramseva/lib/screeens/leadger_report/leadger_view.dart b/frontend/mgramseva/lib/screeens/leadger_report/leadger_view.dart index 14aeb652b..c87956e98 100644 --- a/frontend/mgramseva/lib/screeens/leadger_report/leadger_view.dart +++ b/frontend/mgramseva/lib/screeens/leadger_report/leadger_view.dart @@ -78,27 +78,28 @@ class _LeadgerReportView extends State } else { reportProvider.clearTableData(); reportProvider.getLeadgerReport(); - widget.onViewClick(true, i18.dashboard.BILL_REPORT); + widget.onViewClick(true, i18.dashboard.LEDGER_REPORTS); } }, - key: Keys.billReport.BILL_REPORT_VIEW_BUTTON, + key: Keys.billReport.LEDGER_REPORT_VIEW_BUTTON, ), ), - // SizedBox( - // width: 10, - // ), - // TextButton.icon( - // onPressed: () { - // if (reportProvider.selectedBillPeriod == null) { - // Notifiers.getToastMessage( - // context, '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', 'ERROR'); - // } else { - // reportProvider.getDemandReport(download: true); - // } - // }, - // icon: Icon(Icons.download_sharp), - // label: Text(ApplicationLocalizations.of(context) - // .translate(i18.common.CORE_DOWNLOAD))), + + SizedBox( + width: 10, + ), + TextButton.icon( + onPressed: () { + if (reportProvider.selectedBillYear == null) { + Notifiers.getToastMessage( + context, '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', 'ERROR'); + } else { + reportProvider.getLeadgerReport(download: true); + } + }, + icon: Icon(Icons.download_sharp), + label: Text(ApplicationLocalizations.of(context) + .translate(i18.common.CORE_DOWNLOAD))), ], ), ], diff --git a/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart b/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart index 2cb5d5d0d..588fb77e4 100644 --- a/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart +++ b/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart @@ -3,11 +3,14 @@ import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:mgramseva/model/connection/water_connection.dart'; +import 'package:mgramseva/routers/routers.dart'; import 'package:mgramseva/screeens/leadger_report/leadger_view.dart'; import 'package:mgramseva/screeens/reports/expense_bill_report.dart'; import 'package:mgramseva/screeens/reports/inactive_consumer_report.dart'; +import 'package:mgramseva/screeens/reports/leadger_table.dart'; import 'package:mgramseva/screeens/reports/vendor_report.dart'; import 'package:mgramseva/screeens/reports/view_table.dart'; +import 'package:mgramseva/widgets/sub_label.dart'; import 'package:provider/provider.dart'; import '../../providers/reports_provider.dart'; @@ -27,19 +30,21 @@ import '../reports/collection_report.dart'; class LeadgerReport extends StatefulWidget { final WaterConnection? waterConnection; - LeadgerReport({Key? key,this.waterConnection}) : super(key: key); - + LeadgerReport({Key? key, this.waterConnection}) : super(key: key); + @override State createState() { return _LeadgerReport(); } } -class _LeadgerReport extends State with SingleTickerProviderStateMixin { +class _LeadgerReport extends State + with SingleTickerProviderStateMixin { ScrollController scrollController = ScrollController(); var takeScreenShot = false; bool viewTable = false; String tableTitle = 'Table Data'; + // WaterConnection? waterConnectionItem; @override void dispose() { @@ -60,19 +65,28 @@ class _LeadgerReport extends State with SingleTickerProviderState var reportsProvider = Provider.of( navigatorKey.currentContext!, listen: false); + if (widget.waterConnection == null) { + Navigator.pushNamed(context, Routes.HOUSEHOLD_REGISTER, arguments: {}); + } reportsProvider.getFinancialYearList(); reportsProvider.clearBillingSelection(); reportsProvider.clearBuildTableData(); reportsProvider.clearTableData(); - /*start-from here 3333*/ - reportsProvider.updateDefaultDate(); - + Future.delayed(Duration(milliseconds: 500), () async { + reportsProvider.updateConsumerCode(widget.waterConnection?.connectionNo); + var selectedItem = reportsProvider + .getFinancialYearListDropdown(reportsProvider.billingYearList); + reportsProvider.updateSelectedBillYear(selectedItem.first); + reportsProvider.getLeadgerReport(); + showTable(true, i18.dashboard.LEDGER_REPORTS); + }); } showTable(bool status, String title) { setState(() { viewTable = status; tableTitle = title; + // waterConnectionItem = widget.waterConnection; }); } @@ -90,7 +104,7 @@ class _LeadgerReport extends State with SingleTickerProviderState } @override - Widget build(BuildContext context) { + Widget build(BuildContext context) { // TODO: implement build return Scaffold( appBar: CustomAppBar(), @@ -129,9 +143,10 @@ class _LeadgerReport extends State with SingleTickerProviderState }); }, ), - ViewTable( + LeadgerTable( tableTitle: tableTitle, scrollController: scrollController, + waterConnection: widget.waterConnection, ), ], )) @@ -163,33 +178,34 @@ class _LeadgerReport extends State with SingleTickerProviderState child: Column( children: [ Consumer( - builder: (_, reportProvider, child) => - Container( - child: Column( - children: [ - SelectFieldBuilder( - i18.demandGenerate - .BILLING_YEAR_LABEL, - reportProvider - .selectedBillYear, - '', - '', - reportProvider - .onChangeOfBillYear, - reportProvider - .getFinancialYearListDropdown( - reportProvider - .billingYearList), - true, - readOnly: false, - controller: reportProvider - .billingyearCtrl, - key: Keys.billReport - .BILL_REPORT_BILLING_YEAR, itemAsString: (i) =>"${ApplicationLocalizations.of(context).translate(i.financialYear)}", - ), - ], - ), - )), + builder: (_, reportProvider, child) { + return Container( + child: Column( + children: [ + SelectFieldBuilder( + i18.demandGenerate + .BILLING_YEAR_LABEL, + reportProvider.selectedBillYear, + '', + '', + reportProvider.onChangeOfBillYear, + reportProvider + .getFinancialYearListDropdown( + reportProvider + .billingYearList), + true, + readOnly: false, + controller: reportProvider + .billingyearCtrl, + key: Keys.billReport + .BILL_REPORT_BILLING_YEAR, + itemAsString: (i) => + "${ApplicationLocalizations.of(context).translate(i.financialYear)}", + ), + ], + ), + ); + }), ], ), ), @@ -206,8 +222,17 @@ class _LeadgerReport extends State with SingleTickerProviderState padding: const EdgeInsets.only(bottom: 10.0), child: Column( children: [ + Consumer( + builder: (_, reportProvider, child) { + return SubLabelText( + "${i18.common.LEDGER_CUSTOMER_NAME} : ${widget.waterConnection?.connectionHolders?.first.name}"); + }), + Consumer( + builder: (_, reportProvider, child) { + return SubLabelText( + "${i18.common.LEDGER_CONN_ID} : ${widget.waterConnection?.connectionNo}"); + }), LeadgerReportView(onViewClick: showTable), - ], ), ), diff --git a/frontend/mgramseva/lib/screeens/reports/leadger_table.dart b/frontend/mgramseva/lib/screeens/reports/leadger_table.dart new file mode 100644 index 000000000..8f647bbef --- /dev/null +++ b/frontend/mgramseva/lib/screeens/reports/leadger_table.dart @@ -0,0 +1,96 @@ +import 'package:flutter/material.dart'; +import 'package:mgramseva/model/connection/water_connection.dart'; +import 'package:mgramseva/utils/constants/i18_key_constants.dart'; +import 'package:provider/provider.dart'; +import '../../providers/reports_provider.dart'; +import '../../utils/constants.dart'; +import '../../utils/date_formats.dart'; +import '../../utils/global_variables.dart'; +import '../../utils/localization/application_localizations.dart'; +import '../../widgets/label_text.dart'; +import '../../widgets/pagination.dart'; +import '../../widgets/sub_label.dart'; +import 'generic_report_table.dart'; + +class LeadgerTable extends StatelessWidget { + final ScrollController scrollController; + final String tableTitle; + final WaterConnection? waterConnection; + LeadgerTable({required this.tableTitle, required this.scrollController,this.waterConnection}); + + @override + Widget build(BuildContext context) { + return LayoutBuilder(builder: (context, constraints) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Card( + margin: EdgeInsets.only(bottom: 2), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(0.0), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + + LabelText( + '${ApplicationLocalizations.of(context).translate(tableTitle)}'), + + + Consumer( + builder: (_, reportProvider, child) { + return SubLabelText("${i18.common.LEDGER_CUSTOMER_NAME} : ${waterConnection?.connectionHolders?.first.name}"); + } + ), + + Consumer( + builder: (_, reportProvider, child) { + return SubLabelText("${i18.common.LEDGER_CONN_ID} : ${waterConnection?.connectionNo}"); + } + ), + ])), + SizedBox( + height: 30, + ), + Container( + child: + Consumer(builder: (_, reportProvider, child) { + var width = constraints.maxWidth < 760 + ? 115.0 + : (constraints.maxWidth / 6); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GenericReportTable( + reportProvider.genericTableData, + scrollController: scrollController, + ), + Container( + width: width * + reportProvider + .genericTableData.tableHeaders.length + + 2, + child: Visibility( + visible: + reportProvider.genericTableData.tableData.isNotEmpty, + child: Pagination( + limit: reportProvider.limit, + offSet: reportProvider.offset, + callBack: (pageResponse) => + reportProvider.onChangeOfPageLimit( + pageResponse, tableTitle, context), + isTotalCountVisible: false, + totalCount: + reportProvider.genericTableData.tableData.length, + ), + ), + ) + ], + ); + }), + ), + ], + ); + }); + } +} diff --git a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart index 6b0a3780b..b2b632c7a 100644 --- a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart +++ b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart @@ -186,6 +186,25 @@ class Common { String get FILE_SIZE => 'FILE_SIZE'; String get CHOOSE_AN_ACTION => 'CHOOSE_AN_ACTION'; + // Leadger + String get LEDGER_MONTH => 'LEDGER_MONTH'; + String get LEDGER_DEMAND_GENERATION_DATE => 'LEDGER_DEMAND_GENERATION_DATE'; + String get LEDGER_MONTHLY_CHARGE => 'LEDGER_MONTHLY_CHARGE'; + String get LEDGER_PREV_MONTH_BALANCE => 'LEDGER_PREV_MONTH_BALANCE'; + String get LEDGER_TOTAL_DUE => 'LEDGER_TOTAL_DUE'; + String get LEDGER_DUE_DATE_PAYMENT => 'LEDGER_DUE_DATE_PAYMENT'; + String get LEDGER_DATE => 'LEDGER_DATE'; + String get LEDGER_RECIPET_NO => 'LEDGER_RECIPET_NO'; + String get LEDGER_AMOUNT => 'LEDGER_AMOUNT'; + String get LEDGER_BALANCE => 'LEDGER_BALANCE'; + String get LEDGER_PENALTY_APPLIED_ON_DATE => 'LEDGER_PENALTY_APPLIED_ON_DATE'; + String get LEDGER_PENALTY => 'LEDGER_PENALTY'; + String get LEDGER_BALANCE_FOR_THE_MONH => 'LEDGER_BALANCE_FOR_THE_MONH'; + String get LEDGER_CUSTOMER_NAME => 'LEDGER_CUSTOMER_NAME'; + String get LEDGER_CONN_ID => 'LEDGER_CONN_ID'; + // Leadger + + ///Months String get JAN => 'JAN'; String get FEB => 'FEB '; diff --git a/frontend/mgramseva/lib/utils/date_formats.dart b/frontend/mgramseva/lib/utils/date_formats.dart index ef1844984..ae751def0 100644 --- a/frontend/mgramseva/lib/utils/date_formats.dart +++ b/frontend/mgramseva/lib/utils/date_formats.dart @@ -43,6 +43,17 @@ class DateFormats { } } + static String leadgerTimeStampToDate(int? timeInMillis, {String? format}) { + if (timeInMillis == null || timeInMillis == 0) return '-'; + try { + var date = DateTime.fromMillisecondsSinceEpoch(timeInMillis); + return DateFormat('dd-MMM-yyyy').format(date); + + } catch (e) { + return ''; + } +} + static String getTime(String date) { if (date.trim().isEmpty) return ''; try { diff --git a/frontend/mgramseva/lib/utils/models.dart b/frontend/mgramseva/lib/utils/models.dart index 210843c1d..2d2e30f9a 100644 --- a/frontend/mgramseva/lib/utils/models.dart +++ b/frontend/mgramseva/lib/utils/models.dart @@ -78,7 +78,8 @@ class TableData { final TextStyle? style; final String? apiKey; ValueChanged? callBack; - TableData(this.label, {this.style, this.callBack, this.apiKey}); + ValueChanged? iconButtonCallBack; + TableData(this.label, {this.style, this.callBack,this. iconButtonCallBack, this.apiKey}); } class SortBy { diff --git a/frontend/mgramseva/lib/utils/testing_keys/testing_keys.dart b/frontend/mgramseva/lib/utils/testing_keys/testing_keys.dart index 1d46ec94c..4f247a43a 100644 --- a/frontend/mgramseva/lib/utils/testing_keys/testing_keys.dart +++ b/frontend/mgramseva/lib/utils/testing_keys/testing_keys.dart @@ -135,6 +135,7 @@ class HouseholdKeys { class BillReportKeys { const BillReportKeys(); Key get BILL_REPORT_VIEW_BUTTON => Key("bill_report_view_button"); + Key get LEDGER_REPORT_VIEW_BUTTON => Key("bill_report_view_button"); Key get BILL_REPORT_DOWNLOAD_BUTTON => Key("bill_report_download_button"); Key get COLLECTION_REPORT_VIEW_BUTTON => Key("collection_report_view_button"); Key get INACTIVE_CONSUMER_REPORT_VIEW_BUTTON => diff --git a/frontend/mgramseva/lib/widgets/select_field_builder.dart b/frontend/mgramseva/lib/widgets/select_field_builder.dart index d7b74773d..f64556daa 100644 --- a/frontend/mgramseva/lib/widgets/select_field_builder.dart +++ b/frontend/mgramseva/lib/widgets/select_field_builder.dart @@ -159,6 +159,7 @@ class SelectFieldBuilderState extends State { return DropdownSearch( key: widget.suggestionKey, selectedItem: widget.value, + itemAsString: widget.itemAsString, items: widget.options, onChanged: widget.widget, From d96d49623abc760ca53704d73b43c17c0e69a0d8 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 1 Aug 2024 14:17:46 +0530 Subject: [PATCH 081/133] leadger report update --- frontend/mgramseva/lib/providers/reports_provider.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/mgramseva/lib/providers/reports_provider.dart b/frontend/mgramseva/lib/providers/reports_provider.dart index 081e7e8da..d20d86736 100644 --- a/frontend/mgramseva/lib/providers/reports_provider.dart +++ b/frontend/mgramseva/lib/providers/reports_provider.dart @@ -523,7 +523,7 @@ String formatYearMonth(String inputString) { ledgerReport = response; if (download) { generateExcel( - demandHeaderList + leadgerHeaderList .map((e) => '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(e.label)}') .toList(), @@ -533,10 +533,10 @@ String formatYearMonth(String inputString) { .toList() ?? [], title: - 'LedgerReport_${commonProvider.userDetails?.selectedtenant?.code?.substring(3)}_${selectedBillPeriod.toString().replaceAll('/', '_')}', + 'LedgerReport_${commonProvider.userDetails?.selectedtenant?.code?.substring(3)}_${selectedBillYear.toString().replaceAll('/', '_')}', optionalData: [ 'Ledger Report', - '$selectedBillPeriod', + '$selectedBillYear', '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(commonProvider.userDetails!.selectedtenant!.code!)}', '${commonProvider.userDetails?.selectedtenant?.code?.substring(3)}', 'Downloaded On ${DateFormats.timeStampToDate(DateTime.now().millisecondsSinceEpoch, format: 'dd/MMM/yyyy')}' From 2d6b83f7fdd4d115746192994500f18279e8e29c Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 1 Aug 2024 15:29:05 +0530 Subject: [PATCH 082/133] ledger pagination --- frontend/mgramseva/lib/providers/reports_provider.dart | 5 ++++- .../mgramseva/lib/screeens/leadger_report/ledger_report.dart | 2 -- frontend/mgramseva/lib/screeens/reports/leadger_table.dart | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/mgramseva/lib/providers/reports_provider.dart b/frontend/mgramseva/lib/providers/reports_provider.dart index d20d86736..0bce8ffe8 100644 --- a/frontend/mgramseva/lib/providers/reports_provider.dart +++ b/frontend/mgramseva/lib/providers/reports_provider.dart @@ -171,6 +171,9 @@ class ReportsProvider with ChangeNotifier { if (type == i18.dashboard.VENDOR_REPORT) { getVendorReport(limit: response.limit, offset: response.offset); } + if (type == i18.dashboard.LEDGER_REPORTS) { + getLeadgerReport(limit: response.limit, offset: response.offset); + } } List getDemandsData(List list, @@ -516,7 +519,7 @@ String formatYearMonth(String inputString) { 'offset': '${offset - 1}', 'limit': '${download ? -1 : limit}', 'consumercode':consumerCode, - 'year':selectedBillYear.financialYear + 'year':selectedBillYear.financialYear, }; var response = await ReportsRepo().fetchLedgerReport(params); if (response != null) { diff --git a/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart b/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart index 588fb77e4..4eaf8c29f 100644 --- a/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart +++ b/frontend/mgramseva/lib/screeens/leadger_report/ledger_report.dart @@ -44,7 +44,6 @@ class _LeadgerReport extends State var takeScreenShot = false; bool viewTable = false; String tableTitle = 'Table Data'; - // WaterConnection? waterConnectionItem; @override void dispose() { @@ -86,7 +85,6 @@ class _LeadgerReport extends State setState(() { viewTable = status; tableTitle = title; - // waterConnectionItem = widget.waterConnection; }); } diff --git a/frontend/mgramseva/lib/screeens/reports/leadger_table.dart b/frontend/mgramseva/lib/screeens/reports/leadger_table.dart index 8f647bbef..6e63239da 100644 --- a/frontend/mgramseva/lib/screeens/reports/leadger_table.dart +++ b/frontend/mgramseva/lib/screeens/reports/leadger_table.dart @@ -79,7 +79,7 @@ class LeadgerTable extends StatelessWidget { callBack: (pageResponse) => reportProvider.onChangeOfPageLimit( pageResponse, tableTitle, context), - isTotalCountVisible: false, + isTotalCountVisible: true, totalCount: reportProvider.genericTableData.tableData.length, ), From c0233a854c8fa8554f3b597ca2f9d2ba845679e3 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 1 Aug 2024 16:06:42 +0530 Subject: [PATCH 083/133] app config cleared --- frontend/mgramseva/lib/env/app_config.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/mgramseva/lib/env/app_config.dart b/frontend/mgramseva/lib/env/app_config.dart index e8eef9d25..94253b5b1 100644 --- a/frontend/mgramseva/lib/env/app_config.dart +++ b/frontend/mgramseva/lib/env/app_config.dart @@ -27,7 +27,9 @@ dynamic get apiBaseUrl { } Map devConstants = { - _baseUrl:"https://mgramseva-uat.psegs.in/" + _baseUrl: kIsWeb + ? (window.location.origin) + "/" + : const String.fromEnvironment('BASE_URL'), }; Map stageConstants = { From cf7e312170e647199b21313a6076001e26dbd189 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Thu, 1 Aug 2024 16:10:13 +0530 Subject: [PATCH 084/133] ISTE-229 --- .../repository/WaterDaoImpl.java | 7 +++- .../rowmapper/LedgerReportRowMapper.java | 40 +++++++------------ 2 files changed, 20 insertions(+), 27 deletions(-) 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 8316469ff..724429fbb 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 @@ -54,6 +54,9 @@ @Repository public class WaterDaoImpl implements WaterDao { + @Autowired + private MonthReportRowMapper monthReportRowMapper; + @Autowired private LedgerReportRowMapper ledgerReportRowMapper; @Autowired @@ -733,8 +736,8 @@ public List> getLedgerReport(String consumercode, String ten log.info("Query of ledger report:" + query + "and prepared statement" + preparedStatement); ledgerReportRowMapper.setTenantId(tenantId); ledgerReportRowMapper.setRequestInfo(requestInfoWrapper); - ledgerReportRowMapper.setStartDate(startDate); - ledgerReportRowMapper.setEndDate(endDate); + ledgerReportRowMapper.setStartYear(startYear); + ledgerReportRowMapper.setEndYear(endYear); ledgerReportRowMapper.setConsumerCode(consumercode); List> ledgerReportList= jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 2064b02c7..483bd8591 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -1,6 +1,7 @@ package org.egov.waterconnection.repository.rowmapper; import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.models.auth.In; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.egov.waterconnection.repository.ServiceRequestRepository; @@ -29,6 +30,7 @@ @Slf4j @Component +@Setter public class LedgerReportRowMapper implements ResultSetExtractor>> { @Autowired @@ -48,41 +50,29 @@ public class LedgerReportRowMapper implements ResultSetExtractor> extractData(ResultSet resultSet) throws SQLException, DataAccessException { List> monthlyRecordsList = new ArrayList<>(); Map ledgerReports = new HashMap<>(); - YearMonth startMonth=YearMonth.from(startDate); - YearMonth endMonth=YearMonth.now(); - YearMonth currentMonth=startMonth; + YearMonth startMonth = YearMonth.of(startYear, 4); + YearMonth endMonth; + YearMonth now = YearMonth.now(); + + if (startYear == now.getYear() || (startYear == now.getYear() - 1 && now.getMonthValue() <= 3)) { + endMonth = now; + } else { + endMonth = YearMonth.of(startYear + 1, 3); + } + + YearMonth currentMonth = startMonth; while (!currentMonth.isAfter(endMonth)) { String monthAndYear = currentMonth.format(DateTimeFormatter.ofPattern("MMMMyyyy")); From e665b86bcecdecd2612a0c1145177797bcf946ce Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Thu, 1 Aug 2024 16:12:42 +0530 Subject: [PATCH 085/133] ISTE-229 --- .../org/egov/waterconnection/repository/WaterDaoImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 724429fbb..a642dd7b8 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 @@ -54,8 +54,8 @@ @Repository public class WaterDaoImpl implements WaterDao { - @Autowired - private MonthReportRowMapper monthReportRowMapper; +// @Autowired +// private MonthReportRowMapper monthReportRowMapper; @Autowired private LedgerReportRowMapper ledgerReportRowMapper; From bdeb0fbb15d3df8cfd9767f4877c43ff4389dd02 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Thu, 1 Aug 2024 16:24:42 +0530 Subject: [PATCH 086/133] ISTE-229 --- .../org/egov/waterconnection/repository/WaterDaoImpl.java | 2 +- .../repository/rowmapper/LedgerReportRowMapper.java | 8 ++++---- .../egov/waterconnection/service/WaterServiceImpl.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) 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 a642dd7b8..093f6847b 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 @@ -692,7 +692,7 @@ public List getConsumersByPreviousMeterReading(Long return consumersDemandNotGeneratedList; } - public List> getLedgerReport(String consumercode, String tenantId, Integer limit, Integer offset, String year,RequestInfoWrapper requestInfoWrapper) { + public List> getLedgerReport(String consumercode, String tenantId, Integer offset, Integer limit, String year,RequestInfoWrapper requestInfoWrapper) { String[] years = year.split("-"); if (years.length != 2) { throw new IllegalArgumentException("Invalid fiscal year format"); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 483bd8591..1c7a1ee0b 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -75,7 +75,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce YearMonth currentMonth = startMonth; while (!currentMonth.isAfter(endMonth)) { - String monthAndYear = currentMonth.format(DateTimeFormatter.ofPattern("MMMMyyyy")); + String monthAndYear = currentMonth.format(DateTimeFormatter.ofPattern("MMMM yyyy")); LedgerReport ledgerReport = new LedgerReport(); ledgerReport.setDemand(new DemandLedgerReport()); ledgerReport.getDemand().setMonthAndYear(monthAndYear); @@ -87,7 +87,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce while (resultSet.next()) { Long dateLong = resultSet.getLong("enddate"); LocalDate date = Instant.ofEpochMilli(dateLong).atZone(ZoneId.systemDefault()).toLocalDate(); - String monthAndYear = date.format(DateTimeFormatter.ofPattern("MMMMyyyy")); + String monthAndYear = date.format(DateTimeFormatter.ofPattern("MMMM yyyy")); String code = resultSet.getString("code"); @@ -147,7 +147,7 @@ public int compare(Map o1, Map o2) { String monthAndYear1 = (String) o1.keySet().iterator().next(); String monthAndYear2 = (String) o2.keySet().iterator().next(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMMyyyy", Locale.ENGLISH); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM yyyy", Locale.ENGLISH); YearMonth yearMonth1 = YearMonth.parse(monthAndYear1, formatter); YearMonth yearMonth2 = YearMonth.parse(monthAndYear2, formatter); @@ -188,7 +188,7 @@ private void addPaymentToLedger(List> monthlyRecordList) { for (Payment payment : payments) { Long transactionDateLong = payment.getTransactionDate(); LocalDate transactionDate = Instant.ofEpochMilli(transactionDateLong).atZone(ZoneId.systemDefault()).toLocalDate(); - String transactionMonthAndYear = transactionDate.format(DateTimeFormatter.ofPattern("MMMMyyyy")); + String transactionMonthAndYear = transactionDate.format(DateTimeFormatter.ofPattern("MMMM yyyy")); if (ledgerReport.getDemand().getMonthAndYear().equals(transactionMonthAndYear)) { PaymentLedgerReport paymentLedgerReport = new PaymentLedgerReport(); paymentLedgerReport.setCollectionDate(transactionDateLong); 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 03de8182c..339ddd13c 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 @@ -867,7 +867,7 @@ public WaterConnectionResponse getConsumersWithDemandNotGenerated(String previou @Override public List> ledgerReport(String consumercode, String tenantId, Integer offset, Integer limit, String year,RequestInfoWrapper requestInfoWrapper) { - List> list = waterDaoImpl.getLedgerReport(consumercode, tenantId, limit, offset, year,requestInfoWrapper); + List> list = waterDaoImpl.getLedgerReport(consumercode, tenantId, offset, limit, year,requestInfoWrapper); return list; } } \ No newline at end of file From ffa1d4a972b4e29b7e2f41491b43d8603edbbea1 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 1 Aug 2024 16:28:28 +0530 Subject: [PATCH 087/133] Hide Leadger main menu --- frontend/mgramseva/lib/utils/constants.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/mgramseva/lib/utils/constants.dart b/frontend/mgramseva/lib/utils/constants.dart index 2e445c3c4..f33bdd7c1 100644 --- a/frontend/mgramseva/lib/utils/constants.dart +++ b/frontend/mgramseva/lib/utils/constants.dart @@ -104,11 +104,11 @@ class Constants { (i18.dashboard.CORE_REPORTS), Icons.assessment, Routes.REPORTS, {}), - HomeItem( - "LEDGER_REPORTS", - (i18.dashboard.LEDGER_REPORTS), - Icons.table_chart_rounded, - Routes.LEDGER_REPORTS, {}), + // HomeItem( + // "LEDGER_REPORTS", + // (i18.dashboard.LEDGER_REPORTS), + // Icons.table_chart_rounded, + // Routes.LEDGER_REPORTS, {}), ]; static List SERVICECATEGORY = [ From e6196c93ea133dc10bdb115dfdff073f6f817dc5 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Thu, 1 Aug 2024 18:14:54 +0530 Subject: [PATCH 088/133] ISTE-229 --- .../org/egov/waterconnection/repository/WaterDaoImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 093f6847b..bb772a7b8 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 @@ -740,7 +740,9 @@ public List> getLedgerReport(String consumercode, String ten ledgerReportRowMapper.setEndYear(endYear); ledgerReportRowMapper.setConsumerCode(consumercode); List> ledgerReportList= jdbcTemplate.query(query.toString(), preparedStatement.toArray(), ledgerReportRowMapper); - - return ledgerReportList; + int fromIndex = Math.min(newoffset, ledgerReportList.size()); + int toIndex = Math.min(fromIndex + newlimit, ledgerReportList.size()); + return ledgerReportList.subList(fromIndex, toIndex); +// return ledgerReportList; } } From f3947f664084fa8b5b672d9aab8d53bc325a72ca Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Fri, 2 Aug 2024 12:31:24 +0530 Subject: [PATCH 089/133] ISTE-189-FIX --- .../bill_generation_details_provider.dart | 383 ++++++++++++------ 1 file changed, 252 insertions(+), 131 deletions(-) diff --git a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart index 212fb95a8..962d65fcc 100644 --- a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart +++ b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart @@ -4,12 +4,14 @@ import 'package:flutter/material.dart'; import 'package:mgramseva/model/bill/bill_generation_details/bill_generation_details.dart'; import 'package:mgramseva/model/bill/billing.dart'; import 'package:mgramseva/model/connection/water_connection.dart'; +import 'package:mgramseva/model/demand/demand_list.dart'; import 'package:mgramseva/model/localization/language.dart'; import 'package:mgramseva/model/mdms/connection_type.dart'; import 'package:mgramseva/model/mdms/property_type.dart'; import 'package:mgramseva/model/mdms/tax_head_master.dart'; import 'package:mgramseva/model/mdms/tax_period.dart'; import 'package:mgramseva/model/success_handler.dart'; +import 'package:mgramseva/providers/household_details_provider.dart'; import 'package:mgramseva/repository/bill_generation_details_repo.dart'; import 'package:mgramseva/repository/billing_service_repo.dart'; import 'package:mgramseva/repository/core_repo.dart'; @@ -174,6 +176,7 @@ class BillGenerationProvider with ChangeNotifier { billGenerateDetails.billYear = selectedBillYear; notifyListeners(); } + void clearBillYear() { selectedBillYear = null; billGenerateDetails.billYear = null; @@ -182,6 +185,7 @@ class BillGenerationProvider with ChangeNotifier { selectedBillPeriod = null; notifyListeners(); } + void onChangeOfBillCycle(cycle) { var val = cycle['code']; DateTime result = DateTime.parse(val.toString()); @@ -210,7 +214,7 @@ class BillGenerationProvider with ChangeNotifier { 'consumerCode': bill.consumerCode, 'businessService': bill.businessService, 'tenantId': commonProvider.userDetails?.selectedtenant?.code, - 'connectionType':waterconnection.connectionType + 'connectionType': waterconnection.connectionType }; Navigator.pushNamed(context, Routes.HOUSEHOLD_DETAILS_COLLECT_PAYMENT, arguments: query); @@ -315,32 +319,74 @@ class BillGenerationProvider with ChangeNotifier { '${billList.bill!.first.billNumber.toString()}'), callBack: () => onClickOfCollectPayment(billList.bill!.first, context), - callBackDownload: () => commonProvider - .getFileFromPDFBillService({ - "Bill": [billList.bill!.first] - }, { - "key": waterconnection.connectionType == 'Metered' - ? "ws-bill" - : "ws-bill-nm", - "tenantId": - commonProvider.userDetails!.selectedtenant!.code, - }, billList.bill!.first.mobileNumber, billList.bill!.first, - "Download"), - callBackWhatsApp: () => commonProvider - .getFileFromPDFBillService({ - "Bill": [billList.bill!.first], - }, { - "key": waterconnection.connectionType == 'Metered' - ? "ws-bill" - : "ws-bill-nm", - "tenantId": - commonProvider.userDetails!.selectedtenant!.code, - }, billList.bill!.first.mobileNumber, billList.bill!.first, - "Share"), + callBackDownload: () async { + var hhp = Provider.of( + navigatorKey.currentContext!, + listen: false); + if (hhp.aggDemandItems == null) { + await BillingServiceRepository().fetchAggregateDemand({ + "tenantId": + commonProvider.userDetails!.selectedtenant!.code, + "consumerCode": + billList.bill?.first.consumerCode.toString(), + "businessService": "WS", + }).then((AggragateDemandDetails? value) { + if (value != null) { + hhp.aggDemandItems = value; + notifyListeners(); + } + }); + } + return commonProvider.getFileFromPDFBillService({ + "BillAndDemand": { + "Bill": [billList.bill?.first], + "AggregatedDemands": hhp.aggDemandItems + } + }, { + "key": waterconnection.connectionType == 'Metered' + ? "ws-bill-v2" + : "ws-bill-nm-v2", + "tenantId": + commonProvider.userDetails!.selectedtenant!.code, + }, billList.bill!.first.mobileNumber, billList.bill!.first, + "Download"); + }, + callBackWhatsApp: () async { + var hhp = Provider.of( + navigatorKey.currentContext!, + listen: false); + if (hhp.aggDemandItems == null) { + await BillingServiceRepository().fetchAggregateDemand({ + "tenantId": + commonProvider.userDetails!.selectedtenant!.code, + "consumerCode": + billList.bill?.first.consumerCode.toString(), + "businessService": "WS", + }).then((AggragateDemandDetails? value) { + if (value != null) { + hhp.aggDemandItems = value; + notifyListeners(); + } + }); + } + return commonProvider.getFileFromPDFBillService({ + "BillAndDemand": { + "Bill": [billList.bill?.first], + "AggregatedDemands": hhp.aggDemandItems + } + }, { + "key": waterconnection.connectionType == 'Metered' + ? "ws-bill-v2" + : "ws-bill-nm-v2", + "tenantId": + commonProvider.userDetails!.selectedtenant!.code, + }, billList.bill!.first.mobileNumber, billList.bill!.first, + "Share"); + }, backButton: true, ); })); - } catch (e) { + } catch (e) { Navigator.pop(context); Navigator.of(context).pushReplacement( new MaterialPageRoute(builder: (BuildContext context) { @@ -357,100 +403,168 @@ class BillGenerationProvider with ChangeNotifier { var rateProvider = Provider.of( navigatorKey.currentContext!, listen: false); - var rate = rateProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType=='Non_Metered').toList(); - if(selectedBillPeriod!=null){ - showDialog(context: context, builder: (context)=>AlertDialog( - surfaceTintColor: Colors.white, - title: Text('${ApplicationLocalizations.of(context).translate(i18.common.CORE_CONFIRM)}'), - content: Container( - height: 370, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.ARE_YOU_SURE_TO_GENERATE_DEMAND_FOR)} "${ApplicationLocalizations.of(context).translate(billGenerateDetails.serviceType!)}" ${ApplicationLocalizations.of(context).translate(i18.demandGenerate.WITH_MINIMUM_CHARGE_OF)} : '), - SizedBox(height: 10,), - FittedBox( - child: DataTable( - border: TableBorder.all( - width: 0.5, borderRadius: BorderRadius.all(Radius.circular(5)), - color: Colors.grey,), columns: [ - DataColumn( - label: Text( - "${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), - DataColumn( - label: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.RATE_PERCENTAGE)}", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )),], rows: [ - ...rate.map((e) => DataRow(cells: [ - DataCell(Text( - "${ApplicationLocalizations.of(context).translate("${e.buildingType}")}")), - DataCell(Text("${e.minimumCharge}")) - ])).toList() - ],), - ), - SizedBox(height: 10,), - Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.NO_DEMAND_GEN_WITH_RATE_0)}'), //* Note : No Demand will be generated for the Service Type with rate set to 0. - ], - ), - ), - actions: - (rateProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType=='Non_Metered').length- rateProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType=='Non_Metered' && element.minimumCharge==0).length == 0 ) - ? - [TextButton(onPressed: (){ - Navigator.pop(context); - }, child: Text('${ApplicationLocalizations.of(context).translate(i18.consumerReciepts.CLOSE)}'))] - : - [TextButton(onPressed: () async{ - if(rateProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType=='Non_Metered').length- rateProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType=='Non_Metered' && element.minimumCharge==0).length == 0 ){ - Navigator.pop(context); - Notifiers.getToastMessage(context, '${ApplicationLocalizations.of(context).translate(i18.demandGenerate.NO_SERVICE_PRESENT_WITH_RATE_MORE_THAN_0)}', 'ERROR'); //No Service type present with rate more than 0. - return; - } - try { - Loaders.showLoadingDialog(context); - var commonProvider = Provider.of( - navigatorKey.currentContext!, - listen: false); - var res2 = { - "tenantId": commonProvider.userDetails!.selectedtenant!.code, - "billingPeriod": selectedBillPeriod - }; - var billResponse2 = await BillGenerateRepository().bulkDemand(res2); - Navigator.pop(context); - String localizationText = getSubtitleText(context); - Navigator.of(context).pushReplacement( - new MaterialPageRoute(builder: (BuildContext context) { - return CommonSuccess(SuccessHandler( - ApplicationLocalizations.of(context) - .translate(i18.demandGenerate.GENERATE_DEMAND_SUCCESS), - localizationText, - i18.common.BACK_HOME, - Routes.BILL_GENERATE, - subHeader: - '${ApplicationLocalizations.of(context).translate(i18.demandGenerate.BILLING_CYCLE_LABEL)}', - subTextFun: () => getLocalizedText(context), - subtitleFun: () => getSubtitleText(context))); - })); - } catch (e) { - Navigator.of(context).pushReplacement( - new MaterialPageRoute(builder: (BuildContext context) { - return ErrorPage(e.toString()); - })); - } - }, child: Text('${ApplicationLocalizations.of(context).translate(i18.common.YES)}')), - TextButton(onPressed: (){ - Navigator.pop(context); - }, child: Text('${ApplicationLocalizations.of(context).translate(i18.common.NO)}')),] - , - )); - }else{ - Notifiers.getToastMessage(context, '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', 'ERROR'); //Please select billing cycle + var rate = rateProvider.wcBillingSlabs!.wCBillingSlabs! + .where((element) => element.connectionType == 'Non_Metered') + .toList(); + if (selectedBillPeriod != null) { + showDialog( + context: context, + builder: (context) => AlertDialog( + surfaceTintColor: Colors.white, + title: Text( + '${ApplicationLocalizations.of(context).translate(i18.common.CORE_CONFIRM)}'), + content: Container( + height: 370, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '${ApplicationLocalizations.of(context).translate(i18.demandGenerate.ARE_YOU_SURE_TO_GENERATE_DEMAND_FOR)} "${ApplicationLocalizations.of(context).translate(billGenerateDetails.serviceType!)}" ${ApplicationLocalizations.of(context).translate(i18.demandGenerate.WITH_MINIMUM_CHARGE_OF)} : '), + SizedBox( + height: 10, + ), + FittedBox( + child: DataTable( + border: TableBorder.all( + width: 0.5, + borderRadius: + BorderRadius.all(Radius.circular(5)), + color: Colors.grey, + ), + columns: [ + DataColumn( + label: Text( + "${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}", + style: TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold), + )), + DataColumn( + label: Text( + "${ApplicationLocalizations.of(context).translate(i18.common.RATE_PERCENTAGE)}", + style: TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold), + )), + ], + rows: [ + ...rate + .map((e) => DataRow(cells: [ + DataCell(Text( + "${ApplicationLocalizations.of(context).translate("${e.buildingType}")}")), + DataCell(Text("${e.minimumCharge}")) + ])) + .toList() + ], + ), + ), + SizedBox( + height: 10, + ), + Text( + '${ApplicationLocalizations.of(context).translate(i18.demandGenerate.NO_DEMAND_GEN_WITH_RATE_0)}'), //* Note : No Demand will be generated for the Service Type with rate set to 0. + ], + ), + ), + actions: (rateProvider.wcBillingSlabs!.wCBillingSlabs! + .where((element) => + element.connectionType == 'Non_Metered') + .length - + rateProvider.wcBillingSlabs!.wCBillingSlabs! + .where((element) => + element.connectionType == 'Non_Metered' && + element.minimumCharge == 0) + .length == + 0) + ? [ + TextButton( + onPressed: () { + Navigator.pop(context); + }, + child: Text( + '${ApplicationLocalizations.of(context).translate(i18.consumerReciepts.CLOSE)}')) + ] + : [ + TextButton( + onPressed: () async { + if (rateProvider.wcBillingSlabs!.wCBillingSlabs! + .where((element) => + element.connectionType == + 'Non_Metered') + .length - + rateProvider + .wcBillingSlabs!.wCBillingSlabs! + .where((element) => + element.connectionType == + 'Non_Metered' && + element.minimumCharge == 0) + .length == + 0) { + Navigator.pop(context); + Notifiers.getToastMessage( + context, + '${ApplicationLocalizations.of(context).translate(i18.demandGenerate.NO_SERVICE_PRESENT_WITH_RATE_MORE_THAN_0)}', + 'ERROR'); //No Service type present with rate more than 0. + return; + } + try { + Loaders.showLoadingDialog(context); + var commonProvider = + Provider.of( + navigatorKey.currentContext!, + listen: false); + var res2 = { + "tenantId": commonProvider + .userDetails!.selectedtenant!.code, + "billingPeriod": selectedBillPeriod + }; + var billResponse2 = + await BillGenerateRepository() + .bulkDemand(res2); + Navigator.pop(context); + String localizationText = + getSubtitleText(context); + Navigator.of(context).pushReplacement( + new MaterialPageRoute( + builder: (BuildContext context) { + return CommonSuccess(SuccessHandler( + ApplicationLocalizations.of(context) + .translate(i18.demandGenerate + .GENERATE_DEMAND_SUCCESS), + localizationText, + i18.common.BACK_HOME, + Routes.BILL_GENERATE, + subHeader: + '${ApplicationLocalizations.of(context).translate(i18.demandGenerate.BILLING_CYCLE_LABEL)}', + subTextFun: () => + getLocalizedText(context), + subtitleFun: () => + getSubtitleText(context))); + })); + } catch (e) { + Navigator.of(context).pushReplacement( + new MaterialPageRoute( + builder: (BuildContext context) { + return ErrorPage(e.toString()); + })); + } + }, + child: Text( + '${ApplicationLocalizations.of(context).translate(i18.common.YES)}')), + TextButton( + onPressed: () { + Navigator.pop(context); + }, + child: Text( + '${ApplicationLocalizations.of(context).translate(i18.common.NO)}')), + ], + )); + } else { + Notifiers.getToastMessage( + context, + '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', + 'ERROR'); //Please select billing cycle } } else { autoValidation = true; @@ -499,13 +613,19 @@ class BillGenerationProvider with ChangeNotifier { List getFinancialYearList() { if (languageList?.mdmsRes?.billingService?.taxPeriodList != null) { - CommonMethods.getFilteredFinancialYearList(languageList?.mdmsRes?.billingService?.taxPeriodList ?? []); - languageList?.mdmsRes?.billingService?.taxPeriodList!.sort((a,b)=>a.fromDate!.compareTo(b.fromDate!)); + CommonMethods.getFilteredFinancialYearList( + languageList?.mdmsRes?.billingService?.taxPeriodList ?? + []); + languageList?.mdmsRes?.billingService?.taxPeriodList! + .sort((a, b) => a.fromDate!.compareTo(b.fromDate!)); return (languageList?.mdmsRes?.billingService?.taxPeriodList ?? []) .map((value) { - return value; - }).toList().reversed.toList(); + return value; + }) + .toList() + .reversed + .toList(); } return []; } @@ -521,8 +641,8 @@ class BillGenerationProvider with ChangeNotifier { return []; } - List> getBillingCycle() { - var dates = >[]; + List> getBillingCycle() { + var dates = >[]; if (billGenerateDetails.billYear != null && selectedBillYear != null) { DatePeriod ytd; var fromDate = DateFormats.getFormattedDateToDateTime( @@ -531,26 +651,27 @@ class BillGenerationProvider with ChangeNotifier { var toDate = DateFormats.getFormattedDateToDateTime( DateFormats.timeStampToDate(selectedBillYear.toDate)) as DateTime; - ytd = DatePeriod(fromDate,toDate,DateType.YTD); + ytd = DatePeriod(fromDate, toDate, DateType.YTD); /// Get months based on selected billing year var months = CommonMethods.getPastMonthUntilFinancialYTD(ytd); /// if selected year is future year means all the months will be removed - if(fromDate.year > ytd.endDate.year) months.clear(); + if (fromDate.year > ytd.endDate.year) months.clear(); for (var i = 0; i < months.length; i++) { var prevMonth = months[i].startDate; - Map r = {"code": prevMonth, "name": "${ApplicationLocalizations.of(navigatorKey.currentContext!) - .translate((Constants.MONTHS[prevMonth.month - 1])) + - " - " + - prevMonth.year.toString()}"}; + Map r = { + "code": prevMonth, + "name": + "${ApplicationLocalizations.of(navigatorKey.currentContext!).translate((Constants.MONTHS[prevMonth.month - 1])) + " - " + prevMonth.year.toString()}" + }; dates.add(r); } } if (dates.length > 0) { return dates; } - return >[]; + return >[]; } } From ec123ae85dd90c908910d987d9f22bf8c3a16ca6 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Fri, 2 Aug 2024 12:31:50 +0530 Subject: [PATCH 090/133] Table - Pagination arrow --- .../house_connection_and_bill/new_consumer_bill.dart | 2 ++ frontend/mgramseva/lib/screeens/reports/leadger_table.dart | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/mgramseva/lib/components/house_connection_and_bill/new_consumer_bill.dart b/frontend/mgramseva/lib/components/house_connection_and_bill/new_consumer_bill.dart index a1db22d2b..31643fca6 100644 --- a/frontend/mgramseva/lib/components/house_connection_and_bill/new_consumer_bill.dart +++ b/frontend/mgramseva/lib/components/house_connection_and_bill/new_consumer_bill.dart @@ -467,6 +467,8 @@ class NewConsumerBillState extends State { .CreatePDF( houseHoldProvider.createPDFBody, houseHoldProvider.createPDFPrams) .then((value) async { + + commonProvider.getFileFromPDFBillService( { "BillAndDemand": { diff --git a/frontend/mgramseva/lib/screeens/reports/leadger_table.dart b/frontend/mgramseva/lib/screeens/reports/leadger_table.dart index 6e63239da..d7a289c9b 100644 --- a/frontend/mgramseva/lib/screeens/reports/leadger_table.dart +++ b/frontend/mgramseva/lib/screeens/reports/leadger_table.dart @@ -79,9 +79,10 @@ class LeadgerTable extends StatelessWidget { callBack: (pageResponse) => reportProvider.onChangeOfPageLimit( pageResponse, tableTitle, context), - isTotalCountVisible: true, + isTotalCountVisible: false, totalCount: reportProvider.genericTableData.tableData.length, + ), ), ) From 26e73754cbc47a5ea2986e3da70c104f1c71099d Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Fri, 2 Aug 2024 12:36:17 +0530 Subject: [PATCH 091/133] commit --- frontend/mgramseva/lib/main.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/mgramseva/lib/main.dart b/frontend/mgramseva/lib/main.dart index 8a12efb3d..ab8cbc08e 100644 --- a/frontend/mgramseva/lib/main.dart +++ b/frontend/mgramseva/lib/main.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:io'; import 'dart:isolate'; import 'dart:ui'; - // import 'package:dart_ping_ios/dart_ping_ios.dart'; import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:firebase_core/firebase_core.dart'; From 61e125d636ca56d71d4a2f7263002505fdb311d2 Mon Sep 17 00:00:00 2001 From: Taniya-eGov Date: Fri, 2 Aug 2024 22:15:51 +0530 Subject: [PATCH 092/133] Added Water Search Query for planesearch --- .../repository/builder/WsQueryBuilder.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 58ec99739..484c1c885 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 @@ -67,6 +67,23 @@ public class WsQueryBuilder { + "eg_ws_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + LEFT_OUTER_JOIN_STRING + "eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id"; + private static final String WATER_PLANE_SEARCH_QUERY = "SELECT count(*) OVER() AS full_count, conn.*, wc.*, document.*, plumber.*, wc.connectionCategory, wc.connectionType, wc.waterSource," + + " wc.meterId, wc.meterInstallationDate, wc.pipeSize, wc.noOfTaps, wc.proposedPipeSize, wc.proposedTaps, wc.connection_id as connection_Id, wc.connectionExecutionDate, wc.initialmeterreading, wc.appCreatedDate," + + " wc.detailsprovidedby, wc.estimationfileStoreId , wc.sanctionfileStoreId , wc.estimationLetterDate," + + " conn.id as conn_id, conn.tenantid, conn.applicationNo, conn.applicationStatus, conn.status, conn.connectionNo, conn.oldConnectionNo, conn.property_id, conn.roadcuttingarea," + + " conn.action, conn.adhocpenalty, conn.adhocrebate, conn.adhocpenaltyreason, conn.applicationType, conn.dateEffectiveFrom," + + " conn.adhocpenaltycomment, conn.adhocrebatereason, conn.adhocrebatecomment, conn.createdBy as ws_createdBy, conn.lastModifiedBy as ws_lastModifiedBy," + + " conn.createdTime as ws_createdTime, conn.lastModifiedTime as ws_lastModifiedTime,conn.additionaldetails, " + + " conn.locality, conn.isoldapplication, conn.roadtype, 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}, " + "{pendingAmountValue}," + "{lastDemandDate}" + + " FROM eg_ws_connection conn " + INNER_JOIN_STRING + " eg_ws_service wc ON wc.connection_id = conn.id" + + LEFT_OUTER_JOIN_STRING + "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" + + LEFT_OUTER_JOIN_STRING + "eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id"; + private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT ((select distinct d.taxperiodto as taxperiodto from egbs_demand_v1 d inner join egbs_demanddetail_v1 dd on dd.demandid = d.id "; private static final String WATER_CONNNECTION_BY_DEMANNDDATE_CLAUSE = " and dd.taxheadcode='10101' and d.status = 'ACTIVE' and d.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.taxperiodto desc limit 1))" + " as taxperiodto, count(*) as count "; @@ -662,7 +679,7 @@ public String getSearchQueryStringForPlaneSearch(SearchCriteria criteria, List Date: Mon, 5 Aug 2024 11:56:26 +0530 Subject: [PATCH 093/133] Update FuzzySearchQueryBuilder.java --- .../repository/FuzzySearchQueryBuilder.java | 88 +++++-------------- 1 file changed, 23 insertions(+), 65 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java index 36416b399..a5bb8faf8 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java @@ -63,81 +63,39 @@ public FuzzySearchQueryBuilder(ObjectMapper mapper, PropertiesManager config) { " }"; public String getFuzzySearchQuery(EmployeeSearchCriteria criteria, List ids) { - String finalQuery; + String finalQuery = ""; try { - // Generate base query with pagination String baseQuery = addPagination(criteria); JsonNode node = mapper.readTree(baseQuery); - ObjectNode rootNode = (ObjectNode) node; - ObjectNode insideMatch = (ObjectNode) rootNode.get("query"); - - // Ensure the "bool" node is present - ObjectNode boolNode = (ObjectNode) insideMatch.get("bool"); - if (boolNode == null) { - boolNode = mapper.createObjectNode(); - insideMatch.set("bool", boolNode); - } + ObjectNode insideMatch = (ObjectNode)node.get("query"); + List fuzzyClauses = new LinkedList<>(); - // Initialize the "must" array if it's not present - ArrayNode mustArray = (ArrayNode) boolNode.get("must"); - if (mustArray == null) { - mustArray = mapper.createArrayNode(); - boolNode.set("must", mustArray); + if(criteria.getName() != null){ + fuzzyClauses.add(getInnerNode(criteria.getName(),"Data.user.name",config.getNameFuziness())); } - // Add fuzzy search clause for name if present in criteria - if (criteria.getName() != null) { - mustArray.add(getInnerNode(criteria.getName(), "Data.user.name", config.getNameFuziness())); - } + ArrayNode tenantIdArray = mapper.createArrayNode(); + tenantIdArray.add("pb"); + ObjectNode tenantIdFilter = mapper.createObjectNode(); + tenantIdFilter.putPOJO("terms", mapper.createObjectNode().putPOJO("Data.tenantId.keyword", tenantIdArray)); + fuzzyClauses.add(tenantIdFilter); - // Add filter by IDs if the list is not empty - if (!CollectionUtils.isEmpty(ids)) { - ObjectNode idsFilterNode = mapper.createObjectNode(); - idsFilterNode.set("terms", mapper.convertValue(new HashMap>() {{ - put("Data.id.keyword", ids); - }}, JsonNode.class)); - boolNode.set("filter", idsFilterNode); - } - - // Add filter for tenantId - if (criteria.getTenantId() != null) { - ObjectNode tenantFilterNode = mapper.createObjectNode(); - if (criteria.getTenantIds()!=null) { - // Handle tenantId as a list - JsonNode tenantIdNode = mapper.convertValue(new HashMap>() {{ - put("Data.tenantId", (List) criteria.getTenantIds()); - }}, JsonNode.class); - tenantFilterNode.set("terms", tenantIdNode); - } else { - // Handle tenantId as a single value - JsonNode tenantIdNode = mapper.convertValue(new HashMap() {{ - put("Data.tenantId", criteria.getTenantId()); - }}, JsonNode.class); - tenantFilterNode.set("term", tenantIdNode); - } - boolNode.set("filter", tenantFilterNode); - } - - // Add filter for roles - if (criteria.getRoles()!=null) { - ArrayNode roleFilterArray = mapper.createArrayNode(); + if (criteria.getRoles() != null && !criteria.getRoles().isEmpty()) { + ArrayNode roleArray = mapper.createArrayNode(); for (String role : criteria.getRoles()) { - ObjectNode roleMatchNode = mapper.createObjectNode(); - roleMatchNode.set("match", mapper.convertValue(new HashMap() {{ - put("Data.user.roles.code", role); - }}, JsonNode.class)); - roleFilterArray.add(roleMatchNode); + ObjectNode roleNode = mapper.createObjectNode(); + roleNode.put("term", mapper.createObjectNode().put("Data.user.roles.code.keyword", role)); + roleArray.add(roleNode); } - ObjectNode roleBoolNode = mapper.createObjectNode(); - roleBoolNode.set("bool", mapper.convertValue(new HashMap() {{ - put("should", roleFilterArray); - }}, JsonNode.class)); - mustArray.add(roleBoolNode); - } - - // Convert the final JSON node back to a string - finalQuery = mapper.writeValueAsString(node); + ObjectNode rolesBoolNode = mapper.createObjectNode(); + rolesBoolNode.putPOJO("bool", mapper.createObjectNode().putPOJO("must", roleArray)); + fuzzyClauses.add(rolesBoolNode); + + ObjectNode boolQuery = mapper.createObjectNode(); + boolQuery.putPOJO("must", fuzzyClauses); + insideMatch.putPOJO("bool", boolQuery); + finalQuery = mapper.writeValueAsString(node); } catch (Exception e) { log.error("ES_ERROR", e); throw new CustomException("JSONNODE_ERROR", "Failed to build JSON query for fuzzy search"); From f5967b18a9581e8f4ccc20d0f4117be16102522b Mon Sep 17 00:00:00 2001 From: Palak Garg <86659286+palak-egov@users.noreply.github.com> Date: Mon, 5 Aug 2024 11:57:49 +0530 Subject: [PATCH 094/133] Update application.properties --- .../egov-hrms/src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/resources/application.properties b/business-services/egov-hrms/src/main/resources/application.properties index 2804bb707..d6b00bbbe 100644 --- a/business-services/egov-hrms/src/main/resources/application.properties +++ b/business-services/egov-hrms/src/main/resources/application.properties @@ -77,7 +77,7 @@ egov.pwd.allowed.special.characters=@#$% hrms.search.pagination.default.limit=50 hrms.search.pagination.default.offset=0 hrms.search.pagination.max.search.limit=5000 -hrms.fuzzy.search.is.wildcard=true +hrms.fuzzy.search.is.wildcard=false hrms.search.name.fuziness=2 #Elastic serach Properties From 458d9db2e97223263f1a522a98c787604b1e17bd Mon Sep 17 00:00:00 2001 From: Palak Garg <86659286+palak-egov@users.noreply.github.com> Date: Mon, 5 Aug 2024 13:09:03 +0530 Subject: [PATCH 095/133] Update FuzzySearchQueryBuilder.java --- .../java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java | 1 + 1 file changed, 1 insertion(+) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java index a5bb8faf8..26079fe99 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java @@ -96,6 +96,7 @@ public String getFuzzySearchQuery(EmployeeSearchCriteria criteria, List boolQuery.putPOJO("must", fuzzyClauses); insideMatch.putPOJO("bool", boolQuery); finalQuery = mapper.writeValueAsString(node); + } } catch (Exception e) { log.error("ES_ERROR", e); throw new CustomException("JSONNODE_ERROR", "Failed to build JSON query for fuzzy search"); From 679e6aa9d44c42cc7d0fa9034e677003e7d1d6cf Mon Sep 17 00:00:00 2001 From: Taniya-eGov Date: Mon, 5 Aug 2024 13:17:02 +0530 Subject: [PATCH 096/133] updated planesearch query --- .../egov/waterconnection/repository/builder/WsQueryBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 484c1c885..35d1ac9cc 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 @@ -77,7 +77,7 @@ public class WsQueryBuilder { + " conn.locality, conn.isoldapplication, conn.roadtype, 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}, " + "{pendingAmountValue}," + "{lastDemandDate}" + + " plumber.relationship, " + "{lastDemandDate}" + " FROM eg_ws_connection conn " + INNER_JOIN_STRING + " eg_ws_service wc ON wc.connection_id = conn.id" + LEFT_OUTER_JOIN_STRING + "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 From 7bea11be9ace0f6d171d761d7f5628b2c596e7a2 Mon Sep 17 00:00:00 2001 From: Palak Garg <86659286+palak-egov@users.noreply.github.com> Date: Mon, 5 Aug 2024 14:13:29 +0530 Subject: [PATCH 097/133] Update FuzzySearchService.java --- .../src/main/java/org/egov/hrms/service/FuzzySearchService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java index 4b0656396..b2cfc027c 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java @@ -53,7 +53,7 @@ public List getEmployees(RequestInfo requestInfo, EmployeeSearchCriter EmployeeSearchCriteria employeeSearchCriteria = EmployeeSearchCriteria.builder().tenantId(tenantId).codes(empList).build(); - employees.addAll(employeeRepository.fetchEmployees(criteria,requestInfo)); + employees.addAll(employeeRepository.fetchEmployees(employeeSearchCriteria, requestInfo)); } From 7e71d953c4b34239fe87e4d91f0d385406380d9c Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 5 Aug 2024 17:01:13 +0530 Subject: [PATCH 098/133] ISTE-229 --- .../org/egov/waterconnection/repository/WaterDaoImpl.java | 3 --- .../repository/rowmapper/LedgerReportRowMapper.java | 4 ---- 2 files changed, 7 deletions(-) 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 bb772a7b8..0ba3d13be 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 @@ -54,9 +54,6 @@ @Repository public class WaterDaoImpl implements WaterDao { -// @Autowired -// private MonthReportRowMapper monthReportRowMapper; - @Autowired private LedgerReportRowMapper ledgerReportRowMapper; @Autowired diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 1c7a1ee0b..b3e49e72d 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -167,13 +167,10 @@ public List addPaymentDetails(String consumerCode) { Object response = serviceRequestRepository.fetchResult(URL, requestInfoWrapper); log.info("line 226 response " + response.toString()); PaymentResponse paymentResponse = mapper.convertValue(response, PaymentResponse.class); -// log.info("paymnent response" + paymentResponse.toString()); return paymentResponse.getPayments(); } private void addPaymentToLedger(List> monthlyRecordList) { -// BigDecimal runningBalance=BigDecimal.ZERO; - for (Map record : monthlyRecordList) { LedgerReport ledgerReport = (LedgerReport) record.values().iterator().next(); if (ledgerReport.getDemand() == null) { @@ -203,7 +200,6 @@ private void addPaymentToLedger(List> monthlyRecordList) { { paymentLedgerReport.setBalanceLeft(totalDueAmount.subtract(paymentLedgerReport.getPaid())); } -// runningBalance=paymentLedgerReport.getBalanceLeft(); if (ledgerReport.getPayment() == null) { ledgerReport.setPayment(new ArrayList<>()); } From 3a865a75f7b9abae180a16004883068f786dc1b6 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 5 Aug 2024 17:02:33 +0530 Subject: [PATCH 099/133] ISTE-229 --- .../main/java/org/egov/waterconnection/service/UserService.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/UserService.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/UserService.java index c15f1ea0d..ec0abab7b 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/UserService.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/UserService.java @@ -234,7 +234,6 @@ else if (uri.toString().contains(configuration.getUserCreateEndPoint())) dobFormat = "dd/MM/yyyy"; try { LinkedHashMap responseMap = (LinkedHashMap) serviceRequestRepository.fetchResult(uri, userRequest); - log.info("line 237 "+responseMap.toString()); if (!CollectionUtils.isEmpty(responseMap)) { parseResponse(responseMap, dobFormat); return mapper.convertValue(responseMap, UserDetailResponse.class); @@ -408,7 +407,6 @@ private void setOwnerFields(OwnerInfo holderInfo, UserDetailResponse userDetailR public UserDetailResponse getUser(UserSearchRequest userSearchRequest) { StringBuilder uri = new StringBuilder(configuration.getUserHost()) .append(configuration.getUserSearchEndpoint()); - log.info("uri is "+uri); UserDetailResponse userDetailResponse = userCall(userSearchRequest, uri); return userDetailResponse; } From a74ec00439d646913f7ba2e63dde7e79f0958513 Mon Sep 17 00:00:00 2001 From: Taniya-eGov Date: Mon, 5 Aug 2024 17:03:03 +0530 Subject: [PATCH 100/133] updated plain query for water --- .../egov/waterconnection/repository/builder/WsQueryBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 35d1ac9cc..ab3382542 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 @@ -77,7 +77,7 @@ public class WsQueryBuilder { + " conn.locality, conn.isoldapplication, conn.roadtype, 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, " + "{lastDemandDate}" + + " plumber.relationship, " + " COALESCE(0) AS collectionamount, " + " COALESCE(0) AS pendingamount, " + "{lastDemandDate}" + " FROM eg_ws_connection conn " + INNER_JOIN_STRING + " eg_ws_service wc ON wc.connection_id = conn.id" + LEFT_OUTER_JOIN_STRING + "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 From db3824d07e9fb8730abf3695715901852edb5658 Mon Sep 17 00:00:00 2001 From: Taniya-eGov Date: Mon, 5 Aug 2024 22:32:35 +0530 Subject: [PATCH 101/133] updated query --- .../egov/waterconnection/repository/builder/WsQueryBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ab3382542..cf5c864ad 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 @@ -77,7 +77,7 @@ public class WsQueryBuilder { + " conn.locality, conn.isoldapplication, conn.roadtype, 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, " + " COALESCE(0) AS collectionamount, " + " COALESCE(0) AS pendingamount, " + "{lastDemandDate}" + + " plumber.relationship, " + " COALESCE(0) AS collectionamount, " + " COALESCE(0) AS pendingamount, " + " COALESCE(0) AS taxamount, " + "{lastDemandDate}" + " FROM eg_ws_connection conn " + INNER_JOIN_STRING + " eg_ws_service wc ON wc.connection_id = conn.id" + LEFT_OUTER_JOIN_STRING + "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 From 1be043c4fa758575c98f54e98996ed536ae4e22e Mon Sep 17 00:00:00 2001 From: Taniya-eGov Date: Tue, 6 Aug 2024 12:27:28 +0530 Subject: [PATCH 102/133] added holderSelectValues --- .../egov/waterconnection/repository/builder/WsQueryBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 af614c62b..acf84c687 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 @@ -77,7 +77,7 @@ public class WsQueryBuilder { + " conn.locality, conn.isoldapplication, conn.roadtype, 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, " + " COALESCE(0) AS collectionamount, " + " COALESCE(0) AS pendingamount, " + " COALESCE(0) AS taxamount, " + "{lastDemandDate}" + + " plumber.relationship, " + " {holderSelectValues}, " + " COALESCE(0) AS pendingamount, " + " COALESCE(0) AS taxamount, " + "{lastDemandDate}" + " FROM eg_ws_connection conn " + INNER_JOIN_STRING + " eg_ws_service wc ON wc.connection_id = conn.id" + LEFT_OUTER_JOIN_STRING + "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 From 4a11e7f51f7b53b68ad5d1da1c8e18ca42dce1c1 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 6 Aug 2024 14:50:26 +0530 Subject: [PATCH 103/133] ISTE-229 --- .../rowmapper/LedgerReportRowMapper.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index b3e49e72d..9696d7008 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -76,10 +76,15 @@ public List> extractData(ResultSet resultSet) throws SQLExce while (!currentMonth.isAfter(endMonth)) { String monthAndYear = currentMonth.format(DateTimeFormatter.ofPattern("MMMM yyyy")); + LocalDate startOfMonth = currentMonth.atDay(1); + Long epochTime = startOfMonth.atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); LedgerReport ledgerReport = new LedgerReport(); ledgerReport.setDemand(new DemandLedgerReport()); ledgerReport.getDemand().setMonthAndYear(monthAndYear); ledgerReport.getDemand().setConnectionNo(consumerCode); + BigDecimal taxAmountResult = getMonthlyTaxAmount(epochTime, consumerCode); + BigDecimal totalAmountPaidResult = getMonthlyTotalAmountPaid(epochTime, consumerCode); + ledgerReport.getDemand().setArrears(taxAmountResult.subtract(totalAmountPaidResult)); ledgerReports.put(monthAndYear, ledgerReport); currentMonth = currentMonth.plusMonths(1); } @@ -102,10 +107,11 @@ public List> extractData(ResultSet resultSet) throws SQLExce ledgerReport.setPayment(new ArrayList<>()); } - if (code.equals("10102")) { - ledgerReport.getDemand().setArrears(taxamount != null ? taxamount : BigDecimal.ZERO); - ledgerReport.getDemand().setMonthAndYear(monthAndYear); - } else if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { +// if (code.equals("10102")) { +// ledgerReport.getDemand().setArrears(taxamount != null ? taxamount : BigDecimal.ZERO); +// ledgerReport.getDemand().setMonthAndYear(monthAndYear); +// } else + if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { ledgerReport.getDemand().setPenalty(taxamount != null ? taxamount : BigDecimal.ZERO); BigDecimal amount = ledgerReport.getDemand().getTaxamount() != null ? ledgerReport.getDemand().getTaxamount() : BigDecimal.ZERO; ledgerReport.getDemand().setTotalForCurrentMonth((taxamount != null ? taxamount : BigDecimal.ZERO).add(amount)); @@ -119,11 +125,6 @@ public List> extractData(ResultSet resultSet) throws SQLExce long penaltyAppliedDateMillis = demandGenerationDateLocal.plus(11, ChronoUnit.DAYS).atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); ledgerReport.getDemand().setDueDate(dueDateMillis); ledgerReport.getDemand().setPenaltyAppliedDate(penaltyAppliedDateMillis); - Long startDate = resultSet.getLong("startdate"); - String connectionno = resultSet.getString("connectionno"); - BigDecimal taxAmountResult = getMonthlyTaxAmount(startDate, connectionno); - BigDecimal totalAmountPaidResult = getMonthlyTotalAmountPaid(startDate, connectionno); - ledgerReport.getDemand().setArrears(taxAmountResult.subtract(totalAmountPaidResult)); ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears())); } ledgerReport.getDemand().setConnectionNo(resultSet.getString("connectionno")); From bc093ed5c83d19d46051a840a23c43d0e4985fbc Mon Sep 17 00:00:00 2001 From: palak-egov Date: Tue, 6 Aug 2024 17:04:50 +0530 Subject: [PATCH 104/133] adding user data --- .../egov/hrms/service/FuzzySearchService.java | 20 +++++++++++++++++- .../java/org/egov/hrms/utils/HRMSUtils.java | 21 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java index b2cfc027c..e8e464343 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java @@ -2,21 +2,28 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.JsonPath; +import lombok.extern.slf4j.Slf4j; import org.egov.common.contract.request.RequestInfo; import org.egov.hrms.config.PropertiesManager; import org.egov.hrms.model.Employee; import org.egov.hrms.repository.ElasticSearchRepository; import org.egov.hrms.repository.EmployeeRepository; +import org.egov.hrms.utils.HRMSConstants; +import org.egov.hrms.utils.HRMSUtils; import org.egov.hrms.web.contract.EmployeeSearchCriteria; +import org.egov.hrms.web.contract.User; +import org.egov.hrms.web.contract.UserResponse; import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.*; +import java.util.stream.Collectors; import static org.egov.hrms.utils.HRMSConstants.ES_DATA_PATH; +@Slf4j @Service public class FuzzySearchService { @Autowired @@ -27,6 +34,11 @@ public class FuzzySearchService { private EmployeeRepository employeeRepository; @Autowired private PropertiesManager config; + @Autowired + private UserService userService; + @Autowired + private HRMSUtils hrmsUtils; + public List getEmployees(RequestInfo requestInfo, EmployeeSearchCriteria criteria) { @@ -54,7 +66,13 @@ public List getEmployees(RequestInfo requestInfo, EmployeeSearchCriter EmployeeSearchCriteria employeeSearchCriteria = EmployeeSearchCriteria.builder().tenantId(tenantId).codes(empList).build(); employees.addAll(employeeRepository.fetchEmployees(employeeSearchCriteria, requestInfo)); - + Set uuids = employees.stream().map(Employee::getUuid).collect(Collectors.toSet()); + Map map = new HashMap<>(); + map.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_UUID,uuids); + UserResponse userResponse = userService.getUser(requestInfo, map); + log.info("userResponse {}",userResponse); + List users = userResponse.getUser(); + hrmsUtils.enrichOwner(users, employees); } return employees; diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSUtils.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSUtils.java index d9a9f1c8f..64e768b7f 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSUtils.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSUtils.java @@ -1,14 +1,20 @@ package org.egov.hrms.utils; import java.security.SecureRandom; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Random; +import lombok.extern.slf4j.Slf4j; +import org.egov.hrms.model.Employee; import org.egov.hrms.web.contract.EmployeeSearchCriteria; +import org.egov.hrms.web.contract.User; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +@Slf4j @Service public class HRMSUtils { @@ -61,4 +67,19 @@ public boolean isAssignmentSearchReqd(EmployeeSearchCriteria criteria) { return (! CollectionUtils.isEmpty(criteria.getPositions()) || null != criteria.getAsOnDate() || !CollectionUtils.isEmpty(criteria.getDepartments()) || !CollectionUtils.isEmpty(criteria.getDesignations())); } + + public void enrichOwner(List users, List employees) { + + Map uuidToUserMap = new HashMap<>(); + users.forEach(user -> uuidToUserMap.put(user.getUuid(), user)); + + employees.forEach(employee -> { + User user = uuidToUserMap.get(employee.getUuid()); + if (user == null) { + log.info("USER SEARCH ERROR: The user with UUID : \"" + employee.getUuid() + "\" for the employee with Id \"" + employee.getId() + "\" is not present in user search response"); + } else { + employee.setUser(user); + } + }); + } } From 58e398ac03cc9173ccc3d71824edda7497092bc8 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Wed, 7 Aug 2024 16:50:34 +0530 Subject: [PATCH 105/133] ISTE-292-FIX --- frontend/mgramseva/lib/env/app_config.dart | 1 + .../lib/providers/reports_provider.dart | 355 ++++++++----- frontend/mgramseva/lib/services/mdms.dart | 6 +- .../web/micro-ui-internals/package.json | 4 +- .../packages/css/package.json | 2 +- .../packages/modules/hrms/src/Module.js | 2 + .../components/Modal/EmployeeAppliaction.js | 2 +- .../src/components/MultiSelectDropdown.js | 134 ++--- .../hrms/src/components/SearchUserForm.js | 29 +- .../hrms/src/components/SearchUserResults.js | 81 +-- .../hrms/src/components/config/config.js | 7 + .../SelectUserTypeAndDesignation.js | 500 ++++++++++++++++++ .../components/pageComponents/assignment.js | 1 + .../components/pageComponents/jurisdiction.js | 162 ++++-- .../hrms/src/pages/EditEmployee/EditForm.js | 39 +- .../modules/hrms/src/pages/EmployeeDetails.js | 80 +-- .../modules/hrms/src/pages/SearchUser.js | 27 +- .../modules/hrms/src/pages/createEmployee.js | 36 +- 18 files changed, 1080 insertions(+), 388 deletions(-) create mode 100644 frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js diff --git a/frontend/mgramseva/lib/env/app_config.dart b/frontend/mgramseva/lib/env/app_config.dart index 94253b5b1..f4934d5cb 100644 --- a/frontend/mgramseva/lib/env/app_config.dart +++ b/frontend/mgramseva/lib/env/app_config.dart @@ -22,6 +22,7 @@ void setEnvironment(Environment env) { } } + dynamic get apiBaseUrl { return _config[_baseUrl]; } diff --git a/frontend/mgramseva/lib/providers/reports_provider.dart b/frontend/mgramseva/lib/providers/reports_provider.dart index 0bce8ffe8..fff2b517b 100644 --- a/frontend/mgramseva/lib/providers/reports_provider.dart +++ b/frontend/mgramseva/lib/providers/reports_provider.dart @@ -71,14 +71,13 @@ class ReportsProvider with ChangeNotifier { genericTableData = BillsTableData([], []); notifyListeners(); } + void updateConsumerCode(val) { consumerCode = val; notifyListeners(); } - - - void updateDefaultDate(){ + void updateDefaultDate() { onChangeOfBillYear(getFinancialYearListDropdown(billingYearList).first); } @@ -100,9 +99,8 @@ class ReportsProvider with ChangeNotifier { TableHeader(i18.billDetails.TOTAL_AMOUNT), ]; List get leadgerHeaderList => [ - TableHeader(i18.common.LEDGER_MONTH), - TableHeader( - i18.common.LEDGER_DEMAND_GENERATION_DATE), + TableHeader(i18.common.LEDGER_MONTH), + TableHeader(i18.common.LEDGER_DEMAND_GENERATION_DATE), TableHeader(i18.common.LEDGER_MONTHLY_CHARGE), TableHeader(i18.common.LEDGER_PREV_MONTH_BALANCE), TableHeader(i18.common.LEDGER_TOTAL_DUE), @@ -127,25 +125,24 @@ class ReportsProvider with ChangeNotifier { TableHeader(i18.billDetails.TOTAL_AMOUNT), ]; List get inactiveConsumerHeaderList => [ - TableHeader(i18.common.CONNECTION_ID), - TableHeader(i18.common.STATUS), - TableHeader(i18.common.INACTIVATED_DATE), - TableHeader(i18.common.INACTIVATED_BY_NAME), - ]; + TableHeader(i18.common.CONNECTION_ID), + TableHeader(i18.common.STATUS), + TableHeader(i18.common.INACTIVATED_DATE), + TableHeader(i18.common.INACTIVATED_BY_NAME), + ]; List get expenseBillReportHeaderList => [ - TableHeader(i18.expense.EXPENSE_TYPE), - TableHeader(i18.expense.VENDOR_NAME), - TableHeader(i18.expense.AMOUNT), - TableHeader(i18.expense.BILL_DATE), - TableHeader(i18.expense.EXPENSE_START_DATE), - TableHeader(i18.expense.EXPENSE_END_DATE), - TableHeader(i18.expense.APPLICATION_STATUS), - TableHeader(i18.expense.PAID_DATE), - TableHeader(i18.expense.HAS_ATTACHMENT), - TableHeader(i18.expense.CANCELLED_TIME), - TableHeader(i18.expense.CANCELLED_BY), - - ]; + TableHeader(i18.expense.EXPENSE_TYPE), + TableHeader(i18.expense.VENDOR_NAME), + TableHeader(i18.expense.AMOUNT), + TableHeader(i18.expense.BILL_DATE), + TableHeader(i18.expense.EXPENSE_START_DATE), + TableHeader(i18.expense.EXPENSE_END_DATE), + TableHeader(i18.expense.APPLICATION_STATUS), + TableHeader(i18.expense.PAID_DATE), + TableHeader(i18.expense.HAS_ATTACHMENT), + TableHeader(i18.expense.CANCELLED_TIME), + TableHeader(i18.expense.CANCELLED_BY), + ]; List get vendorReportHeaderList => [ TableHeader(i18.common.BILL_ID), @@ -180,22 +177,23 @@ class ReportsProvider with ChangeNotifier { {isExcel = false}) { return list.map((e) => getDemandRow(e, isExcel: isExcel)).toList(); } - List getLedgerData(List list, - {isExcel = false}) { + + List getLedgerData(List list, {isExcel = false}) { return list.map((e) => getLedgerRow(e, isExcel: isExcel)).toList(); } - -String formatYearMonth(String inputString) { - final length = inputString.length; - if (length < 4) { - return inputString; // Return the original string if length is less than 4 - } else { - return inputString.substring(0, length - 4) + ' - ' + inputString.substring(length - 4); + String formatYearMonth(String inputString) { + final length = inputString.length; + if (length < 4) { + return inputString; // Return the original string if length is less than 4 + } else { + return inputString.substring(0, length - 4) + + ' - ' + + inputString.substring(length - 4); + } } -} - TableDataRow getLedgerRow(LedgerData data, {bool isExcel = false}) { + TableDataRow getLedgerRow(LedgerData data, {bool isExcel = false}) { return TableDataRow([ TableData( formatYearMonth('${data.months?.values.first.demand?.month}'), @@ -205,18 +203,20 @@ String formatYearMonth(String inputString) { TableData('₹ ${data.months?.values.first.demand?.monthlyCharges}'), TableData('₹ ${data.months?.values.first.demand?.previousMonthBalance}'), TableData('₹ ${data.months?.values.first.demand?.totalDues}'), - TableData('${DateFormats.leadgerTimeStampToDate(data.months?.values.first.demand?.dueDateOfPayment)}'), - TableData('${DateFormats.leadgerTimeStampToDate( data.months?.values.first.demand?.demandGenerationDate)}'), + TableData( + '${DateFormats.leadgerTimeStampToDate(data.months?.values.first.demand?.dueDateOfPayment)}'), + TableData( + '${DateFormats.leadgerTimeStampToDate(data.months?.values.first.payment?.first.paymentCollectionDate)}'), TableData('${data.months?.values.first.payment?.first.receiptNo}'), TableData('₹ ${data.months?.values.first.payment?.first.amountPaid}'), TableData('₹ ${data.months?.values.first.demand?.previousMonthBalance}'), - TableData('${DateFormats.leadgerTimeStampToDate(data.months?.values.first.demand?.penaltyAppliedOnDate)}'), + TableData( + '${DateFormats.leadgerTimeStampToDate(data.months?.values.first.demand?.penaltyAppliedOnDate)}'), TableData('₹ ${data.months?.values.first.demand?.penalty}'), TableData('₹ ${data.months?.values.first.payment?.first.balanceLeft}'), ]); } - TableDataRow getDemandRow(BillReportData data, {bool isExcel = false}) { String? name = CommonMethods.truncateWithEllipsis(20, data.consumerName!); return TableDataRow([ @@ -253,53 +253,80 @@ String formatYearMonth(String inputString) { ? '${data.connectionNo ?? '-'}' : '${data.connectionNo?.split('/').first ?? ''}/...${data.connectionNo?.split('/').last ?? ''}', ), - TableData('${(data.oldConnectionNo == null ? null : data.oldConnectionNo!.isEmpty ? null : data.oldConnectionNo) ?? '-'}'), + TableData( + '${(data.oldConnectionNo == null ? null : data.oldConnectionNo!.isEmpty ? null : data.oldConnectionNo) ?? '-'}'), TableData('${name ?? '-'}'), TableData('${data.paymentMode ?? '-'}'), TableData('${data.paymentAmount ?? '0'}'), ]); } - List getInactiveConsumersData(List list, + + List getInactiveConsumersData( + List list, {bool isExcel = false}) { - return list.map((e) => getInactiveConsumersDataRow(e, isExcel: isExcel)).toList(); + return list + .map((e) => getInactiveConsumersDataRow(e, isExcel: isExcel)) + .toList(); } TableDataRow getInactiveConsumersDataRow(InactiveConsumerReportData data, {bool isExcel = false}) { - String? inactivatedBy = CommonMethods.truncateWithEllipsis(20, data.inactivatedByName!); + String? inactivatedBy = + CommonMethods.truncateWithEllipsis(20, data.inactivatedByName!); if (data.connectionNo != null && data.connectionNo!.isEmpty) { data.connectionNo = '-'; } - var inactivatedDate = DateFormats.timeStampToDate(data.inactiveDate?.toInt(),format: "dd/MM/yyyy"); + var inactivatedDate = DateFormats.timeStampToDate( + data.inactiveDate?.toInt(), + format: "dd/MM/yyyy"); return TableDataRow([ TableData( isExcel ? '${data.connectionNo ?? '-'}' : '${data.connectionNo?.split('/').first ?? ''}/...${data.connectionNo?.split('/').last ?? ''}', ), - TableData('${data.status??'-'}'), + TableData('${data.status ?? '-'}'), TableData('${inactivatedDate ?? '-'}'), TableData('${inactivatedBy ?? '-'}'), ]); } + List getExpenseBillReportData(List list, {bool isExcel = false}) { - return list.map((e) => getExpenseBillReportDataRow(e, isExcel: isExcel)).toList(); + return list + .map((e) => getExpenseBillReportDataRow(e, isExcel: isExcel)) + .toList(); } + TableDataRow getExpenseBillReportDataRow(ExpenseBillReportData data, {bool isExcel = false}) { - String? vendorName = CommonMethods.truncateWithEllipsis(20, data.vendorName!); - String? typeOfExpense = CommonMethods.truncateWithEllipsis(20, data.typeOfExpense!); - String? applicationStatus = CommonMethods.truncateWithEllipsis(20, data.applicationStatus!); - String? lastModifiedBy = CommonMethods.truncateWithEllipsis(20, data.lastModifiedBy!); - String? fileLink = CommonMethods.truncateWithEllipsis(20, data.filestoreid!); - var billDate = DateFormats.timeStampToDate(data.billDate?.toInt(),format: "dd/MM/yyyy"); - var taxPeriodFrom = DateFormats.timeStampToDate(data.taxPeriodFrom?.toInt(),format: "dd/MM/yyyy"); - var taxPeriodTo = DateFormats.timeStampToDate(data.taxPeriodTo?.toInt(),format: "dd/MM/yyyy"); - var paidDate = data.paidDate==0?'-':DateFormats.timeStampToDate(data.paidDate?.toInt(),format: "dd/MM/yyyy"); - var lastModifiedTime = data.lastModifiedTime==0?'-':DateFormats.timeStampToDate(data.lastModifiedTime?.toInt(),format: "dd/MM/yyyy"); + String? vendorName = + CommonMethods.truncateWithEllipsis(20, data.vendorName!); + String? typeOfExpense = + CommonMethods.truncateWithEllipsis(20, data.typeOfExpense!); + String? applicationStatus = + CommonMethods.truncateWithEllipsis(20, data.applicationStatus!); + String? lastModifiedBy = + CommonMethods.truncateWithEllipsis(20, data.lastModifiedBy!); + String? fileLink = + CommonMethods.truncateWithEllipsis(20, data.filestoreid!); + var billDate = DateFormats.timeStampToDate(data.billDate?.toInt(), + format: "dd/MM/yyyy"); + var taxPeriodFrom = DateFormats.timeStampToDate(data.taxPeriodFrom?.toInt(), + format: "dd/MM/yyyy"); + var taxPeriodTo = DateFormats.timeStampToDate(data.taxPeriodTo?.toInt(), + format: "dd/MM/yyyy"); + var paidDate = data.paidDate == 0 + ? '-' + : DateFormats.timeStampToDate(data.paidDate?.toInt(), + format: "dd/MM/yyyy"); + var lastModifiedTime = data.lastModifiedTime == 0 + ? '-' + : DateFormats.timeStampToDate(data.lastModifiedTime?.toInt(), + format: "dd/MM/yyyy"); return TableDataRow([ - TableData('${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(typeOfExpense ?? '-')}'), + TableData( + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(typeOfExpense ?? '-')}'), TableData('${vendorName ?? '-'}'), TableData('${data.amount ?? '-'}'), TableData('${billDate ?? '-'}'), @@ -312,20 +339,27 @@ String formatYearMonth(String inputString) { TableData('${lastModifiedBy ?? '-'}'), ]); } + List getVendorReportData(List list, {bool isExcel = false}) { - return list.map((e) => getVendorReportDataRow(e, isExcel: isExcel)).toList(); + return list + .map((e) => getVendorReportDataRow(e, isExcel: isExcel)) + .toList(); } + TableDataRow getVendorReportDataRow(VendorReportData data, {bool isExcel = false}) { - String? vendorName = CommonMethods.truncateWithEllipsis(20, data.vendorName!); - String? typeOfExpense = CommonMethods.truncateWithEllipsis(20, data.typeOfExpense!); + String? vendorName = + CommonMethods.truncateWithEllipsis(20, data.vendorName!); + String? typeOfExpense = + CommonMethods.truncateWithEllipsis(20, data.typeOfExpense!); String? billId = CommonMethods.truncateWithEllipsis(20, data.billId!); return TableDataRow([ TableData('${billId ?? '-'}'), TableData('${vendorName ?? '-'}'), TableData('${data.mobileNo ?? '-'}'), - TableData('${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(typeOfExpense ?? '-')}'), + TableData( + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(typeOfExpense ?? '-')}'), ]); } @@ -333,7 +367,7 @@ String formatYearMonth(String inputString) { notifyListeners(); } - updateSelectedBillYear(val){ + updateSelectedBillYear(val) { selectedBillYear = val; notifyListeners(); } @@ -385,14 +419,13 @@ String formatYearMonth(String inputString) { billingYearList = res; notifyListeners(); streamController.add(billingYearList); - } catch (e, s) { ErrorHandler().allExceptionsHandler(navigatorKey.currentContext!, e, s); streamController.addError('error'); } } - List getFinancialYearListDropdownA( - LanguageList? languageList) { + + List getFinancialYearListDropdownA(LanguageList? languageList) { if (languageList?.mdmsRes?.billingService?.taxPeriodList != null) { CommonMethods.getFilteredFinancialYearList( languageList?.mdmsRes?.billingService?.taxPeriodList ?? @@ -400,15 +433,16 @@ String formatYearMonth(String inputString) { languageList?.mdmsRes?.billingService?.taxPeriodList! .sort((a, b) => a.fromDate!.compareTo(b.fromDate!)); return (languageList?.mdmsRes?.billingService?.taxPeriodList ?? - []) + []) .reversed .toList(); } return []; } - List> getBillingCycleDropdownA( + + List> getBillingCycleDropdownA( dynamic selectedBillYear) { - List> dates = []; + List> dates = []; if (selectedBillYear != null) { DatePeriod ytd; var fromDate = DateFormats.getFormattedDateToDateTime( @@ -428,10 +462,11 @@ String formatYearMonth(String inputString) { for (var i = 0; i < months.length; i++) { var prevMonth = months[i].startDate; - var r = {"code": prevMonth, "name": '${ApplicationLocalizations.of(navigatorKey.currentContext!) - .translate((Constants.MONTHS[prevMonth.month - 1])) + - " - " + - prevMonth.year.toString()}'}; + var r = { + "code": prevMonth, + "name": + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate((Constants.MONTHS[prevMonth.month - 1])) + " - " + prevMonth.year.toString()}' + }; dates.add(r); } } @@ -446,8 +481,8 @@ String formatYearMonth(String inputString) { // } return dates; } - List getFinancialYearListDropdown( - LanguageList? languageList) { + + List getFinancialYearListDropdown(LanguageList? languageList) { if (languageList?.mdmsRes?.billingService?.taxPeriodList != null) { CommonMethods.getFilteredFinancialYearList( languageList?.mdmsRes?.billingService?.taxPeriodList ?? @@ -466,9 +501,8 @@ String formatYearMonth(String inputString) { return []; } - List> getBillingCycleDropdown( - dynamic selectedBillYear) { - var dates = >[]; + List> getBillingCycleDropdown(dynamic selectedBillYear) { + var dates = >[]; if (selectedBillYear != null) { DatePeriod ytd; var fromDate = DateFormats.getFormattedDateToDateTime( @@ -488,38 +522,40 @@ String formatYearMonth(String inputString) { for (var i = 0; i < months.length; i++) { var prevMonth = months[i].startDate; - Map r = {"code": prevMonth, "name": "${ApplicationLocalizations.of(navigatorKey.currentContext!) - .translate((Constants.MONTHS[prevMonth.month - 1])) + - " - " + - prevMonth.year.toString()}"}; + Map r = { + "code": prevMonth, + "name": + "${ApplicationLocalizations.of(navigatorKey.currentContext!).translate((Constants.MONTHS[prevMonth.month - 1])) + " - " + prevMonth.year.toString()}" + }; dates.add(r); } } if (dates.length > 0) { return dates; } - return >[]; + return >[]; } - Future getLeadgerReport( - {bool download = false, - int offset = 1, - int limit = 10, - }) async { + Future getLeadgerReport({ + bool download = false, + int offset = 1, + int limit = 10, + }) async { try { var commonProvider = Provider.of( navigatorKey.currentContext!, listen: false); - + if (selectedBillYear == null) { - throw Exception('${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.SELECT_BILLING_CYCLE)}'); + throw Exception( + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.SELECT_BILLING_CYCLE)}'); } Map params = { 'tenantId': commonProvider.userDetails!.selectedtenant!.code, 'offset': '${offset - 1}', 'limit': '${download ? -1 : limit}', - 'consumercode':consumerCode, - 'year':selectedBillYear.financialYear, + 'consumercode': consumerCode, + 'year': selectedBillYear.financialYear, }; var response = await ReportsRepo().fetchLedgerReport(params); if (response != null) { @@ -548,9 +584,8 @@ String formatYearMonth(String inputString) { if (ledgerReport != null && ledgerReport!.isNotEmpty) { this.limit = limit; this.offset = offset; - this.genericTableData = BillsTableData( - leadgerHeaderList, getLedgerData(ledgerReport!)); - + this.genericTableData = + BillsTableData(leadgerHeaderList, getLedgerData(ledgerReport!)); } } @@ -579,7 +614,8 @@ String formatYearMonth(String inputString) { navigatorKey.currentContext!, listen: false); if (selectedBillPeriod == null) { - throw Exception('${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.SELECT_BILLING_CYCLE)}'); + throw Exception( + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.SELECT_BILLING_CYCLE)}'); } Map params = { 'tenantId': commonProvider.userDetails!.selectedtenant!.code, @@ -645,7 +681,8 @@ String formatYearMonth(String inputString) { navigatorKey.currentContext!, listen: false); if (selectedBillPeriod == null) { - throw Exception('${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.SELECT_BILLING_CYCLE)}'); + throw Exception( + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.SELECT_BILLING_CYCLE)}'); } Map params = { 'tenantId': commonProvider.userDetails!.selectedtenant!.code, @@ -703,15 +740,16 @@ String formatYearMonth(String inputString) { Future getInactiveConsumerReport( {bool download = false, - int offset = 1, - int limit = 10, - String sortOrder = "ASC"}) async { + int offset = 1, + int limit = 10, + String sortOrder = "ASC"}) async { try { var commonProvider = Provider.of( navigatorKey.currentContext!, listen: false); if (selectedBillPeriod == null) { - throw Exception('${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.SELECT_BILLING_CYCLE)}'); + throw Exception( + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.SELECT_BILLING_CYCLE)}'); } Map params = { 'tenantId': commonProvider.userDetails!.selectedtenant!.code, @@ -728,15 +766,15 @@ String formatYearMonth(String inputString) { generateExcel( inactiveConsumerHeaderList .map((e) => - '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(e.label)}') + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(e.label)}') .toList(), getInactiveConsumersData(inactiveconsumers!, isExcel: true) - .map>( - (e) => e.tableRow.map((e) => e.label).toList()) - .toList() ?? + .map>( + (e) => e.tableRow.map((e) => e.label).toList()) + .toList() ?? [], title: - 'InactiveConsumers_${commonProvider.userDetails?.selectedtenant?.code?.substring(3)}_${selectedBillPeriod.toString().replaceAll('/', '_')}', + 'InactiveConsumers_${commonProvider.userDetails?.selectedtenant?.code?.substring(3)}_${selectedBillPeriod.toString().replaceAll('/', '_')}', optionalData: [ 'Inactive Consumer Report', '$selectedBillPeriod', @@ -748,8 +786,8 @@ String formatYearMonth(String inputString) { if (inactiveconsumers != null && inactiveconsumers!.isNotEmpty) { this.limit = limit; this.offset = offset; - this.genericTableData = BillsTableData( - inactiveConsumerHeaderList, getInactiveConsumersData(inactiveconsumers!)); + this.genericTableData = BillsTableData(inactiveConsumerHeaderList, + getInactiveConsumersData(inactiveconsumers!)); } } streamController.add(response); @@ -766,17 +804,19 @@ String formatYearMonth(String inputString) { callNotifier(); } } + Future getExpenseBillReport( {bool download = false, - int offset = 1, - int limit = 10, - String sortOrder = "ASC"}) async { + int offset = 1, + int limit = 10, + String sortOrder = "ASC"}) async { try { var commonProvider = Provider.of( navigatorKey.currentContext!, listen: false); if (selectedBillPeriod == null) { - throw Exception('${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.SELECT_BILLING_CYCLE)}'); + throw Exception( + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.SELECT_BILLING_CYCLE)}'); } Map params = { 'tenantId': commonProvider.userDetails!.selectedtenant!.code, @@ -793,15 +833,15 @@ String formatYearMonth(String inputString) { generateExcel( expenseBillReportHeaderList .map((e) => - '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(e.label)}') + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(e.label)}') .toList(), getExpenseBillReportData(expenseBillReportData!, isExcel: true) - .map>( - (e) => e.tableRow.map((e) => e.label).toList()) - .toList() ?? + .map>( + (e) => e.tableRow.map((e) => e.label).toList()) + .toList() ?? [], title: - 'ExpenseBillReport_${commonProvider.userDetails?.selectedtenant?.code?.substring(3)}_${selectedBillPeriod.toString().replaceAll('/', '_')}', + 'ExpenseBillReport_${commonProvider.userDetails?.selectedtenant?.code?.substring(3)}_${selectedBillPeriod.toString().replaceAll('/', '_')}', optionalData: [ 'Expense Bill Report', '$selectedBillPeriod', @@ -810,11 +850,12 @@ String formatYearMonth(String inputString) { 'Downloaded On ${DateFormats.timeStampToDate(DateTime.now().millisecondsSinceEpoch, format: 'dd/MMM/yyyy')}' ]); } else { - if (expenseBillReportData != null && expenseBillReportData!.isNotEmpty) { + if (expenseBillReportData != null && + expenseBillReportData!.isNotEmpty) { this.limit = limit; this.offset = offset; - this.genericTableData = BillsTableData( - expenseBillReportHeaderList, getExpenseBillReportData(expenseBillReportData!)); + this.genericTableData = BillsTableData(expenseBillReportHeaderList, + getExpenseBillReportData(expenseBillReportData!)); } } streamController.add(response); @@ -823,8 +864,7 @@ String formatYearMonth(String inputString) { streamController.add('error'); throw Exception('API Error'); } - } - catch (e, s) { + } catch (e, s) { ErrorHandler().allExceptionsHandler(navigatorKey.currentContext!, e, s); streamController.addError('error'); callNotifier(); @@ -833,15 +873,16 @@ String formatYearMonth(String inputString) { Future getVendorReport( {bool download = false, - int offset = 1, - int limit = 10, - String sortOrder = "ASC"}) async { + int offset = 1, + int limit = 10, + String sortOrder = "ASC"}) async { try { var commonProvider = Provider.of( navigatorKey.currentContext!, listen: false); if (selectedBillPeriod == null) { - throw Exception('${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.SELECT_BILLING_CYCLE)}'); + throw Exception( + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.SELECT_BILLING_CYCLE)}'); } Map params = { 'tenantId': commonProvider.userDetails!.selectedtenant!.code, @@ -858,15 +899,15 @@ String formatYearMonth(String inputString) { generateExcel( vendorReportHeaderList .map((e) => - '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(e.label)}') + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(e.label)}') .toList(), getVendorReportData(vendorReportData!, isExcel: true) - .map>( - (e) => e.tableRow.map((e) => e.label).toList()) - .toList() ?? + .map>( + (e) => e.tableRow.map((e) => e.label).toList()) + .toList() ?? [], title: - 'VendorReport_${commonProvider.userDetails?.selectedtenant?.code?.substring(3)}_${selectedBillPeriod.toString().replaceAll('/', '_')}', + 'VendorReport_${commonProvider.userDetails?.selectedtenant?.code?.substring(3)}_${selectedBillPeriod.toString().replaceAll('/', '_')}', optionalData: [ 'Vendor Report', '$selectedBillPeriod', @@ -888,8 +929,7 @@ String formatYearMonth(String inputString) { streamController.add('error'); throw Exception('API Error'); } - } - catch (e, s) { + } catch (e, s) { ErrorHandler().allExceptionsHandler(navigatorKey.currentContext!, e, s); streamController.addError('error'); callNotifier(); @@ -907,7 +947,8 @@ String formatYearMonth(String inputString) { //Create a Excel document. //Creating a workbook. - headers.insert(0, '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.S_NO)}'); + headers.insert(0, + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.S_NO)}'); final Workbook workbook = Workbook(); //Accessing via index final Worksheet sheet = workbook.worksheets[0]; @@ -922,20 +963,39 @@ String formatYearMonth(String inputString) { sheet.getRangeByName('A1:D1').columnWidth = 32.5; sheet.getRangeByName('A1:D1').cellStyle.hAlign = HAlignType.center; } else { - sheet.getRangeByName('A1:A${tableData.length+1}').columnWidth = 12.5; - sheet.getRangeByName('A1:A${tableData.length+1}').cellStyle.hAlign = HAlignType.center; - sheet.getRangeByName('A1:A${tableData.length+1}').autoFit(); - sheet.getRangeByName('B1:${CommonMethods.getAlphabetsWithKeyValue()[optionalData.length+1].label}1').columnWidth = 32.5; - sheet.getRangeByName('B1:${CommonMethods.getAlphabetsWithKeyValue()[optionalData.length+1].label}1').cellStyle.hAlign = HAlignType.center; - sheet.getRangeByName('B2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length+1].label}2').columnWidth = 32.5; - sheet.getRangeByName('A2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length+1].label}2').cellStyle.hAlign = HAlignType.center; - sheet.getRangeByName('A2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length+1].label}2').cellStyle.bold = true; + sheet.getRangeByName('A1:A${tableData.length + 1}').columnWidth = 12.5; + sheet.getRangeByName('A1:A${tableData.length + 1}').cellStyle.hAlign = + HAlignType.center; + sheet.getRangeByName('A1:A${tableData.length + 1}').autoFit(); + sheet + .getRangeByName( + 'B1:${CommonMethods.getAlphabetsWithKeyValue()[optionalData.length + 1].label}1') + .columnWidth = 32.5; + sheet + .getRangeByName( + 'B1:${CommonMethods.getAlphabetsWithKeyValue()[optionalData.length + 1].label}1') + .cellStyle + .hAlign = HAlignType.center; + sheet + .getRangeByName( + 'B2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length + 1].label}2') + .columnWidth = 32.5; + sheet + .getRangeByName( + 'A2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length + 1].label}2') + .cellStyle + .hAlign = HAlignType.center; + sheet + .getRangeByName( + 'A2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length + 1].label}2') + .cellStyle + .bold = true; dataStartRow = 3; headersStartRow = 2; for (int i = 0; i < optionalData.length; i++) { sheet .getRangeByName( - '${CommonMethods.getAlphabetsWithKeyValue()[i+1].label}1') + '${CommonMethods.getAlphabetsWithKeyValue()[i + 1].label}1') .setText( optionalData[CommonMethods.getAlphabetsWithKeyValue()[i].key]); } @@ -950,15 +1010,15 @@ String formatYearMonth(String inputString) { for (int i = dataStartRow; i < tableData.length + dataStartRow; i++) { for (int j = 0; j < headers.length; j++) { - if(j==0){ + if (j == 0) { sheet .getRangeByName( - '${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i') - .setText('${i - dataStartRow+1}'); - }else{ + '${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i') + .setText('${i - dataStartRow + 1}'); + } else { sheet .getRangeByName( - '${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i') + '${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i') .setText(tableData[i - dataStartRow][j - 1]); } sheet @@ -982,6 +1042,7 @@ String formatYearMonth(String inputString) { //Save and launch the file. await saveAndLaunchFile(bytes, '$title.xlsx'); } + Future getWaterConnectionsCount() async { try { var commonProvider = Provider.of( diff --git a/frontend/mgramseva/lib/services/mdms.dart b/frontend/mgramseva/lib/services/mdms.dart index e344c48b7..c196781fd 100644 --- a/frontend/mgramseva/lib/services/mdms.dart +++ b/frontend/mgramseva/lib/services/mdms.dart @@ -16,7 +16,7 @@ initRequestBody(tenantId) { { "moduleName": "tenant", "masterDetails": [ - {"name": "tenants"}, + // {"name": "tenants"}, {"name": "citymodule"} ], }, @@ -109,7 +109,7 @@ Map getTenantsMDMS(String tenantId) { { "moduleName": "tenant", "masterDetails": [ - {"name": "tenants"} + // {"name": "tenants"} ] } ] @@ -194,4 +194,4 @@ Map getTenantFinancialYearList(String tenantId) { ] } }; -} \ No newline at end of file +} diff --git a/frontend/micro-ui/web/micro-ui-internals/package.json b/frontend/micro-ui/web/micro-ui-internals/package.json index 2f6b4f69d..a87d6791f 100644 --- a/frontend/micro-ui/web/micro-ui-internals/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/package.json @@ -16,8 +16,8 @@ "node": ">=14" }, "scripts": { - "start": "SKIP_PREFLIGHT_CHECK=true run-s build start:dev", - "sprint": "SKIP_PREFLIGHT_CHECK=true run-s start:script", + "start": "run-s build start:dev", + "sprint": "run-s start:script", "start:dev": "run-p dev:**", "start:script": "./scripts/create.sh", "dev:css": "cd packages/css && yarn start", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/package.json b/frontend/micro-ui/web/micro-ui-internals/packages/css/package.json index 1e4e5f0d8..97e5c4677 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/css/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/package.json @@ -12,7 +12,7 @@ }, "scripts": { "start": "gulp build", - "build:prod": "NODE_ENV=production gulp build", + "build:prod": "SET NODE_ENV=production gulp build", "prepublish": "yarn build:prod", "deploy": "gulp && cp -R svg example && cp -R img example && gh-pages -d example" }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/Module.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/Module.js index 614e1ec81..563a39ca6 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/Module.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/Module.js @@ -8,6 +8,7 @@ import HRBanner from "./components/pageComponents/Banner"; import SelectDateofBirthEmployment from "./components/pageComponents/EmployeeDOB"; import SelectEmployeePhoneNumber from "./components/pageComponents/EmployeePhoneNumber"; import Jurisdictions from "./components/pageComponents/jurisdiction"; +import SelectUserTypeAndDesignation from "./components/pageComponents/SelectUserTypeAndDesignation"; import SelectDateofEmployment from "./components/pageComponents/SelectDateofEmployment"; import SelectEmployeeEmailId from "./components/pageComponents/SelectEmailId"; import SelectEmployeeCorrespondenceAddress from "./components/pageComponents/SelectEmployeeCorrespondenceAddress"; @@ -44,6 +45,7 @@ const componentsToRegister = { SelectEmployeeName, SelectEmployeeId, Jurisdictions, + SelectUserTypeAndDesignation, Assignments, ActionModal, HRBanner, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/Modal/EmployeeAppliaction.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/Modal/EmployeeAppliaction.js index c49e4de32..0148f4bef 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/Modal/EmployeeAppliaction.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/Modal/EmployeeAppliaction.js @@ -58,7 +58,7 @@ export const configEmployeeApplication = ({ t, action, selectFile, uploadedFile, ), }, - + { label: t("HR_REMARKS"), type: "text", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/MultiSelectDropdown.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/MultiSelectDropdown.js index 87a3fcee4..ad1472599 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/MultiSelectDropdown.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/MultiSelectDropdown.js @@ -2,19 +2,19 @@ import React, { useEffect, useReducer, useRef, useState } from "react"; import { ArrowDown, CheckSvg } from "@egovernments/digit-ui-react-components"; import { useTranslation } from "react-i18next"; -const MultiSelectDropdown = ({ options, optionsKey, selected = [], onSelect, defaultLabel = "", defaultUnit = "",BlockNumber=1,isOBPSMultiple=false,props={},isPropsNeeded=false,ServerStyle={}, isSurvey=false,placeholder, disable=false,config}) => { +const MultiSelectDropdown = ({ options, optionsKey, selected = [], onSelect, defaultLabel = "", defaultUnit = "", BlockNumber = 1, isOBPSMultiple = false, props = {}, isPropsNeeded = false, ServerStyle = {}, isSurvey = false, placeholder, disable = false, config }) => { const [active, setActive] = useState(false); const [searchQuery, setSearchQuery] = useState(); const [optionIndex, setOptionIndex] = useState(-1); const dropdownRef = useRef(); const { t } = useTranslation(); - function reducer(state, action){ - switch(action.type){ + function reducer(state, action) { + switch (action.type) { case "ADD_TO_SELECTED_EVENT_QUEUE": - return [...state, {[optionsKey]: action.payload?.[1]?.[optionsKey], propsData: action.payload} ] + return [...state, { [optionsKey]: action.payload?.[1]?.[optionsKey], propsData: action.payload }] case "REMOVE_FROM_SELECTED_EVENT_QUEUE": - const newState = state.filter( e => e?.[optionsKey] !== action.payload?.[1]?.[optionsKey]) + const newState = state.filter(e => e?.[optionsKey] !== action.payload?.[1]?.[optionsKey]) onSelect(newState.map((e) => e.propsData), props); return newState case "REPLACE_COMPLETE_STATE": @@ -25,115 +25,115 @@ const MultiSelectDropdown = ({ options, optionsKey, selected = [], onSelect, def } useEffect(() => { - dispatch({type: "REPLACE_COMPLETE_STATE", payload: fnToSelectOptionThroughProvidedSelection(selected) }) - },[selected?.length, selected?.[0]?.code]) + dispatch({ type: "REPLACE_COMPLETE_STATE", payload: fnToSelectOptionThroughProvidedSelection(selected) }) + }, [selected?.length, selected?.[0]?.code]) - function fnToSelectOptionThroughProvidedSelection(selected){ - return selected?.map( e => ({[optionsKey]: e?.[optionsKey], propsData: [null, e]})) + function fnToSelectOptionThroughProvidedSelection(selected) { + return selected?.map(e => ({ [optionsKey]: e?.[optionsKey], propsData: [null, e] })) } const [alreadyQueuedSelectedState, dispatch] = useReducer(reducer, selected, fnToSelectOptionThroughProvidedSelection) - - useEffect(()=> { - if(!active){ - onSelect(alreadyQueuedSelectedState?.map( e => e.propsData), props) + + useEffect(() => { + if (!active) { + onSelect(alreadyQueuedSelectedState?.map(e => e.propsData), props) } - },[active]) + }, [active]) - function handleOutsideClickAndSubmitSimultaneously(){ + function handleOutsideClickAndSubmitSimultaneously() { setActive(false) } - Digit.Hooks.useClickOutside(dropdownRef, handleOutsideClickAndSubmitSimultaneously , active, {capture: true} ); + Digit.Hooks.useClickOutside(dropdownRef, handleOutsideClickAndSubmitSimultaneously, active, { capture: true }); const filtOptns = - searchQuery?.length > 0 ? options.filter((option) => t(option[optionsKey]&&typeof option[optionsKey]=="string" && option[optionsKey].toUpperCase()).toLowerCase().indexOf(searchQuery.toLowerCase()) >= 0) : options; - + searchQuery?.length > 0 ? options.filter((option) => t(option[optionsKey] && typeof option[optionsKey] == "string" && option[optionsKey].toUpperCase()).toLowerCase().indexOf(searchQuery.toLowerCase()) >= 0) : options; + function onSearch(e) { setSearchQuery(e.target.value); } - function onSelectToAddToQueue(...props){ + function onSelectToAddToQueue(...props) { const isChecked = arguments[0].target.checked - isChecked ? dispatch({type: "ADD_TO_SELECTED_EVENT_QUEUE", payload: arguments }) : dispatch({type: "REMOVE_FROM_SELECTED_EVENT_QUEUE", payload: arguments }) + isChecked ? dispatch({ type: "ADD_TO_SELECTED_EVENT_QUEUE", payload: arguments }) : dispatch({ type: "REMOVE_FROM_SELECTED_EVENT_QUEUE", payload: arguments }) } -/* Custom function to scroll and select in the dropdowns while using key up and down */ - const keyChange = (e) => { + /* Custom function to scroll and select in the dropdowns while using key up and down */ + const keyChange = (e) => { if (e.key == "ArrowDown") { - setOptionIndex(state =>state+1== filtOptns.length?0:state+1); - if(optionIndex+1== filtOptns.length){ - e?.target?.parentElement?.parentElement?.children?.namedItem("jk-dropdown-unique")?.scrollTo?.(0,0) - }else{ - optionIndex>2&& e?.target?.parentElement?.parentElement?.children?.namedItem("jk-dropdown-unique")?.scrollBy?.(0,45) + setOptionIndex(state => state + 1 == filtOptns.length ? 0 : state + 1); + if (optionIndex + 1 == filtOptns.length) { + e?.target?.parentElement?.parentElement?.children?.namedItem("jk-dropdown-unique")?.scrollTo?.(0, 0) + } else { + optionIndex > 2 && e?.target?.parentElement?.parentElement?.children?.namedItem("jk-dropdown-unique")?.scrollBy?.(0, 45) } e.preventDefault(); } else if (e.key == "ArrowUp") { - setOptionIndex(state => state!==0? state - 1: filtOptns.length-1); - if(optionIndex===0){ - e?.target?.parentElement?.parentElement?.children?.namedItem("jk-dropdown-unique")?.scrollTo?.(100000,100000) - }else{ - optionIndex>2&&e?.target?.parentElement?.parentElement?.children?.namedItem("jk-dropdown-unique")?.scrollBy?.(0,-45) - } + setOptionIndex(state => state !== 0 ? state - 1 : filtOptns.length - 1); + if (optionIndex === 0) { + e?.target?.parentElement?.parentElement?.children?.namedItem("jk-dropdown-unique")?.scrollTo?.(100000, 100000) + } else { + optionIndex > 2 && e?.target?.parentElement?.parentElement?.children?.namedItem("jk-dropdown-unique")?.scrollBy?.(0, -45) + } e.preventDefault(); - }else if(e.key=="Enter"){ - onSelectToAddToQueue(e,filtOptns[optionIndex]); - } + } else if (e.key == "Enter") { + onSelectToAddToQueue(e, filtOptns[optionIndex]); + } } const MenuItem = ({ option, index }) => ( -
+
selectedOption[optionsKey] === option[optionsKey]) ? true : false} - onChange={(e) => isPropsNeeded?onSelectToAddToQueue(e, option,props):isOBPSMultiple?onSelectToAddToQueue(e, option,BlockNumber):onSelectToAddToQueue(e, option)} - style={{minWidth: "24px", width: "100%"}} + onChange={(e) => isPropsNeeded ? onSelectToAddToQueue(e, option, props) : isOBPSMultiple ? onSelectToAddToQueue(e, option, BlockNumber) : onSelectToAddToQueue(e, option)} + style={{ minWidth: "24px", width: "100%" }} disabled={option.isDisabled || false} />
- +

{t(option[optionsKey]&&typeof option[optionsKey]=="string" && option[optionsKey])}

+ opacity: 1, + backgroundColor: "rgba(238, 238, 238, var(--bg-opacity))" + } : {}} >{t(option[optionsKey] && typeof option[optionsKey] == "string" && option[optionsKey])}

); const Menu = () => { const filteredOptions = - searchQuery?.length > 0 ? options.filter((option) => t(option[optionsKey]&&typeof option[optionsKey]=="string" && option[optionsKey].toUpperCase()).toLowerCase().indexOf(searchQuery.toLowerCase()) >= 0) : options; + searchQuery?.length > 0 ? options.filter((option) => t(option[optionsKey] && typeof option[optionsKey] == "string" && option[optionsKey].toUpperCase()).toLowerCase().indexOf(searchQuery.toLowerCase()) >= 0) : options; return filteredOptions?.map((option, index) => ); }; return (
-
-
- setActive(true)} value={searchQuery} onChange={onSearch} placeholder={t(placeholder)} /> -
-

{alreadyQueuedSelectedState.length > 0 ? `${isSurvey? alreadyQueuedSelectedState?.filter((ob) => ob?.i18nKey !== undefined).length : alreadyQueuedSelectedState.length} ${defaultUnit}` : defaultLabel}

- +
+
+ setActive(true)} value={searchQuery} onChange={onSearch} placeholder={t(placeholder)} /> +
+

{alreadyQueuedSelectedState.length > 0 ? `${isSurvey ? alreadyQueuedSelectedState?.filter((ob) => ob?.i18nKey !== undefined).length : alreadyQueuedSelectedState.length} ${defaultUnit}` : defaultLabel}

+ +
+ {active ? ( +
+ +
+ ) : null} +
- {active ? ( -
- -
- ) : null} - -
- {config?.isDropdownWithChip ?
- {alreadyQueuedSelectedState.length > 0 && - alreadyQueuedSelectedState.map((value, index) => { - return onSelectToAddToQueue(e, value,props) - : (e) => onSelectToAddToQueue(e, value) - } />; - })} -
: null} + {config?.isDropdownWithChip ?
+ {alreadyQueuedSelectedState.length > 0 && + alreadyQueuedSelectedState.map((value, index) => { + return onSelectToAddToQueue(e, value, props) + : (e) => onSelectToAddToQueue(e, value) + } />; + })} +
: null}
); }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js index 9e1a3a999..cd5082eda 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js @@ -92,7 +92,7 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles { level: "code", value: 7, optionsKey: "name", isMandatory: false }, ]); const [tree, setTree] = useState(null); - const [rolesOptions,setRolesOptions] = useState(null) + const [rolesOptions, setRolesOptions] = useState(null) // const [zones,setZones] = useState([]) // const [circles,setCircles] = useState([]) // const [divisions,setDivisions] = useState([]) @@ -178,7 +178,7 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles // name: "MDMS Admin", // description: "Mdms admin", // }, - + // ]) setTree(resultInTree); return result; @@ -211,7 +211,7 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles "sectionCode": "", "code": "", "roles": [] - }, + }, }); const formData = watch(); @@ -225,7 +225,7 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles "sectionCode": "", "code": "", "roles": [] - }); + }); setUniqueRoles(null); setUniqueTenants(null); @@ -260,7 +260,7 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles return; // Exit the loop early } }); - + if (areMandatoryFieldsNotFilled) { setShowToast({ warning: true, label: t("ES_COMMON_MIN_SEARCH_CRITERIA_MSG") }); setTimeout(closeToast, 5000); @@ -268,7 +268,7 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles } //checking roles - if(data?.roles?.length === 0 || !data?.roles){ + if (data?.roles?.length === 0 || !data?.roles) { setShowToast({ warning: true, label: t("ES_COMMON_MIN_SEARCH_CRITERIA_MSG") }); setTimeout(closeToast, 5000); return; @@ -298,7 +298,7 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles //this is the list of tenants under the current subtree const listOfUniqueTenants = getUniqueLeafCodes(currentLevel); setUniqueTenants(() => listOfUniqueTenants); - setUniqueRoles(() => data?.roles?.filter(row=>row.code)?.map(role=> role.code)); + setUniqueRoles(() => data?.roles?.filter(row => row.code)?.map(role => role.code)); }; const optionsForHierarchy = (level, value) => { @@ -326,9 +326,8 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles const renderHierarchyFields = useMemo(() => { return hierarchy.map(({ level, optionsKey, isMandatory, ...rest }, idx) => ( - {`${t(Digit.Utils.locale.getTransformedLocale(`HR_SU_${level}`))} ${ - isMandatory ? "*" : "" - }`} + {`${t(Digit.Utils.locale.getTransformedLocale(`HR_SU_${level}`))} ${isMandatory ? "*" : "" + }`} (
) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserResults.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserResults.js index 0d9529dd0..425b368e1 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserResults.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserResults.js @@ -1,9 +1,9 @@ import React from 'react' import { useTranslation } from "react-i18next"; -import { Table,Loader,Card } from "@egovernments/digit-ui-react-components"; +import { Table, Loader, Card } from "@egovernments/digit-ui-react-components"; import { Link } from "react-router-dom"; -const SearchUserResults = ({isLoading,data,...props}) => { +const SearchUserResults = ({ isLoading, data, ...props }) => { const { t } = useTranslation(); const GetCell = (value) => {t(value)}; const GetSlaCell = (value) => { @@ -21,6 +21,8 @@ const SearchUserResults = ({isLoading,data,...props}) => { disableSortBy: false, accessor: "code", Cell: ({ row }) => { + console.log(row, "ROW"); + return ( {row.original.code} @@ -37,6 +39,22 @@ const SearchUserResults = ({isLoading,data,...props}) => { return GetCell(`${row.original?.user?.name}`); }, }, + { + Header: t("HR_USER_DEPARTMENT"), + disableSortBy: false, + accessor: "department", + Cell: ({ row }) => { + return GetCell(`${row.original?.assignments[0]?.department}`); + }, + }, + { + Header: t("HR_USER_DESIGNATION"), + disableSortBy: false, + accessor: "designation", + Cell: ({ row }) => { + return GetCell(`${row.original?.assignments[0]?.designation}`); + }, + }, { Header: t("HR_USER_ID_LABEL"), disableSortBy: false, @@ -53,6 +71,7 @@ const SearchUserResults = ({isLoading,data,...props}) => { return GetSlaCell(`${row.original?.isActive ? "ACTIVE" : "INACTIVE"}`); }, }, + { Header: t("HR_SU_TENANT"), disableSortBy: false, @@ -84,39 +103,39 @@ const SearchUserResults = ({isLoading,data,...props}) => { } else if (data?.length > 0) { result = ( { - return { - style: { - maxWidth: cellInfo.column.Header == t("HR_EMP_ID_LABEL") ? "150px" : "", - padding: "20px 18px", - fontSize: "16px", - minWidth: "150px", - }, - }; - }} - // onNextPage={onNextPage} - // onPrevPage={onPrevPage} - // currentPage={currentPage} - totalRecords={data ? data.length : 0} - // onPageSizeChange={onPageSizeChange} - // pageSizeLimit={pageSizeLimit} - // onSort={onSort} - // sortParams={sortParams} - // disableSort={disableSort} - autoSort={true} - manualPagination={false} + t={t} + data={data} + columns={columns} + getCellProps={(cellInfo) => { + return { + style: { + maxWidth: cellInfo.column.Header == t("HR_EMP_ID_LABEL") ? "150px" : "", + padding: "20px 18px", + fontSize: "16px", + minWidth: "150px", + }, + }; + }} + // onNextPage={onNextPage} + // onPrevPage={onPrevPage} + // currentPage={currentPage} + totalRecords={data ? data.length : 0} + // onPageSizeChange={onPageSizeChange} + // pageSizeLimit={pageSizeLimit} + // onSort={onSort} + // sortParams={sortParams} + // disableSort={disableSort} + autoSort={true} + manualPagination={false} /> ); } - return ( -
- {result} -
- ) + return ( +
+ {result} +
+ ) } export default SearchUserResults \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/config/config.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/config/config.js index 527cfae45..4d9398e1c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/config/config.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/config/config.js @@ -26,6 +26,13 @@ export const newConfig = [ key: "SelectEmployeeEmailId", withoutLabel: true, }, + { + type: "component", + isMandatory: true, + component: "SelectUserTypeAndDesignation", + key: "SelectUserTypeAndDesignation", + withoutLabel: true, + }, ], }, { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js new file mode 100644 index 000000000..f368126ca --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js @@ -0,0 +1,500 @@ +import { CardLabel, Dropdown, LabelFieldPair, Loader, RemoveableTag } from "@egovernments/digit-ui-react-components"; +import React, { useEffect, useState } from "react"; +import cleanup from "../Utils/cleanup"; +import MultiSelectDropdown from "./Multiselect"; +import { useParams } from "react-router-dom"; + +const makeDefaultValues = (sessionFormData) => { + return sessionFormData?.Jurisdictions?.map((ele, index) => { + return { + key: index, + hierarchy: { + code: ele?.hierarchy, + name: ele?.hierarchy, + }, + boundaryType: { label: ele?.boundaryType, i18text: ele.boundaryType ? `EGOV_LOCATION_BOUNDARYTYPE_${ele.boundaryType?.toUpperCase()}` : null }, + boundary: { code: ele?.boundary }, + divisionBoundary: ele?.divisionBoundary, + division: ele?.division, + designation: ele?.designation, + roles: ele?.roles, + department: ele?.department, + designation: ele?.designation + + + }; + }); +}; + +const SelectUserTypeAndDesignation = ({ t, config, onSelect, userType, formData }) => { + const tenantId = Digit.ULBService.getCurrentTenantId(); + const [inactiveJurisdictions, setInactiveJurisdictions] = useState([]); + const { data: data = {}, isLoading } = Digit.Hooks.hrms.useHrmsMDMS(tenantId, "egov-hrms", "HRMSRolesandDesignation") || {}; + const { id: employeeId } = useParams(); + const isupdate = Digit.SessionStorage.get("isupdate"); + const userDetails = Digit.UserService.getUser(); + const uuids = [userDetails?.info?.uuid]; + const { data: userData, isUserDataLoading } = Digit.Hooks.useUserSearch(Digit.ULBService.getStateId(), { uuid: uuids }, {}); + const employeeCreateSession = Digit.Hooks.useSessionStorage("NEW_EMPLOYEE_CREATE", {}); + const [sessionFormData, setSessionFormData, clearSessionFormData] = employeeCreateSession; + const isEdit = window.location.href?.includes("hrms/edit"); + const STATE_ADMIN = Digit.UserService.hasAccess(["STATE_ADMIN"]); + const [Boundary, selectboundary] = useState([]); + const [jurisdictions, setjurisdictions] = useState( + !isEdit && sessionFormData?.Jurisdictions?.length > 0 + ? makeDefaultValues(sessionFormData) + : formData?.Jurisdictions || [ + { + id: undefined, + key: 1, + hierarchy: null, + boundaryType: null, + boundary: null, + division: {}, + divisionBoundary: [], + roles: [], + department: {}, + designation: {} + }, + ] + ); + + + + const [userTypeDesignation, setUserTypeDesignation] = useState( + !isEdit && sessionFormData?.Jurisdictions?.length > 0 + ? makeDefaultValues(sessionFormData) + : formData?.Jurisdictions || [ + { + id: undefined, + key: 1, + hierarchy: null, + boundaryType: null, + boundary: null, + division: {}, + department: {}, + designation: {}, + divisionBoundary: [], + roles: [], + }, + ] + ); + const [jurisdictionsData, setJuristictionsData] = useState([]); + let hierarchylist = []; + // const hierarchyData = data?.MdmsRes?.["egov-location"]["TenantBoundary"].filter((ele) => ele?.hierarchyType?.code == "REVENUE")[0]?.hierarchyType; + // hierarchylist.push(hierarchyData); + + // User Details + const { isLoadingDesignation, isError, error, data: responseData, ...rest } = Digit.Hooks.hrms.useHRMSSearch({ codes: employeeId }, tenantId, null, isupdate); + + + + let divisions = []; + divisions = data?.MdmsRes?.["tenant"]["tenants"] + ?.filter((items) => items?.divisionCode) + ?.map((item) => { + return { + code: item.divisionCode, + name: item.divisionName, + i18text: Digit.Utils.locale.getCityLocale(item.divisionCode), + }; + }); + const uniqueDivisions = divisions?.reduce((unique, obj) => { + const isDuplicate = unique.some((item) => item.id === obj.id && item.name === obj.name); + if (!isDuplicate) { + unique.push(obj); + } + return unique; + }, []); + + useEffect(() => { + let cities = userData?.user[0]?.roles?.map((role) => role.tenantId)?.filter((value, index, array) => array.indexOf(value) === index); + + selectboundary( + data?.MdmsRes?.tenant?.tenants + ?.filter((city) => city.code != Digit.ULBService.getStateId() && cities?.includes(city.code)) + ?.map((city) => { + return { ...city, i18text: Digit.Utils.locale.getCityLocale(city.code) }; + }) + ); + }, [data, userData]); + + useEffect(() => { + let jurisdictionData = jurisdictions?.map((jurisdiction) => { + let res = { + id: jurisdiction?.id, + hierarchy: jurisdiction?.boundary?.code, + boundaryType: "City", + boundary: jurisdiction?.boundary?.code, + tenantId: STATE_ADMIN ? jurisdiction?.divisionBoundary && jurisdiction?.divisionBoundary[0]?.code : jurisdiction?.boundary?.code, + auditDetails: jurisdiction?.auditDetails, + division: jurisdiction?.division, + department: jurisdiction?.department, + designation: jurisdiction?.designation + }; + res = cleanup(res); + if (jurisdiction?.roles) { + res["roles"] = jurisdiction?.roles.map((ele) => { + delete ele.description; + return ele; + }); + } + if (jurisdiction?.divisionBoundary) { + res["divisionBoundary"] = jurisdiction?.divisionBoundary; + } + if (isEdit && STATE_ADMIN) { + data?.MdmsRes?.["tenant"]["tenants"]?.map((items) => { + if (items?.code === jurisdiction?.boundary?.code) { + res["division"] = { + code: items?.divisionCode, + i18text: Digit.Utils.locale.convertToLocale(items?.divisionCode, "EGOV_LOCATION_DIVISION"), + }; + res["divisionBoundary"] = [ + { + name: items.name, + code: items.code, + i18text: Digit.Utils.locale.getCityLocale(items.code), + }, + ]; + } + }); + } + return res; + }); + if (isEdit && STATE_ADMIN) { + let divisionData = []; + if (isEdit && jurisdictionData.length > 0) { + jurisdictionData?.map((jurisdiction) => { + if (jurisdiction?.divisionBoundary && jurisdiction?.divisionBoundary?.length > 0 && divisionData.length === 0) { + divisionData.push(jurisdiction); + } else if (divisionData.length > 0) { + if (divisionData[divisionData.length - 1]?.division?.code !== jurisdiction?.division?.code) { + divisionData.push(jurisdiction); + } + } + }); + } + + let finalData = []; + divisionData && + divisionData?.length > 0 && + divisionData?.map((data, index) => { + let divisionBoundarydata = []; + jurisdictionData?.map((jurisdiction) => { + if (data?.division?.code === jurisdiction?.division?.code) { + if (divisionBoundarydata?.length === 0) { + jurisdiction?.divisionBoundary[0] !== undefined && divisionBoundarydata.push(jurisdiction?.divisionBoundary[0]); + } else if (divisionBoundarydata?.length > 0) { + if (divisionBoundarydata[divisionBoundarydata?.length - 1]?.code !== jurisdiction?.divisionBoundary[0]) { + jurisdiction?.divisionBoundary[0] !== undefined && divisionBoundarydata.push(jurisdiction?.divisionBoundary[0]); + } + } + } + }); + let obj = { + ...data, + key: index, + divisionBoundary: divisionBoundarydata, + }; + finalData.push(obj); + }); + + jurisdictionData = finalData; + } + setJuristictionsData(jurisdictionData); + onSelect( + config.key, + [...jurisdictionData, ...inactiveJurisdictions].filter((value) => Object.keys(value).length !== 0) + ); + + }, [jurisdictions, data?.MdmsRes]); + + const reviseIndexKeys = () => { + setjurisdictions((prev) => prev.map((unit, index) => ({ ...unit, key: index }))); + }; + + function filterJurisdictions(unit, jurisdictions) { + const divisionBoundaryCodes = new Set(unit.divisionBoundary.map(item => item.code)); + return jurisdictions.filter(jurisdiction => { + return !divisionBoundaryCodes.has(jurisdiction.boundary.code); + }); + } + const handleRemoveUnit = (unit) => { + if (STATE_ADMIN) { + if (!isEdit) { + setjurisdictions(jurisdictions.filter( + (element) => element.key !== unit.key + )); + setjurisdictions((prev) => prev.map((unit, index) => ({ ...unit, key: index }))); + } + else { + setJuristictionsData(jurisdictionsData.filter( + (element) => element.key !== unit.key + )); + let filterJurisdictionsItems = filterJurisdictions(unit, jurisdictions); + setjurisdictions(filterJurisdictionsItems); + setjurisdictions((prev) => prev.map((unit, index) => ({ ...unit, key: index }))); + } + if (FormData.errors?.Jurisdictions?.type == unit.key) { + clearErrors("Jurisdictions"); + } + reviseIndexKeys(); + } + else { + if (unit.id) { + let res = { + id: unit?.id, + hierarchy: unit?.hierarchy?.code, + boundaryType: unit?.boundaryType?.label, + boundary: unit?.boundary?.code, + division: unit?.division?.code, + tenantId: unit?.boundary?.code, + auditDetails: unit?.auditDetails, + isdeleted: true, + isActive: false, + }; + res = cleanup(res); + if (unit?.roles) { + res["roles"] = unit?.roles.map((ele) => { + delete ele.description; + return ele; + }); + } + setInactiveJurisdictions([...inactiveJurisdictions, res]); + } + setJuristictionsData((pre) => pre.filter((el) => el.key !== unit.key)); + setjurisdictions((prev) => prev.filter((el) => el.key !== unit.key)); + if (FormData.errors?.Jurisdictions?.type == unit.key) { + clearErrors("Jurisdictions"); + } + + reviseIndexKeys(); + + } + + }; + let boundaryTypeoption = []; + const [focusIndex, setFocusIndex] = useState(-1); + + + + function getroledata() { + if (STATE_ADMIN) { + // Specify the role codes you want to filter + const roleCodesToFilter = ["HRMS_ADMIN", "EMPLOYEE", "DIV_ADMIN"]; + // Use the filter method to extract roles with the specified codes + return data?.MdmsRes?.["ws-services-masters"]["WSServiceRoles"] + .filter((role) => { + return roleCodesToFilter.includes(role.code); + }) + .map((role) => { + return { code: role.code, name: role?.name ? role?.name : " ", i18text: "ACCESSCONTROL_ROLES_ROLES_" + role.code }; + }); + } else { + // Specify the role codes you want to filter + const roleCodesToFilter = ["HRMS_ADMIN", "DIV_ADMIN", "MDMS_ADMIN", "LOC_ADMIN", "SYSTEM"]; + // Use the filter method to extract roles with the specified codes + return data?.MdmsRes?.["ws-services-masters"].WSServiceRoles?.filter((role) => { + return !roleCodesToFilter.includes(role.code); + })?.map((role) => { + return { code: role.code, name: role?.name ? role?.name : " ", i18text: "ACCESSCONTROL_ROLES_ROLES_" + role.code }; + }); + } + } + + function getdesignationdata() { + + return data?.MdmsRes?.["common-masters"]?.Designation?.map((ele) => { + ele["i18key"] = t("COMMON_MASTERS_DESIGNATION_" + ele.code); + return ele; + }); + } + function getUserTypes() { + + return data?.MdmsRes?.["common-masters"]?.Department?.map((ele) => { + ele["i18key"] = t("COMMON_MASTERS_DEPARTMENT" + ele.code); + return ele; + }); + } + + if (isLoading && isUserDataLoading && isLoadingDesignation) { + return ; + } + // console.log(dataDesignation, "dataDesignation"); + + return ( +
+ +
+ ); +}; + +function Jurisdiction({ + t, + formData, + data, + userDetails, + jurisdiction, + jurisdictions, + setjurisdictions, + setJuristictionsData, + jurisdictionsData, + onSelect, + config, + handleRemoveUnit, + hierarchylist, + divisions, + getroledata, + roleoption, + index, + Boundary, + getdesignationdata, + getUserTypes, + responseData +}) { + // console.log(responseData?.Employees[0]?.assignments[0]?.department, "responseData"); + // console.log(responseData?.Employees[0]?.assignments[0]?.designation, "responseData"); + + const [BoundaryType, selectBoundaryType] = useState([]); + const [divisionBoundary, setDivisionBoundary] = useState([]); + const [designationList, setDesignationList] = useState([]); + const [depamentValue, setDepamentValue] = useState(""); + const [designationValue, setDesignationValue] = useState(""); + + const [Division, setDivision] = useState([]); + const STATE_ADMIN = Digit.UserService.hasAccess(["STATE_ADMIN"]); + let isMobile = window.Digit.Utils.browser.isMobile(); + const isEdit = window.location.href?.includes("hrms/edit"); + let defaultjurisdiction = () => { + let currentTenant = Digit.ULBService.getCurrentTenantId(); + let defaultjurisdiction; + Boundary?.map((ele) => { + if (ele.code === currentTenant) { + defaultjurisdiction = ele; + } + }) + return defaultjurisdiction; + } + useEffect(() => { + if (responseData != null && depamentValue == "") { + getUserTypes?.forEach((ele) => { + if (ele.code === responseData?.Employees[0]?.assignments[0]?.department) { + setDepamentValue(ele); + const filteredItems = getdesignationdata.filter(val => val.department.includes(ele.code)); + setDesignationList(filteredItems); + setjurisdictions((pre) => pre.map((item) => (item.key == jurisdiction.key ? { ...item, department: ele } : item))); + } + }); + } + },); + + useEffect(() => { + if (responseData != null) { + getdesignationdata?.forEach((ele) => { + if (ele.code === responseData?.Employees[0]?.assignments[0]?.designation) { + setDesignationValue(ele); + setjurisdictions((pre) => pre.map((item) => (item.key === jurisdiction.key ? { ...item, designation: ele } : item))); + } + }); + } + }, [depamentValue]); + useEffect(() => { + setDivision( + divisions?.map((item) => { + return { ...item, i18text: Digit.Utils.locale.convertToLocale(item.code, "EGOV_LOCATION_DIVISION") }; + }) + ); + }, [divisions]); + + const tenant = Digit.ULBService.getCurrentTenantId(); + + useEffect(() => { + if (Boundary?.length > 0) { + selectedboundary(Boundary?.filter((ele) => ele.code == jurisdiction?.boundary?.code)[0]); + } + }, [Boundary]); + + const selectedboundary = (value) => { + setjurisdictions((pre) => pre.map((item) => (item.key === jurisdiction.key ? { ...item, boundary: value } : item))); + }; + const selectDepartment = (value) => { + setDesignationList([]); + setjurisdictions((pre) => pre.map((item) => (item.key == jurisdiction.key ? { ...item, department: value } : item))); + const filteredItems = getdesignationdata.filter(val => val.department.includes(value.code)); + setDesignationList(filteredItems); + }; + const selectDesignation = (value) => { + setjurisdictions((pre) => pre.map((item) => (item.key === jurisdiction.key ? { ...item, designation: value } : item))); + }; + + + + return ( +
+ { + !STATE_ADMIN && ( +
+
+ + + {`${t("HR_COMMON_DEPARTMENT")} * `} + + + +
+
+ + + {`${t("HR_COMMON_USER_DESIGNATION")} * `} + + + +
+
) + } +
+ ); +} + +export default SelectUserTypeAndDesignation; + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/assignment.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/assignment.js index 92abd194a..e1bc15ea3 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/assignment.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/assignment.js @@ -216,6 +216,7 @@ function Assignment({ const ValidateDatePickers = (value) => { assignments; }; + console.log(assignment,"assignment"); return (
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js index 5ff0f0e2f..8cb17be8b 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js @@ -33,21 +33,23 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { const isEdit = window.location.href?.includes("hrms/edit"); const STATE_ADMIN = Digit.UserService.hasAccess(["STATE_ADMIN"]); const [Boundary, selectboundary] = useState([]); + const [subDivisionList, selectSubDivisionList] = useState([]); + const [sectionList, selectSectionListList] = useState([]); const [jurisdictions, setjurisdictions] = useState( !isEdit && sessionFormData?.Jurisdictions?.length > 0 ? makeDefaultValues(sessionFormData) : formData?.Jurisdictions || [ - { - id: undefined, - key: 1, - hierarchy: null, - boundaryType: null, - boundary: null, - division: {}, - divisionBoundary: [], - roles: [], - }, - ] + { + id: undefined, + key: 1, + hierarchy: null, + boundaryType: null, + boundary: null, + division: {}, + divisionBoundary: [], + roles: [], + }, + ] ); const [jurisdictionsData, setJuristictionsData] = useState([]); let hierarchylist = []; @@ -55,6 +57,8 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { // hierarchylist.push(hierarchyData); let divisions = []; + let subDivisionsItems = []; + let sectionItems = []; divisions = data?.MdmsRes?.["tenant"]["tenants"] ?.filter((items) => items?.divisionCode) ?.map((item) => { @@ -64,6 +68,25 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { i18text: Digit.Utils.locale.getCityLocale(item.divisionCode), }; }); + subDivisionsItems = data?.MdmsRes?.["tenant"]["tenants"] + ?.filter((items) => items?.subDivisionCode) + ?.map((item) => { + return { + code: item.subDivisionCode, + name: item.subDivisionName, + i18text: Digit.Utils.locale.getCityLocale(item.subDivisionCode), + }; + }); + + const uniqueSubDivisionsItems = subDivisionsItems?.reduce((unique, obj) => { + const isDuplicate = unique.some((item) => item.id === obj.id && item.name === obj.name); + if (!isDuplicate) { + unique.push(obj); + } + return unique; + }, []); + + const uniqueDivisions = divisions?.reduce((unique, obj) => { const isDuplicate = unique.some((item) => item.id === obj.id && item.name === obj.name); if (!isDuplicate) { @@ -82,6 +105,11 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { return { ...city, i18text: Digit.Utils.locale.getCityLocale(city.code) }; }) ); + if (uniqueSubDivisionsItems != null) { + selectSubDivisionList(uniqueSubDivisionsItems); + + } + // selectSectionListList }, [data, userData]); useEffect(() => { @@ -169,19 +197,16 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { config.key, [...jurisdictionData, ...inactiveJurisdictions].filter((value) => Object.keys(value).length !== 0) ); - + }, [jurisdictions, data?.MdmsRes]); - // useEffect(() => { - // setJuristictionsData(formData?.Jurisdictions); - // }, [formData?.Jurisdictions, jurisdictions]); const reviseIndexKeys = () => { setjurisdictions((prev) => prev.map((unit, index) => ({ ...unit, key: index }))); }; const handleAddUnit = () => { - if(STATE_ADMIN){ - if(!isEdit){ + if (STATE_ADMIN) { + if (!isEdit) { setjurisdictions((prev) => [ ...prev, { @@ -195,7 +220,7 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { }, ]); setjurisdictions((prev) => prev.map((unit, index) => ({ ...unit, key: index }))); - }else{ + } else { setJuristictionsData((prev) => [ ...prev, { @@ -209,9 +234,9 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { }, ]); setJuristictionsData((prev) => prev.map((unit, index) => ({ ...unit, key: index }))); - } + } - }else{ + } else { setjurisdictions((prev) => [ ...prev, { @@ -239,32 +264,21 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { }); } const handleRemoveUnit = (unit) => { - if(STATE_ADMIN){ - if(!isEdit){ + if (STATE_ADMIN) { + if (!isEdit) { setjurisdictions(jurisdictions.filter( (element) => element.key !== unit.key )); setjurisdictions((prev) => prev.map((unit, index) => ({ ...unit, key: index }))); } - else{ + else { setJuristictionsData(jurisdictionsData.filter( (element) => element.key !== unit.key )); - let filterJurisdictionsItems = filterJurisdictions(unit,jurisdictions); + let filterJurisdictionsItems = filterJurisdictions(unit, jurisdictions); setjurisdictions(filterJurisdictionsItems); setjurisdictions((prev) => prev.map((unit, index) => ({ ...unit, key: index }))); } - // console.log(jurisdictions,"jurisdictions"); - // console.log(jurisdictionsData,"jurisdictionsData"); - // setJuristictionsData((pre) => pre.filter((el) => el.key !== unit.key)); - - - - - - - // setjurisdictions(jurisdictions.filter((element) => element.key !== unit.key)); - // setjurisdictions((prev) => prev.filter((el) => el.key !== unit.key)); if (FormData.errors?.Jurisdictions?.type == unit.key) { clearErrors("Jurisdictions"); } @@ -272,7 +286,7 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { } - else{ + else { if (unit.id) { let res = { id: unit?.id, @@ -299,7 +313,7 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { if (FormData.errors?.Jurisdictions?.type == unit.key) { clearErrors("Jurisdictions"); } - + reviseIndexKeys(); } @@ -333,10 +347,10 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { }); } } + if (isLoading && isUserDataLoading) { return ; } - console.log((isEdit && STATE_ADMIN),"isEdit && STATE_ADMIN"); return (
{isEdit && STATE_ADMIN ? ( @@ -389,6 +403,10 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { getroledata={getroledata} handleRemoveUnit={handleRemoveUnit} Boundary={Boundary} + // SUBDIVISION & SECTION + subDivisionList={subDivisionList} + sectionList={sectionList} + // SUBDIVISION & SECTION /> )) )} @@ -418,24 +436,29 @@ function Jurisdiction({ roleoption, index, Boundary, + // SUBDIVISION + subDivisionList, + sectionList, + // SUBDIVISION }) { const [BoundaryType, selectBoundaryType] = useState([]); // const [Boundary, selectboundary] = useState([]); const [divisionBoundary, setDivisionBoundary] = useState([]); + const [sectionDataList, setSectionDataList] = useState([]); const [Division, setDivision] = useState([]); const STATE_ADMIN = Digit.UserService.hasAccess(["STATE_ADMIN"]); let isMobile = window.Digit.Utils.browser.isMobile(); const isEdit = window.location.href?.includes("hrms/edit"); - let defaultjurisdiction = () =>{ + let defaultjurisdiction = () => { let currentTenant = Digit.ULBService.getCurrentTenantId(); let defaultjurisdiction; - Boundary?.map((ele)=>{ - if (ele.code === currentTenant){ + Boundary?.map((ele) => { + if (ele.code === currentTenant) { defaultjurisdiction = ele; } }) return defaultjurisdiction; - } + } useEffect(() => { setDivision( @@ -464,6 +487,33 @@ function Jurisdiction({ setjurisdictions((pre) => pre.map((item) => (item.key === jurisdiction.key ? { ...item, boundary: value } : item))); }; + + const selectSubDivisionList = (value) => { + setjurisdictions((pre) => pre.map((item) => (item.key === jurisdiction.key ? { ...item, subDivision: value } : item))); + + var sections = data?.MdmsRes?.tenant?.tenants + ?.filter((division) => division.subDivisionCode === value.code) + ?.map((division) => { + return { + code: division.sectionCode, + name: division.sectionName, + i18text: Digit.Utils.locale.getCityLocale(division.sectionCode) + }; + }); + const uniqueSections = sections?.reduce((unique, obj) => { + const isDuplicate = unique.some((item) => item.code === obj.code && item.name === obj.name); + if (!isDuplicate) { + unique.push(obj); + } + return unique; + }, []); + setSectionDataList(uniqueSections); + }; + + const selectSectionList = (value) => { + setjurisdictions((pre) => pre.map((item) => (item.key === jurisdiction.key ? { ...item, section: value } : item))); + }; + const selectDivision = (value) => { // Extract projects using array methods const project = data?.MdmsRes?.["tenant"]["tenants"].filter((obj) => obj.divisionCode === value.code); @@ -537,7 +587,7 @@ function Jurisdiction({ [...data].filter((value) => Object.keys(value).length !== 0) ); setjurisdictions((pre) => pre.map((item) => (item.key === jurisdiction.key ? { ...item, roles: res } : item))); - selectedboundary(jurisdiction?.boundary?jurisdiction?.boundary:defaultjurisdiction()); + selectedboundary(jurisdiction?.boundary ? jurisdiction?.boundary : defaultjurisdiction()); }; const selectDivisionBoundary = (e) => { @@ -664,7 +714,33 @@ function Jurisdiction({
) : ( + // subDivision + {/* {!STATE_ADMIN && + {`${t("HR_SUB_DIVISION_LABEL")} * `} + + } + {/* Section */} + {/* {!STATE_ADMIN && + {`${t("HR_SUB_DIVISION_LABEL")} * `} + + } */} {`${t("HR_BOUNDARY_LABEL")} * `} { } }, [mobileNumber]); + let defaultValues = { tenantId: tenantId, employeeStatus: "EMPLOYED", @@ -70,6 +71,11 @@ const EditForm = ({ tenantId, data }) => { name: `COMMON_GENDER_${data?.user?.gender}`, }, }, + SelectUserTypeAndDesignation: { + department: data?.assignments[0]?.department, + designation: data?.assignments[0]?.designation + }, + SelectDateofBirthEmployment: { dob: convertEpochToDate(data?.user?.dob) }, Jurisdictions: data?.jurisdictions?.map((ele, index) => { @@ -151,19 +157,19 @@ const EditForm = ({ tenantId, data }) => { } } } - + if ( formData?.SelectEmployeeGender?.gender.code && - formData?.SelectEmployeeName?.employeeName && - formData?.SelectEmployeePhoneNumber?.mobileNumber && - STATE_ADMIN ? - (formData?.Jurisdictions?.length && !formData?.Jurisdictions.some(juris => juris?.division == undefined || juris?.divisionBoundary?.length === 0 ) ) - :formData?.Jurisdictions?.length && formData?.Jurisdictions.length && !formData?.Jurisdictions.some(juris => juris?.roles?.length === 0 ) - && - checkfield && - phonecheck && - checkMailNameNum(formData)&& - hasUniqueTenantIds(formData?.Jurisdictions) + formData?.SelectEmployeeName?.employeeName && + formData?.SelectEmployeePhoneNumber?.mobileNumber && + STATE_ADMIN ? + (formData?.Jurisdictions?.length && !formData?.Jurisdictions.some(juris => juris?.division == undefined || juris?.divisionBoundary?.length === 0)) + : formData?.Jurisdictions?.length && formData?.Jurisdictions.length && !formData?.Jurisdictions.some(juris => juris?.roles?.length === 0) + && + checkfield && + phonecheck && + checkMailNameNum(formData) && + hasUniqueTenantIds(formData?.Jurisdictions) ) { setSubmitValve(true); } else { @@ -286,7 +292,16 @@ const EditForm = ({ tenantId, data }) => { } let requestdata = Object.assign({}, data); roles = [].concat.apply([], roles); - requestdata.assignments = input?.Assignments ? input?.Assignments : data?.assignments; + // console.log(input?.SelectUserTypeAndDesignation, "input?.Assignments"); + // console.log(data?.assignments, "data?.assignments"); + // console.log(input, "INPUT"); + + let dataAssignments = data?.assignments[0]; + dataAssignments.department = input.SelectUserTypeAndDesignation[0]?.department?.code; + dataAssignments.designation = input.SelectUserTypeAndDesignation[0]?.designation?.code; + + + requestdata.assignments = input?.Assignments ? input?.Assignments : dataAssignments; requestdata.dateOfAppointment = Date.parse(input?.SelectDateofEmployment?.dateOfAppointment); requestdata.code = input?.SelectEmployeeId?.code ? input?.SelectEmployeeId?.code : data?.code; requestdata.jurisdictions = jurisdictions; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EmployeeDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EmployeeDetails.js index 44d54f83a..dad8eff18 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EmployeeDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EmployeeDetails.js @@ -42,6 +42,8 @@ const Details = () => { } }); }); + // console.log(data, "data"); + useEffect(() => { setMutationHappened(false); clearSuccessData(); @@ -63,7 +65,7 @@ const Details = () => { window.open(documentLink, "_blank"); }; - const submitAction = (data) => {}; + const submitAction = (data) => { }; useEffect(() => { switch (selectedAction) { @@ -115,6 +117,8 @@ const Details = () => { + + {data?.Employees?.[0]?.isActive == false ? ( @@ -129,8 +133,8 @@ const Details = () => { text={ t( "EGOV_HRMS_DEACTIVATIONREASON_" + - data?.Employees?.[0]?.deactivationDetails?.sort((a, b) => new Date(a.effectiveFrom) - new Date(b.effectiveFrom))[0] - .reasonForDeactivation + data?.Employees?.[0]?.deactivationDetails?.sort((a, b) => new Date(a.effectiveFrom) - new Date(b.effectiveFrom))[0] + .reasonForDeactivation ) || "NA" } /> @@ -173,41 +177,41 @@ const Details = () => { {data?.Employees?.[0]?.jurisdictions?.length > 0 ? data?.Employees?.[0]?.jurisdictions?.map((element, index) => { - return ( - -
- {" "} - {t("HR_JURISDICTION")} {index + 1} -
- {STATE_ADMIN ? ( - - ) : null} - - {!STATE_ADMIN ? ( - ele.tenantId == element?.boundary) - ?.map((ele) => t(`ACCESSCONTROL_ROLES_ROLES_` + ele?.code))} - /> - ) : null} -
- ); - }) + return ( + +
+ {" "} + {t("HR_JURISDICTION")} {index + 1} +
+ {STATE_ADMIN ? ( + + ) : null} + + {!STATE_ADMIN ? ( + ele.tenantId == element?.boundary) + ?.map((ele) => t(`ACCESSCONTROL_ROLES_ROLES_` + ele?.code))} + /> + ) : null} +
+ ); + }) : null}
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/SearchUser.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/SearchUser.js index ead17dcfd..68bcb3a5d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/SearchUser.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/SearchUser.js @@ -1,4 +1,4 @@ -import React,{useState,useEffect} from 'react' +import React, { useState, useEffect } from 'react' import SearchUserForm from '../components/SearchUserForm' import SearchUserResults from '../components/SearchUserResults'; import { Header } from '@egovernments/digit-ui-react-components' @@ -6,18 +6,18 @@ import { useTranslation } from "react-i18next"; const SearchUser = () => { - const {t} = useTranslation() - const [uniqueTenants,setUniqueTenants] = useState(null) - const [roles,setUniqueRoles] = useState(null) + const { t } = useTranslation() + const [uniqueTenants, setUniqueTenants] = useState(null) + const [roles, setUniqueRoles] = useState(null) const requestCriteriaForEmployeeSearch = { url: "/egov-hrms/employees/_searchListOfEmployee", params: {}, body: { - criteria:{ - tenantIds:uniqueTenants, - roles:roles, - type:"EMPLOYEE" + criteria: { + tenantIds: uniqueTenants, + roles: roles, + type: "EMPLOYEE" } }, config: { @@ -25,13 +25,14 @@ const SearchUser = () => { select: (data) => { return data?.Employees }, - + }, - changeQueryName:{uniqueTenants,roles} + changeQueryName: { uniqueTenants, roles } }; const { isLoading, data, revalidate, isFetching, error } = Digit.Hooks.useCustomAPIHook(requestCriteriaForEmployeeSearch); - + + return (
@@ -39,8 +40,8 @@ const SearchUser = () => {
{t("HR_SU")}
-
- +
+
) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js index 411ae2229..daf9ebf1e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js @@ -126,20 +126,23 @@ const CreateEmployee = () => { } } + + + if ( formData?.SelectEmployeeGender?.gender.code && - formData?.SelectEmployeeName?.employeeName && - formData?.SelectEmployeePhoneNumber?.mobileNumber && - formData?.Jurisdictions?.length && - STATE_ADMIN ? - (formData?.Jurisdictions.length && !formData?.Jurisdictions.some(juris => juris?.division == undefined || juris?.divisionBoundary?.length === 0 ) ) - - :formData?.Jurisdictions?.length && formData?.Jurisdictions.length && !formData?.Jurisdictions.some(juris => juris?.roles?.length === 0 ) - && - checkfield && - phonecheck && - checkMailNameNum(formData) && - hasUniqueTenantIds(formData?.Jurisdictions) + formData?.SelectEmployeeName?.employeeName && + formData?.SelectEmployeePhoneNumber?.mobileNumber && + formData?.Jurisdictions?.length && + STATE_ADMIN ? + (formData?.Jurisdictions.length && !formData?.Jurisdictions.some(juris => juris?.division == undefined || juris?.divisionBoundary?.length === 0)) + + : formData?.Jurisdictions?.length && formData?.Jurisdictions.length && !formData?.Jurisdictions.some(juris => juris?.roles?.length === 0) + && + checkfield && + phonecheck && + checkMailNameNum(formData) && + hasUniqueTenantIds(formData?.Jurisdictions) ) { setSubmitValve(true); } else { @@ -152,6 +155,7 @@ const CreateEmployee = () => { }; const onSubmit = (data) => { + if (!STATE_ADMIN && data.Jurisdictions?.filter((juris) => juris.tenantId == tenantId).length == 0) { setShowToast({ key: true, label: "ERR_BASE_TENANT_MANDATORY" }); closeToast(); @@ -260,6 +264,7 @@ const CreateEmployee = () => { code: "EMPLOYEE", tenantId: "pb", }); + const mappedroles = [].concat.apply([], roles); let dateOfAppointment = new Date(); dateOfAppointment.setDate(dateOfAppointment.getDate() - 1); @@ -267,7 +272,6 @@ const CreateEmployee = () => { { tenantId: tenantId, employeeStatus: "EMPLOYED", - code: data?.SelectEmployeeId?.code ? data?.SelectEmployeeId?.code : undefined, dateOfAppointment: dateOfAppointment.getTime(), employeeType: hrmsData?.["egov-hrms"]?.HRMSConfig[0]?.employeeType, @@ -276,10 +280,11 @@ const CreateEmployee = () => { { fromDate: new Date().getTime(), isCurrentAssignment: hrmsData?.["egov-hrms"]?.HRMSConfig[0]?.isCurrentAssignment, - department: hrmsData?.["egov-hrms"]?.HRMSConfig[0]?.department, + department: !STATE_ADMIN ? data?.SelectUserTypeAndDesignation[0]?.department?.code : + hrmsData?.["egov-hrms"]?.HRMSConfig[0]?.department, designation: STATE_ADMIN ? hrmsData?.["egov-hrms"]?.HRMSConfig[0]?.designation?.filter((x) => x?.isStateUser)[0]?.code - : hrmsData?.["egov-hrms"]?.HRMSConfig[0]?.designation?.filter((x) => !x?.isStateUser)[0]?.code, + : data?.SelectUserTypeAndDesignation[0]?.designation?.code, }, ], user: { @@ -317,6 +322,7 @@ const CreateEmployee = () => { if (isLoading) { return ; } + const config = mdmsData?.config ? mdmsData.config : newConfig; return (
From 43be3ee90013a0bd81c3c836cbac8040ab6e3e5f Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Wed, 7 Aug 2024 18:12:50 +0530 Subject: [PATCH 106/133] Ledger Changes --- frontend/mgramseva/lib/providers/reports_provider.dart | 3 ++- .../packages/modules/hrms/src/components/InboxFilter.js | 3 ++- .../packages/modules/hrms/src/components/SearchUserForm.js | 6 +++++- .../hrms/src/components/pageComponents/jurisdiction.js | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/frontend/mgramseva/lib/providers/reports_provider.dart b/frontend/mgramseva/lib/providers/reports_provider.dart index fff2b517b..d572810cc 100644 --- a/frontend/mgramseva/lib/providers/reports_provider.dart +++ b/frontend/mgramseva/lib/providers/reports_provider.dart @@ -209,7 +209,8 @@ class ReportsProvider with ChangeNotifier { '${DateFormats.leadgerTimeStampToDate(data.months?.values.first.payment?.first.paymentCollectionDate)}'), TableData('${data.months?.values.first.payment?.first.receiptNo}'), TableData('₹ ${data.months?.values.first.payment?.first.amountPaid}'), - TableData('₹ ${data.months?.values.first.demand?.previousMonthBalance}'), + TableData( + '₹ ${(double.parse("${data.months?.values.first.demand?.totalDues}") - double.parse("${data.months?.values.first.payment?.first.amountPaid}"))}'), TableData( '${DateFormats.leadgerTimeStampToDate(data.months?.values.first.demand?.penaltyAppliedOnDate)}'), TableData('₹ ${data.months?.values.first.demand?.penalty}'), diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/InboxFilter.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/InboxFilter.js index 00b059fd8..1e6ae1ebf 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/InboxFilter.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/InboxFilter.js @@ -136,7 +136,8 @@ const Filter = ({ searchParams, onFilterChange, onSearch, removeParam, ...props const roleCodesToFilter = ["HRMS_ADMIN", "DIV_ADMIN", "MDMS_ADMIN", "LOC_ADMIN", "SYSTEM"]; // Use the filter method to extract roles with the specified codes const roles = data?.MdmsRes?.["ws-services-masters"]?.WSServiceRoles?.filter((role) => { - return !roleCodesToFilter.includes(role.code); + return !roleCodesToFilter.includes(role.code) && + (role?.name === "Secretary" || role?.name === "Sarpanch" || role?.name === "Revenue Collector"); })?.map((role) => { return { code: role.code, name: role?.name ? role?.name : " ", i18text: "ACCESSCONTROL_ROLES_ROLES_" + role.code }; }); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js index cd5082eda..5fddd2542 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js @@ -150,7 +150,11 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles const filteredResult = filterKeys(result, requiredKeys); const resultInTree = buildTree(filteredResult, hierarchy); const excludeCodes = ["HRMS_ADMIN", "LOC_ADMIN", "MDMS_ADMIN", "EMPLOYEE", "SYSTEM"]; - setRolesOptions(data?.MdmsRes?.["ws-services-masters"]?.["WSServiceRoles"]?.filter(row => !excludeCodes.includes(row?.code))) + setRolesOptions(data?.MdmsRes?.["ws-services-masters"]?.["WSServiceRoles"]?.filter(row => !excludeCodes.includes(row?.code) + && + (row?.name === "Secretary" || row?.name === "Sarpanch" || row?.name === "Revenue Collector" || row?.name === "DIVISION ADMIN") + )) + //updating to state roles as requested // setRolesOptions([ // // { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js index 8cb17be8b..15ad7adbb 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js @@ -341,7 +341,8 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { const roleCodesToFilter = ["HRMS_ADMIN", "DIV_ADMIN", "MDMS_ADMIN", "LOC_ADMIN", "SYSTEM"]; // Use the filter method to extract roles with the specified codes return data?.MdmsRes?.["ws-services-masters"].WSServiceRoles?.filter((role) => { - return !roleCodesToFilter.includes(role.code); + return !roleCodesToFilter.includes(role.code) && + (role?.name === "Secretary" || role?.name === "Sarpanch" || role?.name === "Revenue Collector"); })?.map((role) => { return { code: role.code, name: role?.name ? role?.name : " ", i18text: "ACCESSCONTROL_ROLES_ROLES_" + role.code }; }); From 0fa7f44ee223f5a476ad05db6b15cf50d3941e54 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Wed, 7 Aug 2024 18:41:20 +0530 Subject: [PATCH 107/133] commit MDMS changes - revert --- frontend/mgramseva/lib/services/mdms.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/mgramseva/lib/services/mdms.dart b/frontend/mgramseva/lib/services/mdms.dart index c196781fd..be33a8177 100644 --- a/frontend/mgramseva/lib/services/mdms.dart +++ b/frontend/mgramseva/lib/services/mdms.dart @@ -16,7 +16,7 @@ initRequestBody(tenantId) { { "moduleName": "tenant", "masterDetails": [ - // {"name": "tenants"}, + {"name": "tenants"}, {"name": "citymodule"} ], }, @@ -109,7 +109,7 @@ Map getTenantsMDMS(String tenantId) { { "moduleName": "tenant", "masterDetails": [ - // {"name": "tenants"} + {"name": "tenants"} ] } ] From d9d3beb82b5060cd895bd71a05ebcc7200abb5ac Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Wed, 7 Aug 2024 19:04:38 +0530 Subject: [PATCH 108/133] PKG JSON REVERT CHANGES --- frontend/micro-ui/web/micro-ui-internals/package.json | 4 ++-- .../micro-ui/web/micro-ui-internals/packages/css/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/package.json b/frontend/micro-ui/web/micro-ui-internals/package.json index a87d6791f..f273694bb 100644 --- a/frontend/micro-ui/web/micro-ui-internals/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/package.json @@ -16,8 +16,8 @@ "node": ">=14" }, "scripts": { - "start": "run-s build start:dev", - "sprint": "run-s start:script", + "start": "SKIP_PREFLIGHT_CHECK=true run-s build start:dev", + "sprint": "SKIP_PREFLIGHT_CHECK=true run-s start:script", "start:dev": "run-p dev:**", "start:script": "./scripts/create.sh", "dev:css": "cd packages/css && yarn start", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/package.json b/frontend/micro-ui/web/micro-ui-internals/packages/css/package.json index 97e5c4677..1e4e5f0d8 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/css/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/package.json @@ -12,7 +12,7 @@ }, "scripts": { "start": "gulp build", - "build:prod": "SET NODE_ENV=production gulp build", + "build:prod": "NODE_ENV=production gulp build", "prepublish": "yarn build:prod", "deploy": "gulp && cp -R svg example && cp -R img example && gh-pages -d example" }, From b70f21fec257d1f1f90e6cd20200d51cc0302153 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 8 Aug 2024 11:35:01 +0530 Subject: [PATCH 109/133] babel fix --- frontend/micro-ui/web/.babelrc | 12 ++++++++---- frontend/micro-ui/web/webpack.config.js | 8 +++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/frontend/micro-ui/web/.babelrc b/frontend/micro-ui/web/.babelrc index 5f90443d1..10bdb6405 100644 --- a/frontend/micro-ui/web/.babelrc +++ b/frontend/micro-ui/web/.babelrc @@ -1,5 +1,9 @@ { - "presets": [ - "@babel/preset-env","@babel/preset-react" - ] - } \ No newline at end of file + "presets": [ + "@babel/preset-env", + "@babel/preset-react" + ], + "plugins": [ + "@babel/plugin-proposal-optional-chaining" + ] +} \ No newline at end of file diff --git a/frontend/micro-ui/web/webpack.config.js b/frontend/micro-ui/web/webpack.config.js index 32f5b82a8..da189d9d2 100644 --- a/frontend/micro-ui/web/webpack.config.js +++ b/frontend/micro-ui/web/webpack.config.js @@ -12,7 +12,13 @@ module.exports = { { test: /\.(js)$/, exclude: /node_modules/, - use: ["babel-loader"], + use: { + loader: "babel-loader", + options: { + presets: ["@babel/preset-env", "@babel/preset-react"], + plugins: ["@babel/plugin-proposal-optional-chaining"] + } + } }, { test: /\.css$/i, From 5a8eaf4b348fa25a80ca2c66bdc4c1fda4cd5079 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 8 Aug 2024 12:18:29 +0530 Subject: [PATCH 110/133] Fuzzy search revert back User Name Search --- .../hrms/src/components/inbox/search.js | 32 +++---------------- .../packages/modules/hrms/src/pages/Inbox.js | 20 ++++++------ 2 files changed, 14 insertions(+), 38 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/inbox/search.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/inbox/search.js index 801c8e6e1..d5562d3d9 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/inbox/search.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/inbox/search.js @@ -58,7 +58,7 @@ const SearchApplication = ({ onSearch, type, onClose, searchFields, searchParams )}
- + {searchFields ?.filter((e) => true) ?.map((input, index) => ( @@ -73,7 +73,7 @@ const SearchApplication = ({ onSearch, type, onClose, searchFields, searchParams ) : null} -
+
) : ( } @@ -85,32 +85,8 @@ const SearchApplication = ({ onSearch, type, onClose, searchFields, searchParams
))} - {/* Updated Search & Clear All Button */} -
-
- {type === "desktop" && !mobileView && ( - - {clearAll()} - - )} - {type === "desktop" && !mobileView && ( - - )} -
- - {/*Don't Remove : Chance of Updated Search & Clear All Button*/} - {/*
+
{type === "desktop" && !mobileView && ( {clearAll()} @@ -124,7 +100,7 @@ const SearchApplication = ({ onSearch, type, onClose, searchFields, searchParams submit /> )} -
*/} +
{(type === "mobile" || mobileView) && ( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Inbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Inbox.js index 15e18f175..d60dd523a 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Inbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Inbox.js @@ -29,9 +29,9 @@ const Inbox = ({ parentRoute, businessService = "HRMS", initialStates = {}, filt let roles = STATE_ADMIN ? { roles: "DIV_ADMIN", isStateLevelSearch: true } : { - roles: "SYSTEM, GP_ADMIN, COLLECTION_OPERATOR, PROFILE_UPDATE, DASHBOAD_VIEWER, SARPANCH, REVENUE_COLLECTOR, SECRETARY", - isStateLevelSearch: false, - }; + roles: "SYSTEM, GP_ADMIN, COLLECTION_OPERATOR, PROFILE_UPDATE, DASHBOAD_VIEWER, SARPANCH, REVENUE_COLLECTOR, SECRETARY", + isStateLevelSearch: false, + }; let requestBody = { criteria: { @@ -51,9 +51,9 @@ const Inbox = ({ parentRoute, businessService = "HRMS", initialStates = {}, filt const checkRoles = requestBody.criteria.roles[0] !== "DIV_ADMIN"; const { data: divisionData, ...rests } = Digit.Hooks.hrms.useHRMSEmployeeSearch(requestBody, isupdate, { - enabled: !STATE_ADMIN ? false : (STATE_ADMIN && searchParams?.hasOwnProperty("isActive")) || searchParams?.hasOwnProperty("tenantIds") ? true : false, + enabled: !STATE_ADMIN ? false : (STATE_ADMIN && searchParams?.hasOwnProperty("isActive")) || searchParams?.hasOwnProperty("tenantIds") ? true : false, }); - + if (searchParams?.hasOwnProperty("roles")) { @@ -75,7 +75,7 @@ const Inbox = ({ parentRoute, businessService = "HRMS", initialStates = {}, filt // setTotalReacords(res?.EmployeCount?.totalEmployee); }, [res]); - useEffect(() => {}, [hookLoading, rest]); + useEffect(() => { }, [hookLoading, rest]); useEffect(() => { setPageOffset(0); @@ -124,10 +124,10 @@ const Inbox = ({ parentRoute, businessService = "HRMS", initialStates = {}, filt const getSearchFields = () => { return [ - // { - // label: t("HR_NAME_LABEL"), - // name: "names", - // }, + { + label: t("HR_NAME_LABEL"), + name: "names", + }, { label: t("HR_MOB_NO_LABEL"), name: "phone", From da6f6f707630a8e223a654ece3d33d25e8eef119 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 8 Aug 2024 14:03:41 +0530 Subject: [PATCH 111/133] UPDATE FIX --- .../modules/hrms/src/pages/EditEmployee/EditForm.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js index 01227d82b..06a0c5d67 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js @@ -296,9 +296,9 @@ const EditForm = ({ tenantId, data }) => { // console.log(data?.assignments, "data?.assignments"); // console.log(input, "INPUT"); - let dataAssignments = data?.assignments[0]; - dataAssignments.department = input.SelectUserTypeAndDesignation[0]?.department?.code; - dataAssignments.designation = input.SelectUserTypeAndDesignation[0]?.designation?.code; + let dataAssignments = data?.assignments; + dataAssignments[0].department = input.SelectUserTypeAndDesignation[0]?.department?.code; + dataAssignments[0].designation = input.SelectUserTypeAndDesignation[0]?.designation?.code; requestdata.assignments = input?.Assignments ? input?.Assignments : dataAssignments; From 7ae0d2cf1e08509758a3c68c8d07ed0fb45e1506 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 8 Aug 2024 17:31:27 +0530 Subject: [PATCH 112/133] Fuzzy search update --- .../libraries/src/services/elements/MDMS.js | 38 ++++++++++--------- .../src/services/molecules/Store/service.js | 4 +- .../packages/modules/core/src/App.js | 4 +- .../packages/modules/core/src/Module.js | 6 +-- .../SelectUserTypeAndDesignation.js | 2 - .../packages/modules/hrms/src/pages/Inbox.js | 2 +- .../modules/pgr/src/pages/employee/Inbox.js | 1 + 7 files changed, 30 insertions(+), 27 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js index a12327f6e..cca16d144 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js @@ -71,6 +71,10 @@ const initRequestBodyWithOutTenent = (tenantId) => ({ moduleName: "common-masters", masterDetails: [{ name: "Department" }, { name: "Designation" }, { name: "StateInfo" }, { name: "wfSlaConfig" }, { name: "uiHomePage" }], }, + { + moduleName: "tenant", + masterDetails: [{ name: "citymodule" }], + }, { moduleName: "DIGIT-UI", masterDetails: [{ name: "ApiCachingSettings" }], @@ -1048,24 +1052,24 @@ const GetSlumLocalityMapping = (MdmsRes, tenantId) => MdmsRes["FSM"].Slum.filter((type) => type.active).reduce((prev, curr) => { return prev[curr.locality] ? { - ...prev, - [curr.locality]: [ - ...prev[curr.locality], - { - ...curr, - i18nKey: `${tenantId.toUpperCase().replace(".", "_")}_${curr.locality}_${curr.code}`, - }, - ], - } + ...prev, + [curr.locality]: [ + ...prev[curr.locality], + { + ...curr, + i18nKey: `${tenantId.toUpperCase().replace(".", "_")}_${curr.locality}_${curr.code}`, + }, + ], + } : { - ...prev, - [curr.locality]: [ - { - ...curr, - i18nKey: `${tenantId.toUpperCase().replace(".", "_")}_${curr.locality}_${curr.code}`, - }, - ], - }; + ...prev, + [curr.locality]: [ + { + ...curr, + i18nKey: `${tenantId.toUpperCase().replace(".", "_")}_${curr.locality}_${curr.code}`, + }, + ], + }; }, {}); const GetPropertyOwnerShipCategory = (MdmsRes) => diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Store/service.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Store/service.js index fa911c4e0..11df81db2 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Store/service.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Store/service.js @@ -55,7 +55,7 @@ export const StoreService = { return await Promise.all(allBoundries); }, digitInitData: async (stateCode, enabledModules) => { - const { MdmsRes } = await MdmsService.init(stateCode); + const { MdmsRes } = await MdmsService.init(stateCode); const stateInfo = MdmsRes["common-masters"]?.StateInfo?.[0] || {}; const uiHomePage = MdmsRes["common-masters"]?.uiHomePage?.[0] || {}; @@ -82,7 +82,7 @@ export const StoreService = { initData.selectedLanguage = Digit.SessionStorage.get("locale") || initData?.languages[2] ? initData?.languages[2]?.value : initData?.languages[1]?.value; ApiCacheService.saveSetting(MdmsRes["DIGIT-UI"]?.ApiCachingSettings); - initData.tenants = MdmsRes?.tenant?.tenants + initData.tenants = MdmsRes?.tenant?.tenants .map((tenant) => ({ i18nKey: `TENANT_TENANTS_${tenant.code.replace(".", "_").toUpperCase()}`, ...tenant, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/App.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/App.js index ab2535630..000cc725a 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/App.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/App.js @@ -3,7 +3,7 @@ import { Redirect, Route, Switch, useHistory, useLocation } from "react-router-d import CitizenApp from "./pages/citizen"; import EmployeeApp from "./pages/employee"; -export const DigitApp = ({ stateCode, modules, appTenants, logoUrl, initData ,defaultLanding="citizen"}) => { +export const DigitApp = ({ stateCode, modules, appTenants, logoUrl, initData, defaultLanding = "citizen" }) => { const history = useHistory(); const { pathname } = useLocation(); const innerWidth = window.innerWidth; @@ -11,7 +11,7 @@ export const DigitApp = ({ stateCode, modules, appTenants, logoUrl, initData ,de const userDetails = Digit.UserService.getUser(); const { data: storeData } = Digit.Hooks.useStore.getInitData(); const { stateInfo } = storeData || {}; - + const DSO = Digit.UserService.hasAccess(["FSM_DSO"]); let CITIZEN = userDetails?.info?.type === "CITIZEN" || !window.location.pathname.split("/").includes("employee") ? true : false; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/Module.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/Module.js index 95a29d987..ca0d3d6c7 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/Module.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/Module.js @@ -11,7 +11,7 @@ import { useState } from "react"; import ErrorBoundary from "./components/ErrorBoundaries"; import getStore from "./redux/store"; -const DigitUIWrapper = ({ stateCode, enabledModules, moduleReducers,defaultLanding }) => { +const DigitUIWrapper = ({ stateCode, enabledModules, moduleReducers, defaultLanding }) => { const { isLoading, data: initData } = Digit.Hooks.useInitStore(stateCode, enabledModules); if (isLoading) { return ; @@ -36,7 +36,7 @@ const DigitUIWrapper = ({ stateCode, enabledModules, moduleReducers,defaultLandi ); }; -export const DigitUI = ({ stateCode, registry, enabledModules, moduleReducers ,defaultLanding}) => { +export const DigitUI = ({ stateCode, registry, enabledModules, moduleReducers, defaultLanding }) => { const [privacy, setPrivacy] = useState(Digit.Utils.getPrivacyObject() || {}); const userType = Digit.UserService.getType(); const queryClient = new QueryClient({ @@ -98,7 +98,7 @@ export const DigitUI = ({ stateCode, registry, enabledModules, moduleReducers ,d }, }} > - + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js index f368126ca..905361faf 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js @@ -310,7 +310,6 @@ const SelectUserTypeAndDesignation = ({ t, config, onSelect, userType, formData }); } function getUserTypes() { - return data?.MdmsRes?.["common-masters"]?.Department?.map((ele) => { ele["i18key"] = t("COMMON_MASTERS_DEPARTMENT" + ele.code); return ele; @@ -320,7 +319,6 @@ const SelectUserTypeAndDesignation = ({ t, config, onSelect, userType, formData if (isLoading && isUserDataLoading && isLoadingDesignation) { return ; } - // console.log(dataDesignation, "dataDesignation"); return (
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Inbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Inbox.js index d60dd523a..88b1395d0 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Inbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Inbox.js @@ -126,7 +126,7 @@ const Inbox = ({ parentRoute, businessService = "HRMS", initialStates = {}, filt return [ { label: t("HR_NAME_LABEL"), - name: "names", + name: "name", }, { label: t("HR_MOB_NO_LABEL"), diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/Inbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/Inbox.js index 66a4903fd..5eebc3cf6 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/Inbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/Inbox.js @@ -41,6 +41,7 @@ const Inbox = () => { }; const onSearch = (params = "") => { + setSearchParams({ ...searchParams, search: params }); }; From 6bd1d0f0d6738de512a0b2b8c3def152aed81c00 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 8 Aug 2024 17:35:50 +0530 Subject: [PATCH 113/133] Build Failed FIX --- frontend/micro-ui/web/.babelrc | 12 ++++++++---- frontend/micro-ui/web/webpack.config.js | 8 +++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/frontend/micro-ui/web/.babelrc b/frontend/micro-ui/web/.babelrc index 5f90443d1..10bdb6405 100644 --- a/frontend/micro-ui/web/.babelrc +++ b/frontend/micro-ui/web/.babelrc @@ -1,5 +1,9 @@ { - "presets": [ - "@babel/preset-env","@babel/preset-react" - ] - } \ No newline at end of file + "presets": [ + "@babel/preset-env", + "@babel/preset-react" + ], + "plugins": [ + "@babel/plugin-proposal-optional-chaining" + ] +} \ No newline at end of file diff --git a/frontend/micro-ui/web/webpack.config.js b/frontend/micro-ui/web/webpack.config.js index 32f5b82a8..da189d9d2 100644 --- a/frontend/micro-ui/web/webpack.config.js +++ b/frontend/micro-ui/web/webpack.config.js @@ -12,7 +12,13 @@ module.exports = { { test: /\.(js)$/, exclude: /node_modules/, - use: ["babel-loader"], + use: { + loader: "babel-loader", + options: { + presets: ["@babel/preset-env", "@babel/preset-react"], + plugins: ["@babel/plugin-proposal-optional-chaining"] + } + } }, { test: /\.css$/i, From c61f398aa2fcbbb8b745ac0bde195c7d1f6235ea Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 8 Aug 2024 18:20:07 +0530 Subject: [PATCH 114/133] ISTE-352 --- .../bill_generation_details_provider.dart | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart index 962d65fcc..28369a513 100644 --- a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart +++ b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart @@ -323,20 +323,20 @@ class BillGenerationProvider with ChangeNotifier { var hhp = Provider.of( navigatorKey.currentContext!, listen: false); - if (hhp.aggDemandItems == null) { - await BillingServiceRepository().fetchAggregateDemand({ - "tenantId": - commonProvider.userDetails!.selectedtenant!.code, - "consumerCode": - billList.bill?.first.consumerCode.toString(), - "businessService": "WS", - }).then((AggragateDemandDetails? value) { - if (value != null) { - hhp.aggDemandItems = value; - notifyListeners(); - } - }); - } + // if (hhp.aggDemandItems == null) { + await BillingServiceRepository().fetchAggregateDemand({ + "tenantId": + commonProvider.userDetails!.selectedtenant!.code, + "consumerCode": + billList.bill?.first.consumerCode.toString(), + "businessService": "WS", + }).then((AggragateDemandDetails? value) { + if (value != null) { + hhp.aggDemandItems = value; + notifyListeners(); + } + }); + // } return commonProvider.getFileFromPDFBillService({ "BillAndDemand": { "Bill": [billList.bill?.first], @@ -352,25 +352,25 @@ class BillGenerationProvider with ChangeNotifier { "Download"); }, callBackWhatsApp: () async { - var hhp = Provider.of( + var hhp = Provider.of( navigatorKey.currentContext!, listen: false); - if (hhp.aggDemandItems == null) { - await BillingServiceRepository().fetchAggregateDemand({ - "tenantId": - commonProvider.userDetails!.selectedtenant!.code, - "consumerCode": - billList.bill?.first.consumerCode.toString(), - "businessService": "WS", - }).then((AggragateDemandDetails? value) { - if (value != null) { - hhp.aggDemandItems = value; - notifyListeners(); - } - }); - } + // if (hhp.aggDemandItems == null) { + await BillingServiceRepository().fetchAggregateDemand({ + "tenantId": + commonProvider.userDetails!.selectedtenant!.code, + "consumerCode": + billList.bill?.first.consumerCode.toString(), + "businessService": "WS", + }).then((AggragateDemandDetails? value) { + if (value != null) { + hhp.aggDemandItems = value; + notifyListeners(); + } + }); + // } return commonProvider.getFileFromPDFBillService({ - "BillAndDemand": { + "BillAndDemand": { "Bill": [billList.bill?.first], "AggregatedDemands": hhp.aggDemandItems } From 107fca287f0e5f83d273ff89aab702c1bc77dc23 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 8 Aug 2024 19:14:47 +0530 Subject: [PATCH 115/133] 292-Localization --- .../packages/modules/hrms/src/pages/EmployeeDetails.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EmployeeDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EmployeeDetails.js index dad8eff18..bf886caa0 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EmployeeDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EmployeeDetails.js @@ -117,8 +117,14 @@ const Details = () => { - - + + {data?.Employees?.[0]?.isActive == false ? ( From f9184ffc711b742e6a8b5ca5a2b8f83386d53a1b Mon Sep 17 00:00:00 2001 From: Palak Garg <86659286+palak-egov@users.noreply.github.com> Date: Thu, 8 Aug 2024 19:30:48 +0530 Subject: [PATCH 116/133] Update FuzzySearchQueryBuilder.java --- .../org/egov/hrms/repository/FuzzySearchQueryBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java index 26079fe99..ef80e1369 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java @@ -76,7 +76,7 @@ public String getFuzzySearchQuery(EmployeeSearchCriteria criteria, List } ArrayNode tenantIdArray = mapper.createArrayNode(); - tenantIdArray.add("pb"); + tenantIdArray.add(criteria.getTenantId()); ObjectNode tenantIdFilter = mapper.createObjectNode(); tenantIdFilter.putPOJO("terms", mapper.createObjectNode().putPOJO("Data.tenantId.keyword", tenantIdArray)); fuzzyClauses.add(tenantIdFilter); @@ -89,7 +89,7 @@ public String getFuzzySearchQuery(EmployeeSearchCriteria criteria, List roleArray.add(roleNode); } ObjectNode rolesBoolNode = mapper.createObjectNode(); - rolesBoolNode.putPOJO("bool", mapper.createObjectNode().putPOJO("must", roleArray)); + rolesBoolNode.putPOJO("bool", mapper.createObjectNode().putPOJO("should", roleArray)); fuzzyClauses.add(rolesBoolNode); ObjectNode boolQuery = mapper.createObjectNode(); From 0ae9faba8806714b4bf2e625dd4e44efef89a6f7 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 8 Aug 2024 22:04:21 +0530 Subject: [PATCH 117/133] ISTE-353 Fix --- .../pageComponents/SelectUserTypeAndDesignation.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js index 905361faf..cdccc0908 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js @@ -398,6 +398,7 @@ function Jurisdiction({ return defaultjurisdiction; } useEffect(() => { + if (responseData != null && depamentValue == "") { getUserTypes?.forEach((ele) => { if (ele.code === responseData?.Employees[0]?.assignments[0]?.department) { @@ -444,12 +445,12 @@ function Jurisdiction({ setjurisdictions((pre) => pre.map((item) => (item.key == jurisdiction.key ? { ...item, department: value } : item))); const filteredItems = getdesignationdata.filter(val => val.department.includes(value.code)); setDesignationList(filteredItems); + setDesignationValue(filteredItems[0]); }; const selectDesignation = (value) => { setjurisdictions((pre) => pre.map((item) => (item.key === jurisdiction.key ? { ...item, designation: value } : item))); - }; - + }; return (
From 2a8dc81f1babbc1502f7c83bacedc5cf6ca0fa2a Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 8 Aug 2024 22:34:05 +0530 Subject: [PATCH 118/133] OLD_CONN ID UPDATED --- .../lib/screeens/reports/leadger_table.dart | 43 +++++++++++++------ .../utils/constants/i18_key_constants.dart | 30 ++++++------- 2 files changed, 44 insertions(+), 29 deletions(-) diff --git a/frontend/mgramseva/lib/screeens/reports/leadger_table.dart b/frontend/mgramseva/lib/screeens/reports/leadger_table.dart index d7a289c9b..8f04672ce 100644 --- a/frontend/mgramseva/lib/screeens/reports/leadger_table.dart +++ b/frontend/mgramseva/lib/screeens/reports/leadger_table.dart @@ -16,7 +16,10 @@ class LeadgerTable extends StatelessWidget { final ScrollController scrollController; final String tableTitle; final WaterConnection? waterConnection; - LeadgerTable({required this.tableTitle, required this.scrollController,this.waterConnection}); + LeadgerTable( + {required this.tableTitle, + required this.scrollController, + this.waterConnection}); @override Widget build(BuildContext context) { @@ -32,22 +35,35 @@ class LeadgerTable extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - LabelText( '${ApplicationLocalizations.of(context).translate(tableTitle)}'), - - Consumer( - builder: (_, reportProvider, child) { - return SubLabelText("${i18.common.LEDGER_CUSTOMER_NAME} : ${waterConnection?.connectionHolders?.first.name}"); - } - ), - + builder: (_, reportProvider, child) { + return SubLabelText( + "${i18.common.LEDGER_CUSTOMER_NAME} : ${waterConnection?.connectionHolders?.first.name}"); + }), Consumer( - builder: (_, reportProvider, child) { - return SubLabelText("${i18.common.LEDGER_CONN_ID} : ${waterConnection?.connectionNo}"); + builder: (_, reportProvider, child) { + if (constraints.maxWidth < 760) { + return Column( + children: [ + SubLabelText( + "${i18.common.LEDGER_CONN_ID} : ${waterConnection?.connectionNo}"), + SubLabelText( + "${i18.common.LEDGER_OLD_CONN_ID} : ${waterConnection?.oldConnectionNo}"), + ], + ); + } else { + return Row( + children: [ + SubLabelText( + "${i18.common.LEDGER_CONN_ID} : ${waterConnection?.connectionNo}"), + SubLabelText( + "${i18.common.LEDGER_OLD_CONN_ID} : ${waterConnection?.oldConnectionNo}"), + ], + ); } - ), + }), ])), SizedBox( height: 30, @@ -79,10 +95,9 @@ class LeadgerTable extends StatelessWidget { callBack: (pageResponse) => reportProvider.onChangeOfPageLimit( pageResponse, tableTitle, context), - isTotalCountVisible: false, + isTotalCountVisible: false, totalCount: reportProvider.genericTableData.tableData.length, - ), ), ) diff --git a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart index b2b632c7a..4e429a44e 100644 --- a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart +++ b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart @@ -188,23 +188,23 @@ class Common { // Leadger String get LEDGER_MONTH => 'LEDGER_MONTH'; - String get LEDGER_DEMAND_GENERATION_DATE => 'LEDGER_DEMAND_GENERATION_DATE'; - String get LEDGER_MONTHLY_CHARGE => 'LEDGER_MONTHLY_CHARGE'; - String get LEDGER_PREV_MONTH_BALANCE => 'LEDGER_PREV_MONTH_BALANCE'; - String get LEDGER_TOTAL_DUE => 'LEDGER_TOTAL_DUE'; - String get LEDGER_DUE_DATE_PAYMENT => 'LEDGER_DUE_DATE_PAYMENT'; - String get LEDGER_DATE => 'LEDGER_DATE'; - String get LEDGER_RECIPET_NO => 'LEDGER_RECIPET_NO'; - String get LEDGER_AMOUNT => 'LEDGER_AMOUNT'; - String get LEDGER_BALANCE => 'LEDGER_BALANCE'; - String get LEDGER_PENALTY_APPLIED_ON_DATE => 'LEDGER_PENALTY_APPLIED_ON_DATE'; - String get LEDGER_PENALTY => 'LEDGER_PENALTY'; - String get LEDGER_BALANCE_FOR_THE_MONH => 'LEDGER_BALANCE_FOR_THE_MONH'; - String get LEDGER_CUSTOMER_NAME => 'LEDGER_CUSTOMER_NAME'; - String get LEDGER_CONN_ID => 'LEDGER_CONN_ID'; + String get LEDGER_DEMAND_GENERATION_DATE => 'LEDGER_DEMAND_GENERATION_DATE'; + String get LEDGER_MONTHLY_CHARGE => 'LEDGER_MONTHLY_CHARGE'; + String get LEDGER_PREV_MONTH_BALANCE => 'LEDGER_PREV_MONTH_BALANCE'; + String get LEDGER_TOTAL_DUE => 'LEDGER_TOTAL_DUE'; + String get LEDGER_DUE_DATE_PAYMENT => 'LEDGER_DUE_DATE_PAYMENT'; + String get LEDGER_DATE => 'LEDGER_DATE'; + String get LEDGER_RECIPET_NO => 'LEDGER_RECIPET_NO'; + String get LEDGER_AMOUNT => 'LEDGER_AMOUNT'; + String get LEDGER_BALANCE => 'LEDGER_BALANCE'; + String get LEDGER_PENALTY_APPLIED_ON_DATE => 'LEDGER_PENALTY_APPLIED_ON_DATE'; + String get LEDGER_PENALTY => 'LEDGER_PENALTY'; + String get LEDGER_BALANCE_FOR_THE_MONH => 'LEDGER_BALANCE_FOR_THE_MONH'; + String get LEDGER_CUSTOMER_NAME => 'LEDGER_CUSTOMER_NAME'; + String get LEDGER_CONN_ID => 'LEDGER_CONN_ID'; + String get LEDGER_OLD_CONN_ID => 'LEDGER_OLD_CONN_ID'; // Leadger - ///Months String get JAN => 'JAN'; String get FEB => 'FEB '; From 9a84d13dbe0272a0b4990e9cf4e0f895e8381b12 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Thu, 8 Aug 2024 22:49:28 +0530 Subject: [PATCH 119/133] old _conn id --- .../screeens/leadger_report/leadger_view.dart | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/frontend/mgramseva/lib/screeens/leadger_report/leadger_view.dart b/frontend/mgramseva/lib/screeens/leadger_report/leadger_view.dart index c87956e98..0df722dcb 100644 --- a/frontend/mgramseva/lib/screeens/leadger_report/leadger_view.dart +++ b/frontend/mgramseva/lib/screeens/leadger_report/leadger_view.dart @@ -45,20 +45,24 @@ class _LeadgerReportView extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( - width: constraints.maxWidth > 344?constraints.maxWidth / 2.5:constraints.maxWidth / 3, + width: constraints.maxWidth > 344 + ? constraints.maxWidth / 2.5 + : constraints.maxWidth / 3, child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "1. ", - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w700), + style: TextStyle( + fontSize: 14, fontWeight: FontWeight.w700), ), Expanded( child: Text( ApplicationLocalizations.of(context) .translate(i18.dashboard.LEDGER_REPORTS), maxLines: 3, - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w700), + style: TextStyle( + fontSize: 14, fontWeight: FontWeight.w700), ), ), ], @@ -71,28 +75,32 @@ class _LeadgerReportView extends State child: Button( ApplicationLocalizations.of(context) .translate(i18.common.VIEW), - () { + () { if (reportProvider.selectedBillYear == null) { Notifiers.getToastMessage( - context, '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', 'ERROR'); + context, + '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', + 'ERROR'); } else { reportProvider.clearTableData(); reportProvider.getLeadgerReport(); - widget.onViewClick(true, i18.dashboard.LEDGER_REPORTS); + widget.onViewClick( + true, i18.dashboard.LEDGER_REPORTS); } }, key: Keys.billReport.LEDGER_REPORT_VIEW_BUTTON, ), ), - - SizedBox( + SizedBox( width: 10, ), TextButton.icon( onPressed: () { if (reportProvider.selectedBillYear == null) { Notifiers.getToastMessage( - context, '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', 'ERROR'); + context, + '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', + 'ERROR'); } else { reportProvider.getLeadgerReport(download: true); } From 6e64334f7adcd47ff42ce07842ec5c823a38fe0f Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Fri, 9 Aug 2024 10:08:50 +0530 Subject: [PATCH 120/133] base URL CLEAR --- frontend/mgramseva/lib/env/app_config.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/mgramseva/lib/env/app_config.dart b/frontend/mgramseva/lib/env/app_config.dart index f4934d5cb..94253b5b1 100644 --- a/frontend/mgramseva/lib/env/app_config.dart +++ b/frontend/mgramseva/lib/env/app_config.dart @@ -22,7 +22,6 @@ void setEnvironment(Environment env) { } } - dynamic get apiBaseUrl { return _config[_baseUrl]; } From c036ce6f341e0529dc14f1d381b6da693da71295 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 9 Aug 2024 11:46:39 +0530 Subject: [PATCH 121/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 9696d7008..60da239e1 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -85,6 +85,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce BigDecimal taxAmountResult = getMonthlyTaxAmount(epochTime, consumerCode); BigDecimal totalAmountPaidResult = getMonthlyTotalAmountPaid(epochTime, consumerCode); ledgerReport.getDemand().setArrears(taxAmountResult.subtract(totalAmountPaidResult)); + log.info("Arrers are "+ledgerReport.getDemand().getArrears()+" and monthandYear"+ ledgerReport.getDemand().getMonthAndYear()); ledgerReports.put(monthAndYear, ledgerReport); currentMonth = currentMonth.plusMonths(1); } @@ -115,7 +116,6 @@ public List> extractData(ResultSet resultSet) throws SQLExce ledgerReport.getDemand().setPenalty(taxamount != null ? taxamount : BigDecimal.ZERO); BigDecimal amount = ledgerReport.getDemand().getTaxamount() != null ? ledgerReport.getDemand().getTaxamount() : BigDecimal.ZERO; ledgerReport.getDemand().setTotalForCurrentMonth((taxamount != null ? taxamount : BigDecimal.ZERO).add(amount)); - ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears() != null ? ledgerReport.getDemand().getArrears() : BigDecimal.ZERO)); } else if (code.equals("10101")) { ledgerReport.getDemand().setMonthAndYear(monthAndYear); ledgerReport.getDemand().setDemandGenerationDate(demandGenerationDateLong); @@ -125,8 +125,9 @@ public List> extractData(ResultSet resultSet) throws SQLExce long penaltyAppliedDateMillis = demandGenerationDateLocal.plus(11, ChronoUnit.DAYS).atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); ledgerReport.getDemand().setDueDate(dueDateMillis); ledgerReport.getDemand().setPenaltyAppliedDate(penaltyAppliedDateMillis); - ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears())); +// ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears())); } + ledgerReport.getDemand().setTotal_due_amount(ledgerReport.getDemand().getTotalForCurrentMonth().add(ledgerReport.getDemand().getArrears() != null ? ledgerReport.getDemand().getArrears() : BigDecimal.ZERO)); ledgerReport.getDemand().setConnectionNo(resultSet.getString("connectionno")); ledgerReport.getDemand().setOldConnectionNo(resultSet.getString("oldconnectionno")); ledgerReport.getDemand().setUserId(resultSet.getString("uuid")); From 0695131dd5458642f24cbed6db9013a7093f285b Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 9 Aug 2024 12:53:29 +0530 Subject: [PATCH 122/133] ISTE-229 --- .../rowmapper/LedgerReportRowMapper.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 60da239e1..498ae96ec 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -112,14 +112,24 @@ public List> extractData(ResultSet resultSet) throws SQLExce // ledgerReport.getDemand().setArrears(taxamount != null ? taxamount : BigDecimal.ZERO); // ledgerReport.getDemand().setMonthAndYear(monthAndYear); // } else - if (code.equals("WS_TIME_PENALTY") || code.equals("10201")) { + BigDecimal arrers_Penalty=BigDecimal.ZERO; + if(code.equalsIgnoreCase("10201")) + { + arrers_Penalty=taxamount; + } + BigDecimal ws_round_off=BigDecimal.ZERO; + if(code.equalsIgnoreCase("WS_Round_Off")) + { + ws_round_off=taxamount; + } + if (code.equalsIgnoreCase("WS_TIME_PENALTY")) { ledgerReport.getDemand().setPenalty(taxamount != null ? taxamount : BigDecimal.ZERO); BigDecimal amount = ledgerReport.getDemand().getTaxamount() != null ? ledgerReport.getDemand().getTaxamount() : BigDecimal.ZERO; ledgerReport.getDemand().setTotalForCurrentMonth((taxamount != null ? taxamount : BigDecimal.ZERO).add(amount)); - } else if (code.equals("10101")) { + } else if (code.equalsIgnoreCase("10101")) { ledgerReport.getDemand().setMonthAndYear(monthAndYear); ledgerReport.getDemand().setDemandGenerationDate(demandGenerationDateLong); - ledgerReport.getDemand().setTaxamount(taxamount); + ledgerReport.getDemand().setTaxamount(taxamount.add(ws_round_off)); ledgerReport.getDemand().setTotalForCurrentMonth(ledgerReport.getDemand().getTaxamount().add(ledgerReport.getDemand().getPenalty() != null ? ledgerReport.getDemand().getPenalty() : BigDecimal.ZERO)); long dueDateMillis = demandGenerationDateLocal.plus(10, ChronoUnit.DAYS).atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); long penaltyAppliedDateMillis = demandGenerationDateLocal.plus(11, ChronoUnit.DAYS).atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); From 00216590cc5ecfd9d2abb7711fe4ab56aeb971f0 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 9 Aug 2024 14:17:02 +0530 Subject: [PATCH 123/133] ISTE-229 --- .../repository/builder/FuzzySearchQueryBuilder.java | 1 + 1 file changed, 1 insertion(+) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/FuzzySearchQueryBuilder.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/FuzzySearchQueryBuilder.java index db159acd0..3d60fb1f4 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/FuzzySearchQueryBuilder.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/FuzzySearchQueryBuilder.java @@ -110,6 +110,7 @@ public String getFuzzySearchQuery(SearchCriteria criteria, List ids){ } finalQuery = mapper.writeValueAsString(node); + log.info("final query is"+finalQuery); } catch (Exception e){ From 8b4c730f9228095afe6fa0527724969a21428e05 Mon Sep 17 00:00:00 2001 From: Palak Garg <86659286+palak-egov@users.noreply.github.com> Date: Fri, 9 Aug 2024 14:51:10 +0530 Subject: [PATCH 124/133] Update application.properties --- .../egov-hrms/src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business-services/egov-hrms/src/main/resources/application.properties b/business-services/egov-hrms/src/main/resources/application.properties index d6b00bbbe..2804bb707 100644 --- a/business-services/egov-hrms/src/main/resources/application.properties +++ b/business-services/egov-hrms/src/main/resources/application.properties @@ -77,7 +77,7 @@ egov.pwd.allowed.special.characters=@#$% hrms.search.pagination.default.limit=50 hrms.search.pagination.default.offset=0 hrms.search.pagination.max.search.limit=5000 -hrms.fuzzy.search.is.wildcard=false +hrms.fuzzy.search.is.wildcard=true hrms.search.name.fuziness=2 #Elastic serach Properties From f8f172c103b205cf3088e9b6b1757c4867c10834 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Fri, 9 Aug 2024 15:08:50 +0530 Subject: [PATCH 125/133] validations updated --- .../SelectUserTypeAndDesignation.js | 5 +++- .../hrms/src/pages/EditEmployee/EditForm.js | 9 +++++++ .../modules/hrms/src/pages/createEmployee.js | 25 ++++++++++++++++--- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js index cdccc0908..972f01175 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/SelectUserTypeAndDesignation.js @@ -399,13 +399,15 @@ function Jurisdiction({ } useEffect(() => { - if (responseData != null && depamentValue == "") { + if (responseData != null && depamentValue == "" && isEdit) { getUserTypes?.forEach((ele) => { if (ele.code === responseData?.Employees[0]?.assignments[0]?.department) { setDepamentValue(ele); const filteredItems = getdesignationdata.filter(val => val.department.includes(ele.code)); setDesignationList(filteredItems); setjurisdictions((pre) => pre.map((item) => (item.key == jurisdiction.key ? { ...item, department: ele } : item))); + // setDesignationValue(filteredItems[0]); + // setjurisdictions((pre) => pre.map((item) => (item.key === jurisdiction.key ? { ...item, designation: filteredItems[0] } : item))); } }); } @@ -446,6 +448,7 @@ function Jurisdiction({ const filteredItems = getdesignationdata.filter(val => val.department.includes(value.code)); setDesignationList(filteredItems); setDesignationValue(filteredItems[0]); + setjurisdictions((pre) => pre.map((item) => (item.key === jurisdiction.key ? { ...item, designation: filteredItems[0] } : item))); }; const selectDesignation = (value) => { setjurisdictions((pre) => pre.map((item) => (item.key === jurisdiction.key ? { ...item, designation: value } : item))); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js index 06a0c5d67..6ab654305 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js @@ -138,6 +138,7 @@ const EditForm = ({ tenantId, data }) => { } const onFormValueChange = (setValue = true, formData) => { + let isValid = false; if (formData?.SelectEmployeePhoneNumber?.mobileNumber) { setMobileNumber(formData?.SelectEmployeePhoneNumber?.mobileNumber); } else { @@ -152,8 +153,15 @@ const EditForm = ({ tenantId, data }) => { } else { if (!STATE_ADMIN) { key?.roles?.length > 0 && setcheck(true); + if (formData?.SelectUserTypeAndDesignation[0] && formData?.SelectUserTypeAndDesignation[0]?.department != undefined && formData?.SelectUserTypeAndDesignation[0]?.designation != undefined) { + isValid = true; + } + else { + isValid = false; + } } else if (STATE_ADMIN) { setcheck(true); + isValid = false; } } } @@ -166,6 +174,7 @@ const EditForm = ({ tenantId, data }) => { (formData?.Jurisdictions?.length && !formData?.Jurisdictions.some(juris => juris?.division == undefined || juris?.divisionBoundary?.length === 0)) : formData?.Jurisdictions?.length && formData?.Jurisdictions.length && !formData?.Jurisdictions.some(juris => juris?.roles?.length === 0) && + isValid && checkfield && phonecheck && checkMailNameNum(formData) && diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js index daf9ebf1e..b72018d4d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js @@ -104,6 +104,7 @@ const CreateEmployee = () => { } const onFormValueChange = (setValue = true, formData) => { + let isValid = false; if (!_.isEqual(sessionFormData, formData)) { setSessionFormData({ ...sessionFormData, ...formData }); } @@ -119,17 +120,32 @@ const CreateEmployee = () => { break; } else { if (!STATE_ADMIN) { + if (formData?.SelectUserTypeAndDesignation[0] && formData?.SelectUserTypeAndDesignation[0]?.department != undefined && formData?.SelectUserTypeAndDesignation[0]?.designation != undefined) { + isValid = true; + } + else { + isValid = false; + } + key?.roles?.length > 0 && setcheck(true); } else if (STATE_ADMIN) { setcheck(true); + isValid = false; } } } + // console.log(formData. + // SelectUserTypeAndDesignation[0].department != undefined + // , "formData"); + // console.log(formData. + // SelectUserTypeAndDesignation[0].designation != undefined + // , "formData"); + console.log(isValid, "isValid"); + if ( - if ( formData?.SelectEmployeeGender?.gender.code && formData?.SelectEmployeeName?.employeeName && formData?.SelectEmployeePhoneNumber?.mobileNumber && @@ -137,12 +153,15 @@ const CreateEmployee = () => { STATE_ADMIN ? (formData?.Jurisdictions.length && !formData?.Jurisdictions.some(juris => juris?.division == undefined || juris?.divisionBoundary?.length === 0)) - : formData?.Jurisdictions?.length && formData?.Jurisdictions.length && !formData?.Jurisdictions.some(juris => juris?.roles?.length === 0) - && + : formData?.Jurisdictions?.length && formData?.Jurisdictions.length && !formData?.Jurisdictions.some(juris => juris?.roles?.length === 0) && + + isValid && + checkfield && phonecheck && checkMailNameNum(formData) && hasUniqueTenantIds(formData?.Jurisdictions) + ) { setSubmitValve(true); } else { From 73cc5d07dac713cfb111c916006db0c900c599af Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 9 Aug 2024 15:13:09 +0530 Subject: [PATCH 126/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 498ae96ec..636f09ec1 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -89,7 +89,6 @@ public List> extractData(ResultSet resultSet) throws SQLExce ledgerReports.put(monthAndYear, ledgerReport); currentMonth = currentMonth.plusMonths(1); } - while (resultSet.next()) { Long dateLong = resultSet.getLong("enddate"); LocalDate date = Instant.ofEpochMilli(dateLong).atZone(ZoneId.systemDefault()).toLocalDate(); @@ -117,10 +116,9 @@ public List> extractData(ResultSet resultSet) throws SQLExce { arrers_Penalty=taxamount; } - BigDecimal ws_round_off=BigDecimal.ZERO; if(code.equalsIgnoreCase("WS_Round_Off")) { - ws_round_off=taxamount; + ledgerReport.getDemand().setTaxamount(ledgerReport.getDemand().getTaxamount().add(taxamount)); } if (code.equalsIgnoreCase("WS_TIME_PENALTY")) { ledgerReport.getDemand().setPenalty(taxamount != null ? taxamount : BigDecimal.ZERO); @@ -129,7 +127,7 @@ public List> extractData(ResultSet resultSet) throws SQLExce } else if (code.equalsIgnoreCase("10101")) { ledgerReport.getDemand().setMonthAndYear(monthAndYear); ledgerReport.getDemand().setDemandGenerationDate(demandGenerationDateLong); - ledgerReport.getDemand().setTaxamount(taxamount.add(ws_round_off)); + ledgerReport.getDemand().setTaxamount(ledgerReport.getDemand().getTaxamount().add(taxamount)); ledgerReport.getDemand().setTotalForCurrentMonth(ledgerReport.getDemand().getTaxamount().add(ledgerReport.getDemand().getPenalty() != null ? ledgerReport.getDemand().getPenalty() : BigDecimal.ZERO)); long dueDateMillis = demandGenerationDateLocal.plus(10, ChronoUnit.DAYS).atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); long penaltyAppliedDateMillis = demandGenerationDateLocal.plus(11, ChronoUnit.DAYS).atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); From cd25f8ec545ebebdb9bf30b3a3e99d860e536dbe Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 9 Aug 2024 16:07:45 +0530 Subject: [PATCH 127/133] ISTE-229 --- .../repository/builder/WsQueryBuilder.java | 2 +- .../waterconnection/web/models/DemandLedgerReport.java | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) 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 acf84c687..3127f7d85 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 @@ -207,7 +207,7 @@ public class WsQueryBuilder { "ORDER BY startdate"; public static final String TAX_AMOUNT_QUERY="SELECT SUM(taxamount) FROM egbs_demanddetail_v1 WHERE " + - "demandid IN (SELECT id FROM egbs_demand_v1 WHERE consumercode = ? AND taxperiodfrom < ? AND status='ACTIVE');"; + "demandid IN (SELECT id FROM egbs_demand_v1 WHERE consumercode = ? AND taxperiodto < ? AND status='ACTIVE');"; public static final String TOTAL_AMOUNT_PAID_QUERY="SELECT SUM(totalamountpaid) FROM egcl_payment WHERE " + "id IN (SELECT paymentid FROM egcl_paymentdetail WHERE billid IN " + diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java index c7cad175e..b84da9289 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/DemandLedgerReport.java @@ -56,12 +56,4 @@ public class DemandLedgerReport { @JsonProperty("penaltyAppliedOnDate") private Long penaltyAppliedDate=0L; -// public DemandLedgerReport(String monthAndYear) { -// this.monthAndYear = monthAndYear; -// this.taxamount = BigDecimal.ZERO; -// this.penalty = BigDecimal.ZERO; -// this.totalForCurrentMonth = BigDecimal.ZERO; -// this.arrears = BigDecimal.ZERO; -// this.total_due_amount = BigDecimal.ZERO; -// } } From b57214cccf6ec7c3fcb512c9d77e7c71038d943f Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 9 Aug 2024 16:39:31 +0530 Subject: [PATCH 128/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 636f09ec1..27b57e6cb 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -201,7 +201,7 @@ private void addPaymentToLedger(List> monthlyRecordList) { paymentLedgerReport.setCollectionDate(transactionDateLong); paymentLedgerReport.setReceiptNo(payment.getPaymentDetails().get(0).getReceiptNumber()); paymentLedgerReport.setPaid(payment.getTotalAmountPaid()); - BigDecimal totalDueAmount=ledgerReport.getDemand().getTotal_due_amount(); + BigDecimal totalDueAmount=payment.getTotalDue(); if(totalDueAmount.equals(BigDecimal.ZERO)) { paymentLedgerReport.setBalanceLeft(payment.getTotalDue().subtract(paymentLedgerReport.getPaid())); From 9f9cf752f9e2c1ecba4b0a08da1409b1aea10ebc Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 9 Aug 2024 16:48:12 +0530 Subject: [PATCH 129/133] ISTE-229 --- .../rowmapper/LedgerReportRowMapper.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 27b57e6cb..35127960f 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -201,15 +201,15 @@ private void addPaymentToLedger(List> monthlyRecordList) { paymentLedgerReport.setCollectionDate(transactionDateLong); paymentLedgerReport.setReceiptNo(payment.getPaymentDetails().get(0).getReceiptNumber()); paymentLedgerReport.setPaid(payment.getTotalAmountPaid()); - BigDecimal totalDueAmount=payment.getTotalDue(); - if(totalDueAmount.equals(BigDecimal.ZERO)) - { +// BigDecimal totalDueAmount=payment.getTotalDue(); +// if(totalDueAmount.equals(BigDecimal.ZERO)) +// { paymentLedgerReport.setBalanceLeft(payment.getTotalDue().subtract(paymentLedgerReport.getPaid())); - } - else - { - paymentLedgerReport.setBalanceLeft(totalDueAmount.subtract(paymentLedgerReport.getPaid())); - } +// } +// else +// { +// paymentLedgerReport.setBalanceLeft(totalDueAmount.subtract(paymentLedgerReport.getPaid())); +// } if (ledgerReport.getPayment() == null) { ledgerReport.setPayment(new ArrayList<>()); } From 8fdb8fee16301447334a9f88c2605fcf1199862c Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Fri, 9 Aug 2024 17:09:45 +0530 Subject: [PATCH 130/133] data type changed double to num --- .../lib/model/reports/leadger_report.dart | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/frontend/mgramseva/lib/model/reports/leadger_report.dart b/frontend/mgramseva/lib/model/reports/leadger_report.dart index 6a1462958..d8158f6b5 100644 --- a/frontend/mgramseva/lib/model/reports/leadger_report.dart +++ b/frontend/mgramseva/lib/model/reports/leadger_report.dart @@ -59,22 +59,22 @@ class LeadgerDemand { final String? month; final int? demandGenerationDate; final String? code; - final double? monthlyCharges; - final double? penalty; - final double? totalForCurrentMonth; - final double? previousMonthBalance; - final double? totalDues; + final num? monthlyCharges; + final num? penalty; + final num? totalForCurrentMonth; + final num? previousMonthBalance; + final num? totalDues; final int? dueDateOfPayment; final int? penaltyAppliedOnDate; LeadgerDemand({ - this.consumerName="", + this.consumerName = "", this.connectionNo, - this.oldConnectionNo="", - this.userId="", + this.oldConnectionNo = "", + this.userId = "", this.month, this.demandGenerationDate, - this.code="", + this.code = "", this.monthlyCharges, this.penalty, this.totalForCurrentMonth, @@ -93,11 +93,11 @@ class LeadgerDemand { month: json['month'] as String?, demandGenerationDate: json['demandGenerationDate'] as int?, code: json['code'] as String?, - monthlyCharges: json['monthlyCharges'] as double?, - penalty: json['penalty'] as double?, - totalForCurrentMonth: json['totalForCurrentMonth'] as double?, - previousMonthBalance: json['previousMonthBalance'] as double?, - totalDues: json['totalDues'] as double?, + monthlyCharges: json['monthlyCharges'] as num?, + penalty: json['penalty'] as num?, + totalForCurrentMonth: json['totalForCurrentMonth'] as num?, + previousMonthBalance: json['previousMonthBalance'] as num?, + totalDues: json['totalDues'] as num?, dueDateOfPayment: json['dueDateOfPayment'] as int?, penaltyAppliedOnDate: json['penaltyAppliedOnDate'] as int?, ); @@ -107,8 +107,8 @@ class LeadgerDemand { class LeadgerPayment { final dynamic paymentCollectionDate; final String? receiptNo; - final double? amountPaid; - final double? balanceLeft; + final num? amountPaid; + final num? balanceLeft; LeadgerPayment({ this.paymentCollectionDate, @@ -121,8 +121,8 @@ class LeadgerPayment { return LeadgerPayment( paymentCollectionDate: json['paymentCollectionDate'], receiptNo: json['receiptNo'] as String?, - amountPaid: json['amountPaid'] as double?, - balanceLeft: json['balanceLeft'] as double?, + amountPaid: json['amountPaid'] as num?, + balanceLeft: json['balanceLeft'] as num?, ); } } From 587b4764d55e2b2edb474211d3ba23e701666803 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 9 Aug 2024 17:27:36 +0530 Subject: [PATCH 131/133] ISTE-229 --- .../rowmapper/LedgerReportRowMapper.java | 16 +++++++--------- .../waterconnection/web/models/LedgerReport.java | 7 +++++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index 35127960f..caceb65cd 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -192,6 +192,8 @@ private void addPaymentToLedger(List> monthlyRecordList) { boolean paymentMatched = false; if(payments!=null) { + BigDecimal totalPaymentInMonth=BigDecimal.ZERO; + BigDecimal totalBalanceLeftInMonth=BigDecimal.ZERO; for (Payment payment : payments) { Long transactionDateLong = payment.getTransactionDate(); LocalDate transactionDate = Instant.ofEpochMilli(transactionDateLong).atZone(ZoneId.systemDefault()).toLocalDate(); @@ -201,15 +203,9 @@ private void addPaymentToLedger(List> monthlyRecordList) { paymentLedgerReport.setCollectionDate(transactionDateLong); paymentLedgerReport.setReceiptNo(payment.getPaymentDetails().get(0).getReceiptNumber()); paymentLedgerReport.setPaid(payment.getTotalAmountPaid()); -// BigDecimal totalDueAmount=payment.getTotalDue(); -// if(totalDueAmount.equals(BigDecimal.ZERO)) -// { - paymentLedgerReport.setBalanceLeft(payment.getTotalDue().subtract(paymentLedgerReport.getPaid())); -// } -// else -// { -// paymentLedgerReport.setBalanceLeft(totalDueAmount.subtract(paymentLedgerReport.getPaid())); -// } + paymentLedgerReport.setBalanceLeft(payment.getTotalDue().subtract(paymentLedgerReport.getPaid())); + totalPaymentInMonth=totalPaymentInMonth.add(payment.getTotalAmountPaid()); + totalBalanceLeftInMonth=totalBalanceLeftInMonth.add(payment.getTotalDue()); if (ledgerReport.getPayment() == null) { ledgerReport.setPayment(new ArrayList<>()); } @@ -217,6 +213,8 @@ private void addPaymentToLedger(List> monthlyRecordList) { paymentMatched = true; } } + ledgerReport.setTotalBalanceLeftInMonth(totalPaymentInMonth); + ledgerReport.setTotalPaymentInMonth(totalPaymentInMonth); } if (!paymentMatched) { PaymentLedgerReport defaultPaymentLedgerReport = new PaymentLedgerReport(); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java index 3dac0232e..720e7f2cb 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/LedgerReport.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import lombok.*; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -17,4 +18,10 @@ public class LedgerReport @JsonProperty("payment") private List payment=new ArrayList<>(); + + @JsonProperty("totalPaymentInMonth") + private BigDecimal totalPaymentInMonth=BigDecimal.ZERO; + + @JsonProperty("totalBalanceLeftInMonth") + private BigDecimal totalBalanceLeftInMonth=BigDecimal.ZERO; } From f1f9d8673d0250c0f952842e8e1b45883535c76d Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 9 Aug 2024 17:40:35 +0530 Subject: [PATCH 132/133] ISTE-229 --- .../repository/rowmapper/LedgerReportRowMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java index caceb65cd..a95dd13b8 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/LedgerReportRowMapper.java @@ -213,7 +213,7 @@ private void addPaymentToLedger(List> monthlyRecordList) { paymentMatched = true; } } - ledgerReport.setTotalBalanceLeftInMonth(totalPaymentInMonth); + ledgerReport.setTotalBalanceLeftInMonth(totalBalanceLeftInMonth); ledgerReport.setTotalPaymentInMonth(totalPaymentInMonth); } if (!paymentMatched) { From ac4dd0110028ead733a2dd0500815298a55608ef Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Fri, 9 Aug 2024 18:02:08 +0530 Subject: [PATCH 133/133] Ledger update --- .../mgramseva/lib/model/reports/leadger_report.dart | 10 +++++++++- .../mgramseva/lib/providers/reports_provider.dart | 11 ++++++++--- .../mgramseva/lib/screeens/reports/leadger_table.dart | 3 --- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/frontend/mgramseva/lib/model/reports/leadger_report.dart b/frontend/mgramseva/lib/model/reports/leadger_report.dart index d8158f6b5..c0549bba7 100644 --- a/frontend/mgramseva/lib/model/reports/leadger_report.dart +++ b/frontend/mgramseva/lib/model/reports/leadger_report.dart @@ -38,8 +38,14 @@ class LedgerData { class MonthData { final LeadgerDemand? demand; final List? payment; + final num? totalPaymentInMonth; + final num? totalBalanceLeftInMonth; - MonthData({this.demand, this.payment}); + MonthData( + {this.demand, + this.payment, + this.totalPaymentInMonth, + this.totalBalanceLeftInMonth}); factory MonthData.fromJson(Map json) { return MonthData( @@ -47,6 +53,8 @@ class MonthData { payment: (json['payment'] as List?) ?.map((e) => LeadgerPayment.fromJson(e)) .toList(), + totalPaymentInMonth: json['totalPaymentInMonth'] as num?, + totalBalanceLeftInMonth: json['totalBalanceLeftInMonth'] as num?, ); } } diff --git a/frontend/mgramseva/lib/providers/reports_provider.dart b/frontend/mgramseva/lib/providers/reports_provider.dart index d572810cc..7b69a0f12 100644 --- a/frontend/mgramseva/lib/providers/reports_provider.dart +++ b/frontend/mgramseva/lib/providers/reports_provider.dart @@ -193,6 +193,10 @@ class ReportsProvider with ChangeNotifier { } } + String formatPaymentReceipts(List? payments) { + return payments?.map((payment) => payment.receiptNo)?.join(', ') ?? ''; + } + TableDataRow getLedgerRow(LedgerData data, {bool isExcel = false}) { return TableDataRow([ TableData( @@ -207,10 +211,11 @@ class ReportsProvider with ChangeNotifier { '${DateFormats.leadgerTimeStampToDate(data.months?.values.first.demand?.dueDateOfPayment)}'), TableData( '${DateFormats.leadgerTimeStampToDate(data.months?.values.first.payment?.first.paymentCollectionDate)}'), - TableData('${data.months?.values.first.payment?.first.receiptNo}'), - TableData('₹ ${data.months?.values.first.payment?.first.amountPaid}'), + // TableData('${data.months?.values.first.payment?.first.receiptNo}'), + TableData('${formatPaymentReceipts(data.months?.values?.first.payment)}'), + TableData('₹ ${data.months?.values.first.totalPaymentInMonth}'), TableData( - '₹ ${(double.parse("${data.months?.values.first.demand?.totalDues}") - double.parse("${data.months?.values.first.payment?.first.amountPaid}"))}'), + '₹ ${(double.parse("${data.months?.values.first.demand?.totalDues}") - double.parse("${data.months?.values.first.totalPaymentInMonth}"))}'), TableData( '${DateFormats.leadgerTimeStampToDate(data.months?.values.first.demand?.penaltyAppliedOnDate)}'), TableData('₹ ${data.months?.values.first.demand?.penalty}'), diff --git a/frontend/mgramseva/lib/screeens/reports/leadger_table.dart b/frontend/mgramseva/lib/screeens/reports/leadger_table.dart index 8f04672ce..49d1e6a90 100644 --- a/frontend/mgramseva/lib/screeens/reports/leadger_table.dart +++ b/frontend/mgramseva/lib/screeens/reports/leadger_table.dart @@ -3,9 +3,6 @@ import 'package:mgramseva/model/connection/water_connection.dart'; import 'package:mgramseva/utils/constants/i18_key_constants.dart'; import 'package:provider/provider.dart'; import '../../providers/reports_provider.dart'; -import '../../utils/constants.dart'; -import '../../utils/date_formats.dart'; -import '../../utils/global_variables.dart'; import '../../utils/localization/application_localizations.dart'; import '../../widgets/label_text.dart'; import '../../widgets/pagination.dart';