|
|
@@ -27,6 +27,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
@@ -53,6 +54,9 @@ public class WeComThirdPartyServiceImpl implements WeComThirdPartyService {
|
|
|
@Autowired
|
|
|
private RedisUtils redisUtils;
|
|
|
|
|
|
+ @Value("${wecom.thirdpart.callback.url:https://test-tp-open.piaoquantv.com/wecom/thirdparty/callback}")
|
|
|
+ private String callbackUrl;
|
|
|
+
|
|
|
@Override
|
|
|
public InitResponse init(InitRequest request) {
|
|
|
if (Objects.isNull(request)) {
|
|
|
@@ -84,6 +88,7 @@ public class WeComThirdPartyServiceImpl implements WeComThirdPartyService {
|
|
|
log.error("WeComThirdPartyService get qr code failed, request: {}, response: {}", request, response);
|
|
|
return null;
|
|
|
}
|
|
|
+ apiClient.setCallbackUrl(new SetCallbackUrlRequest(request.getUuid(), callbackUrl));
|
|
|
return commonResponse.getData();
|
|
|
}
|
|
|
|
|
|
@@ -170,7 +175,15 @@ public class WeComThirdPartyServiceImpl implements WeComThirdPartyService {
|
|
|
existStaff.setUpdateTime(new Date());
|
|
|
thirdPartWeComStaffMapper.updateByPrimaryKeySelective(existStaff);
|
|
|
}
|
|
|
+ saveStaffQrCode(uuid);
|
|
|
+
|
|
|
+ // 清除掉线检测
|
|
|
+ String offLineKey = "wecom:thirdpart:offline:" + uuid;
|
|
|
+ redisUtils.del(offLineKey);
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public void saveStaffQrCode(String uuid) {
|
|
|
// 获取名片二维码
|
|
|
String response = apiClient.getExternalBusinessCard(new UuidRequest(uuid));
|
|
|
CommonResponse<ExternalBusinessCardResponse> cardCommonResponse =
|
|
|
@@ -189,10 +202,6 @@ public class WeComThirdPartyServiceImpl implements WeComThirdPartyService {
|
|
|
String fileUri = "temp/" + System.currentTimeMillis() + "_" + RandomUtil.generate18String() + ".png";
|
|
|
String qrImage = AliOssFileTool.saveInPublicReturnHost(inputStream, EnumPublicBuckets.PUBBUCKET, fileUri, EnumFileType.PICTURE);
|
|
|
weComMapperExt.updateStaffQrImageByUuid(uuid, qrImage);
|
|
|
-
|
|
|
- // 清除掉线检测
|
|
|
- String offLineKey = "wecom:thirdpart:offline:" + uuid;
|
|
|
- redisUtils.del(offLineKey);
|
|
|
}
|
|
|
|
|
|
private Corp getCorpByName(String corpName) {
|