RentingAppointmentApi.java 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. package com.java110.user.api;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.java110.dto.rentingAppointment.RentingAppointmentDto;
  4. import com.java110.po.rentingAppointment.RentingAppointmentPo;
  5. import com.java110.user.bmo.rentingAppointment.IDeleteRentingAppointmentBMO;
  6. import com.java110.user.bmo.rentingAppointment.IGetRentingAppointmentBMO;
  7. import com.java110.user.bmo.rentingAppointment.ISaveRentingAppointmentBMO;
  8. import com.java110.user.bmo.rentingAppointment.IUpdateRentingAppointmentBMO;
  9. import com.java110.utils.util.Assert;
  10. import com.java110.utils.util.BeanConvertUtil;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.http.ResponseEntity;
  13. import org.springframework.web.bind.annotation.*;
  14. /**
  15. * 租赁 预约接口类 controller
  16. * <p>
  17. * add by 吴学文
  18. */
  19. @RestController
  20. @RequestMapping(value = "/rentingAppointment")
  21. public class RentingAppointmentApi {
  22. @Autowired
  23. private ISaveRentingAppointmentBMO saveRentingAppointmentBMOImpl;
  24. @Autowired
  25. private IUpdateRentingAppointmentBMO updateRentingAppointmentBMOImpl;
  26. @Autowired
  27. private IDeleteRentingAppointmentBMO deleteRentingAppointmentBMOImpl;
  28. @Autowired
  29. private IGetRentingAppointmentBMO getRentingAppointmentBMOImpl;
  30. /**
  31. * 微信保存消息模板
  32. *
  33. * @param reqJson
  34. * @return
  35. * @serviceCode /rentingAppointment/saveRentingAppointment
  36. * @path /app/rentingAppointment/saveRentingAppointment
  37. */
  38. @RequestMapping(value = "/saveRentingAppointment", method = RequestMethod.POST)
  39. public ResponseEntity<String> saveRentingAppointment(@RequestBody JSONObject reqJson,
  40. @RequestHeader(value = "store-id") String storeId) {
  41. Assert.hasKeyAndValue(reqJson, "tenantName", "请求报文中未包含tenantName");
  42. Assert.hasKeyAndValue(reqJson, "tenantSex", "请求报文中未包含tenantSex");
  43. Assert.hasKeyAndValue(reqJson, "tenantTel", "请求报文中未包含tenantTel");
  44. Assert.hasKeyAndValue(reqJson, "appointmentTime", "请求报文中未包含appointmentTime");
  45. RentingAppointmentPo rentingAppointmentPo = BeanConvertUtil.covertBean(reqJson, RentingAppointmentPo.class);
  46. rentingAppointmentPo.setStoreId(storeId);
  47. return saveRentingAppointmentBMOImpl.save(rentingAppointmentPo);
  48. }
  49. /**
  50. * 微信修改消息模板
  51. *
  52. * @param reqJson
  53. * @return
  54. * @serviceCode /rentingAppointment/updateRentingAppointment
  55. * @path /app/rentingAppointment/updateRentingAppointment
  56. */
  57. @RequestMapping(value = "/updateRentingAppointment", method = RequestMethod.POST)
  58. public ResponseEntity<String> updateRentingAppointment(@RequestBody JSONObject reqJson) {
  59. // Assert.hasKeyAndValue(reqJson, "tenantName", "请求报文中未包含tenantName");
  60. // Assert.hasKeyAndValue(reqJson, "tenantSex", "请求报文中未包含tenantSex");
  61. // Assert.hasKeyAndValue(reqJson, "tenantTel", "请求报文中未包含tenantTel");
  62. // Assert.hasKeyAndValue(reqJson, "appointmentTime", "请求报文中未包含appointmentTime");
  63. Assert.hasKeyAndValue(reqJson, "appointmentId", "appointmentId不能为空");
  64. RentingAppointmentPo rentingAppointmentPo = BeanConvertUtil.covertBean(reqJson, RentingAppointmentPo.class);
  65. return updateRentingAppointmentBMOImpl.update(rentingAppointmentPo);
  66. }
  67. /**
  68. * 微信删除消息模板
  69. *
  70. * @param reqJson
  71. * @return
  72. * @serviceCode /rentingAppointment/deleteRentingAppointment
  73. * @path /app/rentingAppointment/deleteRentingAppointment
  74. */
  75. @RequestMapping(value = "/deleteRentingAppointment", method = RequestMethod.POST)
  76. public ResponseEntity<String> deleteRentingAppointment(@RequestBody JSONObject reqJson) {
  77. Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空");
  78. Assert.hasKeyAndValue(reqJson, "appointmentId", "appointmentId不能为空");
  79. RentingAppointmentPo rentingAppointmentPo = BeanConvertUtil.covertBean(reqJson, RentingAppointmentPo.class);
  80. return deleteRentingAppointmentBMOImpl.delete(rentingAppointmentPo);
  81. }
  82. /**
  83. * 微信删除消息模板
  84. *
  85. * @param storeId 商户ID
  86. * @return
  87. * @serviceCode /rentingAppointment/queryRentingAppointment
  88. * @path /app/rentingAppointment/queryRentingAppointment
  89. */
  90. @RequestMapping(value = "/queryRentingAppointment", method = RequestMethod.GET)
  91. public ResponseEntity<String> queryRentingAppointment(@RequestHeader(value = "store-id") String storeId,
  92. @RequestParam(value = "page") int page,
  93. @RequestParam(value = "row") int row,
  94. @RequestParam(value = "state", required = false) String state,
  95. @RequestParam(value = "tenantName", required = false) String tenantName,
  96. @RequestParam(value = "tenantTel", required = false) String tenantTel
  97. ) {
  98. RentingAppointmentDto rentingAppointmentDto = new RentingAppointmentDto();
  99. rentingAppointmentDto.setPage(page);
  100. rentingAppointmentDto.setRow(row);
  101. rentingAppointmentDto.setStoreId(storeId);
  102. rentingAppointmentDto.setState(state);
  103. rentingAppointmentDto.setTenantName(tenantName);
  104. rentingAppointmentDto.setTenantTel(tenantTel);
  105. return getRentingAppointmentBMOImpl.get(rentingAppointmentDto);
  106. }
  107. }