| | |
| | | import cn.hutool.core.lang.PatternPool; |
| | | import cn.hutool.core.lang.Validator; |
| | | import cn.hutool.core.util.ReUtil; |
| | | import com.doumee.core.haikang.model.HKConstants; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | 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 com.doumee.dao.system.SystemDictDataMapper; |
| | | import com.doumee.dao.system.model.SystemDictData; |
| | | import com.doumee.service.business.CarEventService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 停车场事件推送记录表Service实现 |
| | |
| | | |
| | | @Autowired |
| | | private CarEventJoinMapper carEventJoinMapper; |
| | | |
| | | @Autowired |
| | | private SystemDictDataMapper systemDictDataMapper; |
| | | |
| | | @Override |
| | | public Integer create(CarEvent carEvent) { |
| | |
| | | //是否包含英文 |
| | | boolean hasWord = ReUtil.contains(PatternPool.WORD, pageWrap.getModel().getKeyWords()); |
| | | |
| | | IPage<VisitEvent> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | IPage<CarEvent> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | MPJLambdaWrapper<CarEvent> queryWrapper = new MPJLambdaWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | |
| | |
| | | .le(Objects.nonNull(pageWrap.getModel().getEndTime()), |
| | | 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())); |
| | | 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; |
| | | } |
| | | } |