123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- package com.huijy.web.controller.api;
- import com.huijy.common.annotation.UnLogin;
- import com.huijy.common.core.domain.AjaxResult;
- import com.huijy.common.core.page.TableDataInfo;
- import com.huijy.management.domain.*;
- import com.huijy.management.service.*;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiImplicitParam;
- import io.swagger.annotations.ApiImplicitParams;
- import io.swagger.annotations.ApiOperation;
- import jdk.nashorn.internal.ir.annotations.Ignore;
- import org.apache.catalina.Store;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import springfox.documentation.annotations.ApiIgnore;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- @Api(value = "小程序",tags = "小程序接口")
- @RestController
- @RequestMapping("/api/index")
- public class ApiIndexController extends ApiAbstractController {
- @Autowired
- private IMemberService memberService;
- @Autowired
- private IMemberLocationService memberLocationService;
- @Autowired
- private IAboutUsService aboutUsService;
- @Autowired
- private IContentService contentService;
- @Autowired
- private IShopService shopService;
- @Autowired
- private IShopSalesRecordService shopSalesRecordService;
- @PostMapping("/pushLatLng")
- @ApiOperation("上传会员坐标")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "lat", value = "坐标的lat", paramType = "body"),
- @ApiImplicitParam(name = "lng", value = "坐标的lng", paramType = "body")
- })
- public AjaxResult pushLatLng(@ApiIgnore Member member, @RequestBody Map params) {
- String lat = (String) params.get("lat");
- String lng = (String) params.get("lng");
- member.setLastLat(lat);
- member.setLastLng(lng);
- memberService.updateMember(member);
- MemberLocation location = new MemberLocation();
- location.setLat(lat);
- location.setLng(lng);
- location.setMemberId(member.getMemberId());
- memberLocationService.insertMemberLocation(location);
- return AjaxResult.success();
- }
- //上传会员拨打记录
- @PostMapping("/pushHelp")
- @ApiOperation("上传会员拨打记录")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "lat", value = "坐标的lat",dataType = "String", paramType = "body"),
- @ApiImplicitParam(name = "lng", value = "坐标的lng",dataType = "String",paramType = "body"),
- @ApiImplicitParam(name = "phone", value = "求助电话",dataType = "String", paramType = "body")
- })
- public AjaxResult pushHelp(@ApiIgnore Member member, @RequestBody Map params) {
- String lat = (String) params.get("lat");
- String lng = (String) params.get("lng");
- String phone = (String) params.get("phone");
- MemberHelp help = new MemberHelp();
- help.setLat(lat);
- help.setLng(lng);
- help.setPhone(phone);
- help.setMemberId(member.getMemberId());
- return AjaxResult.success();
- }
- //关于我们信息,包括小程序的展示素材
- @GetMapping("/getAboutUs")
- @ApiOperation("获取关于我们的信息")
- @UnLogin
- public AjaxResult getAboutUs(@ApiIgnore Member member) {
- AboutUs aboutUs = aboutUsService.selectAboutUsByAboutUsId(1L);
- Map<String, Object> resultObj = new HashMap<String, Object>();
- resultObj.put("aboutUs", aboutUs);
- return AjaxResult.success(resultObj);
- }
- //分页获取主要内容信息
- @GetMapping("/getPageContent")
- @ApiOperation("分页获取主要内容信息")
- @UnLogin
- @ApiImplicitParams({
- @ApiImplicitParam(name = "type", value = "类型:1、党政服务;2、景区介绍;3、旅游攻略;4、热门活动",required = true,defaultValue = "1",dataType = "Integer",
- allowableValues = "1,2,3,4",paramType = "query"),
- @ApiImplicitParam(name = "pageNum", required = true,defaultValue = "1",value = "页码", paramType = "query"),
- @ApiImplicitParam(name = "pageSize", required = true,defaultValue = "20", value = "显示记录数", paramType = "query")
- })
- public TableDataInfo getPageContent(@ApiIgnore Member member, Integer type) {
- // AboutUs aboutUs = aboutUsService.selectAboutUsByAboutUsId(1L);
- Content content = new Content();
- content.setServiceInfo(type+"");
- startPage();
- List<Content> list = contentService.selectContentList(content);
- return getDataTable(list);
- }
- //门店开通申请
- @PostMapping("/shopApply")
- @ApiOperation("商铺开通申请")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "name", value = "商铺名称",required = true,paramType = "body"),
- @ApiImplicitParam(name = "addres", value = "地址", paramType = "body"),
- @ApiImplicitParam(name = "bossName", value = "老板名称",required = true, paramType = "body"),
- @ApiImplicitParam(name = "bossPhone", value = "老板电话",required = true, paramType = "body"),
- @ApiImplicitParam(name = "businessHours", value = "营业时间", paramType = "body"),
- @ApiImplicitParam(name = "briefContent", value = "简介", paramType = "body"),
- @ApiImplicitParam(name = "lat", value = "坐标的lat", paramType = "body"),
- @ApiImplicitParam(name = "lng", value = "坐标的lng", paramType = "body")
- })
- public AjaxResult storeApply(@ApiIgnore Member member, @RequestBody Shop shop) {
- if (shop == null){
- AjaxResult.error("提交数据为空");
- }
- shop.setAuditFlag("0");
- shop.setEnableFlag("0");
- shopService.insertShop(shop);
- return AjaxResult.success();
- }
- //更新门店坐标
- @PostMapping("/updateLatLng")
- @ApiOperation("更新门店坐标")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "shopId", value = "商铺id",required = true,paramType = "body"),
- @ApiImplicitParam(name = "lat", value = "坐标的lat", paramType = "body"),
- @ApiImplicitParam(name = "lng", value = "坐标的lng", paramType = "body")
- })
- public AjaxResult storeApply(@ApiIgnore Member member, @RequestBody Map params) {
- String lat = (String) params.get("lat");
- String lng = (String) params.get("lng");
- Integer shopId = (Integer) params.get("shopId");
- if (shopId==null || shopId<=0){
- return AjaxResult.error("店铺id不能为空");
- }
- Shop shop = shopService.selectShopByShopId(shopId.longValue());
- if (shop == null){
- return AjaxResult.error("获取店铺信息出错");
- }
- shop.setLat(lat);
- shop.setLng(lng);
- shopService.updateShop(shop);
- return AjaxResult.success();
- }
- //门店数据上报
- @PostMapping("/pushRecord")
- @ApiOperation("门店数据上报")
- public AjaxResult storeApply(@ApiIgnore Member member, @RequestBody ShopSalesRecord shopSalesRecord) {
- if (shopSalesRecord==null){
- AjaxResult.error("上传数据为空");
- }
- shopSalesRecordService.insertShopSalesRecord(shopSalesRecord);
- return AjaxResult.success();
- }
- }
|