|
|
@@ -1,5 +1,6 @@
|
|
|
package common.crm.bean.core;
|
|
|
|
|
|
+import beans.parameter.Parameter;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import common.BaseClass;
|
|
|
import common.YosException;
|
|
|
@@ -35,14 +36,28 @@ public abstract class CrmBase extends BaseClass {
|
|
|
private static long sessionExpiresTime = 0L;
|
|
|
public static int fbrandId = 1;
|
|
|
|
|
|
- public static String baseurl = "http://192.168.3.16:8082/dmsService";
|
|
|
- public static String clienturl = "http://192.168.3.16:8081/yos/";
|
|
|
+ public static String baseurl = "";
|
|
|
+ public static String clienturl = "";
|
|
|
public static String cookie = "";
|
|
|
public Logger logger;
|
|
|
|
|
|
public CrmBase(Logger logger) {
|
|
|
super();
|
|
|
this.logger = logger;
|
|
|
+ try {
|
|
|
+ baseurl = Parameter.getString("crm_base_url");
|
|
|
+ clienturl = Parameter.getString("crm_client_url");
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean crm_sync_switch() {
|
|
|
+ try {
|
|
|
+ return Parameter.getBoolean("crm_sync_switch");
|
|
|
+ } catch (Exception e) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void login() throws YosException {
|
|
|
@@ -153,11 +168,13 @@ public abstract class CrmBase extends BaseClass {
|
|
|
//获取crm待同步数据
|
|
|
public ArrayList<crm_datasync> get(String title, String ownertable, int count) throws YosException {
|
|
|
ArrayList<crm_datasync> list = new ArrayList<>();
|
|
|
- Rows rows = dbConnect.runSqlQuery("select max(id) id,ownerid from crm_datasync where ownertable='" + ownertable + "' and status=0 and count<10 group by ownerid limit " + count);
|
|
|
- for (Row row : rows) {
|
|
|
- list.add(new crm_datasync(title, row.getLong("id"), ownertable, row.getLong("ownerid")));
|
|
|
+ if (crm_sync_switch()) {
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select max(id) id,ownerid from crm_datasync where ownertable='" + ownertable + "' and status=0 and count<10 group by ownerid limit " + count);
|
|
|
+ for (Row row : rows) {
|
|
|
+ list.add(new crm_datasync(title, row.getLong("id"), ownertable, row.getLong("ownerid")));
|
|
|
+ }
|
|
|
+ logger.info("监测到有【" + list.size() + "】个【" + title + "】 待同步至CRM");
|
|
|
}
|
|
|
- logger.info("监测到有【" + list.size() + "】个【" + title + "】 待同步至CRM");
|
|
|
return list;
|
|
|
}
|
|
|
|