| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- package com.goafanti.app.controller;
- import java.util.HashMap;
- import java.util.Map;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletRequest;
- 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.activity.service.ActivityService;
- import com.goafanti.banners.enums.BannersType;
- 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.enums.NewsType;
- import com.goafanti.news.service.NewsService;
- @RestController
- @RequestMapping(path = "/api/open/app", method = RequestMethod.GET)
- public class AppApiController extends BaseApiController {
- @Resource
- private BannersService bannersService;
- @Resource
- private ActivityService activityService;
- @Resource
- private NewsService newsService;
- @Resource
- private AchievementService achievementService;
- @Resource
- private DemandService demandService;
- @RequestMapping(value = "/index", method = RequestMethod.GET)
- public Result index(HttpServletRequest request) {
- Map<String, Object> result = new HashMap<>();
- String domainName = request.getServerName();
- result.put("banners", bannersService.findPortalBanners(BannersType.APP.getKey()));
- result.put("activities", activityService.findPortalList(0, 3, null));
- result.put("policies", newsService.findNewsList(0, NewsType.GJZC.getCode(), 3, domainName, true));
- result.put("news", newsService.findNewsList(0, NewsType.JTDT.getCode(), 5, domainName, true));
- return res().data(result);
- }
- /**
- * 科技成果详情
- */
- @RequestMapping(value = "/achievementDetail", method = RequestMethod.GET)
- public Result achievementDetail(String id) {
- Result res = new Result();
- if (StringUtils.isBlank(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果ID", "成果ID"));
- return res;
- }
- res.setData(achievementService.selectAchievementDetail(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, "找不到需求ID", "需求ID"));
- return res;
- }
- res.setData(demandService.selectDemandDetail(id));
- return res;
- }
-
- }
|