| | |
| | | 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.*; |
| | |
| | | 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; |
| | | |
| | |
| | | CarEvent::getCreateDate, pageWrap.getModel().getEndTime()); |
| | | IPage<CarEventDTO> carEventDTOIPage = carEventJoinMapper.selectJoinPage(page, CarEventDTO.class, queryWrapper); |
| | | if(null != carEventDTOIPage && carEventDTOIPage.getRecords().size() > 0) { |
| | | 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->{ |
| | | obj.setVehiclePicUrl(dataMap.get(Constants.FTP_RESOURCE_PATH).getCode() |
| | | +dataMap.get(Constants.CAR_EVENT_IMG).getCode() |
| | | +obj.getVehiclePicUrl()); |
| | | if(Constants.formatIntegerNum(obj.getEventType()) == HKConstants.EventTypes.PARK_LINE_IN.getKey()){ |
| | | obj.setEventTypeName(HKConstants.EventTypes.PARK_LINE_IN.getName()); |
| | | }else if(Constants.formatIntegerNum(obj.getEventType()) == HKConstants.EventTypes.PARK_PASS_IN.getKey()){ |
| | | obj.setEventTypeName(HKConstants.EventTypes.PARK_PASS_IN.getName()); |
| | | }else if(Constants.formatIntegerNum(obj.getEventType()) == HKConstants.EventTypes.PARK_LINE_OUT.getKey()){ |
| | | obj.setEventTypeName(HKConstants.EventTypes.PARK_LINE_OUT.getName()); |
| | | }else{ |
| | | obj.setEventTypeName(HKConstants.EventTypes.PARK_PASS_OUT.getName()); |
| | | } |
| | | }); |
| | | 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())); |
| | | 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()); |
| | | if(Constants.formatIntegerNum(obj.getEventType()) == HKConstants.EventTypes.PARK_LINE_IN.getKey()){ |
| | | obj.setEventTypeName(HKConstants.EventTypes.PARK_LINE_IN.getName()); |
| | | }else if(Constants.formatIntegerNum(obj.getEventType()) == HKConstants.EventTypes.PARK_PASS_IN.getKey()){ |
| | | obj.setEventTypeName(HKConstants.EventTypes.PARK_PASS_IN.getName()); |
| | | }else if(Constants.formatIntegerNum(obj.getEventType()) == HKConstants.EventTypes.PARK_LINE_OUT.getKey()){ |
| | | obj.setEventTypeName(HKConstants.EventTypes.PARK_LINE_OUT.getName()); |
| | | }else{ |
| | | obj.setEventTypeName(HKConstants.EventTypes.PARK_PASS_OUT.getName()); |
| | | } |
| | | newDataList.add(obj); |
| | | }); |
| | | return newDataList; |
| | | } |
| | | } |