201069336ab9a60962c763c797c8f8e919b7b4d0.svn-base 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. package cn.com.goldenwater.dcproj.controller.travel;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.BisInspTravelPlan;
  5. import cn.com.goldenwater.dcproj.service.BisInspTravelPlanService;
  6. import cn.com.goldenwater.dcproj.target.Authority;
  7. import cn.com.goldenwater.dcproj.target.VerifyBean;
  8. import io.swagger.annotations.Api;
  9. import io.swagger.annotations.ApiOperation;
  10. import io.swagger.annotations.ApiParam;
  11. import org.slf4j.Logger;
  12. import org.slf4j.LoggerFactory;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.util.Assert;
  15. import org.springframework.web.bind.annotation.*;
  16. import java.io.IOException;
  17. import java.util.List;
  18. /**
  19. * @author lhc
  20. * @date 2019-9-17
  21. */
  22. @Api(value = "路书基本信息管理", tags = "路书基本信息管理")
  23. @RestController
  24. @RequestMapping("/bis/insp/travel/plan")
  25. public class BisInspTravelPlanController extends BaseController {
  26. private Logger logger = LoggerFactory.getLogger(getClass());
  27. @Autowired
  28. private BisInspTravelPlanService bisInspTravelPlanService;
  29. @ApiOperation(value = "添加个人路书基本信息")
  30. @RequestMapping(value = "/add", method = RequestMethod.POST)
  31. public BaseResponse<BisInspTravelPlan> insert(@ApiParam(name = "bisInspTravelPlan", value = "BisInspTravelPlan", required = true) @RequestBody BisInspTravelPlan bisInspTravelPlan) {
  32. bisInspTravelPlanService.insert(bisInspTravelPlan);
  33. return buildSuccessResponse(bisInspTravelPlan);
  34. }
  35. @ApiOperation(value = "根据ID删除个人路书基本信息")
  36. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  37. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  38. bisInspTravelPlanService.delete(id);
  39. return buildSuccessResponse();
  40. }
  41. @ApiOperation(value = "更新个人路书基本信息信息")
  42. @RequestMapping(value = "/update", method = RequestMethod.POST)
  43. public BaseResponse<BisInspTravelPlan> update(@ApiParam(name = "bisInspTravelPlan", value = "BisInspTravelPlan", required = true) @RequestBody BisInspTravelPlan bisInspTravelPlan) {
  44. Assert.notNull(bisInspTravelPlan.getId(), "主键id为必填参数");
  45. bisInspTravelPlanService.update(bisInspTravelPlan);
  46. return buildSuccessResponse(bisInspTravelPlan);
  47. }
  48. @ApiOperation(value = "根据ID获取路书基本信息(单表)")
  49. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  50. public BaseResponse<BisInspTravelPlan> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  51. BisInspTravelPlan bisInspTravelPlan = bisInspTravelPlanService.get(id);
  52. return buildSuccessResponse(bisInspTravelPlan);
  53. }
  54. @Authority
  55. @VerifyBean
  56. @ApiOperation(value = "根据人员ID获取所有路书基本信息")
  57. @RequestMapping(value = "getMyTravelPlan/{persId}", method = RequestMethod.GET)
  58. public BaseResponse<List<BisInspTravelPlan>> getMyTravelPlan(@ApiParam(name = "persId", value = "persId", required = true) @PathVariable String persId) {
  59. List<BisInspTravelPlan> bisInspTravelPlans = bisInspTravelPlanService.getMyTravelPlan(persId);
  60. return buildSuccessResponse(bisInspTravelPlans);
  61. }
  62. @ApiOperation(value = "根据督查组获取所有路书基本信息")
  63. @RequestMapping(value = "getTravelByPlanId/{planId}", method = RequestMethod.GET)
  64. public BaseResponse<List<BisInspTravelPlan>> getTravelByPlanId(@ApiParam(name = "planId", value = "planId", required = true) @PathVariable String planId) {
  65. List<BisInspTravelPlan> bisInspTravelPlans = bisInspTravelPlanService.getTravelByPlanId(planId);
  66. return buildSuccessResponse(bisInspTravelPlans);
  67. }
  68. @Authority
  69. @VerifyBean
  70. @ApiOperation(value = "添加行程点到收藏")
  71. @RequestMapping(value = "sharePoint", method = RequestMethod.POST)
  72. public BaseResponse<BisInspTravelPlan> sharePoint(@ApiParam(name = "persId", value = "persId", required = true) @RequestParam(value = "persId", defaultValue = "") String persId,
  73. @ApiParam(name = "travelPlanId", value = "travelPlanId", required = true) @RequestParam(value = "travelPlanId", defaultValue = "") String travelPlanId) {
  74. Integer row = bisInspTravelPlanService.sharePoint(persId, travelPlanId);
  75. return buildSuccessResponse();
  76. }
  77. @ApiOperation(value = "下载路书")
  78. @RequestMapping(value = "getTravelPlanInfo", method = RequestMethod.POST)
  79. public BaseResponse<String> getTravelPlanInfo(@ApiParam(name = "travelPlanId", value = "travelPlanId", required = true) @RequestParam(value = "travelPlanId", defaultValue = "") String travelPlanId) throws IOException {
  80. String path = bisInspTravelPlanService.getTravelPlanInfo(travelPlanId);
  81. return buildSuccessResponse(path);
  82. }
  83. @ApiOperation(value = "根据路书Id取消督查组关联")
  84. @RequestMapping(value = "cancelTravelPlan", method = RequestMethod.POST)
  85. public BaseResponse<Integer> cancelTravelPlan(@ApiParam(name = "travelPlanId", value = "travelPlanId", required = true) @RequestParam(value = "travelPlanId", defaultValue = "") String travelPlanId) throws IOException {
  86. Integer path = bisInspTravelPlanService.cancelTravelPlan(travelPlanId);
  87. return buildSuccessResponse(path);
  88. }
  89. }