package com.stylefeng.guns.modular.cloudPayment.controller;
|
|
import com.google.gson.Gson;
|
import com.stylefeng.guns.modular.cloudPayment.example.MchApplicationExample;
|
import com.stylefeng.guns.modular.system.model.TEnterpriseWithdrawal;
|
import com.stylefeng.guns.modular.system.util.ResultUtil;
|
import com.unionpay.upyzt.resp.MchApplicationResp;
|
import com.unionpay.upyzt.resp.MchApplicationStoreResp;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
@Api(tags = "二级商户进件")
|
@Slf4j
|
@RestController
|
@RequestMapping("/api/openSecondMerchantMgmt")
|
public class OpenSecondMerchantMgmtController {
|
|
@Autowired
|
private Gson gson;
|
|
/**
|
* 二级商户首次进件
|
* @param tEnterpriseWithdrawal 二级商户对象
|
* @return 返回参数
|
* @throws Exception 异常
|
*/
|
@ResponseBody
|
@PostMapping("/openSecondMerchantMgmt")
|
@ApiOperation(value = "二级商户首次进件", tags = {"用户端-云闪付相关"}, notes = "")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
|
})
|
public ResultUtil<MchApplicationStoreResp> openSecondMerchantMgmt(@RequestBody TEnterpriseWithdrawal tEnterpriseWithdrawal){
|
MchApplicationStoreResp mchApplicationStoreResp;
|
try{
|
// 二级商户首次进件
|
mchApplicationStoreResp = MchApplicationExample.create(tEnterpriseWithdrawal);
|
log.info("------- 二级商户首次进件 ------- {} ", gson.toJson(mchApplicationStoreResp));
|
}catch (Exception e){
|
log.error("二级商户首次进件失败!!!:{}",e.getMessage());
|
e.printStackTrace();
|
return ResultUtil.error("二级商户首次进件失败!!!");
|
}
|
return ResultUtil.success(mchApplicationStoreResp);
|
}
|
|
/**
|
* 二级商户进件状态查询(系统订单号)
|
* @param mchApplicationId 系统订单号
|
* @return 返回参数
|
* @throws Exception 异常
|
*/
|
@ResponseBody
|
@PostMapping("/querySecondMerchantMgmtByMchApplicationId")
|
@ApiOperation(value = "二级商户进件状态查询(系统订单号)", tags = {"用户端-云闪付相关"}, notes = "")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
|
})
|
public ResultUtil<MchApplicationResp> querySecondMerchantMgmtByMchApplicationId(@RequestBody String mchApplicationId){
|
MchApplicationResp mchApplicationResp;
|
try{
|
// 二级商户进件状态查询(系统订单号)
|
mchApplicationResp = MchApplicationExample.retrieveById(mchApplicationId);
|
log.info("------- 二级商户进件状态查询(系统订单号) ------- {} ", gson.toJson(mchApplicationResp));
|
}catch (Exception e){
|
log.error("二级商户进件状态查询(系统订单号)失败!!!:{}",e.getMessage());
|
e.printStackTrace();
|
return ResultUtil.error("二级商户进件状态查询(系统订单号)失败!!!");
|
}
|
return ResultUtil.success(mchApplicationResp);
|
}
|
|
/**
|
* 修改二级商户信息
|
* @param tEnterpriseWithdrawal 二级商户对象
|
* @return 返回参数
|
* @throws Exception 异常
|
*/
|
@ResponseBody
|
@PostMapping("/updateSecondMerchantMgmt")
|
@ApiOperation(value = "修改二级商户信息", tags = {"用户端-云闪付相关"}, notes = "")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
|
})
|
public ResultUtil<MchApplicationResp> updateSecondMerchantMgmt(@RequestBody TEnterpriseWithdrawal tEnterpriseWithdrawal){
|
MchApplicationResp mchApplicationResp;
|
try{
|
// 修改二级商户信息
|
mchApplicationResp = MchApplicationExample.renew(tEnterpriseWithdrawal);
|
log.info("------- 修改二级商户信息 ------- {} ", gson.toJson(mchApplicationResp));
|
}catch (Exception e){
|
log.error("修改二级商户信息失败!!!:{}",e.getMessage());
|
e.printStackTrace();
|
return ResultUtil.error("修改二级商户信息失败!!!");
|
}
|
return ResultUtil.success(mchApplicationResp);
|
}
|
|
|
/**
|
* 二级商户进件状态查询(平台订单号)
|
* @param outRequestNo 系统订单号
|
* @return 返回参数
|
* @throws Exception 异常
|
*/
|
@ResponseBody
|
@PostMapping("/querySecondMerchantMgmtByOutRequestNo")
|
@ApiOperation(value = "二级商户进件状态查询(平台订单号)", tags = {"用户端-云闪付相关"}, notes = "")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
|
})
|
public ResultUtil<MchApplicationResp> querySecondMerchantMgmtByOutRequestNo(@RequestBody String outRequestNo){
|
MchApplicationResp mchApplicationResp;
|
try{
|
// 二级商户进件状态查询(平台订单号)
|
mchApplicationResp = MchApplicationExample.retrieveByOutRequestNo(outRequestNo);
|
log.info("------- 二级商户进件状态查询(平台订单号) ------- {} ", gson.toJson(mchApplicationResp));
|
}catch (Exception e){
|
log.error("二级商户进件状态查询(平台订单号)失败!!!:{}",e.getMessage());
|
e.printStackTrace();
|
return ResultUtil.error("二级商户进件状态查询(平台订单号)失败!!!");
|
}
|
return ResultUtil.success(mchApplicationResp);
|
}
|
|
|
}
|