ApiIndexController.java 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. package com.huijy.web.controller.api;
  2. import com.huijy.common.annotation.UnLogin;
  3. import com.huijy.common.core.domain.AjaxResult;
  4. import com.huijy.common.core.page.TableDataInfo;
  5. import com.huijy.management.domain.*;
  6. import com.huijy.management.service.*;
  7. import io.swagger.annotations.Api;
  8. import io.swagger.annotations.ApiImplicitParam;
  9. import io.swagger.annotations.ApiImplicitParams;
  10. import io.swagger.annotations.ApiOperation;
  11. import jdk.nashorn.internal.ir.annotations.Ignore;
  12. import org.apache.catalina.Store;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.web.bind.annotation.*;
  15. import springfox.documentation.annotations.ApiIgnore;
  16. import java.util.HashMap;
  17. import java.util.List;
  18. import java.util.Map;
  19. @Api(value = "小程序",tags = "小程序接口")
  20. @RestController
  21. @RequestMapping("/api/index")
  22. public class ApiIndexController extends ApiAbstractController {
  23. @Autowired
  24. private IMemberService memberService;
  25. @Autowired
  26. private IMemberLocationService memberLocationService;
  27. @Autowired
  28. private IAboutUsService aboutUsService;
  29. @Autowired
  30. private IContentService contentService;
  31. @Autowired
  32. private IShopService shopService;
  33. @Autowired
  34. private IShopSalesRecordService shopSalesRecordService;
  35. @PostMapping("/pushLatLng")
  36. @ApiOperation("上传会员坐标")
  37. @ApiImplicitParams({
  38. @ApiImplicitParam(name = "lat", value = "坐标的lat", paramType = "body"),
  39. @ApiImplicitParam(name = "lng", value = "坐标的lng", paramType = "body")
  40. })
  41. public AjaxResult pushLatLng(@ApiIgnore Member member, @RequestBody Map params) {
  42. String lat = (String) params.get("lat");
  43. String lng = (String) params.get("lng");
  44. member.setLastLat(lat);
  45. member.setLastLng(lng);
  46. memberService.updateMember(member);
  47. MemberLocation location = new MemberLocation();
  48. location.setLat(lat);
  49. location.setLng(lng);
  50. location.setMemberId(member.getMemberId());
  51. memberLocationService.insertMemberLocation(location);
  52. return AjaxResult.success();
  53. }
  54. //上传会员拨打记录
  55. @PostMapping("/pushHelp")
  56. @ApiOperation("上传会员拨打记录")
  57. @ApiImplicitParams({
  58. @ApiImplicitParam(name = "lat", value = "坐标的lat",dataType = "String", paramType = "body"),
  59. @ApiImplicitParam(name = "lng", value = "坐标的lng",dataType = "String",paramType = "body"),
  60. @ApiImplicitParam(name = "phone", value = "求助电话",dataType = "String", paramType = "body")
  61. })
  62. public AjaxResult pushHelp(@ApiIgnore Member member, @RequestBody Map params) {
  63. String lat = (String) params.get("lat");
  64. String lng = (String) params.get("lng");
  65. String phone = (String) params.get("phone");
  66. MemberHelp help = new MemberHelp();
  67. help.setLat(lat);
  68. help.setLng(lng);
  69. help.setPhone(phone);
  70. help.setMemberId(member.getMemberId());
  71. return AjaxResult.success();
  72. }
  73. //关于我们信息,包括小程序的展示素材
  74. @GetMapping("/getAboutUs")
  75. @ApiOperation("获取关于我们的信息")
  76. @UnLogin
  77. public AjaxResult getAboutUs(@ApiIgnore Member member) {
  78. AboutUs aboutUs = aboutUsService.selectAboutUsByAboutUsId(1L);
  79. Map<String, Object> resultObj = new HashMap<String, Object>();
  80. resultObj.put("aboutUs", aboutUs);
  81. return AjaxResult.success(resultObj);
  82. }
  83. //分页获取主要内容信息
  84. @GetMapping("/getPageContent")
  85. @ApiOperation("分页获取主要内容信息")
  86. @UnLogin
  87. @ApiImplicitParams({
  88. @ApiImplicitParam(name = "type", value = "类型:1、党政服务;2、景区介绍;3、旅游攻略;4、热门活动",required = true,defaultValue = "1",dataType = "Integer",
  89. allowableValues = "1,2,3,4",paramType = "query"),
  90. @ApiImplicitParam(name = "pageNum", required = true,defaultValue = "1",value = "页码", paramType = "query"),
  91. @ApiImplicitParam(name = "pageSize", required = true,defaultValue = "20", value = "显示记录数", paramType = "query")
  92. })
  93. public TableDataInfo getPageContent(@ApiIgnore Member member, Integer type) {
  94. // AboutUs aboutUs = aboutUsService.selectAboutUsByAboutUsId(1L);
  95. Content content = new Content();
  96. content.setServiceInfo(type+"");
  97. startPage();
  98. List<Content> list = contentService.selectContentList(content);
  99. return getDataTable(list);
  100. }
  101. //门店开通申请
  102. @PostMapping("/shopApply")
  103. @ApiOperation("商铺开通申请")
  104. @ApiImplicitParams({
  105. @ApiImplicitParam(name = "name", value = "商铺名称",required = true,paramType = "body"),
  106. @ApiImplicitParam(name = "addres", value = "地址", paramType = "body"),
  107. @ApiImplicitParam(name = "bossName", value = "老板名称",required = true, paramType = "body"),
  108. @ApiImplicitParam(name = "bossPhone", value = "老板电话",required = true, paramType = "body"),
  109. @ApiImplicitParam(name = "businessHours", value = "营业时间", paramType = "body"),
  110. @ApiImplicitParam(name = "briefContent", value = "简介", paramType = "body"),
  111. @ApiImplicitParam(name = "lat", value = "坐标的lat", paramType = "body"),
  112. @ApiImplicitParam(name = "lng", value = "坐标的lng", paramType = "body")
  113. })
  114. public AjaxResult storeApply(@ApiIgnore Member member, @RequestBody Shop shop) {
  115. if (shop == null){
  116. AjaxResult.error("提交数据为空");
  117. }
  118. shop.setAuditFlag("0");
  119. shop.setEnableFlag("0");
  120. shopService.insertShop(shop);
  121. return AjaxResult.success();
  122. }
  123. //更新门店坐标
  124. @PostMapping("/updateLatLng")
  125. @ApiOperation("更新门店坐标")
  126. @ApiImplicitParams({
  127. @ApiImplicitParam(name = "shopId", value = "商铺id",required = true,paramType = "body"),
  128. @ApiImplicitParam(name = "lat", value = "坐标的lat", paramType = "body"),
  129. @ApiImplicitParam(name = "lng", value = "坐标的lng", paramType = "body")
  130. })
  131. public AjaxResult storeApply(@ApiIgnore Member member, @RequestBody Map params) {
  132. String lat = (String) params.get("lat");
  133. String lng = (String) params.get("lng");
  134. Integer shopId = (Integer) params.get("shopId");
  135. if (shopId==null || shopId<=0){
  136. return AjaxResult.error("店铺id不能为空");
  137. }
  138. Shop shop = shopService.selectShopByShopId(shopId.longValue());
  139. if (shop == null){
  140. return AjaxResult.error("获取店铺信息出错");
  141. }
  142. shop.setLat(lat);
  143. shop.setLng(lng);
  144. shopService.updateShop(shop);
  145. return AjaxResult.success();
  146. }
  147. //门店数据上报
  148. @PostMapping("/pushRecord")
  149. @ApiOperation("门店数据上报")
  150. public AjaxResult storeApply(@ApiIgnore Member member, @RequestBody ShopSalesRecord shopSalesRecord) {
  151. if (shopSalesRecord==null){
  152. AjaxResult.error("上传数据为空");
  153. }
  154. shopSalesRecordService.insertShopSalesRecord(shopSalesRecord);
  155. return AjaxResult.success();
  156. }
  157. }