Bladeren bron

Merge branch 'master' of http://git.dgtis.com/qxp/suishenbang-oneportal

zhangding 4 jaren geleden
bovenliggende
commit
81cec8aea9

+ 28 - 0
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/EsignController.java

@@ -24,6 +24,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * @description:e签宝认证
  * @author:qxm
@@ -346,6 +349,31 @@ public class EsignController extends ApiBaseController {
         }
     }
 
+    @ApiOperation(value = "获取企业\\个人认证情况信息", notes = "参数:{'userId':'XXXXXXX'}" +
+            "\n(userId:用户id)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "params", paramType = "body")
+    })
+    @PostMapping("getOrgOrPersonalVerify")
+    public Object getOrgOrPersonalVerify() {
+        ParameterObject obj = getParameterObject();
+        obj.checkParameterNotNull("userId");
+        String userId = obj.getString("userId");
+        Map map = new HashMap(5);
+        SysUser sysUser = userService.selectUserById(Long.parseLong(userId));
+        if (sysUser!=null){
+            map.put("user",sysUser);
+            CustomersExt customersExt = customersExtService.selectCustomersExtById(sysUser.getSysUserExt().getOrgCode());
+            if (customersExt!=null){
+                map.put("customers",customersExt);
+                return AjaxResult.success(map);
+            }else{
+                return AjaxResult.success(map);
+            }
+        }else{
+            return AjaxResult.error("用户不存在");
+        }
+    }
 //    /**
 //     * @descption: e签宝修改个人信息
 //     * @param:

+ 9 - 0
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/utils/ESign/ESignHttpUtil.java

@@ -124,6 +124,7 @@ public class ESignHttpUtil {
             conn.setUseCaches(false);//设置不要缓存
             conn.setDoOutput(true);
             conn.setDoInput(true);
+
             out = new PrintWriter(conn.getOutputStream());
             out.write(json);
             out.flush();
@@ -157,6 +158,8 @@ public class ESignHttpUtil {
         }
         finally
         {
+            //清除token缓存
+            eSignConfig.geteSignToken().reSetToken();
             try
             {
                 if (out != null)
@@ -245,6 +248,8 @@ public class ESignHttpUtil {
         }
         finally
         {
+            //清除token缓存
+            eSignConfig.geteSignToken().reSetToken();
             try
             {
                 if (out != null)
@@ -315,6 +320,8 @@ public class ESignHttpUtil {
         }
         finally
         {
+            //清除token缓存
+            eSignConfig.geteSignToken().reSetToken();
             try
             {
                 if (out != null)
@@ -381,6 +388,8 @@ public class ESignHttpUtil {
         }
         finally
         {
+            //清除token缓存
+            eSignConfig.geteSignToken().reSetToken();
             try
             {
                 if (in != null)

+ 7 - 1
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/utils/ESign/ESignToken.java

@@ -41,7 +41,7 @@ public class ESignToken {
         try {
             //token未过期使用缓存的token
             long currentTiem = new Date().getTime();
-            if(this.accessToken!=null &&(currentTiem-createTime)<(expires)){
+            if(this.accessToken!=null &&(currentTiem)<(expires-10000)){
                 log.info("本身的token为{}",this.accessToken);
                 return this.accessToken;
             }
@@ -69,6 +69,12 @@ public class ESignToken {
         return this.accessToken;
     }
 
+    public void reSetToken() {
+        accessToken =null;
+        expires = 0;
+        refreshToken = null;
+        createTime = 0;
 
+    }
 
 }