Browse Source

Merge branch 'master' of http://10.1.235.20:3000/ipu/android-share

leijie 7 years ago
parent
commit
d3a710c5fe

+ 10 - 4
display-client/assets/display-client/res/js/mobile/expand-mobile.js

127
			},getMemoryCache:function(callback,key,defValue,err){
127
			},getMemoryCache:function(callback,key,defValue,err){
128
				storageCallback("getMemoryCache",callback);
128
				storageCallback("getMemoryCache",callback);
129
				execute("getMemoryCache",[key,defValue],err);
129
				execute("getMemoryCache",[key,defValue],err);
130
			},setOfflineCache:function(key,value,err){
131
				execute("setOfflineCache", [key,value],err);
132
			},getOfflineCache:function(callback,key,defValue,err){
130
			}setOfflineCache:function(key,value,isEncrypt,err){
131
				if(isEncrypt==undefined){
132
					isEncrypt = false;
133
				}
134
				execute("setOfflineCache", [key,value,isEncrypt],err);
135
			},getOfflineCache:function(callback,key,defValue,isEncrypt,err){
136
				if(isEncrypt==undefined){
137
					isEncrypt = false;
138
				}
133
				storageCallback("getOfflineCache",callback);
139
				storageCallback("getOfflineCache",callback);
134
				return execute("getOfflineCache", [key,defValue],err);
140
				return execute("getOfflineCache", [key,defValue,isEncrypt],err);
135
			},removeOfflineCache:function(key,err){
141
			},removeOfflineCache:function(key,err){
136
				execute("removeOfflineCache", [key],err);
142
				execute("removeOfflineCache", [key],err);
137
			},clearOfflineCache:function(err){
143
			},clearOfflineCache:function(err){

+ 4 - 4
display-client/assets/display-client/res/js/mobile/mobile-browser.js

96
			browserTool.browser.clearMemoryCache();
96
			browserTool.browser.clearMemoryCache();
97
		};
97
		};
98
		/******************离线缓存**********************/
98
		/******************离线缓存**********************/
99
		this.setOfflineCache = function(key, value){
100
			browserTool.browser.setOfflineCache(key, value);
99
		this.setOfflineCache = function(key, value,isEncrypt){
100
			browserTool.browser.setOfflineCache(key, value,isEncrypt);
101
		};
101
		};
102
		this.getOfflineCache = function(callback, key, value){
103
			browserTool.browser.getOfflineCache(callback, key, value);
102
		this.getOfflineCache = function(callback, key, value,isEncrypt){
103
			browserTool.browser.getOfflineCache(callback, key, value,isEncrypt);
104
		};
104
		};
105
		this.removeOfflineCache = function(key){
105
		this.removeOfflineCache = function(key){
106
			browserTool.browser.removeOfflineCache(key);
106
			browserTool.browser.removeOfflineCache(key);

+ 5 - 5
display-client/assets/display-client/res/js/mobile/mobile-client.js

96
			WadeMobile.clearMemoryCache();
96
			WadeMobile.clearMemoryCache();
97
		};
97
		};
98
		/******************离线缓存**********************/
98
		/******************离线缓存**********************/
99
		this.setOfflineCache = function(key, value){
99
		this.setOfflineCache = function(key, value,isEncrypt){
100
			if (clientTool.tool.isDataMap(key)) {
100
			if (clientTool.tool.isDataMap(key)) {
101
				WadeMobile.setOfflineCache(key.map);
101
				WadeMobile.setOfflineCache(key.map, value,isEncrypt);
102
			} else {
102
			} else {
103
				WadeMobile.setOfflineCache(key, value);
103
				WadeMobile.setOfflineCache(key, value,isEncrypt);
104
			}
104
			}
105
		};
105
		};
106
		this.getOfflineCache = function(callback, key, value){
107
			WadeMobile.getOfflineCache(callback, key, value);
106
		this.getOfflineCache = function(callback, key, value,isEncrypt){
107
			WadeMobile.getOfflineCache(callback, key, value,isEncrypt);
108
		};
108
		};
