HrDistributionController.java
2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package com.yoho.search.restapi.others;
import com.yoho.search.common.utils.HttpServletRequestUtils;
import com.yoho.search.models.SearchApiResult;
import com.yoho.search.service.base.SearchRequestParams;
import com.yoho.search.service.service.impl.SearchHongRenService;
import com.yoho.search.service.service.impl.SearchSortGroupService;
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
@RequestMapping("/hr")
public class HrDistributionController {
@Autowired
private SearchSortGroupService searchSortGroupService;
@Autowired
private SearchHongRenService searchHongRenService;
/**
* 对分类进行分组查询
* @param request
* @return
*/
@RequestMapping(method = RequestMethod.GET, value = "/sortgroup")
public SearchApiResult sortGroup(HttpServletRequest request) {
Map<String, String> paramMap = HttpServletRequestUtils.transParamType(request);
if (!checkRequestParam(paramMap)) {
return new SearchApiResult().setCode(400).setMessage("入参缺少hrShopId参数");
}
return searchSortGroupService.sortGroup(paramMap);
}
@RequestMapping(method = RequestMethod.GET, value = "/shopList")
public SearchApiResult getShopList(HttpServletRequest request) {
Map<String, String> paramMap = HttpServletRequestUtils.transParamType(request);
if (!checkRequestParam(paramMap)) {
return new SearchApiResult().setCode(400).setMessage("入参缺少hrShopId参数");
}
return searchHongRenService.shopList(paramMap);
}
@RequestMapping(method = RequestMethod.GET, value = "/productList")
public SearchApiResult productList(HttpServletRequest request) {
Map<String, String> paramMap = HttpServletRequestUtils.transParamType(request);
if (!checkRequestParam(paramMap)) {
return new SearchApiResult().setCode(400).setMessage("入参缺少hrShopId参数");
}
SearchApiResult searchApiResult = searchHongRenService.productList(paramMap);
return searchApiResult;
}
@RequestMapping(method = RequestMethod.GET, value = "/productListForFuzzy")
public SearchApiResult fuzzyProductList(HttpServletRequest request) {
Map<String, String> paramMap = HttpServletRequestUtils.transParamType(request);
if (!checkRequestParam(paramMap)) {
return new SearchApiResult().setCode(400).setMessage("入参缺少hrShopId参数");
}
SearchApiResult searchApiResult = searchHongRenService.productListForFuzzy(paramMap);
return searchApiResult;
}
private boolean checkRequestParam(Map<String, String> paramMap) {
return paramMap.containsKey(SearchRequestParams.PRODUCTINDEX_HRSHOPID);
}
}