|
|
@@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSONException;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fs.ad.enums.AdUploadType;
|
|
|
import com.fs.ad.service.IAdHtmlClickLogService;
|
|
|
@@ -2234,7 +2233,7 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
;
|
|
|
|
|
|
@Override
|
|
|
- public void insertQwExternalContactByExternalUserId(String externalUserID, String userID, Long companyId, String corpId, String state, String welcomeCode) throws ParseException {
|
|
|
+ public void insertQwExternalContactByExternalUserId(String externalUserID, String userID, Long companyId, String corpId, String state, String welcomeCode, QwUser qwUser) throws ParseException {
|
|
|
|
|
|
|
|
|
// String qwApiExternal=redisCache.getCacheObject("qwApiExternal:"+userID+":"+corpId+":"+externalUserID);
|
|
|
@@ -2248,40 +2247,21 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
LocalDate currentDate = LocalDate.now();
|
|
|
// 获取当前系统时间 (HH:mm)
|
|
|
LocalTime localTime = LocalTime.now();
|
|
|
+ log.info("qw_user_id:{},external_id:{}: 查询企微接口开始", qwUser.getId(), externalUserID);
|
|
|
QwExternalContactResult externalContactResult = qwApiService.getExternalcontact(externalUserID, corpId);
|
|
|
- boolean isSend = true;
|
|
|
+ log.info("qw_user_id:{},external_id:{}: 查询企微接口结束", qwUser.getId(), externalUserID);
|
|
|
boolean isWay = false;
|
|
|
QwContactWay wayId = null;
|
|
|
//先入客户
|
|
|
+ log.info("qw_user_id:{},external_id:{}: 查询系统是否有这个人开始", qwUser.getId(), externalUserID);
|
|
|
QwExternalContact qwExternalContact = qwExternalContactMapper.selectQwExternalByExternalIdAndCompanyIdToIdAndFs(externalUserID, userID, corpId);
|
|
|
+ log.info("qw_user_id:{},external_id:{}: 查询系统是否有这个人结束", qwUser.getId(), externalUserID);
|
|
|
boolean isNewQwExternalContact = qwExternalContact == null;
|
|
|
qwExternalContact = qwExternalContact == null ? new QwExternalContact() : qwExternalContact;
|
|
|
qwExternalContact.setUserId(userID); // 设置属于用户ID
|
|
|
qwExternalContact.setExternalUserId(externalUserID); // 设置外部联系人ID
|
|
|
qwExternalContact.setCorpId(corpId);
|
|
|
qwExternalContact.setCreateTime(new Date());
|
|
|
-// if(StringUtils.isNotEmpty(state)){
|
|
|
-// try {
|
|
|
-// AdUploadVo vo = AdUploadVo.builder().state(state).type(AdUploadType.ADD_WX).build();
|
|
|
-// logger.info("上传mq:{}", vo);
|
|
|
-// rocketMQTemplate.syncSend("ad-upload", JSON.toJSONString(vo));
|
|
|
-// }catch (Exception e){
|
|
|
-// logger.error("广告回调上传",e);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// try {
|
|
|
-// new Thread(() -> {
|
|
|
-// try {
|
|
|
-// Thread.sleep(3000);
|
|
|
-// rocketMQTemplate.syncSend("repeat-upload", JSON.toJSONString(RepeatUploadVo.builder().type(0).externalUserId(externalUserID).build()));
|
|
|
-// } catch (InterruptedException e) {
|
|
|
-// logger.error("添加等待时长错误", e);
|
|
|
-// }
|
|
|
-// }).start();
|
|
|
-// }catch (Exception e){
|
|
|
-// logger.error("重粉提交mq失败", e);
|
|
|
-// }
|
|
|
-// iAdHtmlClickLogService.upload(state, AdUploadType.ADD_WX, e -> finalQwExternalContact.setUploadAddWxStatus(1));
|
|
|
//重粉问题
|
|
|
try {
|
|
|
new Thread(() -> {
|
|
|
@@ -2302,13 +2282,14 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
if (isNewQwExternalContact) {
|
|
|
qwExternalContact.setName("待同步客户");
|
|
|
qwExternalContact.setGender(0);
|
|
|
+ log.info("qw_user_id:{},external_id:{}: 插入外部联系人数据开始", qwUser.getId(), externalUserID);
|
|
|
qwExternalContactMapper.insertQwExternalContact(qwExternalContact);
|
|
|
+ log.info("qw_user_id:{},external_id:{}: 插入外部联系人数据结束", qwUser.getId(), externalUserID);
|
|
|
} else {
|
|
|
qwExternalContactMapper.updateQwExternalContact(qwExternalContact);
|
|
|
}
|
|
|
|
|
|
QwExternalContact contact=qwExternalContact;
|
|
|
- QwUser qwUser = qwUserMapper.selectQwUserByCorpIdAndUserId(corpId, userID);
|
|
|
|
|
|
// if (state != null && state != "") {
|
|
|
// String s = "way:" + corpId + ":";
|
|
|
@@ -2360,7 +2341,9 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
if (welcomeCode != null && welcomeCode != "") {
|
|
|
if (qwUser != null) {
|
|
|
// 查询成员的欢迎语以及欢迎图片
|
|
|
+ log.info("qw_user_id:{},external_id:{}: 查询欢迎语开始", qwUser.getId(), externalUserID);
|
|
|
QwFriendWelcomeVO qwFriendWelcomeVO = qwFriendWelcomeMapper.selectQwFriendWelcomeByUserIdVO(qwUser.getId(), corpId);
|
|
|
+ log.info("qw_user_id:{},external_id:{}: 查询欢迎语结束", qwUser.getId(), externalUserID);
|
|
|
if (qwFriendWelcomeVO != null) {
|
|
|
SendWelcomeMsgParam sendWelcomeMsgParam = new SendWelcomeMsgParam();
|
|
|
sendWelcomeMsgParam.setWelcome_code(welcomeCode);
|
|
|
@@ -2426,10 +2409,12 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
});
|
|
|
}
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ log.info("qw_user_id:{},external_id:{}: 请求发送欢迎语开始", qwUser.getId(), externalUserID);
|
|
|
QwResult qwResult = qwApiService.sendWelcomeMsg(sendWelcomeMsgParam, corpId);
|
|
|
+ log.info("qw_user_id:{},external_id:{}: 请求发送欢迎语结束", qwUser.getId(), externalUserID);
|
|
|
logger.info("发送好友欢迎语的参数:" + sendWelcomeMsgParam+"发送好友欢迎语结果:" + qwResult);
|
|
|
if (qwResult.getErrcode()==41050||qwResult.getErrcode()==41051){
|
|
|
-
|
|
|
+ log.info("qw_user_id:{},external_id:{}: 欢迎语状态错误进入补发逻辑:{}", qwUser.getId(), externalUserID, qwResult.getErrcode());
|
|
|
try {
|
|
|
QwSopLogs sopLogs=new QwSopLogs();
|
|
|
sopLogs.setQwUserid(userID);
|