ids) {
+ boolean delState = service.removeByIds(ids);
+ return delState ? R.ok() : R.error("删除失败");
+ }
+}
+
diff --git a/users/src/main/java/com/huoran/users/entity/UserAuthenticationInformation.java b/users/src/main/java/com/huoran/users/entity/UserAuthenticationInformation.java
new file mode 100644
index 0000000..41af46b
--- /dev/null
+++ b/users/src/main/java/com/huoran/users/entity/UserAuthenticationInformation.java
@@ -0,0 +1,87 @@
+package com.huoran.users.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ *
+ * 用户实名认证信息记录
+ *
+ *
+ * @author chen
+ * @since 2023-12-14
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("hr_user_authentication_information")
+@ApiModel(value="UserAuthenticationInformation对象", description="用户实名认证信息记录")
+public class UserAuthenticationInformation implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "主键")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ @ApiModelProperty(value = "账号id")
+ private Integer accountId;
+
+ @ApiModelProperty(value = "姓名")
+ private String realName;
+
+ @ApiModelProperty(value = "身份证号码")
+ private String idCardNo;
+
+ @ApiModelProperty(value = "生日")
+ private Date birthday;
+
+ @ApiModelProperty(value = "年龄")
+ private Integer age;
+
+ @ApiModelProperty(value = "性别")
+ private String sex;
+
+ @ApiModelProperty(value = "省")
+ private String province;
+
+ @ApiModelProperty(value = "市")
+ private String city;
+
+ @ApiModelProperty(value = "县")
+ private String county;
+
+ @ApiModelProperty(value = "地址信息")
+ private String address;
+
+ @ApiModelProperty(value = "民族")
+ private String nationality;
+
+ @ApiModelProperty(value = "有效期起始时间")
+ private Date startDate;
+
+ @ApiModelProperty(value = "有效期结束时间")
+ private Date endDate;
+
+ @ApiModelProperty(value = "签发机关")
+ private String issue;
+
+ @ApiModelProperty(value = "身份证正面图片地址")
+ private String frontOfIdCard;
+
+ @ApiModelProperty(value = "身份证反面图片地址")
+ private String reverseOfIdCard;
+
+ @ApiModelProperty(value = "实名认证的时间")
+ private Date realNameAuthenticationTime;
+
+
+}
diff --git a/users/src/main/java/com/huoran/users/entity/req/IdCardOCRReq.java b/users/src/main/java/com/huoran/users/entity/req/IdCardOCRReq.java
new file mode 100644
index 0000000..ddecdf8
--- /dev/null
+++ b/users/src/main/java/com/huoran/users/entity/req/IdCardOCRReq.java
@@ -0,0 +1,17 @@
+package com.huoran.users.entity.req;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "身份证上传请求参数")
+public class IdCardOCRReq {
+ @ApiModelProperty(value = "身份证正面")
+ private String theFrontOfIDCard;
+
+ @ApiModelProperty(value = "身份证反面")
+ private String reverseOfIDCard;
+
+
+}
diff --git a/users/src/main/java/com/huoran/users/entity/res/IdCardOCRResp.java b/users/src/main/java/com/huoran/users/entity/res/IdCardOCRResp.java
new file mode 100644
index 0000000..a9f06a6
--- /dev/null
+++ b/users/src/main/java/com/huoran/users/entity/res/IdCardOCRResp.java
@@ -0,0 +1,70 @@
+package com.huoran.users.entity.res;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "身份证OCR文件识别")
+public class IdCardOCRResp {
+ @ApiModelProperty(value = "地址信息")
+ private String address;
+
+ @ApiModelProperty(value = "用户姓名")
+ private String name;
+
+ @ApiModelProperty(value = "身份证号码")
+ private String num;
+
+ @ApiModelProperty(value = "民族")
+ private String nationality;
+
+ @ApiModelProperty(value = "配置信息,同输入configure")
+ private String config_str;
+
+ @ApiModelProperty(value = "返回信息")
+ private String respMessage;
+
+ @ApiModelProperty(value = "返回错误码")
+ private String respCode;
+
+ @ApiModelProperty(value = "省")
+ private String province;
+
+ @ApiModelProperty(value = "市")
+ private String city;
+
+ @ApiModelProperty(value = "县/区")
+ private String county;
+
+ @ApiModelProperty(value = "生日")
+ private String birth;
+
+ @ApiModelProperty(value = "性别")
+ private String sex;
+
+ @ApiModelProperty(value = "年龄")
+ private String age;
+
+ @ApiModelProperty(value = "是否是复印件")
+ private String is_fake;
+
+ @ApiModelProperty(value = "有效期起始时间")
+ private String start_date;
+
+ @ApiModelProperty(value = "有效期结束时间")
+ private String end_date;
+
+ @ApiModelProperty(value = "签发机关")
+ private String issue;
+
+
+ //使用@JsonIgnore注解,忽略此属性,前端不会拿到该属性
+ @JsonIgnore
+ @ApiModelProperty(value = "识别结果,true表示成功,false表示失败")
+ private Boolean success;
+
+
+
+}
diff --git a/users/src/main/java/com/huoran/users/entity/res/RealNameAuthenticationResp.java b/users/src/main/java/com/huoran/users/entity/res/RealNameAuthenticationResp.java
new file mode 100644
index 0000000..c5036d2
--- /dev/null
+++ b/users/src/main/java/com/huoran/users/entity/res/RealNameAuthenticationResp.java
@@ -0,0 +1,42 @@
+package com.huoran.users.entity.res;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "实名认证返回的信息")
+public class RealNameAuthenticationResp {
+ @ApiModelProperty(value = "用户姓名")
+ private String name;
+
+ @ApiModelProperty(value = "身份证号码")
+ private String idNo;
+
+
+
+ @ApiModelProperty(value = "返回信息")
+ private String respMessage;
+
+ @ApiModelProperty(value = "返回错误码")
+ private String respCode;
+
+ @ApiModelProperty(value = "省")
+ private String province;
+
+ @ApiModelProperty(value = "市")
+ private String city;
+
+ @ApiModelProperty(value = "县/区")
+ private String county;
+
+ @ApiModelProperty(value = "生日")
+ private String birthday;
+
+ @ApiModelProperty(value = "性别")
+ private String sex;
+
+ @ApiModelProperty(value = "年龄")
+ private String age;
+
+}
diff --git a/users/src/main/java/com/huoran/users/mapper/UserAuthenticationInformationMapper.java b/users/src/main/java/com/huoran/users/mapper/UserAuthenticationInformationMapper.java
new file mode 100644
index 0000000..a6f4402
--- /dev/null
+++ b/users/src/main/java/com/huoran/users/mapper/UserAuthenticationInformationMapper.java
@@ -0,0 +1,16 @@
+package com.huoran.users.mapper;
+
+import com.huoran.users.entity.UserAuthenticationInformation;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ *
+ * 用户实名认证信息记录 Mapper 接口
+ *
+ *
+ * @author chen
+ * @since 2023-12-14
+ */
+public interface UserAuthenticationInformationMapper extends BaseMapper {
+
+}
diff --git a/users/src/main/java/com/huoran/users/mapper/xml/UserAuthenticationInformationMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/UserAuthenticationInformationMapper.xml
new file mode 100644
index 0000000..31be555
--- /dev/null
+++ b/users/src/main/java/com/huoran/users/mapper/xml/UserAuthenticationInformationMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/users/src/main/java/com/huoran/users/service/UserAuthenticationInformationService.java b/users/src/main/java/com/huoran/users/service/UserAuthenticationInformationService.java
new file mode 100644
index 0000000..b975fdc
--- /dev/null
+++ b/users/src/main/java/com/huoran/users/service/UserAuthenticationInformationService.java
@@ -0,0 +1,16 @@
+package com.huoran.users.service;
+
+import com.huoran.users.entity.UserAuthenticationInformation;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 用户实名认证信息记录 服务类
+ *
+ *
+ * @author chen
+ * @since 2023-12-14
+ */
+public interface UserAuthenticationInformationService extends IService {
+
+}
diff --git a/users/src/main/java/com/huoran/users/service/impl/UserAuthenticationInformationServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/UserAuthenticationInformationServiceImpl.java
new file mode 100644
index 0000000..e3fec9d
--- /dev/null
+++ b/users/src/main/java/com/huoran/users/service/impl/UserAuthenticationInformationServiceImpl.java
@@ -0,0 +1,20 @@
+package com.huoran.users.service.impl;
+
+import com.huoran.users.entity.UserAuthenticationInformation;
+import com.huoran.users.mapper.UserAuthenticationInformationMapper;
+import com.huoran.users.service.UserAuthenticationInformationService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 用户实名认证信息记录 服务实现类
+ *
+ *
+ * @author chen
+ * @since 2023-12-14
+ */
+@Service
+public class UserAuthenticationInformationServiceImpl extends ServiceImpl implements UserAuthenticationInformationService {
+
+}
diff --git a/users/src/main/java/com/huoran/users/utils/ali/FaceRecognitionAidUtil.java b/users/src/main/java/com/huoran/users/utils/ali/FaceRecognitionAidUtil.java
new file mode 100644
index 0000000..6eaf4b9
--- /dev/null
+++ b/users/src/main/java/com/huoran/users/utils/ali/FaceRecognitionAidUtil.java
@@ -0,0 +1,148 @@
+package com.huoran.users.utils.ali;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.nacos.client.identify.Base64;
+import com.huoran.users.config.AliRealNameAuthenticationConfig;
+import okhttp3.*;
+import org.apache.http.HttpResponse;
+import org.apache.http.util.EntityUtils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+public class FaceRecognitionAidUtil {
+ public static String postData(String appCode, String url, String name, String idNo) throws IOException {
+ String result = "";
+ RequestBody formBody = new FormBody.Builder().add("name", name).add("idNo", idNo).build();
+ Request request = new Request.Builder().url(url).addHeader("Authorization", "APPCODE " + appCode).post(formBody).build();
+
+ Call call = new OkHttpClient().newCall(request);
+ Response response = null;
+ try {
+ response = call.execute();
+ } catch (IOException e) {
+ System.out.println("execute failed, message:" + e.getMessage());
+ }
+
+ assert response != null;
+ if (!response.isSuccessful()) {
+ // 状态码为403时一般是套餐包用尽,需续购;注意:续购不会改变秘钥(appCode),仅增加次数
+ // 续购链接:https://market.aliyun.com/products/57000002/cmapi025518.html
+ System.out.println("request failed----" + "返回状态码" + response.code() + ",message:" + response.message());
+ }
+ result = response.body().string(); //此处不可以使用toString()方法,该方法已过期
+
+ return result;
+ }
+
+ public static JSONObject checkIdcard(Object idcard, Object name) {
+ JSONObject result = new JSONObject();
+
+ Map querys = new HashMap<>();
+ querys.put("idCard", idcard.toString());
+ querys.put("name", name.toString());
+
+ try {
+ HttpResponse response = HttpUtils.doPost(AliRealNameAuthenticationConfig.ALI_IDCHECK_HOST, AliRealNameAuthenticationConfig.ALI_IDCHECK_PATH, "POST", AliRealNameAuthenticationConfig.buildHeaders(), querys, new HashMap<>() // No need to pass an empty map for bodys
+ );
+
+ int stat = response.getStatusLine().getStatusCode();
+ if (stat == 200) {
+ String res = EntityUtils.toString(response.getEntity());
+ result = JSON.parseObject(res);
+ } else {
+ result.put("error", "Http code: " + stat);
+ result.put("message", EntityUtils.toString(response.getEntity()));
+ }
+ } catch (Exception e) {
+ result.put("error", "实名认证检测失败");
+ result.put("message", e.getMessage());
+ // 记录错误而不仅仅打印堆栈跟踪
+ e.printStackTrace();
+ }
+
+ System.out.println(result);
+ return result;
+ }
+
+
+
+ public static String img_base64(String path) {
+ /**
+ * 对path进行判断,如果是本地文件就二进制读取并base64编码,如果是url,则返回
+ */
+ String imgBase64="";
+ if (path.startsWith("http")){
+ imgBase64 = path;
+ }else {
+ try {
+ File file = new File(path);
+ byte[] content = new byte[(int) file.length()];
+ FileInputStream finputstream = new FileInputStream(file);
+ finputstream.read(content);
+ finputstream.close();
+ imgBase64 = new String(Base64.encodeBase64(content));
+ } catch (IOException e) {
+ e.printStackTrace();
+ return imgBase64;
+ }
+ }
+
+ return imgBase64;
+ }
+
+
+
+
+ public static String IdCardOCRRecognition(String imgFile,String side){
+ String method = "POST";
+ Map headers = new HashMap();
+ //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
+ headers.put("Authorization", "APPCODE " + AliRealNameAuthenticationConfig.ALI_API_APPCODE);
+ //根据API的要求,定义相对应的Content-Type
+ headers.put("Content-Type", "application/json; charset=UTF-8");
+
+ Map querys = new HashMap();
+ // 对图像进行base64编码
+ String imgBase64 = FaceRecognitionAidUtil.img_base64(imgFile);
+
+ //configure配置
+ JSONObject configObj = new JSONObject();
+// configObj.put("side", "face");
+ configObj.put("side", side);
+
+ String config_str = configObj.toString();
+
+ // 拼装请求body的json字符串
+ JSONObject requestObj = new JSONObject();
+ requestObj.put("image", imgBase64);
+ if (configObj.size() > 0) {
+ requestObj.put("configure", config_str);
+ }
+ String bodys = requestObj.toString();
+
+ try {
+ HttpResponse response = HttpUtils.doPost(AliRealNameAuthenticationConfig.ALI_API_HOST, AliRealNameAuthenticationConfig.ALI_API_PATH, method, headers, querys, bodys);
+ int stat = response.getStatusLine().getStatusCode();
+ if (stat != 200) {
+ System.out.println("Http code: " + stat);
+ System.out.println("http header error msg: " + response.getFirstHeader("X-Ca-Error-Message"));
+ System.out.println("Http body error msg:" + EntityUtils.toString(response.getEntity()));
+ }
+
+ String res = EntityUtils.toString(response.getEntity());
+ /* JSONObject res_obj = JSON.parseObject(res);
+
+ System.out.println(res_obj.toJSONString());*/
+ return res;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+}
diff --git a/users/src/main/java/com/huoran/users/utils/ali/HttpUtils.java b/users/src/main/java/com/huoran/users/utils/ali/HttpUtils.java
new file mode 100644
index 0000000..6340df6
--- /dev/null
+++ b/users/src/main/java/com/huoran/users/utils/ali/HttpUtils.java
@@ -0,0 +1,313 @@
+package com.huoran.users.utils.ali;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicNameValuePair;
+
+@SuppressWarnings("deprecation")
+public class HttpUtils {
+
+ /**
+ * get
+ *
+ * @param host
+ * @param path
+ * @param method
+ * @param headers
+ * @param querys
+ * @return
+ * @throws Exception
+ */
+ public static HttpResponse doGet(String host, String path, String method,
+ Map headers,
+ Map querys)
+ throws Exception {
+ HttpClient httpClient = wrapClient(host);
+
+ HttpGet request = new HttpGet(buildUrl(host, path, querys));
+ for (Map.Entry e : headers.entrySet()) {
+ request.addHeader(e.getKey(), e.getValue());
+ }
+
+ return httpClient.execute(request);
+ }
+
+ /**
+ * post form
+ *
+ * @param host
+ * @param path
+ * @param method
+ * @param headers
+ * @param querys
+ * @param bodys
+ * @return
+ * @throws Exception
+ */
+ public static HttpResponse doPost(String host, String path, String method,
+ Map headers,
+ Map querys,
+ Map bodys)
+ throws Exception {
+ HttpClient httpClient = wrapClient(host);
+
+ HttpPost request = new HttpPost(buildUrl(host, path, querys));
+ for (Map.Entry e : headers.entrySet()) {
+ request.addHeader(e.getKey(), e.getValue());
+ }
+
+ if (bodys != null) {
+ List nameValuePairList = new ArrayList();
+
+ for (String key : bodys.keySet()) {
+ nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
+ }
+ UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
+ formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
+ request.setEntity(formEntity);
+ }
+
+ return httpClient.execute(request);
+ }
+
+ /**
+ * Post String
+ *
+ * @param host
+ * @param path
+ * @param method
+ * @param headers
+ * @param querys
+ * @param body
+ * @return
+ * @throws Exception
+ */
+ public static HttpResponse doPost(String host, String path, String method,
+ Map headers,
+ Map querys,
+ String body)
+ throws Exception {
+ HttpClient httpClient = wrapClient(host);
+
+ HttpPost request = new HttpPost(buildUrl(host, path, querys));
+ for (Map.Entry e : headers.entrySet()) {
+ request.addHeader(e.getKey(), e.getValue());
+ }
+
+ if (StringUtils.isNotBlank(body)) {
+ request.setEntity(new StringEntity(body, "utf-8"));
+ }
+
+ return httpClient.execute(request);
+ }
+
+ /**
+ * Post stream
+ *
+ * @param host
+ * @param path
+ * @param method
+ * @param headers
+ * @param querys
+ * @param body
+ * @return
+ * @throws Exception
+ */
+ public static HttpResponse doPost(String host, String path, String method,
+ Map headers,
+ Map querys,
+ byte[] body)
+ throws Exception {
+ HttpClient httpClient = wrapClient(host);
+
+ HttpPost request = new HttpPost(buildUrl(host, path, querys));
+ for (Map.Entry e : headers.entrySet()) {
+ request.addHeader(e.getKey(), e.getValue());
+ }
+
+ if (body != null) {
+ request.setEntity(new ByteArrayEntity(body));
+ }
+
+ return httpClient.execute(request);
+ }
+
+ /**
+ * Put String
+ * @param host
+ * @param path
+ * @param method
+ * @param headers
+ * @param querys
+ * @param body
+ * @return
+ * @throws Exception
+ */
+ public static HttpResponse doPut(String host, String path, String method,
+ Map headers,
+ Map querys,
+ String body)
+ throws Exception {
+ HttpClient httpClient = wrapClient(host);
+
+ HttpPut request = new HttpPut(buildUrl(host, path, querys));
+ for (Map.Entry e : headers.entrySet()) {
+ request.addHeader(e.getKey(), e.getValue());
+ }
+
+ if (StringUtils.isNotBlank(body)) {
+ request.setEntity(new StringEntity(body, "utf-8"));
+ }
+
+ return httpClient.execute(request);
+ }
+
+ /**
+ * Put stream
+ * @param host
+ * @param path
+ * @param method
+ * @param headers
+ * @param querys
+ * @param body
+ * @return
+ * @throws Exception
+ */
+ public static HttpResponse doPut(String host, String path, String method,
+ Map headers,
+ Map querys,
+ byte[] body)
+ throws Exception {
+ HttpClient httpClient = wrapClient(host);
+
+ HttpPut request = new HttpPut(buildUrl(host, path, querys));
+ for (Map.Entry e : headers.entrySet()) {
+ request.addHeader(e.getKey(), e.getValue());
+ }
+
+ if (body != null) {
+ request.setEntity(new ByteArrayEntity(body));
+ }
+
+ return httpClient.execute(request);
+ }
+
+ /**
+ * Delete
+ *
+ * @param host
+ * @param path
+ * @param method
+ * @param headers
+ * @param querys
+ * @return
+ * @throws Exception
+ */
+ public static HttpResponse doDelete(String host, String path, String method,
+ Map headers,
+ Map querys)
+ throws Exception {
+ HttpClient httpClient = wrapClient(host);
+
+ HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
+ for (Map.Entry e : headers.entrySet()) {
+ request.addHeader(e.getKey(), e.getValue());
+ }
+
+ return httpClient.execute(request);
+ }
+
+ private static String buildUrl(String host, String path, Map querys) throws UnsupportedEncodingException {
+ StringBuilder sbUrl = new StringBuilder();
+ sbUrl.append(host);
+ if (!StringUtils.isBlank(path)) {
+ sbUrl.append(path);
+ }
+ if (null != querys) {
+ StringBuilder sbQuery = new StringBuilder();
+ for (Map.Entry query : querys.entrySet()) {
+ if (0 < sbQuery.length()) {
+ sbQuery.append("&");
+ }
+ if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
+ sbQuery.append(query.getValue());
+ }
+ if (!StringUtils.isBlank(query.getKey())) {
+ sbQuery.append(query.getKey());
+ if (!StringUtils.isBlank(query.getValue())) {
+ sbQuery.append("=");
+ sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
+ }
+ }
+ }
+ if (0 < sbQuery.length()) {
+ sbUrl.append("?").append(sbQuery);
+ }
+ }
+
+ return sbUrl.toString();
+ }
+
+ private static HttpClient wrapClient(String host) {
+ HttpClient httpClient = new DefaultHttpClient();
+ if (host.startsWith("https://")) {
+ sslClient(httpClient);
+ }
+
+ return httpClient;
+ }
+
+ private static void sslClient(HttpClient httpClient) {
+ try {
+ SSLContext ctx = SSLContext.getInstance("TLS");
+ X509TrustManager tm = new X509TrustManager() {
+ public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+ public void checkClientTrusted(X509Certificate[] xcs, String str) {
+
+ }
+ public void checkServerTrusted(X509Certificate[] xcs, String str) {
+
+ }
+ };
+ ctx.init(null, new TrustManager[] { tm }, null);
+ SSLSocketFactory ssf = new SSLSocketFactory(ctx);
+ ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+ ClientConnectionManager ccm = httpClient.getConnectionManager();
+ SchemeRegistry registry = ccm.getSchemeRegistry();
+ registry.register(new Scheme("https", 443, ssf));
+ } catch (KeyManagementException ex) {
+ throw new RuntimeException(ex);
+ } catch (NoSuchAlgorithmException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+}
diff --git a/users/src/test/java/com/huoran/users/test/CodeGenerator.java b/users/src/test/java/com/huoran/users/test/CodeGenerator.java
index 1c70f5b..ac7b74b 100644
--- a/users/src/test/java/com/huoran/users/test/CodeGenerator.java
+++ b/users/src/test/java/com/huoran/users/test/CodeGenerator.java
@@ -42,10 +42,10 @@ public class CodeGenerator {
// 3、数据源配置
DataSourceConfig dsc = new DataSourceConfig();
- dsc.setUrl("jdbc:mysql://rm-wz9y13wf7u8q8610fwo.mysql.rds.aliyuncs.com:3308/nakadai?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8");
+ dsc.setUrl("jdbc:mysql://121.37.12.51:3308/nakadai?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8");
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
- dsc.setUsername("super");
- dsc.setPassword("huoran888");
+ dsc.setUsername("root");
+ dsc.setPassword("root");
dsc.setDbType(DbType.MYSQL);
mpg.setDataSource(dsc);
@@ -62,9 +62,9 @@ public class CodeGenerator {
// 5、策略配置
StrategyConfig strategy = new StrategyConfig();
- strategy.setInclude("acl_permission","acl_role","acl_role_permission","acl_user_role");
+ strategy.setInclude("hr_user_authentication_information");
strategy.setNaming(NamingStrategy.underline_to_camel);//数据库表映射到实体的命名策略
- strategy.setTablePrefix("acl_"); //生成实体时去掉表前缀
+ strategy.setTablePrefix("hr_"); //生成实体时去掉表前缀
strategy.setColumnNaming(NamingStrategy.underline_to_camel);//数据库表字段映射到实体的命名策略
strategy.setEntityLombokModel(true); // lombok 模型 @Accessors(chain = true) setter链式操作