HcGovTranslateApi.java 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. package com.java110.common.api;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.java110.common.bmo.hcGovTranslate.IDeleteHcGovTranslateBMO;
  4. import com.java110.common.bmo.hcGovTranslate.IGetHcGovTranslateBMO;
  5. import com.java110.common.bmo.hcGovTranslate.ISaveHcGovTranslateBMO;
  6. import com.java110.common.bmo.hcGovTranslate.IUpdateHcGovTranslateBMO;
  7. import com.java110.dto.hcGovTranslate.HcGovTranslateDto;
  8. import com.java110.po.hcGovTranslate.HcGovTranslatePo;
  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 = "/hcGovTranslate")
  16. public class HcGovTranslateApi {
  17. @Autowired
  18. private ISaveHcGovTranslateBMO saveHcGovTranslateBMOImpl;
  19. @Autowired
  20. private IUpdateHcGovTranslateBMO updateHcGovTranslateBMOImpl;
  21. @Autowired
  22. private IDeleteHcGovTranslateBMO deleteHcGovTranslateBMOImpl;
  23. @Autowired
  24. private IGetHcGovTranslateBMO getHcGovTranslateBMOImpl;
  25. /**
  26. * 微信保存消息模板
  27. * @serviceCode /hcGovTranslate/saveHcGovTranslate
  28. * @path /app/hcGovTranslate/saveHcGovTranslate
  29. * @param reqJson
  30. * @return
  31. */
  32. @RequestMapping(value = "/saveHcGovTranslate", method = RequestMethod.POST)
  33. public ResponseEntity<String> saveHcGovTranslate(@RequestBody JSONObject reqJson) {
  34. Assert.hasKeyAndValue(reqJson, "serviceCode", "请求报文中未包含serviceCode");
  35. Assert.hasKeyAndValue(reqJson, "reqTime", "请求报文中未包含reqTime");
  36. Assert.hasKeyAndValue(reqJson, "sign", "请求报文中未包含sign");
  37. Assert.hasKeyAndValue(reqJson, "extCommunityId", "请求报文中未包含extCommunityId");
  38. Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
  39. Assert.hasKeyAndValue(reqJson, "code", "请求报文中未包含code");
  40. Assert.hasKeyAndValue(reqJson, "govTopic", "请求报文中未包含govTopic");
  41. Assert.hasKeyAndValue(reqJson, "state", "请求报文中未包含state");
  42. Assert.hasKeyAndValue(reqJson, "sendCount", "请求报文中未包含sendCount");
  43. Assert.hasKeyAndValue(reqJson, "updateTime", "请求报文中未包含updateTime");
  44. Assert.hasKeyAndValue(reqJson, "objId", "请求报文中未包含objId");
  45. HcGovTranslatePo hcGovTranslatePo = BeanConvertUtil.covertBean(reqJson, HcGovTranslatePo.class);
  46. return saveHcGovTranslateBMOImpl.save(hcGovTranslatePo);
  47. }
  48. /**
  49. * 微信修改消息模板
  50. * @serviceCode /hcGovTranslate/updateHcGovTranslate
  51. * @path /app/hcGovTranslate/updateHcGovTranslate
  52. * @param reqJson
  53. * @return
  54. */
  55. @RequestMapping(value = "/updateHcGovTranslate", method = RequestMethod.POST)
  56. public ResponseEntity<String> updateHcGovTranslate(@RequestBody JSONObject reqJson) {
  57. Assert.hasKeyAndValue(reqJson, "tranId", "请求报文中未包含tranId");
  58. Assert.hasKeyAndValue(reqJson, "serviceCode", "请求报文中未包含serviceCode");
  59. Assert.hasKeyAndValue(reqJson, "reqTime", "请求报文中未包含reqTime");
  60. Assert.hasKeyAndValue(reqJson, "sign", "请求报文中未包含sign");
  61. Assert.hasKeyAndValue(reqJson, "extCommunityId", "请求报文中未包含extCommunityId");
  62. Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
  63. Assert.hasKeyAndValue(reqJson, "code", "请求报文中未包含code");
  64. Assert.hasKeyAndValue(reqJson, "govTopic", "请求报文中未包含govTopic");
  65. Assert.hasKeyAndValue(reqJson, "state", "请求报文中未包含state");
  66. Assert.hasKeyAndValue(reqJson, "sendCount", "请求报文中未包含sendCount");
  67. Assert.hasKeyAndValue(reqJson, "updateTime", "请求报文中未包含updateTime");
  68. Assert.hasKeyAndValue(reqJson, "objId", "请求报文中未包含objId");
  69. Assert.hasKeyAndValue(reqJson, "tranId", "tranId不能为空");
  70. HcGovTranslatePo hcGovTranslatePo = BeanConvertUtil.covertBean(reqJson, HcGovTranslatePo.class);
  71. return updateHcGovTranslateBMOImpl.update(hcGovTranslatePo);
  72. }
  73. /**
  74. * 微信删除消息模板
  75. * @serviceCode /hcGovTranslate/deleteHcGovTranslate
  76. * @path /app/hcGovTranslate/deleteHcGovTranslate
  77. * @param reqJson
  78. * @return
  79. */
  80. @RequestMapping(value = "/deleteHcGovTranslate", method = RequestMethod.POST)
  81. public ResponseEntity<String> deleteHcGovTranslate(@RequestBody JSONObject reqJson) {
  82. Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空");
  83. Assert.hasKeyAndValue(reqJson, "tranId", "tranId不能为空");
  84. HcGovTranslatePo hcGovTranslatePo = BeanConvertUtil.covertBean(reqJson, HcGovTranslatePo.class);
  85. return deleteHcGovTranslateBMOImpl.delete(hcGovTranslatePo);
  86. }
  87. /**
  88. * 微信删除消息模板
  89. * @serviceCode /hcGovTranslate/queryHcGovTranslate
  90. * @path /app/hcGovTranslate/queryHcGovTranslate
  91. * @param communityId 小区ID
  92. * @return
  93. */
  94. @RequestMapping(value = "/queryHcGovTranslate", method = RequestMethod.GET)
  95. public ResponseEntity<String> queryHcGovTranslate(@RequestParam(value = "communityId") String communityId,
  96. @RequestParam(value = "page") int page,
  97. @RequestParam(value = "row") int row) {
  98. HcGovTranslateDto hcGovTranslateDto = new HcGovTranslateDto();
  99. hcGovTranslateDto.setPage(page);
  100. hcGovTranslateDto.setRow(row);
  101. hcGovTranslateDto.setCommunityId(communityId);
  102. return getHcGovTranslateBMOImpl.get(hcGovTranslateDto);
  103. }
  104. }