Commit b5f25d77 by 蘑菇

fix 图片地址转换

parent ccf35a45
...@@ -115,6 +115,13 @@ ...@@ -115,6 +115,13 @@
<version>3.0-SNAPSHOT</version> <version>3.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-thirdparty-api</artifactId>
<version>${gic-thirdparty-api}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
...@@ -11,15 +12,16 @@ import java.util.Set; ...@@ -11,15 +12,16 @@ import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.ToolUtil; import com.gic.commons.util.GlobalInfo;
import com.gic.haoban.base.api.common.Constant; import com.gic.commons.util.GlobalVar;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.service.util.EmojiFilterUtil; import com.gic.thirdparty.api.dto.PicUploadResDTO;
import com.gic.thirdparty.api.service.QQCloudPicService;
import com.vdurmont.emoji.EmojiParser; import com.vdurmont.emoji.EmojiParser;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.hibernate.hql.internal.CollectionSubqueryFactory;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -98,6 +100,9 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -98,6 +100,9 @@ public class StaffApiServiceImpl implements StaffApiService {
private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService; private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService;
@Autowired @Autowired
private SyncErrorLogService syncErrorLogService; private SyncErrorLogService syncErrorLogService;
@Autowired
private QQCloudPicService qqCloudPicService;
@Override @Override
public StaffDTO selectById(String staffId) { public StaffDTO selectById(String staffId) {
...@@ -936,7 +941,8 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -936,7 +941,8 @@ public class StaffApiServiceImpl implements StaffApiService {
} }
//修改 //修改
} else { } else {
staff.setHeadImg(clerkDTO.getHeadImgUrl()); String url = changeHeaderImageUrl(clerkDTO.getHeadImgUrl());
staff.setHeadImg(url);
staff.setSex(clerkDTO.getClerkGender()); staff.setSex(clerkDTO.getClerkGender());
//staff.setPostion(postion); //staff.setPostion(postion);
// staff.setStaffName(staffName); // staff.setStaffName(staffName);
...@@ -978,6 +984,19 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -978,6 +984,19 @@ public class StaffApiServiceImpl implements StaffApiService {
return response; return response;
} }
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);
logger.info("腾讯云万象优图返回" + JSON.toJSONString(uploadPic));
return uploadPic.downloadUrl;
}catch (Exception e){
logger.info("上传腾讯云万象优图返回失败了:", e);
return headImgUrl;
}
}
/** /**
* 删除企业微信 * 删除企业微信
* *
......
...@@ -56,6 +56,8 @@ ...@@ -56,6 +56,8 @@
<dubbo:reference interface="com.gic.member.api.service.MemberOpenCardBusinessService" id="memberOpenCardBusinessService"/> <dubbo:reference interface="com.gic.member.api.service.MemberOpenCardBusinessService" id="memberOpenCardBusinessService"/>
<dubbo:reference id="eSDataDynamicOperationApiService" interface="com.gic.search.engine.api.service.dynamic.ESDataDynamicOperationApiService" timeout="10000"/> <dubbo:reference id="eSDataDynamicOperationApiService" interface="com.gic.search.engine.api.service.dynamic.ESDataDynamicOperationApiService" timeout="10000"/>
<dubbo:reference id="qqCloudPicService" interface="com.gic.thirdparty.api.service.QQCloudPicService" timeout="10000" retries="0" check="false" />
</beans> </beans>
\ No newline at end of file
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