@RestResource(urlMapping = '/SBG203/*')
|
global with sharing class SBG203Rest {
|
|
global class GeDatas {
|
public NFMUtil.Monitoring Monitoring;
|
public GeData[] Partners;
|
}
|
//合作伙伴抬头层级
|
global class GeData {
|
public License_Info[] License_Info;
|
public Consignee_Info[] Consignee_Info;
|
public Contract_Info[] Contract_Info;
|
public Authorized_Info[] Authorized_Info;
|
|
public String AgentType; //经销商分类
|
public String CompanyName; //企业名称
|
public String CompanyEnglishName; //企业名称(英文)
|
public String DealerTradeType; //代理商贸易类型
|
public String Mobilephone; //合作伙伴手机
|
public String ProductSegment; //产品分类
|
public String KeyAccount; //关键客户
|
public String ExportRegulatedCustomer; //出口限制用户
|
public String MarketVerticals; //市场分类
|
public String Industry; //行业
|
public String Use; //用途
|
public String SubUseEnterprise; //全国企业用户的SubUse
|
public String BPCode; //合作伙伴代码(BS课税,其他分野公用)
|
public String BPCodeforeign; //免税
|
public String BPType; //合作伙伴类型
|
public String RegisterAddress; //住所(等同注册地址)
|
public String RegionName; //省别
|
public String City; //市
|
public String Phone; //合作伙伴电话
|
public String Postal; //合作伙伴邮编
|
public String Fax; //合作伙伴传真
|
public String Region; //省别()
|
public String ApplyType;
|
// 1.客户终止(更新客户)。2.新增(创建-客户,联系人,代理商折扣,证照等)。3.变更( 同新增)。4.续约(同新增)。6.协议变更(客户,代理商折扣)。7.证照变更(客户,证照,联系人)。8.收货信息变更(客户,联系人)
|
public String STR_SUPPL1; //开票地址(80)
|
|
public String VTWEG; //分销渠道
|
public String AccountSource; //客户来源
|
public Boolean TargetCustomer; //客户类型
|
public Boolean IsCOMPO; //COMPO客户
|
public String UserType; //用户属性
|
public String COMPOSubuse; //Subuse
|
|
public String KATR2; //开票类型
|
public String CompanyCode; //公司代码
|
public String Incorporator; //法定代表人(医院)
|
public String Invoice_phone; //开票联系电话
|
public String AgentValidFrom;
|
public String AgentValidTo;
|
public String TaxNo;
|
public String BankName;
|
public String BankCode;
|
public String Agreement1;
|
public String Agreement2;
|
public String Agreement3;
|
public String Agreement4;
|
public String Remark;
|
public String Z3PLAuthorizedNo;
|
public String AuthorizedScope;
|
public String AuthorizedVF;
|
public String AuthorizedVT;
|
public String CNTag;
|
public String Z3PLQualityAgrNo;
|
public String QualityAgrNoVF;
|
public String QualityAgrNoVT;
|
public String Z3PLTransAgrNo;
|
public String TransAgrVF;
|
public String TransAgrVT;
|
public String ServiceType;
|
public String CustomerService;
|
public String OperationProject;
|
public String Approver;
|
public String ApproveDate;
|
public String Comment;
|
|
public String other1;
|
public String other2;
|
public String other3;
|
}
|
|
// 证照层级
|
global class License_Info {
|
public Detail_Info[] Detail_Info;
|
|
public String LicenseType; //证照类型
|
public String BusLicenseNo; //证照号
|
public String ValidFrom; //期限效期从
|
public String ValidTo; //期限效期至
|
public String WarehouseAddress; //库房地址
|
public Boolean IfQuantityCtrl; //是否数量管控
|
//以下字段暂时用不到
|
public String ISSUEDATE1; //证照的发证日期
|
public String DiagnosisScope; //诊疗科目
|
public String BusinessType; //经营方式
|
public String Principal; //企业负责人
|
public String BusinessAddress; //经营场所(等同办公地址)
|
public String BusinessScope; //经营二类范围
|
public String BusinessScope1; //经营三类范围
|
public string IssueAuthority; //发证机关
|
public String Exclusive; //二类经营范围排除子分类
|
public String Exclusive1; //三类经营范围排除子分类
|
public String other4;
|
public String other5;
|
public String other6;
|
|
}
|
|
global class Detail_Info {
|
public String ProSerial; //辐射产品系列
|
public String Quantity; //数量
|
public String ProName; //装置名称
|
public String Category; //活动种类
|
}
|
// 收货人层级
|
global class Consignee_Info {
|
public String ContactId; //收货人ID(管理编码)
|
public String ContactName; //有效收货人名称
|
public String ContactPhone; //收货人电话
|
public String PostalCode; //邮政编码
|
public String ContactAddress; //有效收货人地址
|
public String ContactMobilePhone; //收货人手机
|
public String CITY1; //收货人城市
|
public String ContactEnglishName; //英文名称
|
}
|
|
// 销售人层级
|
global class Authorized_Info {
|
public String SalesAuthorizedNo;
|
public String SalesMan;
|
public String SalesAuthorizedVF;
|
public String SalesAuthorizedVT;
|
}
|
|
// 合同层级
|
global class Contract_Info {
|
|
public String ContractStartDate; //合同开始日
|
public String ContractEndDate; //合同结束日
|
public String DealerRank;
|
public String SubUse;
|
public String ContractRegion; //负责省
|
public String DealerRate; //代理商折扣
|
|
//以下字段暂时不会传输数据
|
public String TermContractNo; //本期协议编号
|
public String ContractOwner; //客户所有人
|
public String ContractDecideStartDate; //允许报价期间(开始日)
|
public String ContractDecideEndDate; //允许报价期间(结束日)
|
public String BusinessAssistant; //营业助理
|
public String SalesState; //申请省
|
public String SalesShopClass; //经销商合同分类
|
public String ContractDepartmentClass; //担当科室分类
|
public String AgencyApplicationDay; //特约经销商申请日
|
public String AgencyApplicationNo; //特约经销商申请编码
|
public String SalesSection; //申请销售课
|
public String SelableProduct; //担当产品
|
public Double AimPrice; //目标金额
|
public Double AimPriceAreaET; //ET目标金额
|
public Double AimPriceAreaSP; //SP耗材目标金额
|
public Double AimPriceAreaENG; //ENG目标金额
|
public Double AimPriceAH; //奥辉目标金额
|
public Double AimPriceSP; //SP目标金额
|
public Double AimPriceGIR; //GIR目标金额
|
public Double DealerdiscountET; //经销商折扣ET
|
public Double DealerdiscountENG; //经销商折扣ENG
|
public Double DealerdiscountSP; //经销商折扣SP
|
public Double DealerdiscountAH; //经销商折扣奥辉
|
public Double DealerdiscountBF; //经销商折扣BF
|
public Double DealerdiscountENF; //经销商折扣ENF
|
public Double DealerdiscountGI; //经销商折扣GI
|
public Double DealerdiscountGS; //经销商折扣GS
|
public Double DealerdiscountGYN; //经销商折扣GYN
|
public Double DealerdiscountOTH; //经销商折扣OTH
|
public Double DealerdiscountURO; //经销商折扣URO
|
public Double DealerdiscountZF; //经销商折扣政府项目
|
public String AimDivision; //目标区分
|
|
}
|
|
@HttpPost
|
global static void execute() {
|
// 取得接口传输内容
|
String strData = RestContext.request.requestBody.toString();
|
GeDatas ges = (GeDatas) JSON.deserializeStrict(strData, GeDatas.class);
|
|
if (ges == null) {
|
return;
|
}
|
|
NFMUtil.Monitoring Monitoring = ges.Monitoring;
|
if (Monitoring == null) {
|
return;
|
}
|
|
BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'SBG203', ges.Partners);
|
if (String.isBlank(rowData.Log__c) == false) {
|
executefuture(rowData.Id);
|
}
|
// JSONを戻す
|
RestResponse res = RestContext.response;
|
res.addHeader('Content-Type', 'application/json');
|
res.statusCode = 200;
|
String jsonResponse = '{"status": "0", "Message":""}';
|
res.responseBody = blob.valueOf(jsonResponse);
|
return;
|
}
|
|
@future
|
global static void executefuture(String rowData_Id) {
|
main(rowData_Id);
|
}
|
|
global static void main(String rowData_Id) {
|
Integer batch_retry_max_cnt = Integer.valueOf(System.Label.batch_retry_max_cnt);
|
BatchIF_Log__c rowData = [Select Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, retry_cnt__c from BatchIF_Log__c where RowDataFlg__c = true and Id =: rowData_Id];
|
String logstr = rowData.MessageGroupNumber__c + ' start\n';
|
BatchIF_Log__c iflog = new BatchIF_Log__c();
|
iflog.Type__c = 'SBG203';
|
iflog.MessageGroupNumber__c = rowData.MessageGroupNumber__c;
|
iflog.Log__c = logstr;
|
iflog.ErrorLog__c = '';
|
insert iflog;
|
|
String rowDataStr = NFMUtil.getRowDataStr(rowData);
|
List < GeData > geDataList = (List < GeData > ) JSON.deserialize(rowDataStr, List < GeData > .class);
|
if (geDataList == null || geDataList.size() == 0) {
|
return;
|
}
|
//客户转换表
|
Map < String, String > transferMap = NFMUtil.BatchIF_Transfer('Account');
|
|
//证照转换表
|
Map < String, String > transferLicenseTypeMap = NFMUtil.BatchIF_Transfer('License_Information__c');
|
|
//证照明细转换表
|
Map < String, String > certificationDetailTransferMap = NFMUtil.BatchIF_Transfer('CertificationDetails__c');
|
|
// 查找客户的全部记录类型
|
Map < String, String > accountRecordTypeMap = getRecordTypeMap();
|
Savepoint sp = Database.setSavepoint();
|
try {
|
|
//满足条件的GeData
|
List < GeData > satisfyGeData = SatisfyGeData(geDataList, iflog);
|
|
//根据bPCodeList查找存在的Account
|
Map < String, Account > existAccountMap = ExistAccount(satisfyGeData, iflog);
|
|
List < Account > upsertAccountList = new List < Account > ();
|
Map < String, String > licenseChangeNotNullMap = new Map < String, String > ();
|
if (satisfyGeData.size() > 0) {
|
|
//考虑是否是BS经销商
|
//存在的BS经销商
|
Map < String, GeData > existBSAccountMap = new Map < String, GeData > ();
|
//不存在的BS经销商
|
Map < String, GeData > notExistBSAccountMap = new Map < String, GeData > ();
|
//保存BS经销商
|
Map < String, Account > insertBSAccountMap = new Map < String, Account > ();
|
Boolean executeFlag = true;
|
for (GeData gda: satisfyGeData) {
|
|
Account accountInfo = new Account();
|
|
String transformProductSegment = gda.ProductSegment == 'LS' ? 'BS' : gda.ProductSegment; //gda.ProductSegment.split(':')[0];//FieldTransformation(gda.BPCode,transferMap, 'ProductSegment__c', gda.ProductSegment, iflog,'ProductSegment');
|
|
if (existAccountMap.containsKey(gda.BPCode) && gda.BPType == '23' && transformProductSegment == 'BS') {
|
//BS代理商-BPCode(课税)存在
|
|
if (existAccountMap.containsKey(gda.BPCodeforeign)) { //变更BS代理商
|
//BS代理商-BPCode(免税)存在
|
|
//获取课税代理商Id
|
existBSAccountMap.put(existAccountMap.get(gda.BPCode).Id + ';' + gda.BPCode + ';' + existAccountMap.get(gda.BPCode).Name, gda);
|
//获取免税代理商Id
|
existBSAccountMap.put(existAccountMap.get(gda.BPCodeforeign).Id + ';' + gda.BPCodeforeign + ';' + existAccountMap.get(gda.BPCodeforeign).Name, gda);
|
//获取母公司Id
|
existBSAccountMap.put(existAccountMap.get(gda.BPCode).ParentId + ';' + gda.BPCode + ':' + gda.BPCodeforeign + ';' + existAccountMap.get(gda.BPCode).Parent.Name, gda);
|
//licenseChangeNotNullMap.put(gda.BPCodeforeign,gda.ApplyType);
|
licenseChangeNotNullMap.put(gda.BPCode + ':' + gda.BPCodeforeign, gda.ApplyType);
|
} else {
|
//BS代理商-BPCode(课税)存在,BS代理商-BPCodeforeign(免税)不存在
|
iflog.ErrorLog__c += 'BPCode[ ' + gda.BPCode + ' ] of BPCodeforeign is inexistence,This data is skipped.\n';
|
executeFlag = false;
|
continue;
|
}
|
logstr = GetLog(logstr, gda);
|
|
} else if (gda.BPType == '23' && transformProductSegment == 'BS') {
|
//新增BS代理商
|
accountInfo.BS_Children_Code__c = gda.BPCode + ':' + gda.BPCodeforeign;
|
accountInfo = AccountValueAssignment(gda, accountInfo, transferMap, accountRecordTypeMap, iflog);
|
String dealerType = FieldTransformation(gda.BPCode, transferMap, 'Dealer_Type__c', gda.AgentType, iflog, 'AgentType');
|
|
if (!dealerType.equals('Invalid')) {
|
accountInfo.Dealer_Type__c = dealerType;
|
//新增BS代理商中的母公司
|
insertBSAccountMap.put(accountInfo.BS_Children_Code__c, accountInfo);
|
//新增BS代理商中的子公司
|
notExistBSAccountMap.put(gda.BPCode, gda);
|
notExistBSAccountMap.put(gda.BPCodeforeign, gda);
|
notExistBSAccountMap.put(accountInfo.BS_Children_Code__c, gda);
|
} else {
|
executeFlag = false;
|
continue;
|
}
|
logstr = GetLog(logstr, gda);
|
}
|
}
|
|
//变更BS代理商
|
if (existBSAccountMap.size() > 0) {
|
|
List < Account > updateBsChildrenAccountList = new List < Account > ();
|
for (String accountId: existBSAccountMap.keySet()) {
|
|
GeData gda = existBSAccountMap.get(accountId);
|
|
Account accountInfo = new Account();
|
accountInfo.Id = accountId.split(';')[0];
|
accountInfo = AccountValueAssignment(gda, accountInfo, transferMap, accountRecordTypeMap, iflog);
|
String dealerType = FieldTransformation(gda.BPCode, transferMap, 'Dealer_Type__c', gda.AgentType, iflog, 'AgentType');
|
|
if (dealerType.equals('Invalid')) {
|
executeFlag = false;
|
continue;
|
}
|
accountInfo.Dealer_Type__c = dealerType;
|
String bpCodeDutyFreeCode = gda.BPCode + ':' + gda.BPCodeforeign;
|
if (accountId.split(';')[1] == bpCodeDutyFreeCode) { //BS代理商母公司更名
|
accountInfo.Name = gda.CompanyName + '(P)';
|
} else { //BS代理商子公司更名
|
|
accountInfo.Name = gda.CompanyName;
|
}
|
updateBsChildrenAccountList.add(accountInfo);
|
|
}
|
|
//跳过SBG001接口
|
if (updateBsChildrenAccountList.size() > 0) {
|
NFMUtil.EscapeSBG001TriggerHandler = true;
|
update updateBsChildrenAccountList;
|
}
|
|
}
|
//新增BS代理商
|
if (insertBSAccountMap.size() > 0) {
|
insert insertBSAccountMap.values();
|
|
List < Account > bsAccountPList = [Select Id, Name, BS_Children_Code__c from Account where BS_Children_Code__c In: insertBSAccountMap.keySet()];
|
|
if (bsAccountPList.size() > 0) {
|
|
List < Account > insertBsChildrenAccountList = new List < Account > ();
|
|
for (Account acc: bsAccountPList) {
|
|
String parentId = acc.Id;
|
String parentName = acc.Name;
|
String bsChildrenCode = acc.BS_Children_Code__c;
|
|
if (notExistBSAccountMap.containsKey(bsChildrenCode)) {
|
Integer no = 0;
|
for (String bpCode: bsChildrenCode.split(':')) {
|
|
GeData gda = notExistBSAccountMap.get(bpCode);
|
Account accountInfo = new Account();
|
|
accountInfo.ManagementCode_Ext__c = bpCode;
|
accountInfo.ParentId = parentId;
|
accountInfo = AccountValueAssignment(gda, accountInfo, transferMap, accountRecordTypeMap, iflog);
|
if (no == 0) {
|
//课税代理商
|
accountInfo.DealerTradeType__c = NFMUtil.getMapValue(transferMap, 'DealerTradeType__c', '11', iflog);
|
} else {
|
//免税代理商
|
accountInfo.DealerTradeType__c = NFMUtil.getMapValue(transferMap, 'DealerTradeType__c', '12', iflog);
|
}
|
|
insertBsChildrenAccountList.add(accountInfo);
|
no++;
|
|
}
|
}
|
}
|
|
if (insertBsChildrenAccountList.size() > 0) {
|
NFMUtil.EscapeSBG001TriggerHandler = true;
|
insert insertBsChildrenAccountList;
|
}
|
|
}
|
}
|
|
//新增或变更其它类型的客户
|
for (GeData gda: satisfyGeData) {
|
String transformProductSegment = gda.ProductSegment == 'LS' ? 'BS' : gda.ProductSegment;
|
if (gda.BPType == '23' && transformProductSegment == 'BS') {
|
continue;
|
}
|
|
Account accountInfo = new Account();
|
|
if (existAccountMap.containsKey(gda.BPCode)) {
|
|
accountInfo = existAccountMap.get(gda.BPCode);
|
licenseChangeNotNullMap.put(gda.BPCode, gda.ApplyType);
|
} else {
|
|
accountInfo.ManagementCode_Ext__c = gda.BPCode;
|
}
|
|
if (gda.BPType == '23') {
|
String dealerType = FieldTransformation(gda.BPCode, transferMap, 'Dealer_Type__c', gda.AgentType, iflog, 'AgentType');
|
|
if (dealerType.equals('Invalid')) {
|
executeFlag = false;
|
}
|
}
|
|
if (gda.BPType == '22') {
|
accountInfo.RecordTypeId = '01228000000TF3Q'; //外贸公司
|
} else if (gda.BPType == '23') {
|
|
accountInfo.DealerTradeType__c = NFMUtil.getMapValue(transferMap, 'DealerTradeType__c', '13', iflog);
|
|
} else if (gda.BPType == '24') { //全国企业用户(大客户)
|
|
if ('42'.equals(gda.VTWEG)) {
|
Map < String, String > subuseMap = getSubuseMap();
|
|
if (!subuseMap.containsKey(gda.COMPOSubuse)) {
|
iflog.ErrorLog__c += 'BPCode[ ' + gda.BPCode + ' ] of COMPOSubuse [ ' + gda.COMPOSubuse + ' ]' + ' is Invalid,This data is skipped.\n';
|
executeFlag = false;
|
}
|
|
} else {
|
String keyAccount = FieldTransformation(gda.BPCode, transferMap, 'KeyAccount__c', gda.KeyAccount, iflog, 'KeyAccount');
|
|
if (keyAccount.equals('Invalid')) {
|
executeFlag = false;
|
}
|
String marketVerticals = FieldTransformation(gda.BPCode, transferMap, 'MarketVerticals__c', gda.MarketVerticals, iflog, 'MarketVerticals');
|
|
if (marketVerticals.equals('Invalid')) {
|
executeFlag = false;
|
}
|
String use = FieldTransformation(gda.BPCode, transferMap, 'Use__c', gda.Use, iflog, 'Use');
|
if (use.equals('Invalid')) {
|
executeFlag = false;
|
}
|
|
String industry = FieldTransformation(gda.BPCode, transferMap, 'IndustryC__c', gda.Industry, iflog, 'Industry');
|
if (industry.equals('Invalid')) {
|
executeFlag = false;
|
}
|
}
|
|
|
}
|
|
if (!executeFlag) {
|
continue;
|
}
|
accountInfo = AccountValueAssignment(gda, accountInfo, transferMap, accountRecordTypeMap, iflog);
|
upsertAccountList.add(accountInfo);
|
logstr = GetLog(logstr, gda);
|
}
|
|
if (upsertAccountList.size() > 0) {
|
NFMUtil.EscapeSBG001TriggerHandler = true;
|
upsert upsertAccountList;
|
for (Account acc: upsertAccountList) {
|
if (acc.NationalEnterpriseUser__c) {
|
UpsertAccountTeamMember(acc.Id);
|
}
|
}
|
}
|
existAccountMap = ExistAccount(satisfyGeData, iflog); //new Map<String,Account>();
|
Map < String, String > licenseChangeMap = LicenseChanges(existAccountMap); //new Map<String,String>();
|
|
if (executeFlag) {
|
|
if (licenseChangeMap.size() > 0 && licenseChangeNotNullMap.size() > 0) {
|
//变更
|
LicenseChange(licenseChangeMap, licenseChangeNotNullMap);
|
}
|
|
//合同相关(代理商折扣)
|
SatisfyDealerDiscount(satisfyGeData, existAccountMap, iflog);
|
|
//证照相关
|
SatisfyLicenseInfo(satisfyGeData, existAccountMap, transferLicenseTypeMap, certificationDetailTransferMap, iflog);
|
|
//联系人相关
|
SatisfyConsigneeInfoList(satisfyGeData, existAccountMap, iflog);
|
|
}
|
|
}
|
|
logstr += '\nend';
|
rowData.retry_cnt__c = 0;
|
|
|
} catch (Exception ex) {
|
Database.rollback(sp);
|
System.debug(Logginglevel.ERROR, 'SBG203_' + rowData.MessageGroupNumber__c + ':' + ex.getMessage());
|
System.debug(Logginglevel.ERROR, 'SBG203_' + rowData.MessageGroupNumber__c + ':' + ex.getStackTraceString());
|
logstr += '\n' + ex.getMessage();
|
iflog.ErrorLog__c = ex.getMessage() + '\n' + ex.getStackTraceString() + '\n' + iflog.ErrorLog__c;
|
|
if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0;
|
if (rowData.retry_cnt__c < batch_retry_max_cnt) {
|
rowData.retry_cnt__c++;
|
LogAutoSendSchedule.assignOneMinute();
|
}
|
if (rowData.retry_cnt__c >= batch_retry_max_cnt) {
|
rowData.ErrorLog__c = ex.getMessage() + '\n' + ex.getStackTraceString() + '\n' + rowData.ErrorLog__c + '错误次数已经超过自动收信设定的最大次数,请手动收信';
|
}
|
}
|
update rowData;
|
iflog.Log__c = logstr;
|
if (iflog.Log__c.length() > 131072) {
|
iflog.Log__c = iflog.Log__c.subString(0, 131065) + ' ...';
|
}
|
if (iflog.ErrorLog__c.length() > 32768) {
|
iflog.ErrorLog__c = iflog.ErrorLog__c.subString(0, 32760) + ' ...';
|
}
|
update iflog;
|
}
|
//证照变更
|
public static void LicenseChange(Map < String, String > licenseChangeMap, Map < String, String > licenseChangeNotNullMap) {
|
|
List < String > deleteExistDealerDiscountList = new List < String > ();
|
List < String > deleteExistLicenseInformationList = new List < String > ();
|
List < String > deleteExistContactList = new List < String > ();
|
for (String managementCode: licenseChangeMap.keySet()) {
|
|
if (licenseChangeNotNullMap.containsKey(managementCode)) {
|
|
String accountId = licenseChangeMap.get(managementCode);
|
//证照变更
|
if (licenseChangeNotNullMap.get(managementCode) == '2' || licenseChangeNotNullMap.get(managementCode) == '3' ||
|
licenseChangeNotNullMap.get(managementCode) == '4' || licenseChangeNotNullMap.get(managementCode) == '7') {
|
|
deleteExistLicenseInformationList.add(accountId);
|
}
|
}
|
}
|
|
List < License_Information__c > deleteLicenseInformationList = null;
|
if (deleteExistLicenseInformationList.size() > 0) {
|
|
deleteLicenseInformationList = [select Id from License_Information__c
|
where LicenseAndAccount__c In: deleteExistLicenseInformationList
|
];
|
if (deleteLicenseInformationList.size() > 0) {
|
delete deleteLicenseInformationList;
|
}
|
}
|
|
}
|
//代理商折扣
|
public static void SatisfyDealerDiscount(List < GeData > satisfyGeData, Map < String, Account > existAccountMap, BatchIF_Log__c iflog) {
|
|
//满足要求的代理商折扣
|
Map < String, Contract_Info > satisfyContractInfoMap = new Map < String, Contract_Info > ();
|
List < Dealer_Discount__c > dealerDiscountList = new List < Dealer_Discount__c > ();
|
Map < String, Dealer_Discount__c > dealerDiscountMap = new Map < String, Dealer_Discount__c > ();
|
//BS代理商免税代理商相关的代理商折扣
|
Map < String, GeData > satisfy2GeData = new Map < String, GeData > ();
|
List < String > bpCodeList = new List < String > ();
|
Map < String, String > bpCodeMap = new Map < String, String > ();
|
//验证代理商折扣必填字段
|
for (GeData gda: satisfyGeData) {
|
|
// if (gda.BPType != '23') {
|
// continue;
|
// }
|
if (!(gda.BPType == '23' || (gda.BPType == '24' && '42'.equals(gda.VTWEG)))) {
|
continue;
|
}
|
if (gda.Contract_Info == null) {
|
continue;
|
}
|
for (Contract_Info contractInfo: gda.Contract_Info) {
|
if (!String.isBlank(gda.ApplyType) && gda.ApplyType != '2' && gda.ApplyType != '3' && gda.ApplyType != '4' && gda.ApplyType != '6') {
|
continue;
|
}
|
if (!existAccountMap.containsKey(gda.BPCode)) {
|
iflog.ErrorLog__c += ' This BPCode[' + gda.BPCode + '] is not exist,This data is skipped .\n';
|
continue;
|
}
|
|
String productSegment = existAccountMap.get(gda.BPCode).ProductSegment__c;
|
if (productSegment == 'BS') {
|
|
if (String.isBlank(contractInfo.ContractRegion)) {
|
continue;
|
}
|
bpCodeMap.put(gda.BPCode, gda.BPCode);
|
bpCodeMap.put(gda.BPCodeforeign, gda.BPCodeforeign);
|
satisfyContractInfoMap.put(gda.BPCode + productSegment + contractInfo.ContractRegion, contractInfo);
|
} else if (productSegment == 'IE') {
|
|
satisfyContractInfoMap.put(gda.BPCode + productSegment + contractInfo.DealerRank, contractInfo);
|
bpCodeMap.put(gda.BPCode, gda.BPCode);
|
} else if (productSegment == 'RVI') {
|
|
// String processData = contractInfo.SubUse;
|
// // String latitudeValue = gda.BPCode + 'Other';
|
// if (String.isNotBlank(processData)) {
|
|
// if ( processData.indexOf('Civil Aviation') != -1) {
|
// // latitudeValue = gda.BPCode + 'Civil Aviation';
|
// bpCodeMap.put(gda.BPCode, gda.BPCode);
|
// if ( processData.indexOf(';') != -1 ) {
|
// // latitudeValue = gda.BPCode + 'Other';
|
// bpCodeMap.put(gda.BPCode, gda.BPCode);
|
// }
|
// } else {
|
// bpCodeMap.put(gda.BPCode, gda.BPCode);
|
// }
|
// satisfyContractInfoMap.put(gda.BPCode + productSegment + contractInfo.SubUse, contractInfo);
|
// }
|
bpCodeMap.put(gda.BPCode, gda.BPCode);
|
satisfyContractInfoMap.put(gda.BPCode + productSegment + contractInfo.SubUse, contractInfo);
|
} else if (productSegment == 'NDT' || productSegment == 'ANI') {
|
bpCodeMap.put(gda.BPCode, gda.BPCode);
|
satisfyContractInfoMap.put(gda.BPCode + productSegment, contractInfo);
|
}
|
satisfy2GeData.put(gda.BPCode, gda);
|
|
}
|
}
|
|
Map < String, Dealer_Discount__c > existDealerDiscountMap = getExistDealerDiscountMap(bpCodeMap.values());
|
Map < String, String > satisfyBsDealerDiscountMap = new Map < String, String > ();
|
|
//Boolean bSforeignFlag = false;
|
Boolean bSFlag = false;
|
for (GeData gda: satisfy2GeData.values()) {
|
|
//Bs免税代理商相关代理商折扣字段的赋值
|
for (Contract_Info contractInfo: satisfyContractInfoMap.values()) {
|
|
if (existAccountMap.containsKey(gda.BPCodeforeign)) {
|
String productSegment = existAccountMap.get(gda.BPCodeforeign).ProductSegment__c;
|
if (productSegment == 'BS') {
|
|
Map < String, Dealer_Discount__c > dealerDiscountBSMap = BS_DealerDiscount(existAccountMap, contractInfo.ContractRegion, existDealerDiscountMap, contractInfo, gda.BPCode, gda.BPCodeforeign, satisfyBsDealerDiscountMap);
|
dealerDiscountMap.putAll(dealerDiscountBSMap);
|
}
|
|
}
|
|
}
|
|
//其它代理商相关代理商折扣字段的赋值
|
for (Contract_Info contractInfo: satisfyContractInfoMap.values()) {
|
|
String productSegment = existAccountMap.get(gda.BPCode).ProductSegment__c;
|
Dealer_Discount__c dealerDiscount;
|
if (productSegment == 'IE' || productSegment == 'NDT' || productSegment == 'ANI') {
|
String latitudeValue = gda.BPCode;
|
dealerDiscount = AcquireDealerDiscount(existDealerDiscountMap, latitudeValue, contractInfo, productSegment);
|
dealerDiscount = DealerDiscountFields(contractInfo, dealerDiscount, productSegment, existAccountMap, '', '', gda.BPCode);
|
dealerDiscountList.add(dealerDiscount);
|
} else if (productSegment == 'BS') {
|
bSFlag = true;
|
Map < String, Dealer_Discount__c > dealerDiscountBSMap = BS_DealerDiscount(existAccountMap, contractInfo.ContractRegion, existDealerDiscountMap, contractInfo, gda.BPCode, '', satisfyBsDealerDiscountMap);
|
dealerDiscountMap.putAll(dealerDiscountBSMap);
|
} else if (productSegment == 'RVI') {
|
|
String processData = contractInfo.SubUse;
|
String latitudeValue = gda.BPCode + 'Other';
|
contractInfo.SubUse = 'Other';
|
if (String.isNotBlank(processData)) {
|
// 包含 Civil Aviation;创建或新增代理商折扣
|
if (processData.indexOf('Civil Aviation') != -1) {
|
latitudeValue = gda.BPCode + 'Civil Aviation';
|
contractInfo.SubUse = 'Civil Aviation';
|
dealerDiscount = AcquireDealerDiscount(existDealerDiscountMap, latitudeValue, contractInfo, productSegment);
|
dealerDiscount = DealerDiscountFields(contractInfo, dealerDiscount, productSegment, existAccountMap, '', '', gda.BPCode);
|
dealerDiscountList.add(dealerDiscount);
|
// 包含';'说明包含 其它的分类;创建或新增代理商折扣
|
if (processData.indexOf(';') != -1) {
|
latitudeValue = gda.BPCode + 'Other';
|
contractInfo.SubUse = 'Other';
|
dealerDiscount = AcquireDealerDiscount(existDealerDiscountMap, latitudeValue, contractInfo, productSegment);
|
dealerDiscount = DealerDiscountFields(contractInfo, dealerDiscount, productSegment, existAccountMap, '', '', gda.BPCode);
|
dealerDiscountList.add(dealerDiscount);
|
}
|
continue;
|
}
|
// else {
|
// contractInfo.SubUse = 'Other';
|
// dealerDiscount = AcquireDealerDiscount(existDealerDiscountMap, latitudeValue, contractInfo, productSegment);
|
// dealerDiscount = DealerDiscountFields(contractInfo, dealerDiscount, productSegment, existAccountMap, '', '', gda.BPCode);
|
// dealerDiscountList.add(dealerDiscount);
|
// }
|
}
|
dealerDiscount = AcquireDealerDiscount(existDealerDiscountMap, latitudeValue, contractInfo, productSegment);
|
dealerDiscount = DealerDiscountFields(contractInfo, dealerDiscount, productSegment, existAccountMap, '', '', gda.BPCode);
|
dealerDiscountList.add(dealerDiscount);
|
|
}
|
}
|
}
|
if (dealerDiscountList.size() > 0) {
|
upsert dealerDiscountList;
|
}
|
if (dealerDiscountMap.size() > 0) {
|
upsert dealerDiscountMap.values();
|
}
|
if (bSFlag) {
|
deleteDealerDiscount(satisfyBsDealerDiscountMap, existDealerDiscountMap);
|
}
|
|
}
|
//转换前后的值的对比
|
public static String FieldTransformation(String bpCode, Map < String, String > transformation, String api, String toConvertStr, BatchIF_Log__c iflog, String receivesField) {
|
String afterTransformation = NFMUtil.getMapValue(transformation, api, toConvertStr, iflog);
|
if (String.isNotBlank(afterTransformation) && !afterTransformation.equals(toConvertStr)) {
|
return afterTransformation;
|
} else if (String.isNotBlank(afterTransformation) && afterTransformation.equals(toConvertStr)) {
|
return afterTransformation;
|
} else {
|
iflog.ErrorLog__c += 'BPCode[ ' + bpCode + ' ] of ' + receivesField + ' [ ' + toConvertStr + ' ]' + ' is Invalid,This data is skipped.\n';
|
return 'Invalid';
|
}
|
}
|
|
//BS代理商折扣
|
public static Map < String, Dealer_Discount__c > BS_DealerDiscount(Map < String, Account > existAccountMap,
|
String contractRegion, Map < String, Dealer_Discount__c > existDealerDiscountMap,
|
Contract_Info contractInfo, String bpCode, String bPCodeforeign,
|
Map < String, String > satisfyBsDealerDiscountMap) {
|
Map < String, Dealer_Discount__c > result = new Map < String, Dealer_Discount__c > ();
|
String code = String.isBlank(bPCodeforeign) ? bpCode : bPCodeforeign;
|
|
if (contractRegion.indexOf(';') != -1) {
|
for (String region: contractRegion.split(';')) {
|
if (String.isNotBlank(region)) {
|
Dealer_Discount__c dealerDiscount;
|
String latitudeValue = code + region;
|
dealerDiscount = AcquireDealerDiscount(existDealerDiscountMap, latitudeValue, contractInfo, 'BS');
|
dealerDiscount = DealerDiscountFields(contractInfo, dealerDiscount, 'BS', existAccountMap, bPCodeforeign, region, bpCode);
|
satisfyBsDealerDiscountMap.put(latitudeValue, latitudeValue);
|
result.put(latitudeValue, dealerDiscount);
|
}
|
}
|
} else if (String.isNotBlank(contractRegion)) {
|
|
Dealer_Discount__c dealerDiscount;
|
String latitudeValue = code + contractRegion;
|
|
dealerDiscount = AcquireDealerDiscount(existDealerDiscountMap, latitudeValue, contractInfo, 'BS');
|
dealerDiscount = DealerDiscountFields(contractInfo, dealerDiscount, 'BS', existAccountMap, bPCodeforeign, contractRegion, bpCode);
|
satisfyBsDealerDiscountMap.put(latitudeValue, latitudeValue);
|
result.put(latitudeValue, dealerDiscount);
|
}
|
return result;
|
}
|
|
//代理商其它字段的赋值
|
public static Dealer_Discount__c DealerDiscountFields(Contract_Info contractInfo, Dealer_Discount__c dealerDiscount, String productSegment,
|
Map < String, Account > existAccountMap, String bPCodeforeign, String region, String bpCode) {
|
String code = String.isNotBlank(bPCodeforeign) ? bPCodeforeign : bpCode;
|
dealerDiscount.Product_Segment__c = productSegment;
|
dealerDiscount.DimensionField1__c = 'Dealer_Code__c';
|
dealerDiscount.DimensionValue1__c = code;
|
dealerDiscount.DealerDiscountAccount__c = existAccountMap.get(code).Id;
|
dealerDiscount.Name = productSegment + '-' + existAccountMap.get(code).Name;
|
if (productSegment == 'BS') {
|
dealerDiscount.DimensionField2__c = 'Province__c';
|
dealerDiscount.DimensionValue2__c = region;
|
if (String.isNotBlank(bPCodeforeign)) {
|
dealerDiscount.DimensionValue1__c = code;
|
dealerDiscount.DealerDiscountAccount__c = existAccountMap.get(code).Id;
|
dealerDiscount.Name = productSegment + '-' + existAccountMap.get(code).Name;
|
}
|
} else if (productSegment == 'RVI') {
|
dealerDiscount.DimensionField2__c = 'Subuse__c';
|
dealerDiscount.DimensionValue2__c = contractInfo.SubUse == 'Civil Aviation' ? 'Civil Aviation' : 'Other';
|
|
}
|
|
return dealerDiscount;
|
}
|
//代理商折扣日期相关字段的赋值
|
public static Dealer_Discount__c AcquireDealerDiscount(Map < String, Dealer_Discount__c > existDealerDiscountMap, String latitudeValue, Contract_Info contractInfo, String productSegment) {
|
system.debug('AcquireDealerDiscount--->Start');
|
Dealer_Discount__c dealerDiscount = new Dealer_Discount__c();
|
Date dateFrom = String.isBlank(contractInfo.ContractStartDate) ? Date.today() : NFMUtil.parseStr2Date(contractInfo.ContractStartDate, false);
|
Date dateTo = NFMUtil.parseStr2Date('20991231', true);
|
|
Decimal dealerRate; //(off:直接存;ON:100-Decimal.valueOf(contractInfo.DealerRate))
|
//if ( productSegment == 'NDT' || productSegment == 'ANI') {
|
// dealerRate = String.isBlank(contractInfo.DealerRate) ? 100 : Decimal.valueOf(contractInfo.DealerRate);
|
//} else
|
//2020-1-2 XHL Start
|
if (productSegment == 'BS') {
|
dealerRate = String.isBlank(contractInfo.DealerRate) ? 100 : 100 - Decimal.valueOf(contractInfo.DealerRate);
|
} else {
|
dealerRate = String.isBlank(contractInfo.DealerRate) ? 100 : Decimal.valueOf(contractInfo.DealerRate);
|
}
|
//2020-1-2 XHL End
|
if (existDealerDiscountMap.containsKey(latitudeValue)) {
|
dealerDiscount = existDealerDiscountMap.get(latitudeValue);
|
Date statusOneStart = dealerDiscount.Valid_Date_From__c;
|
Date statusOneEnd = dealerDiscount.Valid_Date_To__c;
|
Date statusTwoStart = dealerDiscount.Valid_Date_From2__c;
|
Date statusTwoEnd = dealerDiscount.Valid_Date_To2__c;
|
|
if (statusOneStart == null || statusOneEnd < Date.today() || statusOneStart == dateFrom) {
|
dealerDiscount.Valid_Date_To2__c = statusTwoEnd != null ? dateFrom.addDays(-1) : null;
|
dealerDiscount.Valid_Date_From__c = dateFrom;
|
dealerDiscount.Valid_Date_To__c = dateTo;
|
dealerDiscount.Dealer_Rank__c = dealerRate;
|
} else if (statusTwoStart == null || statusTwoEnd < Date.today() || statusTwoStart == dateFrom) {
|
//20200108---Add---Start-折扣开始日2为空,折扣开始日1为未来日期,更新折扣1
|
if (statusTwoStart == null && statusOneStart > Date.today()) {
|
dealerDiscount.Valid_Date_From__c = dateFrom;
|
dealerDiscount.Valid_Date_To__c = dateTo;
|
dealerDiscount.Dealer_Rank__c = dealerRate;
|
//20200108---Add---End
|
} else {
|
dealerDiscount.Valid_Date_To__c = dateFrom.addDays(-1);
|
dealerDiscount.Valid_Date_From2__c = dateFrom;
|
dealerDiscount.Valid_Date_To2__c = dateTo;
|
dealerDiscount.Dealer_Rank2__c = dealerRate;
|
}
|
} else {
|
if ((statusOneStart <= Date.today()) && (Date.today() <= statusOneEnd)) {
|
dealerDiscount.Valid_Date_To__c = dateFrom.addDays(-1);
|
dealerDiscount.Valid_Date_From2__c = dateFrom;
|
dealerDiscount.Valid_Date_To2__c = dateTo;
|
dealerDiscount.Dealer_Rank2__c = dealerRate;
|
} else if ((statusTwoStart <= Date.today()) && (Date.today() <= statusTwoEnd)) {
|
dealerDiscount.Valid_Date_To2__c = dateFrom.addDays(-1);
|
dealerDiscount.Valid_Date_From__c = dateFrom;
|
dealerDiscount.Valid_Date_To__c = dateTo;
|
dealerDiscount.Dealer_Rank__c = dealerRate;
|
}
|
}
|
} else {
|
dealerDiscount.Valid_Date_From__c = dateFrom;
|
dealerDiscount.Valid_Date_To__c = dateTo;
|
dealerDiscount.Dealer_Rank__c = dealerRate;
|
}
|
dealerDiscount.IsFromSPO__c = true;
|
return dealerDiscount;
|
}
|
|
public static void SatisfyLicenseInfo(List < GeData > satisfyGeData, Map < String, Account > existAccountMap, Map < String, String > transferLicenseTypeMap, Map < String, String > certificationDetailTransferMap, BatchIF_Log__c iflog) {
|
system.debug('SatisfyLicenseInfo---Start');
|
//证照层级
|
|
List < License_Info > satisfyLicenseInfoList = new List < License_Info > ();
|
List < License_Information__c > licenseInformationList = new List < License_Information__c > ();
|
List < Account > upsertAccountBusinesslicense = new List < Account > ();
|
List < CertificationDetails__c > certificationDetailsList = new List < CertificationDetails__c > ();
|
for (GeData gda: satisfyGeData) {
|
if (gda.License_Info == null) {
|
continue;
|
}
|
satisfyLicenseInfoList = new List < License_Info > ();
|
for (License_Info licenseInfo: gda.License_Info) {
|
if (!String.isBlank(gda.ApplyType) && gda.ApplyType != '2' && gda.ApplyType != '3' && gda.ApplyType != '4' && gda.ApplyType != '7') {
|
continue;
|
}
|
if (String.isBlank(licenseInfo.LicenseType) || String.isBlank(licenseInfo.BusLicenseNo)) {
|
continue;
|
}
|
satisfyLicenseInfoList.add(licenseInfo);
|
}
|
if (satisfyLicenseInfoList.size() > 0) {
|
|
for (License_Info licenseInfo: satisfyLicenseInfoList) {
|
License_Information__c licenseInformation = new License_Information__c();
|
String licenseType = FieldTransformation(gda.BPCode, transferLicenseTypeMap, 'LicenseType__c', licenseInfo.LicenseType, iflog, 'LicenseType');
|
if (licenseType.equals('Invalid')) {
|
continue;
|
}
|
|
licenseInformation.LicenseType__c = licenseType;
|
licenseInformation.BusinessLicense__c = licenseInfo.BusLicenseNo;
|
licenseInformation.ValidFrom__c = NFMUtil.parseStr2Date(licenseInfo.ValidFrom, false);
|
licenseInformation.ValidTo__c = NFMUtil.parseStr2Date(licenseInfo.ValidTo, false);
|
String warehouseAddress = licenseInfo.WarehouseAddress;
|
if (String.isNotBlank(warehouseAddress)) {
|
if (warehouseAddress.endsWith(';') || warehouseAddress.endsWith(';')) {
|
licenseInformation.StorageAddress__c = warehouseAddress.substring(0, warehouseAddress.length() - 1);
|
} else {
|
licenseInformation.StorageAddress__c = warehouseAddress;
|
}
|
} else {
|
licenseInformation.StorageAddress__c = warehouseAddress;
|
}
|
|
|
String productSegment = gda.ProductSegment == 'LS' ? 'BS' : gda.ProductSegment;
|
if (gda.BPType == '23' && productSegment == 'BS') {
|
licenseInformation.LicenseAndAccount__c = existAccountMap.get(gda.BPCode).ParentId;
|
licenseInformation.Name = existAccountMap.get(gda.BPCode).Parent.Name + licenseType;
|
} else {
|
licenseInformation.LicenseAndAccount__c = existAccountMap.get(gda.BPCode).Id;
|
licenseInformation.Name = existAccountMap.get(gda.BPCode).Name + licenseType;
|
}
|
//辐射安全许可证
|
if ('08'.equals(licenseInfo.LicenseType)) {
|
licenseInformation.IfQuantityCtrl__c = licenseInfo.IfQuantityCtrl;
|
if (licenseInfo.Detail_Info != null) {
|
|
certificationDetailsList = SatisfyLicenseDetails(gda.BPCode, licenseInfo.Detail_Info, certificationDetailTransferMap, iflog);
|
}
|
}
|
if ('04'.equals(licenseInfo.LicenseType)) {
|
|
Account acc = new Account();
|
acc.Id = licenseInformation.LicenseAndAccount__c;
|
acc.Business_license__c = licenseInfo.BusLicenseNo;
|
upsertAccountBusinesslicense.add(acc);
|
}
|
licenseInformationList.add(licenseInformation);
|
}
|
}
|
|
}
|
|
if (licenseInformationList.size() > 0) {
|
upsert licenseInformationList;
|
if (certificationDetailsList.size() > 0) {
|
insertCertificationDetail(certificationDetailsList, licenseInformationList);
|
}
|
}
|
|
if (upsertAccountBusinesslicense.size() > 0) {
|
upsert upsertAccountBusinesslicense;
|
}
|
}
|
|
//获取符合的证照明细
|
public static List < CertificationDetails__c > SatisfyLicenseDetails(String bpCode, List < Detail_Info > LicenseDetailS, Map < String, String > certificationDetailTransferMap, BatchIF_Log__c iflog) {
|
Map < String, CertificationDetails__c > certificationDetailMap = new Map < String, CertificationDetails__c > ();
|
List < CertificationDetails__c > result = new List < CertificationDetails__c > ();
|
for (Detail_Info detailInfo: LicenseDetailS) {
|
|
String licenseType = FieldTransformation(bpCode, certificationDetailTransferMap, 'ProdustionType__c', detailInfo.ProSerial, iflog, 'ProSerial');
|
Integer quantity = String.isBlank(detailInfo.Quantity) ? null : Integer.valueof(detailInfo.Quantity);
|
String remarks = detailInfo.ProName + '(' + quantity + ')';
|
String key = licenseType + '-' + detailInfo.Category;
|
if (!certificationDetailMap.containsKey(key)) {
|
CertificationDetails__c detail = new CertificationDetails__c();
|
detail.ProdustionType__c = licenseType;
|
detail.ProductModelNumber__c = quantity;
|
detail.ActivitieTypes__c = detailInfo.Category;
|
detail.DeviceName__c = detailInfo.ProName;
|
detail.Remarks__c = remarks;
|
certificationDetailMap.put(key, detail);
|
} else {
|
certificationDetailMap.get(key).ProductModelNumber__c += quantity;
|
certificationDetailMap.get(key).DeviceName__c += '/' + detailInfo.ProName;
|
certificationDetailMap.get(key).Remarks__c += '/' + remarks;
|
|
}
|
}
|
if (certificationDetailMap.size() > 0) {
|
for (CertificationDetails__c detail: certificationDetailMap.values()) {
|
result.add(detail);
|
}
|
}
|
|
return result;
|
}
|
|
public static void insertCertificationDetail(List < CertificationDetails__c > certificationDetailsList,
|
List < License_Information__c > licenseInformationList) {
|
|
String radiationCertificateId = '';
|
for (License_Information__c licenseInformation: licenseInformationList) {
|
if (licenseInformation.LicenseType__c == '辐射安全许可证') {
|
radiationCertificateId = licenseInformation.Id;
|
}
|
}
|
for (CertificationDetails__c certificationDetail: certificationDetailsList) {
|
certificationDetail.LicenseInformation__c = radiationCertificateId;
|
}
|
upsert certificationDetailsList;
|
|
}
|
public static void SatisfyConsigneeInfoList(List < GeData > satisfyGeData, Map < String, Account > existAccountMap, BatchIF_Log__c iflog) {
|
system.debug('SatisfyConsigneeInfoList---Start');
|
//收货人层级相关(联系人)
|
List < Contact > upsertContactList = new List < Contact > ();
|
Map < String, Consignee_Info > satisfyConsigneeInfoMap = new Map < String, Consignee_Info > ();
|
// 代理商禁用 将代理商用户设置为未启用
|
List < String > disableContactIdList = new List < String > ();
|
Boolean disableUserFlag = false;
|
// 代理商禁用 将代理商用户设置为未启用
|
//
|
List < Contact > existContact = getexistContactList(satisfyGeData,existAccountMap);
|
|
for (GeData gda: satisfyGeData) {
|
if (gda.Consignee_Info == null) {
|
continue;
|
}
|
satisfyConsigneeInfoMap = new Map < String, Consignee_Info > ();
|
for (Consignee_Info consigneeInfo: gda.Consignee_Info) {
|
if (!String.isBlank(gda.ApplyType) && gda.ApplyType != '2' && gda.ApplyType != '3' &&
|
gda.ApplyType != '4' && gda.ApplyType != '7' && gda.ApplyType != '8') {
|
continue;
|
}
|
if (String.isBlank(consigneeInfo.ContactName) || String.isBlank(consigneeInfo.ContactId)) {
|
continue;
|
}
|
if (String.isBlank(consigneeInfo.ContactAddress) && gda.BPType != '22') {
|
continue;
|
}
|
|
String contactId = processContactId(consigneeInfo.ContactId);
|
satisfyConsigneeInfoMap.put(contactId, consigneeInfo);
|
|
}
|
system.debug('<--satisfyConsigneeInfoMap-->' + satisfyConsigneeInfoMap);
|
Map < String, Contact > existContactMap = new Map < String, Contact > ();
|
if (satisfyConsigneeInfoMap.size() > 0) {
|
|
// String accountId = existAccountMap.get(gda.BPCode).Id;
|
// List < Contact > existContact = [select Id, ManagementCode_Ext__c, IsFromSPO__c, ManagementCode_F__c
|
// from Contact
|
// where AccountId =: accountId
|
// ];
|
|
if (existContact.size() > 0) {
|
for (Contact con: existContact) {
|
|
String contactId = processContactId(con.ManagementCode_F__c);
|
existContactMap.put(contactId, con);
|
if (!satisfyConsigneeInfoMap.containsKey(contactId)) {
|
Contact cont = new Contact();
|
cont.Id = con.Id;
|
cont.ContactStatus__c = 'Cancel';
|
cont.ContactStatusD__c = 'Cancel';
|
if (String.isNotBlank(con.ManagementCode_Ext__c)) {
|
upsertContactList.add(cont);
|
}
|
|
}
|
|
disableContactIdList.add(con.Id);
|
}
|
// 将代理商用户设置为未启用
|
// if (gda.ApplyType == '1' && disableContactIdList != null && disableContactIdList.size() > 0) {
|
// disableUserFlag = true;
|
// }
|
// 将代理商用户设置为未启用
|
}
|
system.debug('existContactMap------>' + existContactMap);
|
for (Consignee_Info consigneeInfo: satisfyConsigneeInfoMap.values()) {
|
|
String contactId = processContactId(consigneeInfo.ContactId);
|
Contact con = new Contact();
|
if (existContactMap.containsKey(contactId)) {
|
con = existContactMap.get(contactId);
|
if (String.isNotBlank(con.ManagementCode_Ext__c)) {
|
con.ManagementCode_Ext__c = consigneeInfo.ContactId;
|
}
|
} else {
|
con.ManagementCode_Ext__c = consigneeInfo.ContactId;
|
con.IsFromSPO__c = true;
|
con.Department = '无';
|
}
|
con.AccountId = existAccountMap.get(gda.BPCode).Id;
|
con.MobilePhone = consigneeInfo.ContactPhone; //SPO只有一个值consigneeInfo.ContactPhone故作此处理20191016 consigneeInfo.ContactMobilePhone;
|
con.MobilePhoneD__c = consigneeInfo.ContactPhone;
|
con.Phone = consigneeInfo.ContactPhone;
|
con.PhoneD__c = consigneeInfo.ContactPhone;
|
con.Postcode__c = consigneeInfo.PostalCode;
|
con.PostcodeD__c = consigneeInfo.PostalCode;
|
con.Address1__c = gda.BPType == '22' ? gda.RegisterAddress : consigneeInfo.ContactAddress;
|
con.Address1D__c = gda.BPType == '22' ? gda.RegisterAddress : consigneeInfo.ContactAddress;
|
con.EnglishAddress__c = gda.BPType == '22' ? gda.STR_SUPPL1 : '';
|
if (String.isNotBlank(consigneeInfo.ContactEnglishName) && gda.BPType == '22') {
|
con.LastName = consigneeInfo.ContactName + '(' + consigneeInfo.ContactEnglishName + ')';
|
con.FirstName = null;
|
con.ContactEnglishName__c = consigneeInfo.ContactEnglishName;
|
} else {
|
con.LastName = consigneeInfo.ContactName;
|
con.FirstName = null;
|
}
|
|
con.ContactStatus__c = 'Active';
|
con.ContactStatusD__c = 'Active';
|
con.StatusD__c = 'Pass';
|
con.ProductSegmentBS__c = false;
|
con.ProductSegmentRVI__c = false;
|
con.ProductSegmentIE__c = false;
|
con.ProductSegmentNDT__c = false;
|
con.ProductSegmentANI__c = false;
|
|
String productSegment = existAccountMap.get(gda.BPCode).ProductSegment__c;
|
if (productSegment == 'BS') {
|
con.ProductSegmentBS__c = true;
|
} else if (productSegment == 'RVI') {
|
con.ProductSegmentRVI__c = true;
|
} else if (productSegment == 'IE') {
|
con.ProductSegmentIE__c = true;
|
} else if (productSegment == 'NDT') {
|
con.ProductSegmentNDT__c = true;
|
} else if (productSegment == 'ANI') {
|
con.ProductSegmentANI__c = true;
|
}
|
|
upsertContactList.add(con);
|
}
|
}
|
|
}
|
// 将代理商用户设置为未启用 START
|
// if (disableUserFlag) {
|
|
// List < User > disableUserList = [SELECT Id, Name, ContactId, IsActive FROM User WHERE ContactId In: disableContactIdList AND IsActive = true];
|
// if (disableUserList.size() > 0) {
|
// for (User user: disableUserList) {
|
// user.IsActive = false;
|
// }
|
// update disableUserList;
|
// }
|
// }
|
// 将代理商用户设置为未启用 END
|
if (upsertContactList.size() > 0) {
|
NFMUtil.EscapeSBG001TriggerHandler = true;
|
system.debug('upsertContactList---->' + upsertContactList);
|
upsert upsertContactList;
|
}
|
system.debug('SatisfyConsigneeInfoList---End');
|
|
}
|
|
public static List < Contact > getexistContactList(List < GeData > satisfyGeData, Map < String, Account > existAccountMap){
|
List < Contact > existContact = new List < Contact >();
|
String accountIdStr = null;
|
Boolean contactCancelFlg = false;
|
for (GeData gda: satisfyGeData) {
|
// 客户禁用,将客户下的联系人进行无效
|
if (!String.isBlank(gda.ApplyType) && gda.ApplyType == '1' ) {
|
contactCancelFlg = true;
|
}
|
accountIdStr = existAccountMap.get(gda.BPCode).Id;
|
}
|
|
if (String.isNotBlank(accountIdStr)) {
|
existContact = [select Id, ManagementCode_Ext__c, IsFromSPO__c, ManagementCode_F__c
|
from Contact
|
where AccountId =: accountIdStr
|
];
|
|
if (contactCancelFlg && existContact.size() > 0 ) {
|
for (Contact con: existContact) {
|
con.ContactStatus__c = 'Cancel';
|
con.ContactStatusD__c = 'Cancel';
|
}
|
|
update existContact;
|
}
|
}
|
|
return existContact;
|
}
|
|
|
public static String processContactId(String contactId) {
|
String result = '';
|
Pattern pattern = Pattern.compile('[0-9]*');
|
Matcher isNum = pattern.matcher(contactId);
|
String stringNum = '';
|
if (isNum.matches()) {
|
Integer integerNum = Integer.valueOf(contactId);
|
stringNum = String.valueOf(integerNum);
|
}
|
result = String.isBlank(stringNum) ? contactId : stringNum;
|
return result;
|
}
|
|
//验证字段是否有值
|
public static Boolean FieldIsBlank(String bpCode, String verifyField, String receivesField, BatchIF_Log__c iflog) {
|
|
if (String.isBlank(bpCode)) {
|
iflog.ErrorLog__c += 'BPCode is required,This data is skipped.\n';
|
return true;
|
} else if (String.isBlank(verifyField)) {
|
iflog.ErrorLog__c += 'BPCode[ ' + bpCode + ' ] of ' + receivesField + ' is required,This data is skipped.\n';
|
return true;
|
} else {
|
return false;
|
}
|
|
}
|
//将 吴 晓晓(00328000010GuUC)放到全国企业用户的客户团队里面
|
public static void UpsertAccountTeamMember(String accountId) {
|
AccountTeamMember atm = new AccountTeamMember();
|
atm.accountId = accountId;
|
atm.userId = '005280000071H0s';
|
atm.teamMemberRole = 'Sales Manager';
|
atm.ACCOUNTACCESSLEVEL = 'Edit';
|
atm.CONTACTACCESSLEVEL = 'Edit';
|
atm.OPPORTUNITYACCESSLEVEL = 'None';
|
atm.CASEACCESSLEVEL = 'None';
|
upsert atm;
|
}
|
|
public static List < GeData > SatisfyGeData(List < GeData > geDataList, BatchIF_Log__c iflog) {
|
|
List < GeData > result = new List < GeData > ();
|
|
for (GeData gda: geDataList) {
|
Boolean ErrorFlg = false;
|
if (FieldIsBlank(gda.BPCode, gda.BPCode, 'BPCode', iflog)) {
|
ErrorFlg = true;
|
}
|
|
if (FieldIsBlank(gda.BPCode, gda.BPType, 'BPType', iflog)) {
|
ErrorFlg = true;
|
}
|
|
if (FieldIsBlank(gda.BPCode, gda.ProductSegment, 'ProductSegment', iflog)) {
|
ErrorFlg = true;
|
}
|
|
if (FieldIsBlank(gda.BPCode, gda.CompanyName, 'CompanyName', iflog)) {
|
ErrorFlg = true;
|
}
|
|
// if (FieldIsBlank(gda.BPCode, gda.VTWEG, 'VTWEG', iflog)) {
|
// ErrorFlg = true;
|
// }
|
|
if (gda.BPType == '24') {
|
|
// 分销渠道-直销
|
if ('42'.equals(gda.VTWEG)) {
|
|
if (FieldIsBlank(gda.BPCode, gda.AccountSource, 'BPType is 24 of AccountSource', iflog)) {
|
ErrorFlg = true;
|
}
|
if (FieldIsBlank(gda.BPCode, gda.UserType, 'BPType is 24 of UserType', iflog)) {
|
ErrorFlg = true;
|
}
|
if (FieldIsBlank(gda.BPCode, gda.COMPOSubuse, 'BPType is 24 of COMPOSubuse', iflog)) {
|
ErrorFlg = true;
|
}
|
if (gda.TargetCustomer == null) {
|
iflog.ErrorLog__c += 'BPCode[ ' + gda.BPCode + ' ] of TargetCustomer is required,This data is skipped.\n'; //客户类型
|
ErrorFlg = true;
|
}
|
|
if (gda.IsCOMPO == null) {
|
iflog.ErrorLog__c += 'BPCode[ ' + gda.BPCode + ' ] of IsCOMPO is required,This data is skipped.\n'; //COMPO客户
|
ErrorFlg = true;
|
}
|
} else {
|
if (FieldIsBlank(gda.BPCode, gda.KeyAccount, 'BPType is 24 of KeyAccount', iflog)) {
|
ErrorFlg = true;
|
}
|
|
if (FieldIsBlank(gda.BPCode, gda.ExportRegulatedCustomer, 'BPType is 24 of ExportRegulatedCustomer', iflog)) {
|
ErrorFlg = true;
|
}
|
|
if (FieldIsBlank(gda.BPCode, gda.MarketVerticals, 'BPType is 24 of MarketVerticals', iflog)) {
|
ErrorFlg = true;
|
}
|
|
if (FieldIsBlank(gda.BPCode, gda.Industry, 'BPType is 24 of Industry', iflog)) {
|
ErrorFlg = true;
|
}
|
|
if (FieldIsBlank(gda.BPCode, gda.Use, 'BPType is 24 of Use', iflog)) {
|
ErrorFlg = true;
|
}
|
}
|
|
}
|
String transformProductSegment = gda.ProductSegment == 'LS' ? 'BS' : gda.ProductSegment;
|
|
if (gda.BPType == '23') {
|
//经销商分类
|
if (FieldIsBlank(gda.BPCode, gda.AgentType, 'AgentType', iflog)) {
|
ErrorFlg = true;
|
}
|
}
|
if (gda.BPType == '23' && transformProductSegment == 'BS') {
|
//免税编码
|
if (FieldIsBlank(gda.BPCode, gda.BPCodeforeign, 'BPType is 23 and ProductSegment is BS BPCodeforeign', iflog)) {
|
ErrorFlg = true;
|
} else {
|
String foreign = gda.BPCodeforeign.trim();
|
if (foreign.equals('3000000378')) {
|
gda.BPCodeforeign = foreign + '-1';
|
}
|
}
|
}
|
if (ErrorFlg) {
|
continue;
|
}
|
result.add(gda);
|
}
|
|
return result;
|
}
|
//存在的客户
|
public static Map < String, Account > ExistAccount(List < GeData > satisfyGeData, BatchIF_Log__c iflog) {
|
|
Map < String, Account > result = new Map < String, Account > ();
|
List < String > bPCodeList = new List < String > ();
|
for (GeData gda: satisfyGeData) {
|
String transformProductSegment = gda.ProductSegment == 'LS' ? 'BS' : gda.ProductSegment;
|
if (gda.BPType == '23' && transformProductSegment == 'BS') {
|
bPCodeList.add(gda.BPCodeforeign);
|
}
|
bPCodeList.add(gda.BPCode);
|
}
|
|
if (bPCodeList.size() > 0) {
|
List < Account > accountList = [select Id, Name, ManagementCode_Ext__c, ParentId, ProductSegment__c,
|
Parent.Name, Parent.BS_Children_Code__c, Address1__c, RecordTypeId, IsPartner, ProhibitionAccount__c
|
from Account
|
where ManagementCode_Ext__c In: bPCodeList
|
];
|
|
if (accountList.size() > 0) {
|
|
for (Account acc: accountList) {
|
result.put(acc.ManagementCode_Ext__c, acc);
|
}
|
}
|
}
|
|
return result;
|
}
|
|
public static Map < String, String > LicenseChanges(Map < String, Account > existAccountMap) {
|
Map < String, String > result = new Map < String, String > ();
|
|
if (existAccountMap.size() > 0) {
|
|
for (Account acc: existAccountMap.values()) {
|
|
if (acc.RecordTypeId == '012280000005gnE' && acc.ProductSegment__c == 'BS') {
|
|
result.put(acc.Parent.BS_Children_Code__c, acc.ParentId);
|
} else {
|
result.put(acc.ManagementCode_Ext__c, acc.Id);
|
}
|
}
|
}
|
return result;
|
|
}
|
|
public static Account AccountValueAssignment(GeData gda, Account accountInfo, Map < String, String > transferMap, Map < String, String > accountRecordTypeMap, BatchIF_Log__c iflog) {
|
system.debug('AccountValueAssignment---Start');
|
system.debug('accountRecordTypeMap---->' + accountRecordTypeMap);
|
String productSegment = gda.ProductSegment == 'LS' ? 'BS' : gda.ProductSegment;
|
if (gda.BPType == '23') {
|
if (String.isNotBlank(accountInfo.BS_Children_Code__c)) {
|
accountInfo.DealerTradeType__c = FieldTransformation(gda.BPCode, transferMap, 'DealerTradeType__c', '13', iflog, 'DealerTradeType');
|
accountInfo.Name = gda.CompanyName + '(P)';
|
} else {
|
accountInfo.Name = gda.CompanyName;
|
}
|
accountInfo.RecordTypeId = '012280000005gnE';
|
// accountInfo.DisableDate__c = gda.ApplyType == '1' ? Date.today() : null;
|
// 将代理商的合作伙伴客户设置为假
|
if (gda.ApplyType == '1') {
|
accountInfo.DisableDate__c = Date.today();
|
accountInfo.IsPartner = false; //将代理商的合作伙伴客户设置为False
|
accountInfo.ProhibitionAccount__c = true;
|
}
|
// 将代理商的合作伙伴客户设置为假
|
accountInfo.Dealer_Type__c = NFMUtil.getMapValue(transferMap, 'Dealer_Type__c', gda.AgentType, iflog);
|
accountInfo.EnglishAddress__c = gda.RegisterAddress;
|
} else if (gda.BPType == '22') {
|
accountInfo.RecordTypeId = '01228000000TF3Q'; //外贸公司
|
accountInfo.Name = gda.CompanyName;
|
accountInfo.EnglishAddress__c = gda.STR_SUPPL1;
|
} else if (gda.BPType == '24') { //全国企业用户(大客户)
|
accountInfo.Name = gda.CompanyName;
|
accountInfo.FacilityName__c = gda.CompanyName;
|
accountInfo.DivisionName__c = '无';
|
accountInfo.DivisionName_D__c = '无';
|
|
if (String.isNotBlank(gda.Postal)) {
|
accountInfo.PostCode__c = gda.Postal;
|
accountInfo.PostCodeD__c = gda.Postal;
|
}
|
|
|
|
// 分销渠道-直销
|
if ('42'.equals(gda.VTWEG)) {
|
// IE直销
|
accountInfo.CustomerSource__c = gda.AccountSource; //客户来源 【CustomerSource】添加选项值 直销、代理商
|
accountInfo.TargetCustomer__c = gda.TargetCustomer ? '目标' : '非目标'; //客户类型
|
accountInfo.compo_Acc__c = gda.IsCOMPO ? 'COMPO客户' : '非COMPO客户'; //COMPO客户
|
accountInfo.UserType__c = gda.UserType; //用户属性
|
accountInfo.RecordTypeId = accountRecordTypeMap.get('IE_Account'); //IE直销 //'0120T0000003Cxt';
|
accountInfo.FacilityNameD__c = gda.CompanyName;
|
Map < String, String > subuseMap = getSubuseMap();
|
accountInfo.IsNew__c = false;
|
if (subuseMap.containsKey(gda.COMPOSubuse)) {
|
String industryC_MarketVerticals_Use = subuseMap.get(gda.COMPOSubuse);
|
List < String > fieldList = industryC_MarketVerticals_Use.split(';');
|
accountInfo.Sub_Use__c = fieldList[0];
|
accountInfo.Sub_UseD__c = fieldList[0];
|
accountInfo.IndustryC__c = fieldList[1];
|
accountInfo.IndustryCD__c = fieldList[1];
|
accountInfo.MarketVerticals__c = fieldList[2];
|
accountInfo.MarketVerticalsD__c = fieldList[2];
|
accountInfo.Use__c = fieldList[3];
|
accountInfo.UseD__c = fieldList[3];
|
|
}
|
|
if (gda.ApplyType == '1') {
|
accountInfo.DisableDate__c = Date.today();
|
accountInfo.IsPartner = false;
|
accountInfo.AccountStatus__c = 'Cancel';
|
accountInfo.AccountStatusD__c = 'Cancel';
|
}
|
} else {
|
String keyAccount = FieldTransformation(gda.BPCode, transferMap, 'KeyAccount__c', gda.KeyAccount, iflog, 'KeyAccount');
|
String marketVerticals = FieldTransformation(gda.BPCode, transferMap, 'MarketVerticals__c', gda.MarketVerticals, iflog, 'MarketVerticals');
|
String use = FieldTransformation(gda.BPCode, transferMap, 'Use__c', gda.Use, iflog, 'Use');
|
String industry = FieldTransformation(gda.BPCode, transferMap, 'IndustryC__c', gda.Industry, iflog, 'Industry');
|
accountInfo.KeyAccount__c = keyAccount;
|
accountInfo.IndustryC__c = industry;
|
accountInfo.IndustryCD__c = industry;
|
|
accountInfo.MarketVerticals__c = marketVerticals;
|
accountInfo.MarketVerticalsD__c = marketVerticals;
|
accountInfo.Use__c = use;
|
accountInfo.UseD__c = use;
|
accountInfo.Sub_Use__c = gda.SubUseEnterprise;
|
accountInfo.Sub_UseD__c = gda.SubUseEnterprise;
|
accountInfo.NationalEnterpriseUser__c = true;
|
|
accountInfo.ExportRegulatedCustomer__c = false;
|
if (gda.ExportRegulatedCustomer == '1') {
|
accountInfo.ExportRegulatedCustomer__c = true;
|
}
|
if (productSegment == 'BS') {
|
accountInfo.RecordTypeId = '01228000000TdF1'; //客户BS
|
} else if (productSegment == 'ANI') {
|
accountInfo.RecordTypeId = '01228000000TdFL'; //客户ANI
|
} else if (productSegment == 'IE') {
|
accountInfo.RecordTypeId = '01228000000TdF6'; //客户IE
|
} else if (productSegment == 'NDT') {
|
accountInfo.RecordTypeId = '01228000000TdFG'; //客户NDT
|
} else if (productSegment == 'RVI') {
|
accountInfo.RecordTypeId = '01228000000TdFB'; //客户RVI
|
}
|
}
|
|
}
|
|
accountInfo.ProductSegment__c = productSegment;
|
accountInfo.Province__c = gda.Region;
|
accountInfo.MobilePhoneNumber__c = gda.Mobilephone;
|
accountInfo.EnglishName__c = gda.CompanyEnglishName;
|
accountInfo.EnglishNameD__c = gda.CompanyEnglishName;
|
accountInfo.City__c = gda.City;
|
accountInfo.CityD__c = gda.City;
|
accountInfo.Address1__c = gda.RegisterAddress;
|
accountInfo.Address1D__c = gda.RegisterAddress;
|
accountInfo.Phone = gda.Phone;
|
accountInfo.PhoneD__c = gda.Phone;
|
accountInfo.Fax = gda.Fax;
|
accountInfo.FaxD__c = gda.Fax;
|
accountInfo.stautesD__c = 'Pass';
|
system.debug('AccountValueAssignment---End');
|
return accountInfo;
|
}
|
|
public static String GetLog(String logstr, GeData gda) {
|
logstr += '管理编码:' + gda.BPCode;
|
logstr += '\n变更类型:' + gda.ApplyType;
|
logstr += '\n客户类型:' + gda.BPType;
|
if (gda.BPType == '23') {
|
logstr += '\n经销商分类:' + gda.AgentType;
|
}
|
return logstr;
|
}
|
|
public static Map < String, Dealer_Discount__c > getExistDealerDiscountMap(List < String > bpCodeList) {
|
Map < String, Dealer_Discount__c > result = new Map < String, Dealer_Discount__c > ();
|
//查找存在的代理商折扣
|
List < Dealer_Discount__c > dealerDiscounts = [Select Id, Name, LatitudeValue__c, Valid_Date_From__c,
|
Valid_Date_From2__c, Valid_Date_To__c, Valid_Date_To2__c
|
from Dealer_Discount__c
|
where DimensionValue1__c In: bpCodeList
|
];
|
|
|
if (dealerDiscounts.size() > 0) {
|
|
for (Dealer_Discount__c dealerDis: dealerDiscounts) {
|
|
result.put(dealerDis.LatitudeValue__c, dealerDis);
|
}
|
}
|
return result;
|
}
|
|
|
public static Map < String, String > getRecordTypeMap() {
|
Map < String, String > result = new Map < String, String > ();
|
List < RecordType > recordTypeList = [select Id, DeveloperName from RecordType where IsActive = true and SobjectType = 'Account'];
|
if (recordTypeList.size() > 0) {
|
for (RecordType recordType: recordTypeList) {
|
result.put(recordType.DeveloperName, recordType.Id);
|
}
|
}
|
return result;
|
}
|
|
public static void deleteDealerDiscount(Map < String, String > satisfyBsDealerDiscountMap, Map < String, Dealer_Discount__c > existDealerDiscountMap) {
|
List < Dealer_Discount__c > dealerDiscountList = new List < Dealer_Discount__c > ();
|
for (String key: existDealerDiscountMap.keySet()) {
|
|
if (!satisfyBsDealerDiscountMap.containsKey(key)) {
|
dealerDiscountList.add(existDealerDiscountMap.get(key));
|
}
|
}
|
if (dealerDiscountList != null) {
|
delete dealerDiscountList;
|
}
|
|
}
|
|
/**
|
* [getSubuseMap description]
|
* @return [description]
|
*/
|
public static Map < String, String > getSubuseMap() {
|
|
// Sub_Use;IndustryC;MarketVerticals;Use
|
Map < String, String > subuseMap = new Map < String, String > ();
|
subuseMap.put('I045', '医疗器械;Medical Device/Equipment;Manufacturing;(Manufacturing) Other');
|
subuseMap.put('I046', '激光加工;Other;Manufacturing;(Manufacturing) Other');
|
subuseMap.put('I047', '制药;Pharmaceutical;Manufacturing;(Manufacturing) Other');
|
subuseMap.put('I048', '动植物;Food/Feed/Agriculture;Other;(Other) Other');
|
subuseMap.put('I049', '新能源汽车;Automotive;Manufacturing;Automotive Body/Engine');
|
subuseMap.put('I050', '5G-PCB;Electronics;Manufacturing;Electronic Device');
|
subuseMap.put('I051', '5G-半导体;Electronics;Manufacturing;Electronic Device');
|
subuseMap.put('I052', '5G-其他;Electronics;Manufacturing;Electronic Device');
|
subuseMap.put('I053', 'Compo-半导体-前道;Electronics;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I054', 'Compo-半导体-中期;Electronics;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I055', 'Compo-半导体-后道;Electronics;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I056', 'Compo-FPD;Electronics;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I057', 'Compo-3D 测量仪;Electronics;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I058', 'Compo-测试仪器;Electronics;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I059', 'Compo-拉曼光谱仪;Academic Research;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I060', 'Compo-血液;Medical Device/Equipment;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I061', 'Compo-尿液/粪便;Medical Device/Equipment;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I062', 'Compo-细胞学;Medical Device/Equipment;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I063', 'Compo-遗传学;Medical Device/Equipment;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I064', 'Compo-病理;Medical Device/Equipment;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I065', 'Compo-生殖;Medical Device/Equipment;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I066', 'Compo-高端显微镜;Academic Research;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I067', 'Compo-细胞观察;Academic Research;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I068', 'Compo-电子显微镜;Academic Research;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I069', 'Compo-高内涵;Academic Research;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I070', 'Compo-流式细胞仪;Academic Research;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I071', 'Compo-ODM;Other;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I072', 'Compo-精准医疗;Academic Research;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I073', 'Compo-其他;Other;Manufacturing;(Manufacturing)OEM');
|
subuseMap.put('I038', '电子类_其他;Electronics;Manufacturing;Electronic Device');
|
subuseMap.put('I036', '电子部品;Electronics;Manufacturing;Electronic Device');
|
subuseMap.put('I035', '半导体;Electronics;Manufacturing;Semiconductor');
|
subuseMap.put('I037', '太阳能;Electronics;Manufacturing;Electronic Device');
|
subuseMap.put('I041', '石油地质;Mining/Geology;Natural Resources;Geology : Geological Surveys');
|
subuseMap.put('I043', '重工设备;Fabricated Metal Manufacturing;Manufacturing;(Manufacturing) Other');
|
subuseMap.put('I044', '材料类_其他;Academic Research;Manufacturing;Industrial Scientific research');//需特殊处理:材料类_其他
|
subuseMap.put('I042', '五金模具;Metal Manufacturing;Manufacturing;Machined Parts');
|
subuseMap.put('I039', '金属;Metal Manufacturing;Manufacturing;Casting');
|
subuseMap.put('I033', 'LED;Electronics;Manufacturing;Electronic Device');
|
subuseMap.put('I034', 'FPD;Electronics;Manufacturing;Electronic Device');
|
subuseMap.put('I040', '汽车;Automotive;Manufacturing;Automotive Body/Engine');
|
|
return subuseMap;
|
}
|
// public static Map < String, String > getSubuseMap() {
|
// Map < String, String > subuseMap = new Map < String, String > ();
|
// subuseMap.put('I045', '医疗器械_Medical Device/Equipment_Manufacturing_(Manufacturing) Other');
|
// subuseMap.put('I046', '激光加工_Other_Manufacturing_(Manufacturing) Other');
|
// subuseMap.put('I047', '制药_Pharmaceutical_Manufacturing_(Manufacturing) Other');
|
// subuseMap.put('I048', '动植物_Food/Feed/Agriculture_Other_(Other) Other');
|
// subuseMap.put('I049', '新能源汽车_Automotive_Manufacturing_Automotive Body/Engine');
|
// subuseMap.put('I050', '5G-PCB_Electronics_Manufacturing_Electronic Device');
|
// subuseMap.put('I051', '5G-半导体_Electronics_Manufacturing_Electronic Device');
|
// subuseMap.put('I052', '5G-其他_Electronics_Manufacturing_Electronic Device');
|
// subuseMap.put('I053', 'Compo-半导体-前道_Electronics_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I054', 'Compo-半导体-中期_Electronics_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I055', 'Compo-半导体-后道_Electronics_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I056', 'Compo-FPD_Electronics_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I057', 'Compo-3D 测量仪_Electronics_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I058', 'Compo-测试仪器_Electronics_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I059', 'Compo-拉曼光谱仪_Academic Research_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I060', 'Compo-血液_Medical Device/Equipment_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I061', 'Compo-尿液/粪便_Medical Device/Equipment_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I062', 'Compo-细胞学_Medical Device/Equipment_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I063', 'Compo-遗传学_Medical Device/Equipment_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I064', 'Compo-病理_Medical Device/Equipment_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I065', 'Compo-生殖_Medical Device/Equipment_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I066', 'Compo-高端显微镜_Academic Research_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I067', 'Compo-细胞观察_Academic Research_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I068', 'Compo-电子显微镜_Academic Research_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I069', 'Compo-高内涵_Academic Research_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I070', 'Compo-流式细胞仪_Academic Research_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I071', 'Compo-ODM_Other_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I072', 'Compo-精准医疗_Academic Research_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I073', 'Compo-其他_Other_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('I038', '电子类_其他_Electronics_Manufacturing_Electronic Device');
|
// subuseMap.put('I036', '电子部品_Electronics_Manufacturing_Electronic Device');
|
// subuseMap.put('I035', '半导体_Electronics_Manufacturing_Semiconductor');
|
// subuseMap.put('I037', '太阳能_Electronics_Manufacturing_Electronic Device');
|
// subuseMap.put('I041', '石油地质_Mining/Geology_Natural Resources_Geology : Geological Surveys');
|
// subuseMap.put('I043', '重工设备_Fabricated Metal Manufacturing_Manufacturing_(Manufacturing) Other');
|
// subuseMap.put('I044', '材料类_其他_Academic Research_Manufacturing_Industrial Scientific research');//需特殊处理:材料类_其他
|
// subuseMap.put('I042', '五金模具_Metal Manufacturing_Manufacturing_Machined Parts');
|
// subuseMap.put('I039', '金属_Metal Manufacturing_Manufacturing_Casting');
|
// subuseMap.put('I033', 'LED_Electronics_Manufacturing_Electronic Device');
|
// subuseMap.put('I034', 'FPD_Electronics_Manufacturing_Electronic Device');
|
// subuseMap.put('I040', '汽车_Automotive_Manufacturing_Automotive Body/Engine');
|
|
// return subuseMap;
|
// }
|
|
// public static Map < String, String > getSubuseMap() {
|
// Map < String, String > subuseMap = new Map < String, String > ();
|
// subuseMap.put('医疗器械', 'Medical Device/Equipment_Manufacturing_(Manufacturing) Other');
|
// subuseMap.put('激光加工', 'Other_Manufacturing_(Manufacturing) Other');
|
// subuseMap.put('制药', 'Pharmaceutical_Manufacturing_(Manufacturing) Other');
|
// subuseMap.put('动植物', 'Food/Feed/Agriculture_Other_(Other) Other');
|
// subuseMap.put('新能源汽车', 'Automotive_Manufacturing_Automotive Body/Engine');
|
// subuseMap.put('5G-PCB', 'Electronics_Manufacturing_Electronic Device');
|
// subuseMap.put('5G-半导体', 'Electronics_Manufacturing_Electronic Device');
|
// subuseMap.put('5G-其他', 'Electronics_Manufacturing_Electronic Device');
|
// subuseMap.put('Compo-半导体-前道', 'Electronics_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-半导体-中期', 'Electronics_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-半导体-后道', 'Electronics_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-FPD', 'Electronics_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-3D 测量仪', 'Electronics_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-测试仪器', 'Electronics_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-拉曼光谱仪', 'Academic Research_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-血液', 'Medical Device/Equipment_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-尿液/粪便', 'Medical Device/Equipment_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-细胞学', 'Medical Device/Equipment_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-遗传学', 'Medical Device/Equipment_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-病理', 'Medical Device/Equipment_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-生殖', 'Medical Device/Equipment_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-高端显微镜', 'Academic Research_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-细胞观察', 'Academic Research_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-电子显微镜', 'Academic Research_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-高内涵', 'Academic Research_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-流式细胞仪', 'Academic Research_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-ODM', 'Other_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-精准医疗', 'Academic Research_Manufacturing_(Manufacturing)OEM');
|
// subuseMap.put('Compo-其他', 'Other_Manufacturing_(Manufacturing)OEM');
|
|
// return subuseMap;
|
// }
|
}
|