Showing
1000 changed files
with
4777 additions
and
0 deletions
Too many changes to show.
To preserve performance only 1000 of 1000+ files are displayed.
crm/crm-base/pom.xml
0 → 100644
1 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
2 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
3 | + <modelVersion>4.0.0</modelVersion> | ||
4 | + <parent> | ||
5 | + <groupId>cn.runsa</groupId> | ||
6 | + <artifactId>crmapp</artifactId> | ||
7 | + <version>1.0.1-SNAPSHOT</version> | ||
8 | + <relativePath>../crmapp/pom.xml</relativePath> | ||
9 | + </parent> | ||
10 | + <artifactId>crm-base</artifactId> | ||
11 | + <packaging>jar</packaging> | ||
12 | + <name>crm-base</name> | ||
13 | + | ||
14 | + | ||
15 | + <properties> | ||
16 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
17 | + </properties> | ||
18 | + | ||
19 | + <dependencies> | ||
20 | + | ||
21 | + <dependency> | ||
22 | + <groupId>org.springframework</groupId> | ||
23 | + <artifactId>spring-web</artifactId> | ||
24 | + <version>${spring_version}</version> | ||
25 | + </dependency> | ||
26 | + <dependency> | ||
27 | + <groupId>javax.servlet</groupId> | ||
28 | + <artifactId>javax.servlet-api</artifactId> | ||
29 | + <version>3.0.1</version> | ||
30 | + <scope>provided</scope> | ||
31 | + </dependency> | ||
32 | + | ||
33 | + <!-- mybatis --> | ||
34 | + <dependency> | ||
35 | + <groupId>org.mybatis</groupId> | ||
36 | + <artifactId>mybatis</artifactId> | ||
37 | + <version>${mybatis_version}</version> | ||
38 | + </dependency> | ||
39 | + | ||
40 | + <!-- aspect java --> | ||
41 | + <dependency> | ||
42 | + <groupId>org.aspectj</groupId> | ||
43 | + <artifactId>aspectjrt</artifactId> | ||
44 | + <version>${aspectj_version}</version> | ||
45 | + </dependency> | ||
46 | + <dependency> | ||
47 | + <groupId>org.aspectj</groupId> | ||
48 | + <artifactId>aspectjweaver</artifactId> | ||
49 | + <version>${aspectj_version}</version> | ||
50 | + </dependency> | ||
51 | + <dependency> | ||
52 | + <groupId>org.springframework</groupId> | ||
53 | + <artifactId>spring-aspects</artifactId> | ||
54 | + <version>${spring_version}</version> | ||
55 | + </dependency> | ||
56 | + | ||
57 | + <!-- java code generation --> | ||
58 | + <dependency> | ||
59 | + <groupId>cglib</groupId> | ||
60 | + <artifactId>cglib-nodep</artifactId> | ||
61 | + <version>3.1</version> | ||
62 | + </dependency> | ||
63 | + <dependency> | ||
64 | + <groupId>org.ow2.asm</groupId> | ||
65 | + <artifactId>asm</artifactId> | ||
66 | + <version>5.0.2</version> | ||
67 | + </dependency> | ||
68 | + | ||
69 | + | ||
70 | + <!-- json --> | ||
71 | + <dependency><!-- databind 编译依赖annotations,core --> | ||
72 | + <groupId>com.fasterxml.jackson.core</groupId> | ||
73 | + <artifactId>jackson-databind</artifactId> | ||
74 | + <version>${jackson_xml_version}</version> | ||
75 | + <exclusions> | ||
76 | + <exclusion> | ||
77 | + <groupId>com.fasterxml.jackson.core</groupId> | ||
78 | + <artifactId>jackson-annotations</artifactId> | ||
79 | + </exclusion> | ||
80 | + </exclusions> | ||
81 | + </dependency> | ||
82 | + <dependency><!-- databind 编译依赖annotations,core --> | ||
83 | + <groupId>com.fasterxml.jackson.core</groupId> | ||
84 | + <artifactId>jackson-annotations</artifactId> | ||
85 | + <version>${jackson_xml_version}</version> | ||
86 | + </dependency> | ||
87 | + <dependency><!-- mapper-asl 编译依赖 core-asl 不需要再次引用 --> | ||
88 | + <groupId>org.codehaus.jackson</groupId> | ||
89 | + <artifactId>jackson-mapper-asl</artifactId> | ||
90 | + <version>${jackson_version}</version> | ||
91 | + </dependency> | ||
92 | + | ||
93 | + <!-- redis --> | ||
94 | + <dependency> | ||
95 | + <groupId>redis.clients</groupId> | ||
96 | + <artifactId>jedis</artifactId> | ||
97 | + <version>2.6.0</version> | ||
98 | + </dependency> | ||
99 | + <dependency> | ||
100 | + <groupId>org.springframework.data</groupId> | ||
101 | + <artifactId>spring-data-redis</artifactId> | ||
102 | + <version>1.6.2.RELEASE</version> | ||
103 | + </dependency> | ||
104 | + | ||
105 | + <!-- java excel --> | ||
106 | + <dependency> | ||
107 | + <groupId>org.apache.poi</groupId> | ||
108 | + <artifactId>poi</artifactId> | ||
109 | + <version>${poi_version}</version> | ||
110 | + </dependency> | ||
111 | + <dependency> | ||
112 | + <groupId>org.apache.poi</groupId> | ||
113 | + <artifactId>poi-ooxml</artifactId> | ||
114 | + <version>${poi_version}</version> | ||
115 | + </dependency> | ||
116 | + <dependency> | ||
117 | + <groupId>xml-apis</groupId> | ||
118 | + <artifactId>xml-apis</artifactId> | ||
119 | + <version>1.4.01</version> | ||
120 | + </dependency> | ||
121 | + <dependency> | ||
122 | + <groupId>xerces</groupId> | ||
123 | + <artifactId>xercesImpl</artifactId> | ||
124 | + <version>2.11.0</version> | ||
125 | + </dependency> | ||
126 | + | ||
127 | + <!-- httpClient --> | ||
128 | + <dependency> | ||
129 | + <groupId>org.apache.httpcomponents</groupId> | ||
130 | + <artifactId>httpclient</artifactId> | ||
131 | + <version>${httpClient_version}</version> | ||
132 | + </dependency> | ||
133 | + <dependency> | ||
134 | + <groupId>org.apache.httpcomponents</groupId> | ||
135 | + <artifactId>httpmime</artifactId> | ||
136 | + <version>${httpClient_version}</version> | ||
137 | + </dependency> | ||
138 | + | ||
139 | + <dependency> | ||
140 | + <groupId>commons-configuration</groupId> | ||
141 | + <artifactId>commons-configuration</artifactId> | ||
142 | + <version>${commons_configuration_version}</version> | ||
143 | + </dependency> | ||
144 | + | ||
145 | + <!-- http async --> | ||
146 | + <dependency> | ||
147 | + <groupId>org.apache.httpcomponents</groupId> | ||
148 | + <artifactId>httpasyncclient</artifactId> | ||
149 | + <version>4.1</version> | ||
150 | + </dependency> | ||
151 | + | ||
152 | + <!-- java mail --> | ||
153 | + <dependency> | ||
154 | + <groupId>com.sun.mail</groupId> | ||
155 | + <artifactId>mailapi</artifactId> | ||
156 | + <version>1.5.2</version> | ||
157 | + </dependency> | ||
158 | + <dependency> | ||
159 | + <groupId>com.sun.mail</groupId> | ||
160 | + <artifactId>smtp</artifactId> | ||
161 | + <version>1.5.2</version> | ||
162 | + </dependency> | ||
163 | + | ||
164 | + <!-- java date time --> | ||
165 | + <dependency> | ||
166 | + <groupId>joda-time</groupId> | ||
167 | + <artifactId>joda-time</artifactId> | ||
168 | + <version>2.5</version> | ||
169 | + </dependency> | ||
170 | + | ||
171 | + <!-- commons --> | ||
172 | + <dependency> | ||
173 | + <groupId>commons-codec</groupId> | ||
174 | + <artifactId>commons-codec</artifactId> | ||
175 | + <version>1.9</version> | ||
176 | + </dependency> | ||
177 | + <dependency> | ||
178 | + <groupId>commons-io</groupId> | ||
179 | + <artifactId>commons-io</artifactId> | ||
180 | + <version>2.4</version> | ||
181 | + </dependency> | ||
182 | + <dependency> | ||
183 | + <groupId>commons-fileupload</groupId> | ||
184 | + <artifactId>commons-fileupload</artifactId> | ||
185 | + <version>1.3.1</version> | ||
186 | + </dependency> | ||
187 | + <dependency> | ||
188 | + <groupId>org.apache.commons</groupId> | ||
189 | + <artifactId>commons-lang3</artifactId> | ||
190 | + <version>3.1</version> | ||
191 | + </dependency> | ||
192 | + <dependency> | ||
193 | + <groupId>commons-beanutils</groupId> | ||
194 | + <artifactId>commons-beanutils</artifactId> | ||
195 | + <version>1.9.2</version> | ||
196 | + </dependency> | ||
197 | + <dependency> | ||
198 | + <groupId>org.apache.commons</groupId> | ||
199 | + <artifactId>commons-pool2</artifactId> | ||
200 | + <version>2.2</version> | ||
201 | + </dependency> | ||
202 | + <dependency> | ||
203 | + <groupId>org.apache.commons</groupId> | ||
204 | + <artifactId>commons-collections4</artifactId> | ||
205 | + <version>4.0</version> | ||
206 | + </dependency> | ||
207 | + <dependency> | ||
208 | + <groupId>commons-collections</groupId> | ||
209 | + <artifactId>commons-collections</artifactId> | ||
210 | + <version>3.2.1</version> | ||
211 | + </dependency> | ||
212 | + <dependency> | ||
213 | + <groupId>commons-net</groupId> | ||
214 | + <artifactId>commons-net</artifactId> | ||
215 | + <version>3.3</version> | ||
216 | + </dependency> | ||
217 | + | ||
218 | + <!-- google guava --> | ||
219 | + <dependency> | ||
220 | + <groupId>com.google.guava</groupId> | ||
221 | + <artifactId>guava</artifactId> | ||
222 | + <version>19.0</version> | ||
223 | + </dependency> | ||
224 | + | ||
225 | + <!-- quartz --> | ||
226 | + <dependency> | ||
227 | + <groupId>org.quartz-scheduler</groupId> | ||
228 | + <artifactId>quartz</artifactId> | ||
229 | + <version>${quartz_version}</version> | ||
230 | + </dependency> | ||
231 | + <dependency> | ||
232 | + <groupId>org.quartz-scheduler</groupId> | ||
233 | + <artifactId>quartz-jobs</artifactId> | ||
234 | + <version>${quartz_version}</version> | ||
235 | + </dependency> | ||
236 | + | ||
237 | + <dependency> | ||
238 | + <groupId>de.alpharogroup</groupId> | ||
239 | + <artifactId>jgeohash</artifactId> | ||
240 | + <version>1.4.7</version> | ||
241 | + </dependency> | ||
242 | + | ||
243 | + <!-- qiniu picture --> | ||
244 | + <dependency> | ||
245 | + <groupId>com.qiniu</groupId> | ||
246 | + <artifactId>qiniu-java-sdk</artifactId> | ||
247 | + <version>7.0.7</version> | ||
248 | + </dependency> | ||
249 | + | ||
250 | + <dependency> | ||
251 | + <groupId>com.aliyun.mns</groupId> | ||
252 | + <artifactId>aliyun-sdk-mns</artifactId> | ||
253 | + <version>1.1.1</version> | ||
254 | + </dependency> | ||
255 | + | ||
256 | + <dependency> | ||
257 | + <groupId>org.springframework.amqp</groupId> | ||
258 | + <artifactId>spring-amqp</artifactId> | ||
259 | + <version>1.5.4.RELEASE</version> | ||
260 | + </dependency> | ||
261 | + <dependency> | ||
262 | + <groupId>org.codehaus.groovy</groupId> | ||
263 | + <artifactId>groovy</artifactId> | ||
264 | + <version>2.4.6</version> | ||
265 | + </dependency> | ||
266 | + <dependency> | ||
267 | + <groupId>org.hibernate</groupId> | ||
268 | + <artifactId>hibernate-validator</artifactId> | ||
269 | + <version>5.2.4.Final</version> | ||
270 | + </dependency> | ||
271 | + <dependency> | ||
272 | + <groupId>com.thoughtworks.xstream</groupId> | ||
273 | + <artifactId>xstream</artifactId> | ||
274 | + <version>1.4.9</version> | ||
275 | + </dependency> | ||
276 | + <dependency> | ||
277 | + <groupId>com.alibaba</groupId> | ||
278 | + <artifactId>fastjson</artifactId> | ||
279 | + <version>${fastjson_version}</version> | ||
280 | + </dependency> | ||
281 | + | ||
282 | + <dependency> | ||
283 | + <groupId>net.sf.ehcache</groupId> | ||
284 | + <artifactId>ehcache-core</artifactId> | ||
285 | + <version>${ehcache_core_version}</version> | ||
286 | + </dependency> | ||
287 | + </dependencies> | ||
288 | +</project> |
1 | +package cn.runsa.crmapp.base; | ||
2 | + | ||
3 | +import java.util.Date; | ||
4 | + | ||
5 | +import org.joda.time.DateTime; | ||
6 | +import org.joda.time.DateTimeZone; | ||
7 | + | ||
8 | +/** | ||
9 | + * 系统常量 | ||
10 | + * | ||
11 | + * @author Stephen | ||
12 | + * | ||
13 | + */ | ||
14 | +public class Constants { | ||
15 | + /** | ||
16 | + * rest webservice 提供的页面地址 | ||
17 | + */ | ||
18 | + public static final String CONSTANTS_SERVER_WEB_URL = "SERVER_URL"; | ||
19 | + /** | ||
20 | + * rest webservice 提供页面的超时时间 | ||
21 | + */ | ||
22 | + public static final int CONSTANTS_API_PAGE_REGISTER_TIMEOUT = 30*60; | ||
23 | + /** | ||
24 | + * rest webservice 提供页面的业务:会员入会 | ||
25 | + */ | ||
26 | + public static final String CONSTANTS_API_PAGE_SCOPE_REGISTER = "REGISTER"; | ||
27 | + | ||
28 | + public static final String CONSTANTS_CLASS_IMPL_PROFILE = "class.impl.profile"; | ||
29 | + | ||
30 | + public static final String CONSTANTS_CLASS_IMPL_SYSTEM = "system"; | ||
31 | + | ||
32 | + public static final String CONSTANTS_SERVER_CONFIG_PATH = "server_config"; | ||
33 | + | ||
34 | + | ||
35 | + /** | ||
36 | + * 系统默认字符集 | ||
37 | + */ | ||
38 | + public static final String CONSTANTS_DEFAULT_CHARSET = "UTF-8"; | ||
39 | + | ||
40 | + public static final String CONSTANTS_DEFAULT_SQL_DELIMITER = "#@#!#"; | ||
41 | + | ||
42 | + | ||
43 | + /** | ||
44 | + * 内容服务的类型:url | ||
45 | + */ | ||
46 | + public static final Byte CONSTANTS_CONTENT_URL = 0; | ||
47 | + | ||
48 | + | ||
49 | + /** | ||
50 | + * 东八区:中国 | ||
51 | + */ | ||
52 | + public static final int CONSTANTS_CHINA_OFFSET_UTC = 8; | ||
53 | + /** | ||
54 | + * 一天的秒 | ||
55 | + */ | ||
56 | + public static final int CONSTANTS_MILLS_OF_DAYS = 24 * 60 * 60 * 1000; | ||
57 | + | ||
58 | + | ||
59 | + /** | ||
60 | + * 操作失败(响应到前端) | ||
61 | + */ | ||
62 | + public static final String RES_EXEC_FAILURE = "cn.runsa.failure"; | ||
63 | + | ||
64 | + | ||
65 | + /** | ||
66 | + * 阳历 | ||
67 | + */ | ||
68 | + public static final int CALENDAR_GREGORIAN = 0; | ||
69 | + /** | ||
70 | + * 阴历 | ||
71 | + */ | ||
72 | + public static final int CALENDAR_LUNAR = 1; | ||
73 | + | ||
74 | + | ||
75 | + /** | ||
76 | + * 未婚 | ||
77 | + */ | ||
78 | + public static final int MARRIAGE_NO = 0; | ||
79 | + /** | ||
80 | + * 已婚 | ||
81 | + */ | ||
82 | + public static final int MARRIAGE_YES = 1; | ||
83 | + /** | ||
84 | + * 婚姻保密 | ||
85 | + */ | ||
86 | + public static final int MARRIAGE_UNKNOWN = 2; | ||
87 | + | ||
88 | + | ||
89 | + /** | ||
90 | + * 女 | ||
91 | + */ | ||
92 | + public static final int SEX_FEMALE = 0; | ||
93 | + /** | ||
94 | + * 男 | ||
95 | + */ | ||
96 | + public static final int SEX_MALE = 1; | ||
97 | + /** | ||
98 | + * 性别保密 | ||
99 | + */ | ||
100 | + public static final int SEX_UNKNOWN = 2; | ||
101 | + | ||
102 | + | ||
103 | + /** | ||
104 | + * 永久 | ||
105 | + */ | ||
106 | + public static Date DATE_FOR_EVER = new DateTime(2099, 12, 31, 23, 59, 59,DateTimeZone.forOffsetHours(CONSTANTS_CHINA_OFFSET_UTC)).toDate(); | ||
107 | + | ||
108 | + | ||
109 | + /** | ||
110 | + * 业务处理需要分页的默认值 | ||
111 | + */ | ||
112 | + public static final int CONSTANTS_BUSINESS_DEFAULT_PAGE_SIZE = 100; | ||
113 | + | ||
114 | + | ||
115 | + /** | ||
116 | + * 顾客未验证 | ||
117 | + */ | ||
118 | + public static final byte CONSTANTS_CUSTOMER_VERIFY_NOT = 0; | ||
119 | + | ||
120 | + | ||
121 | + /** | ||
122 | + * 非会员 | ||
123 | + */ | ||
124 | + public static final Byte CONSTANTS_CUSTOMER_NOT_MEMBER = (byte)0; | ||
125 | + /** | ||
126 | + * 会员 | ||
127 | + */ | ||
128 | + public static final Byte CONSTANTS_CUSTOMER_MEMBER = (byte)1; | ||
129 | + | ||
130 | + | ||
131 | + /** | ||
132 | + * 顾客来源渠道:线下 | ||
133 | + */ | ||
134 | + public static final String CONSTANTS_CUSTOMER_CHANNEL_OFFLINE = "OFFLINE"; | ||
135 | + /** | ||
136 | + * 顾客来源渠道:微信 | ||
137 | + */ | ||
138 | + public static final String CONSTANTS_CUSTOMER_CHANNEL_WEIXIN = "WEIXIN"; | ||
139 | + | ||
140 | + | ||
141 | + /** | ||
142 | + * 顾客来源:门店 | ||
143 | + */ | ||
144 | + public static final String CONSTANTS_CUSTOMER_SOURCE_SITE = "SIT"; | ||
145 | + /** | ||
146 | + * 顾客来源:推荐顾客 | ||
147 | + */ | ||
148 | + public static final String CONSTANTS_CUSTOMER_SOURCE_CUSTOMER = "CST"; | ||
149 | + /** | ||
150 | + * 顾客来源:推荐雇员 | ||
151 | + */ | ||
152 | + public static final String CONSTANTS_CUSTOMER_SOURCE_EMPLOYEE = "EMP"; | ||
153 | + /** | ||
154 | + * 顾客来源:优惠券 | ||
155 | + */ | ||
156 | + public static final String CONSTANTS_CUSTOMER_SOURCE_COUPON = "CPN"; | ||
157 | + /** | ||
158 | + * 顾客来源:搜索公众号 | ||
159 | + */ | ||
160 | + public static final String CONSTANTS_CUSTOMER_SOURCE_WEIXINGZH = "GZH"; | ||
161 | + /** | ||
162 | + * 顾客来源:物流单 | ||
163 | + */ | ||
164 | + public static final String CONSTANTS_CUSTOMER_SOURCE_EXPRESS = "EXP"; | ||
165 | + /** | ||
166 | + * 顾客来源:商品 | ||
167 | + */ | ||
168 | + public static final String CONSTANTS_CUSTOMER_SOURCE_GOODS = "GDS"; | ||
169 | + /** | ||
170 | + * 顾客来源:活动 | ||
171 | + */ | ||
172 | + public static final String CONSTANTS_CUSTOMER_SOURCE_ACTIVITY = "ACT"; | ||
173 | + /** | ||
174 | + * 顾客来源:订单 | ||
175 | + */ | ||
176 | + public static final String CONSTANTS_CUSTOMER_SOURCE_ORDER= "ODR"; | ||
177 | + /** | ||
178 | + * 顾客来源:APP | ||
179 | + */ | ||
180 | + public static final String CONSTANTS_CUSTOMER_SOURCE_APP = "APP"; | ||
181 | + | ||
182 | + | ||
183 | + /** | ||
184 | + * 优惠券来源:内部券 | ||
185 | + */ | ||
186 | + public static final int CONSTANTS_COUPONS_COME_FROM_INNER = 0; | ||
187 | + /** | ||
188 | + * 优惠券来源:外部券 | ||
189 | + */ | ||
190 | + public static final int CONSTANTS_COUPONS_COME_FROM_OUTER = 1; | ||
191 | + | ||
192 | + | ||
193 | + /** | ||
194 | + * 优惠券类型:折扣券 | ||
195 | + */ | ||
196 | + public static final int CONSTANTS_COUPONS_TYPE_DISCOUNT = 0; | ||
197 | + /** | ||
198 | + * 优惠券类型:金额券 | ||
199 | + */ | ||
200 | + public static final int CONSTANTS_COUPONS_TYPE_MONEY = 1; | ||
201 | + /** | ||
202 | + * 优惠券类型:礼品券 | ||
203 | + */ | ||
204 | + public static final int CONSTANTS_COUPONS_TYPE_GIFT = 2; | ||
205 | + /** | ||
206 | + * 优惠券类型:定价券 | ||
207 | + */ | ||
208 | + public static final int CONSTANTS_COUPONS_TYPE_PRICE = 3; | ||
209 | + /** | ||
210 | + * 优惠券类型:包邮券 | ||
211 | + */ | ||
212 | + public static final int CONSTANTS_COUPONS_TYPE_FREESHIPPING = 4; | ||
213 | + | ||
214 | + | ||
215 | + /** | ||
216 | + * 优惠券的生成方式:自动 | ||
217 | + */ | ||
218 | + public static final int CONSTANTS_COUPONS_GENERATE_AUTO = 0; | ||
219 | + /** | ||
220 | + * 优惠券的生成方式:导入 | ||
221 | + */ | ||
222 | + public static final int CONSTANTS_COUPONS_GENERATE_IMPORT = 1; | ||
223 | + /** | ||
224 | + * 优惠券的生成方式:接口接入 | ||
225 | + */ | ||
226 | + public static final int CONSTANTS_COUPONS_GENERATE_INTERFACE = 2; | ||
227 | + | ||
228 | + | ||
229 | + /** | ||
230 | + * 手机 | ||
231 | + */ | ||
232 | + public static final String CONSTANTS_CHANNEL_PHONE = "phone"; | ||
233 | + /** | ||
234 | + * 邮箱 | ||
235 | + */ | ||
236 | + public static final String CONSTANTS_CHANNEL_EMAIL = "email"; | ||
237 | + | ||
238 | + | ||
239 | + /** | ||
240 | + * 联盟级 | ||
241 | + */ | ||
242 | + public static final String CONSTANTS_CUSTOMER_RANK_DEFAULT = "LMJ"; | ||
243 | + | ||
244 | + | ||
245 | + /** | ||
246 | + * 等级改变:升级 | ||
247 | + */ | ||
248 | + public static final boolean CONSTANTS_RANK_CHANGE_UPGRADE = true; | ||
249 | + /** | ||
250 | + * 等级改变:降级 | ||
251 | + */ | ||
252 | + public static final boolean CONSTANTS_RANK_CHANGE_DEGRADE = false; | ||
253 | + | ||
254 | + | ||
255 | + /** | ||
256 | + * 订单回执业务:积分 | ||
257 | + */ | ||
258 | + public static final String CONSTANTS_ORDER_SERVICE_POINTS = "POINTS"; | ||
259 | + /** | ||
260 | + * 订单回执业务:优惠券 | ||
261 | + */ | ||
262 | + public static final String CONSTANTS_ORDER_SERVICE_COUPONS = "COUPON"; | ||
263 | + | ||
264 | + | ||
265 | + | ||
266 | + public static final Byte CONSTANTS_ORDER_POINTS_INCREASE = 1; | ||
267 | + | ||
268 | + public static final Byte CONSTANTS_ORDER_POINTS_DECREASE = 2; | ||
269 | + | ||
270 | + | ||
271 | + /** | ||
272 | + * API账户:公众号 | ||
273 | + */ | ||
274 | + public static final String CONSTANTS_API_TYPE_WXGZH = "GZH"; | ||
275 | + /** | ||
276 | + * API账户:POS | ||
277 | + */ | ||
278 | + public static final String CONSTANTS_API_TYPE_POS = "POS"; | ||
279 | + /** | ||
280 | + * API账户:电商 | ||
281 | + */ | ||
282 | + public static final String CONSTANTS_API_TYPE_E_COMMERCE = "EC"; | ||
283 | + /** | ||
284 | + * API账户:导购 | ||
285 | + */ | ||
286 | + public static final String CONSTANTS_API_TYPE_SALES_ASSISTANT = "SALES"; | ||
287 | + | ||
288 | + | ||
289 | + /** | ||
290 | + * 缓存前缀:token | ||
291 | + */ | ||
292 | + public static final String CONSTANTS_PREFIX_TOKEN = "TOKEN"; | ||
293 | + /** | ||
294 | + * 缓存前缀:顾客信息 | ||
295 | + */ | ||
296 | + public static final String CONSTANTS_PREFIX_CUSTOMER_INFO = "CST_INF"; | ||
297 | + /** | ||
298 | + * 缓存前缀:顾客手机号 | ||
299 | + */ | ||
300 | + public static final String CONSTANTS_PREFIX_CUSTOMER_ID_PHONE = "CST_TEL"; | ||
301 | + /** | ||
302 | + * 缓存前缀:顾客微信 | ||
303 | + */ | ||
304 | + public static final String CONSTANTS_PREFIX_CUSTOMER_ID_WXGZH = "CST_GZH"; | ||
305 | + /** | ||
306 | + * 缓存前缀:顾客账套信息 | ||
307 | + */ | ||
308 | + public static final String CONSTANTS_PREFIX_CUSTOMER_CRM_ACCOUNTS_ALL = "CST_ACTA"; | ||
309 | + /** | ||
310 | + * 缓存前缀:顾客部分账套信息 | ||
311 | + */ | ||
312 | + public static final String CONSTANTS_PREFIX_CUSTOMER_CRM_ACCOUNTS_PART = "CST_ACTP"; | ||
313 | + | ||
314 | + | ||
315 | + | ||
316 | + public static final String CONSTANTS_TEMPLATE_SCOPE_POINTS_EXPIRY = "POINTS_EXPIRY"; | ||
317 | + | ||
318 | + public static final String CONSTANTS_POINTS_CHANGE_TYPE_ADJUST_MANUAL ="ADJ_MAN"; | ||
319 | + | ||
320 | + public static final String CONSTANTS_POINTS_CHANGE_TYPE_EXPIRY ="EXPIRY"; | ||
321 | + | ||
322 | + | ||
323 | + /** | ||
324 | + * 新建时字段 | ||
325 | + */ | ||
326 | + public static final String CONSTANTS_FIELD_MODE_NEW = "NEW"; | ||
327 | + /** | ||
328 | + * 更新时字段 | ||
329 | + */ | ||
330 | + public static final String CONSTANTS_FIELD_MODE_MODIFY = "MOD"; | ||
331 | + /** | ||
332 | + * 审批通过 | ||
333 | + */ | ||
334 | + public static final Byte CONSTANTS_APPROVAL_STAT_PASS = 2; | ||
335 | + | ||
336 | + public static final String CONSTANTS_EVENT_ENV_KEY_NAME_POINTS_CALCULATE = "CRM_CALCULATE"; | ||
337 | + | ||
338 | + /** | ||
339 | + * QiNiu | ||
340 | + */ | ||
341 | + public static final String QN_ACCESS_KEY = "QN_ACCESS_KEY"; | ||
342 | + public static final String QN_SECRET_KEY = "QN_SECRET_KEY"; | ||
343 | + public static final String QN_BUCKET = "QN_BUCKET"; | ||
344 | +} |
1 | +package cn.runsa.crmapp.base.cache; | ||
2 | + | ||
3 | +import java.util.Collection; | ||
4 | + | ||
5 | +import javax.annotation.Resource; | ||
6 | + | ||
7 | +import org.springframework.cache.Cache; | ||
8 | +import org.springframework.cache.CacheManager; | ||
9 | +import org.springframework.cache.support.CompositeCacheManager; | ||
10 | +import org.springframework.stereotype.Component; | ||
11 | + | ||
12 | +import cn.runsa.crmapp.base.utils.SpringUtils; | ||
13 | + | ||
14 | +/** | ||
15 | + * @author Stephen | ||
16 | + */ | ||
17 | +@Component | ||
18 | +public final class CacheAdmin { | ||
19 | + | ||
20 | + @Resource(type=CompositeCacheManager.class) | ||
21 | + private CacheManager cacheManager; | ||
22 | + | ||
23 | + public void clearCache(CacheManager manager,String name){ | ||
24 | + if(manager==null) | ||
25 | + manager = cacheManager; | ||
26 | + Cache cache = manager.getCache(name); | ||
27 | + if(cache!=null){ | ||
28 | + cache.clear(); | ||
29 | + } | ||
30 | + } | ||
31 | + | ||
32 | + public void clearlocalCache(){ | ||
33 | + CacheManager local = SpringUtils.getBean("local", CacheManager.class); | ||
34 | + for(String cache:local.getCacheNames()){ | ||
35 | + clearCache(local,cache); | ||
36 | + } | ||
37 | + } | ||
38 | + | ||
39 | + public void clearCenterCache(){ | ||
40 | + CacheManager center = SpringUtils.getBean("center", CacheManager.class); | ||
41 | + for(String cache:center.getCacheNames()){ | ||
42 | + clearCache(center,cache); | ||
43 | + } | ||
44 | + } | ||
45 | + | ||
46 | + public void clearAllCache(){ | ||
47 | + Collection<String> caches = cacheManager.getCacheNames(); | ||
48 | + for(String cache:caches){ | ||
49 | + clearCache(null,cache); | ||
50 | + } | ||
51 | + } | ||
52 | + | ||
53 | +} |
1 | +package cn.runsa.crmapp.base.conf; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | +import java.util.Properties; | ||
5 | + | ||
6 | +import org.slf4j.LoggerFactory; | ||
7 | +import org.springframework.core.io.FileSystemResource; | ||
8 | +import org.springframework.core.io.support.PropertiesLoaderUtils; | ||
9 | + | ||
10 | +import cn.runsa.crmapp.base.Constants; | ||
11 | + | ||
12 | +public class ServerConfigration { | ||
13 | + | ||
14 | + private final static Properties prop; | ||
15 | + | ||
16 | + static{ | ||
17 | + try { | ||
18 | + prop = PropertiesLoaderUtils.loadProperties(new FileSystemResource(System.getProperty(Constants.CONSTANTS_SERVER_CONFIG_PATH))); | ||
19 | + } catch (IOException e) { | ||
20 | + LoggerFactory.getLogger(ServerConfigration.class).error("load resource-product configration file error",e); | ||
21 | + throw new RuntimeException(e); | ||
22 | + } | ||
23 | + } | ||
24 | + | ||
25 | + public static Properties getServerConfig(){ | ||
26 | + return prop; | ||
27 | + } | ||
28 | + | ||
29 | +} |
1 | +package cn.runsa.crmapp.base.email; | ||
2 | + | ||
3 | +import java.util.Calendar; | ||
4 | +import java.util.Properties; | ||
5 | +import javax.mail.Authenticator; | ||
6 | +import javax.mail.MessagingException; | ||
7 | +import javax.mail.PasswordAuthentication; | ||
8 | +import javax.mail.Session; | ||
9 | +import javax.mail.Transport; | ||
10 | +import javax.mail.Message.RecipientType; | ||
11 | +import javax.mail.internet.InternetAddress; | ||
12 | +import javax.mail.internet.MimeMessage; | ||
13 | + | ||
14 | +import org.slf4j.Logger; | ||
15 | +import org.slf4j.LoggerFactory; | ||
16 | + | ||
17 | +public class SendMail { | ||
18 | + | ||
19 | + private final static Logger logger = LoggerFactory.getLogger(SendMail.class); | ||
20 | + public static final String EN_CODE = "text/html;charset=gb2312"; | ||
21 | + | ||
22 | + private Transport transport; | ||
23 | + private Session mailSession; | ||
24 | + private InternetAddress fromAddress; | ||
25 | + | ||
26 | + public SendMail(String smtpHost, String from, String fromUserPassword) throws MessagingException{ | ||
27 | + this.connect(smtpHost, from, fromUserPassword); | ||
28 | + } | ||
29 | + | ||
30 | + public void connect(String smtpHost, String from, String fromUserPassword) throws MessagingException { | ||
31 | + // 第一步:配置javax.mail.Session对象 | ||
32 | + System.out.println("为" + smtpHost + "配置mail session对象"); | ||
33 | + fromAddress = new InternetAddress(from); | ||
34 | + Properties props = new Properties(); | ||
35 | + props.put("mail.smtp.host", smtpHost); | ||
36 | + props.put("mail.smtp.starttls.enable", "true");// 使用 STARTTLS安全连接 | ||
37 | + // props.put("mail.smtp.port", "25"); //google使用465或587端口 | ||
38 | + props.put("mail.smtp.auth", "true"); // 使用验证 | ||
39 | + // props.put("mail.debug", "true"); | ||
40 | + mailSession = Session.getInstance(props, new MyAuthenticator(from, fromUserPassword)); | ||
41 | + transport = mailSession.getTransport("smtp"); | ||
42 | + transport.connect(smtpHost, from, fromUserPassword); | ||
43 | + } | ||
44 | + | ||
45 | + @SuppressWarnings("static-access") | ||
46 | + public void sendMessage(String to, String subject, | ||
47 | + String messageText, String messageType) throws MessagingException { | ||
48 | + | ||
49 | + logger.info("开始发送mail.收件人:"+ to); | ||
50 | + InternetAddress toAddress = new InternetAddress(to); | ||
51 | + MimeMessage message = new MimeMessage(mailSession); | ||
52 | + message.setFrom(fromAddress); | ||
53 | + message.addRecipient(RecipientType.TO, toAddress); | ||
54 | + message.setSentDate(Calendar.getInstance().getTime()); | ||
55 | + message.setSubject(subject); | ||
56 | + if(messageType == null){ | ||
57 | + message.setContent(messageText, EN_CODE); | ||
58 | + }else{ | ||
59 | + message.setContent(messageText, messageType); | ||
60 | + } | ||
61 | + // 第三步:发送消息 | ||
62 | + transport.send(message, message.getRecipients(RecipientType.TO)); | ||
63 | + System.out.println("message yes"); | ||
64 | + } | ||
65 | + | ||
66 | + public void sendMessage(String to, String subject, | ||
67 | + String messageText) throws MessagingException { | ||
68 | + | ||
69 | + sendMessage(to, subject, messageText,null); | ||
70 | + } | ||
71 | + | ||
72 | + | ||
73 | + @SuppressWarnings("static-access") | ||
74 | + public static void sendMessage(String smtpHost, String from, String fromUserPassword, String to, String subject, | ||
75 | + String messageText, String messageType) throws MessagingException { | ||
76 | + Properties props = new Properties(); | ||
77 | + props.put("mail.smtp.host", smtpHost); | ||
78 | + props.put("mail.smtp.starttls.enable", "true");// 使用 STARTTLS安全连接 | ||
79 | + // props.put("mail.smtp.port", "25"); //google使用465或587端口 | ||
80 | + props.put("mail.smtp.auth", "true"); // 使用验证 | ||
81 | + // props.put("mail.debug", "true"); | ||
82 | + Session mailSession = Session.getInstance(props, new MyAuthenticator(from, fromUserPassword)); | ||
83 | + | ||
84 | + // 第二步:编写消息 | ||
85 | + logger.info("开始发送mail.发送人:" + from + "收件人:" + to); | ||
86 | + InternetAddress fromAddress = new InternetAddress(from); | ||
87 | + InternetAddress toAddress = new InternetAddress(to); | ||
88 | + | ||
89 | + MimeMessage message = new MimeMessage(mailSession); | ||
90 | + | ||
91 | + message.setFrom(fromAddress); | ||
92 | + message.addRecipient(RecipientType.TO, toAddress); | ||
93 | + | ||
94 | + message.setSentDate(Calendar.getInstance().getTime()); | ||
95 | + message.setSubject(subject); | ||
96 | + if(messageType == null){ | ||
97 | + message.setContent(messageText, EN_CODE); | ||
98 | + }else{ | ||
99 | + message.setContent(messageText, messageType); | ||
100 | + } | ||
101 | + | ||
102 | + // 第三步:发送消息 | ||
103 | + Transport transport = mailSession.getTransport("smtp"); | ||
104 | + transport.connect(smtpHost, from, fromUserPassword); | ||
105 | + transport.send(message, message.getRecipients(RecipientType.TO)); | ||
106 | + transport.close(); | ||
107 | + System.out.println("message yes"); | ||
108 | + } | ||
109 | + | ||
110 | + public void close(){ | ||
111 | + try { | ||
112 | + transport.close(); | ||
113 | + } catch (MessagingException e) { | ||
114 | + // TODO Auto-generated catch block | ||
115 | + e.printStackTrace(); | ||
116 | + } | ||
117 | + } | ||
118 | + | ||
119 | + public static void main(String[] args) { | ||
120 | + try { | ||
121 | + System.out.println("单发一人用法,自带关闭"); | ||
122 | + SendMail.sendMessage("smtp.runsa.cn", "support@runsa.cn", "Runsatest@123", "472109366@qq.com", "nihao","English123中文", EN_CODE); | ||
123 | + | ||
124 | + System.out.println("连续发多人用法,需要手动关闭连接"); | ||
125 | + SendMail send = new SendMail("smtp.runsa.cn", "support@runsa.cn", "Runsatest@123"); | ||
126 | + send.sendMessage("472109366@qq.com", "nihao","English123中文", EN_CODE); | ||
127 | + send.sendMessage("472109366@qq.com", "nihao","English123中文", EN_CODE); | ||
128 | + send.close(); | ||
129 | + } catch (MessagingException e) { | ||
130 | + // TODO Auto-generated catch block | ||
131 | + e.printStackTrace(); | ||
132 | + } | ||
133 | + } | ||
134 | +} | ||
135 | + | ||
136 | +class MyAuthenticator extends Authenticator { | ||
137 | + String userName = ""; | ||
138 | + String password = ""; | ||
139 | + | ||
140 | + public MyAuthenticator() { | ||
141 | + | ||
142 | + } | ||
143 | + | ||
144 | + public MyAuthenticator(String userName, String password) { | ||
145 | + this.userName = userName; | ||
146 | + this.password = password; | ||
147 | + } | ||
148 | + | ||
149 | + protected PasswordAuthentication getPasswordAuthentication() { | ||
150 | + return new PasswordAuthentication(userName, password); | ||
151 | + } | ||
152 | +} |
1 | +package cn.runsa.crmapp.base.email; | ||
2 | + | ||
3 | +import java.text.SimpleDateFormat; | ||
4 | +import java.util.Calendar; | ||
5 | +import java.util.Date; | ||
6 | +import java.util.Properties; | ||
7 | + | ||
8 | +import javax.mail.Authenticator; | ||
9 | +import javax.mail.MessagingException; | ||
10 | +import javax.mail.NoSuchProviderException; | ||
11 | +import javax.mail.PasswordAuthentication; | ||
12 | +import javax.mail.Session; | ||
13 | +import javax.mail.Transport; | ||
14 | +import javax.mail.Message.RecipientType; | ||
15 | +import javax.mail.internet.InternetAddress; | ||
16 | +import javax.mail.internet.MimeMessage; | ||
17 | + | ||
18 | +import org.slf4j.Logger; | ||
19 | +import org.slf4j.LoggerFactory; | ||
20 | + | ||
21 | +public class SendMail2 { | ||
22 | + private final static Logger logger = LoggerFactory.getLogger(SendMail2.class); | ||
23 | + | ||
24 | + public static final String EN_CODE = "text/html;charset=gb2312"; | ||
25 | + private Transport transport; | ||
26 | + private Session mailSession; | ||
27 | + private InternetAddress fromAddress; | ||
28 | + | ||
29 | + public SendMail2(String smtpHost, String from, String fromUserPassword) throws MessagingException{ | ||
30 | + this.connect(smtpHost, from, fromUserPassword); | ||
31 | + } | ||
32 | + | ||
33 | + @SuppressWarnings("static-access") | ||
34 | + public void connect(String smtpHost, String from, String fromUserPassword) throws MessagingException { | ||
35 | + // 第一步:配置javax.mail.Session对象 | ||
36 | + System.out.println("为" + smtpHost + "配置mail session对象"); | ||
37 | + fromAddress = new InternetAddress(from); | ||
38 | + Properties props = new Properties(); | ||
39 | + props.put("mail.smtp.host", smtpHost); | ||
40 | + props.put("mail.smtp.starttls.enable", "true");// 使用 STARTTLS安全连接 | ||
41 | + // props.put("mail.smtp.port", "25"); //google使用465或587端口 | ||
42 | + props.put("mail.smtp.auth", "true"); // 使用验证 | ||
43 | + // props.put("mail.debug", "true"); | ||
44 | + mailSession = Session.getInstance(props, new MyAuthenticator(from, fromUserPassword)); | ||
45 | + transport = mailSession.getTransport("smtp"); | ||
46 | + transport.connect(smtpHost, from, fromUserPassword); | ||
47 | + } | ||
48 | + | ||
49 | + public void sendMsg(String subject, String messageText){ | ||
50 | + | ||
51 | + } | ||
52 | + | ||
53 | + @SuppressWarnings("static-access") | ||
54 | + public void sendMessage(String to, String subject, | ||
55 | + String messageText, String messageType) throws MessagingException { | ||
56 | + | ||
57 | + System.out.println("编写消息from——to:" + "——" + to); | ||
58 | + | ||
59 | + InternetAddress toAddress = new InternetAddress(to); | ||
60 | + MimeMessage message = new MimeMessage(mailSession); | ||
61 | + | ||
62 | + message.setFrom(fromAddress); | ||
63 | + message.addRecipient(RecipientType.TO, toAddress); | ||
64 | + message.setSentDate(Calendar.getInstance().getTime()); | ||
65 | + message.setSubject(subject); | ||
66 | + if(messageType == null){ | ||
67 | + message.setContent(messageText, EN_CODE); | ||
68 | + }else{ | ||
69 | + message.setContent(messageText, messageType); | ||
70 | + } | ||
71 | + | ||
72 | + // 第三步:发送消息 | ||
73 | + transport.send(message, message.getRecipients(RecipientType.TO)); | ||
74 | + System.out.println("message yes"); | ||
75 | + } | ||
76 | + public void close(){ | ||
77 | + try { | ||
78 | + transport.close(); | ||
79 | + } catch (MessagingException e) { | ||
80 | + // TODO Auto-generated catch block | ||
81 | + e.printStackTrace(); | ||
82 | + } | ||
83 | + } | ||
84 | + | ||
85 | + public static void main(String[] args) { | ||
86 | + try { | ||
87 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); | ||
88 | + System.out.println(sdf.format(new Date())); | ||
89 | + SendMail2 send = new SendMail2("smtp.runsa.cn", "support@runsa.cn", "Runsatest@123"); | ||
90 | + send.sendMessage("472109366@qq.com", "nihao", | ||
91 | + "---------------wrwe-----------中文", EN_CODE); | ||
92 | + System.out.println(sdf.format(new Date())); | ||
93 | + send.sendMessage("472109366@qq.com", "nihao", | ||
94 | + "---------------wrwe-----------中文", EN_CODE); | ||
95 | + System.out.println(sdf.format(new Date())); | ||
96 | + } catch (MessagingException e) { | ||
97 | + // TODO Auto-generated catch block | ||
98 | + e.printStackTrace(); | ||
99 | + } | ||
100 | + } | ||
101 | + | ||
102 | + | ||
103 | +} |
1 | +package cn.runsa.crmapp.base.event; | ||
2 | + | ||
3 | +import cn.runsa.crmapp.base.event.exception.BusinessEventException; | ||
4 | +/** | ||
5 | + * 抽象evnetHandler,定义流程 | ||
6 | + * @author Stephen | ||
7 | + */ | ||
8 | +public abstract class AbstractBusinessEventHandler implements BusinessEventHandler { | ||
9 | + | ||
10 | + public abstract boolean preHandle(BusinessEvent event); | ||
11 | + | ||
12 | + public abstract void handle(BusinessEvent event) throws BusinessEventException; | ||
13 | + | ||
14 | + public abstract void postHandle(BusinessEvent event, BusinessEventException e); | ||
15 | + | ||
16 | + @Override | ||
17 | + public final void listen(BusinessEvent event) { | ||
18 | + if (preHandle(event)) { | ||
19 | + try { | ||
20 | + handle(event); | ||
21 | + } catch (BusinessEventException e) { | ||
22 | + postHandle(event, e); | ||
23 | + } | ||
24 | + } | ||
25 | + } | ||
26 | +} |
1 | +package cn.runsa.crmapp.base.event; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | +import java.util.Map; | ||
5 | +/** | ||
6 | + * 业务事件 | ||
7 | + * @author Stephen | ||
8 | + * | ||
9 | + */ | ||
10 | +public class BusinessEvent implements Serializable{ | ||
11 | + | ||
12 | + private static final long serialVersionUID = 7738977611490794967L; | ||
13 | + /** | ||
14 | + * 事件代号 | ||
15 | + */ | ||
16 | + private String eventCode; | ||
17 | + /** | ||
18 | + * 账套 | ||
19 | + */ | ||
20 | + private Long [] acts; | ||
21 | + | ||
22 | + private Object target; | ||
23 | + | ||
24 | + private Map<String,Object> env; | ||
25 | + | ||
26 | + private long timestamp; | ||
27 | + | ||
28 | + | ||
29 | + public BusinessEvent() { | ||
30 | + super(); | ||
31 | + } | ||
32 | + | ||
33 | + public BusinessEvent(Object target, long timestamp) { | ||
34 | + super(); | ||
35 | + this.target = target; | ||
36 | + this.timestamp = timestamp; | ||
37 | + } | ||
38 | + | ||
39 | + public Object getTarget() { | ||
40 | + return target; | ||
41 | + } | ||
42 | + | ||
43 | + public void setTarget(Object target) { | ||
44 | + this.target = target; | ||
45 | + } | ||
46 | + | ||
47 | + public Map<String, Object> getEnv() { | ||
48 | + return env; | ||
49 | + } | ||
50 | + | ||
51 | + public Object getEnval(String key){ | ||
52 | + if(this.env!=null){ | ||
53 | + return this.env.get(key); | ||
54 | + } | ||
55 | + return null; | ||
56 | + } | ||
57 | + | ||
58 | + public void setEnv(Map<String, Object> env) { | ||
59 | + this.env = env; | ||
60 | + } | ||
61 | + | ||
62 | + public long getTimestamp() { | ||
63 | + return timestamp; | ||
64 | + } | ||
65 | + | ||
66 | + public void setTimestamp(long timestamp) { | ||
67 | + this.timestamp = timestamp; | ||
68 | + } | ||
69 | + | ||
70 | + public String getEventCode() { | ||
71 | + return eventCode; | ||
72 | + } | ||
73 | + | ||
74 | + public void setEventCode(String eventCode) { | ||
75 | + this.eventCode = eventCode; | ||
76 | + } | ||
77 | + | ||
78 | + public Long[] getActs() { | ||
79 | + return acts; | ||
80 | + } | ||
81 | + | ||
82 | + public void setActs(Long[] acts) { | ||
83 | + this.acts = acts; | ||
84 | + } | ||
85 | + | ||
86 | +} |
1 | +package cn.runsa.crmapp.base.event; | ||
2 | + | ||
3 | +import org.aspectj.lang.JoinPoint; | ||
4 | +import org.aspectj.lang.annotation.Aspect; | ||
5 | +import org.aspectj.lang.annotation.Before; | ||
6 | + | ||
7 | +import com.google.common.eventbus.EventBus; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author Stephen | ||
11 | + */ | ||
12 | +@Aspect | ||
13 | +public class BusinessEventHelper { | ||
14 | + @Before("execution(public * com.google.common.eventbus.EventBus.post(*)") | ||
15 | + public void eventBefore(JoinPoint point){ | ||
16 | + Object[] args = point.getArgs(); | ||
17 | + if(args !=null&&args.length==1){ | ||
18 | + Object obj = args[0]; | ||
19 | + if(BusinessEvent.class.equals(obj.getClass())){ | ||
20 | + BusinessEvent event = (BusinessEvent) args[0]; | ||
21 | + EventBus bus = (EventBus) point.getTarget(); | ||
22 | + event.setEventCode(bus.identifier()); | ||
23 | + } | ||
24 | + } | ||
25 | + } | ||
26 | + | ||
27 | +} |
1 | +package cn.runsa.crmapp.base.event; | ||
2 | + | ||
3 | +import java.util.HashMap; | ||
4 | +import java.util.Map; | ||
5 | +/** | ||
6 | + * 业务事件builder | ||
7 | + * @author Stephen | ||
8 | + */ | ||
9 | +public class EventBuilder { | ||
10 | + | ||
11 | + private BusinessEvent event; | ||
12 | + | ||
13 | + private EventBuilder(){ | ||
14 | + | ||
15 | + } | ||
16 | + | ||
17 | + public static EventBuilder newEvent(Object target){ | ||
18 | + EventBuilder builder = new EventBuilder(); | ||
19 | + builder.event = new BusinessEvent(target,System.currentTimeMillis()); | ||
20 | + return builder; | ||
21 | + } | ||
22 | + | ||
23 | + public static EventBuilder newEvent(Object target,String code){ | ||
24 | + EventBuilder builder = new EventBuilder(); | ||
25 | + builder.event = new BusinessEvent(target,System.currentTimeMillis()); | ||
26 | + builder.event.setEventCode(code); | ||
27 | + return builder; | ||
28 | + } | ||
29 | + | ||
30 | + public EventBuilder putEnv(String name,Object value){ | ||
31 | + this.getEnvMap().put(name, value); | ||
32 | + return this; | ||
33 | + } | ||
34 | + | ||
35 | + public EventBuilder putEnvs(Map<String,Object> envs){ | ||
36 | + this.getEnvMap().putAll(envs); | ||
37 | + return this; | ||
38 | + } | ||
39 | + | ||
40 | + public EventBuilder putActs(Long [] acts){ | ||
41 | + this.event.setActs(acts); | ||
42 | + return this; | ||
43 | + } | ||
44 | + | ||
45 | + public BusinessEvent build(){ | ||
46 | + return this.event; | ||
47 | + } | ||
48 | + | ||
49 | + private Map<String,Object> getEnvMap(){ | ||
50 | + if(event.getEnv()==null){ | ||
51 | + synchronized (event) { | ||
52 | + if(event.getEnv()==null){ | ||
53 | + event.setEnv(new HashMap<String,Object>()); | ||
54 | + } | ||
55 | + } | ||
56 | + } | ||
57 | + return event.getEnv(); | ||
58 | + } | ||
59 | +} |
1 | +package cn.runsa.crmapp.base.event; | ||
2 | + | ||
3 | +import java.io.InputStream; | ||
4 | +import java.util.ArrayList; | ||
5 | +import java.util.Collections; | ||
6 | +import java.util.HashMap; | ||
7 | +import java.util.List; | ||
8 | +import java.util.Map; | ||
9 | + | ||
10 | +import org.apache.commons.io.IOUtils; | ||
11 | +import org.apache.commons.lang3.StringUtils; | ||
12 | +import org.dom4j.Document; | ||
13 | +import org.dom4j.Element; | ||
14 | +import org.dom4j.io.SAXReader; | ||
15 | +import org.slf4j.Logger; | ||
16 | +import org.slf4j.LoggerFactory; | ||
17 | +import org.springframework.core.io.ClassPathResource; | ||
18 | + | ||
19 | +import cn.runsa.crmapp.base.utils.SpringUtils; | ||
20 | + | ||
21 | +import com.google.common.eventbus.EventBus; | ||
22 | + | ||
23 | +/** | ||
24 | + * Build EventBus<br> | ||
25 | + * 一个id,对应唯 一 一 个EventBus | ||
26 | + * | ||
27 | + * @author Stephen | ||
28 | + * | ||
29 | + */ | ||
30 | +public class EventBusBuilder { | ||
31 | + | ||
32 | + private final static Logger log = LoggerFactory.getLogger(EventBusBuilder.class); | ||
33 | + | ||
34 | + private static final Map<String, EventBus> list = new HashMap<String, EventBus>(); | ||
35 | + | ||
36 | + static { | ||
37 | + init(); | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * 获取命名EventBus | ||
42 | + * | ||
43 | + * @param identifier | ||
44 | + * @return | ||
45 | + */ | ||
46 | + public static EventBus named(String identifier) { | ||
47 | + EventBus eventBus = null; | ||
48 | + if (list.containsKey(identifier)) { | ||
49 | + eventBus = list.get(identifier); | ||
50 | + if (eventBus != null) | ||
51 | + return eventBus; | ||
52 | + } | ||
53 | + eventBus = new EventBus(identifier); | ||
54 | + list.put(identifier, eventBus); | ||
55 | + return eventBus; | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * 读取配置,初始化 | ||
60 | + */ | ||
61 | + @SuppressWarnings("unchecked") | ||
62 | + public static void init() { | ||
63 | + SAXReader reader = new SAXReader(); | ||
64 | + InputStream in = null; | ||
65 | + try { | ||
66 | + in = new ClassPathResource("event/business_event.xml").getInputStream(); | ||
67 | + Document doc = reader.read(in); | ||
68 | + Element root = doc.getRootElement(); | ||
69 | + //event element | ||
70 | + List<Element> events = root.elements("event"); | ||
71 | + for (Element ele : events) { | ||
72 | + //event id | ||
73 | + String name = ele.attributeValue("id").trim(); | ||
74 | + EventBus bus = new EventBus(name); | ||
75 | + Element ls = ele.element("listeners"); | ||
76 | + if (ls != null) { | ||
77 | + List<Element> list = ls.elements("listener"); | ||
78 | + if (list != null && list.size() > 0) { | ||
79 | + List<Listener> listeners = new ArrayList<Listener>(); | ||
80 | + for (Element lis : list) { | ||
81 | + String clz = lis.attributeValue("class"); | ||
82 | + String priority = lis.attributeValue("priority"); | ||
83 | + String async = lis.attributeValue("async"); | ||
84 | + if (StringUtils.isNotBlank(clz)) { | ||
85 | + Listener listner = new Listener(); | ||
86 | + listner.setClz(clz.trim()); | ||
87 | + if (StringUtils.isBlank(async)) { | ||
88 | + listner.setAsync(false); | ||
89 | + } else { | ||
90 | + listner.setAsync("true".equalsIgnoreCase(async.trim())); | ||
91 | + } | ||
92 | + if (StringUtils.isNotBlank(priority)) { | ||
93 | + listner.setPriority(Integer.parseInt(priority.trim())); | ||
94 | + } | ||
95 | + listeners.add(listner); | ||
96 | + } | ||
97 | + } | ||
98 | + if (listeners.size() > 0) { | ||
99 | + Collections.sort(listeners); | ||
100 | + for (Listener l : listeners) { | ||
101 | + try{ | ||
102 | + bus.register(SpringUtils.getBean(Class.forName(l.getClz()))); | ||
103 | + }catch(Exception e){ | ||
104 | + log.error("load class error", e); | ||
105 | + } | ||
106 | + | ||
107 | + } | ||
108 | + } | ||
109 | + } | ||
110 | + } | ||
111 | + list.put(name, bus); | ||
112 | + } | ||
113 | + | ||
114 | + } catch (Exception e) { | ||
115 | + log.error("init event bus builder throw an exception", e); | ||
116 | + }finally{ | ||
117 | + IOUtils.closeQuietly(in); | ||
118 | + } | ||
119 | + } | ||
120 | + | ||
121 | +} |
1 | +package cn.runsa.crmapp.base.event; | ||
2 | +/** | ||
3 | + * @author Stephen | ||
4 | + */ | ||
5 | +public class Listener implements Comparable<Listener>{ | ||
6 | + | ||
7 | + private String clz; | ||
8 | + | ||
9 | + private int priority; | ||
10 | + | ||
11 | + private boolean async; | ||
12 | + | ||
13 | + public String getClz() { | ||
14 | + return clz; | ||
15 | + } | ||
16 | + | ||
17 | + public void setClz(String clz) { | ||
18 | + this.clz = clz; | ||
19 | + } | ||
20 | + | ||
21 | + public int getPriority() { | ||
22 | + return priority; | ||
23 | + } | ||
24 | + | ||
25 | + public void setPriority(int priority) { | ||
26 | + this.priority = priority; | ||
27 | + } | ||
28 | + | ||
29 | + public boolean isAsync() { | ||
30 | + return async; | ||
31 | + } | ||
32 | + | ||
33 | + public void setAsync(boolean async) { | ||
34 | + this.async = async; | ||
35 | + } | ||
36 | + | ||
37 | + @Override | ||
38 | + public int compareTo(Listener o) { | ||
39 | + if(o==null){ | ||
40 | + return -1; | ||
41 | + } | ||
42 | + if(this==o){ | ||
43 | + return 0; | ||
44 | + } | ||
45 | + if(this.priority>o.priority){ | ||
46 | + return -1; | ||
47 | + }else if(this.priority<o.priority){ | ||
48 | + return 1; | ||
49 | + }else{ | ||
50 | + return 0; | ||
51 | + } | ||
52 | + } | ||
53 | + | ||
54 | +} |
1 | +package cn.runsa.crmapp.base.event; | ||
2 | + | ||
3 | +import cn.runsa.crmapp.base.event.exception.BusinessEventException; | ||
4 | +/** | ||
5 | + * 简单实现的eventHandler,用户可以直接继承 | ||
6 | + * @author Stephen | ||
7 | + * | ||
8 | + */ | ||
9 | +public abstract class SimpleBusinessEventHandler extends AbstractBusinessEventHandler{ | ||
10 | + | ||
11 | + @Override | ||
12 | + public boolean preHandle(BusinessEvent event) { | ||
13 | + return true; | ||
14 | + } | ||
15 | + | ||
16 | + /** | ||
17 | + * 只是把exception记录下来 | ||
18 | + */ | ||
19 | + @Override | ||
20 | + public void postHandle(BusinessEvent event, BusinessEventException e) { | ||
21 | + if(e!=null){ | ||
22 | + e.printStackTrace(); | ||
23 | + } | ||
24 | + } | ||
25 | + | ||
26 | +} |
crm/crm-base/src/main/java/cn/runsa/crmapp/base/event/exception/BusinessEventException.java
0 → 100644
1 | +package cn.runsa.crmapp.base.event.exception; | ||
2 | + | ||
3 | +public class BusinessEventException extends Exception { | ||
4 | + | ||
5 | + private static final long serialVersionUID = -97726556007905578L; | ||
6 | + | ||
7 | + public BusinessEventException() { | ||
8 | + super(); | ||
9 | + } | ||
10 | + | ||
11 | + public BusinessEventException(String message, Throwable cause) { | ||
12 | + super(message, cause); | ||
13 | + } | ||
14 | + | ||
15 | + public BusinessEventException(String message) { | ||
16 | + super(message); | ||
17 | + } | ||
18 | + | ||
19 | + public BusinessEventException(Throwable cause) { | ||
20 | + super(cause); | ||
21 | + } | ||
22 | +} |
1 | +package cn.runsa.crmapp.base.excel.converter; | ||
2 | + | ||
3 | +import java.util.HashSet; | ||
4 | +import java.util.Set; | ||
5 | + | ||
6 | +import cn.runsa.crmapp.base.excel.core.Converter; | ||
7 | + | ||
8 | +/** | ||
9 | + * @author Stephen | ||
10 | + */ | ||
11 | +public class BooleanConverter implements Converter<Boolean>{ | ||
12 | + | ||
13 | + private static final Set<String> trueValues = new HashSet<String>(4); | ||
14 | + | ||
15 | + private static final Set<String> falseValues = new HashSet<String>(4); | ||
16 | + | ||
17 | + static { | ||
18 | + trueValues.add("true"); | ||
19 | + trueValues.add("on"); | ||
20 | + trueValues.add("yes"); | ||
21 | + trueValues.add("1"); | ||
22 | + trueValues.add("是"); | ||
23 | + | ||
24 | + falseValues.add("false"); | ||
25 | + falseValues.add("off"); | ||
26 | + falseValues.add("no"); | ||
27 | + falseValues.add("0"); | ||
28 | + trueValues.add("否"); | ||
29 | + } | ||
30 | + | ||
31 | + @Override | ||
32 | + public Boolean convert(String source){ | ||
33 | + String value = source.trim(); | ||
34 | + if ("".equals(value)) { | ||
35 | + return null; | ||
36 | + } | ||
37 | + value = value.toLowerCase(); | ||
38 | + if (trueValues.contains(value)) { | ||
39 | + return Boolean.TRUE; | ||
40 | + } | ||
41 | + else if (falseValues.contains(value)) { | ||
42 | + return Boolean.FALSE; | ||
43 | + } | ||
44 | + else { | ||
45 | + throw new IllegalArgumentException(source+"无法判断是或否"); | ||
46 | + } | ||
47 | + } | ||
48 | + | ||
49 | +} |
1 | +package cn.runsa.crmapp.base.excel.converter; | ||
2 | + | ||
3 | +import java.text.ParseException; | ||
4 | +import java.util.Date; | ||
5 | + | ||
6 | +import org.apache.commons.lang3.time.DateUtils; | ||
7 | +import org.apache.poi.ss.usermodel.DateUtil; | ||
8 | + | ||
9 | +import cn.runsa.crmapp.base.excel.core.Converter; | ||
10 | + | ||
11 | +/** | ||
12 | + * @author Stephen | ||
13 | + */ | ||
14 | +public class DateConverter implements Converter<Date> { | ||
15 | + | ||
16 | + private String defaultPattern = "yyyy-MM-dd"; | ||
17 | + | ||
18 | + private String[] acceptPatterns = new String[] {"yyyy-MM-dd HH:mm:ss"}; | ||
19 | + | ||
20 | + public DateConverter(){ | ||
21 | + super(); | ||
22 | + } | ||
23 | + | ||
24 | + public DateConverter(String pattern){ | ||
25 | + this(pattern,null); | ||
26 | + } | ||
27 | + | ||
28 | + public DateConverter(String pattern,String [] accepts){ | ||
29 | + super(); | ||
30 | + if(pattern==null){ | ||
31 | + this.defaultPattern=pattern; | ||
32 | + } | ||
33 | + if(accepts!=null&&accepts.length>0){ | ||
34 | + this.acceptPatterns = accepts; | ||
35 | + } | ||
36 | + } | ||
37 | + | ||
38 | + @Override | ||
39 | + public Date convert(String source){ | ||
40 | + Date date=null; | ||
41 | + String value = source.trim(); | ||
42 | + if ("".equals(value)) { | ||
43 | + return null; | ||
44 | + } | ||
45 | + if(source.matches("^\\d+\\.\\d+$")){ | ||
46 | + double dt = Double.parseDouble(source); | ||
47 | + date = DateUtil.getJavaDate(dt); | ||
48 | + return date; | ||
49 | + } | ||
50 | + try{ | ||
51 | + date=DateUtils.parseDate(source,defaultPattern); | ||
52 | + if(date==null){ | ||
53 | + date=DateUtils.parseDate(source,acceptPatterns); | ||
54 | + } | ||
55 | + }catch(ParseException e){ | ||
56 | + throw new IllegalArgumentException(source+"无法转换为日期"); | ||
57 | + } | ||
58 | + | ||
59 | + return date; | ||
60 | + } | ||
61 | + | ||
62 | +} |
1 | +package cn.runsa.crmapp.base.excel.converter; | ||
2 | + | ||
3 | +import org.springframework.util.NumberUtils; | ||
4 | + | ||
5 | +import cn.runsa.crmapp.base.excel.core.Converter; | ||
6 | + | ||
7 | +/** | ||
8 | + * @author Stephen | ||
9 | + * 数字转换器 | ||
10 | + */ | ||
11 | +public class NumberConverter<T extends Number> implements Converter<T>{ | ||
12 | + | ||
13 | + private final Class<T> targetType; | ||
14 | + | ||
15 | + public NumberConverter(Class<T> targetType){ | ||
16 | + this.targetType = targetType; | ||
17 | + } | ||
18 | + | ||
19 | + @Override | ||
20 | + public T convert(String source) { | ||
21 | + if (source.length() == 0) { | ||
22 | + return null; | ||
23 | + } | ||
24 | + try{ | ||
25 | + return NumberUtils.parseNumber(source, this.targetType); | ||
26 | + }catch(Exception e){ | ||
27 | + e.printStackTrace(); | ||
28 | + throw new IllegalArgumentException(source+"无法转换为数字"); | ||
29 | + } | ||
30 | + | ||
31 | + } | ||
32 | + | ||
33 | +} |
1 | +package cn.runsa.crmapp.base.excel.core; | ||
2 | + | ||
3 | +import java.util.Map; | ||
4 | +import java.util.regex.Pattern; | ||
5 | + | ||
6 | +import org.apache.commons.lang3.builder.ToStringBuilder; | ||
7 | +/** | ||
8 | + * excel的列 | ||
9 | + * @author Stephen | ||
10 | + * @version 1.0 | ||
11 | + */ | ||
12 | +public class ExcelCol implements Comparable<ExcelCol>{ | ||
13 | + | ||
14 | + private Class<?> type; | ||
15 | + | ||
16 | + private String code;//name; | ||
17 | + | ||
18 | + private String name;//title; | ||
19 | + /** | ||
20 | + * 排序 | ||
21 | + */ | ||
22 | + private Integer sortCode = 0; | ||
23 | + private boolean nullable = true; | ||
24 | + private Integer maxLength = -1; | ||
25 | + private Integer minLength = 0; | ||
26 | + /** | ||
27 | + * 考虑到有可能做维护界面,预留字符串pattern | ||
28 | + */ | ||
29 | + private String pattern; | ||
30 | + /** | ||
31 | + * 编译后的pattern | ||
32 | + */ | ||
33 | + private Pattern compiledPattern; | ||
34 | + | ||
35 | + private Map<String, Object> items; //下拉后的选项值.数据来源于code_list 的值 | ||
36 | + | ||
37 | + public Class<?> getType() { | ||
38 | + return type; | ||
39 | + } | ||
40 | + | ||
41 | + public void setType(Class<?> type) { | ||
42 | + this.type = type; | ||
43 | + } | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + public String getCode() { | ||
48 | + return code; | ||
49 | + } | ||
50 | + | ||
51 | + public void setCode(String code) { | ||
52 | + this.code = code; | ||
53 | + } | ||
54 | + | ||
55 | + public String getName() { | ||
56 | + return name; | ||
57 | + } | ||
58 | + | ||
59 | + public void setName(String name) { | ||
60 | + this.name = name; | ||
61 | + } | ||
62 | + | ||
63 | + public Integer getSortCode() { | ||
64 | + return sortCode; | ||
65 | + } | ||
66 | + public void setSortCode(Integer sortCode) { | ||
67 | + this.sortCode = sortCode; | ||
68 | + } | ||
69 | + | ||
70 | + public boolean isNullable() { | ||
71 | + return nullable; | ||
72 | + } | ||
73 | + | ||
74 | + public void setNullable(boolean nullable) { | ||
75 | + this.nullable = nullable; | ||
76 | + } | ||
77 | + | ||
78 | + public Integer getMaxLength() { | ||
79 | + return maxLength; | ||
80 | + } | ||
81 | + | ||
82 | + public void setMaxLength(Integer maxLength) { | ||
83 | + this.maxLength = maxLength; | ||
84 | + } | ||
85 | + | ||
86 | + public Integer getMinLength() { | ||
87 | + return minLength; | ||
88 | + } | ||
89 | + | ||
90 | + public void setMinLength(Integer minLength) { | ||
91 | + this.minLength = minLength; | ||
92 | + } | ||
93 | + | ||
94 | + public String getPattern() { | ||
95 | + return pattern; | ||
96 | + } | ||
97 | + | ||
98 | + public void setPattern(String pattern) { | ||
99 | + this.pattern = pattern; | ||
100 | + } | ||
101 | + | ||
102 | + public Pattern getCompiledPattern() { | ||
103 | + return compiledPattern; | ||
104 | + } | ||
105 | + | ||
106 | + public void setCompiledPattern(Pattern compiledPattern) { | ||
107 | + this.compiledPattern = compiledPattern; | ||
108 | + } | ||
109 | + | ||
110 | + public Map<String, Object> getItems() { | ||
111 | + return items; | ||
112 | + } | ||
113 | + | ||
114 | + public void setItems(Map<String, Object> items) { | ||
115 | + this.items = items; | ||
116 | + } | ||
117 | + | ||
118 | + @Override | ||
119 | + public int compareTo(ExcelCol o) { | ||
120 | + if(o ==null){ | ||
121 | + return 1; | ||
122 | + }else{ | ||
123 | + return this.sortCode-o.sortCode; | ||
124 | + } | ||
125 | + } | ||
126 | + | ||
127 | + @Override | ||
128 | + public String toString() { | ||
129 | + return ToStringBuilder.reflectionToString(this); | ||
130 | + } | ||
131 | +} |
1 | +package cn.runsa.crmapp.base.excel.core; | ||
2 | + | ||
3 | +import java.util.HashMap; | ||
4 | +import java.util.List; | ||
5 | +import java.util.Map; | ||
6 | + | ||
7 | +/** | ||
8 | + * excel数据获取后续的处理,如 | ||
9 | + * 每次读几行,读完之后存入临时表 | ||
10 | + * 调用存储过程等 | ||
11 | + * @author Stephen | ||
12 | + */ | ||
13 | +public abstract class ExcelDataHandler { | ||
14 | + /** | ||
15 | + * 每次获取行数的默认数目 | ||
16 | + */ | ||
17 | + private static final int DEFAULT_SIZE = 100; | ||
18 | + | ||
19 | + private static final int MAX_ERROR_SIZE = 100; //最大错误行数,超过此行数,不需要处理,返回错误结果 | ||
20 | + | ||
21 | + private static final int MAX_SIZE = 10000; //最大处理行数 | ||
22 | + /** | ||
23 | + * 每次获取的行数 | ||
24 | + */ | ||
25 | + private int sizeOneTime; | ||
26 | + private int maxErrRow; | ||
27 | + /** | ||
28 | + * excel数据处理的上下文环境变量 | ||
29 | + */ | ||
30 | + private Map<String,Object> excelDataContext = new HashMap<String,Object>(); | ||
31 | + | ||
32 | + protected ExcelDataHandler(){ | ||
33 | + this(null); | ||
34 | + } | ||
35 | + | ||
36 | + protected ExcelDataHandler(Map<String,Object> context){ | ||
37 | + super(); | ||
38 | + this.sizeOneTime = DEFAULT_SIZE; | ||
39 | + this.maxErrRow = MAX_ERROR_SIZE; | ||
40 | + if(context!=null){ | ||
41 | + this.excelDataContext = context; | ||
42 | + }else{ | ||
43 | + this.excelDataContext = new HashMap<String,Object>(); | ||
44 | + } | ||
45 | + } | ||
46 | + | ||
47 | + protected ExcelDataHandler(Map<String,Object> context, int maxRow, int maxErrRow){ | ||
48 | + super(); | ||
49 | + if(maxRow>0&&maxRow<=MAX_SIZE){ | ||
50 | + this.sizeOneTime = maxRow; | ||
51 | + }else{ | ||
52 | + this.sizeOneTime = DEFAULT_SIZE; | ||
53 | + } | ||
54 | + if(maxErrRow>0&&maxErrRow<=MAX_ERROR_SIZE){ | ||
55 | + this.maxErrRow = maxErrRow; | ||
56 | + }else{ | ||
57 | + this.maxErrRow = MAX_ERROR_SIZE; | ||
58 | + } | ||
59 | + if(context!=null){ | ||
60 | + this.excelDataContext = context; | ||
61 | + }else{ | ||
62 | + this.excelDataContext = new HashMap<String,Object>(); | ||
63 | + } | ||
64 | + | ||
65 | + } | ||
66 | + | ||
67 | + protected void putData(String key,Object val){ | ||
68 | + excelDataContext.put(key, val); | ||
69 | + } | ||
70 | + | ||
71 | + protected void putDatas(Map<String,Object> vals){ | ||
72 | + excelDataContext.putAll(vals); | ||
73 | + } | ||
74 | + | ||
75 | + public int getSizeOneTime() { | ||
76 | + return sizeOneTime; | ||
77 | + } | ||
78 | + | ||
79 | + public Map<String, Object> getExcelDataContext() { | ||
80 | + return excelDataContext; | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + * 处理获取的数据 | ||
85 | + * @param schema 从db中获取的excel结构 | ||
86 | + * @param groupId 组id,用于标记是这个用户操作的(用于多用户操作的区分) | ||
87 | + * @param datas 获取的数据集 | ||
88 | + */ | ||
89 | + public abstract void dataFetched(ExcelSchema schema, String groupId, List<Map<String, Object>> datas); | ||
90 | + | ||
91 | + /** | ||
92 | + * excel数据读取完成 | ||
93 | + * @param schema 从db中获取的excel结构 | ||
94 | + * @param headSchema 从excel中获取的结构,和schema的区别在于: schema是预定义格式,headSchema是真实格式 | ||
95 | + * @param groupId 组id,用于标记是这个用户操作的(用于多用户操作的区分) | ||
96 | + * @param 废弃 errorProcessor excel错误处理器 已放在DefaultSheetContentsHandler中处理 | ||
97 | + * @return 返回失败的数据条数 | ||
98 | + */ | ||
99 | + public abstract ExcelResult dataFinish(ExcelSchema schema, Map<String, ExcelCol> headSchema, String groupId); | ||
100 | + | ||
101 | +} |
1 | +package cn.runsa.crmapp.base.excel.core; | ||
2 | + | ||
3 | +import java.io.File; | ||
4 | +import java.io.FileOutputStream; | ||
5 | +import java.util.HashMap; | ||
6 | +import java.util.List; | ||
7 | +import java.util.Map; | ||
8 | + | ||
9 | +import org.apache.commons.io.IOUtils; | ||
10 | +import org.apache.poi.ss.usermodel.Cell; | ||
11 | +import org.apache.poi.ss.usermodel.Row; | ||
12 | +import org.apache.poi.ss.usermodel.Sheet; | ||
13 | +import org.apache.poi.xssf.streaming.SXSSFWorkbook; | ||
14 | +import org.apache.poi.xssf.usermodel.XSSFClientAnchor; | ||
15 | +import org.apache.poi.xssf.usermodel.XSSFComment; | ||
16 | +import org.apache.poi.xssf.usermodel.XSSFDrawing; | ||
17 | +import org.apache.poi.xssf.usermodel.XSSFRichTextString; | ||
18 | + | ||
19 | +public class ExcelErrorProcessor{ | ||
20 | + | ||
21 | + private final Map<String,Integer> headIndex; | ||
22 | + private final SXSSFWorkbook workbook; | ||
23 | + private final Sheet errorSheet; | ||
24 | + // 创建绘图对象 | ||
25 | + XSSFDrawing p ; | ||
26 | + private volatile int next = 0; | ||
27 | + | ||
28 | + public ExcelErrorProcessor(Map<String, ExcelCol> headSchema){ | ||
29 | + headIndex = new HashMap<String,Integer>(headSchema.size()); | ||
30 | + for(String str:headSchema.keySet()){ | ||
31 | + headIndex.put(headSchema.get(str).getCode(),HSSFSheetHandler.toNumber(str)); //存入的是code,待定 zwj,数据存的是位置 | ||
32 | + } | ||
33 | + headIndex.put("RAWREF", headSchema.size()); | ||
34 | + headIndex.put("ERRMSG", headSchema.size()+1); | ||
35 | + workbook = new SXSSFWorkbook(100); | ||
36 | + workbook.setCompressTempFiles(true); | ||
37 | + errorSheet = workbook.createSheet("错误信息"); | ||
38 | + p = (XSSFDrawing) errorSheet.createDrawingPatriarch(); | ||
39 | + Row row = errorSheet.createRow(next++); | ||
40 | + Cell cell =null; | ||
41 | + //因为现在不读取原数据,所以去掉 | ||
42 | +// for(ExcelCol col:headSchema.values()){ | ||
43 | +// Integer theIndex = headIndex.get(col.getCode()); | ||
44 | +// if(theIndex!=null){ | ||
45 | +// cell = row.createCell(theIndex); | ||
46 | +// cell.setCellValue(col.getName()); | ||
47 | +// | ||
48 | +// } | ||
49 | +// } | ||
50 | +// int start = headSchema.size(); | ||
51 | + int start = 0; | ||
52 | + cell = row.createCell(start); | ||
53 | + cell.setCellValue("原excel位置"); | ||
54 | + cell = row.createCell(start+1); | ||
55 | + cell.setCellValue("报错信息"); | ||
56 | + | ||
57 | + } | ||
58 | + | ||
59 | + //ExcelResult result | ||
60 | + public void flushErrors(List<Map<String,Object>> errorRows){ | ||
61 | + if(errorRows!=null&&errorRows.size()>0){ | ||
62 | + for(Map<String,Object> rowVal:errorRows){ | ||
63 | + Row row = errorSheet.createRow(next++); | ||
64 | + Cell cell =null; | ||
65 | + for(String name:rowVal.keySet()){ | ||
66 | + Integer theIndex = headIndex.get(name); | ||
67 | + if(theIndex!=null){ | ||
68 | + cell = row.createCell(theIndex); | ||
69 | + Object val = rowVal.get(name); | ||
70 | + if(val==null){ | ||
71 | + cell.setCellValue(""); | ||
72 | + }else{ | ||
73 | + cell.setCellValue(val.toString()); | ||
74 | + } | ||
75 | + } | ||
76 | + } | ||
77 | + } | ||
78 | + } | ||
79 | + } | ||
80 | + | ||
81 | + public void flushErrors(ExcelResult result){ | ||
82 | + Map<String,String> errMsgMap = result.getErrMsgMap(); | ||
83 | + List<Map<String, Object>> errRows = result.getErrRows(); | ||
84 | + Cell cell =null; | ||
85 | + | ||
86 | + for(Map<String, Object> map: errRows){ | ||
87 | + Row row = errorSheet.createRow(next++); | ||
88 | + for(Map.Entry<String, Object> entry : map.entrySet()){ | ||
89 | + Integer theIndex = headIndex.get(entry.getKey()); | ||
90 | + if(theIndex!=null){ | ||
91 | + cell = row.createCell(theIndex); | ||
92 | + Object val = entry.getValue(); | ||
93 | + if(val==null){ | ||
94 | + cell.setCellValue(""); | ||
95 | + }else{ | ||
96 | + cell.setCellValue(val.toString()); | ||
97 | + } | ||
98 | + } | ||
99 | + } | ||
100 | + | ||
101 | + } | ||
102 | + | ||
103 | + for(Map.Entry<String, String> entry:errMsgMap.entrySet()){ | ||
104 | + Row row = errorSheet.createRow(next++); | ||
105 | + cell = row.createCell(0); | ||
106 | + cell.setCellValue(entry.getKey()); | ||
107 | + cell = row.createCell(1); | ||
108 | + cell.setCellValue(entry.getValue()); | ||
109 | + } | ||
110 | +// cell.setCellComment(comment); | ||
111 | +// SXSSFComment | ||
112 | + | ||
113 | +// | ||
114 | +// // 前四个参数是坐标点,后四个参数是编辑和显示批注时的大小. | ||
115 | +// XSSFComment comment = p.createCellComment(new XSSFClientAnchor(0, 0, 0, | ||
116 | +// 0, (short) 3, 3, (short) 5, 6)); | ||
117 | +// // 输入批注信息 | ||
118 | +// comment.setString(new XSSFRichTextString("这是批注内容!")); | ||
119 | +// comment.setString(new XSSFRichTextString("这是批注内容!")); | ||
120 | +// // 添加作者,选中B5单元格,看状态栏 | ||
121 | +// comment.setAuthor("toad"); | ||
122 | +// // 将批注添加到单元格对象中 | ||
123 | +// if(cell != null){ | ||
124 | +// cell.setCellComment(comment); | ||
125 | +// } | ||
126 | + | ||
127 | + } | ||
128 | + | ||
129 | + public void flushErrors2Excel(ExcelResult result, String groupId){ | ||
130 | + flushErrors(result); | ||
131 | + String filePath =result.getFilePath(); | ||
132 | + String fileName =result.getFileName(); | ||
133 | + File file = new File(filePath,fileName); | ||
134 | + write(file); | ||
135 | + | ||
136 | + } | ||
137 | + | ||
138 | + /** | ||
139 | + * 请用OutputStream接收SXSSFWorkbook | ||
140 | + * eg: | ||
141 | + * OutputStream ouputStream = response.getOutputStream(); | ||
142 | + * workbook.write(stream); | ||
143 | + * @param result | ||
144 | + * @param groupId | ||
145 | + * @return excel格式对象 | ||
146 | + */ | ||
147 | + public SXSSFWorkbook flushErrors(ExcelResult result, String groupId){ | ||
148 | + flushErrors(result); | ||
149 | + return workbook; | ||
150 | + } | ||
151 | + | ||
152 | + | ||
153 | + void write(File file){ | ||
154 | + FileOutputStream stream =null; | ||
155 | + try { | ||
156 | + stream = new FileOutputStream(file); | ||
157 | + stream.flush(); | ||
158 | + workbook.write(stream); | ||
159 | + stream.close(); | ||
160 | + } catch (Exception e) { | ||
161 | + e.printStackTrace(); | ||
162 | + }finally{ | ||
163 | + IOUtils.closeQuietly(stream); | ||
164 | + } | ||
165 | + } | ||
166 | + | ||
167 | +} |
1 | +package cn.runsa.crmapp.base.excel.core; | ||
2 | + | ||
3 | +import java.util.ArrayList; | ||
4 | +import java.util.List; | ||
5 | +import java.util.Map; | ||
6 | + | ||
7 | +import org.apache.commons.lang3.builder.ToStringBuilder; | ||
8 | + | ||
9 | +/** | ||
10 | + * excel导入结果 | ||
11 | + * @author Stephen | ||
12 | + */ | ||
13 | +public class ExcelResult { | ||
14 | + | ||
15 | + private Integer total; //总行数 | ||
16 | + | ||
17 | + private Integer error; //错误行数 | ||
18 | + | ||
19 | + private String fileName; //错误的文件名称 | ||
20 | + private String filePath; //错误的文件名称 | ||
21 | + | ||
22 | + private String uuid; //不知道 | ||
23 | + | ||
24 | + private Map<String,String> errMsgMap; //错误消息,应该是需要写到文件中的 | ||
25 | + | ||
26 | + //是不是需要存错误行数 | ||
27 | + private List<Map<String, Object>> errRows = new ArrayList<Map<String, Object>>(); | ||
28 | + | ||
29 | + | ||
30 | + public Integer getTotal() { | ||
31 | + return total; | ||
32 | + } | ||
33 | + | ||
34 | + public void setTotal(Integer total) { | ||
35 | + this.total = total; | ||
36 | + } | ||
37 | + | ||
38 | + public Integer getError() { | ||
39 | + return error; | ||
40 | + } | ||
41 | + | ||
42 | + public void setError(Integer error) { | ||
43 | + this.error = error; | ||
44 | + } | ||
45 | + | ||
46 | + public String getUuid() { | ||
47 | + return uuid; | ||
48 | + } | ||
49 | + | ||
50 | + public void setUuid(String uuid) { | ||
51 | + this.uuid = uuid; | ||
52 | + } | ||
53 | + | ||
54 | + public Map<String, String> getErrMsgMap() { | ||
55 | + return errMsgMap; | ||
56 | + } | ||
57 | + | ||
58 | + public void setErrMsgMap(Map<String, String> errMsgMap) { | ||
59 | + this.errMsgMap = errMsgMap; | ||
60 | + } | ||
61 | + | ||
62 | + public List<Map<String, Object>> getErrRows() { | ||
63 | + return errRows; | ||
64 | + } | ||
65 | + | ||
66 | + public void setErrRows(List<Map<String, Object>> errRows) { | ||
67 | + this.errRows = errRows; | ||
68 | + } | ||
69 | + | ||
70 | + public String getFileName() { | ||
71 | + return fileName; | ||
72 | + } | ||
73 | + | ||
74 | + public void setFileName(String fileName) { | ||
75 | + this.fileName = fileName; | ||
76 | + } | ||
77 | + | ||
78 | + public String getFilePath() { | ||
79 | + return filePath; | ||
80 | + } | ||
81 | + | ||
82 | + public void setFilePath(String filePath) { | ||
83 | + this.filePath = filePath; | ||
84 | + } | ||
85 | + | ||
86 | + @Override | ||
87 | + public String toString() { | ||
88 | + return ToStringBuilder.reflectionToString(this); | ||
89 | + } | ||
90 | + | ||
91 | +} |
1 | +package cn.runsa.crmapp.base.excel.core; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | + | ||
5 | +public class ExcelSchema { | ||
6 | + | ||
7 | + private String code; | ||
8 | + | ||
9 | + private String title; | ||
10 | + | ||
11 | + private String targetTableName; | ||
12 | + | ||
13 | + private List<ExcelCol> columns; | ||
14 | + | ||
15 | + public String getCode() { | ||
16 | + return code; | ||
17 | + } | ||
18 | + | ||
19 | + public void setCode(String code) { | ||
20 | + this.code = code; | ||
21 | + } | ||
22 | + | ||
23 | + public String getTitle() { | ||
24 | + return title; | ||
25 | + } | ||
26 | + | ||
27 | + public void setTitle(String title) { | ||
28 | + this.title = title; | ||
29 | + } | ||
30 | + | ||
31 | + public List<ExcelCol> getColumns() { | ||
32 | + return columns; | ||
33 | + } | ||
34 | + | ||
35 | + public void setColumns(List<ExcelCol> columns) { | ||
36 | + this.columns = columns; | ||
37 | + } | ||
38 | + | ||
39 | + public String getTargetTableName() { | ||
40 | + return targetTableName; | ||
41 | + } | ||
42 | + | ||
43 | + public void setTargetTableName(String targetTableName) { | ||
44 | + this.targetTableName = targetTableName; | ||
45 | + } | ||
46 | + | ||
47 | +} |
1 | +package cn.runsa.crmapp.base.excel.core; | ||
2 | + | ||
3 | +import java.io.File; | ||
4 | +import java.io.FileInputStream; | ||
5 | +import java.io.IOException; | ||
6 | +import java.io.InputStream; | ||
7 | +import org.apache.commons.io.IOUtils; | ||
8 | +import org.apache.commons.lang.StringUtils; | ||
9 | +import org.apache.poi.hssf.usermodel.HSSFSheet; | ||
10 | +import org.apache.poi.hssf.usermodel.HSSFWorkbook; | ||
11 | +import org.apache.poi.openxml4j.opc.OPCPackage; | ||
12 | +import org.apache.poi.openxml4j.opc.PackageAccess; | ||
13 | +import org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable; | ||
14 | +import org.apache.poi.xssf.eventusermodel.XSSFReader; | ||
15 | +import org.apache.poi.xssf.model.StylesTable; | ||
16 | +import org.dom4j.Document; | ||
17 | +import org.dom4j.Element; | ||
18 | +import org.dom4j.io.SAXReader; | ||
19 | +import org.slf4j.Logger; | ||
20 | +import org.slf4j.LoggerFactory; | ||
21 | +import org.xml.sax.InputSource; | ||
22 | +import org.xml.sax.XMLReader; | ||
23 | +import org.xml.sax.helpers.XMLReaderFactory; | ||
24 | + | ||
25 | +import cn.runsa.crmapp.base.excel.exception.ExcelException; | ||
26 | +import cn.runsa.crmapp.base.excel.support.DefaultSheetContentsHandler; | ||
27 | + | ||
28 | +/** | ||
29 | + * excel处理工具类 | ||
30 | + * @author Stephen | ||
31 | + */ | ||
32 | +public class ExcelUtils { | ||
33 | + | ||
34 | + private static final Logger log = LoggerFactory.getLogger(ExcelUtils.class); | ||
35 | + | ||
36 | + private static final SAXReader saxReader; | ||
37 | + | ||
38 | + static { | ||
39 | + saxReader = new SAXReader(); | ||
40 | + saxReader.setIncludeExternalDTDDeclarations(false); | ||
41 | + saxReader.setIncludeInternalDTDDeclarations(false); | ||
42 | + saxReader.setValidation(false); | ||
43 | + saxReader.setIgnoreComments(true); | ||
44 | + saxReader.setStripWhitespaceText(true); | ||
45 | + } | ||
46 | + //03 excel处理器 | ||
47 | + private static final HSSFSheetHandler handler = new HSSFSheetHandler(); | ||
48 | + | ||
49 | + public static ExcelResult readExcel(File file, ExcelSchema schema,ExcelDataHandler dataHandler)throws ExcelException{ | ||
50 | + //检查文件 | ||
51 | + if (!file.exists()) { | ||
52 | + throw new ExcelException("文件不存在"); | ||
53 | + } | ||
54 | + if (!file.canRead()) { | ||
55 | + throw new ExcelException("文件不可读"); | ||
56 | + } | ||
57 | + //检查文件类型 | ||
58 | + String fileName = file.getName(); | ||
59 | + boolean isE2003 = false; | ||
60 | + if (StringUtils.isBlank(fileName)) { | ||
61 | + throw new ExcelException("无效的文件名,文件名不能为空"); | ||
62 | + } else if (fileName.endsWith("xlsx")) { | ||
63 | + isE2003 = false; | ||
64 | + } else if (fileName.endsWith("xls")) { | ||
65 | + isE2003 = true; | ||
66 | + } else { | ||
67 | + throw new ExcelException("无效的文件类型"); | ||
68 | + } | ||
69 | + //检查excel模型 | ||
70 | + if (schema == null) { | ||
71 | + throw new ExcelException("缺少excel表头信息,请配置数据库"); | ||
72 | + } | ||
73 | + if (dataHandler == null) { | ||
74 | + throw new ExcelException("缺少excel处理方法"); | ||
75 | + } | ||
76 | + SheetContentsHandler processor = new DefaultSheetContentsHandler(dataHandler, schema); | ||
77 | + if (isE2003) { | ||
78 | + FileInputStream stream = null; | ||
79 | + try { | ||
80 | + stream = new FileInputStream(file); | ||
81 | + //poi 2003 HSSFWorkbook | ||
82 | + HSSFWorkbook workbook = new HSSFWorkbook(stream); | ||
83 | + //目前仅处理第一个sheet | ||
84 | + HSSFSheet sheet = workbook.getSheetAt(0); | ||
85 | + handler.parse(processor,sheet); | ||
86 | + return processor.finish(); | ||
87 | + }catch(ExcelException ee) { | ||
88 | + throw ee; | ||
89 | + }catch (Exception e) { | ||
90 | + log.error("excel处理失败", e); | ||
91 | + throw new ExcelException("excel处理失败"); | ||
92 | + } finally { | ||
93 | + IOUtils.closeQuietly(stream); | ||
94 | + } | ||
95 | + } else { | ||
96 | + OPCPackage pkg = null; | ||
97 | + InputStream sheet = null; | ||
98 | + try { | ||
99 | + pkg = OPCPackage.open(file, PackageAccess.READ); | ||
100 | + XSSFReader reader = new XSSFReader(pkg); | ||
101 | + StylesTable style = reader.getStylesTable(); | ||
102 | + XMLReader parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser"); | ||
103 | + //字符串常量池 | ||
104 | + ReadOnlySharedStringsTable stringValueHandler = new ReadOnlySharedStringsTable(pkg); | ||
105 | + XSSFSheetXMLHandler xmlHandler = new XSSFSheetXMLHandler(style,stringValueHandler, processor); | ||
106 | + parser.setContentHandler(xmlHandler); | ||
107 | + Document doc = saxReader.read(reader.getWorkbookData()); | ||
108 | + Element root = doc.getRootElement(); | ||
109 | + Element sheets = root.element("sheets"); | ||
110 | + Element thisSheet = sheets.element("sheet"); | ||
111 | + String id = thisSheet.attributeValue("id"); | ||
112 | + sheet = reader.getSheet(id); | ||
113 | + InputSource sheetSource = new InputSource(sheet); | ||
114 | + parser.parse(sheetSource); | ||
115 | + return processor.finish(); | ||
116 | + }catch(ExcelException ee) { | ||
117 | + throw ee; | ||
118 | + } catch (Exception e) { | ||
119 | + log.error("excel处理失败", e); | ||
120 | + throw new ExcelException("excel处理失败"); | ||
121 | + } finally { | ||
122 | + IOUtils.closeQuietly(sheet); | ||
123 | + //todo | ||
124 | + try { | ||
125 | + pkg.close(); | ||
126 | + } catch (IOException e) { | ||
127 | + // TODO Auto-generated catch block | ||
128 | + e.printStackTrace(); | ||
129 | + } | ||
130 | + } | ||
131 | + } | ||
132 | + | ||
133 | + } | ||
134 | + | ||
135 | +} |
1 | +package cn.runsa.crmapp.base.excel.core; | ||
2 | + | ||
3 | +import java.math.BigDecimal; | ||
4 | +import java.util.Iterator; | ||
5 | + | ||
6 | +import org.apache.poi.hssf.usermodel.HSSFCell; | ||
7 | +import org.apache.poi.hssf.usermodel.HSSFRow; | ||
8 | +import org.apache.poi.hssf.usermodel.HSSFSheet; | ||
9 | +import org.apache.poi.ss.usermodel.Cell; | ||
10 | +import org.apache.poi.ss.usermodel.CellStyle; | ||
11 | +import org.apache.poi.ss.usermodel.DateUtil; | ||
12 | + | ||
13 | +import cn.runsa.crmapp.base.excel.exception.ExcelException; | ||
14 | +/** | ||
15 | + * 处理excel97-03版本 | ||
16 | + * @author stephen | ||
17 | + */ | ||
18 | +public class HSSFSheetHandler { | ||
19 | + | ||
20 | + private static final char[] digits = { 'A', 'B', 'C', 'D', 'E', 'F', 'G','H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T','U', 'V', 'W', 'X', 'Y', 'Z' }; | ||
21 | + | ||
22 | + /** | ||
23 | + * 解析excel文件 | ||
24 | + * @throws ExcelException | ||
25 | + */ | ||
26 | + public void parse(SheetContentsHandler contentHandler, HSSFSheet sheet) throws ExcelException { | ||
27 | + int first = sheet.getFirstRowNum(); | ||
28 | + int last = sheet.getLastRowNum(); | ||
29 | + if (last - first < 1) | ||
30 | + throw new ExcelException("excel内容为空"); | ||
31 | + for (int i = first; i <= last; i++) { | ||
32 | + HSSFRow row = sheet.getRow(i); | ||
33 | + //开始行 | ||
34 | + contentHandler.startRow(i); | ||
35 | + Iterator<Cell> cells = row.cellIterator(); | ||
36 | + while (cells.hasNext()) { | ||
37 | + HSSFCell cell = (HSSFCell) cells.next(); | ||
38 | + String cellRef = getABCNumber(cell.getColumnIndex()); | ||
39 | + String cellVal = null; | ||
40 | + int type = cell.getCellType(); | ||
41 | + //不处理公式,error类型 | ||
42 | + switch (type) { | ||
43 | + case Cell.CELL_TYPE_BOOLEAN: | ||
44 | + cellVal = String.valueOf(cell.getBooleanCellValue()); | ||
45 | + break; | ||
46 | + case Cell.CELL_TYPE_NUMERIC: | ||
47 | + //如果是时间 | ||
48 | + if (isDateFormat(cell)) { | ||
49 | + cellVal = SheetContentsHandler.DATE_PREFIX+cell.getDateCellValue().getTime(); | ||
50 | + } else { | ||
51 | + BigDecimal bd = new BigDecimal(cell.getNumericCellValue()); | ||
52 | + cellVal = bd.toPlainString(); | ||
53 | + } | ||
54 | + break; | ||
55 | + case Cell.CELL_TYPE_STRING: | ||
56 | + cellVal = cell.getStringCellValue(); | ||
57 | + break; | ||
58 | + default: | ||
59 | + break; | ||
60 | + } | ||
61 | + contentHandler.cell(cellRef, cellVal); | ||
62 | + } | ||
63 | + contentHandler.endRow(); | ||
64 | + } | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * 将列号转换为excel统一格式,如A,B,AB等 | ||
69 | + * @param number | ||
70 | + * @return | ||
71 | + */ | ||
72 | + public static String getABCNumber(int number) { | ||
73 | + if (number < 26) { | ||
74 | + return String.valueOf(digits[number]); | ||
75 | + } else { | ||
76 | + StringBuilder sb = new StringBuilder(); | ||
77 | + do { | ||
78 | + int a = number % 26; | ||
79 | + sb.append(digits[a]); | ||
80 | + number /= 26; | ||
81 | + number--; | ||
82 | + } while (number > 25); | ||
83 | + sb.append(digits[number]); | ||
84 | + return sb.reverse().toString(); | ||
85 | + } | ||
86 | + } | ||
87 | + /** | ||
88 | + * 将excel统一列号转换为十进制数 | ||
89 | + * @param excelNum | ||
90 | + * @return | ||
91 | + */ | ||
92 | + public static int toNumber(String excelNum) { | ||
93 | + byte[] abcs = excelNum.getBytes(); | ||
94 | + int number = 0; | ||
95 | + if(abcs.length == 1){ | ||
96 | + number = index(abcs[0]); | ||
97 | + }else{ | ||
98 | + int total = abcs.length-1; | ||
99 | + for(int i = 0;i<total;i++){ | ||
100 | + number=(int) (number+(index(abcs[i])+1)*Math.pow(26, total-i)); | ||
101 | + } | ||
102 | + number+=index(abcs[total]); | ||
103 | + } | ||
104 | + return number; | ||
105 | + } | ||
106 | + | ||
107 | + /** | ||
108 | + * 给定字符的序号 | ||
109 | + * @param abc | ||
110 | + * @return | ||
111 | + */ | ||
112 | + private static int index(byte abc) { | ||
113 | + return abc-65; | ||
114 | + } | ||
115 | + /** | ||
116 | + * 判断是否是时间 | ||
117 | + * @param cell | ||
118 | + * @return | ||
119 | + */ | ||
120 | + private boolean isDateFormat(Cell cell) { | ||
121 | + if (cell == null) | ||
122 | + return false; | ||
123 | + boolean bDate = false; | ||
124 | + double d = cell.getNumericCellValue(); | ||
125 | + if (DateUtil.isValidExcelDate(d)) { | ||
126 | + CellStyle style = cell.getCellStyle(); | ||
127 | + if (style == null) | ||
128 | + return false; | ||
129 | + int i = style.getDataFormat(); | ||
130 | + bDate = i >= 0x0e && i <= 0x24; | ||
131 | + } | ||
132 | + return bDate; | ||
133 | + } | ||
134 | + | ||
135 | +} |
1 | +package cn.runsa.crmapp.base.excel.core; | ||
2 | + | ||
3 | +import cn.runsa.crmapp.base.excel.exception.ExcelException; | ||
4 | + | ||
5 | + | ||
6 | +/** | ||
7 | + * @author stephen | ||
8 | + * excel内容处理器,事件驱动 | ||
9 | + */ | ||
10 | +public interface SheetContentsHandler { | ||
11 | + | ||
12 | + public static final String DATE_PREFIX = "@Date"; | ||
13 | + | ||
14 | + /** | ||
15 | + * 开始一行 | ||
16 | + * @param rowNum 行号,0开始 | ||
17 | + */ | ||
18 | + void startRow(int rowNum); | ||
19 | + /** | ||
20 | + * 行结束 | ||
21 | + */ | ||
22 | + void endRow() throws ExcelException; | ||
23 | + /** | ||
24 | + * 获取单元格 | ||
25 | + * @param cellReference 单元格位置 | ||
26 | + * @param formattedValue 格式化的字符串值 | ||
27 | + */ | ||
28 | + String cell(String cellReference, String formattedValue); | ||
29 | + /** | ||
30 | + * excel读取完成 | ||
31 | + * @return | ||
32 | + */ | ||
33 | + ExcelResult finish(); | ||
34 | +} |
1 | +package cn.runsa.crmapp.base.excel.core; | ||
2 | + | ||
3 | +import java.math.BigDecimal; | ||
4 | +import java.util.Date; | ||
5 | + | ||
6 | +import org.apache.poi.ss.usermodel.BuiltinFormats; | ||
7 | +import org.apache.poi.ss.usermodel.DateUtil; | ||
8 | +import org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable; | ||
9 | +import org.apache.poi.xssf.model.StylesTable; | ||
10 | +import org.apache.poi.xssf.usermodel.XSSFCellStyle; | ||
11 | +import org.apache.poi.xssf.usermodel.XSSFRichTextString; | ||
12 | +import org.xml.sax.Attributes; | ||
13 | +import org.xml.sax.SAXException; | ||
14 | +import org.xml.sax.helpers.DefaultHandler; | ||
15 | + | ||
16 | +import cn.runsa.crmapp.base.excel.exception.ExcelException; | ||
17 | + | ||
18 | +public class XSSFSheetXMLHandler extends DefaultHandler { | ||
19 | + | ||
20 | + enum xssfDataType { | ||
21 | + BOOLEAN, ERROR, FORMULA, INLINE_STRING, SST_STRING, NUMBER; | ||
22 | + } | ||
23 | + //sheet样式表 | ||
24 | + private StylesTable stylesTable; | ||
25 | + //字符串常量池 | ||
26 | + private ReadOnlySharedStringsTable sharedStringsTable; | ||
27 | + //excel内容处理器 | ||
28 | + private final SheetContentsHandler output; | ||
29 | + | ||
30 | + // V开始 | ||
31 | + private boolean vIsOpen; | ||
32 | + // F开始 | ||
33 | + private boolean fIsOpen; | ||
34 | + // Inline String 开始 | ||
35 | + private boolean isIsOpen; | ||
36 | + | ||
37 | + private xssfDataType nextDataType; | ||
38 | + | ||
39 | + private short formatIndex; | ||
40 | + private String formatString; | ||
41 | + private String cellRef; | ||
42 | + | ||
43 | + private StringBuffer value = new StringBuffer(); | ||
44 | + private StringBuffer formula = new StringBuffer(); | ||
45 | + | ||
46 | + /** | ||
47 | + * Accepts objects needed while parsing. | ||
48 | + * | ||
49 | + * @param styles | ||
50 | + * Table of styles | ||
51 | + * @param strings | ||
52 | + * Table of shared strings | ||
53 | + */ | ||
54 | + public XSSFSheetXMLHandler(StylesTable styles,ReadOnlySharedStringsTable strings,SheetContentsHandler sheetContentsHandler) { | ||
55 | + this.stylesTable = styles; | ||
56 | + this.sharedStringsTable = strings; | ||
57 | + this.output = sheetContentsHandler; | ||
58 | + this.nextDataType = xssfDataType.NUMBER; | ||
59 | + } | ||
60 | + | ||
61 | + private boolean isTextTag(String name) { | ||
62 | + if ("v".equals(name)) { | ||
63 | + return true; | ||
64 | + } | ||
65 | + if ("inlineStr".equals(name)) { | ||
66 | + return true; | ||
67 | + } | ||
68 | + if ("t".equals(name) && isIsOpen) { | ||
69 | + return true; | ||
70 | + } | ||
71 | + return false; | ||
72 | + } | ||
73 | + | ||
74 | + public void startElement(String uri, String localName, String name,Attributes attributes) throws SAXException { | ||
75 | + if (isTextTag(name)) { | ||
76 | + vIsOpen = true; | ||
77 | + // Clear | ||
78 | + value.setLength(0); | ||
79 | + } else if ("is".equals(name)) { | ||
80 | + isIsOpen = true; | ||
81 | + } else if ("f".equals(name)) { | ||
82 | + // Clear | ||
83 | + formula.setLength(0); | ||
84 | + | ||
85 | + //标记将要处理公式 | ||
86 | + if (nextDataType == xssfDataType.NUMBER) { | ||
87 | + nextDataType = xssfDataType.FORMULA; | ||
88 | + } | ||
89 | + // 公式类型 | ||
90 | + String type = attributes.getValue("t"); | ||
91 | + if (type != null && type.equals("shared")) { | ||
92 | + String ref = attributes.getValue("ref"); | ||
93 | + //如果有引用 | ||
94 | + if (ref != null) { | ||
95 | + fIsOpen = true; | ||
96 | + } | ||
97 | + } else { | ||
98 | + fIsOpen = true; | ||
99 | + } | ||
100 | + } else if ("row".equals(name)) { | ||
101 | + //开始行 | ||
102 | + int rowNum = Integer.parseInt(attributes.getValue("r")) - 1; | ||
103 | + output.startRow(rowNum); | ||
104 | + } | ||
105 | + //开始单元格 | ||
106 | + else if ("c".equals(name)) { | ||
107 | + //默认number. | ||
108 | + this.nextDataType = xssfDataType.NUMBER; | ||
109 | + this.formatIndex = -1; | ||
110 | + this.formatString = null; | ||
111 | + cellRef = attributes.getValue("r");//.replaceAll("\\d", ""); | ||
112 | + String cellType = attributes.getValue("t"); | ||
113 | + String cellStyleStr = attributes.getValue("s"); | ||
114 | + if ("b".equals(cellType)) | ||
115 | + nextDataType = xssfDataType.BOOLEAN; | ||
116 | + else if ("e".equals(cellType)) | ||
117 | + nextDataType = xssfDataType.ERROR; | ||
118 | + else if ("inlineStr".equals(cellType)) | ||
119 | + nextDataType = xssfDataType.INLINE_STRING; | ||
120 | + else if ("s".equals(cellType)) | ||
121 | + nextDataType = xssfDataType.SST_STRING; | ||
122 | + else if ("str".equals(cellType)) | ||
123 | + nextDataType = xssfDataType.FORMULA; | ||
124 | + else if (cellStyleStr != null) { | ||
125 | + //带有样式的内容 | ||
126 | + int styleIndex = Integer.parseInt(cellStyleStr); | ||
127 | + XSSFCellStyle style = stylesTable.getStyleAt(styleIndex); | ||
128 | + this.formatIndex = style.getDataFormat(); | ||
129 | + this.formatString = style.getDataFormatString(); | ||
130 | + if (this.formatString == null) | ||
131 | + this.formatString = BuiltinFormats.getBuiltinFormat(this.formatIndex); | ||
132 | + } | ||
133 | + } | ||
134 | + } | ||
135 | + | ||
136 | + public void endElement(String uri, String localName, String name)throws ExcelException,SAXException { | ||
137 | + String thisStr = null; | ||
138 | + //读取excel文本内容(excel以xml格式存储,会有字段标记此单元格的) | ||
139 | + if (isTextTag(name)) { | ||
140 | + vIsOpen = false; | ||
141 | + switch (nextDataType) { | ||
142 | + case BOOLEAN: | ||
143 | + char first = value.charAt(0); | ||
144 | + thisStr = first == '0' ? "false" : "true"; | ||
145 | + break; | ||
146 | + | ||
147 | + case INLINE_STRING: | ||
148 | + XSSFRichTextString rtsi = new XSSFRichTextString(value.toString()); | ||
149 | + thisStr = rtsi.toString(); | ||
150 | + break; | ||
151 | + | ||
152 | + case SST_STRING: | ||
153 | + String sstIndex = value.toString(); | ||
154 | + try { | ||
155 | + int idx = Integer.parseInt(sstIndex); | ||
156 | + XSSFRichTextString rtss = new XSSFRichTextString(sharedStringsTable.getEntryAt(idx)); | ||
157 | + thisStr = rtss.toString(); | ||
158 | + } catch (NumberFormatException ex) { | ||
159 | + //undo | ||
160 | + } | ||
161 | + break; | ||
162 | + | ||
163 | + case NUMBER: | ||
164 | + String n = value.toString(); | ||
165 | + if (this.formatString != null) { | ||
166 | + //若为日期 | ||
167 | + if (this.formatIndex >= 0x0e && this.formatIndex <= 0x24) { | ||
168 | + Date date = DateUtil.getJavaDate(Double.parseDouble(n)); | ||
169 | + thisStr = SheetContentsHandler.DATE_PREFIX+date.getTime(); | ||
170 | + } else { | ||
171 | + BigDecimal bd = new BigDecimal(n); | ||
172 | + thisStr = bd.toPlainString(); | ||
173 | + } | ||
174 | + } else | ||
175 | + thisStr = n; | ||
176 | + break; | ||
177 | + | ||
178 | + default: | ||
179 | + break; | ||
180 | + } | ||
181 | + output.cell(cellRef, thisStr); | ||
182 | + } else if ("f".equals(name)) { | ||
183 | + fIsOpen = false; | ||
184 | + } else if ("is".equals(name)) { | ||
185 | + isIsOpen = false; | ||
186 | + } else if ("row".equals(name)) { | ||
187 | + output.endRow(); | ||
188 | + } | ||
189 | + } | ||
190 | + | ||
191 | + public void characters(char[] ch, int start, int length) throws SAXException { | ||
192 | + if (vIsOpen) { | ||
193 | + value.append(ch, start, length); | ||
194 | + } | ||
195 | + if (fIsOpen) { | ||
196 | + formula.append(ch, start, length); | ||
197 | + } | ||
198 | + } | ||
199 | +} |
1 | +package cn.runsa.crmapp.base.excel.exception; | ||
2 | + | ||
3 | +import org.xml.sax.SAXException; | ||
4 | + | ||
5 | +@SuppressWarnings("serial") | ||
6 | +/** | ||
7 | + * excel处理异常 | ||
8 | + * @author stephen | ||
9 | + */ | ||
10 | +public class ExcelException extends SAXException { | ||
11 | + | ||
12 | + public ExcelException() { | ||
13 | + super(); | ||
14 | + } | ||
15 | + | ||
16 | + public ExcelException(Exception e) { | ||
17 | + super(e); | ||
18 | + } | ||
19 | + | ||
20 | + public ExcelException(String message, Exception e) { | ||
21 | + super(message, e); | ||
22 | + } | ||
23 | + | ||
24 | + public ExcelException(String message) { | ||
25 | + super(message); | ||
26 | + } | ||
27 | +} |
crm/crm-base/src/main/java/cn/runsa/crmapp/base/excel/support/DefaultSheetContentsHandler.java
0 → 100644
1 | +package cn.runsa.crmapp.base.excel.support; | ||
2 | + | ||
3 | +import java.text.SimpleDateFormat; | ||
4 | +import java.util.ArrayList; | ||
5 | +import java.util.Collection; | ||
6 | +import java.util.Date; | ||
7 | +import java.util.HashMap; | ||
8 | +import java.util.HashSet; | ||
9 | +import java.util.List; | ||
10 | +import java.util.Map; | ||
11 | +import java.util.Random; | ||
12 | +import java.util.Set; | ||
13 | +import java.util.UUID; | ||
14 | + | ||
15 | +import org.apache.commons.lang3.StringUtils; | ||
16 | + | ||
17 | +import cn.runsa.crmapp.base.excel.core.Converter; | ||
18 | +import cn.runsa.crmapp.base.excel.core.ConverterRegistry; | ||
19 | +import cn.runsa.crmapp.base.excel.core.ExcelCol; | ||
20 | +import cn.runsa.crmapp.base.excel.core.ExcelDataHandler; | ||
21 | +import cn.runsa.crmapp.base.excel.core.ExcelErrorProcessor; | ||
22 | +import cn.runsa.crmapp.base.excel.core.ExcelResult; | ||
23 | +import cn.runsa.crmapp.base.excel.core.ExcelSchema; | ||
24 | +import cn.runsa.crmapp.base.excel.core.SheetContentsHandler; | ||
25 | +import cn.runsa.crmapp.base.excel.exception.ExcelException; | ||
26 | + | ||
27 | +/** | ||
28 | + * @author Stephen | ||
29 | + */ | ||
30 | +public class DefaultSheetContentsHandler implements SheetContentsHandler,ConverterRegistry{ | ||
31 | + | ||
32 | + //类型转换 | ||
33 | + private static GeneralConvertService convertService = new GeneralConvertService(); | ||
34 | + //处理获取的数据 | ||
35 | + private ExcelDataHandler dataHandler; | ||
36 | + | ||
37 | + private volatile boolean isHead = true; | ||
38 | + | ||
39 | + private volatile boolean isError = false; | ||
40 | + private volatile boolean isRowError = false; //废弃,直接用current.keySet().containsAll(requiredCols) | ||
41 | + | ||
42 | + private volatile String errMsg; | ||
43 | + private Map<String,String> errMsgMap = new HashMap<String,String>(); | ||
44 | + | ||
45 | + private volatile int totalRow = 0; //总行数 | ||
46 | +// private volatile int errorRow = 0; //错误行数 | ||
47 | + //全部列 废弃,用schema.getColumns()获取 ,同时为了和headSchema做区别 2016-05-16 | ||
48 | + // private volatile List<ExcelCol> thead; //excel的表头,从db中获取 | ||
49 | + | ||
50 | + //sheet页的code,以此code,就可以推算出需要插入的表和存储过程 | ||
51 | + //eg: code 为user,则插入的表为user_excel,存储过程为: pro_user_excel(写法待定,但是肯定可以推导出) 废弃 | ||
52 | + //private String sheetCode; //废弃 ,用schema.getCode() 代替 -- 2016-05-16 | ||
53 | + | ||
54 | + //从db中获取的excel表结构.可能会和真实的excel不一致,因为有的列不是必填的 | ||
55 | + private ExcelSchema schema; | ||
56 | + | ||
57 | + private Map<String, ExcelCol> headSchema; //从excel中获取的表头,和db中获取的表头不一定对应 | ||
58 | + | ||
59 | + private final Set<String> requiredCols = new HashSet<String>(); | ||
60 | + //当前行数据 | ||
61 | + private Map<String, Object> current; | ||
62 | + //页中行数据 | ||
63 | + private final List<Map<String, Object>> rows ; | ||
64 | + //页中行数据 | ||
65 | + private final List<Map<String, Object>> errRows= new ArrayList<Map<String, Object>>(); | ||
66 | + | ||
67 | + ExcelErrorProcessor errorProcessor; | ||
68 | + | ||
69 | + //不知道原来id有什么用,准备作为group用,算了,自己定义一个吧 | ||
70 | +// private final String id = UUID.randomUUID().toString().replaceAll("-", ""); | ||
71 | + private final String groupId = (new SimpleDateFormat("yyyyMMddHHmmssSSS")).format(new Date())+ (new Random()).nextInt(9); | ||
72 | + | ||
73 | + | ||
74 | + //zwj 引入了ExcelSchema | ||
75 | +// public DefaultSheetContentsHandler(ExcelDataHandler dataHandler,List<ExcelCol> header,String sheetCode) { | ||
76 | +// this.dataHandler = dataHandler; | ||
77 | +// this.thead = header; | ||
78 | +// this.sheetCode = sheetCode; | ||
79 | +// rows = new ArrayList<Map<String, Object>>(dataHandler.getSizeOneTime()); | ||
80 | +// } | ||
81 | + | ||
82 | + public DefaultSheetContentsHandler(ExcelDataHandler dataHandler,ExcelSchema schema) { | ||
83 | + this.dataHandler = dataHandler; | ||
84 | +// this.thead = schema.getColumns(); 已废弃 | ||
85 | +// sheetCode = schema.getCode(); 已废弃 | ||
86 | + this.schema = schema; | ||
87 | + rows = new ArrayList<Map<String, Object>>(dataHandler.getSizeOneTime()); | ||
88 | + } | ||
89 | + | ||
90 | + @Override | ||
91 | + public void startRow(int rowNum) { | ||
92 | + current = new HashMap<String, Object>(); | ||
93 | + isError = false; | ||
94 | + isRowError = false; | ||
95 | + errMsg = null; | ||
96 | + if(!isHead){ | ||
97 | + totalRow++; | ||
98 | + current.put("ROWNUM", ++rowNum); | ||
99 | + } | ||
100 | + } | ||
101 | + /** | ||
102 | + * 表头处理 | ||
103 | + * @throws ExcelException | ||
104 | + */ | ||
105 | + public void headRowHandle() throws ExcelException{ | ||
106 | + | ||
107 | + //列名 | ||
108 | + List<String> cols = new ArrayList<String>(); | ||
109 | + //必填列名 | ||
110 | + List<String> required = new ArrayList<String>(); | ||
111 | + for (ExcelCol col : schema.getColumns()){ | ||
112 | + cols.add(col.getName()); | ||
113 | + if (!col.isNullable()){ | ||
114 | + required.add(col.getName()); | ||
115 | + requiredCols.add(col.getCode()); | ||
116 | + } | ||
117 | + } | ||
118 | + Collection<Object> row = current.values(); | ||
119 | + //出现超出范围的列 | ||
120 | + if(!cols.containsAll(row)){ | ||
121 | + throw new ExcelException("表头超出范围"); | ||
122 | + } | ||
123 | + //必填的列未出现 | ||
124 | + if(!row.containsAll(required)){ | ||
125 | + throw new ExcelException("缺少必填表头"); | ||
126 | + } | ||
127 | + headSchema = new HashMap<String,ExcelCol>(current.size()); | ||
128 | + for(String ref:current.keySet()){ | ||
129 | + String title = current.get(ref).toString(); | ||
130 | + for(ExcelCol col :schema.getColumns()){ | ||
131 | + if(title.equals(col.getName())){ | ||
132 | + headSchema.put(ref, col); | ||
133 | + break; | ||
134 | + } | ||
135 | + } | ||
136 | + } | ||
137 | + | ||
138 | + errorProcessor = new ExcelErrorProcessor(headSchema); | ||
139 | + | ||
140 | + for (ExcelCol col : headSchema.values()){ | ||
141 | + Class<?> type = col.getType(); | ||
142 | + if(!List.class.equals(type)&&!String.class.equals(type)){ | ||
143 | + if(!convertService.canConvert(type)){ | ||
144 | + throw new ExcelException("缺少类型转换器"); | ||
145 | + } | ||
146 | + } | ||
147 | + } | ||
148 | + } | ||
149 | + | ||
150 | + @Override | ||
151 | + public void endRow() throws ExcelException { | ||
152 | + if(isHead){ | ||
153 | + headRowHandle(); | ||
154 | + isHead = false; | ||
155 | + }else{ | ||
156 | + if(isRowError){ | ||
157 | + System.out.println("行格式错误"); | ||
158 | + errRows.add(current); | ||
159 | + }else if(!current.keySet().containsAll(requiredCols)){ | ||
160 | + System.out.println("行缺少必填项"); | ||
161 | + errRows.add(current); | ||
162 | + }else{ | ||
163 | + rows.add(current); | ||
164 | + if(rows.size()==dataHandler.getSizeOneTime()){ | ||
165 | + dataHandler.dataFetched(schema, groupId, rows); | ||
166 | + rows.clear(); | ||
167 | + } | ||
168 | + } | ||
169 | + } | ||
170 | + } | ||
171 | + | ||
172 | + @Override | ||
173 | + public String cell(String cellReference, String formattedValue) { | ||
174 | + String cellAbsoluteLocation = cellReference; | ||
175 | + errMsg = "内容["+formattedValue+"]"; | ||
176 | + cellReference = cellReference.replaceAll("\\d", ""); | ||
177 | + if(isError){ | ||
178 | + return errMsg; | ||
179 | + } | ||
180 | + if(isHead){ | ||
181 | + //非空 | ||
182 | + if(StringUtils.isNotBlank(formattedValue)){ | ||
183 | + current.put(cellReference, formattedValue.trim()); | ||
184 | + } | ||
185 | + }else{ | ||
186 | + ExcelCol col = headSchema.get(cellReference); | ||
187 | + if(StringUtils.isNotBlank(formattedValue)){ | ||
188 | + | ||
189 | + //没有表头,直接跳过 | ||
190 | + if(col == null){ | ||
191 | + return errMsg; | ||
192 | + } | ||
193 | + Class<?> type = col.getType(); | ||
194 | + String source = null; | ||
195 | + //第一阶段 格式化验证 开始 | ||
196 | + //最大长度 | ||
197 | + if(col.getMaxLength() !=null && formattedValue.length()>col.getMaxLength()){ | ||
198 | + errMsg += "不符合最大长度"+col.getMinLength()+"的要求;"; | ||
199 | + isError = true; | ||
200 | + } else | ||
201 | + //最小长度 | ||
202 | + if(col.getMinLength() !=null && formattedValue.length()<col.getMinLength()){ | ||
203 | + errMsg += "不符合最小长度"+col.getMinLength()+"的要求;"; | ||
204 | + isError = true; | ||
205 | + } | ||
206 | + //正则 | ||
207 | + if(col.getCompiledPattern()!=null){ | ||
208 | + if(!col.getCompiledPattern().matcher(formattedValue).matches()){ | ||
209 | + errMsg += "不符合格式规定;"; | ||
210 | + isError = true; | ||
211 | + } | ||
212 | + } | ||
213 | + //第一阶段检测报告 | ||
214 | + if(isError){ | ||
215 | +// errMsgList.add(errMsg); | ||
216 | + errMsgMap.put(cellAbsoluteLocation, errMsg); | ||
217 | + isError = false; | ||
218 | + isRowError = true; | ||
219 | + return errMsg; | ||
220 | + } | ||
221 | + //第一阶段 格式化验证结束 | ||
222 | + | ||
223 | + //第二阶段,数据类型转换开始 | ||
224 | + if(String.class.equals(type)){ | ||
225 | + current.put(col.getCode(), formattedValue); | ||
226 | + }else if(List.class.equals(type)){ | ||
227 | + //如果是内部枚举 | ||
228 | + Object val = col.getItems().get(formattedValue.trim()); | ||
229 | + //参数错误 | ||
230 | + if(val == null){ | ||
231 | + errMsg += "不在可选择范围内;"; | ||
232 | + isError = true; | ||
233 | + }else{ | ||
234 | + current.put(col.getCode(), val); | ||
235 | + } | ||
236 | + }else if(Date.class.equals(type)&&(source=formattedValue.trim()).startsWith(DATE_PREFIX)){ | ||
237 | + Date val = new Date(Long.parseLong(source.substring(DATE_PREFIX.length()))); | ||
238 | + current.put(col.getCode(), val); | ||
239 | + }else{ | ||
240 | + try{ | ||
241 | + Object val = convertService.convert(formattedValue, type); | ||
242 | + if(val == null){ | ||
243 | + isError = true; | ||
244 | + }else{ | ||
245 | + current.put(col.getCode(),val); | ||
246 | + } | ||
247 | + }catch(Exception e){ | ||
248 | + e.printStackTrace(); | ||
249 | + isError = true; | ||
250 | + errMsg += e.getMessage(); | ||
251 | + } | ||
252 | + } | ||
253 | + } | ||
254 | +// else{ | ||
255 | +// if(!col.isNullable()){ | ||
256 | +// errMsg += "不能为空;"; | ||
257 | +// } | ||
258 | +// } | ||
259 | + | ||
260 | + //第二阶段检测报告 | ||
261 | + if(isError){ | ||
262 | + errMsgMap.put(cellAbsoluteLocation, errMsg); | ||
263 | + isError = false; | ||
264 | + isRowError = true; | ||
265 | + return errMsg; | ||
266 | + } | ||
267 | + //第二阶段,数据类型转换结束 | ||
268 | + } | ||
269 | + | ||
270 | + return null; | ||
271 | + } | ||
272 | + | ||
273 | + @Override | ||
274 | + /** | ||
275 | + * zhangweijiang | ||
276 | + * 1. 处理最后几行数据(最后几行数据需要手动调用dataFetched,因为没有达到DEFAULT_SIZE大小) | ||
277 | + * 2. 把错误日志写入文件中 | ||
278 | + * 3. 调用存储过程 | ||
279 | + */ | ||
280 | + public ExcelResult finish() { | ||
281 | + if(rows.size()>0){ | ||
282 | + dataHandler.dataFetched(schema, groupId, rows); | ||
283 | + rows.clear(); | ||
284 | + } | ||
285 | + | ||
286 | + ExcelResult result = dataHandler.dataFinish(schema, headSchema, groupId); | ||
287 | + result.setTotal(totalRow); | ||
288 | + //需要包含ErrorProcessor处理的错误信息,如果没有报错就算了 | ||
289 | + if(result.getErrMsgMap()!=null && !result.getErrMsgMap().isEmpty() ){ | ||
290 | + errMsgMap.putAll(result.getErrMsgMap()); | ||
291 | + } | ||
292 | + result.setErrMsgMap(errMsgMap); | ||
293 | + result.setFileName(groupId+".xlsx"); //组号即为文件名称 | ||
294 | + Set<String> errRefSet = new HashSet<String>(); | ||
295 | + if(!errMsgMap.isEmpty()){ | ||
296 | + for(String celRef:errMsgMap.keySet()){ | ||
297 | + String rowRef = celRef.replaceAll("[a-zA-Z]",""); | ||
298 | + errRefSet.add(rowRef); | ||
299 | + } | ||
300 | + } | ||
301 | + result.setError(errRefSet.size()); | ||
302 | + result.setErrRows(errRows); | ||
303 | + errorProcessor.flushErrors2Excel(result,groupId); | ||
304 | + | ||
305 | + | ||
306 | + return result; | ||
307 | + } | ||
308 | + | ||
309 | + @Override | ||
310 | + public <T> void addConverter(Class<T> type, Converter<T> converter) { | ||
311 | + convertService.converts.put(type, converter); | ||
312 | + } | ||
313 | + | ||
314 | + @Override | ||
315 | + public void removeConvertible(Class<?> type) { | ||
316 | + convertService.converts.remove(type); | ||
317 | + } | ||
318 | + | ||
319 | + public String getErrMsg() { | ||
320 | + return errMsg; | ||
321 | + } | ||
322 | + | ||
323 | +} |
1 | +package cn.runsa.crmapp.base.excel.support; | ||
2 | + | ||
3 | +import java.math.BigDecimal; | ||
4 | +import java.math.BigInteger; | ||
5 | +import java.util.Date; | ||
6 | +import java.util.Map; | ||
7 | +import java.util.concurrent.ConcurrentHashMap; | ||
8 | + | ||
9 | +import cn.runsa.crmapp.base.excel.converter.BooleanConverter; | ||
10 | +import cn.runsa.crmapp.base.excel.converter.DateConverter; | ||
11 | +import cn.runsa.crmapp.base.excel.converter.NumberConverter; | ||
12 | +import cn.runsa.crmapp.base.excel.core.ConvertService; | ||
13 | +import cn.runsa.crmapp.base.excel.core.Converter; | ||
14 | + | ||
15 | +/** | ||
16 | + * @author Stephen | ||
17 | + */ | ||
18 | +public class GeneralConvertService implements ConvertService{ | ||
19 | + | ||
20 | + protected final Map<Class<?>,Converter<?>> converts; | ||
21 | + | ||
22 | + { | ||
23 | + converts = new ConcurrentHashMap<Class<?>,Converter<?>>(); | ||
24 | + converts.put(Boolean.class, new BooleanConverter()); | ||
25 | + converts.put(Date.class, new DateConverter()); | ||
26 | + converts.put(Byte.class, new NumberConverter<Byte>(Byte.class)); | ||
27 | + converts.put(Short.class, new NumberConverter<Short>(Short.class)); | ||
28 | + converts.put(Integer.class, new NumberConverter<Integer>(Integer.class)); | ||
29 | + converts.put(Long.class, new NumberConverter<Long>(Long.class)); | ||
30 | + converts.put(Float.class, new NumberConverter<Float>(Float.class)); | ||
31 | + converts.put(Double.class, new NumberConverter<Double>(Double.class)); | ||
32 | + converts.put(BigDecimal.class, new NumberConverter<BigDecimal>(BigDecimal.class)); | ||
33 | + converts.put(BigInteger.class, new NumberConverter<BigInteger>(BigInteger.class)); | ||
34 | + } | ||
35 | + | ||
36 | + @Override | ||
37 | + public boolean canConvert(Class<?> targetType) { | ||
38 | + return converts.containsKey(targetType); | ||
39 | + } | ||
40 | + | ||
41 | + @Override | ||
42 | + public <T> T convert(String source, Class<T> targetType) { | ||
43 | + @SuppressWarnings("unchecked") | ||
44 | + Converter<T> converter = (Converter<T>) converts.get(targetType); | ||
45 | + return converter.convert(source); | ||
46 | + } | ||
47 | + | ||
48 | +} |
1 | +package cn.runsa.crmapp.base.extendsion.spring; | ||
2 | + | ||
3 | +import org.springframework.beans.factory.support.DefaultListableBeanFactory; | ||
4 | +import org.springframework.web.context.support.XmlWebApplicationContext; | ||
5 | + | ||
6 | +/** | ||
7 | + * @author Stephen | ||
8 | + * 修改beanfactory的默认实现 | ||
9 | + */ | ||
10 | +public class CustomXmlWebApplicationContext extends XmlWebApplicationContext{ | ||
11 | + | ||
12 | + @Override | ||
13 | + protected DefaultListableBeanFactory createBeanFactory() { | ||
14 | + return new MultipleImplementsBeanFactory(getInternalParentBeanFactory()); | ||
15 | + } | ||
16 | + | ||
17 | +} |
crm/crm-base/src/main/java/cn/runsa/crmapp/base/extendsion/spring/MultipleImplementsBeanFactory.java
0 → 100644
1 | +package cn.runsa.crmapp.base.extendsion.spring; | ||
2 | + | ||
3 | +import java.util.HashMap; | ||
4 | +import java.util.Map; | ||
5 | + | ||
6 | +import org.apache.commons.lang3.StringUtils; | ||
7 | +import org.springframework.beans.factory.BeanFactory; | ||
8 | +import org.springframework.beans.factory.NoSuchBeanDefinitionException; | ||
9 | +import org.springframework.beans.factory.support.DefaultListableBeanFactory; | ||
10 | + | ||
11 | +import cn.runsa.crmapp.base.Constants; | ||
12 | + | ||
13 | +/** | ||
14 | + * @author Stephen | ||
15 | + * 多种实现选择注入的beanFactory | ||
16 | + */ | ||
17 | +public class MultipleImplementsBeanFactory extends DefaultListableBeanFactory{ | ||
18 | + | ||
19 | + public MultipleImplementsBeanFactory() { | ||
20 | + super(); | ||
21 | + } | ||
22 | + | ||
23 | + public MultipleImplementsBeanFactory(BeanFactory parentBeanFactory) { | ||
24 | + super(parentBeanFactory); | ||
25 | + } | ||
26 | + /** | ||
27 | + * 约定:系统外实现,包名包含open.*** | ||
28 | + */ | ||
29 | + @Override | ||
30 | + protected String determinePrimaryCandidate(Map<String, Object> candidateBeans, Class<?> requiredType) { | ||
31 | + String prop = System.getProperty(Constants.CONSTANTS_CLASS_IMPL_PROFILE); | ||
32 | + //允许多个profile | ||
33 | + String [] profiles = null; | ||
34 | + if(StringUtils.isBlank(prop)){ | ||
35 | + profiles = new String []{Constants.CONSTANTS_CLASS_IMPL_SYSTEM}; | ||
36 | + }else{ | ||
37 | + prop = prop.trim(); | ||
38 | + profiles = prop.split(","); | ||
39 | + } | ||
40 | + String beanName = null; | ||
41 | + Map<String, Object> beans = new HashMap<String,Object>(); | ||
42 | + for (Map.Entry<String, Object> entry : candidateBeans.entrySet()) { | ||
43 | + //取到包名 | ||
44 | + String pkgName = entry.getValue().getClass().getPackage().getName(); | ||
45 | + for(String profile : profiles){ | ||
46 | + //系统 | ||
47 | + if(Constants.CONSTANTS_CLASS_IMPL_SYSTEM.equals(profile)){ | ||
48 | + if(pkgName.indexOf(".open.") == -1){ | ||
49 | + beanName = entry.getKey(); | ||
50 | + beans.put(beanName, entry.getValue()); | ||
51 | + } | ||
52 | + }else{ | ||
53 | + if(pkgName.indexOf(".open."+profile) != -1){ | ||
54 | + beanName = entry.getKey(); | ||
55 | + beans.put(beanName, entry.getValue()); | ||
56 | + } | ||
57 | + } | ||
58 | + } | ||
59 | + } | ||
60 | + if(beans.size() == 0){ | ||
61 | + throw new NoSuchBeanDefinitionException(requiredType); | ||
62 | + }else if(beans.size() == 1){ | ||
63 | + return beanName; | ||
64 | + }else{ | ||
65 | + return super.determinePrimaryCandidate(beans, requiredType); | ||
66 | + } | ||
67 | + } | ||
68 | + | ||
69 | +} |
This diff is collapsed. Click to expand it.
1 | +package cn.runsa.crmapp.base.http; | ||
2 | + | ||
3 | +import java.io.File; | ||
4 | +import java.io.FileOutputStream; | ||
5 | +import java.io.IOException; | ||
6 | +import java.io.InputStream; | ||
7 | +import java.io.OutputStream; | ||
8 | + | ||
9 | +import org.apache.commons.fileupload.util.Streams; | ||
10 | +import org.apache.commons.io.IOUtils; | ||
11 | +import org.apache.http.HttpEntity; | ||
12 | +import org.apache.http.HttpStatus; | ||
13 | +import org.apache.http.StatusLine; | ||
14 | +import org.apache.http.client.methods.CloseableHttpResponse; | ||
15 | + | ||
16 | +import cn.runsa.crmapp.base.http.exception.HttpDataFormatException; | ||
17 | +import cn.runsa.crmapp.base.http.exception.HttpDataTypeNotSupportException; | ||
18 | +import cn.runsa.crmapp.base.http.exception.HttpResponseException; | ||
19 | +import cn.runsa.crmapp.base.utils.JsonUtils; | ||
20 | +import cn.runsa.crmapp.base.utils.XmlUtils; | ||
21 | + | ||
22 | +public class ResponseHandler { | ||
23 | + | ||
24 | + @SuppressWarnings("unchecked") | ||
25 | + public static <T> T handle(final CloseableHttpResponse response, Class<T> clz) | ||
26 | + throws HttpResponseException, HttpDataFormatException { | ||
27 | + final StatusLine statusLine = response.getStatusLine(); | ||
28 | + if (statusLine.getStatusCode() != HttpStatus.SC_OK) { | ||
29 | + IOUtils.closeQuietly(response); | ||
30 | + throw new HttpResponseException("http code :" | ||
31 | + + statusLine.getStatusCode()); | ||
32 | + } else { | ||
33 | + HttpEntity entity = response.getEntity(); | ||
34 | + String type =null; | ||
35 | + try{ | ||
36 | + type = entity.getContentType().getValue().toLowerCase(); | ||
37 | + }catch(Exception e){ | ||
38 | + } | ||
39 | + InputStream in = null; | ||
40 | + try { | ||
41 | + in = entity.getContent(); | ||
42 | + String result = IOUtils.toString(in, "UTF-8"); | ||
43 | + if(clz.equals(String.class)){ | ||
44 | + return (T) result; | ||
45 | + } | ||
46 | + if (type.startsWith("application/json")) { | ||
47 | + return JsonUtils.jsonToBean(result, clz); | ||
48 | + } else if (type.startsWith("text/xml")||type.startsWith("application/xml")) { | ||
49 | + return XmlUtils.xmlToBean(result, clz); | ||
50 | + }else{ | ||
51 | + throw new HttpDataTypeNotSupportException(type+" not support"); | ||
52 | + } | ||
53 | + } catch (Exception e) { | ||
54 | + throw new HttpDataFormatException("", e); | ||
55 | + }finally{ | ||
56 | + IOUtils.closeQuietly(in); | ||
57 | +// IOUtils.closeQuietly(response); | ||
58 | + } | ||
59 | + } | ||
60 | + } | ||
61 | + | ||
62 | + public static void downLoadFile(final CloseableHttpResponse response, File file) throws HttpResponseException{ | ||
63 | + StatusLine statusLine = response.getStatusLine(); | ||
64 | + if (statusLine.getStatusCode() != HttpStatus.SC_OK) { | ||
65 | + IOUtils.closeQuietly(response); | ||
66 | + throw new HttpResponseException("http code :" | ||
67 | + + statusLine.getStatusCode()); | ||
68 | + } else { | ||
69 | + HttpEntity entity = response.getEntity(); | ||
70 | + InputStream in =null; | ||
71 | + OutputStream out = null; | ||
72 | + try { | ||
73 | + in = entity.getContent(); | ||
74 | + out = new FileOutputStream(file); | ||
75 | + Streams.copy(in, out, true); | ||
76 | + } catch (IOException e) { | ||
77 | + throw new HttpResponseException("File copy error.",e); | ||
78 | + }finally{ | ||
79 | + IOUtils.closeQuietly(out); | ||
80 | + IOUtils.closeQuietly(in); | ||
81 | + IOUtils.closeQuietly(response); | ||
82 | + } | ||
83 | + | ||
84 | + | ||
85 | + } | ||
86 | + } | ||
87 | +} |
1 | +package cn.runsa.crmapp.base.http; | ||
2 | + | ||
3 | +import java.security.cert.CertificateException; | ||
4 | +import java.security.cert.X509Certificate; | ||
5 | + | ||
6 | +import org.apache.http.conn.ssl.TrustStrategy; | ||
7 | +/** | ||
8 | + * Https 安全策略:信任所有 | ||
9 | + * @author Stephen | ||
10 | + * | ||
11 | + */ | ||
12 | +public class TrustAllStrategy implements TrustStrategy{ | ||
13 | + | ||
14 | + @Override | ||
15 | + public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException { | ||
16 | + return true; | ||
17 | + } | ||
18 | + | ||
19 | +} |
crm/crm-base/src/main/java/cn/runsa/crmapp/base/http/exception/HttpDataFormatException.java
0 → 100644
1 | +package cn.runsa.crmapp.base.http.exception; | ||
2 | +/** | ||
3 | + * http 请求数据格式化异常 | ||
4 | + * @author Stephen | ||
5 | + * | ||
6 | + */ | ||
7 | +public class HttpDataFormatException extends HttpException { | ||
8 | + | ||
9 | + private static final long serialVersionUID = -446888465201916329L; | ||
10 | + | ||
11 | + public HttpDataFormatException() { | ||
12 | + super(); | ||
13 | + } | ||
14 | + | ||
15 | + public HttpDataFormatException(String message, Throwable cause) { | ||
16 | + super(message, cause); | ||
17 | + } | ||
18 | + | ||
19 | + public HttpDataFormatException(String message) { | ||
20 | + super(message); | ||
21 | + } | ||
22 | + | ||
23 | +} |
crm/crm-base/src/main/java/cn/runsa/crmapp/base/http/exception/HttpDataProcessException.java
0 → 100644
1 | +package cn.runsa.crmapp.base.http.exception; | ||
2 | +/** | ||
3 | + * http 处理响应数据异常 | ||
4 | + * @author Stephen | ||
5 | + * | ||
6 | + */ | ||
7 | +public class HttpDataProcessException extends Exception { | ||
8 | + | ||
9 | + private static final long serialVersionUID = -446888465233339L; | ||
10 | + | ||
11 | + public HttpDataProcessException() { | ||
12 | + super(); | ||
13 | + } | ||
14 | + | ||
15 | + public HttpDataProcessException(final String message) { | ||
16 | + super(message); | ||
17 | + } | ||
18 | + | ||
19 | + public HttpDataProcessException(final String message, final Throwable cause) { | ||
20 | + super(message,cause); | ||
21 | + } | ||
22 | +} |
crm/crm-base/src/main/java/cn/runsa/crmapp/base/http/exception/HttpDataTypeNotSupportException.java
0 → 100644
1 | +package cn.runsa.crmapp.base.http.exception; | ||
2 | +/** | ||
3 | + * http 请求数据格式不支持 | ||
4 | + * @author Stephen | ||
5 | + * | ||
6 | + */ | ||
7 | +public class HttpDataTypeNotSupportException extends HttpException { | ||
8 | + | ||
9 | + private static final long serialVersionUID = -4677744724999454091L; | ||
10 | + | ||
11 | + public HttpDataTypeNotSupportException() { | ||
12 | + super(); | ||
13 | + } | ||
14 | + | ||
15 | + public HttpDataTypeNotSupportException(final String message) { | ||
16 | + super(message); | ||
17 | + } | ||
18 | + | ||
19 | + public HttpDataTypeNotSupportException(final String message, final Throwable cause) { | ||
20 | + super(message,cause); | ||
21 | + } | ||
22 | +} |
1 | +package cn.runsa.crmapp.base.http.exception; | ||
2 | + | ||
3 | +/** | ||
4 | + * Http 请求异常 | ||
5 | + * | ||
6 | + * @author Stephen | ||
7 | + * | ||
8 | + */ | ||
9 | +public class HttpException extends Exception { | ||
10 | + | ||
11 | + private static final long serialVersionUID = 2781235741466577292L; | ||
12 | + | ||
13 | + public HttpException() { | ||
14 | + super(); | ||
15 | + } | ||
16 | + | ||
17 | + public HttpException(final String message) { | ||
18 | + super(message); | ||
19 | + } | ||
20 | + | ||
21 | + public HttpException(final String message, final Throwable cause) { | ||
22 | + super(message); | ||
23 | + initCause(cause); | ||
24 | + } | ||
25 | +} |
crm/crm-base/src/main/java/cn/runsa/crmapp/base/http/exception/HttpResponseException.java
0 → 100644
1 | +package cn.runsa.crmapp.base.http.exception; | ||
2 | + | ||
3 | +/** | ||
4 | + * http 响应时异常 | ||
5 | + * | ||
6 | + * @author Stephen | ||
7 | + * | ||
8 | + */ | ||
9 | +public class HttpResponseException extends HttpException { | ||
10 | + | ||
11 | + private static final long serialVersionUID = -2960376536362148494L; | ||
12 | + | ||
13 | + public HttpResponseException() { | ||
14 | + super(); | ||
15 | + } | ||
16 | + | ||
17 | + public HttpResponseException(String message, Throwable cause) { | ||
18 | + super(message, cause); | ||
19 | + } | ||
20 | + | ||
21 | + public HttpResponseException(String message) { | ||
22 | + super(message); | ||
23 | + } | ||
24 | + | ||
25 | +} |
1 | +package cn.runsa.crmapp.base.mq; | ||
2 | + | ||
3 | +import java.io.ByteArrayInputStream; | ||
4 | +import java.io.ByteArrayOutputStream; | ||
5 | +import java.io.IOException; | ||
6 | +import java.util.zip.GZIPInputStream; | ||
7 | +import java.util.zip.GZIPOutputStream; | ||
8 | + | ||
9 | +import com.alibaba.fastjson.JSON; | ||
10 | +import com.google.common.io.ByteStreams; | ||
11 | + | ||
12 | +public class BaseService { | ||
13 | + | ||
14 | + public final static <T> T getOject(String jsonString, Class<T> cls) { | ||
15 | + T t = null; | ||
16 | + try { | ||
17 | + t = JSON.parseObject(jsonString, cls); | ||
18 | + } catch (Exception e) { | ||
19 | + // TODO: handle exception | ||
20 | + } | ||
21 | + return t; | ||
22 | + } | ||
23 | + | ||
24 | + public final static String unGZIP(byte[] body) { | ||
25 | + ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||
26 | + ByteArrayInputStream in = new ByteArrayInputStream(body); | ||
27 | + try { | ||
28 | + GZIPInputStream gunzip = new GZIPInputStream(in); | ||
29 | + ByteStreams.copy(gunzip, out); | ||
30 | + return out.toString(); | ||
31 | + } catch (IOException e1) { | ||
32 | + e1.printStackTrace(); | ||
33 | + } finally { | ||
34 | + try { | ||
35 | + in.close(); | ||
36 | + out.close(); | ||
37 | + } catch (IOException e) { | ||
38 | + } | ||
39 | + } | ||
40 | + return null; | ||
41 | + } | ||
42 | + | ||
43 | + public final static byte[] GZIP(byte[] body) { | ||
44 | + ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||
45 | + try { | ||
46 | + GZIPOutputStream gunzip = new GZIPOutputStream(out); | ||
47 | + gunzip.write(body); | ||
48 | + gunzip.close(); | ||
49 | + return out.toByteArray(); | ||
50 | + } catch (IOException e1) { | ||
51 | + e1.printStackTrace(); | ||
52 | + } finally { | ||
53 | + try { | ||
54 | + out.close(); | ||
55 | + } catch (IOException e) { | ||
56 | + } | ||
57 | + } | ||
58 | + return null; | ||
59 | + } | ||
60 | +} |
1 | +package cn.runsa.crmapp.base.mq; | ||
2 | + | ||
3 | +/** | ||
4 | + * @author Stephen | ||
5 | + * 延迟消息 | ||
6 | + */ | ||
7 | +public class DelayMessage extends MqMessage{ | ||
8 | + | ||
9 | + private static final long serialVersionUID = -6406648480333023838L; | ||
10 | + | ||
11 | + private int delay ; | ||
12 | + | ||
13 | + public int getDelay() { | ||
14 | + return delay; | ||
15 | + } | ||
16 | + | ||
17 | + public void setDelay(int delay) { | ||
18 | + this.delay = delay; | ||
19 | + } | ||
20 | + | ||
21 | +} |
1 | +package cn.runsa.crmapp.base.mq; | ||
2 | + | ||
3 | +import java.util.Properties; | ||
4 | + | ||
5 | +import org.slf4j.Logger; | ||
6 | +import org.slf4j.LoggerFactory; | ||
7 | +import org.springframework.core.io.FileSystemResource; | ||
8 | +import org.springframework.core.io.support.PropertiesLoaderUtils; | ||
9 | + | ||
10 | +import cn.runsa.crmapp.base.Constants; | ||
11 | + | ||
12 | +import com.google.common.base.Throwables; | ||
13 | + | ||
14 | +/** | ||
15 | + * 阿里云凭证 | ||
16 | + * @author Stephen | ||
17 | + */ | ||
18 | +public final class MNSCredential { | ||
19 | + | ||
20 | + private static Properties credential = null; | ||
21 | + | ||
22 | + private static final Logger log = LoggerFactory.getLogger(MNSCredential.class); | ||
23 | + | ||
24 | + static{ | ||
25 | + try { | ||
26 | + credential = PropertiesLoaderUtils.loadProperties(new FileSystemResource(System.getProperty(Constants.CONSTANTS_SERVER_CONFIG_PATH))); | ||
27 | + } catch (Exception e) { | ||
28 | + log.error("mns auth config error,with config file classpath:/mq/aliyun-mns.properties",e); | ||
29 | + Throwables.propagate(e); | ||
30 | + } | ||
31 | + } | ||
32 | + | ||
33 | + public static String getMNSAccountEndpoint() { | ||
34 | + return credential.getProperty("mns.accountendpoint"); | ||
35 | + } | ||
36 | + | ||
37 | + public static String getMNSAccessKeyId() { | ||
38 | + return credential.getProperty("mns.accesskeyid"); | ||
39 | + } | ||
40 | + | ||
41 | + public static String getMNSAccessKeySecret() { | ||
42 | + return credential.getProperty("mns.accesskeysecret"); | ||
43 | + } | ||
44 | + | ||
45 | + public static String getMNSSecurityToken() { | ||
46 | + return credential.getProperty("mns.securitytoken"); | ||
47 | + } | ||
48 | + | ||
49 | +} |
1 | +package cn.runsa.crmapp.base.mq; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | +import java.util.List; | ||
5 | +import java.util.Map; | ||
6 | +import java.util.concurrent.ConcurrentHashMap; | ||
7 | +import java.util.concurrent.ExecutorService; | ||
8 | +import java.util.concurrent.Executors; | ||
9 | +import java.util.concurrent.TimeUnit; | ||
10 | + | ||
11 | +import org.slf4j.Logger; | ||
12 | +import org.slf4j.LoggerFactory; | ||
13 | +import org.springframework.beans.factory.DisposableBean; | ||
14 | +import org.springframework.beans.factory.InitializingBean; | ||
15 | +import org.springframework.core.io.ClassPathResource; | ||
16 | + | ||
17 | +import cn.runsa.crmapp.base.mq.entity.MqClient; | ||
18 | +import cn.runsa.crmapp.base.mq.entity.MqQueue; | ||
19 | +import cn.runsa.crmapp.base.utils.XmlUtils; | ||
20 | + | ||
21 | +import com.aliyun.mns.client.CloudAccount; | ||
22 | +import com.aliyun.mns.client.CloudQueue; | ||
23 | +import com.aliyun.mns.client.MNSClient; | ||
24 | + | ||
25 | +public class MessageReceiver implements InitializingBean, DisposableBean{ | ||
26 | + | ||
27 | + private static MNSClient client = null; | ||
28 | + | ||
29 | + private static Map<String,CloudQueue> queues = new ConcurrentHashMap<String,CloudQueue>(); | ||
30 | + | ||
31 | + private static final Logger log = LoggerFactory.getLogger(MessageReceiver.class); | ||
32 | + | ||
33 | + private static ExecutorService es ; | ||
34 | + | ||
35 | + private static CloudQueue getQueue(String name){ | ||
36 | + CloudQueue queue = queues.get(name); | ||
37 | + if(queue==null){ | ||
38 | + queue = client.getQueueRef(name); | ||
39 | + queues.put(name, queue); | ||
40 | + } | ||
41 | + return queue; | ||
42 | + } | ||
43 | + | ||
44 | + @Override | ||
45 | + public void destroy() throws Exception { | ||
46 | + es.shutdown(); | ||
47 | + es.awaitTermination(60, TimeUnit.SECONDS); | ||
48 | + if(client!=null) | ||
49 | + client.close(); | ||
50 | + queues.clear(); | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public void afterPropertiesSet() throws Exception { | ||
55 | + CloudAccount account = new CloudAccount( | ||
56 | + MNSCredential.getMNSAccessKeyId(), | ||
57 | + MNSCredential.getMNSAccessKeySecret(), | ||
58 | + MNSCredential.getMNSAccountEndpoint()); | ||
59 | + client = account.getMNSClient(); | ||
60 | + es = Executors.newCachedThreadPool(); | ||
61 | + init(); | ||
62 | + } | ||
63 | + | ||
64 | + private void init(){ | ||
65 | + MqClient clt = null; | ||
66 | + try { | ||
67 | + clt = XmlUtils.xmlToBean(new ClassPathResource("mq/aliyun-mns.xml").getInputStream(), MqClient.class); | ||
68 | + } catch (IOException e) { | ||
69 | + log.error("mns init error", e); | ||
70 | + } | ||
71 | + List<MqQueue> list = clt.getQueues(); | ||
72 | + if(list != null && list.size() >0){ | ||
73 | + for(final MqQueue queue:list){ | ||
74 | + for(int i=1;i<=queue.getThread();i++){ | ||
75 | + final int index = i; | ||
76 | + QueueReceiver reveiver = new QueueReceiver(index, getQueue(queue.getName()), queue.getListener()); | ||
77 | + es.execute(reveiver); | ||
78 | + } | ||
79 | + } | ||
80 | + } | ||
81 | + } | ||
82 | +} |
1 | +package cn.runsa.crmapp.base.mq; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | +import java.util.ArrayList; | ||
5 | +import java.util.HashMap; | ||
6 | +import java.util.List; | ||
7 | +import java.util.Map; | ||
8 | +import java.util.concurrent.ConcurrentHashMap; | ||
9 | + | ||
10 | +import org.slf4j.Logger; | ||
11 | +import org.slf4j.LoggerFactory; | ||
12 | +import org.springframework.beans.factory.DisposableBean; | ||
13 | +import org.springframework.beans.factory.InitializingBean; | ||
14 | +import org.springframework.core.io.ClassPathResource; | ||
15 | +import org.springframework.stereotype.Component; | ||
16 | + | ||
17 | +import cn.runsa.crmapp.base.mq.QueueNameAlias.InnerQueue; | ||
18 | +import cn.runsa.crmapp.base.mq.entity.MqClient; | ||
19 | +import cn.runsa.crmapp.base.utils.XmlUtils; | ||
20 | + | ||
21 | +import com.aliyun.mns.client.CloudAccount; | ||
22 | +import com.aliyun.mns.client.CloudQueue; | ||
23 | +import com.aliyun.mns.client.CloudTopic; | ||
24 | +import com.aliyun.mns.client.MNSClient; | ||
25 | +import com.aliyun.mns.model.Message; | ||
26 | + | ||
27 | +/** | ||
28 | + * 发送mq消息 | ||
29 | + * @author Stephen | ||
30 | + */ | ||
31 | +public final class MessageSender implements InitializingBean, DisposableBean{ | ||
32 | + | ||
33 | + private static final Logger log = LoggerFactory.getLogger(MessageSender.class); | ||
34 | + | ||
35 | + private static MNSClient client = null; | ||
36 | + | ||
37 | + private static Map<String,CloudQueue> queues = new ConcurrentHashMap<String,CloudQueue>(); | ||
38 | + | ||
39 | + private static Map<String,CloudTopic> topics = new ConcurrentHashMap<String,CloudTopic>(); | ||
40 | + | ||
41 | + private static Map<InnerQueue,String> queueAlias = new HashMap<InnerQueue,String>(); | ||
42 | + | ||
43 | + @Override | ||
44 | + public void destroy() throws Exception { | ||
45 | + if(client!=null) | ||
46 | + client.close(); | ||
47 | + queues.clear(); | ||
48 | + topics.clear(); | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public void afterPropertiesSet() throws Exception { | ||
53 | + MqClient clt = null; | ||
54 | + try { | ||
55 | + clt = XmlUtils.xmlToBean(new ClassPathResource("mq/aliyun-mns.xml").getInputStream(), MqClient.class); | ||
56 | + } catch (IOException e) { | ||
57 | + log.error("mns init error", e); | ||
58 | + throw new RuntimeException(e); | ||
59 | + } | ||
60 | + if(clt.getQueueAlias()!=null&&clt.getQueueAlias().size()>0){ | ||
61 | + for(QueueNameAlias a : clt.getQueueAlias()){ | ||
62 | + queueAlias.put(a.getInner(), a.getQueueName()); | ||
63 | + } | ||
64 | + } | ||
65 | + CloudAccount account = new CloudAccount( | ||
66 | + MNSCredential.getMNSAccessKeyId(), | ||
67 | + MNSCredential.getMNSAccessKeySecret(), | ||
68 | + MNSCredential.getMNSAccountEndpoint()); | ||
69 | + client = account.getMNSClient(); | ||
70 | + } | ||
71 | + | ||
72 | + private static CloudQueue getQueue(String name){ | ||
73 | + CloudQueue queue = queues.get(name); | ||
74 | + if(queue==null){ | ||
75 | + queue = client.getQueueRef(name); | ||
76 | + queues.put(name, queue); | ||
77 | + } | ||
78 | + return queue; | ||
79 | + } | ||
80 | + | ||
81 | + /*private static CloudTopic getTopic(String name){ | ||
82 | + CloudTopic topic = topics.get(name); | ||
83 | + if(topic==null){ | ||
84 | + synchronized (topic) { | ||
85 | + if (topic == null){ | ||
86 | + topic = client.getTopicRef(name); | ||
87 | + topics.put(name, topic); | ||
88 | + } | ||
89 | + } | ||
90 | + } | ||
91 | + return topic; | ||
92 | + }*/ | ||
93 | + | ||
94 | + public static void putMessage(String queueName,MqMessage message){ | ||
95 | + CloudQueue queue = getQueue(queueName); | ||
96 | + Message msg = new Message(); | ||
97 | + msg.setMessageBody(BaseService.GZIP(message.getMessageBody())); | ||
98 | + msg.setPriority(message.getPriority()); | ||
99 | + queue.putMessage(msg); | ||
100 | + } | ||
101 | + | ||
102 | + public static void putMessage(InnerQueue alias,MqMessage message){ | ||
103 | + if(checkQueueAlias(alias)){ | ||
104 | + putMessage(queueAlias.get(alias), message); | ||
105 | + } | ||
106 | + } | ||
107 | + | ||
108 | + public static void putMessage(String queueName,List<MqMessage> messages){ | ||
109 | + CloudQueue queue = getQueue(queueName); | ||
110 | + List<Message> list = new ArrayList<Message>(messages.size()); | ||
111 | + for(MqMessage message:messages){ | ||
112 | + Message msg = new Message(); | ||
113 | + msg.setMessageBody(BaseService.GZIP(message.getMessageBody())); | ||
114 | + msg.setPriority(message.getPriority()); | ||
115 | + list.add(msg); | ||
116 | + } | ||
117 | + queue.batchPutMessage(list); | ||
118 | + } | ||
119 | + | ||
120 | + public static void putMessage(InnerQueue alias,List<MqMessage> messages){ | ||
121 | + if(checkQueueAlias(alias)){ | ||
122 | + putMessage(queueAlias.get(alias), messages); | ||
123 | + } | ||
124 | + } | ||
125 | + | ||
126 | + public static void putDelayMessage(InnerQueue alias,DelayMessage message){ | ||
127 | + if(checkQueueAlias(alias)){ | ||
128 | + putDelayMessage(queueAlias.get(alias), message); | ||
129 | + } | ||
130 | + } | ||
131 | + | ||
132 | + public static void putDelayMessage(String queueName,DelayMessage message){ | ||
133 | + CloudQueue queue = getQueue(queueName); | ||
134 | + Message msg = new Message(); | ||
135 | + msg.setMessageBody(BaseService.GZIP(message.getMessageBody())); | ||
136 | + msg.setPriority(message.getPriority()); | ||
137 | + msg.setDelaySeconds(message.getDelay()); | ||
138 | + queue.putMessage(msg); | ||
139 | + } | ||
140 | + | ||
141 | + public static void putDelayMessage(String queueName,List<DelayMessage> messages){ | ||
142 | + CloudQueue queue = getQueue(queueName); | ||
143 | + List<Message> list = new ArrayList<Message>(messages.size()); | ||
144 | + for(DelayMessage message:messages){ | ||
145 | + Message msg = new Message(); | ||
146 | + msg.setMessageBody(BaseService.GZIP(message.getMessageBody())); | ||
147 | + msg.setPriority(message.getPriority()); | ||
148 | + msg.setDelaySeconds(message.getDelay()); | ||
149 | + list.add(msg); | ||
150 | + } | ||
151 | + queue.batchPutMessage(list); | ||
152 | + } | ||
153 | + | ||
154 | + public static void putDelayMessage(InnerQueue alias,List<DelayMessage> messages){ | ||
155 | + if(checkQueueAlias(alias)){ | ||
156 | + putDelayMessage(queueAlias.get(alias), messages); | ||
157 | + } | ||
158 | + } | ||
159 | + | ||
160 | + private static boolean checkQueueAlias(InnerQueue alias){ | ||
161 | + if(!queueAlias.containsKey(alias)){ | ||
162 | + if(log.isDebugEnabled()){ | ||
163 | + log.debug("alias with no queue name defined,queue alias :"+alias); | ||
164 | + } | ||
165 | + return false; | ||
166 | + } | ||
167 | + return true; | ||
168 | + } | ||
169 | +} |
1 | +package cn.runsa.crmapp.base.mq; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | +import java.io.UnsupportedEncodingException; | ||
5 | + | ||
6 | +/** | ||
7 | + * @author Stephen | ||
8 | + * mq消息 | ||
9 | + */ | ||
10 | +public class MqMessage implements Serializable{ | ||
11 | + | ||
12 | + private static final long serialVersionUID = -2913291790464662305L; | ||
13 | + | ||
14 | + private static final String ENCODING = "UTF-8"; | ||
15 | + | ||
16 | + private static final int DEFAULT_PRIORITY = 8; | ||
17 | + | ||
18 | + private int priority ; | ||
19 | + | ||
20 | + private byte[] messageBody ; | ||
21 | + | ||
22 | + public MqMessage(){ | ||
23 | + super(); | ||
24 | + } | ||
25 | + | ||
26 | + public MqMessage(byte[] messageBody) { | ||
27 | + this(DEFAULT_PRIORITY,messageBody); | ||
28 | + } | ||
29 | + | ||
30 | + public MqMessage(int priority, byte[] messageBody) { | ||
31 | + super(); | ||
32 | + this.priority = priority; | ||
33 | + this.messageBody = messageBody; | ||
34 | + } | ||
35 | + | ||
36 | + public MqMessage(String messageBody) { | ||
37 | + this(DEFAULT_PRIORITY,messageBody); | ||
38 | + } | ||
39 | + | ||
40 | + public MqMessage(int priority, String messageBody) { | ||
41 | + super(); | ||
42 | + this.priority = priority; | ||
43 | + setStringMessageBody(messageBody); | ||
44 | + } | ||
45 | + | ||
46 | + public int getPriority() { | ||
47 | + return priority; | ||
48 | + } | ||
49 | + | ||
50 | + public void setPriority(int priority) { | ||
51 | + this.priority = priority; | ||
52 | + } | ||
53 | + | ||
54 | + public byte[] getMessageBody() { | ||
55 | + return messageBody; | ||
56 | + } | ||
57 | + | ||
58 | + public void setMessageBody(byte[] messageBody) { | ||
59 | + this.messageBody = messageBody; | ||
60 | + } | ||
61 | + | ||
62 | + public void setStringMessageBody(String messageBody){ | ||
63 | + byte[] body = null; | ||
64 | + try { | ||
65 | + body = messageBody.getBytes(ENCODING); | ||
66 | + } catch (UnsupportedEncodingException e) { | ||
67 | + throw new RuntimeException("Not support encoding"); | ||
68 | + } | ||
69 | + setMessageBody(body); | ||
70 | + } | ||
71 | +} |
1 | +package cn.runsa.crmapp.base.mq; | ||
2 | + | ||
3 | +import com.thoughtworks.xstream.annotations.XStreamAlias; | ||
4 | +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; | ||
5 | + | ||
6 | +/** | ||
7 | + * @author Stephen | ||
8 | + * queue 别名 | ||
9 | + */ | ||
10 | +@XStreamAlias("alias") | ||
11 | +public class QueueNameAlias { | ||
12 | + | ||
13 | + public static enum InnerQueue { | ||
14 | + events | ||
15 | + } | ||
16 | + | ||
17 | + @XStreamAsAttribute | ||
18 | + private InnerQueue inner; | ||
19 | + | ||
20 | + @XStreamAlias("ref") | ||
21 | + @XStreamAsAttribute | ||
22 | + private String queueName; | ||
23 | + | ||
24 | + public InnerQueue getInner() { | ||
25 | + return inner; | ||
26 | + } | ||
27 | + | ||
28 | + public void setInner(InnerQueue inner) { | ||
29 | + this.inner = inner; | ||
30 | + } | ||
31 | + | ||
32 | + public String getQueueName() { | ||
33 | + return queueName; | ||
34 | + } | ||
35 | + | ||
36 | + public void setQueueName(String queueName) { | ||
37 | + this.queueName = queueName; | ||
38 | + } | ||
39 | + | ||
40 | +} |
1 | +package cn.runsa.crmapp.base.mq; | ||
2 | + | ||
3 | +import java.util.HashMap; | ||
4 | +import java.util.Map; | ||
5 | +import java.util.concurrent.ConcurrentHashMap; | ||
6 | + | ||
7 | +import org.slf4j.Logger; | ||
8 | +import org.slf4j.LoggerFactory; | ||
9 | + | ||
10 | +import cn.runsa.crmapp.base.mq.entity.MqListener; | ||
11 | +import cn.runsa.crmapp.base.utils.SpringUtils; | ||
12 | + | ||
13 | +import com.alibaba.fastjson.JSON; | ||
14 | +import com.aliyun.mns.client.CloudQueue; | ||
15 | +import com.aliyun.mns.model.Message; | ||
16 | + | ||
17 | +/** | ||
18 | + * @author Stephen | ||
19 | + */ | ||
20 | +public class QueueReceiver implements Runnable{ | ||
21 | + | ||
22 | + public static final int WAIT_SECONDS = 30; | ||
23 | + | ||
24 | + public static final int BEAT_TEST_SECONDS = 10; | ||
25 | + | ||
26 | + public static final int MAX_MSG_RETRY_TIMES = 5; | ||
27 | + | ||
28 | + private static final Map<String, Object> sLockObjMap = new HashMap<String, Object>(); | ||
29 | + private static Map<String, Integer> sPollingMap = new ConcurrentHashMap<String, Integer>(); | ||
30 | + | ||
31 | + private static final Logger log = LoggerFactory.getLogger(MessageReceiver.class); | ||
32 | + | ||
33 | + private Object lockObj; | ||
34 | + private String queueName; | ||
35 | + private CloudQueue queue; | ||
36 | + private int workerId; | ||
37 | + @SuppressWarnings("rawtypes") | ||
38 | + private MessageListener msgListener; | ||
39 | + @SuppressWarnings("rawtypes") | ||
40 | + private Class msgType; | ||
41 | + | ||
42 | + public QueueReceiver(int worker, CloudQueue queue,MqListener listener) { | ||
43 | + workerId = worker; | ||
44 | + this.queue = queue; | ||
45 | + queueName = queue.getAttributes().getQueueName(); | ||
46 | + try { | ||
47 | + msgListener = (MessageListener<?>) SpringUtils.getBean(Class.forName(listener.getLisClass())); | ||
48 | + msgType = Class.forName(listener.getMsgType()); | ||
49 | + } catch (ClassNotFoundException e) { | ||
50 | + log.error("queue receiver init error",e); | ||
51 | + throw new IllegalArgumentException(e); | ||
52 | + } | ||
53 | + // 初始化lock对象 | ||
54 | + synchronized (sLockObjMap) { | ||
55 | + lockObj = sLockObjMap.get(queueName); | ||
56 | + if (lockObj == null) { | ||
57 | + lockObj = new Object(); | ||
58 | + sLockObjMap.put(queueName, lockObj); | ||
59 | + } | ||
60 | + } | ||
61 | + } | ||
62 | + | ||
63 | + public boolean setPolling() { | ||
64 | + // 进入轮询状态 | ||
65 | + synchronized (lockObj) { | ||
66 | + Integer ret = sPollingMap.get(queueName); | ||
67 | + if (ret == null || ret == -1) { | ||
68 | + sPollingMap.put(queueName, workerId); | ||
69 | + System.out.println(workerId+"轮询"); | ||
70 | + return true; | ||
71 | + } else if (ret == workerId) { | ||
72 | + return true; | ||
73 | + } else { | ||
74 | + return false; | ||
75 | + } | ||
76 | + } | ||
77 | + } | ||
78 | + | ||
79 | + public void clearPolling() { | ||
80 | + // 退出轮询状态 | ||
81 | + synchronized (lockObj) { | ||
82 | + sPollingMap.put(queueName, -1); | ||
83 | + lockObj.notifyAll(); | ||
84 | + System.out.println("唤醒"); | ||
85 | + } | ||
86 | + } | ||
87 | + | ||
88 | + public Message receiveMessage() { | ||
89 | + // 轮询标志 | ||
90 | + boolean polling = false; | ||
91 | + while (true) { | ||
92 | + synchronized (lockObj) { | ||
93 | + Integer p = sPollingMap.get(queueName); | ||
94 | + // 轮询中,则等待 | ||
95 | + if (p != null && p >= 0) { | ||
96 | + if (p != workerId) { | ||
97 | + try { | ||
98 | + polling = false; | ||
99 | + System.out.println(workerId+"歇会儿"); | ||
100 | + lockObj.wait(); | ||
101 | + } catch (InterruptedException e) { | ||
102 | + log.error("MessageReceiver Interrupted! QueueName is " + queueName, e); | ||
103 | + return null; | ||
104 | + } | ||
105 | + } else { | ||
106 | + //只有异常或者断网情况下进入这里 | ||
107 | + try { | ||
108 | + Thread.sleep(WAIT_SECONDS * 1000); | ||
109 | + } catch (InterruptedException e) { | ||
110 | + // undo | ||
111 | + } | ||
112 | + } | ||
113 | + } | ||
114 | + } | ||
115 | + Message message; | ||
116 | + // 未处于轮询状态 | ||
117 | + if (!polling) { | ||
118 | + try { | ||
119 | + message = queue.popMessage(); | ||
120 | + if (message == null) { | ||
121 | + polling = true; | ||
122 | + continue; | ||
123 | + } | ||
124 | + } catch (Exception e) { | ||
125 | + log.error("Exception Happened when popMessage: " + e); | ||
126 | + polling = true; | ||
127 | + continue; | ||
128 | + } | ||
129 | + } else { | ||
130 | + // 尝试进入轮询状态 | ||
131 | + if (!setPolling()) { | ||
132 | + continue; | ||
133 | + } | ||
134 | + try { | ||
135 | + do { | ||
136 | + message = queue.popMessage(WAIT_SECONDS); | ||
137 | + } while (message == null); | ||
138 | + clearPolling(); | ||
139 | + } catch (Exception e) { | ||
140 | + log.error("Exception Happened when popMessage: " + e); | ||
141 | + polling = false; | ||
142 | + continue; | ||
143 | + } | ||
144 | + } | ||
145 | + return message; | ||
146 | + } | ||
147 | + } | ||
148 | + | ||
149 | + @SuppressWarnings("unchecked") | ||
150 | + @Override | ||
151 | + public void run() { | ||
152 | + while (true) { | ||
153 | + Message msg = receiveMessage(); | ||
154 | + if(msg != null){ | ||
155 | + String data = BaseService.unGZIP(msg.getMessageBodyAsBytes()); | ||
156 | + try{ | ||
157 | + if(String.class.equals(msgType)){ | ||
158 | + msgListener.onMessage(data); | ||
159 | + }else{ | ||
160 | + msgListener.onMessage(JSON.parseObject(data, msgType)); | ||
161 | + } | ||
162 | + queue.deleteMessage(msg.getReceiptHandle()); | ||
163 | + }catch(Exception e){ | ||
164 | + log.error("Exception Happened when process msg: " + e); | ||
165 | + if(msg.getDequeueCount()>=MAX_MSG_RETRY_TIMES){ | ||
166 | + queue.deleteMessage(msg.getReceiptHandle()); | ||
167 | + } | ||
168 | + } | ||
169 | + } | ||
170 | + } | ||
171 | + } | ||
172 | + | ||
173 | +} |
1 | +package cn.runsa.crmapp.base.mq.entity; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | + | ||
5 | +import javax.xml.bind.annotation.XmlRootElement; | ||
6 | + | ||
7 | +import cn.runsa.crmapp.base.mq.QueueNameAlias; | ||
8 | + | ||
9 | +import com.thoughtworks.xstream.annotations.XStreamAlias; | ||
10 | + | ||
11 | +/** | ||
12 | + * @author Stephen | ||
13 | + */ | ||
14 | +@XmlRootElement | ||
15 | +@XStreamAlias("client") | ||
16 | +public class MqClient { | ||
17 | + | ||
18 | + private List<MqQueue> queues; | ||
19 | + | ||
20 | + private List<MqTopic> topics; | ||
21 | + | ||
22 | + private List<QueueNameAlias> queueAlias; | ||
23 | + | ||
24 | + public List<MqQueue> getQueues() { | ||
25 | + return queues; | ||
26 | + } | ||
27 | + | ||
28 | + public void setQueues(List<MqQueue> queues) { | ||
29 | + this.queues = queues; | ||
30 | + } | ||
31 | + | ||
32 | + public List<MqTopic> getTopics() { | ||
33 | + return topics; | ||
34 | + } | ||
35 | + | ||
36 | + public void setTopics(List<MqTopic> topics) { | ||
37 | + this.topics = topics; | ||
38 | + } | ||
39 | + | ||
40 | + public List<QueueNameAlias> getQueueAlias() { | ||
41 | + return queueAlias; | ||
42 | + } | ||
43 | + | ||
44 | + public void setQueueAlias(List<QueueNameAlias> queueAlias) { | ||
45 | + this.queueAlias = queueAlias; | ||
46 | + } | ||
47 | + | ||
48 | +} |
1 | +package cn.runsa.crmapp.base.mq.entity; | ||
2 | + | ||
3 | +import com.thoughtworks.xstream.annotations.XStreamAlias; | ||
4 | +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; | ||
5 | + | ||
6 | +/** | ||
7 | + * @author Stephen | ||
8 | + */ | ||
9 | +@XStreamAlias("listener") | ||
10 | +public class MqListener { | ||
11 | + | ||
12 | + @XStreamAlias("class") | ||
13 | + @XStreamAsAttribute | ||
14 | + private String lisClass; | ||
15 | + | ||
16 | + @XStreamAsAttribute | ||
17 | + private String msgType; | ||
18 | + | ||
19 | + public String getLisClass() { | ||
20 | + return lisClass; | ||
21 | + } | ||
22 | + | ||
23 | + public void setLisClass(String lisClass) { | ||
24 | + this.lisClass = lisClass; | ||
25 | + } | ||
26 | + | ||
27 | + public String getMsgType() { | ||
28 | + return msgType; | ||
29 | + } | ||
30 | + | ||
31 | + public void setMsgType(String msgType) { | ||
32 | + this.msgType = msgType; | ||
33 | + } | ||
34 | + | ||
35 | +} |
1 | +package cn.runsa.crmapp.base.mq.entity; | ||
2 | + | ||
3 | +import com.thoughtworks.xstream.annotations.XStreamAlias; | ||
4 | +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; | ||
5 | + | ||
6 | +/** | ||
7 | + * @author Stephen | ||
8 | + */ | ||
9 | +@XStreamAlias("queue") | ||
10 | +public class MqQueue { | ||
11 | + | ||
12 | + @XStreamAsAttribute | ||
13 | + private String name; | ||
14 | + | ||
15 | + @XStreamAsAttribute | ||
16 | + private int thread = 1; | ||
17 | + | ||
18 | + @XStreamAsAttribute | ||
19 | + private String compress = "gzip"; | ||
20 | + | ||
21 | + private MqListener listener; | ||
22 | + | ||
23 | + public String getName() { | ||
24 | + return name; | ||
25 | + } | ||
26 | + | ||
27 | + public void setName(String name) { | ||
28 | + this.name = name; | ||
29 | + } | ||
30 | + | ||
31 | + public int getThread() { | ||
32 | + return thread; | ||
33 | + } | ||
34 | + | ||
35 | + public void setThread(int thread) { | ||
36 | + this.thread = thread; | ||
37 | + } | ||
38 | + | ||
39 | + public String getCompress() { | ||
40 | + return compress; | ||
41 | + } | ||
42 | + | ||
43 | + public void setCompress(String compress) { | ||
44 | + this.compress = compress; | ||
45 | + } | ||
46 | + | ||
47 | + public MqListener getListener() { | ||
48 | + return listener; | ||
49 | + } | ||
50 | + | ||
51 | + public void setListener(MqListener listener) { | ||
52 | + this.listener = listener; | ||
53 | + } | ||
54 | + | ||
55 | +} |
1 | +package cn.runsa.crmapp.base.mq.entity; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | + | ||
5 | +import com.thoughtworks.xstream.annotations.XStreamAlias; | ||
6 | +import com.thoughtworks.xstream.annotations.XStreamImplicit; | ||
7 | + | ||
8 | +/** | ||
9 | + * @author Stephen | ||
10 | + */ | ||
11 | +@XStreamAlias("topic") | ||
12 | +public class MqTopic { | ||
13 | + | ||
14 | + @XStreamImplicit | ||
15 | + private List<MqListener> listeners; | ||
16 | + | ||
17 | + public List<MqListener> getListeners() { | ||
18 | + return listeners; | ||
19 | + } | ||
20 | + | ||
21 | + public void setListeners(List<MqListener> listeners) { | ||
22 | + this.listeners = listeners; | ||
23 | + } | ||
24 | + | ||
25 | +} |
1 | +package cn.runsa.crmapp.base.mq.exception; | ||
2 | + | ||
3 | +public class MqExcepiton extends RuntimeException { | ||
4 | + | ||
5 | + /** | ||
6 | + * | ||
7 | + */ | ||
8 | + private static final long serialVersionUID = 220632093115334702L; | ||
9 | + | ||
10 | + public MqExcepiton() { | ||
11 | + super(); | ||
12 | + } | ||
13 | + | ||
14 | + public MqExcepiton(String message, Throwable cause) { | ||
15 | + super(message, cause); | ||
16 | + } | ||
17 | + | ||
18 | + public MqExcepiton(String message) { | ||
19 | + super(message); | ||
20 | + } | ||
21 | + | ||
22 | + public MqExcepiton(Throwable cause) { | ||
23 | + super(cause); | ||
24 | + } | ||
25 | + | ||
26 | +} |
1 | +package cn.runsa.crmapp.base.redis; | ||
2 | + | ||
3 | +import java.util.concurrent.TimeUnit; | ||
4 | + | ||
5 | +import org.apache.log4j.LogManager; | ||
6 | +import org.apache.log4j.Logger; | ||
7 | +import org.springframework.data.redis.core.RedisTemplate; | ||
8 | + | ||
9 | +import cn.runsa.crmapp.base.utils.JsonUtils; | ||
10 | + | ||
11 | +public class Redis { | ||
12 | + | ||
13 | + private static final Logger log = LogManager.getLogger(Redis.class); | ||
14 | + | ||
15 | + @SuppressWarnings("rawtypes") | ||
16 | + private static RedisTemplate redis; | ||
17 | + | ||
18 | + @SuppressWarnings("rawtypes") | ||
19 | + public RedisTemplate getRedis() { | ||
20 | + return redis; | ||
21 | + } | ||
22 | + | ||
23 | + @SuppressWarnings("rawtypes") | ||
24 | + public void setRedis(RedisTemplate redis) { | ||
25 | + Redis.redis = redis; | ||
26 | + } | ||
27 | + | ||
28 | + public static String getString(String key) { | ||
29 | + String str = null; | ||
30 | + Object val = redis.opsForValue().get(key); | ||
31 | + if(val!=null){ | ||
32 | + str = val.toString(); | ||
33 | + } | ||
34 | + return str; | ||
35 | + } | ||
36 | + | ||
37 | + public static <T> T getObject(String key, Class<T> cls) { | ||
38 | + T t = null; | ||
39 | + try { | ||
40 | + String str = getString(key); | ||
41 | + if(str!=null) | ||
42 | + t = JsonUtils.jsonToBean(str, cls); | ||
43 | + } catch (Exception e) { | ||
44 | + log.error("redis get object value error", e); | ||
45 | + } | ||
46 | + return t; | ||
47 | + } | ||
48 | + | ||
49 | + @SuppressWarnings("unchecked") | ||
50 | + public static boolean setString(String key, String value) { | ||
51 | + redis.opsForValue().set(key, value); | ||
52 | + return true; | ||
53 | + } | ||
54 | + | ||
55 | + public static boolean setObject(String key, Object value) { | ||
56 | + setString(key, JsonUtils.beanToJson(value)); | ||
57 | + return true; | ||
58 | + } | ||
59 | + | ||
60 | + @SuppressWarnings("unchecked") | ||
61 | + public static boolean setString(String key, String value, int timeout) { | ||
62 | + redis.opsForValue().set(key, value,timeout,TimeUnit.SECONDS); | ||
63 | + return true; | ||
64 | + } | ||
65 | + | ||
66 | + public static boolean setObject(String key, Object value, int timeout) { | ||
67 | + setString(key, JsonUtils.beanToJson(value), timeout); | ||
68 | + return true; | ||
69 | + } | ||
70 | + | ||
71 | +} |
1 | +package cn.runsa.crmapp.base.redis.exception; | ||
2 | + | ||
3 | +public class RedisException extends Exception{ | ||
4 | + | ||
5 | + private static final long serialVersionUID = 6585013822092454600L; | ||
6 | + | ||
7 | + public RedisException() { | ||
8 | + super(); | ||
9 | + // TODO Auto-generated constructor stub | ||
10 | + } | ||
11 | + | ||
12 | + public RedisException(String message, Throwable cause) { | ||
13 | + super(message, cause); | ||
14 | + // TODO Auto-generated constructor stub | ||
15 | + } | ||
16 | + | ||
17 | + public RedisException(String message) { | ||
18 | + super(message); | ||
19 | + // TODO Auto-generated constructor stub | ||
20 | + } | ||
21 | + | ||
22 | +} |
1 | +package cn.runsa.crmapp.base.sms; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSON; | ||
4 | + | ||
5 | +public abstract class AbstractHttpSmsSender implements SmsSender { | ||
6 | + | ||
7 | + private Protocol protocol; | ||
8 | + | ||
9 | + public AbstractHttpSmsSender() { | ||
10 | + super(); | ||
11 | + } | ||
12 | + | ||
13 | + @Override | ||
14 | + public void setProtocol(Protocol protocol) { | ||
15 | + this.protocol = protocol; | ||
16 | + } | ||
17 | + | ||
18 | + public Protocol getProtocol() { | ||
19 | + return protocol; | ||
20 | + } | ||
21 | + | ||
22 | + public <T> T getOject(String jsonString, Class<T> cls) { | ||
23 | + T t = null; | ||
24 | + try { | ||
25 | + t = JSON.parseObject(jsonString, cls); | ||
26 | + } catch (Exception e) { | ||
27 | + // TODO: handle exception | ||
28 | + } | ||
29 | + return t; | ||
30 | + } | ||
31 | + | ||
32 | + public String toJsonString(Object T) { | ||
33 | + return JSON.toJSONString(T); | ||
34 | + } | ||
35 | + | ||
36 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +package cn.runsa.crmapp.base.sms; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | +/** | ||
5 | + * 短信消息 | ||
6 | + * @author Stephen | ||
7 | + * | ||
8 | + */ | ||
9 | +public class SmsMessage implements Serializable{ | ||
10 | + | ||
11 | + private static final long serialVersionUID = 8620596786869937729L; | ||
12 | + /** | ||
13 | + * 手机号,可以为多个,中间以英文逗号分隔 | ||
14 | + */ | ||
15 | + private String mobile; | ||
16 | + /** | ||
17 | + * 内容编码为UTF8 | ||
18 | + */ | ||
19 | + private String content; | ||
20 | + | ||
21 | + public String getMobile() { | ||
22 | + return mobile; | ||
23 | + } | ||
24 | + | ||
25 | + public void setMobile(String mobile) { | ||
26 | + this.mobile = mobile; | ||
27 | + } | ||
28 | + | ||
29 | + public String getContent() { | ||
30 | + return content; | ||
31 | + } | ||
32 | + | ||
33 | + public void setContent(String content) { | ||
34 | + this.content = content; | ||
35 | + } | ||
36 | +} |
1 | +package cn.runsa.crmapp.base.sms; | ||
2 | + | ||
3 | +import cn.runsa.crmapp.base.sms.exception.SmsException; | ||
4 | + | ||
5 | +/** | ||
6 | + * 发短信 | ||
7 | + * | ||
8 | + * @author Stephen | ||
9 | + * | ||
10 | + */ | ||
11 | +public interface SmsSender { | ||
12 | + | ||
13 | + void sendSMS(SmsMessage msg) throws SmsException; | ||
14 | + | ||
15 | + /** | ||
16 | + * 发送验证码,返回有效时间,单位为秒 | ||
17 | + * | ||
18 | + * @param mobile | ||
19 | + * 手机号 | ||
20 | + * @param sequence | ||
21 | + * 序列号(可以为场景字符串或者任意字符) | ||
22 | + * @param code | ||
23 | + * 验证码 | ||
24 | + * @return | ||
25 | + * @throws SmsException | ||
26 | + */ | ||
27 | + int sendCaptcha(String mobile, String sequence, String code) throws SmsException; | ||
28 | + | ||
29 | + /** | ||
30 | + * 查询余额,返回剩余条数 | ||
31 | + * | ||
32 | + * @return | ||
33 | + * @throws SmsException | ||
34 | + */ | ||
35 | + long remainCheck() throws SmsException; | ||
36 | + | ||
37 | + /** | ||
38 | + * 设置处理协议 | ||
39 | + * | ||
40 | + * @param protocol | ||
41 | + */ | ||
42 | + void setProtocol(Protocol protocol); | ||
43 | + | ||
44 | +} |
1 | +package cn.runsa.crmapp.base.sms.exception; | ||
2 | +/** | ||
3 | + * 短信发送异常,不包括发送短信但没有接收到,意思就是 并不是端到端 | ||
4 | + * @author Stephen | ||
5 | + * | ||
6 | + */ | ||
7 | +public class SmsException extends Exception{ | ||
8 | + | ||
9 | + private static final long serialVersionUID = 7587790473289942572L; | ||
10 | + | ||
11 | + public SmsException() { | ||
12 | + super(); | ||
13 | + } | ||
14 | + | ||
15 | + public SmsException(String message, Throwable cause) { | ||
16 | + super(message, cause); | ||
17 | + } | ||
18 | + | ||
19 | + public SmsException(String message) { | ||
20 | + super(message); | ||
21 | + } | ||
22 | + | ||
23 | + public SmsException(Throwable cause) { | ||
24 | + super(cause); | ||
25 | + } | ||
26 | + | ||
27 | +} |
1 | +package cn.runsa.crmapp.base.utils; | ||
2 | + | ||
3 | +import java.beans.PropertyDescriptor; | ||
4 | +import java.lang.reflect.Method; | ||
5 | +import java.util.HashSet; | ||
6 | +import java.util.Set; | ||
7 | + | ||
8 | +import org.slf4j.Logger; | ||
9 | +import org.slf4j.LoggerFactory; | ||
10 | +import org.springframework.util.Assert; | ||
11 | + | ||
12 | +import cn.runsa.crmapp.base.event.BusinessEvent; | ||
13 | + | ||
14 | +/** | ||
15 | + * @author Stephen | ||
16 | + */ | ||
17 | +public class BeanUtils extends org.springframework.beans.BeanUtils{ | ||
18 | + | ||
19 | + private static final Logger log = LoggerFactory.getLogger(BeanUtils.class); | ||
20 | + | ||
21 | + /** | ||
22 | + * 归并相同类型的两个对象 | ||
23 | + * @param target | ||
24 | + * @param source | ||
25 | + * @param strategy | ||
26 | + * @param ignores | ||
27 | + */ | ||
28 | + public static void merge(Object target, Object source, MergeStrategy strategy,String [] ignores) { | ||
29 | + Assert.notNull(source, "Source must not be null"); | ||
30 | + Assert.notNull(target, "Target must not be null"); | ||
31 | + if(!target.getClass().equals(source.getClass())){ | ||
32 | + throw new IllegalArgumentException("source and target must be same class type"); | ||
33 | + } | ||
34 | + PropertyDescriptor[] targetPds = getPropertyDescriptors(target.getClass()); | ||
35 | + byte code = strategy.code; | ||
36 | + Set<String> allIgnore = new HashSet<String>(); | ||
37 | + if(ignores!=null){ | ||
38 | + for(String ignore:ignores){ | ||
39 | + allIgnore.add(ignore); | ||
40 | + } | ||
41 | + } | ||
42 | + for (PropertyDescriptor targetPd : targetPds) { | ||
43 | + String name = targetPd.getName(); | ||
44 | + if("class".equals(name)){ | ||
45 | + continue; | ||
46 | + } | ||
47 | + Method read = targetPd.getReadMethod(); | ||
48 | + if(read==null){ | ||
49 | + allIgnore.add(name); | ||
50 | + }else{ | ||
51 | + //target not null | ||
52 | + if((code&0x01)!=0){ | ||
53 | + try{ | ||
54 | + if(read.invoke(target)!=null){ | ||
55 | + allIgnore.add(name); | ||
56 | + } | ||
57 | + }catch(Exception e){ | ||
58 | + log.error("get properties error with name "+name, e); | ||
59 | + allIgnore.add(name); | ||
60 | + } | ||
61 | + | ||
62 | + } | ||
63 | + //source not null | ||
64 | + if((code&0x10)!=0){ | ||
65 | + try{ | ||
66 | + if(read.invoke(source)==null){ | ||
67 | + allIgnore.add(name); | ||
68 | + } | ||
69 | + }catch(Exception e){ | ||
70 | + log.error("get properties error with name "+name, e); | ||
71 | + allIgnore.add(name); | ||
72 | + } | ||
73 | + } | ||
74 | + } | ||
75 | + | ||
76 | + } | ||
77 | + ignores = new String [allIgnore.size()]; | ||
78 | + allIgnore.toArray(ignores); | ||
79 | + copyProperties(source, target, ignores); | ||
80 | + } | ||
81 | + | ||
82 | + public static enum MergeStrategy{ | ||
83 | + | ||
84 | + targetEmpty((byte)1),sourceNotEmpty((byte)2),targetEmptyAndSourceNotEmpty((byte)3); | ||
85 | + | ||
86 | + private byte code; | ||
87 | + | ||
88 | + private MergeStrategy(byte code){ | ||
89 | + this.code = code; | ||
90 | + } | ||
91 | + | ||
92 | + public byte getCode(){ | ||
93 | + return code; | ||
94 | + } | ||
95 | + } | ||
96 | + | ||
97 | + public static void main(String[] args) { | ||
98 | + merge(new BusinessEvent(), new BusinessEvent(),MergeStrategy.targetEmpty, null); | ||
99 | + } | ||
100 | +} |
1 | +package cn.runsa.crmapp.base.utils; | ||
2 | + | ||
3 | +import java.io.ByteArrayInputStream; | ||
4 | +import java.io.FileOutputStream; | ||
5 | +import java.io.IOException; | ||
6 | + | ||
7 | +import org.apache.poi.poifs.filesystem.DirectoryEntry; | ||
8 | +import org.apache.poi.poifs.filesystem.POIFSFileSystem; | ||
9 | + | ||
10 | + | ||
11 | +public class ExportExcel { | ||
12 | + | ||
13 | + public static int exportDoc(String destFile, String fileContent) { | ||
14 | + try { | ||
15 | + | ||
16 | + StringBuffer sb = new StringBuffer(); | ||
17 | + sb.append("<html><head></head><body><div>sssssssssssss" + fileContent + "</div></body></html>"); | ||
18 | + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(sb.toString().getBytes("UTF-8")); | ||
19 | + POIFSFileSystem fileSystem = new POIFSFileSystem(); | ||
20 | + | ||
21 | + DirectoryEntry directory = fileSystem.getRoot(); | ||
22 | + directory.createDocument("WordDocument", byteArrayInputStream); | ||
23 | + | ||
24 | + FileOutputStream fileOutputStream = new FileOutputStream(destFile); | ||
25 | + fileSystem.writeFilesystem(fileOutputStream); | ||
26 | + | ||
27 | + byteArrayInputStream.close(); | ||
28 | + fileOutputStream.close(); | ||
29 | + return 1; | ||
30 | + } catch (IOException e) { | ||
31 | + return 0; | ||
32 | + } | ||
33 | + } | ||
34 | + | ||
35 | +} |
1 | +package cn.runsa.crmapp.base.utils; | ||
2 | + | ||
3 | +import com.google.common.base.Strings; | ||
4 | + | ||
5 | +public class FourBytesCharEscapeUtils { | ||
6 | + | ||
7 | + public static String escape(String str){ | ||
8 | + if(Strings.isNullOrEmpty(str)){ | ||
9 | + return str; | ||
10 | + }else{ | ||
11 | + byte[] conbyte = str.getBytes(); | ||
12 | + for (int i = 0; i < conbyte.length; i++) { | ||
13 | + //四字节,替换为? ? | ||
14 | + if ((conbyte[i] & 0xF8) == 0xF0) { | ||
15 | + for (int j = 0; j < 4; j+=2) { | ||
16 | + conbyte[i+j]=0x3f; | ||
17 | + } | ||
18 | + for (int j = 1; j < 4; j+=2) { | ||
19 | + conbyte[i+j]=0x20; | ||
20 | + } | ||
21 | + i += 3; | ||
22 | + } | ||
23 | + } | ||
24 | + str = new String(conbyte); | ||
25 | + return str; | ||
26 | + } | ||
27 | + } | ||
28 | +} |
1 | +package cn.runsa.crmapp.base.utils; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSON; | ||
4 | + | ||
5 | +public class JsonUtils { | ||
6 | + | ||
7 | + /** | ||
8 | + * 将java对象转换成json字符串 | ||
9 | + * | ||
10 | + * @param obj | ||
11 | + * 准备转换的对象 | ||
12 | + * @return json字符串 | ||
13 | + * @throws Exception | ||
14 | + */ | ||
15 | + public static String beanToJson(Object obj) { | ||
16 | + return JSON.toJSONString(obj); | ||
17 | + //.replaceAll("\\\\", "").replaceAll("\"", "\\\"") | ||
18 | + } | ||
19 | + | ||
20 | + /** | ||
21 | + * 将json字符串转换成java对象 | ||
22 | + * | ||
23 | + * @param json | ||
24 | + * 准备转换的json字符串 | ||
25 | + * @param cls | ||
26 | + * 准备转换的类 | ||
27 | + * @return | ||
28 | + * @throws Exception | ||
29 | + */ | ||
30 | + public static <T> T jsonToBean(String json, Class<T> cls) { | ||
31 | + return JSON.parseObject(json, cls); | ||
32 | + } | ||
33 | + | ||
34 | +} |
1 | +package cn.runsa.crmapp.base.utils; | ||
2 | + | ||
3 | +import org.springframework.beans.BeansException; | ||
4 | +import org.springframework.beans.factory.config.AutowireCapableBeanFactory; | ||
5 | +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; | ||
6 | +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; | ||
7 | +import org.springframework.stereotype.Component; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author Stephen | ||
11 | + */ | ||
12 | +@Component | ||
13 | +public final class SpringUtils implements BeanFactoryPostProcessor { | ||
14 | + | ||
15 | + private static ConfigurableListableBeanFactory beanFactory; | ||
16 | + | ||
17 | + @Override | ||
18 | + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { | ||
19 | + SpringUtils.beanFactory = beanFactory; | ||
20 | + } | ||
21 | + | ||
22 | + /** | ||
23 | + * 获取对象 | ||
24 | + */ | ||
25 | + public static Object getBean(String name) { | ||
26 | + return beanFactory.getBean(name); | ||
27 | + } | ||
28 | + | ||
29 | + /** | ||
30 | + * 获取对象 | ||
31 | + */ | ||
32 | + @SuppressWarnings("unchecked") | ||
33 | + public static <T> T getBean(String name, Class<T> clz) { | ||
34 | + T result = (T) beanFactory.getBean(name); | ||
35 | + return result; | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * 获取对象 | ||
40 | + */ | ||
41 | + public static <T> T getBean(Class<T> clz) { | ||
42 | + T result = (T) beanFactory.getBean(clz); | ||
43 | + return result; | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * 判断是否包含对象 | ||
48 | + */ | ||
49 | + public static boolean containsBean(String name) { | ||
50 | + return beanFactory.containsBean(name); | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * 创建对象到spring context | ||
55 | + */ | ||
56 | + @SuppressWarnings("unchecked") | ||
57 | + public static <T> T createBean(Class<T> clz) { | ||
58 | + T result = (T) beanFactory.createBean(clz, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, true); | ||
59 | + return result; | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * 删除对象 | ||
64 | + */ | ||
65 | + public static void destroyBean(String beanName) { | ||
66 | + beanFactory.destroyScopedBean(beanName); | ||
67 | + } | ||
68 | + | ||
69 | +} |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-common/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/bizevent/NormalAsyncBusinessEventListener.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/bizevent/support/TimesLimitedEventProcessor.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/entity/support/PolicyExecutionData.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/exception/runtime/BusinessRuntimeException.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/expression/DefaultLogicTranslator.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/open/auto/utils/AutoHttpSmsSender.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/sender/SmsChannel_SATURDAY_Sender.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/service/PolicyGoodsGroupMapperService.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/serviceImpl/AccountSetServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/serviceImpl/ApiAccountServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/serviceImpl/ApprovalProcessServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/serviceImpl/CustomerBehaveServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/serviceImpl/DiscountItemServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/serviceImpl/EventActionServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/serviceImpl/EventListenerServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/serviceImpl/ExcelImportServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/serviceImpl/StatementServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-common/src/main/java/cn/runsa/crmapp/common/serviceImpl/SysSettingServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-coupon/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-coupon/src/main/java/cn/runsa/crmapp/coupon/entity/CouponGrantShopperExample.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-coupon/src/main/java/cn/runsa/crmapp/coupon/event/CounponGrantApprovalListener.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-coupon/src/main/java/cn/runsa/crmapp/coupon/open/auto/msg/AutoDeliveryCoupon.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-coupon/src/main/java/cn/runsa/crmapp/coupon/open/auto/msg/AutoVerificationCoupon.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-coupon/src/main/java/cn/runsa/crmapp/coupon/open/auto/service/AutoCouponServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-coupon/src/main/java/cn/runsa/crmapp/coupon/serviceImpl/CouponRuleServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-coupon/src/main/java/cn/runsa/crmapp/coupon/serviceImpl/CouponsReceiptServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-coupon/src/test/java/db.xml
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/entity/CrmTagTemplatePopularArgument.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/entity/CrmTagTemplateRMFArgument.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/entity/CustomerRankPolicyDiscount.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/entity/CustomerSiteSaleTarget.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/event/CustomerRank4MemberCreatedHandler.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/event/CustomerWxgzhMergeHandler.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/mapper/CrmTagTemplateRMFArgumentMapper.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/mapper/CustAttentionSiteMapper.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/mapper/CustomerAccountMapper.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/mapper/CustomerAddressMapper.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/mapper/CustomerChatChannelMapper.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/mapper/CustomerEventItemMapper.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/mapper/CustomerNeedRatedMapper.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/mapper/CustomerProtocolMapper.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/mapper/CustomerRankPolicyDiscountMapper.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/mapper/CustomerSiteSaleTargetMapper.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/mapper/CustomerSuggestMapper.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/mapper/CustomerWxgzhExtMapper.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/open/auto/service/AutoCustomerService.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/service/CustomerAccountService.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/service/CustomerAddressService.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/service/CustomerBehaveService.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/service/CustomerEventService.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/service/CustomerOutBondService.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/service/CustomerProtocolService.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/service/CustomerRankChangeService.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/service/CustomerSiteSaleTargetService.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/service/CustomerSuggestService.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/service/CustomerWxgzhService.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/service/CustomersRankService.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/CouponMergeService.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/CustomerAccountServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/CustomerAddressServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/CustomerBehaveServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/CustomerEventServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/CustomerMergeService.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/CustomerOutBondServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/CustomerProtocolServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/CustomerRankServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/CustomerServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/CustomerSuggestServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/CustomerTagServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/CustomerWxgzhServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/CustomersRankServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/GuiderServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/PointMergeService.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/serviceImpl/RankPolicyServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/tag/CustomerConditionTagExecutor.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/tag/CustomerTagPopularBrandParser.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/tag/CustomerTemplateTagExecutor.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/tag/ProcedureConditionTagExecutor.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/tag/ProcedureRMFTemplateTagExecutor.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/tag/ProcedureTemplateTagExecutor.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/task/CustomerConditionTagTask.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/task/CustomerTemplateTagTask.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/java/cn/runsa/crmapp/customer/vo/CustomerAccountWithUpgradeId.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/resources/mybatis/xml/customer/CrmTagTemplatePopularArgumentMapper.xml
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/resources/mybatis/xml/customer/CrmTagTemplateRMFArgumentMapper.xml
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/resources/mybatis/xml/customer/CustomerRankPolicyDiscountMapper.xml
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-customer/src/main/resources/mybatis/xml/customer/CustomerSiteSaleTargetMapper.xml
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-goods/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-goods/src/main/java/cn/runsa/crmapp/goods/open/auto/msg/AutoCustomerCarListener.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-market/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-market/src/main/java/cn/runsa/crmapp/market/entity/CrmMarketActivityCustomer.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-market/src/main/java/cn/runsa/crmapp/market/event/MarketApprovalPassListener.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-market/src/main/java/cn/runsa/crmapp/market/mapper/CrmMarketActivityCustomerMapper.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-market/src/main/java/cn/runsa/crmapp/market/mapper/CrmMarketCouponItemMapper.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-market/src/main/java/cn/runsa/crmapp/market/serviceImpl/CrmMarketServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-market/src/main/java/cn/runsa/crmapp/market/serviceImpl/MarketParseServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-order/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-order/src/main/java/cn/runsa/crmapp/order/open/auto/msg/AutoSalesOrderListener.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-order/src/main/java/cn/runsa/crmapp/order/serviceImpl/CustomerSalesOrderServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-order/src/main/java/cn/runsa/crmapp/order/serviceImpl/OrderReceiptServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-points/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/event/ActivateEventPointsProcessor.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/event/BindedEventPointsProcessor.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/event/ConsumeEventPointsProcessor.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/event/PointAdjustApprovalListener.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/event/PointsReward4FanCreatedHandler.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/event/RatedAmountSegEventPointsProcessor.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/event/RatedDiscountSegEventPointsProcessor.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/event/RatedSegmentEventPointsParser.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/event/RegisterEventPointsProcessor.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/event/ScaleConsumeEventPointsParser.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/event/ScaleConsumeEventPointsProcessor.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/event/SimpleTimesLimitEventPointsProcessor.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/event/SubscribeEventPointsProcessor.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/open/auto/PointsReward4MemberCreatedRequest.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/open/auto/msg/AutoPointsBackUpListener.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/open/auto/msg/AutoPointsDecreaseListener.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/open/auto/msg/AutoPointsIncreaseListener.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/open/auto/service/AutoPointsService.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/policy/cash/PointsCashNonsupportParser.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/policy/expiration/PointsExpiryExecutor.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/policy/expiration/PointsExpiryNeverExecutor.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/policy/expiration/PointsExpiryNeverParser.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/service/CustomerPointsAccountService.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/serviceImpl/CustomerPointsServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/serviceImpl/DuibaNotifyServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/serviceImpl/DuibaOrdersServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/serviceImpl/PointAdjustItemServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/serviceImpl/PointAdjustServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/serviceImpl/PointsAccountServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/serviceImpl/PointsEventServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/serviceImpl/PointsExpirationServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/serviceImpl/PointsReceiptServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/serviceImpl/PointsSetPolicyServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/serviceImpl/PointsSetServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-points/src/main/java/cn/runsa/crmapp/points/serviceImpl/PointsTypeServiceImpl.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-rest/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-rest/src/main/java/cn/runsa/crmapp/rest/framework/AccountResourceAuthorization.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-rest/src/main/java/cn/runsa/crmapp/rest/open/auto/api/AutoCustomerController.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-rest/src/main/java/cn/runsa/crmapp/rest/open/duiba/api/DuibaCustomerController.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-rest/src/main/java/cn/runsa/crmapp/rest/open/duiba/api/DuibaNotifyController.java
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-rest/src/main/java/cn/runsa/crmapp/rest/open/duiba/api/DuibaPointsController.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-rest/src/main/java/cn/runsa/crmapp/rest/open/duiba/sdk/CreditNeedAuditParams.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-rest/src/main/resources/logback.xml
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-rest/src/main/webapp/WEB-INF/web.xml
0 → 100644
This diff is collapsed. Click to expand it.
crm/crm-server/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-server/src/main/java/cn/runsa/crmapp/server/listener/spring/ScheduleStopListener.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-server/src/main/java/cn/runsa/crmapp/server/task/CustomerPointsExpiredClearanceTask.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crm-server/src/main/java/cn/runsa/crmapp/server/task/listener/JobExecuteListener.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/crmapp/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
crm/portal/data/portal/ROOT/index.html
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/portal/data/portal/update/2016-04-11.sql
0 → 100644
This diff is collapsed. Click to expand it.
crm/portal/data/portal/update/2016-04-12.sql
0 → 100644
This diff is collapsed. Click to expand it.
crm/portal/data/portal/update/2016-04-13.sql
0 → 100644
This diff is collapsed. Click to expand it.
crm/portal/data/portal/update/2016-04-14.sql
0 → 100644
This diff is collapsed. Click to expand it.
crm/portal/data/portal/update/2016-04-19.sql
0 → 100644
This diff is collapsed. Click to expand it.
crm/portal/data/portal/update/2016-05-10.sql
0 → 100644
This diff is collapsed. Click to expand it.
crm/portal/data/portal/update/2016-06-28.sql
0 → 100644
This diff is collapsed. Click to expand it.
crm/portal/data/portal/update/2016-07-02.sql
0 → 100644
This diff is collapsed. Click to expand it.
crm/portal/data/portal/update/2016-07-11.sql
0 → 100644
This diff is collapsed. Click to expand it.
crm/portal/data/portal/update/2016-07-20.sql
0 → 100644
This diff is collapsed. Click to expand it.
crm/portal/data/portal/update/2016-07-30.sql
0 → 100644
This diff is collapsed. Click to expand it.
crm/portal/data/portal/国家省市区街道.rar
0 → 100644
No preview for this file type
crm/portal/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
crm/portal/portal.base/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
crm/portal/portal.base/src/main/java/cn/runsa/portal/base/QualifiedBeanNameGenerator.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
crm/portal/portal.base/src/main/java/cn/runsa/portal/base/entity/Excel_error_procedure.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment