Browse Source

fix(service):修复客户转移审批服务中的空指针异常

- 添加对销售信息为空的检查并记录警告日志
- 修复目标销售信息查询逻辑并增加空值判断
-修正字符串格式化时使用错误的用户ID问题
- 移除课程观看日志映射文件中多余的项目过滤条件
xw 4 ngày trước cách đây
mục cha
commit
f9db5061f3

+ 12 - 2
fs-service/src/main/java/com/fs/qw/service/impl/CustomerTransferApprovalServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.fs.common.utils.DictUtils;
+import com.fs.common.utils.StringUtils;
 import com.fs.company.cache.ICompanyCacheService;
 import com.fs.company.cache.ICompanyUserCacheService;
 import com.fs.company.domain.Company;
@@ -20,7 +21,7 @@ import com.fs.qw.mapper.CustomerTransferApprovalMapper;
 import com.fs.qw.service.ICustomerTransferApprovalService;
 import com.fs.qw.vo.TransferCustomDTO;
 import com.fs.store.service.cache.IFsUserCacheService;
-import com.hc.openapi.tool.util.StringUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.hc.core5.util.Asserts;
 import org.springframework.aop.framework.AopContext;
@@ -41,6 +42,7 @@ import java.util.Objects;
  * @author fs
  * @date 2025-04-01
  */
+@Slf4j
 @Service
 @EnableAspectJAutoProxy(proxyTargetClass = true,exposeProxy = true)
 public class CustomerTransferApprovalServiceImpl implements ICustomerTransferApprovalService
@@ -138,10 +140,18 @@ public class CustomerTransferApprovalServiceImpl implements ICustomerTransferApp
                 FsUserCompanyUser userCompanyUser = userCompanyUserService.selectByUserIdAndProjectId(customerId.getUserId(), customerId.getProjectId());
                 if(Objects.nonNull(userCompanyUser)){
                     CompanyUser companyUser = companyUserCacheService.selectCompanyUserById(userCompanyUser.getCompanyUserId());
+                    if(Objects.isNull(companyUser)){
+                        log.warn("未找到销售信息, companyUserId: {}", userCompanyUser.getCompanyUserId());
+                        continue;
+                    }
                     String companyUserName = String.format("%s_%d", companyUser.getUserName(), companyUser.getUserId());
 
                     CompanyUser afterCompanyUser = companyUserCacheService.selectCompanyUserById(item.getTargetUserId());
-                    String afterCompanyUserName = String.format("%s_%d", afterCompanyUser.getUserName(), companyUser.getUserId());
+                    if(Objects.isNull(afterCompanyUser)){
+                        log.warn("未找到目标销售信息, targetUserId: {}", item.getTargetUserId());
+                        continue;
+                    }
+                    String afterCompanyUserName = String.format("%s_%d", afterCompanyUser.getUserName(), afterCompanyUser.getUserId());
 
                     customerList.add(TransferCustomDTO.builder()
                             .userName(String.format("%s_%d", fsUser.getNickName(), fsUser.getUserId()))

+ 0 - 3
fs-service/src/main/resources/mapper/course/FsCourseWatchLogMapper.xml

@@ -145,9 +145,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     #{sopId}
                 </foreach>
             </if>
-            <if test ='maps.project !=null'>
-                and l.project = #{maps.project}
-            </if>
             <if test="maps.sopId != null  and maps.sopId != '' ">
                 and l.sop_id = #{maps.sopId}
             </if>