|
@@ -23,7 +23,6 @@ import com.fs.qw.enums.SmsLogType;
|
|
|
import com.fs.qw.mapper.QwAcquisitionAssistantMapper;
|
|
import com.fs.qw.mapper.QwAcquisitionAssistantMapper;
|
|
|
import com.fs.qw.mapper.QwUserMapper;
|
|
import com.fs.qw.mapper.QwUserMapper;
|
|
|
import com.fs.qw.param.QwUserListParam;
|
|
import com.fs.qw.param.QwUserListParam;
|
|
|
-import com.fs.qw.service.IQwUserService;
|
|
|
|
|
import com.fs.qw.utils.UniqueStringUtil;
|
|
import com.fs.qw.utils.UniqueStringUtil;
|
|
|
import com.fs.qw.vo.QwUserVO;
|
|
import com.fs.qw.vo.QwUserVO;
|
|
|
import com.fs.wxwork.dto.WxAddSearchDTO;
|
|
import com.fs.wxwork.dto.WxAddSearchDTO;
|
|
@@ -36,12 +35,15 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.context.ApplicationContext;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.fs.qw.mapper.QwAcquisitionLinkInfoMapper;
|
|
import com.fs.qw.mapper.QwAcquisitionLinkInfoMapper;
|
|
|
import com.fs.qw.domain.QwAcquisitionLinkInfo;
|
|
import com.fs.qw.domain.QwAcquisitionLinkInfo;
|
|
|
import com.fs.qw.service.IQwAcquisitionLinkInfoService;
|
|
import com.fs.qw.service.IQwAcquisitionLinkInfoService;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
+import javax.annotation.PostConstruct;
|
|
|
|
|
+
|
|
|
import static com.fs.his.utils.PhoneUtil.encryptPhone;
|
|
import static com.fs.his.utils.PhoneUtil.encryptPhone;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -54,6 +56,9 @@ import static com.fs.his.utils.PhoneUtil.encryptPhone;
|
|
|
@Service
|
|
@Service
|
|
|
public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoService
|
|
public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoService
|
|
|
{
|
|
{
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ApplicationContext applicationContext;
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ISmsService smsService;
|
|
private ISmsService smsService;
|
|
|
|
|
|
|
@@ -72,18 +77,19 @@ public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoS
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private QwAcquisitionLinkInfoMapper qwAcquisitionLinkInfoMapper;
|
|
private QwAcquisitionLinkInfoMapper qwAcquisitionLinkInfoMapper;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private QwAcquisitionLinkInfoServiceImpl self; // 注入自身代理对象
|
|
|
|
|
-
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private IQwUserService qwUserService;
|
|
|
|
|
-
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private QwUserMapper qwUserMapper;
|
|
private QwUserMapper qwUserMapper;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private WxWorkService wxWorkService;
|
|
|
|
|
|
|
+ private WxWorkService wxWorkService;
|
|
|
|
|
|
|
|
|
|
+ @PostConstruct
|
|
|
|
|
+ public void init() {
|
|
|
|
|
+ // 如果自动注入失败,手动获取
|
|
|
|
|
+ if (wxWorkService == null) {
|
|
|
|
|
+ wxWorkService = applicationContext.getBean(WxWorkService.class);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
//拼接电话号码的链接后缀(这个后面拼接加密后的手机字符串)
|
|
//拼接电话号码的链接后缀(这个后面拼接加密后的手机字符串)
|
|
|
private static final String LINK_SUFFIX = "?customer_channel=up:";
|
|
private static final String LINK_SUFFIX = "?customer_channel=up:";
|
|
|
|
|
|
|
@@ -596,13 +602,15 @@ public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoS
|
|
|
QwUserListParam queryCondition=new QwUserListParam();
|
|
QwUserListParam queryCondition=new QwUserListParam();
|
|
|
queryCondition.setCorpId(dto.getCorpId());
|
|
queryCondition.setCorpId(dto.getCorpId());
|
|
|
queryCondition.setQwUserId(qwUser.getQwUserId());
|
|
queryCondition.setQwUserId(qwUser.getQwUserId());
|
|
|
- List<QwUserVO> qwUserVOS = qwUserService.selectQwUserListStaffVO(queryCondition);
|
|
|
|
|
|
|
+ List<QwUserVO> qwUserVOS = qwUserMapper.selectQwUserListStaffVO(queryCondition);
|
|
|
if (qwUserVOS.isEmpty()){
|
|
if (qwUserVOS.isEmpty()){
|
|
|
throw new CustomException("此主体不存在该销售用户");
|
|
throw new CustomException("此主体不存在该销售用户");
|
|
|
}
|
|
}
|
|
|
if (qwUserVOS.get(0).getIpadStatus()==0){
|
|
if (qwUserVOS.get(0).getIpadStatus()==0){
|
|
|
throw new CustomException("此销售用户ipad已离线,请登录");
|
|
throw new CustomException("此销售用户ipad已离线,请登录");
|
|
|
}
|
|
}
|
|
|
|
|
+ // 每次使用时获取代理对象
|
|
|
|
|
+ QwAcquisitionLinkInfoServiceImpl self = applicationContext.getBean(QwAcquisitionLinkInfoServiceImpl.class);
|
|
|
try {
|
|
try {
|
|
|
//调用ipad加好友接口
|
|
//调用ipad加好友接口
|
|
|
WxWorkResponseDTO<String> response = self.qwAddWxInvokeIpad(dto.getPhone(), qwUser.getUid(),
|
|
WxWorkResponseDTO<String> response = self.qwAddWxInvokeIpad(dto.getPhone(), qwUser.getUid(),
|
|
@@ -630,7 +638,7 @@ public class QwAcquisitionLinkInfoServiceImpl implements IQwAcquisitionLinkInfoS
|
|
|
* @param serverId 服务器id
|
|
* @param serverId 服务器id
|
|
|
* @return String 结果
|
|
* @return String 结果
|
|
|
*/
|
|
*/
|
|
|
- private WxWorkResponseDTO<String> qwAddWxInvokeIpad(String mobile, String qwUid, Long serverId, String vid, String qwUserName) {
|
|
|
|
|
|
|
+ public WxWorkResponseDTO<String> qwAddWxInvokeIpad(String mobile, String qwUid, Long serverId, String vid, String qwUserName) {
|
|
|
if (StringUtils.isBlank(mobile) || StringUtils.isBlank(qwUid) || serverId == null) {
|
|
if (StringUtils.isBlank(mobile) || StringUtils.isBlank(qwUid) || serverId == null) {
|
|
|
log.warn("企微申请加好友任务参数校验失败: mobile={}, qwUid={}, serverId={}", mobile, qwUid, serverId);
|
|
log.warn("企微申请加好友任务参数校验失败: mobile={}, qwUid={}, serverId={}", mobile, qwUid, serverId);
|
|
|
return null;
|
|
return null;
|