|
|
|
@@ -1,87 +0,0 @@ |
|
|
|
package com.iformall.controller; |
|
|
|
|
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.WxActivity; |
|
|
|
import com.iformall.domain.po.WxMall; |
|
|
|
import com.iformall.service.WxMallService; |
|
|
|
import com.iformall.service.pay.alipay.AliPayUtil; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.ModelAttribute; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.net.URLDecoder; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author gongbiao |
|
|
|
*/ |
|
|
|
@RestController |
|
|
|
@RequestMapping("/api/alipay") |
|
|
|
public class AliPayController extends BaseController { |
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxMallService wxMallService; |
|
|
|
@Autowired |
|
|
|
private AliPayUtil alipayUtil; |
|
|
|
|
|
|
|
@ApiOperation("获取会员页面") |
|
|
|
@GetMapping("getMemberPage") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), |
|
|
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) |
|
|
|
public ResultData getMemberPage(@ModelAttribute WxActivity wxActivity, Integer pageNum, Integer pageSize) { |
|
|
|
WxMall wxMall = wxMallService.getByTenantInfo(getTenantInfo()); |
|
|
|
if (null == wxMall ) { |
|
|
|
return new ResultData(Result.ERROR,"wxMall不存在"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(wxMall.getAlipayAppAuthToken())) { |
|
|
|
return new ResultData(Result.ERROR,"wxMall alipayAppToken不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isBlank(wxMall.getAlipayMemberTemplateId())) { |
|
|
|
return new ResultData(Result.ERROR,"wxMall alipayMemberTemplateId不存在"); |
|
|
|
} |
|
|
|
String url = alipayUtil.getSmartDistrictMemberCardUrl(wxMall.getAlipayAppAuthToken(), wxMall.getAlipayMemberTemplateId(), "memberAuth_"+wxMall.getTenantId()); |
|
|
|
try { |
|
|
|
return new ResultData(URLDecoder.decode(url, "utf-8")); |
|
|
|
} catch (UnsupportedEncodingException e) { |
|
|
|
logger.error("getMemberPage error url["+url+"]",e); |
|
|
|
return new ResultData(Result.ERROR,"url返回失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("获取商圈智能积分授权授权页面") |
|
|
|
@GetMapping("getSmartDistrctPointPage") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), |
|
|
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) |
|
|
|
public ResultData getSmartDistrctPointPage(@ModelAttribute WxActivity wxActivity, Integer pageNum, Integer pageSize) { |
|
|
|
WxMall wxMall = wxMallService.getByTenantInfo(getTenantInfo()); |
|
|
|
if (null == wxMall ) { |
|
|
|
return new ResultData(Result.ERROR,"wxMall不存在"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(wxMall.getAlipayAppAuthToken())) { |
|
|
|
return new ResultData(Result.ERROR,"wxMall alipayAppToken不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isBlank(wxMall.getAlipayMemberTemplateId())) { |
|
|
|
return new ResultData(Result.ERROR,"wxMall alipayMemberTemplateId不存在"); |
|
|
|
} |
|
|
|
String url = alipayUtil.getH5SmartDistrictMallVipPointsUrl(wxMall.getTenantId()); |
|
|
|
try { |
|
|
|
return new ResultData(URLDecoder.decode(url, "utf-8")); |
|
|
|
} catch (UnsupportedEncodingException e) { |
|
|
|
logger.error("getMemberPage error url["+url+"]",e); |
|
|
|
return new ResultData(Result.ERROR,"url返回失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |