| | |
| | | |
| | | import cn.hutool.core.io.IoUtil; |
| | | import cn.hutool.core.util.IdcardUtil; |
| | | import com.aliyun.auth.credentials.Credential; |
| | | import com.aliyun.auth.credentials.provider.StaticCredentialProvider; |
| | | import com.aliyun.sdk.service.cloudauth20190307.AsyncClient; |
| | | import com.aliyun.sdk.service.cloudauth20190307.models.Id2MetaVerifyRequest; |
| | | import com.aliyun.sdk.service.cloudauth20190307.models.Id2MetaVerifyResponse; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.dao.business.dto.ApplyPowerDTO; |
| | |
| | | import com.doumee.dao.business.vo.ApplyPowerVO; |
| | | import com.doumee.dao.business.vo.ChangeDealTypeVO; |
| | | import com.doumee.dao.business.vo.CountCyclePriceVO; |
| | | import com.google.gson.Gson; |
| | | import darabonba.core.client.ClientOverrideConfiguration; |
| | | import io.swagger.models.auth.In; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.compress.archivers.zip.Zip64Mode; |
| | |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | import java.util.Date; |
| | | import java.util.concurrent.CompletableFuture; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import com.aliyun.auth.credentials.Credential; |
| | | import com.aliyun.auth.credentials.provider.StaticCredentialProvider; |
| | | import com.aliyun.core.http.HttpClient; |
| | | import com.aliyun.core.http.HttpMethod; |
| | | import com.aliyun.core.http.ProxyOptions; |
| | | import com.aliyun.httpcomponent.httpclient.ApacheAsyncHttpClientBuilder; |
| | | import com.aliyun.sdk.service.cloudauth20190307.models.*; |
| | | import com.aliyun.sdk.service.cloudauth20190307.*; |
| | | import com.google.gson.Gson; |
| | | import darabonba.core.RequestConfiguration; |
| | | import darabonba.core.client.ClientOverrideConfiguration; |
| | | import darabonba.core.utils.CommonUtil; |
| | | import darabonba.core.TeaPair; |
| | | |
| | | //import javax.net.ssl.KeyManager; |
| | | //import javax.net.ssl.X509TrustManager; |
| | | import java.net.InetSocketAddress; |
| | | import java.time.Duration; |
| | | import java.util.*; |
| | | import java.util.concurrent.CompletableFuture; |
| | | import java.io.*; |
| | | |
| | | public class Constants { |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(BigDecimal.valueOf(3.45678).setScale(2,BigDecimal.ROUND_HALF_UP)); |
| | | System.out.println(BigDecimal.valueOf(3.45678).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | // System.out.println(IdcardUtil.isValidCard("340621199310134818")); |
| | | // System.out.println(IdcardUtil.isValidCard("341621199310134818")); |
| | | |
| | | // System.out.println("{\"companyName\":\"应宝科技\",\"endtime\":\"2024-03-01 17:19:00\",\"erpId\":\"4D40185D5BC74A13821BE46EAF8B4179\",\"erpWithVisitDTOList\":[],\"faceImg\":\"20240304/1709518170325_742.jpg\",\"idcardNo\":\"342501199609300535\",\"idcardType\":0,\"name\":\"黄晋\",\"phone\":\"17756328697\",\"reason\":\"探险\",\"receptMemberId\":\"E7E514BD7DE3F27CE0530B630A0AEAE0\",\"starttime\":\"2024-03-01 13:18:00\"}"); |
| | | } |
| | | /** |
| | | * 用户类型 0系统用户 1企业用户 2服务机构管理员 3服务机构子账号 4综合服务单位管理员 5综合服务单位子账号 6专家 7县区用户 8市局用户 |
| | | */ |
| | |
| | | return applyPowerVO; |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | // System.out.println(BigDecimal.valueOf(3.45678).setScale(2,BigDecimal.ROUND_HALF_UP)); |
| | | // System.out.println(BigDecimal.valueOf(3.45678).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | // System.out.println(IdcardUtil.isValidCard("340621199310134818")); |
| | | // System.out.println(IdcardUtil.isValidCard("341621199310134818")); |
| | | |
| | | // System.out.println("{\"companyName\":\"应宝科技\",\"endtime\":\"2024-03-01 17:19:00\",\"erpId\":\"4D40185D5BC74A13821BE46EAF8B4179\",\"erpWithVisitDTOList\":[],\"faceImg\":\"20240304/1709518170325_742.jpg\",\"idcardNo\":\"342501199609300535\",\"idcardType\":0,\"name\":\"黄晋\",\"phone\":\"17756328697\",\"reason\":\"探险\",\"receptMemberId\":\"E7E514BD7DE3F27CE0530B630A0AEAE0\",\"starttime\":\"2024-03-01 13:18:00\"}"); |
| | | |
| | | // Constants constants = new Constants(); |
| | | // constants.test("LTAI5tRBTeQKoeUs41yVdW4F","rYHEOw2l7AooAOz88JSZ2aSQxfQQTS","340621199310134818","任康"); |
| | | |
| | | |
| | | |
| | | StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder() |
| | | // Please ensure that the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set. |
| | | .accessKeyId("LTAI5tKzCBb4CU1bwUfSoakP") |
| | | .accessKeySecret("7HNswKVfXJkSmiQDTT5wL3KjH1oS16") |
| | | //.securityToken(System.getenv("ALIBABA_CLOUD_SECURITY_TOKEN")) // use STS token |
| | | .build()); |
| | | |
| | | // Configure the Client |
| | | AsyncClient client = AsyncClient.builder() |
| | | .region("cn-hangzhou") // Region ID |
| | | //.httpClient(httpClient) // Use the configured HttpClient, otherwise use the default HttpClient (Apache HttpClient) |
| | | .credentialsProvider(provider) |
| | | //.serviceConfiguration(Configuration.create()) // Service-level configuration |
| | | // Client-level configuration rewrite, can set Endpoint, Http request parameters, etc. |
| | | .overrideConfiguration( |
| | | ClientOverrideConfiguration.create() |
| | | // Endpoint 请参考 https://api.aliyun.com/product/Cloudauth |
| | | .setEndpointOverride("cloudauth.aliyuncs.com") |
| | | //.setConnectTimeout(Duration.ofSeconds(30)) |
| | | ) |
| | | .build(); |
| | | |
| | | // Parameter settings for API request |
| | | Id2MetaVerifyRequest id2MetaVerifyRequest = Id2MetaVerifyRequest.builder() |
| | | .identifyNum("340621199310134818") |
| | | .userName("任康") |
| | | .paramType("normal") |
| | | // Request-level configuration rewrite, can set Http request parameters, etc. |
| | | // .requestConfiguration(RequestConfiguration.create().setHttpHeaders(new HttpHeaders())) |
| | | .build(); |
| | | |
| | | // Asynchronously get the return value of the API request |
| | | CompletableFuture<Id2MetaVerifyResponse> response = client.id2MetaVerify(id2MetaVerifyRequest); |
| | | // Synchronously get the return value of the API request |
| | | Id2MetaVerifyResponse resp = response.get(); |
| | | System.out.println(new Gson().toJson(resp)); |
| | | // Asynchronous processing of return values |
| | | /*response.thenAccept(resp -> { |
| | | System.out.println(new Gson().toJson(resp)); |
| | | }).exceptionally(throwable -> { // Handling exceptions |
| | | System.out.println(throwable.getMessage()); |
| | | return null; |
| | | });*/ |
| | | |
| | | // Finally, close the client |
| | | client.close(); |
| | | } |
| | | |
| | | public void test(String accessKeyId,String accessKeySecret,String identifyNum,String name) throws Exception{ |
| | | |
| | | // HttpClient Configuration |
| | | /*HttpClient httpClient = new ApacheAsyncHttpClientBuilder() |
| | | .connectionTimeout(Duration.ofSeconds(10)) // Set the connection timeout time, the default is 10 seconds |
| | | .responseTimeout(Duration.ofSeconds(10)) // Set the response timeout time, the default is 20 seconds |
| | | .maxConnections(128) // Set the connection pool size |
| | | .maxIdleTimeOut(Duration.ofSeconds(50)) // Set the connection pool timeout, the default is 30 seconds |
| | | // Configure the proxy |
| | | .proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("<your-proxy-hostname>", 9001)) |
| | | .setCredentials("<your-proxy-username>", "<your-proxy-password>")) |
| | | // If it is an https connection, you need to configure the certificate, or ignore the certificate(.ignoreSSL(true)) |
| | | .x509TrustManagers(new X509TrustManager[]{}) |
| | | .keyManagers(new KeyManager[]{}) |
| | | .ignoreSSL(false) |
| | | .build();*/ |
| | | |
| | | // Configure Credentials authentication information, including ak, secret, token |
| | | StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder() |
| | | // Please ensure that the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set. |
| | | .accessKeyId(System.getenv(accessKeyId)) |
| | | .accessKeySecret(System.getenv(accessKeySecret)) |
| | | //.securityToken(System.getenv("ALIBABA_CLOUD_SECURITY_TOKEN")) // use STS token |
| | | .build()); |
| | | |
| | | // Configure the Client |
| | | AsyncClient client = AsyncClient.builder() |
| | | .region("cn-hangzhou") // Region ID |
| | | //.httpClient(httpClient) // Use the configured HttpClient, otherwise use the default HttpClient (Apache HttpClient) |
| | | .credentialsProvider(provider) |
| | | //.serviceConfiguration(Configuration.create()) // Service-level configuration |
| | | // Client-level configuration rewrite, can set Endpoint, Http request parameters, etc. |
| | | .overrideConfiguration( |
| | | ClientOverrideConfiguration.create() |
| | | // Endpoint 请参考 https://api.aliyun.com/product/Cloudauth |
| | | .setEndpointOverride("cloudauth.aliyuncs.com") |
| | | //.setConnectTimeout(Duration.ofSeconds(30)) |
| | | ) |
| | | .build(); |
| | | |
| | | // Parameter settings for API request |
| | | Id2MetaVerifyRequest id2MetaVerifyRequest = Id2MetaVerifyRequest.builder() |
| | | .identifyNum(identifyNum) |
| | | .userName(name) |
| | | .paramType("normal") |
| | | // Request-level configuration rewrite, can set Http request parameters, etc. |
| | | // .requestConfiguration(RequestConfiguration.create().setHttpHeaders(new HttpHeaders())) |
| | | .build(); |
| | | |
| | | // Asynchronously get the return value of the API request |
| | | CompletableFuture<Id2MetaVerifyResponse> response = client.id2MetaVerify(id2MetaVerifyRequest); |
| | | // Synchronously get the return value of the API request |
| | | Id2MetaVerifyResponse resp = response.get(); |
| | | System.out.println(new Gson().toJson(resp)); |
| | | // Asynchronous processing of return values |
| | | /*response.thenAccept(resp -> { |
| | | System.out.println(new Gson().toJson(resp)); |
| | | }).exceptionally(throwable -> { // Handling exceptions |
| | | System.out.println(throwable.getMessage()); |
| | | return null; |
| | | });*/ |
| | | |
| | | // Finally, close the client |
| | | client.close(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |