From 1b9a01bf5000714b08a75a50dd1f5f3eab65d888 Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期五, 08 十二月 2023 17:18:38 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/OperatorController.java |  170 +++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 123 insertions(+), 47 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 96ac725..00d87bb 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.util.ResultUtil;
 
+import com.mysql.cj.x.protobuf.MysqlxExpr;
 import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -57,15 +58,20 @@
     private ICityService cityService;
     @Autowired
     private IOperatorAuthService operatorAuthService;
+    @Autowired
+    private IStoreService storeService;
 
 
     /**
-     * 根据运营商ID 获取运营商管理的省市
+     * 根据运营商id查询所有门店
      */
-    @RequestMapping(value = "/getCityByOperatorId")
+    @RequestMapping("/getStores")
     @ResponseBody
-    public List<TOperatorCity> getCityByOperatorId(@RequestBody Integer operatorId) {
-        return operatorCityService.list(new QueryWrapper<TOperatorCity>().eq("operatorId",operatorId));
+    public List<TStore> getStores(Integer id)
+    {
+        return storeService.list(new QueryWrapper<TStore>()
+                .eq("operatorId",id)
+                .ne("state",3));
     }
 
     /**
@@ -150,18 +156,42 @@
     public String proportionAuth(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("provinceList",list);
         model.addAttribute("data",data);
+        OperatorAuth info = operatorAuthService.getOne(new QueryWrapper<OperatorAuth>().eq("operatorId", id));
+        model.addAttribute("item",info);
+        if (info==null){
+            OperatorAuth operatorAuth = new OperatorAuth();
+            model.addAttribute("item",operatorAuth);
+            model.addAttribute("bodyType",0);
+            model.addAttribute("code",null);
+            model.addAttribute("reasons",null);
+
+        }else{
+            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.html";
     }
 
     /**
-     * 商户认证提交
+     * 支付宝商户认证提交
      */
     @RequestMapping(value = "/auth")
     @ResponseBody
-    public Object auth(String beneficiaryEnd,String businessEnd,String legalEnd, String name,String phone,String number,Integer operatorId,String bodyType,Integer type,String businessName,String businessNumber,
+    public Object auth(String beneficiaryEnd,String businessEnd,String legalEnd, String name,String phone,String number
+            ,Integer operatorId,String bodyType,Integer type,String businessName,String businessNumber,
                        String legalRepresentative,String registerAddress,String businessTerm,String businessPicture,
                        String legalPerson,String legalNumber,String legalPhone,String legalEmail,String legalTerm,
                        String legalAddress,String legalFront,String legalBack,Integer accountType,String bank,
@@ -170,8 +200,32 @@
                        String beneficiaryNumber,String beneficiaryAddress,String beneficiaryTerm,String beneficiaryFront,String beneficiaryBack,
                        String remark) {
         UUID uuid = UUID.randomUUID();
-        String numericUUID = uuid.toString().replaceAll("-", "");
+        OperatorAuth data = operatorAuthService.getOne(new QueryWrapper<OperatorAuth>().eq("operatorId", operatorId));
         OperatorAuth operatorAuth = new OperatorAuth();
+        if (data!=null){
+            operatorAuth.setId(data.getId());
+            if(businessPicture==null || businessPicture.equals("")){
+                operatorAuth.setBusinessPicture(data.getBusinessPicture());
+                businessPicture = data.getBusinessPicture();
+            }
+            if(legalFront==null || legalFront.equals("")){
+                legalFront = data.getLegalFront();
+                operatorAuth.setLegalFront(data.getLegalFront());
+            }
+            if(legalBack==null || legalBack.equals("")){
+                legalBack = data.getLegalBack();
+                operatorAuth.setLegalBack(data.getLegalBack());
+            }
+            if(beneficiaryFront==null || beneficiaryFront.equals("")){
+                beneficiaryFront = data.getBeneficiaryFront();
+                operatorAuth.setBeneficiaryFront(data.getBeneficiaryFront());
+            }
+            if(beneficiaryBack==null || beneficiaryBack.equals("")){
+                beneficiaryBack = data.getBeneficiaryBack();
+                operatorAuth.setBeneficiaryBack(data.getBeneficiaryBack());
+            }
+        }
+        String numericUUID = uuid.toString().replaceAll("-", "");
         operatorAuth.setName(name);
         operatorAuth.setPhone(phone);
         operatorAuth.setNumber(number);
@@ -221,9 +275,9 @@
         // 营业执照
         String string = uploadImg(businessPicture).toString();
         // 法人身份证正面照
-         legalFront = uploadImg(legalFront).toString();
+        legalFront = uploadImg(legalFront).toString();
         // 法人身份证背面照
-         legalBack = uploadImg(legalBack).toString();
+        legalBack = uploadImg(legalBack).toString();
 
         if (bodyType.equals("ENTERPRISE")){
             // 受益人身份证正面照
@@ -312,7 +366,23 @@
 //            String orderStatus = r.getString("order_status");
             operatorAuth.setOrderNo(order_no);
             operatorAuth.setOrderStatus(order_status);
-            operatorAuthService.save(operatorAuth);
+
+
+            operatorAuthService.saveOrUpdate(operatorAuth);
+            // 通过运营商id找到用户id
+            TOperator byId = operatorService.getById(operatorId);
+            if (byId!=null){
+                Integer userId = byId.getUserId();
+                OperatorUser userId1 = operatorUserService.getOne(new QueryWrapper<OperatorUser>().eq("userId", userId));
+                if (userId1!=null){
+                    // 设置为审核中状态
+                    userId1.setAlipayAudit(1);
+//                    userId1.setWechatAudit(1);
+                    operatorUserService.updateById(userId1);
+                    operatorAuth.setQrCode(null);
+                    operatorAuthService.saveOrUpdate(operatorAuth);
+                }
+            }
         } else {
             System.out.println("调用失败");
         }
@@ -468,6 +538,11 @@
         operatorUser.setAlipayType(3);
         operatorUser.setWechatType(3);
         operatorUser.setOperatorId(data.getId());
+        // 添加运营商商户认证
+        operatorUser.setAlipayProportion("未设置");
+        operatorUser.setWechatProportion("未设置");
+        operatorUser.setWechatAudit(0);
+        operatorUser.setAlipayAudit(0);
         operatorUserService.save(operatorUser);
         user.setObjectId(data.getId());
         userService.updateById(user);
@@ -513,6 +588,7 @@
             }
         }
 
+
         return ResultUtil.success("添加成功");
     }
     /**
@@ -542,47 +618,47 @@
         data.setState(1);
         operatorService.updateById(data);
         if (type != 1){
-        if (SinataUtil.isNotEmpty(comArr)){
-            JSONArray jsonArray = JSON.parseArray(comArr);
-            int size = jsonArray.size();
-            for (int i = 0; i < size; i++) {
-                JSONObject jsonObject = jsonArray.getJSONObject(i);
-                TOperatorCity province = new TOperatorCity();
-                TOperatorCity city = new TOperatorCity();
-                TOperatorCity one1 = operatorCityService.getOne(new QueryWrapper<TOperatorCity>()
-                        .eq("name", jsonObject.getString("province"))
-                        .eq("operatorId", data.getId()));
-                // 省
-                if (one1==null){
-                    province.setName(jsonObject.getString("province"));
-                    province.setCode(jsonObject.getInteger("provinceCode"));
-                    province.setPid(0);
-                    province.setType(jsonObject.getInteger("areaType"));
-                    province.setOperatorId(data.getId());
-                    city.setPid(province.getId());
-                    operatorCityService.save(province);
-                    // 市
-                    if (!jsonObject.getString("city").equals("")){
-                        city.setName(jsonObject.getString("city"));
-                        city.setCode(jsonObject.getInteger("cityCode"));
+            if (SinataUtil.isNotEmpty(comArr)){
+                JSONArray jsonArray = JSON.parseArray(comArr);
+                int size = jsonArray.size();
+                for (int i = 0; i < size; i++) {
+                    JSONObject jsonObject = jsonArray.getJSONObject(i);
+                    TOperatorCity province = new TOperatorCity();
+                    TOperatorCity city = new TOperatorCity();
+                    TOperatorCity one1 = operatorCityService.getOne(new QueryWrapper<TOperatorCity>()
+                            .eq("name", jsonObject.getString("province"))
+                            .eq("operatorId", data.getId()));
+                    // 省
+                    if (one1==null){
+                        province.setName(jsonObject.getString("province"));
+                        province.setCode(jsonObject.getInteger("provinceCode"));
+                        province.setPid(0);
+                        province.setType(jsonObject.getInteger("areaType"));
+                        province.setOperatorId(data.getId());
                         city.setPid(province.getId());
-                        city.setType(jsonObject.getInteger("areaType"));
-                        city.setOperatorId(data.getId());
-                        operatorCityService.save(city);
-                    }
-                }else{
-                    // 市
-                    if (!jsonObject.getString("city").equals("")){
-                        city.setName(jsonObject.getString("city"));
-                        city.setCode(jsonObject.getInteger("cityCode"));
-                        city.setPid(one1.getId());
-                        city.setType(jsonObject.getInteger("areaType"));
-                        city.setOperatorId(data.getId());
-                        operatorCityService.save(city);
+                        operatorCityService.save(province);
+                        // 市
+                        if (!jsonObject.getString("city").equals("")){
+                            city.setName(jsonObject.getString("city"));
+                            city.setCode(jsonObject.getInteger("cityCode"));
+                            city.setPid(province.getId());
+                            city.setType(jsonObject.getInteger("areaType"));
+                            city.setOperatorId(data.getId());
+                            operatorCityService.save(city);
+                        }
+                    }else{
+                        // 市
+                        if (!jsonObject.getString("city").equals("")){
+                            city.setName(jsonObject.getString("city"));
+                            city.setCode(jsonObject.getInteger("cityCode"));
+                            city.setPid(one1.getId());
+                            city.setType(jsonObject.getInteger("areaType"));
+                            city.setOperatorId(data.getId());
+                            operatorCityService.save(city);
+                        }
                     }
                 }
             }
-        }
         }
         return ResultUtil.success("添加成功");
     }

--
Gitblit v1.7.1