高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
@isTest
private class TaskFeedbackControllerTest {
    @TestSetup
    public static void setUp() {
        RecordType rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Hp'];
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName IN ('Department_GI', 'Department_BF') order by DeveloperName desc];
 
        Account acc = new Account();
        acc.RecordTypeId = rectCo.Id;
        acc.Name = 'HP test1';
 
        insert acc;
 
        List<Account> dept = [select Id, Name from Account where ParentId = :acc.Id and Department_Class_Label__c IN ('消化科', '呼吸科') order by Department_Class_Label__c];
 
        Account depart1 = new Account();
        depart1.RecordTypeId = rectDpt[0].Id;
        depart1.Name         = '*';
        depart1.Department_Name__c  = 'Gastoro Intestin Test';
        depart1.ParentId            = dept[0].Id;
        depart1.Department_Class__c = dept[0].Id;
        depart1.Hospital__c         = acc.Id;
 
        Account depart2 = new Account();
        depart2.RecordTypeId = rectDpt[1].Id;
        depart2.Name         = '*';
        depart2.Department_Name__c  = '診療科2';
        depart2.ParentId            = dept[1].Id;
        depart2.Department_Class__c = dept[1].Id;
        depart2.Hospital__c         = acc.Id;
        insert new Account[] {depart1, depart2};
 
 
        Task__c task = new Task__c();
        task.Account__c = depart2.id;
        task.Name = '11111';
        task.taskStatus__c = '01 分配';
        task.assignee__c = UserInfo.getUserId();
        insert task;
    
 
    //  2021-10-22  mzy  任务管理改善   start
        Task__c task2 = new Task__c();
        task2.Account__c = depart2.id;
        task2.Name = '22222';
        task2.taskStatus__c = '01 分配';
        task2.TaskDifferent__c = '上级分配任务';
        task2.assignee__c = UserInfo.getUserId();
        insert task2;
 
        Task__c task3 = new Task__c();
        task3.Account__c = depart2.id;
        task3.Name = '3333';
        task3.taskStatus__c = '04 取消';
        task3.assignee__c = UserInfo.getUserId();
        insert task3;
        //  2021-10-22   mzy  任务管理改善  end
 
        Task__c task4 = new Task__c();
        task4.Account__c = depart2.id;
        task4.Name = '3333';
        task4.NeedFeedback__c = true;
        task4.taskStatus__c = '02 接受';
        task4.assignee__c = UserInfo.getUserId();
        insert task4;
 
 
        
    }
    @isTest
    public static void test_getCurrentTask() {
        taskFeedbackController.getFeedbackTask(Null, Null,
                                            Null, Null,
                                            Null, Null,
                                            Null, Null,
                                            Null, Null,
                                            Null, Null,
                                            Null, Null,
                                            Null);
    }
    @isTest
    public static void test_confirmOrDelay() {
        task__c task =
            [select id
                from Task__c
                where Name = '11111'];
        taskFeedbackController.confirmOrDelay(false,
                                            Null,'', task.id,false,Date.today());
 
        taskFeedbackController.feedback('testFeedback', task.id);
        TaskFeedbackController.checkEnquiryController(task.id);
    }
    @isTest
    public static void test_resetAssignee() {
        task__c task =
            [select id
                from Task__c
                where Name = '11111'];
        taskFeedbackController.resetAssignee(UserInfo.getUserId(),  task.id);
    }
    @isTest
    public static void test_getMyTask() {
        taskFeedbackController.getMyTask(Null, Null,
                                        Null, Null,
                                        Null, Null,
                                        Null
                                        );
    }
    @isTest
    public static void test_getSubTask() {
        taskFeedbackController.getSubTask(Null, Null,
                                        Null, Null,
                                        Null, Null, Null,
                                        Null
                                        );
    }
    @isTest
    public static void test_cancel() {
        task__c task =
            [select id
                from Task__c
                where Name = '11111'];
        taskFeedbackController.cancel(task.id, null,
                                    Null );
    }
    @isTest
    public static void test_TasksBuild() {
        task__c task =
            [select id
                from Task__c
                where Name = '11111'];
        taskFeedbackController.TasksBuild(
            new list<ID>{UserInfo.getUserId()},Null, Null,
                                        Null, Null,
                                        Null, Null, Null,
                                        Null
            );
    }
    @isTest
    public static void test_getpickerField() {
        taskFeedbackController.getpickerField();
    }
 
    //2021-10-22  mzy  任务管理改善  start
    @isTest
    public static void test_resetAssignee_Owner() {
        task__c task =
            [select id
                from Task__c
                where Name = '11111'];
        taskFeedbackController.resetAssignee_Owner(UserInfo.getUserId(),  task.id);
    }
    @isTest
    public static void test_mergeTask() {
        List<task__c> taskList =
            [select id,Name,taskStatus__c 
                from Task__c
                where assignee__c = :UserInfo.getUserId() AND taskStatus__c = '01 分配'];
        //System.assertEquals(null, taskList);     
        List<String> taskIdList = new List<String> ();
        if(taskList.size()>0){
            for (task__c tsk : taskList) {
                taskIdList.add(tsk.Id);
            }
        }
        taskFeedbackController.mergeTask(taskIdList);
    }
    //2021-10-22  mzy  任务管理改善   end
}