109
		this.removeOfflineCache = function(key){
109
		this.removeOfflineCache = function(key){
110
			WadeMobile.removeOfflineCache(key);
110
			WadeMobile.removeOfflineCache(key);

+ 2 - 0
display-client/assets/mobile-action.xml

194
	<!-- 物理按键监听 -->
194
	<!-- 物理按键监听 -->
195
	<action name="setKeyDownFlag" class="com.ai.ipu.mobile.plugin.MobileUI" method="setKeyDownFlag"></action>
195
	<action name="setKeyDownFlag" class="com.ai.ipu.mobile.plugin.MobileUI" method="setKeyDownFlag"></action>
196
	<action name="cleanKeyDownFlag" class="com.ai.ipu.mobile.plugin.MobileUI" method="cleanKeyDownFlag"></action>
196
	<action name="cleanKeyDownFlag" class="com.ai.ipu.mobile.plugin.MobileUI" method="cleanKeyDownFlag"></action>
197
	
198
	<action name="openIPUFromOtherApp" class="com.ai.ipu.func.OpenOtherApp" method="openIPUFromOtherApp"></action>
197
</actions>
199
</actions>

+ 1 - 1
display-client/assets/mobile-config.xml

1
<?xml version="1.0" encoding="utf-8"?>
1
<?xml version="1.0" encoding="utf-8"?>
2
<configs>
2
<configs>
3
    <!-- 请求主机名或请求地址。包括服务器的ip地址和端口 -->
3
    <!-- 请求主机名或请求地址。包括服务器的ip地址和端口 -->
4
	<config name="request_host" value="http://www.aiipu.com"/>
4
	<config name="request_host" value="http://www.aiipu.com:8083"/>
5
	<!-- 必须。10.0.2.2为Android模拟器的保留ip地址。访问到本机电脑时使用 -->
5
	<!-- 必须。10.0.2.2为Android模拟器的保留ip地址。访问到本机电脑时使用 -->
6
	<!-- <config name="request_host" value="http://10.0.2.2:8080"/> -->
6
	<!-- <config name="request_host" value="http://10.0.2.2:8080"/> -->
7
	<!-- 必须。容器应用名或请求根路径 -->
7
	<!-- 必须。容器应用名或请求根路径 -->

+ 45 - 0
display-client/src/com/ai/ipu/func/OpenOtherApp.java

1
package com.ai.ipu.func;
2

3
import org.json.JSONArray;
4
import org.json.JSONException;
5

6
import com.ai.ipu.mobile.frame.IIpuMobile;
7
import com.ai.ipu.mobile.frame.plugin.Plugin;
8

9
import android.content.Intent;
10

11
public class OpenOtherApp extends Plugin {
12

13
	public OpenOtherApp(IIpuMobile ipumobile) {
14
		super(ipumobile);
15
		
16
	}
17
	
18
	public void openIPUFromOtherApp(JSONArray params) {
19
		try {
20
			String pageAction = params.getString(0);
21
			Intent intent = new Intent();
22
			intent.setClassName("com.ai.ipu.display", "com.ai.ipu.display.MainActivity");
23
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
24
			intent.putExtra("PAGE_ACTION", pageAction);
25
			
26
			if(params.length() > 1) {
27
				JSONArray array = params.getJSONArray(1);
28
				String pageParams = array.getString(0);
29
				if (pageParams != null && pageParams.length() > 0) {
30
					intent.putExtra("PAGE_PARAMS", pageParams);
31
				}
32
				
33
				String contextParams = array.getString(1);
34
				if (contextParams != null && contextParams.length() > 0) {
35
					intent.putExtra("PAGE_CONTEXT", contextParams);
36
				}
37
			}
38
			
39
			context.startActivity(intent);
40
		} catch (JSONException e) {
41
			e.printStackTrace();
42
		}
43
	}
44

45
}

+ 15 - 0
display-server/src/main/resources/dev/database.xml

1
<?xml version="1.0" encoding="UTF-8"?>
2

3
<database limit="100000">
4
	<display
5
		type="dbcp"
6
		driver="com.mysql.jdbc.Driver"
7
		url="jdbc:mysql://localhost:3306/display?useUnicode=true"
8
        user="ipu"
9
        passwd="ipumysql"
10
		initialSize="5"
11
		maxActive="20"
12
		maxIdle="5"
13
		maxWait="1000"
14
		/>
15
</database>

display-server/src/main/resources/database.xml → display-server/src/main/resources/pro/database.xml


+ 14 - 0
display-server/src/main/resources/test/database.xml

1
<?xml version="1.0" encoding="UTF-8"?>
2
<database limit="100000">
3
	<display
4
		type="dbcp"
5
		driver="com.mysql.jdbc.Driver"
6
		url="jdbc:mysql://121.42.183.206:3307/display?useUnicode=true"
7
        user="ipu"
8
        passwd="ipumysql"
9
		initialSize="5"
10
		maxActive="20"
11
		maxIdle="5"
12
		maxWait="1000"
13
		/>
14
</database>

+ 3 - 3
display-server/src/main/webapp/res/js/base/jcl.js

720
			return r;
720
			return r;
721
		},
721
		},
