You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

73 lines
2.6 KiB

  1. package com.simple.controller;
  2. import com.simple.annotation.AuthIgnore;
  3. import com.simple.common.ErrorCode;
  4. import com.simple.common.Result;
  5. import com.simple.common.ResultData;
  6. import com.simple.domain.po.WxAppinfo;
  7. import com.simple.domain.po.WxMall;
  8. import com.simple.service.WxAppinfoService;
  9. import com.simple.service.WxMallService;
  10. import io.swagger.annotations.Api;
  11. import io.swagger.annotations.ApiImplicitParam;
  12. import io.swagger.annotations.ApiOperation;
  13. import org.slf4j.Logger;
  14. import org.slf4j.LoggerFactory;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.web.bind.annotation.GetMapping;
  17. import org.springframework.web.bind.annotation.RequestMapping;
  18. import org.springframework.web.bind.annotation.RestController;
  19. import java.util.HashMap;
  20. import java.util.Map;
  21. @RestController
  22. @RequestMapping("/api/mall")
  23. @Api(description = "商场信息相关接口")
  24. public class WxMallController extends BaseController {
  25. private final Logger logger = LoggerFactory.getLogger(this.getClass());
  26. @Autowired
  27. private WxMallService wxMallService;
  28. @Autowired
  29. private WxAppinfoService wxAppinfoService;
  30. @AuthIgnore
  31. @ApiOperation("根据appId获取")
  32. @GetMapping("/getAppIcon")
  33. @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true)
  34. public ResultData getAppIcon(String appId) {
  35. WxAppinfo appInfo = wxAppinfoService.getByAppId(appId);
  36. if (appInfo == null) {
  37. return new ResultData(ErrorCode.APP_ID_NOT_FOUND);
  38. }
  39. WxMall mall = wxMallService.getByTenantId(appInfo.getTenantId());
  40. if (mall == null) {
  41. return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND);
  42. }
  43. Map resultMap = new HashMap();
  44. resultMap.put("mallImgUrl", mall.getImgUrl());
  45. resultMap.put("mallName", mall.getName());
  46. return new ResultData(Result.SUCCESS, "查询成功", resultMap);
  47. }
  48. @ApiOperation("根据appId获取")
  49. @GetMapping("/mallInfo")
  50. @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true)
  51. public ResultData getMallInfo(String appId) {
  52. WxAppinfo appInfo = wxAppinfoService.getByAppId(appId);
  53. if (appInfo == null) {
  54. return new ResultData(ErrorCode.APP_ID_NOT_FOUND);
  55. }
  56. WxMall mall = wxMallService.getByTenantId(appInfo.getTenantId());
  57. if (mall == null) {
  58. return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND);
  59. }
  60. return new ResultData(Result.SUCCESS, "查询成功", mall);
  61. }
  62. }