| | |
| | | |
| | | @FeignClient(value = "mb-cloud-other") |
| | | public interface StoreClient { |
| | | |
| | | /** |
| | | * 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/getProportionByOperatorId") |
| | | String getProportionByOperatorId(Integer id); |
| | | /** |
| | | * 根据运营商id获取对应运营商商户号 |
| | | * @return |
| | |
| | | records.setPayTime(new Date()); |
| | | records.setOrderNumber(tradeNo); |
| | | rereMapper.updateById(records); |
| | | |
| | | payMoneyUtil.confirm(smid,code,tradeNo,amount.toString()); |
| | | RechargeRecords rechargeRecords = rereMapper.selectOne(new QueryWrapper<RechargeRecords>() |
| | | .eq("code", code)); |
| | | if (rechargeRecords.getPayStatus() == 2) { |
| | |
| | | user.setIntegral(user.getIntegral() - userCouponPayment1.getIntegral().intValue()); |
| | | appUserService.updateById(user); |
| | | } |
| | | |
| | | payMoneyUtil.confirm(smid,code,tradeNo,cash.toString()); |
| | | break; |
| | | |
| | |
| | | userPointsMerchandise.setInsertTime(null); |
| | | userPointsMerchandise.setUserId(null); |
| | | mcClient.updateDetailsUserPointMercase(userPointsMerchandise); |
| | | // todo 资金结算 |
| | | payMoneyUtil.confirm(smid,code,tradeNo,cash.toString()); |
| | | } |
| | | moneyOut(tradeNo, tradeNo); |
| | | break; |
| | |
| | | package com.dsh.account.service.impl; |
| | | |
| | | import com.alipay.api.AlipayClient; |
| | | import com.alipay.api.DefaultAlipayClient; |
| | | import com.alipay.api.request.AlipayTradeOrderSettleRequest; |
| | | import com.alipay.api.response.AlipayTradeOrderSettleResponse; |
| | | import com.alipay.api.response.AlipayTradeQueryResponse; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | Integer storeId = coursePackage.getStoreId(); |
| | | Store store = storeClient.queryStoreById(storeId); |
| | | String smid1= ""; |
| | | if (store.getOperatorId()==null){ |
| | | if (store.getOperatorId()==null || store.getOperatorId() == 0){ |
| | | // 平台 |
| | | smid1 = smid; |
| | | // 属于平台 不做资金冻结 不做分账处理 |
| | | payMoneyUtil.confirm(smid1,code,tradeNo,amount.toString()); |
| | | }else{ |
| | | String smidByOperatorId = storeClient.getSMIDByOperatorId(store.getOperatorId()); |
| | | smid1 = smidByOperatorId; |
| | | payMoneyUtil.confirm1(smid1,code,tradeNo,amount.toString()); |
| | | // 分账处理 |
| | | extracted(store.getOperatorId(), amount, tradeNo); |
| | | } |
| | | payMoneyUtil.confirm(smid1,code,tradeNo,amount.toString()); |
| | | |
| | | break; |
| | | } |
| | | if ("WAIT_BUYER_PAY".equals(tradeStatus)) { |
| | |
| | | } |
| | | return alipay; |
| | | } |
| | | |
| | | private void extracted(Integer operatorId, BigDecimal coursePackageOrder1, String tradeNo) throws Exception { |
| | | // 分账 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", |
| | | "2021004105665036", |
| | | "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCi5i9nW/hGLJ3A06cZxTQdviFC7THpdSihoTYGLr9q006hu0V26ecBMY/o4w5bvIX0Ok/yofmZsVcCJpAPvbXL/uqVrIjnRRxXiaeBFThlxoBUTdunvbUSDYfzlEhJr5NvUKI6H6lz2niXlQGx4qy8Hau4ccWit9kM8jwUvsBVQoFgJA+xrjMvooA7YLopQtpOD+UJr5thApTSf1xrnr1W12yolTLEH15JmNV372cqXrYUuqnY0QsaPtxeqJUGAOcGdVLllQ7easEznP8DFBvDdHATcmp2SHNQDUEWN6MCVPbMgY06NQVqAXxqjTAYSVh+6TRu6bofPmpYC3TZB003AgMBAAECggEBAJAcR2+PA3NBYUYHeFrqBRMS8uX8ZR19kjZ7IgoSLTFaQsP9opRylPSPXhrPVBKAE5leRQAHn4MCSlESwHvMfxo7KFjFTFAc6dffZZpipYQUOc9bGampwJh58/3e/pyBgVMG6J23CPf/HJQtNFSkjd/V9+ayb/9l2dUEL3bC0fAZ/dbx8HsxdLw8wn3fLlWLj68hOMqa2deCZe3JdSVsPbeWqkh56FFsMLug0Nd+Ar4TgRl9/jnhXF0JWiD0LmPUYLhboY7EfUBzN4w1iYbDi1P+3zvoOYsiVKAXox9GMhQ2VzOO2UcSTuizSza2e98mGpabl/GpKmCz+RDFjtkX6eECgYEA2MyCij65eO3aGIm3FUe93DULRBYTfX8qJQSJq2WOWA3mmQlEW6L3O2B5/lG2h+8WmN6iLEs9eHpgycGYp7vAqgrANEn16ACVcuyx0scFtrZfZ+kmHMzFfiUWxJjVYk/6YngsGVBLdw6ueM42C8TTP67X9tU5TdVGoGWuqEj4W98CgYEAwFqwprXOch5Pqk/RPbb49r0Ou03K/UbciWnWWKzUhFFNS8MdlQPoDvQZbMwHLeWsa2VhaKITK3x5biLQb3U+0GLOn6lTvEyrEUH+ucREyLgVYTRAvwBPtnvlrzpyxPk2HnslQjju8WrvvLLBMKWUjlTrTOzhaHT21gz3pHMiOakCgYEAhLmfaXdBITGshb054sNLDtdCkGpbgEcrzAHdLps769iGxkYQHXHFngpQZUwtTUcoNGqIKknd1jZFrv7gsD+XkgKG7PwimehRlkwmCX5ilxtLiVgJRzRt6+5U5AMVD90a0tHzXYP0z2yjj73fBJF5KtGl0a10KZxaYrQdm1UhB00CgYBZZgzx/k9rtHC8LAqIj1CYhHejT92G53c6Gkl3vyOqN4sgKhfGmSEySfrDGPRBPZxr8ZtbIPCd5mUdberH0osWGMYFaJI1UsCy7aQwvGpniz7MhZeN7dweaOjwDs8mgtjHQ96mL4XGCDhR0BZ/wIURvZ/6iaGdhbbu9unlsWj3uQKBgQCmZYdsbbZkd3ev6f8rwyvMz+DrCQyYpY44cegBYuJgrZiQnL2fJioeN7ixX0UM48SfwsZEIrzshP/LGAwnc2MdjxKUl4jLN8SEe0NAjXOnz9Zaw740+aOmLpXcLWdP4uM2gIhWsvW1tEkQZCXmm7c9s/RsU8Pmzv+YL3+fSijOzA==", |
| | | "json", "GBK", |
| | | "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB", |
| | | "RSA2"); |
| | | AlipayTradeOrderSettleRequest request = new AlipayTradeOrderSettleRequest(); |
| | | String randomCode = UUIDUtil.getRandomCode(16); |
| | | String proportionByOperatorId1 = storeClient.getProportionByOperatorId(operatorId); |
| | | // 支付宝分账比例 |
| | | String s1 = proportionByOperatorId1.split(",")[1]; |
| | | double i = Double.parseDouble(s1); |
| | | double v = i * 0.01; |
| | | BigDecimal bigDecimal1 = new BigDecimal(String.valueOf(v)); |
| | | // 分账金额 |
| | | BigDecimal bigDecimal2 = coursePackageOrder1.multiply(bigDecimal1).setScale(2, RoundingMode.DOWN); |
| | | request.setBizContent("{" + |
| | | " \"out_request_no\":\"" + randomCode + "\"," + |
| | | " \"trade_no\":\"" + tradeNo + "\"," + |
| | | " \"royalty_parameters\":[" + |
| | | " {" + |
| | | " \"royalty_type\":\"transfer\"," + |
| | | " \"trans_out\":\"" + storeClient.getSMIDByOperatorId(operatorId)+ "\"," + |
| | | " \"trans_out_type\":\"userId\"," + |
| | | " \"trans_in_type\":\"userId\"," + |
| | | " \"trans_in\":\"" + smid + "\"," + |
| | | " \"amount\":" + bigDecimal2 + "," + |
| | | " \"desc\":\"平台服务费\"," + |
| | | " \"royalty_scene\":\"平台服务费\"," + |
| | | " }" + |
| | | " ]," + |
| | | " \"extend_params\":{" + |
| | | " \"royalty_finish\":\"true\"" + |
| | | " }," + |
| | | " \"royalty_mode\":\"async\"" + |
| | | "}"); |
| | | AlipayTradeOrderSettleResponse response = alipayClient.execute(request); |
| | | if (response.isSuccess()) { |
| | | System.out.println("调用成功"); |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | } |
| | | } |
| | | public int PlaypaiGoldPayment(String code, ClasspaymentRequest request) { |
| | | PlayPaiGoldCoursePackage paiGoldCoursePackage = new PlayPaiGoldCoursePackage(); |
| | | paiGoldCoursePackage.setCoursePackageId(request.getLessonId()); |
| | |
| | | return ResultUtil.error("出现问题啦"); |
| | | } |
| | | } |
| | | |
| | | // 资金冻结 做分账处理 |
| | | public ResultUtil confirm1(String smid,String code, String outTradeNo, String amount) { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", |
| | | aliAppid, |
| | | appPrivateKey, |
| | | "json", |
| | | "GBK", |
| | | alipay_public_key, |
| | | "RSA2"); |
| | | AlipayTradeSettleConfirmRequest request = new AlipayTradeSettleConfirmRequest(); |
| | | request.setBizContent("{" + |
| | | " \"out_request_no\":\""+code+"\"," + |
| | | " \"trade_no\":\""+outTradeNo+"\"," + |
| | | " \"settle_info\":{" + |
| | | " \"settle_detail_infos\":[" + |
| | | " {" + |
| | | " \"trans_in_type\":\"defaultSettle\"," + |
| | | " \"settle_entity_id\":\""+smid+"\"," + |
| | | " \"settle_entity_type\":\"SecondMerchant\"," + |
| | | " \"amount\":"+amount+"," + |
| | | " }" + |
| | | " ]" + |
| | | " }," + |
| | | " \"extend_params\":{" + |
| | | " \"royalty_freeze\":\"true\"" + |
| | | " }" + |
| | | "}"); |
| | | AlipayTradeSettleConfirmResponse response = null; |
| | | try { |
| | | response = alipayClient.execute(request); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if(response.isSuccess()){ |
| | | System.out.println("调用成功"); |
| | | return ResultUtil.success(); |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | return ResultUtil.error("出现问题啦"); |
| | | } |
| | | } |
| | | /** |
| | | * 支付成功后的回调处理逻辑 |
| | | * |
| | |
| | | @FeignClient("mb-cloud-other") |
| | | public interface StoreClient { |
| | | /** |
| | | * 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/getProportionByOperatorId") |
| | | String getProportionByOperatorId(Integer id); |
| | | /** |
| | | * 根据运营商id获取对应运营商商户号 |
| | | * @return |
| | | */ |
| | |
| | | // 判断当前赛事属于哪个运营商 |
| | | Competition byId = competitionService.getById(paymentCompetitionVo.getId()); |
| | | Integer operatorId = byId.getOperatorId(); |
| | | if (operatorId == null ){ |
| | | if (operatorId == null || operatorId == 0 ){ |
| | | // 说明是平台 |
| | | return aliPaymentCompetition(smid,code, money); |
| | | return aliPaymentCompetition(operatorId,smid,code, money); |
| | | } |
| | | // 获取该运营商的商户号 |
| | | String smid = storeClient.getSMIDByOperatorId(operatorId); |
| | | return aliPaymentCompetition(smid,code, money); |
| | | return aliPaymentCompetition(operatorId,smid,code, money); |
| | | } |
| | | if (paymentCompetitionVo.getPayType() == 3) {//玩湃币 |
| | | appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() - money.intValue()); |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil aliPaymentCompetition(String smid,String code, BigDecimal money) throws Exception { |
| | | public ResultUtil aliPaymentCompetition(Integer operatorId,String smid,String code, BigDecimal money) throws Exception { |
| | | ResultUtil alipay = payMoneyUtil.alipay |
| | | (smid,"报名赛事", "", "", code, money.toString(), "/base/competition/aliPaymentCompetitionCallback"); |
| | | if (alipay.getCode() == 200) { |
| | |
| | | paymentCompetition.setPayTime(new Date()); |
| | | paymentCompetition.setPayOrderNo(tradeNo); |
| | | paymentCompetitionService.updateById(paymentCompetition); |
| | | if (operatorId == null || operatorId == 0){ |
| | | // 属于平台的赛事 资金不做冻结 不做分账处理 |
| | | payMoneyUtil.confirm1(smid,code,tradeNo,money.toString()); |
| | | }else{ |
| | | // 资金冻结 |
| | | payMoneyUtil.confirm(smid,code,tradeNo,money.toString()); |
| | | // 分账处理 |
| | | extracted(operatorId, money, tradeNo); |
| | | } |
| | | // 结算资金到商户账号 |
| | | payMoneyUtil.confirm(smid,code,tradeNo,money.toString()); |
| | | //分账 |
| | | // moneyOut(tradeNo, tradeNo,code); |
| | | break; |
| | |
| | | } |
| | | return alipay; |
| | | } |
| | | |
| | | private void extracted(Integer operatorId, BigDecimal money, String tradeNo) throws Exception { |
| | | // 分账 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", |
| | | "2021004105665036", |
| | | "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCi5i9nW/hGLJ3A06cZxTQdviFC7THpdSihoTYGLr9q006hu0V26ecBMY/o4w5bvIX0Ok/yofmZsVcCJpAPvbXL/uqVrIjnRRxXiaeBFThlxoBUTdunvbUSDYfzlEhJr5NvUKI6H6lz2niXlQGx4qy8Hau4ccWit9kM8jwUvsBVQoFgJA+xrjMvooA7YLopQtpOD+UJr5thApTSf1xrnr1W12yolTLEH15JmNV372cqXrYUuqnY0QsaPtxeqJUGAOcGdVLllQ7easEznP8DFBvDdHATcmp2SHNQDUEWN6MCVPbMgY06NQVqAXxqjTAYSVh+6TRu6bofPmpYC3TZB003AgMBAAECggEBAJAcR2+PA3NBYUYHeFrqBRMS8uX8ZR19kjZ7IgoSLTFaQsP9opRylPSPXhrPVBKAE5leRQAHn4MCSlESwHvMfxo7KFjFTFAc6dffZZpipYQUOc9bGampwJh58/3e/pyBgVMG6J23CPf/HJQtNFSkjd/V9+ayb/9l2dUEL3bC0fAZ/dbx8HsxdLw8wn3fLlWLj68hOMqa2deCZe3JdSVsPbeWqkh56FFsMLug0Nd+Ar4TgRl9/jnhXF0JWiD0LmPUYLhboY7EfUBzN4w1iYbDi1P+3zvoOYsiVKAXox9GMhQ2VzOO2UcSTuizSza2e98mGpabl/GpKmCz+RDFjtkX6eECgYEA2MyCij65eO3aGIm3FUe93DULRBYTfX8qJQSJq2WOWA3mmQlEW6L3O2B5/lG2h+8WmN6iLEs9eHpgycGYp7vAqgrANEn16ACVcuyx0scFtrZfZ+kmHMzFfiUWxJjVYk/6YngsGVBLdw6ueM42C8TTP67X9tU5TdVGoGWuqEj4W98CgYEAwFqwprXOch5Pqk/RPbb49r0Ou03K/UbciWnWWKzUhFFNS8MdlQPoDvQZbMwHLeWsa2VhaKITK3x5biLQb3U+0GLOn6lTvEyrEUH+ucREyLgVYTRAvwBPtnvlrzpyxPk2HnslQjju8WrvvLLBMKWUjlTrTOzhaHT21gz3pHMiOakCgYEAhLmfaXdBITGshb054sNLDtdCkGpbgEcrzAHdLps769iGxkYQHXHFngpQZUwtTUcoNGqIKknd1jZFrv7gsD+XkgKG7PwimehRlkwmCX5ilxtLiVgJRzRt6+5U5AMVD90a0tHzXYP0z2yjj73fBJF5KtGl0a10KZxaYrQdm1UhB00CgYBZZgzx/k9rtHC8LAqIj1CYhHejT92G53c6Gkl3vyOqN4sgKhfGmSEySfrDGPRBPZxr8ZtbIPCd5mUdberH0osWGMYFaJI1UsCy7aQwvGpniz7MhZeN7dweaOjwDs8mgtjHQ96mL4XGCDhR0BZ/wIURvZ/6iaGdhbbu9unlsWj3uQKBgQCmZYdsbbZkd3ev6f8rwyvMz+DrCQyYpY44cegBYuJgrZiQnL2fJioeN7ixX0UM48SfwsZEIrzshP/LGAwnc2MdjxKUl4jLN8SEe0NAjXOnz9Zaw740+aOmLpXcLWdP4uM2gIhWsvW1tEkQZCXmm7c9s/RsU8Pmzv+YL3+fSijOzA==", |
| | | "json", "GBK", |
| | | "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB", |
| | | "RSA2"); |
| | | AlipayTradeOrderSettleRequest request = new AlipayTradeOrderSettleRequest(); |
| | | String randomCode = UUIDUtil.getRandomCode(16); |
| | | String proportionByOperatorId = storeClient.getProportionByOperatorId(operatorId); |
| | | // 支付宝分账比例 |
| | | String s1 = proportionByOperatorId.split(",")[1]; |
| | | double i = Double.parseDouble(s1); |
| | | double v = i * 0.01; |
| | | BigDecimal bigDecimal1 = new BigDecimal(String.valueOf(v)); |
| | | BigDecimal cashPayment = money; |
| | | // 分账金额 |
| | | BigDecimal bigDecimal2 = cashPayment.multiply(bigDecimal1).setScale(2, RoundingMode.DOWN); |
| | | request.setBizContent("{" + |
| | | " \"out_request_no\":\"" + randomCode + "\"," + |
| | | " \"trade_no\":\"" + tradeNo + "\"," + |
| | | " \"royalty_parameters\":[" + |
| | | " {" + |
| | | " \"royalty_type\":\"transfer\"," + |
| | | " \"trans_out\":\"" + storeClient.getSMIDByOperatorId(operatorId) + "\"," + |
| | | " \"trans_out_type\":\"userId\"," + |
| | | " \"trans_in_type\":\"userId\"," + |
| | | " \"trans_in\":\"" + smid + "\"," + |
| | | " \"amount\":" + bigDecimal2 + "," + |
| | | " \"desc\":\"平台服务费\"," + |
| | | " \"royalty_scene\":\"平台服务费\"," + |
| | | " }" + |
| | | " ]," + |
| | | " \"extend_params\":{" + |
| | | " \"royalty_finish\":\"true\"" + |
| | | " }," + |
| | | " \"royalty_mode\":\"async\"" + |
| | | "}"); |
| | | AlipayTradeOrderSettleResponse response = alipayClient.execute(request); |
| | | if (response.isSuccess()) { |
| | | System.out.println("调用成功"); |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | } |
| | | } |
| | | // @Autowired |
| | | //private IPaymentCompetitionService paymentCompetitionService; |
| | | |
| | |
| | | " ]" + |
| | | " }," + |
| | | " \"extend_params\":{" + |
| | | " \"royalty_freeze\":\"true\"" + |
| | | " }" + |
| | | "}"); |
| | | AlipayTradeSettleConfirmResponse response = null; |
| | | try { |
| | | response = alipayClient.execute(request); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if(response.isSuccess()){ |
| | | System.out.println("调用成功"); |
| | | return ResultUtil.success(); |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | return ResultUtil.error("出现问题啦"); |
| | | } |
| | | } |
| | | // 属于平台的运营商 因为无需分账不冻结资金 |
| | | public ResultUtil confirm1(String smid,String code, String outTradeNo, String amount) { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", |
| | | aliAppid, |
| | | appPrivateKey, |
| | | "json", |
| | | "GBK", |
| | | alipay_public_key, |
| | | "RSA2"); |
| | | AlipayTradeSettleConfirmRequest request = new AlipayTradeSettleConfirmRequest(); |
| | | request.setBizContent("{" + |
| | | " \"out_request_no\":\""+code+"\"," + |
| | | " \"trade_no\":\""+outTradeNo+"\"," + |
| | | " \"settle_info\":{" + |
| | | " \"settle_detail_infos\":[" + |
| | | " {" + |
| | | " \"trans_in_type\":\"defaultSettle\"," + |
| | | " \"settle_entity_id\":\""+smid+"\"," + |
| | | " \"settle_entity_type\":\"SecondMerchant\"," + |
| | | " \"amount\":"+amount+"," + |
| | | " }" + |
| | | " ]" + |
| | | " }," + |
| | | " \"extend_params\":{" + |
| | | " \"royalty_freeze\":\"false\"" + |
| | | " }" + |
| | | "}"); |
| | |
| | | return ResultUtil.error("出现问题啦"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 微信统一下单 |
| | | * |
| | |
| | | */ |
| | | @FeignClient("mb-cloud-other") |
| | | public interface StoreClient { |
| | | /** |
| | | * 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/getProportionByOperatorId") |
| | | String getProportionByOperatorId(Integer id); |
| | | |
| | | /** |
| | | * 根据运营商id获取对应运营商商户号 |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.alipay.api.AlipayClient; |
| | | import com.alipay.api.DefaultAlipayClient; |
| | | import com.alipay.api.domain.Person; |
| | | import com.alipay.api.request.AlipayTradeOrderSettleRequest; |
| | | import com.alipay.api.response.AlipayTradeOrderSettleResponse; |
| | | import com.alipay.api.response.AlipayTradeQueryResponse; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.persistence.criteria.CriteriaBuilder; |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | |
| | | } |
| | | private String smid = "2088330203191220";//平台支付宝商户号 |
| | | |
| | | public static void main(String[] args) { |
| | | BigDecimal bigDecimal = new BigDecimal("100"); |
| | | |
| | | |
| | | String s = "1"; |
| | | double v = Double.parseDouble(s); |
| | | double v1 = v * 0.01; |
| | | |
| | | BigDecimal bigDecimal1 = new BigDecimal(String.valueOf(v1)); |
| | | BigDecimal multiply = bigDecimal1.multiply(bigDecimal); |
| | | System.err.println(v); |
| | | System.err.println(v1); |
| | | System.err.println(multiply); |
| | | } |
| | | public ResultUtil AlipayPayment(String code, BigDecimal request) { |
| | | // 二级商户商户号 |
| | | String smidUser; |
| | | TCoursePackagePaymentMapper baseMapper1 = this.baseMapper; |
| | | TCoursePackagePayment coursePackagePayment = baseMapper1.getCoursePackagePaymentByCode(code); |
| | | // 判断这个课包属于哪个门店 属于哪个运营商 根据运营商 id 获取对应的商户号 |
| | |
| | | TCoursePackage byId = coursePackageService.getById(coursePackageId); |
| | | Store store = storeClient.queryStoreById(byId.getStoreId()); |
| | | if (store.getOperatorId() == null ){ |
| | | // 说明是平台的门店 |
| | | payMoneyUtil.confirm(smid,code,tradeNo,request.toString()); |
| | | // 说明是平台的门店 无需冻结资金 不走分账 |
| | | payMoneyUtil.confirm1(smid,code,tradeNo,request.toString()); |
| | | }else if (store.getOperatorId() == 0){ |
| | | payMoneyUtil.confirm(smid,code,tradeNo,request.toString()); |
| | | // 说明是平台的门店 |
| | | payMoneyUtil.confirm1(smid,code,tradeNo,request.toString()); |
| | | // 发起分账 |
| | | extracted(store, coursePackageOrder1, tradeNo); |
| | | }else{ |
| | | String smid = storeClient.getSMIDByOperatorId(store.getOperatorId()); |
| | | payMoneyUtil.confirm(smid,code,tradeNo,request.toString()); |
| | | payMoneyUtil.confirm(storeClient.getSMIDByOperatorId(store.getOperatorId()),code,tradeNo,request.toString()); |
| | | // 发起分账 |
| | | extracted(store, coursePackageOrder1, tradeNo); |
| | | } |
| | | break; |
| | | } |
| | |
| | | return alipay; |
| | | } |
| | | |
| | | private void extracted(Store store, CoursePackageOrder coursePackageOrder1, String tradeNo) throws Exception { |
| | | // 分账 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", |
| | | "2021004105665036", |
| | | "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCi5i9nW/hGLJ3A06cZxTQdviFC7THpdSihoTYGLr9q006hu0V26ecBMY/o4w5bvIX0Ok/yofmZsVcCJpAPvbXL/uqVrIjnRRxXiaeBFThlxoBUTdunvbUSDYfzlEhJr5NvUKI6H6lz2niXlQGx4qy8Hau4ccWit9kM8jwUvsBVQoFgJA+xrjMvooA7YLopQtpOD+UJr5thApTSf1xrnr1W12yolTLEH15JmNV372cqXrYUuqnY0QsaPtxeqJUGAOcGdVLllQ7easEznP8DFBvDdHATcmp2SHNQDUEWN6MCVPbMgY06NQVqAXxqjTAYSVh+6TRu6bofPmpYC3TZB003AgMBAAECggEBAJAcR2+PA3NBYUYHeFrqBRMS8uX8ZR19kjZ7IgoSLTFaQsP9opRylPSPXhrPVBKAE5leRQAHn4MCSlESwHvMfxo7KFjFTFAc6dffZZpipYQUOc9bGampwJh58/3e/pyBgVMG6J23CPf/HJQtNFSkjd/V9+ayb/9l2dUEL3bC0fAZ/dbx8HsxdLw8wn3fLlWLj68hOMqa2deCZe3JdSVsPbeWqkh56FFsMLug0Nd+Ar4TgRl9/jnhXF0JWiD0LmPUYLhboY7EfUBzN4w1iYbDi1P+3zvoOYsiVKAXox9GMhQ2VzOO2UcSTuizSza2e98mGpabl/GpKmCz+RDFjtkX6eECgYEA2MyCij65eO3aGIm3FUe93DULRBYTfX8qJQSJq2WOWA3mmQlEW6L3O2B5/lG2h+8WmN6iLEs9eHpgycGYp7vAqgrANEn16ACVcuyx0scFtrZfZ+kmHMzFfiUWxJjVYk/6YngsGVBLdw6ueM42C8TTP67X9tU5TdVGoGWuqEj4W98CgYEAwFqwprXOch5Pqk/RPbb49r0Ou03K/UbciWnWWKzUhFFNS8MdlQPoDvQZbMwHLeWsa2VhaKITK3x5biLQb3U+0GLOn6lTvEyrEUH+ucREyLgVYTRAvwBPtnvlrzpyxPk2HnslQjju8WrvvLLBMKWUjlTrTOzhaHT21gz3pHMiOakCgYEAhLmfaXdBITGshb054sNLDtdCkGpbgEcrzAHdLps769iGxkYQHXHFngpQZUwtTUcoNGqIKknd1jZFrv7gsD+XkgKG7PwimehRlkwmCX5ilxtLiVgJRzRt6+5U5AMVD90a0tHzXYP0z2yjj73fBJF5KtGl0a10KZxaYrQdm1UhB00CgYBZZgzx/k9rtHC8LAqIj1CYhHejT92G53c6Gkl3vyOqN4sgKhfGmSEySfrDGPRBPZxr8ZtbIPCd5mUdberH0osWGMYFaJI1UsCy7aQwvGpniz7MhZeN7dweaOjwDs8mgtjHQ96mL4XGCDhR0BZ/wIURvZ/6iaGdhbbu9unlsWj3uQKBgQCmZYdsbbZkd3ev6f8rwyvMz+DrCQyYpY44cegBYuJgrZiQnL2fJioeN7ixX0UM48SfwsZEIrzshP/LGAwnc2MdjxKUl4jLN8SEe0NAjXOnz9Zaw740+aOmLpXcLWdP4uM2gIhWsvW1tEkQZCXmm7c9s/RsU8Pmzv+YL3+fSijOzA==", |
| | | "json", "GBK", |
| | | "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB", |
| | | "RSA2"); |
| | | AlipayTradeOrderSettleRequest request = new AlipayTradeOrderSettleRequest(); |
| | | String randomCode = UUIDUtil.getRandomCode(16); |
| | | String proportionByOperatorId = storeClient.getProportionByOperatorId(store.getOperatorId()); |
| | | // 支付宝分账比例 |
| | | String s1 = proportionByOperatorId.split(",")[1]; |
| | | double i = Double.parseDouble(s1); |
| | | double v = i * 0.01; |
| | | BigDecimal bigDecimal1 = new BigDecimal(String.valueOf(v)); |
| | | BigDecimal cashPayment = coursePackageOrder1.getCashPayment(); |
| | | // 分账金额 |
| | | BigDecimal bigDecimal2 = cashPayment.multiply(bigDecimal1).setScale(2, RoundingMode.DOWN); |
| | | request.setBizContent("{" + |
| | | " \"out_request_no\":\"" + randomCode + "\"," + |
| | | " \"trade_no\":\"" + tradeNo + "\"," + |
| | | " \"royalty_parameters\":[" + |
| | | " {" + |
| | | " \"royalty_type\":\"transfer\"," + |
| | | " \"trans_out\":\"" + storeClient.getSMIDByOperatorId(store.getOperatorId()) + "\"," + |
| | | " \"trans_out_type\":\"userId\"," + |
| | | " \"trans_in_type\":\"userId\"," + |
| | | " \"trans_in\":\"" + smid + "\"," + |
| | | " \"amount\":" + bigDecimal2 + "," + |
| | | " \"desc\":\"平台服务费\"," + |
| | | " \"royalty_scene\":\"平台服务费\"," + |
| | | " }" + |
| | | " ]," + |
| | | " \"extend_params\":{" + |
| | | " \"royalty_finish\":\"true\"" + |
| | | " }," + |
| | | " \"royalty_mode\":\"async\"" + |
| | | "}"); |
| | | AlipayTradeOrderSettleResponse response = alipayClient.execute(request); |
| | | if (response.isSuccess()) { |
| | | System.out.println("调用成功"); |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | } |
| | | } |
| | | |
| | | public ResultUtil PlaypaiGoldPayment(AppUser appUser, String code, Integer wpGold) { |
| | | TCoursePackagePayment packagePayment = this.baseMapper.selectOne(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("code", code)); |
| | |
| | | Integer operatorId = store.getOperatorId(); |
| | | if (operatorId==null){ |
| | | String smid ="2088330203191220"; |
| | | // 说明是平台的 |
| | | payMoneyUtil.confirm(smid,finalCode,tradeNo,paymentPrice.toString()); |
| | | // 说明是平台的 不走分账 |
| | | // payMoneyUtil.confirm(smid,finalCode,tradeNo,paymentPrice.toString()); |
| | | payMoneyUtil.confirm1(smid,finalCode,tradeNo,paymentPrice.toString()); |
| | | break; |
| | | }else if (operatorId==0){ |
| | | String smid ="2088330203191220"; |
| | | // 说明是平台的 |
| | | payMoneyUtil.confirm(smid,finalCode,tradeNo,paymentPrice.toString()); |
| | | payMoneyUtil.confirm1(smid,finalCode,tradeNo,paymentPrice.toString()); |
| | | break; |
| | | }else{ |
| | | // 当前课程不属于门店 查询这个课程属于哪个门店 属于哪个运营商 |
| | | String smidByOperatorId = storeClient.getSMIDByOperatorId(operatorId); |
| | | payMoneyUtil.confirm(smidByOperatorId,finalCode,tradeNo,paymentPrice.toString()); |
| | | // 分账处理 |
| | | extracted(store, coursePackageOrder1, tradeNo); |
| | | break; |
| | | } |
| | | } |
| | |
| | | return alipay; |
| | | } |
| | | |
| | | |
| | | private void extracted(Store store, CoursePackageOrder coursePackageOrder1, String tradeNo) throws Exception { |
| | | // 分账 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", |
| | | "2021004105665036", |
| | | "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCi5i9nW/hGLJ3A06cZxTQdviFC7THpdSihoTYGLr9q006hu0V26ecBMY/o4w5bvIX0Ok/yofmZsVcCJpAPvbXL/uqVrIjnRRxXiaeBFThlxoBUTdunvbUSDYfzlEhJr5NvUKI6H6lz2niXlQGx4qy8Hau4ccWit9kM8jwUvsBVQoFgJA+xrjMvooA7YLopQtpOD+UJr5thApTSf1xrnr1W12yolTLEH15JmNV372cqXrYUuqnY0QsaPtxeqJUGAOcGdVLllQ7easEznP8DFBvDdHATcmp2SHNQDUEWN6MCVPbMgY06NQVqAXxqjTAYSVh+6TRu6bofPmpYC3TZB003AgMBAAECggEBAJAcR2+PA3NBYUYHeFrqBRMS8uX8ZR19kjZ7IgoSLTFaQsP9opRylPSPXhrPVBKAE5leRQAHn4MCSlESwHvMfxo7KFjFTFAc6dffZZpipYQUOc9bGampwJh58/3e/pyBgVMG6J23CPf/HJQtNFSkjd/V9+ayb/9l2dUEL3bC0fAZ/dbx8HsxdLw8wn3fLlWLj68hOMqa2deCZe3JdSVsPbeWqkh56FFsMLug0Nd+Ar4TgRl9/jnhXF0JWiD0LmPUYLhboY7EfUBzN4w1iYbDi1P+3zvoOYsiVKAXox9GMhQ2VzOO2UcSTuizSza2e98mGpabl/GpKmCz+RDFjtkX6eECgYEA2MyCij65eO3aGIm3FUe93DULRBYTfX8qJQSJq2WOWA3mmQlEW6L3O2B5/lG2h+8WmN6iLEs9eHpgycGYp7vAqgrANEn16ACVcuyx0scFtrZfZ+kmHMzFfiUWxJjVYk/6YngsGVBLdw6ueM42C8TTP67X9tU5TdVGoGWuqEj4W98CgYEAwFqwprXOch5Pqk/RPbb49r0Ou03K/UbciWnWWKzUhFFNS8MdlQPoDvQZbMwHLeWsa2VhaKITK3x5biLQb3U+0GLOn6lTvEyrEUH+ucREyLgVYTRAvwBPtnvlrzpyxPk2HnslQjju8WrvvLLBMKWUjlTrTOzhaHT21gz3pHMiOakCgYEAhLmfaXdBITGshb054sNLDtdCkGpbgEcrzAHdLps769iGxkYQHXHFngpQZUwtTUcoNGqIKknd1jZFrv7gsD+XkgKG7PwimehRlkwmCX5ilxtLiVgJRzRt6+5U5AMVD90a0tHzXYP0z2yjj73fBJF5KtGl0a10KZxaYrQdm1UhB00CgYBZZgzx/k9rtHC8LAqIj1CYhHejT92G53c6Gkl3vyOqN4sgKhfGmSEySfrDGPRBPZxr8ZtbIPCd5mUdberH0osWGMYFaJI1UsCy7aQwvGpniz7MhZeN7dweaOjwDs8mgtjHQ96mL4XGCDhR0BZ/wIURvZ/6iaGdhbbu9unlsWj3uQKBgQCmZYdsbbZkd3ev6f8rwyvMz+DrCQyYpY44cegBYuJgrZiQnL2fJioeN7ixX0UM48SfwsZEIrzshP/LGAwnc2MdjxKUl4jLN8SEe0NAjXOnz9Zaw740+aOmLpXcLWdP4uM2gIhWsvW1tEkQZCXmm7c9s/RsU8Pmzv+YL3+fSijOzA==", |
| | | "json", "GBK", |
| | | "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB", |
| | | "RSA2"); |
| | | AlipayTradeOrderSettleRequest request = new AlipayTradeOrderSettleRequest(); |
| | | String randomCode = UUIDUtil.getRandomCode(16); |
| | | String proportionByOperatorId = storeClient.getProportionByOperatorId(store.getOperatorId()); |
| | | // 支付宝分账比例 |
| | | String s1 = proportionByOperatorId.split(",")[1]; |
| | | double i = Double.parseDouble(s1); |
| | | double v = i * 0.01; |
| | | BigDecimal bigDecimal1 = new BigDecimal(String.valueOf(v)); |
| | | BigDecimal cashPayment = coursePackageOrder1.getCashPayment(); |
| | | // 分账金额 |
| | | BigDecimal bigDecimal2 = cashPayment.multiply(bigDecimal1).setScale(2, RoundingMode.DOWN); |
| | | request.setBizContent("{" + |
| | | " \"out_request_no\":\"" + randomCode + "\"," + |
| | | " \"trade_no\":\"" + tradeNo + "\"," + |
| | | " \"royalty_parameters\":[" + |
| | | " {" + |
| | | " \"royalty_type\":\"transfer\"," + |
| | | " \"trans_out\":\"" + storeClient.getSMIDByOperatorId(store.getOperatorId()) + "\"," + |
| | | " \"trans_out_type\":\"userId\"," + |
| | | " \"trans_in_type\":\"userId\"," + |
| | | " \"trans_in\":\"" + smid + "\"," + |
| | | " \"amount\":" + bigDecimal2 + "," + |
| | | " \"desc\":\"平台服务费\"," + |
| | | " \"royalty_scene\":\"平台服务费\"," + |
| | | " }" + |
| | | " ]," + |
| | | " \"extend_params\":{" + |
| | | " \"royalty_finish\":\"true\"" + |
| | | " }," + |
| | | " \"royalty_mode\":\"async\"" + |
| | | "}"); |
| | | AlipayTradeOrderSettleResponse response = alipayClient.execute(request); |
| | | if (response.isSuccess()) { |
| | | System.out.println("调用成功"); |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | } |
| | | } |
| | | //分账 |
| | | public void moneyOut(String outNum, String tradeNo,String code) throws AlipayApiException { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | |
| | | return ResultUtil.error("出现问题啦"); |
| | | } |
| | | } |
| | | // 属于平台的运营商 因为无需分账不冻结资金 |
| | | public ResultUtil confirm1(String smid,String code, String outTradeNo, String amount) { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", |
| | | aliAppid, |
| | | appPrivateKey, |
| | | "json", |
| | | "GBK", |
| | | alipay_public_key, |
| | | "RSA2"); |
| | | AlipayTradeSettleConfirmRequest request = new AlipayTradeSettleConfirmRequest(); |
| | | request.setBizContent("{" + |
| | | " \"out_request_no\":\""+code+"\"," + |
| | | " \"trade_no\":\""+outTradeNo+"\"," + |
| | | " \"settle_info\":{" + |
| | | " \"settle_detail_infos\":[" + |
| | | " {" + |
| | | " \"trans_in_type\":\"defaultSettle\"," + |
| | | " \"settle_entity_id\":\""+smid+"\"," + |
| | | " \"settle_entity_type\":\"SecondMerchant\"," + |
| | | " \"amount\":"+amount+"," + |
| | | " }" + |
| | | " ]" + |
| | | " }," + |
| | | " \"extend_params\":{" + |
| | | " \"royalty_freeze\":\"false\"" + |
| | | " }" + |
| | | "}"); |
| | | AlipayTradeSettleConfirmResponse response = null; |
| | | try { |
| | | response = alipayClient.execute(request); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if(response.isSuccess()){ |
| | | System.out.println("调用成功"); |
| | | return ResultUtil.success(); |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | return ResultUtil.error("出现问题啦"); |
| | | } |
| | | } |
| | | /** |
| | | * 支付宝支付 |
| | | */ |
| | |
| | | <name>管理后台</name> |
| | | <description>管理后台</description> |
| | | <dependencies> |
| | | <!--微信商户认证图片上传--> |
| | | <dependency> |
| | | <groupId>com.github.wechatpay-apiv3</groupId> |
| | | <artifactId>wechatpay-java</artifactId> |
| | | <version>0.2.12</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.wechatpay-apiv3</groupId> |
| | | <artifactId>wechatpay-apache-httpclient</artifactId> |
| | | <version>0.4.9</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-test</artifactId> |
| | | <version>5.3.9</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>core</artifactId> |
| | | <version>3.4.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>javase</artifactId> |
| | | <version>3.4.1</version> |
| | | </dependency> |
| | | <!--处理json--> |
| | | <dependency> |
| | | <groupId>org.json</groupId> |
| | |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>cn.mb.cloud</groupId> |
| | | <artifactId>mb-cloud-common-sentinel</artifactId> |
| | | <groupId>cn.mb.cloud</groupId> |
| | | <artifactId>mb-cloud-common-sentinel</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | <classifier>jdk15</classifier> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>kaptcha-spring-boot-starter</artifactId> |
| | | <version>1.1.0</version> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>kaptcha-spring-boot-starter</artifactId> |
| | | <version>1.1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.jsonwebtoken</groupId> |
| | |
| | | <version>4.5.0</version> |
| | | </dependency> |
| | | |
| | | |
| | | <!--二维码--> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>core</artifactId> |
| | | <version>3.3.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>javase</artifactId> |
| | | <version>3.3.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | </repositories> |
| | | |
| | | |
| | | </project> |
| | | </project> |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.guns.modular.system.model.CarInsurance; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Mapper |
| | | public interface CarInsuranceMapper extends BaseMapper<CarInsurance> { |
| | | |
| | | |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.guns.modular.system.model.OperatorAuth; |
| | | import com.dsh.guns.modular.system.model.OperatorAuthAlipay; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author administrator |
| | | * @since 2023-09-19 |
| | | */ |
| | | @Mapper |
| | | public interface TOperatorAuthWxMapper extends BaseMapper<OperatorAuth> { |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | |
| | | import com.dsh.course.feignClient.account.model.Coach; |
| | | import com.dsh.course.mapper.TOperatorAuthWxMapper; |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | | import com.dsh.guns.core.common.constant.factory.PageFactory; |
| | | import com.dsh.guns.core.util.SinataUtil; |
| | |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.service.*; |
| | | |
| | | import com.dsh.guns.modular.system.util.AutoUpdateVerifierTest; |
| | | import com.dsh.guns.modular.system.util.HttpRequestUtil; |
| | | import com.dsh.guns.modular.system.util.PayMoneyUtil; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.github.binarywang.wxpay.service.BankService; |
| | | import com.github.binarywang.wxpay.v3.WechatPayUploadHttpPost; |
| | | import com.mysql.cj.x.protobuf.MysqlxExpr; |
| | | import com.sun.org.apache.bcel.internal.generic.NEW; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | |
| | | import javax.crypto.BadPaddingException; |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.IllegalBlockSizeException; |
| | | import javax.crypto.NoSuchPaddingException; |
| | | import javax.security.cert.X509Certificate; |
| | | import java.io.*; |
| | | import java.net.URI; |
| | | import java.net.URISyntaxException; |
| | | import java.net.URL; |
| | | import java.security.InvalidKeyException; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | |
| | | private TOperatorCityService operatorCityService; |
| | | @Autowired |
| | | private IOperatorAuthService operatorAuthService; |
| | | @Autowired |
| | | private IOperatorAuthWxService operatorAuthWxService; |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | @Autowired |
| | |
| | | } |
| | | |
| | | /** |
| | | * 跳转运营商商户去认证页面 |
| | | * 支付宝跳转运营商商户去认证页面 |
| | | */ |
| | | @RequestMapping("/proportionAuth/{id}") |
| | | public String proportionAuth(Model model,@PathVariable("id") Integer id) { |
| | |
| | | return PREFIX + "OperatorUser_proportionAuth.html"; |
| | | } |
| | | /** |
| | | * 跳转运营商商户去认证页面 详情页面 |
| | | * 微信跳转运营商商户去认证页面 |
| | | */ |
| | | @RequestMapping("/proportionAuthWx/{id}") |
| | | public String proportionAuthWx(Model model,@PathVariable("id") Integer id) { |
| | | model.addAttribute("id",id); |
| | | TOperator data = operatorService.getById(id); |
| | | User byId = userService.getById(data.getUserId()); |
| | | model.addAttribute("user",byId); |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",list); |
| | | model.addAttribute("data",data); |
| | | OperatorAuthAlipay info = operatorAuthService.getOne(new QueryWrapper<OperatorAuthAlipay>().eq("operatorId", id)); |
| | | model.addAttribute("item",info); |
| | | |
| | | if (info==null){ |
| | | OperatorAuthAlipay operatorAuth = new OperatorAuthAlipay(); |
| | | model.addAttribute("item",operatorAuth); |
| | | model.addAttribute("bodyType",0); |
| | | model.addAttribute("code",null); |
| | | model.addAttribute("reasons",null); |
| | | // 0不显示二维码 |
| | | model.addAttribute("type",0); |
| | | }else{ |
| | | model.addAttribute("bodyType",info.getBodyType()); |
| | | model.addAttribute("accountType",info.getAccountType()); |
| | | model.addAttribute("useType",info.getUseType()); |
| | | model.addAttribute("cardType",info.getCardType()); |
| | | model.addAttribute("reasons",info.getRefuseReason()); |
| | | // TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, info.getCityCode())); |
| | | // List<TCity> district = cityService.list(new QueryWrapper<TCity>().eq("parent_id", one.getId())); |
| | | // model.addAttribute("district",district); |
| | | // if (info.getOrderStatus().equals("AUDIT_PASS")||info.getOrderStatus().equals("LEGAL_CONFIRM")||info.getOrderStatus().equals("CONTACT_CONFIRM")){ |
| | | // // 通过才展示二维码 |
| | | // model.addAttribute("type",1); |
| | | // }else{ |
| | | // model.addAttribute("type",0); |
| | | // } |
| | | // model.addAttribute("code",info.getQrCode()); |
| | | // model.addAttribute("item",info); |
| | | // model.addAttribute("bodyType",info.getBodyType()); |
| | | // if (info.getRefuseReason()!=null && (!info.getRefuseReason().equals(""))){ |
| | | // model.addAttribute("reasons",info.getRefuseReason()); |
| | | // }else{ |
| | | // model.addAttribute("reasons",null); |
| | | // } |
| | | |
| | | |
| | | } |
| | | return PREFIX + "OperatorUser_proportionAuthWX.html"; |
| | | } |
| | | /** |
| | | * 支付宝跳转运营商商户去认证页面 详情页面 |
| | | */ |
| | | @RequestMapping("/proportionAuth1/{id}") |
| | | public String proportionAuth1(Model model,@PathVariable("id") Integer id) { |
| | |
| | | return PREFIX + "OperatorUser_proportionAuth_info.html"; |
| | | } |
| | | /** |
| | | * 微信跳转运营商商户去认证页面 详情页面 |
| | | */ |
| | | @RequestMapping("/proportionAuth1Wx/{id}") |
| | | public String proportionAuth1Wx(Model model,@PathVariable("id") Integer id) { |
| | | model.addAttribute("id",id); |
| | | TOperator data = operatorService.getById(id); |
| | | User byId = userService.getById(data.getUserId()); |
| | | model.addAttribute("user",byId); |
| | | OperatorUser operatorId = operatorUserService.getOne(new QueryWrapper<OperatorUser>() |
| | | .eq("operatorId", data.getId())); |
| | | model.addAttribute("data",data); |
| | | OperatorAuth info = operatorAuthWxService.getOne(new QueryWrapper<OperatorAuth>() |
| | | .eq("operatorId", id)); |
| | | model.addAttribute("item",info); |
| | | List<TCity> list1 = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list1",list1); |
| | | if (StringUtils.hasLength(info.getProvince())){ |
| | | // 获取银行开户省 |
| | | List<TCity> list4 = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | // 获取银行开户市 |
| | | TCity city = cityService.getOne(new QueryWrapper<TCity>().eq("code", info.getProvinceCode())); |
| | | List<TCity> list5 = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, city.getId())); |
| | | model.addAttribute("list4",list4); |
| | | model.addAttribute("list5",list5); |
| | | }else{ |
| | | List<TCity> list6 = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list4",list6); |
| | | List<TCity> list5 = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 1)); |
| | | model.addAttribute("list5",list5); |
| | | } |
| | | model.addAttribute("bodyType",info.getBodyType()); |
| | | model.addAttribute("accountType",info.getAccountType()); |
| | | model.addAttribute("useType",info.getAccountType()); |
| | | model.addAttribute("cardType",""); |
| | | model.addAttribute("reasons",info.getRefuseReason()); |
| | | // 【申请状态】 枚举值: |
| | | //CHECKING:资料校验中 |
| | | //ACCOUNT_NEED_VERIFY:待账户验证 |
| | | //AUDITING:审核中 |
| | | //REJECTED:已驳回 |
| | | //NEED_SIGN:待签约 |
| | | //FINISH:完成 |
| | | //FROZEN:已冻结 |
| | | //CANCELED:已作废 |
| | | switch (info.getApplymentState()){ |
| | | case "CHECKING": |
| | | model.addAttribute("applymentState","资料校验中"); |
| | | break; |
| | | case "ACCOUNT_NEED_VERIFY": |
| | | model.addAttribute("applymentState","待账户验证"); |
| | | break; |
| | | case "AUDITING": |
| | | model.addAttribute("applymentState","审核中"); |
| | | break; |
| | | case "REJECTED": |
| | | model.addAttribute("applymentState","已驳回"); |
| | | break; |
| | | case "NEED_SIGN": |
| | | model.addAttribute("applymentState","待签约"); |
| | | break; |
| | | case "FINISH": |
| | | model.addAttribute("applymentState","完成"); |
| | | break; |
| | | case "FROZEN": |
| | | model.addAttribute("applymentState","已冻结"); |
| | | break; |
| | | case "CANCELED": |
| | | model.addAttribute("applymentState","已作废"); |
| | | break; |
| | | } |
| | | if (info.getSignState()!=null){ |
| | | switch (info.getApplymentState()){ |
| | | case "CHECKING": |
| | | model.addAttribute("applymentState","资料校验中"); |
| | | break; |
| | | case "ACCOUNT_NEED_VERIFY": |
| | | model.addAttribute("applymentState","待账户验证"); |
| | | break; |
| | | case "AUDITING": |
| | | model.addAttribute("applymentState","审核中"); |
| | | break; |
| | | case "REJECTED": |
| | | model.addAttribute("applymentState","已驳回"); |
| | | break; |
| | | case "NEED_SIGN": |
| | | model.addAttribute("applymentState","待签约"); |
| | | break; |
| | | case "FINISH": |
| | | model.addAttribute("applymentState","完成"); |
| | | break; |
| | | case "FROZEN": |
| | | model.addAttribute("applymentState","已冻结"); |
| | | break; |
| | | case "CANCELED": |
| | | model.addAttribute("applymentState","已作废"); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | model.addAttribute("state",info.getApplymentState()); |
| | | if (info.getSignState() == null){ |
| | | model.addAttribute("signState",0); |
| | | |
| | | }else{ |
| | | model.addAttribute("signState",info.getSignState()); |
| | | |
| | | } |
| | | // todo 查询申请单状态 |
| | | model.addAttribute("accountName",info.getSignState()); |
| | | model.addAttribute("accountNo",info.getSignState()); |
| | | model.addAttribute("payAmount",info.getSignState()); |
| | | model.addAttribute("destinationAccountNumber",info.getSignState()); |
| | | model.addAttribute("destinationAccountName",info.getSignState()); |
| | | model.addAttribute("destinationAccountBank",info.getSignState()); |
| | | model.addAttribute("city",info.getSignState()); |
| | | model.addAttribute("remark",info.getSignState()); |
| | | model.addAttribute("deadline",info.getSignState()); |
| | | model.addAttribute("signState",info.getSignState()); |
| | | |
| | | // TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, info.getCityCode())); |
| | | // List<TCity> district = cityService.list(new QueryWrapper<TCity>().eq("parent_id", one.getId())); |
| | | // model.addAttribute("district",district); |
| | | // if (info.getOrderStatus().equals("AUDIT_PASS")||info.getOrderStatus().equals("LEGAL_CONFIRM")||info.getOrderStatus().equals("CONTACT_CONFIRM")){ |
| | | // // 通过才展示二维码 |
| | | // model.addAttribute("type",1); |
| | | // }else{ |
| | | // model.addAttribute("type",0); |
| | | // } |
| | | // model.addAttribute("code",info.getQrCode()); |
| | | // model.addAttribute("item",info); |
| | | // model.addAttribute("bodyType",info.getBodyType()); |
| | | // if (info.getRefuseReason()!=null && (!info.getRefuseReason().equals(""))){ |
| | | // model.addAttribute("reasons",info.getRefuseReason()); |
| | | // }else{ |
| | | // model.addAttribute("reasons",null); |
| | | // } |
| | | |
| | | return PREFIX + "OperatorUser_proportionAuth_infoWX.html"; |
| | | } |
| | | /** |
| | | * 根据所选市 获取区 |
| | | */ |
| | | @RequestMapping(value = "/getDistrict") |
| | |
| | | return ERROR; |
| | | } |
| | | } |
| | | // public static void main(String[] args) { |
| | | // public static void main(String[] args) { |
| | | // // 调用支付宝接口 通过银行卡号获取银行信息 |
| | | // String url = "https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&" + |
| | | // "cardNo=6217003800041315031&cardBinCheck=true"; |
| | |
| | | // System.err.println(cardType); |
| | | // |
| | | // } |
| | | public static String rsaEncryptOAEP(String message, X509Certificate certificate) |
| | | throws IllegalBlockSizeException, IOException { |
| | | try { |
| | | Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA-1AndMGF1Padding"); |
| | | cipher.init(Cipher.ENCRYPT_MODE, certificate.getPublicKey()); |
| | | byte[] data = message.getBytes("utf-8"); |
| | | byte[] cipherdata = cipher.doFinal(data); |
| | | return Base64.getEncoder().encodeToString(cipherdata); |
| | | } catch (NoSuchAlgorithmException | NoSuchPaddingException e) { |
| | | throw new RuntimeException("当前Java环境不支持RSA v1.5/OAEP", e); |
| | | } catch (InvalidKeyException e) { |
| | | throw new IllegalArgumentException("无效的证书", e); |
| | | } catch (IllegalBlockSizeException | BadPaddingException e) { |
| | | throw new IllegalBlockSizeException("加密原串的长度不能超过214字节"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 微信商户认证提交 |
| | | */ |
| | | @RequestMapping(value = "/wxAuth") |
| | | @ResponseBody |
| | | public Object wxAuth(Integer operatorId,String bodyType,String businessName,String businessNumber,String companyAddress, |
| | | String aliasName, |
| | | String license,String legalPhone, |
| | | String legalEmail, |
| | | String legalPerson,String legalAddress, |
| | | String IDCardTime,String IDCardEnd,String tradeTime,String endTime, |
| | | String leagleNumber,String legalFront,String legalBack, |
| | | String bankCard,String bankCardTwo,Integer useType,String bank,String bankName, |
| | | String accountName,String provinceCode,String province,String cityCode,String city, |
| | | String isBenefits, |
| | | String benefitsName, |
| | | String benefitsFront, |
| | | String benefitsBack, |
| | | String benefitsNumber, |
| | | String benefitsStartTime, |
| | | String benefitsEndTime, |
| | | String benefitsAddress |
| | | ) { |
| | | OperatorAuth operatorId1 = operatorAuthWxService.getOne(new QueryWrapper<OperatorAuth>() |
| | | .eq("operatorId", operatorId)); |
| | | TOperator byId = operatorService.getById(operatorId); |
| | | Integer userId1 = byId.getUserId(); |
| | | OperatorUser userId2 = operatorUserService.getOne(new QueryWrapper<OperatorUser>() |
| | | .eq("userId", userId1)); |
| | | userId2.setWechatAudit(1); |
| | | // 2是企业 4个体 |
| | | if (bodyType.equals("2")){ |
| | | userId2.setWechatType(2); |
| | | }else{ |
| | | userId2.setWechatType(4); |
| | | } |
| | | operatorUserService.updateById(userId2); |
| | | if (null == endTime || "".equals(endTime)){ |
| | | endTime = "长期"; |
| | | } |
| | | if (null == IDCardEnd || "".equals(IDCardEnd)){ |
| | | IDCardEnd = "长期"; |
| | | } |
| | | OperatorAuth operatorAuth = new OperatorAuth(); |
| | | |
| | | |
| | | operatorAuth.setOperatorId(operatorId); |
| | | operatorAuth.setBodyType(bodyType); |
| | | operatorAuth.setAliasName(aliasName); |
| | | operatorAuth.setBusinessName(businessName); |
| | | operatorAuth.setAccountType(useType); |
| | | operatorAuth.setBusinessNumber(businessNumber); |
| | | operatorAuth.setLegalRepresentative(legalPerson); |
| | | operatorAuth.setRegisterAddress(companyAddress); |
| | | operatorAuth.setBusinessTerm(tradeTime); |
| | | operatorAuth.setBusinessEnd(endTime); |
| | | operatorAuth.setLegalPerson(legalPerson); |
| | | operatorAuth.setLeagleNumber(leagleNumber); |
| | | operatorAuth.setLegalTerm(IDCardTime); |
| | | operatorAuth.setLegalEnd(IDCardEnd); |
| | | operatorAuth.setLegalEmail(legalEmail); |
| | | operatorAuth.setLegalAddress(legalAddress); |
| | | operatorAuth.setBusinessPicture(license); |
| | | operatorAuth.setLegalFront(legalFront); |
| | | operatorAuth.setLegalBack(legalBack); |
| | | if (!StringUtils.hasLength(license))operatorAuth.setBusinessPicture(null); |
| | | if (!StringUtils.hasLength(legalFront))operatorAuth.setLegalFront(null); |
| | | if (!StringUtils.hasLength(legalBack))operatorAuth.setLegalBack(null); |
| | | operatorAuth.setBank(bank); |
| | | operatorAuth.setAccountName(accountName); |
| | | operatorAuth.setProvince(province); |
| | | operatorAuth.setProvinceCode(provinceCode); |
| | | operatorAuth.setCity(city); |
| | | operatorAuth.setCityCode(cityCode); |
| | | operatorAuth.setBankName(bankName); |
| | | operatorAuth.setBankNumber(bankCard); |
| | | operatorAuth.setAuditState(0); |
| | | operatorAuth.setName(legalPerson); |
| | | operatorAuth.setLegalPhone(legalPhone); |
| | | operatorAuth.setPhone(legalPhone); |
| | | operatorAuth.setNumber(leagleNumber); |
| | | operatorAuth.setBankCardTwo(bankCardTwo); |
| | | operatorAuth.setIsBenefits(isBenefits); |
| | | |
| | | if (isBenefits.equals("true")){ |
| | | operatorAuth.setBenefitsName(legalPerson); |
| | | operatorAuth.setBenefitsFront(legalFront); |
| | | operatorAuth.setBenefitsBack(legalBack); |
| | | operatorAuth.setBenefitsNumber(leagleNumber); |
| | | operatorAuth.setBenefitsStartTime(IDCardTime); |
| | | operatorAuth.setBenefitsEndTime(IDCardEnd); |
| | | operatorAuth.setBenefitsAddress(legalAddress); |
| | | benefitsName = legalPerson; |
| | | benefitsFront = legalFront; |
| | | benefitsBack =legalBack; |
| | | benefitsNumber =leagleNumber; |
| | | benefitsStartTime =IDCardTime; |
| | | benefitsEndTime =IDCardEnd; |
| | | benefitsAddress = legalAddress; |
| | | } |
| | | LocalDateTime currentDateTime = LocalDateTime.now(); |
| | | // 格式化日期和时间信息 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); |
| | | String formattedDateTime = currentDateTime.format(formatter); |
| | | // 生成随机数,填充剩余位数 |
| | | Random random = new Random(); |
| | | StringBuilder randomPart = new StringBuilder(); |
| | | for (int i = 0; i < 3; i++) { |
| | | // 大写字母 |
| | | randomPart.append((char) (random.nextInt(26) + 'A')); |
| | | } |
| | | // 组合业务申请编号 若申请单被驳回,可填写相同的“业务申请编号”,即可覆盖修改原申请单信息 。 |
| | | String orderNumber = formattedDateTime + randomPart; |
| | | if (operatorId1 == null){ |
| | | operatorAuth.setOutBizNo(orderNumber); |
| | | operatorAuth.setAuditState(1); |
| | | operatorAuth.setApplymentState("CHECKING"); |
| | | operatorAuthWxService.save(operatorAuth); |
| | | }else{ |
| | | operatorAuth.setId(operatorId1.getId()); |
| | | operatorAuth.setBenefitsFront(operatorId1.getLegalFront()); |
| | | operatorAuth.setBenefitsBack(operatorId1.getLegalBack()); |
| | | BeanUtils.copyProperties(operatorAuth,operatorId1); |
| | | operatorId1.setAuditState(1); |
| | | operatorId1.setApplymentState("CHECKING"); |
| | | operatorAuthWxService.updateById(operatorId1); |
| | | } |
| | | String param="{"+ |
| | | "\"out_request_no\" :"+ "\""+orderNumber+"\""+","+ |
| | | " \"organization_type\" :"+"\""+bodyType+"\""+","+ |
| | | " \"finance_institution\" : false,\n" + |
| | | " \"business_license_info\" : {\n" + |
| | | // 主体为“个体工商户/企业”时,不填。 |
| | | // "cert_type:" + "CERTIFICATE_TYPE_2388,"+ |
| | | " \"business_license_copy\" :"+ "\""+license+"\""+","+ |
| | | " \"business_license_number\" : "+"\""+businessNumber+"\""+","+ |
| | | " \"merchant_name\" : "+ "\""+businessName+"\""+","+ |
| | | " \"legal_person\" : "+ "\""+legalPerson+"\""+","+ |
| | | "\"company_address\" :"+ "\""+companyAddress+"\""+","+ |
| | | " \"business_time\" : \"[\\\\\\\""+tradeTime+"\\\\\\\",\\\\\\\""+endTime+"\\\\\\\"]\"\n" + |
| | | " },\n" + |
| | | // "finance_institution_info:" +" {"+ |
| | | // "finance_type:" + "BANK_AGENT,"+ |
| | | // "finance_license_pics:" +"["+ |
| | | // "example_finance_license_pics"+ |
| | | // "]},"+ |
| | | // "id_holder_type:" + "LEGAL,"+ |
| | | " \"id_doc_type\" : \"IDENTIFICATION_TYPE_MAINLAND_IDCARD\",\n" + |
| | | // "authorize_letter_copy:" + "47ZC6GC-vnrbEny_Ie_An5-tCpqxucuxi-vByf3Gjm7KEIUv0OF4wFNIO4kqg05InE4d2I6_H7I4,"+ |
| | | " \"id_card_info\" : {\n" + |
| | | " \"id_card_copy\" : "+ "\""+legalFront+"\""+","+ |
| | | " \"id_card_national\" : "+ "\""+legalBack+"\""+","+ |
| | | " \"id_card_name\" : "+ "\""+legalPerson+"\""+","+ |
| | | " \"id_card_number\" : "+ "\""+leagleNumber+"\""+","+ |
| | | " \"id_card_address\" : "+ "\""+legalAddress+"\""+","+ |
| | | " \"id_card_valid_time_begin\" : "+ "\""+IDCardTime+"\""+","+ |
| | | " \"id_card_valid_time\" : "+ "\""+IDCardEnd+"\""+","+ |
| | | // "id_doc_info:" + |
| | | // "{id_doc_name:" + "jTpGmxUX3FBWVQ5NJTZvlKX_gdU4cRz7z5NxpnFuAxhBTEO_PvWkfSCJ3zVIn001D8daLC-ehEuo0BJqRTvDujqhThn4ReFxikqJ5YW6zFQ,"+ |
| | | // "id_doc_number:" + "jTpGmxUX3FBWVQ5NJTZvlKX_gdU4cRz7z5NxpnFuAxhBTEO_PvWkfSCJ3zVIn001D8daLC-ehEuo0BJqRTvDujqhThn4ReFxikqJ5YW6zFQ,"+ |
| | | // "id_doc_copy:" + "47ZC6GC-vnrbEny__Ie_An5-tCpqxucuxi-vByf3Gjm7KE53JXvGy9tqZm2XAUf-4KGprrKhpVBDIUv0OF4wFNIO4kqg05InE4d2I6_H7I4,"+ |
| | | // "id_doc_copy_back:" + "47ZC6GC-vnrbEny__Ie_An5-tCpqxucuxi-vByf3Gjm7KE53JXvGy9tqZm2XAUf-4KGprrKhpVBDIUv0OF4wFNIO4kqg05InE4d2I6_H7I4,"+ |
| | | // "id_doc_address:" + "jTpGmxUX3FBWVQ5NJTZvlKX_gdU4cRz7z5NxpnFuAxhBTEO_PvWkfSCJ3zVIn001D8daLC-ehEuo0BJqRTvDujqhThn4ReFxikqJ5YW6zFQ,"+ |
| | | // "doc_period_begin:" + "2019-06-06,"+ |
| | | // "doc_period_end:" + "2020-01-02},"+ |
| | | |
| | | " \"owner\" : true,\n" + |
| | | " \"account_info\" : {\n" + |
| | | " \"bank_account_type\" : "+ "\""+useType+"\""+","+ |
| | | " \"account_bank\" : "+ "\""+bank+"\""+","+ |
| | | " \"account_name\" : "+ "\""+accountName+"\""+","+ |
| | | " \"bank_address_code\" :"+ "\""+cityCode+"\""+","+ |
| | | " \"bank_branch_id\" : "+ "\""+bankCardTwo+"\""+","+ |
| | | " \"bank_name\" : "+ "\""+bankName+"\""+","+ |
| | | " \"account_number\" : "+ "\""+bankCard+"\""+","+ |
| | | " \"contact_info\" : {\n" + |
| | | " \"contact_type\" : \"65\",\n" + |
| | | " \"contact_name\" :"+ "\""+legalPerson+"\""+","+ |
| | | " \"contact_id_doc_type\" : \"IDENTIFICATION_TYPE_MAINLAND_IDCARD\",\n" + |
| | | " \"contact_id_card_number\" : "+ "\""+leagleNumber+"\""+","+ |
| | | " \"contact_id_doc_copy\" : "+ "\""+legalFront+"\""+","+ |
| | | " \"contact_id_doc_copy_back\" :"+ "\""+legalBack+"\""+","+ |
| | | // "contact_id_doc_period_begin:"+ "2019-06-06,"+ |
| | | // "contact_id_doc_period_end:" + "2026-06-06,"+ |
| | | // "business_authorization_letter:" + "47ZC6GC-vnrbEny_Ie_An5-tCpqxucuxi-vByf3Gjm7KEIUv0OF4wFNIO4kqg05InE4d2I6_H7I4,"+ |
| | | " \"mobile_phone\" : "+ "\""+legalPhone+"\""+","+ |
| | | " \"contact_email\" : "+ "\""+legalEmail+"\""+ |
| | | " },\n" + |
| | | " \"sales_scene_info\" : {\n" + |
| | | " \"store_name\" : \"爱烧烤\",\n" + |
| | | " \"store_url\" : \"http://www.qq.com\",\n" + |
| | | " \"store_qr_code\" : \"jTpGmxUX3FBWVQ5NJTZvlKX_gdU4cRz7z5NxpnFuAxhBTEO_PvWkfSCJ3zVIn001D8daLC-ehEuo0BJqRTvDujqhThn4ReFxikqJ5YW6zFQ\",\n" + |
| | | " \"mini_program_sub_appid\" : \"wxa123344545577\"\n" + |
| | | " },\n" + |
| | | " \"settlement_info\" : {\n" ; |
| | | if (Integer.parseInt(bodyType) == 4){ |
| | | param = param+" \"settlement_id\" : 802,\n" + |
| | | " \"qualification_type\" : \"休闲娱乐/旅游服务\"\n" +" },\n" ; |
| | | }else{ |
| | | param = param+" \"settlement_id\" : 800,\n" + |
| | | " \"qualification_type\" : \"休闲娱乐/旅游服务\"\n" +" },\n" ; |
| | | } |
| | | param+= " \"merchant_shortname\" : "+ "\""+aliasName+"\""+ |
| | | |
| | | // "qualifications:" + "[\"jTpGmxUX3FBWVQ5NJTZvlKX_gdU4cRz7z5NxpnFuAxhBTEO_PvWkfSCJ3zVIn001D8daLC-ehEuo0BJqRTvDujqhThn4ReFxikqJ5YW6zFQ\",\"47ZC6GC-vnrbEny__Ie_An5-tCpqxucuxi-vByf3Gjm7KE53JXvGy9tqZm2XAUf-4KGprrKhpVBDIUv0OF4wFNIO4kqg05InE4d2I6_H7I4\"],"+ |
| | | // "business_addition_pics:" + "[\"jTpGmxUX3FBWVQ5NJTZvlKX_gdU4cRz7z5NxpnFuAxhBTEO_PvWkfSCJ3zVIn001D8daLC-ehEuo0BJqRTvDujqhThn4ReFxikqJ5YW6zFQ\",\"47ZC6GC-vnrbEny__Ie_An5-tCpqxucuxi-vByf3Gjm7KE53JXvGy9tqZm2XAUf-4KGprrKhpVBDIUv0OF4wFNIO4kqg05InE4d2I6_H7I4\"],"+ |
| | | // "business_addition_desc:" + "特殊情况,说明原因,"+ |
| | | // "ubo_info_list:"+ "[{"+ |
| | | "\"ubo_info_list\" : [\n" + |
| | | " {\n" + |
| | | " \"ubo_id_doc_type\" : \"IDENTIFICATION_TYPE_MAINLAND_IDCARD\",\n" + |
| | | " \"ubo_id_doc_copy\" : "+ "\""+benefitsFront+"\""+ |
| | | " \"ubo_id_doc_copy_back\" : "+ "\""+benefitsBack+"\""+ |
| | | " \"ubo_id_doc_name\" : "+ "\""+benefitsName+"\""+ |
| | | " \"ubo_id_doc_number\" : "+ "\""+benefitsNumber+"\""+ |
| | | " \"ubo_id_doc_address\" : "+ "\""+benefitsAddress+"\""+ |
| | | " \"ubo_id_doc_period_begin\" : "+ "\""+benefitsStartTime+"\""+ |
| | | " \"ubo_id_doc_period_end\" : "+ "\""+benefitsEndTime+"\""+ |
| | | " }\n" + |
| | | " ]"+ |
| | | " }\n"+ |
| | | " }\n"+ |
| | | " }\n"; |
| | | |
| | | |
| | | // 使用 Jackson 解析 JSON |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | // 将 JSON 字符串解析为 Map |
| | | Map<String, Object> map = objectMapper.readValue(param, Map.class); |
| | | |
| | | // 输出 Map 中的内容 |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | System.out.println(entry.getKey() + ": " + entry.getValue()); |
| | | } |
| | | System.err.println(map); |
| | | String s = HttpRequestUtil.postRequest1("https://api.mch.weixin.qq.com/v3/ecommerce/applyments/", map); |
| | | System.err.println("返回结果:"+s); |
| | | JSONObject jsonObject = JSON.parseObject(s); |
| | | String string = jsonObject.getString("out_request_no"); |
| | | // 获取业务申请编号 后续用该字段查询申请状态 |
| | | operatorAuth.setOrderNo(string); |
| | | System.err.println(jsonObject); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.err.println(param); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 支付宝商户认证提交 |
| | |
| | | " \"mobile\":\""+phone+"\"," + |
| | | " }" + |
| | | " ],"; |
| | | // todo 拼接 |
| | | String biz_cards=" \"biz_cards\":[" + |
| | | " {" + |
| | | " \"account_holder_name\":\""+accountName+"\"," + |
| | |
| | | } |
| | | String res= |
| | | " \"service\":[" + |
| | | " \"app支付\"" + |
| | | " ]," + |
| | | " \"alipay_logon_id\":" + |
| | | " \""+zfbAccount+"\"" + |
| | | " ," + |
| | | " \"sites\":[" + |
| | | " {" + |
| | | " \"site_type\":\"02\"," + |
| | | " \"site_name\":\"玩湃生活\"," + |
| | | " \"tiny_app_id\":\"wx82f853a410b0c7c0\"" + |
| | | " }" + |
| | | " ]," + |
| | | " \"cert_name\":\""+businessName+"\","+ |
| | | " \"binding_alipay_logon_id\":\""+zfbAccount+"\","+ |
| | | " \"default_settle_rule\":{" + |
| | | " \"default_settle_type\":\""+type+"\"," + |
| | | " \"default_settle_target\":\""+account+"\"" + |
| | | " }" + |
| | | "}"; |
| | | " \"app支付\"" + |
| | | " ]," + |
| | | " \"alipay_logon_id\":" + |
| | | " \""+zfbAccount+"\"" + |
| | | " ," + |
| | | " \"sites\":[" + |
| | | " {" + |
| | | " \"site_type\":\"02\"," + |
| | | " \"site_name\":\"玩湃生活\"," + |
| | | " \"tiny_app_id\":\"wx82f853a410b0c7c0\"" + |
| | | " }" + |
| | | " ]," + |
| | | " \"cert_name\":\""+businessName+"\","+ |
| | | " \"binding_alipay_logon_id\":\""+zfbAccount+"\","+ |
| | | " \"default_settle_rule\":{" + |
| | | " \"default_settle_type\":\""+type+"\"," + |
| | | " \"default_settle_target\":\""+account+"\"" + |
| | | " }" + |
| | | "}"; |
| | | if (accountType.equals("bankCard")){ |
| | | request.setBizContent(param |
| | | + biz_cards+res); |
| | |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | public static Object uploadImg(String img){ |
| | | String appPrivateKey = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCi5i9nW/hGLJ3A06cZxTQdviFC7THpdSihoTYGLr9q006hu0V26ecBMY/o4w5bvIX0Ok/yofmZsVcCJpAPvbXL/uqVrIjnRRxXiaeBFThlxoBUTdunvbUSDYfzlEhJr5NvUKI6H6lz2niXlQGx4qy8Hau4ccWit9kM8jwUvsBVQoFgJA+xrjMvooA7YLopQtpOD+UJr5thApTSf1xrnr1W12yolTLEH15JmNV372cqXrYUuqnY0QsaPtxeqJUGAOcGdVLllQ7easEznP8DFBvDdHATcmp2SHNQDUEWN6MCVPbMgY06NQVqAXxqjTAYSVh+6TRu6bofPmpYC3TZB003AgMBAAECggEBAJAcR2+PA3NBYUYHeFrqBRMS8uX8ZR19kjZ7IgoSLTFaQsP9opRylPSPXhrPVBKAE5leRQAHn4MCSlESwHvMfxo7KFjFTFAc6dffZZpipYQUOc9bGampwJh58/3e/pyBgVMG6J23CPf/HJQtNFSkjd/V9+ayb/9l2dUEL3bC0fAZ/dbx8HsxdLw8wn3fLlWLj68hOMqa2deCZe3JdSVsPbeWqkh56FFsMLug0Nd+Ar4TgRl9/jnhXF0JWiD0LmPUYLhboY7EfUBzN4w1iYbDi1P+3zvoOYsiVKAXox9GMhQ2VzOO2UcSTuizSza2e98mGpabl/GpKmCz+RDFjtkX6eECgYEA2MyCij65eO3aGIm3FUe93DULRBYTfX8qJQSJq2WOWA3mmQlEW6L3O2B5/lG2h+8WmN6iLEs9eHpgycGYp7vAqgrANEn16ACVcuyx0scFtrZfZ+kmHMzFfiUWxJjVYk/6YngsGVBLdw6ueM42C8TTP67X9tU5TdVGoGWuqEj4W98CgYEAwFqwprXOch5Pqk/RPbb49r0Ou03K/UbciWnWWKzUhFFNS8MdlQPoDvQZbMwHLeWsa2VhaKITK3x5biLQb3U+0GLOn6lTvEyrEUH+ucREyLgVYTRAvwBPtnvlrzpyxPk2HnslQjju8WrvvLLBMKWUjlTrTOzhaHT21gz3pHMiOakCgYEAhLmfaXdBITGshb054sNLDtdCkGpbgEcrzAHdLps769iGxkYQHXHFngpQZUwtTUcoNGqIKknd1jZFrv7gsD+XkgKG7PwimehRlkwmCX5ilxtLiVgJRzRt6+5U5AMVD90a0tHzXYP0z2yjj73fBJF5KtGl0a10KZxaYrQdm1UhB00CgYBZZgzx/k9rtHC8LAqIj1CYhHejT92G53c6Gkl3vyOqN4sgKhfGmSEySfrDGPRBPZxr8ZtbIPCd5mUdberH0osWGMYFaJI1UsCy7aQwvGpniz7MhZeN7dweaOjwDs8mgtjHQ96mL4XGCDhR0BZ/wIURvZ/6iaGdhbbu9unlsWj3uQKBgQCmZYdsbbZkd3ev6f8rwyvMz+DrCQyYpY44cegBYuJgrZiQnL2fJioeN7ixX0UM48SfwsZEIrzshP/LGAwnc2MdjxKUl4jLN8SEe0NAjXOnz9Zaw740+aOmLpXcLWdP4uM2gIhWsvW1tEkQZCXmm7c9s/RsU8Pmzv+YL3+fSijOzA==";//支付宝开发者应用私钥 |
| | | String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB";//支付宝支付公钥 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询进件申请单审核状态 |
| | | */ |
| | | public JSONObject queryState(String orderNo) { |
| | | String url = "https://api.mch.weixin.qq.com/v3/ecommerce/applyments/out-request-no/"+orderNo; |
| | | String req1 = HttpRequestUtil.getReq1(url, new HashMap<>()); |
| | | System.err.println("查询申请单审核状态字符串"+req1); |
| | | JSONObject jsonObject = JSON.parseObject(req1); |
| | | System.err.println("查询申请单审核状态Json"+jsonObject); |
| | | String applymentState = jsonObject.getString("applyment_state"); |
| | | String outBizNo = jsonObject.getString("out_request_no"); |
| | | OperatorAuth operatorAuth = operatorAuthWxService.getOne( |
| | | new QueryWrapper<OperatorAuth>() |
| | | .eq("outBizNo", outBizNo)); |
| | | OperatorUser operatorUser = operatorUserService.getOne(new QueryWrapper<OperatorUser>() |
| | | .eq("operatorId", operatorAuth.getOperatorId())); |
| | | // 审核状态 |
| | | operatorAuth.setApplymentState(applymentState); |
| | | if (applymentState.equals("REJECTED") || applymentState.equals("FROZEN")){ |
| | | operatorUser.setWechatAudit(3); |
| | | operatorAuth.setAuditState(2); |
| | | // 如果被拒 赋值拒绝原因 |
| | | operatorAuth.setRefuseReason(jsonObject.getJSONObject("audit_detail").getString("reject_reason")); |
| | | } |
| | | if (applymentState.equals("NEED_SIGN")){ |
| | | operatorAuth.setSignUrl(jsonObject.getString("sign_url")); |
| | | operatorAuth.setMerchantNumber(jsonObject.getString("sub_mchid")); |
| | | } |
| | | if (applymentState.equals("FINISH")){ |
| | | operatorAuth.setMerchantNumber(jsonObject.getString("sub_mchid")); |
| | | operatorUser.setWechatAudit(2); |
| | | operatorAuth.setAuditState(1); |
| | | } |
| | | if (applymentState.equals("ACCOUNT_NEED_VERIFY")){ |
| | | operatorAuth.setLegalValidationUrl(jsonObject.getString("legal_validation_url")); |
| | | } |
| | | return jsonObject; |
| | | /** |
| | | * { |
| | | * "applyment_state" : "FINISH", |
| | | * "applyment_state_desc" : "审核中", |
| | | * "sign_url" : "https://pay.weixin.qq.com/public/apply4ec_sign/s?applymentId=2000002126198476&sign=b207b673049a32c858f3aabd7d27c7ec", |
| | | * "sub_mchid" : "1542488631", |
| | | * "account_validation" : { |
| | | * "account_name" : "aOf7Gk2qT26kakkuTZpbFAn7Mb7xcar0LlQaYoi3+LnnWwgAsfaUUTg9+GmYJq6YCz+RiluWHeHFq1lt8n3eIkF0laVvqmAU80xIWGZgWJnRmnRuZxsg0HJZfnUac2JfqyuL8OoyM2YSuYDqdsyvcOlgUQgq8MPCR6pmvhBCmIeJvnVSm8J+L+yx912itUmTDxhdBlu1CFBIUefME9nYB70vCVTNAVXgURkf65mjHMBiE9Y+wrPZVmTIIz3C3PtPVMZYDEvBT4rDdICA3ZYXshYqeOSslSjSMf+MhhC4oaujiISFzq3AE+as7mAEDJly+DgRuVs74msmKUH8pl+3oA==", |
| | | * "account_no" : "aOf7Gk2qT26kakkuTZpbFAn7Mb7xcar0LlQaYoi3+LnnWwgAsfaUUTg9+GmYJq6YCz+RiluWHeHFq1lt8n3eIkF0laVvqmAU80xIWGZgWJnRmnRuZxsg0HJZfnUac2JfqyuL8OoyM2YSuYDqdsyvcOlgUQgq8MPCR6pmvhBCmIeJvnVSm8J+L+yx912itUmTDxhdBlu1CFBIUefME9nYB70vCVTNAVXgURkf65mjHMBiE9Y+wrPZVmTIIz3C3PtPVMZYDEvBT4rDdICA3ZYXshYqeOSslSjSMf+MhhC4oaujiISFzq3AE+as7mAEDJly+DgRuVs74msmKUH8pl+3oA==", |
| | | * "pay_amount" : 124, |
| | | * "destination_account_number" : "7222223333322332", |
| | | * "destination_account_name" : "财付通支付科技有限公司", |
| | | * "destination_account_bank" : "招商银行威盛大厦支行", |
| | | * "city" : "深圳", |
| | | * "remark" : "入驻账户验证", |
| | | * "deadline" : "2018-12-10 17:09:01" |
| | | * }, |
| | | * "audit_detail" : [ |
| | | * { |
| | | * "param_name" : "id_card_copy", |
| | | * "reject_reason" : "身份证背面识别失败,请上传更清晰的身份证图片。" |
| | | * } |
| | | * ], |
| | | * "legal_validation_url" : "https://pay.weixin.qq.com/public/apply4ec_sign/s?applymentId=2000002126198476&sign=b207b673049a32c858f3aabd7d27c7ec", |
| | | * "out_request_no" : "APPLYMENT_00000000001", |
| | | * "applyment_id" : 2000002124775691, |
| | | * "sign_state" : "SIGNED" |
| | | * } |
| | | */ |
| | | } |
| | | |
| | | /** |
| | | * 分账比例提交 |
| | | */ |
| | | @RequestMapping(value = "/proportion") |
| | |
| | | operatorUserService.updateById(id); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | | // public static void main(String[] args) throws URISyntaxException { |
| | | // String filePath = "https://we-park-life.oss-cn-beijing.aliyuncs.com/img/a5e24fc4b13b4ea48bb2455ad8662a5d.jpg"; // 替换成你的OSS图片链接 |
| | | // String string = UUID.randomUUID().toString(); |
| | | // try { |
| | | // URL url = new URL(filePath); |
| | | // InputStream inputStream = url.openStream(); |
| | | // // 这里可以根据需求处理 inputStream,比如保存到本地文件 |
| | | // // 例如保存到本地文件 |
| | | // saveInputStreamToFile(inputStream, "D:\\tempImg\\"+string+".jpg"); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // URI uri = new URI("https://api.mch.weixin.qq.com/v3/merchant/media/upload"); |
| | | // File file = new File("D:\\tempImg\\"+string+".jpg"); |
| | | // try (FileInputStream ins1 = new FileInputStream(file)) { |
| | | // String sha256 = DigestUtils.sha256Hex(ins1); |
| | | // try (InputStream ins2 = new FileInputStream(file)) { |
| | | // HttpPost request = new WechatPayUploadHttpPost.Builder(uri) |
| | | // .withImage(file.getName(), sha256, ins2) |
| | | // .build(); |
| | | //// CloseableHttpResponse response1 = httpClient.execute(request); |
| | | // } |
| | | // } catch (IOException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // } |
| | | private static void saveInputStreamToFile(InputStream inputStream, String filePath) throws IOException { |
| | | OutputStream outputStream = new FileOutputStream(filePath); |
| | | byte[] buffer = new byte[1024]; |
| | | int bytesRead; |
| | | while ((bytesRead = inputStream.read(buffer)) != -1) { |
| | | outputStream.write(buffer, 0, bytesRead); |
| | | } |
| | | outputStream.close(); |
| | | inputStream.close(); |
| | | } |
| | | /** |
| | | * 微信商户认证上传图片 |
| | | */ |
| | | @RequestMapping(value = "/wxUpload") |
| | | @ResponseBody |
| | | public Object wxUpload(String img) throws URISyntaxException, FileNotFoundException { |
| | | String filePath = "https://we-park-life.oss-cn-beijing.aliyuncs.com/img/a5e24fc4b13b4ea48bb2455ad8662a5d.jpg"; // 替换成你的OSS图片链接 |
| | | String string = UUID.randomUUID().toString(); |
| | | try { |
| | | URL url = new URL(filePath); |
| | | InputStream inputStream = url.openStream(); |
| | | // 这里可以根据需求处理 inputStream,比如保存到本地文件 |
| | | // 例如保存到本地文件 |
| | | |
| | | |
| | | saveInputStreamToFile(inputStream, "D:\\tempImg\\"+string+".jpg"); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | URI uri = new URI("https://api.mch.weixin.qq.com/v3/merchant/media/upload"); |
| | | File file = new File("D:\\tempImg\\"+string+".jpg"); |
| | | try (FileInputStream ins1 = new FileInputStream(file)) { |
| | | String sha256 = DigestUtils.sha256Hex(ins1); |
| | | try (InputStream ins2 = new FileInputStream(file)) { |
| | | HttpPost request = new WechatPayUploadHttpPost.Builder(uri) |
| | | .withImage(file.getName(), sha256, ins2) |
| | | .build(); |
| | | // CloseableHttpResponse response1 = httpClient.execute(request); |
| | | } |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return null; |
| | | } |
| | | // 辅助方法:将 InputStream 转换为 FileInputStream |
| | | private static FileInputStream convertInputStreamToFileInputStream(InputStream inputStream) throws IOException { |
| | | // 将 InputStream 转为临时文件,然后返回其 FileInputStream |
| | | File tempFile = File.createTempFile("temp", null); |
| | | org.apache.commons.io.IOUtils.copy(inputStream, new java.io.FileOutputStream(tempFile)); |
| | | return new FileInputStream(tempFile); |
| | | } |
| | | |
| | | /** |
| | | * 跳转运营商设置分账比例页面 |
| | | */ |
| | |
| | | } |
| | | return ResultUtil.success("添加成功"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取所有运营商 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getOperatorListAll") |
| | | public Object getOperatorListAll(){ |
| | | return operatorService.list(new QueryWrapper<TOperator>().eq("state", 1)); |
| | | } |
| | | } |
| | |
| | | return list; |
| | | } |
| | | |
| | | @RequestMapping(value = "/mgtShopAuth", method = RequestMethod.POST) |
| | | @ApiOperation(value = "微信平台商户进件") |
| | | @ResponseBody |
| | | public Object mgtShopAuth(Integer operatorId,String aliasName, String name,String phone, |
| | | String bodyType,String businessName,String businessNumber,String legalPerson, |
| | | String legalRepresentative,String registerAddress,String businessTerm,String businessPicture, |
| | | String businessEnd,String legalNumber,String accountType, |
| | | Integer blBusinessFoeverFlag, String leagleNumber,String legalAddress, |
| | | String legalTerm,String legalEnd, Integer lpIcForeverFlag,String legalFront,String legalBack, |
| | | String legalPhone,String legalEmail, String settlementAccountType,String saBank,String saAccountName, |
| | | String saBankProvinceCode,String saBankCityCode, String saBankName,String saNumber,String baPics, |
| | | String baDesc,Integer owner, String uboName,String uboIdCard,String uboIcStartDate,String uboIcEndDate, |
| | | String uboIcFront,String uboIcBack, String uboIcAddress) { |
| | | MgtShopAuthDto mgtShopAuthDto = new MgtShopAuthDto(); |
| | | Integer userId = Objects.requireNonNull(UserExt.getUser()).getId(); |
| | | mgtShopAuthDto.setUserId(userId); |
| | | mgtShopAuthDto.setAuthId("1"); |
| | | mgtShopAuthDto.setShopId(Long.valueOf(operatorId)); |
| | | mgtShopAuthDto.setShopName(businessName); |
| | | mgtShopAuthDto.setShopownerName(name); |
| | | mgtShopAuthDto.setShopownerPhone(phone); |
| | | mgtShopAuthDto.setMainType(Integer.valueOf(bodyType)); |
| | | mgtShopAuthDto.setBlShopName(businessName); |
| | | mgtShopAuthDto.setBlNumber(businessNumber); |
| | | mgtShopAuthDto.setBlCorporateName(legalRepresentative); |
| | | mgtShopAuthDto.setBlRegisteredAddress(registerAddress); |
| | | mgtShopAuthDto.setBlBusinessStartTime(businessTerm); |
| | | mgtShopAuthDto.setBlBusinessDeanline(businessEnd); |
| | | mgtShopAuthDto.setBlBusinessFoeverFlag(blBusinessFoeverFlag); |
| | | mgtShopAuthDto.setBlImage(businessPicture); |
| | | mgtShopAuthDto.setLpCorporateName(legalPerson); |
| | | mgtShopAuthDto.setLpIdCard(legalNumber); |
| | | mgtShopAuthDto.setLpIdAddress(legalAddress); |
| | | mgtShopAuthDto.setLpIcStartDate(legalTerm); |
| | | mgtShopAuthDto.setLpIcEndDate(legalEnd); |
| | | mgtShopAuthDto.setLpIcForeverFlag(lpIcForeverFlag); |
| | | mgtShopAuthDto.setLpIcFront(legalFront); |
| | | mgtShopAuthDto.setLpIcBack(legalBack); |
| | | mgtShopAuthDto.setLpMobilePhone(legalPhone); |
| | | mgtShopAuthDto.setLpContactEmail("法人邮箱"); |
| | | mgtShopAuthDto.setSettlementAccountType(accountType); |
| | | mgtShopAuthDto.setSaBank("开户行"); |
| | | mgtShopAuthDto.setSaAccountName("开户名称"); |
| | | mgtShopAuthDto.setSaBankProvinceCode("开户所在省"); |
| | | mgtShopAuthDto.setSaBankCityCode("开户所在市"); |
| | | mgtShopAuthDto.setSaBankName("开户行全称"); |
| | | mgtShopAuthDto.setSaNumber("银行卡号"); |
| | | mgtShopAuthDto.setOwner(1); |
| | | mgtShopAuthDto.setUboName("ck"); |
| | | mgtShopAuthDto.setUboIdCard("513701199910156123"); |
| | | mgtShopAuthDto.setUboIcStartDate("2020-05-05"); |
| | | mgtShopAuthDto.setUboIcEndDate("2025-05-05"); |
| | | mgtShopAuthDto.setUboIcFront("受益人身份证正面"); |
| | | mgtShopAuthDto.setUboIcBack("受益人身份证正面"); |
| | | mgtShopAuthDto.setUboIcAddress("受益人居住地址"); |
| | | operatorUserService.mgtShopAuth(mgtShopAuthDto); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
| | |
| | | private Integer operatorId; |
| | | @TableField(value = "bodyType") |
| | | private String bodyType; |
| | | @TableField(value = "type") |
| | | private Integer type; |
| | | @TableField(value = "businessName") |
| | | private String businessName; |
| | | @TableField(value = "businessNumber") |
| | |
| | | private String legalAddress; |
| | | @TableField(value = "legalFront") |
| | | private String legalFront; |
| | | @TableField(value = "merchantNumber") |
| | | private String merchantNumber; |
| | | @TableField(value = "legalBack") |
| | | private String legalBack; |
| | | @TableField(value = "aliasName") |
| | | private String aliasName; |
| | | @TableField(value = "accountType") |
| | | private Integer accountType; |
| | | @TableField(value = "auditState") |
| | | private Integer auditState; |
| | | @TableField(value = "bank") |
| | | private String bank; |
| | | @TableField(value = "accountName") |
| | |
| | | private String bankName; |
| | | @TableField(value = "bankNumber") |
| | | private String bankNumber; |
| | | @TableField(value = "auditState") |
| | | private Integer auditState; |
| | | @TableField(value = "isBeneficiary") |
| | | private String isBeneficiary; |
| | | @TableField(value = "beneficiary") |
| | | private String beneficiary; |
| | | @TableField(value = "beneficiaryNumber") |
| | | private String beneficiaryNumber; |
| | | @TableField(value = "beneficiaryAddress") |
| | | private String beneficiaryAddress; |
| | | @TableField(value = "beneficiaryTerm") |
| | | private String beneficiaryTerm; |
| | | @TableField(value = "beneficiaryFront") |
| | | private String beneficiaryFront; |
| | | @TableField(value = "beneficiaryBack") |
| | | private String beneficiaryBack; |
| | | @TableField(value = "bankCardTwo") |
| | | private String bankCardTwo; |
| | | @TableField(value = "refuseReason") |
| | | private String refuseReason; |
| | | |
| | | @TableField(value = "remark") |
| | | private String remark; |
| | | @TableField(value = "outBizNo") |
| | | private String outBizNo; |
| | | @TableField(value = "name") |
| | |
| | | private String businessEnd; |
| | | @TableField(value = "legalEnd") |
| | | private String legalEnd; |
| | | @TableField(value = "beneficiaryEnd") |
| | | private String beneficiaryEnd; |
| | | @TableField(value = "orderNo") |
| | | private String orderNo; |
| | | @TableField(value = "orderStatus") |
| | | private String orderStatus; |
| | | @TableField(value = "qrCode") |
| | | private String qrCode; |
| | | @TableField(value = "legalValidationUrl") |
| | | private String legalValidationUrl; |
| | | @TableField(value = "applymentState") |
| | | private String applymentState; |
| | | @TableField(value = "signUrl") |
| | | private String signUrl; |
| | | @TableField(value = "signState") |
| | | private String signState; |
| | | |
| | | |
| | | @TableField(value = "isBenefits") |
| | | private String isBenefits; |
| | | @TableField(value = "benefitsName") |
| | | private String benefitsName; |
| | | @TableField(value = "benefitsFront") |
| | | private String benefitsFront; |
| | | @TableField(value = "benefitsBack") |
| | | private String benefitsBack; |
| | | @TableField(value = "benefitsNumber") |
| | | private String benefitsNumber; |
| | | @TableField(value = "benefitsStartTime") |
| | | private String benefitsStartTime; |
| | | @TableField(value = "benefitsEndTime") |
| | | private String benefitsEndTime; |
| | | @TableField(value = "benefitsAddress") |
| | | private String benefitsAddress; |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.guns.modular.system.model.OperatorAuth; |
| | | import com.dsh.guns.modular.system.model.OperatorAuthAlipay; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2023/8/1 17:49 |
| | | */ |
| | | public interface IOperatorAuthWxService extends IService<OperatorAuth> { |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.mapper.TOperatorAuthMapper; |
| | | import com.dsh.course.mapper.TOperatorAuthWxMapper; |
| | | import com.dsh.guns.modular.system.model.OperatorAuth; |
| | | import com.dsh.guns.modular.system.model.OperatorAuthAlipay; |
| | | import com.dsh.guns.modular.system.service.IOperatorAuthService; |
| | | import com.dsh.guns.modular.system.service.IOperatorAuthWxService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author administrator |
| | | * @since 2023-09-19 |
| | | */ |
| | | @Service |
| | | public class TOperatorAuthWxServiceImpl extends ServiceImpl<TOperatorAuthWxMapper, OperatorAuth> implements IOperatorAuthWxService { |
| | | |
| | | } |
| | |
| | | import com.dsh.guns.modular.system.service.IOperatorAuthService; |
| | | import com.dsh.guns.modular.system.service.IOperatorUserService; |
| | | import com.dsh.guns.modular.system.service.ITStudentService; |
| | | import com.dsh.guns.modular.system.util.WeChatUtil; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsResult; |
| | | import com.github.binarywang.wxpay.service.EcommerceService; |
| | | import com.github.binarywang.wxpay.service.WxPayService; |
| | |
| | | private IOperatorAuthService operatorAuthService; |
| | | @Autowired |
| | | private TOperatorMapper operatorMapper; |
| | | @Autowired |
| | | private WeChatUtil weChatUtil; |
| | | // @Autowired |
| | | // private WeChatUtil weChatUtil; |
| | | |
| | | // @Override |
| | | // public void mgtShopAuth(MgtShopAuthDto mgtShopAuthDto) { |
New file |
| | |
| | | package com.dsh.guns.modular.system.util; |
| | | |
| | | import static org.apache.http.HttpHeaders.ACCEPT; |
| | | import static org.apache.http.HttpStatus.SC_OK; |
| | | import static org.apache.http.entity.ContentType.APPLICATION_JSON; |
| | | import static org.junit.Assert.assertEquals; |
| | | import static org.junit.Assert.assertTrue; |
| | | |
| | | import com.github.binarywang.wxpay.v3.WechatPayUploadHttpPost; |
| | | import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Validator; |
| | | import com.wechat.pay.contrib.apache.httpclient.util.PemUtil; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.net.URI; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.PrivateKey; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.apache.http.HttpEntity; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.client.utils.URIBuilder; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.junit.After; |
| | | import org.junit.Before; |
| | | import org.junit.Test; |
| | | |
| | | @Deprecated |
| | | public class AutoUpdateVerifierTest { |
| | | |
| | | // 你的商户私钥 |
| | | private static final String privateKey = "-----BEGIN PRIVATE KEY-----\n" |
| | | + "-----END PRIVATE KEY-----\n"; |
| | | //测试AutoUpdateCertificatesVerifier的verify方法参数 |
| | | private static final String serialNumber = ""; |
| | | private static final String message = ""; |
| | | private static final String signature = ""; |
| | | private static final String merchantId = ""; // 商户号 |
| | | private static final String merchantSerialNumber = ""; // 商户证书序列号 |
| | | private static final String apiV3Key = ""; // API V3密钥 |
| | | private CloseableHttpClient httpClient; |
| | | private AutoUpdateCertificatesVerifier verifier; |
| | | |
| | | @Before |
| | | public void setup() { |
| | | PrivateKey merchantPrivateKey = PemUtil.loadPrivateKey(privateKey); |
| | | |
| | | //使用自动更新的签名验证器,不需要传入证书 |
| | | verifier = new AutoUpdateCertificatesVerifier( |
| | | new WechatPay2Credentials(merchantId, new PrivateKeySigner(merchantSerialNumber, merchantPrivateKey)), |
| | | apiV3Key.getBytes(StandardCharsets.UTF_8)); |
| | | |
| | | httpClient = WechatPayHttpClientBuilder.create() |
| | | .withMerchant(merchantId, merchantSerialNumber, merchantPrivateKey) |
| | | .withValidator(new WechatPay2Validator(verifier)) |
| | | .build(); |
| | | } |
| | | |
| | | @After |
| | | public void after() throws IOException { |
| | | httpClient.close(); |
| | | } |
| | | |
| | | @Test |
| | | public void autoUpdateVerifierTest() { |
| | | assertTrue(verifier.verify(serialNumber, message.getBytes(StandardCharsets.UTF_8), signature)); |
| | | } |
| | | |
| | | @Test |
| | | public void getCertificateTest() throws Exception { |
| | | URIBuilder uriBuilder = new URIBuilder("https://api.mch.weixin.qq.com/v3/certificates"); |
| | | HttpGet httpGet = new HttpGet(uriBuilder.build()); |
| | | httpGet.addHeader(ACCEPT, APPLICATION_JSON.toString()); |
| | | CloseableHttpResponse response = httpClient.execute(httpGet); |
| | | assertEquals(SC_OK, response.getStatusLine().getStatusCode()); |
| | | try { |
| | | HttpEntity entity = response.getEntity(); |
| | | // do something useful with the response body |
| | | // and ensure it is fully consumed |
| | | EntityUtils.consume(entity); |
| | | } finally { |
| | | response.close(); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void uploadImageTest() throws Exception { |
| | | String filePath = "/your/home/hellokitty.png"; |
| | | |
| | | URI uri = new URI("https://api.mch.weixin.qq.com/v3/merchant/media/upload"); |
| | | |
| | | File file = new File(filePath); |
| | | try (FileInputStream fileIs = new FileInputStream(file)) { |
| | | String sha256 = DigestUtils.sha256Hex(fileIs); |
| | | try (InputStream is = new FileInputStream(file)) { |
| | | WechatPayUploadHttpPost request = new WechatPayUploadHttpPost.Builder(uri) |
| | | .withImage(file.getName(), sha256, is) |
| | | .build(); |
| | | |
| | | try (CloseableHttpResponse response = httpClient.execute(request)) { |
| | | assertEquals(SC_OK, response.getStatusLine().getStatusCode()); |
| | | HttpEntity entity = response.getEntity(); |
| | | // do something useful with the response body |
| | | // and ensure it is fully consumed |
| | | String s = EntityUtils.toString(entity); |
| | | System.out.println(s); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return result; |
| | | }/*** |
| | | * get请求(带参数) |
| | | * @param url |
| | | * @return String |
| | | */ |
| | | public static String getReq1(String url, Map<String, String> params) { |
| | | String result = null; |
| | | try { |
| | | URIBuilder uriBuilder = new URIBuilder(url); |
| | | Iterator maplist = params.entrySet().iterator(); |
| | | while (maplist.hasNext()) { |
| | | Map.Entry<String, String> map = (Map.Entry<String, String>) maplist.next(); |
| | | uriBuilder.addParameter(map.getKey(), map.getValue()); |
| | | } |
| | | CloseableHttpClient client = HttpClientBuilder.create().build(); |
| | | HttpPost get = new HttpPost(uriBuilder.build()); |
| | | // todo 验签 |
| | | get.setHeader("Authorization", "close"); |
| | | get.setHeader("Content-Type", "application/json"); |
| | | get.setHeader("Accept", "application/json"); |
| | | get.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36"); |
| | | HttpResponse response = client.execute(get); |
| | | result = EntityUtils.toString(response.getEntity(), "UTF-8"); |
| | | |
| | | } catch (URISyntaxException e) { |
| | | e.printStackTrace(); |
| | | } catch (ClientProtocolException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return result; |
| | | } |
| | | public static String postRequest(String url, Map<String, String> params) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public static String postRequest1(String url, Map<String, Object> params) { |
| | | // 构造HttpClient的实例 |
| | | HttpClient httpClient = new HttpClient(); |
| | | // 创建POST方法的实例 |
| | | PostMethod postMethod = new PostMethod(url); |
| | | // 设置请求头信息 |
| | | postMethod.setRequestHeader("Authorization", "close"); |
| | | postMethod.setRequestHeader("Accept", "application/json"); |
| | | postMethod.addRequestHeader("Content-Type", "application/json"); |
| | | postMethod.addRequestHeader("Wechatpay-Serial", "application/json"); |
| | | postMethod.setRequestHeader("Connection", "close"); |
| | | // 添加参数 |
| | | for (Map.Entry<String, Object> entry : params.entrySet()) { |
| | | postMethod.addParameter(entry.getKey(), entry.getValue().toString()); |
| | | } |
| | | // 使用系统提供的默认的恢复策略,设置请求重试处理,用的是默认的重试处理:请求三次 |
| | | httpClient.getParams().setBooleanParameter("http.protocol.expect-continue", false); |
| | | // 接收处理结果 |
| | | String result = null; |
| | | try { |
| | | // 执行Http Post请求 |
| | | httpClient.executeMethod(postMethod); |
| | | // 返回处理结果 |
| | | result = postMethod.getResponseBodyAsString(); |
| | | } catch (HttpException e) { |
| | | // 发生致命的异常,可能是协议不对或者返回的内容有问题 |
| | | System.out.println("请检查输入的URL!"); |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | // 发生网络异常 |
| | | System.out.println("发生网络异常!"); |
| | | e.printStackTrace(); |
| | | } finally { |
| | | // 释放链接 |
| | | postMethod.releaseConnection(); |
| | | // 关闭HttpClient实例 |
| | | if (httpClient != null) { |
| | | ((SimpleHttpConnectionManager) httpClient.getHttpConnectionManager()).shutdown(); |
| | | httpClient = null; |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | public static String getRequest(String url, Map<String, String> params) { |
| | | // 构造HttpClient实例 |
| | | HttpClient client = new HttpClient(); |
| | |
| | | package com.dsh.guns.modular.system.util; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.guns.modular.system.model.OperatorAuth; |
| | | import com.dsh.guns.modular.system.model.OperatorAuthAlipay; |
| | | import com.dsh.guns.modular.system.model.OperatorUser; |
| | | import com.dsh.guns.modular.system.model.TOperator; |
| | | import com.dsh.guns.modular.system.service.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Component |
| | | public class TaskUtil { |
| | | @Autowired |
| | | private TOperatorService operatorService; |
| | | @Autowired |
| | | private TOperatorCityService operatorCityService; |
| | | @Autowired |
| | | private IOperatorAuthService operatorAuthService; |
| | | @Autowired |
| | | private IOperatorAuthWxService operatorAuthWxService; |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | // 每隔5分钟执行一次 查询商户支付宝和微信绑定状态 |
| | | @Scheduled(fixedRate = 5 * 60 * 1000) |
| | | public void queryWxAndZfbState() { |
| | | // 支付宝 |
| | | List<OperatorAuthAlipay> list = operatorAuthService.list(); |
| | | for (OperatorAuthAlipay operatorAuthAlipay : list) { |
| | | OperatorUser operatorId = operatorUserService.getOne(new QueryWrapper<OperatorUser>() |
| | | .eq("operatorId", operatorAuthAlipay.getOperatorId())); |
| | | if (operatorId == null)return; |
| | | operatorId.setAlipayAudit(operatorAuthAlipay.getAuditState()); |
| | | operatorUserService.updateById(operatorId); |
| | | } |
| | | // 微信 |
| | | List<OperatorAuth> list1 = operatorAuthWxService.list(); |
| | | for (OperatorAuth operatorAuth : list1) { |
| | | OperatorUser operatorId = operatorUserService.getOne(new QueryWrapper<OperatorUser>() |
| | | .eq("operatorId", operatorAuth.getOperatorId())); |
| | | if (operatorId == null)return; |
| | | operatorId.setWechatAudit(operatorAuth.getAuditState()); |
| | | operatorUserService.updateById(operatorId); |
| | | } |
| | | } |
| | | // 每隔5分钟执行一次 查询商户支付宝和微信绑定状态 如果两者都进件成功 那么修改t_operator表为商户绑定成功状态 |
| | | @Scheduled(fixedRate = 5 * 60 * 1000) |
| | | public void queryOperatorState() { |
| | | List<TOperator> list2 = operatorService.list(); |
| | | for (TOperator tOperator : list2) { |
| | | OperatorUser operatorId = operatorUserService.getOne(new QueryWrapper<OperatorUser>() |
| | | .eq("operatorId", tOperator.getId())); |
| | | if (operatorId == null)return; |
| | | if (operatorId.getAlipayAudit() == 2 && operatorId.getWechatAudit() == 2){ |
| | | tOperator.setState(2); |
| | | operatorService.updateById(tOperator); |
| | | } |
| | | } |
| | | |
| | | } |
| | | @Scheduled(fixedRate = 1 * 60 * 1000) |
| | | public void queryOperatorState1() { |
| | | List<OperatorAuth> list = operatorAuthWxService.list(); |
| | | for (OperatorAuth operatorAuth : list) { |
| | | queryState(operatorAuth.getOrderNo()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 查询进件申请单审核状态 |
| | | */ |
| | | public JSONObject queryState(String orderNo) { |
| | | String url = "https://api.mch.weixin.qq.com/v3/ecommerce/applyments/out-request-no/"+orderNo; |
| | | String req1 = HttpRequestUtil.getReq1(url, new HashMap<>()); |
| | | System.err.println("查询申请单审核状态字符串"+req1); |
| | | JSONObject jsonObject = JSON.parseObject(req1); |
| | | System.err.println("查询申请单审核状态Json"+jsonObject); |
| | | String applymentState = jsonObject.getString("applyment_state"); |
| | | String outBizNo = jsonObject.getString("out_request_no"); |
| | | OperatorAuth operatorAuth = operatorAuthWxService.getOne( |
| | | new QueryWrapper<OperatorAuth>() |
| | | .eq("outBizNo", outBizNo)); |
| | | if (operatorAuth == null)return null; |
| | | |
| | | |
| | | |
| | | OperatorUser operatorUser = operatorUserService.getOne(new QueryWrapper<OperatorUser>() |
| | | .eq("operatorId", operatorAuth.getOperatorId())); |
| | | // 审核状态 |
| | | operatorAuth.setApplymentState(applymentState); |
| | | if (applymentState.equals("REJECTED") || applymentState.equals("FROZEN")){ |
| | | operatorUser.setWechatAudit(3); |
| | | operatorAuth.setAuditState(2); |
| | | // 如果被拒 赋值拒绝原因 |
| | | operatorAuth.setRefuseReason(jsonObject.getJSONObject("audit_detail").getString("reject_reason")); |
| | | } |
| | | if (applymentState.equals("NEED_SIGN")){ |
| | | operatorAuth.setSignUrl(jsonObject.getString("sign_url")); |
| | | operatorAuth.setMerchantNumber(jsonObject.getString("sub_mchid")); |
| | | } |
| | | if (applymentState.equals("FINISH")){ |
| | | operatorAuth.setMerchantNumber(jsonObject.getString("sub_mchid")); |
| | | operatorUser.setWechatAudit(2); |
| | | operatorAuth.setAuditState(1); |
| | | } |
| | | if (applymentState.equals("ACCOUNT_NEED_VERIFY")){ |
| | | operatorAuth.setLegalValidationUrl(jsonObject.getString("legal_validation_url")); |
| | | } |
| | | return jsonObject; |
| | | /** |
| | | * { |
| | | * "applyment_state" : "FINISH", |
| | | * "applyment_state_desc" : "审核中", |
| | | * "sign_url" : "https://pay.weixin.qq.com/public/apply4ec_sign/s?applymentId=2000002126198476&sign=b207b673049a32c858f3aabd7d27c7ec", |
| | | * "sub_mchid" : "1542488631", |
| | | * "account_validation" : { |
| | | * "account_name" : "aOf7Gk2qT26kakkuTZpbFAn7Mb7xcar0LlQaYoi3+LnnWwgAsfaUUTg9+GmYJq6YCz+RiluWHeHFq1lt8n3eIkF0laVvqmAU80xIWGZgWJnRmnRuZxsg0HJZfnUac2JfqyuL8OoyM2YSuYDqdsyvcOlgUQgq8MPCR6pmvhBCmIeJvnVSm8J+L+yx912itUmTDxhdBlu1CFBIUefME9nYB70vCVTNAVXgURkf65mjHMBiE9Y+wrPZVmTIIz3C3PtPVMZYDEvBT4rDdICA3ZYXshYqeOSslSjSMf+MhhC4oaujiISFzq3AE+as7mAEDJly+DgRuVs74msmKUH8pl+3oA==", |
| | | * "account_no" : "aOf7Gk2qT26kakkuTZpbFAn7Mb7xcar0LlQaYoi3+LnnWwgAsfaUUTg9+GmYJq6YCz+RiluWHeHFq1lt8n3eIkF0laVvqmAU80xIWGZgWJnRmnRuZxsg0HJZfnUac2JfqyuL8OoyM2YSuYDqdsyvcOlgUQgq8MPCR6pmvhBCmIeJvnVSm8J+L+yx912itUmTDxhdBlu1CFBIUefME9nYB70vCVTNAVXgURkf65mjHMBiE9Y+wrPZVmTIIz3C3PtPVMZYDEvBT4rDdICA3ZYXshYqeOSslSjSMf+MhhC4oaujiISFzq3AE+as7mAEDJly+DgRuVs74msmKUH8pl+3oA==", |
| | | * "pay_amount" : 124, |
| | | * "destination_account_number" : "7222223333322332", |
| | | * "destination_account_name" : "财付通支付科技有限公司", |
| | | * "destination_account_bank" : "招商银行威盛大厦支行", |
| | | * "city" : "深圳", |
| | | * "remark" : "入驻账户验证", |
| | | * "deadline" : "2018-12-10 17:09:01" |
| | | * }, |
| | | * "audit_detail" : [ |
| | | * { |
| | | * "param_name" : "id_card_copy", |
| | | * "reject_reason" : "身份证背面识别失败,请上传更清晰的身份证图片。" |
| | | * } |
| | | * ], |
| | | * "legal_validation_url" : "https://pay.weixin.qq.com/public/apply4ec_sign/s?applymentId=2000002126198476&sign=b207b673049a32c858f3aabd7d27c7ec", |
| | | * "out_request_no" : "APPLYMENT_00000000001", |
| | | * "applyment_id" : 2000002124775691, |
| | | * "sign_state" : "SIGNED" |
| | | * } |
| | | */ |
| | | } |
| | | |
| | | /** |
| | | * 每月第一天的1点执行的任务 |
| | |
| | | package com.dsh.guns.modular.system.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.domain.Shop; |
| | | import com.dsh.course.util.UUIDUtil; |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | | import com.dsh.guns.modular.system.controller.util.UploadUtil; |
| | | import com.dsh.guns.modular.system.model.OperatorAuth; |
| | | import com.dsh.guns.modular.system.model.TOperator; |
| | | import com.dsh.guns.modular.system.model.User; |
| | | import com.dsh.guns.modular.system.service.IUserService; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsRequest; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsResult; |
| | | import com.github.binarywang.wxpay.bean.media.ImageUploadResult; |
| | | import com.github.binarywang.wxpay.service.EcommerceService; |
| | | import com.github.binarywang.wxpay.service.MerchantMediaService; |
| | | import com.github.binarywang.wxpay.service.WxPayService; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.NoArgsConstructor; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.http.*; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.InputStream; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 微信工具类 |
| | | */ |
| | | @Component |
| | | public class WeChatUtil { |
| | | |
| | | private WxPayService wxService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * @description 电商二级商户进件(提交申请单) |
| | | * @author jqs |
| | | * @date 2023/8/11 10:04 |
| | | * @param shopAuthentication |
| | | * @param applyNumber |
| | | * @param operator |
| | | * @return ApplymentsResult |
| | | */ |
| | | |
| | | |
| | | public ApplymentsResult ecommerceApply(OperatorAuth shopAuthentication, String applyNumber, TOperator operator) throws Exception { |
| | | |
| | | EcommerceService ecommerceService = wxService.getEcommerceService(); |
| | | MerchantMediaService merchantMediaService = wxService.getMerchantMediaService(); |
| | | ApplymentsRequest request = new ApplymentsRequest(); |
| | | //生成提交类 |
| | | request.setOutRequestNo(applyNumber); |
| | | if("ENTERPRISE".equals(shopAuthentication.getBodyType())){ |
| | | request.setOrganizationType("2"); |
| | | }else{ |
| | | request.setOrganizationType("4"); |
| | | } |
| | | //营业执照 |
| | | ApplymentsRequest.BusinessLicenseInfo business_license_info = new ApplymentsRequest.BusinessLicenseInfo(); |
| | | InputStream blImageIO = OBSUploadUtil.getOBSStream(shopAuthentication.getBusinessPicture().replace("https://obs.ap-southeast-4.myhuaweicloud.com/","")); |
| | | ImageUploadResult blImageIR = merchantMediaService.imageUploadV3(blImageIO,applyNumber+"blimage.jpg"); |
| | | business_license_info.setBusinessLicenseCopy(blImageIR.getMediaId()); |
| | | blImageIO.close(); |
| | | business_license_info.setBusinessLicenseNumber(shopAuthentication.getBusinessNumber()); |
| | | business_license_info.setMerchantName(shopAuthentication.getBusinessName()); |
| | | business_license_info.setLegalPerson(shopAuthentication.getLegalPerson()); |
| | | business_license_info.setCompanyAddress(shopAuthentication.getRegisterAddress()); |
| | | List<String> businessTimeList = new ArrayList<>(); |
| | | businessTimeList.add(0,shopAuthentication.getBusinessTerm()); |
| | | businessTimeList.add(1,shopAuthentication.getBusinessEnd()); |
| | | if(businessTimeList!=null&&businessTimeList.size()>1){ |
| | | String businessTime = JSONObject.toJSONString(businessTimeList); |
| | | business_license_info.setBusinessTime(businessTime); |
| | | } |
| | | request.setBusinessLicenseInfo(business_license_info); |
| | | //法人证件 |
| | | request.setIdDocType("IDENTIFICATION_TYPE_MAINLAND_IDCARD"); |
| | | ApplymentsRequest.IdCardInfo id_card_info = new ApplymentsRequest.IdCardInfo(); |
| | | InputStream lpIcFrontIO = OBSUploadUtil.getOBSStream(shopAuthentication.getLegalFront().replace("https://obs.ap-southeast-4.myhuaweicloud.com/","")); |
| | | ImageUploadResult lpIcFrontIR = merchantMediaService.imageUploadV3(lpIcFrontIO,applyNumber+"lpIcFront.jpg"); |
| | | id_card_info.setIdCardCopy(lpIcFrontIR.getMediaId()); |
| | | lpIcFrontIO.close(); |
| | | InputStream lpIcBackIO = OBSUploadUtil.getOBSStream(shopAuthentication.getLegalBack().replace("https://obs.ap-southeast-4.myhuaweicloud.com/","")); |
| | | ImageUploadResult lpIcBackIR = merchantMediaService.imageUploadV3(lpIcBackIO,applyNumber+"lpIcBack.jpg"); |
| | | id_card_info.setIdCardNational(lpIcBackIR.getMediaId()); |
| | | lpIcBackIO.close(); |
| | | id_card_info.setIdCardName(shopAuthentication.getLegalPerson()); |
| | | id_card_info.setIdCardNumber(shopAuthentication.getLeagleNumber()); |
| | | if("ENTERPRISE".equals(shopAuthentication.getBodyType())){ |
| | | id_card_info.setIdCardAddress(shopAuthentication.getLegalAddress()); |
| | | } |
| | | id_card_info.setIdCardValidTimeBegin(shopAuthentication.getLegalTerm()); |
| | | id_card_info.setIdCardValidTime(shopAuthentication.getLegalEnd()); |
| | | request.setIdCardInfo(id_card_info); |
| | | //企业填写 |
| | | if("ENTERPRISE".equals(shopAuthentication.getBodyType())){ |
| | | //受益人 |
| | | if("true".equals(shopAuthentication.getIsBeneficiary())){ |
| | | request.setOwner(true); |
| | | }else{ |
| | | request.setOwner(false); |
| | | List<ApplymentsRequest.UboInfo> ubo_info_list = new ArrayList<>(); |
| | | ApplymentsRequest.UboInfo uboInfo = new ApplymentsRequest.UboInfo(); |
| | | uboInfo.setUboIdDocType("IDENTIFICATION_TYPE_MAINLAND_IDCARD"); |
| | | InputStream uboIcFrontIO = OBSUploadUtil.getOBSStream(shopAuthentication.getBeneficiaryFront().replace("https://obs.ap-southeast-4.myhuaweicloud.com/","")); |
| | | ImageUploadResult uboIcFrontIR = merchantMediaService.imageUploadV3(uboIcFrontIO,applyNumber+"uboIcFront.jpg"); |
| | | uboInfo.setUboIdDocCopy(uboIcFrontIR.getMediaId()); |
| | | uboIcFrontIO.close(); |
| | | InputStream uboIcBackIO = OBSUploadUtil.getOBSStream(shopAuthentication.getBeneficiaryBack().replace("https://obs.ap-southeast-4.myhuaweicloud.com/","")); |
| | | ImageUploadResult uboIcBackIR = merchantMediaService.imageUploadV3(uboIcBackIO,applyNumber+"uboIcBack.jpg"); |
| | | uboInfo.setUboIdDocCopyBack(uboIcBackIR.getMediaId()); |
| | | uboIcBackIO.close(); |
| | | uboInfo.setUboIdDocName(shopAuthentication.getBeneficiary()); |
| | | uboInfo.setUboIdDocNumber(shopAuthentication.getBeneficiaryNumber()); |
| | | uboInfo.setUboIdDocAddress(shopAuthentication.getBeneficiaryAddress()); |
| | | uboInfo.setUboIdDocPeriodBegin(shopAuthentication.getBeneficiaryTerm()); |
| | | ubo_info_list.add(uboInfo); |
| | | request.setUboInfoList(ubo_info_list); |
| | | } |
| | | } |
| | | //结算账户信息 |
| | | ApplymentsRequest.AccountInfo accountInfo = new ApplymentsRequest.AccountInfo(); |
| | | if(shopAuthentication.getAccountType().equals(1)){ |
| | | accountInfo.setBankAccountType("74"); |
| | | }else{ |
| | | accountInfo.setBankAccountType("75"); |
| | | } |
| | | accountInfo.setAccountBank(shopAuthentication.getBank()); |
| | | accountInfo.setAccountName(shopAuthentication.getAccountName()); |
| | | accountInfo.setBankAddressCode(shopAuthentication.getCityCode()); |
| | | accountInfo.setBankName(shopAuthentication.getBankName()); |
| | | accountInfo.setAccountNumber(shopAuthentication.getBankNumber()); |
| | | request.setAccountInfo(accountInfo); |
| | | ApplymentsRequest.ContactInfo contactInfo = new ApplymentsRequest.ContactInfo(); |
| | | contactInfo.setContactType("65"); |
| | | contactInfo.setContactName(shopAuthentication.getLegalPerson()); |
| | | contactInfo.setContactIdCardNumber(shopAuthentication.getLeagleNumber()); |
| | | contactInfo.setMobilePhone(shopAuthentication.getLegalPhone()); |
| | | contactInfo.setContactEmail(shopAuthentication.getLegalEmail()); |
| | | request.setContactInfo(contactInfo); |
| | | //店铺信息 |
| | | ApplymentsRequest.SalesSceneInfo salesSceneInfo = new ApplymentsRequest.SalesSceneInfo(); |
| | | salesSceneInfo.setStoreName(operator.getName()); |
| | | // InputStream storeQrCodeIO = OBSUploadUtils.getOSSInputStream(operator.getShopCode().replace("https://hongruitang.oss-cn-beijing.aliyuncs.com/","")); |
| | | // ImageUploadResult storeQrCodeIR = merchantMediaService.imageUploadV3(storeQrCodeIO,applyNumber+"storeQrCode.jpg"); |
| | | // salesSceneInfo.setStoreQrCode(storeQrCodeIR.getMediaId()); |
| | | // storeQrCodeIO.close(); |
| | | request.setSalesSceneInfo(salesSceneInfo); |
| | | request.setMerchantShortname(operator.getName()); |
| | | // request.setBusinessAdditionPics(shopAuthentication.getBaPics()); |
| | | // request.setBusinessAdditionDesc(shopAuthentication.getBaDesc()); |
| | | return ecommerceService.createApply(request); |
| | | } |
| | | |
| | | } |
| | | //package com.dsh.guns.modular.system.util; |
| | | // |
| | | //import com.alibaba.fastjson.JSON; |
| | | //import com.alibaba.fastjson.JSONObject; |
| | | //import com.alipay.api.domain.Shop; |
| | | //import com.dsh.course.util.UUIDUtil; |
| | | //import com.dsh.guns.core.util.ToolUtil; |
| | | //import com.dsh.guns.modular.system.controller.util.UploadUtil; |
| | | //import com.dsh.guns.modular.system.model.OperatorAuth; |
| | | //import com.dsh.guns.modular.system.model.TOperator; |
| | | //import com.dsh.guns.modular.system.model.User; |
| | | //import com.dsh.guns.modular.system.service.IUserService; |
| | | //import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsRequest; |
| | | //import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsResult; |
| | | //import com.github.binarywang.wxpay.bean.media.ImageUploadResult; |
| | | //import com.github.binarywang.wxpay.service.EcommerceService; |
| | | //import com.github.binarywang.wxpay.service.MerchantMediaService; |
| | | //import com.github.binarywang.wxpay.service.WxPayService; |
| | | //import lombok.AllArgsConstructor; |
| | | //import lombok.NoArgsConstructor; |
| | | //import org.apache.commons.codec.digest.DigestUtils; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.beans.factory.annotation.Value; |
| | | //import org.springframework.context.annotation.Bean; |
| | | //import org.springframework.http.*; |
| | | //import org.springframework.stereotype.Component; |
| | | //import org.springframework.web.client.RestTemplate; |
| | | // |
| | | //import java.io.ByteArrayInputStream; |
| | | //import java.io.InputStream; |
| | | //import java.io.UnsupportedEncodingException; |
| | | //import java.net.URLDecoder; |
| | | //import java.util.ArrayList; |
| | | //import java.util.HashMap; |
| | | //import java.util.List; |
| | | //import java.util.Map; |
| | | // |
| | | ///** |
| | | // * 微信工具类 |
| | | // */ |
| | | //@Component |
| | | //public class WeChatUtil { |
| | | // |
| | | // private WxPayService wxService; |
| | | // |
| | | // |
| | | // |
| | | // /** |
| | | // * @description 电商二级商户进件(提交申请单) |
| | | // * @author jqs |
| | | // * @date 2023/8/11 10:04 |
| | | // * @param shopAuthentication |
| | | // * @param applyNumber |
| | | // * @param operator |
| | | // * @return ApplymentsResult |
| | | // */ |
| | | // |
| | | // |
| | | // public ApplymentsResult ecommerceApply(OperatorAuth shopAuthentication, String applyNumber, TOperator operator) throws Exception { |
| | | // |
| | | // EcommerceService ecommerceService = wxService.getEcommerceService(); |
| | | // MerchantMediaService merchantMediaService = wxService.getMerchantMediaService(); |
| | | // ApplymentsRequest request = new ApplymentsRequest(); |
| | | // //生成提交类 |
| | | // request.setOutRequestNo(applyNumber); |
| | | // if("ENTERPRISE".equals(shopAuthentication.getBodyType())){ |
| | | // request.setOrganizationType("2"); |
| | | // }else{ |
| | | // request.setOrganizationType("4"); |
| | | // } |
| | | // //营业执照 |
| | | // ApplymentsRequest.BusinessLicenseInfo business_license_info = new ApplymentsRequest.BusinessLicenseInfo(); |
| | | // InputStream blImageIO = OBSUploadUtil.getOBSStream(shopAuthentication.getBusinessPicture().replace("https://obs.ap-southeast-4.myhuaweicloud.com/","")); |
| | | // ImageUploadResult blImageIR = merchantMediaService.imageUploadV3(blImageIO,applyNumber+"blimage.jpg"); |
| | | // business_license_info.setBusinessLicenseCopy(blImageIR.getMediaId()); |
| | | // blImageIO.close(); |
| | | // business_license_info.setBusinessLicenseNumber(shopAuthentication.getBusinessNumber()); |
| | | // business_license_info.setMerchantName(shopAuthentication.getBusinessName()); |
| | | // business_license_info.setLegalPerson(shopAuthentication.getLegalPerson()); |
| | | // business_license_info.setCompanyAddress(shopAuthentication.getRegisterAddress()); |
| | | // List<String> businessTimeList = new ArrayList<>(); |
| | | // businessTimeList.add(0,shopAuthentication.getBusinessTerm()); |
| | | // businessTimeList.add(1,shopAuthentication.getBusinessEnd()); |
| | | // if(businessTimeList!=null&&businessTimeList.size()>1){ |
| | | // String businessTime = JSONObject.toJSONString(businessTimeList); |
| | | // business_license_info.setBusinessTime(businessTime); |
| | | // } |
| | | // request.setBusinessLicenseInfo(business_license_info); |
| | | // //法人证件 |
| | | // request.setIdDocType("IDENTIFICATION_TYPE_MAINLAND_IDCARD"); |
| | | // ApplymentsRequest.IdCardInfo id_card_info = new ApplymentsRequest.IdCardInfo(); |
| | | // InputStream lpIcFrontIO = OBSUploadUtil.getOBSStream(shopAuthentication.getLegalFront().replace("https://obs.ap-southeast-4.myhuaweicloud.com/","")); |
| | | // ImageUploadResult lpIcFrontIR = merchantMediaService.imageUploadV3(lpIcFrontIO,applyNumber+"lpIcFront.jpg"); |
| | | // id_card_info.setIdCardCopy(lpIcFrontIR.getMediaId()); |
| | | // lpIcFrontIO.close(); |
| | | // InputStream lpIcBackIO = OBSUploadUtil.getOBSStream(shopAuthentication.getLegalBack().replace("https://obs.ap-southeast-4.myhuaweicloud.com/","")); |
| | | // ImageUploadResult lpIcBackIR = merchantMediaService.imageUploadV3(lpIcBackIO,applyNumber+"lpIcBack.jpg"); |
| | | // id_card_info.setIdCardNational(lpIcBackIR.getMediaId()); |
| | | // lpIcBackIO.close(); |
| | | // id_card_info.setIdCardName(shopAuthentication.getLegalPerson()); |
| | | // id_card_info.setIdCardNumber(shopAuthentication.getLeagleNumber()); |
| | | // if("ENTERPRISE".equals(shopAuthentication.getBodyType())){ |
| | | // id_card_info.setIdCardAddress(shopAuthentication.getLegalAddress()); |
| | | // } |
| | | // id_card_info.setIdCardValidTimeBegin(shopAuthentication.getLegalTerm()); |
| | | // id_card_info.setIdCardValidTime(shopAuthentication.getLegalEnd()); |
| | | // request.setIdCardInfo(id_card_info); |
| | | // //企业填写 |
| | | // if("ENTERPRISE".equals(shopAuthentication.getBodyType())){ |
| | | // //受益人 |
| | | // if("true".equals(shopAuthentication.getIsBeneficiary())){ |
| | | // request.setOwner(true); |
| | | // }else{ |
| | | // request.setOwner(false); |
| | | // List<ApplymentsRequest.UboInfo> ubo_info_list = new ArrayList<>(); |
| | | // ApplymentsRequest.UboInfo uboInfo = new ApplymentsRequest.UboInfo(); |
| | | // uboInfo.setUboIdDocType("IDENTIFICATION_TYPE_MAINLAND_IDCARD"); |
| | | // InputStream uboIcFrontIO = OBSUploadUtil.getOBSStream(shopAuthentication.getBeneficiaryFront().replace("https://obs.ap-southeast-4.myhuaweicloud.com/","")); |
| | | // ImageUploadResult uboIcFrontIR = merchantMediaService.imageUploadV3(uboIcFrontIO,applyNumber+"uboIcFront.jpg"); |
| | | // uboInfo.setUboIdDocCopy(uboIcFrontIR.getMediaId()); |
| | | // uboIcFrontIO.close(); |
| | | // InputStream uboIcBackIO = OBSUploadUtil.getOBSStream(shopAuthentication.getBeneficiaryBack().replace("https://obs.ap-southeast-4.myhuaweicloud.com/","")); |
| | | // ImageUploadResult uboIcBackIR = merchantMediaService.imageUploadV3(uboIcBackIO,applyNumber+"uboIcBack.jpg"); |
| | | // uboInfo.setUboIdDocCopyBack(uboIcBackIR.getMediaId()); |
| | | // uboIcBackIO.close(); |
| | | // uboInfo.setUboIdDocName(shopAuthentication.getBeneficiary()); |
| | | // uboInfo.setUboIdDocNumber(shopAuthentication.getBeneficiaryNumber()); |
| | | // uboInfo.setUboIdDocAddress(shopAuthentication.getBeneficiaryAddress()); |
| | | // uboInfo.setUboIdDocPeriodBegin(shopAuthentication.getBeneficiaryTerm()); |
| | | // ubo_info_list.add(uboInfo); |
| | | // request.setUboInfoList(ubo_info_list); |
| | | // } |
| | | // } |
| | | // //结算账户信息 |
| | | // ApplymentsRequest.AccountInfo accountInfo = new ApplymentsRequest.AccountInfo(); |
| | | // if(shopAuthentication.getAccountType().equals(1)){ |
| | | // accountInfo.setBankAccountType("74"); |
| | | // }else{ |
| | | // accountInfo.setBankAccountType("75"); |
| | | // } |
| | | // accountInfo.setAccountBank(shopAuthentication.getBank()); |
| | | // accountInfo.setAccountName(shopAuthentication.getAccountName()); |
| | | // accountInfo.setBankAddressCode(shopAuthentication.getCityCode()); |
| | | // accountInfo.setBankName(shopAuthentication.getBankName()); |
| | | // accountInfo.setAccountNumber(shopAuthentication.getBankNumber()); |
| | | // request.setAccountInfo(accountInfo); |
| | | // ApplymentsRequest.ContactInfo contactInfo = new ApplymentsRequest.ContactInfo(); |
| | | // contactInfo.setContactType("65"); |
| | | // contactInfo.setContactName(shopAuthentication.getLegalPerson()); |
| | | // contactInfo.setContactIdCardNumber(shopAuthentication.getLeagleNumber()); |
| | | // contactInfo.setMobilePhone(shopAuthentication.getLegalPhone()); |
| | | // contactInfo.setContactEmail(shopAuthentication.getLegalEmail()); |
| | | // request.setContactInfo(contactInfo); |
| | | // //店铺信息 |
| | | // ApplymentsRequest.SalesSceneInfo salesSceneInfo = new ApplymentsRequest.SalesSceneInfo(); |
| | | // salesSceneInfo.setStoreName(operator.getName()); |
| | | //// InputStream storeQrCodeIO = OBSUploadUtils.getOSSInputStream(operator.getShopCode().replace("https://hongruitang.oss-cn-beijing.aliyuncs.com/","")); |
| | | //// ImageUploadResult storeQrCodeIR = merchantMediaService.imageUploadV3(storeQrCodeIO,applyNumber+"storeQrCode.jpg"); |
| | | //// salesSceneInfo.setStoreQrCode(storeQrCodeIR.getMediaId()); |
| | | //// storeQrCodeIO.close(); |
| | | // request.setSalesSceneInfo(salesSceneInfo); |
| | | // request.setMerchantShortname(operator.getName()); |
| | | //// request.setBusinessAdditionPics(shopAuthentication.getBaPics()); |
| | | //// request.setBusinessAdditionDesc(shopAuthentication.getBaDesc()); |
| | | // return ecommerceService.createApply(request); |
| | | // } |
| | | // |
| | | //} |
New file |
| | |
| | | package com.dsh.guns.modular.system.util; |
| | | |
| | | |
| | | import com.github.binarywang.wxpay.v3.WechatPayUploadHttpPost; |
| | | import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Validator; |
| | | import com.wechat.pay.contrib.apache.httpclient.util.PemUtil; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | import org.apache.http.HttpEntity; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.net.URI; |
| | | import java.net.URISyntaxException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.PrivateKey; |
| | | import java.text.ParseException; |
| | | import java.util.Date; |
| | | |
| | | import static org.apache.http.HttpStatus.SC_OK; |
| | | import static org.junit.Assert.assertEquals; |
| | | |
| | | |
| | | /** |
| | | * 定时任务工具类 |
| | | */ |
| | | @Component |
| | | public class WxUploadImgUtil { |
| | | // 你的商户私钥 |
| | | private static final String privateKey = "-----BEGIN PRIVATE KEY-----\n" |
| | | + "-----END PRIVATE KEY-----\n"; |
| | | //测试AutoUpdateCertificatesVerifier的verify方法参数 |
| | | private static final String serialNumber = ""; |
| | | private static final String message = ""; |
| | | private static final String signature = ""; |
| | | private static final String merchantId = ""; // 商户号 |
| | | private static final String merchantSerialNumber = ""; // 商户证书序列号 |
| | | private static final String apiV3Key = ""; // API V3密钥 |
| | | private CloseableHttpClient httpClient; |
| | | private AutoUpdateCertificatesVerifier verifier; |
| | | |
| | | public String uploadImg(String date, String pattern) throws IOException, URISyntaxException { |
| | | PrivateKey merchantPrivateKey = PemUtil.loadPrivateKey(privateKey); |
| | | |
| | | //使用自动更新的签名验证器,不需要传入证书 |
| | | verifier = new AutoUpdateCertificatesVerifier( |
| | | new WechatPay2Credentials(merchantId, new PrivateKeySigner(merchantSerialNumber, merchantPrivateKey)), |
| | | apiV3Key.getBytes(StandardCharsets.UTF_8)); |
| | | |
| | | httpClient = WechatPayHttpClientBuilder.create() |
| | | .withMerchant(merchantId, merchantSerialNumber, merchantPrivateKey) |
| | | .withValidator(new WechatPay2Validator(verifier)) |
| | | .build(); |
| | | String filePath = "/your/home/hellokitty.png"; |
| | | URI uri = new URI("https://api.mch.weixin.qq.com/v3/merchant/media/upload"); |
| | | File file = new File(filePath); |
| | | try (FileInputStream fileIs = new FileInputStream(file)) { |
| | | String sha256 = DigestUtils.sha256Hex(fileIs); |
| | | try (InputStream is = new FileInputStream(file)) { |
| | | WechatPayUploadHttpPost request = new WechatPayUploadHttpPost.Builder(uri) |
| | | .withImage(file.getName(), sha256, is) |
| | | .build(); |
| | | |
| | | try (CloseableHttpResponse response = httpClient.execute(request)) { |
| | | assertEquals(SC_OK, response.getStatusLine().getStatusCode()); |
| | | HttpEntity entity = response.getEntity(); |
| | | // do something useful with the response body |
| | | // and ensure it is fully consumed |
| | | String s = EntityUtils.toString(entity); |
| | | System.out.println(s); |
| | | } |
| | | } |
| | | } |
| | | httpClient.close(); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dsh.course.mapper.TOperatorAuthWxMapper"> |
| | | |
| | | |
| | | </mapper> |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .avatar-uploader .el-upload { |
| | | border: 1px dashed #d9d9d9; |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | height: 100px; |
| | | width: 100px; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .avatar-uploader .el-upload:hover { |
| | | border-color: #409EFF; |
| | | } |
| | | .avatar-uploader-icon { |
| | | font-size: 28px; |
| | | color: #8c939d; |
| | | width: 100px; |
| | | height: 100px; |
| | | line-height: 100px; |
| | | margin-top: 32px; |
| | | text-align: center; |
| | | } |
| | | .avatar { |
| | | width: 100px; |
| | | height: 100px; |
| | | display: block; |
| | | } |
| | | |
| | | .col-sm-12 { |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .col-sm-12 select { |
| | | height: 33px; |
| | | } |
| | | #app1{ |
| | | margin-left: 255px; |
| | | } |
| | | |
| | | |
| | | </style> |
| | | <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="carInfoForm"> |
| | | <h2>商户信息</h2> |
| | | <div style="display: flex"> |
| | | <span>运营商名称:</span><span>${data.name}</span> |
| | | <span>管理员姓名:</span><span>${user.name}</span> |
| | | <span>管理员电话:</span><span>${user.phone}</span> |
| | | </div> |
| | | <h2>商户号信息</h2> |
| | | </br> |
| | | </br> |
| | | <input hidden id="id" value="${id}"> |
| | | <div class="row"> |
| | | <div class="col-lg-6" style=""> |
| | | <div class="form-group"> |
| | | <label class="col-sm-4 control-label" > |
| | | 商户类型:<input checked type="radio" name="bodyType" value="2" onclick="updateHalf(2)">企业 |
| | | <input type="radio" name="bodyType" value="4" onclick="updateHalf(1)">个人 |
| | | </label> |
| | | </div> |
| | | |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*法人姓名:</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" id="legalPerson" value="" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*法人身份证号:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="" id="leagleNumber" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <#avatar id="IDCardImg" name="*法人身份证正面照" avatarImg="" /> |
| | | </div> |
| | | <div class="form-group"> |
| | | <#avatar id="IDCardImg1" name="*法人身份证背面照" avatarImg="" /> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*身份证开始时间:</label> |
| | | <div class="col-sm-9" style="display: flex"> |
| | | <input style="width: 300px" class="form-control" id="IDCardTime" value="" name="IDCardTime" type="date"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*身份证结束时间:</label> |
| | | <div class="col-sm-9" style="display: flex"> |
| | | <input style="width: 300px" class="form-control" value="" id="IDCardEnd" name="IDCardTime" type="date"> |
| | | <input type="checkbox" style="margin-left: 10px" id="IDCardE" value="0" onchange="TSite.tradeYse(this)">长期</input> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*证件居住地址:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="" id="legalAddress" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*法人邮箱:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="" id="legalEmail" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*法人电话:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="" id="legalPhone" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <#avatar id="license" name="*营业执照" avatarImg="" /> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*营业执照注册号:</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" id="businessNumber" value="" placeholder="请输入营业执照注册号" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*商户名称(一般与证件名称相同):</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="" id="businessName" placeholder="请输入商户名称" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*商户别名(微信账单显示的商户名称):</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="" id="aliasName" placeholder="请输入商户别名" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*营业期限(开始):</label> |
| | | <div class="col-sm-9" style="display: flex"> |
| | | <input style="width: 300px" class="form-control" id="tradeTime" value="" name="tradeTime" type="date"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*营业期限(结束):</label> |
| | | <div class="col-sm-9" style="display: flex"> |
| | | <input style="width: 300px" class="form-control" value="" id="endTime" name="endTime" type="date"> |
| | | <input type="checkbox" style="margin-left: 10px" id="tradeE" value="0" onchange="TSite.tradeYse(this)">长期</input> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*营业执照注册地址:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="" id="companyAddress" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-lg-6" style=""> |
| | | <div id="banks"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-4 control-label" > |
| | | 账号使用类型:<input checked type="radio" name="useType" value="74" >对公 |
| | | <input type="radio" name="useType" value="75" >对私 |
| | | </label> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*开户银行:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" id="bank" value="" placeholder="请输入(例:中国农业银行)" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*开户银行联行号:</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" id="bankCardTwo" value="" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*开户名称:</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" id="bankUserName" value="" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*开户银行全称(含支行):</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" id="bankName1" value="" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*银行账号:</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" id="bankCard" value="" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group" id="provinceCode"> |
| | | <label class="col-sm-3 control-label">*开户行所在省:</label> |
| | | <div class="col-sm-9"> |
| | | <select style="width: 300px" class="form-control" id="pCode" name="pCode" onchange="TSite.oneChange2(this)"> |
| | | <option style="width: 300px" value="">全部</option> |
| | | @for(obj in list){ |
| | | <option style="width: 300px" value="${obj.code}">${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" id="cityCode"> |
| | | <label class="col-sm-3 control-label">*开户行所在市:</label> |
| | | <div class="col-sm-9"> |
| | | <select style="width: 300px" class="form-control" id="cCode" name="cCode" > |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row" id="benefit"> |
| | | <div class="col-lg-6" style=""> |
| | | <div class="form-group"> |
| | | <label class="col-sm-4 control-label" > |
| | | 法人是否为受益人:<input type="radio" checked name="type" value="true" onclick="updateHalf1(1)">是 |
| | | <input type="radio" name="type" value="false" onclick="updateHalf1(0)">否 |
| | | </label> |
| | | </div> |
| | | <div hidden id="benefitInfo"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*受益人姓名:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" id="bName" name="bName" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*受益人身份证地址:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" id="bAddress" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*受益人身份证有效期:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" id="bTime" name="bTime" type="date"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*受益人身份证结束时间:</label> |
| | | <div class="col-sm-9" style="display: flex"> |
| | | <input style="width: 300px" class="form-control" id="bEnd" name="IDCardTime" type="date"> |
| | | <input type="checkbox" style="margin-left: 10px" id="bIDCardT" value="0" onchange="TSite.tradeYse(this)">长期</input> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <#avatar id="bImg1" name="受益人身份证正面照" /> |
| | | </div> |
| | | |
| | | <div class="col-lg-6" style=""> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*受益人身份证号:</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" id="bIDNumber" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <#avatar id="bImg2" name="受益人身份证背面照" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5" > |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TSite.addSubmit1()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TSite.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script src="${ctxPath}/modular/system/operatorUser/operatorUser.js"></script> |
| | | <script src="${ctxPath}/js/vue/vue.js"></script> |
| | | <script src="${ctxPath}/js/elementui/index.js"></script> |
| | | <link rel="stylesheet" href="${ctxPath}/js/elementui/index.css"> |
| | | <script> |
| | | function updateHalf(e) { |
| | | if(e==1){ |
| | | $("#benefit").hide() |
| | | }else { |
| | | $("#benefit").show() |
| | | } |
| | | } |
| | | function updateHalf1(e) { |
| | | if(e==0){ |
| | | // 法人不是受益人 |
| | | $("#benefitInfo").show() |
| | | }else { |
| | | // 法人是受益人 |
| | | $("#benefitInfo").hide() |
| | | } |
| | | } |
| | | |
| | | |
| | | </script> |
| | | @} |
| | |
| | | <input type="radio" name="useType" value="02" >对私 |
| | | </label> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div cl ass="form-group"> |
| | | <label class="col-sm-4 control-label" > |
| | | 银行卡类型:<input checked type="radio" name="cardType" value="DC" onclick="updateHalf(2)">借记卡 |
| | | <input type="radio" name="cardType" value="CC" onclick="updateHalf(1)">信用卡 |
| | |
| | | var cardType = "${cardType}"; |
| | | var OBJradio=document.getElementsByName("bodyType") |
| | | var type=document.getElementsByName("type") |
| | | if("${bodyType}"=="01"){ |
| | | if("${bodyType}"=="2"){ |
| | | OBJradio[0].checked=true |
| | | }else { |
| | | OBJradio[1].checked=true |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .avatar-uploader .el-upload { |
| | | border: 1px dashed #d9d9d9; |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | height: 100px; |
| | | width: 100px; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .avatar-uploader .el-upload:hover { |
| | | border-color: #409EFF; |
| | | } |
| | | .avatar-uploader-icon { |
| | | font-size: 28px; |
| | | color: #8c939d; |
| | | width: 100px; |
| | | height: 100px; |
| | | line-height: 100px; |
| | | margin-top: 32px; |
| | | text-align: center; |
| | | } |
| | | .avatar { |
| | | width: 100px; |
| | | height: 100px; |
| | | display: block; |
| | | } |
| | | |
| | | .col-sm-12 { |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .col-sm-12 select { |
| | | height: 33px; |
| | | } |
| | | #app1{ |
| | | margin-left: 255px; |
| | | } |
| | | |
| | | |
| | | </style> |
| | | <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="carInfoForm"> |
| | | <h2>商户信息</h2> |
| | | <div style="display: flex"> |
| | | <span>运营商名称:</span><span>${data.name}</span> |
| | | <span>管理员姓名:</span><span>${user.name}</span> |
| | | <span>管理员电话:</span><span>${user.phone}</span> |
| | | </div> |
| | | <h2>商户号信息</h2> |
| | | </br> |
| | | </br> |
| | | <input hidden id="id" value="${id}"> |
| | | <div class="row"> |
| | | <div class="col-lg-6" style=""> |
| | | <div class="form-group"> |
| | | <label class="col-sm-4 control-label" > |
| | | 商户类型:<input checked type="radio" name="bodyType" value="2" onclick="updateHalf(2)">企业 |
| | | <input type="radio" name="bodyType" value="4" onclick="updateHalf(1)">个人 |
| | | </label> |
| | | </div> |
| | | |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*法人姓名:</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" id="legalPerson" value="${item.legalPerson}" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*法人身份证号:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="${item.leagleNumber}" id="leagleNumber" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <#avatar id="IDCardImg" name="*法人身份证正面照" avatarImg="${item.legalFront}" /> |
| | | </div> |
| | | <div class="form-group"> |
| | | <#avatar id="IDCardImg1" name="*法人身份证背面照" avatarImg="${item.legalBack}" /> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*身份证开始时间:</label> |
| | | <div class="col-sm-9" style="display: flex"> |
| | | <input style="width: 300px" class="form-control" id="IDCardTime" value="${item.legalTerm}" name="IDCardTime" type="date"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*身份证结束时间:</label> |
| | | <div class="col-sm-9" style="display: flex"> |
| | | <input style="width: 300px" class="form-control" value="${item.legalEnd}" id="IDCardEnd" name="IDCardTime" type="date"> |
| | | <input type="checkbox" style="margin-left: 10px" id="IDCardE" value="0" onchange="TSite.tradeYse(this)">长期</input> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*证件居住地址:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="${item.legalAddress}" id="legalAddress" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*法人邮箱:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="${item.legalEmail}" id="email" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*法人电话:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="${item.legalPhone}" id="legalPhone" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <#avatar id="license" name="*营业执照" avatarImg="${item.businessPicture}" /> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*营业执照注册号:</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" id="businessNumber" value="${item.businessNumber}" placeholder="请输入营业执照注册号" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*商户名称(一般与证件名称相同):</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="${item.businessName}" id="businessName" placeholder="请输入商户名称" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*商户别名(微信账单显示的商户名称):</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="${item.aliasName}" id="aliasName" placeholder="请输入商户别名" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*营业期限(开始):</label> |
| | | <div class="col-sm-9" style="display: flex"> |
| | | <input style="width: 300px" class="form-control" id="tradeTime" value="${item.businessTerm}" name="tradeTime" type="date"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*营业期限(结束):</label> |
| | | <div class="col-sm-9" style="display: flex"> |
| | | <input style="width: 300px" class="form-control" value="${item.businessEnd}" id="endTime" name="endTime" type="date"> |
| | | <input type="checkbox" style="margin-left: 10px" id="tradeE" value="0" onchange="TSite.tradeYse(this)">长期</input> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*营业执照注册地址:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="${item.registerAddress}" id="companyAddress" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-lg-6" style=""> |
| | | <div id="banks"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-4 control-label" > |
| | | 账号使用类型:<input checked type="radio" name="useType" value="74" >对公 |
| | | <input type="radio" name="useType" value="75" >对私 |
| | | </label> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*开户银行:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" id="bankName" value="${item.bank}" placeholder="请输入(例:中国农业银行)" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*开户银行联行号:</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" id="bankCardTwo" value="${item.bankCardTwo}" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*开户名称:</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" id="bankUserName" value="${item.accountName}" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*开户银行全称(含支行):</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" id="bankName1" value="${item.bankName}" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" > |
| | | <label class="col-sm-3 control-label">*银行账号:</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" id="bankCard" value="${item.bankNumber}" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group" id="provinceCode"> |
| | | <label class="col-sm-3 control-label">*开户行所在省:</label> |
| | | <div class="col-sm-9"> |
| | | <select style="width: 300px" class="form-control" id="pCode" name="pCode" onchange="TSite.oneChange2(this)"> |
| | | @for(obj in list4){ |
| | | <option style="width: 300px" value="${obj.code}" ${obj.code == item.provinceCode ? 'selected=selected' : ''}>${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" id="cityCode"> |
| | | <label class="col-sm-3 control-label">*开户行所在市:</label> |
| | | <div class="col-sm-9"> |
| | | <select style="width: 300px" class="form-control" id="cCode" name="cCode" > |
| | | @for(obj in list5){ |
| | | <option style="width: 300px" value="${obj.code}" ${obj.code == item.cityCode ? 'selected=selected' : ''}>${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="row" id="benefit"> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-4 control-label" > |
| | | 法人是否为受益人:<input type="radio" checked name="type" value="true" onclick="updateHalf1(1)">是 |
| | | <input type="radio" name="type" value="false" onclick="updateHalf1(0)">否 |
| | | </label> |
| | | </div> |
| | | <div hidden id="benefitInfo"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*受益人姓名:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" value="${item.benefitsName}"class="form-control" id="bName" name="bName" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*受益人身份证地址:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control"value="${item.benefitsAddress}" id="bAddress" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*受益人身份证有效期:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" value="${item.benefitsStartTime}" id="bTime" name="bTime" type="date"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*受益人身份证结束时间:</label> |
| | | <div class="col-sm-9" style="display: flex"> |
| | | <input style="width: 300px" class="form-control" value="${item.benefitsEndTime}" id="bEnd" name="IDCardTime" type="date"> |
| | | <input type="checkbox" style="margin-left: 10px" id="bIDCardT" value="0" onchange="TSite.tradeYse(this)">长期</input> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <#avatar id="bImg1" name="受益人身份证正面照" avatarImg="${item.benefitsFront}" /> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*受益人身份证号:</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" value="${item.benefitsNumber}" id="bIDNumber" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*受益人证件居住地址:</label> |
| | | <div class="col-sm-9" > |
| | | <input style="width: 300px" class="form-control" value="${item.benefitsAddress}" id="bIDAddress" placeholder="请输入" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <#avatar id="bImg2" name="受益人身份证背面照" avatarImg="${item.benefitsBack}"/> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row" id="applyment_state"> |
| | | <div class="col-lg-6" > |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*申请状态:</label> |
| | | <div class="col-sm-9"> |
| | | <h3 style="color: red">${applymentState}</h3> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row" hidden id="account"> |
| | | <div class="col-lg-6" > |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*付款户名:</label> |
| | | <div class="col-sm-9"> |
| | | <h3>${accountName}</h3> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-lg-6" > |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*付款卡号:</label> |
| | | <div class="col-sm-9"> |
| | | <h3>${accountNo}</h3> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-lg-6" > |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*需要汇款的金额(单位:分):</label> |
| | | <div class="col-sm-9"> |
| | | <h3>${payAmount}</h3> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-lg-6" > |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*收款账户的卡号:</label> |
| | | <div class="col-sm-9"> |
| | | <h3>${destinationAccountNumber}</h3> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-lg-6" > |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*收款账户名:</label> |
| | | <div class="col-sm-9"> |
| | | <h3>${destinationAccountName}</h3> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-lg-6" > |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*收款账户的开户银行名称:</label> |
| | | <div class="col-sm-9"> |
| | | <h3>${destinationAccountBank}</h3> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-lg-6" > |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*收款账户的省市:</label> |
| | | <div class="col-sm-9"> |
| | | <h3>${city}</h3> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-lg-6" > |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*商户汇款时,需要填写的备注信息:</label> |
| | | <div class="col-sm-9"> |
| | | <h3>${remark}</h3> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-lg-6" > |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*请在此时间前完成汇款:</label> |
| | | <div class="col-sm-9"> |
| | | <h3>${deadline}</h3> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" hidden id="sign_url"> |
| | | <label class="col-sm-3 control-label">*签约链接(需让申请单-管理者用微信扫码打开,完成签约):</label> |
| | | <div class="col-sm-9" > |
| | | <img src="https://we-park-life.oss-cn-beijing.aliyuncs.com/img/10e7c7ec88c14cb9970910ad642b4ad5.png" width="200px" height="200px" alt="二维码"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" hidden id="legal_validation_url"> |
| | | <label class="col-sm-3 control-label">*法人验证链接(商户法人用微信扫码打开,完成账户验证):</label> |
| | | <div class="col-sm-9" > |
| | | <img src="https://we-park-life.oss-cn-beijing.aliyuncs.com/img/10e7c7ec88c14cb9970910ad642b4ad5.png" width="200px" height="200px" alt="二维码"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row" hidden id="sign_state"> |
| | | <div class="col-lg-6" > |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*签约状态:</label> |
| | | <div class="col-sm-9"> |
| | | <h3 style="color: red">${signState}</h3> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5" > |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TSite.addSubmit1()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TSite.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script src="${ctxPath}/modular/system/operatorUser/operatorUser.js"></script> |
| | | <script src="${ctxPath}/js/vue/vue.js"></script> |
| | | <script src="${ctxPath}/js/elementui/index.js"></script> |
| | | <link rel="stylesheet" href="${ctxPath}/js/elementui/index.css"> |
| | | <script> |
| | | function updateHalf1(e) { |
| | | if(e==0){ |
| | | // 法人不是受益人 |
| | | $("#benefitInfo").show() |
| | | }else { |
| | | // 法人是受益人 |
| | | $("#benefitInfo").hide() |
| | | } |
| | | } |
| | | // function updateHalf(e) { |
| | | // if(e==3){ |
| | | // console.log("展示") |
| | | // $("#banks").show() |
| | | // $("#aliNumber").hide() |
| | | // }else if (e==4){ |
| | | // // 结算到支付宝账号 |
| | | // console.log("隐藏") |
| | | // $("#banks").hide() |
| | | // $("#aliNumber").show() |
| | | // } |
| | | // } |
| | | |
| | | window.onload = function(){ |
| | | var state="${state}" |
| | | if(state=="FINISH"){ |
| | | $("#sign_url").show() |
| | | } |
| | | var signState="${signState}" |
| | | if(signState!= 0){ |
| | | $("#sign_url").show() |
| | | } |
| | | var applymentState="${applymentState}" |
| | | var legalValidationUrl="${item.legalValidationUrl}" |
| | | if(applymentState== "待账户验证"){ |
| | | $("#account").show() |
| | | if (legalValidationUrl !=null && legalValidationUrl != ""){ |
| | | $("#legal_validation_url").show() |
| | | } |
| | | } |
| | | // 如果state为finish 才展示二维码链接 |
| | | var idCardEnd="${item.legalEnd}" |
| | | var businessEnd="${item.businessEnd}" |
| | | var benefitsEndTime="${item.benefitsEndTime}" |
| | | var tradeT = document.getElementById('tradeE'); |
| | | var IDCardTime = document.getElementById('IDCardTime'); |
| | | var endTime = document.getElementById('endTime'); |
| | | var IDCardT = document.getElementById('IDCardE'); |
| | | var IDCardTime = document.getElementById('IDCardEnd'); |
| | | var IDCardE = document.getElementById('IDCardE'); |
| | | var IDCardTime = document.getElementById('IDCardEnd'); |
| | | var IDCardE = document.getElementById('IDCardE'); |
| | | var bEnd = document.getElementById('bEnd'); |
| | | console.log("进入") |
| | | |
| | | console.log("身份证结束时间") |
| | | console.log(idCardEnd) |
| | | if (idCardEnd == "长期"){ |
| | | IDCardE.checked = true; |
| | | IDCardTime.disabled = true; |
| | | } |
| | | console.log("营业结束时间") |
| | | console.log(businessEnd) |
| | | if (businessEnd == "长期"){ |
| | | tradeT.checked = true; |
| | | endTime.disabled = true; |
| | | } |
| | | if (benefitsEndTime == "长期"){ |
| | | bIDCardT.checked = true; |
| | | bEnd.disabled = true; |
| | | } |
| | | console.log("${item.accountType}") |
| | | var accountType = "${item.accountType}"; |
| | | var OBJradio=document.getElementsByName("useType") |
| | | if(accountType=="74"){ |
| | | OBJradio[0].checked=true |
| | | }else { |
| | | OBJradio[1].checked=true |
| | | } |
| | | |
| | | } |
| | | </script> |
| | | @} |
| | |
| | | }, |
| | | ]; |
| | | }; |
| | | /** |
| | | * 商户号认证页面 |
| | | */ |
| | | TSite.auth = function () { |
| | | console.log("看看行内平台") |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: "商户认证", |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/operator/proportionAuth/' + TSite.seItem.operatorId |
| | | }); |
| | | this.layerIndex = index; |
| | | console.log("看看行内平台") |
| | | console.log(TSite.seItem.platform) |
| | | if (TSite.seItem.platform == "微信"){ |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: "微信商户认证", |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/operator/proportionAuthWx/' + TSite.seItem.operatorId |
| | | }); |
| | | this.layerIndex = index; |
| | | }else{ |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: "支付宝商户认证", |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/operator/proportionAuth/' + TSite.seItem.operatorId |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | |
| | | } |
| | | }; |
| | | /** |
| | |
| | | */ |
| | | TSite.auth1 = function () { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: "商户认证详情", |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/operator/proportionAuth1/' + TSite.seItem.operatorId |
| | | }); |
| | | this.layerIndex = index; |
| | | console.log(TSite.seItem.platform) |
| | | if (TSite.seItem.platform == "微信"){ |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: "微信商户认证", |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/operator/proportionAuth1Wx/' + TSite.seItem.operatorId |
| | | }); |
| | | this.layerIndex = index; |
| | | }else { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: "商户认证详情", |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/operator/proportionAuth1/' + TSite.seItem.operatorId |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | } |
| | | }; |
| | | TSite.proportion = function () { |
| | |
| | | var oneId=$(e).val(); |
| | | console.log(oneId) |
| | | console.log("!!!!!!!!!!!!!") |
| | | if ($("#pCode").val()==""){ |
| | | var content='<option value="">请先选择省</option>'; |
| | | $("#cCode").empty().append(content); |
| | | } |
| | | var ajax = new $ax(Feng.ctxPath + "/tCompetition/onChange3", function(data){ |
| | | if(data!=null){ |
| | | var content='<option value="">选择市</option>'; |
| | |
| | | Feng.error("请输入营业执照编号"); |
| | | return; |
| | | } |
| | | if ("" == $("#businessNumber").val() ){ |
| | | Feng.error("请上传营业执照"); |
| | | return; |
| | | } |
| | | |
| | | if ("" == $("#name").val() ){ |
| | | Feng.error("请输入联系人姓名"); |
| | | return; |
| | |
| | | ajax.set("zfbAccount", $("#zfbAccount").val() ); |
| | | ajax.start(); |
| | | }; |
| | | // 微信商户认证提交按钮 |
| | | TSite.addSubmit1 = function(){ |
| | | var bodyType = $("input[name='bodyType']:checked").val(); |
| | | if (bodyType=="" || null == bodyType){ |
| | | Feng.error("请选择主体类型"); |
| | | return; |
| | | } |
| | | var radios = document.getElementsByName('type'); |
| | | if (bodyType == 2){ |
| | | for (var i = 0; i < radios.length; i++) { |
| | | if (radios[i].checked) { |
| | | if (radios[i].value != "true"){ |
| | | // 法人不是受益人 |
| | | if ("" == $("#bName").val() ){ |
| | | Feng.error("请输入受益人姓名"); |
| | | return; |
| | | } |
| | | if ("" == $("#bAddress").val() ){ |
| | | Feng.error("请输入受益人身份证居住地址"); |
| | | return; |
| | | } |
| | | if ("" == $("#bTime").val() ){ |
| | | Feng.error("请选择受益人身份证开始时间"); |
| | | return; |
| | | } |
| | | var bIDCardT = document.getElementById("bIDCardT"); |
| | | if (!bIDCardT.checked){ |
| | | if ("" == $("#bEnd").val() || null == $("#bEnd").val()){ |
| | | Feng.error("请选择受益人身份证过期时间"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if ("" == $("#bIDNumber").val() ){ |
| | | Feng.error("请输入受益人身份证号"); |
| | | return; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if ("" == $("#businessName").val() ){ |
| | | Feng.error("请输入商户名称"); |
| | | return; |
| | | } |
| | | if ("" == $("#aliasName").val() ){ |
| | | Feng.error("请输入商户别名"); |
| | | return; |
| | | } |
| | | if ("" == $("#businessNumber").val() ){ |
| | | Feng.error("请输入营业执照编号"); |
| | | return; |
| | | } |
| | | |
| | | var tradeT = document.getElementById("tradeE"); |
| | | if (!tradeT.checked){ |
| | | if ("" == $("#endTime").val() || null == $("#endTime").val()){ |
| | | Feng.error("请输入营业证照过期时间"); |
| | | return; |
| | | } |
| | | } |
| | | if ("" == $("#tradeTime").val() || null == $("#tradeTime").val()){ |
| | | Feng.error("请输入营业执照生效期间"); |
| | | return; |
| | | } |
| | | if ("" == $("#licenseRegistration").val() ){ |
| | | Feng.error("请输入营业执照注册号"); |
| | | return; |
| | | } |
| | | if ("" == $("#companyAddress").val() ){ |
| | | Feng.error("营业执照注册地址"); |
| | | return; |
| | | } |
| | | if ("" == $("#legalPerson").val()){ |
| | | Feng.error("请输入法人姓名"); |
| | | return; |
| | | } |
| | | if ("" == $("#leagleNumber").val()){ |
| | | Feng.error("请输入法人身份证号"); |
| | | return; |
| | | } |
| | | var IDCardE = document.getElementById("IDCardE"); |
| | | if (!IDCardE.checked){ |
| | | if ("" == $("#IDCardEnd").val() || null == $("#IDCardEnd").val()){ |
| | | Feng.error("请选择身份证过期时间"); |
| | | return; |
| | | } |
| | | } |
| | | if ("" == $("#IDCardTime").val() || null == $("#IDCardTime").val()){ |
| | | Feng.error("请选择身份证开始时间"); |
| | | return; |
| | | } |
| | | // 结算账户类型 |
| | | var useType = $("input[name='useType']:checked").val(); |
| | | // 结算到银行卡 |
| | | if ("" == $("#bankCard").val()){ |
| | | Feng.error("请输入银行卡号"); |
| | | return; |
| | | } |
| | | if ("" == $("#bankName").val()){ |
| | | Feng.error("请输入开户银行"); |
| | | return; |
| | | } |
| | | if ("" == $("#bankCardTwo").val()){ |
| | | Feng.error("请输入开户银行联行号"); |
| | | return; |
| | | } |
| | | if ("" == $("#bankUserName").val()){ |
| | | Feng.error("请输入开户名称"); |
| | | return; |
| | | } |
| | | if ("" == $("#bankCard").val()){ |
| | | Feng.error("请输入银行账号"); |
| | | return; |
| | | } |
| | | if ("" == $("#bankName1").val()){ |
| | | Feng.error("请输入开户支行名称"); |
| | | return; |
| | | } |
| | | |
| | | if ("" == $("#pCode").val()){ |
| | | Feng.error("请选择开户银行所在省"); |
| | | return; |
| | | } |
| | | if ("" == $("#cCode").val()){ |
| | | Feng.error("请选择开户银行所在市"); |
| | | return; |
| | | } |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/operator/wxAuth", function(data){ |
| | | if (data==5001){ |
| | | Feng.error("未上传营业执照!"); |
| | | return; |
| | | }else if(data==5002){ |
| | | Feng.error("未上传法人身份证正面照!"); |
| | | return; |
| | | }else if(data==5003){ |
| | | Feng.error("未上传法人身份证背面照!"); |
| | | return; |
| | | }else if (data.code==500){ |
| | | console.log(data); |
| | | Feng.error("认证失败:"+data.msg); |
| | | return; |
| | | }else{ |
| | | Feng.success("认证成功!请等待微信平台审核"); |
| | | window.parent.TSite.table.refresh(); |
| | | TSite.close(); |
| | | } |
| | | },function(data){ |
| | | Feng.error("操作失败!"); |
| | | }); |
| | | ajax.set("operatorId", $("#id").val()); |
| | | ajax.set("bodyType", bodyType ); |
| | | ajax.set("businessName", $("#businessName").val()); |
| | | ajax.set("aliasName", $("#aliasName").val()); |
| | | ajax.set("businessNumber", $("#businessNumber").val() ); |
| | | ajax.set("tradeTime", $("#tradeTime").val() ); |
| | | ajax.set("endTime", $("#endTime").val() ); |
| | | ajax.set("businessNumber", $("#businessNumber").val() ); |
| | | ajax.set("license", $("#license").val() ); |
| | | ajax.set("companyAddress", $("#companyAddress").val() ); |
| | | ajax.set("legalPerson", $("#legalPerson").val() ); |
| | | ajax.set("leagleNumber", $("#leagleNumber").val() ); |
| | | ajax.set("IDCardTime", $("#IDCardTime").val() ); |
| | | ajax.set("IDCardEnd", $("#IDCardEnd").val() ); |
| | | ajax.set("leagleNumber", $("#leagleNumber").val() ); |
| | | ajax.set("legalFront", $("#IDCardImg").val() ); |
| | | ajax.set("legalBack", $("#IDCardImg1").val() ); |
| | | ajax.set("legalPhone", $("#legalPhone").val() ); |
| | | ajax.set("legalEmail", $("#legalEmail").val() ); |
| | | ajax.set("legalAddress", $("#legalAddress").val() ); |
| | | ajax.set("useType", useType ); |
| | | ajax.set("bankCard", $("#bankCard").val() ); |
| | | ajax.set("bank", $("#bank").val() ); |
| | | ajax.set("bankCardTwo", $("#bankCardTwo").val() ); |
| | | ajax.set("accountName", $("#bankUserName").val() ); |
| | | ajax.set("bankName", $("#bankName1").val() ); |
| | | ajax.set("provinceCode", $("#pCode").val() ); |
| | | ajax.set("province", $('#pCode option:selected').text()); |
| | | ajax.set("cityCode", $("#cCode").val() ); |
| | | ajax.set("city", $('#cCode option:selected').text()); |
| | | if (radios[0].value == "true"){ |
| | | ajax.set("isBenefits", "true"); |
| | | ajax.set("benefitsName", $("#legalPerson").val() ); |
| | | ajax.set("benefitsFront", $("#IDCardImg").val() ); |
| | | ajax.set("benefitsBack", $("#IDCardImg1").val() ); |
| | | ajax.set("benefitsNumber", $("#leagleNumber").val() ); |
| | | ajax.set("benefitsStartTime", $("#IDCardTime").val() ); |
| | | ajax.set("benefitsEndTime", $("#IDCardEnd").val() ); |
| | | ajax.set("benefitsAddress", $("#legalAddress").val() ); |
| | | }else{ |
| | | ajax.set("isBenefits", "false"); |
| | | ajax.set("benefitsName", $("#bName").val() ); |
| | | ajax.set("benefitsFront", $("#bImg1").val() ); |
| | | ajax.set("benefitsBack", $("#bImg2").val() ); |
| | | ajax.set("benefitsNumber", $("#bIDNumber").val() ); |
| | | ajax.set("benefitsStartTime", $("#bTime").val() ); |
| | | ajax.set("benefitsEndTime", $("#bEnd").val() ); |
| | | ajax.set("benefitsAddress", $("#bAddress").val() ); |
| | | } |
| | | |
| | | |
| | | ajax.start(); |
| | | }; |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | |
| | | // 判断是否被选中 |
| | | if (tradeT.checked) { |
| | | endTime.disabled = true; |
| | | endTime.value=""; |
| | | endTime.value="长期"; |
| | | } else { |
| | | endTime.disabled = false; |
| | | endTime.value=""; |
| | | } |
| | | if (IDCardT.checked) { |
| | | IDCardTime.value=""; |
| | | IDCardTime.value="长期"; |
| | | IDCardTime.disabled = true; |
| | | } else { |
| | | IDCardTime.disabled = false; |
| | | IDCardTime.value=""; |
| | | } |
| | | if (bIDCardT.checked) { |
| | | bTime.value=""; |
| | | bTime.value="长期"; |
| | | bTime.disabled = true; |
| | | } else { |
| | | bTime.value=""; |
| | | bTime.disabled = false; |
| | | } |
| | | }; |
| | |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.AlipayClient; |
| | | import com.alipay.api.DefaultAlipayClient; |
| | | import com.alipay.api.request.AlipayTradeOrderSettleRequest; |
| | | import com.alipay.api.response.AlipayTradeOrderSettleResponse; |
| | | import com.alipay.api.response.AlipayTradeQueryResponse; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.other.entity.*; |
| | | import com.dsh.other.feignclient.CourseRecordClient; |
| | | import com.dsh.other.feignclient.StoreClient; |
| | | import com.dsh.other.feignclient.account.AppUserClient; |
| | | import com.dsh.other.feignclient.account.model.AppUser; |
| | | import com.dsh.other.model.QueryMySiteVo; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | TGame game = gameService.getById(gameId); |
| | | String smid2=""; |
| | | Integer operationId = game.getOperationId(); |
| | | if (operationId==0){ |
| | | // 是平台的 |
| | | if (operationId == null || operationId==0 ){ |
| | | // 是平台的不冻结资金 不做分账处理 |
| | | smid2 = smid; |
| | | payMoneyUtil.confirm1(smid2,code,tradeNo,config.getCash().toString()); |
| | | }else{ |
| | | String smidByOperatorId = siteService.getSMIDByOperatorId(operationId); |
| | | smid2 = smidByOperatorId; |
| | | payMoneyUtil.confirm(smid2,code,tradeNo,config.getCash().toString()); |
| | | extracted(operationId, config.getCash(), tradeNo); |
| | | } |
| | | payMoneyUtil.confirm(smid2,code,tradeNo,config.getCash().toString()); |
| | | |
| | | break; |
| | | } |
| | | if ("WAIT_BUYER_PAY".equals(s)) { |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | @Autowired |
| | | private StoreClient storeClient; |
| | | private void extracted(Integer operatorId, BigDecimal coursePackageOrder1, String tradeNo) throws Exception { |
| | | // 分账 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", |
| | | "2021004105665036", |
| | | "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCi5i9nW/hGLJ3A06cZxTQdviFC7THpdSihoTYGLr9q006hu0V26ecBMY/o4w5bvIX0Ok/yofmZsVcCJpAPvbXL/uqVrIjnRRxXiaeBFThlxoBUTdunvbUSDYfzlEhJr5NvUKI6H6lz2niXlQGx4qy8Hau4ccWit9kM8jwUvsBVQoFgJA+xrjMvooA7YLopQtpOD+UJr5thApTSf1xrnr1W12yolTLEH15JmNV372cqXrYUuqnY0QsaPtxeqJUGAOcGdVLllQ7easEznP8DFBvDdHATcmp2SHNQDUEWN6MCVPbMgY06NQVqAXxqjTAYSVh+6TRu6bofPmpYC3TZB003AgMBAAECggEBAJAcR2+PA3NBYUYHeFrqBRMS8uX8ZR19kjZ7IgoSLTFaQsP9opRylPSPXhrPVBKAE5leRQAHn4MCSlESwHvMfxo7KFjFTFAc6dffZZpipYQUOc9bGampwJh58/3e/pyBgVMG6J23CPf/HJQtNFSkjd/V9+ayb/9l2dUEL3bC0fAZ/dbx8HsxdLw8wn3fLlWLj68hOMqa2deCZe3JdSVsPbeWqkh56FFsMLug0Nd+Ar4TgRl9/jnhXF0JWiD0LmPUYLhboY7EfUBzN4w1iYbDi1P+3zvoOYsiVKAXox9GMhQ2VzOO2UcSTuizSza2e98mGpabl/GpKmCz+RDFjtkX6eECgYEA2MyCij65eO3aGIm3FUe93DULRBYTfX8qJQSJq2WOWA3mmQlEW6L3O2B5/lG2h+8WmN6iLEs9eHpgycGYp7vAqgrANEn16ACVcuyx0scFtrZfZ+kmHMzFfiUWxJjVYk/6YngsGVBLdw6ueM42C8TTP67X9tU5TdVGoGWuqEj4W98CgYEAwFqwprXOch5Pqk/RPbb49r0Ou03K/UbciWnWWKzUhFFNS8MdlQPoDvQZbMwHLeWsa2VhaKITK3x5biLQb3U+0GLOn6lTvEyrEUH+ucREyLgVYTRAvwBPtnvlrzpyxPk2HnslQjju8WrvvLLBMKWUjlTrTOzhaHT21gz3pHMiOakCgYEAhLmfaXdBITGshb054sNLDtdCkGpbgEcrzAHdLps769iGxkYQHXHFngpQZUwtTUcoNGqIKknd1jZFrv7gsD+XkgKG7PwimehRlkwmCX5ilxtLiVgJRzRt6+5U5AMVD90a0tHzXYP0z2yjj73fBJF5KtGl0a10KZxaYrQdm1UhB00CgYBZZgzx/k9rtHC8LAqIj1CYhHejT92G53c6Gkl3vyOqN4sgKhfGmSEySfrDGPRBPZxr8ZtbIPCd5mUdberH0osWGMYFaJI1UsCy7aQwvGpniz7MhZeN7dweaOjwDs8mgtjHQ96mL4XGCDhR0BZ/wIURvZ/6iaGdhbbu9unlsWj3uQKBgQCmZYdsbbZkd3ev6f8rwyvMz+DrCQyYpY44cegBYuJgrZiQnL2fJioeN7ixX0UM48SfwsZEIrzshP/LGAwnc2MdjxKUl4jLN8SEe0NAjXOnz9Zaw740+aOmLpXcLWdP4uM2gIhWsvW1tEkQZCXmm7c9s/RsU8Pmzv+YL3+fSijOzA==", |
| | | "json", "GBK", |
| | | "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB", |
| | | "RSA2"); |
| | | AlipayTradeOrderSettleRequest request = new AlipayTradeOrderSettleRequest(); |
| | | String randomCode = UUIDUtil.getRandomCode(16); |
| | | |
| | | String proportionByOperatorId = operatorUserService.getOne(new QueryWrapper<OperatorUser>() |
| | | .eq("operatorId",operatorId)).getAlipayProportion(); |
| | | // 支付宝分账比例 |
| | | String s1 = proportionByOperatorId.split(",")[1]; |
| | | double i = Double.parseDouble(s1); |
| | | double v = i * 0.01; |
| | | BigDecimal bigDecimal1 = new BigDecimal(String.valueOf(v)); |
| | | // 分账金额 |
| | | BigDecimal bigDecimal2 = coursePackageOrder1.multiply(bigDecimal1).setScale(2, RoundingMode.DOWN); |
| | | request.setBizContent("{" + |
| | | " \"out_request_no\":\"" + randomCode + "\"," + |
| | | " \"trade_no\":\"" + tradeNo + "\"," + |
| | | " \"royalty_parameters\":[" + |
| | | " {" + |
| | | " \"royalty_type\":\"transfer\"," + |
| | | " \"trans_out\":\"" + storeClient.getSMIDByOperatorId(operatorId)+ "\"," + |
| | | " \"trans_out_type\":\"userId\"," + |
| | | " \"trans_in_type\":\"userId\"," + |
| | | " \"trans_in\":\"" + smid + "\"," + |
| | | " \"amount\":" + bigDecimal2 + "," + |
| | | " \"desc\":\"平台服务费\"," + |
| | | " \"royalty_scene\":\"平台服务费\"," + |
| | | " }" + |
| | | " ]," + |
| | | " \"extend_params\":{" + |
| | | " \"royalty_finish\":\"true\"" + |
| | | " }," + |
| | | " \"royalty_mode\":\"async\"" + |
| | | "}"); |
| | | AlipayTradeOrderSettleResponse response = alipayClient.execute(request); |
| | | if (response.isSuccess()) { |
| | | System.out.println("调用成功"); |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | } |
| | | } |
| | | |
| | | private static Integer startGame(Integer uid, Integer gameId, Integer spaceId, Integer sutuId) { |
| | | HashMap<String, String> map = new HashMap<>(); |
| | |
| | | import com.dsh.other.feignclient.model.BillingDataRequestVo; |
| | | import com.dsh.other.feignclient.model.SiteChangeStateVO; |
| | | import com.dsh.other.feignclient.model.SiteVo; |
| | | import com.dsh.other.mapper.TOperatorUserMapper; |
| | | import com.dsh.other.model.*; |
| | | import com.dsh.other.model.dto.siteDto.TSiteDTO; |
| | | import com.dsh.other.model.vo.siteVo.ExpireSiteSearchVO; |
| | |
| | | private UserCouponClient userCouponClient; |
| | | @Autowired |
| | | private CityManagerClient cityManagerClient; |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | |
| | | /** |
| | | * 通过运营商id查询运营商对应的支付宝商户号 |
| | |
| | | public String getSMIDByOperatorId(Integer id) { |
| | | // 获取运营商的管理员 |
| | | return siteService.getSMIDByOperatorId(id); |
| | | }/** |
| | | * 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | */ |
| | | @RequestMapping("/base/getProportionByOperatorId") |
| | | @ResponseBody |
| | | public String getProportionByOperatorId(Integer id) { |
| | | OperatorUser operatorId = operatorUserService.getOne( |
| | | new QueryWrapper<OperatorUser>().eq("operatorId",id) |
| | | ); |
| | | if (operatorId.getWechatProportion() == null){ |
| | | operatorId.setWechatProportion("0"); |
| | | } |
| | | if (operatorId.getAlipayProportion() == null){ |
| | | operatorId.setAlipayProportion("0"); |
| | | } |
| | | return operatorId.getWechatProportion()+","+operatorId.getAlipayProportion(); |
| | | } |
| | | /** |
| | | * 获取所有场地 |
| | |
| | | |
| | | @Autowired |
| | | private StoreService service; |
| | | |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/game") |
| | |
| | | @FeignClient(value = "mb-cloud-other") |
| | | public interface StoreClient { |
| | | |
| | | |
| | | /** |
| | | * 根据运营商id获取对应运营商商户号 |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/getSMIDByOperatorId") |
| | | String getSMIDByOperatorId(Integer id); |
| | | @PostMapping("/base/protocol/storeDetail/courseOfSto") |
| | | StoreDetailOfCourse getCourseOfStore(@RequestParam("storeId") Integer storeId); |
| | | |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.AlipayClient; |
| | | import com.alipay.api.DefaultAlipayClient; |
| | | import com.alipay.api.request.AlipayTradeOrderSettleRequest; |
| | | import com.alipay.api.response.AlipayTradeOrderSettleResponse; |
| | | import com.alipay.api.response.AlipayTradeQueryResponse; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.other.entity.*; |
| | | import com.dsh.other.feignclient.StoreClient; |
| | | import com.dsh.other.feignclient.account.AppUserClient; |
| | | import com.dsh.other.feignclient.account.model.AppUser; |
| | | import com.dsh.other.feignclient.activity.CouponClient; |
| | |
| | | } |
| | | |
| | | private String smid = "2088330203191220";//平台支付宝商户号 |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | @Autowired |
| | | private StoreClient storeClient; |
| | | /** |
| | | * 课程支付宝支付 |
| | | * |
| | |
| | | Store byId = storeService.getById(storeId); |
| | | Integer operatorId = byId.getOperatorId(); |
| | | String smid1 = ""; |
| | | if (operatorId == null ){ |
| | | // 平台的门店 |
| | | }else if (operatorId == 0){ |
| | | smid1 = smid; |
| | | if (operatorId == null || operatorId == 0){ |
| | | // 平台的门店 不冻结资金不做分账处理 |
| | | payMoneyUtil.confirm1(smid1,code,tradeNo,paymentPrice.toString()); |
| | | }else{ |
| | | smid1 = siteService.getSMIDByOperatorId(operatorId); |
| | | |
| | | payMoneyUtil.confirm(smid1,code,tradeNo,paymentPrice.toString()); |
| | | // 分账 |
| | | extracted(operatorId, new BigDecimal(paymentPrice.toString()), tradeNo); |
| | | } |
| | | payMoneyUtil.confirm(smid1,code,tradeNo,paymentPrice.toString()); |
| | | |
| | | break; |
| | | } |
| | | if ("WAIT_BUYER_PAY".equals(s)) { |
| | |
| | | return alipay; |
| | | } |
| | | |
| | | private void extracted(Integer operatorId, BigDecimal coursePackageOrder1, String tradeNo) throws Exception { |
| | | // 分账 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", |
| | | "2021004105665036", |
| | | "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCi5i9nW/hGLJ3A06cZxTQdviFC7THpdSihoTYGLr9q006hu0V26ecBMY/o4w5bvIX0Ok/yofmZsVcCJpAPvbXL/uqVrIjnRRxXiaeBFThlxoBUTdunvbUSDYfzlEhJr5NvUKI6H6lz2niXlQGx4qy8Hau4ccWit9kM8jwUvsBVQoFgJA+xrjMvooA7YLopQtpOD+UJr5thApTSf1xrnr1W12yolTLEH15JmNV372cqXrYUuqnY0QsaPtxeqJUGAOcGdVLllQ7easEznP8DFBvDdHATcmp2SHNQDUEWN6MCVPbMgY06NQVqAXxqjTAYSVh+6TRu6bofPmpYC3TZB003AgMBAAECggEBAJAcR2+PA3NBYUYHeFrqBRMS8uX8ZR19kjZ7IgoSLTFaQsP9opRylPSPXhrPVBKAE5leRQAHn4MCSlESwHvMfxo7KFjFTFAc6dffZZpipYQUOc9bGampwJh58/3e/pyBgVMG6J23CPf/HJQtNFSkjd/V9+ayb/9l2dUEL3bC0fAZ/dbx8HsxdLw8wn3fLlWLj68hOMqa2deCZe3JdSVsPbeWqkh56FFsMLug0Nd+Ar4TgRl9/jnhXF0JWiD0LmPUYLhboY7EfUBzN4w1iYbDi1P+3zvoOYsiVKAXox9GMhQ2VzOO2UcSTuizSza2e98mGpabl/GpKmCz+RDFjtkX6eECgYEA2MyCij65eO3aGIm3FUe93DULRBYTfX8qJQSJq2WOWA3mmQlEW6L3O2B5/lG2h+8WmN6iLEs9eHpgycGYp7vAqgrANEn16ACVcuyx0scFtrZfZ+kmHMzFfiUWxJjVYk/6YngsGVBLdw6ueM42C8TTP67X9tU5TdVGoGWuqEj4W98CgYEAwFqwprXOch5Pqk/RPbb49r0Ou03K/UbciWnWWKzUhFFNS8MdlQPoDvQZbMwHLeWsa2VhaKITK3x5biLQb3U+0GLOn6lTvEyrEUH+ucREyLgVYTRAvwBPtnvlrzpyxPk2HnslQjju8WrvvLLBMKWUjlTrTOzhaHT21gz3pHMiOakCgYEAhLmfaXdBITGshb054sNLDtdCkGpbgEcrzAHdLps769iGxkYQHXHFngpQZUwtTUcoNGqIKknd1jZFrv7gsD+XkgKG7PwimehRlkwmCX5ilxtLiVgJRzRt6+5U5AMVD90a0tHzXYP0z2yjj73fBJF5KtGl0a10KZxaYrQdm1UhB00CgYBZZgzx/k9rtHC8LAqIj1CYhHejT92G53c6Gkl3vyOqN4sgKhfGmSEySfrDGPRBPZxr8ZtbIPCd5mUdberH0osWGMYFaJI1UsCy7aQwvGpniz7MhZeN7dweaOjwDs8mgtjHQ96mL4XGCDhR0BZ/wIURvZ/6iaGdhbbu9unlsWj3uQKBgQCmZYdsbbZkd3ev6f8rwyvMz+DrCQyYpY44cegBYuJgrZiQnL2fJioeN7ixX0UM48SfwsZEIrzshP/LGAwnc2MdjxKUl4jLN8SEe0NAjXOnz9Zaw740+aOmLpXcLWdP4uM2gIhWsvW1tEkQZCXmm7c9s/RsU8Pmzv+YL3+fSijOzA==", |
| | | "json", "GBK", |
| | | "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB", |
| | | "RSA2"); |
| | | AlipayTradeOrderSettleRequest request = new AlipayTradeOrderSettleRequest(); |
| | | String randomCode = UUIDUtil.getRandomCode(16); |
| | | |
| | | String proportionByOperatorId = operatorUserService.getOne(new QueryWrapper<OperatorUser>() |
| | | .eq("operatorId",operatorId)).getAlipayProportion(); |
| | | // 支付宝分账比例 |
| | | String s1 = proportionByOperatorId.split(",")[1]; |
| | | double i = Double.parseDouble(s1); |
| | | double v = i * 0.01; |
| | | BigDecimal bigDecimal1 = new BigDecimal(String.valueOf(v)); |
| | | // 分账金额 |
| | | BigDecimal bigDecimal2 = coursePackageOrder1.multiply(bigDecimal1).setScale(2, RoundingMode.DOWN); |
| | | request.setBizContent("{" + |
| | | " \"out_request_no\":\"" + randomCode + "\"," + |
| | | " \"trade_no\":\"" + tradeNo + "\"," + |
| | | " \"royalty_parameters\":[" + |
| | | " {" + |
| | | " \"royalty_type\":\"transfer\"," + |
| | | " \"trans_out\":\"" + storeClient.getSMIDByOperatorId(operatorId)+ "\"," + |
| | | " \"trans_out_type\":\"userId\"," + |
| | | " \"trans_in_type\":\"userId\"," + |
| | | " \"trans_in\":\"" + smid + "\"," + |
| | | " \"amount\":" + bigDecimal2 + "," + |
| | | " \"desc\":\"平台服务费\"," + |
| | | " \"royalty_scene\":\"平台服务费\"," + |
| | | " }" + |
| | | " ]," + |
| | | " \"extend_params\":{" + |
| | | " \"royalty_finish\":\"true\"" + |
| | | " }," + |
| | | " \"royalty_mode\":\"async\"" + |
| | | "}"); |
| | | AlipayTradeOrderSettleResponse response = alipayClient.execute(request); |
| | | if (response.isSuccess()) { |
| | | System.out.println("调用成功"); |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | } |
| | | } |
| | | /** |
| | | * 玩湃币支付 |
| | | * |
| | |
| | | return ResultUtil.error("出现问题啦"); |
| | | } |
| | | } |
| | | // 属于平台的运营商 因为无需分账不冻结资金 |
| | | public ResultUtil confirm1(String smid,String code, String outTradeNo, String amount) { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", |
| | | aliAppid, |
| | | appPrivateKey, |
| | | "json", |
| | | "GBK", |
| | | alipay_public_key, |
| | | "RSA2"); |
| | | AlipayTradeSettleConfirmRequest request = new AlipayTradeSettleConfirmRequest(); |
| | | request.setBizContent("{" + |
| | | " \"out_request_no\":\""+code+"\"," + |
| | | " \"trade_no\":\""+outTradeNo+"\"," + |
| | | " \"settle_info\":{" + |
| | | " \"settle_detail_infos\":[" + |
| | | " {" + |
| | | " \"trans_in_type\":\"defaultSettle\"," + |
| | | " \"settle_entity_id\":\""+smid+"\"," + |
| | | " \"settle_entity_type\":\"SecondMerchant\"," + |
| | | " \"amount\":"+amount+"," + |
| | | " }" + |
| | | " ]" + |
| | | " }," + |
| | | " \"extend_params\":{" + |
| | | " \"royalty_freeze\":\"false\"" + |
| | | " }" + |
| | | "}"); |
| | | AlipayTradeSettleConfirmResponse response = null; |
| | | try { |
| | | response = alipayClient.execute(request); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if(response.isSuccess()){ |
| | | System.out.println("调用成功"); |
| | | return ResultUtil.success(); |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | return ResultUtil.error("出现问题啦"); |
| | | } |
| | | } |
| | | /** |
| | | * 支付宝支付 |
| | | */ |