OwnerApi.java 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package com.java110.user.api;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.java110.po.owner.OwnerPo;
  4. import com.java110.user.bmo.owner.IChangeOwnerPhone;
  5. import com.java110.user.bmo.owner.IComprehensiveQuery;
  6. import com.java110.user.bmo.owner.IQueryTenants;
  7. import com.java110.user.bmo.owner.IVisitorRecord;
  8. import com.java110.utils.util.Assert;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.http.ResponseEntity;
  11. import org.springframework.web.bind.annotation.*;
  12. @RestController
  13. @RequestMapping(value = "/ownerApi")
  14. public class OwnerApi {
  15. @Autowired
  16. private IQueryTenants queryTenantsImpl;
  17. @Autowired
  18. private IVisitorRecord visitorRecordImpl;
  19. @Autowired
  20. private IChangeOwnerPhone changeOwnerPhoneImpl;
  21. @Autowired
  22. private IComprehensiveQuery comprehensiveQueryImpl;
  23. @RequestMapping(value = "/tenants")
  24. public ResponseEntity<String> tenants(@RequestBody JSONObject reqJson) {
  25. Assert.hasKeyAndValue(reqJson, "code", "小区编码不能为空");
  26. return queryTenantsImpl.query(reqJson);
  27. }
  28. @RequestMapping(value = "/visitorRecord")
  29. public ResponseEntity<String> visitorRecord(@RequestBody JSONObject reqJson) {
  30. Assert.hasKeyAndValue(reqJson, "code", "小区编码不能为空");
  31. return visitorRecordImpl.query(reqJson);
  32. }
  33. /**
  34. * 变更 业主手机号
  35. *
  36. * @param reqJson
  37. * @return
  38. * @service /ownerApi/changeOwnerPhone
  39. * @path /app/ownerApi/changeOwnerPhoto
  40. */
  41. @RequestMapping(value = "/changeOwnerPhone", method = RequestMethod.POST)
  42. public ResponseEntity<String> changeOwnerPhone(@RequestBody JSONObject reqJson) {
  43. Assert.hasKeyAndValue(reqJson, "link", "请求报文中未包含手机号");
  44. Assert.hasKeyAndValue(reqJson, "userId", "请求报文中未包含用户ID");
  45. Assert.hasKeyAndValue(reqJson, "memberId", "请求报文中未包含业主信息");
  46. Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含小区信息");
  47. OwnerPo ownerPo = new OwnerPo();
  48. ownerPo.setLink(reqJson.getString("link"));
  49. ownerPo.setMemberId(reqJson.getString("memberId"));
  50. ownerPo.setCommunityId(reqJson.getString("communityId"));
  51. ownerPo.setUserId(reqJson.getString("userId"));
  52. return changeOwnerPhoneImpl.change(ownerPo);
  53. }
  54. /**
  55. * 综合查询
  56. *
  57. * @param communityId 小区ID
  58. * @return
  59. * @service /ownerApi/comprehensiveQuery
  60. * @path /app/ownerApi/comprehensiveQuery
  61. */
  62. @RequestMapping(value = "/comprehensiveQuery", method = RequestMethod.GET)
  63. public ResponseEntity<String> comprehensiveQuery(@RequestParam(value = "communityId") String communityId,
  64. @RequestParam(value = "searchValue") String searchValue,
  65. @RequestParam(value = "searchType") String searchType,
  66. @RequestHeader(value = "user-id") String userId) {
  67. return comprehensiveQueryImpl.query(communityId, searchValue, searchType,userId);
  68. }
  69. }