Merge remote-tracking branch 'origin/2.0' into 2.0
| | |
| | | * 课包支付配置id |
| | | */ |
| | | private Integer coursePackageConfigId; |
| | | private Integer addUserId; |
| | | private Integer addType; |
| | | |
| | | } |
| | |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | |
| | | // 是否微信分账 |
| | | private Integer isFenZhang; |
| | | } |
| | |
| | | |
| | | @FeignClient(value = "mb-cloud-other") |
| | | public interface StoreClient { |
| | | |
| | | /** |
| | | * 根据运营商id获取对应运营商商户号 |
| | | * 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/getProportionByOperatorId") |
| | | String getProportionByOperatorId(Integer id); |
| | | /** |
| | | * 根据运营商id获取对应运营商支付宝商户号 |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/getSMIDByOperatorId") |
| | | String getSMIDByOperatorId(Integer id); |
| | | // 根据运营商id获取微信商户号 |
| | | @PostMapping("/base/getmerchantNumberByOperatorId") |
| | | String getmerchantNumberByOperatorId(Integer id); |
| | | |
| | | @PostMapping("/store/queryByStoreId") |
| | | OperatorUser queryByStoreId(Integer storeId); |
| | |
| | | * 限领数量 |
| | | */ |
| | | private Integer pickUpQuantity; |
| | | private Integer publisherType; |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | private Integer state; |
| | | private Integer cityManagerId; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | |
| | | @Resource |
| | | private IntroduceRewardsClient introduceRewardsClient; |
| | | |
| | | |
| | | private String aliAppid = "2021004105665036";//支付宝appid |
| | | |
| | | 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==";//支付宝开发者应用私钥 |
| | |
| | | userCouponPaymentClient.addUserCouponPayment(userCouponPayment); |
| | | try { |
| | | if(exchangeType.getPayType() == 1){ |
| | | return weChatPaymentCoupon("购买优惠券", userCouponPayment); |
| | | String temp = "0"; |
| | | if (coupon.getPublisherType()!=null && coupon.getPublisherType() != 2){ |
| | | // 做分账 |
| | | temp = "1"; |
| | | } |
| | | return weChatPaymentCoupon("购买优惠券-"+temp, userCouponPayment); |
| | | } |
| | | if(exchangeType.getPayType() == 2){ |
| | | return aliPaymentCoupon("购买优惠券", userCouponPayment); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | System.out.println(exchangeType); |
| | | try { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | |
| | | coursePackageOrder.setInsertTime(new Date()); |
| | | coursePackageOrder.setOrderType(2); |
| | | paymentClient.savePaymentCoursePackage(coursePackageOrder); |
| | | return WechatPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(exchangeType.getStuIds().size())), code); |
| | | } else { |
| | | return WechatPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(goodsNums)), code); |
| | | return WechatPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(exchangeType.getStuIds().size())), code,merchandise.getId()); |
| | | } else if (merchandise.getType() == 1){ |
| | | return WechatPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(goodsNums)), code,merchandise.getId()); |
| | | } |
| | | } catch (Exception e) { |
| | | return ResultUtil.runErr(); |
| | |
| | | case 1: |
| | | try { |
| | | if (merchandise.getType() == 2) { |
| | | return WechatPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(exchangeType.getStuIds().size())), code); |
| | | return WechatPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(exchangeType.getStuIds().size())), code,merchandise.getId()); |
| | | } else { |
| | | return WechatPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(goodsNums)), code); |
| | | return WechatPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(goodsNums)), code,merchandise.getId()); |
| | | } |
| | | } catch (Exception e) { |
| | | return ResultUtil.runErr(); |
| | |
| | | public ResultUtil weChatPaymentCoupon(String body, UserCouponPayment userCouponPayment) throws Exception { |
| | | String code = userCouponPayment.getCode(); |
| | | Double cash = userCouponPayment.getCash(); |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay(body, "", code, cash.toString(), |
| | | Integer couponId = userCouponPayment.getCouponId(); |
| | | Coupon coupon = userConponClient.queryCouponById(couponId); |
| | | String temp ="0"; |
| | | if (coupon.getPublisherType()!=null&&coupon.getPublisherType()!=2){ |
| | | temp = "1"; |
| | | } |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay(body+"-"+temp, "", code, cash.toString(), |
| | | "/base/coupon/weChatPaymentCouponCallback", "APP", ""); |
| | | if (weixinpay.getCode() == 200) { |
| | | new Thread(new Runnable() { |
| | |
| | | Thread.sleep(wait); |
| | | UserCouponPayment userCouponPayment1 = userCouponPaymentClient.getUserCouponPayment(code); |
| | | if (userCouponPayment1.getStatus() == 2) { |
| | | |
| | | break; |
| | | } |
| | | ResultUtil<Map<String, String>> resultUtil = payMoneyUtil.queryWXOrder(code, ""); |
| | |
| | | TAppUser user = appUserService.getById(userCouponPayment1.getUserId()); |
| | | user.setIntegral(user.getIntegral() - userCouponPayment1.getIntegral().intValue()); |
| | | appUserService.updateById(user); |
| | | } |
| | | // 休眠两分钟后再调用分账接口 避免提示订单正在处理中 |
| | | Thread.sleep(120000); |
| | | if (coupon!=null){ |
| | | if (coupon.getPublisherType()!=null&&coupon.getPublisherType()!=2){ |
| | | if (coupon.getPublisherType() == 3){ |
| | | // 门店 向上查询运营商 |
| | | Store store = storeClient.queryStoreById(coupon.getCityManagerId()); |
| | | if (store.getOperatorId()==null || store.getOperatorId()==0){ |
| | | // 平台不分账 |
| | | break; |
| | | }else{ |
| | | // 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | String proportionByOperatorId = storeClient.getProportionByOperatorId(store.getOperatorId()); |
| | | String[] split = proportionByOperatorId.split(","); |
| | | String s1 = split[0]; |
| | | if (!s1.equals("未设置")){ |
| | | BigDecimal bigDecimal = new BigDecimal(s1); |
| | | // 分账比例 |
| | | BigDecimal bigDecimal1 = bigDecimal.divide(new BigDecimal(100)).setScale(2); |
| | | // 微信商户号 |
| | | String s2 = storeClient.getmerchantNumberByOperatorId(store.getOperatorId()); |
| | | BigDecimal bigDecimal2 = new BigDecimal(cash); |
| | | ResultUtil fenzhang = payMoneyUtil.fenzhang(userCouponPayment1.getOrderNumber(), bigDecimal2.multiply(bigDecimal1), s2); |
| | | if (!fenzhang.getCode().equals(500)){ |
| | | System.err.println("分账失败 原因是:"+fenzhang.getMsg()); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | private ResultUtil WechatPayment(Integer type, BigDecimal cash, String code) throws Exception { |
| | | private ResultUtil WechatPayment(Integer type, BigDecimal cash, String code,Integer id) throws Exception { |
| | | String name = (type == 1 ? "购买实体商品" : type == 2 ? "报名运动营": type == 3 ? "购买门票" : "购买优惠券"); |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay(name, "", code, cash.toString(), |
| | | PointsMerchandise pointsMerchandise = mcClient.selectPointsMerchandiseById(id); |
| | | // 分账表示 0否1是 |
| | | String temp = "0"; |
| | | switch (type){ |
| | | case 1: |
| | | temp = "0"; |
| | | break; |
| | | case 2: |
| | | // 判断课包属于平台还是运营商 |
| | | CoursePackage coursePackage = cpageClient.queryCoursePackageById(pointsMerchandise.getCoursePackageId()); |
| | | Store store = storeClient.queryStoreById(coursePackage.getStoreId()); |
| | | if (store.getOperatorId() ==null || store.getOperatorId() == 0){ |
| | | // 平台课包 不分账 |
| | | }else{ |
| | | temp = "1"; |
| | | } |
| | | break; |
| | | case 3: |
| | | List<Integer> integers = mcsClient.queryPointMerStoreIds(pointsMerchandise.getId()); |
| | | if (!integers.isEmpty()){ |
| | | Store store1 = storeClient.queryStoreById(integers.get(0)); |
| | | if (store1.getOperatorId() ==null || store1.getOperatorId() == 0){ |
| | | // 平台门票 不分账 |
| | | }else{ |
| | | temp = "1"; |
| | | } |
| | | } |
| | | // 查询门票指定的门店 属于平台还是运营商 |
| | | break; |
| | | } |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay(name+"-"+temp, "", code, cash.toString(), |
| | | "/base/pointMer/exchangeGoodPaymentWeChatCallback", "APP", ""); |
| | | if (weixinpay.getCode() == 200) { |
| | | new Thread(new Runnable() { |
| | |
| | | Thread.sleep(wait); |
| | | UserPointsMerchandise userPointsMerchandise = mcClient.queryUserPointMerchaseByCode(code).get(0); |
| | | if (userPointsMerchandise.getPayStatus() == 2) { |
| | | |
| | | |
| | | break; |
| | | } |
| | | ResultUtil<Map<String, String>> resultUtil = payMoneyUtil.queryWXOrder(code, ""); |
| | |
| | | paymentClient.addCoursePackageOrderStudent(addCoursePackageOrderStudent); |
| | | } |
| | | } |
| | | // 休眠两分钟后再调用分账接口 避免提示订单正在处理中 |
| | | Thread.sleep(120000); |
| | | // 分账表示 0否1是 |
| | | String temp = "0"; |
| | | // 运营商id |
| | | Integer operatorId = 0; |
| | | switch (type){ |
| | | case 1: |
| | | temp = "0"; |
| | | break; |
| | | case 2: |
| | | // 判断课包属于平台还是运营商 |
| | | CoursePackage coursePackage = cpageClient.queryCoursePackageById(pointsMerchandise.getCoursePackageId()); |
| | | Store store = storeClient.queryStoreById(coursePackage.getStoreId()); |
| | | if (store.getOperatorId() ==null || store.getOperatorId() == 0){ |
| | | // 平台课包 不分账 |
| | | }else{ |
| | | temp = "1"; |
| | | operatorId = store.getOperatorId(); |
| | | } |
| | | break; |
| | | case 3: |
| | | List<Integer> integers = mcsClient.queryPointMerStoreIds(pointsMerchandise.getId()); |
| | | if (!integers.isEmpty()){ |
| | | Store store1 = storeClient.queryStoreById(integers.get(0)); |
| | | if (store1.getOperatorId() ==null || store1.getOperatorId() == 0){ |
| | | // 平台门票 不分账 |
| | | }else{ |
| | | temp = "1"; |
| | | operatorId = store1.getOperatorId(); |
| | | } |
| | | } |
| | | // 查询门票指定的门店 属于平台还是运营商 |
| | | break; |
| | | } |
| | | if (operatorId != 0) { |
| | | // 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | String proportionByOperatorId = storeClient.getProportionByOperatorId(operatorId); |
| | | String[] split = proportionByOperatorId.split(","); |
| | | String s1 = split[0]; |
| | | if (!s1.equals("未设置")){ |
| | | BigDecimal bigDecimal = new BigDecimal(s1); |
| | | // 分账比例 |
| | | BigDecimal bigDecimal1 = bigDecimal.divide(new BigDecimal(100)).setScale(2); |
| | | // 微信商户号 |
| | | String s2 = storeClient.getmerchantNumberByOperatorId(operatorId); |
| | | |
| | | ResultUtil fenzhang = payMoneyUtil.fenzhang(transaction_id, cash.multiply(bigDecimal1), s2); |
| | | if (!fenzhang.getCode().equals(500)){ |
| | | System.err.println("分账失败 原因是:"+fenzhang.getMsg()); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | if ("USERPAYING".equals(s) || "NOTPAY".equals(s)) { |
| | |
| | | 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; |
| | |
| | | try { |
| | | switch (request.getPayType()) { |
| | | case 1: |
| | | return WeChatPayment(code, request.getPayAmount(), hour); |
| | | return WeChatPayment(code, request.getPayAmount(), hour,request.getLessonId()); |
| | | case 2: |
| | | return AlipayPayment(code, request.getPayAmount(), hour); |
| | | case 3: |
| | |
| | | } |
| | | |
| | | |
| | | public ResultUtil WeChatPayment(String code, BigDecimal amount, Integer hour) throws Exception { |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("课包续费", "", code, amount.toString(), |
| | | public ResultUtil WeChatPayment(String code, BigDecimal amount, Integer hour,Integer lessonId) throws Exception { |
| | | // 判断这个课包是属于哪个运营商的 |
| | | CoursePackage coursePackage = coursePackageClient.queryCoursePackageById(lessonId); |
| | | Integer storeId = coursePackage.getStoreId(); |
| | | Store store = storeClient.queryStoreById(storeId); |
| | | // 是否分账 0否1是 |
| | | int isFenZhang= 1; |
| | | String merchantNumber = ""; |
| | | if (store.getOperatorId()==null || store.getOperatorId()==0){ |
| | | // 平台 |
| | | isFenZhang = 0; |
| | | } |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("课包续费"+"-"+isFenZhang, "", code, amount.toString(), |
| | | "/base/coursePackage/wechatPaymentCallback", "APP", ""); |
| | | if (weixinpay.getCode() == 200) { |
| | | new Thread(new Runnable() { |
| | |
| | | coursePackagePayment.setLaveClassHours(hour); |
| | | coursePackagePayment.setOrderNumber(transaction_id); |
| | | couPayClient.updatePaymentCoursePackage(coursePackagePayment); |
| | | if (store.getOperatorId()!=null && store.getOperatorId()!=0){ |
| | | // 休眠两分钟后再调用分账接口 避免提示订单正在处理中 |
| | | Thread.sleep(120000); |
| | | // 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | String proportionByOperatorId = storeClient.getProportionByOperatorId(store.getOperatorId()); |
| | | String[] split = proportionByOperatorId.split(","); |
| | | String s1 = split[0]; |
| | | if (!s1.equals("未设置")){ |
| | | BigDecimal bigDecimal = new BigDecimal(s1); |
| | | // 分账比例 |
| | | BigDecimal bigDecimal1 = bigDecimal.divide(new BigDecimal(100)).setScale(2); |
| | | // 微信商户号 |
| | | String s2 = storeClient.getmerchantNumberByOperatorId(store.getOperatorId()); |
| | | |
| | | ResultUtil fenzhang = payMoneyUtil.fenzhang(transaction_id, amount.multiply(bigDecimal1), s2); |
| | | if (!fenzhang.getCode().equals(500)){ |
| | | System.err.println("分账失败 原因是:"+fenzhang.getMsg()); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | if ("USERPAYING".equals(s) || "NOTPAY".equals(s)) { |
| | |
| | | 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()); |
| | |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.crypto.BadPaddingException; |
| | |
| | | |
| | | private String certPath = "/usr/playpai/cert/weixin/apiclient_cert.p12";//微信证书 |
| | | |
| | | |
| | | |
| | | /** |
| | | * 发起分账 |
| | | * @param order 微信订单号 |
| | | * @return |
| | | */ |
| | | public ResultUtil fenzhang(String order,BigDecimal amount,String merchantNumber) throws Exception { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("mch_id", mchId); |
| | | map.put("appid", appid); |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | map.put("nonce_str", nonce_str); |
| | | map.put("transaction_id", order); |
| | | // 将这个字符串使用json格式拼接起来 |
| | | Map<String, Object> body = new HashMap<>(); |
| | | body.put("type", "MERCHANT_ID"); |
| | | body.put("account", merchantNumber); |
| | | body.put("amount", amount); |
| | | body.put("description", "订单分账"); |
| | | JSONObject jsonObject = new JSONObject(body); |
| | | String jsonString = jsonObject.toString(); |
| | | map.put("receiver",jsonString); |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | String url = "https://api.mch.weixin.qq.com/secapi/pay/profitsharing"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = null; |
| | | try { |
| | | body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.err.println("分账请求"+body1); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | return ResultUtil.success(); |
| | | } else { |
| | | // System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | } else { |
| | | // System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 支付宝支付 |
| | |
| | | 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("出现问题啦"); |
| | | } |
| | | } |
| | | /** |
| | | * 支付成功后的回调处理逻辑 |
| | | * |
| | |
| | | map.put("appid", appid); |
| | | map.put("mch_id", mchId); |
| | | map.put("nonce_str", nonce_str); |
| | | map.put("body", body); |
| | | String temp = ""; |
| | | if (body.split("-").length>1){ |
| | | temp = body.split("-")[1]; |
| | | map.put("body", body.split("-")[0]); |
| | | }else{ |
| | | map.put("body", body); |
| | | } |
| | | if (StringUtils.hasLength(temp) && temp.equals("1")){ |
| | | // 添加分账标识 |
| | | map.put("profit_sharing", "Y"); |
| | | } |
| | | map.put("attach", attach);//存储订单id |
| | | map.put("out_trade_no", out_trade_no);//存储的订单code |
| | | map.put("total_fee", i); |
| | |
| | | } |
| | | if (ofSearch.getStoreId() != null || ofSearch.getStoreIds().size() != 0) { |
| | | for (Map<String, Object> map : mapList1) { |
| | | if (map.get("cityManagerId").equals(ofSearch.getOperatorId())){ |
| | | mapList.add(map); |
| | | continue; |
| | | } |
| | | // 如果当前登陆人是运营商 只能查看平台添加的优惠券应只展示使用范围为全国通用、 |
| | | // 指定城市有运营商管辖的、指定门店有运营商旗下门店 |
| | | if (ofSearch.getObjType() == 2) { |
| | | if (Integer.parseInt(String.valueOf(map.get("useScope"))) == 1) { |
| | | mapList.add(map); |
| | | continue; |
| | | } |
| | | if (Integer.parseInt(String.valueOf(map.get("useScope"))) == 2) { |
| | | // 获取到优惠券id 查询这个优惠券指定了哪些城市 |
| | |
| | | // 已兑换数量 |
| | | @TableField(exist = false) |
| | | private Integer pickUpQuantity4; |
| | | |
| | | // 添加人id 判断是平台添加还是运营商添加 用于判断分账 |
| | | @TableField("addUserId") |
| | | private Integer addUserId; |
| | | // 添加人类型 1平台2运营商3门店 用于判断分账 |
| | | @TableField("addType") |
| | | private Integer addType; |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | state, |
| | | illustrate, |
| | | auditStatus, |
| | | publisherType |
| | | publisherType, |
| | | cityManagerId |
| | | from t_coupon |
| | | where 1=1 |
| | | <if test="objType == 3"> |
| | |
| | | import com.dsh.competition.service.IParticipantService; |
| | | import com.dsh.competition.service.IPaymentCompetitionService; |
| | | import com.dsh.competition.service.UserCompetitionService; |
| | | import com.dsh.competition.util.PayMoneyUtil; |
| | | import com.dsh.competition.util.ResultUtil; |
| | | import com.dsh.competition.util.TokenUtil; |
| | | import com.dsh.competition.util.ToolUtil; |
| | | import com.dsh.competition.util.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | import lombok.Synchronized; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.OutputStream; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | |
| | | String payOrderNo = paymentCompetition.getPayOrderNo(); |
| | | if (paymentCompetition.getPayType() == 1) {//微信支付 |
| | | if (StringUtils.hasLength(paymentCompetition.getFenzhangNo())){ |
| | | // 是分账订单 如果分账金额不为0 那么回退分账金额 |
| | | if (paymentCompetition.getFenzhangAmount()!=null && paymentCompetition.getFenzhangAmount().compareTo(BigDecimal.ZERO)>0){ |
| | | String randomCode = UUIDUtil.getRandomCode(16); |
| | | String randomCode1 = UUIDUtil.getRandomCode(16); |
| | | if (competition.getOperatorId()!=null && competition.getOperatorId()!=0){ |
| | | // 微信商户号 |
| | | String s2 =storeClient.getmerchantNumberByOperatorId(competition.getOperatorId()); |
| | | ResultUtil resultUtil = payMoneyUtil.fenzhangRefund(paymentCompetition.getFenzhangNo(), paymentCompetition.getFenzhangAmount(), s2, randomCode, randomCode1); |
| | | if (!resultUtil.getCode().equals(500)){ |
| | | System.err.println("分账回退失败 原因是:"+resultUtil.getMsg()); |
| | | }else{ |
| | | paymentCompetition.setFenzhangRefundNo(resultUtil.getMsg()); |
| | | paymentCompetitionService.updateById(paymentCompetition); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | Map<String, String> map = payMoneyUtil.wxRefund(payOrderNo, code, amount.toString(), amount.toString(), |
| | | "/base/competition/weChatCancelPaymentCompetitionCallback"); |
| | | String return_code = map.get("return_code"); |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | @TableField("payOrderNo") |
| | | private String payOrderNo; |
| | | /** |
| | | * 分账流水号 |
| | | */ |
| | | @TableField("fenzhangNo") |
| | | private String fenzhangNo; |
| | | /** |
| | | * 分账业务号 存值表明已分账 未存表明未分账 |
| | | */ |
| | | @TableField("fenzhangOrderNo") |
| | | private String fenzhangOrderNo; |
| | | /** |
| | | * 分账金额 |
| | | */ |
| | | @TableField("fenzhangAmount") |
| | | private BigDecimal fenzhangAmount; |
| | | /** |
| | | * 分账回退流水号 |
| | | */ |
| | | @TableField("fenzhangRefundNo") |
| | | private String fenzhangRefundNo; |
| | | /** |
| | | * 退款时间 |
| | | */ |
| | | @TableField("refundTime") |
| | |
| | | */ |
| | | @TableField("refundOrderNo") |
| | | private String refundOrderNo; |
| | | |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | |
| | | @FeignClient("mb-cloud-other") |
| | | public interface StoreClient { |
| | | /** |
| | | * 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/getProportionByOperatorId") |
| | | String getProportionByOperatorId(Integer id); |
| | | /** |
| | | * 根据运营商id获取对应运营商商户号 |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/getSMIDByOperatorId") |
| | | String getSMIDByOperatorId(Integer id); |
| | | |
| | | // 根据运营商id获取微信商户号 |
| | | @PostMapping("/base/getmerchantNumberByOperatorId") |
| | | String getmerchantNumberByOperatorId(Integer id); |
| | | /** |
| | | * 根据名称模糊搜索门店 |
| | | * |
| | |
| | | userCompetitionService.save(userCompetition); |
| | | } |
| | | if (paymentCompetitionVo.getPayType() == 1) {//微信 |
| | | return weChatPaymentCompetition(code, money); |
| | | Competition byId = competitionService.getById(paymentCompetitionVo.getId()); |
| | | Integer operatorId = byId.getOperatorId(); |
| | | int temp = 0; |
| | | if (operatorId!=null && operatorId != 0){ |
| | | temp =1; |
| | | } |
| | | return weChatPaymentCompetition(code, money,temp,operatorId); |
| | | } |
| | | |
| | | if (paymentCompetitionVo.getPayType() == 2) {//支付宝 |
| | | // 判断当前赛事属于哪个运营商 |
| | | 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 weChatPaymentCompetition(String code, BigDecimal money) throws Exception { |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("报名赛事", "", code, money.toString(), |
| | | public ResultUtil weChatPaymentCompetition(String code, BigDecimal money,Integer isFenZhang,Integer operatorId) throws Exception { |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("报名赛事"+"-"+isFenZhang, "", code, money.toString(), |
| | | "/base/competition/weChatPaymentCompetitionCallback", "APP", ""); |
| | | if (weixinpay.getCode() == 200) { |
| | | new Thread(new Runnable() { |
| | |
| | | Competition competition = cttService.getById(paymentCompetition.getCompetitionId()); |
| | | competition.setApplicantsNumber(competition.getApplicantsNumber() + 1); |
| | | cttService.updateById(competition); |
| | | if (operatorId!=null && operatorId!=0){ |
| | | // 休眠两分钟后再调用分账接口 避免提示订单正在处理中 |
| | | Thread.sleep(120000); |
| | | // 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | String proportionByOperatorId = storeClient.getProportionByOperatorId(operatorId); |
| | | String[] split = proportionByOperatorId.split(","); |
| | | String s1 = split[0]; |
| | | if (!s1.equals("未设置")){ |
| | | BigDecimal bigDecimal = new BigDecimal(s1); |
| | | // 分账比例 |
| | | BigDecimal bigDecimal1 = bigDecimal.divide(new BigDecimal(100)).setScale(2); |
| | | // 微信商户号 |
| | | String s2 = storeClient.getmerchantNumberByOperatorId(operatorId); |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | paymentCompetition.setFenzhangOrderNo(nonce_str); |
| | | ResultUtil fenzhang = payMoneyUtil.fenzhang(transaction_id, money.multiply(bigDecimal1), s2,nonce_str); |
| | | if (!fenzhang.getCode().equals(500)){ |
| | | System.err.println("分账失败 原因是:"+fenzhang.getMsg()); |
| | | }else{ |
| | | paymentCompetition.setFenzhangNo(fenzhang.getMsg()); |
| | | paymentCompetition.setFenzhangAmount(money.multiply(bigDecimal1)); |
| | | paymentCompetitionService.updateById(paymentCompetition); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | if ("USERPAYING".equals(s) || "NOTPAY".equals(s)) { |
| | |
| | | * @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) { |
| | |
| | | |
| | | // 结算资金到商户账号 |
| | | payMoneyUtil.confirm(smid,code,tradeNo,money.toString()); |
| | | if (operatorId == null || operatorId == 0){ |
| | | // 属于平台的赛事 资金不做冻结 不做分账处理 |
| | | payMoneyUtil.confirm1(smid,code,tradeNo,money.toString()); |
| | | }else{ |
| | | // 资金冻结 |
| | | payMoneyUtil.confirm(smid,code,tradeNo,money.toString()); |
| | | // 分账处理 |
| | | extracted(operatorId, money, tradeNo); |
| | | } |
| | | // 结算资金到商户账号 |
| | | //分账 |
| | | // 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; |
| | | |
| | |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | |
| | | @Autowired |
| | | private UserCompetitionService userCompetitionService; |
| | | |
| | |
| | | |
| | | String payOrderNo = paymentCompetition.getPayOrderNo(); |
| | | if (paymentCompetition.getPayType() == 1) {//微信支付 |
| | | if (StringUtils.hasLength(paymentCompetition.getFenzhangNo())){ |
| | | // 是分账订单 如果分账金额不为0 那么回退分账金额 |
| | | if (paymentCompetition.getFenzhangAmount()!=null && paymentCompetition.getFenzhangAmount().compareTo(BigDecimal.ZERO)>0){ |
| | | String randomCode = UUIDUtil.getRandomCode(16); |
| | | String randomCode1 = UUIDUtil.getRandomCode(16); |
| | | if (competition.getOperatorId()!=null && competition.getOperatorId()!=0){ |
| | | // 微信商户号 |
| | | String s2 =storeClient.getmerchantNumberByOperatorId(competition.getOperatorId()); |
| | | ResultUtil resultUtil = payMoneyUtil.fenzhangRefund(paymentCompetition.getFenzhangNo(), paymentCompetition.getFenzhangAmount(), s2, randomCode, randomCode1); |
| | | if (!resultUtil.getCode().equals(500)){ |
| | | System.err.println("分账回退失败 原因是:"+resultUtil.getMsg()); |
| | | }else{ |
| | | paymentCompetition.setFenzhangRefundNo(resultUtil.getMsg()); |
| | | paymentCompetitionMapper.updateById(paymentCompetition); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | Map<String, String> map = payMoneyUtil.wxRefund(payOrderNo, code, amount.toString(), amount.toString(), |
| | | "/base/competition/weChatCancelPaymentCompetitionCallback"); |
| | | String return_code = map.get("return_code"); |
| | |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.crypto.BadPaddingException; |
| | | import javax.crypto.Cipher; |
| | |
| | | " ]" + |
| | | " }," + |
| | | " \"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("出现问题啦"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 微信统一下单 |
| | | * |
| | |
| | | map.put("appid", appid); |
| | | map.put("mch_id", mchId); |
| | | map.put("nonce_str", nonce_str); |
| | | map.put("body", body); |
| | | String temp = ""; |
| | | if (body.split("-").length>1){ |
| | | temp = body.split("-")[1]; |
| | | map.put("body", body.split("-")[0]); |
| | | }else{ |
| | | map.put("body", body); |
| | | } |
| | | if (StringUtils.hasLength(temp) && temp.equals("1")){ |
| | | // 添加分账标识 |
| | | map.put("profit_sharing", "Y"); |
| | | } |
| | | map.put("attach", attach);//存储订单id |
| | | map.put("out_trade_no", out_trade_no);//存储的订单code |
| | | map.put("total_fee", i); |
| | | map.put("spbill_create_ip", hostAddress); |
| | | map.put("notify_url", callbackPath + notify_url); |
| | | map.put("trade_type", tradeType); |
| | | |
| | | if ("JSAPI".equals(tradeType)) { |
| | | map.put("openid", openId); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 发起分账 |
| | | * @param order 微信订单号 |
| | | * @return |
| | | */ |
| | | public ResultUtil fenzhang(String order,BigDecimal amount,String merchantNumber,String nonceStr ) throws Exception { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("mch_id", mchId); |
| | | map.put("appid", appid); |
| | | map.put("nonce_str", nonceStr); |
| | | map.put("transaction_id", order); |
| | | // 将这个字符串使用json格式拼接起来 |
| | | Map<String, Object> body = new HashMap<>(); |
| | | body.put("type", "MERCHANT_ID"); |
| | | body.put("account", merchantNumber); |
| | | body.put("amount", amount); |
| | | body.put("description", "订单分账"); |
| | | JSONObject jsonObject = new JSONObject(body); |
| | | String jsonString = jsonObject.toString(); |
| | | map.put("receiver",jsonString); |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | String url = "https://api.mch.weixin.qq.com/secapi/pay/profitsharing"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = null; |
| | | try { |
| | | body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.err.println("分账请求"+body1); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | |
| | | return ResultUtil.success(map1.get("order_id")); |
| | | } else { |
| | | // System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | } else { |
| | | // System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 微信支付成功后的回调处理 |
| | |
| | | return map2; |
| | | } |
| | | } |
| | | /** |
| | | * 发起分账回退 |
| | | * @param order 微信订单号 |
| | | * @return |
| | | */ |
| | | public ResultUtil fenzhangRefund(String order,BigDecimal amount,String merchantNumber, |
| | | String nonce_str, |
| | | String fenzhangRefundNo) throws Exception { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("mch_id", mchId); |
| | | map.put("appid", appid); |
| | | map.put("nonce_str", nonce_str); |
| | | map.put("order_id", order); |
| | | map.put("out_return_no", fenzhangRefundNo); |
| | | map.put("return_account_type", "MERCHANT_ID"); |
| | | map.put("return_account", merchantNumber); |
| | | map.put("return_amount", amount); |
| | | map.put("description", "用户退款"); |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | String url = "https://api.mch.weixin.qq.com/secapi/pay/profitsharingreturn"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = null; |
| | | try { |
| | | body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.err.println("分账金额回退"+body1); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | return ResultUtil.success(map1.get("return_no")); |
| | | } else { |
| | | // System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | } else { |
| | | // System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 微信退款成功后的回调处理 |
| | |
| | | */ |
| | | @TableField("orderType") |
| | | private Integer orderType; |
| | | |
| | | /** |
| | | * 分账流水号 |
| | | */ |
| | | @TableField("fenzhangNo") |
| | | private String fenzhangNo; |
| | | /** |
| | | * 分账业务号 存值表明已分账 未存表明未分账 |
| | | */ |
| | | @TableField("fenzhangOrderNo") |
| | | private String fenzhangOrderNo; |
| | | @TableField(exist = false) |
| | | private Integer type; |
| | | } |
| | |
| | | */ |
| | | @FeignClient("mb-cloud-other") |
| | | public interface StoreClient { |
| | | /** |
| | | * 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/getProportionByOperatorId") |
| | | String getProportionByOperatorId(Integer id); |
| | | |
| | | /** |
| | | * 根据运营商id获取对应运营商商户号 |
| | |
| | | */ |
| | | @PostMapping("/base/getSMIDByOperatorId") |
| | | String getSMIDByOperatorId(Integer id); |
| | | // 根据运营商id获取微信商户号 |
| | | @PostMapping("/base/getmerchantNumberByOperatorId") |
| | | String getmerchantNumberByOperatorId(Integer id); |
| | | /** |
| | | * 根据名称模糊搜索门店 |
| | | * |
| | |
| | | } |
| | | } |
| | | try { |
| | | return WeChatPayment(code, money); |
| | | return WeChatPayment(code, money,request.getLessonId()); |
| | | } catch (Exception e) { |
| | | return ResultUtil.runErr(); |
| | | } |
| | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | public ResultUtil WeChatPayment(String code, BigDecimal request) throws Exception { |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("课包续费", "", code, request.toString(), |
| | | public ResultUtil WeChatPayment(String code, BigDecimal request,Integer coursePackageId) throws Exception { |
| | | TCoursePackage byId = coursePackageService.getById(coursePackageId); |
| | | Integer storeId = byId.getStoreId(); |
| | | Store store = storeClient.queryStoreById(storeId); |
| | | // 是否分账 0否1是 |
| | | int isFenZhang= 1; |
| | | String merchantNumber = ""; |
| | | if (store.getOperatorId()==null || store.getOperatorId()==0){ |
| | | // 平台 |
| | | isFenZhang = 0; |
| | | } |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("课包续费"+"-"+isFenZhang, "", code, request.toString(), |
| | | "/base/coursePackage/wechatRegisteredCoursesCallback", "APP", ""); |
| | | if (weixinpay.getCode() == 200) { |
| | | String finalCode = code; |
| | |
| | | .eq("classHours", coursePackageOrder1.getClassHours()) |
| | | ); |
| | | coursePackageService.addCoursePackageOrderStudent(coursePackageOrder1.getId(), coursePackagePaymentConfig); |
| | | if (store.getOperatorId()!=null && store.getOperatorId()!=0){ |
| | | // 休眠两分钟后再调用分账接口 避免提示订单正在处理中 |
| | | Thread.sleep(120000); |
| | | // 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | String proportionByOperatorId = storeClient.getProportionByOperatorId(store.getOperatorId()); |
| | | String[] split = proportionByOperatorId.split(","); |
| | | String s1 = split[0]; |
| | | if (!s1.equals("未设置")){ |
| | | BigDecimal bigDecimal = new BigDecimal(s1); |
| | | // 分账比例 |
| | | BigDecimal bigDecimal1 = bigDecimal.divide(new BigDecimal(100)).setScale(2); |
| | | // 微信商户号 |
| | | String s2 = storeClient.getmerchantNumberByOperatorId(store.getOperatorId()); |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | |
| | | ResultUtil fenzhang = payMoneyUtil.fenzhang(transaction_id, request.multiply(bigDecimal1), s2,nonce_str); |
| | | if (!fenzhang.getCode().equals(500)){ |
| | | System.err.println("分账失败 原因是:"+fenzhang.getMsg()); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | if ("USERPAYING".equals(s) || "NOTPAY".equals(s)) { |
| | |
| | | } |
| | | 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; |
| | | } |
| | |
| | | }).start(); |
| | | } |
| | | 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) { |
| | |
| | | @Autowired |
| | | private TCoursePackageService packageService; |
| | | |
| | | |
| | | @Autowired |
| | | private TCoursePackagePaymentService packagePaymentService; |
| | | @Autowired |
| | | private CoursePackageStudentService coursePackageStudentService; |
| | | |
| | |
| | | coursePackageOrder.setPayUserId(uid); |
| | | coursePackageOrderService.updateById(coursePackageOrder); |
| | | } |
| | | |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("报名运动营", coursePackagePaymentConfig.getId().toString(), code, paymentPrice.toString(), |
| | | TCoursePackage byId = coursePackageService.getById(paymentCourseVo.getId()); |
| | | Integer storeId = byId.getStoreId(); |
| | | Store store = storeClient.queryStoreById(storeId); |
| | | // 是否分账 0否1是 |
| | | int isFenZhang= 1; |
| | | if (store.getOperatorId()==null || store.getOperatorId()==0){ |
| | | // 平台 |
| | | isFenZhang = 0; |
| | | } |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("报名运动营"+"-"+isFenZhang, coursePackagePaymentConfig.getId().toString(), code, paymentPrice.toString(), |
| | | "/base/course/weChatPaymentCourseCallback", "APP", ""); |
| | | if (weixinpay.getCode() == 200) { |
| | | String finalCode = code; |
| | |
| | | coursePackageOrderService.updateById(coursePackageOrder1); |
| | | //修改课时有效期 |
| | | addCoursePackageOrderStudent(coursePackageOrder1.getId(), coursePackagePaymentConfig); |
| | | if (store.getOperatorId()!=null && store.getOperatorId()!=0){ |
| | | // 休眠两分钟后再调用分账接口 避免提示订单正在处理中 |
| | | Thread.sleep(120000); |
| | | // 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | String proportionByOperatorId = storeClient.getProportionByOperatorId(store.getOperatorId()); |
| | | String[] split = proportionByOperatorId.split(","); |
| | | String s1 = split[0]; |
| | | if (!s1.equals("未设置")){ |
| | | BigDecimal bigDecimal = new BigDecimal(s1); |
| | | // 分账比例 |
| | | BigDecimal bigDecimal1 = bigDecimal.divide(new BigDecimal(100)).setScale(2); |
| | | // 微信商户号 |
| | | String s2 = storeClient.getmerchantNumberByOperatorId(store.getOperatorId()); |
| | | BigDecimal bigDecimal2 = new BigDecimal(paymentPrice); |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | ResultUtil fenzhang = payMoneyUtil.fenzhang(transaction_id, bigDecimal2.multiply(bigDecimal1), s2,nonce_str); |
| | | if (!fenzhang.getCode().equals(500)){ |
| | | System.err.println("分账失败 原因是:"+fenzhang.getMsg()); |
| | | }else{ |
| | | coursePackageOrder1.setFenzhangNo(fenzhang.getMsg()); |
| | | coursePackageOrder1.setFenzhangOrderNo(nonce_str); |
| | | coursePackageOrderService.updateById(coursePackageOrder1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | break; |
| | | |
| | | } |
| | | if ("USERPAYING".equals(s) || "NOTPAY".equals(s)) { |
| | | num++; |
| | |
| | | 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"); |
| | |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.crypto.BadPaddingException; |
| | | import javax.crypto.Cipher; |
| | |
| | | " }," + |
| | | " \"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\"" + |
| | | " }" + |
| | | "}"); |
| | | AlipayTradeSettleConfirmResponse response = null; |
| | |
| | | map.put("appid", appid); |
| | | map.put("mch_id", mchId); |
| | | map.put("nonce_str", nonce_str); |
| | | map.put("body", body); |
| | | String temp = ""; |
| | | if (body.split("-").length>1){ |
| | | temp = body.split("-")[1]; |
| | | map.put("body", body.split("-")[0]); |
| | | }else{ |
| | | map.put("body", body); |
| | | } |
| | | if (StringUtils.hasLength(temp) && temp.equals("1")){ |
| | | // 添加分账标识 |
| | | map.put("profit_sharing", "Y"); |
| | | } |
| | | map.put("attach", attach);//存储订单id |
| | | map.put("out_trade_no", out_trade_no);//存储的订单code |
| | | map.put("total_fee", i); |
| | |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | /** |
| | | * 发起分账 |
| | | * @param order 微信订单号 |
| | | * @return |
| | | */ |
| | | public ResultUtil fenzhang(String order,BigDecimal amount,String merchantNumber,String nonceStr) throws Exception { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("mch_id", mchId); |
| | | map.put("appid", appid); |
| | | map.put("nonce_str", nonceStr); |
| | | map.put("transaction_id", order); |
| | | // 将这个字符串使用json格式拼接起来 |
| | | Map<String, Object> body = new HashMap<>(); |
| | | body.put("type", "MERCHANT_ID"); |
| | | body.put("account", merchantNumber); |
| | | body.put("amount", amount); |
| | | body.put("description", "订单分账"); |
| | | JSONObject jsonObject = new JSONObject(body); |
| | | String jsonString = jsonObject.toString(); |
| | | map.put("receiver",jsonString); |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | String url = "https://api.mch.weixin.qq.com/secapi/pay/profitsharing"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = null; |
| | | try { |
| | | body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.err.println("分账请求"+body1); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | return ResultUtil.success(); |
| | | } else { |
| | | // System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | } else { |
| | | // System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 微信支付成功后的回调处理 |
| | |
| | | <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> |
| | |
| | | </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> |
| | |
| | | </repositories> |
| | | |
| | | |
| | | </project> |
| | | </project> |
| | |
| | | // 已兑换数量 |
| | | @TableField(exist = false) |
| | | private Integer pickUpQuantity4; |
| | | |
| | | @TableField("addUserId") |
| | | // 添加人id 判断是平台添加还是运营商添加 用于判断分账 |
| | | private Integer addUserId; |
| | | @TableField("addType") |
| | | // 添加人类型 1平台2运营商3门店 用于判断分账 |
| | | private Integer addType; |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | |
| | | 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.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.*; |
| | | import com.alipay.api.request.AlipayMerchantIndirectAuthorderCreateRequest; |
| | | import com.alipay.api.request.AlipayMerchantIndirectAuthorderQuerystatusRequest; |
| | | import com.alipay.api.request.AntMerchantExpandIndirectImageUploadRequest; |
| | | import com.alipay.api.request.AntMerchantExpandIndirectZftCreateRequest; |
| | | import com.alipay.api.response.AlipayMerchantIndirectAuthorderCreateResponse; |
| | | import com.alipay.api.response.AlipayMerchantIndirectAuthorderQuerystatusResponse; |
| | | import com.alipay.api.response.AntMerchantExpandIndirectImageUploadResponse; |
| | | import com.alipay.api.response.AntMerchantExpandIndirectZftCreateResponse; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | |
| | | import com.dsh.course.feignClient.account.model.Coach; |
| | | 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.controller.util.MD5; |
| | | import com.dsh.guns.modular.system.controller.util.MD5AndKL; |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.service.*; |
| | | |
| | |
| | | import com.dsh.guns.modular.system.util.PayMoneyUtil; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | |
| | | import com.github.binarywang.wxpay.service.BankService; |
| | | import com.mysql.cj.x.protobuf.MysqlxExpr; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.github.binarywang.wxpay.v3.WechatPayUploadHttpPost; |
| | | import com.wechat.pay.java.service.profitsharing.ProfitsharingService; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | 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.web.bind.annotation.*; |
| | | |
| | | |
| | | 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; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | |
| | | @Autowired |
| | | private IOperatorAuthService operatorAuthService; |
| | | @Autowired |
| | | private IOperatorAuthWxService operatorAuthWxService; |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | @Autowired |
| | | private IUserService userService; |
| | |
| | | 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==";//支付宝开发者应用私钥 |
| | | private String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB";//支付宝支付公钥 |
| | | private String aliAppid = "2021004105665036";//支付宝appid |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据运营商id查询所有门店 |
| | | */ |
| | |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("provinceList",list); |
| | | return PREFIX + "Operator_add.html"; |
| | | } |
| | | @RequestMapping("/bindWx/{id}") |
| | | public String bindWx(Model model,@PathVariable("id") Integer id) { |
| | | |
| | | model.addAttribute("id",id); |
| | | model.addAttribute("merchantNumber",operatorService.getById(id).getMerchantNumber()); |
| | | model.addAttribute("name",operatorService.getById(id).getMerchantName()); |
| | | return PREFIX + "Operator_wx.html"; |
| | | } |
| | | /** |
| | | * 跳转运营商编辑页面 |
| | |
| | | List<Map<String,Object>> list = operatorService.listAll(page,userName,phone,type); |
| | | page.setRecords(list); |
| | | return super.packForBT(page); |
| | | |
| | | } |
| | | private ProfitsharingService profitsharingService; |
| | | /** |
| | | * 手动填入微信商户号 |
| | | */ |
| | | @RequestMapping(value = "/merchantNumberWx") |
| | | @ResponseBody |
| | | public Object listAll(Integer id, String merchantNumber,String name) throws Exception { |
| | | TOperator byId = operatorService.getById(id); |
| | | byId.setMerchantNumber(merchantNumber); |
| | | byId.setMerchantName(name); |
| | | operatorService.updateById(byId); |
| | | ResultUtil resultUtil = payMoneyUtil.addReceiver(merchantNumber, name); |
| | | if (resultUtil.getCode() == 500){ |
| | | return ResultUtil.error(resultUtil.getMsg()); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 跳转运营商商户去认证页面 |
| | | * 支付宝跳转运营商商户去认证页面 |
| | | */ |
| | | @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; |
| | | } |
| | | |
| | | /** |
| | | * 支付宝商户认证提交 |
| | |
| | | } |
| | | 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 |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | PointsMerchandise pointsMerchandise = new PointsMerchandise(); |
| | | pointsMerchandise.setAddUserId(UserExt.getUser().getObjectId()); |
| | | pointsMerchandise.setAddType(UserExt.getUser().getObjectType()); |
| | | pointsMerchandise.setType(typeAll); |
| | | pointsMerchandise.setName(name); |
| | | pointsMerchandise.setCoursePackageId(coursePackageId); |
| | |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | model.addAttribute("userType",objectType); |
| | | List<CityManager> province = cityManagerClient.listAll(); |
| | | // 已有城市管理的省 |
| | | ArrayList<String> list1 = new ArrayList<>(); |
| | | // 已有城市管理的市 |
| | | ArrayList<String> list2 = new ArrayList<>(); |
| | | for (CityManager cityManager : province) { |
| | | list1.add(cityManager.getProvince()); |
| | | list2.add(cityManager.getCity()); |
| | | } |
| | | HashSet<String> set = new HashSet<String>(list1); |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | QueryWrapper<TSiteType> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("state",1); |
| | | List<TSiteType> siteType = siteTypeService.list(wrapper); |
| | | |
| | | List<TCity> list3 = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | model.addAttribute("list",list3); |
| | | model.addAttribute("siteType",siteType); |
| | | String roleid = UserExt.getUser().getRoleid(); |
| | |
| | | model.addAttribute("objectType",objectType); |
| | | model.addAttribute("objectId",objectId); |
| | | model.addAttribute("type",1); |
| | | |
| | | |
| | | List<TOperator> list5 = tOperatorService.list(); |
| | | |
| | | model.addAttribute("list5",list5); |
| | | |
| | | return PREFIX + "TSite.html"; |
| | | } |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private TOperatorService tOperatorService; |
| | | |
| | | @Autowired |
| | | private TOperatorCityService operatorCityService; |
| | | /** |
| | | * 跳转到添加场地管理 |
| | | */ |
| | | @RequestMapping("/add") |
| | | public String tCompetitionAdd(Model model) { |
| | | List<CityManager> province = cityManagerClient.listAll(); |
| | | System.out.println(province); |
| | | // 已有城市管理的省 |
| | | ArrayList<String> list1 = new ArrayList<>(); |
| | | // 已有城市管理的市 |
| | | ArrayList<String> list2 = new ArrayList<>(); |
| | | for (CityManager cityManager : province) { |
| | | list1.add(cityManager.getProvince()); |
| | | list2.add(cityManager.getCity()); |
| | | if (UserExt.getUser().getObjectType()==2){ |
| | | // 查询这个运营商管理的省 |
| | | TOperator id = tOperatorService.getOne(new QueryWrapper<TOperator>().eq("id", UserExt.getUser().getObjectId())); |
| | | if (id.getType()==1){ |
| | | // 全国 |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",list); |
| | | }else{ |
| | | // 找到他管理的省 |
| | | List<TOperatorCity> list = operatorCityService.list(new QueryWrapper<TOperatorCity>().eq("operatorId", UserExt.getUser().getObjectId()).eq("pid", 0)); |
| | | model.addAttribute("list",list); |
| | | } |
| | | }else{ |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",list); |
| | | } |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | |
| | | List<TOperator> list = tOperatorService.list(); |
| | | model.addAttribute("yysList",list); |
| | | model.addAttribute("userType",objectType); |
| | | HashSet<String> set = new HashSet<String>(list1); |
| | | QueryWrapper<TSiteType> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("state",1); |
| | | List<TSiteType> siteType = siteTypeService.list(wrapper); |
| | | model.addAttribute("siteType",siteType); |
| | | model.addAttribute("province",set); |
| | | model.addAttribute("city",list2); |
| | | model.addAttribute("province",list); |
| | | String roleid = UserExt.getUser().getRoleid(); |
| | | model.addAttribute("role",roleid); |
| | | model.addAttribute("objectType",objectType); |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.apache.http.NameValuePair; |
| | | import org.apache.http.client.config.RequestConfig; |
| | | import org.apache.http.client.entity.UrlEncodedFormEntity; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.conn.ssl.SSLConnectionSocketFactory; |
| | | import org.apache.http.entity.ContentType; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
| | | import org.apache.http.message.BasicNameValuePair; |
| | | import org.apache.http.ssl.SSLContexts; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.net.ssl.SSLContext; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | | import java.nio.charset.Charset; |
| | | import java.security.KeyStore; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * http工具类 |
| | | */ |
| | | public class HttpClientUtil { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(HttpClientUtil.class); |
| | | |
| | | private static PoolingHttpClientConnectionManager connectionManager; |
| | | |
| | | |
| | | { |
| | | //1.创建连接池管理器 |
| | | connectionManager = new PoolingHttpClientConnectionManager(60000, |
| | | TimeUnit.MILLISECONDS); |
| | | connectionManager.setMaxTotal(1000); |
| | | connectionManager.setDefaultMaxPerRoute(50); |
| | | } |
| | | |
| | | /** |
| | | * 创建一个httpClient对象 |
| | | */ |
| | | private static CloseableHttpClient getHttpCline() { |
| | | return HttpClients.custom() |
| | | .setConnectionManager(connectionManager) |
| | | .disableAutomaticRetries() |
| | | .build(); |
| | | } |
| | | |
| | | private static RequestConfig getRequestConfig() { |
| | | RequestConfig.Builder builder = RequestConfig.custom(); |
| | | builder.setSocketTimeout(60000)//3.1设置客户端等待服务端返回数据的超时时间 |
| | | .setConnectTimeout(30000)//3.2设置客户端发起TCP连接请求的超时时间 |
| | | .setExpectContinueEnabled(true) |
| | | .setConnectionRequestTimeout(30000);//3.3设置客户端从连接池获取链接的超时时间 |
| | | return builder.build(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建一个POST请求实例 |
| | | * |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | */ |
| | | public static CloseableHttpResponse setPostHttpRequset(String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception { |
| | | HttpPost httpPost = new HttpPost(url); |
| | | httpPost.setConfig(getRequestConfig()); |
| | | if (null != header) { |
| | | for (String key : header.keySet()) { |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | } |
| | | List<NameValuePair> list = new ArrayList<>(); |
| | | if (null != params) { |
| | | Set<String> keys = params.keySet(); |
| | | for (String key : keys) { |
| | | list.add(new BasicNameValuePair(key, null == params.get(key) ? null : params.get(key).toString())); |
| | | } |
| | | } |
| | | switch (contentType) { |
| | | case "form": |
| | | httpPost.setEntity(new UrlEncodedFormEntity(list, "UTF-8")); |
| | | break; |
| | | case "json": |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String s = objectMapper.writeValueAsString(params); |
| | | httpPost.setEntity(new StringEntity(s, ContentType.create(ContentType.APPLICATION_JSON.getMimeType(), Charset.forName("UTF-8")))); |
| | | break; |
| | | } |
| | | return getHttpCline().execute(httpPost); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取get请求实例 |
| | | * |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | */ |
| | | private static CloseableHttpResponse setGetHttpRequset(String url, Map<String, Object> params, Map<String, String> header) throws Exception { |
| | | StringBuffer sb = new StringBuffer(); |
| | | String p = ""; |
| | | if (null != params) { |
| | | Set<String> keys = params.keySet(); |
| | | for (String key : keys) { |
| | | sb.append(key + "=" + params.get(key) + "&"); |
| | | } |
| | | p = "?" + sb.substring(0, sb.length() - 1); |
| | | } |
| | | HttpGet httpGet = new HttpGet(url + p); |
| | | httpGet.setConfig(getRequestConfig()); |
| | | if (null != header) { |
| | | for (String key : header.keySet()) { |
| | | httpGet.setHeader(key, header.get(key)); |
| | | } |
| | | } |
| | | return getHttpCline().execute(httpGet); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送http请求 |
| | | * |
| | | * @param mothed "GET、POST、PUT、HEAD、DELETE、HEAD、OPTIONS" |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | * @param header 请求头 |
| | | * @param contentType 参数请求方式form/json |
| | | * @return |
| | | */ |
| | | public static HttpResult pushHttpRequset(String mothed, String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception { |
| | | String randome = UUID.randomUUID().toString(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); |
| | | logger.info(sdf.format(new Date()) + "----(" + randome + ")请求参数:" + JSON.toJSONString(params)); |
| | | CloseableHttpResponse httpResponse = null; |
| | | switch (mothed) { |
| | | case "GET": |
| | | httpResponse = setGetHttpRequset(url, params, header); |
| | | break; |
| | | case "POST": |
| | | httpResponse = setPostHttpRequset(url, params, header, contentType); |
| | | break; |
| | | } |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | logger.info(sdf.format(new Date()) + "----(" + randome + ")返回结果:" + content); |
| | | HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); |
| | | close(httpResponse); |
| | | return httpResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送XML请求 |
| | | * |
| | | * @param url 请求地址 |
| | | * @param xml XML数据 |
| | | * @param header 自定义请求头 |
| | | * @return |
| | | */ |
| | | public static HttpResult pushHttpRequsetXml(String url, String xml, Map<String, String> header) throws Exception { |
| | | HttpPost httpPost = new HttpPost(url); |
| | | httpPost.setConfig(getRequestConfig()); |
| | | for (String key : header.keySet()) { |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | httpPost.setHeader("Content-Type", "application/xml"); |
| | | httpPost.setEntity(new StringEntity(xml, "UTF-8")); |
| | | CloseableHttpResponse httpResponse = getHttpCline().execute(httpPost); |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); |
| | | close(httpResponse); |
| | | return httpResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 请求https发送XML请求 |
| | | * |
| | | * @param url 接口路径 |
| | | * @param xml 内容 |
| | | * @param header 请求头 |
| | | * @param certPassword 证书密码 |
| | | * @param certPath 证书路径 |
| | | * @param certType 证书类型 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String pushHttpsRequsetXml(String url, String xml, Map<String, String> header, String certPassword, String certPath, String certType) throws Exception { |
| | | HttpPost httpPost = new HttpPost(url); |
| | | for (String key : header.keySet()) { |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | httpPost.setHeader("Content-Type", "application/xml"); |
| | | httpPost.setEntity(new StringEntity(xml, "UTF-8")); |
| | | CloseableHttpClient httpCline = initCert(certPassword, certPath, certType); |
| | | CloseableHttpResponse httpResponse = httpCline.execute(httpPost); |
| | | String content = null; |
| | | if (httpResponse.getStatusLine().getStatusCode() == 200) { |
| | | content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | } else { |
| | | content = "返回状态码:" + httpResponse.getStatusLine() + "。" + EntityUtils.toString(httpResponse.getEntity()); |
| | | } |
| | | close(httpResponse); |
| | | httpCline.close(); |
| | | return content; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 初始化https对象(带证书) |
| | | * |
| | | * @param key 证书密码 |
| | | * @param certPath 证书路径 |
| | | * @param certType 证书类型 |
| | | * @throws Exception |
| | | */ |
| | | private static CloseableHttpClient initCert(String key, String certPath, String certType) throws Exception { |
| | | KeyStore keyStore = KeyStore.getInstance(certType); |
| | | InputStream inputStream = new FileInputStream(new File(certPath)); |
| | | try { |
| | | keyStore.load(inputStream, key.toCharArray()); |
| | | } finally { |
| | | inputStream.close(); |
| | | } |
| | | SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, key.toCharArray()).build(); |
| | | SSLConnectionSocketFactory sslsf = |
| | | new SSLConnectionSocketFactory(sslcontext, new String[]{"TLSv1"}, null, |
| | | SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); |
| | | return HttpClients.custom().setSSLSocketFactory(sslsf).build(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 关闭资源 |
| | | */ |
| | | private static void close(CloseableHttpResponse httpResponse) { |
| | | try { |
| | | if (null != httpResponse) { |
| | | EntityUtils.consume(httpResponse.getEntity());//此处高能,通过源码分析,由EntityUtils是否回收HttpEntity |
| | | httpResponse.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | if (null != httpResponse) { |
| | | httpResponse.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.util; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * http请求返回封装 |
| | | */ |
| | | @Data |
| | | public class HttpResult { |
| | | /** |
| | | * 返回状态码 |
| | | */ |
| | | private Integer code; |
| | | /** |
| | | * 返回结果 |
| | | */ |
| | | private String data; |
| | | |
| | | /** |
| | | * 返回封装结果 |
| | | * |
| | | * @param code |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public static HttpResult getHttpResult(Integer code, String data) { |
| | | HttpResult httpResult = new HttpResult(); |
| | | httpResult.setCode(code); |
| | | httpResult.setData(data); |
| | | return httpResult; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.util; |
| | | |
| | | import java.security.MessageDigest; |
| | | |
| | | public class MD5AndKL { |
| | | |
| | | /** |
| | | * MD5加码。32位 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String MD5(String inStr) { |
| | | MessageDigest md5 = null; |
| | | try { |
| | | md5 = MessageDigest.getInstance("MD5"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e.toString()); |
| | | } |
| | | byte[] md5Bytes = md5.digest(inStr.getBytes()); |
| | | StringBuffer hexValue = new StringBuffer(); |
| | | for (int i = 0; i < md5Bytes.length; i++) { |
| | | int val = ((int) md5Bytes[i]) & 0xff; |
| | | if (val < 16) { |
| | | hexValue.append("0"); |
| | | } |
| | | hexValue.append(Integer.toHexString(val)); |
| | | } |
| | | return hexValue.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 可逆的加密算法 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String KL(String inStr) { |
| | | char[] a = inStr.toCharArray(); |
| | | for (int i = 0; i < a.length; i++) { |
| | | a[i] = (char) (a[i] ^ 't'); |
| | | } |
| | | String s = new String(a); |
| | | return s; |
| | | } |
| | | |
| | | /** |
| | | * 加密后解密 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String JM(String inStr) { |
| | | char[] a = inStr.toCharArray(); |
| | | for (int i = 0; i < a.length; i++) { |
| | | a[i] = (char) (a[i] ^ 't'); |
| | | } |
| | | String k = new String(a); |
| | | return k; |
| | | } |
| | | |
| | | |
| | | public static String byteArrayToHexString(byte b[]) { |
| | | StringBuffer resultSb = new StringBuffer(); |
| | | for (int i = 0; i < b.length; i++) |
| | | resultSb.append(byteToHexString(b[i])); |
| | | |
| | | return resultSb.toString(); |
| | | } |
| | | |
| | | private static String byteToHexString(byte b) { |
| | | int n = b; |
| | | if (n < 0) |
| | | n += 256; |
| | | int d1 = n / 16; |
| | | int d2 = n % 16; |
| | | return hexDigits[d1] + hexDigits[d2]; |
| | | } |
| | | |
| | | public static String MD5Encode(String origin, String charsetname) { |
| | | String resultString = null; |
| | | try { |
| | | resultString = new String(origin); |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | if (charsetname == null || "".equals(charsetname)) { |
| | | resultString = byteArrayToHexString(md.digest(resultString.getBytes())); |
| | | } else { |
| | | resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname))); |
| | | } |
| | | } catch (Exception exception) { |
| | | exception.printStackTrace(); |
| | | } |
| | | return resultString; |
| | | } |
| | | |
| | | private static final String hexDigits[] = {"0", "1", "2", "3", "4", "5", |
| | | "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}; |
| | | |
| | | // public static void main(String args[]) { |
| | | // |
| | | // System.out.println("MD5后再加密:" + KL(MD5("123456"))); |
| | | // System.out.println(MD5("123456")); |
| | | // // System.out.println("加密:" + KL(MD5("123456"))); |
| | | // // s = KL(s); |
| | | // // System.out.println("解密:" + KL("81dc9bdb52d04dc20036dbd8313ed055")); |
| | | // // System.out.println("解密:" + JM(KL(s))); |
| | | // // System.out.println("解密为MD5后的:" + KL(KL(MD5(s)))); |
| | | // // System.out.println(JM("5d62957bb57d3e49dcf48a0df064be4c")); |
| | | // // System.out.println(MD5AndKL.KL(MD5AndKL.MD5("admin"+"87654321"))); |
| | | // } |
| | | } |
| | |
| | | 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 = "legalBack") |
| | | private String legalBack; |
| | | |
| | | @TableField(value = "accountType") |
| | | private Integer accountType; |
| | | |
| | | @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 = "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 = "bankCardTwo") |
| | | private String bankCardTwo; |
| | | @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; |
| | | @TableField(value = "auditState") |
| | | private Integer auditState; |
| | | @TableField(value = "aliasName") |
| | | private String aliasName; |
| | | @TableField(value = "merchantNumber") |
| | | private String merchantNumber; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | private Integer id; |
| | | |
| | | private String name; |
| | | /** |
| | | * 微信商户号 |
| | | */ |
| | | @TableField("merchantNumber") |
| | | private String merchantNumber; |
| | | /** |
| | | * 微信商户全称 |
| | | */ |
| | | @TableField("merchantName") |
| | | private String merchantName; |
| | | |
| | | @TableField("userId") |
| | | private Integer userId; |
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> { |
| | | } |
| | |
| | | import com.dsh.guns.modular.system.model.Bank; |
| | | import com.dsh.guns.modular.system.model.CoachChangeStateVO; |
| | | import com.dsh.guns.modular.system.model.TOperator; |
| | | import com.wechat.pay.java.service.profitsharing.model.AddReceiverResponse; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | int changeState(CoachChangeStateVO vo); |
| | | |
| | | List<Bank> getBankList(); |
| | | |
| | | } |
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 { |
| | | |
| | | } |
| | |
| | | package com.dsh.guns.modular.system.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.mapper.TOperatorMapper; |
| | | import com.dsh.guns.core.exception.ServiceException; |
| | | import com.dsh.guns.modular.system.model.Bank; |
| | | import com.dsh.guns.modular.system.model.CoachChangeStateVO; |
| | | import com.dsh.guns.modular.system.model.TOperator; |
| | | import com.dsh.guns.modular.system.service.TOperatorService; |
| | | import com.wechat.pay.java.service.profitsharing.ProfitsharingService; |
| | | import com.wechat.pay.java.service.profitsharing.model.AddReceiverRequest; |
| | | import com.wechat.pay.java.service.profitsharing.model.AddReceiverResponse; |
| | | import com.wechat.pay.java.service.profitsharing.model.ReceiverRelationType; |
| | | import com.wechat.pay.java.service.profitsharing.model.ReceiverType; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.SortedMap; |
| | | import java.util.TreeMap; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class TOperatorServiceImpl extends ServiceImpl<TOperatorMapper, TOperator> implements TOperatorService { |
| | | |
| | | @Autowired |
| | | private TOperatorMapper tOperatorMapper; |
| | | @Override |
| | |
| | | |
| | | return tOperatorMapper.getBankList(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | 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) { |
| | |
| | | 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(); |
| | |
| | | import com.alipay.api.request.*; |
| | | import com.alipay.api.response.*; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.util.UUIDUtil; |
| | | import com.dsh.guns.modular.system.controller.util.HttpClientUtil; |
| | | import com.dsh.guns.modular.system.controller.util.MD5AndKL; |
| | | import com.dsh.guns.modular.system.model.OperatorAuthAlipay; |
| | | import com.dsh.guns.modular.system.model.OperatorUser; |
| | | import com.dsh.guns.modular.system.service.IOperatorAuthService; |
| | |
| | | import org.dom4j.Element; |
| | | import org.dom4j.io.SAXReader; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.crypto.Mac; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.*; |
| | | import java.util.*; |
| | | |
| | | import static com.dsh.guns.modular.system.controller.util.MD5AndKL.byteArrayToHexString; |
| | | |
| | | /** |
| | | * 第三方支付工具类 |
| | | */ |
| | |
| | | |
| | | private String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB";//支付宝支付公钥 |
| | | |
| | | private String appid = "";//微信appid |
| | | private String smid = "2088330203191220";//平台支付宝商户号... |
| | | |
| | | private String appletsAppid = "";//微信小程序appid |
| | | private String appid = "wx41d32f362ba0f911";//微信appid |
| | | |
| | | private String mchId = "";//微信商户号 |
| | | private String appSecret = "cf0ebf950f5926a69041a0e2bbe20f3e"; |
| | | |
| | | private String key = "";//微信商户号 |
| | | private String mchId = "1501481761";//微信商户号 |
| | | |
| | | private String key = "6f5e0c2dcabfa9c27b5da5836a362fef";//微信商户号 |
| | | |
| | | private String callbackPath = "https://online.daowepark.com:443/account";//支付回调网关地址 |
| | | |
| | |
| | | private IOperatorUserService operatorUserService; |
| | | |
| | | /** |
| | | * 添加分账接收方 |
| | | * @param number 商户号或者openId |
| | | * @param name 商户全称或者个人姓名 |
| | | * @return |
| | | */ |
| | | public ResultUtil addReceiver(String number,String name) throws Exception { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("mch_id", mchId); |
| | | map.put("appid", appid); |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | map.put("nonce_str", nonce_str); |
| | | // 将这个字符串使用json格式拼接起来 |
| | | Map<String, Object> body = new HashMap<>(); |
| | | body.put("type", "MERCHANT_ID"); |
| | | body.put("account", number); |
| | | body.put("name", name); |
| | | body.put("relation_type", "PARTNER"); |
| | | JSONObject jsonObject = new JSONObject(body); |
| | | String jsonString = jsonObject.toString(); |
| | | map.put("receiver",jsonString ); |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | String url = "https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = null; |
| | | try { |
| | | body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | return ResultUtil.success(); |
| | | } else { |
| | | // System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | } else { |
| | | // System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | /** |
| | | * 发起分账 |
| | | * @param order 微信订单号 |
| | | * @return |
| | | */ |
| | | public ResultUtil fenzhang(String order) throws Exception { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("mch_id", mchId); |
| | | map.put("appid", appid); |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | map.put("nonce_str", nonce_str); |
| | | map.put("transaction_id", order); |
| | | // 将这个字符串使用json格式拼接起来 |
| | | Map<String, Object> body = new HashMap<>(); |
| | | body.put("type", "MERCHANT_ID"); |
| | | // todo 分账接收方 计算分账金额 |
| | | body.put("account", "1233"); |
| | | body.put("amount", "0"); |
| | | body.put("description", "订单分账"); |
| | | JSONObject jsonObject = new JSONObject(body); |
| | | String jsonString = jsonObject.toString(); |
| | | map.put("receiver",jsonString); |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | String url = "https://api.mch.weixin.qq.com/secapi/pay/profitsharing"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = null; |
| | | try { |
| | | body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | return ResultUtil.success(); |
| | | } else { |
| | | // System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | } else { |
| | | // System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | /** |
| | | * 删除分账接收方 |
| | | * @param number 商户号或者openId |
| | | * @param name 商户全称或者个人姓名 |
| | | * @return |
| | | */ |
| | | public ResultUtil deleteReceiver(String number,String name) throws Exception { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("mch_id", mchId); |
| | | map.put("appid", appid); |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | map.put("nonce_str", nonce_str); |
| | | // 将这个字符串使用json格式拼接起来 |
| | | Map<String, Object> body = new HashMap<>(); |
| | | body.put("type", "MERCHANT_ID"); |
| | | body.put("account", number); |
| | | body.put("name", name); |
| | | body.put("relation_type", "PARTNER"); |
| | | JSONObject jsonObject = new JSONObject(body); |
| | | String jsonString = jsonObject.toString(); |
| | | map.put("receiver",jsonString ); |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | String url = "https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = null; |
| | | try { |
| | | body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | return ResultUtil.success(); |
| | | } else { |
| | | // System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | } else { |
| | | // System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | /** |
| | | * 微信下单的签名算法 |
| | | * |
| | | * @param map |
| | | * @return |
| | | */ |
| | | private String weixinSignature(Map<String, Object> map) { |
| | | try { |
| | | Set<Map.Entry<String, Object>> entries = map.entrySet(); |
| | | List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); |
| | | // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) |
| | | Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() { |
| | | public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) { |
| | | return (o1.getKey()).toString().compareTo(o2.getKey()); |
| | | } |
| | | }); |
| | | // 构造签名键值对的格式 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (Map.Entry<String, Object> item : infoIds) { |
| | | if (item.getKey() != null || item.getKey() != "") { |
| | | String key = item.getKey(); |
| | | Object val = item.getValue(); |
| | | if (!(val == "" || val == null)) { |
| | | sb.append(key + "=" + val + "&"); |
| | | } |
| | | } |
| | | } |
| | | sb.append("key=" + key); |
| | | String sign = sha256_HMAC(sb.toString(), key).toUpperCase(); |
| | | return sign; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | * sha256_HMAC加密 |
| | | * @param message 消息 |
| | | * @param secret 秘钥 |
| | | * @return 加密后字符串 |
| | | */ |
| | | public String sha256_HMAC(String message, String secret) { |
| | | String hash = ""; |
| | | try { |
| | | Mac sha256_HMAC = Mac.getInstance("HmacSHA256"); |
| | | SecretKeySpec secret_key = new SecretKeySpec(secret.getBytes(), "HmacSHA256"); |
| | | sha256_HMAC.init(secret_key); |
| | | byte[] bytes = sha256_HMAC.doFinal(message.getBytes()); |
| | | hash = byteArrayToHexString(bytes); |
| | | } catch (Exception e) { |
| | | System.out.println("Error HmacSHA256 ===========" + e.getMessage()); |
| | | } |
| | | return hash; |
| | | } |
| | | |
| | | /** |
| | | * 处理直付通审核通过和拒绝消息 |
| | | */ |
| | | public void getMessage() { |
| | |
| | | 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; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | feign.compression.request.enabled=true |
| | | feign.compression.response.enabled=true |
| | | |
| | | mybatis-plus.configuration.map-underscore-to-camel-case=false |
| | | mybatis-plus.configuration.map-underscore-to-camel-case=false |
| | | |
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> |
| | |
| | | <#button name="冻结" icon="fa-remove" clickFun="TSite.offShelf()" space="true"/> |
| | | <#button name="解冻" icon="fa-check" clickFun="TSite.onShelf()" space="true"/> |
| | | <#button name="重置密码" icon="fa-search" clickFun="TSite.reload()" space="true"/> |
| | | <#button name="绑定微信商户号" icon="fa-search" clickFun="TSite.bindWx()" space="true"/> |
| | | </div> |
| | | <#table id="TSiteTable"/> |
| | | </div> |
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> |
| | | @} |
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"> |
| | | <div class="row"> |
| | | <input hidden id="id" value="${id}"> |
| | | <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="merchantNumber" value="${merchantNumber}" placeholder="请输入" type="number"> |
| | | </div> |
| | | <label class="col-sm-3 control-label">*微信商户全称:</label> |
| | | <div class="col-sm-9"> |
| | | <input style="width: 300px" class="form-control" id="name" value="${name}" placeholder="请输入" type="text"> |
| | | </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.merchantNumber()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TSite.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script src="${ctxPath}/modular/system/operator/operator_add.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"> |
| | | |
| | | @} |
| | |
| | | @} |
| | | <#button name="免费福利" icon="fa-remove" clickFun="TCompetition.gift()" space="true"/> |
| | | <#button name="首页设置" icon="fa-remove" clickFun="TCompetition.indexSet()" space="true"/> |
| | | |
| | | |
| | | @if(role == '1'){ |
| | | @if(shiro.hasPermission("/tHomeModule/tHomeModule_platformSet")){ |
| | | <#button name="图文模块设置" icon="fa-edit" clickFun="TCompetition.platformSet()" space="true"/> |
| | |
| | | */ |
| | | TSite.initColumn = function () { |
| | | return [ |
| | | {field: 'selectItem', checkbox: true}, |
| | | {field: 'selectItem', radio: true}, |
| | | {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '运营商名称', field: 'name', visible: true, align: 'center', valign: 'middle',width:'20%',}, |
| | | {title: '管理员姓名', field: 'userName', visible: true, align: 'center', valign: 'middle', |
| | |
| | | this.layerIndex = index; |
| | | } |
| | | }; |
| | | TSite.bindWx = function () { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: "商户认证", |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/operator/bindWx/' + TSite.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | }; |
| | | /** |
| | | * 商户号认证页面回显 |
| | | */ |
| | |
| | | |
| | | } |
| | | }; |
| | | TSite.oneChange = function (e) { |
| | | console.log("进入!") |
| | | var oneId=$(e).val(); |
| | | console.log(oneId) |
| | | var ajax = new $ax(Feng.ctxPath + "/tCompetition/onChange", function(data){ |
| | | var content='<option value="">选择市</option>'; |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#cCode").empty().append(content); |
| | | }); |
| | | if (oneId==""){ |
| | | var temp = '<option value="">请先选择省</option>'; |
| | | $("#cCode").empty().append(temp); |
| | | } |
| | | ajax.set("oneId",oneId); |
| | | ajax.start(); |
| | | } |
| | | |
| | | /** |
| | | * 关闭此对话框 |
| | | */ |
| | | TSite.close = function() { |
| | | parent.layer.close(window.parent.TSite.layerIndex); |
| | | } |
| | | |
| | | TSite.merchantNumber = function(){ |
| | | if($("#merchantNumber").val() == "" || $("#merchantNumber").val() == null){ |
| | | Feng.error("请填写微信商户号") |
| | | return; |
| | | } |
| | | if($("#name").val() == "" || $("#name").val() == null){ |
| | | Feng.error("请填写微信商户全称") |
| | | return; |
| | | } |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/operator/merchantNumberWx", function(data){ |
| | | console.log(data) |
| | | if (data.code == 500){ |
| | | Feng.error(data.msg) |
| | | return |
| | | } |
| | | Feng.success("操作成功!"); |
| | | window.parent.TSite.table.refresh(); |
| | | TSite.close(); |
| | | },function(data){ |
| | | Feng.error("操作失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("id",$("#id").val()); |
| | | ajax.set("merchantNumber",$("#merchantNumber").val()); |
| | | ajax.set("name",$("#name").val()); |
| | | ajax.start(); |
| | | }; |
| | | TSite.oneChange = function (e) { |
| | | console.log("进入!") |
| | | var oneId=$(e).val(); |
| | |
| | | }, |
| | | ]; |
| | | }; |
| | | /** |
| | | * 商户号认证页面 |
| | | */ |
| | | 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; |
| | | } |
| | | }; |
| | |
| | | console.log("看看是否可预约值") |
| | | console.log(reservation); |
| | | var checkbox = document.querySelector('input[name="pt"]'); |
| | | if (checkbox.checked) { |
| | | data.type = 1 |
| | | console.log("选中是平台"); |
| | | data.operatorId = 0; |
| | | } else { |
| | | console.log("运营商"); |
| | | data.type = 2; |
| | | console.log(checkbox) |
| | | if (checkbox!=null){ |
| | | if (checkbox.checked) { |
| | | data.type = 1 |
| | | console.log("选中是平台"); |
| | | data.operatorId = 0; |
| | | } else { |
| | | console.log("运营商"); |
| | | data.type = 2; |
| | | } |
| | | } |
| | | |
| | | if (reservation == 1) { |
| | | if (data.typeName === "智慧场地") { |
| | | console.log("===========这是智慧球场") |
| | |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | @ResponseBody |
| | | @PostMapping("/api/game/payGame") |
| | | @ApiOperation(value = "支付游戏", tags = {"用户—游戏"}) |
| | |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Site byId = siteService.getById(spaceId); |
| | | // 是否分账 0否1是 |
| | | int isFenZhang= 1; |
| | | String merchantNumber = ""; |
| | | if (byId.getOperatorId()==null || byId.getOperatorId()==0){ |
| | | // 平台 |
| | | isFenZhang = 0; |
| | | } |
| | | //判断当前用户是否是员工 |
| | | AppUser appUser1 = appUserClient.queryAppUser(uid); |
| | |
| | | tGameRecord.setMoney(config.getCash()); |
| | | gameRecordService.updateById(tGameRecord); |
| | | String params = uid + "_" + gameId + "_" + spaceId + "_" + sutuId+"_"+code+"_"+configId + "_" + gameType; |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("游戏支付", params, code, config.getCash().toString(), |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("游戏支付-"+isFenZhang, params, code, config.getCash().toString(), |
| | | "/base/game/wechatPaymentGameCallback", "APP", ""); |
| | | if (weixinpay.getCode() == 200) { |
| | | new Thread(new Runnable() { |
| | |
| | | } |
| | | gameRecordService.updateBatchById(list); |
| | | Integer integer = startGame(uid, gameType, gameId, spaceId, sutuId); |
| | | if (byId.getOperatorId()!=null && byId.getOperatorId()!=0){ |
| | | // 休眠两分钟后再调用分账接口 避免提示订单正在处理中 |
| | | Thread.sleep(120000); |
| | | // 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | OperatorUser operatorId = operatorUserService.getOne( |
| | | new QueryWrapper<OperatorUser>().eq("operatorId",byId.getOperatorId()) |
| | | ); |
| | | if (operatorId.getWechatProportion() == null){ |
| | | operatorId.setWechatProportion("0"); |
| | | } |
| | | if (operatorId.getAlipayProportion() == null){ |
| | | operatorId.setAlipayProportion("0"); |
| | | } |
| | | String proportion= operatorId.getWechatProportion()+","+operatorId.getAlipayProportion(); |
| | | String[] split = proportion.split(","); |
| | | String s1 = split[0]; |
| | | if (!s1.equals("未设置")){ |
| | | BigDecimal bigDecimal = new BigDecimal(s1); |
| | | // 分账比例 |
| | | BigDecimal bigDecimal1 = bigDecimal.divide(new BigDecimal(100)).setScale(2); |
| | | // 微信商户号 |
| | | String s2 =siteService.getmerchantNumberByOperatorId(byId.getOperatorId()); |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | |
| | | ResultUtil fenzhang = payMoneyUtil.fenzhang(transaction_id, config.getCash().multiply(bigDecimal1), s2,nonce_str); |
| | | if (!fenzhang.getCode().equals(500)){ |
| | | System.err.println("分账失败 原因是:"+fenzhang.getMsg()); |
| | | }else{ |
| | | tGameRecord.setFenzhangNo(fenzhang.getMsg()); |
| | | tGameRecord.setFenzhangOrderNo(nonce_str); |
| | | tGameRecord.setFenzhangAmount(config.getCash().multiply(bigDecimal1)); |
| | | gameRecordService.updateById(tGameRecord); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | |
| | | } |
| | | if ("USERPAYING".equals(s) || "NOTPAY".equals(s)) { |
| | | num++; |
| | |
| | | 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; |
| | |
| | | |
| | | @Resource |
| | | private CityManagerClient cityManagerClient; |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | |
| | | @Autowired |
| | | private TGameConfigService gameConfigService; |
| | |
| | | |
| | | @Resource |
| | | private CourseRecordClient courseRecordClient; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | |
| | | @RequestMapping("/base/getSMIDByOperatorId") |
| | | @ResponseBody |
| | | public String getSMIDByOperatorId(Integer id) { |
| | | // 获取运营商的管理员 |
| | | return siteService.getSMIDByOperatorId(id); |
| | | } |
| | | /** |
| | | * 通过运营商id查询运营商对应的微信商户号 |
| | | */ |
| | | @RequestMapping("/base/getmerchantNumberByOperatorId") |
| | | @ResponseBody |
| | | public String getmerchantNumberByOperatorId(Integer id) { |
| | | return siteService.getmerchantNumberByOperatorId(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") |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | private List<Integer> rid; |
| | | @TableField("addType") |
| | | private Integer addType; |
| | | /** |
| | | * 分账流水号 |
| | | */ |
| | | @TableField("fenzhangNo") |
| | | private String fenzhangNo; |
| | | /** |
| | | * 分账业务号 存值表明已分账 未存表明未分账 |
| | | */ |
| | | @TableField("fenzhangOrderNo") |
| | | private String fenzhangOrderNo; |
| | | // 分账金额 |
| | | @TableField("fenzhangAmount") |
| | | private BigDecimal fenzhangAmount; |
| | | // 分账回退流水号 |
| | | @TableField("fenzhangRefundNo") |
| | | private String fenzhangRefundNo; |
| | | } |
| | |
| | | |
| | | private Date time; |
| | | |
| | | |
| | | /** |
| | | * 分账流水号 |
| | | */ |
| | | private String fenzhangNo; |
| | | /** |
| | | * 分账业务号 存值表明已分账 未存表明未分账 |
| | | */ |
| | | private String fenzhangOrderNo; |
| | | // 分账金额 |
| | | private BigDecimal fenzhangAmount; |
| | | // 分账回退流水号 |
| | | private String fenzhangRefundNo; |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | @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); |
| | | |
| | |
| | | List<TSiteDTO> listExipre(@Param("query") ExpireSiteSearchVO vo); |
| | | |
| | | String getSMIDByOperatorId(@Param("id")Integer id); |
| | | String getmerchantNumberByOperatorId(@Param("id")Integer id); |
| | | |
| | | } |
| | |
| | | Object changeState(SiteChangeStateVO vo); |
| | | |
| | | String getSMIDByOperatorId(Integer id); |
| | | String getmerchantNumberByOperatorId(Integer id); |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | import org.aspectj.weaver.ast.Var; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | |
| | | public ResultUtil weChatPaymentSite(Double paymentPrice, SiteBooking siteBooking) throws Exception { |
| | | String code = siteBooking.getOrderNo(); |
| | | Integer id = siteBooking.getId(); |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("预约场地", id.toString(), code, paymentPrice.toString(), |
| | | Site byId = siteService.getById(siteBooking.getSiteId()); |
| | | // 是否分账 0否1是 |
| | | int isFenZhang= 1; |
| | | String merchantNumber = ""; |
| | | if (byId.getOperatorId()==null || byId.getOperatorId()==0){ |
| | | // 平台 |
| | | isFenZhang = 0; |
| | | } |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("预约场地-"+isFenZhang, id.toString(), code, paymentPrice.toString(), |
| | | "/base/site/weChatPaymentSiteCallback", "APP", ""); |
| | | if (weixinpay.getCode() == 200) { |
| | | new Thread(new Runnable() { |
| | |
| | | siteBooking.setStatus(1); |
| | | siteBooking.setPayOrderNo(transaction_id); |
| | | siteBookingService.updateById(siteBooking); |
| | | |
| | | if (byId.getOperatorId()!=null && byId.getOperatorId()!=0){ |
| | | // 休眠两分钟后再调用分账接口 避免提示订单正在处理中 |
| | | Thread.sleep(120000); |
| | | // 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | OperatorUser operatorId = operatorUserService.getOne( |
| | | new QueryWrapper<OperatorUser>().eq("operatorId",byId.getOperatorId()) |
| | | ); |
| | | if (operatorId.getWechatProportion() == null){ |
| | | operatorId.setWechatProportion("0"); |
| | | } |
| | | if (operatorId.getAlipayProportion() == null){ |
| | | operatorId.setAlipayProportion("0"); |
| | | } |
| | | String proportion= operatorId.getWechatProportion()+","+operatorId.getAlipayProportion(); |
| | | String[] split = proportion.split(","); |
| | | String s1 = split[0]; |
| | | if (!s1.equals("未设置")){ |
| | | BigDecimal bigDecimal = new BigDecimal(s1); |
| | | // 分账比例 |
| | | BigDecimal bigDecimal1 = bigDecimal.divide(new BigDecimal(100)).setScale(2); |
| | | // 微信商户号 |
| | | String s2 =siteService.getmerchantNumberByOperatorId(byId.getOperatorId()); |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | BigDecimal bigDecimal2 = new BigDecimal(paymentPrice); |
| | | ResultUtil fenzhang = payMoneyUtil.fenzhang(transaction_id, bigDecimal2.multiply(bigDecimal1), s2,nonce_str); |
| | | if (!fenzhang.getCode().equals(500)){ |
| | | System.err.println("分账失败 原因是:"+fenzhang.getMsg()); |
| | | }else{ |
| | | siteBooking.setFenzhangNo(fenzhang.getMsg()); |
| | | siteBooking.setFenzhangOrderNo(nonce_str); |
| | | siteBooking.setFenzhangAmount(bigDecimal2.multiply(bigDecimal1)); |
| | | siteBookingService.updateById(siteBooking); |
| | | } |
| | | } |
| | | } |
| | | |
| | | break; |
| | | } |
| | | if ("USERPAYING".equals(s) || "NOTPAY".equals(s)) { |
| | |
| | | } |
| | | |
| | | 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("调用失败"); |
| | | } |
| | | } |
| | | /** |
| | | * 玩湃币支付 |
| | | * |
| | |
| | | @Override |
| | | public ResultUtil cancelMySite(Integer uid, Integer id) throws Exception { |
| | | SiteBooking siteBooking = siteBookingService.getById(id); |
| | | |
| | | Site byId = siteService.getById(siteBooking.getSiteId()); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| | | Date startTime = siteBooking.getStartTime(); |
| | | if (format.format(new Date()).equals(format.format(startTime)) && siteBooking.getStatus() != 0) { |
| | |
| | | return ResultUtil.error("不能进行取消操作"); |
| | | } |
| | | if (siteBooking.getPayType() == 1) {//微信支付 |
| | | if (StringUtils.hasLength(siteBooking.getFenzhangNo())){ |
| | | // 是分账订单 如果分账金额不为0 那么回退分账金额 |
| | | if (siteBooking.getFenzhangAmount()!=null && siteBooking.getFenzhangAmount().compareTo(BigDecimal.ZERO)>0){ |
| | | String randomCode = UUIDUtil.getRandomCode(16); |
| | | String randomCode1 = UUIDUtil.getRandomCode(16); |
| | | if (byId.getOperatorId()!=null && byId.getOperatorId()!=0){ |
| | | // 休眠两分钟后再调用分账接口 避免提示订单正在处理中 |
| | | // 微信商户号 |
| | | String s2 =siteService.getmerchantNumberByOperatorId(byId.getOperatorId()); |
| | | ResultUtil resultUtil = payMoneyUtil.fenzhangRefund(siteBooking.getFenzhangNo(), siteBooking.getFenzhangAmount(), s2, randomCode, randomCode1); |
| | | if (!resultUtil.getCode().equals(500)){ |
| | | System.err.println("分账回退失败 原因是:"+resultUtil.getMsg()); |
| | | }else{ |
| | | siteBooking.setFenzhangRefundNo(resultUtil.getMsg()); |
| | | siteBookingService.updateById(siteBooking); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | Map<String, String> map = payMoneyUtil.wxRefund(siteBooking.getPayOrderNo(), siteBooking.getOrderNo(), siteBooking.getPayMoney().toString(), |
| | | siteBooking.getPayMoney().toString(), "/base/site/cancelMySiteCallback"); |
| | | if (null == map) { |
| | |
| | | public String getSMIDByOperatorId(Integer id) { |
| | | return siteMapper.getSMIDByOperatorId(id); |
| | | } |
| | | @Override |
| | | public String getmerchantNumberByOperatorId(Integer id) { |
| | | return siteMapper.getmerchantNumberByOperatorId(id); |
| | | } |
| | | } |
| | |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.crypto.BadPaddingException; |
| | |
| | | " }," + |
| | | " \"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\"" + |
| | | " }" + |
| | | "}"); |
| | | AlipayTradeSettleConfirmResponse response = null; |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | JSONObject alipay_trade_precreate_response = JSON.parseObject(response.getBody()).getJSONObject("alipay_trade_precreate_response"); |
| | | |
| | | System.err.print(alipay_trade_precreate_response.getString("qr_code")); |
| | | return ResultUtil.success(alipay_trade_precreate_response.getString("qr_code")); |
| | | } |
| | |
| | | map.put("appid", appid); |
| | | map.put("mch_id", mchId); |
| | | map.put("nonce_str", nonce_str); |
| | | map.put("body", body); |
| | | String temp = ""; |
| | | if (body.split("-").length>1){ |
| | | temp = body.split("-")[1]; |
| | | map.put("body", body.split("-")[0]); |
| | | }else{ |
| | | map.put("body", body); |
| | | } |
| | | if (StringUtils.hasLength(temp) && temp.equals("1")){ |
| | | // 添加分账标识 |
| | | map.put("profit_sharing", "Y"); |
| | | } |
| | | map.put("attach", attach);//存储订单id |
| | | map.put("out_trade_no", out_trade_no);//存储的订单code |
| | | map.put("total_fee", i); |
| | |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | /** |
| | | * 发起分账 |
| | | * @param order 微信订单号 |
| | | * @return |
| | | */ |
| | | public ResultUtil fenzhang(String order,BigDecimal amount,String merchantNumber,String nonce_str) throws Exception { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("mch_id", mchId); |
| | | map.put("appid", appid); |
| | | map.put("nonce_str", nonce_str); |
| | | map.put("transaction_id", order); |
| | | // 将这个字符串使用json格式拼接起来 |
| | | Map<String, Object> body = new HashMap<>(); |
| | | body.put("type", "MERCHANT_ID"); |
| | | body.put("account", merchantNumber); |
| | | body.put("amount", amount); |
| | | body.put("description", "订单分账"); |
| | | JSONObject jsonObject = new JSONObject(body); |
| | | String jsonString = jsonObject.toString(); |
| | | map.put("receiver",jsonString); |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | String url = "https://api.mch.weixin.qq.com/secapi/pay/profitsharing"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = null; |
| | | try { |
| | | body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.err.println("分账请求"+body1); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | return ResultUtil.success(); |
| | | } else { |
| | | // System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | } else { |
| | | // System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | /** |
| | | * 发起分账回退 |
| | | * @param order 微信订单号 |
| | | * @return |
| | | */ |
| | | public ResultUtil fenzhangRefund(String order,BigDecimal amount,String merchantNumber, |
| | | String nonce_str, |
| | | String fenzhangRefundNo) throws Exception { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("mch_id", mchId); |
| | | map.put("appid", appid); |
| | | map.put("nonce_str", nonce_str); |
| | | map.put("order_id", order); |
| | | map.put("out_return_no", fenzhangRefundNo); |
| | | map.put("return_account_type", "MERCHANT_ID"); |
| | | map.put("return_account", merchantNumber); |
| | | map.put("return_amount", amount); |
| | | map.put("description", "用户退款"); |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | String url = "https://api.mch.weixin.qq.com/secapi/pay/profitsharingreturn"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for (int l = 0; l < keys.length; l++) { |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = null; |
| | | try { |
| | | body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.err.println("分账金额回退"+body1); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if ("SUCCESS".equals(return_code)) { |
| | | String result_code = map1.get("result_code"); |
| | | if ("SUCCESS".equals(result_code)) { |
| | | return ResultUtil.success(map1.get("return_no")); |
| | | } else { |
| | | // System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | } else { |
| | | // System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 微信支付成功后的回调处理 |
| | |
| | | <select id="getSMIDByOperatorId" resultType="java.lang.String"> |
| | | select alipayNum from t_operator_user where operatorId = #{id} |
| | | </select> |
| | | <select id="getmerchantNumberByOperatorId" resultType="java.lang.String"> |
| | | select merchantNumber from t_operator where id = #{id} |
| | | </select> |
| | | </mapper> |