支付宝认证,切换支付通道新逻辑,后台切换列表,推广三张图详情,关闭向充值服务请求,

This commit is contained in:
liuyingfang
2023-07-01 11:53:01 +08:00
parent 69049951c3
commit 8e0583b460
17 changed files with 617 additions and 77 deletions

View File

@@ -5,13 +5,14 @@ import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.appGuide.AppGuideService;
import cn.pluss.platform.entity.AppGuide;
import cn.pluss.platform.enums.image;
import com.alipay.api.domain.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
@@ -26,7 +27,8 @@ public class IntroduceController {
private AppGuideService appGuideService;
@GetMapping({"/common", "/common/{code}"})
public Result<String> billIntro(@PathVariable(value = "code", required = false) String code, HttpServletRequest httpServletRequest) {
public Result<String> billIntro(@PathVariable(value = "code", required = false) String code, HttpServletRequest httpServletRequest,
@RequestParam String typeCode) {
if (StringUtils.isEmpty(code)) {
String html = "<p><img src=\"https://www.shouyinbei.net/resources/images/upload/82031620725808697.jpg\" style=\"\"/></p><p><img src=\"https://www.shouyinbei.net/resources/images/upload/86751620725811158.jpg\" style=\"\"/></p><p><img src=\"https://www.shouyinbei.net/resources/images/upload/38401620725814105.jpg\" style=\"\"/></p><p><img src=\"https://www.shouyinbei.net/resources/images/upload/14561620725816223.jpg\" style=\"\"/></p><p><img src=\"https://www.shouyinbei.net/resources/images/upload/45071620725822267.jpg\" style=\"\"/></p><p><img src=\"https://www.shouyinbei.net/resources/images/upload/31221620725827105.jpg\" style=\"\"/></p><p><img src=\"https://www.shouyinbei.net/resources/images/upload/68211620725829889.jpg\" style=\"\"/></p><p><br/></p>";
return ResultGenerator.genSuccessResult(html);
@@ -36,10 +38,12 @@ public class IntroduceController {
if (!"SHTGKT".equals(code)){
return ResultGenerator.genSuccessResult(entity == null ? "" : entity.getContent());
}
//如果是推广宽图则看宽图是否开放
if (Objects.equals(entity.getType(), "1")) {
String type = httpServletRequest.getHeader("type");
//TODO 暂时安卓开发IOS不开
if ("1".equals(type)){
return ResultGenerator.genSuccessResult(entity == null ? "" : entity.getContent());
return ResultGenerator.genSuccessResult(image(typeCode));
}else if ("2".equals(type)){
return ResultGenerator.genFailResult("");
}
@@ -48,4 +52,37 @@ public class IntroduceController {
return ResultGenerator.genFailResult("");
}
}
private String image(String typeCode){
switch (typeCode){
case "AG":
return image.PROMOTION_IMAGE.getImageUrl();
case "XW":
return image.SMALL_IMAGE.getImageUrl();
default:
return image.OTHER_IMAGE.getImageUrl();
}
}
@PostMapping ({"/common"})
public Result<String> billIntro(HttpServletRequest httpServletRequest,
@RequestBody Map<String, String> params) {
AppGuide entity = appGuideService.getByCode(params.get("code"));
if (!"SHTGKT".equals(params.get("code"))){
return ResultGenerator.genSuccessResult(entity == null ? "" : entity.getContent());
}
//如果是推广宽图则看宽图是否开放
if (Objects.equals(entity.getType(), "1")) {
String type = httpServletRequest.getHeader("type");
//TODO 暂时安卓开发IOS不开
if ("1".equals(type)){
return ResultGenerator.genSuccessResult(image(params.get("typeCode")));
}else if ("2".equals(type)){
return ResultGenerator.genFailResult("");
}
return ResultGenerator.genSuccessResult(entity == null ? "" : entity.getContent());
}else {
return ResultGenerator.genFailResult("");
}
}
}

View File

@@ -2,10 +2,14 @@ package cn.pluss.platform.controller;
import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.entity.Account;
import cn.pluss.platform.entity.MerchantChannelStatus;
import cn.pluss.platform.enums.ZfbChannel;
import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.mapper.AccountMapper;
import cn.pluss.platform.merchant.AccountService;
import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -22,6 +26,10 @@ import java.util.Map;
public class ZfbAttestationController {
@Resource
private MerchantChannelStatusService merchantChannelStatusService;
@Resource
private AccountService accountService;
@Resource
private AccountMapper accountMapper;
/**
* 支付认证
@@ -30,42 +38,40 @@ public class ZfbAttestationController {
*/
@PostMapping
public Result<Object> Attestation(@RequestBody Map<String, String> params) {
List<MerchantChannelStatus> merchantCode = merchantChannelStatusService.getMerchantCodeByInfo(params.get("merchantCode"));
List<Object> result = new ArrayList<>();
for (MerchantChannelStatus channelStatus : merchantCode) {
switch (channelStatus.getChannel()){
case 1:
HashMap<Object, Object> merchantCodeMap = new HashMap<>();
merchantCodeMap.put("virChannelFlag", channelStatus.getVirChannelFlag());
merchantCodeMap.put("url", ZfbChannel.SXF_CHANNEL.getUrl());
merchantCodeMap.put("nameChannel",ZfbChannel.SXF_CHANNEL.getName());
result.add(merchantCodeMap);
break;
case 4:
HashMap<Object, Object> merchantCodeMap4 = new HashMap<>();
merchantCodeMap4.put("virChannelFlag", channelStatus.getVirChannelFlag());
merchantCodeMap4.put("url", ZfbChannel.YS_CHANNEL.getUrl());
merchantCodeMap4.put("nameChannel",ZfbChannel.YS_CHANNEL.getName());
result.add(merchantCodeMap4);
break;
case 5:
HashMap<Object, Object> merchantCodeMap5 = new HashMap<>();
merchantCodeMap5.put("virChannelFlag", channelStatus.getVirChannelFlag());
merchantCodeMap5.put("url", ZfbChannel.LKL_CHANNEL.getUrl());
merchantCodeMap5.put("nameChannel",ZfbChannel.LKL_CHANNEL.getName());
result.add(merchantCodeMap5);
break;
case 6:
HashMap<Object, Object> merchantCodeMap6 = new HashMap<>();
merchantCodeMap6.put("virChannelFlag", channelStatus.getVirChannelFlag());
merchantCodeMap6.put("url", ZfbChannel.YS_CHANNEL.getUrl());
merchantCodeMap6.put("nameChannel",ZfbChannel.YS_CHANNEL.getName());
result.add(merchantCodeMap6);
break;
default:
throw new MsgException("未知通道");
}
QueryWrapper<Account> QueryWrapper = new QueryWrapper<Account>()
.eq("userId", Integer.valueOf(params.get("userId")))
.eq("valid", 1);
Account one = accountService.getOne(QueryWrapper);
if (one == null){
throw new MsgException("账号异常");
}
return ResultGenerator.genSuccessResult(result);
MerchantChannelStatus merchantCode = merchantChannelStatusService.getMerchantCodeByInfo(params.get("merchantCode"), one.getChannelType());
HashMap<Object, Object> merchantCodeMap = new HashMap<>();
switch (merchantCode.getChannel()){
case 1:
merchantCodeMap.put("virChannelFlag", merchantCode.getVirChannelFlag());
merchantCodeMap.put("url", ZfbChannel.SXF_CHANNEL.getUrl());
merchantCodeMap.put("nameChannel",ZfbChannel.SXF_CHANNEL.getName());
break;
case 4:
merchantCodeMap.put("virChannelFlag", merchantCode.getVirChannelFlag());
merchantCodeMap.put("url", ZfbChannel.YS_CHANNEL.getUrl());
merchantCodeMap.put("nameChannel",ZfbChannel.YS_CHANNEL.getName());
break;
case 5:
merchantCodeMap.put("virChannelFlag", merchantCode.getVirChannelFlag());
merchantCodeMap.put("url", ZfbChannel.LKL_CHANNEL.getUrl());
merchantCodeMap.put("nameChannel",ZfbChannel.LKL_CHANNEL.getName());
break;
case 6:
merchantCodeMap.put("virChannelFlag", merchantCode.getVirChannelFlag());
merchantCodeMap.put("url", ZfbChannel.YS_CHANNEL.getUrl());
merchantCodeMap.put("nameChannel",ZfbChannel.YS_CHANNEL.getName());
break;
default:
throw new MsgException("未知通道");
}
return ResultGenerator.genSuccessResult(merchantCodeMap);
}
}

View File

@@ -3,6 +3,7 @@ package cn.pluss.platform.controller.merchant;
import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService;
import cn.pluss.platform.vo.AccountChannelVO;
import cn.pluss.platform.vo.ChannelStatusVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -31,6 +32,16 @@ public class MerchantChannelStatusController {
return ResultGenerator.genSuccessResult(csVO);
}
/**
* 结算类型切换
* @return
*/
@GetMapping("/channelCheck")
public Result<AccountChannelVO> channelCheck(){
return ResultGenerator.genSuccessResult(channelStatusService.channelCheck());
}
/**
* 快速到账通道和常规通道切换
* @param params 通道标识目前是0常规通道 1 快速到账通道
@@ -42,4 +53,10 @@ public class MerchantChannelStatusController {
ChannelStatusVO channelStatusVO = channelStatusService.appSwitchChannel(Integer.parseInt(flag));
return ResultGenerator.genSuccessResult(channelStatusVO);
}
@PostMapping("/request")
public Result<ChannelStatusVO> request(@RequestBody Map<String, Object> params){
String flag = (String) params.get("flag");
ChannelStatusVO channelStatusVO = channelStatusService.appSwitchRequest(Integer.parseInt(flag));
return ResultGenerator.genSuccessResult(channelStatusVO);
}
}