@GET @Produces(MediaType.APPLICATION_JSON) @Path("/getAutoPlanClinetDetailsRecord/{user}/{token}") public Response getAutoPlanClinetDetailsRecord( @QueryParam("partyId") int partyId, @QueryParam("buId") int buId, @PathParam("token") String token, @PathParam("user") String name) throws JsonGenerationException, JsonMappingException, IOException { BaseResponse<AutoPlanData> baseResponse = new BaseResponse<AutoPlanData>(); baseResponse.setResponseObject(partnerService.getAutoPlanClinetDetailsRecord(partyId, buId)); baseResponse.setStatus("SUCCESS"); Response response = FiinfraResponseBuilder.getSuccessResponse(baseResponse, null); return response; }
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/deleteTargets/{user}/{token}") public Response deleteTargets( @QueryParam("buId") int buId, @QueryParam("targetIds") String targetIds, @PathParam("token") String token, @PathParam("user") String name) throws Exception { int recordCount = partnerService.deleteTargets(targetIds, buId); BaseResponse<Integer> br = new BaseResponse<Integer>(); br.setResponseObject(recordCount); response = FiinfraResponseBuilder.getSuccessResponse(br, null); return response; }
@GET @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/getPlanType/{user}/{token}") public Response getPlanType( @QueryParam("buId") int buId, @QueryParam("partyId") int partyId, @PathParam("token") String token, @PathParam("user") String name) throws IOException { BaseResponse<Integer> br = new BaseResponse<>(); br.setResponseObject(partnerService.getPlanType(partyId, buId)); Response response = FiinfraResponseBuilder.getSuccessResponse(br, null); return response; }
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/getPartnerAutoPlanConfiguration/{user}/{token}") public Response getPartnerAutoPlanConfiguration( @Context HttpServletRequest request, @PathParam("token") String token, @PathParam("user") String name, @QueryParam("partyId") int partyId) throws IOException { String buId = request.getHeader("buId"); BaseResponse<Integer> br = new BaseResponse<Integer>(); br.setResponseObject( partnerService.getPartnerAutoPlanCongiguration(partyId, Integer.parseInt(buId))); Response response = FiinfraResponseBuilder.getSuccessResponse(br, null); return response; }
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/getProfileRecord/{user}/{token}") public Response getProfileRecord( @QueryParam("partyId") int partyId, @QueryParam("buId") int buId, @PathParam("token") String token, @PathParam("user") String name) throws JsonGenerationException, JsonMappingException, IOException { logger.debug("partyId:---" + partyId); ProfileData documentData = partnerService.getProfileDetails(partyId, buId); BaseResponse<ProfileData> br = new BaseResponse<>(); br.setResponseObject(documentData); response = FiinfraResponseBuilder.getSuccessResponse(br, null); return response; }
@POST @Path(value = "/updateQuickDCDetails/{username}/{token}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateQuickDCDetails( AutoPlanData autoPlanData, @Context HttpServletRequest request, @PathParam("username") String userName, @PathParam("token") String token) { String buId = request.getHeader("buId"); BaseResponse<Integer> baseResponse = new BaseResponse<>(); baseResponse.setResponseObject( partnerService.updateQuickDCDetails(autoPlanData, Integer.parseInt(buId))); Response response = FiinfraResponseBuilder.getSuccessResponse(baseResponse, null); return response; }
@POST @Path(value = "/saveInterstedFpSection/{username}/{token}") @Produces(MediaType.APPLICATION_JSON) public Response saveInterstedFpSection( @PathParam("username") String userName, @PathParam("token") String token, @QueryParam("partyId") int partyId, @QueryParam("lastModifiedBy") Integer lastModifiedBy, @QueryParam("buId") Integer buId, @RequestBody KeyValue keyValue) { BaseResponse<Boolean> baseResponse = new BaseResponse<Boolean>(); baseResponse.setResponseObject(new Boolean(true)); partnerService.saveInterstedFpSection(partyId, lastModifiedBy, keyValue, buId); Response response = FiinfraResponseBuilder.getSuccessResponse(baseResponse, null); return response; }
@GET @Path(value = "/updateCurrentNodeIdForPartyId/{username}/{token}") @Produces(MediaType.APPLICATION_JSON) public Response updateCurrentNodeIdForPartyId( @Context HttpServletRequest request, @PathParam("username") String userName, @PathParam("token") String token, @QueryParam("partyId") int partyId, @QueryParam("nodeId") int nodeId) { String buId = request.getHeader("buId"); BaseResponse<Boolean> baseResponse = new BaseResponse<Boolean>(); baseResponse.setResponseObject( partnerService.updateCurrentNodeIdForPartyId(partyId, nodeId, Integer.parseInt(buId))); Response response = FiinfraResponseBuilder.getSuccessResponse(baseResponse, null); return response; }
@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/savePartnerLocationData/{user}/{token}") public Response savePartnerLocationData( LocationData locationData, @Context HttpServletRequest request, @PathParam("token") String token, @PathParam("user") String name) throws Exception { String buId = request.getHeader("buId"); int recordCount = partnerService.savePartnerLocationData(locationData, Integer.parseInt(buId)); BaseResponse<Integer> br = new BaseResponse<>(); br.setResponseObject(recordCount); response = FiinfraResponseBuilder.getSuccessResponse(br, null); return response; }
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/getPartnerDetails/{user}/{token}") public Response getPartnerDetails( @QueryParam("buId") int buId, @QueryParam("partyId") int partyId, @PathParam("token") String token, @PathParam("user") String name) throws JsonGenerationException, JsonMappingException, IOException { logger.debug("partyId:---" + partyId); Partner partner = partnerService.getPartnerDetails(partyId, buId); BaseResponse<Partner> br = new BaseResponse<>(); br.setResponseObject(partner); response = FiinfraResponseBuilder.getSuccessResponse(br, null); // System.out.println("Response======"+response); return response; }
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/getOLTransactionConfiguration/{username}/{token}") public Response getOLTransactionConfiguration( @PathParam("username") String username, @PathParam("token") String token, @QueryParam("partyId") Integer partyId, @QueryParam("attrCodeId") Integer attrCodeId, @QueryParam("attrCodeList") String attrCodeList, @QueryParam("buId") Integer buId) { BaseResponse<ConfigurationProductsList> br = new BaseResponse<ConfigurationProductsList>(); br.setResponseObject( partnerService.getConfigurationProductsList(partyId, attrCodeId, attrCodeList, buId)); response = FiinfraResponseBuilder.getSuccessResponse(br, null); return response; }
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/getNameOfPartnerOrNode/{user}/{token}") public Response getNameOfPartnerOrNode( @Context HttpServletRequest request, @QueryParam("partyId") Integer partyId, @QueryParam("currentNodeId") Integer currentNodeId, @PathParam("token") String token, @PathParam("user") String userName) throws JsonGenerationException, JsonMappingException, IOException { String buId = request.getHeader("buId"); String name = partnerService.getNameOfPartnerOrNode(partyId, currentNodeId, Integer.parseInt(buId)); BaseResponse<String> br = new BaseResponse<>(); br.setResponseObject(name); response = FiinfraResponseBuilder.getSuccessResponse(br, null); return response; }
@GET @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/deletePartner/{user}/{token}") public Response deletePartner( @QueryParam("buId") int buId, @QueryParam("partyId") int partyId, @PathParam("token") String token, @PathParam("user") String name) throws IOException { // System.out.println("In APP Calling deletePartner"); BaseResponse<Integer> br = new BaseResponse<>(); logger.info(br); br.setResponseObject(partnerService.deletePartner(partyId, buId)); // Response response=partnerService.addPartner(partner); Response response = FiinfraResponseBuilder.getSuccessResponse(br, null); // System.out.println("Delete Partner="+response); return response; }
@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/savePartnerData/{user}/{token}") public Response savePartnerData( Partner partner, @Context HttpServletRequest request, @PathParam("token") String token, @PathParam("user") String name) throws IOException { // System.out.println("In APP Calling SavePartner"); String buId = request.getHeader("buId"); BaseResponse<Integer> br = new BaseResponse<>(); logger.info(br); br.setResponseObject(partnerService.addPartner(partner, Integer.parseInt(buId))); // Response response=partnerService.addPartner(partner); Response response = FiinfraResponseBuilder.getSuccessResponse(br, null); return response; }
@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/updatePartnerProfile/{user}/{token}") public Response updatePartnerProfile( ProfileData profileData, @PathParam("token") String token, @PathParam("user") String name) throws Exception { String sectionName = profileData.getSectionName(); String dataXml = FiinfraUtility.getProfileDataXML(profileData, sectionName); int buId = profileData.getBuId(); int partyId = profileData.getPartyId(); int recordCount = partnerService.updatePartnerProfile( sectionName, dataXml, buId, partyId, profileData.getLastModifiedBy()); BaseResponse<Integer> br = new BaseResponse<>(); br.setResponseObject(recordCount); response = FiinfraResponseBuilder.getSuccessResponse(br, null); return response; }
@POST @Produces(MediaType.APPLICATION_JSON) @Path("/saveRtaFilePasswords/{user}/{token}") public Response saveRtaFilePasswords( @Context HttpServletRequest request, @PathParam("token") String token, @PathParam("user") String user, @QueryParam("partyId") Integer partyId, @QueryParam("userId") Integer userId, @RequestBody List<String> passwords) throws IOException { // System.out.println("In APP Calling SavePartner"); String buId = request.getHeader("buId"); BaseResponse<Boolean> br = new BaseResponse<Boolean>(); logger.info(br); br.setResponseObject( partnerService.saveRtaFilePasswords(partyId, passwords, userId, Integer.parseInt(buId))); // Response response=partnerService.addPartner(partner); Response response = FiinfraResponseBuilder.getSuccessResponse(br, null); return response; }
@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/insertOrUpdateBisunessValuation/{user}/{token}") public Response insertOrUpdateBisunessValuation( BusinessValuationData businessValuationData, @Context HttpServletRequest request, @PathParam("token") String token, @PathParam("user") String name) throws Exception { String buId = request.getHeader("buId"); String dataXml = FiinfraUtility.getBusinessDataXML(businessValuationData); int partyId = businessValuationData.getPartyId(); int recordCount = partnerService.insertOrUpdateBisunessValuation( dataXml, partyId, businessValuationData.getCreatedBy(), Integer.parseInt(buId)); BaseResponse<Integer> br = new BaseResponse<>(); br.setResponseObject(recordCount); response = FiinfraResponseBuilder.getSuccessResponse(br, null); return response; }
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/updatePartnerAutoPlanConfiguration/{user}/{token}") public Response updatePartnerAutoPlanConfiguration( @Context HttpServletRequest request, @QueryParam("isAutoPlanEnabled") int isAutoPlanEnabled, @QueryParam("partyId") int partyId, @QueryParam("lastModifiedBy") int lastModifiedBy, @PathParam("token") String token, @PathParam("user") String name) throws JsonGenerationException, JsonMappingException, IOException { logger.debug("partyId:---" + partyId); String buId = request.getHeader("buId"); Integer recordCount = partnerService.updatePartnerAutoPlanConfiguration( partyId, lastModifiedBy, isAutoPlanEnabled, Integer.parseInt(buId)); BaseResponse<Integer> br = new BaseResponse<>(); br.setResponseObject(recordCount); response = FiinfraResponseBuilder.getSuccessResponse(br, null); return response; }
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/getHeirarchyDataForVP/{user}/{token}") public Response getHeirarchyDataForVP( @Context HttpServletRequest request, @QueryParam("partyId") int partyId, @QueryParam("currentNodeId") int currentNodeId, @QueryParam("level") int level, @PathParam("token") String token, @PathParam("user") String name) throws JsonGenerationException, JsonMappingException, IOException { String buId = request.getHeader("buId"); logger.debug("partyId:---" + partyId); logger.debug("currentNodeId:---" + currentNodeId); logger.debug("level:---" + level); HeirarchyData heirarchyData = partnerService.getHeirarchyDataForVP(partyId, currentNodeId, level, Integer.parseInt(buId)); BaseResponse<HeirarchyData> br = new BaseResponse<>(); br.setResponseObject(heirarchyData); response = FiinfraResponseBuilder.getSuccessResponse(br, null); return response; }
// @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; } }