|
|
@@ -54,15 +54,28 @@ public class ScheduleTask9 {
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
- 最近一年打款客户为老客户
|
|
|
+ 最近一年大货打款客户为老客户
|
|
|
*/
|
|
|
Set<String> oldCustomerCodes = new HashSet<>();
|
|
|
String customerCode;
|
|
|
+ List<Map> subTableData;
|
|
|
for (Map confirmedReceiptRecord : confirmedReceiptData){
|
|
|
customerCode = (String) confirmedReceiptRecord.get("customerCode");
|
|
|
- oldCustomerCodes.add(customerCode);
|
|
|
+ subTableData = (List<Map>) confirmedReceiptRecord.get("subTableData");
|
|
|
+ for (Map subTableRecord : subTableData){
|
|
|
+ if(subTableRecord.get("customerCode") != null && customerCode.equals(subTableRecord.get("customerCode"))){
|
|
|
+ //仅大货打款为老客户
|
|
|
+ if("全款".equals(subTableRecord.get("receiptType"))
|
|
|
+ || "大货定金".equals(subTableRecord.get("receiptType"))
|
|
|
+ || "大货尾款".equals(subTableRecord.get("receiptType"))){
|
|
|
+ oldCustomerCodes.add(customerCode);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ log.info("客户(主表)与客户(子表)不一致:"+confirmedReceiptRecord.get("processInstanceId"));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- log.info("最近一年打款客户数量="+oldCustomerCodes.size());
|
|
|
+ log.info("最近一年大货打款客户数量="+oldCustomerCodes.size());
|
|
|
|
|
|
/*
|
|
|
查询(易思达)客户名册所有记录
|
|
|
@@ -82,6 +95,8 @@ public class ScheduleTask9 {
|
|
|
String newOrOldFlag; //新老客户
|
|
|
String formInstId;
|
|
|
int count = 0;
|
|
|
+ String customerAiTableId;
|
|
|
+ Map syncLog;
|
|
|
for (String oldCustomerCode : oldCustomerCodes){
|
|
|
try {
|
|
|
for (Map ltcCustomerRecord : ltcCustomerData){
|
|
|
@@ -92,6 +107,12 @@ public class ScheduleTask9 {
|
|
|
log.info("修改为老客户:"+ltcCustomerRecord.get("customerName").toString());
|
|
|
yidaService.updateLtcCustomerNewOrOld(formInstId, "老");
|
|
|
Thread.sleep(3000);
|
|
|
+ syncLog = new HashMap();
|
|
|
+ syncLog.put("logType","新老客户变更同步");
|
|
|
+ customerAiTableId = ltcCustomerRecord.get("aiTableId").toString();
|
|
|
+ syncLog.put("aiTableID",customerAiTableId);
|
|
|
+ syncLog.put("newOrOld","老客户");
|
|
|
+ yidaService.addSyncLog(syncLog);
|
|
|
count++;
|
|
|
}
|
|
|
//已找到该客户
|
|
|
@@ -154,11 +175,10 @@ public class ScheduleTask9 {
|
|
|
/*
|
|
|
最近1年有实际成单日期项目的关联客户以及有打款记录的客户保留老客户标识,其他客户更新为新客户标识
|
|
|
*/
|
|
|
- String customerAiTableId;
|
|
|
boolean isOrdered;
|
|
|
count = 0;
|
|
|
for (Map ltcCustomerRecord : ltcCustomerDataFilter){ //遍历老客户
|
|
|
- System.out.println("老客户:" + ltcCustomerRecord.get("customerName").toString());
|
|
|
+// System.out.println("老客户:" + ltcCustomerRecord.get("customerName").toString());
|
|
|
customerCode = ltcCustomerRecord.get("customerCode").toString();
|
|
|
if(oldCustomerCodes.contains(customerCode)){
|
|
|
//有打款记录,保留老客户标识
|
|
|
@@ -175,7 +195,7 @@ public class ScheduleTask9 {
|
|
|
}
|
|
|
if(customerAiTableId.equals(sys1SaleRecord.get("customerId"))){
|
|
|
actualCloseDate = Long.parseLong(sys1SaleRecord.get("actualCloseDate").toString());
|
|
|
- System.out.println("实际成单日期:" + sdf.format(new Date(actualCloseDate)));
|
|
|
+// System.out.println("实际成单日期:" + sdf.format(new Date(actualCloseDate)));
|
|
|
//有实际成单日期项目,保留老客户标识
|
|
|
isOrdered = true;
|
|
|
break;
|
|
|
@@ -188,6 +208,12 @@ public class ScheduleTask9 {
|
|
|
log.info("修改为新客户:" + ltcCustomerRecord.get("customerName").toString());
|
|
|
yidaService.updateLtcCustomerNewOrOld(formInstId, "新");
|
|
|
Thread.sleep(3000);
|
|
|
+ syncLog = new HashMap();
|
|
|
+ syncLog.put("logType","新老客户变更同步");
|
|
|
+ customerAiTableId = ltcCustomerRecord.get("aiTableId").toString();
|
|
|
+ syncLog.put("aiTableID",customerAiTableId);
|
|
|
+ syncLog.put("newOrOld","新客户");
|
|
|
+ yidaService.addSyncLog(syncLog);
|
|
|
count++;
|
|
|
} catch (Exception e) {
|
|
|
log.error("修改为新客户异常",e);
|
|
|
@@ -290,16 +316,23 @@ public class ScheduleTask9 {
|
|
|
|
|
|
String testUseFlag; //测试使用
|
|
|
String seaType; //公海/私海
|
|
|
+ String newOrOldFlag; //新老客户
|
|
|
String businessUserId; //业务员userId
|
|
|
String businessUnionId; //业务员unionId
|
|
|
Map<String, Integer> privateCustomerNumMap; //业务员私海客户数量
|
|
|
int numOfPrivateCustomer;
|
|
|
+ Map<String, Integer> privateNewCustomerNumMap; //业务员新客户数量
|
|
|
+ int numOfPrivateNewCustomer;
|
|
|
+ Map<String, Integer> privateOldCustomerNumMap; //业务员老客户数量
|
|
|
+ int numOfPrivateOldCustomer;
|
|
|
|
|
|
/*
|
|
|
统计易思达系统私海客户数量
|
|
|
- 按新老客户统计todo
|
|
|
+ 同时按新老客户统计
|
|
|
*/
|
|
|
privateCustomerNumMap = new HashMap<>();
|
|
|
+ privateNewCustomerNumMap = new HashMap<>();
|
|
|
+ privateOldCustomerNumMap = new HashMap<>();
|
|
|
for(Map ltcCustomerRecord : ltcCustomerData){
|
|
|
try {
|
|
|
testUseFlag = "";
|
|
|
@@ -326,6 +359,20 @@ public class ScheduleTask9 {
|
|
|
}else{
|
|
|
privateCustomerNumMap.put(businessUserId, 1);
|
|
|
}
|
|
|
+ newOrOldFlag = ltcCustomerRecord.get("newOrOld").toString();
|
|
|
+ if("新".equals(newOrOldFlag)){
|
|
|
+ if(privateNewCustomerNumMap.containsKey(businessUserId)){
|
|
|
+ privateNewCustomerNumMap.put(businessUserId, privateNewCustomerNumMap.get(businessUserId) + 1);
|
|
|
+ }else{
|
|
|
+ privateNewCustomerNumMap.put(businessUserId, 1);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(privateOldCustomerNumMap.containsKey(businessUserId)){
|
|
|
+ privateOldCustomerNumMap.put(businessUserId, privateOldCustomerNumMap.get(businessUserId) + 1);
|
|
|
+ }else{
|
|
|
+ privateOldCustomerNumMap.put(businessUserId, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
}else{
|
|
|
log.info("未匹配到在职业务员:" + businessUserId + " " + ddCoreClient.getNameByUserId(businessUserId));
|
|
|
}
|
|
|
@@ -359,6 +406,32 @@ public class ScheduleTask9 {
|
|
|
// } catch (Exception e) {
|
|
|
// log.error("更新各业务员私海客户数量异常",e);
|
|
|
// }
|
|
|
+// if(privateNewCustomerNumMap.containsKey(userIdKey)){
|
|
|
+// numOfPrivateNewCustomer = privateNewCustomerNumMap.get(userIdKey);
|
|
|
+// }else{
|
|
|
+// //新客户归0
|
|
|
+// numOfPrivateNewCustomer = 0;
|
|
|
+// }
|
|
|
+// try {
|
|
|
+// formInstId = userIdFormInstIdMap.get(userIdKey);
|
|
|
+// log.info("更新各业务员新客户数量:" + formInstId + " " + numOfPrivateNewCustomer);
|
|
|
+// yidaService.updateLtcBusinessUserPrivateNewCustomerNum(formInstId, numOfPrivateNewCustomer);
|
|
|
+// } catch (Exception e) {
|
|
|
+// log.error("更新各业务员新客户数量异常",e);
|
|
|
+// }
|
|
|
+// if(privateOldCustomerNumMap.containsKey(userIdKey)){
|
|
|
+// numOfPrivateOldCustomer = privateOldCustomerNumMap.get(userIdKey);
|
|
|
+// }else{
|
|
|
+// //老客户归0
|
|
|
+// numOfPrivateOldCustomer = 0;
|
|
|
+// }
|
|
|
+// try {
|
|
|
+// formInstId = userIdFormInstIdMap.get(userIdKey);
|
|
|
+// log.info("更新各业务员老客户数量:" + formInstId + " " + numOfPrivateOldCustomer);
|
|
|
+// yidaService.updateLtcBusinessUserPrivateOldCustomerNum(formInstId, numOfPrivateOldCustomer);
|
|
|
+// } catch (Exception e) {
|
|
|
+// log.error("更新各业务员老客户数量异常",e);
|
|
|
+// }
|
|
|
// }
|
|
|
|
|
|
|
|
|
@@ -366,9 +439,11 @@ public class ScheduleTask9 {
|
|
|
/*
|
|
|
统计项目总表私海客户数量
|
|
|
私海客户总数
|
|
|
- 按新老客户统计todo
|
|
|
+ 同时按新老客户统计
|
|
|
*/
|
|
|
privateCustomerNumMap = new HashMap<>();
|
|
|
+ privateNewCustomerNumMap = new HashMap<>();
|
|
|
+ privateOldCustomerNumMap = new HashMap<>();
|
|
|
for(Map sys1CustomerRecord : sys1CustomerData){
|
|
|
try {
|
|
|
testUseFlag = "";
|
|
|
@@ -387,6 +462,20 @@ public class ScheduleTask9 {
|
|
|
}else{
|
|
|
privateCustomerNumMap.put(businessUnionId, 1);
|
|
|
}
|
|
|
+ newOrOldFlag = sys1CustomerRecord.get("newOrOld").toString();
|
|
|
+ if("新".equals(newOrOldFlag)){
|
|
|
+ if(privateNewCustomerNumMap.containsKey(businessUnionId)){
|
|
|
+ privateNewCustomerNumMap.put(businessUnionId, privateNewCustomerNumMap.get(businessUnionId) + 1);
|
|
|
+ }else{
|
|
|
+ privateNewCustomerNumMap.put(businessUnionId, 1);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(privateOldCustomerNumMap.containsKey(businessUnionId)){
|
|
|
+ privateOldCustomerNumMap.put(businessUnionId, privateOldCustomerNumMap.get(businessUnionId) + 1);
|
|
|
+ }else{
|
|
|
+ privateOldCustomerNumMap.put(businessUnionId, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
@@ -417,6 +506,32 @@ public class ScheduleTask9 {
|
|
|
} catch (Exception e) {
|
|
|
log.error("更新各业务员私海客户数量(项目总表)异常",e);
|
|
|
}
|
|
|
+ if(privateNewCustomerNumMap.containsKey(unionIdKey)){
|
|
|
+ numOfPrivateNewCustomer = privateNewCustomerNumMap.get(unionIdKey);
|
|
|
+ }else{
|
|
|
+ //新客户归0
|
|
|
+ numOfPrivateNewCustomer = 0;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ formInstId = unionIdFormInstIdMap.get(unionIdKey);
|
|
|
+ log.info("更新各业务员新客户数量(项目总表):" + formInstId + " " + numOfPrivateNewCustomer);
|
|
|
+ yidaService.updateLtcBusinessUserPrivateNewCustomerNum2(formInstId, numOfPrivateNewCustomer);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("更新各业务员新客户数量(项目总表)异常",e);
|
|
|
+ }
|
|
|
+ if(privateOldCustomerNumMap.containsKey(unionIdKey)){
|
|
|
+ numOfPrivateOldCustomer = privateOldCustomerNumMap.get(unionIdKey);
|
|
|
+ }else{
|
|
|
+ //老客户归0
|
|
|
+ numOfPrivateOldCustomer = 0;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ formInstId = unionIdFormInstIdMap.get(unionIdKey);
|
|
|
+ log.info("更新各业务员老客户数量(项目总表):" + formInstId + " " + numOfPrivateOldCustomer);
|
|
|
+ yidaService.updateLtcBusinessUserPrivateOldCustomerNum2(formInstId, numOfPrivateOldCustomer);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("更新各业务员老客户数量(项目总表)异常",e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
log.info("计算业务员私海客户数量结束");
|