| | |
| | | import com.alibaba.fastjson.JSON; |
| | | 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.response.AlipayMerchantIndirectAuthorderCreateResponse; |
| | | import com.alipay.api.response.AlipayMerchantIndirectAuthorderQuerystatusResponse; |
| | | import com.alipay.api.response.AntMerchantExpandIndirectImageUploadResponse; |
| | | 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.CityManagerClient; |
| | | import com.dsh.course.feignClient.account.CoachClient; |
| | | import com.dsh.course.feignClient.account.CoachTypeClient; |
| | | import com.dsh.course.feignClient.account.model.CityManager; |
| | | |
| | | import com.dsh.course.feignClient.account.model.Coach; |
| | | import com.dsh.course.feignClient.account.model.CoachSerchVO; |
| | | import com.dsh.course.feignClient.account.model.CoachType; |
| | | import com.dsh.guns.config.UserExt; |
| | | 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.model.*; |
| | | import com.dsh.guns.modular.system.service.*; |
| | | import com.dsh.guns.modular.system.service.impl.TOperatorUserServiceImpl; |
| | | |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | import io.swagger.models.auth.In; |
| | | import org.apache.catalina.valves.RemoteIpValve; |
| | | |
| | | 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.web.bind.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private IUserService userService; |
| | | @Autowired |
| | | private ICityService cityService; |
| | | @Autowired |
| | | private IOperatorAuthService operatorAuthService; |
| | | @Autowired |
| | | private IStoreService storeService; |
| | | |
| | | |
| | | /** |
| | | * 根据运营商id查询所有门店 |
| | | */ |
| | | @RequestMapping("/getStores") |
| | | @ResponseBody |
| | | public List<TStore> getStores(Integer id) |
| | | { |
| | | return storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId",id) |
| | | .ne("state",3)); |
| | | } |
| | | |
| | | /** |
| | | * 跳转运营商管理首页 |
| | | */ |
| | |
| | | */ |
| | | @RequestMapping("/proportionAuth/{id}") |
| | | public String proportionAuth(Model model,@PathVariable("id") Integer id) { |
| | | model.addAttribute("operatorId",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); |
| | | // 0不显示二维码 |
| | | model.addAttribute("type",0); |
| | | |
| | | }else{ |
| | | if (info.getOrderStatus().equals("AUDIT_PASS")){ |
| | | // 通过才展示二维码 |
| | | 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(value = "/auth") |
| | | @ResponseBody |
| | | public Object auth(Integer alipayType,Integer wechatType,String alipayNum,String wechatNum,Integer operatorId ) { |
| | | TOperator id = operatorService.getOne(new QueryWrapper<TOperator>().eq("id", operatorId)); |
| | | OperatorUser operatorUser = new OperatorUser(); |
| | | operatorUser.setUserId(id.getUserId()); |
| | | operatorUser.setAlipay("支付宝"); |
| | | operatorUser.setWechat("微信"); |
| | | operatorUser.setWechatType(wechatType); |
| | | operatorUser.setAlipayType(alipayType); |
| | | operatorUser.setAlipayNum(alipayNum); |
| | | operatorUser.setWechatNum(wechatNum); |
| | | operatorUser.setOperatorId(operatorId); |
| | | operatorUserService.save(operatorUser); |
| | | // 修改运营商状态为 已认证 |
| | | id.setStatus(2); |
| | | operatorService.updateById(id); |
| | | 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) { |
| | | UUID uuid = UUID.randomUUID(); |
| | | 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()); |
| | | } |
| | | }else{ |
| | | if(businessPicture==null || businessPicture.equals("")){ |
| | | // 未上传营业执照 |
| | | return 5001; |
| | | } |
| | | if(legalFront==null || legalFront.equals("")){ |
| | | // 未上传法人身份证正面照 |
| | | return 5002; |
| | | } |
| | | if(legalBack==null || legalBack.equals("")){ |
| | | // 未上传法人身份证背面照 |
| | | return 5003; |
| | | } |
| | | if (businessPicture!=null && businessPicture.equals("ENTERPRISE")){ |
| | | if(beneficiaryFront==null || beneficiaryFront.equals("")){ |
| | | // 未上传受益人身份证正面照 |
| | | return 5004; |
| | | } |
| | | if(beneficiaryBack==null || beneficiaryBack.equals("")){ |
| | | // 未上传受益人身份证背面照 |
| | | return 5005; |
| | | } |
| | | } |
| | | } |
| | | String numericUUID = uuid.toString().replaceAll("-", ""); |
| | | 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.setLegalPerson(legalPerson); |
| | | operatorAuth.setLeagleNumber(legalNumber); |
| | | operatorAuth.setLegalPhone(legalPhone); |
| | | operatorAuth.setLegalEmail(legalEmail); |
| | | operatorAuth.setLegalTerm(legalTerm); |
| | | operatorAuth.setLegalAddress(legalAddress); |
| | | operatorAuth.setLegalFront(legalFront); |
| | | operatorAuth.setLegalBack(legalBack); |
| | | operatorAuth.setAccountType(accountType); |
| | | operatorAuth.setBank(bank); |
| | | operatorAuth.setAccountName(accountName); |
| | | operatorAuth.setProvince(province); |
| | | operatorAuth.setProvinceCode(provinceCode); |
| | | operatorAuth.setCity(city); |
| | | operatorAuth.setCityCode(cityCode); |
| | | operatorAuth.setBankName(bankName); |
| | | operatorAuth.setBankNumber(bankNumber); |
| | | 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); |
| | | |
| | | |
| | | // 将图片上传至阿里存储 |
| | | // 营业执照 |
| | | String string = uploadImg(businessPicture).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","2021003199648333", |
| | | "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCXnbOiY2VkKb5ubpcwKqzmqbKotpKGA79yn2aQeZiTWhqmLdCKjVp64naGpnOQEC7hDZluOO1crWHVhIEp7XGIEVawA7mb/dBbzo4wQQYVtLX6iEZViYk/mA7G59S/lvsLVi+jkVGlx2Co8JhvkTRtCEFgUnVA9o2jKy5BIEwrusNuDjrn5X+3ZvfZJN/iV0yzhzXynzioZt/DIcdODOVPUrem8T/5ifJ6ydSKIumgquBKyQnFOj+LRt5qMioBVzLnod0S/6kKMoNVN3/qx/PHRaeHbrF7I67IpGNROg0D9C4d9xXbGhSqQciXitLVnNzWuCov4Ie5nT5VCg9RjXyVAgMBAAECggEAf5rU81lgnnqbseoWCQ4B02kD2wc+Lti8qsYJ1pLgnTP6td5dZB8wBbjQNOem35sfOX7uoVv8OkIa00/gPd9/7BtbsGySLP3j/UDNX0N60Y30k1VajOdiwklCNpor7swtog75rVrDMxmo+sb0JQI684E9NMpxsSlRcAEJvvpl4W7LkhfJZyCUNXPAAh9SOkFOeaXATueEQ57V5vpeKM2JRJy//1P1LS2c/quLRIPqaTYgVAvxfdAYQvvP0vPijxHtxJlDxPa8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dCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB","RSA2"); |
| | | AlipayMerchantIndirectAuthorderCreateRequest request = new AlipayMerchantIndirectAuthorderCreateRequest(); |
| | | String param = "{" + |
| | | " \"out_biz_no\":\""+uuid+"\"," + |
| | | " \"contact_person_info\":{" + |
| | | " \"contact_name\":\""+name+"\"," + |
| | | " \"contact_phone_no\":\""+phone+"\"," + |
| | | " \"contact_card_no\":\""+number+"\"," + |
| | | " \"contact_cert_type\":\"RESIDENT\"" + |
| | | " }," + |
| | | " \"auth_identity_info\":{" + |
| | | " \"identity_type\":\""+bodyType+"\"," + |
| | | " \"is_financial_org\":false," + |
| | | " \"certificate_type\":\"BUSINESS_CERT\"," + |
| | | " \"certificate_info\":{" + |
| | | " \"cert_no\":\""+businessNumber+"\"," + |
| | | " \"cert_image\":\""+string+"\"," + |
| | | " \"merchant_name\":\""+businessName+"\"," + |
| | | " \"legal_person_name\":\""+legalRepresentative+"\"," + |
| | | " \"register_address\":\""+registerAddress+"\"," + |
| | | " \"effect_time\":\""+businessTerm+"\"," + |
| | | " \"expire_time\":\""+businessEnd+"\"" + |
| | | " }," + |
| | | " }," + |
| | | " \"legal_person_info\":{" + |
| | | " \"card_type\":\"RESIDENT\"," + |
| | | " \"person_name\":\""+legalRepresentative+"\"," + |
| | | " \"card_no\":\""+legalNumber+"\"," + |
| | | " \"effect_time\":\""+legalTerm+"\"," + |
| | | " \"expire_time\":\""+legalEnd+"\"," + |
| | | " \"card_front_img\":\""+legalFront+"\"," + |
| | | " \"card_back_img\":\""+legalBack+"\"," + |
| | | " \"is_benefit_person\":"+isBeneficiary+"" + |
| | | " },"; |
| | | String bene = " \"benefit_person_info\":{" + |
| | | " \"person_name\":\""+beneficiary+"\"," + |
| | | " \"card_no\":\""+beneficiaryNumber+"\"," + |
| | | " \"card_type\":\"RESIDENT\"," + |
| | | " \"effect_time\":\""+beneficiaryTerm+"\"," + |
| | | " \"expire_time\":\""+beneficiaryEnd+"\"," + |
| | | " \"card_front_img\":\""+beneficiaryFront+"\"," + |
| | | " \"card_back_img\":\""+beneficiaryBack+"\"" + |
| | | " },"; |
| | | if (bodyType.equals("ENTERPRISE")){ |
| | | request.setBizContent(param |
| | | + bene+ |
| | | "}"); |
| | | }else{ |
| | | request.setBizContent(param |
| | | + |
| | | "}"); |
| | | } |
| | | |
| | | AlipayMerchantIndirectAuthorderCreateResponse response = null; |
| | | try { |
| | | response = alipayClient.execute(request); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if(response.isSuccess()){ |
| | | 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"); |
| | | operatorAuth.setOrderNo(order_no); |
| | | operatorAuth.setOrderStatus(order_status); |
| | | |
| | | |
| | | 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); |
| | | if (bodyType.equals("ENTERPRISE")){ |
| | | userId1.setAlipayType(2); |
| | | }else{ |
| | | userId1.setAlipayType(1); |
| | | } |
| | | // userId1.setWechatAudit(1); |
| | | operatorUserService.updateById(userId1); |
| | | operatorAuth.setQrCode(null); |
| | | operatorAuthService.saveOrUpdate(operatorAuth); |
| | | // 根据选择类型修改认证类型 |
| | | |
| | | } |
| | | } |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | public static Object uploadImg(String img){ |
| | | String privateKey = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCXnbOiY2VkKb5ubpcwKqzmqbKotpKGA79yn2aQeZiTWhqmLdCKjVp64naGpnOQEC7hDZluOO1crWHVhIEp7XGIEVawA7mb/dBbzo4wQQYVtLX6iEZViYk/mA7G59S/lvsLVi+jkVGlx2Co8JhvkTRtCEFgUnVA9o2jKy5BIEwrusNuDjrn5X+3ZvfZJN/iV0yzhzXynzioZt/DIcdODOVPUrem8T/5ifJ6ydSKIumgquBKyQnFOj+LRt5qMioBVzLnod0S/6kKMoNVN3/qx/PHRaeHbrF7I67IpGNROg0D9C4d9xXbGhSqQciXitLVnNzWuCov4Ie5nT5VCg9RjXyVAgMBAAECggEAf5rU81lgnnqbseoWCQ4B02kD2wc+Lti8qsYJ1pLgnTP6td5dZB8wBbjQNOem35sfOX7uoVv8OkIa00/gPd9/7BtbsGySLP3j/UDNX0N60Y30k1VajOdiwklCNpor7swtog75rVrDMxmo+sb0JQI684E9NMpxsSlRcAEJvvpl4W7LkhfJZyCUNXPAAh9SOkFOeaXATueEQ57V5vpeKM2JRJy//1P1LS2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LtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB"; |
| | | AlipayConfig alipayConfig = new AlipayConfig(); |
| | | alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do"); |
| | | alipayConfig.setAppId("2021003199648333"); |
| | | alipayConfig.setPrivateKey(privateKey); |
| | | alipayConfig.setFormat("json"); |
| | | alipayConfig.setAlipayPublicKey(alipayPublicKey); |
| | | alipayConfig.setCharset("UTF8"); |
| | | alipayConfig.setSignType("RSA2"); |
| | | AlipayClient alipayClient = null; |
| | | try { |
| | | alipayClient = new DefaultAlipayClient(alipayConfig); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // 这是一个1x1像素的图片流 |
| | | String imageBase64 = "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAEUlEQVR42mP4TyRgGFVIX4UAI/uOgGWVNeQAAAAASUVORK5CYII="; |
| | | // 下列FileItem中也可用直接读取本地文件的方式来获取文件 |
| | | // FileItem imageContent = new FileItem("本地文件的绝对路径"); |
| | | AntMerchantExpandIndirectImageUploadRequest request = new AntMerchantExpandIndirectImageUploadRequest(); |
| | | FileItem imageContent = new FileItem(img, Base64.getDecoder().decode(imageBase64)); |
| | | request.setImageContent(imageContent); |
| | | request.setImageType("jpg"); |
| | | AntMerchantExpandIndirectImageUploadResponse response = null; |
| | | try { |
| | | response = alipayClient.execute(request); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.out.println(response.getBody()); |
| | | if (response.isSuccess()) { |
| | | System.out.println("调用成功"); |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | } |
| | | JSONObject json = JSONObject.parseObject(response.getBody()); |
| | | String sign = json.getString("ant_merchant_expand_indirect_image_upload_response"); |
| | | JSONObject r = JSONObject.parseObject(sign); |
| | | String image_id = r.getString("image_id"); |
| | | return image_id; |
| | | } |
| | | |
| | | /** |
| | | * 分账比例提交 |
| | | */ |
| | | @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 alipayNum,String wechatProportion, |
| | | String wechatNum) { |
| | | Integer id1 = operatorService.getOne(new QueryWrapper<TOperator>().eq("id", operatorIdOne)) |
| | | .getUserId(); |
| | | OperatorUser id = operatorUserService.getOne(new QueryWrapper<OperatorUser>().eq("userId", id1)); |
| | | id.setAlipayProportion(alipayProportion); |
| | | id.setWechatProportion(wechatProportion); |
| | | id.setAlipayNum(alipayNum); |
| | | id.setWechatNum(wechatNum); |
| | | operatorUserService.updateById(id); |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | @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"; |
| | | } |
| | | /** |
| | |
| | | @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(); |
| | | } |
| | | /** |
| | |
| | | user.setName(userName); |
| | | user.setPhone(phone); |
| | | user.setObjectType(2); |
| | | String s = MD5.md5("a123456"); |
| | | user.setPassword(s); |
| | | user.setAccount(phone); |
| | | user.setRoleid("2"); |
| | | user.setObjectType(2); |
| | | user.setStatus(1); |
| | | userService.save(user); |
| | | TOperator data = new TOperator(); |
| | | data.setUserId(user.getId()); |
| | |
| | | data.setStatus(1); |
| | | data.setState(1); |
| | | operatorService.save(data); |
| | | // 添加运营商认证数据 |
| | | OperatorUser operatorUser = new OperatorUser(); |
| | | operatorUser.setUserId(user.getId()); |
| | | operatorUser.setAlipay("支付宝"); |
| | | operatorUser.setWechat("微信"); |
| | | 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); |
| | | if (SinataUtil.isNotEmpty(comArr)){ |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | return ResultUtil.success("添加成功"); |
| | | } |
| | | /** |
| | |
| | | */ |
| | | @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()); |
| | |
| | | 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("添加成功"); |
| | | } |