Search in sources :

Example 86 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project sic by belluccifranco.

the class CajaController method getSaldoFinalCajas.

@GetMapping("/cajas/empresas/{idEmpresa}/saldo-final")
public double getSaldoFinalCajas(@PathVariable long idEmpresa, @RequestParam(value = "idUsuario", required = false) Long idUsuario, @RequestParam(value = "desde", required = false) Long desde, @RequestParam(value = "hasta", required = false) Long hasta) {
    Calendar fechaDesde = Calendar.getInstance();
    // Rango temporal hasta la implementacion de criteria builder
    fechaDesde.add(Calendar.YEAR, -17);
    Calendar fechaHasta = Calendar.getInstance();
    if (desde != null && hasta != null) {
        fechaDesde.set(Calendar.HOUR, 0);
        fechaDesde.set(Calendar.MINUTE, 0);
        fechaDesde.set(Calendar.SECOND, 0);
        fechaDesde.set(Calendar.MILLISECOND, 0);
        fechaDesde.setTimeInMillis(desde);
        fechaHasta.set(Calendar.HOUR, 0);
        fechaHasta.set(Calendar.MINUTE, 0);
        fechaHasta.set(Calendar.SECOND, 0);
        fechaHasta.set(Calendar.MILLISECOND, 0);
        fechaHasta.setTimeInMillis(hasta);
    }
    return cajaService.getSaldoFinalCajas(idEmpresa, idUsuario, fechaDesde.getTime(), fechaHasta.getTime());
}
Also used : Calendar(java.util.Calendar) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 87 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project sic by belluccifranco.

the class CajaController method getSaldoRealCajas.

@GetMapping("/cajas/empresas/{idEmpresa}/saldo-real")
public double getSaldoRealCajas(@PathVariable long idEmpresa, @RequestParam(value = "idUsuario", required = false) Long idUsuario, @RequestParam(value = "desde", required = false) Long desde, @RequestParam(value = "hasta", required = false) Long hasta) {
    Calendar fechaDesde = Calendar.getInstance();
    // Rango temporal hasta la implementacion de criteria builder
    fechaDesde.add(Calendar.YEAR, -17);
    Calendar fechaHasta = Calendar.getInstance();
    if (desde != null && hasta != null) {
        fechaDesde.set(Calendar.HOUR, 0);
        fechaDesde.set(Calendar.MINUTE, 0);
        fechaDesde.set(Calendar.SECOND, 0);
        fechaDesde.set(Calendar.MILLISECOND, 0);
        fechaDesde.setTimeInMillis(desde);
        fechaHasta.set(Calendar.HOUR, 0);
        fechaHasta.set(Calendar.MINUTE, 0);
        fechaHasta.set(Calendar.SECOND, 0);
        fechaHasta.set(Calendar.MILLISECOND, 0);
        fechaHasta.setTimeInMillis(hasta);
    }
    return cajaService.getSaldoRealCajas(idEmpresa, idUsuario, fechaDesde.getTime(), fechaHasta.getTime());
}
Also used : Calendar(java.util.Calendar) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 88 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project sic by belluccifranco.

the class FacturaController method buscarFacturaVenta.

@GetMapping("/facturas/venta/busqueda/criteria")
@ResponseStatus(HttpStatus.OK)
public Page<FacturaVenta> buscarFacturaVenta(@RequestParam Long idEmpresa, @RequestParam(required = false) Long desde, @RequestParam(required = false) Long hasta, @RequestParam(required = false) Long idCliente, @RequestParam(required = false) Integer nroSerie, @RequestParam(required = false) Integer nroFactura, @RequestParam(required = false) Long idViajante, @RequestParam(required = false) TipoDeComprobante tipoDeComprobante, @RequestParam(required = false) Long idUsuario, @RequestParam(required = false) Long nroPedido, @RequestParam(required = false) Boolean soloImpagas, @RequestParam(required = false) Boolean soloPagas, @RequestParam(required = false) Integer pagina, @RequestParam(required = false) Integer tamanio) {
    Calendar fechaDesde = Calendar.getInstance();
    Calendar fechaHasta = Calendar.getInstance();
    if ((desde != null) && (hasta != null)) {
        fechaDesde.setTimeInMillis(desde);
        fechaHasta.setTimeInMillis(hasta);
    }
    soloImpagas = (soloImpagas == null) ? false : soloImpagas;
    soloPagas = (soloPagas == null) ? false : soloPagas;
    if ((soloImpagas == true) && (soloPagas == true)) {
        soloImpagas = false;
        soloPagas = false;
    }
    Cliente cliente = new Cliente();
    if (idCliente != null) {
        cliente = clienteService.getClientePorId(idCliente);
    }
    Usuario usuario = new Usuario();
    if (idUsuario != null) {
        usuario = usuarioService.getUsuarioPorId(idUsuario);
    }
    Usuario viajante = new Usuario();
    if (idViajante != null) {
        viajante = usuarioService.getUsuarioPorId(idViajante);
    }
    if (tamanio == null || tamanio <= 0) {
        tamanio = TAMANIO_PAGINA_DEFAULT;
    }
    if (pagina == null || pagina < 0) {
        pagina = 0;
    }
    Pageable pageable = new PageRequest(pagina, tamanio, new Sort(Sort.Direction.DESC, "fecha"));
    BusquedaFacturaVentaCriteria criteria = BusquedaFacturaVentaCriteria.builder().empresa(empresaService.getEmpresaPorId(idEmpresa)).buscaPorFecha((desde != null) && (hasta != null)).fechaDesde(fechaDesde.getTime()).fechaHasta(fechaHasta.getTime()).buscaCliente(idCliente != null).cliente(cliente).buscaUsuario(idUsuario != null).usuario(usuario).buscaViajante(idViajante != null).viajante(viajante).buscaPorNumeroFactura((nroSerie != null) && (nroFactura != null)).numSerie((nroSerie != null) ? nroSerie : 0).numFactura((nroFactura != null) ? nroFactura : 0).buscarPorPedido(nroPedido != null).nroPedido((nroPedido != null) ? nroPedido : 0).buscaPorTipoComprobante(tipoDeComprobante != null).tipoComprobante((tipoDeComprobante != null) ? tipoDeComprobante : null).buscaSoloImpagas(soloImpagas).buscaSoloPagadas(soloPagas).cantRegistros(0).pageable(pageable).build();
    return facturaService.buscarFacturaVenta(criteria);
}
Also used : BusquedaFacturaVentaCriteria(sic.modelo.BusquedaFacturaVentaCriteria) PageRequest(org.springframework.data.domain.PageRequest) Usuario(sic.modelo.Usuario) Pageable(org.springframework.data.domain.Pageable) Calendar(java.util.Calendar) Sort(org.springframework.data.domain.Sort) Cliente(sic.modelo.Cliente) GetMapping(org.springframework.web.bind.annotation.GetMapping) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus)

