|
|
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@Slf4j
|
|
|
@@ -47,18 +48,27 @@ public class AitableController {
|
|
|
String yidaCustomerLevel = UtilMap.getString(data, "yidaCustomerLevel"); //客户潜在等级
|
|
|
String yidaNewOrOld = UtilMap.getString(data, "yidaNewOrOld"); //新老客户
|
|
|
String yidaCustomerStatus = UtilMap.getString(data, "yidaCustomerStatus"); //客户情况
|
|
|
+ String yidaCountryOrRegion = UtilMap.getString(data, "yidaCountryOrRegion"); //客户国家/地区
|
|
|
+ List<String> yidaProductTypes = UtilMap.getList(data, "yidaProductTypes"); //主要品类
|
|
|
Map<String,Object> fields = new HashMap<>();
|
|
|
try {
|
|
|
fields.put("20rO7zS",yidaCustomerName); //客户公司名【基础】
|
|
|
fields.put("qgOhsh1",yidaCustomerLevel); //客户分级【客户】
|
|
|
- fields.put("3Y796Wb",yidaNewOrOld+"客户"); //新老客户?【客户】
|
|
|
+ fields.put("3Y796Wb",yidaNewOrOld); //新老客户?【客户】
|
|
|
fields.put("jIS3Gbd",yidaCustomerStatus); //客户情况
|
|
|
+ fields.put("JjVfpWO",yidaCountryOrRegion); //客户国家/地区【客户】
|
|
|
+ fields.put("7sMX43a",yidaProductTypes); //产品细分【客户】
|
|
|
JSONArray user = new JSONArray();
|
|
|
JSONObject unionId = new JSONObject();
|
|
|
unionId.put("unionId",ddCoreClient.getUnionIdByUserId(yidaBusinessUserId));
|
|
|
user.add(unionId);
|
|
|
fields.put("ynNC3Kq",JSONObject.toJSONString(user)); //业务【人事】
|
|
|
- String aitableId = aitableService.addSys1CustomerData(fields);
|
|
|
+ String aitableId = aitableService.querySys1CustomerIdByName(yidaCustomerName);
|
|
|
+ if(aitableId == null || aitableId.isEmpty()){
|
|
|
+ aitableId = aitableService.addSys1CustomerData(fields);
|
|
|
+ }else{
|
|
|
+ log.info("客户["+yidaCustomerName+"]在项目总表已存在,不再新增");
|
|
|
+ }
|
|
|
yidaService.updateCustomerRelatedAitableId(yidaInstanceId, aitableId);
|
|
|
return McR.success();
|
|
|
} catch (Exception e) {
|