From 07390e2fcb4adf27c928335bf27ae7939c5a80ad Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 23 五月 2023 11:28:12 +0800
Subject: [PATCH] bakcup20230523
---
force-app/main/default/classes/SetPersonalTargetController.cls | 303 +++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 234 insertions(+), 69 deletions(-)
diff --git a/force-app/main/default/classes/SetPersonalTargetController.cls b/force-app/main/default/classes/SetPersonalTargetController.cls
index fd2a244..1b6d529 100644
--- a/force-app/main/default/classes/SetPersonalTargetController.cls
+++ b/force-app/main/default/classes/SetPersonalTargetController.cls
@@ -50,6 +50,9 @@
}
// 鏈儴銉椼儷銉�銈︺兂
public static List<SelectOption> salesDptOpts { get; private set; }
+ public static List<SelectOption> options;//<DB202303443108 20230410 you start
+
+
static {
salesDptOpts = new List<SelectOption>();
salesDptOpts.add(new SelectOption('', '--鏃�--'));
@@ -59,15 +62,35 @@
salesDptOpts.add(new SelectOption('4.瑗垮崡', '4.瑗垮崡'));
salesDptOpts.add(new SelectOption('5.鍗庝笢', '5.鍗庝笢'));
salesDptOpts.add(new SelectOption('6.鍗庡崡', '6.鍗庡崡'));
+
+ ////<DB202303443108 20230410 you start 浠婂勾杩樻槸鍙樉绀�6澶ф湰閮紝鏆傛椂娉ㄩ噴
+ //options= FixtureUtil.getPlickList('User', 'Dept__c');
+ //for (SelectOption op : options) {
+ // if (String.isNotBlank(op.getValue())) {
+ // //if(op.getValue()=='鑳介噺浜嬩笟鏈儴'){
+ // // salesDptOpts.add(new SelectOption('鑳介噺浜嬩笟鏈儴','7.鑳介噺'));
+ // //}else{
+ // salesDptOpts.add(new SelectOption(op.getValue(),op.getValue()));
+ // //}
+
+ // }
+ //}
+ ////<DB202303443108 20230410 you end
+
}
// 鑱岀
public static List<SelectOption> userJobCategorys { get; private set; }
static {
+ // DB202303443108 20230407 you start 鑱岀-->SFDC-鑱岀
userJobCategorys = new List<SelectOption>();
userJobCategorys.add(new SelectOption('', '--鏃�--'));
- userJobCategorys.add(new SelectOption('閿�鍞帹骞�', '閿�鍞帹骞�'));
- userJobCategorys.add(new SelectOption('閿�鍞競鍦�', '閿�鍞競鍦�'));
+ userJobCategorys.add(new SelectOption('閿�鍞帹骞�', '鎺ㄥ箍'));
+ userJobCategorys.add(new SelectOption('閿�鍞競鍦�', '钀ヤ笟甯傚満'));
+ //userJobCategorys.add(new SelectOption('閿�鍞湇鍔�', '鏈嶅姟'));
+ userJobCategorys.add(new SelectOption('钀ヤ笟鍔╃悊', '钀ヤ笟鍔╃悊'));
+ userJobCategorys.add(new SelectOption('琛屾斂鍔╃悊', '琛屾斂鍔╃悊'));
+ //userJobCategorys.add(new SelectOption('鍏朵粬', '鍏朵粬'));
}
// 鐜板湪骞村害
@@ -99,9 +122,11 @@
// 涓汉鐩爣(SetPersonalTarget):闅愯棌OTH銆�
// CHAN-BBLCYP 20190509 LHJ Start
//private static String[] amountCategory = new String[] {'GI','ET','BF','GS','URO','GYN','ENT'};
- private static String[] amountCategory = new String[] {'GI', 'ET', 'BF', 'GS', 'URO', 'GYN', 'ENT', 'ENG'};
+ //private static String[] amountCategory = new String[] {'GI', 'ET', 'BF', 'GS', 'URO', 'GYN', 'ENT', 'ENG'};
// CHAN-BBLCYP 20190509 LHJ End
-
+ // DB202303443108 20230407 you start
+ private static String[] amountCategory = new String[] {'GI', 'ET', 'BF', 'GS', 'URO', 'GYN', 'ENT', 'ENG1','ENG2'};
+ // DB202303443108 20230407 you end
//CHAN-BDQBLX 20210125 you start
private List<Amount_Major_Product__c> upsertAMPList ;//= new List<Amount_Major_Product__c>();
private Map<String, Amount_Major_Product__c> Amount_Major_ProductMap1;
@@ -110,9 +135,12 @@
//public Blob csvFileBody {get; set;}
public string csvAsString {get; set;}
public String[] csvFileLines {get; set;}
+ // DB202303443108 20230407 you start
//wangweipeng 20210616 鏂板姞璐熻矗浜у搧鍒嗙被锛堝吋锛� 瀵煎嚭瀵煎叆琛ㄥご
- private static String[] titlepage = new String[] {'鏈儴', '鐪�', '瑙掕壊', '鎷呭綋', '鑱屼綅', '璐熻矗浜у搧鍒嗙被锛堜富锛�', '璐熻矗浜у搧鍒嗙被锛堝吋锛�', 'GI', 'ET', 'BF', 'GS', 'URO', 'GYN', 'ENT', 'ENG'};
-
+ //private static String[] titlepage = new String[] {'鏈儴', '鐪�', '瑙掕壊', '鎷呭綋', '鑱屼綅', '璐熻矗浜у搧鍒嗙被锛堜富锛�', '璐熻矗浜у搧鍒嗙被锛堝吋锛�','鐩爣绫诲瀷', 'GI', 'ET', 'BF', 'GS', 'URO', 'GYN', 'ENT', 'ENG1', 'ENG2'};
+ private static String[] titlepage = new String[] {'鏈儴', '鐪�', '鎷呭綋', '鑱屼綅', '璐熻矗浜у搧鍒嗙被锛堜富锛�', '璐熻矗浜у搧鍒嗙被锛堝吋锛�','鐩爣绫诲瀷', 'GI', 'ET', 'BF', 'GS', 'URO', 'GYN', 'ENT', 'ENG1', 'ENG2','澶囨敞'};//20230510 ljh
+
+ // DB202303443108 20230407 you end
public Integer detailCountLimit{get;private set;}
//CHAN-BDQBLX 20210125 you end
@@ -216,14 +244,23 @@
doubleOTH.add(Double.valueOf(strOTH));
}
proportion.put('OTH', doubleOTH);
-
- String strObjectiveProportionENG = System.Label.ObjectiveProportionENG;
- List<String> objectiveProportionENG = strObjectiveProportionENG.split(',');
- List<Double> doubleENG = new List<Double>();
- for (String strENG : objectiveProportionENG) {
- doubleENG.add(Double.valueOf(strENG));
+ // DB202303443108 20230407 you start ENG鎷嗗垎涓篍NG1鍜孍NG2
+ String strObjectiveProportionENG1 = System.Label.ObjectiveProportionENG;
+ List<String> objectiveProportionENG1 = strObjectiveProportionENG1.split(',');
+ List<Double> doubleENG1 = new List<Double>();
+ for (String strENG1 : objectiveProportionENG1) {
+ doubleENG1.add(Double.valueOf(strENG1));
}
- proportion.put('ENG', doubleENG);
+ proportion.put('ENG1', doubleENG1);
+
+ String strObjectiveProportionENG2 = System.Label.ObjectiveProportionENG;
+ List<String> objectiveProportionENG2 = strObjectiveProportionENG2.split(',');
+ List<Double> doubleENG2 = new List<Double>();
+ for (String strENG2 : objectiveProportionENG2) {
+ doubleENG2.add(Double.valueOf(strENG2));
+ }
+ proportion.put('ENG2', doubleENG2);
+ // DB202303443108 20230407 you end
}
// 鑱蜂綅
if (plist == null) {
@@ -237,23 +274,26 @@
// plist.add(new Position('鍓儴闀�', false));
// plist.add(new Position('閮ㄩ暱', false));
plist.add(new Position('缁忕悊绾�', true));
- plist.add(new Position('鎬荤洃绾�', false));
+ plist.add(new Position('鎬荤洃绾�', true));
+ plist.add(new Position('鎬昏绾�', true));
//20220402 lt SWAG-CD28H3 銆愬鎵樸�戙�愭湡鍒濅慨鏀�4鏈�6鏃ュ紑濮嬩慨鏀广�戠洰鏍囧綍鍏ョ浉鍏冲垽鏂慨鏀� start
}
// 褰撳墠鐢ㄦ埛淇℃伅
if (loginUser == null) {
- loginUser = [Select Id, Salesdepartment__c, Province__c, ProfileId, Job_Category__c From User where Id = :Userinfo.getUserId()];
- loginUser.Job_Category__c = null;
+ loginUser = [Select Id, Salesdepartment__c,Dept__c, Province__c, ProfileId, SFDCPosition_C__c From User where Id = :Userinfo.getUserId()];
+ loginUser.SFDCPosition_C__c = null;
}
+ //adminDpt = loginUser.Dept__c;
adminDpt = loginUser.Salesdepartment__c;
if (String.isBlank(adminDpt)
&& (loginUser.ProfileId == System.Label.ProfileId_SystemAdmin
|| loginUser.ProfileId == System.Label.ProfileId_103
)
) {
- adminDpt = '4.鍗庝笢';
+ adminDpt = '5.鍗庝笢';//'鍖荤枟鍗庝笢钀ヤ笟鏈儴';
}
+
//repFlg =adminDpt;
// province = loginUser.Province__c;
users = this.getUserList(false, false, true);
@@ -404,14 +444,15 @@
string[] titlecsv = csvFileLines[0].trim().split(',');//
system.debug(titlecsv + '==titlepage==' + titlepage);
for (integer j = 0; j < titlecsv.size(); j++) {
- if (!titlepage.contains(titlecsv[j])) {
+ // 20230515 ljh lightning妯″紡瀵煎嚭鏈夌┖鏍� start
+ // if (!titlepage.contains(titlecsv[j])) {
+ if (!titlepage.contains(titlecsv[j].trim())) {
+ // 20230515 ljh lightning妯″紡瀵煎嚭鏈夌┖鏍� end
system.debug('琛ㄥご涓嶄竴鑷村緱鍒�===' + titlecsv[j]);
ValFlag = true;
exportByVal = '琛ㄥご涓嶄竴鑷达紝璇蜂弗鏍兼寜鐓у鍑烘ā鏉垮~鍐�';
break;
}
-
-
}
}
@@ -429,12 +470,27 @@
Set<String> zzs = new Set<String>();//鑱岀
for (Integer i = 1; i < csvFileLines.size(); i++) {
+ System.debug('zheli472:'+csvFileLines[i]);
+ // 20230515 ljh 鍗冨垎浣� start
+ String p = '\"([^\"]*)\"' ;
+ Pattern PP = Pattern.compile(p);
+ Matcher matcher1 = PP.matcher(csvFileLines[i]);
+ while(matcher1.find())
+ {
+ String old = matcher1.group(0);
+ String repNew = matcher1.group(0).replaceAll(',','').trim();
+ csvFileLines[i] = csvFileLines[i].replace(old,repNew);
+ }
+ // 20230515 ljh 鍗冨垎浣� end
string[] csvRecordData = csvFileLines[i].split(',');
if (csvRecordData.size() > 0) {
- String bu = csvRecordData[0].replace(' ', '');
- String sf = csvRecordData[1].replace(' ', '');
- String dandang = csvRecordData[3].replace(' ', '');
- String zw = csvRecordData[4].replace(' ', '');
+ String bu = csvRecordData[0].replace(' ', '');//鏈儴
+ String sf = csvRecordData[1].replace(' ', '');//鐪�
+ //闅愯棌瑙掕壊
+ //String dandang = csvRecordData[3].replace(' ', '');//鎷呭綋
+ //String zw = csvRecordData[4].replace(' ', '');//閫氱敤鑱岀骇
+ String dandang = csvRecordData[2].replace(' ', '');//鎷呭綋
+ String zw = csvRecordData[3].replace(' ', '');//閫氱敤鑱岀骇
String key_flg = (bu + sf + dandang + zw).replaceAll('"', '');
UserInfoList.add(key_flg);
szMap.put(key_flg, csvRecordData);
@@ -456,10 +512,26 @@
Map<String, User> userMap = new Map<String, User>();
for (User userl : userList) {
yydds.add(userl.Sales_Speciality__c);//鍖婚櫌鎷呭綋
- zzs.add(userl.Job_Category__c);//鑱岀
+ zzs.add(userl.SFDCPosition_C__c);//鑱岀
userMap.put(userl.UserInfos__c, userl);
}
+ /**
+ 瑙掕壊闅愯棌鏆傛椂娉ㄩ噴
+ Integer Target_Number = 7;//鐩爣绫诲瀷
+ Integer GI_Number = 8;
+ Integer ET_Number = 9;
+ Integer BF_Number = 10;
+ Integer GS_Number = 11;
+ Integer URO_Number = 12;
+ Integer GYN_Number = 13;
+ Integer ENT_Number = 14;
+ // DB202303443108 20230407 you start
+ Integer ENG1_Number = 15;
+ Integer ENG2_Number = 16;
+ // DB202303443108 20230407 you end
+ **/
+ Integer Target_Number = 6;//鐩爣绫诲瀷
Integer GI_Number = 7;
Integer ET_Number = 8;
Integer BF_Number = 9;
@@ -467,8 +539,11 @@
Integer URO_Number = 11;
Integer GYN_Number = 12;
Integer ENT_Number = 13;
- Integer ENG_Number = 14;
-
+ // DB202303443108 20230407 you start
+ Integer ENG1_Number = 14;
+ Integer ENG2_Number = 15;
+ // DB202303443108 20230407 you end
+ Integer Remarks_Number = 16;//20230510 ljh
upsertAMPList = new List<Amount_Major_Product__c>();//鍒濆鍖栵紝瑙e喅閲嶅瀵煎叆鏁版嵁 id閲嶅寰楅棶棰�
for (String key : szMap.keySet()) {
//鍙栫敤鎴风殑Id
@@ -486,33 +561,61 @@
List<String> csvRecordData = szMap.get(key);
Amount_Major_Product__c upsertAMP = new Amount_Major_Product__c();
+
+ String Target_Type = String.isNotBlank(csvRecordData[Target_Number]) && String.isNotBlank(csvRecordData[Target_Number].replaceAll('"', '')) ? String.valueof(csvRecordData[Target_Number].replaceAll('"', '')) : '';
+ // 20230510 ljh start
+ String remarks = String.isNotBlank(csvRecordData[Remarks_Number]) && String.isNotBlank(csvRecordData[Remarks_Number].replaceAll('"', '')) ? String.valueof(csvRecordData[Remarks_Number].replaceAll('"', '')) : '';
+ // 20230510 ljh start
//鑾峰彇瀵煎叆鏁伴噺
- Decimal GI_Amount = String.isNotBlank(csvRecordData[GI_Number]) && String.isNotBlank(csvRecordData[GI_Number].replaceAll('"', '')) ? Decimal.valueof(csvRecordData[GI_Number].replaceAll('"', '')) : 0.00;
-
- DataSplicing(GI_Amount,userid + '_GI',Amount_Major_ProductMap1,userinfors);
+ // 20230515 ljh 鍗冨垎浣� start
+ // Decimal GI_Amount = String.isNotBlank(csvRecordData[GI_Number]) && String.isNotBlank(csvRecordData[GI_Number].replaceAll('"', '')) ? Decimal.valueof(csvRecordData[GI_Number].replaceAll('"', '')) : 0.00;
+ Decimal GI_Amount = String.isNotBlank(csvRecordData[GI_Number]) && String.isNotBlank(csvRecordData[GI_Number].replaceAll('"', '')) ? Decimal.valueof(csvRecordData[GI_Number].replaceAll('"', '').trim()) : 0.00;
+ // 20230515 ljh 鍗冨垎浣� end
+ DataSplicing(GI_Amount,userid + '_GI',Amount_Major_ProductMap1,userinfors,Target_Type,remarks);
- Decimal ET_Amount = String.isNotBlank(csvRecordData[ET_Number]) && String.isNotBlank(csvRecordData[ET_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[ET_Number].replaceAll('"', '')) : 0.00;
- DataSplicing(ET_Amount,userid + '_ET',Amount_Major_ProductMap1,userinfors);
+ // 20230515 ljh 鍗冨垎浣� start
+ // Decimal ET_Amount = String.isNotBlank(csvRecordData[ET_Number]) && String.isNotBlank(csvRecordData[ET_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[ET_Number].replaceAll('"', '')) : 0.00;
+ Decimal ET_Amount = String.isNotBlank(csvRecordData[ET_Number]) && String.isNotBlank(csvRecordData[ET_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[ET_Number].replaceAll('"', '').trim()) : 0.00;
+ // 20230515 ljh 鍗冨垎浣� end
+ DataSplicing(ET_Amount,userid + '_ET',Amount_Major_ProductMap1,userinfors,Target_Type,remarks);
- Decimal BF_Amount = String.isNotBlank(csvRecordData[BF_Number]) && String.isNotBlank(csvRecordData[BF_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[BF_Number].replaceAll('"', '')) : 0.00;
- DataSplicing(BF_Amount,userid + '_BF',Amount_Major_ProductMap1,userinfors);
+ // 20230515 ljh 鍗冨垎浣� start
+ // Decimal BF_Amount = String.isNotBlank(csvRecordData[BF_Number]) && String.isNotBlank(csvRecordData[BF_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[BF_Number].replaceAll('"', '')) : 0.00;
+ Decimal BF_Amount = String.isNotBlank(csvRecordData[BF_Number]) && String.isNotBlank(csvRecordData[BF_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[BF_Number].replaceAll('"', '').trim()) : 0.00;
+ // 20230515 ljh 鍗冨垎浣� end
+ DataSplicing(BF_Amount,userid + '_BF',Amount_Major_ProductMap1,userinfors,Target_Type,remarks);
- Decimal GS_Amount = String.isNotBlank(csvRecordData[GS_Number]) && String.isNotBlank(csvRecordData[GS_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[GS_Number].replaceAll('"', '')) : 0.00;
- DataSplicing(GS_Amount,userid + '_GS',Amount_Major_ProductMap1,userinfors);
-
- Decimal URO_Amount = String.isNotBlank(csvRecordData[URO_Number]) && String.isNotBlank(csvRecordData[URO_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[URO_Number].replaceAll('"', '')) : 0.00;
- DataSplicing(URO_Amount,userid + '_URO',Amount_Major_ProductMap1,userinfors);
-
- Decimal GYN_Amount = String.isNotBlank(csvRecordData[GYN_Number]) && String.isNotBlank(csvRecordData[GYN_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[GYN_Number].replaceAll('"', '')) : 0.00;
- DataSplicing(GYN_Amount,userid + '_GYN',Amount_Major_ProductMap1,userinfors);
-
- Decimal ENT_Amount = String.isNotBlank(csvRecordData[ENT_Number]) && String.isNotBlank(csvRecordData[ENT_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[ENT_Number].replaceAll('"', '')) : 0.00;
- DataSplicing(ENT_Amount,userid + '_ENT',Amount_Major_ProductMap1,userinfors);
- system.debug('ENG_Number--->'+csvRecordData[ENG_Number]);
+ // 20230515 ljh 鍗冨垎浣� start
+ // Decimal GS_Amount = String.isNotBlank(csvRecordData[GS_Number]) && String.isNotBlank(csvRecordData[GS_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[GS_Number].replaceAll('"', '')) : 0.00;
+ Decimal GS_Amount = String.isNotBlank(csvRecordData[GS_Number]) && String.isNotBlank(csvRecordData[GS_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[GS_Number].replaceAll('"', '').trim()) : 0.00;
+ // 20230515 ljh 鍗冨垎浣� end
+ DataSplicing(GS_Amount,userid + '_GS',Amount_Major_ProductMap1,userinfors,Target_Type,remarks);
+ // 20230515 ljh 鍗冨垎浣� start
+ // Decimal URO_Amount = String.isNotBlank(csvRecordData[URO_Number]) && String.isNotBlank(csvRecordData[URO_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[URO_Number].replaceAll('"', '')) : 0.00;
+ Decimal URO_Amount = String.isNotBlank(csvRecordData[URO_Number]) && String.isNotBlank(csvRecordData[URO_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[URO_Number].replaceAll('"', '').trim()) : 0.00;
+ // 20230515 ljh 鍗冨垎浣� end
+ DataSplicing(URO_Amount,userid + '_URO',Amount_Major_ProductMap1,userinfors,Target_Type,remarks);
+ // 20230515 ljh 鍗冨垎浣� start
+ // Decimal GYN_Amount = String.isNotBlank(csvRecordData[GYN_Number]) && String.isNotBlank(csvRecordData[GYN_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[GYN_Number].replaceAll('"', '')) : 0.00;
+ Decimal GYN_Amount = String.isNotBlank(csvRecordData[GYN_Number]) && String.isNotBlank(csvRecordData[GYN_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[GYN_Number].replaceAll('"', '').trim()) : 0.00;
+ // 20230515 ljh 鍗冨垎浣� end
+ DataSplicing(GYN_Amount,userid + '_GYN',Amount_Major_ProductMap1,userinfors,Target_Type,remarks);
+ // 20230515 ljh 鍗冨垎浣� start
+ // Decimal ENT_Amount = String.isNotBlank(csvRecordData[ENT_Number]) && String.isNotBlank(csvRecordData[ENT_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[ENT_Number].replaceAll('"', '')) : 0.00;
+ Decimal ENT_Amount = String.isNotBlank(csvRecordData[ENT_Number]) && String.isNotBlank(csvRecordData[ENT_Number].replaceAll('"', '')) ? Decimal.valueOf(csvRecordData[ENT_Number].replaceAll('"', '').trim()) : 0.00;
+ // 20230515 ljh 鍗冨垎浣� end
+ DataSplicing(ENT_Amount,userid + '_ENT',Amount_Major_ProductMap1,userinfors,Target_Type,remarks);
+ system.debug('ENG1_Number--->'+csvRecordData[ENG1_Number]);
//鍥犱负鏈�鍚庝竴鍒楁暟鎹湁绌烘牸锛屾墍浠ュ姞.trim()
- Decimal ENG_Amount = String.isNotBlank(csvRecordData[ENG_Number]) && String.isNotBlank(csvRecordData[ENG_Number].replaceAll('"', ''))? Decimal.valueOf(csvRecordData[ENG_Number].replaceAll('"', '').trim()) : 0.00;
+ // DB202303443108 20230407 you start
+ Decimal ENG1_Amount = String.isNotBlank(csvRecordData[ENG1_Number]) && String.isNotBlank(csvRecordData[ENG1_Number].replaceAll('"', ''))? Decimal.valueOf(csvRecordData[ENG1_Number].replaceAll('"', '').trim()) : 0.00;
// Decimal.valueOf(String str)
- DataSplicing(ENG_Amount,userid + '_ENG',Amount_Major_ProductMap1,userinfors);
+ DataSplicing(ENG1_Amount,userid + '_ENG1',Amount_Major_ProductMap1,userinfors,Target_Type,remarks);
+
+ Decimal ENG2_Amount = String.isNotBlank(csvRecordData[ENG2_Number]) && String.isNotBlank(csvRecordData[ENG2_Number].replaceAll('"', ''))? Decimal.valueOf(csvRecordData[ENG2_Number].replaceAll('"', '').trim()) : 0.00;
+ DataSplicing(ENG2_Amount,userid + '_ENG2',Amount_Major_ProductMap1,userinfors,Target_Type,remarks);
+
+ // DB202303443108 20230407 you end
@@ -540,17 +643,25 @@
return null;
}
// 鏈�缁堝緱鏁版嵁澶勭悊锛�
- private void DataSplicing(Decimal amount, String key, Map<String, Amount_Major_Product__c> ampMap,User userinfors ) {//鍘昏繘琛屾渶缁堟暟鎹緱鎻掑叆锛屾洿鏂版垨鍒犻櫎鎿嶄綔
+ // 20230510 ljh start
+ // private void DataSplicing(Decimal amount, String key, Map<String, Amount_Major_Product__c> ampMap,User userinfors,String Target_Type) {//鍘昏繘琛屾渶缁堟暟鎹緱鎻掑叆锛屾洿鏂版垨鍒犻櫎鎿嶄綔
+ private void DataSplicing(Decimal amount, String key, Map<String, Amount_Major_Product__c> ampMap,User userinfors,String Target_Type,String remarks) {//鍘昏繘琛屾渶缁堟暟鎹緱鎻掑叆锛屾洿鏂版垨鍒犻櫎鎿嶄綔
+ // 20230510 ljh end
Amount_Major_Product__c upsertAMP = new Amount_Major_Product__c();
Amount_Major_Product__c Amount_Major_Product = Amount_Major_ProductMap.get(key);
- system.debug('==amount=='+amount+'==key=='+key+'==ampMap=='+ampMap+'==userinfors=='+userinfors+'\n');
+ //system.debug('==amount=='+amount+'==key=='+key+'==ampMap=='+ampMap+'==userinfors=='+userinfors+'==Target_Type=='+Target_Type+'\n');
if (ampMap.containskey(key)) {
upsertAMP = ampMap.get(key);
if (amount > 0) {
- if(amount!=upsertAMP.Amount__c){
+ // 20230510 ljh update start
+ // if(amount!=upsertAMP.Amount__c){
+ if(amount!=upsertAMP.Amount__c || Target_Type!=upsertAMP.TargetType__c ||remarks!=upsertAMP.remarks__c){
+ // 20230510 ljh update end
upsertAMP.Amount__c = amount;
upsertAMP.Use_Start_Date__c = userinfors.Use_Start_Date__c;
upsertAMP.Is_Processing__c = true;
+ upsertAMP.TargetType__c = Target_Type;
+ upsertAMP.remarks__c = remarks;// 20230510 ljh
upsertAMPList.add(upsertAMP);
//鏇存柊
}
@@ -559,6 +670,8 @@
//涓嶇敤鍒犻櫎浜嗭紝鍏佽 鏁版嵁鏄┖鐨勫瓨鍦�
upsertAMP.Amount__c = null;
upsertAMP.Is_Processing__c = true;
+ upsertAMP.TargetType__c = Target_Type;// 20230510 ljh
+ upsertAMP.remarks__c = remarks;// 20230510 ljh
upsertAMPList.add(upsertAMP);
}
} else {
@@ -570,6 +683,8 @@
upsertAMP.Use_Start_Date__c = userinfors.Use_Start_Date__c;
upsertAMP.iYear__c = iYear;
upsertAMP.Is_Processing__c = true;
+ upsertAMP.TargetType__c = Target_Type;
+ upsertAMP.remarks__c = remarks;// 20230510 ljh
upsertAMPList.add(upsertAMP);
} else {
//鍏佽 鏁版嵁鏄┖鐨勫瓨鍦�
@@ -580,6 +695,8 @@
upsertAMP.Use_Start_Date__c = userinfors.Use_Start_Date__c;
upsertAMP.iYear__c = iYear;
upsertAMP.Is_Processing__c = true;
+ upsertAMP.TargetType__c = Target_Type;
+ upsertAMP.remarks__c = remarks;// 20230510 ljh
upsertAMPList.add(upsertAMP);
}
}
@@ -592,7 +709,7 @@
Amount_Major_ProductMap1 = new Map<String, Amount_Major_Product__c>();
list<Amount_Major_Product__c> Existed_Amount_Major_Products = [select key__c, Amount__c, user_Alias__c,
- Is_Processing__c, iYear__c from Amount_Major_Product__c where iYear__c = : iYear and SAP_Province__c in :sfs];
+ Is_Processing__c, iYear__c,TargetType__c,remarks__c from Amount_Major_Product__c where iYear__c = : iYear and SAP_Province__c in :sfs];
//system.debug('Existed_Amount_Major_Products' + Existed_Amount_Major_Products);
for ( Amount_Major_Product__c Amount_Major_Product : Existed_Amount_Major_Products ) {
@@ -605,8 +722,8 @@
}
}
private List<User> getUserList(List<String> UserInfoList) {//鏍规嵁涓婁紶鏂囦欢涓緱鏈儴锛岀渷浠斤紝鎷呭綋锛岃亴浣� 寰楀埌浜唘ser 淇℃伅
- String soql = 'select Id, UserInfos__c, Salesdepartment__c, Province__c, Alias, Product_specialist_incharge_product__c,Responsible_for_Products_Concurrently__c, Use_Start_Date__c,'
- + ' ProfileId, Profile.Name, UserRoleId, UserRole.Name, Sales_Speciality__c, HR_Post__c,Job_Category__c'
+ String soql = 'select Id, UserInfos__c, Salesdepartment__c,Dept__c, Province__c, Alias, Product_specialist_incharge_product__c,Responsible_for_Products_Concurrently__c, Use_Start_Date__c,'
+ + ' ProfileId, Profile.Name, UserRoleId, UserRole.Name, Sales_Speciality__c, HR_Post__c,SFDCPosition_C__c'
+ ' from User where IsActive = true and Test_staff__c = false and UserType = \'Standard\' '
+ ' and Salesdepartment__c <> \'7.鑳介噺\' '
+ ' and UserInfos__c IN :UserInfoList order by Salesdepartment__c, Province__c';
@@ -689,8 +806,8 @@
}
list<Amount_Major_Product__c> Existed_Amount_Major_Products = [select key__c, Amount__c, user_Alias__c,
- Is_Processing__c, iYear__c from Amount_Major_Product__c where iYear__c = : iYear ];
- //system.debug('Existed_Amount_Major_Products' + Existed_Amount_Major_Products);
+ Is_Processing__c, iYear__c,TargetType__c,remarks__c from Amount_Major_Product__c where iYear__c = : iYear ];
+ //system.debug('iYear===' + iYear);
if (Existed_Amount_Major_Products.size() <= 0 ) {
return false;
}
@@ -706,6 +823,7 @@
break;
}
}
+ //system.debug('==flag=='+flag);
if (flag) {
Amount_Major_ProductMap.put(Amount_Major_Product.key__c, Amount_Major_Product);
}
@@ -713,12 +831,14 @@
}
//ApexPages.addmessage(new ApexPages.message('aa'));
//'Amount_Major_ProductMap' + Amount_Major_ProductMap.keySet()
+ //system.debug(Amount_Major_ProductMap+'Existed_Amount_Major_Products==' + Amount_Major_ProductMap.keySet());
return true;
}
// 銉︺兗銈躲伄妞滅储
private List<User> getUserList(Boolean searchByDpt, Boolean searchByProvince, Boolean defaultSearch) {
- String soql = 'select Id, Salesdepartment__c, Province__c, Alias, Product_specialist_incharge_product__c,Responsible_for_Products_Concurrently__c, Use_Start_Date__c,'
+ system.debug('杩涙潵浜�');
+ String soql = 'select Id, Salesdepartment__c,Dept__c, Province__c, Alias, Product_specialist_incharge_product__c,Responsible_for_Products_Concurrently__c, Use_Start_Date__c,'
+ ' ProfileId, Profile.Name, UserRoleId, UserRole.Name, Sales_Speciality__c, HR_Post__c'
+ ' from User where IsActive = true and Test_staff__c = false and UserType = \'Standard\' '
// CHAN-BBLCYP 20190509 LHJ Start
@@ -739,10 +859,10 @@
//wangweipeng SWAG-C6V8W5 2021/09/16 end
// 鑱岀
- if (defaultSearch || String.isBlank(loginUser.Job_Category__c)) {
- soql += ' and (Job_Category__c = \'閿�鍞帹骞縗' or Job_Category__c = \'閿�鍞競鍦篭')';
+ if (defaultSearch || String.isBlank(loginUser.SFDCPosition_C__c)) {
+ soql += ' and (SFDCPosition_C__c = \'閿�鍞帹骞縗' or SFDCPosition_C__c = \'閿�鍞競鍦篭' or SFDCPosition_C__c = \'钀ヤ笟鍔╃悊\' or SFDCPosition_C__c = \'琛屾斂鍔╃悊\')';// or SFDCPosition_C__c = \'閿�鍞湇鍔' or SFDCPosition_C__c = \'鍏朵粬\'
} else {
- soql += ' and Job_Category__c = \'' + loginUser.Job_Category__c + '\'';
+ soql += ' and SFDCPosition_C__c = \'' + loginUser.SFDCPosition_C__c + '\'';
}
// 鏈儴銇仸妞滅储銇牬鍚堛�佺渷銈掔劇瑕�
if (searchByDpt) {
@@ -762,14 +882,19 @@
if (String.isBlank(salesDpt) && String.isBlank(loginUser.Province__c)) {
soql += ' and Salesdepartment__c = \'' + adminDpt + '\'';
}
+ if(String.isBlank(salesDpt) ){
+ soql += ' and (Salesdepartment__c = \'1.鍗庡寳\' or Salesdepartment__c = \'2.涓滃寳\' or Salesdepartment__c = \'3.瑗垮寳\' or Salesdepartment__c = \'4.瑗垮崡\' or Salesdepartment__c = \'5.鍗庝笢\' or Salesdepartment__c = \'6.鍗庡崡\')';
+ }
if (searchByProvince) {
salesDpt = adminDpt;
}
+
// 鑱蜂綅鏉′欢
List<String> positionNames = new List<String>();
String s1 = '缁忕悊';
String s2 = '鎬荤洃';
+ String s3 = '鎬昏';
for (Position p : plist) {
if (p.check) {
//positionNames.add(p.positionName);
@@ -798,7 +923,7 @@
for (Integer i = 0; i < positionNames.size(); i++) {
if (i == positionNames.size() - 1) {
//20220517 lt SWAG-CD28H3 Start
- if(positionNames[i] != '缁忕悊绾�' && positionNames[i] != '鎬荤洃绾�'){
+ if(positionNames[i] != '缁忕悊绾�' && positionNames[i] != '鎬荤洃绾�' && positionNames[i] != '鎬昏绾�'){
soql += ' HR_Post__c = \'' + positionNames[i] + '\'';
}
else if(positionNames[i] == '缁忕悊绾�'){
@@ -808,9 +933,12 @@
soql += ' HR_Post__c like \'%' + s2 + '%\'';
}
//20220517 lt SWAG-CD28H3 End
+ else if(positionNames[i] == '鎬昏绾�'){
+ soql += ' HR_Post__c like \'%' + s3 + '%\'';
+ }
} else {
//20220517 lt SWAG-CD28H3 Start
- if(positionNames[i] != '缁忕悊绾�' && positionNames[i] != '鎬荤洃绾�'){
+ if(positionNames[i] != '缁忕悊绾�' && positionNames[i] != '鎬荤洃绾�' && positionNames[i] != '鎬昏绾�'){
soql += ' HR_Post__c = \'' + positionNames[i] + '\' or';
}
else if(positionNames[i] == '缁忕悊绾�'){
@@ -820,6 +948,9 @@
soql += ' HR_Post__c like \'%' + s2 + '%\' or';
}
//20220517 lt SWAG-CD28H3 End
+ else if(positionNames[i] == '鎬昏绾�'){
+ soql += ' HR_Post__c like \'%' + s3 + '%\' or';
+ }
}
}
soql += ')';
@@ -837,7 +968,7 @@
Opportunity[] opportunitys = [select
Id, OwnerId, Opportunity_Category__c, Proportion__c, CloseDate,
Amount, Objective__c, Target_category__c,
- SAP_Province__c, RecordTypeId, OCM_Target_period__c
+ SAP_Province__c, RecordTypeId, OCM_Target_period__c,TargetType__c,remarks__c
from Opportunity
where Target_category__c = '鎷呭綋鐩爣'
and RecordTypeId = :rt.Id
@@ -852,6 +983,7 @@
//--------------20200605 ljh end start ------
// 褰撳墠骞村害娌℃湁鏁版嵁鏃讹紝鏄剧ず淇℃伅
//&& opportunitys.size() <= 0 Existed_Amount_Major_Products.size()<=0
+ system.debug('==currentPeriodOld=='+currentPeriodOld);
if (opportunitys.size() <= 0 && isPast && iYear < currentYear) {
ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, '娌℃湁涓婂勾搴︾殑鏁版嵁銆�');
ApexPages.addMessage(msg);
@@ -896,15 +1028,24 @@
for (Integer j = 0; j < amountCategory.size(); j++) {
String key = users[u].Id + '_' + amountCategory[j] ;
if (Amount_Major_ProductMap.containsKey(key)) {
+
Amount_Major_Product__c Amount_Major_Product = Amount_Major_ProductMap.get(key);
dataBean.amount[j].Amount = Amount_Major_Product.Amount__c;
+ //dataBean.opportunity.TargetType__c = Amount_Major_Product.TargetType__c;
+ dataBean.opportunity.TargetType__c = String.isNotBlank(Amount_Major_Product.TargetType__c) ? Amount_Major_Product.TargetType__c : '涓汉';
+ system.debug(Amount_Major_ProductMap.get(key)+'==key====='+key+'==='+Amount_Major_Product.Amount__c+'=='+Amount_Major_Product.TargetType__c);
+ dataBean.opportunity.remarks__c = Amount_Major_Product.remarks__c;// 20230510 ljh start
} else {
+ dataBean.opportunity.TargetType__c = '涓汉';
// dataBean.amount[j].Amount = null;
+ dataBean.opportunity.remarks__c = '';// 20230510 ljh start
}
+
}
// 2020/06/05 SWAG-BQ7CM9 涓庢棦鏈変腑闂磋〃鏁版嵁杩涜瀵规瘮锛岀劧鍚庢洿鏂拌嚦visualforce page by ljh end
dataBeans.add(dataBean);
}
+ system.debug('==dataBeans=='+dataBeans);
}
// 瀹熼殯銇繚瀛樸儹銈搞儍銈�
@@ -1077,11 +1218,15 @@
if (Amount_Major_ProductMap.containsKey(key)) {
//涓存椂琛ㄥ凡缁忔湁浜�
Amount_Major_Product__c Amount_Major_Product = Amount_Major_ProductMap.get(key);
-
- if (Amount_Major_Product.Amount__c == db.amount[j].Amount) {
+ // 20230510 ljh start
+ // if (Amount_Major_Product.Amount__c == db.amount[j].Amount) {
+ if (Amount_Major_Product.Amount__c == db.amount[j].Amount && Amount_Major_Product.TargetType__c == db.opportunity.TargetType__c && Amount_Major_Product.remarks__c == db.opportunity.remarks__c) {
+ // 20230510 ljh end
continue;
} else {
Amount_Major_Product.Amount__c = db.amount[j].Amount;
+ Amount_Major_Product.TargetType__c = db.opportunity.TargetType__c;
+ Amount_Major_Product.remarks__c = db.opportunity.remarks__c; // 20230510 ljh
Amount_Major_Product.user_Alias__c = db.user.Alias;
Amount_Major_Product.SAP_Province__c = db.user.Province__c;
Amount_Major_Product.Use_Start_Date__c = db.user.Use_Start_Date__c;
@@ -1118,12 +1263,18 @@
if (oppMap.containskey(keyOpp)) {
opp = oppMap.get(keyOpp);
//if (opp.Proportion__c != proportion.get(amountC)[i]) {
- if (opp.Amount != db.amount[j].Amount) {
+ // 20230510 ljh start
+ // if (opp.Amount != db.amount[j].Amount) {
+ if (opp.Amount != db.amount[j].Amount || opp.TargetType__c != db.opportunity.TargetType__c || opp.remarks__c != db.opportunity.remarks__c) {
+ // 20230510 ljh end
proportionChanged = true;
break;
}
} else {
- if (db.amount[j].Amount != null) {
+ // 20230510 ljh start
+ // if (db.amount[j].Amount != null) {
+ if (db.amount[j].Amount != null || db.opportunity.TargetType__c != null || db.opportunity.remarks__c != null) {
+ // 20230510 ljh end
proportionChanged = true;
break;
}
@@ -1135,6 +1286,8 @@
Amount_Major_Product__c Amount_Major_Product = new Amount_Major_Product__c();
Amount_Major_Product.key__c = key;
Amount_Major_Product.Amount__c = db.amount[j].Amount;
+ Amount_Major_Product.TargetType__c = db.opportunity.TargetType__c;
+ Amount_Major_Product.remarks__c = db.opportunity.remarks__c; // 20230510 ljh
Amount_Major_Product.user_Alias__c = db.user.Alias;
Amount_Major_Product.SAP_Province__c = db.user.Province__c;
Amount_Major_Product.Use_Start_Date__c = db.user.Use_Start_Date__c;
@@ -1163,14 +1316,21 @@
public Opportunity[] amount { get; set; }
// 鏄惁鍙樺寲 0锛氭棤 1锛氭湁
public String isChanged { get; set; }
+ //鐩爣绫诲瀷
+ public Opportunity opportunity { get; set; }
+ // 20230510 ljh start
+ // 澶囨敞
+ public String remarks { get; set; }
+ // 20230510 ljh end
// 鏋勯�犳柟娉�
DataBean(User user, Map<String, Opportunity> oppMap, Integer iYear) {
this.user = user;
this.amount = new List<Opportunity>();
this.isChanged = '0';
-
-
+ this.opportunity = new Opportunity();
+ this.opportunity.TargetType__c = '涓汉';
+ this.remarks = ''; // 20230510 ljh add
// 鎸夐噾棰濆垎绫伙紝鏌ユ壘鏁版嵁锛屽苟璁惧��
for (Integer i = 0; i < amountCategory.size(); i++) {
String amountC = amountCategory[i];
@@ -1194,6 +1354,11 @@
if (oppMap.containskey(key)) {
//a.Amount = oppMap.get(key).Amount;
amountSum += oppMap.get(key).Objective__c == null ? 0 : oppMap.get(key).Objective__c;
+ this.opportunity.TargetType__c = oppMap.get(key).TargetType__c;
+ this.opportunity.remarks__c = oppMap.get(key).remarks__c;// 20230510 ljh start
+ }else{
+ this.opportunity.TargetType__c = '涓汉';
+ this.opportunity.remarks__c = ''; // 20230510 ljh start
}
}
if (amountSum > 0) {
--
Gitblit v1.9.1