|
|
|
@@ -0,0 +1,64 @@ |
|
|
|
package com.iformall.controller.app; |
|
|
|
|
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.controller.base.BaseController; |
|
|
|
import com.iformall.domain.po.WxAppinfo; |
|
|
|
import com.iformall.domain.po.WxPayAccount; |
|
|
|
import com.iformall.enums.EnumAppPlat; |
|
|
|
import com.iformall.enums.EnumEnableType; |
|
|
|
import com.iformall.service.WxAppinfoService; |
|
|
|
import com.iformall.service.WxPayAccountService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
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.*; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author gongbiao |
|
|
|
*/ |
|
|
|
@RestController |
|
|
|
@RequestMapping("payAccount") |
|
|
|
@Api(description = "支付设置") |
|
|
|
public class WxPayAccountController extends BaseController { |
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxPayAccountService wxPayAccountService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxAppinfoService wxAppinfoService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "获取支付设置", notes = "") |
|
|
|
@GetMapping("/getPayAccount") |
|
|
|
public ResultData getPayAccount(Integer plat) { |
|
|
|
logger.info("/payAccount/getPayAccount" + plat); |
|
|
|
EnumAppPlat enumPlat = EnumAppPlat.getByCode(plat); |
|
|
|
if(enumPlat == null){ |
|
|
|
enumPlat = EnumAppPlat.WX; |
|
|
|
} |
|
|
|
|
|
|
|
WxPayAccount payAccount = wxPayAccountService.getPayAccount(getTenantInfo(), enumPlat); |
|
|
|
|
|
|
|
if(payAccount == null){ |
|
|
|
return new ResultData(ErrorCode.API_KEY_NOT_FOUND.getCode(),"未找到支付配置"); |
|
|
|
} |
|
|
|
WxPayAccount returnPayAccount = new WxPayAccount(); |
|
|
|
returnPayAccount.setType(payAccount.getType()); |
|
|
|
returnPayAccount.setMchType(payAccount.getMchType()); |
|
|
|
returnPayAccount.setOpenPay(payAccount.getOpenPay()); |
|
|
|
returnPayAccount.setPayVersion(payAccount.getPayVersion()); |
|
|
|
returnPayAccount.setShare(payAccount.getShare()); |
|
|
|
return new ResultData(returnPayAccount); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |