//BEFORE -- 设置GI/SP 助理和5个战略科室所有人的共享
|
//NOW ----- 设置GI/SP助理 和5个医院下所有战略科室所有人的共享
|
// { 1. 根据OCSM管理省 给GI和SP助理 信息负责人(助理),行政窗口 ,备品窗口 赋值 信息负责人助理设置GI助理
|
//3.给关联医院的所有启用战略科室下的所有启用所有人设置销售共享 ,给招投标项目的行政窗口和备品窗口设置共享 ,给招投标项目的GI/SP助理设置共享}
|
|
//设置GI/SP/销售助理的值 和共享
|
public without sharing class TenderInformationHandler extends Oly_TriggerHandler {
|
private Map<Id, Tender_information__c> newMap;
|
private Map<Id, Tender_information__c> oldMap;
|
private List<Tender_information__c> newList;
|
private List<Tender_information__c> oldList;
|
|
|
public TenderInformationHandler() {
|
this.newMap = (Map<Id, Tender_information__c>) Trigger.newMap;
|
this.oldMap = (Map<Id, Tender_information__c>) Trigger.oldMap;
|
this.newList = (List<Tender_information__c>) Trigger.new;
|
this.oldList = (List<Tender_information__c>) Trigger.old;
|
}
|
|
//根据新建的OCSM管理省字段,根据OCSM管理省对象GI,SP助理, 行政窗口 ,备品窗口 给这个招投标项目的GI,SP助理,行政窗口,备品窗口 ,信息负责人(助理)赋值;
|
protected override void beforeInsert() {
|
AssignValueToAssistant();
|
// add 【委托】P-招标项目-手动创建的招标项目增加必填字段 2021/11/03 fxk Star
|
for (Tender_information__c ten : newList) {
|
if (ten.RecordTypeId == '0121m000000bKzA' || ten.RecordTypeId == '01210000000VLZ8') {
|
ten.OwnerId = '00510000000gmxH';
|
if(ten.Hospital__c != null
|
|| ten.Hospital1__c != null
|
|| ten.Hospital2__c != null
|
|| ten.Hospital3__c != null
|
|| ten.Hospital4__c != null){
|
ten.IsRelateProject__c = '是';
|
ten.relativeTime__c = Datetime.now();
|
}
|
updateTenOwner();
|
}
|
}
|
// add 【委托】P-招标项目-手动创建的招标项目增加必填字段 2021/11/03 fxk End
|
}
|
|
protected override void beforeUpdate() {
|
//反逻辑删除 fxk
|
updateTenDel();
|
AssignValueToAssistant();
|
if (!StaticParameter.EscapeOtherUpdateTenOwner) {
|
updateTenOwner();
|
}
|
}
|
|
protected override void afterInsert() {
|
// 根据上面赋值的GI、SP助理,行政窗口,备品窗口,更新共享,共享原因不一样
|
addShare();
|
sednMessage();
|
// updateTenOwner();
|
}
|
protected override void afterUpdate() {
|
addShare();
|
sednMessage();
|
updateWin();
|
}
|
|
public void sednMessage() {
|
//规则条件
|
//ISCHANGED(InfoType__c) && Text(InfoType__c) = '3:结果' && (Text(IsBid__c) = '是' || ( Text(IsBid__c) = '否' && OpportunityNum__c != null && OpportunityNum__c > 0) )
|
// 1)没有关联询价,确认相关性,那么就发给GI和SP助理;
|
// 2)关联询价后,询价的所有人、项目所有人,GI和SP助理,收邮件;
|
//关联询价 发给询价所有人 招标项目所有人
|
//没有关联询价并且做了相关性确认 发给招标项目所有人
|
|
//1.判断是否符合大条件 拿到招标id
|
Set<Id> zbIds = new Set<Id>();
|
//拿到招标id , 招标所有人 GI/SP助理 的邮件地址
|
Map<Id, Set<String>> zbOppMap = new Map<Id, Set<String>>();
|
List<Tender_information__c> tlist = new List<Tender_information__c>();
|
|
for (Tender_information__c ten : newList) {
|
// if (ten.InfoType__c == '3:结果' &&
|
// (ten.IsBid__c == '是' || (ten.IsBid__c == '否' && ten.OpportunityNum__c != null && ten.OpportunityNum__c > 0))
|
// && (Trigger.isInsert || (Trigger.isUpdate && oldMap.get(ten.Id).InfoType__c != '3:结果'))) {
|
// zbIds.add(ten.Id);
|
// }
|
// 判断条件修改
|
if (ten.InfoType__c == '3:结果' && (Trigger.isInsert || (Trigger.isUpdate && oldMap.get(ten.Id).InfoType__c != '3:结果'))) {
|
// 如果招标所有人为系统管理员(OlympusSystem)时需要跳过
|
if (ten.Id != '00510000000gmxH') {
|
zbIds.add(ten.Id);
|
}
|
}
|
}
|
if (zbIds.size() > 0) {
|
tlist = [select Id, GI_assistant__r.Email, SP_assistant__r.Email, Hospital__r.Name, BudgetAmount__c, Name, department__r.Name, OpenBidingTime__c, Owner.Alias, Owner.Email from Tender_information__c where id in :zbIds];
|
for (Tender_information__c ten : tlist) {
|
if (!zbOppMap.containsKey(ten.Id)) {
|
zbOppMap.put(ten.Id, new Set<String>());
|
}
|
zbOppMap.get(ten.Id).add(ten.Owner.Email);
|
|
}
|
//取得询价
|
// 招标-询价关联修改 20210817 start
|
// List<Opportunity> oppList = new List<Opportunity>();
|
// oppList = [select id,Owner.Email,Bidding_Project_Name_Bid__c,Bidding_Project_Name_Bid__r.owner.Email from Opportunity where Bidding_Project_Name_Bid__c in :zbIds];
|
// if (oppList.size() > 0) {
|
// for (Opportunity opp : oppList) {
|
// // 能走到这说明 询价的所有人、项目所有人 也得发邮件
|
// if (!zbOppMap.containsKey(opp.Bidding_Project_Name_Bid__c)) {
|
// zbOppMap.put(opp.Bidding_Project_Name_Bid__c, new Set<String>());
|
// }
|
// zbOppMap.get(opp.Bidding_Project_Name_Bid__c).add(opp.Owner.Email);
|
// // zbOppMap.get(opp.Bidding_Project_Name_Bid__c).add(opp.Bidding_Project_Name_Bid__r.owner.Email);
|
// }
|
// }
|
List<Tender_Opportunity_Link__c> link_list = [select id, Tender_information__c, Opportunity__r.Owner.Email from Tender_Opportunity_Link__c where Tender_information__c in :zbIds];
|
if (link_list != null && link_list.size() > 0) {
|
for (Tender_Opportunity_Link__c link : link_list) {
|
// 能走到这说明 询价的所有人、项目所有人 也得发邮件
|
if (!zbOppMap.containsKey(link.Tender_information__c)) {
|
zbOppMap.put(link.Tender_information__c, new Set<String>());
|
}
|
zbOppMap.get(link.Tender_information__c).add(link.Opportunity__r.Owner.Email);
|
}
|
}
|
// 招标-询价关联修改 20210817 end
|
}
|
|
if (zbOppMap.size() > 0) {
|
if (tlist.size() > 0) {
|
List<Messaging.SingleEmailMessage> sendMails = new List<Messaging.SingleEmailMessage>();
|
|
for (Tender_information__c ten : tlist) {
|
if (zbOppMap.containsKey(ten.Id)) {
|
String body = '';
|
String title = '';
|
String BudgetAmount = ten.BudgetAmount__c == null ? '' : ten.BudgetAmount__c + '';
|
String HospitalName = ten.Hospital__c == null ? '' : ten.Hospital__r.Name;
|
String departmentName = ten.department__c == null ? '' : ten.department__r.Name;
|
String OpenBidingTime = ten.OpenBidingTime__c == null ? '' : ten.OpenBidingTime__c.format();
|
|
title = '中标结果:' + ten.Hospital__r.Name + ' 预算金额' + BudgetAmount + '已有中标结果请确认';
|
|
body += '项目名:' + ten.Name + '<br/>';
|
body += '预算金额:' + BudgetAmount + '<br/>';
|
body += '医院:' + HospitalName + '<br/>';
|
// body += '战略科室:'+departmentName + '<br/>';
|
body += '中标日:' + OpenBidingTime + '<br/>';
|
body += '主担当:' + ten.Owner.Alias + '<br/>';
|
body += '招投标链接: <br/>';
|
body += '<a href="' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + ten.Id + '">' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + ten.Id + '</a><br/>';
|
// body += '收件人: '+zbOppMap.get(ten.Id);
|
|
List<String> toMailList = new List<String>();
|
// List<String> toccList = new List<String>();
|
// emas.add(UserInfo.getUserEmail());
|
//收信人
|
toMailList.addAll(zbOppMap.get(ten.Id));
|
// if (toMailList.contains(null)) {
|
// toMailList.remove(null);
|
// }
|
// toMailList.add('rentongxiao@prec-tech.com');
|
//抄送人
|
// toccList.add('gzw@prec-tech.com');
|
// toccList.add('rentongxiao@prec-tech.com');
|
Messaging.SingleEmailMessage messageNEW = new Messaging.SingleEmailMessage();
|
messageNEW.subject = title;
|
//messageNEW.plainTextBody = body;
|
messageNEW.htmlBody = body;
|
messageNEW.setCharset('UTF-8');
|
messageNEW.toAddresses = toMailList;
|
// messageNEW.ccAddresses = toccList;
|
sendMails.add(messageNEW);
|
}
|
}
|
|
if (sendMails.size() > 0) {
|
for (Messaging.SingleEmailMessage mc : sendMails) {
|
List<Messaging.SingleEmailMessage> tempsendMails = new List<Messaging.SingleEmailMessage>();
|
tempsendMails.add(mc);
|
Messaging.SendEmailResult[] results = null;
|
if (!NFMUtil.isSandbox()) {
|
results = messaging.sendEmail(tempsendMails);
|
}
|
if (results != null && results.size() > 0) {
|
for (Integer i = 0; i < results.size(); i++) {
|
if (results[i].success == false) {
|
System.debug('邮件:::' + mc.getSubject() + '发送失败');
|
} else {
|
System.debug('邮件:::' + mc.getSubject() + '发送成功');
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
|
|
public void addShare() {
|
//1.获得医院
|
Set<Id> hpIdsets = new Set<Id>();
|
for (Tender_information__c info : newList) {
|
if (info.Hospital__c != null) {
|
hpIdsets.add(info.Hospital__c);
|
}
|
if (info.Hospital1__c != null) {
|
hpIdsets.add(info.Hospital1__c);
|
}
|
if (info.Hospital2__c != null) {
|
hpIdsets.add(info.Hospital2__c);
|
}
|
if (info.Hospital3__c != null) {
|
hpIdsets.add(info.Hospital3__c);
|
}
|
if (info.Hospital4__c != null) {
|
hpIdsets.add(info.Hospital4__c);
|
}
|
|
}
|
|
if (hpIdsets.contains(null)) {
|
hpIdsets.remove(null);
|
}
|
|
List<Account> accList = new List<Account>();
|
if (hpIdsets.size() > 0) {
|
//获取医院下所有启用战略科室的启用所有人
|
//取得战略科室:
|
// accList = [select id,OwnerId,ParentId,OwnerIsActive__c from Account where Parent.RecordType_DeveloperName__c = 'HP'
|
// AND OwnerIsActive__c = true
|
// AND ParentId in :hpIdsets];
|
//获取医院上的主担当
|
accList = [select id, GI_Main__c, GI_Main__r.IsActive, BF_owner__c, BF_owner__r.IsActive,
|
ET_owner__c, ET_owner__r.IsActive, SP_Main__c, SP_Main__r.IsActive, URO_owner_ID__c, URO_owner_ID__r.IsActive,
|
GYN_owner__c, GYN_owner__r.IsActive, ENT_owner_ID__c, ENT_owner_ID__r.IsActive, Energy_LeaderStr__c
|
from Account where Id in :hpIdsets ];
|
// updateTenOwner(newList, accList);
|
}
|
|
//获取共享原因
|
String rowCauseGI = Schema.Tender_information__Share.RowCause.GI_assistant__c;
|
String rowCauseSP = Schema.Tender_information__Share.RowCause.SP_assistant__c;
|
String rowCauseSale = Schema.Tender_information__Share.RowCause.SalesOwner__c;
|
String rowCauseAdministrative = Schema.Tender_information__Share.RowCause.Administrative_assistant__c;
|
String rowCauseBeipin = Schema.Tender_information__Share.RowCause.Beipin_assistant__c;
|
String rowCauseTender = Schema.Tender_information__Share.RowCause.TenderAssistant__c;
|
//营业窗口的共享原因
|
String rowCauseYingye = Schema.Tender_information__Share.RowCause.YingyeWindow__c;
|
|
List<String> rowCauseList = new List<String>();
|
rowCauseList.add(rowCauseGI);
|
rowCauseList.add(rowCauseSP);
|
rowCauseList.add(rowCauseSale);
|
rowCauseList.add(rowCauseAdministrative);
|
rowCauseList.add(rowCauseBeipin);
|
rowCauseList.add(rowCauseTender);
|
rowCauseList.add(rowCauseYingye);
|
|
|
//以 医院id 和战略科室所有人id集合为map
|
// Map<Id,Set<Id>> hpDepartmentMap = new Map<Id,Set<Id>>();
|
// if (accList.size() > 0) {
|
// for (Account department : accList) {
|
// if (!hpDepartmentMap.containsKey(department.ParentId)) {
|
// hpDepartmentMap.put(department.ParentId, new Set<Id>());
|
// }
|
// hpDepartmentMap.get(department.ParentId).add(department.OwnerId);
|
// }
|
// }
|
//能量担当需要单独查一下
|
List<String> ddNameListtrim = new List<String>();
|
List<String> ddNameList = new List<String>();
|
for (Account hp : accList) {
|
if (hp.Energy_LeaderStr__c != null && hp.Energy_LeaderStr__c != '') {
|
// update fxk 2021/10/26 star
|
String str = hp.Energy_LeaderStr__c.replaceAll(' ', '');
|
String name = str.subString(0, 1) + ' ' + str.subString(1, str.length());
|
ddNameListtrim.add(name);
|
ddNameList.add(str);
|
// update fxk 2021/10/26 end
|
}
|
}
|
//查询用户 获取id
|
List<User> ulist = new List<User>();
|
ulist = [select id, Alias, IsActive, Name from user where IsActive = true and (Alias in :ddNameList or Alias in :ddNameListtrim)];
|
Map<String, Id> uidmap = new Map<String, Id>();
|
if (ulist != null && ulist.size() > 0) {
|
for (User u : ulist) {
|
uidmap.put(u.Name, u.Id);
|
}
|
}
|
// upd 用户勾选了战略科室的话,这条招标信息只有关联医院对应的战略科室主担当可以看到,否则医院所有科室主担当都能看到 2021、9、22 fxk Star
|
// Map<Id, Set<Id>> hpDepartmentMap = new Map<Id, Set<Id>>();
|
Map<Id, Map<String, Id>> hpDepartmentMap = new Map<Id, Map<String, Id>>();
|
if (accList.size() > 0) {
|
for (Account hp : accList) {
|
//消化科主担当
|
// Set<Id> ddIds = new Set<Id>();
|
Map<String, Id> ddmap = new Map<String, Id>();
|
if (hp.GI_Main__c != null && hp.GI_Main__r.IsActive ) {
|
// System.debug('-------2------' + tenDepartMap.get(info.Id));
|
// ddIds.add(hp.GI_Main__c);
|
ddmap.put('01210000000QemLAAS', hp.GI_Main__c);
|
}
|
// 呼吸科主担当
|
if (hp.BF_owner__c != null && hp.BF_owner__r.IsActive ) {
|
// System.debug('-------3------' + hp.BF_owner__c);
|
// ddIds.add(hp.BF_owner__c);
|
ddmap.put('01210000000QezZAAS', hp.BF_owner__c);
|
}
|
// ET科主担当
|
// if (hp.ET_owner__c != null && hp.ET_owner__r.IsActive) {
|
// // System.debug('-------3------' + hp.ET_owner__r);
|
// // ddIds.add(hp.ET_owner__c);
|
// ddmap.put(hp.Department_Class__r.RecordTypeId, hp.GI_Main__c);
|
// }
|
// 普外科主担当
|
if (hp.SP_Main__c != null && hp.SP_Main__r.IsActive) {
|
// System.debug('-------3------' + hp.SP_Main__r);
|
// ddIds.add(hp.SP_Main__c);
|
ddmap.put('01210000000QezeAAC', hp.SP_Main__c);
|
}
|
// 泌尿科主担当
|
if (hp.URO_owner_ID__c != null && hp.URO_owner_ID__r.IsActive) {
|
// System.debug('-------3------' + hp.URO_owner_ID__r);
|
// ddIds.add(hp.URO_owner_ID__c);
|
ddmap.put('01210000000QezjAAC', hp.URO_owner_ID__c);
|
}
|
// 妇科主担当
|
if (hp.GYN_owner__c != null && hp.GYN_owner__r.IsActive) {
|
// System.debug('-------3------' + hp.GYN_owner__r);
|
// ddIds.add(hp.GYN_owner__c);
|
ddmap.put('01210000000QezoAAC', hp.GYN_owner__c);
|
}
|
// 耳鼻喉科主担当
|
if (hp.ENT_owner_ID__c != null && hp.ENT_owner_ID__r.IsActive) {
|
// System.debug('-------3------' + hp.ENT_owner_ID__r);
|
// ddIds.add(hp.ENT_owner_ID__c);
|
ddmap.put('01210000000QeztAAC', hp.ENT_owner_ID__c);
|
}
|
//能量担当
|
|
if (hp.Energy_LeaderStr__c != null) {
|
|
String str = hp.Energy_LeaderStr__c.replaceAll(' ', '');
|
String name = str.subString(0, 1) + ' ' + str.subString(1, str.length());
|
// update fxk 2021/10/26 star
|
if (uidmap.containsKey(hp.Energy_LeaderStr__c)) {
|
// ddIds.add(uidmap.get(hp.Energy_LeaderStr__c));
|
// ddIds.add(uidmap.get(name));
|
ddmap.put('nengliang', uidmap.get(hp.Energy_LeaderStr__c));
|
|
}else if(uidmap.containsKey(name)){
|
ddmap.put('nengliang', uidmap.get(name));
|
}
|
// update fxk 2021/10/26 end
|
}
|
// ddIds.remove(null);
|
ddmap.remove(null);
|
if (ddmap.size() > 0) {
|
// hpDepartmentMap.put(hp.Id, ddIds);
|
hpDepartmentMap.put(hp.Id, ddmap);
|
}
|
}
|
}
|
// upd 用户勾选了战略科室的话,这条招标信息只有关联医院对应的战略科室主担当可以看到,否则医院所有科室主担当都能看到 2021、9、22 fxk End
|
|
|
//待共享的数据
|
//取值顺序是:所有人,之后是gi助理,接下来是sp助理,接下来是战略科室所有人 所以倒着来
|
List<Tender_information__Share> tenShareList = new List<Tender_information__Share>();
|
for (Tender_information__c tenc : newList) {
|
//一个map为 针对一条招投标计划的共享
|
Map<Id, Tender_information__Share> sharemap = new Map<Id, Tender_information__Share>();
|
//1.先设置 医院担当的共享
|
//获取5个医院
|
Map<Id, String> hmap = new Map<Id, String>();
|
hmap.put(tenc.Hospital__c, tenc.Hospital__c);
|
hmap.put(tenc.Hospital1__c, tenc.Hospital1__c);
|
hmap.put(tenc.Hospital2__c, tenc.Hospital2__c);
|
hmap.put(tenc.Hospital3__c, tenc.Hospital3__c);
|
hmap.put(tenc.Hospital4__c, tenc.Hospital4__c);
|
hmap.remove(null);
|
if (hpDepartmentMap.size() > 0) {
|
for (Id hpId : hpDepartmentMap.keySet()) {
|
if (hmap.containsKey(hpId)) {
|
// upd 用户勾选了战略科室的话,这条招标信息只有关联医院对应的战略科室主担当可以看到,否则医院所有科室主担当都能看到 2021、9、22 fxk Star
|
Map<String, String> tempMap = new Map<String, String>();
|
if (tenc.department_selection__c != null) {
|
System.debug('=========1=======' + tenc.department_selection__c);
|
List<String> tenDepartList = tenc.department_selection__c.split(';');
|
for (String departs : tenDepartList) {
|
tempMap.put(departs, '');
|
}
|
// tempMap.put('nengliang', '');
|
} else {
|
System.debug('=========2=======' + tenc.department_selection__c);
|
tempMap.put('01210000000QemLAAS', '');
|
tempMap.put('01210000000QezZAAS', '');
|
tempMap.put('01210000000QezeAAC', '');
|
tempMap.put('01210000000QezjAAC', '');
|
tempMap.put('01210000000QezoAAC', '');
|
tempMap.put('01210000000QeztAAC', '');
|
tempMap.put('nengliang', '');
|
}
|
Map<String, Id> departToMainmap = hpDepartmentMap.get(hpId);
|
for (String depart : tempMap.keySet()) {
|
if (departToMainmap.containsKey(depart)) {
|
if (tenc.OwnerId != departToMainmap.get(depart)) {
|
Tender_information__Share aos = new Tender_information__Share(
|
RowCause = rowCauseSale,
|
ParentId = tenc.Id,
|
UserOrGroupId = departToMainmap.get(depart),
|
AccessLevel = 'Edit');
|
sharemap.put(departToMainmap.get(depart), aos);
|
}
|
}
|
}
|
// for (Id uId : hpDepartmentMap.get(hpId)) {
|
// if (tenc.OwnerId != uId) {
|
// Tender_information__Share aos = new Tender_information__Share(
|
// RowCause = rowCauseSale,
|
// ParentId = tenc.Id,
|
// UserOrGroupId = uId,
|
// AccessLevel = 'Edit');
|
// sharemap.put(uId, aos);
|
|
// }
|
// }
|
// upd 用户勾选了战略科室的话,这条招标信息只有关联医院对应的战略科室主担当可以看到,否则医院所有科室主担当都能看到 2021、9、22 fxk End
|
|
}
|
}
|
}
|
//行政窗口
|
if (tenc.OwnerId != tenc.Window2__c && tenc.Window2__c != null) {
|
Tender_information__Share aos = new Tender_information__Share(
|
RowCause = rowCauseAdministrative,
|
ParentId = tenc.Id,
|
UserOrGroupId = tenc.Window2__c,
|
AccessLevel = 'Edit');
|
sharemap.put(tenc.Window2__c, aos);
|
}
|
//备品窗口
|
// if (tenc.OwnerId != tenc.beiPinwindow__c && tenc.beiPinwindow__c != null){
|
// Tender_information__Share aos = new Tender_information__Share(
|
// RowCause = rowCauseBeipin,
|
// ParentId = tenc.Id,
|
// UserOrGroupId = tenc.beiPinwindow__c,
|
// AccessLevel = 'Edit');
|
// sharemap.put(tenc.beiPinwindow__c, aos);
|
// }
|
//招标项目助理2
|
if (tenc.OwnerId != tenc.TenderAssistant2__c && tenc.TenderAssistant2__c != null) {
|
Tender_information__Share aos = new Tender_information__Share(
|
RowCause = rowCauseTender,
|
ParentId = tenc.Id,
|
UserOrGroupId = tenc.TenderAssistant2__c,
|
AccessLevel = 'Edit');
|
sharemap.put(tenc.TenderAssistant2__c, aos);
|
}
|
//招标项目助理1
|
if (tenc.OwnerId != tenc.TenderAssistant1__c && tenc.TenderAssistant1__c != null) {
|
Tender_information__Share aos = new Tender_information__Share(
|
RowCause = rowCauseTender,
|
ParentId = tenc.Id,
|
UserOrGroupId = tenc.TenderAssistant1__c,
|
AccessLevel = 'Edit');
|
sharemap.put(tenc.TenderAssistant1__c, aos);
|
}
|
//营业窗口
|
if (tenc.OwnerId != tenc.YingyeWindow__c && tenc.YingyeWindow__c != null) {
|
Tender_information__Share aos = new Tender_information__Share(
|
RowCause = rowCauseYingye,
|
ParentId = tenc.Id,
|
UserOrGroupId = tenc.YingyeWindow__c,
|
AccessLevel = 'Edit');
|
sharemap.put(tenc.YingyeWindow__c, aos);
|
}
|
|
//2.SP助理
|
if (tenc.OwnerId != tenc.SP_assistant__c && tenc.SP_assistant__c != null) {
|
Tender_information__Share aos = new Tender_information__Share(
|
RowCause = rowCauseSP,
|
ParentId = tenc.Id,
|
UserOrGroupId = tenc.SP_assistant__c,
|
AccessLevel = 'Edit');
|
sharemap.put(tenc.SP_assistant__c, aos);
|
}
|
//3.GI助理
|
if (tenc.OwnerId != tenc.GI_assistant__c && tenc.GI_assistant__c != null) {
|
Tender_information__Share aos = new Tender_information__Share(
|
RowCause = rowCauseGI,
|
ParentId = tenc.Id,
|
UserOrGroupId = tenc.GI_assistant__c,
|
AccessLevel = 'Edit');
|
sharemap.put(tenc.GI_assistant__c, aos);
|
}
|
tenShareList.addAll(sharemap.values());
|
|
}
|
|
//现在用的是全删全加的方法,没有再判断是否发生改变了
|
//删除
|
List<Tender_information__Share> beforeShareList =
|
[select id from Tender_information__Share
|
where ParentId in :newMap.keySet()
|
and RowCause in :rowCauseList];
|
//先删
|
if (beforeShareList != null && beforeShareList.size() > 0) {
|
delete beforeShareList;
|
}
|
//再加
|
if (tenShareList.size() > 0) {
|
insert tenShareList;
|
}
|
}
|
|
public void AssignValueToAssistant() {
|
//根据ocsm管理省的助理设置当前招投标项目的gi/sp助理
|
Map<String, OCM_Management_Province__c> mpMap = new Map<String, OCM_Management_Province__c>();
|
|
for (OCM_Management_Province__c mp : [SELECT id, Name, GI_assistant__c, SP_assistant__c, SP_assistant__r.IsActive, GI_assistant__r.IsActive, Window2__c, Window2__r.IsActive, Admin_assistant3__c, Admin_assistant3__r.IsActive, TenderAssistant1__c, TenderAssistant1__r.IsActive, TenderAssistant2__c, TenderAssistant2__r.IsActive, Window1__c, Window1__r.IsActive FROM OCM_Management_Province__c]) {
|
mpMap.put(mp.Name, mp);
|
}
|
|
//设置GI/SP助理 行政助理、备品窗口
|
//直接设置 信息负责人(助理) 为GI助理
|
for (Tender_information__c info : newList) {
|
//用户自己选 所有人需要和用户选的人保持一致;
|
// if (info.OwnerId != info.departmentOwner__c && info.departmentOwner__c != null) {
|
// info.OwnerId = info.departmentOwner__c;
|
// }
|
//不能判断ocsm管理省是否发生改变了 会有历史数据
|
if (info.OCSMProvince__c != null) {
|
OCM_Management_Province__c ocm = mpMap.get(info.OCSMProvince__c);
|
if (ocm != null) {
|
//设置OCSM管理省查找字段的值 20210728 start 为了更新历史数据 直接赋值即可
|
// if (Trigger.isInsert || (Trigger.isUpdate && oldMap.get(info.Id).OCSMProvince__c != info.OCSMProvince__c)) {
|
info.OCSMProvinceS__c = ocm.Id;
|
// }
|
//设置OCSM管理省查找字段的值 20210728 end
|
// GI助理为空时__r.IsActive返回false 20210813
|
if (ocm.GI_assistant__r.IsActive ) {
|
if (info.GI_assistant__c != ocm.GI_assistant__c) {
|
info.GI_assistant__c = ocm.GI_assistant__c;
|
}
|
if (info.InfoOwner__c != ocm.GI_assistant__c) {
|
info.InfoOwner__c = ocm.GI_assistant__c;
|
}
|
}
|
// 增加GI助理为空时的处理,清空招标项目的GI助理和信息负责人(助理) 20210813
|
else if (ocm.GI_assistant__c == null) {
|
info.GI_assistant__c = null;
|
info.InfoOwner__c = ocm.GI_assistant__c;
|
}
|
if (ocm.SP_assistant__r.IsActive && info.SP_assistant__c != ocm.SP_assistant__c) {
|
info.SP_assistant__c = ocm.SP_assistant__c;
|
}
|
// 增加SP助理为空时的处理,清空招标项目的SP助理 20210813
|
else if (ocm.SP_assistant__c == null) {
|
info.SP_assistant__c = null;
|
}
|
if (ocm.Window2__r.IsActive && info.Window2__c != ocm.Window2__c) {
|
info.Window2__c = ocm.Window2__c;
|
}
|
// 清空行政窗口 20210813
|
else if (ocm.Window2__c == null) {
|
info.Window2__c = null;
|
}
|
//
|
// if (ocm.Admin_assistant3__r.IsActive && info.beiPinwindow__c != ocm.Admin_assistant3__c) {
|
// info.beiPinwindow__c = ocm.Admin_assistant3__c;
|
// }
|
//设置招标助理1和招标助理2的值
|
if (ocm.TenderAssistant1__r.IsActive && info.TenderAssistant1__c != ocm.TenderAssistant1__c) {
|
info.TenderAssistant1__c = ocm.TenderAssistant1__c;
|
}
|
// 清空招标助理1 20210813
|
else if (ocm.TenderAssistant1__c == null) {
|
info.TenderAssistant1__c = null;
|
}
|
if (ocm.TenderAssistant2__r.IsActive && info.TenderAssistant2__c != ocm.TenderAssistant2__c) {
|
info.TenderAssistant2__c = ocm.TenderAssistant2__c;
|
}
|
// 清空招标助理2 20210813
|
else if (ocm.TenderAssistant2__c == null) {
|
info.TenderAssistant2__c = null;
|
}
|
|
//设置营业窗口 add by rentx 20210721
|
if (ocm.Window1__r.IsActive && info.YingyeWindow__c != ocm.Window1__c) {
|
info.YingyeWindow__c = ocm.Window1__c;
|
}
|
// 清空营业窗口 20210813
|
else if (ocm.Window1__c == null) {
|
info.YingyeWindow__c = null;
|
}
|
}
|
// add 战略科室分类为普外科、泌尿科、妇科、耳鼻喉科时,信息负责人(助理)修改为 SP助理 2021、11、11 fxk star
|
if(info.department_selection__c != null){
|
List<String> tenDepartList = info.department_selection__c.split(';');
|
if(tenDepartList.contains('01210000000QezeAAC')
|
|| tenDepartList.contains('01210000000QezjAAC')
|
|| tenDepartList.contains('01210000000QezoAAC')
|
|| tenDepartList.contains('01210000000QeztAAC')){
|
System.debug('=====-----'+info.department_selection__c);
|
info.InfoOwner__c = info.SP_assistant__c;
|
}
|
}
|
// add 战略科室分类为普外科、泌尿科、妇科、耳鼻喉科时,信息负责人(助理)修改为 SP助理 2021、11、11 fxk end
|
}
|
}
|
}
|
// fxk 2021/8/3 反逻辑删除 Star
|
private void updateTenDel() {
|
List<Tender_information__c> updateTenList = new List<Tender_information__c>();
|
for (Tender_information__c TenoldInfo : newList) {
|
if (TenoldInfo.Logical_delete__c == false && (TenoldInfo.Logical_delete__c != oldMap.get(TenoldInfo.Id).Logical_delete__c)) {
|
TenoldInfo.Retain_Tender__c = null;
|
}
|
if (TenoldInfo.Retain_Tender__c == null && (TenoldInfo.Retain_Tender__c != oldMap.get(TenoldInfo.Id).Retain_Tender__c)) {
|
TenoldInfo.Logical_delete__c = false;
|
}
|
}
|
}
|
// fxk 2021/8/3 反逻辑删除 end
|
// 20210824 中标时修改关联询价的招标项目名和中标时间
|
private void updateWin() {
|
List<String> tenderIds = new List<String>();
|
List<String> lostWinIds = new List<String>();
|
for (Tender_information__c ten : newList) {
|
if ('3:结果'.equals(ten.InfoType__c) && !'3:结果'.equals((oldMap.get(ten.Id).InfoType__c))) {
|
tenderIds.add(ten.Id);
|
} else if (!'3:结果'.equals(ten.InfoType__c) && '3:结果'.equals((oldMap.get(ten.Id).InfoType__c))) {
|
lostWinIds.add(ten.Id);
|
}
|
}
|
if (tenderIds.size() > 0) {
|
List<Tender_Opportunity_Link__c> links =
|
[SELECT id,
|
Tender_information__c,
|
Tender_information__r.OpenBidingTime__c,
|
Tender_information__r.WinnerAmount__c,
|
Tender_information__r.ZhongBiaoUnit1__c,
|
Opportunity__c
|
FROM Tender_Opportunity_Link__c
|
WHERE Tender_information__c IN :tenderIds
|
AND Opportunity__r.Bidding_Project_Name_Bid__c NOT IN :tenderIds];
|
if (links != null && links.size() > 0) {
|
List<String> oppIds = new List<String>();
|
for (Tender_Opportunity_Link__c link : links) {
|
oppIds.add(link.Opportunity__c);
|
}
|
if (oppIds.size() > 0) {
|
List<Opportunity> opps = [select id, Bidding_Project_Name_Bid__c, Bidding_Project_Name_Bid__r.InfoType__c, Closing_Bid_Date_Bid__c from Opportunity where Id in :oppIds and Bidding_Project_Name_Bid__r.InfoType__c != '3:结果'];
|
if (opps != null && opps.size() > 0) {
|
for (Opportunity opp : opps) {
|
for (Tender_Opportunity_Link__c link : links) {
|
if (link.Opportunity__c == opp.Id) {
|
opp.Bidding_Project_Name_Bid__c = link.Tender_information__c;
|
break;
|
}
|
}
|
}
|
// 需要跳过询价trigger 防止出现重复更新的情况
|
StaticParameter.EscapeOpportunityBefUpdTrigger = true;
|
update opps;
|
StaticParameter.EscapeOpportunityBefUpdTrigger = false;
|
}
|
}
|
}
|
}
|
if (lostWinIds.size() > 0) {
|
List<Tender_Opportunity_Link__c> links_2 =
|
[SELECT id,
|
Tender_information__c,
|
Opportunity__c
|
FROM Tender_Opportunity_Link__c
|
WHERE Tender_information__c NOT IN :lostWinIds
|
AND Tender_information__r.InfoType__c = '3:结果'
|
AND Opportunity__r.Bidding_Project_Name_Bid__c IN :lostWinIds];
|
if (links_2 != null && links_2.size() > 0) {
|
List<String> oppIds = new List<String>();
|
for (Tender_Opportunity_Link__c link : links_2) {
|
oppIds.add(link.Opportunity__c);
|
}
|
if (oppIds.size() > 0) {
|
List<Opportunity> opps_2 = [select id, Bidding_Project_Name_Bid__c, Bidding_Project_Name_Bid__r.InfoType__c, Closing_Bid_Date_Bid__c from Opportunity where Id in :oppIds and Bidding_Project_Name_Bid__r.InfoType__c != '3:结果'];
|
if (opps_2 != null && opps_2.size() > 0) {
|
for (Opportunity opp : opps_2) {
|
for (Tender_Opportunity_Link__c link : links_2) {
|
if (link.Opportunity__c == opp.Id) {
|
opp.Bidding_Project_Name_Bid__c = link.Tender_information__c;
|
break;
|
}
|
}
|
}
|
// 需要跳过询价trigger 防止出现重复更新的情况
|
StaticParameter.EscapeOpportunityBefUpdTrigger = true;
|
update opps_2;
|
StaticParameter.EscapeOpportunityBefUpdTrigger = false;
|
}
|
}
|
}
|
}
|
}
|
|
public void updateTenOwner() {
|
System.debug('12345678');
|
//1.获得医院
|
Set<Id> hpIdsets = new Set<Id>();
|
// Map < 招投标Id,Map<关联医院 >> 对应招投标下的关联医院
|
Map<Id, Map<Id, Id>> hpIdsetsMap = new Map<Id, Map<Id, Id>>();
|
// 得到招投标的所有人
|
Map<Id, Id> tenderinformationOwnerMap = new Map<Id, Id>();
|
// 得到招投标的关联战略科室
|
Map<Id, List<String>> department_selectionMap = new Map<Id, List<String>>();
|
for (Tender_information__c info : newList) {
|
Map<Id, Id> ressMap = new Map<Id, Id>();
|
// 多加一步判断 如果new的OwnerId和old的不同 就不再做判断了 start
|
// add 【委托】P-招标项目-手动创建的招标项目增加必填字段 2021/11/03 fxk Star
|
Tender_information__c oldTen = new Tender_information__c();
|
if (oldMap!=null && oldMap.containskey(info.Id)) {
|
oldTen = oldMap.get(info.Id);
|
}
|
// add 【委托】P-招标项目-手动创建的招标项目增加必填字段 2021/11/03 fxk End
|
if (oldTen.OwnerId != null && !oldTen.OwnerId.equals(info.OwnerId)) {
|
continue;
|
}
|
// 多加一步判断 如果new的OwnerId和old的不同 就不再做判断了 end
|
tenderinformationOwnerMap.put(info.Id, info.OwnerId);
|
System.debug('-------9=======' + info.Hospital__c);
|
if (info.Hospital__c != null) {
|
hpIdsets.add(info.Hospital__c);
|
System.debug('-------7=======' + hpIdsets);
|
ressMap.put(info.Hospital__c, info.Hospital__c);
|
System.debug('-------8=======' + ressMap);
|
}
|
// if (info.Hospital1__c != null) {
|
// hpIdsets.add(info.Hospital1__c);
|
// ressMap.put(info.Hospital1__c, info.Hospital1__c);
|
// }
|
// if (info.Hospital2__c != null) {
|
// hpIdsets.add(info.Hospital2__c);
|
// ressMap.put(info.Hospital2__c, info.Hospital2__c);
|
// }
|
// if (info.Hospital3__c != null) {
|
// hpIdsets.add(info.Hospital3__c);
|
// ressMap.put(info.Hospital3__c, info.Hospital3__c);
|
// }
|
// if (info.Hospital4__c != null) {
|
// hpIdsets.add(info.Hospital4__c);
|
// ressMap.put(info.Hospital4__c, info.Hospital4__c);
|
// }
|
hpIdsetsMap.put(info.Id, ressMap);
|
if (info.department_selection__c != null) {
|
List<String> tenDepartList = info.department_selection__c.split(';');
|
department_selectionMap.put(info.Id, tenDepartList);
|
}
|
}
|
|
if (hpIdsets.contains(null)) {
|
hpIdsets.remove(null);
|
}
|
|
List<Account> accList = new List<Account>();
|
System.debug('-------4=======' + hpIdsets);
|
if (hpIdsets.size() > 0) {
|
System.debug('-------5=======');
|
//获取医院下所有启用战略科室的启用所有人
|
//取得战略科室:
|
// accList = [select id,OwnerId,ParentId,OwnerIsActive__c from Account where Parent.RecordType_DeveloperName__c = 'HP'
|
// AND OwnerIsActive__c = true
|
// AND ParentId in :hpIdsets];
|
//获取医院上的主担当
|
accList = [select id, GI_Main__c, GI_Main__r.IsActive, BF_owner__c, BF_owner__r.IsActive,
|
ET_owner__c, ET_owner__r.IsActive, SP_Main__c, SP_Main__r.IsActive, URO_owner_ID__c, URO_owner_ID__r.IsActive,
|
GYN_owner__c, GYN_owner__r.IsActive, ENT_owner_ID__c, ENT_owner_ID__r.IsActive, Energy_LeaderStr__c
|
from Account where Id in :hpIdsets ];
|
}
|
|
|
|
|
// List<Tender_information__c> TenInfoList = new List<Tender_information__c>();
|
// Map<Id,Map<String,Id>> ddd = new Map<Id,Map<String,Id>>();
|
// for (Id tenderId : hpIdsetsMap.keySet()) {
|
// // Tender_information__c ten = new Tender_information__c();
|
// // ten.Id = tenderId;
|
// Id tenderownerId = tenderinformationOwnerMap.get(tenderId);
|
// Map<Id, Id> ressMap = hpIdsetsMap.get(tenderId);
|
// for (Account hp : accList) {
|
// Map<String, Id> hptempMap = new Map<String, Id>();
|
|
// Map<String, Id> hptempMap1 = new Map<String, Id>();
|
// if (ressMap.containsKey(hp.Id) && ddd.containsKey(tenderId)) {
|
// hptempMap1 = ddd.get()
|
// }
|
// if (hp.GI_Main__c != null && hp.GI_Main__r.IsActive ) {
|
// hptempMap.put('01210000000QemLAAS', hp.GI_Main__c);
|
// // ttt = tenderownerId == hp.GI_Main__c;
|
// hptempMap1.put(hp.GI_Main__c,hp.GI_Main__c);
|
// }
|
// // 呼吸科主担当
|
// if (hp.BF_owner__c != null && hp.BF_owner__r.IsActive ) {
|
// hptempMap.put('01210000000QezZAAS', hp.BF_owner__c);
|
// }
|
|
// // 普外科主担当
|
// if (hp.SP_Main__c != null && hp.SP_Main__r.IsActive) {
|
// hptempMap.put('01210000000QezeAAC', hp.SP_Main__c);
|
// }
|
// // 泌尿科主担当
|
// if (hp.URO_owner_ID__c != null && hp.URO_owner_ID__r.IsActive) {
|
// hptempMap.put('01210000000QezjAAC', hp.URO_owner_ID__c);
|
// }
|
// // 妇科主担当
|
// if (hp.GYN_owner__c != null && hp.GYN_owner__r.IsActive) {
|
// hptempMap.put('01210000000QezoAAC', hp.GYN_owner__c);
|
// }
|
// // 耳鼻喉科主担当
|
// if (hp.ENT_owner_ID__c != null && hp.ENT_owner_ID__r.IsActive) {
|
// hptempMap.put('01210000000QeztAAC', hp.ENT_owner_ID__c);
|
// }
|
|
// // if (ressMap.containsKey(hp.Id) && !hptempMap1.containsKey(tenderownerId)) {
|
// // ddd.put(tenderId, hptempMap);
|
// // }
|
// }
|
|
|
// }
|
// 用于更新招投标
|
List<Tender_information__c> TenInfoList = new List<Tender_information__c>();
|
|
Map<Id, Map<String, Id>> hpTypeToMainMap = new Map<Id, Map<String, Id>>();
|
// 存招投标对应的医院主担当
|
Map<Id, Map<String, Id>> hpMainMap = new Map<Id, Map<String, Id>>();
|
for (Id tenderId : hpIdsetsMap.keySet()) {
|
// 招投标 所有人
|
Id tenderownerId = tenderinformationOwnerMap.get(tenderId);
|
// 存医院
|
Map<Id, Id> ressMap = hpIdsetsMap.get(tenderId);
|
System.debug('-------3=======' + accList);
|
Map<String, Id> hpTypeToMaintempMap = new Map<String, Id>();
|
if (accList.size() > 0) {
|
for (Account hp : accList) {
|
// 医院主担当 记录类型Id 对应 医院主担当
|
hpTypeToMaintempMap = new Map<String, Id>();
|
// 存放 医院主担当
|
Map<String, Id> hpMaintempMap = new Map<String, Id>();
|
// 关联医院
|
if (ressMap.containsKey(hp.Id) && hpMainMap.containsKey(tenderId)) {
|
hpMaintempMap = hpMainMap.get(tenderId);
|
}
|
if (hp.GI_Main__c != null && hp.GI_Main__r.IsActive ) {
|
hpTypeToMaintempMap.put('01210000000QemLAAS', hp.GI_Main__c);
|
hpMaintempMap.put(hp.GI_Main__c, hp.GI_Main__c);
|
}
|
// 呼吸科主担当
|
if (hp.BF_owner__c != null && hp.BF_owner__r.IsActive ) {
|
hpTypeToMaintempMap.put('01210000000QezZAAS', hp.BF_owner__c);
|
hpMaintempMap.put(hp.BF_owner__c, hp.BF_owner__c);
|
}
|
// 普外科主担当
|
if (hp.SP_Main__c != null && hp.SP_Main__r.IsActive) {
|
hpTypeToMaintempMap.put('01210000000QezeAAC', hp.SP_Main__c);
|
hpMaintempMap.put(hp.SP_Main__c, hp.SP_Main__c);
|
}
|
// 泌尿科主担当
|
if (hp.URO_owner_ID__c != null && hp.URO_owner_ID__r.IsActive) {
|
hpTypeToMaintempMap.put('01210000000QezjAAC', hp.URO_owner_ID__c);
|
hpMaintempMap.put(hp.URO_owner_ID__c, hp.URO_owner_ID__c);
|
}
|
// 妇科主担当
|
if (hp.GYN_owner__c != null && hp.GYN_owner__r.IsActive) {
|
hpTypeToMaintempMap.put('01210000000QezoAAC', hp.GYN_owner__c);
|
hpMaintempMap.put(hp.GYN_owner__c, hp.GYN_owner__c);
|
}
|
// 耳鼻喉科主担当
|
if (hp.ENT_owner_ID__c != null && hp.ENT_owner_ID__r.IsActive) {
|
hpTypeToMaintempMap.put('01210000000QeztAAC', hp.ENT_owner_ID__c);
|
hpMaintempMap.put(hp.ENT_owner_ID__c, hp.ENT_owner_ID__c);
|
}
|
// 存招投标下所有关联医院 的所有主担当
|
if (ressMap.containsKey(hp.Id) ) {
|
hpMainMap.put(tenderId, hpMaintempMap);
|
}
|
}
|
}
|
// 所有关联医院的主担当不包含 招投标所有人
|
System.debug('-------2=======' + hpMainMap);
|
if (hpMainMap.get(tenderId) != null) {
|
// 增加判断战略科室
|
if (department_selectionMap.get(tenderId) != null) {
|
boolean changeOwner = true;
|
Map<String, Id> tenHpMainMap = hpMainMap.get(tenderId);
|
for (String type : department_selectionMap.get(tenderId)) {
|
if (tenHpMainMap.get(type) != null && tenHpMainMap.get(type).equals(tenderownerId)) {
|
changeOwner = false;
|
break;
|
}
|
}
|
if (changeOwner) {
|
hpTypeToMainMap.put(tenderId, hpTypeToMaintempMap);
|
}
|
} else {
|
hpTypeToMaintempMap.put('00510000000gmxH', '00510000000gmxH');
|
hpTypeToMainMap.put(tenderId, hpTypeToMaintempMap);
|
}
|
} else {
|
hpTypeToMaintempMap.put('00510000000gmxH', '00510000000gmxH');
|
hpTypeToMainMap.put(tenderId, hpTypeToMaintempMap);
|
}
|
|
}
|
System.debug('-------1=======' + hpTypeToMainMap);
|
Map<Id, Id> UpdateTenMap = new Map<Id, Id>();
|
if (hpTypeToMainMap.size() > 0) {
|
// 查招投标-询价关联表
|
List<Tender_Opportunity_Link__c> TenOppLinkList = [select Id, Opportunity__c, Tender_information__c, Opportunity__r.OwnerId, Opportunity__r.Owner.IsActive, Name
|
from Tender_Opportunity_Link__c where Tender_information__c in :hpTypeToMainMap.keySet() and Opportunity__r.Owner.IsActive = true
|
order by Tender_information__c, Name asc];
|
Map<Id, Id> oppMainMap = new Map<Id, Id>();
|
for (Tender_Opportunity_Link__c oppLinks : TenOppLinkList) {
|
if (!oppMainMap.containsKey(oppLinks.Tender_information__c)) {
|
oppMainMap.put(oppLinks.Tender_information__c, oppLinks.Opportunity__r.OwnerId );
|
}
|
}
|
|
for (Id tenderId : hpTypeToMainMap.keySet()) {
|
for (Tender_information__c info : newList) {
|
// add 【委托】P-招标项目-手动创建的招标项目增加必填字段 2021/11/03 fxk Star
|
Tender_information__c oldTen = new Tender_information__c();
|
if (oldMap!=null && oldMap.containskey(info.Id)) {
|
oldTen = oldMap.get(info.Id);
|
}
|
// add 【委托】P-招标项目-手动创建的招标项目增加必填字段 2021/11/03 fxk End
|
// 招投标没关联询价
|
if (!oppMainMap.containsKey(tenderId)) {
|
System.debug('----------5---------' + oppMainMap);
|
// 招投标 关联战略科室(字段) 有值
|
if (department_selectionMap.containsKey(tenderId)) {
|
System.debug('----------4---------' + department_selectionMap);
|
// 战略科室的 记录类型
|
String typeId = department_selectionMap.get(tenderId) == null ? '' : department_selectionMap.get(tenderId)[0];
|
System.debug('----------6---------' + typeId);
|
Map<String, Id> hpTypeToMaintempMap = hpTypeToMainMap.get(tenderId);
|
System.debug('----------7---------' + hpTypeToMaintempMap);
|
if (hpTypeToMaintempMap.containsKey(typeId)) {
|
UpdateTenMap.put(tenderId, hpTypeToMaintempMap.get(typeId));
|
System.debug('----------8---------' + UpdateTenMap);
|
} else {
|
UpdateTenMap.put(tenderId, '00510000000gmxH');
|
System.debug('----------9---------' + UpdateTenMap);
|
}
|
} else {
|
UpdateTenMap.put(tenderId, '00510000000gmxH');
|
System.debug('----------10---------' + UpdateTenMap);
|
}
|
} else if ((oldTen.OwnerId != null && oldTen.OwnerId.equals(info.OwnerId))
|
&& !hpMainMap.get(tenderId).containskey(info.ownerId)) {
|
UpdateTenMap.put(tenderId, oppMainMap.get(tenderId));
|
System.debug('----------11---------' + UpdateTenMap);
|
}
|
}
|
}
|
}
|
// StaticParameter.EscapeOtherUpdateTenOwner = false;
|
if (UpdateTenMap.size() > 0) {
|
for (Tender_information__c info : newList) {
|
if (UpdateTenMap.containsKey(info.Id)) {
|
info.OwnerId = UpdateTenMap.get(info.Id);
|
}
|
}
|
}
|
// StaticParameter.EscapeOtherUpdateTenOwner = true;
|
}
|
}
|