From e27f54aa7e10836e2741dc590559e1039fbade78 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 23 七月 2021 15:06:41 +0800
Subject: [PATCH] 1. 创建子任务时,执行用户默认为当前登录用户或执行组中的第一人 2. 修复部分企业类型问题图标错误 3. 新增场景账户自动生成功能

---
 app/src/main/java/cn/flightfeather/thirdapp/module/task/NewSubTaskViewModel.kt |   36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/task/NewSubTaskViewModel.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/task/NewSubTaskViewModel.kt
index 7d00dd7..84d5a5a 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/task/NewSubTaskViewModel.kt
+++ b/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
@@ -418,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

--
Gitblit v1.9.3