RentingApi.java 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. package com.java110.user.api;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.java110.dto.rentingConfig.RentingConfigDto;
  4. import com.java110.po.rentingConfig.RentingConfigPo;
  5. import com.java110.user.bmo.rentingConfig.IDeleteRentingConfigBMO;
  6. import com.java110.user.bmo.rentingConfig.IGetRentingConfigBMO;
  7. import com.java110.user.bmo.rentingConfig.ISaveRentingConfigBMO;
  8. import com.java110.user.bmo.rentingConfig.IUpdateRentingConfigBMO;
  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. @RestController
  15. @RequestMapping(value = "/renting")
  16. public class RentingApi {
  17. @Autowired
  18. private ISaveRentingConfigBMO saveRentingConfigBMOImpl;
  19. @Autowired
  20. private IUpdateRentingConfigBMO updateRentingConfigBMOImpl;
  21. @Autowired
  22. private IDeleteRentingConfigBMO deleteRentingConfigBMOImpl;
  23. @Autowired
  24. private IGetRentingConfigBMO getRentingConfigBMOImpl;
  25. /**
  26. * 微信保存消息模板
  27. *
  28. * @param reqJson
  29. * @return
  30. * @serviceCode /renting/saveRentingConfig
  31. * @path /app/renting/saveRentingConfig
  32. */
  33. @RequestMapping(value = "/saveRentingConfig", method = RequestMethod.POST)
  34. public ResponseEntity<String> saveRentingConfig(@RequestBody JSONObject reqJson) {
  35. Assert.hasKeyAndValue(reqJson, "rentingType", "请求报文中未包含rentingType");
  36. Assert.hasKeyAndValue(reqJson, "rentingFormula", "请求报文中未包含rentingFormula");
  37. Assert.hasKeyAndValue(reqJson, "servicePrice", "请求报文中未包含servicePrice");
  38. Assert.hasKeyAndValue(reqJson, "serviceOwnerRate", "请求报文中未包含serviceOwnerRate");
  39. Assert.hasKeyAndValue(reqJson, "serviceTenantRate", "请求报文中未包含serviceTenantRate");
  40. Assert.hasKeyAndValue(reqJson, "adminSeparateRate", "请求报文中未包含adminSeparateRate");
  41. Assert.hasKeyAndValue(reqJson, "proxySeparateRate", "请求报文中未包含proxySeparateRate");
  42. Assert.hasKeyAndValue(reqJson, "propertySeparateRate", "请求报文中未包含propertySeparateRate");
  43. RentingConfigPo rentingConfigPo = BeanConvertUtil.covertBean(reqJson, RentingConfigPo.class);
  44. return saveRentingConfigBMOImpl.save(rentingConfigPo);
  45. }
  46. /**
  47. * 微信修改消息模板
  48. *
  49. * @param reqJson
  50. * @return
  51. * @serviceCode /renting/updateRentingConfig
  52. * @path /app/renting/updateRentingConfig
  53. */
  54. @RequestMapping(value = "/updateRentingConfig", method = RequestMethod.POST)
  55. public ResponseEntity<String> updateRentingConfig(@RequestBody JSONObject reqJson) {
  56. Assert.hasKeyAndValue(reqJson, "rentingType", "请求报文中未包含rentingType");
  57. Assert.hasKeyAndValue(reqJson, "rentingFormula", "请求报文中未包含rentingFormula");
  58. Assert.hasKeyAndValue(reqJson, "servicePrice", "请求报文中未包含servicePrice");
  59. Assert.hasKeyAndValue(reqJson, "serviceOwnerRate", "请求报文中未包含serviceOwnerRate");
  60. Assert.hasKeyAndValue(reqJson, "serviceTenantRate", "请求报文中未包含serviceTenantRate");
  61. Assert.hasKeyAndValue(reqJson, "adminSeparateRate", "请求报文中未包含adminSeparateRate");
  62. Assert.hasKeyAndValue(reqJson, "proxySeparateRate", "请求报文中未包含proxySeparateRate");
  63. Assert.hasKeyAndValue(reqJson, "propertySeparateRate", "请求报文中未包含propertySeparateRate");
  64. Assert.hasKeyAndValue(reqJson, "rentingConfigId", "rentingConfigId不能为空");
  65. RentingConfigPo rentingConfigPo = BeanConvertUtil.covertBean(reqJson, RentingConfigPo.class);
  66. return updateRentingConfigBMOImpl.update(rentingConfigPo);
  67. }
  68. /**
  69. * 微信删除消息模板
  70. *
  71. * @param reqJson
  72. * @return
  73. * @serviceCode /renting/deleteRentingConfig
  74. * @path /app/renting/deleteRentingConfig
  75. */
  76. @RequestMapping(value = "/deleteRentingConfig", method = RequestMethod.POST)
  77. public ResponseEntity<String> deleteRentingConfig(@RequestBody JSONObject reqJson) {
  78. Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空");
  79. Assert.hasKeyAndValue(reqJson, "rentingConfigId", "rentingConfigId不能为空");
  80. RentingConfigPo rentingConfigPo = BeanConvertUtil.covertBean(reqJson, RentingConfigPo.class);
  81. return deleteRentingConfigBMOImpl.delete(rentingConfigPo);
  82. }
  83. /**
  84. * 微信删除消息模板
  85. *
  86. * @return
  87. * @serviceCode /renting/queryRentingConfig
  88. * @path /app/renting/queryRentingConfig
  89. */
  90. @RequestMapping(value = "/queryRentingConfig", method = RequestMethod.GET)
  91. public ResponseEntity<String> queryRentingConfig(
  92. @RequestParam(value = "page") int page,
  93. @RequestParam(value = "row") int row) {
  94. RentingConfigDto rentingConfigDto = new RentingConfigDto();
  95. rentingConfigDto.setPage(page);
  96. rentingConfigDto.setRow(row);
  97. return getRentingConfigBMOImpl.get(rentingConfigDto);
  98. }
  99. }