dcs 13 ساعت پیش
والد
کامیت
b09d208529

+ 13 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/workark/model/Product.java

@@ -17,6 +17,11 @@ public class Product {
      */
     private long organizationId;
 
+    /**
+     * 组织名称
+     */
+    private String organizationName;
+
     /**
      * 状态
      */
@@ -105,6 +110,14 @@ public class Product {
         this.organizationId = organizationId;
     }
 
+    public String getOrganizationName() {
+        return organizationName;
+    }
+
+    public void setOrganizationName(String organizationName) {
+        this.organizationName = organizationName;
+    }
+
     public Integer getState() {
         return state;
     }

+ 23 - 18
virgo.api/src/main/resources/mapper/ProductMapper.xml

@@ -7,6 +7,7 @@
     <resultMap type="com.bosshand.virgo.api.workark.model.Product" id="result">
         <id column="id" property="id"/>
         <result column="organizationId" property="organizationId"/>
+        <result column="organizationName" property="organizationName"/>
         <result column="state" property="state"/>
         <result column="type" property="type"/>
         <result column="productLevelId" property="productLevelId"/>
@@ -22,33 +23,37 @@
         <result column="subtitle" property="subtitle"/>
         <result column="customerId" property="customerId"/>
     </resultMap>
+    
+    <sql id="query">
+        select a.*, b.name as organizationName from workark_product a left join mgr_organization b on a.organizationId = b.id
+    </sql>
 
     <select id="get" resultMap="result">
-        select * from workark_product where id = #{id}
+        <include refid="query"/> where a.id = #{id}
     </select>
 
     <select id="getList" resultMap="result">
-        select * from workark_product
+        <include refid="query"/>
         <where>
             <if test="organizationId != 0">
-                and organizationId = #{organizationId}
+                and a.organizationId = #{organizationId}
             </if>
             <if test="name != null">
-                and name = #{name}
+                and a.name = #{name}
             </if>
             <if test="state != null">
-                and state = #{state}
+                and a.state = #{state}
             </if>
             <if test="type != null">
-                and type = #{type}
+                and a.type = #{type}
             </if>
             <if test="productLevelId != 0">
-                and productLevelId = #{productLevelId}
+                and a.productLevelId = #{productLevelId}
             </if>
             <if test="customerId != null">
-                and customerId = #{customerId}
+                and a.customerId = #{customerId}
             </if>
-            and deleteState != 1
+            and a.deleteState != 1
         </where>
     </select>
 
@@ -78,29 +83,29 @@
     </select>
 
     <select id="getLimit" resultMap="result">
-        select * from workark_product
+        <include refid="query"/>
         <where>
             <if test="p.organizationId != 0">
-                and organizationId = #{p.organizationId}
+                and a.organizationId = #{p.organizationId}
             </if>
             <if test="p.name != null">
-                and name = #{p.name}
+                and a.name = #{p.name}
             </if>
             <if test="p.state != null">
-                and state = #{p.state}
+                and a.state = #{p.state}
             </if>
             <if test="p.type != null">
-                and type = #{p.type}
+                and a.type = #{p.type}
             </if>
             <if test="p.productLevelId != 0">
-                and productLevelId = #{p.productLevelId}
+                and a.productLevelId = #{p.productLevelId}
             </if>
             <if test="p.customerId != null">
-                and customerId = #{p.customerId}
+                and a.customerId = #{p.customerId}
             </if>
-            and deleteState != 1
+            and a.deleteState != 1
         </where>
-        order by createTime desc limit #{currIndex} , #{pageSize}
+        order by a.createTime desc limit #{currIndex} , #{pageSize}
     </select>
 
     <insert id="save" useGeneratedKeys="true" keyProperty="id">

+ 7 - 4
virgo.core/src/main/java/com/bosshand/virgo/core/controller/UserContextController.java

@@ -1,10 +1,7 @@
 package com.bosshand.virgo.core.controller;
 
 import com.alibaba.fastjson.JSONObject;
-import com.bosshand.virgo.core.model.Identity;
-import com.bosshand.virgo.core.model.MgrOrganization;
-import com.bosshand.virgo.core.model.MgrUser;
-import com.bosshand.virgo.core.model.UserContext;
+import com.bosshand.virgo.core.model.*;
 import com.bosshand.virgo.core.response.Response;
 import com.bosshand.virgo.core.service.MgrUserService;
 import com.bosshand.virgo.core.shiro.LoginUserDto;
@@ -240,4 +237,10 @@ public class UserContextController {
 		return Response.ok(jsonObject);
 	}
 
+	@ApiOperation(value = "企业三要素验证V2", notes = "企业三要素验证V2")
+	@RequestMapping(value = "/companyCheck", method = RequestMethod.POST)
+	public Response companyCheck(@RequestBody CompanyCheck companyCheck) {
+		return Response.ok(mgrUserService.companyCheck(companyCheck));
+	}
+
 }

+ 44 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/model/CompanyCheck.java

@@ -0,0 +1,44 @@
+package com.bosshand.virgo.core.model;
+
+/**
+ * 企业三要素验证V2
+ */
+public class CompanyCheck {
+
+    /**
+     * 公司名称
+     */
+    private String companyName;
+    /**
+     * 统一社会信用代码
+     */
+    private String creditNo;
+    /**
+     * 法人姓名
+     */
+    private String legalPerson;
+
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
+    public String getCreditNo() {
+        return creditNo;
+    }
+
+    public void setCreditNo(String creditNo) {
+        this.creditNo = creditNo;
+    }
+
+    public String getLegalPerson() {
+        return legalPerson;
+    }
+
+    public void setLegalPerson(String legalPerson) {
+        this.legalPerson = legalPerson;
+    }
+}

+ 34 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/service/MgrUserService.java

@@ -6,6 +6,7 @@ import com.bosshand.virgo.core.model.*;
 import com.bosshand.virgo.core.utils.*;
 import com.bosshand.virgo.exception.Constant;
 import com.bosshand.virgo.exception.ServiceException;
+import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.shiro.subject.Subject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -13,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
 import java.util.*;
 
 @Service
@@ -545,4 +548,35 @@ public class MgrUserService {
 
 	}
 
+	/**
+	 * 企业三要素验证V2
+	 */
+	public JSONObject companyCheck(CompanyCheck companyCheck) {
+		String appid = "vSkTV1F17aS72hx4rM8eJKTzIDvTBoLm";
+		String app_security = "ZblFsh41FLQmbbAAyjdqufSXHmmOOtJW";
+		String timestamp = String.valueOf(System.currentTimeMillis());
+		String sign = DigestUtils.md5Hex(appid + "&" + timestamp + "&" + app_security);
+		String companyName = "";
+		String legalPerson = "";
+		try {
+			companyName = URLEncoder.encode(companyCheck.getCompanyName(), "utf-8");
+			legalPerson = URLEncoder.encode(companyCheck.getLegalPerson(), "utf-8");
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		}
+		String url = "https://api.shumaidata.com/v4/company-three/check/v2?companyName="
+				+ companyName
+				+ "&creditNo="
+				+ companyCheck.getCreditNo()
+				+ "&legalPerson="
+				+ legalPerson
+				+ "&appid="
+				+ appid
+				+ "&timestamp="
+				+ timestamp
+				+ "&sign=" + sign;
+		String str = WeChatUtil.httpRequest(url, "GET", null);
+		return JSONObject.parseObject(str).getJSONObject("data");
+	}
+
 }