OrganizationEvaluationRuleController.java 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. package com.ims.eval.controller;
  2. import com.baomidou.mybatisplus.core.metadata.IPage;
  3. import com.ims.eval.config.CustomException;
  4. import com.ims.eval.entity.OrganizationEvaluationRule;
  5. import com.ims.eval.entity.dto.request.OrganizationEvaluationRuleDTO;
  6. import com.ims.eval.entity.dto.result.R;
  7. import com.ims.eval.service.IOrganizationEvaluationRuleService;
  8. import io.swagger.annotations.ApiOperation;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.*;
  11. import java.util.Arrays;
  12. import java.util.List;
  13. import java.util.Map;
  14. /**
  15. * <p>
  16. * 单位考评配置 前端控制器
  17. * </p>
  18. *
  19. * @author wang
  20. * @since 2023-03-01
  21. */
  22. @RestController
  23. @RequestMapping("//organization-evaluation-rule")
  24. public class OrganizationEvaluationRuleController {
  25. @Autowired
  26. private IOrganizationEvaluationRuleService organizationEvaluationRuleService;
  27. /**
  28. * @param pageNum 当前页数
  29. * @param pageSize 当前页大小
  30. * @param id 主键
  31. * @param organizationName 考评组织名称
  32. * @param organizationId 考评组织ID
  33. * @param organizationType 考评类别
  34. * @param binSection 业务版块
  35. * @param binStage 业务阶段
  36. * @param evaluationCycle 考评周期
  37. * @return
  38. */
  39. //@ImsPreAuth("eval:organizationEvaluationRule:view")
  40. @GetMapping(value = "list")
  41. public R list(@RequestParam(value = "pageNum") Integer pageNum,
  42. @RequestParam(value = "pageSize") Integer pageSize,
  43. @RequestParam(value = "id", required = false) String id,
  44. @RequestParam(value = "organizationName", required = false) String organizationName,
  45. @RequestParam(value = "organizationId", required = false) String organizationId,
  46. @RequestParam(value = "organizationType", required = false) String organizationType,
  47. @RequestParam(value = "binSection", required = false) String binSection,
  48. @RequestParam(value = "binStage", required = false) String binStage,
  49. @RequestParam(value = "evaluationCycle", required = false) String evaluationCycle,
  50. @RequestParam(value = "year", required = false) String year) {
  51. IPage<OrganizationEvaluationRule> list = organizationEvaluationRuleService.list2(pageNum, pageSize, id, organizationName, organizationId, organizationType, binSection, binStage, evaluationCycle,year);
  52. return R.ok().data(list);
  53. }
  54. @GetMapping(value = "list2")
  55. public R list2(@RequestParam(value = "pageNum") Integer pageNum,
  56. @RequestParam(value = "pageSize") Integer pageSize,
  57. @RequestParam(value = "id", required = false) String id,
  58. @RequestParam(value = "organizationName", required = false) String organizationName,
  59. @RequestParam(value = "organizationId", required = false) String organizationId,
  60. @RequestParam(value = "organizationType", required = false) String organizationType,
  61. @RequestParam(value = "binSection", required = false) String binSection,
  62. @RequestParam(value = "binStage", required = false) String binStage,
  63. @RequestParam(value = "evaluationCycle", required = false) String evaluationCycle,
  64. @RequestParam(value = "year", required = false) String year) {
  65. IPage<OrganizationEvaluationRule> list = organizationEvaluationRuleService.list(pageNum, pageSize, id, organizationName, organizationId, organizationType, binSection, binStage, evaluationCycle,year);
  66. return R.ok().data(list);
  67. }
  68. /**
  69. * 查询所有数据
  70. *
  71. * @param id 主键
  72. * @param organizationName 考评组织名称
  73. * @param organizationId 考评组织ID
  74. * @param organizationType 考评类别
  75. * @param binSection 业务版块
  76. * @param binStage 业务阶段
  77. * @param evaluationCycle 考评周期
  78. * @return
  79. */
  80. //@ImsPreAuth("eval:organizationEvaluationRule:view")
  81. @GetMapping(value = "listAll")
  82. public R listAll(
  83. @RequestParam(value = "id", required = false) String id,
  84. @RequestParam(value = "organizationName", required = false) String organizationName,
  85. @RequestParam(value = "organizationId", required = false) String organizationId,
  86. @RequestParam(value = "organizationType", required = false) String organizationType,
  87. @RequestParam(value = "binSection", required = false) String binSection,
  88. @RequestParam(value = "binStage", required = false) String binStage,
  89. @RequestParam(value = "evaluationCycle", required = false) String evaluationCycle,
  90. @RequestParam(value = "year", required = false) String year) {
  91. List<OrganizationEvaluationRule> list = organizationEvaluationRuleService.listAll(id, organizationName, organizationId, organizationType, binSection, binStage, evaluationCycle,year);
  92. return R.ok().data(list);
  93. }
  94. /**
  95. * 添加
  96. *
  97. * @param evaluationRule
  98. * @return
  99. */
  100. //@ImsPreAuth("eval:organizationEvaluationRule:edit")
  101. @PostMapping(value = "/save")
  102. @ApiOperation(value = "新增(修改)", notes = "新增(修改)")
  103. public R addAll(@RequestBody OrganizationEvaluationRule evaluationRule) {
  104. try {
  105. boolean b = organizationEvaluationRuleService.saveOrUpdate(evaluationRule);
  106. if (b) {
  107. return R.ok().data(b);
  108. } else {
  109. return R.error().data("保存失败!");
  110. }
  111. } catch (CustomException e) {
  112. return R.customError(e.getMessage()).data("失败!");
  113. }
  114. }
  115. /**
  116. * 批量删除
  117. *
  118. * @param ids
  119. * @return
  120. */
  121. //@ImsPreAuth("eval:organizationEvaluationRule:remove")
  122. @PostMapping(value = "/remove/{ids}")
  123. @ApiOperation(value = "删除", notes = "删除")
  124. public R deleteAll(@PathVariable("ids") String ids) {
  125. String[] strings = ids.split(",");
  126. boolean b = organizationEvaluationRuleService.removeByIds(Arrays.asList(strings));
  127. if (b) {
  128. return R.ok().data(b);
  129. } else {
  130. return R.error().data("删除失败!");
  131. }
  132. }
  133. /**
  134. * 更具目标责任书获取对应的组织考评股则id
  135. * @param id
  136. * @param type (目标责任书:mb;考评记录:kp)
  137. * @return
  138. */
  139. @GetMapping(value = "getOrganizationRule")
  140. public R getOrganizationRule(
  141. @RequestParam(value = "id", required = false) String id,
  142. @RequestParam(value = "type", required = true) String type) {
  143. List<OrganizationEvaluationRule> list = organizationEvaluationRuleService.getOrganizationRuleId(id,type);
  144. return R.ok().data(list);
  145. }
  146. }