From 4eec0941212a811ba4400eb628164189c17623d3 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 14 二月 2019 17:42:28 +0800
Subject: [PATCH] 增加第三方订单处理
---
fanli/src/main/java/com/yeshi/fanli/service/impl/config/ConfigServiceImpl.java | 68 +++++++++++++++++++++++++++++++++-
1 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/config/ConfigServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/config/ConfigServiceImpl.java
index a413b42..8174bca 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/config/ConfigServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/config/ConfigServiceImpl.java
@@ -6,10 +6,13 @@
import javax.annotation.Resource;
+import net.sf.json.JSONArray;
+
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.yeshi.utils.entity.ProxyIP;
import com.google.gson.Gson;
import com.yeshi.fanli.dao.config.ConfigDao;
@@ -17,9 +20,8 @@
import com.yeshi.fanli.entity.config.AppHomeFloatImg;
import com.yeshi.fanli.entity.xcx.XCXSettingConfig;
import com.yeshi.fanli.service.inter.config.ConfigService;
+import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
-
-import net.sf.json.JSONArray;
@Service
public class ConfigServiceImpl implements ConfigService {
@@ -32,6 +34,43 @@
return configDao.list("from Config");
}
+ @Override
+ public List<Config> listObjects(String key, int page) {
+ int start = (page - 1) * Constant.PAGE_SIZE;
+ StringBuffer hqlBuf = new StringBuffer("from Config pr where 1=1 ");
+
+ if (key != null && !"".equals(key.trim())) {
+ hqlBuf.append(" and (pr.name like ? )");
+ }
+
+ hqlBuf.append(" order by pr.id desc ");
+ String hql = hqlBuf.toString();
+ if (hql.contains("pr.name")) {
+ return configDao.list(hqlBuf.toString(), start, Constant.PAGE_SIZE, new Serializable[] { "%" + key + "%" });
+ } else {
+ return configDao.list(hqlBuf.toString(), start, Constant.PAGE_SIZE, new Serializable[] {});
+ }
+
+ }
+
+ @Override
+ public int getCount(String key, int page) {
+
+ StringBuffer hqlBuf = new StringBuffer("select count(*) from Config pr where 1=1 ");
+
+ if (key != null && !"".equals(key.trim())) {
+ hqlBuf.append(" and (pr.name like ? )");
+ }
+
+ String hql = hqlBuf.toString();
+
+ if (hql.contains("pr.name")) {
+ return (int) configDao.getCount(hqlBuf.toString(), new Serializable[] { "%" + key + "%" });
+ } else {
+ return (int) configDao.getCount(hqlBuf.toString(), new Serializable[] {});
+ }
+ }
+
@CacheEvict(value = "config", allEntries = true)
@Transactional
public void update(List<Config> list) {
@@ -41,6 +80,7 @@
}
}
+ @CacheEvict(value = "config", allEntries = true)
public void update(Config config) {
config.setCreatetime(new Date().getTime() + "");
configDao.update(config);
@@ -102,6 +142,8 @@
@Override
public String getH5Host() {
String value = get("h5_url");
+ String[] sts = value.split(",");
+ value = sts[(int) (sts.length * Math.random())];
return value.trim();
}
@@ -147,4 +189,26 @@
return value;
}
+ @Override
+ public Config getConfig(long id) {
+ return configDao.find(Config.class, id);
+ }
+
+ @Override
+ public ProxyIP getTaoBaoProxyIP() {
+ String value = get("taobao_proxy_ip");
+ try {
+ String[] sts = value.split(":");
+ return new ProxyIP(sts[0], Integer.parseInt(sts[1]));
+ } catch (Exception e) {
+ }
+ return null;
+ }
+
+ @Override
+ public String getAppHomeFloatNotifyImg() {
+
+ return get("home_float_notify_img");
+ }
+
}
--
Gitblit v1.8.0