123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- package com.huijy.web.controller.api;
- import com.huijy.common.annotation.UnLogin;
- import com.huijy.common.core.domain.AjaxResult;
- import com.huijy.common.core.domain.entity.SysDictData;
- import com.huijy.common.core.page.TableDataInfo;
- import com.huijy.common.utils.StringUtils;
- import com.huijy.management.domain.*;
- import com.huijy.management.service.*;
- import com.huijy.system.service.ISysDictDataService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiImplicitParam;
- import io.swagger.annotations.ApiImplicitParams;
- import io.swagger.annotations.ApiOperation;
- 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;
- @Autowired
- private ISysDictDataService sysDictDataService;
- @Autowired
- private IMarkerService markerService;
- @Autowired
- private IEarlyWarningService earlyWarningService;
- @Autowired
- private IMemberHelpService memberHelpService;
- @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 MemberHelp help) {
- help.setMemberId(member.getMemberId());
- memberHelpService.insertMemberHelp(help);
- 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+"");
- content.setReleaseFlag("1");
- startPage();
- List<Content> list = contentService.selectContentList(content);
- return getDataTable(list);
- }
- //分页获取主要内容信息
- @GetMapping("/getContentInfo/{contentId}")
- @ApiOperation("获取主要内容详细信息")
- @UnLogin
- public AjaxResult getContentInfo(@ApiIgnore Member member, @PathVariable Integer contentId) {
- // AboutUs aboutUs = aboutUsService.selectAboutUsByAboutUsId(1L);
- Content info = contentService.selectContentByContentId(contentId.longValue());
- Map<String, Object> resultObj = new HashMap<String, Object>();
- resultObj.put("info", info);
- return AjaxResult.success(resultObj);
- }
- //门店开通申请
- @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"),
- @ApiImplicitParam(name = "shopType", value = "商铺类型 1、商铺 2、酒店",defaultValue = "1",paramType = "body"),
- })
- public AjaxResult storeApply(@ApiIgnore Member member, @RequestBody Shop shop) {
- if (shop == null){
- AjaxResult.error("提交数据为空");
- }
- shop.setMemberId(member.getMemberId());
- shop.setAuditFlag("0");
- shop.setEnableFlag("0");
- shopService.insertShop(shop);
- return AjaxResult.success();
- }
- //门店开通申请
- @GetMapping("/getShopList")
- @ApiOperation("获取商铺列表")
- public AjaxResult getShopList(@ApiIgnore Member member) {
- List list = shopService.getListByMemberId(member.getMemberId());
- Map<String, Object> resultObj = new HashMap<String, Object>();
- resultObj.put("list", list);
- return AjaxResult.success(resultObj);
- }
- @GetMapping("/getShopInfo/{shopId}")
- @ApiOperation("获取商铺列表")
- public AjaxResult getShopInfo(@ApiIgnore Member member, @PathVariable Long shopId) {
- if (shopId == null){
- AjaxResult.error("提交数据为空");
- }
- Shop shop = shopService.selectShopByShopId(shopId);
- Map<String, Object> resultObj = new HashMap<String, Object>();
- resultObj.put("shopInfo", shop);
- return AjaxResult.success(resultObj);
- }
- //更新门店坐标
- @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();
- }
- //返回标记物类型
- @PostMapping("/getMarkerType")
- @ApiOperation("获取标记物类型")
- public AjaxResult getMarkerDictData(){
- SysDictData dictData = new SysDictData();
- dictData.setDictType("marker_type");
- dictData.setStatus("0");
- List<SysDictData> list = sysDictDataService.selectDictDataList(dictData);
- Map<String, Object> resultObj = new HashMap<String, Object>();
- resultObj.put("list", list);
- return AjaxResult.success(resultObj);
- }
- //
- @GetMapping("/getPageMarker")
- @ApiOperation("根据标记物类型分页获取标记物信息")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "markerType", value = "标记物类型:0为所有类型",required = true,defaultValue = "0",dataType = "String",paramType = "query"),
- @ApiImplicitParam(name = "pageNum", required = true,defaultValue = "1",value = "页码", paramType = "query"),
- @ApiImplicitParam(name = "pageSize", required = true,defaultValue = "20", value = "显示记录数", paramType = "query")
- })
- public TableDataInfo getPageMarker(String markerType) {
- Marker marker = new Marker();
- if (StringUtils.isNotEmpty(markerType) && !markerType.equalsIgnoreCase("0")){
- marker.setMarkerType(markerType);
- }
- startPage();
- List<Marker> list = markerService.selectMarkerList(marker);
- return getDataTable(list);
- }
- @PostMapping("/getEarlyWarnType")
- @ApiOperation("获取预警类型")
- public AjaxResult getEarlyWarnType(){
- SysDictData dictData = new SysDictData();
- dictData.setDictType("early_warning_type");
- dictData.setStatus("0");
- List<SysDictData> list = sysDictDataService.selectDictDataList(dictData);
- Map<String, Object> resultObj = new HashMap<String, Object>();
- resultObj.put("list", list);
- return AjaxResult.success(resultObj);
- }
- @GetMapping("/getPageEarlyWarn")
- @ApiOperation("根据预警类型分页获取预警信息")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "earlyWarnType", value = "预警类型:0为所有类型",required = true,defaultValue = "0",dataType = "String",paramType = "query"),
- @ApiImplicitParam(name = "pageNum", required = true,defaultValue = "1",value = "页码", paramType = "query"),
- @ApiImplicitParam(name = "pageSize", required = true,defaultValue = "20", value = "显示记录数", paramType = "query")
- })
- public TableDataInfo getPageEarlyWarn(String earlyWarnType) {
- EarlyWarning earlyWarning = new EarlyWarning();
- if (StringUtils.isNotEmpty(earlyWarnType) && !earlyWarnType.equalsIgnoreCase("0")){
- earlyWarning.setEarlyWarningType(earlyWarnType);
- }
- startPage();
- List<EarlyWarning> list = earlyWarningService.selectEarlyWarningList(earlyWarning);
- return getDataTable(list);
- }
- }
|