package com.goafanti.demandCollection.controller; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; 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.controller.CertifyApiController; import com.goafanti.common.model.DemandCollection; import com.goafanti.demandCollection.bo.InputDemandCollection; import com.goafanti.demandCollection.service.DemandCollectionService; @RestController @RequestMapping(value = "/open") public class OpenDemandCollectionApiController extends CertifyApiController { @Resource private DemandCollectionService demandCollectionService; /** * 新增需求收集 * @param d * @return */ @RequestMapping(value="/addDemandCollection",method = RequestMethod.POST) public Result addDemandCollection(DemandCollection d){ Result res =new Result(); if (d.getDwmc()==null) { res.getError().add(buildError("名称必须指定","名称必须指定")); return res; } res.data(demandCollectionService.addDemandCollection(d)); return res; } /** * 需求收集列表 * @param d * @return */ @RequestMapping(value="/demandCollectionList",method = RequestMethod.GET) public Result demandCollectionList(InputDemandCollection i){ Result res =new Result(); res.data(demandCollectionService.demandCollectionList(i)); return res; } /** * 导出变更列表 * * @param response * @return */ @RequestMapping(value = "/exportDemandCollectionList" , method = RequestMethod.GET) public Result exportDemandCollectionList(HttpServletResponse response,InputDemandCollection i) { Result res=new Result(); try { demandCollectionService.exportDemandCollectionList( response, i); } catch (Exception e) { res.getError().add(buildError("格式不正确")); e.printStackTrace(); return res; } res.data(1); return res; } }