Просмотр исходного кода

完善客户信息表筛选通话状态的查询逻辑

cgp 4 дней назад
Родитель
Сommit
eeb8d04391

+ 11 - 4
fs-admin/src/main/java/com/fs/his/task/KdzlTask.java

@@ -359,18 +359,25 @@ public class KdzlTask {
      * 根据电话号码同步客户信息表的通话状态
      *
      */
-    public void  syncCallStatusByPhone() {
+    public int  syncCallStatusByPhone() {
         List<UserPhoneAndCallStatusVO> phoneAndCallStatusVOList =kdzlCallRecordMapper.selectUserPhoneAndCallStatus();
         if (CollectionUtils.isEmpty(phoneAndCallStatusVOList)){
-            return;
+            return 0;
         }
         for (UserPhoneAndCallStatusVO item : phoneAndCallStatusVOList) {
-            if ("".equals(item.getCallStatus())||item.getCallStatus()==null){
+            if (item == null) {
+                continue;
+            }
+            if (item.getCallStatus() == null || item.getCallStatus().isEmpty()){
                 item.setCallStatus("2");//未接通
             }
         }
+        // 更新前过滤掉 phone 为空的元素(避免更新时匹配不到)
+        List<UserPhoneAndCallStatusVO> validList = phoneAndCallStatusVOList.stream()
+                .filter(vo -> vo != null && vo.getPhone() != null && !vo.getPhone().isEmpty())
+                .collect(Collectors.toList());
         //根据电话号码更新客户信息表的通话状态
-        int update=companyCustomerMapper.updateBatchFsCompanyCustomerCallStatusByPhoneList(phoneAndCallStatusVOList);
+        return companyCustomerMapper.updateBatchFsCompanyCustomerCallStatusByPhoneList(validList);
     }
 
     /**

+ 1 - 1
fs-service/src/main/resources/mapper/his/FsKdzlCallRecordMapper.xml

@@ -117,7 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectUserPhoneAndCallStatus" resultType="com.fs.his.vo.UserPhoneAndCallStatusVO">
-        SELECT called, status
+        SELECT called as phone, status as callStatus
         FROM (
                  SELECT
                      called,

+ 1 - 1
fs-service/src/main/resources/mapper/qw/FsCompanyCustomerMapper.xml

@@ -108,7 +108,7 @@
             and kdzl_make_status = #{kdzlMakeStatus}
         </if>
         <if test="kdzlCallStatus != null and kdzlCallStatus != ''">
-            and kdzl_call_status like concat('%', #{kdzlCallStatus}, '%')
+            and kdzl_call_status = #{kdzlCallStatus}
         </if>
         <if test="processStatus != null">
             and process_status = #{processStatus}