From 5b83b50d38c757b38dcc87a40a17d34cc2948e10 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期五, 15 三月 2024 09:49:15 +0800
Subject: [PATCH] Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/PlayPai into 2.0

---
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/OperatorController.java |  105 ++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 84 insertions(+), 21 deletions(-)

diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/OperatorController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/OperatorController.java
index 359427c..c1d7f8f 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/OperatorController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/OperatorController.java
@@ -26,6 +26,7 @@
 import com.dsh.guns.modular.system.model.*;
 import com.dsh.guns.modular.system.service.*;
 
+import com.dsh.guns.modular.system.util.HttpRequestUtil;
 import com.dsh.guns.modular.system.util.PayMoneyUtil;
 import com.dsh.guns.modular.system.util.ResultUtil;
 
@@ -222,8 +223,26 @@
         TOperator data = operatorService.getById(id);
         User byId = userService.getById(data.getUserId());
         model.addAttribute("user",byId);
+        OperatorUser operatorId = operatorUserService.getOne(new QueryWrapper<OperatorUser>()
+                .eq("operatorId", data.getId()));
 
         model.addAttribute("data",data);
+        String state="";
+        switch (operatorId.getAlipayAudit()){
+            case 0:
+                state="未认证";
+                break;
+            case 1:
+                state="待审核";
+                break;
+            case 2:
+                state="已通过";
+                break;
+            case 3:
+                state="已拒绝";
+                break;
+        }
+        model.addAttribute("state",state);
         OperatorAuthAlipay info = operatorAuthService.getOne(new QueryWrapper<OperatorAuthAlipay>()
                 .eq("operatorId", id));
         model.addAttribute("item",info);
@@ -240,10 +259,9 @@
         }else{
             List<TCity> list6 = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0));
             model.addAttribute("list4",list6);
+            List<TCity> list5 = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 1));
+            model.addAttribute("list5",list5);
         }
-
-
-
         model.addAttribute("bodyType",info.getBodyType());
         model.addAttribute("accountType",info.getAccountType());
         model.addAttribute("useType",info.getUseType());
@@ -287,17 +305,22 @@
             return ERROR;
         }
     }
-    public static void main(String[] args) {
-        String bankName = "中国工商银行"; // 要转换为简写的银行名称
+//    public static void main(String[] args) {
+//        // 调用支付宝接口 通过银行卡号获取银行信息
+//        String url = "https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&" +
+//                "cardNo=6217003800041315031&cardBinCheck=true";
+//        HashMap<String, String> hashMap = new HashMap<>();
+//        String result = HttpRequestUtil.postRequest(url,hashMap);
+//        System.err.println(result);
+//        JSONObject json = JSONObject.parseObject(result);
+//        String bank = json.getString("bank");
+//        String cardType = json.getString("cardType");
+//        System.err.println(bank);
+//        System.err.println(cardType);
+//
+//    }
 
-        Pattern pattern = Pattern.compile("([\\u4e00-\\u9fa5]+)(?=\\s+[A-Za-z]+$)");
-        Matcher matcher = pattern.matcher(bankName);
-        if (matcher.find()) {
-            System.out.println(matcher.group()); // 输出结果:"工商银行" -> "ICBC"
-        } else {
-            System.out.println("无法识别该银行名称!");
-        }
-    }
+
     /**
      * 支付宝商户认证提交
      */
@@ -316,11 +339,26 @@
         Integer userId1 = byId.getUserId();
         OperatorUser userId2 = operatorUserService.getOne(new QueryWrapper<OperatorUser>()
                 .eq("userId", userId1));
-        // 0未认证 1待审核 2通过 3驳回
         userId2.setAlipayAudit(1);
-        operatorUserService.updateById(userId2);
+        // 01是企业
+        if (bodyType.equals("01")){
+            userId2.setAlipayType(2);
+        }else{
+            userId2.setAlipayType(1);
+        }
+        operatorUserService.saveOrUpdate(userId2);
         OperatorAuthAlipay data = operatorAuthService.getOne(new QueryWrapper<OperatorAuthAlipay>().eq("operatorId", operatorId));
