app/src/main/java/cn/flightfeather/thirdapp/module/task/NewSubTaskViewModel.kt
@@ -5,10 +5,10 @@
import android.arch.lifecycle.MutableLiveData
import android.arch.lifecycle.ViewModel
import cn.flightfeather.thirdapp.CommonApplication
import cn.flightfeather.thirdapp.bean.Monitorobjectversion
import cn.flightfeather.thirdapp.bean.Scense
import cn.flightfeather.thirdapp.bean.Subtask
import cn.flightfeather.thirdapp.bean.Task
import cn.flightfeather.thirdapp.bean.entity.Monitorobjectversion
import cn.flightfeather.thirdapp.bean.entity.Scense
import cn.flightfeather.thirdapp.bean.entity.Subtask
import cn.flightfeather.thirdapp.bean.entity.Task
import cn.flightfeather.thirdapp.bean.vo.TaskVo
import cn.flightfeather.thirdapp.common.net.ResultCallBack
import cn.flightfeather.thirdapp.model.event.TopTaskEvent
@@ -169,6 +169,10 @@
     * 根据所选场景类型及是否监管刷新场景
     */
    fun refreshScene() {
        //sceneTypeList会根据联网获取的场景变更内容,此处判断保证下标不会越界
        if (selectedTypeIndex >= sceneTypeList.size) {
            selectedTypeIndex = 0
        }
        //筛选场景类型
        val tmp = ArrayList<Scense>()
        if (selectedTypeIndex == 0) {
@@ -414,16 +418,26 @@
                tguid = UUIDGenerator.generate16ShortUUID()
                tsguid = selectedTopTask?.tguid
                levelnum = null
                val cal = Calendar.getInstance()
                cal.time = Date()
                cal.set(Calendar.HOUR_OF_DAY, 0)
                cal.set(Calendar.MINUTE, 0)
                cal.set(Calendar.SECOND, 0)
                starttime = cal.time
                cal.set(Calendar.HOUR_OF_DAY, 23)
                cal.set(Calendar.MINUTE, 59)
                cal.set(Calendar.SECOND, 59)
                endtime = cal.time
                // 判断当前时间与总任务的时间段关系,不在总任务时间范围内时,使用总任务开始时间为默认时间,否则用当前时间为默认时间
                if (cal.time < starttime || cal.time > endtime) {
                    cal.time = starttime
                    cal.set(Calendar.HOUR_OF_DAY, 23)
                    cal.set(Calendar.MINUTE, 59)
                    cal.set(Calendar.SECOND, 59)
                    endtime = cal.time
                } else {
                    cal.set(Calendar.HOUR_OF_DAY, 0)
                    cal.set(Calendar.MINUTE, 0)
                    cal.set(Calendar.SECOND, 0)
                    starttime = cal.time
                    cal.set(Calendar.HOUR_OF_DAY, 23)
                    cal.set(Calendar.MINUTE, 59)
                    cal.set(Calendar.SECOND, 59)
                    endtime = cal.time
                }
                plannerguid = application.currentUser.guid
                plannerusername = application.currentUser.acountname
                plannerrealname = application.currentUser.realname