44323
2024-01-30 987fd6c12a7dcfb2b6ae9ee585fc182d2d865040
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/OperatorController.java
@@ -9,13 +9,16 @@
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;
@@ -23,15 +26,23 @@
import com.dsh.guns.modular.system.model.*;
import com.dsh.guns.modular.system.service.*;
import com.dsh.guns.modular.system.util.HttpRequestUtil;
import com.dsh.guns.modular.system.util.PayMoneyUtil;
import com.dsh.guns.modular.system.util.ResultUtil;
import com.github.binarywang.wxpay.service.BankService;
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;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -48,13 +59,34 @@
    @Autowired
    private TOperatorCityService operatorCityService;
    @Autowired
    private IOperatorAuthService operatorAuthService;
    @Autowired
    private IOperatorUserService operatorUserService;
    @Autowired
    private IUserService userService;
    @Autowired
    private ICityService cityService;
    @Autowired
    private IOperatorAuthService operatorAuthService;
    private PayMoneyUtil payMoneyUtil;
    @Autowired
    private IStoreService storeService;
    private String appPrivateKey = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCi5i9nW/hGLJ3A06cZxTQdviFC7THpdSihoTYGLr9q006hu0V26ecBMY/o4w5bvIX0Ok/yofmZsVcCJpAPvbXL/uqVrIjnRRxXiaeBFThlxoBUTdunvbUSDYfzlEhJr5NvUKI6H6lz2niXlQGx4qy8Hau4ccWit9kM8jwUvsBVQoFgJA+xrjMvooA7YLopQtpOD+UJr5thApTSf1xrnr1W12yolTLEH15JmNV372cqXrYUuqnY0QsaPtxeqJUGAOcGdVLllQ7easEznP8DFBvDdHATcmp2SHNQDUEWN6MCVPbMgY06NQVqAXxqjTAYSVh+6TRu6bofPmpYC3TZB003AgMBAAECggEBAJAcR2+PA3NBYUYHeFrqBRMS8uX8ZR19kjZ7IgoSLTFaQsP9opRylPSPXhrPVBKAE5leRQAHn4MCSlESwHvMfxo7KFjFTFAc6dffZZpipYQUOc9bGampwJh58/3e/pyBgVMG6J23CPf/HJQtNFSkjd/V9+ayb/9l2dUEL3bC0fAZ/dbx8HsxdLw8wn3fLlWLj68hOMqa2deCZe3JdSVsPbeWqkh56FFsMLug0Nd+Ar4TgRl9/jnhXF0JWiD0LmPUYLhboY7EfUBzN4w1iYbDi1P+3zvoOYsiVKAXox9GMhQ2VzOO2UcSTuizSza2e98mGpabl/GpKmCz+RDFjtkX6eECgYEA2MyCij65eO3aGIm3FUe93DULRBYTfX8qJQSJq2WOWA3mmQlEW6L3O2B5/lG2h+8WmN6iLEs9eHpgycGYp7vAqgrANEn16ACVcuyx0scFtrZfZ+kmHMzFfiUWxJjVYk/6YngsGVBLdw6ueM42C8TTP67X9tU5TdVGoGWuqEj4W98CgYEAwFqwprXOch5Pqk/RPbb49r0Ou03K/UbciWnWWKzUhFFNS8MdlQPoDv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";//支付宝支付公钥
    private String aliAppid = "2021004105665036";//支付宝appid
    /**
     * 根据运营商id查询所有门店
     */
    @RequestMapping("/getStores")
    @ResponseBody
    public List<TStore> getStores(Integer id)
    {
        payMoneyUtil.getMessage();
        return storeService.list(new QueryWrapper<TStore>()
                .eq("operatorId",id)
                .ne("state",3));
    }
    /**
     * 跳转运营商管理首页
     */
