@Override public ClientDashboardData getClientDashboardData(ClientDashboardData client, int buId) { jdbcTemplate.setDataSource(dataSourceProvider.getDataSource(buId)); CommonStoredProcedure sp = new CommonStoredProcedure(jdbcTemplate, SP_GET_CLIENT_DASHBOARD_DATA); sp.setParameters( new SqlParameter[] { new SqlParameter("partyId", Types.INTEGER), new SqlParameter("buId", Types.INTEGER), new SqlParameter("nodeId", Types.INTEGER), new SqlParameter("userId", Types.INTEGER), new SqlOutParameter("result", Types.INTEGER) }); sp.compile(); // Integer userId=loanData.getPartyLoanId() !=null && loanData.getPartyLoanId()>0 ? // loanData.getLastModifiedBy(): loanData.getCreatedBy(); Map<String, Object> paranValues = new HashMap<String, Object>(); paranValues.put("partyId", client.getPartyId() != null ? client.getPartyId() : 0); paranValues.put("buId", client.getBuId() != null ? client.getBuId() : 0); paranValues.put("nodeId", client.getNodeId() != null ? client.getNodeId() : 0); paranValues.put("userId", 1); Map<String, Object> storedProcResult = sp.execute(paranValues); logger.debug("storedProcResult:------" + storedProcResult); client.setPartyId((Integer) storedProcResult.get("result")); return client; }
@Override public List<ClientData> mergeClientConformation(String partyIds, int buId) { List<ClientData> clientDatas = new ArrayList<ClientData>(); jdbcTemplate.setDataSource(dataSourceProvider.getDataSource(buId)); String result = FiinfraConstants.fail; List<Map<String, Object>> l = new ArrayList<Map<String, Object>>(); CommonStoredProcedure myStoredProcedure = new CommonStoredProcedure(jdbcTemplate, "usp_cp_mergeClientConformation"); SqlParameter partyIdsParam = new SqlParameter("partyIds", Types.VARCHAR); SqlParameter[] paramArray = {partyIdsParam}; myStoredProcedure.setParameters(paramArray); myStoredProcedure.compile(); Map<String, Object> paranValues = new HashMap<String, Object>(); paranValues.put("partyIds", partyIds); logger.debug("paranValues:--" + paranValues); Map<String, Object> storedProcResult = myStoredProcedure.execute(paranValues); l = (List<Map<String, Object>>) storedProcResult.get("#result-set-1"); // System.out.println("l:--" + l); if (l != null) { ClientData clientData = null; for (Map<String, Object> row : l) { clientData = new ClientData(); clientData.setPartyId((Integer) row.get("partyId")); clientData.setFirstName((String) row.get("firstName")); clientDatas.add(clientData); } } return clientDatas; }
public String mergeClients(int partyId, String mergeClientIds, int buId, int contactPartyId) { jdbcTemplate.setDataSource(dataSourceProvider.getDataSource(buId)); String result = FiinfraConstants.fail; List<Map<String, Object>> l = new ArrayList<Map<String, Object>>(); CommonStoredProcedure myStoredProcedure = new CommonStoredProcedure(jdbcTemplate, "usp_cp_mergeClients"); SqlParameter partyIdsParam = new SqlParameter("partyId", Types.INTEGER); SqlParameter mergeClientIdsParam = new SqlParameter("mergeClientId", Types.VARCHAR); SqlParameter contactPartyIdParam = new SqlParameter("contactPartyId", Types.INTEGER); // SqlParameter nodeIdParam = new SqlParameter("nodeId", Types.INTEGER); SqlOutParameter recordCountParam = new SqlOutParameter("recordCount", Types.INTEGER); SqlParameter[] paramArray = { partyIdsParam, mergeClientIdsParam, contactPartyIdParam, recordCountParam }; myStoredProcedure.setParameters(paramArray); myStoredProcedure.compile(); Map<String, Object> paranValues = new HashMap<String, Object>(); paranValues.put("partyId", partyId); paranValues.put("mergeClientId", mergeClientIds); paranValues.put("contactPartyId", contactPartyId); paranValues.put("recordCountParam", recordCountParam); // paranValues.put("contactPartyId",nodeI); logger.debug("paranValues:--" + paranValues); Map<String, Object> storedProcResult = myStoredProcedure.execute(paranValues); logger.debug("storedProcResult:---" + storedProcResult); int recordCount = (int) storedProcResult.get("recordCount"); if (recordCount > 0) result = FiinfraConstants.success; // result = FiinfraConstants.EMPTY_RESULT_SET; return result; }
@Override public List<OpportunityStageData> getClientStageList(int partyId, int buId, int nodeId) { // TODO Auto-generated method stub jdbcTemplate.setDataSource(dataSourceProvider.getDataSource(buId)); List<OpportunityStageData> clientStageDatas = new ArrayList<>(); try { List<Map<String, Object>> l = new ArrayList<Map<String, Object>>(); CommonStoredProcedure myStoredProcedure = new CommonStoredProcedure(jdbcTemplate, "usp_cp_getClientStageList"); SqlParameter partyIdParam = new SqlParameter("partyId", Types.INTEGER); SqlParameter nodeIdParam = new SqlParameter("nodeId", Types.INTEGER); SqlParameter[] paramArray = {partyIdParam, nodeIdParam}; myStoredProcedure.setParameters(paramArray); myStoredProcedure.compile(); Map<String, Object> paranValues = new HashMap<String, Object>(); paranValues.put("partyId", partyId); paranValues.put("nodeId", nodeId); // System.out.println("paranValues:--" + paranValues); Map<String, Object> storedProcResult = myStoredProcedure.execute(paranValues); // System.out.println("storedProcResult:---" + storedProcResult); // personal details l = (List<Map<String, Object>>) storedProcResult.get("#result-set-1"); // System.out.println("l:--" + l); if (l != null) { OpportunityStageData opportunityStageData = null; for (Map<String, Object> row : l) { opportunityStageData = new OpportunityStageData(); opportunityStageData.setPartyId((int) row.get("partyid")); opportunityStageData.setStage((String) row.get("stage")); opportunityStageData.setFpStageEndDate((String) row.get("FPStageEndDate")); opportunityStageData.setFpStageEndDateTime((String) row.get("FPStageEndDateTime")); clientStageDatas.add(opportunityStageData); } } // System.out.println("App Client Data........."+clientStageDatas); } catch (Exception e) { // e.printStackTrace(); logger.debug(e.getMessage()); } return clientStageDatas; }
@Override public List<Integer> saveClient(int partyId, String clientXMLString, int createdBy, int buId) { int recordCount = 0; int isPanExist = 0; List<Integer> resultList = new ArrayList<>(); jdbcTemplate.setDataSource(dataSourceProvider.getDataSource(buId)); ClientData clientData = new ClientData(); List<Map<String, Object>> l = new ArrayList<Map<String, Object>>(); CommonStoredProcedure myStoredProcedure = new CommonStoredProcedure(jdbcTemplate, "usp_cp_saveClient"); SqlParameter partyIdParam = new SqlParameter("partyId", Types.INTEGER); SqlParameter clientXMLStringParam = new SqlParameter("clientXMLString", Types.VARCHAR); SqlParameter createdByParam = new SqlParameter("createdBy", Types.INTEGER); SqlOutParameter recordCountParam = new SqlOutParameter("recordCount", Types.VARCHAR); SqlOutParameter partyIdDBParam = new SqlOutParameter("partyIdDB", Types.VARCHAR); SqlOutParameter isPanExistParam = new SqlOutParameter("isPanExist", Types.VARCHAR); logger.debug("clientXMLString:--" + clientXMLString); SqlParameter[] paramArray = { partyIdParam, clientXMLStringParam, createdByParam, recordCountParam, partyIdDBParam, isPanExistParam }; myStoredProcedure.setParameters(paramArray); myStoredProcedure.compile(); Map<String, Object> paranValues = new HashMap<String, Object>(); paranValues.put("partyId", partyId); paranValues.put("clientXMLString", clientXMLString); paranValues.put("createdBy", createdBy); // System.out.println("paranValues:--" + paranValues); // System.out.println("XML"+clientXMLString); Map<String, Object> storedProcResult = myStoredProcedure.execute(paranValues); logger.info("storedProcResult:---" + storedProcResult); recordCount = Integer.parseInt(storedProcResult.get("recordCount").toString()); partyId = Integer.parseInt(storedProcResult.get("partyIdDB").toString()); isPanExist = Integer.parseInt(storedProcResult.get("isPanExist").toString()); resultList.add(recordCount); resultList.add(partyId); resultList.add(isPanExist); logger.info("recordCount:---" + recordCount); logger.info("isPanExist------" + isPanExist); return resultList; }
@Override public List<Integer> updateClientProfile( String sectionName, String dataXml, int buId, int partyId, int lastModifiedBy) { int recordCount = 0; List<Integer> resultList = new ArrayList<>(); jdbcTemplate.setDataSource(dataSourceProvider.getDataSource(buId)); ClientProfileData clientProfileData = new ClientProfileData(); List<Map<String, Object>> l = new ArrayList<Map<String, Object>>(); CommonStoredProcedure myStoredProcedure = new CommonStoredProcedure(jdbcTemplate, "usp_cp_saveClientProfileDetails"); // System.out.println("Client // PartyID-----------------------------------------------------------------"+partyId); SqlParameter partyIdParam = new SqlParameter("partyId", Types.INTEGER); SqlParameter sectionNameParam = new SqlParameter("sectionName", Types.VARCHAR); SqlParameter dataXmlParam = new SqlParameter("dataXml", Types.VARCHAR); SqlParameter lastModifiedByParam = new SqlParameter("lastModifiedBy", Types.INTEGER); SqlOutParameter recordCountParam = new SqlOutParameter("recordCount", Types.VARCHAR); SqlOutParameter isPanExistParam = new SqlOutParameter("isPanExist", Types.VARCHAR); logger.debug("dataXml:--" + dataXml); SqlParameter[] paramArray = { partyIdParam, sectionNameParam, dataXmlParam, lastModifiedByParam, recordCountParam, isPanExistParam }; myStoredProcedure.setParameters(paramArray); myStoredProcedure.compile(); Map<String, Object> paranValues = new HashMap<String, Object>(); paranValues.put("partyId", partyId); paranValues.put("sectionName", sectionName); paranValues.put("dataXml", dataXml); paranValues.put("lastModifiedBy", lastModifiedBy); System.out.println("paranValues:--" + paranValues); Map<String, Object> storedProcResult = myStoredProcedure.execute(paranValues); logger.info("storedProcResult:---" + storedProcResult); recordCount = Integer.parseInt(storedProcResult.get("recordCount").toString()); int isPanExist = Integer.parseInt(storedProcResult.get("isPanExist").toString()); resultList.add(recordCount); resultList.add(isPanExist); logger.info("recordCount:---" + recordCount); logger.info("isPanExist***********----" + isPanExist); return resultList; }
@Override public Integer getNumberOfAlertsForPartyId(Integer partyID, Integer nodeID, Integer buId) { jdbcTemplate.setDataSource(dataSourceProvider.getDataSource(buId)); CommonStoredProcedure myStoredProcedure = new CommonStoredProcedure(jdbcTemplate, "usp_DIY_getNumberOfAlertsForPartyId"); SqlParameter partyId = new SqlParameter("partyId", Types.INTEGER); SqlParameter nodeId = new SqlParameter("nodeId", Types.INTEGER); SqlOutParameter Result = new SqlOutParameter("Result", Types.INTEGER); SqlParameter[] param = {partyId, nodeId, Result}; myStoredProcedure.setParameters(param); myStoredProcedure.compile(); Map<String, Object> paramValue = new HashMap<String, Object>(); paramValue.put("partyId", partyID); paramValue.put("nodeId", nodeID); Map<String, Object> storedProcedureResult = myStoredProcedure.execute(paramValue); Integer result2 = (Integer) storedProcedureResult.get("Result"); return result2; }
// @Override // public List<ClientData> getClientList(int partyId, int buId,String clientValueSearch,boolean // IsAutoPlan,int nodeId) { // jdbcTemplate.setDataSource(dataSourceProvider.getDataSource(buId)); // return jdbcTemplate.query("{call usp_cp_getClientList(?,?,?,?)}", new Object[] { // partyId,clientValueSearch,IsAutoPlan,nodeId }, // new BeanPropertyRowMapper<ClientData>(ClientData.class)); // } @SuppressWarnings("finally") @Override public Response getClientList( int partyId, int buId, String clientValueSearch, boolean IsAutoPlan, int nodeId, int pageNo, int pageSize, String orderBy, String sord) { jdbcTemplate.setDataSource(dataSourceProvider.getDataSource(buId)); try { List<ClientData> list; BaseResponse<GridData> br = new BaseResponse<GridData>(); GridData gridData = new GridData(); list = jdbcTemplate.query( "{call usp_cp_getClientList(?,?,?,?,?,?,?,?)}", new Object[] { partyId, clientValueSearch, IsAutoPlan, nodeId, pageNo, pageSize, orderBy, sord }, new BeanPropertyRowMapper<ClientData>(ClientData.class)); gridData.setRows(list); CommonStoredProcedure myStoredProcedure = new CommonStoredProcedure(jdbcTemplate, "usp_cp_getClientListCount"); SqlParameter partyIdParam = new SqlParameter("partyId", Types.INTEGER); SqlParameter nodeIdParam = new SqlParameter("nodeId", Types.INTEGER); SqlParameter clientVlaueParam = new SqlParameter("clientValueSearch", Types.VARCHAR); SqlParameter IsAutoPlanParam = new SqlParameter("IsAutoPlan", Types.BOOLEAN); SqlOutParameter recordsCountParam = new SqlOutParameter("recordsCount", Types.INTEGER); SqlParameter[] paramArray = { partyIdParam, clientVlaueParam, IsAutoPlanParam, nodeIdParam, recordsCountParam }; myStoredProcedure.setParameters(paramArray); myStoredProcedure.compile(); Map<String, Object> paranValues = new HashMap<String, Object>(); paranValues.put("partyId", partyId); paranValues.put("clientValueSearch", clientValueSearch); paranValues.put("IsAutoPlan", IsAutoPlan); paranValues.put("nodeId", nodeId); logger.info("paranValues:--------------" + paranValues); logger.info("-----------Before Calling SP In APP(getClientList)-----------"); Map<String, Object> storedProcResult = myStoredProcedure.execute(paranValues); logger.info("-----------After Calling SP In APP(getClientList)-----------"); int recordCount = (int) storedProcResult.get("recordsCount"); gridData.setRecords(recordCount); gridData.setPage(pageNo); gridData.setTotal( recordCount % pageSize == 0 ? recordCount / pageSize : (recordCount / pageSize) + 1); br.setResponseObject(gridData); response = FiinfraResponseBuilder.getSuccessResponse(br, null); } catch (DataAccessException e) { response = FiinfraResponseBuilder.getErrorResponse(e.getMessage().toString()); } finally { return response; } }
public List<ClientData> getClientListToMerge( int partyId, int buId, int contactpartyId, boolean isAllClients, boolean isFromProfile, int nodeId, String searchText) { jdbcTemplate.setDataSource(dataSourceProvider.getDataSource(buId)); // return jdbcTemplate.query(SP_RETRIVE_ClIENTS_TO_MERGE,new Object[] // {partyId,contactpartyId,isAllClients}, // new BeanPropertyRowMapper<ClientData>(ClientData.class)); List<ClientData> clientDatas = new ArrayList<ClientData>(); try { jdbcTemplate.setDataSource(dataSourceProvider.getDataSource(buId)); List<Map<String, Object>> l = new ArrayList<Map<String, Object>>(); CommonStoredProcedure myStoredProcedure = new CommonStoredProcedure(jdbcTemplate, "usp_cp_getClientListToMerge"); SqlParameter partyIdParam = new SqlParameter("partyId", Types.INTEGER); SqlParameter contactpartyIdParam = new SqlParameter("contactpartyId", Types.INTEGER); SqlParameter isAllClientsParam = new SqlParameter("isAllClients", Types.BOOLEAN); SqlParameter isFromProfileParam = new SqlParameter("isFromProfile", Types.BOOLEAN); SqlParameter nodeIdParam = new SqlParameter("nodeId", Types.INTEGER); SqlParameter searchTextParam = new SqlParameter("searchText", Types.VARCHAR); SqlParameter[] paramArray = { partyIdParam, contactpartyIdParam, isAllClientsParam, isFromProfileParam, nodeIdParam, searchTextParam }; myStoredProcedure.setParameters(paramArray); myStoredProcedure.compile(); Map<String, Object> paranValues = new HashMap<String, Object>(); paranValues.put("partyId", partyId); paranValues.put("contactpartyId", contactpartyId); paranValues.put("isAllClients", isAllClients); paranValues.put("isFromProfile", isFromProfile); paranValues.put("nodeId", nodeId); paranValues.put("searchText", searchText); // System.out.println("paranValues:--" + paranValues); Map<String, Object> storedProcResult = myStoredProcedure.execute(paranValues); // System.out.println("storedProcResult:---" + storedProcResult); // personal details l = (List<Map<String, Object>>) storedProcResult.get("#result-set-1"); // System.out.println("l:--" + l); if (l != null) { ClientData clientData = null; for (Map<String, Object> row : l) { clientData = new ClientData(); clientData.setFirstName((String) row.get("firstName")); clientData.setLastName((String) row.get("lastName")); clientData.setPanNo((String) row.get("panNo")); clientData.setEmail((String) row.get("contactEmail")); clientData.setPartyId((Integer) row.get("partyId")); clientData.setAddress((String) row.get("address")); clientDatas.add(clientData); } } // System.out.println("App Client Data........."+clientDatas); } catch (Exception e) { // e.printStackTrace(); logger.debug(e.getMessage()); } return clientDatas; // List<ClientData> mergeClientData = new ArrayList<ClientData>(); // return mergeClientData; }