cc 3 bulan lalu
induk
melakukan
91264a3470

+ 20 - 14
src/main/java/com/qingjian/module/person/service/IntimacyService.java

@@ -26,6 +26,7 @@ import com.qingjian.module.person.mapper.PersonBasicInfoMapper;
 import com.qingjian.module.person.mapper.PersonGroupMapper;
 import com.qingjian.module.person.mapper.PersonGroupRelMapper;
 import com.qingjian.module.plat.service.CacheManageService;
+import com.qingjian.module.track.mapper.TrackTogetherTravelMapper;
 import com.qingjian.module.trans.mapper.AcctOpenInfoMapper;
 import com.qingjian.module.trans.mapper.TransRecordMapper;
 import lombok.extern.slf4j.Slf4j;
@@ -61,6 +62,8 @@ public class IntimacyService extends ServiceImpl<IntimacyMapper, Intimacy> {
     private PersonBasicInfoMapper personBasicInfoMapper;
     @Inject
     private CacheManageService cacheManageService;
+    @Inject
+    private TrackTogetherTravelMapper trackTogetherTravelMapper;
 
     public List<Intimacy> dataList() {
         return this.list();
@@ -448,22 +451,25 @@ public class IntimacyService extends ServiceImpl<IntimacyMapper, Intimacy> {
     public List<IntimacyDTO> travelTogether(String personName) {
         List<TravelDataDTO> serviceRecords = new ArrayList<>();
         Map<String, List<TravelDataDTO>> tripMatchMap = new HashMap<>();
-
-        List<TravelDataDTO> flightTrainRecords = intimacyMapper.travelsTrainFlight(personName, "");
-        if (CollUtil.isNotEmpty(flightTrainRecords)) {
-            List<TravelDataDTO> mappedRecords = flightTrainRecords.stream().map(record -> {
-                TravelDataDTO dto = new TravelDataDTO();
-                dto.setId(record.getId());
-                dto.setPersonName(personName);
-                dto.setCompanionName(record.getCompanionName());
-                dto.setCount(1);
-                return dto;
-            }).toList();
-            serviceRecords.addAll(mappedRecords);
+        PersonBasicInfo personBasicInfo = personBasicInfoMapper.selectOne(Wrappers.<PersonBasicInfo>lambdaQuery()
+                .eq(PersonBasicInfo::getPersonName, personName), false);
+        if (personBasicInfo != null && StrUtil.isNotEmpty(personBasicInfo.getPersonCertNo())) {
+            List<TravelDataDTO> flightTrainRecords = intimacyMapper.travelsTrainFlight(personName, "");
+            if (CollUtil.isNotEmpty(flightTrainRecords)) {
+                List<TravelDataDTO> mappedRecords = flightTrainRecords.stream().map(record -> {
+                    TravelDataDTO dto = new TravelDataDTO();
+                    dto.setId(record.getId());
+                    dto.setPersonName(personName);
+                    dto.setCompanionName(record.getCompanionName());
+                    dto.setCount(1);
+                    return dto;
+                }).toList();
+                serviceRecords.addAll(mappedRecords);
+            }
         }
         List<PersonBasicInfo> allPersons = personBasicInfoMapper.selectList(Wrappers.emptyWrapper());
 
-        List<TravelDataDTO> travelRecords = intimacyMapper.travels(personName, "");
+        List<TravelDataDTO> travelRecords = trackTogetherTravelMapper.travels(null, null, personName);
         Map<String, List<TravelDataDTO>> timeTripGroup = travelRecords.stream().collect(Collectors.groupingBy(item ->
                 String.format("%s_%s",
                         StrUtil.isBlank(item.getTripDateTime()) ? "" : item.getTripDateTime().trim(),
@@ -472,7 +478,7 @@ public class IntimacyService extends ServiceImpl<IntimacyMapper, Intimacy> {
             if (Objects.equals(otherPerson.getPersonName(), personName)) {
                 continue;
             }
-            List<TravelDataDTO> otherTravelRecords = intimacyMapper.travels(otherPerson.getPersonName(), otherPerson.getPersonCertNo());
+            List<TravelDataDTO> otherTravelRecords = trackTogetherTravelMapper.travels(null, null, otherPerson.getPersonName());
             if (CollUtil.isEmpty(otherTravelRecords)) {
                 continue;
             }

+ 0 - 2
src/main/resources/mappers/track/TrackTogetherTravelMapper.xml

@@ -12,7 +12,6 @@
         from together_flight_info
         where companionName is not null
         and personCertNo=#{personCertNo}
-        and companionName != #{personName}
         <if test="startDate != null">
             and flightDateTime::DATE >= #{startDate}
         </if>
@@ -27,7 +26,6 @@
         from together_train_info
         where companionName is not null
         and personCertNo = #{personCertNo}
-        and companionName != #{personName}
         <if test="startDate != null">
             and depDateTime::DATE >= #{startDate}
         </if>