|
@@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.sun.media.jfxmedia.logging.Logger;
|
|
import jdk.nashorn.internal.runtime.UserAccessorProperty;
|
|
import jdk.nashorn.internal.runtime.UserAccessorProperty;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
@@ -128,17 +129,24 @@ public class QYWxServiceImpl extends ServiceImpl<CorpUserInfoMapper, CorpUserInf
|
|
* @param token
|
|
* @param token
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
- public void updateUserOpenId(String token) throws Exception {
|
|
|
|
|
|
+ public void updateUserOpenId(String token) {
|
|
List<String> userList = wxUserInfoMapper.getUseridList();
|
|
List<String> userList = wxUserInfoMapper.getUseridList();
|
|
for(String userid:userList){
|
|
for(String userid:userList){
|
|
- JSONObject resultJson = DepartUserProvider.convertUserIdToOpenId(userid, token);
|
|
|
|
- Integer errcode = resultJson.getInteger("errcode");
|
|
|
|
- if(errcode == 0){
|
|
|
|
- String openId = resultJson.getString("openid");
|
|
|
|
- wxUserInfoMapper.updateUserInfoByUserid(userid, openId);
|
|
|
|
- wxUserInfoMapper.updateUserDepartMapOpenIdByUserid(userid, openId);
|
|
|
|
- }else{
|
|
|
|
- throw new Exception("userid转换为openId出错啦,resultJson为" + resultJson);
|
|
|
|
|
|
+ try{
|
|
|
|
+ JSONObject resultJson = DepartUserProvider.convertUserIdToOpenId(userid, token);
|
|
|
|
+
|
|
|
|
+ Integer errcode = resultJson.getInteger("errcode");
|
|
|
|
+ if(errcode == 0){
|
|
|
|
+ String openId = resultJson.getString("openid");
|
|
|
|
+ wxUserInfoMapper.updateUserInfoByUserid(userid, openId);
|
|
|
|
+ wxUserInfoMapper.updateUserDepartMapOpenIdByUserid(userid, openId);
|
|
|
|
+ }else{
|
|
|
|
+ //throw new Exception("userid转换为openId出错啦,resultJson为" + resultJson);
|
|
|
|
+ System.out.println(userid + " : userid转换为openId出错啦" + resultJson);
|
|
|
|
+ //log.info("1112");
|
|
|
|
+ }
|
|
|
|
+ }catch(Exception e){
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|