Explorar el Código

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

leijie %!s(int64=7) %!d(string=hace) años
padre
commit
d3a710c5fe

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

@ -127,11 +127,17 @@ define(["require"],function(require) {
127 127
			},getMemoryCache:function(callback,key,defValue,err){
128 128
				storageCallback("getMemoryCache",callback);
129 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 139
				storageCallback("getOfflineCache",callback);
134
				return execute("getOfflineCache", [key,defValue],err);
140
				return execute("getOfflineCache", [key,defValue,isEncrypt],err);
135 141
			},removeOfflineCache:function(key,err){
136 142
				execute("removeOfflineCache", [key],err);
137 143
			},clearOfflineCache:function(err){

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

@ -96,11 +96,11 @@ define(["browserTool","jcl"],function(browserTool,Wade) {
96 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 105
		this.removeOfflineCache = function(key){
106 106
			browserTool.browser.removeOfflineCache(key);

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

@ -96,15 +96,15 @@ define(["wadeMobile","clientTool"],function(WadeMobile,clientTool) {
96 96
			WadeMobile.clearMemoryCache();
97 97
		};
98 98
		/******************离线缓存**********************/
99
		this.setOfflineCache = function(key, value){
99
		this.setOfflineCache = function(key, value,isEncrypt){
100 100
			if (clientTool.tool.isDataMap(key)) {
101
				WadeMobile.setOfflineCache(key.map);
101
				WadeMobile.setOfflineCache(key.map, value,isEncrypt);
102 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 109
		this.removeOfflineCache = function(key){
110 110
			WadeMobile.removeOfflineCache(key);

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

@ -194,4 +194,6 @@
194 194
	<!-- 物理按键监听 -->
195 195
	<action name="setKeyDownFlag" class="com.ai.ipu.mobile.plugin.MobileUI" method="setKeyDownFlag"></action>
196 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 199
</actions>

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

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

@ -0,0 +1,45 @@
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

@ -0,0 +1,15 @@
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

@ -0,0 +1,14 @@
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,7 +720,7 @@ define(["zepto"],function($){
720 720
			return r;
721 721
		},
722 722
		parseString:function(str){
723
			str=$.parseJsonString(str);
723
			//str=$.parseJsonString(str);
724 724
			//console.log("#####this.parseObject");
725 725
			return window.JSON && window.JSON.parse ? this.parseObject(window.JSON.parse(str)) 
726 726
					: (new Function("this.parseObject(" +str+")")).apply(this);
@ -733,7 +733,7 @@ define(["zepto"],function($){
733 733
				}else if(obj[p] && $.isObject(obj[p])){
734 734
					this.add(p,new $.DataMap(obj[p]));
735 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,7 +811,7 @@ define(["zepto"],function($){
811 811
			return this.length; 
812 812
		},	
813 813
		parseString:function(str){
814
			str=$.parseJsonString(str);
814
			//str=$.parseJsonString(str);
815 815
			//console.log("#####this.parseArray");
816 816
			return window.JSON && window.JSON.parse ? this.parseArray(window.JSON.parse(str)) : 
817 817
				(new Function("this.parseArray(" +str+")")).apply(this);	

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

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

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

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

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

@ -4,12 +4,27 @@
4 4
	<parent>
5 5
		<groupId>com.ai.ipu.mobile</groupId>
6 6
		<artifactId>ipu-mobile-aggregator</artifactId>
7
		<version>3.0</version>
7
		<version>3.0-SNAPSHOT</version>
8 8
	</parent>
9 9
10 10
	<artifactId>ipu-plugin-basic</artifactId>
11 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 28
	<properties>
14 29
		<scan-code>1.0</scan-code>
15 30
		<android-lite-http>1.0</android-lite-http>
@ -51,7 +66,7 @@
51 66
		<dependency>
52 67
			<groupId>com.ai.ipu.mobile</groupId>
53 68
			<artifactId>ipu-plugin-extend</artifactId>
54
			<version>${ipu}</version>
69
			<version>3.0</version>
55 70
		</dependency>
56 71
	</dependencies>
57 72
</project>

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

@ -1,17 +1,17 @@
1 1
package com.ai.ipu.mobile.plugin;
2 2

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

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

10 9
import com.ai.ipu.basic.string.StringUtil;
11 10
import com.ai.ipu.mobile.common.MobileCache;
12 11
import com.ai.ipu.mobile.data.SharedPrefUtil;
13 12
import com.ai.ipu.mobile.frame.IIpuMobile;
14 13
import com.ai.ipu.mobile.frame.plugin.Plugin;
14
import com.ai.ipu.mobile.frame.template.TemplateManager;
15 15
import com.ai.ipu.mobile.util.Constant;
16 16
import com.ailk.common.data.IData;
17 17
import com.ailk.common.data.impl.DataMap;
@ -139,39 +139,67 @@ public class MobileStorage extends Plugin{
139 139
	public void setOfflineCache(JSONArray param) throws Exception {
140 140
		String key = param.getString(0);
141 141
		String value = param.getString(1);
142
		setOfflineCache(key, value);
142
		Boolean isEncrypt = param.getBoolean(2);
143
		setOfflineCache(key,value,isEncrypt);
143 144
		callback(value);
144 145
	}
145 146
	
146 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 153
		if (key == null || "".equals(key))
149 154
			return;
150 155
		if (StringUtil.isDataMap(key)) {
151 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 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 171
	public void getOfflineCache(JSONArray param) throws Exception {
159 172
		String key = param.getString(0);
160 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 176
		callback(value);
163 177
	}
164 178
	
165 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 185
		if (key == null || "".equals(key))
168 186
			return null;
169 187
		if (StringUtil.isJSONArray(key)) {
170 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 195
			return json.toString();
173 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,7 +11,7 @@
11 11
12 12
	<distributionManagement>
13 13
		<repository>
14
			<id>exus-service-ipu-repository</id>
14
			<id>ipu-exus</id>
15 15
			<name>nexus service ipu repository</name>
16 16
			<url>http://114.215.100.48:9090/nexus/content/repositories/ipu/</url>
17 17
		</repository>
@ -319,5 +319,45 @@
319 319
		</pluginManagement>
320 320
321 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 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 363
</project>