Commit 20b9d546 by qwmqiuwenmin

fix

parent 009049c2
...@@ -3,6 +3,8 @@ package com.gic.haoban.manage.service.service.out.impl; ...@@ -3,6 +3,8 @@ package com.gic.haoban.manage.service.service.out.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil; import com.gic.commons.util.GICMQClientUtil;
import com.gic.commons.util.GlobalInfo;
import com.gic.commons.util.GlobalVar;
import com.gic.haoban.base.api.common.Constant; import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
...@@ -22,10 +24,15 @@ import com.gic.haoban.manage.service.config.Config; ...@@ -22,10 +24,15 @@ import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.*; import com.gic.haoban.manage.service.entity.*;
import com.gic.haoban.manage.service.service.*; import com.gic.haoban.manage.service.service.*;
import com.gic.mq.sdk.GicMQClient; import com.gic.mq.sdk.GicMQClient;
import com.gic.thirdparty.api.dto.PicUploadResDTO;
import com.gic.thirdparty.api.service.QQCloudPicService;
import com.gic.wechat.api.service.qywx.QywxDepartmentApiService; import com.gic.wechat.api.service.qywx.QywxDepartmentApiService;
import java.io.InputStream;
import java.net.URL;
import java.util.List; import java.util.List;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -61,6 +68,9 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -61,6 +68,9 @@ public class MessageApiServiceImpl implements MessageApiService {
@Autowired @Autowired
private QywxDepartmentApiService qywxDepartmentApiService; private QywxDepartmentApiService qywxDepartmentApiService;
@Autowired
private QQCloudPicService qqCloudPicService;
private final String CONTACT_APP = "contactSuiteId"; private final String CONTACT_APP = "contactSuiteId";
@Override @Override
...@@ -254,7 +264,9 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -254,7 +264,9 @@ public class MessageApiServiceImpl implements MessageApiService {
staff.setStaffName(qywxCallBackDTO.getUserName()); staff.setStaffName(qywxCallBackDTO.getUserName());
staff.setWxUserId(qywxCallBackDTO.getUserid()); staff.setWxUserId(qywxCallBackDTO.getUserid());
staff.setPostion(qywxCallBackDTO.getPosition()); staff.setPostion(qywxCallBackDTO.getPosition());
staff.setHeadImg(qywxCallBackDTO.getAvatar()); if(StringUtils.isNotBlank(qywxCallBackDTO.getAvatar())){
staff.setHeadImg(changeHeaderImageUrl(qywxCallBackDTO.getAvatar()));
}
staff.setNationCode("86"); staff.setNationCode("86");
//激活状态 //激活状态
if(qywxCallBackDTO.getStatus() != null && qywxCallBackDTO.getStatus() == 1){ if(qywxCallBackDTO.getStatus() != null && qywxCallBackDTO.getStatus() == 1){
...@@ -405,6 +417,20 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -405,6 +417,20 @@ public class MessageApiServiceImpl implements MessageApiService {
} }
} }
} }
private String changeHeaderImageUrl(String headImgUrl) {
try {
InputStream in = new URL(headImgUrl).openStream();
byte[] data = IOUtils.toByteArray(in);
PicUploadResDTO uploadPic = qqCloudPicService.uploadPic(GlobalVar.ctxPropertiesMap.get(GlobalInfo.QQPIC_KEY_ENTERPRISE), data);
log.info("腾讯云万象优图返回" + JSON.toJSONString(uploadPic));
return uploadPic.downloadUrl;
}catch (Exception e){
log.info("上传腾讯云万象优图返回失败了:", e);
return headImgUrl;
}
}
/** /**
* 通过关联的父级ID链查询父级部门 * 通过关联的父级ID链查询父级部门
* @param parentChain * @param parentChain
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment