| | |
| | | import cn.hutool.core.util.ReUtil; |
| | | 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.DeviceEventQuery; |
| | | import com.doumee.dao.admin.response.DeviceEventDTO; |
| | |
| | | import com.doumee.dao.business.model.Company; |
| | | import com.doumee.dao.business.model.DeviceEvent; |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.dao.system.SystemDictDataMapper; |
| | | import com.doumee.dao.system.model.SystemDictData; |
| | | import com.doumee.dao.system.vo.SystemDictDataListVO; |
| | | import com.doumee.service.business.DeviceEventService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.sun.org.apache.xerces.internal.xs.StringList; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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 DeviceEventJoinMapper deviceEventJoinMapper; |
| | | |
| | | @Autowired |
| | | private SystemDictDataMapper systemDictDataMapper; |
| | | |
| | | @Override |
| | | public Integer create(DeviceEvent deviceEvent) { |
| | |
| | | pageWrap.getModel().getEndTime()); |
| | | queryWrapper.orderByDesc(DeviceEvent::getHappenTime); |
| | | IPage<DeviceEventDTO> deviceEventDTOIPage = deviceEventJoinMapper.selectJoinPage(page, DeviceEventDTO.class, queryWrapper); |
| | | if(null != deviceEventDTOIPage && deviceEventDTOIPage.getRecords().size() > 0) { |
| | | deviceEventDTOIPage.setRecords(newDeviceEvent(deviceEventDTOIPage.getRecords())); |
| | | } |
| | | return PageData.from(deviceEventDTOIPage); |
| | | } |
| | | |
| | | // 对图片进行判断处理 |
| | | private List<DeviceEventDTO> newDeviceEvent(List<DeviceEventDTO> DeviceEventDTOList) { |
| | | List<DeviceEventDTO> newDeviceEventDTOS = new ArrayList<>(); |
| | | for (DeviceEventDTO dto:DeviceEventDTOList) { |
| | | if(StringUtils.isNotBlank(dto.getExtEventPictureURL())) { |
| | | String extEventPictureURL = dto.getExtEventPictureURL(); |
| | | // 使用split("/")将URL按照"/"进行分割成多个部分 |
| | | String[] parts = extEventPictureURL.split("\\\\"); |
| | | String newStr = parts[0]; |
| | | boolean number = Validator.isNumber(newStr); |
| | | if(number) { |
| | | List<String> codes = Arrays.asList(Constants.FTP_RESOURCE_PATH,Constants.DEVICE_EVENT_IMG); |
| | | List<SystemDictData> list = systemDictDataMapper.list(codes); |
| | | if(null != list && list.size() > 0) { |
| | | Map<String,SystemDictData> dataMap = list.stream().collect(Collectors.toMap(SystemDictData::getLabel, Function.identity())); |
| | | dto.setExtEventPictureURL(dataMap.get(Constants.FTP_RESOURCE_PATH).getCode() |
| | | +dataMap.get(Constants.DEVICE_EVENT_IMG).getCode() |
| | | +dto.getExtEventPictureURL()); |
| | | } |
| | | }else { |
| | | dto.setExtEventPictureURL(null); |
| | | } |
| | | } |
| | | newDeviceEventDTOS.add(dto); |
| | | } |
| | | return newDeviceEventDTOS; |
| | | } |
| | | } |