| | |
| | | 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.DeviceEventDTO; |
| | | import com.doumee.dao.admin.response.VisitEventDTO; |
| | | import com.doumee.dao.business.VisitEventMapper; |
| | | import com.doumee.dao.business.join.VisitEventJoinMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.system.SystemDictDataMapper; |
| | | import com.doumee.dao.system.model.SystemDictData; |
| | | import com.doumee.service.business.VisitEventService; |
| | | 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 VisitEventJoinMapper visitEventJoinMapper; |
| | | |
| | | @Autowired |
| | | private SystemDictDataMapper systemDictDataMapper; |
| | | |
| | | @Override |
| | | public Integer create(VisitEvent visitEvent) { |
| | |
| | | |
| | | IPage<VisitEvent> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | MPJLambdaWrapper<VisitEvent> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper .leftJoin(Company.class,Company::getId,Member::getCompanyId); |
| | | queryWrapper .leftJoin(Visits.class,Visits::getHkId,VisitEvent::getVisitorId); |
| | | queryWrapper.selectAll(VisitEvent.class) |
| | | .selectAs(Company::getName,VisitEventDTO::getPersonCompanyName); |
| | | .selectAs(Visits::getCompanyName,VisitEventDTO::getPersonCompanyName); |
| | | queryWrapper.like(number, |
| | | VisitEvent::getPhone, |
| | | pageWrap.getModel().getKeyWords()) |
| | |
| | | pageWrap.getModel().getEndTime()); |
| | | queryWrapper.orderByDesc(VisitEvent::getHappenTime); |
| | | IPage<VisitEventDTO> visitEventDTOIPage = visitEventJoinMapper.selectJoinPage(page, VisitEventDTO.class, queryWrapper); |
| | | if(null != visitEventDTOIPage && visitEventDTOIPage.getRecords().size() > 0) { |
| | | visitEventDTOIPage.setRecords(newVisitEvent(visitEventDTOIPage.getRecords())); |
| | | } |
| | | return PageData.from(visitEventDTOIPage); |
| | | } |
| | | |
| | | |
| | | private List<VisitEventDTO> newVisitEvent(List<VisitEventDTO> VisitEventDTOList) { |
| | | List<String> codes = Arrays.asList(Constants.FTP_RESOURCE_PATH,Constants.MEMBER_IMG); |
| | | List<SystemDictData> list = systemDictDataMapper.list(codes); |
| | | Map<String,SystemDictData> dataMap = list.stream().collect(Collectors.toMap(SystemDictData::getLabel, Function.identity())); |
| | | List<VisitEventDTO> newDataList = new ArrayList<>(); |
| | | VisitEventDTOList.stream().forEach(obj->{ |
| | | obj.setCaptureUrl(dataMap.get(Constants.FTP_RESOURCE_PATH).getCode() |
| | | +dataMap.get(Constants.MEMBER_IMG).getCode() |
| | | +obj.getCaptureUrl()); |
| | | if(Constants.formatIntegerNum(obj.getEventType()) == HKConstants.EventTypes.VISIT_SIGN_IN.getKey()){ |
| | | obj.setEventTypeName(HKConstants.EventTypes.VISIT_SIGN_IN.getName()); |
| | | }else if(Constants.formatIntegerNum(obj.getEventType()) == HKConstants.EventTypes.VISIT_SIGN_OUT.getKey()){ |
| | | obj.setEventTypeName(HKConstants.EventTypes.VISIT_SIGN_OUT.getName()); |
| | | } |
| | | newDataList.add(obj); |
| | | }); |
| | | return newDataList; |
| | | } |
| | | } |