李彤
2023-05-15 19ae52ae3e06c44c646ae6b45dc2b0d7f2cead88
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
public  with sharing    class TerminateController {
    public TerminateController() {
 
    }
 
    //根据ID查询  招投标项目
    @AuraEnabled
    public  static string GetInspectById(String Id){
        QueryWrapper query = new QueryWrapper(Tender_information__c.SObjectType);
        query.eq('Id', Id);
        List<Tender_information__c> arrays = DataBasePlus.listPlus(query);
        return JSON.serialize(arrays); 
    }
 
    @AuraEnabled
    public static Boolean cannotModifyIsRelateProject(String Id){
        Boolean cannotModify = false;
        String profileIds = System.Label.Tender_IsnotRelated_ModifyDisable;
        System.debug('---lt123简档Id---'+UserInfo.getProfileId());
        // 判断当前用户简档
        if (profileIds.contains(UserInfo.getProfileId())) {
            // 获取招标项目 判断相关性
            Tender_information__c tender = [select Id, IsRelateProject__c from Tender_information__c where Id = :Id];
            if (tender != null && '是'.equals(tender.IsRelateProject__c)) {
                cannotModify = true;
            }
        }
        return cannotModify;
    }
 
 
     //招投标项目列表字段 irrelevantReasons__c 所有的值
    @AuraEnabled
    public  static string GetIrrelevantReasons(){
      String JsonData = CommonUtils.GetSelectedValues( Tender_information__c.irrelevantReasons__c.getDescribe());
      return JsonData;
    }
 
 
     //招投标项目列表字段 TerminateReason__c 所有的值
    @AuraEnabled
    public  static string GetIrresponsibleReason(){
      String JsonData = CommonUtils.GetSelectedValues( Tender_information__c.TerminateReason__c.getDescribe());
      return JsonData;
    }
 
 //20220913 you SWAG-CJ3DS5 start
      //招投标项目列表字段 TerminateReason__c 所有的值
    @AuraEnabled
    public  static string GetproInvolvedManual(){
      String JsonData = CommonUtils.GetSelectedValues( Tender_information__c.proInvolvedManual__c.getDescribe());
      return JsonData;
    }
//20220913 you SWAG-CJ3DS5 end  
  
 
      // 产品类
      public class Information {
        public  String hospital;//关联医院
        public  String account;// 关联普通科室
        public  String department;//关联医院
    }
 
    // 查询用户 根据父ID的值  
    @AuraEnabled
    public  static string  GetIsPrentIdArr(String Id){
        return CommonUtils.GetAccountPrentID(Id);
    }
 
 
    //保存数据  JSONData 是 招投标项目 对象的 json格式的值 
    @AuraEnabled
    public  static string  SaveData(String JsonData,String Id,String checkboxValue){
        try{
            Tender_information__c temp = (Tender_information__c)JSON.deserialize(JsonData,Tender_information__c.class);
            System.debug('temp=='+temp);
            
            StaticParameter.EscapeOtherUpdateTenOwner = false;
            update temp;
            StaticParameter.EscapeOtherUpdateTenOwner = true;
            
            //String assvale=AssignValuesToOwner(Id,checkboxValue);
        }catch(Exception ex)
        {
           return  ex.getMessage();
        }
        return  '成功';
    }
 
    //保存 应标数据 JSONData 是 招投标项目 对象的 json格式的值 
     @AuraEnabled
    public  static String SaveDataYB(String JsonData){
        try{
            Tender_information__c temp = (Tender_information__c)JSON.deserialize(JsonData,Tender_information__c.class);
          //if (temp.IsTerminate__c == '否') {
                temp.TerminateApprovalStatus__c = '草案中';
                temp.ownerid = UserInfo.getUserId();
            //}else{
            //    temp.TerminateApprovalStatus__c = null;
            //    temp.irresponsibleReasonOther__c = null;
            //    temp.TerminateReason__c = null;
            //    temp.irresponseApplyTime__c = null;
            //    temp.TerminateExtraContent__c = null;
            //}
            update temp;
        }catch(Exception ex)
        {
            return  ex.getMessage();
        }
        return  '成功';
    }
 
    //提交审核 应标数据 JSONData 是 招投标项目 对象的 json格式的值 
    @AuraEnabled
    public  static String ChangeDataYB(String JsonData){
        try{
            Tender_information__c temp = (Tender_information__c)JSON.deserialize(JsonData,Tender_information__c.class);
            if (temp.IsTerminate__c == '是') {
                temp.TerminateApprovalStatus__c = '填写完毕';
                temp.ownerid = UserInfo.getUserId();
            }
            update temp;
        }catch(Exception ex)
        {
            return  ex.getMessage();
        }
        return  '成功';
    }
 
 
    //查询战略科室
    @AuraEnabled
    public  static String SearchZLKS(String content,String[] ParentId){
        String jsonData = CommonUtils.GetZLKS(content,ParentId);
        return jsonData;
    }
 
    //查询医院
    @AuraEnabled
    public  static String SearchYY(String content){
        String jsonData = CommonUtils.GetYY(content);
        return jsonData;
    }
 
    //查询父类
    @AuraEnabled
    public  static String SearchParent(String Id){
        String jsonData = CommonUtils.GetParent(Id);
        return jsonData;
    }
 
    //查询医院下的科室
    @AuraEnabled
    public  static String SearchYYChilders(String content,String ParentId){
    String jsonData = CommonUtils.GetYYChilders(content,ParentId);
    return jsonData;
    }
       
 
     //根据id查询医院
     @AuraEnabled
     public  static String SearchAccountById(String Id){
        QueryWrapper query = new QueryWrapper(account.SObjectType);
        query.eq('Id',Id);
        List<account> arraysTemp = DataBasePlus.listPlus(query);
        return JSON.serialize(arraysTemp);  
     }
 
    //根据id查询用户
    @AuraEnabled
    public  static String SearchUserById(String Id){
        QueryWrapper query = new QueryWrapper(user.SObjectType);
        query.eq('Id',Id);
        List<user> arraysTemp = DataBasePlus.listPlus(query);
        return JSON.serialize(arraysTemp);  
    }
 
 
    //判断当前登录用户 是否是 所有人
    @AuraEnabled
    public  static String CheckOwner(String Id){
        String OwnerId = UserInfo.getUserId();
        String sql = 'select Id, owner.Id ,Name from Tender_information__c where  Id = :Id ';
        List<Tender_information__c> arrays = Database.query(sql);
        
        if(UserInfo.getProfileId() == System.Label.ProfileId_SystemAdmin)
        {
            return '1'+ '==' + '1';
        }
        if(arrays.size()<1)
        {
            return  '2'+ '==' + '1';
        }
        return OwnerId + '==' + arrays[0].owner.Id;
    } 
 
    
}