# ShiftDigitalCheckInServiceImpl.java

    package cloud.wconnect.frontoffice.service.endofshift.impl;

    import cloud.wconnect.commonlib.cons.BaseErrorCodeEnum;
    import cloud.wconnect.commonlib.cons.CommonErrorI18nConstant;
    import cloud.wconnect.commonlib.exception.BadRequestException;
    import cloud.wconnect.commonlib.exception.ForbiddenException;
    import cloud.wconnect.frontoffice.entity.endofshift.ShiftDigitalCheckIn;
    import cloud.wconnect.frontoffice.mapper.endofshift.ShiftDigitalCheckInMapper;
    import cloud.wconnect.frontoffice.service.endofshift.IShiftDigitalCheckInService;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
    import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
    import org.springframework.stereotype.Service;

    import java.text.MessageFormat;
    import java.util.List;
    import java.util.Objects;

    /**
     * <p>
     * 服务实现类
     * </p>
     *
     * @author lichen
     * @since 2023-03-07
     */
    @Service
    @DS("ratelog_manage")
    public class ShiftDigitalCheckInServiceImpl extends ServiceImpl<ShiftDigitalCheckInMapper, ShiftDigitalCheckIn> implements IShiftDigitalCheckInService {

        /**
         * 校验Digital Check-in是否存在且属于资产
         *
         * @param id         checkIn 主键id
         * @param propertyId 资产id
         * @return void
         * @author lichen
         * @date 2023/5/12
         */
        @Override
        public ShiftDigitalCheckIn checkIsExistAndAffiliation(Integer id, Integer propertyId) {
            //查询Digital Check-in
            ShiftDigitalCheckIn oriShiftDigitalCheckIn = getById(id);
            //校验是否存在
            if (Objects.isNull(oriShiftDigitalCheckIn)) {
                throw new BadRequestException(CommonErrorI18nConstant.DATA_NOT_FOUND,
                        BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(), "The Digital Check-in does not exist");
            }
            //校验是否属于资产
            if (!oriShiftDigitalCheckIn.getPropertyId().equals(propertyId)) {
                throw new ForbiddenException(BaseErrorCodeEnum.DATA_FORBIDDEN.getI18nCode(),
                        BaseErrorCodeEnum.DATA_FORBIDDEN.getCode(),
                        MessageFormat.format("The Digital Check-in is not affiliation to propertyId:{0}; Digital Check-in propertyId:{1}",
                                propertyId, oriShiftDigitalCheckIn.getPropertyId()));
            }
            return oriShiftDigitalCheckIn;
        }

        /**
         * 查询指定排班的Digital Check-in信息
         *
         * @param shiftId 排班id
         * @return java.util.List<cloud.wconnect.frontoffice.entity.endofshift.ShiftDigitalCheckIn>
         * @author lichen
         * @date 2025/6/20
         */
        @Override
        public List<ShiftDigitalCheckIn> listByShiftId(Integer shiftId) {
            return list(new LambdaQueryWrapper<ShiftDigitalCheckIn>().eq(ShiftDigitalCheckIn::getShiftId, shiftId));
        }
    }