3bf9f60a5a216c48c2c0f692bf8a7915d3162673.svn-base 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. package cn.com.goldenwater.dcproj.controller.tac;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.TacEvalationConfig;
  5. import cn.com.goldenwater.dcproj.param.TacEvalationConfigParam;
  6. import cn.com.goldenwater.dcproj.service.TacEvalationConfigService;
  7. import cn.com.goldenwater.dcproj.vo.TacEvalationConfigVo;
  8. import cn.com.goldenwater.id.util.UuidUtil;
  9. import com.github.pagehelper.PageInfo;
  10. import io.swagger.annotations.Api;
  11. import io.swagger.annotations.ApiOperation;
  12. import io.swagger.annotations.ApiParam;
  13. import org.apache.commons.lang3.StringUtils;
  14. import org.slf4j.Logger;
  15. import org.slf4j.LoggerFactory;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.web.bind.annotation.*;
  18. import java.util.List;
  19. /**
  20. * @author lune
  21. * @date 2019-9-11
  22. */
  23. @Api(value = "TAC 测评权重配置表管理", tags = "TAC 测评权重配置表管理")
  24. @RestController
  25. @RequestMapping("/tac/evalation/config")
  26. public class TacEvalationConfigController extends BaseController {
  27. private Logger logger = LoggerFactory.getLogger(getClass());
  28. @Autowired
  29. private TacEvalationConfigService tacEvalationConfigService;
  30. @ApiOperation(value = "添加/修改测评权重配置表")
  31. @RequestMapping(value = "", method = RequestMethod.POST)
  32. public BaseResponse<TacEvalationConfig> insert(@ApiParam(name = "tacEvalationConfig", value = "TacEvalationConfig", required = true) @RequestBody TacEvalationConfig tacEvalationConfig) {
  33. if (StringUtils.isBlank(tacEvalationConfig.getId())) {
  34. String uuid = UuidUtil.uuid(); // 生成uuid
  35. tacEvalationConfig.setId(uuid);
  36. tacEvalationConfigService.insert(tacEvalationConfig);
  37. } else {
  38. tacEvalationConfigService.update(tacEvalationConfig);
  39. }
  40. return buildSuccessResponse(tacEvalationConfig);
  41. }
  42. @ApiOperation(value = "根据ID删除测评权重配置表")
  43. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  44. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  45. int ret = tacEvalationConfigService.delete(id);
  46. return buildSuccessResponse();
  47. }
  48. @ApiOperation(value = "根据年份获取测评权重配置表(单表)")
  49. @GetMapping("/getConfigsByYear")
  50. public BaseResponse<TacEvalationConfigVo> getConfigsByYear(@ApiParam(name = "year", value = "year", required = true) @RequestParam String year) {
  51. TacEvalationConfigParam tacEvalationConfigParam = new TacEvalationConfigParam();
  52. tacEvalationConfigParam.setYear(Long.parseLong(year));
  53. TacEvalationConfigVo tacEvalationConfig = tacEvalationConfigService.getConfigsByYear(tacEvalationConfigParam);
  54. return buildSuccessResponse(tacEvalationConfig);
  55. }
  56. @ApiOperation(value = "根据ID获取测评权重配置表(单表)")
  57. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  58. public BaseResponse<TacEvalationConfig> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  59. TacEvalationConfig tacEvalationConfig = tacEvalationConfigService.get(id);
  60. return buildSuccessResponse(tacEvalationConfig);
  61. }
  62. @ApiOperation(value = "获取测评权重配置表(列表所有)")
  63. @RequestMapping(value = "/list", method = RequestMethod.POST)
  64. public BaseResponse<List<TacEvalationConfig>> list(@ApiParam(name = "tacEvalationConfigParam", value = "tacEvalationConfigParam", required = true) @RequestBody TacEvalationConfigParam tacEvalationConfigParam) {
  65. List<TacEvalationConfig> tacEvalationConfigList = tacEvalationConfigService.findList(tacEvalationConfigParam);
  66. return buildSuccessResponse(tacEvalationConfigList);
  67. }
  68. @ApiOperation(value = "获取测评权重配置表(列表--分页)")
  69. @RequestMapping(value = "/page", method = RequestMethod.POST)
  70. public BaseResponse<PageInfo<TacEvalationConfig>> page(@ApiParam(name = "tacEvalationConfigParam", value = "tacEvalationConfigParam", required = true) @RequestBody TacEvalationConfigParam tacEvalationConfigParam) {
  71. PageInfo<TacEvalationConfig> tacEvalationConfigList = tacEvalationConfigService.findPageInfo(tacEvalationConfigParam);
  72. return buildSuccessResponse(tacEvalationConfigList);
  73. }
  74. @ApiOperation(value = "添加/修改测评权重配置表")
  75. @RequestMapping(value = "/insertConfigByYear", method = RequestMethod.POST)
  76. public BaseResponse insertConfigByYear(@ApiParam(name = "tacEvalationConfig", value = "TacEvalationConfig", required = true)
  77. @RequestBody TacEvalationConfigVo vo) {
  78. tacEvalationConfigService.insertConfigByYear(vo);
  79. return buildSuccessResponse();
  80. }
  81. }