| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.account.service.ITEnterpriseWithdrawalService; |
| | | import com.stylefeng.guns.modular.account.service.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.account.unionpay.*; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.*; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.AllocationReq; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.BalanceAcctReq; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.DepositReq; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.WithdrawalReq; |
| | | import com.stylefeng.guns.modular.account.unionpay.GetOpenBodySig; |
| | | import com.stylefeng.guns.modular.account.unionpay.NotifyDemo; |
| | | import com.stylefeng.guns.modular.account.unionpay.QrCodeConfiguration; |
| | | import com.stylefeng.guns.modular.account.unionpay.Util; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.enums.PaymentTypeEnum; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.model.Reassign; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.unionpay.upyzt.exception.UpyztException; |
| | | import com.unionpay.upyzt.resp.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | // return "/WEB-INF/views/jsp/payResult.jsp"; |
| | | } |
| | | |
| | | // @ResponseBody |
| | | // @RequestMapping(value = "/api/placeOrder/appPayRecharge", method = RequestMethod.POST) |
| | | // @ApiOperation(value = "支付充值", tags = {"支付充值"}, notes = "") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | // }) |
| | | public static void app(){ |
| | | DepositReq depositReq = new DepositReq(); |
| | | depositReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | //- |
| | | depositReq.setAmount(60000); // 支付金额 |
| | | depositReq.setBalanceAcctId("2008429872055963229"); |
| | | depositReq.setDepositType("1"); |
| | | depositReq.setPaymentType(PaymentTypeEnum.CUP_APP.getCode()); |
| | | //- |
| | | depositReq.setPaymentTradeNo("88890525-135"); |
| | | depositReq.setPaymentSucceededAt(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date())); |
| | | //- |
| | | depositReq.setOrderNo("88890525-135"); |
| | | depositReq.setOrderAmount(1L); |
| | | depositReq.setProductName("充值金额"); |
| | | depositReq.setProductCount(1); |
| | | depositReq.setNotifyUrl("http://zhentonggongsi.com:8010/api/placeOrder/notifyUrlOne"); |
| | | DepositResp depositResp = null; |
| | | try { |
| | | depositResp = DepositExample.create(depositReq); |
| | | } catch (UpyztException e) { |
| | | log.error(e.getMessage()); |
| | | e.printStackTrace(); |
| | | } |
| | | System.err.println(depositResp); |
| | | log.info("支付充值成功:{}",depositResp); |
| | | } |
| | | |
| | | // @ResponseBody |
| | | // @RequestMapping(value = "/api/placeOrder/queryApp", method = RequestMethod.POST) |
| | | // @ApiOperation(value = "支付充值查询", tags = {"支付充值查询"}, notes = "") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | // }) |
| | | public void queryApp(){ |
| | | DepositResp balanceAcctResp = null; |
| | | try { |
| | | balanceAcctResp = DepositExample.retrieveById("2008429872055963229"); |
| | | System.err.println(balanceAcctResp); |
| | | } catch (UpyztException e) { |
| | | log.error("电子账簿查询失败:{}",e.getMessage()); |
| | | e.printStackTrace(); |
| | | } |
| | | log.info("电子账簿查询完成=========:{}",balanceAcctResp); |
| | | } |
| | | |
| | | |
| | | // @ResponseBody |
| | | // @RequestMapping(value = "/api/placeOrder/fenZhang", method = RequestMethod.POST) |
| | | // @ApiOperation(value = "分账", tags = {"分账"}, notes = "") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | // }) |
| | | public void fenZhang(){ |
| | | log.info("平台分账到司机电子账簿========="); |
| | | AllocationReq allocationReq = userWithdrawalService.createAllocationReq("2007942595542621717", "2007942320163036794", 1,"123456"); |
| | | allocationReq.setOrderNo("202304041039329889826910"); |
| | | allocationReq.setPassword("123456"); |
| | | allocationReq.setOrderAmount(1L); |
| | | allocationReq.setProductName("测试退货5(1111)"); |
| | | allocationReq.setProductCount(1); |
| | | AllocationResp allocationResp = null; |
| | | try { |
| | | allocationResp = AllocationExample.create(allocationReq); |
| | | } catch (UpyztException e) { |
| | | log.error("平台分账到司机电子账簿失败:{}",e.getMessage()); |
| | | e.printStackTrace(); |
| | | } |
| | | log.info("平台分账到司机电子账簿完成=========:{}",allocationResp); |
| | | } |
| | | // @ResponseBody |
| | | // @RequestMapping(value = "/api/placeOrder/dianZi", method = RequestMethod.POST) |
| | | // @ApiOperation(value = "电子账簿查询", tags = {"电子账簿查询"}, notes = "") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | // }) |
| | | public void dianZi(){ |
| | | BalanceAcctListResp balanceAcctListResp = null; |
| | | try { |
| | | BalanceAcctReq balanceAcctReq = new BalanceAcctReq(); |
| | | balanceAcctReq.setMchId("1008427961477222943"); |
| | | balanceAcctListResp = BalanceAcctExample.retrieveByUserId(balanceAcctReq); |
| | | System.err.println(balanceAcctListResp); |
| | | } catch (UpyztException e) { |
| | | log.error("电子账簿查询失败:{}",e.getMessage()); |
| | | e.printStackTrace(); |
| | | } |
| | | log.info("电子账簿查询完成=========:{}",balanceAcctListResp); |
| | | } |
| | | |
| | | // @ResponseBody |
| | | // @RequestMapping(value = "/api/placeOrder/tiXian", method = RequestMethod.POST) |
| | | // @ApiOperation(value = "提现", tags = {"提现"}, notes = "") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | // }) |
| | | public void tiXian(){ |
| | | WithdrawalResp balanceAcctResp = null; |
| | | try { |
| | | |
| | | /*params.put("out_order_no", withdrawalReq.getOutOrderNo()); |
| | | params.put("amount", withdrawalReq.getAmount()); |
| | | params.put("balance_acct_id", withdrawalReq.getBalanceAcctId()); |
| | | params.put("bank_acct_no", Upyzt.encryptField(withdrawalReq.getBankAcctNo())); |
| | | params.put("password", Upyzt.encryptField(withdrawalReq.getPassword()));*/ |
| | | WithdrawalReq withdrawalReq = new WithdrawalReq(); |
| | | withdrawalReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | withdrawalReq.setAmount(1); |
| | | withdrawalReq.setBalanceAcctId("2007942320163036794"); |
| | | withdrawalReq.setBankAcctNo("149245719387"); |
| | | withdrawalReq.setPassword("123456"); |
| | | balanceAcctResp = WithdrawalExample.create(withdrawalReq); |
| | | System.err.println(balanceAcctResp); |
| | | } catch (UpyztException e) { |
| | | System.err.println("提现失败:{}"+e.getMessage()); |
| | | e.printStackTrace(); |
| | | } |
| | | log.info("提现完成=========:{}",balanceAcctResp); |
| | | } |
| | | |
| | | // @ResponseBody |
| | | // @RequestMapping(value = "/api/placeOrder/tiXianQuery", method = RequestMethod.POST) |
| | | // @ApiOperation(value = "提现查询", tags = {"提现查询"}, notes = "") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | // }) |
| | | public void tiXianQuery(){ |
| | | WithdrawalResp balanceAcctResp = null; |
| | | try { |
| | | balanceAcctResp = WithdrawalExample.retrieveById("3708203534784717899"); |
| | | System.err.println(balanceAcctResp); |
| | | } catch (UpyztException e) { |
| | | System.err.println("提现失败:{}"+e.getMessage()); |
| | | e.printStackTrace(); |
| | | } |
| | | log.info("提现完成=========:{}",balanceAcctResp); |
| | | } |
| | | |
| | | } |