xuhy
2025-01-09 712f70b2936079a131ecb1e63c6d337171618cad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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);
    }
 
 
}