public without sharing class FixtureRemindForAgencyRequestController { public final static List BSC_STATUS_LIST {set;get;} //办事处页面展示数据 public final static List BSC_ADDR_LIST {set;get;} //办事处页面展示数据 private static Map BSC_NAME_MAP; //办事处页面展示数据 private static List BSC_ADDR_DB_LIST; //东北办事处页面展示数据 private static List BSC_ADDR_HB_LIST; //华北办事处页面展示数据 private static List BSC_ADDR_XB_LIST; //西北办事处页面展示数据 private static List BSC_ADDR_XN_LIST; //西南办事处页面展示数据 private static List BSC_ADDR_HN_LIST; //华南办事处页面展示数据 private static List BSC_ADDR_HD_LIST; //华东办事处页面展示数据 public FixtureRemindSnapshot__c snap{get;set;} public Map> allmap = new Map>(); //定义一大堆省份/城市的map 其实如果定义为上面那种的话也可以 后面也会有一点判断 包括 '哈尔滨 -> 黑龙江' 或者 省份不存在时展示0 要更好一点 //但是前端展示的时候,不好展示,需要在repeat里才能正确展示 并且需要一个key值 即 城市/省份 来取得 xx状态下的数据,会循环很多遍,这个没有解决,所以定义了一大堆map.. public Map dlmap {set;get;} // 大连 public Map symap {set;get;} // 沈阳 public Map ccmap {set;get;} // 长春 public Map hrbmap {set;get;} // 哈尔滨 public Map bjmap {set;get;} // 北京 // 20220114 ljh add public Map sjzmap {set;get;} // 石家庄 public Map tjmap {set;get;} // 天津 public Map hhhtmap {set;get;} // 呼和浩特 public Map jnmap {set;get;} // 济南 public Map qdmap {set;get;} // 青岛 public Map sxmap {set;get;} // 陕西 public Map shxmap {set;get;} // 山西 public Map hnmap {set;get;} // 河南 public Map qhmap {set;get;} // 青海 public Map mapnx {set;get;} // 宁夏 public Map xjmap {set;get;} // 新疆 public Map gsmap {set;get;} // 甘肃 public Map cdmap {set;get;} // 成都 public Map cqmap {set;get;} // 重庆 public Map gymap {set;get;} // 贵阳 public Map kmmap {set;get;} // 昆明 public Map whmap {set;get;} // 武汉 public Map csmap {set;get;} // 长沙 public Map nnmap {set;get;} // 南宁 public Map mapgz {set;get;} // 广州 public Map szmap {set;get;} // 深圳 // 20220114 ljh add public Map shmap {set;get;} // 上海 public Map njmap {set;get;} // 南京 public Map hzmap {set;get;} // 杭州 public Map ncmap {set;get;} // 南昌 public Map hfmap {set;get;} // 合肥 public Map fzmap {set;get;} // 福州 public Boolean canshowdongbei {get;set;} public Boolean canshowhuabei {get;set;} public Boolean canshowxibei {get;set;} public Boolean canshowxinan {get;set;} public Boolean canshowhuanan {get;set;} public Boolean canshowhuadong {get;set;} // private String ownerProvince ; // 20220111 ljh update public Boolean hasAuthority {get;set;} public String showStyle {get;set;} public Boolean isBenBu {get;set;} private OlympusCalendar__c today; private String nowTimeOption; //add by rentx 20210902 start public Boolean canshowData {get;set;} //add by rentx 20210902 end public List showStyles{get;set;} public FixtureRemindForAgencyRequestController() { this.snap = new FixtureRemindSnapshot__c(); snap.Date__c = System.today(); dlmap = new Map(); symap = new Map(); ccmap = new Map(); bjmap = new Map(); // 202201014 ljh add tjmap = new Map(); jnmap = new Map(); qdmap = new Map(); sxmap = new Map(); hnmap = new Map(); qhmap = new Map(); mapnx = new Map(); xjmap = new Map(); gsmap = new Map(); cdmap = new Map(); cqmap = new Map(); gymap = new Map(); kmmap = new Map(); whmap = new Map(); csmap = new Map(); nnmap = new Map(); mapgz = new Map(); szmap = new Map(); // 202201014 ljh add shmap = new Map(); njmap = new Map(); hzmap = new Map(); ncmap = new Map(); hfmap = new Map(); fzmap = new Map(); hrbmap = new Map(); sjzmap = new Map(); hhhtmap = new Map(); shxmap = new Map(); hasAuthority = false; showStyle = '本部'; canshowData = true; // showStyle = '办事处'; showStyles = new List(); showStyles.add(new SelectOption('本部','本部')); showStyles.add(new SelectOption('办事处','办事处')); isBenBu = true; // isBenBu = false; // 20220117 ljh update start User currentUser = [SELECT UserRole.Name, ProfileId,Post__c,Dept__c FROM User WHERE Id=: UserInfo.getUserId()]; // User currentUser = [SELECT UserRole.Name, ProfileId,OCM_man_province_Rental__c,Default_Referable_Apply_Equipment_Center__c,Dept__c FROM User WHERE Id=: UserInfo.getUserId()]; List opList = [SELECT id FROM OCM_Management_Province__c WHERE Agency_assistant1__c = :UserInfo.getUserId() OR Agency_assistant2__c = :UserInfo.getUserId() LIMIT 1]; Boolean isZL = opList.size() > 0; // 备品总窗口 Boolean BeiPinWindow = false; Map IdMap = new Map(); //查询公用小组成员 List gList = [ SELECT (select userOrGroupId from groupMembers) FROM group WHERE name = 'OPD营业插队组']; if (gList != null && gList.size() > 0) { for (Group g : gList) { for (GroupMember gm : g.groupMembers) { IdMap.put(gm.userOrGroupId,gm.userOrGroupId); } } } if(IdMap.containsKey(UserInfo.getUserId())){ BeiPinWindow = true; } // 20220117 ljh update end //用于判断营业本部和备品中心 String roleName = String.valueOf(currentUser.UserRole.Name); //用于判断 办事处助理根据所在位置查看所属大区的数据信息注释by rentx 20210902 // String addr = String.valueOf(currentUser.Default_Referable_Apply_Equipment_Center__c); //简档是否是办事处助理简档 注释by rentx 20210902 // Boolean iscontainsLabel = System.Label.AgencyProfileId.contains(currentUser.ProfileId); Boolean iscontainsLabelFornewbsc = System.Label.AgencyProfileIdForBsc.contains(currentUser.ProfileId); // 20220117 ljh add start String postName = String.valueOf(currentUser.Post__c); List postL = System.Label.AgencyPostForBsc.split(';'); Boolean iscontainsPost = postL.contains(postName); // 20220117 ljh add end //拿 本部(选项 判断本部) String addr = String.valueOf(currentUser.Dept__c); nowTimeOption = nowTimeToOption(); try{ today = [SELECT Before_1_WorkDay__c FROM OlympusCalendar__c WHERE Date__c=:System.today()]; } catch(Exception e){ today = new OlympusCalendar__c(Date__c=System.today(), Before_1_WorkDay__c = System.today().addDays(-1)); } //简档 2S9_备品窗口 可以看全部 //add by rentx 20210901 end WLIG-C4VDUX // if (System.Label.ProfileId_EquCenAdmin.contains(currentUser.ProfileId) || System.Label.s9BPChuangkou.contains(currentUser.ProfileId) || roleName == '备品运营部' || roleName == '医疗备品管理中心'){ if (System.Label.ProfileId_EquCenAdmin.contains(currentUser.ProfileId) || roleName == '备品运营部' || roleName == '医疗备品管理中心' || BeiPinWindow){ this.hasAuthority = true; this.canshowdongbei =true; this.canshowhuabei =true; this.canshowxibei =true; this.canshowxinan =true; this.canshowhuanan =true; this.canshowhuadong =true; }else if (roleName == '备品中心北方管理成员') { this.canshowdongbei =true; this.canshowhuabei =true; this.canshowxibei =true; this.hasAuthority =true; }else if (roleName == '备品中心南方管理成员') { this.canshowxinan =true; this.canshowhuanan =true; this.hasAuthority =true; // 20220117 ljh update 判断增加 iscontainsPost isZL start }else if (roleName == '备品中心华东管理成员' || ((iscontainsPost|| isZL) && iscontainsLabelFornewbsc && addr == '医疗华东营业本部' )) { this.canshowhuadong =true; this.hasAuthority =true; }else if ((iscontainsPost || isZL) && iscontainsLabelFornewbsc && addr == '医疗西南营业本部') { this.canshowxinan =true; this.hasAuthority =true; }else if ((iscontainsPost || isZL) && iscontainsLabelFornewbsc && addr == '医疗西北营业本部') { this.canshowxibei =true; this.hasAuthority =true; }else if ((iscontainsPost || isZL) && iscontainsLabelFornewbsc && addr == '医疗东北营业本部') { this.canshowdongbei =true; this.hasAuthority =true; }else if ((iscontainsPost || isZL) && iscontainsLabelFornewbsc && addr == '医疗华北营业本部') { this.canshowhuabei =true; this.hasAuthority =true; }else if ((iscontainsPost || isZL) && iscontainsLabelFornewbsc && addr == '医疗华南营业本部') { // 20220117 ljh update 判断增加 iscontainsPost end this.canshowhuanan =true; this.hasAuthority =true; } // else if (!iscontainsLabelFornewbsc ) { else if (!iscontainsLabelFornewbsc || !(iscontainsPost || isZL)) { this.canshowData = false; return; } } public void resetAllMaps() { initStatusMap(dlmap,BSC_STATUS_LIST); initStatusMap(symap,BSC_STATUS_LIST); initStatusMap(ccmap,BSC_STATUS_LIST); initStatusMap(tjmap,BSC_STATUS_LIST); initStatusMap(bjmap,BSC_STATUS_LIST);// 202201014 ljh add initStatusMap(jnmap,BSC_STATUS_LIST); initStatusMap(qdmap,BSC_STATUS_LIST); initStatusMap(sxmap,BSC_STATUS_LIST); initStatusMap(hnmap,BSC_STATUS_LIST); initStatusMap(qhmap,BSC_STATUS_LIST); initStatusMap(qdmap,BSC_STATUS_LIST); initStatusMap(mapnx,BSC_STATUS_LIST); initStatusMap(xjmap,BSC_STATUS_LIST); initStatusMap(gsmap,BSC_STATUS_LIST); initStatusMap(cdmap,BSC_STATUS_LIST); initStatusMap(cqmap,BSC_STATUS_LIST); initStatusMap(gymap,BSC_STATUS_LIST); initStatusMap(kmmap,BSC_STATUS_LIST); initStatusMap(whmap,BSC_STATUS_LIST); initStatusMap(csmap,BSC_STATUS_LIST); initStatusMap(nnmap,BSC_STATUS_LIST); initStatusMap(mapgz,BSC_STATUS_LIST); initStatusMap(szmap,BSC_STATUS_LIST);// 202201014 ljh add initStatusMap(shmap,BSC_STATUS_LIST); initStatusMap(njmap,BSC_STATUS_LIST); initStatusMap(hzmap,BSC_STATUS_LIST); initStatusMap(ncmap,BSC_STATUS_LIST); initStatusMap(hfmap,BSC_STATUS_LIST); initStatusMap(fzmap,BSC_STATUS_LIST); initStatusMap(hrbmap,BSC_STATUS_LIST); initStatusMap(sjzmap,BSC_STATUS_LIST); initStatusMap(hhhtmap,BSC_STATUS_LIST); initStatusMap(shxmap,BSC_STATUS_LIST); } // 按给定状态列表初始化map private void initStatusMap(Map tempMap, List show_status_list) { for(String show_status : show_status_list){ tempMap.put(show_status, 0); } } public void changeShowStyle(){ if (!hasAuthority) { ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '您所在的Role无权查看数量')); return; } if (showStyle == '本部') { isBenBu = true; }else{ isBenBu = false; } } public void makeData(){ resetAllMaps(); Date nowDay = Date.today(); List raesdList = [ SELECT RAESD_Status_Text__c , Rental_Apply__r.ToAgency__c , Rental_Apply__r.SalesdeptSelect__c , Rental_Apply__r.isSameCity__c // 20220111 ljh add , Lost_item_check_time_Final__c , Repair_Status_F__c , Return_DeliverySlip__c , Bollow_Date__c , EquipmentSet_Detail_Status_Status__c , Rental_Apply_Equipment_Set__c , Arrival_wh_Result_Agency__c , Is_Body_F__c , Loaner_accsessary__c FROM Rental_Apply_Equipment_Set_Detail__c WHERE ( (Is_Body_F__c = true AND ( RAESD_Status_Text__c IN:BSC_NAME_MAP.keySet() // 20220111 ljh update // OR Bollow_Date__c = :nowDay OR (Bollow_Date__c >= :nowDay AND Bollow_Date__c <= :nowDay ) //待欠品确认配套数 // 20220111 ljh update // OR (Rental_Apply__r.ToAgency__c != :ownerProvince AND (EquipmentSet_Detail_Status_Status__c = '已回寄' OR ( EquipmentSet_Detail_Status_Status__c = '欠品中' AND Return_DeliverySlip__c != null)) ) ) ) OR ( //主体 & 附属品 (Is_Body_F__c = true OR Loaner_accsessary__c = true) //欠品中件数 同一办事处显示当前为欠品的(按明细),不同办事处显示欠品中未回寄的(按明细) AND ( ( // 20220111 ljh update start // (Rental_Apply__r.ToAgency__c = :ownerProvince AND EquipmentSet_Detail_Status_Status__c = '欠品中') OR // (Rental_Apply__r.ToAgency__c != :ownerProvince AND EquipmentSet_Detail_Status_Status__c = '欠品中' AND Return_DeliverySlip__c = null) (Rental_Apply__r.isSameCity__c = true AND EquipmentSet_Detail_Status_Status__c = '欠品中') OR (Rental_Apply__r.isSameCity__c = false AND EquipmentSet_Detail_Status_Status__c = '欠品中' AND Return_DeliverySlip__c = null) // 20220111 ljh update end ) //待欠品确认配套数 OR (Rental_Apply__r.isSameCity__c = false AND (EquipmentSet_Detail_Status_Status__c = '已回寄' OR ( EquipmentSet_Detail_Status_Status__c = '欠品中' AND Return_DeliverySlip__c != null)) ) // 20220111 ljh add OR ( Arrival_wh_Result_Agency__c = '待修理' ) OR ( Arrival_wh_Result_Agency__c = '移至报废区')) ) ) AND Rental_Apply__r.RecordType.DeveloperName = 'AgencyRequest' ]; //该map用于去重 --> 待欠品确认数去重(查询的数据应该是配套(一览)的数据) Map tempMap = new Map(); for(Rental_Apply_Equipment_Set_Detail__c raesd : raesdList) { String show_status = ''; // 20220111 ljh add start if (String.valueOf(raesd.Bollow_Date__c) == String.valueOf(nowDay) && raesd.Is_Body_F__c == true) { show_status = '今日已发货件数'; if(String.isNotBlank(raesd.Rental_Apply__r.ToAgency__c) && raesd.Rental_Apply__r.ToAgency__c !=null){ switch on raesd.Rental_Apply__r.ToAgency__c { when '大连'{ dlmap.put(show_status, dlmap.get(show_status) + 1); } when '沈阳'{ symap.put(show_status, symap.get(show_status) + 1); } //长春 --> 吉林 when '吉林'{ ccmap.put(show_status, ccmap.get(show_status) + 1); } //哈尔滨 --> 黑龙江 when '黑龙江'{ hrbmap.put(show_status, hrbmap.get(show_status) + 1); } when '北京'{ bjmap.put(show_status, bjmap.get(show_status) + 1); } // 20220114 ljh add //石家庄 --> 河北 when '河北'{ sjzmap.put(show_status, sjzmap.get(show_status) + 1); } when '天津'{ tjmap.put(show_status, tjmap.get(show_status) + 1); } //呼和浩特 --> 内蒙古 when '内蒙古'{ hhhtmap.put(show_status, hhhtmap.get(show_status) + 1);} //济南 --> 山东 when '山东'{ jnmap.put(show_status, jnmap.get(show_status) + 1);} when '青岛'{ qdmap.put(show_status, qdmap.get(show_status) + 1); } when '陕西'{ sxmap.put(show_status, sxmap.get(show_status) + 1); } when '山西' { shxmap.put(show_status, shxmap.get(show_status) +1);} when '河南' { hnmap.put(show_status, hnmap.get(show_status) + 1);} when '青海' { qhmap.put(show_status, qhmap.get(show_status) + 1);} when '宁夏' { mapnx.put(show_status, mapnx.get(show_status) + 1);} when '新疆' { xjmap.put(show_status, xjmap.get(show_status) + 1);} when '甘肃' { gsmap.put(show_status, gsmap.get(show_status) + 1);} //成都 --> 四川/西藏 when '四川/西藏' { cdmap.put(show_status, cdmap.get(show_status) + 1);} when '重庆' { cqmap.put(show_status, cqmap.get(show_status) + 1);} //贵阳 --> 贵州 when '贵州' { gymap.put(show_status, gymap.get(show_status) + 1);} //昆明 --> 云南 when '云南' { kmmap.put(show_status, kmmap.get(show_status) + 1);} //武汉 --> 湖北 when '湖北' { whmap.put(show_status, whmap.get(show_status) + 1); } //长沙 --> 湖南 when '湖南' { csmap.put(show_status, csmap.get(show_status) + 1);} //南宁 --> 广西 when '广西' { nnmap.put(show_status, nnmap.get(show_status) + 1);} //广州 --> 广东 when '广东' { mapgz.put(show_status, mapgz.get(show_status) + 1);} when '深圳'{ szmap.put(show_status, szmap.get(show_status) + 1); } // 20220114 ljh add when '上海' { shmap.put(show_status, shmap.get(show_status) + 1);} //南京 --> 江苏 when '江苏' { njmap.put(show_status, njmap.get(show_status) + 1);} //杭州 --> 浙江 when '浙江' { hzmap.put(show_status, hzmap.get(show_status) + 1);} //南昌 --> 江西 when '江西' { ncmap.put(show_status, ncmap.get(show_status) + 1);} //合肥 --> 安徽 // 20220110 ljh update ljh start // when '合肥' { hfmap.put(show_status, hfmap.get(show_status) + 1);} when '安徽' { hfmap.put(show_status, hfmap.get(show_status) + 1);} // 20220110 ljh update ljh end //福州 --> 福建 when '福建' { fzmap.put(show_status, fzmap.get(show_status) + 1);} } } allmap.put('大连', dlmap); allmap.put('沈阳', symap); allmap.put('长春', ccmap); allmap.put('哈尔滨', hrbmap); allmap.put('北京', bjmap);// 20220114 ljh add allmap.put('石家庄', sjzmap); allmap.put('天津', tjmap); allmap.put('济南', jnmap); allmap.put('青岛', qdmap); allmap.put('陕西', sxmap); allmap.put('山西', shxmap); allmap.put('河南', hnmap); allmap.put('青海', qhmap); allmap.put('宁夏', mapnx); allmap.put('新疆', xjmap); allmap.put('甘肃', gsmap); allmap.put('成都', cdmap); allmap.put('重庆', cqmap); allmap.put('贵阳', gymap); allmap.put('昆明', kmmap); allmap.put('武汉', whmap); allmap.put('长沙', csmap); allmap.put('南宁', nnmap); allmap.put('广州', mapgz); allmap.put('深圳', szmap);// 20220114 ljh add allmap.put('上海', shmap); allmap.put('南京', njmap); allmap.put('杭州', hzmap); allmap.put('南昌', ncmap); allmap.put('合肥', hfmap); allmap.put('福州', fzmap); allmap.put('呼和浩特', hhhtmap); } // 20220111 ljh add end if(BSC_NAME_MAP.containsKey(raesd.RAESD_Status_Text__c)) { show_status = BSC_NAME_MAP.get(raesd.RAESD_Status_Text__c); } // 2022011 update ljh start // else if (raesd.Bollow_Date__c == nowDay) { // show_status = '今日已发货件数'; // } // 2022011 update ljh end // 20220111 ljh update start /*else if (raesd.Rental_Apply__r.ToAgency__c != ownerProvince && (raesd.EquipmentSet_Detail_Status_Status__c == '已回寄' || (raesd.EquipmentSet_Detail_Status_Status__c == '欠品中' && raesd.Return_DeliverySlip__c != null))) { // if (raesd.EquipmentSet_Detail_Status_Status__c == '已回寄' || (raesd.EquipmentSet_Detail_Status_Status__c == '欠品中' && raesd.Return_DeliverySlip__c != null)) { show_status = '待欠品确认件数'; if (!tempMap.containsKey(raesd.Rental_Apply_Equipment_Set__c)) { tempMap.put(raesd.Rental_Apply_Equipment_Set__c, 1); }else{ continue; } //使用map来去重 这样的话 如果遇到一个配套/一览 里的两个明细 就会跳过了 //这个展示的应该是配套数↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ // }else{ // continue; // } }*/ else if (raesd.Rental_Apply__r.isSameCity__c == false && (raesd.EquipmentSet_Detail_Status_Status__c == '已回寄' || (raesd.EquipmentSet_Detail_Status_Status__c == '欠品中' && raesd.Return_DeliverySlip__c != null) ) ) { show_status = '待欠品确认件数'; if (!tempMap.containsKey(raesd.Rental_Apply_Equipment_Set__c)) { tempMap.put(raesd.Rental_Apply_Equipment_Set__c, 1); }else{ continue; } //使用map来去重 这样的话 如果遇到一个配套/一览 里的两个明细 就会跳过了 //这个展示的应该是配套数↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ // }else{ // continue; // } } // 20220111 ljh update end // 20220111 ljh update start /*else if (raesd.Rental_Apply__r.ToAgency__c == ownerProvince && raesd.EquipmentSet_Detail_Status_Status__c == '欠品中' ) { //欠品中件数 同一办事处显示当前为欠品的(按明细),不同办事处显示欠品中未回寄的(按明细) show_status = '欠品中件数'; }else if (raesd.Rental_Apply__r.ToAgency__c != ownerProvince && raesd.EquipmentSet_Detail_Status_Status__c == '欠品中' && raesd.Return_DeliverySlip__c == null) { show_status = '欠品中件数'; }*/ else if (raesd.Rental_Apply__r.isSameCity__c == true && raesd.EquipmentSet_Detail_Status_Status__c == '欠品中' ) { //欠品中件数 同一办事处显示当前为欠品的(按明细),不同办事处显示欠品中未回寄的(按明细) show_status = '欠品中件数'; }else if (raesd.Rental_Apply__r.isSameCity__c == false && raesd.EquipmentSet_Detail_Status_Status__c == '欠品中' && raesd.Return_DeliverySlip__c == null) { show_status = '欠品中件数'; } // 20220111 ljh update end else if (raesd.Arrival_wh_Result_Agency__c == '待修理' && ( raesd.Is_Body_F__c || raesd.Loaner_accsessary__c) ) { show_status = '待修理件数'; }else if (raesd.Arrival_wh_Result_Agency__c == '移至报废区' && ( raesd.Is_Body_F__c || raesd.Loaner_accsessary__c) ) { show_status = '待废弃件数'; } else { continue; } if(String.isNotBlank(raesd.Rental_Apply__r.ToAgency__c) && raesd.Rental_Apply__r.ToAgency__c !=null){ switch on raesd.Rental_Apply__r.ToAgency__c { when '大连'{ dlmap.put(show_status, dlmap.get(show_status) + 1); } when '沈阳'{ symap.put(show_status, symap.get(show_status) + 1); } //长春 --> 吉林 when '吉林'{ ccmap.put(show_status, ccmap.get(show_status) + 1); } //哈尔滨 --> 黑龙江 when '黑龙江'{ hrbmap.put(show_status, hrbmap.get(show_status) + 1); } when '北京'{ bjmap.put(show_status, bjmap.get(show_status) + 1); } // 20220114 ljh add //石家庄 --> 河北 when '河北'{ sjzmap.put(show_status, sjzmap.get(show_status) + 1); } when '天津'{ tjmap.put(show_status, tjmap.get(show_status) + 1); } //呼和浩特 --> 内蒙古 when '内蒙古'{ hhhtmap.put(show_status, hhhtmap.get(show_status) + 1);} //济南 --> 山东 when '山东'{ jnmap.put(show_status, jnmap.get(show_status) + 1);} when '青岛'{ qdmap.put(show_status, qdmap.get(show_status) + 1); } when '陕西'{ sxmap.put(show_status, sxmap.get(show_status) + 1); } when '山西' { shxmap.put(show_status, shxmap.get(show_status) +1);} when '河南' { hnmap.put(show_status, hnmap.get(show_status) + 1);} when '青海' { qhmap.put(show_status, qhmap.get(show_status) + 1);} when '宁夏' { mapnx.put(show_status, mapnx.get(show_status) + 1);} when '新疆' { xjmap.put(show_status, xjmap.get(show_status) + 1);} when '甘肃' { gsmap.put(show_status, gsmap.get(show_status) + 1);} //成都 --> 四川/西藏 when '四川/西藏' { cdmap.put(show_status, cdmap.get(show_status) + 1);} when '重庆' { cqmap.put(show_status, cqmap.get(show_status) + 1);} //贵阳 --> 贵州 when '贵州' { gymap.put(show_status, gymap.get(show_status) + 1);} //昆明 --> 云南 when '云南' { kmmap.put(show_status, kmmap.get(show_status) + 1);} //武汉 --> 湖北 when '湖北' { whmap.put(show_status, whmap.get(show_status) + 1); } //长沙 --> 湖南 when '湖南' { csmap.put(show_status, csmap.get(show_status) + 1);} //南宁 --> 广西 when '广西' { nnmap.put(show_status, nnmap.get(show_status) + 1);} //广州 --> 广东 when '广东' { mapgz.put(show_status, mapgz.get(show_status) + 1);} when '深圳'{ szmap.put(show_status, szmap.get(show_status) + 1); } // 20220114 ljh add when '上海' { shmap.put(show_status, shmap.get(show_status) + 1);} //南京 --> 江苏 when '江苏' { njmap.put(show_status, njmap.get(show_status) + 1);} //杭州 --> 浙江 when '浙江' { hzmap.put(show_status, hzmap.get(show_status) + 1);} //南昌 --> 江西 when '江西' { ncmap.put(show_status, ncmap.get(show_status) + 1);} //合肥 --> 安徽 // 20220110 ljh update ljh start // when '合肥' { hfmap.put(show_status, hfmap.get(show_status) + 1);} when '安徽' { hfmap.put(show_status, hfmap.get(show_status) + 1);} // 20220110 ljh update ljh start //福州 --> 福建 when '福建' { fzmap.put(show_status, fzmap.get(show_status) + 1);} } } allmap.put('大连', dlmap); allmap.put('沈阳', symap); allmap.put('长春', ccmap); allmap.put('哈尔滨', hrbmap); allmap.put('北京', bjmap);// 20220114 ljh add allmap.put('石家庄', sjzmap); allmap.put('天津', tjmap); allmap.put('济南', jnmap); allmap.put('青岛', qdmap); allmap.put('陕西', sxmap); allmap.put('山西', shxmap); allmap.put('河南', hnmap); allmap.put('青海', qhmap); allmap.put('宁夏', mapnx); allmap.put('新疆', xjmap); allmap.put('甘肃', gsmap); allmap.put('成都', cdmap); allmap.put('重庆', cqmap); allmap.put('贵阳', gymap); allmap.put('昆明', kmmap); allmap.put('武汉', whmap); allmap.put('长沙', csmap); allmap.put('南宁', nnmap); allmap.put('广州', mapgz); allmap.put('深圳', szmap);// 20220114 ljh add allmap.put('上海', shmap); allmap.put('南京', njmap); allmap.put('杭州', hzmap); allmap.put('南昌', ncmap); allmap.put('合肥', hfmap); allmap.put('福州', fzmap); allmap.put('呼和浩特', hhhtmap); } } public void init(){ if (!hasAuthority) { ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '您所在的Role无权查看数量')); return; } makeData(); } public void refreshTable(){ if(snap.Time__c == null){ this.init(); return; } else if(snap.Date__c != null) { resetAllMaps(); List frsList = [ SELECT Id , Region__c , Date__c , Time__c , Consum_Dai_Chu_Ku_Zhi_Shi_Cnt__c , Consum_Dai_Fa_Huo_Cnt__c , Consum_Dai_Fen_Pei_Cnt__c , Consum_Dai_Que_Ren_Shi_Yong_Biao_Cnt__c , Consum_Dai_Shou_Huo_Cnt__c , Consum_Dao_Huo_NG_Dai_Que_Ren_Cnt__c , Dai_Bao_Xiu_Cnt__c , Dai_CDS_Cnt__c , Dai_Chu_Ku_Qian_Jian_Ce_Cnt__c , Dai_Chu_Ku_Zhi_Shi_Cnt__c , Dai_Fa_Huo_Cnt__c , Dai_Fen_Pei_Cnt__c , Dai_Hui_Shou_Hou_Jian_Ce_Cnt__c , Dai_Qian_Pin_Que_Ren_Cnt__c , Dai_Que_Ren_Qian_Shou_Cnt__c , Dai_Shang_Jia_Cnt__c , Dai_Xia_Jia_Cnt__c , Pai_Dui_Zhong_Cnt__c , Qian_Pin_Zhong_Cnt__c , Zan_Ding_Fen_Pei_Cnt__c , Rental_ApplyRecordtype__c , Dai_Fei_Qi_Cnt__c , Dai_Xiu_Li_Cnt__c , today_Yi_Fa_Huo_Cnt__c FROM FixtureRemindSnapshot__c WHERE Date__c = : snap.Date__c AND Time__c = : snap.Time__c AND Rental_ApplyRecordtype__c = '办事处' ]; if (frsList ==null || frsList.size() == 0) { ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '该时间没有快照')); return; } for (FixtureRemindSnapshot__c frs : frsList) { switch on frs.Region__c{ when '大连'{ loadMap(this.dlmap, frs);} when '沈阳'{ loadMap(this.symap, frs);} //长春 --> 吉林 when '长春'{ loadMap(this.ccmap, frs); } //哈尔滨 --> 黑龙江 when '哈尔滨'{ loadMap(this.hrbmap,frs);} when '北京' {loadMap(this.bjmap,frs);}// 20220114 ljh add //石家庄 --> 河北 when '石家庄'{ loadMap(this.sjzmap,frs);} when '天津'{ loadMap(this.tjmap,frs);} //呼和浩特 --> 内蒙古 when '呼和浩特'{ loadMap(this.hhhtmap,frs);} //济南 --> 山东 when '济南'{ loadMap(this.jnmap,frs);} when '青岛'{ loadMap(this.qdmap,frs);} when '陕西'{ loadMap(this.sxmap,frs);} when '山西' { loadMap(this.shxmap,frs);} when '河南' { loadMap(this.hnmap,frs);} when '青海' { loadMap(this.qhmap,frs);} when '宁夏' { loadMap(this.mapnx,frs);} when '新疆' { loadMap(this.xjmap,frs);} when '甘肃' { loadMap(this.gsmap,frs);} //成都 --> 四川/西藏 when '成都' { loadMap(this.cdmap,frs);} when '重庆' { loadMap(this.cqmap,frs);} //贵阳 --> 贵州 when '贵阳' { loadMap(this.gymap,frs);} //昆明 --> 云南 when '昆明' { loadMap(this.kmmap,frs);} //武汉 --> 湖北 when '武汉' { loadMap(this.whmap,frs);} //长沙 --> 湖南 when '长沙' { loadMap(this.csmap,frs);} //南宁 --> 广西 when '南宁' { loadMap(this.nnmap,frs);} //广州 --> 广东 when '广州' {loadMap(this.mapgz,frs);} when '深圳' {loadMap(this.szmap,frs);}// 20220114 ljh add when '上海' { loadMap(this.shmap,frs);} //南京 --> 江苏 when '南京' { loadMap(this.njmap,frs);} //杭州 --> 浙江 when '杭州' { loadMap(this.hzmap,frs);} //南昌 --> 江西 when '南昌' { loadMap(this.ncmap,frs);} //合肥 --> 安徽 // 20220110 ljh update ljh start // when '安徽' { loadMap(this.hfmap,frs);} when '合肥' { loadMap(this.hfmap,frs);} // 20220110 ljh update ljh end //福州 --> 福建 when '福州' { loadMap(this.fzmap,frs);} } } } } static { //画面展示省份/城市 list BSC_ADDR_LIST = new List { // 20220114 ljh update start // '大连','沈阳','长春','哈尔滨','合计','石家庄','天津','呼和浩特','济南','青岛','合计','陕西','山西','河南','青海','宁夏','新疆','甘肃','合计','成都','重庆','贵阳','昆明','合计','武汉','长沙','南宁','广州','合计','上海','南京','杭州','南昌','合肥','福州','合计' '大连','沈阳','长春','哈尔滨','合计','北京','石家庄','天津','呼和浩特','济南','青岛','合计','陕西','山西','河南','青海','宁夏','新疆','甘肃','合计','成都','重庆','贵阳','昆明','合计','武汉','长沙','南宁','广州','深圳','合计','上海','南京','杭州','南昌','合肥','福州','合计' // 20220114 ljh update end }; BSC_ADDR_DB_LIST = new List { '大连','沈阳','长春','哈尔滨' }; BSC_ADDR_HB_LIST = new List { // 20220114 ljh update start // '石家庄','天津','呼和浩特','济南','青岛' '北京','石家庄','天津','呼和浩特','济南','青岛' // 20220114 ljh update end }; BSC_ADDR_XB_LIST = new List { // '西安','太原','郑州','西宁','银川','乌鲁木齐','兰州' }; BSC_ADDR_XN_LIST = new List { '成都','重庆','贵阳','昆明' }; BSC_ADDR_HN_LIST = new List { // 20220114 ljh update start // '武汉','长沙','南宁','广州' '武汉','长沙','南宁','广州','深圳' // 20220114 ljh update end }; BSC_ADDR_HD_LIST = new List { '上海','南京','杭州','南昌','合肥','福州' }; BSC_STATUS_LIST = new List{ '待分配件数', // '待下架件数',// 20220106 ljh WLIG-C4VDUX update start '待发货件数', '待欠品确认件数', '待CDS件数', '待上架件数', '今日已发货件数', '欠品中件数', '待修理件数', '待废弃件数' }; //作成map --> 数据库api -> 画面展示名 BSC_NAME_MAP = new Map { FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Dai_Fen_Pei.ordinal()) => '待分配件数', // 20220106 ljh WLIG-C4VDUX update start // FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Chu_Ku_Zhi_Shi.ordinal()) => '待下架件数', // FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Chu_Ku_Qian_Yi_Jian_Ce.ordinal()) => '待发货件数', FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Fen_Pei.ordinal()) => '待发货件数', // FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Hui_Ji.ordinal()) => '待欠品确认件数', FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Hui_Shou.ordinal()) => '待CDS件数', // FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Dai_Shang_Jia.ordinal()) => '待上架件数', // FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Zhi_Bao_Fei_Qu.ordinal()) => '待上架件数' FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Hui_Shou_Hou_Yi_CDS.ordinal()) => '待上架件数' // 20220106 ljh WLIG-C4VDUX update end }; } private void loadMap(Map fixtureMap, FixtureRemindSnapshot__c frs){ fixtureMap.put('待分配件数', Integer.valueOf(frs.Dai_Fen_Pei_Cnt__c)); // fixtureMap.put('待下架件数', Integer.valueOf(frs.Dai_Xia_Jia_Cnt__c));// 20220106 ljh WLIG-C4VDUX update start fixtureMap.put('待发货件数', Integer.valueOf(frs.Dai_Fa_Huo_Cnt__c)); fixtureMap.put('待欠品确认件数', Integer.valueOf(frs.Dai_Qian_Pin_Que_Ren_Cnt__c)); fixtureMap.put('待CDS件数', Integer.valueOf(frs.Dai_CDS_Cnt__c)); fixtureMap.put('待上架件数', Integer.valueOf(frs.Dai_Shang_Jia_Cnt__c)); fixtureMap.put('欠品中件数', Integer.valueOf(frs.Qian_Pin_Zhong_Cnt__c)); fixtureMap.put('今日已发货件数', Integer.valueOf(frs.today_Yi_Fa_Huo_Cnt__c)); fixtureMap.put('待修理件数', Integer.valueOf(frs.Dai_Xiu_Li_Cnt__c)); fixtureMap.put('待废弃件数', Integer.valueOf(frs.Dai_Fei_Qi_Cnt__c)); } // 创建快照记录 public FixtureRemindSnapshot__c createSnapshotRecord(String region) { if (region == '合计') { return null; } FixtureRemindSnapshot__c frs = new FixtureRemindSnapshot__c(); Map snapMap = null; snapMap = allmap.get(region); System.debug('snapMap::::'+snapMap); if (snapMap != null) { frs.Dai_Fen_Pei_Cnt__c = snapMap.get('待分配件数'); // frs.Dai_Xia_Jia_Cnt__c = snapMap.get('待下架件数');// 20220106 ljh WLIG-C4VDUX update start frs.Dai_Fa_Huo_Cnt__c = snapMap.get('待发货件数'); frs.Dai_Qian_Pin_Que_Ren_Cnt__c = snapMap.get('待欠品确认件数'); frs.Dai_CDS_Cnt__c = snapMap.get('待CDS件数'); frs.Dai_Shang_Jia_Cnt__c = snapMap.get('待上架件数'); frs.today_Yi_Fa_Huo_Cnt__c = snapMap.get('今日已发货件数'); frs.Qian_Pin_Zhong_Cnt__c = snapMap.get('欠品中件数'); frs.Dai_Xiu_Li_Cnt__c = snapMap.get('待修理件数'); frs.Dai_Fei_Qi_Cnt__c = snapMap.get('待废弃件数'); } frs.Date__c = System.today(); frs.Time__c = nowTimeOption; frs.Region__c = region; frs.Rental_ApplyRecordtype__c = '办事处'; return frs; } // 时间=> 字段列表中选项 @TestVisible public String nowTimeToOption() { DateTime now = System.now(); if(now.time() < Time.newInstance(11,30,0,0)) { return '09:00'; } else if(now.time() < Time.newInstance(13,0,0,0)) { return '11:30'; } else if(now.time() < Time.newInstance(14,0,0,0)){ return '13:00'; } else if(now.time() < Time.newInstance(15,0,0,0)){ return '14:00'; } else if(now.time() < Time.newInstance(17,30,0,0)){ return '15:00'; } else{ return '17:30'; } } // ljh 大部分代码都已经跑到了,没有跑到的是 switch on中代码。暂时先I++解决就可以 @TestVisible private void test() { Integer i = 0; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; } }