|
@@ -1,23 +1,29 @@
|
|
|
package com.awspaas.user.apps.donenow_crm.controller;
|
|
package com.awspaas.user.apps.donenow_crm.controller;
|
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
+
|
|
|
import com.actionsoft.bpms.bo.engine.BO;
|
|
import com.actionsoft.bpms.bo.engine.BO;
|
|
|
import com.actionsoft.bpms.commons.database.RowMap;
|
|
import com.actionsoft.bpms.commons.database.RowMap;
|
|
|
|
|
+import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
|
|
|
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
|
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
|
|
import com.actionsoft.bpms.server.UserContext;
|
|
import com.actionsoft.bpms.server.UserContext;
|
|
|
import com.actionsoft.bpms.server.bind.annotation.Controller;
|
|
import com.actionsoft.bpms.server.bind.annotation.Controller;
|
|
|
import com.actionsoft.bpms.server.bind.annotation.Mapping;
|
|
import com.actionsoft.bpms.server.bind.annotation.Mapping;
|
|
|
import com.actionsoft.bpms.util.DBSql;
|
|
import com.actionsoft.bpms.util.DBSql;
|
|
|
import com.actionsoft.sdk.local.SDK;
|
|
import com.actionsoft.sdk.local.SDK;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
-
|
|
|
|
|
-import java.sql.Connection;
|
|
|
|
|
-import java.sql.SQLException;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import com.alibaba.cloud.commons.lang.StringUtils;
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.awspaas.user.apps.donenow_crm.constant.CrmConstant;
|
|
|
|
|
|
|
|
@Controller
|
|
@Controller
|
|
|
-public class accountController {
|
|
|
|
|
- /**
|
|
|
|
|
- * 鍒犻櫎瀹㈡埛
|
|
|
|
|
|
|
+public class AccountController extends BaseController {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 删除客户
|
|
|
* @param uc
|
|
* @param uc
|
|
|
* @param ids
|
|
* @param ids
|
|
|
* @return
|
|
* @return
|
|
@@ -26,18 +32,18 @@ public class accountController {
|
|
|
@Mapping(value = "com.awspaas.user.apps.donenow_DelAccount")
|
|
@Mapping(value = "com.awspaas.user.apps.donenow_DelAccount")
|
|
|
public ResponseObject delAccount(UserContext uc, String ids) throws SQLException {
|
|
public ResponseObject delAccount(UserContext uc, String ids) throws SQLException {
|
|
|
if (StringUtils.isBlank(ids))
|
|
if (StringUtils.isBlank(ids))
|
|
|
- return ResponseObject.newErrResponse("璇烽€夋嫨瑕佸垹闄ょ殑鏁版嵁");
|
|
|
|
|
|
|
+ return ResponseObject.newErrResponse("请选择要删除的数据");
|
|
|
|
|
|
|
|
String tableName = "BO_EU_DNCRM_ACCOUNT";
|
|
String tableName = "BO_EU_DNCRM_ACCOUNT";
|
|
|
|
|
|
|
|
- //寮曠敤鏍¢獙
|
|
|
|
|
|
|
+ //引用校验
|
|
|
String result = verifyDel(tableName, ids);
|
|
String result = verifyDel(tableName, ids);
|
|
|
if (result != null)
|
|
if (result != null)
|
|
|
return ResponseObject.newErrResponse(result);
|
|
return ResponseObject.newErrResponse(result);
|
|
|
|
|
|
|
|
Connection conn = null;
|
|
Connection conn = null;
|
|
|
try {
|
|
try {
|
|
|
- //寮曠敤鏍¢獙
|
|
|
|
|
|
|
+ //引用校验
|
|
|
conn = DBSql.open();
|
|
conn = DBSql.open();
|
|
|
conn.setAutoCommit(false);
|
|
conn.setAutoCommit(false);
|
|
|
|
|
|
|
@@ -46,19 +52,19 @@ public class accountController {
|
|
|
bo.set("CLOSED", "1");
|
|
bo.set("CLOSED", "1");
|
|
|
SDK.getBOAPI().update(tableName, bo, conn);
|
|
SDK.getBOAPI().update(tableName, bo, conn);
|
|
|
|
|
|
|
|
- //Contacts鑱旂郴浜� 鍒犻櫎
|
|
|
|
|
|
|
+ //Contacts联系人 删除
|
|
|
List<BO> contacts = SDK.getBOAPI().query("BO_EU_DNCRM_CONTACT").addQuery("ACCOUNT_ID=", id).addQuery("CLOSED=", 0).list();
|
|
List<BO> contacts = SDK.getBOAPI().query("BO_EU_DNCRM_CONTACT").addQuery("ACCOUNT_ID=", id).addQuery("CLOSED=", 0).list();
|
|
|
for (BO contact : contacts) {
|
|
for (BO contact : contacts) {
|
|
|
contact.set("CLOSED", "1");
|
|
contact.set("CLOSED", "1");
|
|
|
SDK.getBOAPI().update("BO_EU_DNCRM_CONTACT", contact, conn);
|
|
SDK.getBOAPI().update("BO_EU_DNCRM_CONTACT", contact, conn);
|
|
|
|
|
|
|
|
- //鍒犻櫎 缁勭粐涓��搴旂殑鐢ㄦ埛
|
|
|
|
|
|
|
+ //删除 组织中对应的用户
|
|
|
String userId = DBSql.getString(conn, "SELECT USERID FROM orguser WHERE ext5=? AND CLOSED=0 ", new Object[]{contact.getId()});
|
|
String userId = DBSql.getString(conn, "SELECT USERID FROM orguser WHERE ext5=? AND CLOSED=0 ", new Object[]{contact.getId()});
|
|
|
if (StringUtils.isNotBlank(userId))
|
|
if (StringUtils.isNotBlank(userId))
|
|
|
- SDK.getORGAPI().disabledUser(userId);//绂佺敤缁勭粐涓�敤鎴�
|
|
|
|
|
|
|
+ SDK.getORGAPI().disabledUser(userId);//禁用组织中用户
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //閰嶇疆椤归€昏緫鍒犻櫎
|
|
|
|
|
|
|
+ //配置项逻辑删除
|
|
|
List<BO> installedProducts = SDK.getBOAPI().query("BO_EU_DNCRM_INSTALLED_PRODUCT").addQuery("ACCOUNT_ID=", id).addQuery("CLOSED=", 0).list();
|
|
List<BO> installedProducts = SDK.getBOAPI().query("BO_EU_DNCRM_INSTALLED_PRODUCT").addQuery("ACCOUNT_ID=", id).addQuery("CLOSED=", 0).list();
|
|
|
for (BO installedProduct : installedProducts) {
|
|
for (BO installedProduct : installedProducts) {
|
|
|
installedProduct.set("CLOSED", "1");
|
|
installedProduct.set("CLOSED", "1");
|
|
@@ -66,7 +72,7 @@ public class accountController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- //瀹㈡埛鍦板潃
|
|
|
|
|
|
|
+ //客户地址
|
|
|
List<BO> address = SDK.getBOAPI().query("BO_EU_DNCRM_LOCATION").addQuery("ACCOUNT_ID=", id).addQuery("CLOSED=", 0).list();
|
|
List<BO> address = SDK.getBOAPI().query("BO_EU_DNCRM_LOCATION").addQuery("ACCOUNT_ID=", id).addQuery("CLOSED=", 0).list();
|
|
|
for (BO addressBO : address) {
|
|
for (BO addressBO : address) {
|
|
|
addressBO.set("CLOSED", "1");
|
|
addressBO.set("CLOSED", "1");
|
|
@@ -90,7 +96,7 @@ public class accountController {
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 鍒犻櫎鑱旂郴浜�
|
|
|
|
|
|
|
+ * 删除联系人
|
|
|
* @param uc
|
|
* @param uc
|
|
|
* @param ids
|
|
* @param ids
|
|
|
* @return
|
|
* @return
|
|
@@ -99,11 +105,11 @@ public class accountController {
|
|
|
@Mapping(value = "com.awspaas.user.apps.donenow_DelContact")
|
|
@Mapping(value = "com.awspaas.user.apps.donenow_DelContact")
|
|
|
public ResponseObject delContact(UserContext uc, String ids) throws SQLException {
|
|
public ResponseObject delContact(UserContext uc, String ids) throws SQLException {
|
|
|
if (StringUtils.isBlank(ids))
|
|
if (StringUtils.isBlank(ids))
|
|
|
- return ResponseObject.newErrResponse("璇烽€夋嫨瑕佸垹闄ょ殑鏁版嵁");
|
|
|
|
|
|
|
+ return ResponseObject.newErrResponse("请选择要删除的数据");
|
|
|
|
|
|
|
|
String tableName = "BO_EU_DNCRM_CONTACT";
|
|
String tableName = "BO_EU_DNCRM_CONTACT";
|
|
|
|
|
|
|
|
- //寮曠敤鏍¢獙
|
|
|
|
|
|
|
+ //引用校验
|
|
|
String result = verifyDel(tableName, ids);
|
|
String result = verifyDel(tableName, ids);
|
|
|
if (result != null)
|
|
if (result != null)
|
|
|
return ResponseObject.newErrResponse(result);
|
|
return ResponseObject.newErrResponse(result);
|
|
@@ -118,43 +124,43 @@ public class accountController {
|
|
|
/*
|
|
/*
|
|
|
if (DBSql.getInt(conn,"SELECT COUNT(*) from BO_EU_DNSDK_TASK where contact_id=? and closed=0",new Object[]{id}) > 0)
|
|
if (DBSql.getInt(conn,"SELECT COUNT(*) from BO_EU_DNSDK_TASK where contact_id=? and closed=0",new Object[]{id}) > 0)
|
|
|
{
|
|
{
|
|
|
- return "璇ヨ仈绯讳汉鏄�叕鍙哥殑澶栧寘鑱旂郴浜猴紙宸ュ崟涓�殑澶栧寘浜哄憳锛�";
|
|
|
|
|
|
|
+ return "该联系人是公司的外包联系人(工单中的外包人员)";
|
|
|
}
|
|
}
|
|
|
*/
|
|
*/
|
|
|
if (DBSql.getInt(conn, "SELECT COUNT(*) from BO_EU_DNSDK_TASK where contact_id=? and closed=0", new Object[]{id}) > 0) {
|
|
if (DBSql.getInt(conn, "SELECT COUNT(*) from BO_EU_DNSDK_TASK where contact_id=? and closed=0", new Object[]{id}) > 0) {
|
|
|
- throw new Exception("璇ヨ仈绯讳汉鏈夊叧鑱旂殑宸ュ崟鎴栦换鍔�");
|
|
|
|
|
|
|
+ throw new Exception("该联系人有关联的工单或任务");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (DBSql.getInt(conn, "SELECT COUNT(*) from BO_EU_DNCOM_ACTIVITY where CREATEUSER=(SELECT USERID FROM orguser WHERE ext5=? AND CLOSED=0 ) and closed=0", new Object[]{id}) > 0) {
|
|
if (DBSql.getInt(conn, "SELECT COUNT(*) from BO_EU_DNCOM_ACTIVITY where CREATEUSER=(SELECT USERID FROM orguser WHERE ext5=? AND CLOSED=0 ) and closed=0", new Object[]{id}) > 0) {
|
|
|
- throw new Exception("璇ヨ仈绯讳汉鍦ㄨ嚜鍔╂湇鍔″彴鍒涘缓杩囧伐鍗曞�娉�");
|
|
|
|
|
|
|
+ throw new Exception("该联系人在自助服务台创建过工单备注");
|
|
|
}
|
|
}
|
|
|
/*
|
|
/*
|
|
|
|
|
|
|
|
if (_dal.FindSignleBySql<int>($"SELECT COUNT(*) from com_attachment where create_user_id={id} and delete_time=0") > 0)
|
|
if (_dal.FindSignleBySql<int>($"SELECT COUNT(*) from com_attachment where create_user_id={id} and delete_time=0") > 0)
|
|
|
{
|
|
{
|
|
|
- return "璇ヨ仈绯讳汉鍦ㄨ嚜鍔╂湇鍔″彴鍒涘缓杩囬檮浠�";
|
|
|
|
|
|
|
+ return "该联系人在自助服务台创建过附件";
|
|
|
}
|
|
}
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
if (DBSql.getInt(conn, "SELECT COUNT(*) from BO_EU_DNCTT_CONTRACT where (contact_id=? OR bill_to_contact_id=?) and closed=0", new Object[]{id, id}) > 0) {
|
|
if (DBSql.getInt(conn, "SELECT COUNT(*) from BO_EU_DNCTT_CONTRACT where (contact_id=? OR bill_to_contact_id=?) and closed=0", new Object[]{id, id}) > 0) {
|
|
|
- throw new Exception("璇ヨ仈绯讳汉鏄��鎴风殑璐﹀崟鑱旂郴浜�");
|
|
|
|
|
|
|
+ throw new Exception("该联系人是客户的账单联系人");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (DBSql.getInt(conn, "SELECT COUNT(*) from BO_EU_DNCRM_ACCOUNT_REFERENCE where email_to_contacts=? and closed=0", new Object[]{id}) > 0) {
|
|
if (DBSql.getInt(conn, "SELECT COUNT(*) from BO_EU_DNCRM_ACCOUNT_REFERENCE where email_to_contacts=? and closed=0", new Object[]{id}) > 0) {
|
|
|
- throw new Exception("璇ヨ仈绯讳汉鏄��鎴风殑鍞�竴鐨勪竴涓�彂绁ㄩ偖浠舵帴鏀朵汉");
|
|
|
|
|
|
|
+ throw new Exception("该联系人是客户的唯一的一个发票邮件接收人");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //Contacts鑱旂郴浜� 鍒犻櫎
|
|
|
|
|
|
|
+ //Contacts联系人 删除
|
|
|
BO contact = SDK.getBOAPI().get("BO_EU_DNCRM_CONTACT", id);
|
|
BO contact = SDK.getBOAPI().get("BO_EU_DNCRM_CONTACT", id);
|
|
|
contact.set("CLOSED", "1");
|
|
contact.set("CLOSED", "1");
|
|
|
SDK.getBOAPI().update("BO_EU_DNCRM_CONTACT", contact, conn);
|
|
SDK.getBOAPI().update("BO_EU_DNCRM_CONTACT", contact, conn);
|
|
|
|
|
|
|
|
- //鍒犻櫎 缁勭粐涓��搴旂殑鐢ㄦ埛
|
|
|
|
|
|
|
+ //删除 组织中对应的用户
|
|
|
String userId = DBSql.getString(conn, "SELECT USERID FROM orguser WHERE ext5=? AND CLOSED=0 ", new Object[]{contact.getId()});
|
|
String userId = DBSql.getString(conn, "SELECT USERID FROM orguser WHERE ext5=? AND CLOSED=0 ", new Object[]{contact.getId()});
|
|
|
if (StringUtils.isNotBlank(userId))
|
|
if (StringUtils.isNotBlank(userId))
|
|
|
- SDK.getORGAPI().disabledUser(userId);//绂佺敤缁勭粐涓�敤鎴�
|
|
|
|
|
|
|
+ SDK.getORGAPI().disabledUser(userId);//禁用组织中用户
|
|
|
|
|
|
|
|
- //閰嶇疆椤归€昏緫鍒犻櫎
|
|
|
|
|
|
|
+ //配置项逻辑删除
|
|
|
List<BO> installedProducts = SDK.getBOAPI().query("BO_EU_DNCRM_INSTALLED_PRODUCT").addQuery("CONTACT_ID=", id).addQuery("CLOSED=", 0).list();
|
|
List<BO> installedProducts = SDK.getBOAPI().query("BO_EU_DNCRM_INSTALLED_PRODUCT").addQuery("CONTACT_ID=", id).addQuery("CLOSED=", 0).list();
|
|
|
for (BO installedProduct : installedProducts) {
|
|
for (BO installedProduct : installedProducts) {
|
|
|
installedProduct.set("CLOSED", "1");
|
|
installedProduct.set("CLOSED", "1");
|
|
@@ -179,7 +185,7 @@ public class accountController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 鍒犻櫎閰嶇疆椤�
|
|
|
|
|
|
|
+ * 删除配置项
|
|
|
* @param uc
|
|
* @param uc
|
|
|
* @param ids
|
|
* @param ids
|
|
|
* @return
|
|
* @return
|
|
@@ -189,11 +195,11 @@ public class accountController {
|
|
|
public ResponseObject delInstallProd(UserContext uc, String ids) throws SQLException {
|
|
public ResponseObject delInstallProd(UserContext uc, String ids) throws SQLException {
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(ids))
|
|
if (StringUtils.isBlank(ids))
|
|
|
- return ResponseObject.newErrResponse("璇烽€夋嫨瑕佸垹闄ょ殑鏁版嵁");
|
|
|
|
|
|
|
+ return ResponseObject.newErrResponse("请选择要删除的数据");
|
|
|
|
|
|
|
|
String tableName = "BO_EU_DNCRM_INSTALLED_PRODUCT";
|
|
String tableName = "BO_EU_DNCRM_INSTALLED_PRODUCT";
|
|
|
|
|
|
|
|
- //寮曠敤鏍¢獙
|
|
|
|
|
|
|
+ //引用校验
|
|
|
String result = verifyDel(tableName, ids);
|
|
String result = verifyDel(tableName, ids);
|
|
|
if (result != null)
|
|
if (result != null)
|
|
|
return ResponseObject.newErrResponse(result);
|
|
return ResponseObject.newErrResponse(result);
|
|
@@ -210,7 +216,7 @@ public class accountController {
|
|
|
installProd.set("CLOSED", "1");
|
|
installProd.set("CLOSED", "1");
|
|
|
SDK.getBOAPI().update(tableName, installProd, conn);
|
|
SDK.getBOAPI().update(tableName, installProd, conn);
|
|
|
|
|
|
|
|
- //鍚堝悓鎴愭湰 淇�敼椤圭洰鎴愭湰
|
|
|
|
|
|
|
+ //合同成本 修改项目成本
|
|
|
String CONTRACT_COST_ID = installProd.getString("CONTRACT_COST_ID");
|
|
String CONTRACT_COST_ID = installProd.getString("CONTRACT_COST_ID");
|
|
|
if (StringUtils.isNotBlank(CONTRACT_COST_ID)) {
|
|
if (StringUtils.isNotBlank(CONTRACT_COST_ID)) {
|
|
|
BO contractCost = SDK.getBOAPI().get("BO_EU_DNCTT_CONTRACT_COST", CONTRACT_COST_ID);
|
|
BO contractCost = SDK.getBOAPI().get("BO_EU_DNCTT_CONTRACT_COST", CONTRACT_COST_ID);
|
|
@@ -238,7 +244,7 @@ public class accountController {
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 鍒犻櫎鍦板潃
|
|
|
|
|
|
|
+ * 删除地址
|
|
|
* @param uc
|
|
* @param uc
|
|
|
* @param ids
|
|
* @param ids
|
|
|
* @return
|
|
* @return
|
|
@@ -248,11 +254,11 @@ public class accountController {
|
|
|
public ResponseObject delLocation(UserContext uc, String ids) throws SQLException {
|
|
public ResponseObject delLocation(UserContext uc, String ids) throws SQLException {
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(ids))
|
|
if (StringUtils.isBlank(ids))
|
|
|
- return ResponseObject.newErrResponse("璇烽€夋嫨瑕佸垹闄ょ殑鏁版嵁");
|
|
|
|
|
|
|
+ return ResponseObject.newErrResponse("请选择要删除的数据");
|
|
|
|
|
|
|
|
String tableName = "BO_EU_DNCRM_LOCATION";
|
|
String tableName = "BO_EU_DNCRM_LOCATION";
|
|
|
|
|
|
|
|
- //寮曠敤鏍¢獙
|
|
|
|
|
|
|
+ //引用校验
|
|
|
String result = verifyDel(tableName, ids);
|
|
String result = verifyDel(tableName, ids);
|
|
|
if (result != null)
|
|
if (result != null)
|
|
|
return ResponseObject.newErrResponse(result);
|
|
return ResponseObject.newErrResponse(result);
|
|
@@ -301,11 +307,123 @@ public class accountController {
|
|
|
for (RowMap rowMap : list) {
|
|
for (RowMap rowMap : list) {
|
|
|
errMsg += rowMap.getString("NAME") + rowMap.getString("NUM") + "\r\n";
|
|
errMsg += rowMap.getString("NAME") + rowMap.getString("NUM") + "\r\n";
|
|
|
}
|
|
}
|
|
|
- return "鍒犻櫎澶辫触锛岃�浠ヤ笅鏁版嵁寮曠敤锛歕r\n" + errMsg;
|
|
|
|
|
|
|
+ return "删除失败,被以下数据引用:\r\n" + errMsg;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Mapping("com.awspaas.user.apps.donenow_crm.querydepartment")
|
|
|
|
|
+ public String findPchSelect(String accountId,UserContext uc) {
|
|
|
|
|
+ RowMap map = DBSql.getMap("SELECT * FROM orgdepartment WHERE EXT1=?", new Object[] {accountId});
|
|
|
|
|
+ if(map==null) {
|
|
|
|
|
+ return fail("请先保存主表数据");
|
|
|
|
|
+ }
|
|
|
|
|
+ return success("保存成功");
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Mapping("com.awspaas.user.apps.donenow_crm.queryhtml")
|
|
|
|
|
+ public String queryhtml(String cateId,String objectId,UserContext uc) {
|
|
|
|
|
+ System.out.println("cateId:"+cateId);
|
|
|
|
|
+ System.out.println("objectId:"+objectId);
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
|
+ map.put("uid", uc.getUID());
|
|
|
|
|
+ map.put("sid", uc.getSessionId());
|
|
|
|
|
+ map.put("cateId", cateId);
|
|
|
|
|
+ map.put("objectId", objectId);
|
|
|
|
|
+
|
|
|
|
|
+ String ORGID = uc.getCompanyModel().getId();
|
|
|
|
|
+ System.out.println("ORGID:"+ORGID);
|
|
|
|
|
+ //查询配置项类型
|
|
|
|
|
+ BO detail = SDK.getBOAPI().query(CrmConstant.BO_EU_DNSYS_UDF_GROUP).detailById(cateId);
|
|
|
|
|
+ if(null==detail) {
|
|
|
|
|
+ return StringUtils.EMPTY;
|
|
|
|
|
+ }
|
|
|
|
|
+ //查询配置项类型自定义字段,比如EXTTEXT5
|
|
|
|
|
+ List<BO> fieldList = SDK.getBOAPI().query(CrmConstant.BO_EU_DNSYS_UDF_GROUP_FIELD).bindId(detail.getBindId()).list();
|
|
|
|
|
+ List<String> list=new ArrayList<String>();
|
|
|
|
|
+ for (BO bo : fieldList) {
|
|
|
|
|
+ list.add("'"+bo.getString("UDF_FIELD_COL_NAME")+"'");
|
|
|
|
|
+ }
|
|
|
|
|
+ //根据配置信息去自定义属性表中查询所有字段信息,返回前端拼接成页面
|
|
|
|
|
+ String fieldSql="SELECT * FROM "+CrmConstant.BO_EU_DNSYS_UDF_FIELD+" WHERE COL_NAME IN ("+org.apache.commons.lang3.StringUtils.join(list, ",")+") AND ORGID=? AND CATE_ID="+CrmConstant.PZXID+" ORDER BY SORT_ORDER";
|
|
|
|
|
+ List<RowMap> udfList = DBSql.getMaps(fieldSql, new Object[] { ORGID });
|
|
|
|
|
+ System.out.println("sql2:"+fieldSql);
|
|
|
|
|
+
|
|
|
|
|
+ map.put("formTitle", "配置项自定义字段");
|
|
|
|
|
+
|
|
|
|
|
+ List<Map<String, Object>> colFields = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ //查询配置表存储数据
|
|
|
|
|
+ BO object=SDK.getBOAPI().query(CrmConstant.BO_EU_DNCRM_INSTALLED_PRODUCT).detailById(objectId);
|
|
|
|
|
+ for (RowMap udf : udfList) {
|
|
|
|
|
+ Map<String, Object> field = new HashMap<>();
|
|
|
|
|
+ String COL_NAME = udf.getString("COL_NAME");
|
|
|
|
|
+
|
|
|
|
|
+ field.put("name", COL_NAME);
|
|
|
|
|
+ if (object != null) {
|
|
|
|
|
+ field.put("value", object.getString(COL_NAME));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ field.put("value", udf.getString("DEFAULT_VALUE"));
|
|
|
|
|
+ }
|
|
|
|
|
+ String DATA_TYPE_ID = udf.getString("DATA_TYPE_ID");
|
|
|
|
|
+
|
|
|
|
|
+ field.put("type", DATA_TYPE_ID);
|
|
|
|
|
+ if (DATA_TYPE_ID.equals("530")) {
|
|
|
|
|
+
|
|
|
|
|
+ String sql = udf.getString("SQL_CONFIG");
|
|
|
|
|
+
|
|
|
|
|
+ if (sql.contains("@")) {
|
|
|
|
|
+ sql = SDK.getRuleAPI().executeAtScript(sql, uc);
|
|
|
|
|
+ }
|
|
|
|
|
+ List<RowMap> list2 = DBSql.getMaps(sql, new Object[0]);
|
|
|
|
|
+
|
|
|
|
|
+ field.put("list", list2);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ field.put("comment", udf.getString("COL_COMMENT"));
|
|
|
|
|
+ field.put("readonly", udf.getString("IS_PROTECTED"));
|
|
|
|
|
+ field.put("required", udf.getString("IS_REQUIRED"));
|
|
|
|
|
+
|
|
|
|
|
+ colFields.add(field);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ map.put("colFields", JSON.toJSONString(colFields));
|
|
|
|
|
+
|
|
|
|
|
+ return HtmlPageTemplate.merge("CONF.html", map);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Mapping("com.awspaas.user.apps.donenow_crm_save")
|
|
|
|
|
+ public ResponseObject udfSave(UserContext userContext, String cateId, String objectId, String data) throws Exception {
|
|
|
|
|
+ System.out.println("cateId=" + cateId + " objectId=" + objectId);
|
|
|
|
|
+ System.out.println(data);
|
|
|
|
|
+ JSONObject json = JSON.parseObject(data);
|
|
|
|
|
+ String set = "";
|
|
|
|
|
+ List<String> values = new ArrayList<>();
|
|
|
|
|
+ for (String key : json.keySet()) {
|
|
|
|
|
+ String value = json.getString(key);
|
|
|
|
|
+ if(StringUtils.isBlank(value))
|
|
|
|
|
+ value="";
|
|
|
|
|
+ if(value.contains("[")&&value.length()>4) {
|
|
|
|
|
+ value=value.substring(2, 3);
|
|
|
|
|
+ }
|
|
|
|
|
+ set = set + key + "=?,";
|
|
|
|
|
+ values.add(value);
|
|
|
|
|
+ }
|
|
|
|
|
+ values.add(objectId);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ String sql = "update " + CrmConstant.BO_EU_DNCRM_INSTALLED_PRODUCT + " set " + set.substring(0, set.length() - 1) + " where id=?";
|
|
|
|
|
+ System.out.println("updateBO_EU_DNCRM_INSTALLED_PRODUCTSql:"+sql);
|
|
|
|
|
+
|
|
|
|
|
+ DBSql.update(sql, values.toArray());
|
|
|
|
|
+
|
|
|
|
|
+ return ResponseObject.newOkResponse("保存成功");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|