|
|
@@ -28,7 +28,7 @@ public class orderclue extends Controller {
|
|
|
* @throws YosException
|
|
|
*/
|
|
|
public ArrayList<Long> getLeaderIds() throws YosException {
|
|
|
- return dbConnect.runSqlQuery("SELECT sat_orderclueid FROM sat_orderclue_auth WHERE isused=1 AND sys_enterpriseid = " + sys_enterpriseid).toArrayList("sat_orderclueid", new ArrayList<>());
|
|
|
+ return dbConnect.runSqlQuery("SELECT sat_orderclueid FROM sat_orderclue_auth WHERE sys_enterpriseid = " + sys_enterpriseid).toArrayList("sat_orderclueid", new ArrayList<>());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -38,7 +38,7 @@ public class orderclue extends Controller {
|
|
|
* @throws YosException
|
|
|
*/
|
|
|
public ArrayList<Long> getSalesIds(Long sys_enterprise_hrid) throws YosException {
|
|
|
- return dbConnect.runSqlQuery("SELECT sat_orderclueid FROM sat_orderclue_auth WHERE isused=1 AND sys_enterpriseid = " + sys_enterpriseid + " and hrid = " + sys_enterprise_hrid).toArrayList("sat_orderclueid", new ArrayList<>());
|
|
|
+ return dbConnect.runSqlQuery("SELECT sat_orderclueid FROM sat_orderclue_auth WHERE sys_enterpriseid = " + sys_enterpriseid + " and hrid = " + sys_enterprise_hrid).toArrayList("sat_orderclueid", new ArrayList<>());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -48,7 +48,7 @@ public class orderclue extends Controller {
|
|
|
* @throws YosException
|
|
|
*/
|
|
|
public ArrayList<Long> getFollowIds() throws YosException {
|
|
|
- return dbConnect.runSqlQuery("SELECT sat_orderclueid FROM sat_orderclue WHERE sat_orderclueid in (SELECT sat_orderclueid FROM sat_orderclue_auth WHERE isused AND sys_enterpriseid = " + sys_enterpriseid + ") AND `status` = '待跟进'").toArrayList("sat_orderclueid", new ArrayList<>());
|
|
|
+ return dbConnect.runSqlQuery("SELECT sat_orderclueid FROM sat_orderclue WHERE sat_orderclueid in (SELECT sat_orderclueid FROM sat_orderclue_auth WHERE sys_enterpriseid = " + sys_enterpriseid + ") AND `status` = '待跟进'").toArrayList("sat_orderclueid", new ArrayList<>());
|
|
|
}
|
|
|
|
|
|
@API(title = "线索池-web-列表", apiversion = R.ID20221101094502.v1.class)
|
|
|
@@ -56,7 +56,7 @@ public class orderclue extends Controller {
|
|
|
boolean isAll = content.getBoolean("isAll");
|
|
|
ArrayList<Long> sat_orderclueids = new ArrayList<>();
|
|
|
if (usertype == 1) {
|
|
|
- sat_orderclueids = SQLFactory.createQuerySQL(this, "sat_orderclue_auth", "sat_orderclueid").setWhere("isused", true).setWhere("sys_enterpriseid", sys_enterpriseid).query().toArrayList("sat_orderclueid", new ArrayList<>());
|
|
|
+ sat_orderclueids = SQLFactory.createQuerySQL(this, "sat_orderclue_auth", "sat_orderclueid").setWhere("sys_enterpriseid", sys_enterpriseid).query().toArrayList("sat_orderclueid", new ArrayList<>());
|
|
|
} else {
|
|
|
if (isleader) {
|
|
|
sat_orderclueids.addAll(getLeaderIds());
|
|
|
@@ -85,7 +85,7 @@ public class orderclue extends Controller {
|
|
|
}
|
|
|
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sat_orderclue", "sat_orderclueid", "name", "phonenumber", "province", "city", "county", "address", "notes", "cluesource", "status").setTableAlias("t1");
|
|
|
- querySQL.addJoinTable(QuerySQL.JOINTYPE.left, "sat_orderclue_auth", "t2", "sat_orderclueid=:sat_orderclueid and isused=1");
|
|
|
+ querySQL.addJoinTable(QuerySQL.JOINTYPE.left, "sat_orderclue_auth", "t2", "sat_orderclueid=:sat_orderclueid ");
|
|
|
querySQL.addJoinTable(QuerySQL.JOINTYPE.left, "sys_enterprise", "t3", "t2.sys_enterpriseid=t3.sys_enterpriseid", "enterprisename");
|
|
|
querySQL.addJoinTable(QuerySQL.JOINTYPE.left, "sys_enterprise_hr", "t4", "t2.hrid=t4.sys_enterprise_hrid", "sys_enterprise_hrid");
|
|
|
querySQL.addQueryFields("leadername", "t4.name");
|
|
|
@@ -225,7 +225,7 @@ public class orderclue extends Controller {
|
|
|
memberHrid = query.get(0).getLong("sys_enterprise_hrid");
|
|
|
}
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sat_orderclue", "sat_orderclueid", "name", "phonenumber", "province", "city", "county", "address", "notes", "cluesource", "status").setTableAlias("t1");
|
|
|
- querySQL.addJoinTable(QuerySQL.JOINTYPE.left, "sat_orderclue_auth", "t2", "sat_orderclueid=:sat_orderclueid and isused=1");
|
|
|
+ querySQL.addJoinTable(QuerySQL.JOINTYPE.left, "sat_orderclue_auth", "t2", "sat_orderclueid=:sat_orderclueid ");
|
|
|
querySQL.addJoinTable(QuerySQL.JOINTYPE.left, "sys_enterprise", "t3", "t3.sys_enterpriseid=t2.sys_enterpriseid", "enterprisename");
|
|
|
querySQL.addJoinTable(QuerySQL.JOINTYPE.left, "sys_enterprise_hr", "t4", "t4.sys_enterprise_hrid=t2.hrid");
|
|
|
querySQL.addQueryFields("createBy", "t1.createby");
|
|
|
@@ -253,7 +253,7 @@ public class orderclue extends Controller {
|
|
|
String changeDate = "";
|
|
|
Row countRow = dbConnect.runSqlQuery(0, " SELECT COUNT(0) count FROM sat_orderclue_auth WHERE sat_orderclueid = " + sat_orderclueid);
|
|
|
if (countRow.getLong("count") > 1) {
|
|
|
- Row changeRow = dbConnect.runSqlQuery(0, " SELECT changeby,changedate FROM sat_orderclue_auth WHERE isused AND sat_orderclueid = " + sat_orderclueid);
|
|
|
+ Row changeRow = dbConnect.runSqlQuery(0, " SELECT changeby,changedate FROM sat_orderclue_auth WHERE sat_orderclueid = " + sat_orderclueid);
|
|
|
changeBy = changeRow.getString("changeby");
|
|
|
changeDate = changeRow.getString("changedate");
|
|
|
}
|
|
|
@@ -262,7 +262,7 @@ public class orderclue extends Controller {
|
|
|
String followDate = "";
|
|
|
//获取跟进id
|
|
|
Long sat_orderclue_authid = 0L;
|
|
|
- Rows authRows = dbConnect.runSqlQuery(" SELECT sat_orderclue_authid FROM sat_orderclue_auth WHERE isused AND sat_orderclueid = " + sat_orderclueid);
|
|
|
+ Rows authRows = dbConnect.runSqlQuery(" SELECT sat_orderclue_authid FROM sat_orderclue_auth WHERE sat_orderclueid = " + sat_orderclueid);
|
|
|
if (authRows.isNotEmpty()) {
|
|
|
sat_orderclue_authid = authRows.get(0).getLong("sat_orderclue_authid");
|
|
|
}
|
|
|
@@ -286,9 +286,7 @@ public class orderclue extends Controller {
|
|
|
Long sat_orderclueid = content.getLong("sat_orderclueid");
|
|
|
QuerySQL ordercluefollowuplogQuery = SQLFactory.createQuerySQL(this, "sat_ordercluefollowuplog", "createby", "createdate", "content", "followupmode", "logtype", "competitor").setTableAlias("t1");
|
|
|
ordercluefollowuplogQuery.addJoinTable(JOINTYPE.inner, "sat_orderclue_auth", "t2", "sat_orderclue_authid=:sat_orderclue_authid");
|
|
|
- if (!isleader) {
|
|
|
- ordercluefollowuplogQuery.setWhere("t2.isused=1");
|
|
|
- }
|
|
|
+
|
|
|
ordercluefollowuplogQuery.setWhere("t1.sat_orderclueid", sat_orderclueid);
|
|
|
ordercluefollowuplogQuery.setOrderBy("t1.createdate");
|
|
|
Rows rows = ordercluefollowuplogQuery.query();
|
|
|
@@ -308,7 +306,7 @@ public class orderclue extends Controller {
|
|
|
String logtype = content.getString("logtype");//记录类型
|
|
|
|
|
|
long sat_orderclue_authid = 0L;
|
|
|
- Rows authRows = dbConnect.runSqlQuery(" SELECT sat_orderclue_authid FROM sat_orderclue_auth WHERE isused=1 AND sat_orderclueid = " + sat_orderclueid);
|
|
|
+ Rows authRows = dbConnect.runSqlQuery(" SELECT sat_orderclue_authid FROM sat_orderclue_auth WHERE sat_orderclueid = " + sat_orderclueid);
|
|
|
if (authRows.isNotEmpty()) {
|
|
|
sat_orderclue_authid = authRows.get(0).getLong("sat_orderclue_authid");
|
|
|
}
|
|
|
@@ -330,32 +328,6 @@ public class orderclue extends Controller {
|
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
|
|
|
|
- @API(title = "线索池-web-线索转移", apiversion = R.ID2026020914470801.v1.class)
|
|
|
- public String changeClue() throws YosException {
|
|
|
- long sys_enterprise_hrid = content.getLong("sys_enterprise_hrid");
|
|
|
- JSONArray sat_orderclueid_array = content.getJSONArray("sat_orderclueid");
|
|
|
- SQLDump sqlDump = new SQLDump();
|
|
|
- for (Object obj : sat_orderclueid_array) {
|
|
|
- String sat_orderclueid = obj.toString();
|
|
|
- Rows rows = dbConnect.runSqlQuery("SELECT * FROM sat_orderclue_auth WHERE sat_orderclueid = " + sat_orderclueid + " AND hrid =" + sys_enterprise_hrid + " AND sys_enterpriseid = " + sys_enterpriseid);
|
|
|
- sqlDump.add("UPDATE sat_orderclue_auth SET isused = 0 where sat_orderclueid = " + sat_orderclueid + " AND sys_enterpriseid = " + sys_enterpriseid);
|
|
|
- if (rows.isEmpty()) {
|
|
|
- sqlDump.add(getAddAuthSql(Long.parseLong(sat_orderclueid), sys_enterprise_hrid));
|
|
|
- } else {
|
|
|
- UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sat_orderclue_auth");
|
|
|
- updateSQL.setValue("isused", 1);
|
|
|
- updateSQL.setWhere("sat_orderclueid", sat_orderclueid);
|
|
|
- updateSQL.setWhere("sys_enterpriseid", sys_enterpriseid);
|
|
|
- updateSQL.setWhere("hrid", sys_enterprise_hrid);
|
|
|
- sqlDump.add(updateSQL);
|
|
|
- }
|
|
|
- }
|
|
|
- sqlDump.commit();
|
|
|
- //发送消息
|
|
|
- sendMsg(sat_orderclueid_array, sys_enterprise_hrid);
|
|
|
- return getSucReturnObject().toString();
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 发送消息:经销商团队人员
|
|
|
*
|