puzhibing
2026-04-24 6bf04d03aa5376062bc9bb77030f533b3d1b9aa9
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpCruiseCheckInRuleServiceImpl.java
@@ -27,6 +27,8 @@
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;
@@ -64,6 +66,8 @@
    @Resource
    private XpCruiseCheckInRuleOperationsUserMapper xpCruiseCheckInRuleOperationsUserMapper;
    @Override
@@ -314,4 +318,29 @@
        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;
    }
}