722
		parseString:function(str){
722
		parseString:function(str){
723
			str=$.parseJsonString(str);
723
			//str=$.parseJsonString(str);
724
			//console.log("#####this.parseObject");
724
			//console.log("#####this.parseObject");
725
			return window.JSON && window.JSON.parse ? this.parseObject(window.JSON.parse(str)) 
725
			return window.JSON && window.JSON.parse ? this.parseObject(window.JSON.parse(str)) 
726
					: (new Function("this.parseObject(" +str+")")).apply(this);
726
					: (new Function("this.parseObject(" +str+")")).apply(this);
733
				}else if(obj[p] && $.isObject(obj[p])){
733
				}else if(obj[p] && $.isObject(obj[p])){
734
					this.add(p,new $.DataMap(obj[p]));
734
					this.add(p,new $.DataMap(obj[p]));
735
				}else{
735
				}else{
736
					this.add(p,(obj[p]==undefined || obj[p]==null)?"":obj[p]);
736
					this.add(p,(obj[p]==undefined || obj[p]==null)?"":obj[p]+"");
737
				} 
737
				} 
738
			}
738
			}
739
		}
739
		}
811
			return this.length; 
811
			return this.length; 
812
		},	
812
		},	
813
		parseString:function(str){
813
		parseString:function(str){
814
			str=$.parseJsonString(str);
814
			//str=$.parseJsonString(str);
815
			//console.log("#####this.parseArray");
815
			//console.log("#####this.parseArray");
816
			return window.JSON && window.JSON.parse ? this.parseArray(window.JSON.parse(str)) : 
816
			return window.JSON && window.JSON.parse ? this.parseArray(window.JSON.parse(str)) : 
817
				(new Function("this.parseArray(" +str+")")).apply(this);	
817
				(new Function("this.parseArray(" +str+")")).apply(this);	

+ 1 - 1
ipu-mobile-ui/pom.xml

4
	<parent>
4
	<parent>
5
		<groupId>com.ai.ipu.mobile</groupId>
5
		<groupId>com.ai.ipu.mobile</groupId>
6
		<artifactId>ipu-mobile-aggregator</artifactId>
6
		<artifactId>ipu-mobile-aggregator</artifactId>
7
		<version>3.0</version>
7
		<version>3.0-SNAPSHOT</version>
8
	</parent>
8
	</parent>
9
9
10
	<artifactId>ipu-mobile-ui</artifactId>
10
	<artifactId>ipu-mobile-ui</artifactId>

+ 0 - 1
ipu-plugin-basic/.classpath

17
			<attribute name="maven.pomderived" value="true"/>
17
			<attribute name="maven.pomderived" value="true"/>
18
		</attributes>
18
		</attributes>
19
	</classpathentry>
19
	</classpathentry>
20
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
21
	<classpathentry kind="output" path="target/classes"/>
20
	<classpathentry kind="output" path="target/classes"/>
22
</classpath>
21
</classpath>

+ 17 - 2
ipu-plugin-basic/pom.xml

4
	<parent>
4
	<parent>
5
		<groupId>com.ai.ipu.mobile</groupId>
5
		<groupId>com.ai.ipu.mobile</groupId>
6
		<artifactId>ipu-mobile-aggregator</artifactId>
6
		<artifactId>ipu-mobile-aggregator</artifactId>
7
		<version>3.0</version>
7
		<version>3.0-SNAPSHOT</version>
8
	</parent>
8
	</parent>
9
9
10
	<artifactId>ipu-plugin-basic</artifactId>
10
	<artifactId>ipu-plugin-basic</artifactId>
11
	<packaging>jar</packaging>
11
	<packaging>jar</packaging>
12
	
12
	
13
	<repositories>
14
		<repository>
15
			<id>ipu</id>
16
			<name>ipu repository</name>
17
			<url>http://114.215.100.48:9090/nexus/content/groups/public/</url>
18
			<releases>
19
				<enabled>true</enabled>
20
			</releases>
21
			<snapshots>
22
				<enabled>true</enabled>
23
				<updatePolicy>always</updatePolicy>
24
			</snapshots>
25
		</repository>
26
	</repositories>
27
	
13
	<properties>
28
	<properties>
14
		<scan-code>1.0</scan-code>
29
		<scan-code>1.0</scan-code>
15
		<android-lite-http>1.0</android-lite-http>
30
		<android-lite-http>1.0</android-lite-http>
51
		<dependency>
66
		<dependency>
52
			<groupId>com.ai.ipu.mobile</groupId>
67
			<groupId>com.ai.ipu.mobile</groupId>
53
			<artifactId>ipu-plugin-extend</artifactId>
68
			<artifactId>ipu-plugin-extend</artifactId>
54
			<version>${ipu}</version>
69
			<version>3.0</version>
55
		</dependency>
70
		</dependency>
56
	</dependencies>
71
	</dependencies>
57
</project>
72
</project>

+ 38 - 10
ipu-plugin-basic/src/main/java/com/ai/ipu/mobile/plugin/MobileStorage.java

1
package com.ai.ipu.mobile.plugin;
1
package com.ai.ipu.mobile.plugin;
2

2

3
import java.security.Key;
3
import java.util.HashMap;
4
import java.util.HashMap;
4
import java.util.Map;
5
import java.util.Map;
5

6
import org.json.JSONArray;
6
import org.json.JSONArray;
7
import org.json.JSONException;
7
import org.json.JSONException;
8
import org.json.JSONObject;
8
import org.json.JSONObject;
9

10
import com.ai.ipu.basic.string.StringUtil;
9
import com.ai.ipu.basic.string.StringUtil;
11
import com.ai.ipu.mobile.common.MobileCache;
10
import com.ai.ipu.mobile.common.MobileCache;
12
import com.ai.ipu.mobile.data.SharedPrefUtil;
11
import com.ai.ipu.mobile.data.SharedPrefUtil;
13
import com.ai.ipu.mobile.frame.IIpuMobile;
12
import com.ai.ipu.mobile.frame.IIpuMobile;
14
import com.ai.ipu.mobile.frame.plugin.Plugin;
13
import com.ai.ipu.mobile.frame.plugin.Plugin;
14
import com.ai.ipu.mobile.frame.template.TemplateManager;
15
import com.ai.ipu.mobile.util.Constant;
15
import com.ai.ipu.mobile.util.Constant;
16
import com.ailk.common.data.IData;
16
import com.ailk.common.data.IData;
17
import com.ailk.common.data.impl.DataMap;
17
import com.ailk.common.data.impl.DataMap;
139
	public void setOfflineCache(JSONArray param) throws Exception {
139
	public void setOfflineCache(JSONArray param) throws Exception {
140
		String key = param.getString(0);
140
		String key = param.getString(0);
141
		String value = param.getString(1);
141
		String value = param.getString(1);
142
		setOfflineCache(key, value);
142
		Boolean isEncrypt = param.getBoolean(2);
143
		setOfflineCache(key,value,isEncrypt);
143
		callback(value);
144
		callback(value);
144
	}
145
	}
145
	
146
	
146
	/**写入Android本地存储键值对*/
147
	/**写入Android本地存储键值对*/
147
	public void setOfflineCache(String key,String value){
148
	public void setOfflineCache(String key,String value,Boolean isEncrypt)throws Exception {
149
		Key deskey = null;
150
		if(isEncrypt){
151
			deskey = TemplateManager.getResKey();
152
		}
148
		if (key == null || "".equals(key))
153
		if (key == null || "".equals(key))
149
			return;
154
			return;
150
		if (StringUtil.isDataMap(key)) {
155
		if (StringUtil.isDataMap(key)) {
151
			IData data = new DataMap(key);
156
			IData data = new DataMap(key);
152
			SharedPrefUtil.put(Constant.MobileCache.IPU_MOBILE_STORAGE, data);
157
			if(isEncrypt){
158
				SharedPrefUtil.put(Constant.MobileCache.IPU_MOBILE_STORAGE, data,deskey);
159
			}else{
160
				SharedPrefUtil.put(Constant.MobileCache.IPU_MOBILE_STORAGE, data);
161
			}
153
		} else {
162
		} else {
154
			SharedPrefUtil.put(Constant.MobileCache.IPU_MOBILE_STORAGE, key, value);
163
			if(isEncrypt){
164
				SharedPrefUtil.put(Constant.MobileCache.IPU_MOBILE_STORAGE, key, value,deskey);
165
			}else{
166
				SharedPrefUtil.put(Constant.MobileCache.IPU_MOBILE_STORAGE, key, value);
167
			}
155
		}
168
		}
156
	}
169
	}
157
	
170
	
158
	public void getOfflineCache(JSONArray param) throws Exception {
171
	public void getOfflineCache(JSONArray param) throws Exception {
159
		String key = param.getString(0);
172
		String key = param.getString(0);
160
		String defValue = param.getString(1);
173
		String defValue = param.getString(1);
161
		String value = getOfflineCache(key, defValue);
174
		Boolean isEncrypt = param.getBoolean(2);
175
		String value = getOfflineCache(key, defValue,isEncrypt);
162
		callback(value);
176
		callback(value);
163
	}
177
	}
164
	
178
	
165
	/**获取 Android 本地存储键值 */
179
	/**获取 Android 本地存储键值 */
166
	public String getOfflineCache(String key,String defValue) throws JSONException{
180
	public String getOfflineCache(String key,String defValue,Boolean isEncrypt) throws Exception{
181
		Key deskey = null;
182
		if(isEncrypt){
183
			deskey = TemplateManager.getResKey();
184
		}
167
		if (key == null || "".equals(key))
185
		if (key == null || "".equals(key))
168
			return null;
186
			return null;
169
		if (StringUtil.isJSONArray(key)) {
187
		if (StringUtil.isJSONArray(key)) {
170
			JSONArray keys = new JSONArray(key);
188
			JSONArray keys = new JSONArray(key);
171
			JSONObject json =new JSONObject(SharedPrefUtil.get(Constant.MobileCache.IPU_MOBILE_STORAGE, keys));
189
			JSONObject json = null;
190
			if(isEncrypt){
191
				 json =new JSONObject(SharedPrefUtil.get(Constant.MobileCache.IPU_MOBILE_STORAGE, keys,deskey));
192
			}else{
193
				 json =new JSONObject(SharedPrefUtil.get(Constant.MobileCache.IPU_MOBILE_STORAGE, keys));
194
			}
172
			return json.toString();
195
			return json.toString();
173
		} else {
196
		} else {
174
			return SharedPrefUtil.get(Constant.MobileCache.IPU_MOBILE_STORAGE, key, defValue);
197
			if(isEncrypt){
198
				return SharedPrefUtil.get(Constant.MobileCache.IPU_MOBILE_STORAGE, key, defValue,deskey);
199
			}else{
200
				return SharedPrefUtil.get(Constant.MobileCache.IPU_MOBILE_STORAGE, key, defValue);
201
			}
202
			
175
		}
203
		}
176
	}
204
	}
177
	
205
	

+ 41 - 1
ipu-web-libs/pom.xml

11
11
12
	<distributionManagement>
12
	<distributionManagement>
13
		<repository>
13
		<repository>
14
			<id>exus-service-ipu-repository</id>
14
			<id>ipu-exus</id>
15
			<name>nexus service ipu repository</name>
15
			<name>nexus service ipu repository</name>
16
			<url>http://114.215.100.48:9090/nexus/content/repositories/ipu/</url>
16
			<url>http://114.215.100.48:9090/nexus/content/repositories/ipu/</url>
17
		</repository>
17
		</repository>
319
		</pluginManagement>
319
		</pluginManagement>
320
320
321
		<outputDirectory>${basedir}/src/main/webapp/WEB-INF/classes</outputDirectory>
321
		<outputDirectory>${basedir}/src/main/webapp/WEB-INF/classes</outputDirectory>
322
		<resources>
323
			<resource>
324
				<directory>${project.basedir}/src/main/resources</directory>
325
				<!-- 资源根目录排除各环境的配置,防止在生成目录中多余其它目录 -->
326
				<excludes>
327
					<exclude>test/*</exclude>
328
					<exclude>pro/*</exclude>
329
					<exclude>dev/*</exclude>
330
				</excludes>
331
			</resource>
332
			<resource>
333
				<directory>src/main/resources/${profiles.active}</directory>
334
			</resource>
335
		</resources>
322
	</build>
336
	</build>
337
	<profiles>
338
		<profile>
339
			<!-- 本地开发环境 -->
340
			<id>dev</id>
341
			<properties>
342
				<profiles.active>dev</profiles.active>
343
			</properties>
344
			<activation>
345
				<activeByDefault>true</activeByDefault>
346
			</activation>
347
		</profile>
348
		<profile>
349
			<!-- 测试环境 -->
350
			<id>test</id>
351
			<properties>
352
				<profiles.active>test</profiles.active>
353
			</properties>
354
		</profile>
355
		<profile>
356
			<!-- 生产环境 -->
357
			<id>pro</id>
358
			<properties>
359
				<profiles.active>pro</profiles.active>
360
			</properties>
361
		</profile>
362
	</profiles>
323
</project>
363
</project>