飞书推送事件 优化

This commit is contained in:
苏竹红
2023-11-01 13:42:07 +08:00
parent 01c2ce6b07
commit 603ab7247a
5 changed files with 16 additions and 7 deletions

View File

@@ -147,7 +147,7 @@ public class EnterpriseUserDAO {
return userList.stream().filter(o->!StringUtils.isAnyBlank(o.getMobile(), o.getName())).collect(Collectors.toMap(k -> k.getUserId(), Function.identity())); return userList.stream().filter(o->!StringUtils.isAnyBlank(o.getMobile(), o.getName())).collect(Collectors.toMap(k -> k.getUserId(), Function.identity()));
} }
public String selectByMobile(String mobile) { public EnterpriseUserDO selectByMobile(String mobile) {
return enterpriseUserMapper.selectByMobile(mobile); return enterpriseUserMapper.selectByMobile(mobile);
} }

View File

@@ -101,7 +101,7 @@ public interface EnterpriseUserMapper {
*/ */
List<EnterpriseUserDO> getUserListByRegionIds(@Param("regionIds") List<String> regionIds); List<EnterpriseUserDO> getUserListByRegionIds(@Param("regionIds") List<String> regionIds);
String selectByMobile(@Param("mobile") String mobile); EnterpriseUserDO selectByMobile(@Param("mobile") String mobile);
EnterpriseUserDO selectByInvestmentManager(@Param("investmentManager") String investmentManager); EnterpriseUserDO selectByInvestmentManager(@Param("investmentManager") String investmentManager);

View File

@@ -332,8 +332,8 @@
SUBSTR(jobnumber,1,1), SUBSTR(jobnumber,1,1),
CAST(SUBSTR(jobnumber,2) AS UNSIGNED) ASC CAST(SUBSTR(jobnumber,2) AS UNSIGNED) ASC
</select> </select>
<select id="selectByMobile" resultType="java.lang.String"> <select id="selectByMobile" resultMap="BaseResultMap">
SELECT user_id FROM enterprise_user WHERE mobile =#{mobile} and deleted=0 LIMIT 1 SELECT <include refid="Base_Column_List"/> FROM enterprise_user WHERE mobile =#{mobile} and deleted=0 LIMIT 1
</select> </select>
<select id="selectByInvestmentManager" resultMap="BaseResultMap"> <select id="selectByInvestmentManager" resultMap="BaseResultMap">
SELECT SELECT

View File

@@ -429,13 +429,13 @@ public class EcSyncServiceImpl implements EcSyncService {
private String getInvestmentManager(String followUserName, String followUserMobile) throws ApiException { private String getInvestmentManager(String followUserName, String followUserMobile) throws ApiException {
//传递过来有跟进人的情况下查询跟进人是否存在 //传递过来有跟进人的情况下查询跟进人是否存在
if (StringUtil.isNotEmpty(followUserMobile) && StringUtil.isNotEmpty(followUserName)) { if (StringUtil.isNotEmpty(followUserMobile) && StringUtil.isNotEmpty(followUserName)) {
String userId = enterpriseUserDAO.selectByMobile(followUserMobile); EnterpriseUserDO enterpriseUserDO = enterpriseUserDAO.selectByMobile(followUserMobile);
if (StringUtil.isEmpty(userId)) { if (enterpriseUserDO==null) {
// 给飞书群发送消息 跟进人找不到 // 给飞书群发送消息 跟进人找不到
sendFeiShuRobotMessage("推送:飞书架构中找不到该用户:【" + followUserName + "】,该用户电话号码为:" + followUserMobile, "27243d49-97ca-4981-8aec-7c3bf84eb660"); sendFeiShuRobotMessage("推送:飞书架构中找不到该用户:【" + followUserName + "】,该用户电话号码为:" + followUserMobile, "27243d49-97ca-4981-8aec-7c3bf84eb660");
throw new ApiException("飞书架构中找不到该用户:【" + followUserName + "】,该用户电话号码为:" + followUserMobile); throw new ApiException("飞书架构中找不到该用户:【" + followUserName + "】,该用户电话号码为:" + followUserMobile);
} }
return userId; return enterpriseUserDO.getUserId();
} }
return ""; return "";
} }

View File

@@ -211,6 +211,15 @@ public class EnterpriseSyncServiceImpl implements EnterpriseSyncService {
enterpriseUserRoleDAO.deleteUserRole(userDetail.getUserId()); enterpriseUserRoleDAO.deleteUserRole(userDetail.getUserId());
} }
EnterpriseUserDO enterpriseUser = EnterpriseUserDTO.transUserDtoToDo(userDetail, regionPathMap, leaderDeptMap, eventType); EnterpriseUserDO enterpriseUser = EnterpriseUserDTO.transUserDtoToDo(userDetail, regionPathMap, leaderDeptMap, eventType);
if(StringUtils.isNotBlank(enterpriseUser.getMobile())){
EnterpriseUserDO enterpriseUserDO = enterpriseUserDAO.selectByMobile(enterpriseUser.getMobile());
//如果没有用户信息 但是飞书推的是更新的事件
if (enterpriseUserDO==null){
log.info("没有用户信息 但是飞书推的是更新的事件");
enterpriseUserDO.setIsLeader(Boolean.FALSE);
enterpriseUserDO.setLeaderDeptIds("[]");
}
}
enterpriseUserDAO.batchInsertOrUpdate(new ArrayList<>(Arrays.asList(enterpriseUser))); enterpriseUserDAO.batchInsertOrUpdate(new ArrayList<>(Arrays.asList(enterpriseUser)));
userRegionMappingDAO.batchInsertOrUpdateUserRegion(UserRegionMappingDO.convertSyncDO(Arrays.asList(enterpriseUser))); userRegionMappingDAO.batchInsertOrUpdateUserRegion(UserRegionMappingDO.convertSyncDO(Arrays.asList(enterpriseUser)));
userRegionMappingDAO.deleteUserRegionByUserId(userDetail.getUserId(), DataSourceEnum.SYNC, departmentLists); userRegionMappingDAO.deleteUserRegionByUserId(userDetail.getUserId(), DataSourceEnum.SYNC, departmentLists);