# EndOfShiftController.java

    package cloud.wconnect.frontoffice.controller.endofshift;

    import cloud.wconnect.commonlib.annotation.ApiId;
    import cloud.wconnect.commonlib.component.SessionContext;
    import cloud.wconnect.commonlib.cons.BaseConstant;
    import cloud.wconnect.commonlib.cons.BaseErrorCodeEnum;
    import cloud.wconnect.commonlib.cons.CommonErrorI18nConstant;
    import cloud.wconnect.commonlib.cons.CommonFieldI18nConstant;
    import cloud.wconnect.commonlib.exception.BadRequestException;
    import cloud.wconnect.commonlib.pojo.dto.ListPagedDTO;
    import cloud.wconnect.commonlib.pojo.dto.PropertyDTO;
    import cloud.wconnect.commonlib.redis.PropertyI18nRedisService;
    import cloud.wconnect.commonlib.util.DateTimeUtils;
    import cloud.wconnect.commonlib.util.I18nMessageUtils;
    import cloud.wconnect.commonlib.util.JsonUtils;
    import cloud.wconnect.frontoffice.cons.endofshift.EndOfShiftAreaEnum;
    import cloud.wconnect.frontoffice.entity.endofshift.EosShiftConfig;
    import cloud.wconnect.frontoffice.entity.endofshift.ShiftReportInfo;
    import cloud.wconnect.frontoffice.pojo.dto.EosShiftDetailDTO;
    import cloud.wconnect.frontoffice.pojo.dto.endofshift.*;
    import cloud.wconnect.frontoffice.pojo.dto.endofshift.detail.ShiftReportDetailDTO;
    import cloud.wconnect.frontoffice.pojo.query.ShiftQuery;
    import cloud.wconnect.frontoffice.service.endofshift.IEndOfShiftService;
    import cloud.wconnect.frontoffice.service.endofshift.IEosShiftConfigService;
    import cloud.wconnect.frontoffice.service.endofshift.IShiftOperationRecordService;
    import cloud.wconnect.frontoffice.service.endofshift.IShiftReportInfoService;
    import cloud.wconnect.frontoffice.service.endofshift.area.IEosDelete;
    import cloud.wconnect.frontoffice.service.endofshift.area.IEosSave;
    import cloud.wconnect.frontoffice.service.endofshift.area.IEosSearch;
    import com.fasterxml.jackson.databind.ObjectMapper;
    import com.google.common.collect.Lists;
    import jakarta.validation.Valid;
    import org.apache.commons.lang3.StringUtils;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.context.ApplicationContext;
    import org.springframework.web.bind.annotation.*;

    import java.util.*;
    import java.util.function.Function;
    import java.util.stream.Collectors;

    /**
     * end of shift controller
     */
    @RestController
    @RequestMapping("/end-of-shift")
    public class EndOfShiftController {

        @Autowired
        private IEndOfShiftService shiftReportService;
        @Autowired
        private SessionContext sessionContext;
        @Autowired
        private IEosShiftConfigService shiftConfigService;
        @Autowired
        private ApplicationContext applicationContext;
        @Autowired
        private PropertyI18nRedisService propertyI18nRedisService;
        @Autowired
        private IShiftOperationRecordService shiftOperationRecordService;
        @Autowired
        private IShiftReportInfoService shiftReportInfoService;
        @Autowired
        private ObjectMapper objectMapper;
        @Autowired
        private I18nMessageUtils i18nMessageUtils;

        /**
         * 查询班表详细信息
         *
         * @param property     资产标识
         * @param endOfShiftId 排班id
         * @return cloud.wconnect.frontoffice.pojo.dto.endofshift.detail.ShiftReportDetailDTO
         * @author lichen
         * @date 2025/6/19
         */
        @ApiId(68)
        @GetMapping("/detail/{endOfShiftId:\\d+}")
        public ShiftReportDetailDTO getShiftReport(@RequestParam String property, @PathVariable Integer endOfShiftId) {
            int propertyId = sessionContext.getPropertyId(property);
            //校验排班是否存在
            ShiftReportInfo shiftReportInfo = shiftReportInfoService.checkExist(endOfShiftId);
            //校验是否归属于当前资产
            shiftReportInfoService.checkBelong(propertyId, shiftReportInfo);
            //查询排班详情
            return shiftReportService.getShiftReportInfoDetail(propertyId, shiftReportInfo);
        }

        /**
         * 编辑班表的info sheet内容
         *
         * @param property          资产标识
         * @param endOfShiftId      排班id
         * @param shiftInfoSheetDTO info sheet 信息
         * @return java.util.Map<java.lang.String, java.lang.String>
         * @author lichen
         * @date 2025/6/19
         */
        @ApiId(69)
        @PostMapping("/{endOfShiftId:\\d+}/info-sheet")
        public Map<String, String> editInfoSheet(String property, @PathVariable Integer endOfShiftId,
                                                 @Valid @RequestBody ShiftInfoSheetDTO shiftInfoSheetDTO) {
            int propertyId = sessionContext.getPropertyId(property);
            //校验排班基础信息是否存在
            ShiftReportInfo shiftReportInfo = shiftReportInfoService.checkExist(endOfShiftId);
            //校验是否归属于当前资产
            shiftReportInfoService.checkBelong(propertyId, shiftReportInfo);

            Collection<IEosSave> values = applicationContext.getBeansOfType(IEosSave.class).values();
            for (IEosSave service : values) {
                if (service.support(EndOfShiftAreaEnum.INFO_SHEET.getAreaId())) {
                    service.save(propertyId, shiftReportInfo, shiftInfoSheetDTO, sessionContext.getLoginUserId());
                    break;
                }
            }
            return Collections.emptyMap();
        }

        /**
         * 编辑Incidents / Property issues内容
         *
         * @param property                        资产标识
         * @param endOfShiftId                    排班id
         * @param shiftIncidentsPropertyIssuesDTO Incidents / Property issues数据
         * @return cloud.wconnect.frontoffice.pojo.dto.endofshift.ShiftResultDTO
         * @author lichen
         * @date 2025/6/19
         */
        @ApiId(80)
        @PostMapping("/{endOfShiftId:\\d+}/issues")
        public Map<String, String> editIncidentsPropertyIssues(String property, @PathVariable Integer endOfShiftId,
                                                               @RequestBody ShiftIncidentsPropertyIssuesDTO shiftIncidentsPropertyIssuesDTO) {
            int propertyId = sessionContext.getPropertyId(property);
            //校验排班基础信息是否存在
            ShiftReportInfo shiftReportInfo = shiftReportInfoService.checkExist(endOfShiftId);
            //校验是否归属于当前资产
            shiftReportInfoService.checkBelong(propertyId, shiftReportInfo);

            Collection<IEosSave> values = applicationContext.getBeansOfType(IEosSave.class).values();
            for (IEosSave service : values) {
                if (service.support(EndOfShiftAreaEnum.INCIDENTS_PROPERTY_ISSUES.getAreaId())) {
                    service.save(propertyId, shiftReportInfo, shiftIncidentsPropertyIssuesDTO, sessionContext.getLoginUserId());
                    break;
                }
            }
            return Collections.emptyMap();
        }

        /**
         * 编辑Enrollment total内容
         *
         * @param property                资产标识
         * @param endOfShiftId            排班id
         * @param shiftEnrollmentTotalDTO Enrollment total内容
         * @return java.util.Map<java.lang.String, java.lang.String>
         * @author lichen
         * @date 2025/6/19
         */
        @ApiId(71)
        @PostMapping("/{endOfShiftId:\\d+}/enrollment")
        public Map<String, String> editEnrollmentTotal(String property, @PathVariable Integer endOfShiftId,
                                                       @Valid @RequestBody ShiftEnrollmentTotalDTO shiftEnrollmentTotalDTO) {
            int propertyId = sessionContext.getPropertyId(property);
            //校验排班基础信息是否存在
            ShiftReportInfo shiftReportInfo = shiftReportInfoService.checkExist(endOfShiftId);
            //校验是否归属于当前资产
            shiftReportInfoService.checkBelong(propertyId, shiftReportInfo);

            Collection<IEosSave> values = applicationContext.getBeansOfType(IEosSave.class).values();
            for (IEosSave service : values) {
                if (service.support(EndOfShiftAreaEnum.ENROLLMENT_TOTAL.getAreaId())) {
                    service.save(propertyId, shiftReportInfo, shiftEnrollmentTotalDTO, sessionContext.getLoginUserId());
                    break;
                }
            }
            return Collections.emptyMap();
        }

        /**
         * 编辑Sales resume: Group / Corp Guest / Banquet / Event / VIP内容
         *
         * @param property            资产标识
         * @param endOfShiftId        排班id
         * @param shiftSalesResumeDTO Sales resume: Group / Corp Guest / Banquet / Event / VIP内容
         * @return java.util.Map<java.lang.String, java.lang.String>
         * @author lichen
         * @date 2025/6/19
         */
        @ApiId(72)
        @PostMapping("/{endOfShiftId:\\d+}/resume")
        public Map<String, String> editSalesResume(String property, @PathVariable Integer endOfShiftId,
                                                   @Valid @RequestBody ShiftSalesResumeDTO shiftSalesResumeDTO) {
            int propertyId = sessionContext.getPropertyId(property);
            //校验排班基础信息是否存在
            ShiftReportInfo shiftReportInfo = shiftReportInfoService.checkExist(endOfShiftId);
            //校验是否归属于当前资产
            shiftReportInfoService.checkBelong(propertyId, shiftReportInfo);

            Collection<IEosSave> values = applicationContext.getBeansOfType(IEosSave.class).values();
            for (IEosSave service : values) {
                if (service.support(EndOfShiftAreaEnum.SALES_RESUME.getAreaId())) {
                    service.save(propertyId, shiftReportInfo, shiftSalesResumeDTO, sessionContext.getLoginUserId());
                    break;
                }
            }
            return Collections.emptyMap();
        }

        /**
         * 编辑Pass on 内容
         *
         * @param property       资产标识
         * @param endOfShiftId   排班id
         * @param shiftPassOnDTO Pass on 内容
         * @return java.util.Map<java.lang.String, java.lang.String>
         * @author lichen
         * @date 2025/6/19
         */
        @ApiId(70)
        @PostMapping("/{endOfShiftId:\\d+}/pass-on")
        public Map<String, String> editShiftPassOn(String property, @PathVariable Integer endOfShiftId,
                                                   @Valid @RequestBody ShiftPassOnDTO shiftPassOnDTO) {
            int propertyId = sessionContext.getPropertyId(property);
            //校验排班基础信息是否存在
            ShiftReportInfo shiftReportInfo = shiftReportInfoService.checkExist(endOfShiftId);
            //校验是否归属于当前资产
            shiftReportInfoService.checkBelong(propertyId, shiftReportInfo);

            Collection<IEosSave> values = applicationContext.getBeansOfType(IEosSave.class).values();
            for (IEosSave service : values) {
                if (service.support(EndOfShiftAreaEnum.PASS_ON.getAreaId())) {
                    service.save(propertyId, shiftReportInfo, shiftPassOnDTO, sessionContext.getLoginUserId());
                    break;
                }
            }
            return Collections.emptyMap();
        }

        /**
         * 编辑Digital check-in内容
         *
         * @param property               资产标识
         * @param endOfShiftId           排班id
         * @param shiftDigitalCheckInDTO Digital check-in内容
         * @return java.util.Map<java.lang.String, java.lang.String>
         * @author lichen
         * @date 2025/6/19
         */
        @ApiId(73)
        @PostMapping("/{endOfShiftId:\\d+}/digital-check-in")
        public Map<String, String> saveDigitalCheckIn(String property, @PathVariable Integer endOfShiftId,
                                                      @Valid @RequestBody ShiftDigitalCheckInDTO shiftDigitalCheckInDTO) {
            int propertyId = sessionContext.getPropertyId(property);
            //校验排班基础信息是否存在
            ShiftReportInfo shiftReportInfo = shiftReportInfoService.checkExist(endOfShiftId);
            //校验是否归属于当前资产
            shiftReportInfoService.checkBelong(propertyId, shiftReportInfo);

            Collection<IEosSave> values = applicationContext.getBeansOfType(IEosSave.class).values();
            for (IEosSave service : values) {
                if (service.support(EndOfShiftAreaEnum.DIGITAL_CHECK_IN.getAreaId())) {
                    service.save(propertyId, shiftReportInfo, shiftDigitalCheckInDTO, sessionContext.getLoginUserId());
                    break;
                }
            }
            return Collections.emptyMap();
        }

        /**
         * 删除Digital check in
         *
         * @param property     资产标识
         * @param endOfShiftId 排班id
         * @param id           Digital check in数据id
         * @return java.util.Map
         * @author lichen
         * @date 2025/6/19
         */
        @ApiId(74)
        @DeleteMapping("/{endOfShiftId:\\d+}/digital-check-in/{id:\\d+}")
        public Map<String, String> removeDigitalCheckIn(String property, @PathVariable Integer endOfShiftId, @PathVariable int id) {
            int propertyId = sessionContext.getPropertyId(property);
            //校验排班基础信息是否存在
            ShiftReportInfo shiftReportInfo = shiftReportInfoService.checkExist(endOfShiftId);
            //校验是否归属于当前资产
            shiftReportInfoService.checkBelong(propertyId, shiftReportInfo);

            Collection<IEosDelete> values = applicationContext.getBeansOfType(IEosDelete.class).values();
            for (IEosDelete service : values) {
                if (service.support(EndOfShiftAreaEnum.DIGITAL_CHECK_IN.getAreaId())) {
                    service.delete(propertyId, shiftReportInfo, id);
                    break;
                }
            }
            return Collections.emptyMap();
        }

        /**
         * 保存Guest complaint内容
         *
         * @param property               资产标识
         * @param endOfShiftId           排班id
         * @param shiftGuestComplaintDTO Guest complaint内容
         * @return java.util.Map<java.lang.String, java.lang.String>
         * @author lichen
         * @date 2025/6/19
         */
        @ApiId(75)
        @PostMapping("/{endOfShiftId:\\d+}/guest-complaint")
        public Map<String, String> saveGuestComplaint(String property, @PathVariable Integer endOfShiftId,
                                                      @Valid @RequestBody ShiftGuestComplaintDTO shiftGuestComplaintDTO) {
            int propertyId = sessionContext.getPropertyId(property);
            //校验排班基础信息是否存在
            ShiftReportInfo shiftReportInfo = shiftReportInfoService.checkExist(endOfShiftId);
            //校验是否归属于当前资产
            shiftReportInfoService.checkBelong(propertyId, shiftReportInfo);

            Collection<IEosSave> values = applicationContext.getBeansOfType(IEosSave.class).values();
            for (IEosSave service : values) {
                if (service.support(EndOfShiftAreaEnum.GUEST_COMPLAINT.getAreaId())) {
                    service.save(propertyId, shiftReportInfo, shiftGuestComplaintDTO, sessionContext.getLoginUserId());
                    break;
                }
            }
            return Collections.emptyMap();
        }

        /**
         * 删除Guest complaint内容
         *
         * @param property     资产标识
         * @param endOfShiftId 排班id
         * @param id           Guest complaint内容id
         * @return java.util.Map
         * @author lichen
         * @date 2025/6/19
         */
        @ApiId(76)
        @DeleteMapping("/{endOfShiftId:\\d+}/guest-complaint/{id:\\d+}")
        public Map<String, String> removeGuestComplaint(String property, @PathVariable Integer endOfShiftId, @PathVariable int id) {
            int propertyId = sessionContext.getPropertyId(property);
            //校验排班基础信息是否存在
            ShiftReportInfo shiftReportInfo = shiftReportInfoService.checkExist(endOfShiftId);
            //校验是否归属于当前资产
            shiftReportInfoService.checkBelong(propertyId, shiftReportInfo);

            Collection<IEosDelete> values = applicationContext.getBeansOfType(IEosDelete.class).values();
            for (IEosDelete service : values) {
                if (service.support(EndOfShiftAreaEnum.GUEST_COMPLAINT.getAreaId())) {
                    service.delete(propertyId, shiftReportInfo, id);
                    break;
                }
            }
            return Collections.emptyMap();
        }

        /**
         * 保存Wake up call内容
         *
         * @param property           资产标识
         * @param endOfShiftId       排班id
         * @param shiftWakeupCallDTO Wake up call内容
         * @return java.util.Map<java.lang.String, java.lang.String>
         * @author lichen
         * @date 2025/6/19
         */
        @ApiId(77)
        @PostMapping("/{endOfShiftId:\\d+}/wake-up-call")
        public Map<String, String> saveWakeUpCall(String property, @PathVariable Integer endOfShiftId,
                                                  @RequestBody ShiftWakeupCallDTO shiftWakeupCallDTO) {
            int propertyId = sessionContext.getPropertyId(property);
            //校验排班基础信息是否存在
            ShiftReportInfo shiftReportInfo = shiftReportInfoService.checkExist(endOfShiftId);
            //校验是否归属于当前资产
            shiftReportInfoService.checkBelong(propertyId, shiftReportInfo);

            Collection<IEosSave> values = applicationContext.getBeansOfType(IEosSave.class).values();
            for (IEosSave service : values) {
                if (service.support(EndOfShiftAreaEnum.WAKE_UP_CALL.getAreaId())) {
                    service.save(propertyId, shiftReportInfo, shiftWakeupCallDTO, sessionContext.getLoginUserId());
                    break;
                }
            }
            return Collections.emptyMap();
        }

        /**
         * 删除Wake up call内容
         *
         * @param property     资产标识
         * @param endOfShiftId 排班id
         * @param id           Wake up call内容id
         * @return java.util.Map
         * @author lichen
         * @date 2025/6/19
         */
        @ApiId(79)
        @DeleteMapping("/{endOfShiftId:\\d+}/wake-up-call/{id:\\d+}")
        public Map<String, String> removeWakeUpCall(String property, @PathVariable Integer endOfShiftId, @PathVariable int id) {
            int propertyId = sessionContext.getPropertyId(property);
            //校验排班基础信息是否存在
            ShiftReportInfo shiftReportInfo = shiftReportInfoService.checkExist(endOfShiftId);
            //校验是否归属于当前资产
            shiftReportInfoService.checkBelong(propertyId, shiftReportInfo);

            Collection<IEosDelete> values = applicationContext.getBeansOfType(IEosDelete.class).values();
            for (IEosDelete service : values) {
                if (service.support(EndOfShiftAreaEnum.WAKE_UP_CALL.getAreaId())) {
                    service.delete(propertyId, shiftReportInfo, id);
                    break;
                }
            }
            return Collections.emptyMap();
        }

        /**
         * 根据关键字检索排班信息
         *
         * @param property   资产标识
         * @param shiftQuery 查询条件
         * @return cloud.wconnect.commonlib.pojo.dto.ListPagedDTO<cloud.wconnect.frontoffice.pojo.dto.endofshift.ShiftInfoDTO>
         * @author lichen
         * @date 2025/6/19
         */
        @ApiId(82)
        @GetMapping("/search")
        public ListPagedDTO<ShiftInfoDTO> searchList(String property, @Valid ShiftQuery shiftQuery) {
            if (StringUtils.isBlank(shiftQuery.getKeyword())) {
                return new ListPagedDTO<>();
            }

            //支持查询的区域集合
            ArrayList<Integer> typeList = Lists.newArrayList(EndOfShiftAreaEnum.PASS_ON.getAreaId(), EndOfShiftAreaEnum.INCIDENTS_PROPERTY_ISSUES.getAreaId(),
                    EndOfShiftAreaEnum.DIGITAL_CHECK_IN.getAreaId(), EndOfShiftAreaEnum.SALES_RESUME.getAreaId(), EndOfShiftAreaEnum.GUEST_COMPLAINT.getAreaId());
            if (!typeList.contains(shiftQuery.getType())) {
                throw new BadRequestException(CommonErrorI18nConstant.MUST_IN_LIST,
                        i18nMessageUtils.getErrorParamMapNotNeedTranslate("type", typeList),
                        BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                        "The type must between in [2-Incidents/Property Issues 4-Sales Resume 5-Pass On 6-Digital Check-in 7-Guest Complaint], type:" + shiftQuery.getType());
            }

            int propertyId = sessionContext.getPropertyId(property);

            //查询数据
            ListPagedDTO<ShiftInfoDTO> shiftInfoDTOListPagedDTO = new ListPagedDTO<>();
            Collection<IEosSearch> values = applicationContext.getBeansOfType(IEosSearch.class).values();
            for (IEosSearch service : values) {
                if (service.support(shiftQuery.getType())) {
                    shiftInfoDTOListPagedDTO = service.searchList(propertyId, shiftQuery);
                    break;
                }
            }

            long total = shiftInfoDTOListPagedDTO.getTotal();
            if (total == 0) return shiftInfoDTOListPagedDTO;

            List<ShiftInfoDTO> shiftInfoDTS = shiftInfoDTOListPagedDTO.getList();
            //排班配置id
            List<Integer> shiftConfigId = shiftInfoDTS.stream().map(ShiftInfoDTO::getShiftConfigId).toList();
            Map<Integer, EosShiftConfig> shiftConfigId2ShiftConfig = shiftConfigService.listByIds(shiftConfigId).stream().collect(Collectors.toMap(EosShiftConfig::getId, Function.identity()));

            //填充班次名称、班次时间
            for (ShiftInfoDTO shiftInfoDTO : shiftInfoDTS) {
                //获取对应的排班配置
                EosShiftConfig shiftConfig = shiftConfigId2ShiftConfig.get(shiftInfoDTO.getShiftConfigId());
                //获取排班配置的班次详情集合
                Map<Integer, EosShiftDetailDTO> shift2ShiftDetailDTO = JsonUtils.convertStringToList(objectMapper, shiftConfig.getShiftConfig(), EosShiftDetailDTO.class)
                        .stream().collect(Collectors.toMap(EosShiftDetailDTO::getShift, Function.identity()));
                //获取当前排班数据的班次详情
                EosShiftDetailDTO shiftDetailDTO = shift2ShiftDetailDTO.get(shiftInfoDTO.getShift());
                shiftInfoDTO.setShiftName(shiftDetailDTO.getShiftName());
                shiftInfoDTO.setStartTime(shiftDetailDTO.getStartTime());
                shiftInfoDTO.setEndTime(shiftDetailDTO.getEndTime());
            }

            return shiftInfoDTOListPagedDTO;
        }

        /**
         * 发送排班信息通知
         *
         * @param property     资产标识
         * @param endOfShiftId 排班id
         * @return java.util.Map<java.lang.String, java.lang.String>
         * @author lichen
         * @date 2025/6/20
         */
        @ApiId(81)
        @PostMapping("/{endOfShiftId:\\d+}/send")
        public Map<String, String> sendNotify(String property, @PathVariable Integer endOfShiftId) {
            int propertyId = sessionContext.getPropertyId(property);
            //校验排班基础信息是否存在
            ShiftReportInfo shiftReportInfo = shiftReportInfoService.checkExist(endOfShiftId);
            //校验是否归属于当前资产
            shiftReportInfoService.checkBelong(propertyId, shiftReportInfo);
            //获取资产DTO
            PropertyDTO propertyDTO = propertyI18nRedisService.get(propertyId);
            //发送通知
            shiftReportService.sendNotify(propertyDTO, shiftReportInfo, sessionContext.getLoginUserId());
            return Collections.emptyMap();
        }

        /**
         * 查询操作日志
         *
         * @param property     资产标识
         * @param endOfShiftId 排班id
         * @param type
         * @return java.util.List<cloud.wconnect.frontoffice.pojo.dto.endofshift.ShiftOperationRecordDTO>
         * @author lichen
         * @date 2025/6/20
         */
        @ApiId(1533)
        @GetMapping("/{endOfShiftId:\\d+}/{type:\\d+}/log")
        public List<ShiftOperationRecordDTO> listLogs(String property, @PathVariable Integer endOfShiftId, @PathVariable Integer type) {
            //支持查询的区域集合
            ArrayList<Integer> typeList = Lists.newArrayList(EndOfShiftAreaEnum.INFO_SHEET.getAreaId(), EndOfShiftAreaEnum.INCIDENTS_PROPERTY_ISSUES.getAreaId(),
                    EndOfShiftAreaEnum.ENROLLMENT_TOTAL.getAreaId(), EndOfShiftAreaEnum.SALES_RESUME.getAreaId(), EndOfShiftAreaEnum.PASS_ON.getAreaId());
            if (!typeList.contains(type)) {
                throw new BadRequestException(CommonErrorI18nConstant.MUST_IN_LIST,
                        i18nMessageUtils.getErrorParamMapNotNeedTranslate("type", typeList),
                        BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                        "The type must between in [1:Info sheet 2:Incidents/Property Issues 3:Enrollment total 4:Sales Resume 5:Pass On], type:" + type);
            }

            int propertyId = sessionContext.getPropertyId(property);
            Integer tenantId = sessionContext.getTenantSymbolBO().getId();
            //校验排班基础信息是否存在
            ShiftReportInfo shiftReportInfo = shiftReportInfoService.checkExist(endOfShiftId);
            //校验是否归属于当前资产
            shiftReportInfoService.checkBelong(propertyId, shiftReportInfo);
            //查询指定区域操作日志
            return shiftOperationRecordService.list(tenantId, propertyId, shiftReportInfo.getId(), type);
        }

        /**
         * 查询指定日期的排班列表
         *
         * @param property   资产标识
         * @param targetDate 目标日期（yyyyMMdd）
         * @return java.util.List<cloud.wconnect.frontoffice.pojo.dto.endofshift.ShiftInfoDTO>
         * @author lichen
         * @date 2025/6/23
         */
        @ApiId(1534)
        @GetMapping("/{targetDate:\\d+}")
        public List<ShiftInfoDTO> list(String property, @PathVariable int targetDate) {
            int propertyId = sessionContext.getPropertyId(property);

            //校验日期格式是否正确
            try {
                DateTimeUtils.strToLocalDate(String.valueOf(targetDate), BaseConstant.DATE_FORMAT_YYYYMMDD);
            } catch (Exception e) {
                LinkedHashMap<String, Boolean> map = new LinkedHashMap<>();
                map.put(CommonFieldI18nConstant.DATE, true);
                map.put(BaseConstant.DATE_FORMAT_YYYYMMDD, false);
                throw new BadRequestException(CommonErrorI18nConstant.FORMAT_INCORRECT,
                        i18nMessageUtils.getErrorParamMap(map),
                        BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(), "The date format is incorrect");
            }

            //校验目标日期的排班配置是否存在
            EosShiftConfig shiftConfig = shiftConfigService.checkTargetDateShiftConfigExist(propertyId, targetDate);
            //查询目标日期的排班列表
            return shiftReportInfoService.listByTargetDate(propertyId, targetDate, shiftConfig);
        }

    }