scr 8 роки тому
батько
коміт
0a27966808

+ 101 - 0
src/main/java/com/uas/platform/home/core/util/HttpUtil.java

@@ -0,0 +1,101 @@
+package com.uas.platform.home.core.util;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.protocol.HTTP;
+
+import java.io.*;
+import java.net.URL;
+import java.net.URLConnection;
+
+/**
+ * created by shicr on 2017/11/24
+ **/
+public class HttpUtil {
+
+    /**
+     * 发送post请求
+     *
+     * @param postUrl
+     * @param formData
+     * @return
+     * @throws Exception
+     */
+    public static Response doPost(String postUrl, String formData,  int timeout) throws Exception {
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        HttpPost post = new HttpPost(postUrl);
+        StringEntity postingString = new StringEntity(formData, HTTP.UTF_8);
+        post.setEntity(postingString);
+        post.setHeader("Content-type", "application/json");
+        CloseableHttpResponse response = httpClient.execute(post);
+        return Response.getResponse(response);
+    }
+    public static class Response {
+        private int statusCode;
+        private String responseText;
+
+        public int getStatusCode() {
+            return statusCode;
+        }
+
+        public void setStatusCode(int statusCode) {
+            this.statusCode = statusCode;
+        }
+
+        public String getResponseText() {
+            return responseText;
+        }
+
+        public void setResponseText(String responseText) {
+            this.responseText = responseText;
+        }
+
+        public Response() {
+        }
+
+        public Response(boolean success, String content) {
+            super();
+            this.statusCode = success ? 200 : 404;
+            this.responseText = content;
+        }
+
+        public Response(HttpResponse response) throws IllegalStateException, IOException, Exception {
+            this.statusCode = response.getStatusLine().getStatusCode();
+            this.responseText = HttpUtil.read2String(response.getEntity().getContent());
+        }
+
+        public static Response getResponse(HttpResponse response) throws IllegalStateException, IOException, Exception {
+            if (response != null)
+                return new Response(response);
+            return null;
+        }
+    }
+
+    /**
+     * 将输入流转为字符串
+     *
+     * @param inStream
+     * @return
+     * @throws Exception
+     */
+    public static String read2String(InputStream inStream) throws Exception {
+        ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
+        byte[] buffer = new byte[1024];
+        int len = 0;
+        while ((len = inStream.read(buffer)) != -1) {
+            outSteam.write(buffer, 0, len);
+        }
+        try {
+            outSteam.close();
+            inStream.close();
+        } catch (Exception e) {
+
+        }
+        return new String(outSteam.toByteArray(), "UTF-8");
+    }
+
+}

+ 160 - 0
src/main/java/com/uas/platform/home/model/Loan.java

@@ -0,0 +1,160 @@
+package com.uas.platform.home.model;
+
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * 贷款申请信息表
+ */
+
+public class Loan implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ID
+     */
+    private Long id;
+
+    /**
+     * 产品名
+     */
+    private String product;
+
+    /**
+     * uuid
+     */
+    private Long userId;
+
+    /**
+     * 姓名
+     */
+    private String name;
+
+    /**
+     * 手机号
+     */
+    private Long telphone;
+
+    /**
+     * 公司名
+     */
+    private String companyName;
+
+    /**
+     * 借款金额
+     */
+    private Long amount;
+
+    /**
+     * 审核状态
+     */
+    private String status;
+
+    /**
+     * 单据创建时间
+     */
+    private Date createTime;
+
+    /**
+     * erp下载状态
+     */
+    private Integer sendStatus;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getProduct() {
+        return product;
+    }
+
+    public void setProduct(String product) {
+        this.product = product;
+    }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Long getTelphone() {
+        return telphone;
+    }
+
+    public void setTelphone(Long telphone) {
+        this.telphone = telphone;
+    }
+
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
+    public Long getAmount() {
+        return amount;
+    }
+
+    public void setAmount(Long amount) {
+        this.amount = amount;
+    }
+
+    public String getStatus() {
+
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public Date getCreateTime() {
+      return this.createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Integer getSendStatus() {
+        return sendStatus;
+    }
+
+    public void setSendStatus(Integer sendStatus) {
+        this.sendStatus = sendStatus;
+    }
+
+    @Override
+    public String toString() {
+        return "Loan{" +
+                "id=" + id +
+                ", product='" + product + '\'' +
+                ", userId=" + userId +
+                ", name='" + name + '\'' +
+                ", telphone=" + telphone +
+                ", companyName='" + companyName + '\'' +
+                ", amount=" + amount +
+                ", status='" + status + '\'' +
+                ", createTime=" + createTime +
+                '}';
+    }
+}