@@ -130,188 +162,406 @@
        page.setRecords(list);
        return super.packForBT(page);
    }
    /**
     * 跳转运营商商户去认证页面
     */
    @RequestMapping("/proportionAuth/{id}")
    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("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_proportionAuth.html";
    }
    /**
     * 跳转运营商商户去认证页面 详情页面
     */
    @RequestMapping("/proportionAuth1/{id}")
    public String proportionAuth1(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);
        model.addAttribute("data",data);
        OperatorAuthAlipay info = operatorAuthService.getOne(new QueryWrapper<OperatorAuthAlipay>()
                .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.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_proportionAuth_info.html";
    }
    /**
     * 根据所选市 获取区
     */
    @RequestMapping(value = "/getDistrict")
    @ResponseBody
    public Object onChange(String cityCode) {
        try {
            TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, cityCode));
            List<TCity> parent_id = cityService.list(new QueryWrapper<TCity>().eq("parent_id", one.getId()));
            return parent_id;
        }catch (Exception e){
            e.printStackTrace();
            return ERROR;
        }
    }
    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);
    }
    /**
     * 商户认证提交
     * 支付宝商户认证提交
     */
    @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,
                       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,
                       String accountName,String province,String provinceCode,String city,String cityCode,
                       String bankName,String bankNumber,String isBeneficiary,String beneficiary,String beneficiaryPhone,
                       String beneficiaryNumber,String beneficiaryAddress,String beneficiaryTerm,String beneficiaryFront,String beneficiaryBack,
                       String remark) {
    public Object auth(Integer operatorId,String bodyType,String businessName,String aliasName,String businessNumber,
                       String license,String name,String phone,String shopProvinceCode,String shopProvince,String shopCityCode,
                       String shopCity, String shopDistrictCode,String shopDistrict,String registerAddress,String legalPerson,
                       String leagleNumber,String legalFront,String legalBack,String accountType,String alipayAccount,
                       String bankCard,String useType,String cardType,String bankName,String bankNameTwo,
                       String accountName,String provinceCode,String province,String cityCode,String city,String zfbAccount,
                       String iqImage) {
        UUID uuid = UUID.randomUUID();
        // 通过运营商id查询
        TOperator byId = operatorService.getById(operatorId);
        Integer userId1 = byId.getUserId();
        OperatorUser userId2 = operatorUserService.getOne(new QueryWrapper<OperatorUser>()
                .eq("userId", userId1));
        OperatorAuthAlipay data = operatorAuthService.getOne(new QueryWrapper<OperatorAuthAlipay>().eq("operatorId", operatorId));
    // 调用支付宝接口 通过银行卡号获取银行信息
        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);
//            group = matcher.group();
//            if (matcher.find()) {
//                System.out.println("银行名称简写为:" + matcher.group());
//            } else {
//                System.out.println("无法获取到银行名称简写!");
//                return 5007;
//            }
//        }
        OperatorAuthAlipay operatorAuth = new OperatorAuthAlipay();
        if (data!=null){
            operatorAuth.setId(data.getId());
            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(iqImage==null || iqImage.equals("")){
                iqImage = data.getIqImage();
                operatorAuth.setIqImage(data.getIqImage());
            }
            if(license==null || license.equals("")){
                license = data.getCertImage();
                operatorAuth.setCertImage(data.getCertImage());
            }
        }else{
            operatorAuth.setLegalFront(legalFront);
            operatorAuth.setLegalBack(legalBack);
            operatorAuth.setIqImage(iqImage);
            operatorAuth.setCertImage(license);
            if(license==null || license.equals("")){
                // 未上传营业执照
                return 5001;
            }
            if(legalFront==null || legalFront.equals("")){
                // 未上传法人身份证正面照
                return 5002;
            }
            if(legalBack==null || legalBack.equals("")){
                // 未上传法人身份证背面照
                return 5003;
            }
        }
        String numericUUID = uuid.toString().replaceAll("-", "");
        OperatorAuth operatorAuth = new OperatorAuth();
        operatorAuth.setOutBizNo(numericUUID);
        operatorAuth.setOperatorId(operatorId);
        operatorAuth.setRegisterAddress(registerAddress);
        operatorAuth.setAliasName(aliasName);
        operatorAuth.setBodyType(bodyType);
        operatorAuth.setName(name);
        operatorAuth.setPhone(phone);
        operatorAuth.setNumber(number);
        operatorAuth.setBusinessEnd(businessEnd);
        operatorAuth.setLegalEnd(legalEnd);
        operatorAuth.setBeneficiaryEnd(beneficiaryEnd);
        operatorAuth.setOperatorId(operatorId);
        operatorAuth.setBodyType(bodyType);
        operatorAuth.setType(type);
        operatorAuth.setBusinessName(businessName);
        operatorAuth.setBusinessNumber(businessNumber);
        operatorAuth.setLegalRepresentative(legalRepresentative);
        operatorAuth.setRegisterAddress(registerAddress);
        operatorAuth.setBusinessTerm(businessTerm);
        operatorAuth.setOutBizNo(numericUUID);
        operatorAuth.setBusinessPicture(businessPicture);
        operatorAuth.setCertImage(license);
        operatorAuth.setLegalPerson(legalPerson);
        operatorAuth.setLeagleNumber(legalNumber);
        operatorAuth.setLegalPhone(legalPhone);
        operatorAuth.setLegalEmail(legalEmail);
        operatorAuth.setLegalTerm(legalTerm);
        operatorAuth.setLegalAddress(legalAddress);
        operatorAuth.setLegalFront(legalFront);
        operatorAuth.setLegalBack(legalBack);
        operatorAuth.setLeagleNumber(leagleNumber);
        operatorAuth.setAccountType(accountType);
        operatorAuth.setBank(bank);
        operatorAuth.setBankName(bankName);
        operatorAuth.setAccountName(accountName);
        operatorAuth.setBankCard(bankCard);
        operatorAuth.setProvince(province);
        operatorAuth.setProvinceCode(provinceCode);
        operatorAuth.setCity(city);
        operatorAuth.setCityCode(cityCode);
        operatorAuth.setBankName(bankName);
        operatorAuth.setBankNumber(bankNumber);
        operatorAuth.setShopCity(shopCity);
        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);
        operatorAuth.setShopDistrictCode(shopDistrictCode);
        operatorAuth.setAlipayAccount(alipayAccount);
        operatorAuth.setUseType(useType);
        operatorAuth.setCardType(cardType);
        operatorAuth.setBankNameTwo(bankNameTwo);
        operatorAuth.setAuditState(0);
        operatorAuth.setIsBeneficiary(isBeneficiary);
        operatorAuth.setBeneficiary(beneficiary);
        operatorAuth.setBeneficiaryNumber(beneficiaryNumber);
        operatorAuth.setBeneficiaryAddress(beneficiaryAddress);
        operatorAuth.setBeneficiaryTerm(beneficiaryTerm);
        operatorAuth.setBeneficiaryFront(beneficiaryFront);
        operatorAuth.setBeneficiaryBack(beneficiaryBack);
        operatorAuth.setRefuseReason("");
        operatorAuth.setRemark(remark);
        operatorAuth.setZfbAccount(zfbAccount);
        // 将图片上传至阿里存储
        // 营业执照
        String string = uploadImg(businessPicture).toString();
        String string = uploadImg(license).toString();
        // 法人身份证正面照
         legalFront = uploadImg(legalFront).toString();
        legalFront = uploadImg(legalFront).toString();
        // 法人身份证背面照
         legalBack = uploadImg(legalBack).toString();
        if (bodyType.equals("ENTERPRISE")){
            // 受益人身份证正面照
            beneficiaryFront=uploadImg(beneficiaryFront).toString();
            // 受益人身份证背面照
            beneficiaryBack=uploadImg(beneficiaryBack).toString();
        }
        //第二步:提交申请单
        AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","2021004123692417",
                "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDe188UHA8lR8CjG6KeKIYjYw6UfpJOl7nyklpiZKfbJ1q70D+LEdEZbWrzZ2eSwqeD+7B/ZV8Hyum9vrU6FPbgc6q/vy73ji0o1AhQP0GPPtcnNaAP9IppwchTSEjvODKMHSotB64LSBuFLgtAGSAJ6nHPXlEcyV5Y4Dev/E1JD3b9N2uTXilW5zZ2o1IxwXBIxuU0Tw7wHXUjcaXbpGuQUGIq54fzsbqP4TjSVoa8S41FhbtP9n61NulUtGFRfyHxpo/kj4cx3o6P4s+PBo/T2DlaMkpI6cRx0rfjL1ZkXrDJLYcCokUKxiJ/trrGjdYFUz6r2TGe1kAnjehkW+TTAgMBAAECggEAWMKtAN2MStUhrdY8F7Mcesvh6tPfgt58elpBFh/xnCE4ysZQCRy3pOEoUHtHjfVqs+90hcni6D+yipmDpfbjvtNTl7yXAJPo+PI7vXr0qhHlsQBzGOfWmflNyZ5pLp+7woN7YSRF9shp7cpBQO7BDDIN0wNGW6j5o3zrsXVVc1uu5ndD0kxV6XM3P43EY8mMdRXT9UmF0WTomLQ7JxhlY23fgYmS7USZUKkN9BkKAbwnxdskDnFT94infup4kbWoPr5DF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u+36d1nDVOWW4CmgsOPyj1GOFoTcJOR/BqyIriwyLxpuMS8qgOqGJZXi+W4Nw2AJL6iMVwY2eI8F1G10gACK2I9TNJRzHh3tMTA6ItysbGoekRDtn6Xrkh5V6cyHQjLw0Q6MJK/68XT6/LWzarDEEYrSnIevOydMY32ptAgm5fp/h08M2khCmI6CuMWKmc87dPpd2krGVTALqprAQvB74AIqO+5DE0fN4LoitOYXAtWDCEF4kHN0hQUygIEGCwtMgEVzkf92VLlCX35YtDhWd1yQIDAQAB","RSA2");
        AlipayMerchantIndirectAuthorderCreateRequest request = new AlipayMerchantIndirectAuthorderCreateRequest();
        legalBack = uploadImg(legalBack).toString();
        operatorAuthService.saveOrUpdate(operatorAuth);
        AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",
                aliAppid,
                appPrivateKey,
                "json","GBK",
                alipay_public_key,
                "RSA2");
        AntMerchantExpandIndirectZftCreateRequest request = new AntMerchantExpandIndirectZftCreateRequest();
        String param = "{" +
                "  \"out_biz_no\":\""+uuid+"\"," +
                "  \"contact_person_info\":{" +
                "    \"contact_name\":\""+name+"\"," +
                "    \"contact_phone_no\":\""+phone+"\"," +
                "    \"contact_card_no\":\""+number+"\"," +
                "    \"contact_cert_type\":\"RESIDENT\"" +
                "  }," +
                "  \"auth_identity_info\":{" +
                "    \"identity_type\":\""+bodyType+"\"," +
                "    \"is_financial_org\":false," +
                "    \"certificate_type\":\"BUSINESS_CERT\"," +
                "    \"certificate_info\":{" +
                "      \"cert_no\":\""+businessNumber+"\"," +
                "      \"cert_image\":\""+string+"\"," +
                "      \"merchant_name\":\""+businessName+"\"," +
                "      \"legal_person_name\":\""+legalRepresentative+"\"," +
                "      \"register_address\":\""+registerAddress+"\"," +
                "      \"effect_time\":\""+businessTerm+"\"," +
                "      \"expire_time\":\""+businessEnd+"\"" +
                "    }," +
                "    }," +
                "  \"legal_person_info\":{" +
                "    \"card_type\":\"RESIDENT\"," +
                "    \"person_name\":\""+legalRepresentative+"\"," +
                "    \"card_no\":\""+legalNumber+"\"," +
                "    \"effect_time\":\""+legalTerm+"\"," +
                "    \"expire_time\":\""+legalEnd+"\"," +
                "    \"card_front_img\":\""+legalFront+"\"," +
                "    \"card_back_img\":\""+legalBack+"\"," +
                "    \"is_benefit_person\":"+isBeneficiary+"" +
                "  },";
        String bene = "  \"benefit_person_info\":{" +
                "    \"person_name\":\""+beneficiary+"\"," +
                "    \"card_no\":\""+beneficiaryNumber+"\"," +
                "    \"card_type\":\"RESIDENT\"," +
                "    \"effect_time\":\""+beneficiaryTerm+"\"," +
                "    \"expire_time\":\""+beneficiaryEnd+"\"," +
                "    \"card_front_img\":\""+beneficiaryFront+"\"," +
                "    \"card_back_img\":\""+beneficiaryBack+"\"" +
                "  },";
        if (bodyType.equals("ENTERPRISE")){
                "  \"external_id\":\""+numericUUID+"\"," +
                "  \"merchant_type\":\""+bodyType+"\"," +
                "  \"name\":\""+businessName+"\"," +
                "  \"alias_name\":\""+aliasName+"\"," +
                "  \"mcc\":\"B0068\"," +
                "  \"cert_no\":\""+businessNumber+"\"," +
                "  \"cert_type\":\"201\"," +
                "  \"cert_image\":\""+string+"\"," +
                "  \"legal_name\":\""+legalPerson+"\"," +
                "  \"legal_cert_no\":\""+leagleNumber+"\"," +
                "  \"legal_cert_front_image\":\""+legalFront+"\"," +
                "  \"legal_cert_back_image\":\""+legalBack+"\"," +
                "  \"contact_infos\":[" +
                "    {" +
                "      \"name\":\""+name+"\"," +
                "      \"mobile\":\""+phone+"\"," +
                "    }" +
                "  ],";
        // todo 拼接
        String biz_cards="  \"biz_cards\":[" +
                "    {" +
                "      \"account_holder_name\":\""+accountName+"\"," +
                "      \"account_no\":\""+bankCard+"\"," +
                "      \"account_inst_province\":\""+province+"\"," +
                "      \"account_inst_city\":\""+city+"\"," +
                "      \"account_branch_name\":\""+bankNameTwo+"\"," +
                "      \"usage_type\":\""+useType+"\"," +
                "      \"account_type\":\""+cardType+"\"," +
                "      \"account_inst_name\":\""+bankName+"\"," +
                "      \"account_inst_id\":\""+group+"\"," +
                "    }" +
                "  ]," ;
        // 结算类型 支付宝账户 / 银行卡
        String type ;
        // 结算类型为支付宝 填写支付宝账号 结算类型为银行卡填写银行卡号
        String account;
        if (accountType.equals("bankCard")){
            type = accountType;
            account = bankCard;
        }else{
            type =  accountType;
            account = alipayAccount;
        }
        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+"\"" +
                "  }" +
                "}";
        if (accountType.equals("bankCard")){
            request.setBizContent(param
                    + bene+
                    "}");
                    + biz_cards+res);
        }else{
            request.setBizContent(param
                    +
                    "}");
                    +res);
        }
        AlipayMerchantIndirectAuthorderCreateResponse response = null;
        AntMerchantExpandIndirectZftCreateResponse response = null;
        try {
            response = alipayClient.execute(request);
        } catch (AlipayApiException e) {
            e.printStackTrace();
        }
        if(response.isSuccess()){
            System.out.println("上传认证单");
            System.out.println("调用成功");
            JSONObject json = JSONObject.parseObject(response.getBody());
            JSONObject json1 = json.getJSONObject("alipay_merchant_indirect_authorder_create_response");
            String order_no = json1.getString("order_no");
            String order_status = json1.getString("order_status");
//            // 申请单号
//            String orderNo = r.getString("order_no");
            /**
             * 状态 审核中(AUDITING)、待联系人确认(CONTACT_CONFIRM),
             * 待法人确认(LEGAL_CONFIRM)、审核通过(AUDIT_PASS)、
             * 审核失败(AUDIT_REJECT)、已冻结(AUDIT_FREEZE)、
             * 已撤回(CANCELED)、联系人处理中(CONTACT_PROCESSING)
             */
//            String orderStatus = r.getString("order_status");
            JSONObject json1 = json.getJSONObject("ant_merchant_expand_indirect_zft_create_response");
            String order_no = json1.getString("order_id");
            System.err.println("订单号"+order_no);
            operatorAuth.setOrderNo(order_no);
            operatorAuth.setOrderStatus(order_status);
            operatorAuthService.save(operatorAuth);
            operatorAuth.setRefuseReason("");
            operatorAuthService.saveOrUpdate(operatorAuth);
            Integer userId = operatorService.getById(operatorId).getUserId();
            OperatorUser user = operatorUserService.getOne(new QueryWrapper<OperatorUser>().eq("userId", userId));
            user.setAlipayAudit(1);
            // 01是企业
            if (bodyType.equals("01")){
                user.setAlipayType(2);
            }else{
                user.setAlipayType(1);
            }
            operatorUserService.saveOrUpdate(user);
        } else {
            System.out.println("调用失败");
            if (response.getCode().equals("40004")){
                String subMsg = response.getSubMsg();
                return ResultUtil.error(subMsg);
            }
        }
        return SUCCESS_TIP;
        return ResultUtil.success();
    }
    public static Object uploadImg(String img){
        String privateKey = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCSsmylIHe0j0pRQrB9p5ljryk9Qg2Z/JgIh+gtZES1TDo35YVw24aRRt7pkY7oHIZqpMRmSsWND1t63LVuNlpq532LG0iEJVJS53GzpRoHDD3iD01GmUoNjkCL36NCrbY0hTDDw7GZnYuJ8194Sss7OEoi7Mghg/XUreX4awwpWngTepCF7zs0S4YJQWyGY4JI6ooGraW23siBVY5MUI9XXLL6UKIExUfKe7zRihs8SrTHNnXtDT6EKYYo8P6M90Xuk173QsK2Xguk1FQ5Blh2ts7UvZVjP+WoQwDvrnqruve5kzDD9gwnAYUvhY66mtlxeub9nf5LLTtCliXeUZpNAgMBAAECggEAaPShSM9e9d9jM5p8PZqw4yJKZhqhMqAHgmsCUZ+gjPn52U4s198oez5ydDgBP85Q2XIDVpB+oPrw34mTgUQAEuaG6wTdMDannMscjYQ9h/dZOyjph+5ajjJNugWKgEVazF7S0e1sXtTaJhvrHVyd5UPTvwMb+Oa59q1ok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M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB";//支付宝支付公钥
        String aliAppid = "2021004105665036";//支付宝appid
        AlipayConfig alipayConfig = new AlipayConfig();
        alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do");
        alipayConfig.setAppId("2021004123692417");
        alipayConfig.setPrivateKey(privateKey);
        alipayConfig.setAppId(aliAppid);
        alipayConfig.setPrivateKey(appPrivateKey);
        alipayConfig.setFormat("json");
        alipayConfig.setAlipayPublicKey(alipayPublicKey);
        alipayConfig.setAlipayPublicKey(alipay_public_key);
        alipayConfig.setCharset("UTF8");
        alipayConfig.setSignType("RSA2");
        AlipayClient alipayClient = null;
@@ -352,8 +602,8 @@
     */
    @RequestMapping(value = "/proportion")
    @ResponseBody
    public Object auth(String alipayProportion,String wechatProportion,Integer operatorIdOne ) {
        OperatorUser id = operatorUserService.getOne(new QueryWrapper<OperatorUser>().eq("id", operatorIdOne));
    public Object auth(Integer operatorIdOne ,String alipayProportion,String wechatProportion) {
        OperatorUser id = operatorUserService.getOne(new QueryWrapper<OperatorUser>().eq("operatorId", operatorIdOne));
        id.setAlipayProportion(alipayProportion);
        id.setWechatProportion(wechatProportion);
        operatorUserService.updateById(id);
@@ -365,9 +615,11 @@
    @RequestMapping("/proportion/{id}")
    public String proportion(Model model,@PathVariable("id") Integer id) {
        OperatorUser o = operatorUserService.getOne(new QueryWrapper<OperatorUser>().eq("operatorId", id));
        model.addAttribute("operatorIdOne",o.getId());
        model.addAttribute("id",id);
        model.addAttribute("alipayProportion",o.getAlipayProportion());
        model.addAttribute("wechatProportion",o.getWechatProportion());
        model.addAttribute("alipayNum",o.getAlipayNum());
        model.addAttribute("wechatNum",o.getWechatNum());
        return PREFIX + "OperatorUser_proportion.html";
    }
    /**
@@ -403,6 +655,18 @@
    @ResponseBody
    public Object changeState(@RequestBody CoachChangeStateVO vo){
        operatorService.changeState(vo);
        List<Integer> ids = vo.getIds();
        // 将运营商账号也冻结
        List<TOperator> list = operatorService.list(new QueryWrapper<TOperator>()
                .in("id",ids));
        // 用户ids
        List<Integer> collect = list.stream().map(TOperator::getUserId).collect(Collectors.toList());
        for (Integer integer : collect) {
            User user = new User();
            user.setId(integer);
            user.setStatus(vo.getState());
            userService.updateById(user);
        }
        return ResultUtil.success();
    }
    /**
@@ -441,6 +705,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);
@@ -486,6 +755,7 @@
            }
        }
        return ResultUtil.success("添加成功");
    }
    /**
@@ -493,19 +763,19 @@
     */
    @ResponseBody
    @RequestMapping(value = "/updateOperator")
    public ResultUtil updateOperator(Integer id,String name,String userName,String phone,Integer type ,@RequestParam String comArr) {
    public ResultUtil updateOperator(Integer id,String name,String userName
            ,String phone,Integer type ,@RequestParam String comArr) {
        User one = userService.getOne(new QueryWrapper<User>().eq("name", name).eq("phone", phone));
        if (one!=null){
            return ResultUtil.error("当前管理员名称和电话已存在!");
        }
        operatorCityService.remove(new QueryWrapper<TOperatorCity>().eq("operatorId",id));
        User user = new User();
        User user = userService.getOne(new QueryWrapper<User>().eq("objectId", id).
                eq("objectType", 2));
        user.setName(userName);
        user.setAccount(phone);
        user.setPhone(phone);
        user.setObjectType(2);
        String a123456 = SecureUtil.md5("a123456");
        user.setPassword(a123456);
        userService.save(user);
        userService.updateById(user);
        TOperator data = new TOperator();
        data.setId(id);
        data.setUserId(user.getId());
@@ -515,47 +785,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("添加成功");
    }