| | |
| | | import com.xiaopeng.maintenance.service.IXpCruiseCheckInRecordService; |
| | | import com.xiaopeng.maintenance.service.IXpCruiseCheckInRuleLocationService; |
| | | import com.xiaopeng.maintenance.service.IXpCruiseCheckInRuleService; |
| | | import com.xiaopeng.maintenance.vo.CruiseCheckInLocationVo; |
| | | import com.xiaopeng.maintenance.vo.XpCruiseCheckInRuleInfoVo; |
| | | import com.xiaopeng.maintenance.vo.XpCruiseCheckInRuleListPage; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Resource |
| | | private XpCruiseCheckInRuleOperationsUserMapper xpCruiseCheckInRuleOperationsUserMapper; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | xpCruiseCheckInRuleOperationsUser.setOperationsUserId(relationId); |
| | | xpCruiseCheckInRuleOperationsUserMapper.insert(xpCruiseCheckInRuleOperationsUser); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取打卡规则详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public XpCruiseCheckInRuleInfoVo getXpCruiseCheckInRuleInfo(Integer id) { |
| | | XpCruiseCheckInRuleInfoVo info = new XpCruiseCheckInRuleInfoVo(); |
| | | XpCruiseCheckInRule byId = this.getById(id); |
| | | BeanUtils.copyProperties(byId, info); |
| | | List<XpCruiseCheckInRuleLocation> list = xpCruiseCheckInRuleLocationService.list(new QueryWrapper<XpCruiseCheckInRuleLocation>().eq("cruise_check_in_rule_id", id)); |
| | | List<XpCheckLocation> xpCheckLocations = xpCheckLocationService.listByIds(list.stream().map(XpCruiseCheckInRuleLocation::getCheckLocationId).collect(Collectors.toList())); |
| | | List<CruiseCheckInLocationVo> collect = list.stream().map(locationList -> { |
| | | CruiseCheckInLocationVo vo = new CruiseCheckInLocationVo(); |
| | | vo.setAddress(xpCheckLocations.stream().filter(xpCheckLocation -> xpCheckLocation.getId().equals(locationList.getCheckLocationId())).findFirst().get().getLocationAddress()); |
| | | vo.setCheckRange(xpCheckLocations.stream().filter(xpCheckLocation -> xpCheckLocation.getId().equals(locationList.getCheckLocationId())).findFirst().get().getLocationRange()); |
| | | vo.setCheckTime(StringUtils.isNotEmpty(locationList.getStartTime()) ? locationList.getStartTime() + "~" + locationList.getEndTime() : "不限"); |
| | | return vo; |
| | | |
| | | }).collect(Collectors.toList()); |
| | | info.setLocationList(collect); |
| | | return info; |
| | | } |
| | | } |