feiyu02
2024-11-19 752e00503f672ddfe2066afb6c235721a3a912b5
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/ScheduleServiceImpl.kt
@@ -1,5 +1,6 @@
package cn.flightfeather.supervision.lightshare.service.Impl
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.domain.entity.ScheduleSignRecord
import cn.flightfeather.supervision.domain.mapper.BaseInfoMapper
import cn.flightfeather.supervision.domain.mapper.EnvironmentalScheduleMapper
@@ -41,6 +42,7 @@
                res.addAll(ScheduleVo.toScheduleVoList(it, option))
            }
        }
        res.sortBy { it.time }
        res.forEach {
            val millisecond = it.time?.time!! + 1000 * 60 * 60 * 24
@@ -55,6 +57,32 @@
        return BaseResponse(true, data = res)
    }
//    override fun getYearSchedules(option: ScheduleOption): List<ScheduleVo> {
//        option.userId ?: throw BizException("用户id不能为空")
//        val userInfo = userinfoMapper.selectByPrimaryKey(option.userId) ?: throw BizException("用户不存在")
//        val baseInfo = baseInfoMapper.selectByPrimaryKey(option.userId)
//        val config = userConfigRep.getUserConfig(userInfo, baseInfo)
//        val res = mutableListOf<ScheduleVo>()
//        scheduleRepository.getSchedules(userInfo, config, option).forEach{
//            it?.let {
//
//                res.addAll(ScheduleVo.toScheduleVoList(it, option))
//            }
//        }
//
//        // 查询签收记录
//        res.forEach {
//            if (!it.needSign) return@forEach
//            val millisecond = it.time?.time!! + 1000 * 60 * 60 * 24
//            val eTime = Date(millisecond)
//            val r = scheduleSignRecordRepository.getRecord(option.userId, it.id, it.time, eTime)
//            if (r.isNotEmpty()) {
//                it.recordId = r[0]?.srId
//                it.finished = r[0]?.srSignStatus ?: false
//            }
//        }
//    }
    override fun completeSchedule(userId: String, id: Int): BaseResponse<ScheduleSignRecord> {
        val now = LocalDate.now().atTime(0,0,0)
        val sTime = Date.from(now.atZone(ZoneId.systemDefault()).toInstant())