src/main/java/com/kshrd/derphsar_api/rest/restcontroller/ShopRestController.java
/**
     * Post a shop
     *
     * @param shopRequestModel - Shop request model
     * @return - Return response message
     */
Post a shop
@param shopRequestModel - Shop request model
@return - Return response message
Post a shop @param shopRequestModel - Shop request model @return - Return response message
@PostMapping("/shops")
    @ApiOperation(value = "create a shop", response = ShopCreateFirstResponse.class)
    public ResponseEntity<BaseApiNoPaginationResponse<ShopCreateFirstResponse>> createShop(@RequestBody ShopRequestModel shopRequestModel){
            ModelMapper mapper = new ModelMapper();
            UUID uuid = UUID.randomUUID();
            BaseApiNoPaginationResponse<ShopCreateFirstResponse> response = new BaseApiNoPaginationResponse<>();
            ShopDto shopDto = mapper.map(shopRequestModel,ShopDto.class);
            if(!shopRequestModel.getName().isEmpty() && !shopRequestModel.getAddress().isEmpty() && shopRequestModel.getU_id() != 0 && shopRequestModel.getCat_id() != 0 ){
                if(shopRequestModel.getOpenTime().after(shopRequestModel.getCloseTime())){
                    response.setMessage(message.insertError("Shop"));
                    response.setStatus(HttpStatus.BAD_REQUEST);
                }else {
                    shopDto.setShopId("DP"+uuid.toString().substring(0,10));
                    shopDto.setStatus(true);
                    ShopDto shop = shopServiceImp.createShop(shopDto);
                    ShopCreateFirstResponse shopCreateFirstResponse = mapper.map(shop, ShopCreateFirstResponse.class);
                    response.setMessage(message.inserted("Shop"));
                    response.setData(shopCreateFirstResponse);
                    response.setStatus(HttpStatus.CREATED);
                }
            }else {
                response.setMessage(message.insertError("Shop"));
                response.setStatus(HttpStatus.BAD_REQUEST);
        }
        return ResponseEntity.ok(response);
    }
@ PostMapping ( "/shops" ) @ ApiOperation ( value = "create a shop" , response = ShopCreateFirstResponse . class ) public ResponseEntity < BaseApiNoPaginationResponse < ShopCreateFirstResponse > > createShop ( @ RequestBody ShopRequestModel shopRequestModel ) { ModelMapper mapper = new ModelMapper ( ) ; UUID uuid = UUID . randomUUID ( ) ; BaseApiNoPaginationResponse < ShopCreateFirstResponse > response = new BaseApiNoPaginationResponse < > ( ) ; ShopDto shopDto = mapper . map ( shopRequestModel , ShopDto . class ) ; if ( ! shopRequestModel . getName ( ) . isEmpty ( ) && ! shopRequestModel . getAddress ( ) . isEmpty ( ) && shopRequestModel . getU_id ( ) != 0 && shopRequestModel . getCat_id ( ) != 0 ) { if ( shopRequestModel . getOpenTime ( ) . after ( shopRequestModel . getCloseTime ( ) ) ) { response . setMessage ( message . insertError ( "Shop" ) ) ; response . setStatus ( HttpStatus . BAD_REQUEST ) ; } else { shopDto . setShopId ( "DP" + uuid . toString ( ) . substring ( 0 , 10 ) ) ; shopDto . setStatus ( true ) ; ShopDto shop = shopServiceImp . createShop ( shopDto ) ; ShopCreateFirstResponse shopCreateFirstResponse = mapper . map ( shop , ShopCreateFirstResponse . class ) ; response . setMessage ( message . inserted ( "Shop" ) ) ; response . setData ( shopCreateFirstResponse ) ; response . setStatus ( HttpStatus . CREATED ) ; } } else { response . setMessage ( message . insertError ( "Shop" ) ) ; response . setStatus ( HttpStatus . BAD_REQUEST ) ; } return ResponseEntity . ok ( response ) ; }
Post a shop
 @param shopRequestModel - Shop request model
 @return - Return response message
Post a shop @param shopRequestModel - Shop request model @return - Return response message