Example 89 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project FP-PSP-SERVER by FundacionParaguaya.

the class ApplicationController method getPaginatedApplications.

@GetMapping()
public ResponseEntity<PaginableList<ApplicationDTO>> getPaginatedApplications(@RequestParam(value = "page", required = false, defaultValue = "1") int page, @RequestParam(value = "per_page", required = false, defaultValue = "12") int perPage, @RequestParam(value = "sort_by", required = false, defaultValue = "name") String sortBy, @RequestParam(value = "order", required = false, defaultValue = "asc") String orderBy, @RequestParam(value = "filter", required = false, defaultValue = "") String filter, @AuthenticationPrincipal UserDetailsDTO userDetails) {
    PageRequest pageRequest = new PspPageRequest(page, perPage, orderBy, sortBy);
    Page<ApplicationDTO> pageProperties = applicationService.getPaginatedApplications(userDetails, filter, pageRequest);
    PaginableList<ApplicationDTO> response = new PaginableList<>(pageProperties, pageProperties.getContent());
    return ResponseEntity.ok(response);
}
Also used : ApplicationDTO(py.org.fundacionparaguaya.pspserver.network.dtos.ApplicationDTO) PspPageRequest(py.org.fundacionparaguaya.pspserver.common.pagination.PspPageRequest) PageRequest(org.springframework.data.domain.PageRequest) PaginableList(py.org.fundacionparaguaya.pspserver.common.pagination.PaginableList) PspPageRequest(py.org.fundacionparaguaya.pspserver.common.pagination.PspPageRequest) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 90 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project FP-PSP-SERVER by FundacionParaguaya.

the class FamilyController method getAllFamilies.

@GetMapping()
public ResponseEntity<List<FamilyDTO>> getAllFamilies(@RequestParam(value = "organization_id", required = false) Long organizationId, @RequestParam(value = "country_id", required = false) Long countryId, @RequestParam(value = "city_id", required = false) Long cityId, @RequestParam(value = "free_text", required = false) String name, @RequestParam(value = "application_id", required = false) Long applicationId, @RequestParam(value = "last_modified_gt", required = false) String lastModifiedGt, @AuthenticationPrincipal UserDetailsDTO user) {
    FamilyFilterDTO filter = FamilyFilterDTO.builder().applicationId(applicationId).organizationId(organizationId).countryId(countryId).cityId(cityId).name(name).isActive(true).lastModifiedGt(lastModifiedGt).build();
    List<FamilyDTO> families = familyService.listFamilies(filter, user);
    return ResponseEntity.ok(families);
}
Also used : FamilyFilterDTO(py.org.fundacionparaguaya.pspserver.families.dtos.FamilyFilterDTO) FamilyDTO(py.org.fundacionparaguaya.pspserver.families.dtos.FamilyDTO) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

GetMapping (org.springframework.web.bind.annotation.GetMapping)756 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)114 ResponseEntity (org.springframework.http.ResponseEntity)80 ArrayList (java.util.ArrayList)52 List (java.util.List)49 ModelAndView (org.springframework.web.servlet.ModelAndView)48 WebMessageException (org.hisp.dhis.dxf2.webmessage.WebMessageException)45 HttpHeaders (org.springframework.http.HttpHeaders)41 Map (java.util.Map)40 HashMap (java.util.HashMap)38 lombok.val (lombok.val)38 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)36 Grid (org.hisp.dhis.common.Grid)35 IOException (java.io.IOException)34 RequestParam (org.springframework.web.bind.annotation.RequestParam)34 ApiOperation (io.swagger.annotations.ApiOperation)31 RootNode (org.hisp.dhis.node.types.RootNode)31 PathVariable (org.springframework.web.bind.annotation.PathVariable)31 HttpServletRequest (javax.servlet.http.HttpServletRequest)30 FieldFilterParams (org.hisp.dhis.fieldfilter.FieldFilterParams)28