| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- package com.goafanti.user.controller;
- import javax.annotation.Resource;
- 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.CertifyApiController;
- import com.goafanti.common.enums.UserType;
- import com.goafanti.common.utils.StringUtils;
- import com.goafanti.demand.service.DemandService;
- import com.goafanti.user.service.UserService;
- @RestController
- @RequestMapping(value = "/api/user/partner")
- public class UserPartnerApiController extends CertifyApiController {
- @Resource
- private UserService userService;
- @Resource
- private DemandService demandService;
- @Resource
- private AchievementService achievementService;
- /**
- * "伙伴"主页详情
- */
- @RequestMapping(value = "/detail", method = RequestMethod.GET)
- public Result detail(String uid, Integer type) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "用户ID"));
- return res;
- }
-
- 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 (UserType.PERSONAL.getCode().equals(type)) {
- res.setData(userService.findUserPartnerDetail(uid));
- } else {
- res.setData(userService.findOrgPartnerDetail(uid));
- }
- return res;
- }
-
- /**
- * "伙伴"主页--科技需求列表
- */
- @RequestMapping(value = "/demandList", method = RequestMethod.GET)
- public Result demandList(String employerId, String pageNo, String pageSize) {
- Result res = new Result();
- if (StringUtils.isBlank(employerId)){
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "employerId"));
- return res;
- }
- 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.lisePartnerDemand(employerId, pNo, pSize));
- return res;
- }
- /**
- * "伙伴"主页--科技成果列表
- */
- @RequestMapping(value = "/achievementList", method = RequestMethod.GET)
- public Result achievementList(String ownerId, String pageNo, String pageSize){
- Result res = new Result();
- if (StringUtils.isBlank(ownerId)){
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "ownerId"));
- return res;
- }
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(achievementService.listPartnerAchievement(ownerId, pNo, pSize));
- return res;
- }
-
- }
|