|
|
@@ -83,14 +83,11 @@ public class udfController {
|
|
|
{
|
|
|
String sql = udf.getString("SQL_CONFIG");//查询配置
|
|
|
|
|
|
- if (sql.contains("@"))
|
|
|
- sql = SDK.getRuleAPI().executeAtScript(sql, userContext);
|
|
|
+ if (sql.contains("@")) sql = SDK.getRuleAPI().executeAtScript(sql, userContext);
|
|
|
|
|
|
|
|
|
- if (sql.contains("@"))
|
|
|
- sql = SDK.getRuleAPI().executeAtScript(sql, userContext);
|
|
|
- if (sql.contains("$ID"))
|
|
|
- sql = sql.replace("$ID", objectId);
|
|
|
+ if (sql.contains("@")) sql = SDK.getRuleAPI().executeAtScript(sql, userContext);
|
|
|
+ if (sql.contains("$ID")) sql = sql.replace("$ID", objectId);
|
|
|
|
|
|
if (sql.contains("$")) {
|
|
|
|
|
|
@@ -134,8 +131,7 @@ public class udfController {
|
|
|
System.out.println("com.awspaas.user.apps.donenow_sys_udf_save");
|
|
|
System.out.println("cateId=" + cateId + " objectId=" + objectId);
|
|
|
System.out.println(data);
|
|
|
- if (StringUtils.isBlank(data) || data.equals("{}"))
|
|
|
- return ResponseObject.newOkResponse();
|
|
|
+ if (StringUtils.isBlank(data) || data.equals("{}")) return ResponseObject.newOkResponse();
|
|
|
|
|
|
JSONObject json = JSON.parseObject(data);
|
|
|
|
|
|
@@ -155,8 +151,7 @@ public class udfController {
|
|
|
}
|
|
|
values.add(objectId);
|
|
|
//转换成 数组
|
|
|
- if (StringUtils.isBlank(set))
|
|
|
- return ResponseObject.newOkResponse();
|
|
|
+ if (StringUtils.isBlank(set)) return ResponseObject.newOkResponse();
|
|
|
|
|
|
String sql = "update " + tableName + " set " + set.substring(0, set.length() - 1) + " where id=?";
|
|
|
System.out.println("sql===" + sql);
|
|
|
@@ -182,8 +177,7 @@ public class udfController {
|
|
|
public ResponseObject networkUdf(UserContext userContext, String boDefName, String boId) throws IOException {
|
|
|
String ORGID = userContext.getCompanyModel().getId();
|
|
|
RowMap cateGeneral = DBSql.getMap("select * from bo_eu_dnd_general where is_active=1 and closed=0 and general_table_id=32 AND ORGID=? AND REMARK=?", new Object[]{ORGID, boDefName});
|
|
|
- if (cateGeneral == null)
|
|
|
- return ResponseObject.newOkResponse("未配置");
|
|
|
+ if (cateGeneral == null) return ResponseObject.newOkResponse("未配置");
|
|
|
String cateId = cateGeneral.getString("OID");
|
|
|
List<RowMap> udfList = DBSql.getMaps("SELECT * FROM BO_EU_DNSYS_UDF_FIELD WHERE COL_NAME LIKE 'NETWORK_%' AND CATE_ID=? AND ORGID=? AND IS_ACTIVE=1 ORDER BY SORT_ORDER", new Object[]{cateId, ORGID});
|
|
|
|
|
|
@@ -205,10 +199,8 @@ public class udfController {
|
|
|
{
|
|
|
newSelectedOptionTitle = udf.getString("COL_COMMENT");
|
|
|
String sql = udf.getString("SQL_CONFIG");//查询配置 label value
|
|
|
- if (sql.contains("@"))
|
|
|
- sql = SDK.getRuleAPI().executeAtScript(sql, userContext);
|
|
|
- if (sql.contains("$ID"))
|
|
|
- sql = sql.replace("$ID", boId);
|
|
|
+ if (sql.contains("@")) sql = SDK.getRuleAPI().executeAtScript(sql, userContext);
|
|
|
+ if (sql.contains("$ID")) sql = sql.replace("$ID", boId);
|
|
|
|
|
|
if (sql.contains("$")) {
|
|
|
|
|
|
@@ -247,8 +239,7 @@ public class udfController {
|
|
|
|
|
|
String ORGID = userContext.getCompanyModel().getId();
|
|
|
RowMap cateGeneral = DBSql.getMap("select * from bo_eu_dnd_general where is_active=1 and closed=0 and general_table_id=32 AND ORGID=? AND REMARK=?", new Object[]{ORGID, boDefName});
|
|
|
- if (cateGeneral == null)
|
|
|
- return ResponseObject.newOkResponse("未配置");
|
|
|
+ if (cateGeneral == null) return ResponseObject.newOkResponse("未配置");
|
|
|
String cateId = cateGeneral.getString("OID");
|
|
|
|
|
|
List<RowMap> udfList = DBSql.getMaps("SELECT * FROM BO_EU_DNSYS_UDF_FIELD WHERE COL_NAME LIKE 'NETWORK_%' AND CATE_ID=? AND ORGID=? AND IS_ACTIVE=1 ORDER BY SORT_ORDER", new Object[]{cateId, ORGID});
|
|
|
@@ -278,13 +269,10 @@ public class udfController {
|
|
|
{
|
|
|
String sql = udf.getString("SQL_CONFIG");//查询配置
|
|
|
|
|
|
- if (sql.contains("@"))
|
|
|
- sql = SDK.getRuleAPI().executeAtScript(sql, userContext);
|
|
|
+ if (sql.contains("@")) sql = SDK.getRuleAPI().executeAtScript(sql, userContext);
|
|
|
|
|
|
- if (sql.contains("@"))
|
|
|
- sql = SDK.getRuleAPI().executeAtScript(sql, userContext);
|
|
|
- if (sql.contains("$ID"))
|
|
|
- sql = sql.replace("$ID", boId);
|
|
|
+ if (sql.contains("@")) sql = SDK.getRuleAPI().executeAtScript(sql, userContext);
|
|
|
+ if (sql.contains("$ID")) sql = sql.replace("$ID", boId);
|
|
|
if (sql.contains("$")) {
|
|
|
//匹配字符串中 所有 $大写字母小写字母下划线数字 的字符串
|
|
|
Pattern pattern = Pattern.compile("\\$([A-Za-z0-9_]+)");
|
|
|
@@ -341,12 +329,10 @@ public class udfController {
|
|
|
System.out.println("commentType=" + commentType);
|
|
|
|
|
|
BOModel boModel = BOCache.getInstance().getModelByEntityName(boDefName);
|
|
|
- if (boModel == null)
|
|
|
- return ResponseObject.newOkResponse("未配置");
|
|
|
+ if (boModel == null) return ResponseObject.newOkResponse("未配置");
|
|
|
String tableName = boModel.getName();
|
|
|
RowMap boMap = DBSql.getMap("select * from " + tableName + " where ID=?", new Object[]{boId});
|
|
|
- if (boMap == null)
|
|
|
- return ResponseObject.newOkResponse("未找到对象");
|
|
|
+ if (boMap == null) return ResponseObject.newOkResponse("未找到对象");
|
|
|
|
|
|
|
|
|
JSONObject json = JSON.parseObject(data);
|
|
|
@@ -360,8 +346,7 @@ public class udfController {
|
|
|
|
|
|
for (String key : json.keySet()) {
|
|
|
String fieldName = key.toUpperCase();
|
|
|
- if (fieldName.startsWith("NETWORK_"))
|
|
|
- bo.set(fieldName, json.get(key));
|
|
|
+ if (fieldName.startsWith("NETWORK_")) bo.set(fieldName, json.get(key));
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
@@ -504,13 +489,11 @@ public class udfController {
|
|
|
|
|
|
for (String permissionId : map.keySet()) {
|
|
|
boolean flag = SDK.getPermAPI().havingUserInPermission(userContext.getUID(), permissionId);
|
|
|
- if (flag)
|
|
|
- permissions.add(map.get(permissionId));
|
|
|
+ if (flag) permissions.add(map.get(permissionId));
|
|
|
}
|
|
|
|
|
|
ResponseObject responseObject = ResponseObject.newOkResponse();
|
|
|
- if (!permissions.isEmpty())
|
|
|
- responseObject.setData(StringUtils.join(permissions, ","));
|
|
|
+ if (!permissions.isEmpty()) responseObject.setData(StringUtils.join(permissions, ","));
|
|
|
return responseObject;
|
|
|
}
|
|
|
|
|
|
@@ -527,4 +510,72 @@ public class udfController {
|
|
|
return responseObject;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取信息流信息
|
|
|
+ * @param userContext
|
|
|
+ * @param streamId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Mapping(value = "com.awspaas.user.apps.donenow_sys_getstreamInfo")
|
|
|
+ public ResponseObject getstreamInfo(UserContext userContext, String streamId) {
|
|
|
+ ResponseObject responseObject = ResponseObject.newOkResponse();
|
|
|
+ //获取活动相关信息
|
|
|
+ RowMap rowMap = DBSql.getMap("select * from BO_EU_DNCOM_ACTIVITY where STREAM_ID=? ", new Object[]{streamId});
|
|
|
+
|
|
|
+ String OBJECT_TYPE_ID = rowMap.getString("OBJECT_TYPE_ID");
|
|
|
+ Map<String, String> resultMap = new HashMap<>();
|
|
|
+
|
|
|
+ String boId = null;
|
|
|
+
|
|
|
+ switch (OBJECT_TYPE_ID) {
|
|
|
+ case "735"://客户
|
|
|
+ {
|
|
|
+ boId = rowMap.getString("ACCOUNT_ID");
|
|
|
+ RowMap account = DBSql.getMap("select BINDID,NAME,NO from BO_EU_DNCRM_ACCOUNT WHERE ID=?", new Object[]{boId});
|
|
|
+ resultMap.put("NAME", account.getString("NAME"));
|
|
|
+ resultMap.put("NO", account.getString("NO"));
|
|
|
+
|
|
|
+ String processUrl = SDK.getFormAPI().getFormURL(SDK.getPortalAPI().getPortalUrl(), userContext.getSessionId(), account.getString("BINDID"), null, 1, null, null, null, true);
|
|
|
+ resultMap.put("URL", processUrl);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "736"://联系人
|
|
|
+ {
|
|
|
+ boId = rowMap.getString("CONTACT_ID");
|
|
|
+ RowMap contact = DBSql.getMap("select BINDID,NAME from BO_EU_DNCRM_CONTACT WHERE ID=?", new Object[]{boId});
|
|
|
+ resultMap.put("NAME", contact.getString("NAME"));
|
|
|
+
|
|
|
+ String processUrl = SDK.getFormAPI().getFormURL(SDK.getPortalAPI().getPortalUrl(), userContext.getSessionId(), contact.getString("BINDID"), null, 1, null, null, null, true);
|
|
|
+ resultMap.put("URL", processUrl);
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "739"://合同
|
|
|
+ {
|
|
|
+ boId = rowMap.getString("CONTRACT_ID");
|
|
|
+ RowMap contract = DBSql.getMap("select BINDID,NAME,NO from BO_EU_DNCTT_CONTRACT WHERE ID=?", new Object[]{boId});
|
|
|
+ resultMap.put("NAME", contract.getString("NAME"));
|
|
|
+ resultMap.put("NO", contract.getString("NO"));
|
|
|
+
|
|
|
+ String processUrl = SDK.getFormAPI().getFormURL(SDK.getPortalAPI().getPortalUrl(), userContext.getSessionId(), contract.getString("BINDID"), null, 1, null, null, null, true);
|
|
|
+ resultMap.put("URL", processUrl);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "737"://商机
|
|
|
+ boId = rowMap.getString("OPPORTUNITY_ID");
|
|
|
+
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ responseObject.setData(resultMap);
|
|
|
+ return responseObject;
|
|
|
+ }
|
|
|
+
|
|
|
}
|