UfoSecondhandController.java 1.36 KB
package com.yoho.search.restapi.ufo;

import com.yoho.search.common.UfoSearchRequestParams;
import com.yoho.search.common.utils.HttpServletRequestUtils;
import com.yoho.search.models.SearchApiResult;
import com.yoho.search.service.scene.ufo.UfoMaxStoragePriceIdService;
import com.yoho.search.service.scene.ufo.UfoSecondhandSkupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
public class UfoSecondhandController {

    @Autowired
    private UfoMaxStoragePriceIdService ufoMaxStoragePriceIdService;
    @Autowired
    private UfoSecondhandSkupService ufoSecondhandSkupService;

    @RequestMapping(method = RequestMethod.GET, value = "/ufo/secondHand/skupList")
    public SearchApiResult secondHandSkupList(HttpServletRequest request) {
        Map<String, String> paramMap = HttpServletRequestUtils.transParamType(request);
        int maxStoragePriceId = ufoMaxStoragePriceIdService.queryUfoMaxStoragePriceId();
        paramMap.put(UfoSearchRequestParams.UFO_PARAM_MAXSTORAGEPRICE_ID, maxStoragePriceId + "");
        return ufoSecondhandSkupService.secondHandSkupList(paramMap);
    }

}