# InfoSheetAreaServiceImpl.java

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

    import cloud.wconnect.commonlib.util.DateTimeUtils;
    import cloud.wconnect.frontoffice.cons.endofshift.EndOfShiftAreaEnum;
    import cloud.wconnect.frontoffice.entity.endofshift.ShiftOperationRecord;
    import cloud.wconnect.frontoffice.entity.endofshift.ShiftReportInfo;
    import cloud.wconnect.frontoffice.pojo.dto.endofshift.ShiftInfoSheetDTO;
    import cloud.wconnect.frontoffice.service.endofshift.IShiftOperationRecordService;
    import cloud.wconnect.frontoffice.service.endofshift.IShiftReportInfoService;
    import cloud.wconnect.frontoffice.service.endofshift.area.IEosSave;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    import org.springframework.transaction.annotation.Transactional;

    /**
     * Info sheet 区域service
     *
     * @author lichen
     * @date 2025/6/19
     */
    @Service
    @DS("ratelog_manage")
    public class InfoSheetAreaServiceImpl implements IEosSave {

        /**
         * 区域类型
         */
        public static final int INFO_SHEET = EndOfShiftAreaEnum.INFO_SHEET.getAreaId();
        @Autowired
        private IShiftReportInfoService shiftReportInfoService;
        @Autowired
        private IShiftOperationRecordService shiftOperationRecordService;

        /**
         * 用于判断是否支持子类执行方法
         *
         * @param type 类型
         * @return java.lang.Boolean
         * @author lichen
         * @date 2025/6/19
         */
        @Override
        public boolean support(Integer type) {
            return type == INFO_SHEET;
        }

        /**
         * 保存排班信息（指定资产指定日期指定排班配置）指定区域的数据
         *
         * @param propertyId      属性ID
         * @param shiftReportInfo 排班基础信息
         * @param object          保存的区域对象
         * @param loginUserId     登录用户id
         * @return void
         */
        @Override
        @Transactional(rollbackFor = Exception.class)
        public void save(Integer propertyId, ShiftReportInfo shiftReportInfo, Object object, int loginUserId) {
            int shiftReportInfoId = shiftReportInfo.getId();
            //当前时间
            long operatorTime = DateTimeUtils.nowTimestamp();

            //更新的wrapper
            LambdaUpdateWrapper<ShiftReportInfo> updateWrapper = new LambdaUpdateWrapper<>();
            updateWrapper.eq(ShiftReportInfo::getId, shiftReportInfoId);
            updateWrapper.set(ShiftReportInfo::getOperateUid, loginUserId);
            updateWrapper.set(ShiftReportInfo::getOperateTime, operatorTime);
            updateWrapper.set(ShiftReportInfo::getCanSend, true);

            ShiftInfoSheetDTO shiftInfoSheetDTO = (ShiftInfoSheetDTO) object;
            updateWrapper.set(ShiftReportInfo::getArrivals, shiftInfoSheetDTO.getArrivals())
                    .set(ShiftReportInfo::getDepartures, shiftInfoSheetDTO.getDepartures())
                    .set(ShiftReportInfo::getExpOcc, shiftInfoSheetDTO.getExpOcc())
                    .set(ShiftReportInfo::getCompRooms, shiftInfoSheetDTO.getCompRooms())
                    .set(ShiftReportInfo::getOooRooms, shiftInfoSheetDTO.getOooRooms())
                    .set(ShiftReportInfo::getOosRooms, shiftInfoSheetDTO.getOosRooms())
                    .set(ShiftReportInfo::getVdRooms, shiftInfoSheetDTO.getVdRooms())
                    .set(ShiftReportInfo::getGsr1, shiftInfoSheetDTO.getGsr1())
                    .set(ShiftReportInfo::getGsr2, shiftInfoSheetDTO.getGsr2())
                    .set(ShiftReportInfo::getGsr3, shiftInfoSheetDTO.getGsr3())
                    .set(ShiftReportInfo::getMaintenance, shiftInfoSheetDTO.getMaintenance())
                    .set(ShiftReportInfo::getHouseman, shiftInfoSheetDTO.getHouseman())
                    .set(ShiftReportInfo::getSecurity, shiftInfoSheetDTO.getSecurity())
                    .set(ShiftReportInfo::getGatekeeper, shiftInfoSheetDTO.getGatekeeper())
                    .set(ShiftReportInfo::getDriver1, shiftInfoSheetDTO.getDriver1())
                    .set(ShiftReportInfo::getDriver2, shiftInfoSheetDTO.getDriver2());
            shiftReportInfoService.update(updateWrapper);

            //插入操作记录
            ShiftOperationRecord shiftOperationRecord = ShiftOperationRecord.builder()
                    .propertyId(propertyId)
                    .shiftId(shiftReportInfoId)
                    .operationType(INFO_SHEET)
                    .operationBy(loginUserId)
                    .operationTime(operatorTime)
                    .build();
            shiftOperationRecordService.save(shiftOperationRecord);
        }
    }