bd181d3d2cf76485ab5b969b74bb2d04aa2bfe44.svn-base 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package cn.com.goldenwater.dcproj.controller.rsvr;
  2. import cn.com.goldenwater.dcproj.model.BisInspBaseView;
  3. import cn.com.goldenwater.dcproj.model.BisInspPreList;
  4. import cn.com.goldenwater.dcproj.param.BisInspPreListParam;
  5. import cn.com.goldenwater.dcproj.service.BisInspBaseViewService;
  6. import cn.com.goldenwater.dcproj.service.BisInspPreListService;
  7. import cn.com.goldenwater.core.web.BaseController;
  8. import cn.com.goldenwater.core.web.BaseResponse;
  9. import cn.com.goldenwater.dcproj.service.BisInspRsvrRgstrService;
  10. import cn.com.goldenwater.id.util.UuidUtil;
  11. import com.github.pagehelper.PageInfo;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiOperation;
  14. import io.swagger.annotations.ApiParam;
  15. import org.slf4j.Logger;
  16. import org.slf4j.LoggerFactory;
  17. import org.springframework.beans.factory.annotation.Autowired;
  18. import org.springframework.web.bind.annotation.PathVariable;
  19. import org.springframework.web.bind.annotation.RequestBody;
  20. import org.springframework.web.bind.annotation.RequestMapping;
  21. import org.springframework.web.bind.annotation.RequestMethod;
  22. import org.springframework.web.bind.annotation.RestController;
  23. /**
  24. * @author lune
  25. * @date 2019-2-18
  26. */
  27. @Api(value = "APP 走访人员情况管理", tags = "APP 走访人员情况管理")
  28. @RestController
  29. @RequestMapping("/dc/insp/preList")
  30. public class BisInspPreListController extends BaseController {
  31. private Logger logger = LoggerFactory.getLogger(getClass());
  32. @Autowired
  33. private BisInspPreListService bisInspPreListService;
  34. @Autowired
  35. private BisInspRsvrRgstrService bisInspRsvrRgstrService;
  36. @Autowired
  37. private BisInspBaseViewService bisInspBaseViewService;
  38. @ApiOperation(value = "添加走访人信息")
  39. @RequestMapping(value = "", method = RequestMethod.POST)
  40. public BaseResponse<String> insert(@ApiParam(name = "bisInspPreList", value = "BisInspPreList", required = true) @RequestBody BisInspPreList bisInspPreList) {
  41. BisInspPreListParam bisInspPreListParam = new BisInspPreListParam();
  42. bisInspPreListParam.setViewId(bisInspPreList.getViewId());
  43. bisInspPreListParam.setViewPreName(bisInspPreList.getViewPreName());
  44. BisInspPreList bisInspPre = bisInspPreListService.getBy(bisInspPreListParam);
  45. if (bisInspPre != null) {
  46. return buildFailResponse(1003, "走访人员姓名不能重复添加");
  47. }
  48. String uuid = UuidUtil.uuid();
  49. bisInspPreList.setViewPreId(uuid);
  50. int ret = bisInspPreListService.insert(bisInspPreList);
  51. BisInspBaseView inspBaseView = bisInspBaseViewService.get(bisInspPreList.getViewId());
  52. if (inspBaseView != null) {
  53. bisInspRsvrRgstrService.updateRsvr(inspBaseView.getRgstrId(), inspBaseView.getStatus(), "view");
  54. }
  55. return buildSuccessResponse();
  56. }
  57. @ApiOperation(value = "根据ID删除走访人员信息")
  58. @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
  59. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  60. int ret = bisInspPreListService.delete(id);
  61. return buildSuccessResponse();
  62. }
  63. @ApiOperation(value = "更新走访人员信息")
  64. @RequestMapping(value = "/update", method = RequestMethod.POST)
  65. public BaseResponse update(@ApiParam(name = "bisInspPreList", value = "BisInspPreList", required = true) @RequestBody BisInspPreList bisInspPreList) {
  66. int ret = bisInspPreListService.update(bisInspPreList);
  67. return buildSuccessResponse();
  68. }
  69. @ApiOperation(value = "根据ID获取走访人员信息(单表)")
  70. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  71. public BaseResponse<BisInspPreList> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  72. BisInspPreList bisInspPreList = bisInspPreListService.get(id);
  73. return buildSuccessResponse(bisInspPreList);
  74. }
  75. @ApiOperation(value = "根据访问Id获取走访人员列表")
  76. @RequestMapping(value = "/page", method = RequestMethod.POST)
  77. public BaseResponse<PageInfo<BisInspPreList>> list(@ApiParam(name = "inspPreListParam", value = "inspPreListParam", required = true) @RequestBody BisInspPreListParam inspPreListParam) {
  78. PageInfo<BisInspPreList> bisInspPreList = bisInspPreListService.findPageInfo(inspPreListParam);
  79. return buildSuccessResponse(bisInspPreList);
  80. }
  81. @ApiOperation(value = "根据访问Id获取走访人员列表")
  82. @RequestMapping(value = "/list/{viewId}", method = RequestMethod.GET)
  83. public BaseResponse<PageInfo<BisInspPreList>> list(@ApiParam(name = "viewId", value = "viewId", required = true) @PathVariable String viewId) {
  84. BisInspPreListParam inspPreListParam = new BisInspPreListParam();
  85. inspPreListParam.setViewId(viewId);
  86. PageInfo<BisInspPreList> bisInspPreList = bisInspPreListService.findPageInfo(inspPreListParam);
  87. return buildSuccessResponse(bisInspPreList);
  88. }
  89. }