| @@ -26,14 +26,29 @@ interface DeliveryOrderRepository : AbstractRepository<DeliveryOrder, Long> { | |||
| fun findByOrderDateBetweenAndDeletedIsFalse(startDate: LocalDateTime?, endDate: LocalDateTime?) : List<DeliveryOrderInfo> | |||
| //GET FULL LIST | |||
| fun findAllBy() : List<DeliveryOrderInfo>; | |||
| fun findAllByCodeContainsAndShopNameContainsAndStatusAndOrderDateBetweenAndDeletedIsFalse(code: String?, shopName: String?, status: DeliveryOrderStatus?, startDate: LocalDateTime?, endDate: LocalDateTime?) : List<DeliveryOrderInfo>; | |||
| //SEARCH ALL | |||
| fun findAllByCodeContainsAndShopNameContainsAndStatusAndOrderDateBetweenAndEstimatedArrivalDateBetweenAndDeletedIsFalse(code: String?, shopName: String?, status: DeliveryOrderStatus?, orderStartDate: LocalDateTime?, orderEndDate: LocalDateTime?, estArrStartDate: LocalDateTime?, estArrEndDate: LocalDateTime?) : List<DeliveryOrderInfo>; | |||
| //SEARCH WITHOUT STATUS | |||
| fun findAllByCodeContainsAndShopNameContainsAndOrderDateBetweenAndEstimatedArrivalDateBetweenAndDeletedIsFalse(code: String?, shopName: String?, orderStartDate: LocalDateTime?, orderEndDate: LocalDateTime?, estArrStartDate: LocalDateTime?, estArrEndDate: LocalDateTime?) : List<DeliveryOrderInfo>; | |||
| fun findAllBy() : List<DeliveryOrderInfo>; | |||
| //SEARCH WITHOUT EST ARR DATE | |||
| fun findAllByCodeContainsAndShopNameContainsAndStatusAndOrderDateBetweenAndDeletedIsFalse(code: String?, shopName: String?, status: DeliveryOrderStatus?, orderStartDate: LocalDateTime?, orderEndDate: LocalDateTime?) : List<DeliveryOrderInfo>; | |||
| //SEARCH WITHOUT EST ARR DATE + STATUS | |||
| fun findAllByCodeContainsAndShopNameContainsAndOrderDateBetweenAndDeletedIsFalse(code: String?, shopName: String?, orderStartDate: LocalDateTime?, orderEndDate: LocalDateTime?) : List<DeliveryOrderInfo>; | |||
| //SEARCH WITHOUT ORDER DATE | |||
| fun findAllByCodeContainsAndShopNameContainsAndStatusAndEstimatedArrivalDateBetweenAndDeletedIsFalse(code: String?, shopName: String?, status: DeliveryOrderStatus?, estArrStartDate: LocalDateTime?, estArrEndDate: LocalDateTime?) : List<DeliveryOrderInfo>; | |||
| //SEARCH WITHOUT ORDER DATE + STATUS | |||
| fun findAllByCodeContainsAndShopNameContainsAndEstimatedArrivalDateBetweenAndDeletedIsFalse(code: String?, shopName: String?, estArrStartDate: LocalDateTime?, estArrEndDate: LocalDateTime?): List<DeliveryOrderInfo>; | |||
| //SEARCH WITHOUT DATE + STATUS | |||
| fun findAllByCodeContainsAndShopNameContainsAndDeletedIsFalse(code: String?, shopName: String?) : List<DeliveryOrderInfo>; | |||
| //SEARCH WITHOUT DATE | |||
| fun findAllByCodeContainsAndShopNameContainsAndStatusAndDeletedIsFalse(code: String?, shopName: String?, staus: DeliveryOrderStatus?) : List<DeliveryOrderInfo>; | |||
| fun findAllByCodeContainsAndShopNameContainsAndOrderDateBetweenAndDeletedIsFalse(code: String?, shopName: String?, startDate: LocalDateTime?, endDate: LocalDateTime?) : List<DeliveryOrderInfo>; | |||
| } | |||
| @@ -98,27 +98,40 @@ open class DeliveryOrderService( | |||
| open fun searchAll(code: String?, shopName: String?, status: DeliveryOrderStatus?, startDate: LocalDateTime?, endDate: LocalDateTime?):List<DeliveryOrderInfo> { | |||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndStatusAndOrderDateBetweenAndDeletedIsFalse(code, shopName, status, startDate, endDate); | |||
| } | |||
| open fun getFullList(): List<DeliveryOrderInfo>{ | |||
| return deliveryOrderRepository.findAllBy(); | |||
| } | |||
| open fun searchCodeAndShopName(code: String?, shopName: String?) : List<DeliveryOrderInfo> { | |||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndDeletedIsFalse(code, shopName); | |||
| open fun searchAll(code: String?, shopName: String?, status: DeliveryOrderStatus?, orderStartDate: LocalDateTime?, orderEndDate: LocalDateTime?, estArrStartDate: LocalDateTime?, estArrEndDate: LocalDateTime?):List<DeliveryOrderInfo> { | |||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndStatusAndOrderDateBetweenAndEstimatedArrivalDateBetweenAndDeletedIsFalse(code, shopName, status, orderStartDate, orderEndDate, estArrStartDate, estArrEndDate); | |||
| } | |||
| open fun searchWithoutStatus(code: String?, shopName: String?, orderStartDate: LocalDateTime?, orderEndDate: LocalDateTime?, estArrStartDate: LocalDateTime?, estArrEndDate: LocalDateTime?) : List<DeliveryOrderInfo> { | |||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndOrderDateBetweenAndEstimatedArrivalDateBetweenAndDeletedIsFalse(code, shopName, orderStartDate, orderEndDate, estArrStartDate, estArrEndDate); | |||
| } | |||
| open fun searchWithoutEstArrDate(code: String?, shopName: String?, status: DeliveryOrderStatus?, orderStartDate: LocalDateTime?, orderEndDate: LocalDateTime?): List<DeliveryOrderInfo>{ | |||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndStatusAndOrderDateBetweenAndDeletedIsFalse(code, shopName, status, orderStartDate, orderEndDate); | |||
| } | |||
| open fun searchWithoutEstArrDateAndStatus(code: String?, shopName: String?, orderStartDate: LocalDateTime?, orderEndDate: LocalDateTime?): List<DeliveryOrderInfo>{ | |||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndOrderDateBetweenAndDeletedIsFalse(code, shopName, orderStartDate, orderEndDate); | |||
| } | |||
| open fun searchWithoutOrderDate(code: String?, shopName: String?, status: DeliveryOrderStatus?, estArrStartDate: LocalDateTime?, estArrEndDate: LocalDateTime?) : List<DeliveryOrderInfo>{ | |||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndStatusAndEstimatedArrivalDateBetweenAndDeletedIsFalse(code, shopName, status, estArrStartDate, estArrEndDate); | |||
| } | |||
| open fun searchWithoutOrderDateAndStatus(code: String?, shopName: String?, estArrStartDate: LocalDateTime?, estArrEndDate: LocalDateTime?) : List<DeliveryOrderInfo>{ | |||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndEstimatedArrivalDateBetweenAndDeletedIsFalse(code, shopName, estArrStartDate, estArrEndDate); | |||
| } | |||
| open fun searchWithoutDate(code: String?, shopName: String?, status: DeliveryOrderStatus?) : List<DeliveryOrderInfo> { | |||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndStatusAndDeletedIsFalse(code, shopName, status); | |||
| } | |||
| open fun searchWithoutStatus(code: String?, shopName: String?, startDate: LocalDateTime?, endDate: LocalDateTime?) : List<DeliveryOrderInfo> { | |||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndOrderDateBetweenAndDeletedIsFalse(code, shopName, startDate, endDate); | |||
| open fun searchCodeAndShopName(code: String?, shopName: String?) : List<DeliveryOrderInfo> { | |||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndDeletedIsFalse(code, shopName); | |||
| } | |||
| open fun updateDeliveryOrderStatus(request: SaveDeliveryOrderStatusRequest): SaveDeliveryOrderResponse { | |||
| val deliveryOrder = checkNotNull( | |||
| request.id?.let { deliveryOrderRepository.findById(it).getOrNull() } | |||
| @@ -55,33 +55,58 @@ class DeliveryOrderController( | |||
| return deliveryOrderService.searchBetweenOrderDate(start, end); | |||
| } | |||
| @GetMapping("/search-DO/{code}&{shopName}&{status}&{startDate}&{endDate}") | |||
| fun searchDO(@PathVariable code: String?, @PathVariable shopName: String?, @PathVariable status: DeliveryOrderStatus?, @PathVariable startDate: LocalDateTime? , @PathVariable endDate: LocalDateTime?): List<DeliveryOrderInfo>{ | |||
| @GetMapping("/search-DO/{code}&{shopName}&{status}&{orderStartDate}&{orderEndDate}&{estArrStartDate}&{estArrEndDate}") | |||
| fun searchDO(@PathVariable code: String?, @PathVariable shopName: String?, @PathVariable status: DeliveryOrderStatus?, @PathVariable orderStartDate: LocalDateTime? , @PathVariable orderEndDate: LocalDateTime?, @PathVariable estArrStartDate: LocalDateTime?, @PathVariable estArrEndDate: LocalDateTime?): List<DeliveryOrderInfo>{ | |||
| println("test"); | |||
| if(code != null || shopName != null){ | |||
| if(startDate!=null || endDate!=null){ | |||
| if(status!=null){ | |||
| //ALL | |||
| return deliveryOrderService.searchAll(code, shopName, status, startDate, endDate); | |||
| if(orderStartDate != null && orderEndDate != null && estArrStartDate != null && estArrEndDate != null){ | |||
| if (status != null){ | |||
| return deliveryOrderService.searchAll(code, shopName, status, orderStartDate, orderEndDate, estArrStartDate, estArrEndDate); | |||
| } | |||
| else{ | |||
| //WITHOUT STATUS | |||
| return deliveryOrderService.searchWithoutStatus(code, shopName, startDate, endDate); | |||
| return deliveryOrderService.searchWithoutStatus(code, shopName, orderStartDate, orderEndDate, estArrStartDate, estArrEndDate); | |||
| } | |||
| } | |||
| if(startDate==null && endDate==null){ | |||
| if(status!=null){ | |||
| //WITHOUT DATE (CODE + SHOPNAME + STATUS) | |||
| return deliveryOrderService.searchWithoutDate(code, shopName, status); | |||
| else{ | |||
| if(orderStartDate == null && orderEndDate == null && estArrStartDate == null && estArrEndDate == null){ | |||
| if(status != null){ | |||
| return deliveryOrderService.searchWithoutDate(code, shopName, status); | |||
| } | |||
| else{ | |||
| return deliveryOrderService.searchCodeAndShopName(code, shopName); | |||
| } | |||
| } | |||
| else{ | |||
| //WITHOUT DATE + STATUS (CODE + SHOPNAME) | |||
| return deliveryOrderService.searchCodeAndShopName(code, shopName); | |||
| if(estArrStartDate != null && estArrEndDate != null && (orderStartDate == null && orderEndDate == null)){ | |||
| if (status != null){ | |||
| return deliveryOrderService.searchWithoutOrderDate(code, shopName, status, estArrStartDate, estArrEndDate); | |||
| } | |||
| else{ | |||
| return deliveryOrderService.searchWithoutOrderDateAndStatus(code, shopName, estArrStartDate, estArrEndDate); | |||
| } | |||
| } | |||
| else if(orderStartDate != null && orderEndDate != null && (estArrStartDate == null && estArrEndDate == null)){ | |||
| if (status != null){ | |||
| return deliveryOrderService.searchAll(code, shopName, status, orderStartDate, orderEndDate, estArrStartDate, estArrEndDate); | |||
| } | |||
| else{ | |||
| return deliveryOrderService.searchWithoutStatus(code, shopName, orderStartDate, orderEndDate, estArrStartDate, estArrEndDate); | |||
| } | |||
| } | |||
| else{ | |||
| return emptyList(); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| //INITIALIZATION | |||
| return deliveryOrderService.getFullList(); | |||
| } | |||