lishuai
2023-12-20 26a5fcd889f8650d28e56a87de3f9c3b48c5bbfb
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/CarEventServiceImpl.java
@@ -10,6 +10,8 @@
import com.doumee.core.utils.Utils;
import com.doumee.dao.admin.request.VisitEventQuery;
import com.doumee.dao.admin.response.CarEventDTO;
import com.doumee.dao.admin.response.DeviceEventDTO;
import com.doumee.dao.admin.response.VisitEventDTO;
import com.doumee.dao.business.CarEventMapper;
import com.doumee.dao.business.join.CarEventJoinMapper;
import com.doumee.dao.business.model.*;
@@ -26,10 +28,7 @@
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -320,10 +319,17 @@
                            CarEvent::getCreateDate, pageWrap.getModel().getEndTime());
        IPage<CarEventDTO> carEventDTOIPage = carEventJoinMapper.selectJoinPage(page, CarEventDTO.class, queryWrapper);
        if(null != carEventDTOIPage && carEventDTOIPage.getRecords().size() > 0) {
            carEventDTOIPage.setRecords(newCarEventDTO(carEventDTOIPage.getRecords()));
        }
        return PageData.from(carEventDTOIPage);
    }
    private List<CarEventDTO> newCarEventDTO(List<CarEventDTO> newCarEventDTOList) {
            List<String> codes = Arrays.asList(Constants.FTP_RESOURCE_PATH,Constants.CAR_EVENT_IMG);
            List<SystemDictData> list = systemDictDataMapper.list(codes);
            Map<String,SystemDictData> dataMap = list.stream().collect(Collectors.toMap(SystemDictData::getLabel, Function.identity()));
            carEventDTOIPage.getRecords().stream().forEach(obj->{
        List<CarEventDTO> newDataList = new ArrayList<>();
        newCarEventDTOList.stream().forEach(obj->{
                obj.setVehiclePicUrl(dataMap.get(Constants.FTP_RESOURCE_PATH).getCode()
                        +dataMap.get(Constants.CAR_EVENT_IMG).getCode()
                        +obj.getVehiclePicUrl());
@@ -336,8 +342,8 @@
                }else{
                    obj.setEventTypeName(HKConstants.EventTypes.PARK_PASS_OUT.getName());
                }
            newDataList.add(obj);
            });
        }
        return PageData.from(carEventDTOIPage);
        return newDataList;
    }
}