-        String group="ABC";
+        // 调用支付宝接口 通过银行卡号获取银行信息
+        String url = "https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&" +
+                "cardNo="+bankCard+"&cardBinCheck=true";
+        HashMap<String, String> hashMap = new HashMap<>();
+        String result = HttpRequestUtil.postRequest(url,hashMap);
+        System.err.println(result);
+        JSONObject json2 = JSONObject.parseObject(result);
+        String bank = json2.getString("bank");
+        String cardType1 = json2.getString("cardType");
+        // 根据银行卡号查询所属银行
+        String group=bank;
 //        if(StringUtils.hasLength(bankName)){
 //            Pattern pattern = Pattern.compile(".*[\\u4e00-\\u9fa5]+"); // 只保留汉字部分
 //            Matcher matcher = pattern.matcher(bankName);
@@ -398,6 +436,12 @@
         operatorAuth.setShopProvince(shopProvince);
         operatorAuth.setShopProvinceCode(shopProvinceCode);
         operatorAuth.setShopCityCode(shopCityCode);
+        if(StringUtils.hasLength(province)&& province.equals("请选择省")){
+            operatorAuth.setProvince(null);
+        }
+        if(StringUtils.hasLength(city)&& province.equals("请选择市")){
+            operatorAuth.setCity(null);
+        }
         operatorAuth.setProvince(province);
         operatorAuth.setProvinceCode(provinceCode);
         operatorAuth.setShopDistrict(shopDistrict);
@@ -443,7 +487,6 @@
                 "      \"mobile\":\""+phone+"\"," +
                 "    }" +
                 "  ],";
-
         // todo 拼接
         String biz_cards="  \"biz_cards\":[" +
                 "    {" +
@@ -462,12 +505,12 @@
         String type ;
         // 结算类型为支付宝 填写支付宝账号 结算类型为银行卡填写银行卡号
         String account;
-        if (StringUtils.hasLength(alipayAccount)){
-            type =  accountType;
-            account = alipayAccount;
-        }else{
+        if (accountType.equals("bankCard")){
             type = accountType;
             account = bankCard;
+        }else{
+            type =  accountType;
+            account = alipayAccount;
         }
         String res=
                 "  \"service\":[" +
@@ -493,6 +536,9 @@
         if (accountType.equals("bankCard")){
             request.setBizContent(param
                     + biz_cards+res);
+        }else{
+            request.setBizContent(param
+                    +res);
         }
         AntMerchantExpandIndirectZftCreateResponse response = null;
         try {
@@ -508,6 +554,7 @@
             System.err.println("订单号"+order_no);
             operatorAuth.setOrderNo(order_no);
             operatorAuth.setRefuseReason("");
+
             operatorAuthService.saveOrUpdate(operatorAuth);
             Integer userId = operatorService.getById(operatorId).getUserId();
             OperatorUser user = operatorUserService.getOne(new QueryWrapper<OperatorUser>().eq("userId", userId));
@@ -520,6 +567,11 @@
             }
             operatorUserService.saveOrUpdate(user);
         } else {
+            Integer userId = operatorService.getById(operatorId).getUserId();
+            OperatorUser user = operatorUserService.getOne(new QueryWrapper<OperatorUser>().eq("userId", userId));
+            user.setAlipayAudit(3);
+            operatorUserService.saveOrUpdate(user);
+            operatorAuth.setRefuseReason(response.getSubMsg());
             if (response.getCode().equals("40004")){
                 String subMsg = response.getSubMsg();
                 return ResultUtil.error(subMsg);
@@ -804,4 +856,15 @@
         }
         return ResultUtil.success("添加成功");
     }
+
+
+    /**
+     * 获取所有运营商
+     * @return
+     */
+    @ResponseBody
+    @PostMapping("/getOperatorListAll")
+    public Object getOperatorListAll(){
+        return operatorService.list(new QueryWrapper<TOperator>().eq("state", 1));
+    }
 }

--
Gitblit v1.7.1