OrganizationAnnualReportController.java 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. package com.goafanti.customer.controller;
  2. import javax.annotation.Resource;
  3. import org.springframework.web.bind.annotation.RequestMapping;
  4. import org.springframework.web.bind.annotation.RequestMethod;
  5. import org.springframework.web.bind.annotation.RestController;
  6. import com.goafanti.common.bo.Result;
  7. import com.goafanti.common.constant.ErrorConstants;
  8. import com.goafanti.common.controller.BaseApiController;
  9. import com.goafanti.common.model.OrganizationAnnualReport;
  10. import com.goafanti.common.model.OrganizationYearProject;
  11. import com.goafanti.common.utils.StringUtils;
  12. import com.goafanti.customer.service.AdminOrgAnnualReportService;
  13. @RestController
  14. @RequestMapping("/api/admin/customers")
  15. public class OrganizationAnnualReportController extends BaseApiController{
  16. @Resource
  17. private AdminOrgAnnualReportService adminOrgAnnualReportService;
  18. /**
  19. * 新增客户年报
  20. **/
  21. @RequestMapping(value = "/addOrgAnnual", method = RequestMethod.POST)
  22. public Result addOrgAnnual(OrganizationAnnualReport o) {
  23. Result res=new Result();
  24. if (StringUtils.isEmpty(o.getUid())) {
  25. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户ID"));
  26. return res;
  27. }
  28. if (null==o.getYear()) {
  29. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份"));
  30. return res;
  31. }
  32. if (adminOrgAnnualReportService.checkYear(o)) {
  33. res.getError().add(buildError("", "年份已存在", "年份已存在"));
  34. return res;
  35. }
  36. res.setData(adminOrgAnnualReportService.addOrgAnnual(o));
  37. return res;
  38. }
  39. /**
  40. * 删除客户年报
  41. **/
  42. @RequestMapping(value = "/delectOrgAnnual", method = RequestMethod.POST)
  43. public Result delectOrgAnnual(OrganizationAnnualReport o) {
  44. Result res=new Result();
  45. if (StringUtils.isEmpty(o.getId())) {
  46. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
  47. return res;
  48. }
  49. res.setData(adminOrgAnnualReportService.delectOrgAnnual(o));
  50. return res;
  51. }
  52. /**
  53. * 查看客户年报
  54. **/
  55. @RequestMapping(value = "/selectOrgAnnual", method = RequestMethod.GET)
  56. public Result selectOrgAnnual(OrganizationAnnualReport o) {
  57. Result res=new Result();
  58. if (StringUtils.isEmpty(o.getId())) {
  59. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
  60. return res;
  61. }
  62. res.setData(adminOrgAnnualReportService.selectOrgAnnual(o.getId()));
  63. return res;
  64. }
  65. /**
  66. * 修改客户年报
  67. **/
  68. @RequestMapping(value = "/updateOrgAnnual", method = RequestMethod.POST)
  69. public Result updateOrgAnnual(OrganizationAnnualReport o) {
  70. Result res=new Result();
  71. if (StringUtils.isEmpty(o.getId())) {
  72. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
  73. return res;
  74. }
  75. if (null==o.getYear()) {
  76. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份"));
  77. return res;
  78. }
  79. if (adminOrgAnnualReportService.checkAnnual(o)) {
  80. res.getError().add(buildError("", "年份已存在", "年份已存在"));
  81. return res;
  82. }
  83. res.setData(adminOrgAnnualReportService.updateOrgAnnual(o));
  84. return res;
  85. }
  86. /**
  87. * 客户年报列表
  88. **/
  89. @RequestMapping(value = "/selectListOrgAnnual", method = RequestMethod.GET)
  90. public Result selectListOrgAnnual(OrganizationAnnualReport o,Integer pNo,Integer pSize) {
  91. Result res=new Result();
  92. if (StringUtils.isEmpty(o.getUid())) {
  93. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "客户ID"));
  94. return res;
  95. }
  96. res.setData(adminOrgAnnualReportService.selectListOrgAnnual(o,pNo,pSize));
  97. return res;
  98. }
  99. /**
  100. * 新增客户年份项目
  101. **/
  102. @RequestMapping(value = "/addOrgYearProject", method = RequestMethod.POST)
  103. public Result addOrgYearProject(OrganizationYearProject o) {
  104. Result res=new Result();
  105. if (StringUtils.isEmpty(o.getUid())) {
  106. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户ID"));
  107. return res;
  108. }
  109. if (null==o.getYear()) {
  110. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份"));
  111. return res;
  112. }
  113. res.setData(adminOrgAnnualReportService.addOrgYearProject(o));
  114. return res;
  115. }
  116. /**
  117. * 删除客户年份项目
  118. **/
  119. @RequestMapping(value = "/delectOrgYearProject", method = RequestMethod.POST)
  120. public Result delectOrgYearProject(OrganizationYearProject o) {
  121. Result res=new Result();
  122. if (StringUtils.isEmpty(o.getId())) {
  123. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
  124. return res;
  125. }
  126. res.setData(adminOrgAnnualReportService.delectOrgYearProject(o));
  127. return res;
  128. }
  129. /**
  130. * 查看客户年份项目
  131. **/
  132. @RequestMapping(value = "/selectOrgYearProject", method = RequestMethod.GET)
  133. public Result selectOrgYearProject(OrganizationYearProject o) {
  134. Result res=new Result();
  135. if (StringUtils.isEmpty(o.getId())) {
  136. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
  137. return res;
  138. }
  139. res.setData(adminOrgAnnualReportService.selectOrgYearProject(o.getId()));
  140. return res;
  141. }
  142. /**
  143. * 修改客户年份项目
  144. **/
  145. @RequestMapping(value = "/updateOrgYearProject", method = RequestMethod.POST)
  146. public Result updateOrgYearProject(OrganizationYearProject o) {
  147. Result res=new Result();
  148. if (StringUtils.isEmpty(o.getId())) {
  149. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
  150. return res;
  151. }
  152. if (null==o.getYear()) {
  153. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份"));
  154. return res;
  155. }
  156. res.setData(adminOrgAnnualReportService.updateOrgYearProject(o));
  157. return res;
  158. }
  159. /**
  160. * 客户年份项目列表
  161. **/
  162. @RequestMapping(value = "/selectListOrgYearProject", method = RequestMethod.GET)
  163. public Result selectListOrgYearProject(OrganizationYearProject o,Integer pNo,Integer pSize) {
  164. Result res=new Result();
  165. if (StringUtils.isEmpty(o.getUid())) {
  166. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "客户ID"));
  167. return res;
  168. }
  169. res.setData(adminOrgAnnualReportService.selectListOrgYearProject(o,pNo,pSize));
  170. return res;
  171. }
  172. }