package cn.com.goldenwater.dcproj.controller.travel; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.model.BisInspTravelPlan; import cn.com.goldenwater.dcproj.service.BisInspTravelPlanService; import cn.com.goldenwater.dcproj.target.Authority; import cn.com.goldenwater.dcproj.target.VerifyBean; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.Assert; import org.springframework.web.bind.annotation.*; import java.io.IOException; import java.util.List; /** * @author lhc * @date 2019-9-17 */ @Api(value = "路书基本信息管理", tags = "路书基本信息管理") @RestController @RequestMapping("/bis/insp/travel/plan") public class BisInspTravelPlanController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private BisInspTravelPlanService bisInspTravelPlanService; @ApiOperation(value = "添加个人路书基本信息") @RequestMapping(value = "/add", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "bisInspTravelPlan", value = "BisInspTravelPlan", required = true) @RequestBody BisInspTravelPlan bisInspTravelPlan) { bisInspTravelPlanService.insert(bisInspTravelPlan); return buildSuccessResponse(bisInspTravelPlan); } @ApiOperation(value = "根据ID删除个人路书基本信息") @RequestMapping(value = "delete/{id}", method = RequestMethod.POST) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { bisInspTravelPlanService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "更新个人路书基本信息信息") @RequestMapping(value = "/update", method = RequestMethod.POST) public BaseResponse update(@ApiParam(name = "bisInspTravelPlan", value = "BisInspTravelPlan", required = true) @RequestBody BisInspTravelPlan bisInspTravelPlan) { Assert.notNull(bisInspTravelPlan.getId(), "主键id为必填参数"); bisInspTravelPlanService.update(bisInspTravelPlan); return buildSuccessResponse(bisInspTravelPlan); } @ApiOperation(value = "根据ID获取路书基本信息(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { BisInspTravelPlan bisInspTravelPlan = bisInspTravelPlanService.get(id); return buildSuccessResponse(bisInspTravelPlan); } @Authority @VerifyBean @ApiOperation(value = "根据人员ID获取所有路书基本信息") @RequestMapping(value = "getMyTravelPlan/{persId}", method = RequestMethod.GET) public BaseResponse> getMyTravelPlan(@ApiParam(name = "persId", value = "persId", required = true) @PathVariable String persId) { List bisInspTravelPlans = bisInspTravelPlanService.getMyTravelPlan(persId); return buildSuccessResponse(bisInspTravelPlans); } @ApiOperation(value = "根据督查组获取所有路书基本信息") @RequestMapping(value = "getTravelByPlanId/{planId}", method = RequestMethod.GET) public BaseResponse> getTravelByPlanId(@ApiParam(name = "planId", value = "planId", required = true) @PathVariable String planId) { List bisInspTravelPlans = bisInspTravelPlanService.getTravelByPlanId(planId); return buildSuccessResponse(bisInspTravelPlans); } @Authority @VerifyBean @ApiOperation(value = "添加行程点到收藏") @RequestMapping(value = "sharePoint", method = RequestMethod.POST) public BaseResponse sharePoint(@ApiParam(name = "persId", value = "persId", required = true) @RequestParam(value = "persId", defaultValue = "") String persId, @ApiParam(name = "travelPlanId", value = "travelPlanId", required = true) @RequestParam(value = "travelPlanId", defaultValue = "") String travelPlanId) { Integer row = bisInspTravelPlanService.sharePoint(persId, travelPlanId); return buildSuccessResponse(); } @ApiOperation(value = "下载路书") @RequestMapping(value = "getTravelPlanInfo", method = RequestMethod.POST) public BaseResponse getTravelPlanInfo(@ApiParam(name = "travelPlanId", value = "travelPlanId", required = true) @RequestParam(value = "travelPlanId", defaultValue = "") String travelPlanId) throws IOException { String path = bisInspTravelPlanService.getTravelPlanInfo(travelPlanId); return buildSuccessResponse(path); } @ApiOperation(value = "根据路书Id取消督查组关联") @RequestMapping(value = "cancelTravelPlan", method = RequestMethod.POST) public BaseResponse cancelTravelPlan(@ApiParam(name = "travelPlanId", value = "travelPlanId", required = true) @RequestParam(value = "travelPlanId", defaultValue = "") String travelPlanId) throws IOException { Integer path = bisInspTravelPlanService.cancelTravelPlan(travelPlanId); return buildSuccessResponse(path); } }