39febc6ecc5640e244a05484ecb44e240e9ab02c.svn-base 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package cn.com.goldenwater.dcproj.controller.ducha;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.BisInspAll;
  5. import cn.com.goldenwater.dcproj.service.BisInspAllService;
  6. import io.swagger.annotations.Api;
  7. import io.swagger.annotations.ApiOperation;
  8. import org.apache.commons.lang3.StringUtils;
  9. import org.slf4j.Logger;
  10. import org.slf4j.LoggerFactory;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.web.bind.annotation.*;
  13. import java.util.List;
  14. /**
  15. * @author lune
  16. * @date 2019-3-5
  17. */
  18. @Api(value = "督查组管理", tags = "督查组管理")
  19. @RestController
  20. @RequestMapping("/dc/insp/all")
  21. public class BisInspAllController extends BaseController {
  22. private Logger logger = LoggerFactory.getLogger(getClass());
  23. @Autowired
  24. private BisInspAllService bisInspAllService;
  25. @ApiOperation(value = "根据督查组名获取督查组")
  26. @GetMapping(value = "/listByName")
  27. public BaseResponse<List<BisInspAll>> listByName(@RequestParam("ptypes") String ptypes) {
  28. String[] ptypesArray = ptypes.split(",");
  29. for (int i = 0; i < ptypesArray.length; i++) {
  30. ptypesArray[i] += getCurrentOrgId();
  31. }
  32. ptypes = StringUtils.join(ptypesArray, ",");
  33. if (StringUtils.isNotBlank(ptypes)) {
  34. return buildSuccessResponse(bisInspAllService.listByName(ptypes));
  35. }
  36. return buildFailResponse();
  37. }
  38. @ApiOperation(value = "根据督查组名获取年度")
  39. @GetMapping(value = "/getYear/{id}")
  40. public BaseResponse<String[]> getYearById(@PathVariable("id") String id) {
  41. if (id.length() > 6) {
  42. id = id.substring(0, 6);
  43. } else if (id.length() == 3) {
  44. id = id + getCurrentOrgId();
  45. }
  46. return buildSuccessResponse(bisInspAllService.getYearById(id));
  47. }
  48. }