| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- package com.goafanti.portal.controller;
- import java.math.BigDecimal;
- import javax.annotation.Resource;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import com.goafanti.achievement.service.AchievementService;
- import com.goafanti.common.bo.Result;
- import com.goafanti.common.constant.ErrorConstants;
- import com.goafanti.common.controller.BaseApiController;
- import com.goafanti.common.enums.UserLevel;
- import com.goafanti.common.enums.UserType;
- import com.goafanti.demand.service.DemandService;
- import com.goafanti.user.service.OrganizationIdentityService;
- import com.goafanti.user.service.UserIdentityService;
- @RestController
- @RequestMapping(value = "/portal/search")
- public class PortalSearchApiController extends BaseApiController {
- @Resource
- private AchievementService achievementService;
- @Resource
- private DemandService demandService;
- @Resource
- private UserIdentityService userIdentityService;
- @Resource
- private OrganizationIdentityService organizationIdentityService;
- /**
- * 科技成果搜索
- */
- @RequestMapping(value = "/achievementList", method = RequestMethod.GET)
- public Result achievementSearchList(Integer bargainingMode, Integer category, Integer maturity,
- BigDecimal transferPriceLower, BigDecimal transferPriceUpper, Integer transferMode, String keyword,
- Integer fieldA, Integer fieldB, String pageNo, String pageSize) {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 20;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(achievementService.listAchievementSearchList(bargainingMode, category, maturity, transferPriceLower,
- transferPriceUpper, transferMode, keyword, fieldA, fieldB, pNo, pSize));
- return res;
- }
- /**
- * 科技需求搜索
- */
- @RequestMapping(value = "/demandList", method = RequestMethod.GET)
- public Result demandSearchList(String keyword, Integer industryCategoryA, Integer industryCategoryB,
- Integer demandType, BigDecimal budgetCostLower, BigDecimal budgetCostUpper, String pageNo,
- String pageSize) {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(demandService.listDemandSearchList(keyword, industryCategoryA, industryCategoryB, demandType,
- budgetCostLower, budgetCostUpper, pNo, pSize));
- return res;
- }
- /**
- * 用户搜索
- */
- @RequestMapping(value = "/subscriberList", method = RequestMethod.GET)
- public Result subscriberSearchList(String name, Integer level, Integer type, String field, Integer province, Integer city,
- Integer area, String pageNo, String pageSize) {
- Result res = new Result();
- if (null == type) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "用户类型"));
- return res;
- }
- if (!UserType.PERSONAL.getCode().equals(type) && !UserType.ORGANIZATION.getCode().equals(type)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户类型"));
- return res;
- }
- if (null != level && !UserLevel.GENERAL.getCode().equals(level)
- && !UserLevel.CERTIFIED.getCode().equals(level)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户认证标记"));
- return res;
- }
- Integer pNo = 1;
- Integer pSize = 12;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- if (UserType.PERSONAL.getCode().equals(type)) {
- res.setData(userIdentityService.listSubscriber(name, level, field, province, city, area, pNo, pSize));
- } else {
- res.setData(organizationIdentityService.listSubscriber(name, level, field, province, city, area, pNo, pSize));
- }
- return res;
- }
- }
|