package com.goafanti.customer.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.OrganizationAnnualReport; import com.goafanti.common.model.OrganizationYearProject; import com.goafanti.common.utils.StringUtils; import com.goafanti.customer.service.AdminOrgAnnualReportService; @RestController @RequestMapping("/api/admin/customers") public class OrganizationAnnualReportController extends BaseApiController{ @Resource private AdminOrgAnnualReportService adminOrgAnnualReportService; /** * 新增客户年报 **/ @RequestMapping(value = "/addOrgAnnual", method = RequestMethod.POST) public Result addOrgAnnual(OrganizationAnnualReport o) { Result res=new Result(); if (StringUtils.isEmpty(o.getUid())) { res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户ID")); return res; } if (null==o.getYear()) { res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份")); return res; } if (adminOrgAnnualReportService.checkYear(o)) { res.getError().add(buildError("", "年份已存在", "年份已存在")); return res; } res.setData(adminOrgAnnualReportService.addOrgAnnual(o)); return res; } /** * 删除客户年报 **/ @RequestMapping(value = "/delectOrgAnnual", method = RequestMethod.POST) public Result delectOrgAnnual(OrganizationAnnualReport o) { Result res=new Result(); if (StringUtils.isEmpty(o.getId())) { res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID")); return res; } res.setData(adminOrgAnnualReportService.delectOrgAnnual(o)); return res; } /** * 查看客户年报 **/ @RequestMapping(value = "/selectOrgAnnual", method = RequestMethod.GET) public Result selectOrgAnnual(OrganizationAnnualReport o) { Result res=new Result(); if (StringUtils.isEmpty(o.getId())) { res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID")); return res; } res.setData(adminOrgAnnualReportService.selectOrgAnnual(o.getId())); return res; } /** * 修改客户年报 **/ @RequestMapping(value = "/updateOrgAnnual", method = RequestMethod.POST) public Result updateOrgAnnual(OrganizationAnnualReport o) { Result res=new Result(); if (StringUtils.isEmpty(o.getId())) { res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID")); return res; } if (null==o.getYear()) { res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份")); return res; } if (adminOrgAnnualReportService.checkAnnual(o)) { res.getError().add(buildError("", "年份已存在", "年份已存在")); return res; } res.setData(adminOrgAnnualReportService.updateOrgAnnual(o)); return res; } /** * 客户年报列表 **/ @RequestMapping(value = "/selectListOrgAnnual", method = RequestMethod.GET) public Result selectListOrgAnnual(OrganizationAnnualReport o,Integer pNo,Integer pSize) { Result res=new Result(); if (StringUtils.isEmpty(o.getUid())) { res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "客户ID")); return res; } res.setData(adminOrgAnnualReportService.selectListOrgAnnual(o,pNo,pSize)); return res; } /** * 新增客户年份项目 **/ @RequestMapping(value = "/addOrgYearProject", method = RequestMethod.POST) public Result addOrgYearProject(OrganizationYearProject o) { Result res=new Result(); if (StringUtils.isEmpty(o.getUid())) { res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户ID")); return res; } if (null==o.getYear()) { res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份")); return res; } res.setData(adminOrgAnnualReportService.addOrgYearProject(o)); return res; } /** * 删除客户年份项目 **/ @RequestMapping(value = "/delectOrgYearProject", method = RequestMethod.POST) public Result delectOrgYearProject(OrganizationYearProject o) { Result res=new Result(); if (StringUtils.isEmpty(o.getId())) { res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID")); return res; } res.setData(adminOrgAnnualReportService.delectOrgYearProject(o)); return res; } /** * 查看客户年份项目 **/ @RequestMapping(value = "/selectOrgYearProject", method = RequestMethod.GET) public Result selectOrgYearProject(OrganizationYearProject o) { Result res=new Result(); if (StringUtils.isEmpty(o.getId())) { res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID")); return res; } res.setData(adminOrgAnnualReportService.selectOrgYearProject(o.getId())); return res; } /** * 修改客户年份项目 **/ @RequestMapping(value = "/updateOrgYearProject", method = RequestMethod.POST) public Result updateOrgYearProject(OrganizationYearProject o) { Result res=new Result(); if (StringUtils.isEmpty(o.getId())) { res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID")); return res; } if (null==o.getYear()) { res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份")); return res; } res.setData(adminOrgAnnualReportService.updateOrgYearProject(o)); return res; } /** * 客户年份项目列表 **/ @RequestMapping(value = "/selectListOrgYearProject", method = RequestMethod.GET) public Result selectListOrgYearProject(OrganizationYearProject o,Integer pNo,Integer pSize) { Result res=new Result(); if (StringUtils.isEmpty(o.getUid())) { res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "客户ID")); return res; } res.setData(adminOrgAnnualReportService.selectListOrgYearProject(o,pNo,pSize)); return res; } }