| | |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.service.*; |
| | | |
| | | 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.github.binarywang.wxpay.service.BankService; |
| | |
| | | @Autowired |
| | | private TOperatorCityService operatorCityService; |
| | | @Autowired |
| | | private IOperatorAuthService operatorAuthService; |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | @Autowired |
| | | private IUserService userService; |
| | | @Autowired |
| | | private ICityService cityService; |
| | | @Autowired |
| | | private IOperatorAuthService operatorAuthService; |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Autowired |
| | | private IStoreService storeService; |
| | | private 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==";//支付宝开发者应用私钥 |
| | |
| | | @ResponseBody |
| | | public List<TStore> getStores(Integer id) |
| | | { |
| | | payMoneyUtil.getMessage(); |
| | | return storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId",id) |
| | | .ne("state",3)); |
| | |
| | | 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); |
| | | String state=""; |
| | | switch (operatorId.getAlipayAudit()){ |
| | | case 0: |
| | | state="未认证"; |
| | | break; |
| | | case 1: |
| | | state="待审核"; |
| | | break; |
| | | case 2: |
| | | state="已通过"; |
| | | break; |
| | | case 3: |
| | | state="已拒绝"; |
| | | break; |
| | | } |
| | | model.addAttribute("state",state); |
| | | OperatorAuthAlipay info = operatorAuthService.getOne(new QueryWrapper<OperatorAuthAlipay>() |
| | | .eq("operatorId", id)); |
| | | model.addAttribute("item",info); |
| | |
| | | }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.getUseType()); |
| | |
| | | } |
| | | } |
| | | public static void main(String[] args) { |
| | | String bankName = "中国工商银行"; // 要转换为简写的银行名称 |
| | | // 调用支付宝接口 通过银行卡号获取银行信息 |
| | | String url = "https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&" + |
| | | "cardNo=6217003800041315031&cardBinCheck=true"; |
| | | HashMap<String, String> hashMap = new HashMap<>(); |
| | | String result = HttpRequestUtil.postRequest(url,hashMap); |
| | | System.err.println(result); |
| | | JSONObject json = JSONObject.parseObject(result); |
| | | String bank = json.getString("bank"); |
| | | String cardType = json.getString("cardType"); |
| | | System.err.println(bank); |
| | | System.err.println(cardType); |
| | | |
| | | Pattern pattern = Pattern.compile("([\\u4e00-\\u9fa5]+)(?=\\s+[A-Za-z]+$)"); |
| | | Matcher matcher = pattern.matcher(bankName); |
| | | if (matcher.find()) { |
| | | System.out.println(matcher.group()); // 输出结果:"工商银行" -> "ICBC" |
| | | } else { |
| | | System.out.println("无法识别该银行名称!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝商户认证提交 |
| | | */ |
| | |
| | | Integer userId1 = byId.getUserId(); |
| | | OperatorUser userId2 = operatorUserService.getOne(new QueryWrapper<OperatorUser>() |
| | | .eq("userId", userId1)); |
| | | // 0未认证 1待审核 2通过 3驳回 |
| | | userId2.setAlipayAudit(1); |
| | | operatorUserService.updateById(userId2); |
| | | // 01是企业 |
| | | if (bodyType.equals("01")){ |
| | | userId2.setAlipayType(2); |
| | | }else{ |
| | | userId2.setAlipayType(1); |
| | | } |
| | | operatorUserService.saveOrUpdate(userId2); |
| | | OperatorAuthAlipay data = operatorAuthService.getOne(new QueryWrapper<OperatorAuthAlipay>().eq("operatorId", operatorId)); |
| | | String group="ABC"; |
| | | // 调用支付宝接口 通过银行卡号获取银行信息 |
| | | String url = "https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&" + |
| | | "cardNo="+bankCard+"&cardBinCheck=true"; |
| | | HashMap<String, String> hashMap = new HashMap<>(); |
| | | String result = HttpRequestUtil.postRequest(url,hashMap); |
| | | System.err.println(result); |
| | | JSONObject json2 = JSONObject.parseObject(result); |
| | | String bank = json2.getString("bank"); |
| | | String cardType1 = json2.getString("cardType"); |
| | | // 根据银行卡号查询所属银行 |
| | | String group=bank; |
| | | // if(StringUtils.hasLength(bankName)){ |
| | | // Pattern pattern = Pattern.compile(".*[\\u4e00-\\u9fa5]+"); // 只保留汉字部分 |
| | | // Matcher matcher = pattern.matcher(bankName); |
| | |
| | | operatorAuth.setShopProvince(shopProvince); |
| | | operatorAuth.setShopProvinceCode(shopProvinceCode); |
| | | operatorAuth.setShopCityCode(shopCityCode); |
| | | if(StringUtils.hasLength(province)&& province.equals("请选择省")){ |
| | | operatorAuth.setProvince(null); |
| | | } |
| | | if(StringUtils.hasLength(city)&& province.equals("请选择市")){ |
| | | operatorAuth.setCity(null); |
| | | } |
| | | operatorAuth.setProvince(province); |
| | | operatorAuth.setProvinceCode(provinceCode); |
| | | operatorAuth.setShopDistrict(shopDistrict); |
| | |
| | | legalFront = uploadImg(legalFront).toString(); |
| | | // 法人身份证背面照 |
| | | legalBack = uploadImg(legalBack).toString(); |
| | | // 商户行业资质图片 |
| | | iqImage = uploadImg(iqImage).toString(); |
| | | operatorAuthService.saveOrUpdate(operatorAuth); |
| | | // todo 填写申请单 |
| | | //第二步:提交申请单 |
| | | // AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","2021003199648333", |
| | | // "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCXnbOiY2VkKb5ubpcwKqzmqbKotpKGA79yn2aQeZiTWhqmLdCKjVp64naGpnOQEC7hDZluOO1crWHVhIEp7XGIEVawA7mb/dBbzo4wQQYVtLX6iEZViYk/mA7G59S/lvsLVi+jkVGlx2Co8JhvkTRtCEFgUnVA9o2jKy5BIEwrusNuDjrn5X+3ZvfZJN/iV0yzhzXynzioZt/DIcdODOVPUrem8T/5ifJ6ydSKIumgquBKyQnFOj+LRt5qMioBVzLnod0S/6kKMoNVN3/qx/PHRaeHbrF7I67IpGNROg0D9C4d9xXbGhSqQciXitLVnNzWuCov4Ie5nT5VCg9RjXyVAgMBAAECggEAf5rU81lgnnqbseoWCQ4B02kD2wc+Lti8qsYJ1pLgnTP6td5dZB8wBbjQNOem35sfOX7uoVv8OkIa00/gPd9/7BtbsGySLP3j/UDNX0N60Y30k1VajOdiwklCNpor7swtog75rVrDMxmo+sb0JQI684E9NMpxsSlRcAEJvvpl4W7LkhfJZyCUNXPAAh9SOkFOe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EAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB","RSA2"); |
| | | // AlipayMerchantIndirectAuthorderCreateRequest request = new AlipayMerchantIndirectAuthorderCreateRequest(); |
| | | // String param = "{" + |
| | | // " \"out_biz_no\":\""+uuid+"\"," + |
| | | // " \"contact_person_info\":{" + |
| | | // " \"contact_name\":\""+name+"\"," + |
| | | // " \"contact_phone_no\":\""+phone+"\"," + |
| | | // " \"contact_card_no\":\""+number+"\"," + |
| | | // " \"contact_cert_type\":\"RESIDENT\"" + |
| | | // " }," + |
| | | // " \"auth_identity_info\":{" + |
| | | // " \"identity_type\":\""+bodyType+"\"," + |
| | | // " \"is_financial_org\":false," + |
| | | // " \"certificate_type\":\"BUSINESS_CERT\"," + |
| | | // " \"certificate_info\":{" + |
| | | // " \"cert_no\":\""+businessNumber+"\"," + |
| | | // " \"cert_image\":\""+string+"\"," + |
| | | // " \"merchant_name\":\""+businessName+"\"," + |
| | | // " \"legal_person_name\":\""+legalRepresentative+"\"," + |
| | | // " \"register_address\":\""+registerAddress+"\"," + |
| | | // " \"effect_time\":\""+businessTerm+"\"," + |
| | | // " \"expire_time\":\""+businessEnd+"\"" + |
| | | // " }," + |
| | | // " }," + |
| | | // " \"legal_person_info\":{" + |
| | | // " \"card_type\":\"RESIDENT\"," + |
| | | // " \"person_name\":\""+legalRepresentative+"\"," + |
| | | // " \"card_no\":\""+legalNumber+"\"," + |
| | | // " \"effect_time\":\""+legalTerm+"\"," + |
| | | // " \"expire_time\":\""+legalEnd+"\"," + |
| | | // " \"card_front_img\":\""+legalFront+"\"," + |
| | | // " \"card_back_img\":\""+legalBack+"\"," + |
| | | // " \"is_benefit_person\":"+isBeneficiary+"" + |
| | | // " },"; |
| | | // String bene = " \"benefit_person_info\":{" + |
| | | // " \"person_name\":\""+beneficiary+"\"," + |
| | | // " \"card_no\":\""+beneficiaryNumber+"\"," + |
| | | // " \"card_type\":\"RESIDENT\"," + |
| | | // " \"effect_time\":\""+beneficiaryTerm+"\"," + |
| | | // " \"expire_time\":\""+beneficiaryEnd+"\"," + |
| | | // " \"card_front_img\":\""+beneficiaryFront+"\"," + |
| | | // " \"card_back_img\":\""+beneficiaryBack+"\"" + |
| | | // " },"; |
| | | // if (bodyType.equals("ENTERPRISE")){ |
| | | // request.setBizContent(param |
| | | // + bene+ |
| | | // "}"); |
| | | // }else{ |
| | | // request.setBizContent(param |
| | | // + |
| | | // "}"); |
| | | // } |
| | | // |
| | | // AlipayMerchantIndirectAuthorderCreateResponse response = null; |
| | | // try { |
| | | // response = alipayClient.execute(request); |
| | | // } catch (AlipayApiException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", |
| | | aliAppid, |
| | | appPrivateKey, |
| | |
| | | " \"mobile\":\""+phone+"\"," + |
| | | " }" + |
| | | " ],"; |
| | | |
| | | // todo 拼接 |
| | | String biz_cards=" \"biz_cards\":[" + |
| | | " {" + |
| | |
| | | String type ; |
| | | // 结算类型为支付宝 填写支付宝账号 结算类型为银行卡填写银行卡号 |
| | | String account; |
| | | if (StringUtils.hasLength(alipayAccount)){ |
| | | type = accountType; |
| | | account = alipayAccount; |
| | | }else{ |
| | | if (accountType.equals("bankCard")){ |
| | | type = accountType; |
| | | account = bankCard; |
| | | }else{ |
| | | type = accountType; |
| | | account = alipayAccount; |
| | | } |
| | | String res= |
| | | " \"service\":[" + |
| | |
| | | if (accountType.equals("bankCard")){ |
| | | request.setBizContent(param |
| | | + biz_cards+res); |
| | | }else{ |
| | | request.setBizContent(param |
| | | +res); |
| | | } |
| | | AntMerchantExpandIndirectZftCreateResponse response = null; |
| | | try { |
| | | response = alipayClient.execute(request); |
| | | } catch (AlipayApiException e) { |
| | | System.err.println("???????????"); |
| | | e.printStackTrace(); |
| | | } |
| | | if(response.isSuccess()){ |
| | |
| | | String order_no = json1.getString("order_id"); |
| | | System.err.println("订单号"+order_no); |
| | | operatorAuth.setOrderNo(order_no); |
| | | operatorAuth.setRefuseReason(""); |
| | | operatorAuthService.saveOrUpdate(operatorAuth); |
| | | Integer userId = operatorService.getById(operatorId).getUserId(); |
| | | OperatorUser user = operatorUserService.getOne(new QueryWrapper<OperatorUser>().eq("userId", userId)); |
| | |
| | | }else{ |
| | | user.setAlipayType(1); |
| | | } |
| | | operatorUserService.saveOrUpdate(user); |
| | | } else { |
| | | if (response.getCode().equals("40004")){ |
| | | String subMsg = response.getSubMsg(); |
| | |
| | | */ |
| | | @RequestMapping(value = "/proportion") |
| | | @ResponseBody |
| | | public Object auth(Integer operatorIdOne ,String alipayProportion,String alipayNum,String wechatProportion, |
| | | String wechatNum) { |
| | | Integer id1 = operatorService.getOne(new QueryWrapper<TOperator>().eq("id", operatorIdOne)) |
| | | .getUserId(); |
| | | OperatorUser id = operatorUserService.getOne(new QueryWrapper<OperatorUser>().eq("userId", id1)); |
| | | public Object auth(Integer operatorIdOne ,String alipayProportion,String wechatProportion) { |
| | | OperatorUser id = operatorUserService.getOne(new QueryWrapper<OperatorUser>().eq("operatorId", operatorIdOne)); |
| | | id.setAlipayProportion(alipayProportion); |
| | | id.setWechatProportion(wechatProportion); |
| | | id.setAlipayNum(alipayNum); |
| | | id.setWechatNum(wechatNum); |
| | | operatorUserService.updateById(id); |
| | | return SUCCESS_TIP; |
| | | } |