package com.goafanti.app.controller;

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.AchievementInterestService;
import com.goafanti.achievement.service.AchievementService;
import com.goafanti.banners.service.BannersService;
import com.goafanti.common.bo.Result;
import com.goafanti.common.constant.ErrorConstants;
import com.goafanti.common.controller.BaseApiController;
import com.goafanti.demand.service.DemandService;
import com.goafanti.news.service.NewsService;
import com.goafanti.user.service.UserCareerService;
import com.goafanti.user.service.UserIdentityService;
import com.goafanti.user.service.UserInterestService;
import com.goafanti.user.service.UserService;

@RestController
@RequestMapping(path = "/open/app/user", method = RequestMethod.GET)
public class OpenAppUserController extends BaseApiController {
	@Resource
	private AchievementService	achievementService;
	@Resource
	private DemandService		demandService;
	@Resource
	private UserIdentityService	userIdentityService;

	/**
	 * 专家详情
	 */
	@RequestMapping(value = "/expertsDetail", method = RequestMethod.GET)
	public Result expertsDetail(String uid) {
		Result res = new Result();
		if (StringUtils.isBlank(uid)) {
			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"专家必须指定","专家"));
			return res;
		}
		res.setData(userIdentityService.expertsDetail( uid));
		return res;
	}
	/**
	 * 成果详情
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "/achievementDetail", method = RequestMethod.GET)
	private Result userDetail(String id ) {
		Result res = new Result();
		if (StringUtils.isBlank(id)) {
			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"成果必须指定","成果"));
			return res;
		}
		res.setData(achievementService.selectAppUserOwnerDetail(id));
		return res;
	}
	/**
	 * 需求详情
	 */
	@RequestMapping(value = "/demandDetail", method = RequestMethod.GET)
	public Result DemandDetail(String id ) {
		Result res = new Result();
		if (StringUtils.isBlank(id)) {
			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"需求必须指定","需求"));
			return res;
		}
		res.setData(demandService.selectDemandDetail( id));
		return res;
	}

	@RequestMapping(value = "/index", method = RequestMethod.GET)
	public Result index(){
		Result res = new Result();
		return res;
	}
}
