| @@ -0,0 +1,71 @@ | |||
| package com.simple.controller; | |||
| import com.simple.annotation.AuthIgnore; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxAppinfo; | |||
| import com.simple.domain.po.WxMall; | |||
| import com.simple.service.WxAppinfoService; | |||
| import com.simple.service.WxMallService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("/api/mall") | |||
| @Api(description="商场信息相关接口") | |||
| public class WxMallController extends BaseController { | |||
| private Logger logger = Logger.getLogger(WxMallController.class); | |||
| @Autowired | |||
| private WxMallService wxMallService; | |||
| @Autowired | |||
| private WxAppinfoService wxAppinfoService; | |||
| @AuthIgnore | |||
| @ApiOperation("根据appId获取") | |||
| @GetMapping("/getAppIcon") | |||
| @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true) | |||
| public ResultData getAppIcon(String appId) { | |||
| WxAppinfo appInfo = wxAppinfoService.getByAppId(appId); | |||
| if (appInfo == null) { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| WxMall mall = wxMallService.getByTenantId(appInfo.getTenantId()); | |||
| if (mall==null) { | |||
| return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| Map resultMap = new HashMap(); | |||
| resultMap.put("mallImgUrl", mall.getImgUrl()); | |||
| resultMap.put("mallName", mall.getName()); | |||
| return new ResultData(Result.SUCCESS, "查询成功", resultMap); | |||
| } | |||
| @ApiOperation("根据appId获取") | |||
| @GetMapping("/mallInfo") | |||
| @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true) | |||
| public ResultData getMallInfo(String appId) { | |||
| WxAppinfo appInfo = wxAppinfoService.getByAppId(appId); | |||
| if (appInfo == null) { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| WxMall mall = wxMallService.getByTenantId(appInfo.getTenantId()); | |||
| if (mall==null) { | |||
| return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", mall); | |||
| } | |||
| } | |||