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.common.bo.Result; import com.goafanti.common.constant.ErrorConstants; import com.goafanti.common.controller.BaseApiController; import com.goafanti.common.model.ExpertPublish; import com.goafanti.common.utils.StringUtils; import com.goafanti.user.service.ExpertPublishPageService; import com.goafanti.user.service.ExpertPublishService; import com.goafanti.user.service.UserService; @RestController @RequestMapping(value = "/api/admin/expert") public class ExpertPublishController extends BaseApiController { @Resource private ExpertPublishService expertPublishService; /** * 成果发布 */ @RequestMapping(value = "/addExpertPublish", method = RequestMethod.POST) private Result addExpertPublish(ExpertPublish e) { Result res = new Result(); if (StringUtils.isBlank(e.getExpertId())) { res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到专家", "专家")); return res; } res.setData(expertPublishService.insertExpertPublish(e)); return res; } /** * 撤销发布 */ @RequestMapping(value = "/deletePublish", method = RequestMethod.GET) private Result deletePublish(String id) { Result res = new Result(); res.setData(expertPublishService.deletePublish(id)); return res; } /** * 修改发布 */ @RequestMapping(value = "/updatePublish", method = RequestMethod.GET) private Result updatePublish(ExpertPublish e) { Result res = new Result(); res.setData(expertPublishService.updatePublish(e)); return res; } /** * 发布列表 */ @RequestMapping(value = "/listPublish", method = RequestMethod.GET) private Result listPublish(String name,String publishPlatform,Integer publishClient,String publishPage, Integer ifTop, Integer pageNo, Integer pageSize) { Result res = new Result(); if (null==pageNo) { pageNo=1; } if (null==pageSize) { pageSize=10; } res.setData(expertPublishService.listPublish( name, publishPlatform, publishClient, publishPage, ifTop, pageNo, pageSize)); return res; } /** * 获取专家页面位置 */ @RequestMapping(value="/getPublishPage",method = RequestMethod.GET) private Result getPublishPage(){ Result res=new Result(); return res.data(ExpertPublishPageService.getBranchInformation()); } }