package cn.com.goldenwater.dcproj.controller.ducha; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.model.BisInspAll; import cn.com.goldenwater.dcproj.service.BisInspAllService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @author lune * @date 2019-3-5 */ @Api(value = "督查组管理", tags = "督查组管理") @RestController @RequestMapping("/dc/insp/all") public class BisInspAllController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private BisInspAllService bisInspAllService; @ApiOperation(value = "根据督查组名获取督查组") @GetMapping(value = "/listByName") public BaseResponse> listByName(@RequestParam("ptypes") String ptypes) { String[] ptypesArray = ptypes.split(","); for (int i = 0; i < ptypesArray.length; i++) { ptypesArray[i] += getCurrentOrgId(); } ptypes = StringUtils.join(ptypesArray, ","); if (StringUtils.isNotBlank(ptypes)) { return buildSuccessResponse(bisInspAllService.listByName(ptypes)); } return buildFailResponse(); } @ApiOperation(value = "根据督查组名获取年度") @GetMapping(value = "/getYear/{id}") public BaseResponse getYearById(@PathVariable("id") String id) { if (id.length() > 6) { id = id.substring(0, 6); } else if (id.length() == 3) { id = id + getCurrentOrgId(); } return buildSuccessResponse(bisInspAllService.getYearById(id)); } }