Commit 2164fd1d17ef45a2a8cd068ab7cbb66ce4401119
1 parent
11b34fcc
ini
Showing
86 changed files
with
7318 additions
and
0 deletions
titan-cache/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 | + | ||
5 | + <groupId>com.dili.titan</groupId> | ||
6 | + <artifactId>titan-Sync</artifactId> | ||
7 | + <version>1.0</version> | ||
8 | + <packaging>war</packaging> | ||
9 | + | ||
10 | + | ||
11 | + <properties> | ||
12 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
13 | + <spring.version>3.2.9.RELEASE</spring.version> | ||
14 | + </properties> | ||
15 | + | ||
16 | + <profiles> | ||
17 | + <profile> | ||
18 | + <id>develop</id> | ||
19 | + <activation> | ||
20 | + <activeByDefault>true</activeByDefault> | ||
21 | + </activation> | ||
22 | + <properties> | ||
23 | + <titan.jdbc.driver>com.mysql.jdbc.Driver</titan.jdbc.driver> | ||
24 | + <titan.jdbc.url>jdbc:MySql://10.28.10.188:3306/agriez_titan?useUnicode=true&characterEncoding=utf8</titan.jdbc.url> | ||
25 | + <titan.jdbc.username>root</titan.jdbc.username> | ||
26 | + <titan.jdbc.password>123456</titan.jdbc.password> | ||
27 | + <!-- 日志 --> | ||
28 | + <dili_titan.log.level>INFO</dili_titan.log.level> | ||
29 | + <dili_titan.log.path>/export/logs</dili_titan.log.path> | ||
30 | + <dili_titan.log.root.appender>CONSOLE</dili_titan.log.root.appender> | ||
31 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
32 | + <!-- redis 地址 --> | ||
33 | + <cache.redis.url>10.28.10.208</cache.redis.url> | ||
34 | + <cache.redis.port>6379</cache.redis.port> | ||
35 | + <!-- MQ 地址--> | ||
36 | + <conf.mq.namesrvAddr>10.28.10.209:9876;10.28.10.149:9876</conf.mq.namesrvAddr> | ||
37 | + <conf.mq.producerGroup>TitanCachePNR</conf.mq.producerGroup> | ||
38 | + <dili_titan.website.url>manweb.1n4j.com</dili_titan.website.url> | ||
39 | + </properties> | ||
40 | + </profile> | ||
41 | + | ||
42 | + <profile> | ||
43 | + <id>test</id> | ||
44 | + <activation> | ||
45 | + <activeByDefault>false</activeByDefault> | ||
46 | + </activation> | ||
47 | + <properties> | ||
48 | + <titan.jdbc.driver>com.mysql.jdbc.Driver</titan.jdbc.driver> | ||
49 | + <titan.jdbc.url>jdbc:MySql://10.28.6.156:3306/agriez_titan?useUnicode=true&characterEncoding=utf8</titan.jdbc.url> | ||
50 | + <titan.jdbc.username>root</titan.jdbc.username> | ||
51 | + <titan.jdbc.password>123456</titan.jdbc.password> | ||
52 | + <!-- 日志 --> | ||
53 | + <dili_titan.log.level>INFO</dili_titan.log.level> | ||
54 | + <dili_titan.log.path>/home/tomcat/export</dili_titan.log.path> | ||
55 | + <dili_titan.log.root.appender>CONSOLE</dili_titan.log.root.appender> | ||
56 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
57 | + <!-- redis 地址 --> | ||
58 | + <cache.redis.url>10.28.10.207</cache.redis.url> | ||
59 | + <cache.redis.port>6379</cache.redis.port> | ||
60 | + <!-- MQ 地址--> | ||
61 | + <conf.mq.namesrvAddr>10.28.10.230:9876</conf.mq.namesrvAddr> | ||
62 | + <conf.mq.producerGroup>TitanCachePNR</conf.mq.producerGroup> | ||
63 | + <dili_titan.website.url>manweb.1n4j.com</dili_titan.website.url> | ||
64 | + </properties> | ||
65 | + </profile> | ||
66 | + | ||
67 | + <profile> | ||
68 | + <id>online</id> | ||
69 | + <activation> | ||
70 | + <activeByDefault>false</activeByDefault> | ||
71 | + </activation> | ||
72 | + <properties> | ||
73 | + <titan.jdbc.driver>com.mysql.jdbc.Driver</titan.jdbc.driver> | ||
74 | + <titan.jdbc.url>jdbc:MySql://titan.db.1n4j.com:3306/agriez_titan?useUnicode=true&characterEncoding=utf8</titan.jdbc.url> | ||
75 | + <titan.jdbc.username>appAccPayor</titan.jdbc.username> | ||
76 | + <titan.jdbc.password>iTDYVBtI6MX4NQ3Er2Oh</titan.jdbc.password> | ||
77 | + <dili_titan.log.level>INFO</dili_titan.log.level> | ||
78 | + <dili_titan.log.path>/diliapp/servers/logs</dili_titan.log.path> | ||
79 | + <dili_titan.log.root.appender>FILE_ALL</dili_titan.log.root.appender> | ||
80 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
81 | + <!-- redis 地址 --> | ||
82 | + <cache.redis.url>redis.1n4j.com</cache.redis.url> | ||
83 | + <cache.redis.port>6379</cache.redis.port> | ||
84 | + <!-- MQ 地址--> | ||
85 | + <conf.mq.namesrvAddr>192.168.60.62:9876;192.168.60.63:9876</conf.mq.namesrvAddr> | ||
86 | + <conf.mq.producerGroup>cachePNR</conf.mq.producerGroup> | ||
87 | + <dili_titan.website.url>manweb.1n4j.com</dili_titan.website.url> | ||
88 | + </properties> | ||
89 | + </profile> | ||
90 | + | ||
91 | + <profile> | ||
92 | + <id>pnr-clone</id> | ||
93 | + <activation> | ||
94 | + <activeByDefault>false</activeByDefault> | ||
95 | + </activation> | ||
96 | + <properties> | ||
97 | + <titan.jdbc.driver>com.mysql.jdbc.Driver</titan.jdbc.driver> | ||
98 | + <titan.jdbc.url>jdbc:MySql://10.28.5.236:3306/titan?useUnicode=true&characterEncoding=utf8</titan.jdbc.url> | ||
99 | + <titan.jdbc.username>root</titan.jdbc.username> | ||
100 | + <titan.jdbc.password>123456</titan.jdbc.password> | ||
101 | + <!-- 日志 --> | ||
102 | + <dili_titan.log.level>INFO</dili_titan.log.level> | ||
103 | + <dili_titan.log.path>/home/tomcat/export</dili_titan.log.path> | ||
104 | + <dili_titan.log.root.appender>CONSOLE | ||
105 | + </dili_titan.log.root.appender> | ||
106 | + <project.build.sourceEncoding>UTF-8 | ||
107 | + </project.build.sourceEncoding> | ||
108 | + <!-- redis 地址 --> | ||
109 | + <cache.redis.url>10.28.5.200</cache.redis.url> | ||
110 | + <cache.redis.port>6379</cache.redis.port> | ||
111 | + <!-- MQ 地址--> | ||
112 | + <conf.mq.namesrvAddr>10.28.5.202:9876;10.28.5.203:9876</conf.mq.namesrvAddr> | ||
113 | + <conf.mq.producerGroup>cachePNR</conf.mq.producerGroup> | ||
114 | + <dili_titan.website.url>manweb.1n4j.com</dili_titan.website.url> | ||
115 | + </properties> | ||
116 | + </profile> | ||
117 | + </profiles> | ||
118 | + | ||
119 | + <dependencies> | ||
120 | + <dependency> | ||
121 | + <groupId>junit</groupId> | ||
122 | + <artifactId>junit</artifactId> | ||
123 | + <version>4.10</version> | ||
124 | + <scope>test</scope> | ||
125 | + </dependency> | ||
126 | + <dependency> | ||
127 | + <groupId>org.slf4j</groupId> | ||
128 | + <artifactId>slf4j-api</artifactId> | ||
129 | + <version>1.6.4</version> | ||
130 | + </dependency> | ||
131 | + <dependency> | ||
132 | + <groupId>org.slf4j</groupId> | ||
133 | + <artifactId>slf4j-log4j12</artifactId> | ||
134 | + <version>1.6.4</version> | ||
135 | + </dependency> | ||
136 | + <dependency> | ||
137 | + <groupId>log4j</groupId> | ||
138 | + <artifactId>log4j</artifactId> | ||
139 | + <version>1.2.17</version> | ||
140 | + </dependency> | ||
141 | + <dependency> | ||
142 | + <groupId>commons-lang</groupId> | ||
143 | + <artifactId>commons-lang</artifactId> | ||
144 | + <version>2.5</version> | ||
145 | + </dependency> | ||
146 | + <dependency> | ||
147 | + <groupId>commons-collections</groupId> | ||
148 | + <artifactId>commons-collections</artifactId> | ||
149 | + <version>3.2.1</version> | ||
150 | + </dependency> | ||
151 | + <dependency> | ||
152 | + <groupId>commons-logging</groupId> | ||
153 | + <artifactId>commons-logging</artifactId> | ||
154 | + <version>1.1.3</version> | ||
155 | + </dependency> | ||
156 | + <dependency> | ||
157 | + <groupId>org.springframework</groupId> | ||
158 | + <artifactId>spring-jdbc</artifactId> | ||
159 | + <version>${spring.version}</version> | ||
160 | + </dependency> | ||
161 | + <dependency> | ||
162 | + <groupId>org.springframework</groupId> | ||
163 | + <artifactId>spring-context-support</artifactId> | ||
164 | + <version>${spring.version}</version> | ||
165 | + </dependency> | ||
166 | + <dependency> | ||
167 | + <groupId>org.springframework</groupId> | ||
168 | + <artifactId>spring-web</artifactId> | ||
169 | + <version>${spring.version}</version> | ||
170 | + </dependency> | ||
171 | + <dependency> | ||
172 | + <groupId>org.springframework</groupId> | ||
173 | + <artifactId>spring-webmvc</artifactId> | ||
174 | + <version>${spring.version}</version> | ||
175 | + </dependency> | ||
176 | + <dependency> | ||
177 | + <groupId>org.mybatis</groupId> | ||
178 | + <artifactId>mybatis</artifactId> | ||
179 | + <version>3.2.1</version> | ||
180 | + </dependency> | ||
181 | + <dependency> | ||
182 | + <groupId>org.mybatis</groupId> | ||
183 | + <artifactId>mybatis-spring</artifactId> | ||
184 | + <version>1.2.0</version> | ||
185 | + </dependency> | ||
186 | + <dependency> | ||
187 | + <groupId>mysql</groupId> | ||
188 | + <artifactId>mysql-connector-java</artifactId> | ||
189 | + <version>5.1.30</version> | ||
190 | + </dependency> | ||
191 | + <dependency> | ||
192 | + <groupId>com.alibaba</groupId> | ||
193 | + <artifactId>druid</artifactId> | ||
194 | + <version>1.0.11</version> | ||
195 | + </dependency> | ||
196 | + <dependency> | ||
197 | + <groupId>org.springframework</groupId> | ||
198 | + <artifactId>spring-context</artifactId> | ||
199 | + <version>${spring.version}</version> | ||
200 | + </dependency> | ||
201 | + <dependency> | ||
202 | + <groupId>com.diligrp.util.rocketMQUtil</groupId> | ||
203 | + <artifactId>diligrp-util-rocketMQUtil</artifactId> | ||
204 | + <version>0.0.1-SNAPSHOT</version> | ||
205 | + <exclusions> | ||
206 | + <exclusion> | ||
207 | + <artifactId>jackson-core-asl</artifactId> | ||
208 | + <groupId>org.codehaus.jackson</groupId> | ||
209 | + </exclusion> | ||
210 | + </exclusions> | ||
211 | + </dependency> | ||
212 | + <dependency> | ||
213 | + <groupId>org.springframework</groupId> | ||
214 | + <artifactId>spring-test</artifactId> | ||
215 | + <version>${spring.version}</version> | ||
216 | + <scope>test</scope> | ||
217 | + </dependency> | ||
218 | + <dependency> | ||
219 | + <groupId>redis.clients</groupId> | ||
220 | + <artifactId>jedis</artifactId> | ||
221 | + <version>2.4.2</version> | ||
222 | + </dependency> | ||
223 | + <dependency> | ||
224 | + <groupId>org.springframework.data</groupId> | ||
225 | + <artifactId>spring-data-redis</artifactId> | ||
226 | + <version>1.3.0.RELEASE</version> | ||
227 | + </dependency> | ||
228 | + <dependency> | ||
229 | + <groupId>org.codehaus.jackson</groupId> | ||
230 | + <artifactId>jackson-mapper-asl</artifactId> | ||
231 | + <version>1.9.2</version> | ||
232 | + </dependency> | ||
233 | + <!-- JSON --> | ||
234 | + <dependency> | ||
235 | + <groupId>com.alibaba</groupId> | ||
236 | + <artifactId>fastjson</artifactId> | ||
237 | + <version>1.1.31</version> | ||
238 | + </dependency> | ||
239 | + | ||
240 | + <dependency> | ||
241 | + <groupId>com.yqyw.website.web</groupId> | ||
242 | + <artifactId>diligrp-website-api</artifactId> | ||
243 | + <version>1.0.3-SNAPSHOT</version> | ||
244 | + </dependency> | ||
245 | + <dependency> | ||
246 | + <artifactId>diligrp-website-util</artifactId> | ||
247 | + <groupId>com.diligrp.website</groupId> | ||
248 | + <version>0.0.1-SNAPSHOT</version> | ||
249 | + </dependency> | ||
250 | + | ||
251 | + </dependencies> | ||
252 | + | ||
253 | + <build> | ||
254 | + <resources> | ||
255 | + <resource> | ||
256 | + <directory>src/main/resources</directory> | ||
257 | + <filtering>true</filtering> | ||
258 | + </resource> | ||
259 | + </resources> | ||
260 | + <plugins> | ||
261 | + <plugin> | ||
262 | + <groupId>org.apache.maven.plugins</groupId> | ||
263 | + <artifactId>maven-war-plugin</artifactId> | ||
264 | + <version>2.3</version> | ||
265 | + </plugin> | ||
266 | + <plugin> | ||
267 | + <groupId>org.apache.maven.plugins</groupId> | ||
268 | + <artifactId>maven-compiler-plugin</artifactId> | ||
269 | + <version>2.5.1</version> | ||
270 | + <configuration> | ||
271 | + <source>1.6</source> | ||
272 | + <target>1.6</target> | ||
273 | + <encoding>UTF-8</encoding> | ||
274 | + </configuration> | ||
275 | + </plugin> | ||
276 | + <plugin> | ||
277 | + <groupId>org.apache.maven.plugins</groupId> | ||
278 | + <artifactId>maven-surefire-plugin</artifactId> | ||
279 | + <version>2.17</version> | ||
280 | + <configuration> | ||
281 | + <skipTests>true</skipTests> | ||
282 | + </configuration> | ||
283 | + </plugin> | ||
284 | + <plugin> | ||
285 | + <groupId>org.mortbay.jetty</groupId> | ||
286 | + <artifactId>maven-jetty-plugin</artifactId> | ||
287 | + <version>6.1.26</version> | ||
288 | + <configuration> | ||
289 | + <scanIntervalSeconds>3</scanIntervalSeconds> | ||
290 | + <contextPath>/</contextPath> | ||
291 | + <connectors> | ||
292 | + <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> | ||
293 | + <port>8080</port> | ||
294 | + </connector> | ||
295 | + </connectors> | ||
296 | + </configuration> | ||
297 | + </plugin> | ||
298 | + </plugins> | ||
299 | + </build> | ||
300 | +</project> |
titan-cache/src/main/java/com/dili/titan/dao/BaseDao.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.dao; | ||
6 | + | ||
7 | + | ||
8 | +import java.io.Serializable; | ||
9 | +import java.util.List; | ||
10 | + | ||
11 | +/** | ||
12 | + * dao基类<实体,主键> | ||
13 | + * | ||
14 | + * @author dev-center | ||
15 | + * @since 2014-05-10 | ||
16 | + * @param <T> | ||
17 | + * 实体 | ||
18 | + * @param <KEY> | ||
19 | + * 主键 | ||
20 | + */ | ||
21 | +public interface BaseDao<T, KEY extends Serializable> { | ||
22 | + | ||
23 | + /** | ||
24 | + * 添加对象 | ||
25 | + * | ||
26 | + * @param t | ||
27 | + * @return 影响条数 | ||
28 | + */ | ||
29 | + int insertEntry(T... t); | ||
30 | + | ||
31 | + /** | ||
32 | + * 删除对象,主键 | ||
33 | + * | ||
34 | + * @param key | ||
35 | + * @return 影响条数 | ||
36 | + */ | ||
37 | + int deleteByKey(KEY... key); | ||
38 | + | ||
39 | + /** | ||
40 | + * 更新对象,条件主键ID | ||
41 | + * | ||
42 | + * @param t | ||
43 | + * @return 影响条数 | ||
44 | + */ | ||
45 | + int updateByKey(T t); | ||
46 | + | ||
47 | + /** | ||
48 | + * 查询对象,条件主键 | ||
49 | + * | ||
50 | + * @param key | ||
51 | + * @return | ||
52 | + */ | ||
53 | + T selectEntry(KEY key); | ||
54 | + | ||
55 | + /** | ||
56 | + * 查询对象,条件主键数组 | ||
57 | + * | ||
58 | + * @param key | ||
59 | + * @return | ||
60 | + */ | ||
61 | + List<T> selectEntryList(KEY... key); | ||
62 | + | ||
63 | + /** | ||
64 | + * 查询对象,只要不为NULL与空则为条件 | ||
65 | + * | ||
66 | + * @param t | ||
67 | + * @return | ||
68 | + */ | ||
69 | + List<T> selectEntryList(T t); | ||
70 | + | ||
71 | + /** | ||
72 | + * 查询对象总数 | ||
73 | + * | ||
74 | + * @param t | ||
75 | + * @return | ||
76 | + */ | ||
77 | + Integer selectEntryListCount(T t); | ||
78 | +} |
titan-cache/src/main/java/com/dili/titan/dao/BaseDaoImpl.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.dao; | ||
6 | + | ||
7 | + | ||
8 | +import java.io.Serializable; | ||
9 | +import java.util.List; | ||
10 | + | ||
11 | +/** | ||
12 | + * dao实现类 | ||
13 | + * | ||
14 | + * @author dev-center | ||
15 | + * @since 2014-05-10 | ||
16 | + * @param <T> | ||
17 | + * 实体 | ||
18 | + * @param <KEY> | ||
19 | + * 主键 | ||
20 | + */ | ||
21 | +public abstract class BaseDaoImpl<T, KEY extends Serializable> extends MyBatisSupport implements BaseDao<T, KEY> { | ||
22 | + private static final String DEFAULT_INSERT_KEY = "insertEntry"; | ||
23 | + private static final String DEFAULT_DELETE_ARRAY_KEY = "deleteByArrayKey"; | ||
24 | + private static final String DEFAULT_UPDATE_KEY = "updateByKey"; | ||
25 | + private static final String DEFAULT_SELECT_ARRAY_KEY = "selectEntryArray"; | ||
26 | + private static final String DEFAULT_SELECT_CONDTION = "selectEntryList"; | ||
27 | + private static final String DEFAULT_SELECT_CONDTION_COUNT = "selectEntryListCount"; | ||
28 | + | ||
29 | + /** | ||
30 | + * 获取命名空间前缀 | ||
31 | + * | ||
32 | + * @param statement | ||
33 | + * @return | ||
34 | + */ | ||
35 | + public abstract String getNameSpace(String statement); | ||
36 | + | ||
37 | + public int insertEntry(T... t) { | ||
38 | + int result = 0; | ||
39 | + if (t == null || t.length <= 0) { | ||
40 | + return result; | ||
41 | + } | ||
42 | + for (T o : t) { | ||
43 | + if (o != null) { | ||
44 | + result += this.insert(getNameSpace(DEFAULT_INSERT_KEY), o); | ||
45 | + } | ||
46 | + } | ||
47 | + return result; | ||
48 | + } | ||
49 | + | ||
50 | + | ||
51 | + public int deleteByKey(KEY... key) { | ||
52 | + return this.delete(getNameSpace(DEFAULT_DELETE_ARRAY_KEY), key); | ||
53 | + } | ||
54 | + | ||
55 | + | ||
56 | + public int updateByKey(T t) { | ||
57 | + return this.update(getNameSpace(DEFAULT_UPDATE_KEY), t); | ||
58 | + } | ||
59 | + | ||
60 | + public T selectEntry(KEY key) { | ||
61 | + @SuppressWarnings("unchecked") | ||
62 | + List<T> list = this.selectEntryList(key); | ||
63 | + if (list != null && list.size() > 0) { | ||
64 | + return list.get(0); | ||
65 | + } | ||
66 | + return null; | ||
67 | + } | ||
68 | + | ||
69 | + public List<T> selectEntryList(KEY... key) { | ||
70 | + if (key == null || key.length <= 0) { | ||
71 | + return null; | ||
72 | + } | ||
73 | + return this.selectList(getNameSpace(DEFAULT_SELECT_ARRAY_KEY), key); | ||
74 | + } | ||
75 | + | ||
76 | + public List<T> selectEntryList(T t) { | ||
77 | + return this.selectList(getNameSpace(DEFAULT_SELECT_CONDTION), t); | ||
78 | + } | ||
79 | + | ||
80 | + public Integer selectEntryListCount(T t) { | ||
81 | + return this.select(getNameSpace(DEFAULT_SELECT_CONDTION_COUNT), t); | ||
82 | + } | ||
83 | + | ||
84 | +} |
titan-cache/src/main/java/com/dili/titan/dao/MyBatisSupport.java
0 → 100644
1 | +package com.dili.titan.dao; | ||
2 | + | ||
3 | +import com.dili.titan.exception.TitanException; | ||
4 | +import org.mybatis.spring.SqlSessionTemplate; | ||
5 | +import org.slf4j.Logger; | ||
6 | +import org.slf4j.LoggerFactory; | ||
7 | + | ||
8 | +import javax.annotation.Resource; | ||
9 | +import java.util.List; | ||
10 | +import java.util.Map; | ||
11 | + | ||
12 | +/** | ||
13 | + * | ||
14 | + * | ||
15 | + */ | ||
16 | +abstract class MyBatisSupport { | ||
17 | + protected static final Logger LOGGER = LoggerFactory.getLogger(MyBatisSupport.class); | ||
18 | + @Resource | ||
19 | + private SqlSessionTemplate sqlTemplate; | ||
20 | + | ||
21 | + /** | ||
22 | + * | ||
23 | + * | ||
24 | + * @param readonly | ||
25 | + * @return | ||
26 | + */ | ||
27 | + protected SqlSessionTemplate getSqlTemplate(boolean readonly) { | ||
28 | + if (readonly) { | ||
29 | + | ||
30 | + } | ||
31 | + return sqlTemplate; | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * 新增对象 | ||
36 | + * | ||
37 | + * @param statement | ||
38 | + * @param parameter | ||
39 | + * @return | ||
40 | + */ | ||
41 | + protected int insert(String statement, Object parameter) { | ||
42 | + int res = 0; | ||
43 | + try { | ||
44 | + if (parameter != null) { | ||
45 | + res = getSqlTemplate(false).insert(statement, parameter); | ||
46 | + } | ||
47 | + } catch (Exception ex) { | ||
48 | + throw new TitanException("Mybatis执行新增异常", ex); | ||
49 | + } | ||
50 | + return res; | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * 删除对象 | ||
55 | + * | ||
56 | + * @param statement | ||
57 | + * @param parameter | ||
58 | + * @return | ||
59 | + */ | ||
60 | + protected int delete(String statement, Object parameter) { | ||
61 | + int res = 0; | ||
62 | + try { | ||
63 | + res = getSqlTemplate(false).delete(statement, parameter); | ||
64 | + } catch (Exception ex) { | ||
65 | + throw new TitanException("Mybatis执行删除异常", ex); | ||
66 | + } | ||
67 | + return res; | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * 更新对象 | ||
72 | + * | ||
73 | + * @param statement | ||
74 | + * @param parameter | ||
75 | + * @return | ||
76 | + */ | ||
77 | + protected int update(String statement, Object parameter) { | ||
78 | + int res = 0; | ||
79 | + try { | ||
80 | + if (parameter != null) { | ||
81 | + res = getSqlTemplate(false).update(statement, parameter); | ||
82 | + } | ||
83 | + } catch (Exception ex) { | ||
84 | + throw new TitanException("Mybatis执行更新异常", ex); | ||
85 | + } | ||
86 | + return res; | ||
87 | + } | ||
88 | + | ||
89 | + /** | ||
90 | + * 查询一条记录 | ||
91 | + * | ||
92 | + * @param <T> | ||
93 | + * @param statement | ||
94 | + * @param parameter | ||
95 | + * @param clz | ||
96 | + * @return | ||
97 | + */ | ||
98 | + @SuppressWarnings("unchecked") | ||
99 | + protected <T> T select(String statement, Object parameter) { | ||
100 | + T obj = null; | ||
101 | + try { | ||
102 | + obj = (T) getSqlTemplate(true).selectOne(statement, parameter); | ||
103 | + } catch (Exception ex) { | ||
104 | + throw new TitanException("Mybatis执行单条查询异常", ex); | ||
105 | + } | ||
106 | + return obj; | ||
107 | + } | ||
108 | + | ||
109 | + /** | ||
110 | + * 查询列表 | ||
111 | + * | ||
112 | + * @param <T> | ||
113 | + * @param statement | ||
114 | + * @param parameter | ||
115 | + * @param clz | ||
116 | + * @return | ||
117 | + */ | ||
118 | + protected <T> List<T> selectList(String statement, Object parameter) { | ||
119 | + List<T> list = null; | ||
120 | + try { | ||
121 | + list = getSqlTemplate(true).selectList(statement, parameter); | ||
122 | + } catch (Exception ex) { | ||
123 | + throw new TitanException("Mybatis执行列表查询异常", ex); | ||
124 | + } | ||
125 | + return list; | ||
126 | + } | ||
127 | + | ||
128 | + /** | ||
129 | + * 查询列表(无参数) | ||
130 | + * | ||
131 | + * @param statement | ||
132 | + * @return | ||
133 | + */ | ||
134 | + protected <T> List<T> selectList(String statement) { | ||
135 | + List<T> list = null; | ||
136 | + try { | ||
137 | + list = getSqlTemplate(true).selectList(statement); | ||
138 | + } catch (Exception ex) { | ||
139 | + throw new TitanException("Mybatis执行列表查询异常", ex); | ||
140 | + } | ||
141 | + return list; | ||
142 | + } | ||
143 | + | ||
144 | + /** | ||
145 | + * 查询Map | ||
146 | + * | ||
147 | + * @param <K> | ||
148 | + * @param <V> | ||
149 | + * @param statement | ||
150 | + * @param parameter | ||
151 | + * @param mapKey | ||
152 | + * @return | ||
153 | + */ | ||
154 | + protected <K, V> Map<K, V> selectMap(String statement, Object parameter, String mapKey) { | ||
155 | + Map<K, V> map = null; | ||
156 | + try { | ||
157 | + map = getSqlTemplate(true).selectMap(statement, parameter, mapKey); | ||
158 | + } catch (Exception ex) { | ||
159 | + throw new TitanException("Mybatis执行Map查询异常", ex); | ||
160 | + } | ||
161 | + return map; | ||
162 | + } | ||
163 | +} |
titan-cache/src/main/java/com/dili/titan/dao/gq/PresaleDao.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.dao.gq; | ||
6 | + | ||
7 | + | ||
8 | +import com.dili.titan.dao.BaseDao; | ||
9 | +import com.dili.titan.domain.gq.Presale; | ||
10 | +import com.dili.titan.domain.gq.Supply; | ||
11 | + | ||
12 | +import java.util.List; | ||
13 | + | ||
14 | +/** | ||
15 | + * SupplyDao 接口 | ||
16 | + * @author dev-center | ||
17 | + * @since 2014-12-16 | ||
18 | + */ | ||
19 | +public interface PresaleDao extends BaseDao<Presale,Long> { | ||
20 | + | ||
21 | + /** | ||
22 | + * 更新用户手机号 | ||
23 | + * @param userId | ||
24 | + * @param phone | ||
25 | + */ | ||
26 | + public void updatePhone(Long userId,String phone); | ||
27 | +} | ||
0 | \ No newline at end of file | 28 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/dao/gq/PurchaseDao.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.dao.gq; | ||
6 | + | ||
7 | + | ||
8 | +import com.dili.titan.dao.BaseDao; | ||
9 | +import com.dili.titan.domain.gq.Purchase; | ||
10 | + | ||
11 | +import java.util.List; | ||
12 | + | ||
13 | +/** | ||
14 | + * PurchaseDao 接口 | ||
15 | + * @author dev-center | ||
16 | + * @since 2014-12-16 | ||
17 | + */ | ||
18 | +public interface PurchaseDao extends BaseDao<Purchase,Long> { | ||
19 | + /** | ||
20 | + * 更新用户手机号 | ||
21 | + * @param userId | ||
22 | + * @param phone | ||
23 | + */ | ||
24 | + public void updatePhone(Long userId,String phone); | ||
25 | +} | ||
0 | \ No newline at end of file | 26 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/dao/gq/SupplyDao.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.dao.gq; | ||
6 | + | ||
7 | + | ||
8 | +import com.dili.titan.dao.BaseDao; | ||
9 | +import com.dili.titan.domain.gq.Supply; | ||
10 | + | ||
11 | +import java.util.List; | ||
12 | + | ||
13 | +/** | ||
14 | + * SupplyDao 接口 | ||
15 | + * @author dev-center | ||
16 | + * @since 2014-12-16 | ||
17 | + */ | ||
18 | +public interface SupplyDao extends BaseDao<Supply,Long> { | ||
19 | + /** | ||
20 | + * 更新用户手机号 | ||
21 | + * @param userId | ||
22 | + * @param phone | ||
23 | + */ | ||
24 | + public void updatePhone(Long userId,String phone); | ||
25 | +} | ||
0 | \ No newline at end of file | 26 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/dao/gq/impl/PresaleDaoImpl.java
0 → 100644
1 | +package com.dili.titan.dao.gq.impl; | ||
2 | + | ||
3 | +import com.dili.titan.dao.BaseDaoImpl; | ||
4 | +import com.dili.titan.dao.gq.PresaleDao; | ||
5 | +import com.dili.titan.domain.gq.Presale; | ||
6 | +import org.springframework.stereotype.Repository; | ||
7 | + | ||
8 | +import java.util.HashMap; | ||
9 | +import java.util.Map; | ||
10 | + | ||
11 | +/** | ||
12 | + * Created by gsz on 2015/7/27. | ||
13 | + */ | ||
14 | +@Repository | ||
15 | +public class PresaleDaoImpl extends BaseDaoImpl<Presale,Long> implements PresaleDao { | ||
16 | + private final static String NAMESPACE = "com.dili.titan.dao.gq.PresaleDao."; | ||
17 | + | ||
18 | + //返回本DAO命名空间,并添加statement | ||
19 | + public String getNameSpace(String statement) { | ||
20 | + return NAMESPACE + statement; | ||
21 | + } | ||
22 | + | ||
23 | + @Override | ||
24 | + public void updatePhone(Long userId, String phone) { | ||
25 | + Map<String,Object> conditionMap = new HashMap<String,Object>(); | ||
26 | + conditionMap.put("userId",userId); | ||
27 | + conditionMap.put("phone",phone); | ||
28 | + this.update(getNameSpace("updatePhone"),conditionMap); | ||
29 | + } | ||
30 | +} |
titan-cache/src/main/java/com/dili/titan/dao/gq/impl/PurchaseDaoImpl.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.dao.gq.impl; | ||
6 | + | ||
7 | +import com.dili.titan.dao.BaseDaoImpl; | ||
8 | +import com.dili.titan.dao.gq.PurchaseDao; | ||
9 | +import com.dili.titan.domain.gq.Purchase; | ||
10 | +import org.springframework.stereotype.Repository; | ||
11 | + | ||
12 | +import java.util.HashMap; | ||
13 | +import java.util.List; | ||
14 | +import java.util.Map; | ||
15 | + | ||
16 | + | ||
17 | +/** | ||
18 | + * PurchaseDao 实现类 | ||
19 | + * @author dev-center | ||
20 | + * @since 2014-12-16 | ||
21 | + */ | ||
22 | +@Repository("purchaseDao") | ||
23 | +public class PurchaseDaoImpl extends BaseDaoImpl<Purchase,Long> implements PurchaseDao { | ||
24 | + private final static String NAMESPACE = "com.dili.titan.dao.gq.PurchaseDao."; | ||
25 | + | ||
26 | + //返回本DAO命名空间,并添加statement | ||
27 | + public String getNameSpace(String statement) { | ||
28 | + return NAMESPACE + statement; | ||
29 | + } | ||
30 | + @Override | ||
31 | + public void updatePhone(Long userId, String phone) { | ||
32 | + Map<String,Object> conditionMap = new HashMap<String,Object>(); | ||
33 | + conditionMap.put("userId",userId); | ||
34 | + conditionMap.put("phone",phone); | ||
35 | + this.update(getNameSpace("updatePhone"),conditionMap); | ||
36 | + } | ||
37 | +} |
titan-cache/src/main/java/com/dili/titan/dao/gq/impl/SupplyDaoImpl.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.dao.gq.impl; | ||
6 | + | ||
7 | +import com.dili.titan.dao.BaseDaoImpl; | ||
8 | +import com.dili.titan.dao.gq.SupplyDao; | ||
9 | +import com.dili.titan.domain.gq.Supply; | ||
10 | +import org.springframework.stereotype.Repository; | ||
11 | + | ||
12 | +import java.util.HashMap; | ||
13 | +import java.util.List; | ||
14 | +import java.util.Map; | ||
15 | + | ||
16 | +/** | ||
17 | + * SupplyDao 实现类 | ||
18 | + * | ||
19 | + * @author dev-center | ||
20 | + * @since 2014-12-16 | ||
21 | + */ | ||
22 | +@Repository("supplyDao") | ||
23 | +public class SupplyDaoImpl extends BaseDaoImpl<Supply, Long> implements | ||
24 | + SupplyDao { | ||
25 | + private final static String NAMESPACE = "com.dili.titan.dao.gq.SupplyDao."; | ||
26 | + | ||
27 | + // 返回本DAO命名空间,并添加statement | ||
28 | + public String getNameSpace(String statement) { | ||
29 | + return NAMESPACE + statement; | ||
30 | + } | ||
31 | + @Override | ||
32 | + public void updatePhone(Long userId, String phone) { | ||
33 | + Map<String,Object> conditionMap = new HashMap<String,Object>(); | ||
34 | + conditionMap.put("userId",userId); | ||
35 | + conditionMap.put("phone",phone); | ||
36 | + this.update(getNameSpace("updatePhone"),conditionMap); | ||
37 | + } | ||
38 | +} |
titan-cache/src/main/java/com/dili/titan/dao/impl/AttributeDao.java
0 → 100644
1 | +package com.dili.titan.dao.impl; | ||
2 | + | ||
3 | +import com.dili.titan.dao.BaseDaoImpl; | ||
4 | +import com.dili.titan.domain.Attribute; | ||
5 | +import com.dili.titan.domain.AttributeValue; | ||
6 | +import org.springframework.stereotype.Repository; | ||
7 | + | ||
8 | +import java.util.List; | ||
9 | + | ||
10 | +/** | ||
11 | + * AttributeDao 实现类 | ||
12 | + * | ||
13 | + * @author dev-center | ||
14 | + * @since 2014-05-10 | ||
15 | + */ | ||
16 | +@Repository("attributeDao") | ||
17 | +public class AttributeDao extends BaseDaoImpl<Attribute, Long> { | ||
18 | + private final static String NAMESPACE = "com.dili.titan.dao.AttributeDao."; | ||
19 | + | ||
20 | + // 返回本DAO命名空间,并添加statement | ||
21 | + public String getNameSpace(String statement) { | ||
22 | + return NAMESPACE + statement; | ||
23 | + } | ||
24 | + | ||
25 | + /** | ||
26 | + * 查询属性的所有属性值 | ||
27 | + * | ||
28 | + * @param attrId | ||
29 | + * @return | ||
30 | + */ | ||
31 | + public List<AttributeValue> getAttributeValues(long attrId) { | ||
32 | + return this.selectList(getNameSpace("selectAttributeValue"), attrId); | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * 查询所有的属性 | ||
37 | + * | ||
38 | + * @return | ||
39 | + */ | ||
40 | + public List<Attribute> getAllAttribute() { | ||
41 | + return this.selectList(getNameSpace("selectAllEntry")); | ||
42 | + } | ||
43 | +} | ||
0 | \ No newline at end of file | 44 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/dao/impl/CategoryDao.java
0 → 100644
1 | +package com.dili.titan.dao.impl; | ||
2 | + | ||
3 | +import com.dili.titan.dao.BaseDaoImpl; | ||
4 | +import com.dili.titan.domain.Category; | ||
5 | +import com.dili.titan.domain.CategoryAttr; | ||
6 | +import org.springframework.stereotype.Repository; | ||
7 | + | ||
8 | +import java.util.List; | ||
9 | + | ||
10 | +/** | ||
11 | + * CategoryDao 实现类 | ||
12 | + * | ||
13 | + * @author dev-center | ||
14 | + * @since 2014-05-10 | ||
15 | + */ | ||
16 | +@Repository("categoryDao") | ||
17 | +public class CategoryDao extends BaseDaoImpl<Category, Integer> { | ||
18 | + private final static String NAMESPACE = "com.dili.titan.dao.CategoryDao."; | ||
19 | + | ||
20 | + public String getNameSpace(String statement) { | ||
21 | + return NAMESPACE + statement; | ||
22 | + } | ||
23 | + | ||
24 | + public List<Category> selectAllCategory() { | ||
25 | + return this.selectList(getNameSpace("selectAllEntry")); | ||
26 | + } | ||
27 | + | ||
28 | + public List<CategoryAttr> getCategoryAttrById(int cateId) { | ||
29 | + return this.selectList(getNameSpace("selectCateAttrById"), cateId); | ||
30 | + } | ||
31 | + | ||
32 | + /** | ||
33 | + * this method is可搜索属性 | ||
34 | + * @param cateId | ||
35 | + * @return | ||
36 | + * @createTime 2014年9月30日 上午11:16:33 | ||
37 | + * @author yangjianjun | ||
38 | + */ | ||
39 | + public List<CategoryAttr> getCategorySeacherAttrById(int cateId) { | ||
40 | + return this.selectList(getNameSpace("selectCateSeacherAttrById"), cateId); | ||
41 | + } | ||
42 | + | ||
43 | + public List<Integer> getChildByCid(int cateId) { | ||
44 | + return this.selectList(getNameSpace("selectChildById"), cateId); | ||
45 | + } | ||
46 | +} | ||
0 | \ No newline at end of file | 47 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/dao/impl/ProductOfflineDao.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.dao.impl; | ||
6 | + | ||
7 | +import com.dili.titan.dao.BaseDaoImpl; | ||
8 | +import com.dili.titan.domain.ProductOffline; | ||
9 | +import org.springframework.stereotype.Repository; | ||
10 | + | ||
11 | +import java.util.HashMap; | ||
12 | +import java.util.List; | ||
13 | +import java.util.Map; | ||
14 | + | ||
15 | +/** | ||
16 | + * ProductOfflineDao 实现类 | ||
17 | + * @author dev-center | ||
18 | + * @since 2014-11-14 | ||
19 | + */ | ||
20 | +@Repository("productOfflineDao") | ||
21 | +public class ProductOfflineDao extends BaseDaoImpl<ProductOffline,Long>{ | ||
22 | + private final static String NAMESPACE = "com.dili.titan.dao.ProductOfflineDao."; | ||
23 | + | ||
24 | + //返回本DAO命名空间,并添加statement | ||
25 | + public String getNameSpace(String statement) { | ||
26 | + return NAMESPACE + statement; | ||
27 | + } | ||
28 | + | ||
29 | + public int delProductInfo(List<Long> pids) { | ||
30 | + Map<Object, Object> map = new HashMap<Object, Object>(); | ||
31 | + map.put("list", pids); | ||
32 | + return this.delete(getNameSpace("delProduct"), map); | ||
33 | + } | ||
34 | + | ||
35 | + public int deleteCateProducts(List<Long> cateIds, Long sellerId) { | ||
36 | + Map<Object, Object> map = new HashMap<Object, Object>(); | ||
37 | + map.put("list", cateIds); | ||
38 | + map.put("sellerId", sellerId); | ||
39 | + return this.delete(getNameSpace("deleteCateProducts"), map); | ||
40 | + } | ||
41 | + | ||
42 | + public ProductOffline selectCatePid(Long cateId) { | ||
43 | + return this.select(getNameSpace("selectCatePid"), cateId); | ||
44 | + } | ||
45 | + | ||
46 | + public List<Long> getSellerSaleCates(Long sellerId) { | ||
47 | + return this.selectList(getNameSpace("selectSellerSaleCates"), sellerId); | ||
48 | + } | ||
49 | +} | ||
0 | \ No newline at end of file | 50 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/dao/impl/ProductPopDao.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.dao.impl; | ||
6 | + | ||
7 | +import com.dili.titan.dao.BaseDaoImpl; | ||
8 | +import com.dili.titan.domain.ProductPop; | ||
9 | +import org.springframework.stereotype.Repository; | ||
10 | + | ||
11 | +import java.util.HashMap; | ||
12 | +import java.util.List; | ||
13 | +import java.util.Map; | ||
14 | + | ||
15 | +/** | ||
16 | + * ProductOfflineDao 实现类 | ||
17 | + * @author dev-center | ||
18 | + * @since 2014-11-14 | ||
19 | + */ | ||
20 | +@Repository("productPopDao") | ||
21 | +public class ProductPopDao extends BaseDaoImpl<ProductPop,Long>{ | ||
22 | + private final static String NAMESPACE = "com.dili.titan.dao.ProductPopDao."; | ||
23 | + | ||
24 | + //返回本DAO命名空间,并添加statement | ||
25 | + public String getNameSpace(String statement) { | ||
26 | + return NAMESPACE + statement; | ||
27 | + } | ||
28 | + | ||
29 | + public int update(long shopId,long cityId){ | ||
30 | + Map<String,Object> param = new HashMap<String,Object>(); | ||
31 | + param.put("shopId", shopId); | ||
32 | + param.put("cityId", cityId); | ||
33 | + return this.update(getNameSpace("setProductLocalityArea"), param); | ||
34 | + } | ||
35 | + | ||
36 | + public int updateCityId(long shopId,int cityId){ | ||
37 | + Map<String,Object> param = new HashMap<String,Object>(); | ||
38 | + param.put("shopId", shopId); | ||
39 | + param.put("cityId", cityId); | ||
40 | + return this.update(getNameSpace("setShopCityId"), param); | ||
41 | + } | ||
42 | + | ||
43 | + public List<Long> getProductPopList(long shopId){ | ||
44 | + return this.selectList(getNameSpace("selectProductIdByShopId"), shopId); | ||
45 | + } | ||
46 | + | ||
47 | + public int updateShopName(long shopId,String shopName){ | ||
48 | + Map<String,Object> param = new HashMap<String,Object>(); | ||
49 | + param.put("shopId", shopId); | ||
50 | + param.put("shopName", shopName); | ||
51 | + return this.update(getNameSpace("setShopName"), param); | ||
52 | + } | ||
53 | + | ||
54 | + public int updateUserName(long userId,String userName){ | ||
55 | + Map<String,Object> param = new HashMap<String,Object>(); | ||
56 | + param.put("userId", userId); | ||
57 | + param.put("userName", userName); | ||
58 | + return this.update(getNameSpace("setUserName"), param); | ||
59 | + } | ||
60 | + | ||
61 | + public int updateMarket(long shopId,long marketId,String marketName){ | ||
62 | + Map<String,Object> param = new HashMap<String,Object>(); | ||
63 | + param.put("shopId", shopId); | ||
64 | + param.put("marketId", marketId); | ||
65 | + param.put("marketName", marketName); | ||
66 | + return this.update(getNameSpace("setMarket"), param); | ||
67 | + } | ||
68 | + | ||
69 | + | ||
70 | + public List<Long> selectDropsProduct(Long shopId){ | ||
71 | + return this.selectList(getNameSpace("selectDropsProduct"), shopId); | ||
72 | + } | ||
73 | + | ||
74 | + public int dropsProduct(Long shopId){ | ||
75 | + return this.update(getNameSpace("dropsProduct"), shopId); | ||
76 | + } | ||
77 | + | ||
78 | + public List<Long> selectDelProduct(Long shopId){ | ||
79 | + return this.selectList(getNameSpace("selectDelProduct"), shopId); | ||
80 | + } | ||
81 | + | ||
82 | + public int delProduct(Long shopId){ | ||
83 | + return this.update(getNameSpace("delProduct"), shopId); | ||
84 | + } | ||
85 | + | ||
86 | + | ||
87 | +} | ||
0 | \ No newline at end of file | 88 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/domain/Attribute.java
0 → 100644
1 | +package com.dili.titan.domain; | ||
2 | + | ||
3 | +import org.codehaus.jackson.annotate.JsonIgnore; | ||
4 | + | ||
5 | +import java.util.Date; | ||
6 | + | ||
7 | +/** | ||
8 | + * attribute | ||
9 | + * | ||
10 | + * @author dev-center | ||
11 | + * @since 2014-05-10 | ||
12 | + */ | ||
13 | +public class Attribute extends BaseQuery implements java.io.Serializable { | ||
14 | + private static final long serialVersionUID = 5047017009144564235L; | ||
15 | + private Long attrId; | ||
16 | + private String name; | ||
17 | + private String alias; | ||
18 | + private String inputtype; | ||
19 | + private Integer type; | ||
20 | + private Integer dealType; | ||
21 | + private Integer required; | ||
22 | + private Integer status; | ||
23 | + private Date ctime; | ||
24 | + private Date utime; | ||
25 | + | ||
26 | + public Long getAttrId() { | ||
27 | + return attrId; | ||
28 | + } | ||
29 | + | ||
30 | + public void setAttrId(Long attrId) { | ||
31 | + this.attrId = attrId; | ||
32 | + } | ||
33 | + | ||
34 | + public String getName() { | ||
35 | + return name; | ||
36 | + } | ||
37 | + | ||
38 | + public void setName(String name) { | ||
39 | + this.name = name; | ||
40 | + } | ||
41 | + | ||
42 | + public String getAlias() { | ||
43 | + return alias; | ||
44 | + } | ||
45 | + | ||
46 | + public void setAlias(String alias) { | ||
47 | + this.alias = alias; | ||
48 | + } | ||
49 | + | ||
50 | + public String getInputtype() { | ||
51 | + return inputtype; | ||
52 | + } | ||
53 | + | ||
54 | + public void setInputtype(String inputtype) { | ||
55 | + this.inputtype = inputtype; | ||
56 | + } | ||
57 | + | ||
58 | + public Integer getType() { | ||
59 | + return type; | ||
60 | + } | ||
61 | + | ||
62 | + public void setType(Integer type) { | ||
63 | + this.type = type; | ||
64 | + } | ||
65 | + | ||
66 | + public Integer getRequired() { | ||
67 | + return required; | ||
68 | + } | ||
69 | + | ||
70 | + public void setRequired(Integer required) { | ||
71 | + this.required = required; | ||
72 | + } | ||
73 | + | ||
74 | + public Integer getStatus() { | ||
75 | + return status; | ||
76 | + } | ||
77 | + | ||
78 | + public void setStatus(Integer status) { | ||
79 | + this.status = status; | ||
80 | + } | ||
81 | + | ||
82 | + @JsonIgnore | ||
83 | + public Date getCtime() { | ||
84 | + return ctime; | ||
85 | + } | ||
86 | + | ||
87 | + public void setCtime(Date ctime) { | ||
88 | + this.ctime = ctime; | ||
89 | + } | ||
90 | + | ||
91 | + @JsonIgnore | ||
92 | + public Date getUtime() { | ||
93 | + return utime; | ||
94 | + } | ||
95 | + | ||
96 | + public void setUtime(Date utime) { | ||
97 | + this.utime = utime; | ||
98 | + } | ||
99 | + | ||
100 | + public Integer getDealType() { | ||
101 | + return dealType; | ||
102 | + } | ||
103 | + | ||
104 | + public void setDealType(Integer dealType) { | ||
105 | + this.dealType = dealType; | ||
106 | + } | ||
107 | + | ||
108 | +} | ||
0 | \ No newline at end of file | 109 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/domain/AttributeValue.java
0 → 100644
1 | +package com.dili.titan.domain; | ||
2 | + | ||
3 | +/** | ||
4 | + * attributeValue | ||
5 | + * | ||
6 | + * @author dev-center | ||
7 | + * @since 2014-05-10 | ||
8 | + */ | ||
9 | +public class AttributeValue extends BaseQuery { | ||
10 | + private static final long serialVersionUID = 1L; | ||
11 | + private Long valueId; | ||
12 | + private Long attrId; | ||
13 | + private String value; | ||
14 | + private Integer order; | ||
15 | + private Integer show; | ||
16 | + private Integer status; | ||
17 | + | ||
18 | + public AttributeValue() { | ||
19 | + // 默认无参构造方法 | ||
20 | + } | ||
21 | + | ||
22 | + /** | ||
23 | + * 获取 attrId | ||
24 | + * | ||
25 | + * @return | ||
26 | + */ | ||
27 | + public Long getAttrId() { | ||
28 | + return attrId; | ||
29 | + } | ||
30 | + | ||
31 | + /** | ||
32 | + * 设置 attrId | ||
33 | + * | ||
34 | + * @param attrId | ||
35 | + */ | ||
36 | + public void setAttrId(Long attrId) { | ||
37 | + this.attrId = attrId; | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * 获取 value | ||
42 | + * | ||
43 | + * @return | ||
44 | + */ | ||
45 | + public String getValue() { | ||
46 | + return value; | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * 设置 value | ||
51 | + * | ||
52 | + * @param value | ||
53 | + */ | ||
54 | + public void setValue(String value) { | ||
55 | + this.value = value; | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * 获取 order | ||
60 | + * | ||
61 | + * @return | ||
62 | + */ | ||
63 | + public Integer getOrder() { | ||
64 | + return order; | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * 设置 order | ||
69 | + * | ||
70 | + * @param order | ||
71 | + */ | ||
72 | + public void setOrder(Integer order) { | ||
73 | + this.order = order; | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * 获取 show | ||
78 | + * | ||
79 | + * @return | ||
80 | + */ | ||
81 | + public Integer getShow() { | ||
82 | + return show; | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
86 | + * 设置 show | ||
87 | + * | ||
88 | + * @param show | ||
89 | + */ | ||
90 | + public void setShow(Integer show) { | ||
91 | + this.show = show; | ||
92 | + } | ||
93 | + | ||
94 | + /** | ||
95 | + * 获取 status | ||
96 | + * | ||
97 | + * @return | ||
98 | + */ | ||
99 | + public Integer getStatus() { | ||
100 | + return status; | ||
101 | + } | ||
102 | + | ||
103 | + /** | ||
104 | + * 设置 status | ||
105 | + * | ||
106 | + * @param status | ||
107 | + */ | ||
108 | + public void setStatus(Integer status) { | ||
109 | + this.status = status; | ||
110 | + } | ||
111 | + | ||
112 | + public Long getValueId() { | ||
113 | + return valueId; | ||
114 | + } | ||
115 | + | ||
116 | + public void setValueId(Long valueId) { | ||
117 | + this.valueId = valueId; | ||
118 | + } | ||
119 | + | ||
120 | +} | ||
0 | \ No newline at end of file | 121 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/domain/BaseQuery.java
0 → 100644
1 | +package com.dili.titan.domain; | ||
2 | + | ||
3 | +import org.codehaus.jackson.annotate.JsonIgnore; | ||
4 | + | ||
5 | +import java.io.Serializable; | ||
6 | + | ||
7 | +/** | ||
8 | + * 基础查询类 | ||
9 | + * | ||
10 | + * @author dev-center | ||
11 | + * @since 2014-05-10 | ||
12 | + */ | ||
13 | +public class BaseQuery implements Serializable { | ||
14 | + private static final long serialVersionUID = -4304410457539406430L; | ||
15 | + | ||
16 | + private transient Integer startIndex;// 开始索引 | ||
17 | + | ||
18 | + private transient Integer endIndex;// 结束索引 | ||
19 | + | ||
20 | + private transient String orderField;// 排序字段 | ||
21 | + | ||
22 | + private transient String orderType;// 排序类型 | ||
23 | + | ||
24 | + private transient String keyword;// 关键则查询 | ||
25 | + | ||
26 | + @JsonIgnore | ||
27 | + public Integer getStartIndex() { | ||
28 | + return startIndex; | ||
29 | + } | ||
30 | + | ||
31 | + public void setStartIndex(Integer startIndex) { | ||
32 | + this.startIndex = startIndex; | ||
33 | + } | ||
34 | + | ||
35 | + @JsonIgnore | ||
36 | + public Integer getEndIndex() { | ||
37 | + return endIndex; | ||
38 | + } | ||
39 | + | ||
40 | + public void setEndIndex(Integer endIndex) { | ||
41 | + this.endIndex = endIndex; | ||
42 | + } | ||
43 | + | ||
44 | + @JsonIgnore | ||
45 | + public Integer getPageSize() { | ||
46 | + if (endIndex != null && startIndex != null) { | ||
47 | + return endIndex - startIndex; | ||
48 | + } | ||
49 | + return null; | ||
50 | + } | ||
51 | + | ||
52 | + @JsonIgnore | ||
53 | + public String getOrderField() { | ||
54 | + return orderField; | ||
55 | + } | ||
56 | + | ||
57 | + public void setOrderField(String orderField) { | ||
58 | + this.orderField = orderField; | ||
59 | + } | ||
60 | + | ||
61 | + @JsonIgnore | ||
62 | + public String getorderType() { | ||
63 | + if ("DESC".equalsIgnoreCase(orderType) || "ASC".equalsIgnoreCase(orderType)) { | ||
64 | + return orderType.toUpperCase(); | ||
65 | + } | ||
66 | + return null; | ||
67 | + } | ||
68 | + | ||
69 | + @JsonIgnore | ||
70 | + public String getOrderNextType() { | ||
71 | + if ("ASC".equalsIgnoreCase(orderType)) { | ||
72 | + return "DESC"; | ||
73 | + } | ||
74 | + return "ASC"; | ||
75 | + } | ||
76 | + | ||
77 | + public void setorderType(String orderType) { | ||
78 | + this.orderType = orderType; | ||
79 | + } | ||
80 | + | ||
81 | + public void setKeyword(String keyword) { | ||
82 | + this.keyword = keyword; | ||
83 | + } | ||
84 | + | ||
85 | + @JsonIgnore | ||
86 | + public String getkeyword() { | ||
87 | + return keyword; | ||
88 | + } | ||
89 | +} |
titan-cache/src/main/java/com/dili/titan/domain/Category.java
0 → 100644
1 | +package com.dili.titan.domain; | ||
2 | + | ||
3 | +import com.mysql.jdbc.StringUtils; | ||
4 | + | ||
5 | +public class Category extends BaseQuery implements java.io.Serializable { | ||
6 | + private static final long serialVersionUID = 2741179212701828528L; | ||
7 | + | ||
8 | + /** | ||
9 | + * 交易场景 :线上 | ||
10 | + */ | ||
11 | + public static final int DEALTYPE_ONLINE = 1; | ||
12 | + /** | ||
13 | + * 交易场景 :线下 | ||
14 | + */ | ||
15 | + public static final int DEALTYPE_OFFLINE = 2; | ||
16 | + /** | ||
17 | + * 交易场景 :线上和线下 | ||
18 | + */ | ||
19 | + public static final int DEALTYPE_ONANDOFF = 3; | ||
20 | + | ||
21 | + //删除状态,对应数据库status字段 | ||
22 | + public static final Integer STATUS_DELETED = -1; | ||
23 | + | ||
24 | + private Integer id; | ||
25 | + private String name; | ||
26 | + private String jp; | ||
27 | + private String alias; | ||
28 | + private Integer parent; | ||
29 | + private Integer order; | ||
30 | + private Integer template; | ||
31 | + private Integer status; | ||
32 | + private Integer activate; | ||
33 | + private String icon; | ||
34 | + private Integer dealType; | ||
35 | + | ||
36 | + public Category() { | ||
37 | + // 默认无参构造方法 | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * 获取 name | ||
42 | + * | ||
43 | + * @return | ||
44 | + */ | ||
45 | + public String getName() { | ||
46 | + return name; | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * 设置 name | ||
51 | + * | ||
52 | + * @param name | ||
53 | + */ | ||
54 | + public void setName(String name) { | ||
55 | + this.name = name; | ||
56 | + } | ||
57 | + | ||
58 | + public String getAlias() { | ||
59 | + if(StringUtils.isNullOrEmpty(this.alias)) return ""; | ||
60 | + this.alias = this.alias.replaceAll(","," ").replaceAll(","," "); | ||
61 | + return alias; | ||
62 | + } | ||
63 | + | ||
64 | + public void setAlias(String alias) { | ||
65 | + this.alias = alias; | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * 获取 parent | ||
70 | + * | ||
71 | + * @return | ||
72 | + */ | ||
73 | + public Integer getParent() { | ||
74 | + return parent; | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * 设置 parent | ||
79 | + * | ||
80 | + * @param parent | ||
81 | + */ | ||
82 | + public void setParent(Integer parent) { | ||
83 | + this.parent = parent; | ||
84 | + } | ||
85 | + | ||
86 | + /** | ||
87 | + * 获取 template | ||
88 | + * | ||
89 | + * @return | ||
90 | + */ | ||
91 | + public Integer getTemplate() { | ||
92 | + return template; | ||
93 | + } | ||
94 | + | ||
95 | + /** | ||
96 | + * 设置 template | ||
97 | + * | ||
98 | + * @param template | ||
99 | + */ | ||
100 | + public void setTemplate(Integer template) { | ||
101 | + this.template = template; | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * 获取 status | ||
106 | + * | ||
107 | + * @return | ||
108 | + */ | ||
109 | + public Integer getStatus() { | ||
110 | + return status; | ||
111 | + } | ||
112 | + | ||
113 | + /** | ||
114 | + * 设置 status | ||
115 | + * | ||
116 | + * @param status | ||
117 | + */ | ||
118 | + public void setStatus(Integer status) { | ||
119 | + this.status = status; | ||
120 | + } | ||
121 | + | ||
122 | + /** | ||
123 | + * 获取 activate | ||
124 | + * | ||
125 | + * @return | ||
126 | + */ | ||
127 | + public Integer getActivate() { | ||
128 | + return activate; | ||
129 | + } | ||
130 | + | ||
131 | + /** | ||
132 | + * 设置 activate | ||
133 | + * | ||
134 | + * @param activate | ||
135 | + */ | ||
136 | + public void setActivate(Integer activate) { | ||
137 | + this.activate = activate; | ||
138 | + } | ||
139 | + | ||
140 | + public Integer getId() { | ||
141 | + return id; | ||
142 | + } | ||
143 | + | ||
144 | + public void setId(Integer id) { | ||
145 | + this.id = id; | ||
146 | + } | ||
147 | + | ||
148 | + public Integer getOrder() { | ||
149 | + return order; | ||
150 | + } | ||
151 | + | ||
152 | + public void setOrder(Integer order) { | ||
153 | + this.order = order; | ||
154 | + } | ||
155 | + | ||
156 | + public String getIcon() { | ||
157 | + return icon; | ||
158 | + } | ||
159 | + | ||
160 | + public void setIcon(String icon) { | ||
161 | + this.icon = icon; | ||
162 | + } | ||
163 | + | ||
164 | + public Integer getDealType() { | ||
165 | + return dealType; | ||
166 | + } | ||
167 | + | ||
168 | + public void setDealType(Integer dealType) { | ||
169 | + this.dealType = dealType; | ||
170 | + } | ||
171 | + | ||
172 | + public String getJp() { | ||
173 | + return jp; | ||
174 | + } | ||
175 | + | ||
176 | + public void setJp(String jp) { | ||
177 | + this.jp = jp; | ||
178 | + } | ||
179 | +} | ||
0 | \ No newline at end of file | 180 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/domain/CategoryAttr.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.domain; | ||
6 | + | ||
7 | + | ||
8 | +/** | ||
9 | + * categoryAttr | ||
10 | + * | ||
11 | + * @author dev-center | ||
12 | + * @since 2014-05-10 | ||
13 | + */ | ||
14 | +public class CategoryAttr extends BaseQuery { | ||
15 | + private static final long serialVersionUID = 1L; | ||
16 | + private Long id; | ||
17 | + private Integer catId; | ||
18 | + private Long attrId; | ||
19 | + private Integer searchable; | ||
20 | + private Integer order; | ||
21 | + private Integer dealType; | ||
22 | + | ||
23 | + public Integer getCatId() { | ||
24 | + return catId; | ||
25 | + } | ||
26 | + | ||
27 | + public void setCatId(Integer catId) { | ||
28 | + this.catId = catId; | ||
29 | + } | ||
30 | + | ||
31 | + public Long getAttrId() { | ||
32 | + return attrId; | ||
33 | + } | ||
34 | + | ||
35 | + public void setAttrId(Long attrId) { | ||
36 | + this.attrId = attrId; | ||
37 | + } | ||
38 | + | ||
39 | + public Integer getSearchable() { | ||
40 | + return searchable; | ||
41 | + } | ||
42 | + | ||
43 | + public void setSearchable(Integer searchable) { | ||
44 | + this.searchable = searchable; | ||
45 | + } | ||
46 | + | ||
47 | + public Integer getOrder() { | ||
48 | + return order; | ||
49 | + } | ||
50 | + | ||
51 | + public void setOrder(Integer order) { | ||
52 | + this.order = order; | ||
53 | + } | ||
54 | + | ||
55 | + public Long getId() { | ||
56 | + return id; | ||
57 | + } | ||
58 | + | ||
59 | + public void setId(Long id) { | ||
60 | + this.id = id; | ||
61 | + } | ||
62 | + | ||
63 | + public Integer getDealType() { | ||
64 | + return dealType; | ||
65 | + } | ||
66 | + | ||
67 | + public void setDealType(Integer dealType) { | ||
68 | + this.dealType = dealType; | ||
69 | + } | ||
70 | +} | ||
0 | \ No newline at end of file | 71 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/domain/ProductImg.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.domain; | ||
6 | + | ||
7 | +import java.util.Date; | ||
8 | + | ||
9 | +/** | ||
10 | + * productImg | ||
11 | + * @author dev-center | ||
12 | + * @since 2014-05-10 | ||
13 | + */ | ||
14 | +public class ProductImg extends BaseQuery { | ||
15 | + | ||
16 | + private static final long serialVersionUID = 1L; | ||
17 | + private Long pid; | ||
18 | + private String imgUrl; | ||
19 | + private String imgTitle; | ||
20 | + private Long order; | ||
21 | + private String desc; | ||
22 | + private Date ctime; | ||
23 | + private Date utime; | ||
24 | + | ||
25 | + public ProductImg() { | ||
26 | + // 默认无参构造方法 | ||
27 | + } | ||
28 | + | ||
29 | + /** | ||
30 | + * 获取 pid | ||
31 | + * @return | ||
32 | + */ | ||
33 | + public Long getPid() { | ||
34 | + return pid; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * 设置 pid | ||
39 | + * @param pid | ||
40 | + */ | ||
41 | + public void setPid(Long pid) { | ||
42 | + this.pid = pid; | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * 获取 imgUrl | ||
47 | + * @return | ||
48 | + */ | ||
49 | + public String getImgUrl() { | ||
50 | + return imgUrl; | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * 设置 imgUrl | ||
55 | + * @param imgUrl | ||
56 | + */ | ||
57 | + public void setImgUrl(String imgUrl) { | ||
58 | + this.imgUrl = imgUrl; | ||
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * 获取 imgTitle | ||
63 | + * @return | ||
64 | + */ | ||
65 | + public String getImgTitle() { | ||
66 | + return imgTitle; | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * 设置 imgTitle | ||
71 | + * @param imgTitle | ||
72 | + */ | ||
73 | + public void setImgTitle(String imgTitle) { | ||
74 | + this.imgTitle = imgTitle; | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * 获取 order | ||
79 | + * @return | ||
80 | + */ | ||
81 | + public Long getOrder() { | ||
82 | + return order; | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
86 | + * 设置 order | ||
87 | + * @param order | ||
88 | + */ | ||
89 | + public void setOrder(Long order) { | ||
90 | + this.order = order; | ||
91 | + } | ||
92 | + | ||
93 | + /** | ||
94 | + * 获取 desc | ||
95 | + * @return | ||
96 | + */ | ||
97 | + public String getDesc() { | ||
98 | + return desc; | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * 设置 desc | ||
103 | + * @param desc | ||
104 | + */ | ||
105 | + public void setDesc(String desc) { | ||
106 | + this.desc = desc; | ||
107 | + } | ||
108 | + | ||
109 | + /** | ||
110 | + * 获取 ctime | ||
111 | + * @return | ||
112 | + */ | ||
113 | + public Date getCtime() { | ||
114 | + return ctime; | ||
115 | + } | ||
116 | + | ||
117 | + /** | ||
118 | + * 设置 ctime | ||
119 | + * @param ctime | ||
120 | + */ | ||
121 | + public void setCtime(Date ctime) { | ||
122 | + this.ctime = ctime; | ||
123 | + } | ||
124 | + | ||
125 | + /** | ||
126 | + * 获取 utime | ||
127 | + * @return | ||
128 | + */ | ||
129 | + public Date getUtime() { | ||
130 | + return utime; | ||
131 | + } | ||
132 | + | ||
133 | + /** | ||
134 | + * 设置 utime | ||
135 | + * @param utime | ||
136 | + */ | ||
137 | + public void setUtime(Date utime) { | ||
138 | + this.utime = utime; | ||
139 | + } | ||
140 | +} | ||
0 | \ No newline at end of file | 141 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/domain/ProductOffline.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.domain; | ||
6 | + | ||
7 | +import java.util.Date; | ||
8 | +import java.util.List; | ||
9 | + | ||
10 | +/** | ||
11 | + * productOffline | ||
12 | + * @author dev-center | ||
13 | + * @since 2014-11-14 | ||
14 | + */ | ||
15 | +public class ProductOffline extends BaseQuery { | ||
16 | + private static final long serialVersionUID = 1L; | ||
17 | + private Long pid; | ||
18 | + private Integer cateId; | ||
19 | + | ||
20 | + //商品正常状态 | ||
21 | + public static final Integer PRODUCT_NORMAL = 1; | ||
22 | + //商品失效状态 | ||
23 | + public static final Integer PRODUCT_INVALID = 2; | ||
24 | + | ||
25 | + /** | ||
26 | + * 类目名 | ||
27 | + */ | ||
28 | + private String cateName; | ||
29 | + /** | ||
30 | + * 品规 | ||
31 | + */ | ||
32 | + private String offlineAttrValue; | ||
33 | + private String sellerName; | ||
34 | + private Long price; | ||
35 | + private Integer status; | ||
36 | + private String uniqueKey; | ||
37 | + private Long sellerUserId; | ||
38 | + private Date ctime; | ||
39 | + private Date utime; | ||
40 | + | ||
41 | + /** 分类ID */ | ||
42 | + private List<Integer> cateList; | ||
43 | + | ||
44 | + public ProductOffline(){ | ||
45 | + //默认无参构造方法 | ||
46 | + } | ||
47 | + | ||
48 | + public String getUniqueKey() { | ||
49 | + return uniqueKey; | ||
50 | + } | ||
51 | + | ||
52 | + | ||
53 | + | ||
54 | + public void setUniqueKey(String uniqueKey) { | ||
55 | + this.uniqueKey = uniqueKey; | ||
56 | + } | ||
57 | + | ||
58 | + | ||
59 | + | ||
60 | + public Long getSellerUserId() { | ||
61 | + return sellerUserId; | ||
62 | + } | ||
63 | + | ||
64 | + public void setSellerUserId(Long sellerUserId) { | ||
65 | + this.sellerUserId = sellerUserId; | ||
66 | + } | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + public List<Integer> getCateList() { | ||
71 | + return cateList; | ||
72 | + } | ||
73 | + | ||
74 | + | ||
75 | + | ||
76 | + public void setCateList(List<Integer> cateList) { | ||
77 | + this.cateList = cateList; | ||
78 | + } | ||
79 | + | ||
80 | + | ||
81 | + | ||
82 | + /** | ||
83 | + * 获取 pid | ||
84 | + * @return | ||
85 | + */ | ||
86 | + public Long getPid(){ | ||
87 | + return pid; | ||
88 | + } | ||
89 | + | ||
90 | + /** | ||
91 | + * 设置 pid | ||
92 | + * @param pid | ||
93 | + */ | ||
94 | + public void setPid(Long pid){ | ||
95 | + this.pid = pid; | ||
96 | + } | ||
97 | + | ||
98 | + /** | ||
99 | + * 获取 cateId | ||
100 | + * @return | ||
101 | + */ | ||
102 | + public Integer getCateId(){ | ||
103 | + return cateId; | ||
104 | + } | ||
105 | + | ||
106 | + /** | ||
107 | + * 设置 cateId | ||
108 | + * @param cateId | ||
109 | + */ | ||
110 | + public void setCateId(Integer cateId){ | ||
111 | + this.cateId = cateId; | ||
112 | + } | ||
113 | + | ||
114 | + public String getCateName() { | ||
115 | + return cateName; | ||
116 | + } | ||
117 | + | ||
118 | + public void setCateName(String cateName) { | ||
119 | + this.cateName = cateName; | ||
120 | + } | ||
121 | + | ||
122 | + public String getOfflineAttrValue() { | ||
123 | + return offlineAttrValue; | ||
124 | + } | ||
125 | + | ||
126 | + public void setOfflineAttrValue(String offlineAttrValue) { | ||
127 | + this.offlineAttrValue = offlineAttrValue; | ||
128 | + } | ||
129 | + | ||
130 | + /** | ||
131 | + * 获取 sellerName | ||
132 | + * @return | ||
133 | + */ | ||
134 | + public String getSellerName(){ | ||
135 | + return sellerName; | ||
136 | + } | ||
137 | + | ||
138 | + /** | ||
139 | + * 设置 sellerName | ||
140 | + * @param sellerName | ||
141 | + */ | ||
142 | + public void setSellerName(String sellerName){ | ||
143 | + this.sellerName = sellerName; | ||
144 | + } | ||
145 | + | ||
146 | + /** | ||
147 | + * 获取 price | ||
148 | + * @return | ||
149 | + */ | ||
150 | + public Long getPrice(){ | ||
151 | + return price; | ||
152 | + } | ||
153 | + | ||
154 | + /** | ||
155 | + * 设置 price | ||
156 | + * @param price | ||
157 | + */ | ||
158 | + public void setPrice(Long price){ | ||
159 | + this.price = price; | ||
160 | + } | ||
161 | + | ||
162 | + /** | ||
163 | + * 获取 status | ||
164 | + * @return | ||
165 | + */ | ||
166 | + public Integer getStatus(){ | ||
167 | + return status; | ||
168 | + } | ||
169 | + | ||
170 | + /** | ||
171 | + * 设置 status | ||
172 | + * @param status | ||
173 | + */ | ||
174 | + public void setStatus(Integer status){ | ||
175 | + this.status = status; | ||
176 | + } | ||
177 | + | ||
178 | + /** | ||
179 | + * 获取 ctime | ||
180 | + * @return | ||
181 | + */ | ||
182 | + public Date getCtime(){ | ||
183 | + return ctime; | ||
184 | + } | ||
185 | + | ||
186 | + /** | ||
187 | + * 设置 ctime | ||
188 | + * @param ctime | ||
189 | + */ | ||
190 | + public void setCtime(Date ctime){ | ||
191 | + this.ctime = ctime; | ||
192 | + } | ||
193 | + | ||
194 | + public Date getUtime() { | ||
195 | + return utime; | ||
196 | + } | ||
197 | + | ||
198 | + public void setUtime(Date utime) { | ||
199 | + this.utime = utime; | ||
200 | + } | ||
201 | + | ||
202 | + | ||
203 | +} | ||
0 | \ No newline at end of file | 204 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/domain/ProductPop.java
0 → 100644
1 | +package com.dili.titan.domain; | ||
2 | + | ||
3 | +import java.util.Date; | ||
4 | +import java.util.List; | ||
5 | + | ||
6 | + | ||
7 | +public class ProductPop extends BaseQuery implements java.io.Serializable { | ||
8 | + private static final long serialVersionUID = 1L; | ||
9 | + | ||
10 | + /**报价类型:规格报价 */ | ||
11 | + public static final int QUOTATION_TYPE_GG = 1; | ||
12 | + /**报价类型:区间报价 */ | ||
13 | + public static final int QUOTATION_TYPE_QJ = 2; | ||
14 | + /** | ||
15 | + * 商品 | ||
16 | + */ | ||
17 | + private Long pid; | ||
18 | + /** | ||
19 | + * 商品名称 | ||
20 | + */ | ||
21 | + private String name; | ||
22 | + /** | ||
23 | + * 分类 | ||
24 | + */ | ||
25 | + private Integer cateId; | ||
26 | + | ||
27 | + /** | ||
28 | + * 自定义分类ID | ||
29 | + */ | ||
30 | + private Integer userDefined; | ||
31 | + /** | ||
32 | + * 分类名称 | ||
33 | + */ | ||
34 | + private String cate; | ||
35 | + /** | ||
36 | + * 产地id | ||
37 | + */ | ||
38 | + private Long producingArea; | ||
39 | + /** | ||
40 | + * 卖家ID | ||
41 | + */ | ||
42 | + private Long seller; | ||
43 | + /** | ||
44 | + * 卖家名称 | ||
45 | + */ | ||
46 | + private String sellerName; | ||
47 | + /** | ||
48 | + * 店铺ID | ||
49 | + */ | ||
50 | + private Long shop; | ||
51 | + /** | ||
52 | + * 店铺名称 | ||
53 | + */ | ||
54 | + private String shopName; | ||
55 | + /** | ||
56 | + * 商品有效期 | ||
57 | + */ | ||
58 | + private Integer indate; | ||
59 | + /** | ||
60 | + * 上架模式, 放入仓库1,审核后立即上架2,指定上架时间3 | ||
61 | + */ | ||
62 | + private Integer publishMode; | ||
63 | + /** | ||
64 | + * 设置上架时间 | ||
65 | + */ | ||
66 | + private Date publishSettime; | ||
67 | + /** | ||
68 | + * 上架时间 | ||
69 | + */ | ||
70 | + private Date publishTime; | ||
71 | + /** | ||
72 | + * 下架时间 | ||
73 | + */ | ||
74 | + private Date dropsTime; | ||
75 | + /** | ||
76 | + * 商品状态 预览-2,删除-1,新建1,审核未通过2,强制下架3,待上架4,在架5,已下架6 | ||
77 | + */ | ||
78 | + private Integer status; | ||
79 | + | ||
80 | + /** | ||
81 | + * 创建时间 | ||
82 | + */ | ||
83 | + private Date ctime; | ||
84 | + /** | ||
85 | + * 更新时间 | ||
86 | + */ | ||
87 | + private Date utime; | ||
88 | + /** | ||
89 | + * 商品描述 | ||
90 | + */ | ||
91 | + private String desc; | ||
92 | + | ||
93 | + /** | ||
94 | + * 商品备货时长在数据字典中的 | ||
95 | + */ | ||
96 | + private Long prepareTime; | ||
97 | + | ||
98 | + /** | ||
99 | + * 商品最低价格 | ||
100 | + */ | ||
101 | + private Integer minPrice; | ||
102 | + /** | ||
103 | + * 商品最高价格 | ||
104 | + */ | ||
105 | + private Integer maxPrice; | ||
106 | + ///** | ||
107 | + // * 商品交割地 | ||
108 | + // */ | ||
109 | + //private List<Delivery> deliveryArea; | ||
110 | + | ||
111 | + /** | ||
112 | + * 商品默认图片 | ||
113 | + */ | ||
114 | + private String defaultPic; | ||
115 | + /** | ||
116 | + * 图片列表 | ||
117 | + */ | ||
118 | + private List<String> pictures; | ||
119 | + | ||
120 | + /** | ||
121 | + * SKU列表信息 | ||
122 | + */ | ||
123 | +// private List<Sku> skus; | ||
124 | + /** | ||
125 | + * 按时间查询,开始时间 | ||
126 | + */ | ||
127 | + private Date startTime; | ||
128 | + | ||
129 | + /** | ||
130 | + * 商品库存单位ID | ||
131 | + */ | ||
132 | + private Integer storeUnit; | ||
133 | + private String unitName; | ||
134 | + /** | ||
135 | + * 按时间查询,结束时间 | ||
136 | + */ | ||
137 | + private Date endTime; | ||
138 | + | ||
139 | + //子分类附带其父分类 | ||
140 | + private List<Category> subCateList; | ||
141 | + | ||
142 | + /** | ||
143 | + * 所在地ID | ||
144 | + */ | ||
145 | + private Long localityArea; | ||
146 | + /** 所在国家地*/ | ||
147 | + private Long countryAreaId; | ||
148 | + /** 自定义国家所在城市名(国外)*/ | ||
149 | + private String foreignCityName; | ||
150 | + /** 商品发布地ID*/ | ||
151 | + private Long publishedLocationID; | ||
152 | + | ||
153 | + /*1:规格报价 & 2:区间报价类型*/ | ||
154 | + private Integer quotationType; | ||
155 | + | ||
156 | + public Long getPid() { | ||
157 | + return pid; | ||
158 | + } | ||
159 | + | ||
160 | + public void setPid(Long pid) { | ||
161 | + this.pid = pid; | ||
162 | + } | ||
163 | + | ||
164 | + public String getName() { | ||
165 | + return name; | ||
166 | + } | ||
167 | + | ||
168 | + public void setName(String name) { | ||
169 | + this.name = name; | ||
170 | + } | ||
171 | + | ||
172 | + public Integer getCateId() { | ||
173 | + return cateId; | ||
174 | + } | ||
175 | + | ||
176 | + public void setCateId(Integer cateId) { | ||
177 | + this.cateId = cateId; | ||
178 | + } | ||
179 | + | ||
180 | + public Integer getUserDefined() { | ||
181 | + return userDefined; | ||
182 | + } | ||
183 | + | ||
184 | + public void setUserDefined(Integer userDefined) { | ||
185 | + this.userDefined = userDefined; | ||
186 | + } | ||
187 | + | ||
188 | + public String getCate() { | ||
189 | + return cate; | ||
190 | + } | ||
191 | + | ||
192 | + public void setCate(String cate) { | ||
193 | + this.cate = cate; | ||
194 | + } | ||
195 | + | ||
196 | + public Long getProducingArea() { | ||
197 | + return producingArea; | ||
198 | + } | ||
199 | + | ||
200 | + public void setProducingArea(Long producingArea) { | ||
201 | + this.producingArea = producingArea; | ||
202 | + } | ||
203 | + | ||
204 | + public Long getSeller() { | ||
205 | + return seller; | ||
206 | + } | ||
207 | + | ||
208 | + public void setSeller(Long seller) { | ||
209 | + this.seller = seller; | ||
210 | + } | ||
211 | + | ||
212 | + public String getSellerName() { | ||
213 | + return sellerName; | ||
214 | + } | ||
215 | + | ||
216 | + public void setSellerName(String sellerName) { | ||
217 | + this.sellerName = sellerName; | ||
218 | + } | ||
219 | + | ||
220 | + public Long getShop() { | ||
221 | + return shop; | ||
222 | + } | ||
223 | + | ||
224 | + public void setShop(Long shop) { | ||
225 | + this.shop = shop; | ||
226 | + } | ||
227 | + | ||
228 | + public String getShopName() { | ||
229 | + return shopName; | ||
230 | + } | ||
231 | + | ||
232 | + public void setShopName(String shopName) { | ||
233 | + this.shopName = shopName; | ||
234 | + } | ||
235 | + | ||
236 | + public Integer getIndate() { | ||
237 | + return indate; | ||
238 | + } | ||
239 | + | ||
240 | + public void setIndate(Integer indate) { | ||
241 | + this.indate = indate; | ||
242 | + } | ||
243 | + | ||
244 | + public Integer getPublishMode() { | ||
245 | + return publishMode; | ||
246 | + } | ||
247 | + | ||
248 | + public void setPublishMode(Integer publishMode) { | ||
249 | + this.publishMode = publishMode; | ||
250 | + } | ||
251 | + | ||
252 | + public Date getPublishSettime() { | ||
253 | + return publishSettime; | ||
254 | + } | ||
255 | + | ||
256 | + public void setPublishSettime(Date publishSettime) { | ||
257 | + this.publishSettime = publishSettime; | ||
258 | + } | ||
259 | + | ||
260 | + public Date getPublishTime() { | ||
261 | + return publishTime; | ||
262 | + } | ||
263 | + | ||
264 | + public void setPublishTime(Date publishTime) { | ||
265 | + this.publishTime = publishTime; | ||
266 | + } | ||
267 | + | ||
268 | + public Date getDropsTime() { | ||
269 | + return dropsTime; | ||
270 | + } | ||
271 | + | ||
272 | + public void setDropsTime(Date dropsTime) { | ||
273 | + this.dropsTime = dropsTime; | ||
274 | + } | ||
275 | + | ||
276 | + public Integer getStatus() { | ||
277 | + return status; | ||
278 | + } | ||
279 | + | ||
280 | + public void setStatus(Integer status) { | ||
281 | + this.status = status; | ||
282 | + } | ||
283 | + | ||
284 | + public Date getCtime() { | ||
285 | + return ctime; | ||
286 | + } | ||
287 | + | ||
288 | + public void setCtime(Date ctime) { | ||
289 | + this.ctime = ctime; | ||
290 | + } | ||
291 | + | ||
292 | + public Date getUtime() { | ||
293 | + return utime; | ||
294 | + } | ||
295 | + | ||
296 | + public void setUtime(Date utime) { | ||
297 | + this.utime = utime; | ||
298 | + } | ||
299 | + | ||
300 | + public String getDesc() { | ||
301 | + return desc; | ||
302 | + } | ||
303 | + | ||
304 | + public void setDesc(String desc) { | ||
305 | + this.desc = desc; | ||
306 | + } | ||
307 | + | ||
308 | + public Long getPrepareTime() { | ||
309 | + return prepareTime; | ||
310 | + } | ||
311 | + | ||
312 | + public void setPrepareTime(Long prepareTime) { | ||
313 | + this.prepareTime = prepareTime; | ||
314 | + } | ||
315 | + | ||
316 | + public Integer getMinPrice() { | ||
317 | + return minPrice; | ||
318 | + } | ||
319 | + | ||
320 | + public void setMinPrice(Integer minPrice) { | ||
321 | + this.minPrice = minPrice; | ||
322 | + } | ||
323 | + | ||
324 | + public Integer getMaxPrice() { | ||
325 | + return maxPrice; | ||
326 | + } | ||
327 | + | ||
328 | + public void setMaxPrice(Integer maxPrice) { | ||
329 | + this.maxPrice = maxPrice; | ||
330 | + } | ||
331 | + | ||
332 | + public String getDefaultPic() { | ||
333 | + return defaultPic; | ||
334 | + } | ||
335 | + | ||
336 | + public void setDefaultPic(String defaultPic) { | ||
337 | + this.defaultPic = defaultPic; | ||
338 | + } | ||
339 | + | ||
340 | + public List<String> getPictures() { | ||
341 | + return pictures; | ||
342 | + } | ||
343 | + | ||
344 | + public void setPictures(List<String> pictures) { | ||
345 | + this.pictures = pictures; | ||
346 | + } | ||
347 | + | ||
348 | + public Date getStartTime() { | ||
349 | + return startTime; | ||
350 | + } | ||
351 | + | ||
352 | + public void setStartTime(Date startTime) { | ||
353 | + this.startTime = startTime; | ||
354 | + } | ||
355 | + | ||
356 | + public Integer getStoreUnit() { | ||
357 | + return storeUnit; | ||
358 | + } | ||
359 | + | ||
360 | + public void setStoreUnit(Integer storeUnit) { | ||
361 | + this.storeUnit = storeUnit; | ||
362 | + } | ||
363 | + | ||
364 | + public String getUnitName() { | ||
365 | + return unitName; | ||
366 | + } | ||
367 | + | ||
368 | + public void setUnitName(String unitName) { | ||
369 | + this.unitName = unitName; | ||
370 | + } | ||
371 | + | ||
372 | + public Date getEndTime() { | ||
373 | + return endTime; | ||
374 | + } | ||
375 | + | ||
376 | + public void setEndTime(Date endTime) { | ||
377 | + this.endTime = endTime; | ||
378 | + } | ||
379 | + | ||
380 | + public List<Category> getSubCateList() { | ||
381 | + return subCateList; | ||
382 | + } | ||
383 | + | ||
384 | + public void setSubCateList(List<Category> subCateList) { | ||
385 | + this.subCateList = subCateList; | ||
386 | + } | ||
387 | + | ||
388 | + public Long getLocalityArea() { | ||
389 | + return localityArea; | ||
390 | + } | ||
391 | + | ||
392 | + public void setLocalityArea(Long localityArea) { | ||
393 | + this.localityArea = localityArea; | ||
394 | + } | ||
395 | + | ||
396 | + public Long getCountryAreaId() { | ||
397 | + return countryAreaId; | ||
398 | + } | ||
399 | + | ||
400 | + public void setCountryAreaId(Long countryAreaId) { | ||
401 | + this.countryAreaId = countryAreaId; | ||
402 | + } | ||
403 | + | ||
404 | + public String getForeignCityName() { | ||
405 | + return foreignCityName; | ||
406 | + } | ||
407 | + | ||
408 | + public void setForeignCityName(String foreignCityName) { | ||
409 | + this.foreignCityName = foreignCityName; | ||
410 | + } | ||
411 | + | ||
412 | + public Long getPublishedLocationID() { | ||
413 | + return publishedLocationID; | ||
414 | + } | ||
415 | + | ||
416 | + public void setPublishedLocationID(Long publishedLocationID) { | ||
417 | + this.publishedLocationID = publishedLocationID; | ||
418 | + } | ||
419 | + | ||
420 | + public Integer getQuotationType() { | ||
421 | + return quotationType; | ||
422 | + } | ||
423 | + | ||
424 | + public void setQuotationType(Integer quotationType) { | ||
425 | + this.quotationType = quotationType; | ||
426 | + } | ||
427 | + | ||
428 | + //private List<Delivery> deliveryList; | ||
429 | +// private List<ProductSkuPop> skuList; | ||
430 | +// private List<ProductPopAttr> attrList; | ||
431 | +// private List<ProductImg> imgList; | ||
432 | +// private List<ProductPopAttr> saleAttrList; | ||
433 | +// private List<ProductPopAttr> descAttrList; | ||
434 | +// private List<ProductPopPriceRange> productPopPriceRanges; | ||
435 | +// private List<ProductAuth> productAuthList; | ||
436 | +// private ProductVideo productVideo; | ||
437 | + | ||
438 | + | ||
439 | + | ||
440 | +} | ||
0 | \ No newline at end of file | 441 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/domain/RedisKeyConstant.java
0 → 100644
1 | +package com.dili.titan.domain; | ||
2 | + | ||
3 | +/** | ||
4 | + * Created by gsz on 2015/6/4. | ||
5 | + */ | ||
6 | +public class RedisKeyConstant { | ||
7 | + public static final String ATTRIBUTE = "Attribute";//属性 | ||
8 | + public static final String ATTR_VALUE = "Attr_value";//属性值 | ||
9 | + public static final String CATEGORY = "Category";//分类 | ||
10 | + public static final String CATE_ATTR = "Cate_Attr";//分类属性 | ||
11 | + public static final String CATE_SEARCH_ATTRA ="Cate_Search_Attr";//可搜索属性 | ||
12 | + public static final String CATE_ALLPARENT = "Cate_AllParent_";//分类所有父分类 | ||
13 | + public static final String CATE_CHILD = "Cate_Child_";//分类子节点 | ||
14 | + public static final String PURCHASE = "Purchase";//求购信息 | ||
15 | + public static final String NEW_SUPPLY_KEY = "New_Supply";//最新供应信息 | ||
16 | + public static final String SUPPLY = "Supply";//供应信息 | ||
17 | + public static final String PRESALE = "Presale";//预售信息 | ||
18 | + public static final String PRODUCT_POP = "product_Pop";//第三方商品 | ||
19 | + public static final String PICKUPINFO = "pickupinfo";//提货点 | ||
20 | +} |
titan-cache/src/main/java/com/dili/titan/domain/gq/Presale.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2015 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.domain.gq; | ||
6 | + | ||
7 | + | ||
8 | +import java.util.Date; | ||
9 | + | ||
10 | +/** | ||
11 | + * presale | ||
12 | + * @author dev-center | ||
13 | + * @since 2015-07-24 | ||
14 | + */ | ||
15 | +public class Presale { | ||
16 | + private Long id; | ||
17 | + private String title; | ||
18 | + private String userName; | ||
19 | + private Long categoryId; | ||
20 | + private Long localityAreaId; | ||
21 | + private Integer count; | ||
22 | + private Integer unitId; | ||
23 | + private String phone; | ||
24 | + private Integer status; | ||
25 | + private Long userId; | ||
26 | + private Integer source; | ||
27 | + private String reason; | ||
28 | + private Date startTime; | ||
29 | + private Date endTime; | ||
30 | + private Date ctime; | ||
31 | + private String utime; | ||
32 | + | ||
33 | + public Presale(){ | ||
34 | + //默认无参构造方法 | ||
35 | + } | ||
36 | + | ||
37 | + public Long getId() { | ||
38 | + return id; | ||
39 | + } | ||
40 | + | ||
41 | + public void setId(Long id) { | ||
42 | + this.id = id; | ||
43 | + } | ||
44 | + | ||
45 | + public String getTitle() { | ||
46 | + return title; | ||
47 | + } | ||
48 | + | ||
49 | + public void setTitle(String title) { | ||
50 | + this.title = title; | ||
51 | + } | ||
52 | + | ||
53 | + public String getUserName() { | ||
54 | + return userName; | ||
55 | + } | ||
56 | + | ||
57 | + public void setUserName(String userName) { | ||
58 | + this.userName = userName; | ||
59 | + } | ||
60 | + | ||
61 | + public Long getCategoryId() { | ||
62 | + return categoryId; | ||
63 | + } | ||
64 | + | ||
65 | + public void setCategoryId(Long categoryId) { | ||
66 | + this.categoryId = categoryId; | ||
67 | + } | ||
68 | + | ||
69 | + public Long getLocalityAreaId() { | ||
70 | + return localityAreaId; | ||
71 | + } | ||
72 | + | ||
73 | + public void setLocalityAreaId(Long localityAreaId) { | ||
74 | + this.localityAreaId = localityAreaId; | ||
75 | + } | ||
76 | + | ||
77 | + public Integer getCount() { | ||
78 | + return count; | ||
79 | + } | ||
80 | + | ||
81 | + public void setCount(Integer count) { | ||
82 | + this.count = count; | ||
83 | + } | ||
84 | + | ||
85 | + public Integer getUnitId() { | ||
86 | + return unitId; | ||
87 | + } | ||
88 | + | ||
89 | + public void setUnitId(Integer unitId) { | ||
90 | + this.unitId = unitId; | ||
91 | + } | ||
92 | + | ||
93 | + public String getPhone() { | ||
94 | + return phone; | ||
95 | + } | ||
96 | + | ||
97 | + public void setPhone(String phone) { | ||
98 | + this.phone = phone; | ||
99 | + } | ||
100 | + | ||
101 | + public Integer getStatus() { | ||
102 | + return status; | ||
103 | + } | ||
104 | + | ||
105 | + public void setStatus(Integer status) { | ||
106 | + this.status = status; | ||
107 | + } | ||
108 | + | ||
109 | + public Long getUserId() { | ||
110 | + return userId; | ||
111 | + } | ||
112 | + | ||
113 | + public void setUserId(Long userId) { | ||
114 | + this.userId = userId; | ||
115 | + } | ||
116 | + | ||
117 | + public Integer getSource() { | ||
118 | + return source; | ||
119 | + } | ||
120 | + | ||
121 | + public void setSource(Integer source) { | ||
122 | + this.source = source; | ||
123 | + } | ||
124 | + | ||
125 | + public String getReason() { | ||
126 | + return reason; | ||
127 | + } | ||
128 | + | ||
129 | + public void setReason(String reason) { | ||
130 | + this.reason = reason; | ||
131 | + } | ||
132 | + | ||
133 | + public Date getStartTime() { | ||
134 | + return startTime; | ||
135 | + } | ||
136 | + | ||
137 | + public void setStartTime(Date startTime) { | ||
138 | + this.startTime = startTime; | ||
139 | + } | ||
140 | + | ||
141 | + public Date getEndTime() { | ||
142 | + return endTime; | ||
143 | + } | ||
144 | + | ||
145 | + public void setEndTime(Date endTime) { | ||
146 | + this.endTime = endTime; | ||
147 | + } | ||
148 | + | ||
149 | + public Date getCtime() { | ||
150 | + return ctime; | ||
151 | + } | ||
152 | + | ||
153 | + public void setCtime(Date ctime) { | ||
154 | + this.ctime = ctime; | ||
155 | + } | ||
156 | + | ||
157 | + public String getUtime() { | ||
158 | + return utime; | ||
159 | + } | ||
160 | + | ||
161 | + public void setUtime(String utime) { | ||
162 | + this.utime = utime; | ||
163 | + } | ||
164 | +} | ||
0 | \ No newline at end of file | 165 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/domain/gq/Purchase.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2015 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.domain.gq; | ||
6 | + | ||
7 | +import java.util.Date; | ||
8 | + | ||
9 | +/** | ||
10 | + * purchase | ||
11 | + * @author dev-center | ||
12 | + * @since 2015-07-24 | ||
13 | + */ | ||
14 | +public class Purchase { | ||
15 | + private Long id; | ||
16 | + private String title; | ||
17 | + private String userName; | ||
18 | + private Long categoryId; | ||
19 | + private Long producingAreaId; | ||
20 | + private Long localityAreaId; | ||
21 | + private Integer count; | ||
22 | + private Integer unitId; | ||
23 | + private String phone; | ||
24 | + private Date expireTime; | ||
25 | + private Integer status; | ||
26 | + private Long userId; | ||
27 | + private Integer source; | ||
28 | + private String reason; | ||
29 | + private Date ctime; | ||
30 | + private String utime; | ||
31 | + | ||
32 | + public Purchase(){ | ||
33 | + //默认无参构造方法 | ||
34 | + } | ||
35 | + | ||
36 | + public Long getId() { | ||
37 | + return id; | ||
38 | + } | ||
39 | + | ||
40 | + public void setId(Long id) { | ||
41 | + this.id = id; | ||
42 | + } | ||
43 | + | ||
44 | + public String getTitle() { | ||
45 | + return title; | ||
46 | + } | ||
47 | + | ||
48 | + public void setTitle(String title) { | ||
49 | + this.title = title; | ||
50 | + } | ||
51 | + | ||
52 | + public String getUserName() { | ||
53 | + return userName; | ||
54 | + } | ||
55 | + | ||
56 | + public void setUserName(String userName) { | ||
57 | + this.userName = userName; | ||
58 | + } | ||
59 | + | ||
60 | + public Long getCategoryId() { | ||
61 | + return categoryId; | ||
62 | + } | ||
63 | + | ||
64 | + public void setCategoryId(Long categoryId) { | ||
65 | + this.categoryId = categoryId; | ||
66 | + } | ||
67 | + | ||
68 | + public Long getLocalityAreaId() { | ||
69 | + return localityAreaId; | ||
70 | + } | ||
71 | + | ||
72 | + public void setLocalityAreaId(Long localityAreaId) { | ||
73 | + this.localityAreaId = localityAreaId; | ||
74 | + } | ||
75 | + | ||
76 | + public Integer getCount() { | ||
77 | + return count; | ||
78 | + } | ||
79 | + | ||
80 | + public void setCount(Integer count) { | ||
81 | + this.count = count; | ||
82 | + } | ||
83 | + | ||
84 | + public Integer getUnitId() { | ||
85 | + return unitId; | ||
86 | + } | ||
87 | + | ||
88 | + public void setUnitId(Integer unitId) { | ||
89 | + this.unitId = unitId; | ||
90 | + } | ||
91 | + | ||
92 | + public String getPhone() { | ||
93 | + return phone; | ||
94 | + } | ||
95 | + | ||
96 | + public void setPhone(String phone) { | ||
97 | + this.phone = phone; | ||
98 | + } | ||
99 | + | ||
100 | + public Date getExpireTime() { | ||
101 | + return expireTime; | ||
102 | + } | ||
103 | + | ||
104 | + public void setExpireTime(Date expireTime) { | ||
105 | + this.expireTime = expireTime; | ||
106 | + } | ||
107 | + | ||
108 | + public Integer getStatus() { | ||
109 | + return status; | ||
110 | + } | ||
111 | + | ||
112 | + public void setStatus(Integer status) { | ||
113 | + this.status = status; | ||
114 | + } | ||
115 | + | ||
116 | + public Long getUserId() { | ||
117 | + return userId; | ||
118 | + } | ||
119 | + | ||
120 | + public void setUserId(Long userId) { | ||
121 | + this.userId = userId; | ||
122 | + } | ||
123 | + | ||
124 | + public Integer getSource() { | ||
125 | + return source; | ||
126 | + } | ||
127 | + | ||
128 | + public void setSource(Integer source) { | ||
129 | + this.source = source; | ||
130 | + } | ||
131 | + | ||
132 | + public String getReason() { | ||
133 | + return reason; | ||
134 | + } | ||
135 | + | ||
136 | + public void setReason(String reason) { | ||
137 | + this.reason = reason; | ||
138 | + } | ||
139 | + | ||
140 | + public Date getCtime() { | ||
141 | + return ctime; | ||
142 | + } | ||
143 | + | ||
144 | + public void setCtime(Date ctime) { | ||
145 | + this.ctime = ctime; | ||
146 | + } | ||
147 | + | ||
148 | + public String getUtime() { | ||
149 | + return utime; | ||
150 | + } | ||
151 | + | ||
152 | + public void setUtime(String utime) { | ||
153 | + this.utime = utime; | ||
154 | + } | ||
155 | + | ||
156 | + public Long getProducingAreaId() { | ||
157 | + return producingAreaId; | ||
158 | + } | ||
159 | + | ||
160 | + public void setProducingAreaId(Long producingAreaId) { | ||
161 | + this.producingAreaId = producingAreaId; | ||
162 | + } | ||
163 | +} | ||
0 | \ No newline at end of file | 164 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/domain/gq/Supply.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2015 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.domain.gq; | ||
6 | + | ||
7 | + | ||
8 | +import java.util.Date; | ||
9 | + | ||
10 | +/** | ||
11 | + * supply | ||
12 | + * @author dev-center | ||
13 | + * @since 2015-07-24 | ||
14 | + */ | ||
15 | +public class Supply { | ||
16 | + private Long id; | ||
17 | + private String title; | ||
18 | + private String userName; | ||
19 | + private Long categoryId; | ||
20 | + private Long localityAreaId; | ||
21 | + private Long producingAreaId; | ||
22 | + private Long price; | ||
23 | + private Integer count; | ||
24 | + private Integer unitId; | ||
25 | + private Long userId; | ||
26 | + private String phone; | ||
27 | + private Date expireTime; | ||
28 | + private Integer status; | ||
29 | + private Integer source; | ||
30 | + private String reason; | ||
31 | + private Date ctime; | ||
32 | + private String utime; | ||
33 | + | ||
34 | + public Supply(){ | ||
35 | + //默认无参构造方法 | ||
36 | + } | ||
37 | + | ||
38 | + public Long getId() { | ||
39 | + return id; | ||
40 | + } | ||
41 | + | ||
42 | + public void setId(Long id) { | ||
43 | + this.id = id; | ||
44 | + } | ||
45 | + | ||
46 | + public String getTitle() { | ||
47 | + return title; | ||
48 | + } | ||
49 | + | ||
50 | + public void setTitle(String title) { | ||
51 | + this.title = title; | ||
52 | + } | ||
53 | + | ||
54 | + public String getUserName() { | ||
55 | + return userName; | ||
56 | + } | ||
57 | + | ||
58 | + public void setUserName(String userName) { | ||
59 | + this.userName = userName; | ||
60 | + } | ||
61 | + | ||
62 | + public Long getCategoryId() { | ||
63 | + return categoryId; | ||
64 | + } | ||
65 | + | ||
66 | + public void setCategoryId(Long categoryId) { | ||
67 | + this.categoryId = categoryId; | ||
68 | + } | ||
69 | + | ||
70 | + public Long getProducingAreaId() { | ||
71 | + return producingAreaId; | ||
72 | + } | ||
73 | + | ||
74 | + public void setProducingAreaId(Long producingAreaId) { | ||
75 | + this.producingAreaId = producingAreaId; | ||
76 | + } | ||
77 | + | ||
78 | + public Long getPrice() { | ||
79 | + return price; | ||
80 | + } | ||
81 | + | ||
82 | + public void setPrice(Long price) { | ||
83 | + this.price = price; | ||
84 | + } | ||
85 | + | ||
86 | + public Integer getCount() { | ||
87 | + return count; | ||
88 | + } | ||
89 | + | ||
90 | + public void setCount(Integer count) { | ||
91 | + this.count = count; | ||
92 | + } | ||
93 | + | ||
94 | + public Integer getUnitId() { | ||
95 | + return unitId; | ||
96 | + } | ||
97 | + | ||
98 | + public void setUnitId(Integer unitId) { | ||
99 | + this.unitId = unitId; | ||
100 | + } | ||
101 | + | ||
102 | + public Long getUserId() { | ||
103 | + return userId; | ||
104 | + } | ||
105 | + | ||
106 | + public void setUserId(Long userId) { | ||
107 | + this.userId = userId; | ||
108 | + } | ||
109 | + | ||
110 | + public String getPhone() { | ||
111 | + return phone; | ||
112 | + } | ||
113 | + | ||
114 | + public void setPhone(String phone) { | ||
115 | + this.phone = phone; | ||
116 | + } | ||
117 | + | ||
118 | + public Date getExpireTime() { | ||
119 | + return expireTime; | ||
120 | + } | ||
121 | + | ||
122 | + public void setExpireTime(Date expireTime) { | ||
123 | + this.expireTime = expireTime; | ||
124 | + } | ||
125 | + | ||
126 | + public Integer getStatus() { | ||
127 | + return status; | ||
128 | + } | ||
129 | + | ||
130 | + public void setStatus(Integer status) { | ||
131 | + this.status = status; | ||
132 | + } | ||
133 | + | ||
134 | + public Integer getSource() { | ||
135 | + return source; | ||
136 | + } | ||
137 | + | ||
138 | + public void setSource(Integer source) { | ||
139 | + this.source = source; | ||
140 | + } | ||
141 | + | ||
142 | + public String getReason() { | ||
143 | + return reason; | ||
144 | + } | ||
145 | + | ||
146 | + public void setReason(String reason) { | ||
147 | + this.reason = reason; | ||
148 | + } | ||
149 | + | ||
150 | + public Date getCtime() { | ||
151 | + return ctime; | ||
152 | + } | ||
153 | + | ||
154 | + public void setCtime(Date ctime) { | ||
155 | + this.ctime = ctime; | ||
156 | + } | ||
157 | + | ||
158 | + public String getUtime() { | ||
159 | + return utime; | ||
160 | + } | ||
161 | + | ||
162 | + public void setUtime(String utime) { | ||
163 | + this.utime = utime; | ||
164 | + } | ||
165 | + | ||
166 | + public Long getLocalityAreaId() { | ||
167 | + return localityAreaId; | ||
168 | + } | ||
169 | + | ||
170 | + public void setLocalityAreaId(Long localityAreaId) { | ||
171 | + this.localityAreaId = localityAreaId; | ||
172 | + } | ||
173 | +} | ||
0 | \ No newline at end of file | 174 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/domain/log/LogBusinessIdUtils.java
0 → 100644
1 | +package com.dili.titan.domain.log; | ||
2 | + | ||
3 | +import org.apache.commons.lang.StringUtils; | ||
4 | + | ||
5 | +import java.util.UUID; | ||
6 | + | ||
7 | +/** | ||
8 | + * 用于设置线程的UUID,用于打印日志 | ||
9 | + * @author cdwangyong3 | ||
10 | + * | ||
11 | + */ | ||
12 | +public class LogBusinessIdUtils { | ||
13 | + private static final ThreadLocal<String> businessLocal = new ThreadLocal<String>(); | ||
14 | + /** | ||
15 | + * 返回当前线程对应的uuid | ||
16 | + * @return | ||
17 | + */ | ||
18 | + public static String getCurBusinessId(){ | ||
19 | + String uuid = businessLocal.get(); | ||
20 | + if(StringUtils.isEmpty(uuid)){ | ||
21 | + uuid = UUID.randomUUID().toString().replace("-", ""); | ||
22 | + businessLocal.set(uuid); | ||
23 | + } | ||
24 | + return uuid; | ||
25 | + } | ||
26 | + | ||
27 | + | ||
28 | + /** | ||
29 | + * 给当前线程重新设置 | ||
30 | + */ | ||
31 | + public static void clear(){ | ||
32 | + businessLocal.set(null); | ||
33 | + } | ||
34 | +} |
titan-cache/src/main/java/com/dili/titan/domain/log/LogHelper.java
0 → 100644
1 | +package com.dili.titan.domain.log; | ||
2 | + | ||
3 | +import org.apache.commons.lang.StringUtils; | ||
4 | +import org.apache.commons.logging.Log; | ||
5 | +import org.apache.commons.logging.LogFactory; | ||
6 | + | ||
7 | +import java.io.PrintWriter; | ||
8 | +import java.io.StringWriter; | ||
9 | +import java.util.HashMap; | ||
10 | +import java.util.Map; | ||
11 | + | ||
12 | +/** | ||
13 | + * Describe: User: BjYangKai Date: 2011-4-21 Time: 12:00:33 | ||
14 | + */ | ||
15 | +public class LogHelper { | ||
16 | + | ||
17 | + /** | ||
18 | + * stock相关重要日志 | ||
19 | + */ | ||
20 | + private static Map<LogTypeEnum, Log> logMap = new HashMap<LogTypeEnum, Log>(); | ||
21 | + | ||
22 | + static { | ||
23 | + for (LogTypeEnum ft : LogTypeEnum.values()) { | ||
24 | + logMap.put(ft, LogFactory.getLog(ft.getKey())); | ||
25 | + } | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * | ||
30 | + * @param str | ||
31 | + * @return | ||
32 | + */ | ||
33 | + public static String addLogbusinessId(String str) { | ||
34 | + if (StringUtils.isEmpty(str)) { | ||
35 | + return str; | ||
36 | + } else { | ||
37 | + return "业务标示ID[" + LogBusinessIdUtils.getCurBusinessId() + "]," | ||
38 | + + str; | ||
39 | + } | ||
40 | + } | ||
41 | + | ||
42 | + /** | ||
43 | + * 使用默认的文件记录debug信息 | ||
44 | + * | ||
45 | + * @param str 日志信息 | ||
46 | + */ | ||
47 | + public static void debug(String str, Object... args) { | ||
48 | + debug(LogTypeEnum.DEFAULT, str, args); | ||
49 | + } | ||
50 | + | ||
51 | + /** | ||
52 | + * 使用默认的文件记录info信息 | ||
53 | + * | ||
54 | + * @param str 日志信息 | ||
55 | + */ | ||
56 | + public static void info(String str, Object... args) { | ||
57 | + info(LogTypeEnum.DEFAULT, str, args); | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * 使用默认的文件记录warn信息 | ||
62 | + * | ||
63 | + * @param str 日志信息 | ||
64 | + */ | ||
65 | + public static void warn(String str, Object... args) { | ||
66 | + warn(LogTypeEnum.DEFAULT, str, args); | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * 使用默认的文件记录error信息 | ||
71 | + * | ||
72 | + * @param str 日志信息 | ||
73 | + */ | ||
74 | + public static void error(Throwable e, String str, Object... args) { | ||
75 | + error(LogTypeEnum.DEFAULT, e, str, args); | ||
76 | + } | ||
77 | + | ||
78 | + /** | ||
79 | + * 使用默认的文件记录fatal信息 | ||
80 | + * | ||
81 | + * @param str 日志信息 | ||
82 | + */ | ||
83 | + public static void fatal(Throwable e, String str, Object... args) { | ||
84 | + fatal(LogTypeEnum.DEFAULT, e, str, args); | ||
85 | + } | ||
86 | + | ||
87 | + /** | ||
88 | + * 记录运行期错误信息 | ||
89 | + * | ||
90 | + * @param e | ||
91 | + */ | ||
92 | + public static void execption(Throwable e) { | ||
93 | + error(LogTypeEnum.EXCEPTION, getExceptionTrace(e)); | ||
94 | + } | ||
95 | + | ||
96 | + /** | ||
97 | + * 打印错误信息 | ||
98 | + * | ||
99 | + * @param e | ||
100 | + * @return | ||
101 | + */ | ||
102 | + public static String getExceptionTrace(Throwable e) { | ||
103 | + if (e != null) { | ||
104 | + StringWriter sw = new StringWriter(); | ||
105 | + PrintWriter pw = new PrintWriter(sw); | ||
106 | + e.printStackTrace(pw); | ||
107 | + return sw.toString(); | ||
108 | + } else | ||
109 | + return null; | ||
110 | + } | ||
111 | + | ||
112 | + public static Log getLog(LogTypeEnum type) { | ||
113 | + if (logMap.get(type) == null) { | ||
114 | + return LogFactory.getLog(LogHelper.class); | ||
115 | + } else { | ||
116 | + return logMap.get(type); | ||
117 | + } | ||
118 | + } | ||
119 | + | ||
120 | + /** | ||
121 | + * 日志消息占位符形式的替换,按照传入参数依次替换"{}" | ||
122 | + * | ||
123 | + * @param str 带占位符的日志消息 | ||
124 | + * @param args 需要被替换的参数,除了字符串和基本类型的对象形式外,其他类型需要自己实现toString方法 | ||
125 | + * @return | ||
126 | + */ | ||
127 | + public static <T extends Object> String replace(String str, T... args) { | ||
128 | + if (str == null) { | ||
129 | + return str; | ||
130 | + } | ||
131 | + if (args == null || args.length < 1) { | ||
132 | + return addLogbusinessId(str.replaceAll("\\{\\}", " null")); | ||
133 | + } | ||
134 | + StringBuilder builder = new StringBuilder(str); | ||
135 | + int start = builder.indexOf("{"); | ||
136 | + int end = builder.indexOf("}", start); | ||
137 | + for (Object arg : args) { | ||
138 | + if (start == -1) { | ||
139 | + break; | ||
140 | + } | ||
141 | + if (arg == null) { | ||
142 | + arg = "null"; | ||
143 | + } | ||
144 | + builder.replace(start, end + 1, arg.toString()); | ||
145 | + start = start + arg.toString().length(); | ||
146 | + start = builder.indexOf("{", start); | ||
147 | + end = builder.indexOf("}", start); | ||
148 | + } | ||
149 | + return addLogbusinessId(builder.toString()); | ||
150 | + } | ||
151 | + | ||
152 | + /** | ||
153 | + * 记录DEBUG信息 | ||
154 | + * | ||
155 | + * @param type 日志业务类型 | ||
156 | + * @param str | ||
157 | + */ | ||
158 | + public static void debug(LogTypeEnum type, String str, Object... args) { | ||
159 | + Log log = getLog(type); | ||
160 | + if (log.isDebugEnabled()) { | ||
161 | + String msg = replace(str, args); | ||
162 | + log.debug(msg); | ||
163 | + } | ||
164 | + } | ||
165 | + | ||
166 | + /** | ||
167 | + * 记录INFO信息 | ||
168 | + * | ||
169 | + * @param type 日志业务类型 | ||
170 | + * @param str | ||
171 | + */ | ||
172 | + public static void info(LogTypeEnum type, String str, Object... args) { | ||
173 | + Log log = getLog(type); | ||
174 | + if (log.isInfoEnabled()) { | ||
175 | + String msg = replace(str, args); | ||
176 | + log.info(msg); | ||
177 | + } | ||
178 | + } | ||
179 | + | ||
180 | + /** | ||
181 | + * 记录warn信息 | ||
182 | + * | ||
183 | + * @param type 日志业务类型 | ||
184 | + * @param str | ||
185 | + */ | ||
186 | + public static void warn(LogTypeEnum type, String str, Object... args) { | ||
187 | + Log log = getLog(type); | ||
188 | + if (log.isWarnEnabled()) { | ||
189 | + String msg = replace(str, args); | ||
190 | + log.warn(msg); | ||
191 | + } | ||
192 | + } | ||
193 | + | ||
194 | + /** | ||
195 | + * 记录error信息 | ||
196 | + * | ||
197 | + * @param type 日志业务类型 | ||
198 | + * @param str | ||
199 | + */ | ||
200 | + public static void error(LogTypeEnum type, String str, Object... args) { | ||
201 | + Log log = getLog(type); | ||
202 | + if (log.isErrorEnabled()) { | ||
203 | + String msg = replace(str, args); | ||
204 | + log.error(msg); | ||
205 | + } | ||
206 | + } | ||
207 | + | ||
208 | + /** | ||
209 | + * 记录fatal信息 | ||
210 | + * | ||
211 | + * @param type 日志业务类型 | ||
212 | + * @param str 日志信息 | ||
213 | + */ | ||
214 | + public static void fatal(LogTypeEnum type, String str, Object... args) { | ||
215 | + Log log = getLog(type); | ||
216 | + if (log.isFatalEnabled()) { | ||
217 | + String msg = replace(str, args); | ||
218 | + log.fatal(msg); | ||
219 | + } | ||
220 | + } | ||
221 | + | ||
222 | + /** | ||
223 | + * 记录error信息 | ||
224 | + * | ||
225 | + * @param type 日志业务类型 | ||
226 | + * @param str | ||
227 | + */ | ||
228 | + public static void error(LogTypeEnum type, Throwable e, String str, | ||
229 | + Object... args) { | ||
230 | + Log log = getLog(type); | ||
231 | + if (log.isErrorEnabled()) { | ||
232 | + String msg = replace(str, args); | ||
233 | + log.error(msg, e); | ||
234 | + } | ||
235 | + } | ||
236 | + | ||
237 | + /** | ||
238 | + * 记录fatal信息 | ||
239 | + * | ||
240 | + * @param type 日志业务类型 | ||
241 | + * @param str 日志信息 | ||
242 | + */ | ||
243 | + public static void fatal(LogTypeEnum type, Throwable e, String str, | ||
244 | + Object... args) { | ||
245 | + Log log = getLog(type); | ||
246 | + if (log.isFatalEnabled()) { | ||
247 | + String msg = replace(str, args); | ||
248 | + log.fatal(msg, e); | ||
249 | + } | ||
250 | + } | ||
251 | + | ||
252 | + public static void main(String[] args) { | ||
253 | + LogHelper.debug(LogTypeEnum.DEFAULT, "aaaa"); | ||
254 | + System.out.println(); | ||
255 | + } | ||
256 | +} |
titan-cache/src/main/java/com/dili/titan/domain/log/LogTypeEnum.java
0 → 100644
1 | +package com.dili.titan.domain.log; | ||
2 | + | ||
3 | +import org.apache.commons.lang.StringUtils; | ||
4 | +import org.apache.commons.logging.Log; | ||
5 | + | ||
6 | +/** | ||
7 | + * 日志的业务类型,对重要的业务日志需要在这里定义类型 | ||
8 | + * | ||
9 | + * @author dingjun | ||
10 | + */ | ||
11 | +public enum LogTypeEnum { | ||
12 | + DEFAULT("DEFAULT", "默认"), | ||
13 | + SUPPLY("TITAN_SUPPLY", "供应单"), | ||
14 | + PRESALE("TITAN_PRESALE", "供应单"), | ||
15 | + PURCHASE("TITAN_PURCHASE", "求购信息"), | ||
16 | + CATEGORY("TITAN_CATEGORY", "类目"), | ||
17 | + ATTRIBUTE("TITAN_ATTRIBUTE", "属性"), | ||
18 | + PRODUCT("TITAN_PRODUCT", "线上商品"), | ||
19 | + PRODUCT_OFFLINE("TITAN_PRODUCT_OFFLINE", "线下商品"), | ||
20 | + PRODUCT_MQ("PRODUCT_MQ", "MQ消息"), | ||
21 | + //AUTH("TITAN_AUTH", "商品认证"), | ||
22 | + //STOCK("TITAN_STOCK", "库存"), | ||
23 | + //PRODUCT_TP("TITAN_SUPPLIER", "供应商商品"), | ||
24 | + EXCEPTION("EXCEPTION", "运行错误"); | ||
25 | + | ||
26 | + private String key; | ||
27 | + private String value; | ||
28 | + | ||
29 | + LogTypeEnum() { | ||
30 | + } | ||
31 | + | ||
32 | + LogTypeEnum(String key, String value) { | ||
33 | + this.key = key; | ||
34 | + this.value = value; | ||
35 | + } | ||
36 | + | ||
37 | + public static String getValue(String key) { | ||
38 | + for (LogTypeEnum ft : LogTypeEnum.values()) { | ||
39 | + if (ft.getKey().equals(key)) { | ||
40 | + return ft.getValue(); | ||
41 | + } | ||
42 | + } | ||
43 | + return null; | ||
44 | + } | ||
45 | + | ||
46 | + public String getKey() { | ||
47 | + return key; | ||
48 | + } | ||
49 | + | ||
50 | + public String getValue() { | ||
51 | + return value; | ||
52 | + } | ||
53 | + | ||
54 | + public Log getLog() { | ||
55 | + return LogHelper.getLog(this); | ||
56 | + } | ||
57 | +} |
titan-cache/src/main/java/com/dili/titan/domain/log/MarkConstant.java
0 → 100644
1 | +package com.dili.titan.domain.log; | ||
2 | + | ||
3 | +/** | ||
4 | + * <p>Title: 〈标题〉</p> | ||
5 | + * <p>Description: 〈描述〉</p> | ||
6 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
7 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
8 | + * <B>Company</B> 地利集团 | ||
9 | + * <p>CreateTime:2014/10/13</p> | ||
10 | + * | ||
11 | + * @author gongsz | ||
12 | + */ | ||
13 | +public class MarkConstant { | ||
14 | + /** | ||
15 | + * 分隔符 - | ||
16 | + */ | ||
17 | + public static final String SPLIT_CODE = "-"; | ||
18 | + /** | ||
19 | + * 冒号 | ||
20 | + */ | ||
21 | + public static final String COLON = ":"; | ||
22 | + /** | ||
23 | + * 逗号 | ||
24 | + */ | ||
25 | + public static final String COMMA = ","; | ||
26 | + | ||
27 | + /** | ||
28 | + * 左方括号 | ||
29 | + */ | ||
30 | + public static final String LEFT_BRACKETS="["; | ||
31 | + /** | ||
32 | + * 右方括号 | ||
33 | + */ | ||
34 | + public static final String RIGHT_BRACKETS="]"; | ||
35 | + /** | ||
36 | + * 换行 | ||
37 | + */ | ||
38 | + public static final String NEW_LINE = "\n";; | ||
39 | + | ||
40 | + /** | ||
41 | + * 符号:点 | ||
42 | + */ | ||
43 | + public static final String SYMBOL_POINT = "."; | ||
44 | + | ||
45 | + /** | ||
46 | + * 符号:/ | ||
47 | + */ | ||
48 | + public static final String SPRIT = "/"; | ||
49 | + /** | ||
50 | + * 符号:下划线 | ||
51 | + */ | ||
52 | + public static final String UNDERLINE = "_"; | ||
53 | + /** | ||
54 | + * 符号:& | ||
55 | + */ | ||
56 | + public static final String AND = "&"; | ||
57 | + /** | ||
58 | + * 空格 | ||
59 | + */ | ||
60 | + public static final String BLANK= " "; | ||
61 | + | ||
62 | + /** | ||
63 | + * 左括号 | ||
64 | + */ | ||
65 | + public static final String LEFT_BRACKET= "("; | ||
66 | + | ||
67 | + /** | ||
68 | + * 右括号 | ||
69 | + */ | ||
70 | + public static final String RIGHT_BRACKET= ")"; | ||
71 | + | ||
72 | +} |
titan-cache/src/main/java/com/dili/titan/exception/TitanException.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.exception; | ||
6 | + | ||
7 | +/** | ||
8 | + * AppException | ||
9 | + * @author dev-center | ||
10 | + * @since 2014-05-10 | ||
11 | + */ | ||
12 | +public class TitanException extends RuntimeException{ | ||
13 | + private static final long serialVersionUID = 1L; | ||
14 | + public TitanException() { | ||
15 | + super(); | ||
16 | + } | ||
17 | + | ||
18 | + public TitanException(String message) { | ||
19 | + super(message); | ||
20 | + } | ||
21 | + | ||
22 | + public TitanException(String message, Throwable cause) { | ||
23 | + super(message, cause); | ||
24 | + } | ||
25 | + | ||
26 | + public TitanException(Throwable cause) { | ||
27 | + super(cause); | ||
28 | + } | ||
29 | +} |
titan-cache/src/main/java/com/dili/titan/handler/AttributeHandler.java
0 → 100644
1 | +package com.dili.titan.handler; | ||
2 | + | ||
3 | +import com.dili.titan.domain.Attribute; | ||
4 | +import com.dili.titan.domain.AttributeValue; | ||
5 | +import com.dili.titan.domain.RedisKeyConstant; | ||
6 | +import com.dili.titan.domain.log.LogHelper; | ||
7 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
8 | +import com.dili.titan.mq.sender.TopicProducer; | ||
9 | +import com.dili.titan.redis.JedisClient; | ||
10 | +import com.dili.titan.service.impl.AttributeService; | ||
11 | +import org.codehaus.jackson.JsonNode; | ||
12 | +import org.codehaus.jackson.map.ObjectMapper; | ||
13 | +import org.springframework.stereotype.Component; | ||
14 | + | ||
15 | +import javax.annotation.PostConstruct; | ||
16 | +import javax.annotation.Resource; | ||
17 | +import java.util.List; | ||
18 | + | ||
19 | +/** | ||
20 | + * <B>Description</B> TODO 属性监控<br /> | ||
21 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
22 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
23 | + * <B>Company</B> 地利集团 | ||
24 | + * @createTime 2014年9月22日 下午2:49:22 | ||
25 | + * @author yangjianjun | ||
26 | + */ | ||
27 | +@Component | ||
28 | +public class AttributeHandler implements BaseHandler { | ||
29 | + | ||
30 | + private ObjectMapper mapper = new ObjectMapper(); | ||
31 | + | ||
32 | + @Resource(name = "attributeService") | ||
33 | + private AttributeService attributeService; | ||
34 | + | ||
35 | + @Resource(name = "jedisClient") | ||
36 | + private JedisClient jedisClient; | ||
37 | + | ||
38 | + @Resource(name = "topicProducer") | ||
39 | + private TopicProducer topicProducer; | ||
40 | + | ||
41 | + @Override | ||
42 | + public void handle(String message) throws Exception { | ||
43 | + try { | ||
44 | + JsonNode node = mapper.readTree(message); | ||
45 | + long attrId = node.get("attrId").asLong(); | ||
46 | + int operType = node.get("oper").asInt(); | ||
47 | + | ||
48 | + switch (operType) { | ||
49 | + case 1: | ||
50 | + add(attrId); | ||
51 | + topicProducer.sendMQAttribute(attrId, operType); | ||
52 | + break; | ||
53 | + case 2: | ||
54 | + update(attrId); | ||
55 | + topicProducer.sendMQAttribute(attrId, operType); | ||
56 | + break; | ||
57 | + case 3: | ||
58 | + delete(attrId); | ||
59 | + topicProducer.sendMQAttribute(attrId, operType); | ||
60 | + break; | ||
61 | + default: | ||
62 | + LogHelper.error(LogTypeEnum.ATTRIBUTE, | ||
63 | + "Attribute operType error"); | ||
64 | + break; | ||
65 | + } | ||
66 | + } catch (Exception e) { | ||
67 | + LogHelper.error(LogTypeEnum.ATTRIBUTE, e, "handle error!", | ||
68 | + e.getMessage()); | ||
69 | + throw e; | ||
70 | + } | ||
71 | + } | ||
72 | + | ||
73 | + /** | ||
74 | + * 新增属性 | ||
75 | + * | ||
76 | + * @param attrId | ||
77 | + */ | ||
78 | + private void add(long attrId) throws Exception { | ||
79 | + putAddUpdateAttr(attrId); | ||
80 | + putAddUpdateAttrValue(attrId); | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + * 修改属性 | ||
85 | + * | ||
86 | + */ | ||
87 | + private void update(long attrId) throws Exception { | ||
88 | + putAddUpdateAttr(attrId); | ||
89 | + putAddUpdateAttrValue(attrId); | ||
90 | + } | ||
91 | + | ||
92 | + private void delete(long attrId) throws Exception { | ||
93 | + delAttr(attrId); | ||
94 | + delAttrValue(attrId); | ||
95 | + } | ||
96 | + | ||
97 | + private void putAddUpdateAttr(long attrId) throws Exception { | ||
98 | + try { | ||
99 | + Attribute attribute = attributeService.getAttributeById(attrId); | ||
100 | + String json = mapper.writeValueAsString(attribute); | ||
101 | + jedisClient.hput(RedisKeyConstant.ATTRIBUTE, | ||
102 | + String.valueOf(attribute.getAttrId()), json,JedisClient.expireTime); | ||
103 | + | ||
104 | + List<Attribute> attributes = attributeService.getAllAttribute(); | ||
105 | + for (Attribute a : attributes) { | ||
106 | + try { | ||
107 | + String jsons = mapper.writeValueAsString(a); | ||
108 | + jedisClient.hput(RedisKeyConstant.ATTRIBUTE, | ||
109 | + String.valueOf(a.getAttrId()), jsons,JedisClient.expireTime); | ||
110 | + putAddUpdateAttrValue(a.getAttrId()); | ||
111 | + } catch (Exception e) { | ||
112 | + LogHelper.error(LogTypeEnum.ATTRIBUTE, e, | ||
113 | + "load attribute error!attrId={}", attrId); | ||
114 | + throw e; | ||
115 | + } | ||
116 | + } | ||
117 | + | ||
118 | + } catch (Exception e) { | ||
119 | + LogHelper.error(LogTypeEnum.ATTRIBUTE, e, | ||
120 | + "load addAttr error!attrId={}", attrId); | ||
121 | + throw e; | ||
122 | + } | ||
123 | + } | ||
124 | + | ||
125 | + private void putAddUpdateAttrValue(long attrId) throws Exception { | ||
126 | + try { | ||
127 | + List<AttributeValue> values = attributeService | ||
128 | + .getAttributeValues(attrId); | ||
129 | + String json = mapper.writeValueAsString(values); | ||
130 | + jedisClient.hput(RedisKeyConstant.ATTR_VALUE, String.valueOf(attrId), json,JedisClient.expireTime); | ||
131 | + } catch (Exception e) { | ||
132 | + LogHelper.error(LogTypeEnum.ATTRIBUTE, e, | ||
133 | + "load addAttrValue error!attrId={}", attrId); | ||
134 | + throw e; | ||
135 | + } | ||
136 | + } | ||
137 | + | ||
138 | + private void delAttr(long attrId) throws Exception { | ||
139 | + try { | ||
140 | + jedisClient.hdel(RedisKeyConstant.ATTRIBUTE, String.valueOf(attrId)); | ||
141 | + putAddUpdateAttr(attrId); | ||
142 | + } catch (Exception e) { | ||
143 | + LogHelper.error(LogTypeEnum.ATTRIBUTE, e, | ||
144 | + "load delAttr error!attrId={}", attrId); | ||
145 | + throw e; | ||
146 | + } | ||
147 | + } | ||
148 | + | ||
149 | + private void delAttrValue(long attrId) throws Exception { | ||
150 | + try { | ||
151 | + jedisClient.hdel(RedisKeyConstant.ATTR_VALUE, String.valueOf(attrId)); | ||
152 | + putAddUpdateAttrValue(attrId); | ||
153 | + } catch (Exception e) { | ||
154 | + LogHelper.error(LogTypeEnum.ATTRIBUTE, e, | ||
155 | + "load delAttrValue error!attrId={}", attrId); | ||
156 | + throw e; | ||
157 | + } | ||
158 | + } | ||
159 | + | ||
160 | + /** | ||
161 | + * 应用启动时自动执行load方法,加载所有的属性信息 | ||
162 | + * | ||
163 | + */ | ||
164 | + @PostConstruct | ||
165 | + public void load() { | ||
166 | + LogHelper.info(LogTypeEnum.ATTRIBUTE, "begin load attribute info"); | ||
167 | + List<Attribute> attributes = attributeService.getAllAttribute(); | ||
168 | + for (Attribute a : attributes) { | ||
169 | + try { | ||
170 | + String json = mapper.writeValueAsString(a); | ||
171 | + jedisClient.hput(RedisKeyConstant.ATTRIBUTE, String.valueOf(a.getAttrId()), | ||
172 | + json,JedisClient.expireTime); | ||
173 | + putAddUpdateAttrValue(a.getAttrId()); | ||
174 | + } catch (Exception e) { | ||
175 | + LogHelper.error(LogTypeEnum.ATTRIBUTE, e, | ||
176 | + "load attribute error!attrId={}", a.getAttrId()); | ||
177 | + } | ||
178 | + } | ||
179 | + LogHelper.info(LogTypeEnum.ATTRIBUTE, "load attribute info done"); | ||
180 | + } | ||
181 | +} |
titan-cache/src/main/java/com/dili/titan/handler/BaseHandler.java
0 → 100644
titan-cache/src/main/java/com/dili/titan/handler/CategoryHandler.java
0 → 100644
1 | +package com.dili.titan.handler; | ||
2 | + | ||
3 | +import com.dili.titan.domain.Category; | ||
4 | +import com.dili.titan.domain.CategoryAttr; | ||
5 | +import com.dili.titan.domain.RedisKeyConstant; | ||
6 | +import com.dili.titan.domain.log.LogHelper; | ||
7 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
8 | +import com.dili.titan.mq.sender.TopicProducer; | ||
9 | +import com.dili.titan.redis.JedisClient; | ||
10 | +import com.dili.titan.service.impl.CategoryService; | ||
11 | + | ||
12 | +import org.apache.commons.collections.CollectionUtils; | ||
13 | +import org.apache.commons.lang.StringUtils; | ||
14 | +import org.codehaus.jackson.JsonNode; | ||
15 | +import org.codehaus.jackson.map.DeserializationConfig; | ||
16 | +import org.codehaus.jackson.map.ObjectMapper; | ||
17 | +import org.springframework.stereotype.Component; | ||
18 | + | ||
19 | +import javax.annotation.PostConstruct; | ||
20 | +import javax.annotation.Resource; | ||
21 | + | ||
22 | +import java.util.ArrayList; | ||
23 | +import java.util.List; | ||
24 | +import java.util.Set; | ||
25 | + | ||
26 | +/** | ||
27 | + * <B>Description</B> TODO 类目监控<br /> | ||
28 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
29 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
30 | + * <B>Company</B> 地利集团 | ||
31 | + * @createTime 2014年9月22日 下午2:49:30 | ||
32 | + * @author yangjianjun | ||
33 | + */ | ||
34 | +@Component | ||
35 | +public class CategoryHandler implements BaseHandler { | ||
36 | + | ||
37 | + private ObjectMapper mapper = new ObjectMapper().configure( | ||
38 | + DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
39 | + | ||
40 | + @Resource(name = "categoryService") | ||
41 | + private CategoryService categoryService; | ||
42 | + | ||
43 | + @Resource(name = "jedisClient") | ||
44 | + private JedisClient jedisClient; | ||
45 | + | ||
46 | + @Resource(name = "topicProducer") | ||
47 | + private TopicProducer topicProducer; | ||
48 | + | ||
49 | + @Override | ||
50 | + public void handle(String message) throws Exception { | ||
51 | + try { | ||
52 | + JsonNode node = mapper.readTree(message); | ||
53 | + int cateId = node.get("cateId").asInt(); | ||
54 | + int operType = node.get("oper").asInt(); | ||
55 | + | ||
56 | + switch (operType) { | ||
57 | + case 1: | ||
58 | + add(cateId); | ||
59 | + topicProducer.sendMQCategory(cateId, operType); | ||
60 | + break; | ||
61 | + case 2: | ||
62 | + update(cateId); | ||
63 | + topicProducer.sendMQCategory(cateId, operType); | ||
64 | + break; | ||
65 | + case 3: | ||
66 | + update(cateId); | ||
67 | + topicProducer.sendMQCategory(cateId, operType); | ||
68 | + break; | ||
69 | + default: | ||
70 | + LogHelper | ||
71 | + .error(LogTypeEnum.CATEGORY, "Category operType error"); | ||
72 | + break; | ||
73 | + } | ||
74 | + } catch (Exception e) { | ||
75 | + LogHelper.error(LogTypeEnum.CATEGORY, e, e.getMessage()); | ||
76 | + throw e; | ||
77 | + } | ||
78 | + } | ||
79 | + | ||
80 | + private void add(int cateId) throws Exception { | ||
81 | + putCateParent(cateId); | ||
82 | + putAddUpdateCate(cateId); | ||
83 | + putAddUpdateCateAttr(cateId); | ||
84 | + } | ||
85 | + | ||
86 | + /** | ||
87 | + * 修改属性 | ||
88 | + * | ||
89 | + */ | ||
90 | + private void update(int cateId) throws Exception { | ||
91 | + putAddUpdateCate(cateId); | ||
92 | + putAddUpdateCateAttr(cateId); | ||
93 | + } | ||
94 | + | ||
95 | + private void putAddUpdateCate(int cateId) throws Exception { | ||
96 | + try { | ||
97 | + Category category = categoryService.getCategoryById(cateId); | ||
98 | + String json = mapper.writeValueAsString(category); | ||
99 | + jedisClient | ||
100 | + .hput(RedisKeyConstant.CATEGORY, String.valueOf(category.getId()), json,JedisClient.expireTime); | ||
101 | + setCateChildRedis(category); | ||
102 | + } catch (Exception e) { | ||
103 | + LogHelper.error(LogTypeEnum.CATEGORY, e, | ||
104 | + "putAddUpdateCate error! cateId={}", cateId); | ||
105 | + throw e; | ||
106 | + } | ||
107 | + } | ||
108 | + | ||
109 | + private void putAddUpdateCateAttr(int cateId) throws Exception { | ||
110 | + try { | ||
111 | + List<CategoryAttr> values = categoryService | ||
112 | + .getCategoryAttrById(cateId); | ||
113 | + String json = mapper.writeValueAsString(values); | ||
114 | + jedisClient.hput(RedisKeyConstant.CATE_ATTR, String.valueOf(cateId), json,JedisClient.expireTime); | ||
115 | + | ||
116 | + List<CategoryAttr> seacherValues = categoryService | ||
117 | + .getCategorySeacherAttrById(cateId); | ||
118 | + String seacherAttrJson = mapper.writeValueAsString(seacherValues); | ||
119 | + jedisClient.hput(RedisKeyConstant.CATE_SEARCH_ATTRA, String.valueOf(cateId), | ||
120 | + seacherAttrJson,JedisClient.expireTime);// 可搜索属性 | ||
121 | + } catch (Exception e) { | ||
122 | + LogHelper.error(LogTypeEnum.CATEGORY, e, | ||
123 | + "putAddUpdateCateAttr error! cateId={}", cateId); | ||
124 | + throw e; | ||
125 | + } | ||
126 | + } | ||
127 | + | ||
128 | + private void putCateParent(int cateId) throws Exception { | ||
129 | + try { | ||
130 | + List<Integer> parents = categoryService.getAllParentCate(cateId); | ||
131 | + if (CollectionUtils.isEmpty(parents)) { | ||
132 | + return; | ||
133 | + } | ||
134 | + jedisClient.sadd(RedisKeyConstant.CATE_ALLPARENT + cateId,JedisClient.expireTime, mapper | ||
135 | + .writeValueAsString(parents.toArray(new Integer[parents | ||
136 | + .size()]))); | ||
137 | + } catch (Exception e) { | ||
138 | + LogHelper.error(LogTypeEnum.CATEGORY, e, | ||
139 | + "putCateParent error! cateId={}", cateId); | ||
140 | + throw e; | ||
141 | + | ||
142 | + } | ||
143 | + } | ||
144 | + | ||
145 | + /** | ||
146 | + * 应用启动时自动执行load方法,加载所有的类目信息 | ||
147 | + * | ||
148 | + */ | ||
149 | + @PostConstruct | ||
150 | + public void load() { | ||
151 | + LogHelper.info(LogTypeEnum.CATEGORY, "begin load category info"); | ||
152 | + List<Category> categorys = categoryService.getAllCategory(); | ||
153 | + for (Category c : categorys) { | ||
154 | + try { | ||
155 | + String json = mapper.writeValueAsString(c); | ||
156 | + jedisClient.hput(RedisKeyConstant.CATEGORY, String.valueOf(c.getId()), json,JedisClient.expireTime); | ||
157 | + setCateChildRedis(c); | ||
158 | + putAddUpdateCateAttr(c.getId()); | ||
159 | + putCateParent(c.getId()); | ||
160 | + } catch (Exception e) { | ||
161 | + LogHelper.error(LogTypeEnum.CATEGORY, e, | ||
162 | + "load category error!cateId={}", c.getId()); | ||
163 | + } | ||
164 | + } | ||
165 | + LogHelper.info(LogTypeEnum.CATEGORY, "load category info done"); | ||
166 | + } | ||
167 | + | ||
168 | + private void setCateChildRedis(Category c) { | ||
169 | + List<Integer> cids = categoryService.getChildByCid(c.getParent()); | ||
170 | + jedisClient.delKey(RedisKeyConstant.CATE_CHILD+ c.getParent()); | ||
171 | + if(CollectionUtils.isNotEmpty(cids)){ | ||
172 | + jedisClient.sadd(RedisKeyConstant.CATE_CHILD+ c.getParent(),JedisClient.expireTime, | ||
173 | + StringUtils.join(cids.toArray(),",").split(",")); | ||
174 | + } | ||
175 | + } | ||
176 | + | ||
177 | +} |
titan-cache/src/main/java/com/dili/titan/handler/CloseShopHandler.java
0 → 100644
1 | +package com.dili.titan.handler; | ||
2 | + | ||
3 | +import com.dili.titan.domain.RedisKeyConstant; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.mq.sender.TopicProducer; | ||
7 | +import com.dili.titan.redis.JedisClient; | ||
8 | +import com.dili.titan.service.impl.ProductPopService; | ||
9 | +import org.apache.commons.collections.CollectionUtils; | ||
10 | +import org.codehaus.jackson.JsonNode; | ||
11 | +import org.codehaus.jackson.map.DeserializationConfig; | ||
12 | +import org.codehaus.jackson.map.ObjectMapper; | ||
13 | +import org.springframework.stereotype.Component; | ||
14 | + | ||
15 | +import javax.annotation.Resource; | ||
16 | +import java.util.List; | ||
17 | + | ||
18 | + | ||
19 | +/** | ||
20 | + * <B>Description</B> 求购信息 <br /> | ||
21 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
22 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
23 | + * <B>Company</B> 地利集团 | ||
24 | + * @createTime 2014年12月22日 下午6:24:00 | ||
25 | + * @author ywd | ||
26 | + */ | ||
27 | +@Component | ||
28 | +public class CloseShopHandler implements BaseHandler { | ||
29 | + | ||
30 | + private ObjectMapper mapper = new ObjectMapper().configure( | ||
31 | + DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
32 | + | ||
33 | + @Resource(name = "productPopService") | ||
34 | + private ProductPopService productPopService; | ||
35 | + | ||
36 | + @Resource(name = "topicProducer") | ||
37 | + private TopicProducer topicProducer; | ||
38 | + | ||
39 | + @Resource(name = "jedisClient") | ||
40 | + private JedisClient client; | ||
41 | + | ||
42 | + @Override | ||
43 | + public void handle(String message) throws Exception { | ||
44 | + try { | ||
45 | + JsonNode node = mapper.readTree(message); | ||
46 | + long shopId = node.get("shopId").asLong(); | ||
47 | + int shopState = node.get("shopState").asInt(); | ||
48 | + if(shopState==4) { | ||
49 | + update(shopId); | ||
50 | + } | ||
51 | + if(shopState==5) { | ||
52 | + del(shopId); | ||
53 | + } | ||
54 | + } catch (Exception e) { | ||
55 | + LogHelper.error(LogTypeEnum.PRODUCT, e, e.getMessage()); | ||
56 | + throw e; | ||
57 | + } | ||
58 | + } | ||
59 | + | ||
60 | + public void del(long shopId) throws Exception{ | ||
61 | + List<Long> pids = productPopService.selectDelProduct(shopId); | ||
62 | + if(CollectionUtils.isEmpty(pids)){ | ||
63 | + return; | ||
64 | + } | ||
65 | + productPopService.delProduct(shopId); | ||
66 | + for (Long pid: pids ) { | ||
67 | + client.hdel(RedisKeyConstant.PRODUCT_POP, String.valueOf(pid)); | ||
68 | + topicProducer.sendMQProduct(pid,1); | ||
69 | + } | ||
70 | + } | ||
71 | + | ||
72 | + public void update(long shopId) throws Exception{ | ||
73 | + List<Long> pids = productPopService.selectDropsProduct(shopId); | ||
74 | + if(CollectionUtils.isEmpty(pids)){ | ||
75 | + return; | ||
76 | + } | ||
77 | + productPopService.dropsProduct(shopId); | ||
78 | + for (Long pid: pids ) { | ||
79 | + client.hdel(RedisKeyConstant.PRODUCT_POP, String.valueOf(pid)); | ||
80 | + topicProducer.sendMQProduct(pid,1); | ||
81 | + } | ||
82 | + } | ||
83 | + | ||
84 | +} |
titan-cache/src/main/java/com/dili/titan/handler/PresaleHandler.java
0 → 100644
1 | +package com.dili.titan.handler; | ||
2 | + | ||
3 | +import com.dili.titan.domain.RedisKeyConstant; | ||
4 | +import com.dili.titan.domain.gq.Presale; | ||
5 | +import com.dili.titan.domain.log.LogHelper; | ||
6 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
7 | +import com.dili.titan.mq.sender.TopicProducer; | ||
8 | +import com.dili.titan.redis.JedisClient; | ||
9 | +import com.dili.titan.service.impl.PresaleService; | ||
10 | +import org.codehaus.jackson.JsonNode; | ||
11 | +import org.codehaus.jackson.map.DeserializationConfig; | ||
12 | +import org.codehaus.jackson.map.ObjectMapper; | ||
13 | +import org.springframework.stereotype.Component; | ||
14 | + | ||
15 | +import javax.annotation.Resource; | ||
16 | + | ||
17 | + | ||
18 | +/** | ||
19 | + * <B>Description</B> 供应信息 <br /> | ||
20 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
21 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
22 | + * <B>Company</B> 地利集团 | ||
23 | + * @createTime 2014年12月23日 下午4:42:36 | ||
24 | + * @author ywd | ||
25 | + */ | ||
26 | +@Component | ||
27 | +public class PresaleHandler implements BaseHandler { | ||
28 | + | ||
29 | + private ObjectMapper mapper = new ObjectMapper().configure( | ||
30 | + DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
31 | + | ||
32 | + @Resource | ||
33 | + private PresaleService presaleService; | ||
34 | + | ||
35 | + @Resource(name = "jedisClient") | ||
36 | + private JedisClient jedisClient; | ||
37 | + | ||
38 | + @Resource(name = "topicProducer") | ||
39 | + private TopicProducer topicProducer; | ||
40 | + | ||
41 | + @Override | ||
42 | + public void handle(String message) throws Exception { | ||
43 | + try { | ||
44 | + JsonNode node = mapper.readTree(message); | ||
45 | + int operType = node.get("oper").asInt(); | ||
46 | + Long pid = node.get("pid").asLong(); | ||
47 | + put(pid); | ||
48 | + topicProducer.sendMQPresale(pid,operType); | ||
49 | + } catch (Exception e) { | ||
50 | + LogHelper.error(LogTypeEnum.PRESALE, e, e.getMessage()); | ||
51 | + throw e; | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * this method is 根据供应ID存储供应 | ||
57 | + * @createTime 2014年12月22日 下午5:14:24 | ||
58 | + * @author ywd | ||
59 | + */ | ||
60 | + private void put(Long pid)throws Exception{ | ||
61 | + try { | ||
62 | + Presale presale= presaleService.findByKey(pid); | ||
63 | + if(presale == null){ | ||
64 | + LogHelper.error(LogTypeEnum.PRESALE , | ||
65 | + "can't find Presale by pid={}", pid); | ||
66 | + return; | ||
67 | + } | ||
68 | + String json = mapper.writeValueAsString(presale); | ||
69 | + jedisClient.hput(RedisKeyConstant.PRESALE,presale.getId().toString(), json,JedisClient.expireTime); | ||
70 | + } catch (Exception e) { | ||
71 | + LogHelper.error(LogTypeEnum.PRESALE, e, | ||
72 | + "load putPresale error!pid={}", pid); | ||
73 | + throw e; | ||
74 | + } | ||
75 | + } | ||
76 | +} |
titan-cache/src/main/java/com/dili/titan/handler/ProductHandler.java
0 → 100644
1 | +package com.dili.titan.handler; | ||
2 | + | ||
3 | +import com.dili.titan.mq.sender.TopicProducer; | ||
4 | +import com.dili.titan.redis.JedisClient; | ||
5 | +import org.apache.log4j.Logger; | ||
6 | +import org.codehaus.jackson.JsonNode; | ||
7 | +import org.codehaus.jackson.map.ObjectMapper; | ||
8 | +import org.springframework.stereotype.Component; | ||
9 | + | ||
10 | +import javax.annotation.Resource; | ||
11 | +/** | ||
12 | + * <B>Description</B> TODO 商品监控 <br /> | ||
13 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
14 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
15 | + * <B>Company</B> 地利集团 | ||
16 | + * @createTime 2014年9月22日 下午2:49:15 | ||
17 | + * @author yangjianjun | ||
18 | + */ | ||
19 | +@Component | ||
20 | +public class ProductHandler implements BaseHandler { | ||
21 | + private Logger logger = Logger.getLogger(ProductHandler.class); | ||
22 | + private ObjectMapper mapper = new ObjectMapper(); | ||
23 | + @Resource(name="topicProducer") | ||
24 | + private TopicProducer topicProducer; | ||
25 | + @Resource(name="jedisClient") | ||
26 | + private JedisClient client; | ||
27 | + /** | ||
28 | + * 第三方销售 | ||
29 | + */ | ||
30 | + public static final String SALE_TYPE_POP = "30"; | ||
31 | + | ||
32 | + @Override | ||
33 | + public void handle(String message) { | ||
34 | + JsonNode node; | ||
35 | + try { | ||
36 | + node = mapper.readTree(message); | ||
37 | + long pid = node.get("pid").asLong(); | ||
38 | + int operType = node.get("oper").asInt(); | ||
39 | + int sign = node.get("sign").asInt(); // 1:修改商品,2:修改商品价格或库存(实时 ), 3: 删除商品, 4: 修改商品认证信息, 5: 更新商品状态,6:批量设置第三方商品自定义分类 | ||
40 | + switch (operType) { | ||
41 | + case 1: | ||
42 | + topicProducer.sendMQProduct(pid, operType); | ||
43 | + break; | ||
44 | + case 2: | ||
45 | + if(sign == 1){ //1:修改商品 | ||
46 | + deleteProductAllInfo(pid); | ||
47 | + }else if(sign == 4){ // 4: 修改商品认证信息 | ||
48 | + client.hdel("product_Auth", String.valueOf(pid)); | ||
49 | + }else if(sign == 5 || sign == 7){ //5: 更新商品状态 | ||
50 | + String saleType = getSaleType(pid); | ||
51 | + if (SALE_TYPE_POP.equals(saleType)) { | ||
52 | + client.hdel("product_Pop", String.valueOf(pid)); | ||
53 | + } | ||
54 | + }else if(sign == 6){ //6:批量设置第三方商品自定义分类 | ||
55 | + client.hdel("product_Subcate_Id", String.valueOf(pid)); | ||
56 | + }else if(sign == 7){ //7:清除视频缓存 | ||
57 | + client.hdel("product_Video", String.valueOf(pid)); | ||
58 | + } | ||
59 | + topicProducer.sendMQProduct(pid, operType); | ||
60 | + break; | ||
61 | + case 3: | ||
62 | + if(sign == 3){ //3: 删除商品 | ||
63 | + deleteProductAllInfo(pid); | ||
64 | + } | ||
65 | + topicProducer.sendMQProduct(pid, operType); | ||
66 | + break; | ||
67 | + default: | ||
68 | + break; | ||
69 | + } | ||
70 | + } catch (Exception e) { | ||
71 | + logger.error("handle error", e); | ||
72 | + } | ||
73 | + } | ||
74 | + | ||
75 | + /** | ||
76 | + * this method is 删除商品所有缓存 | ||
77 | + * @param pid | ||
78 | + * @createTime 2015年6月4日 下午2:06:23 | ||
79 | + * @author yangwd | ||
80 | + */ | ||
81 | + private void deleteProductAllInfo(long pid){ | ||
82 | + String saleType = getSaleType(pid); | ||
83 | + if (SALE_TYPE_POP.equals(saleType)) { | ||
84 | + client.hdel("product_Pop", String.valueOf(pid)); | ||
85 | + client.hdel("product_Pop_Attr", String.valueOf(pid)); | ||
86 | + } | ||
87 | + client.hdel("product_Img", String.valueOf(pid)); | ||
88 | + client.hdel("product_Auth", String.valueOf(pid)); | ||
89 | + client.hdel("product_Video", String.valueOf(pid)); | ||
90 | + } | ||
91 | + | ||
92 | + public String getSaleType(Long pid) { | ||
93 | + if (pid >= 1000000000l && pid < 5000000000l) { | ||
94 | + return SALE_TYPE_POP; | ||
95 | + } else { | ||
96 | + return null; | ||
97 | + } | ||
98 | + } | ||
99 | + | ||
100 | +} |
titan-cache/src/main/java/com/dili/titan/handler/ProductSearchHandler.java
0 → 100644
1 | +package com.dili.titan.handler; | ||
2 | + | ||
3 | +import com.dili.titan.domain.log.LogHelper; | ||
4 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
5 | +import com.dili.titan.mq.sender.TopicProducer; | ||
6 | +import org.codehaus.jackson.JsonNode; | ||
7 | +import org.codehaus.jackson.map.ObjectMapper; | ||
8 | +import org.springframework.stereotype.Component; | ||
9 | + | ||
10 | +import javax.annotation.Resource; | ||
11 | + | ||
12 | +/** | ||
13 | + * <B>Description</B> TODO 商品监控 <br /> | ||
14 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
15 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
16 | + * <B>Company</B> 地利集团 | ||
17 | + * | ||
18 | + * @author yangjianjun | ||
19 | + * @createTime 2014年9月22日 下午2:49:15 | ||
20 | + */ | ||
21 | +@Component | ||
22 | +public class ProductSearchHandler implements BaseHandler { | ||
23 | + private ObjectMapper mapper = new ObjectMapper(); | ||
24 | + @Resource(name = "topicProducer") | ||
25 | + private TopicProducer topicProducer; | ||
26 | + | ||
27 | + @Override | ||
28 | + public void handle(String message) { | ||
29 | + JsonNode node; | ||
30 | + try { | ||
31 | + node = mapper.readTree(message); | ||
32 | + long pid = node.get("cid").asLong(); | ||
33 | + int type = node.get("type").asInt(); | ||
34 | + int operType = node.get("oper").asInt(); | ||
35 | + topicProducer.sendMQProductSearch(pid,type, operType); | ||
36 | + } catch (Exception e) { | ||
37 | + LogHelper.error(LogTypeEnum.PRODUCT, e, "ProductSearchHandler error", e); | ||
38 | + } | ||
39 | + } | ||
40 | +} |
titan-cache/src/main/java/com/dili/titan/handler/PurchaseHandler.java
0 → 100644
1 | +package com.dili.titan.handler; | ||
2 | + | ||
3 | +import com.dili.titan.domain.RedisKeyConstant; | ||
4 | +import com.dili.titan.domain.gq.Purchase; | ||
5 | +import com.dili.titan.domain.log.LogHelper; | ||
6 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
7 | +import com.dili.titan.mq.sender.TopicProducer; | ||
8 | +import com.dili.titan.redis.JedisClient; | ||
9 | +import com.dili.titan.service.impl.PurchaseService; | ||
10 | +import org.apache.commons.collections.CollectionUtils; | ||
11 | +import org.codehaus.jackson.JsonNode; | ||
12 | +import org.codehaus.jackson.map.DeserializationConfig; | ||
13 | +import org.codehaus.jackson.map.ObjectMapper; | ||
14 | +import org.springframework.stereotype.Component; | ||
15 | + | ||
16 | +import javax.annotation.PostConstruct; | ||
17 | +import javax.annotation.Resource; | ||
18 | +import java.util.ArrayList; | ||
19 | +import java.util.List; | ||
20 | + | ||
21 | + | ||
22 | +/** | ||
23 | + * <B>Description</B> 求购信息 <br /> | ||
24 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
25 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
26 | + * <B>Company</B> 地利集团 | ||
27 | + * @createTime 2014年12月22日 下午6:24:00 | ||
28 | + * @author ywd | ||
29 | + */ | ||
30 | +@Component | ||
31 | +public class PurchaseHandler implements BaseHandler { | ||
32 | + | ||
33 | + private ObjectMapper mapper = new ObjectMapper().configure( | ||
34 | + DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
35 | + | ||
36 | + @Resource | ||
37 | + private PurchaseService purchaseService; | ||
38 | + | ||
39 | + @Resource(name = "jedisClient") | ||
40 | + private JedisClient jedisClient; | ||
41 | + | ||
42 | + @Resource(name = "topicProducer") | ||
43 | + private TopicProducer topicProducer; | ||
44 | + | ||
45 | + @Override | ||
46 | + public void handle(String message) throws Exception { | ||
47 | + try { | ||
48 | + JsonNode node = mapper.readTree(message); | ||
49 | + int operType = node.get("oper").asInt(); | ||
50 | + Long pid = node.get("pid").asLong(); | ||
51 | + put(pid); | ||
52 | + topicProducer.sendMQPurchase(pid,operType); | ||
53 | + } catch (Exception e) { | ||
54 | + LogHelper.error(LogTypeEnum.PURCHASE, e, e.getMessage()); | ||
55 | + throw e; | ||
56 | + } | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * this method is 根据供应ID存储供应 | ||
61 | + * @createTime 2014年12月22日 下午5:14:24 | ||
62 | + * @author ywd | ||
63 | + */ | ||
64 | + private void put(Long pid)throws Exception{ | ||
65 | + try { | ||
66 | + Purchase purchase= purchaseService.findByKey(pid); | ||
67 | + if(purchase == null){ | ||
68 | + LogHelper.error(LogTypeEnum.PURCHASE , | ||
69 | + "can't find Purchase by pid={}", pid); | ||
70 | + return; | ||
71 | + } | ||
72 | + String json = mapper.writeValueAsString(purchase); | ||
73 | + jedisClient.hput(RedisKeyConstant.PURCHASE,purchase.getId().toString(), json,JedisClient.expireTime); | ||
74 | + } catch (Exception e) { | ||
75 | + LogHelper.error(LogTypeEnum.PURCHASE, e, | ||
76 | + "load putPurchase error!pid={}", pid); | ||
77 | + throw e; | ||
78 | + } | ||
79 | + } | ||
80 | + | ||
81 | +} |
titan-cache/src/main/java/com/dili/titan/handler/ShopAddressHandler.java
0 → 100644
1 | +package com.dili.titan.handler; | ||
2 | + | ||
3 | +import com.dili.titan.domain.log.LogHelper; | ||
4 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
5 | +import com.dili.titan.service.impl.ProductPopService; | ||
6 | +import org.codehaus.jackson.JsonNode; | ||
7 | +import org.codehaus.jackson.map.DeserializationConfig; | ||
8 | +import org.codehaus.jackson.map.ObjectMapper; | ||
9 | +import org.springframework.stereotype.Component; | ||
10 | + | ||
11 | +import javax.annotation.Resource; | ||
12 | + | ||
13 | + | ||
14 | +/** | ||
15 | + * <B>Description</B> 求购信息 <br /> | ||
16 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
17 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
18 | + * <B>Company</B> 地利集团 | ||
19 | + * @createTime 2014年12月22日 下午6:24:00 | ||
20 | + * @author ywd | ||
21 | + */ | ||
22 | +@Component | ||
23 | +public class ShopAddressHandler implements BaseHandler { | ||
24 | + | ||
25 | + private ObjectMapper mapper = new ObjectMapper().configure( | ||
26 | + DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
27 | + | ||
28 | + @Resource(name = "productPopService") | ||
29 | + private ProductPopService productPopService; | ||
30 | + | ||
31 | + @Override | ||
32 | + public void handle(String message) throws Exception { | ||
33 | + try { | ||
34 | + JsonNode node = mapper.readTree(message); | ||
35 | + long shopId = node.get("shopId").asLong(); | ||
36 | + int cityId = node.get("cityId").asInt(); | ||
37 | + update(shopId, cityId); | ||
38 | + } catch (Exception e) { | ||
39 | + LogHelper.error(LogTypeEnum.PRODUCT, e, e.getMessage()); | ||
40 | + throw e; | ||
41 | + } | ||
42 | + } | ||
43 | + | ||
44 | + public void update(long shopId,int cityId) throws Exception{ | ||
45 | + productPopService.updateCityId(shopId, cityId); | ||
46 | + } | ||
47 | + | ||
48 | +} |
titan-cache/src/main/java/com/dili/titan/handler/ShopMarketHandler.java
0 → 100644
1 | +package com.dili.titan.handler; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.rpc.ConfigRPC; | ||
7 | +import com.dili.titan.service.impl.ProductPopService; | ||
8 | +import com.diligrp.website.web.interfaces.domain.output.PickUpPointResp; | ||
9 | +import org.springframework.stereotype.Component; | ||
10 | +import org.springframework.transaction.annotation.Transactional; | ||
11 | + | ||
12 | +import javax.annotation.Resource; | ||
13 | + | ||
14 | + | ||
15 | +/** | ||
16 | + * <B>Description</B> 求购信息 <br /> | ||
17 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
18 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
19 | + * <B>Company</B> 地利集团 | ||
20 | + * | ||
21 | + * @author ywd | ||
22 | + * @createTime 2014年12月22日 下午6:24:00 | ||
23 | + */ | ||
24 | +@Component | ||
25 | +public class ShopMarketHandler implements BaseHandler { | ||
26 | + | ||
27 | + @Resource | ||
28 | + private ProductPopService productPopService; | ||
29 | + @Resource | ||
30 | + ConfigRPC configRPC; | ||
31 | + | ||
32 | + @Override | ||
33 | + public void handle(String message) throws Exception { | ||
34 | + try { | ||
35 | + JSONObject node = JSONObject.parseObject(message); | ||
36 | + Long shopId = node.getLong("shopId"); | ||
37 | + Long marketId = node.getLong("statisticsMarket"); | ||
38 | + update(shopId, marketId); | ||
39 | + } catch (Exception e) { | ||
40 | + LogHelper.error(LogTypeEnum.PRODUCT, e, e.getMessage()); | ||
41 | + throw e; | ||
42 | + } | ||
43 | + } | ||
44 | + | ||
45 | + @Transactional | ||
46 | + public void update(Long shopId,Long marketId) throws Exception { | ||
47 | + if(marketId==0){ | ||
48 | + productPopService.updateMarket(shopId,marketId,""); | ||
49 | + return; | ||
50 | + } | ||
51 | + PickUpPointResp resp = configRPC.getPickUpInfoById(marketId); | ||
52 | + if(resp==null){ | ||
53 | + throw new Exception("市场ID不存在!"); | ||
54 | + } | ||
55 | + productPopService.updateMarket(shopId,marketId,resp.getPickName()); | ||
56 | + } | ||
57 | + | ||
58 | +} |
titan-cache/src/main/java/com/dili/titan/handler/ShopNameHandler.java
0 → 100644
1 | +package com.dili.titan.handler; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.service.impl.ProductPopService; | ||
7 | +import org.codehaus.jackson.JsonNode; | ||
8 | +import org.codehaus.jackson.map.DeserializationConfig; | ||
9 | +import org.codehaus.jackson.map.ObjectMapper; | ||
10 | +import org.springframework.stereotype.Component; | ||
11 | + | ||
12 | +import javax.annotation.Resource; | ||
13 | + | ||
14 | + | ||
15 | +/** | ||
16 | + * <B>Description</B> 求购信息 <br /> | ||
17 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
18 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
19 | + * <B>Company</B> 地利集团 | ||
20 | + * @createTime 2014年12月22日 下午6:24:00 | ||
21 | + * @author ywd | ||
22 | + */ | ||
23 | +@Component | ||
24 | +public class ShopNameHandler implements BaseHandler { | ||
25 | + | ||
26 | + @Resource(name = "productPopService") | ||
27 | + private ProductPopService productPopService; | ||
28 | + | ||
29 | + @Override | ||
30 | + public void handle(String message) throws Exception { | ||
31 | + try { | ||
32 | + JSONObject node = JSONObject.parseObject(message); | ||
33 | + long shopId = node.getLong("shopId"); | ||
34 | + String shopName = node.getString("shopName"); | ||
35 | + update(shopId, shopName); | ||
36 | + } catch (Exception e) { | ||
37 | + LogHelper.error(LogTypeEnum.PRODUCT, e, e.getMessage()); | ||
38 | + throw e; | ||
39 | + } | ||
40 | + } | ||
41 | + | ||
42 | + public void update(long shopId,String shopName) throws Exception{ | ||
43 | + productPopService.updateShopName(shopId, shopName); | ||
44 | + } | ||
45 | + | ||
46 | +} |
titan-cache/src/main/java/com/dili/titan/handler/SupplyHandler.java
0 → 100644
1 | +package com.dili.titan.handler; | ||
2 | + | ||
3 | +import com.dili.titan.domain.RedisKeyConstant; | ||
4 | +import com.dili.titan.domain.gq.Supply; | ||
5 | +import com.dili.titan.domain.log.LogHelper; | ||
6 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
7 | +import com.dili.titan.mq.sender.TopicProducer; | ||
8 | +import com.dili.titan.redis.JedisClient; | ||
9 | +import com.dili.titan.service.impl.SupplyService; | ||
10 | +import org.codehaus.jackson.JsonNode; | ||
11 | +import org.codehaus.jackson.map.DeserializationConfig; | ||
12 | +import org.codehaus.jackson.map.ObjectMapper; | ||
13 | +import org.springframework.stereotype.Component; | ||
14 | + | ||
15 | +import javax.annotation.Resource; | ||
16 | + | ||
17 | + | ||
18 | +/** | ||
19 | + * <B>Description</B> 供应信息 <br /> | ||
20 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
21 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
22 | + * <B>Company</B> 地利集团 | ||
23 | + * @createTime 2014年12月23日 下午4:42:36 | ||
24 | + * @author ywd | ||
25 | + */ | ||
26 | +@Component | ||
27 | +public class SupplyHandler implements BaseHandler { | ||
28 | + | ||
29 | + private ObjectMapper mapper = new ObjectMapper().configure( | ||
30 | + DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
31 | + | ||
32 | + @Resource(name = "supplyService") | ||
33 | + private SupplyService supplyService; | ||
34 | + | ||
35 | + @Resource(name = "jedisClient") | ||
36 | + private JedisClient jedisClient; | ||
37 | + | ||
38 | + @Resource(name = "topicProducer") | ||
39 | + private TopicProducer topicProducer; | ||
40 | + | ||
41 | + @Override | ||
42 | + public void handle(String message) throws Exception { | ||
43 | + try { | ||
44 | + JsonNode node = mapper.readTree(message); | ||
45 | + int operType = node.get("oper").asInt(); | ||
46 | + Long pid = node.get("pid").asLong(); | ||
47 | + put(pid); | ||
48 | + topicProducer.sendMQSupply(pid,operType); | ||
49 | + } catch (Exception e) { | ||
50 | + LogHelper.error(LogTypeEnum.SUPPLY, e, e.getMessage()); | ||
51 | + throw e; | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * this method is 根据供应ID存储供应 | ||
57 | + * @createTime 2014年12月22日 下午5:14:24 | ||
58 | + * @author ywd | ||
59 | + */ | ||
60 | + private void put(Long pid)throws Exception{ | ||
61 | + try { | ||
62 | + Supply supply= supplyService.findByKey(pid); | ||
63 | + if(supply == null){ | ||
64 | + LogHelper.error(LogTypeEnum.SUPPLY , | ||
65 | + "can't find Supply by pid={}", pid); | ||
66 | + return; | ||
67 | + } | ||
68 | + String json = mapper.writeValueAsString(supply); | ||
69 | + jedisClient.hput(RedisKeyConstant.SUPPLY,supply.getId().toString(), json,JedisClient.expireTime); | ||
70 | + } catch (Exception e) { | ||
71 | + LogHelper.error(LogTypeEnum.SUPPLY, e, | ||
72 | + "load putSupply error!pid={}", pid); | ||
73 | + throw e; | ||
74 | + } | ||
75 | + } | ||
76 | +} |
titan-cache/src/main/java/com/dili/titan/handler/UserHandler.java
0 → 100644
1 | +package com.dili.titan.handler; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import com.dili.titan.domain.RedisKeyConstant; | ||
5 | +import com.dili.titan.domain.gq.Presale; | ||
6 | +import com.dili.titan.domain.gq.Purchase; | ||
7 | +import com.dili.titan.domain.gq.Supply; | ||
8 | +import com.dili.titan.domain.log.LogHelper; | ||
9 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
10 | +import com.dili.titan.redis.JedisClient; | ||
11 | +import com.dili.titan.service.impl.PresaleService; | ||
12 | +import com.dili.titan.service.impl.ProductPopService; | ||
13 | +import com.dili.titan.service.impl.PurchaseService; | ||
14 | +import com.dili.titan.service.impl.SupplyService; | ||
15 | +import org.apache.commons.collections.CollectionUtils; | ||
16 | +import org.springframework.stereotype.Component; | ||
17 | +import org.springframework.transaction.annotation.Transactional; | ||
18 | + | ||
19 | +import javax.annotation.Resource; | ||
20 | +import java.util.List; | ||
21 | + | ||
22 | + | ||
23 | +/** | ||
24 | + * <B>Description</B> 求购信息 <br /> | ||
25 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
26 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
27 | + * <B>Company</B> 地利集团 | ||
28 | + * | ||
29 | + * @author ywd | ||
30 | + * @createTime 2014年12月22日 下午6:24:00 | ||
31 | + */ | ||
32 | +@Component | ||
33 | +public class UserHandler implements BaseHandler { | ||
34 | + | ||
35 | + @Resource | ||
36 | + private ProductPopService productPopService; | ||
37 | + | ||
38 | + @Override | ||
39 | + public void handle(String message) throws Exception { | ||
40 | + try { | ||
41 | + JSONObject node = JSONObject.parseObject(message); | ||
42 | + Long userId = node.getLong("id"); | ||
43 | + String userName = node.getString("accountName"); | ||
44 | + update(userId, userName); | ||
45 | + } catch (Exception e) { | ||
46 | + LogHelper.error(LogTypeEnum.PRODUCT, e, e.getMessage()); | ||
47 | + throw e; | ||
48 | + } | ||
49 | + } | ||
50 | + | ||
51 | + @Transactional | ||
52 | + public void update(Long userId, String userName) throws Exception { | ||
53 | + productPopService.updateUserName(userId,userName); | ||
54 | + } | ||
55 | + | ||
56 | +} |
titan-cache/src/main/java/com/dili/titan/handler/UserShopHandler.java
0 → 100644
1 | +package com.dili.titan.handler; | ||
2 | + | ||
3 | +import com.dili.titan.domain.RedisKeyConstant; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.mq.sender.TopicProducer; | ||
7 | +import com.dili.titan.redis.JedisClient; | ||
8 | +import com.dili.titan.service.impl.ProductPopService; | ||
9 | +import org.codehaus.jackson.JsonNode; | ||
10 | +import org.codehaus.jackson.map.DeserializationConfig; | ||
11 | +import org.codehaus.jackson.map.ObjectMapper; | ||
12 | +import org.springframework.stereotype.Component; | ||
13 | + | ||
14 | +import javax.annotation.Resource; | ||
15 | + | ||
16 | +import java.util.List; | ||
17 | + | ||
18 | + | ||
19 | +/** | ||
20 | + * <B>Description</B> 求购信息 <br /> | ||
21 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
22 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
23 | + * <B>Company</B> 地利集团 | ||
24 | + * @createTime 2014年12月22日 下午6:24:00 | ||
25 | + * @author ywd | ||
26 | + */ | ||
27 | +@Component | ||
28 | +public class UserShopHandler implements BaseHandler { | ||
29 | + | ||
30 | + private ObjectMapper mapper = new ObjectMapper().configure( | ||
31 | + DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
32 | + | ||
33 | + @Resource(name = "productPopService") | ||
34 | + private ProductPopService productPopService; | ||
35 | + | ||
36 | + @Resource(name = "topicProducer") | ||
37 | + private TopicProducer topicProducer; | ||
38 | + | ||
39 | + @Resource(name = "jedisClient") | ||
40 | + private JedisClient client; | ||
41 | + | ||
42 | + @Override | ||
43 | + public void handle(String message) throws Exception { | ||
44 | + try { | ||
45 | + JsonNode node = mapper.readTree(message); | ||
46 | + boolean provinceChange = node.get("provinceChange").asBoolean(); | ||
47 | + long shopId = node.get("shopId").asLong(); | ||
48 | + long cityId = node.get("cityId").asLong(); | ||
49 | + update(provinceChange, shopId, cityId); | ||
50 | + } catch (Exception e) { | ||
51 | + LogHelper.error(LogTypeEnum.PRODUCT, e, e.getMessage()); | ||
52 | + throw e; | ||
53 | + } | ||
54 | + } | ||
55 | + | ||
56 | + public void update(boolean provinceChange,long shopId,long cityId) throws Exception{ | ||
57 | + int result = productPopService.update(shopId, cityId); | ||
58 | + if(result >0){ | ||
59 | + List<Long> listPro = productPopService.getProductPopList(shopId); | ||
60 | + for (int i = 0; i < listPro.size(); i++) { | ||
61 | + client.hdel(RedisKeyConstant.PRODUCT_POP, String.valueOf(listPro.get(i))); | ||
62 | + if(provinceChange){ | ||
63 | + topicProducer.sendMQProduct(listPro.get(i),1); | ||
64 | + } | ||
65 | + } | ||
66 | + } | ||
67 | + } | ||
68 | + | ||
69 | +} |
titan-cache/src/main/java/com/dili/titan/mq/listener/AttributeMessageHandler.java
0 → 100644
1 | +package com.dili.titan.mq.listener; | ||
2 | + | ||
3 | +import com.alibaba.rocketmq.common.message.MessageExt; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.handler.AttributeHandler; | ||
7 | +import com.diligrp.util.rocketMQUtil.DiliMQListener; | ||
8 | +import org.springframework.stereotype.Component; | ||
9 | + | ||
10 | +import javax.annotation.Resource; | ||
11 | +/** | ||
12 | + * <B>Description</B> 属性消息监听 <br /> | ||
13 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
14 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
15 | + * <B>Company</B> 地利集团 | ||
16 | + * @createTime 2014年7月24日 下午3:16:34 | ||
17 | + * @author yangjianjun | ||
18 | + */ | ||
19 | +@Component | ||
20 | +public class AttributeMessageHandler implements DiliMQListener { | ||
21 | + @Resource | ||
22 | + private AttributeHandler attributeHandler; | ||
23 | + private String topic = "Titan_Cache_Attribute"; | ||
24 | + private String tags="pnr"; | ||
25 | + | ||
26 | + @Override | ||
27 | + public String getTags() { | ||
28 | + return tags; | ||
29 | + } | ||
30 | + | ||
31 | + @Override | ||
32 | + public String getTopic() { | ||
33 | + return topic; | ||
34 | + } | ||
35 | + | ||
36 | + @Override | ||
37 | + public void operate(MessageExt messageExt) { | ||
38 | + if (messageExt == null) { | ||
39 | + LogHelper.warn(LogTypeEnum.ATTRIBUTE, | ||
40 | + "listener AttributeMessageHandler content is null"); | ||
41 | + return; | ||
42 | + } | ||
43 | + try { | ||
44 | + byte[] bytesMessage = messageExt.getBody(); | ||
45 | + String json = new String(bytesMessage,"UTF-8"); | ||
46 | + LogHelper.info(LogTypeEnum.ATTRIBUTE, "listener AttributeMessageHandler context={}", json); | ||
47 | + attributeHandler.handle(json); | ||
48 | + } catch (Exception e) { | ||
49 | + LogHelper.error(LogTypeEnum.ATTRIBUTE, e, "listener AttributeMessageHandler Exception:", | ||
50 | + e.getMessage()); | ||
51 | + throw new RuntimeException(e); | ||
52 | + } | ||
53 | + } | ||
54 | +} |
titan-cache/src/main/java/com/dili/titan/mq/listener/CategoryMessageHandler.java
0 → 100644
1 | +package com.dili.titan.mq.listener; | ||
2 | + | ||
3 | +import com.alibaba.rocketmq.common.message.MessageExt; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.handler.CategoryHandler; | ||
7 | +import com.diligrp.util.rocketMQUtil.DiliMQListener; | ||
8 | +import org.springframework.stereotype.Component; | ||
9 | + | ||
10 | +import javax.annotation.Resource; | ||
11 | + | ||
12 | +/** | ||
13 | + * <B>Description</B>类目消息监听 <br /> | ||
14 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
15 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
16 | + * <B>Company</B> 地利集团 | ||
17 | + * @createTime 2014年7月24日 下午3:15:25 | ||
18 | + * @author yangjianjun | ||
19 | + */ | ||
20 | +@Component | ||
21 | +public class CategoryMessageHandler implements DiliMQListener { | ||
22 | + @Resource | ||
23 | + private CategoryHandler categoryHandler; | ||
24 | + private String topic = "Titan_Cache_Category"; | ||
25 | + private String tags = "pnr"; | ||
26 | + | ||
27 | + @Override | ||
28 | + public String getTags() { | ||
29 | + return tags; | ||
30 | + } | ||
31 | + | ||
32 | + @Override | ||
33 | + public String getTopic() { | ||
34 | + return topic; | ||
35 | + } | ||
36 | + | ||
37 | + @Override | ||
38 | + public void operate(MessageExt message) { | ||
39 | + if (message == null) { | ||
40 | + LogHelper.warn(LogTypeEnum.CATEGORY, | ||
41 | + "listener CategoryMessageHandler content is null"); | ||
42 | + return; | ||
43 | + } | ||
44 | + try { | ||
45 | + byte[] bytesMessage = message.getBody(); | ||
46 | + String json = new String(bytesMessage,"UTF-8"); | ||
47 | + LogHelper.info(LogTypeEnum.CATEGORY, "listener CategoryMessageHandler context={}", json); | ||
48 | + categoryHandler.handle(json); | ||
49 | + } catch (Exception e) { | ||
50 | + LogHelper.error(LogTypeEnum.CATEGORY, e, "listener CategoryMessageHandler EXCEPTION!", | ||
51 | + e.getMessage()); | ||
52 | + throw new RuntimeException(e); | ||
53 | + } | ||
54 | + } | ||
55 | + | ||
56 | +} |
titan-cache/src/main/java/com/dili/titan/mq/listener/CloseShopMessageHandler.java
0 → 100644
1 | +package com.dili.titan.mq.listener; | ||
2 | + | ||
3 | +import com.alibaba.rocketmq.common.message.MessageExt; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.handler.CloseShopHandler; | ||
7 | +import com.dili.titan.handler.UserHandler; | ||
8 | +import com.diligrp.util.rocketMQUtil.DiliMQListener; | ||
9 | +import org.springframework.stereotype.Component; | ||
10 | + | ||
11 | +import javax.annotation.Resource; | ||
12 | + | ||
13 | + | ||
14 | +/** | ||
15 | + * <B>Description</B> TODO <br /> | ||
16 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
17 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
18 | + * <B>Company</B> 地利集团 | ||
19 | + * @createTime 2014年11月25日 上午11:48:14 | ||
20 | + * @author ywd | ||
21 | + */ | ||
22 | +@Component | ||
23 | +public class CloseShopMessageHandler implements DiliMQListener { | ||
24 | + @Resource | ||
25 | + private CloseShopHandler closeShopHandler; | ||
26 | + private String topic = "user_shop_state"; | ||
27 | + private String tags = "change"; | ||
28 | + | ||
29 | + @Override | ||
30 | + public String getTags() { | ||
31 | + return tags; | ||
32 | + } | ||
33 | + | ||
34 | + @Override | ||
35 | + public String getTopic() { | ||
36 | + return topic; | ||
37 | + } | ||
38 | + | ||
39 | + @Override | ||
40 | + public void operate(MessageExt message) { | ||
41 | + if (message == null) { | ||
42 | + LogHelper.warn(LogTypeEnum.PRODUCT, | ||
43 | + "listener UserMessageHandler content is null"); | ||
44 | + return; | ||
45 | + } | ||
46 | + try { | ||
47 | + byte[] bytesMessage = message.getBody(); | ||
48 | + String json = new String(bytesMessage,"UTF-8"); | ||
49 | + LogHelper.info(LogTypeEnum.PRODUCT, | ||
50 | + "listener UserMessageHandler context={}", json); | ||
51 | + closeShopHandler.handle(json); | ||
52 | + } catch (Exception e) { | ||
53 | + LogHelper.error(LogTypeEnum.PRODUCT, e, | ||
54 | + "listener UserMessageHandler EXCEPTION!", | ||
55 | + e.getMessage()); | ||
56 | + throw new RuntimeException(e); | ||
57 | + } | ||
58 | + } | ||
59 | +} |
titan-cache/src/main/java/com/dili/titan/mq/listener/MessageHandler.java
0 → 100644
1 | +package com.dili.titan.mq.listener; | ||
2 | + | ||
3 | +import com.alibaba.rocketmq.common.message.MessageExt; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.handler.ProductHandler; | ||
7 | +import com.diligrp.util.rocketMQUtil.DiliMQListener; | ||
8 | +import org.springframework.stereotype.Component; | ||
9 | + | ||
10 | +import javax.annotation.Resource; | ||
11 | + | ||
12 | +@Component | ||
13 | +public class MessageHandler implements DiliMQListener { | ||
14 | + | ||
15 | + @Resource | ||
16 | + private ProductHandler productHandler; | ||
17 | + private String topic = "Titan_Cache_Product"; | ||
18 | + private String tags = "pnr"; | ||
19 | + | ||
20 | + @Override | ||
21 | + public String getTags() { | ||
22 | + return tags; | ||
23 | + } | ||
24 | + | ||
25 | + @Override | ||
26 | + public String getTopic() { | ||
27 | + return topic; | ||
28 | + } | ||
29 | + | ||
30 | + @Override | ||
31 | + public void operate(MessageExt message) { | ||
32 | + if (message == null) { | ||
33 | + LogHelper.warn(LogTypeEnum.PRODUCT, | ||
34 | + "listener MessageHandler content is null"); | ||
35 | + return; | ||
36 | + } | ||
37 | + try { | ||
38 | + byte[] bytesMessage = message.getBody(); | ||
39 | + String json = new String(bytesMessage,"UTF-8"); | ||
40 | + LogHelper.info(LogTypeEnum.PRODUCT, | ||
41 | + "listener MessageHandler context={}", json); | ||
42 | + productHandler.handle(json); | ||
43 | + } catch (Exception e) { | ||
44 | + LogHelper.error(LogTypeEnum.PRODUCT, e, | ||
45 | + "listener MessageHandler EXCEPTION!", | ||
46 | + e.getMessage()); | ||
47 | + throw new RuntimeException(e); | ||
48 | + } | ||
49 | + } | ||
50 | +} |
titan-cache/src/main/java/com/dili/titan/mq/listener/PresaleMessageHandler.java
0 → 100644
1 | +package com.dili.titan.mq.listener; | ||
2 | + | ||
3 | +import com.alibaba.rocketmq.common.message.MessageExt; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.handler.PresaleHandler; | ||
7 | +import com.dili.titan.handler.SupplyHandler; | ||
8 | +import com.diligrp.util.rocketMQUtil.DiliMQListener; | ||
9 | +import org.springframework.stereotype.Component; | ||
10 | + | ||
11 | +import javax.annotation.Resource; | ||
12 | + | ||
13 | +/** | ||
14 | + * <B>Description</B> 供应信息监听器 <br /> | ||
15 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
16 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
17 | + * <B>Company</B> 地利集团 | ||
18 | + * @createTime 2014年11月25日 上午11:48:14 | ||
19 | + * @author ywd | ||
20 | + */ | ||
21 | +@Component | ||
22 | +public class PresaleMessageHandler implements DiliMQListener { | ||
23 | + @Resource | ||
24 | + private PresaleHandler presaleHandler; | ||
25 | + private String topic = "Titan_Cache_Presale"; | ||
26 | + private String tags = "pnr"; | ||
27 | + | ||
28 | + @Override | ||
29 | + public String getTags() { | ||
30 | + return tags; | ||
31 | + } | ||
32 | + | ||
33 | + @Override | ||
34 | + public String getTopic() { | ||
35 | + return topic; | ||
36 | + } | ||
37 | + | ||
38 | + @Override | ||
39 | + public void operate(MessageExt message) { | ||
40 | + if (message == null) { | ||
41 | + LogHelper.warn(LogTypeEnum.SUPPLY, | ||
42 | + "listener PresaleMessageHandler content is null"); | ||
43 | + return; | ||
44 | + } | ||
45 | + try { | ||
46 | + byte[] bytesMessage = message.getBody(); | ||
47 | + String json = new String(bytesMessage,"UTF-8"); | ||
48 | + LogHelper.info(LogTypeEnum.SUPPLY, | ||
49 | + "listener PresaleMessageHandler context={}", json); | ||
50 | + presaleHandler.handle(json); | ||
51 | + } catch (Exception e) { | ||
52 | + LogHelper.error(LogTypeEnum.SUPPLY, e, | ||
53 | + "listener PresaleMessageHandler EXCEPTION!", | ||
54 | + e.getMessage()); | ||
55 | + throw new RuntimeException(e); | ||
56 | + } | ||
57 | + } | ||
58 | +} |
titan-cache/src/main/java/com/dili/titan/mq/listener/ProductSearchMessageHandler.java
0 → 100644
1 | +package com.dili.titan.mq.listener; | ||
2 | + | ||
3 | +import com.alibaba.rocketmq.common.message.MessageExt; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.handler.ProductHandler; | ||
7 | +import com.dili.titan.handler.ProductSearchHandler; | ||
8 | +import com.diligrp.util.rocketMQUtil.DiliMQListener; | ||
9 | +import org.springframework.stereotype.Component; | ||
10 | + | ||
11 | +import javax.annotation.Resource; | ||
12 | + | ||
13 | +@Component | ||
14 | +public class ProductSearchMessageHandler implements DiliMQListener { | ||
15 | + | ||
16 | + @Resource | ||
17 | + private ProductSearchHandler productSearchHandler; | ||
18 | + private String topic = "Titan_Cache_Product_Search_Cate"; | ||
19 | + private String tags = "pnr"; | ||
20 | + | ||
21 | + @Override | ||
22 | + public String getTags() { | ||
23 | + return tags; | ||
24 | + } | ||
25 | + | ||
26 | + @Override | ||
27 | + public String getTopic() { | ||
28 | + return topic; | ||
29 | + } | ||
30 | + | ||
31 | + @Override | ||
32 | + public void operate(MessageExt message) { | ||
33 | + if (message == null) { | ||
34 | + LogHelper.warn(LogTypeEnum.PRODUCT, | ||
35 | + "listener ProductSearchMessageHandler content is null"); | ||
36 | + return; | ||
37 | + } | ||
38 | + try { | ||
39 | + byte[] bytesMessage = message.getBody(); | ||
40 | + String json = new String(bytesMessage,"UTF-8"); | ||
41 | + LogHelper.info(LogTypeEnum.PRODUCT, | ||
42 | + "listener ProductSearchMessageHandler context={}", json); | ||
43 | + productSearchHandler.handle(json); | ||
44 | + } catch (Exception e) { | ||
45 | + LogHelper.error(LogTypeEnum.PRODUCT, e, | ||
46 | + "listener ProductSearchMessageHandler EXCEPTION!", | ||
47 | + e.getMessage()); | ||
48 | + throw new RuntimeException(e); | ||
49 | + } | ||
50 | + } | ||
51 | +} |
titan-cache/src/main/java/com/dili/titan/mq/listener/PurchaseMessageHandler.java
0 → 100644
1 | +package com.dili.titan.mq.listener; | ||
2 | + | ||
3 | +import com.alibaba.rocketmq.common.message.MessageExt; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.handler.PurchaseHandler; | ||
7 | +import com.diligrp.util.rocketMQUtil.DiliMQListener; | ||
8 | +import org.springframework.stereotype.Component; | ||
9 | + | ||
10 | +import javax.annotation.Resource; | ||
11 | + | ||
12 | +/** | ||
13 | + * <B>Description</B> 求购信息 监听器<br /> | ||
14 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
15 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
16 | + * <B>Company</B> 地利集团 | ||
17 | + * @createTime 2014年11月25日 上午11:48:14 | ||
18 | + * @author ywd | ||
19 | + */ | ||
20 | +@Component | ||
21 | +public class PurchaseMessageHandler implements DiliMQListener { | ||
22 | + @Resource | ||
23 | + private PurchaseHandler purchaseHandler; | ||
24 | + private String topic = "Titan_Cache_Purchase"; | ||
25 | + private String tags = "pnr"; | ||
26 | + | ||
27 | + @Override | ||
28 | + public String getTags() { | ||
29 | + return tags; | ||
30 | + } | ||
31 | + | ||
32 | + @Override | ||
33 | + public String getTopic() { | ||
34 | + return topic; | ||
35 | + } | ||
36 | + | ||
37 | + @Override | ||
38 | + public void operate(MessageExt message) { | ||
39 | + if (message == null) { | ||
40 | + LogHelper.warn(LogTypeEnum.PURCHASE, | ||
41 | + "listener PurchaseMessageHandler content is null"); | ||
42 | + return; | ||
43 | + } | ||
44 | + try { | ||
45 | + byte[] bytesMessage = message.getBody(); | ||
46 | + String json = new String(bytesMessage,"UTF-8"); | ||
47 | + LogHelper.info(LogTypeEnum.PURCHASE, | ||
48 | + "listener PurchaseMessageHandler context={}", json); | ||
49 | + purchaseHandler.handle(json); | ||
50 | + } catch (Exception e) { | ||
51 | + LogHelper.error(LogTypeEnum.PURCHASE, e, | ||
52 | + "listener PurchaseMessageHandler EXCEPTION!", | ||
53 | + e.getMessage()); | ||
54 | + throw new RuntimeException(e); | ||
55 | + } | ||
56 | + } | ||
57 | +} |
titan-cache/src/main/java/com/dili/titan/mq/listener/ShopMarketMessageHandler.java
0 → 100644
1 | +package com.dili.titan.mq.listener; | ||
2 | + | ||
3 | +import com.alibaba.rocketmq.common.message.MessageExt; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.handler.ShopMarketHandler; | ||
7 | +import com.dili.titan.handler.UserHandler; | ||
8 | +import com.diligrp.util.rocketMQUtil.DiliMQListener; | ||
9 | +import org.springframework.stereotype.Component; | ||
10 | + | ||
11 | +import javax.annotation.Resource; | ||
12 | + | ||
13 | + | ||
14 | +/** | ||
15 | + * <B>Description</B> TODO <br /> | ||
16 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
17 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
18 | + * <B>Company</B> 地利集团 | ||
19 | + * @createTime 2014年11月25日 上午11:48:14 | ||
20 | + * @author ywd | ||
21 | + */ | ||
22 | +@Component | ||
23 | +public class ShopMarketMessageHandler implements DiliMQListener { | ||
24 | + @Resource | ||
25 | + private ShopMarketHandler shopMarketHandler; | ||
26 | + private String topic = "user_shop_market"; | ||
27 | + private String tags = "change"; | ||
28 | + | ||
29 | + @Override | ||
30 | + public String getTags() { | ||
31 | + return tags; | ||
32 | + } | ||
33 | + | ||
34 | + @Override | ||
35 | + public String getTopic() { | ||
36 | + return topic; | ||
37 | + } | ||
38 | + | ||
39 | + @Override | ||
40 | + public void operate(MessageExt message) { | ||
41 | + if (message == null) { | ||
42 | + LogHelper.warn(LogTypeEnum.PRODUCT, | ||
43 | + "listener ShopMarketMessageHandler content is null"); | ||
44 | + return; | ||
45 | + } | ||
46 | + try { | ||
47 | + byte[] bytesMessage = message.getBody(); | ||
48 | + String json = new String(bytesMessage,"UTF-8"); | ||
49 | + LogHelper.info(LogTypeEnum.PRODUCT, | ||
50 | + "listener ShopMarketMessageHandler context={}", json); | ||
51 | + shopMarketHandler.handle(json); | ||
52 | + } catch (Exception e) { | ||
53 | + LogHelper.error(LogTypeEnum.PRODUCT, e, | ||
54 | + "listener ShopMarketMessageHandler EXCEPTION!", | ||
55 | + e.getMessage()); | ||
56 | + throw new RuntimeException(e); | ||
57 | + } | ||
58 | + } | ||
59 | +} |
titan-cache/src/main/java/com/dili/titan/mq/listener/SupplyMessageHandler.java
0 → 100644
1 | +package com.dili.titan.mq.listener; | ||
2 | + | ||
3 | +import com.alibaba.rocketmq.common.message.MessageExt; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.handler.SupplyHandler; | ||
7 | +import com.diligrp.util.rocketMQUtil.DiliMQListener; | ||
8 | +import org.springframework.stereotype.Component; | ||
9 | + | ||
10 | +import javax.annotation.Resource; | ||
11 | + | ||
12 | +/** | ||
13 | + * <B>Description</B> 供应信息监听器 <br /> | ||
14 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
15 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
16 | + * <B>Company</B> 地利集团 | ||
17 | + * @createTime 2014年11月25日 上午11:48:14 | ||
18 | + * @author ywd | ||
19 | + */ | ||
20 | +@Component | ||
21 | +public class SupplyMessageHandler implements DiliMQListener { | ||
22 | + @Resource | ||
23 | + private SupplyHandler supplyHandler; | ||
24 | + private String topic = "Titan_Cache_Supply"; | ||
25 | + private String tags = "pnr"; | ||
26 | + | ||
27 | + @Override | ||
28 | + public String getTags() { | ||
29 | + return tags; | ||
30 | + } | ||
31 | + | ||
32 | + @Override | ||
33 | + public String getTopic() { | ||
34 | + return topic; | ||
35 | + } | ||
36 | + | ||
37 | + @Override | ||
38 | + public void operate(MessageExt message) { | ||
39 | + if (message == null) { | ||
40 | + LogHelper.warn(LogTypeEnum.SUPPLY, | ||
41 | + "listener SupplyMessageHandler content is null"); | ||
42 | + return; | ||
43 | + } | ||
44 | + try { | ||
45 | + byte[] bytesMessage = message.getBody(); | ||
46 | + String json = new String(bytesMessage,"UTF-8"); | ||
47 | + LogHelper.info(LogTypeEnum.SUPPLY, | ||
48 | + "listener SupplyMessageHandler context={}", json); | ||
49 | + supplyHandler.handle(json); | ||
50 | + } catch (Exception e) { | ||
51 | + LogHelper.error(LogTypeEnum.SUPPLY, e, | ||
52 | + "listener SupplyMessageHandler EXCEPTION!", | ||
53 | + e.getMessage()); | ||
54 | + throw new RuntimeException(e); | ||
55 | + } | ||
56 | + } | ||
57 | +} |
titan-cache/src/main/java/com/dili/titan/mq/listener/UserMessageHandler.java
0 → 100644
1 | +package com.dili.titan.mq.listener; | ||
2 | + | ||
3 | +import com.alibaba.rocketmq.common.message.MessageExt; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.handler.UserHandler; | ||
7 | +import com.dili.titan.handler.UserShopHandler; | ||
8 | +import com.diligrp.util.rocketMQUtil.DiliMQListener; | ||
9 | +import org.springframework.stereotype.Component; | ||
10 | + | ||
11 | +import javax.annotation.Resource; | ||
12 | + | ||
13 | + | ||
14 | +/** | ||
15 | + * <B>Description</B> TODO <br /> | ||
16 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
17 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
18 | + * <B>Company</B> 地利集团 | ||
19 | + * @createTime 2014年11月25日 上午11:48:14 | ||
20 | + * @author ywd | ||
21 | + */ | ||
22 | +@Component | ||
23 | +public class UserMessageHandler implements DiliMQListener { | ||
24 | + @Resource | ||
25 | + private UserHandler userHandler; | ||
26 | + private String topic = "account_info_change"; | ||
27 | + private String tags = "PNR"; | ||
28 | + | ||
29 | + @Override | ||
30 | + public String getTags() { | ||
31 | + return tags; | ||
32 | + } | ||
33 | + | ||
34 | + @Override | ||
35 | + public String getTopic() { | ||
36 | + return topic; | ||
37 | + } | ||
38 | + | ||
39 | + @Override | ||
40 | + public void operate(MessageExt message) { | ||
41 | + if (message == null) { | ||
42 | + LogHelper.warn(LogTypeEnum.PRODUCT, | ||
43 | + "listener UserMessageHandler content is null"); | ||
44 | + return; | ||
45 | + } | ||
46 | + try { | ||
47 | + byte[] bytesMessage = message.getBody(); | ||
48 | + String json = new String(bytesMessage,"UTF-8"); | ||
49 | + LogHelper.info(LogTypeEnum.PRODUCT, | ||
50 | + "listener UserMessageHandler context={}", json); | ||
51 | + userHandler.handle(json); | ||
52 | + } catch (Exception e) { | ||
53 | + LogHelper.error(LogTypeEnum.PRODUCT, e, | ||
54 | + "listener UserMessageHandler EXCEPTION!", | ||
55 | + e.getMessage()); | ||
56 | + throw new RuntimeException(e); | ||
57 | + } | ||
58 | + } | ||
59 | +} |
titan-cache/src/main/java/com/dili/titan/mq/listener/UserShopMessageHandler.java
0 → 100644
1 | +package com.dili.titan.mq.listener; | ||
2 | + | ||
3 | +import com.alibaba.rocketmq.common.message.MessageExt; | ||
4 | +import com.dili.titan.domain.log.LogHelper; | ||
5 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
6 | +import com.dili.titan.handler.ShopAddressHandler; | ||
7 | +import com.dili.titan.handler.ShopNameHandler; | ||
8 | +import com.dili.titan.handler.UserShopHandler; | ||
9 | +import com.diligrp.util.rocketMQUtil.DiliMQListener; | ||
10 | +import org.apache.commons.lang.StringUtils; | ||
11 | +import org.springframework.stereotype.Component; | ||
12 | + | ||
13 | +import javax.annotation.Resource; | ||
14 | +import javax.security.auth.callback.CallbackHandler; | ||
15 | + | ||
16 | + | ||
17 | +/** | ||
18 | + * <B>Description</B> TODO <br /> | ||
19 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
20 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
21 | + * <B>Company</B> 地利集团 | ||
22 | + * @createTime 2014年11月25日 上午11:48:14 | ||
23 | + * @author ywd | ||
24 | + */ | ||
25 | +@Component | ||
26 | +public class UserShopMessageHandler implements DiliMQListener { | ||
27 | + @Resource | ||
28 | + private UserShopHandler userShopHandler; | ||
29 | + @Resource | ||
30 | + private ShopAddressHandler shopAddressHandler; | ||
31 | + @Resource | ||
32 | + private ShopNameHandler shopNameHandler; | ||
33 | + private String topic = "user_shop"; | ||
34 | + private String tags = "shop_edit||shop_address_edit||shop_name_edit"; | ||
35 | + | ||
36 | + | ||
37 | + @Override | ||
38 | + public String getTags() { | ||
39 | + return tags; | ||
40 | + } | ||
41 | + | ||
42 | + @Override | ||
43 | + public String getTopic() { | ||
44 | + return topic; | ||
45 | + } | ||
46 | + | ||
47 | + @Override | ||
48 | + public void operate(MessageExt message) { | ||
49 | + if (message == null) { | ||
50 | + LogHelper.warn(LogTypeEnum.PRODUCT, | ||
51 | + "listener UserShopMessageHandler content is null"); | ||
52 | + return; | ||
53 | + } | ||
54 | + try { | ||
55 | + String tags = message.getTags(); | ||
56 | + if(StringUtils.isEmpty(tags)){ | ||
57 | + LogHelper.info(LogTypeEnum.PRODUCT, | ||
58 | + "listener UserShopMessageHandler tags is NULL"); | ||
59 | + return; | ||
60 | + } | ||
61 | + byte[] bytesMessage = message.getBody(); | ||
62 | + message.getTags(); | ||
63 | + String json = new String(bytesMessage,"UTF-8"); | ||
64 | + LogHelper.info(LogTypeEnum.PRODUCT, | ||
65 | + "listener UserShopMessageHandler context={}", json); | ||
66 | + if("shop_edit".equals(tags)) { | ||
67 | + userShopHandler.handle(json); | ||
68 | + } | ||
69 | + if("shop_address_edit".equals(tags)){ | ||
70 | + shopAddressHandler.handle(json); | ||
71 | + } | ||
72 | + if("shop_name_edit".equals(tags)){ | ||
73 | + shopNameHandler.handle(json); | ||
74 | + } | ||
75 | + } catch (Exception e) { | ||
76 | + LogHelper.error(LogTypeEnum.PRODUCT, e, | ||
77 | + "listener UserShopMessageHandler EXCEPTION!", | ||
78 | + e.getMessage()); | ||
79 | + throw new RuntimeException(e); | ||
80 | + } | ||
81 | + } | ||
82 | +} |
titan-cache/src/main/java/com/dili/titan/mq/sender/TopicProducer.java
0 → 100644
1 | +package com.dili.titan.mq.sender; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONArray; | ||
4 | +import com.alibaba.rocketmq.common.message.Message; | ||
5 | +import com.dili.titan.domain.log.LogHelper; | ||
6 | +import com.dili.titan.domain.log.LogTypeEnum; | ||
7 | +import com.diligrp.util.exception.DiliUtilException; | ||
8 | +import com.diligrp.util.rocketMQUtil.DiliMQProducer; | ||
9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
10 | +import org.springframework.stereotype.Component; | ||
11 | + | ||
12 | +import java.nio.charset.Charset; | ||
13 | +import java.util.HashMap; | ||
14 | +import java.util.Map; | ||
15 | + | ||
16 | +@Component("topicProducer") | ||
17 | +public class TopicProducer { | ||
18 | + | ||
19 | + @Autowired | ||
20 | + private DiliMQProducer diliMQProducer; | ||
21 | + | ||
22 | + /** | ||
23 | + * 发送消息 | ||
24 | + * | ||
25 | + * @param destination | ||
26 | + * @param message | ||
27 | + */ | ||
28 | + public void send(final String destination, final String message) { | ||
29 | + Message mesg = new Message(destination, "pnr", message.getBytes(Charset.forName("UTF-8"))); | ||
30 | + try { | ||
31 | + Thread.sleep(500); | ||
32 | + diliMQProducer.sendMsg(mesg); | ||
33 | + } catch (Exception e) { | ||
34 | + LogHelper.error(LogTypeEnum.PRODUCT_MQ, e,"发送MQ异常!KEY={},内容={}", destination, | ||
35 | + message); | ||
36 | + } | ||
37 | + LogHelper.info(LogTypeEnum.PRODUCT_MQ, "发送MQ!KEY={},内容={}", destination, | ||
38 | + message); | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * this method is 发送属性mq消息 | ||
43 | + * | ||
44 | + * @param attrId | ||
45 | + * @param oper | ||
46 | + * @createTime 2014年7月10日 下午8:12:21 | ||
47 | + * @author yangjianjun | ||
48 | + */ | ||
49 | + public void sendMQAttribute(Object attrId, int oper) { | ||
50 | + Map<String, Object> mapMQ = new HashMap<String, Object>(); | ||
51 | + mapMQ.put("attrId", attrId); | ||
52 | + mapMQ.put("oper", oper); | ||
53 | + this.send("Titan_Attribute", JSONArray.toJSON(mapMQ).toString()); | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * this method is 发送类目mq消息 | ||
58 | + * | ||
59 | + * @param oper | ||
60 | + * @createTime 2014年7月10日 下午8:12:29 | ||
61 | + * @author yangjianjun | ||
62 | + */ | ||
63 | + public void sendMQCategory(Object cateId, int oper) { | ||
64 | + Map<String, Object> mapMQ = new HashMap<String, Object>(); | ||
65 | + mapMQ.put("cateId", cateId); | ||
66 | + mapMQ.put("oper", oper); | ||
67 | + this.send("Titan_Category", JSONArray.toJSON(mapMQ).toString()); | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * this method is 发送产品mq消息 | ||
72 | + * | ||
73 | + * @param pid | ||
74 | + * @param oper | ||
75 | + * @createTime 2014年7月10日 下午8:13:11 | ||
76 | + * @author yangjianjun | ||
77 | + */ | ||
78 | + public void sendMQProduct(Object pid, int oper) { | ||
79 | + if (pid.toString().startsWith("1") || pid.toString().startsWith("8")) { | ||
80 | + Map<String, Object> mapMQ = new HashMap<String, Object>(); | ||
81 | + mapMQ.put("pid", pid); | ||
82 | + mapMQ.put("oper", oper); | ||
83 | + this.send("Titan_Product", JSONArray.toJSON(mapMQ).toString()); | ||
84 | + } | ||
85 | + } | ||
86 | + | ||
87 | + /** | ||
88 | + * this method is 供应信息MQ | ||
89 | + * @param pid | ||
90 | + * @param oper | ||
91 | + * @createTime 2014年12月25日 上午10:28:47 | ||
92 | + * @author yangwd | ||
93 | + */ | ||
94 | + public void sendMQSupply(Object pid, int oper) { | ||
95 | + Map<String, Object> mapMQ = new HashMap<String, Object>(); | ||
96 | + mapMQ.put("pid", pid); | ||
97 | + mapMQ.put("oper", oper); | ||
98 | + this.send("Titan_Supply", JSONArray.toJSON(mapMQ).toString()); | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * this method is 求购信息MQ | ||
103 | + * @param pid | ||
104 | + * @param oper | ||
105 | + * @createTime 2014年12月25日 上午10:29:13 | ||
106 | + * @author yangwd | ||
107 | + */ | ||
108 | + public void sendMQPurchase(Object pid, int oper) { | ||
109 | + Map<String, Object> mapMQ = new HashMap<String, Object>(); | ||
110 | + mapMQ.put("pid", pid); | ||
111 | + mapMQ.put("oper", oper); | ||
112 | + this.send("Titan_Purchase", JSONArray.toJSON(mapMQ).toString()); | ||
113 | + } | ||
114 | + | ||
115 | + /** | ||
116 | + * this method is 预售信息MQ | ||
117 | + * @param pid | ||
118 | + * @param oper | ||
119 | + * @createTime 2014年12月25日 上午10:29:13 | ||
120 | + * @author yangwd | ||
121 | + */ | ||
122 | + public void sendMQPresale(Object pid, int oper) { | ||
123 | + Map<String, Object> mapMQ = new HashMap<String, Object>(); | ||
124 | + mapMQ.put("pid", pid); | ||
125 | + mapMQ.put("oper", oper); | ||
126 | + this.send("Titan_Presale", JSONArray.toJSON(mapMQ).toString()); | ||
127 | + } | ||
128 | + | ||
129 | + /** | ||
130 | + * this method is 商品分类置顶排序信息MQ | ||
131 | + * @param cid | ||
132 | + * @param oper | ||
133 | + * @createTime 2014年12月25日 上午10:29:13 | ||
134 | + * @author yangwd | ||
135 | + */ | ||
136 | + public void sendMQProductSearch(Object cid, int type,int oper) { | ||
137 | + Map<String, Object> mapMQ = new HashMap<String, Object>(); | ||
138 | + mapMQ.put("cid", cid); | ||
139 | + mapMQ.put("type", type); | ||
140 | + mapMQ.put("oper", oper); | ||
141 | + this.send("Titan_Product_Search_Cate", JSONArray.toJSON(mapMQ).toString()); | ||
142 | + } | ||
143 | +} |
titan-cache/src/main/java/com/dili/titan/redis/JedisClient.java
0 → 100644
1 | +package com.dili.titan.redis; | ||
2 | + | ||
3 | +import org.springframework.data.redis.core.BoundListOperations; | ||
4 | +import org.springframework.data.redis.core.BoundSetOperations; | ||
5 | +import org.springframework.data.redis.core.HashOperations; | ||
6 | +import org.springframework.data.redis.core.RedisTemplate; | ||
7 | +import org.springframework.stereotype.Component; | ||
8 | + | ||
9 | +import javax.annotation.Resource; | ||
10 | +import java.util.Collection; | ||
11 | +import java.util.List; | ||
12 | +import java.util.Set; | ||
13 | +import java.util.concurrent.TimeUnit; | ||
14 | + | ||
15 | +@Component("jedisClient") | ||
16 | +public class JedisClient { | ||
17 | + | ||
18 | + @Resource(name = "jedisTemplate") | ||
19 | + private RedisTemplate<String, String> template; | ||
20 | + private static final String titan_Index = "titan_"; | ||
21 | + public static final long expireTime = 3; //小时 | ||
22 | + | ||
23 | + /** | ||
24 | + * Redis Key exists or not | ||
25 | + * @param redisKey | ||
26 | + * @return | ||
27 | + * @createTime 2014年5月29日 下午2:56:52 | ||
28 | + * @author celine | ||
29 | + */ | ||
30 | + public boolean exists(String redisKey) { | ||
31 | + redisKey = titan_Index + redisKey; | ||
32 | + return template.hasKey(redisKey); | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * | ||
37 | + * | ||
38 | + * @param key | ||
39 | + * @param hashKey | ||
40 | + * @return | ||
41 | + */ | ||
42 | + public boolean hasKey(String key, String hashKey) { | ||
43 | + key = titan_Index + key; | ||
44 | + HashOperations<String, String, String> hashOps = template.opsForHash(); | ||
45 | + return hashOps.hasKey(key, hashKey); | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * map put | ||
50 | + * | ||
51 | + * @param key | ||
52 | + * @param hashKey | ||
53 | + * @param value | ||
54 | + */ | ||
55 | +// public void hput(String key, String hashKey, String value) { | ||
56 | +// HashOperations<String, String, String> hashOps = template.opsForHash(); | ||
57 | +// hashOps.put(key, hashKey, value); | ||
58 | +// } | ||
59 | + | ||
60 | + public void hput(String key, String hashKey, String value, long expireTime) { | ||
61 | + key = titan_Index + key; | ||
62 | + template.expire(key, expireTime, TimeUnit.HOURS); | ||
63 | + HashOperations<String, String, String> hashOps = template.opsForHash(); | ||
64 | + hashOps.put(key, hashKey, value); | ||
65 | + } | ||
66 | + /** | ||
67 | + * map get | ||
68 | + * | ||
69 | + * @param key the map name(new HashMap("name")) | ||
70 | + * @param hashKey the field key | ||
71 | + * @return | ||
72 | + */ | ||
73 | + public String hget(String key, String hashKey) { | ||
74 | + key = titan_Index + key; | ||
75 | + HashOperations<String, String, String> hashOps = template.opsForHash(); | ||
76 | + return hashOps.get(key, hashKey); | ||
77 | + } | ||
78 | + | ||
79 | + /** | ||
80 | + * map del | ||
81 | + * | ||
82 | + * @param key | ||
83 | + * @param hashKey | ||
84 | + */ | ||
85 | + public void hdel(String key, String hashKey) { | ||
86 | + key = titan_Index + key; | ||
87 | + HashOperations<String, String, String> hashOps = template.opsForHash(); | ||
88 | + hashOps.delete(key, hashKey); | ||
89 | + } | ||
90 | + | ||
91 | + /** | ||
92 | + * 根据多个key查询values | ||
93 | + * | ||
94 | + * @param key | ||
95 | + * @param hashKeys | ||
96 | + */ | ||
97 | + public List<String> hmultiget(String key, Collection<String> hashKeys) { | ||
98 | + key = titan_Index + key; | ||
99 | + HashOperations<String, String, String> hashOps = template.opsForHash(); | ||
100 | + return hashOps.multiGet(key, hashKeys); | ||
101 | + } | ||
102 | + | ||
103 | + /** | ||
104 | + * map size | ||
105 | + * | ||
106 | + * @param key | ||
107 | + * @return | ||
108 | + */ | ||
109 | + public long hlen(String key) { | ||
110 | + key = titan_Index + key; | ||
111 | + HashOperations<String, String, String> hashOps = template.opsForHash(); | ||
112 | + return hashOps.size(key); | ||
113 | + } | ||
114 | + | ||
115 | + /** | ||
116 | + * all keys in the map | ||
117 | + * | ||
118 | + * @param key | ||
119 | + * @return | ||
120 | + */ | ||
121 | + public Set<String> hkeys(String key) { | ||
122 | + key = titan_Index + key; | ||
123 | + HashOperations<String, String, String> hashOps = template.opsForHash(); | ||
124 | + return hashOps.keys(key); | ||
125 | + } | ||
126 | + | ||
127 | +// /** | ||
128 | +// * set add | ||
129 | +// * | ||
130 | +// * @param key | ||
131 | +// * @param values | ||
132 | +// */ | ||
133 | +// public void sadd(String key, String... values) { | ||
134 | +// BoundSetOperations<String, String> setOps = template.boundSetOps(key); | ||
135 | +// setOps.add(values); | ||
136 | +// } | ||
137 | + public void sadd(String key,long expireTime, String... values) { | ||
138 | + key = titan_Index + key; | ||
139 | + template.expire(key, expireTime, TimeUnit.HOURS); | ||
140 | + BoundSetOperations<String, String> setOps = template.boundSetOps(key); | ||
141 | + setOps.add(values); | ||
142 | + } | ||
143 | + | ||
144 | + /** | ||
145 | + * set all values | ||
146 | + * | ||
147 | + * @param key | ||
148 | + * @return | ||
149 | + */ | ||
150 | + public Set<String> smembers(String key) { | ||
151 | + key = titan_Index + key; | ||
152 | + BoundSetOperations<String, String> setOps = template.boundSetOps(key); | ||
153 | + return setOps.members(); | ||
154 | + } | ||
155 | + | ||
156 | + /** | ||
157 | + * remove object from set | ||
158 | + * | ||
159 | + * | ||
160 | + * @param key | ||
161 | + * @param values | ||
162 | + * @return | ||
163 | + */ | ||
164 | + public Long sremove(String key, Object... values) { | ||
165 | + key = titan_Index + key; | ||
166 | + BoundSetOperations<String, String> setOps = template.boundSetOps(key); | ||
167 | + return setOps.remove(values); | ||
168 | + }; | ||
169 | + | ||
170 | + /** | ||
171 | + * set size | ||
172 | + * | ||
173 | + * @param key | ||
174 | + * @param values | ||
175 | + * @return | ||
176 | + */ | ||
177 | + public Long slen(String key, Object... values) { | ||
178 | + key = titan_Index + key; | ||
179 | + BoundSetOperations<String, String> setOps = template.boundSetOps(key); | ||
180 | + return setOps.size(); | ||
181 | + }; | ||
182 | + | ||
183 | + /** | ||
184 | + * 删除redis中的key及所有数据(谨慎使用) | ||
185 | + * | ||
186 | + * @param key | ||
187 | + */ | ||
188 | + public void delKey(String key) { | ||
189 | + key = titan_Index + key; | ||
190 | + template.delete(key); | ||
191 | + } | ||
192 | + /** | ||
193 | + * 移除并返回列表 key 的尾元素。 | ||
194 | + * | ||
195 | + * @param key | ||
196 | + * @return | ||
197 | + */ | ||
198 | + public String lrpop(String key) { | ||
199 | + BoundListOperations<String, String> listOps = template.boundListOps(key); | ||
200 | + return listOps.rightPop(); | ||
201 | + }; | ||
202 | + /** | ||
203 | + * list left push | ||
204 | + * | ||
205 | + * @param key | ||
206 | + * @param value | ||
207 | + * @return | ||
208 | + */ | ||
209 | + public Long llpush(String key, String value) { | ||
210 | + key = titan_Index + key; | ||
211 | + BoundListOperations<String, String> listOps = template.boundListOps(key); | ||
212 | + return listOps.leftPush(value); | ||
213 | + }; | ||
214 | + | ||
215 | + /** | ||
216 | + * list left push all | ||
217 | + * | ||
218 | + * @param key | ||
219 | + * @param values | ||
220 | + * @return | ||
221 | + */ | ||
222 | + public Long llpush(String key, String... values) { | ||
223 | + key = titan_Index + key; | ||
224 | + BoundListOperations<String, String> listOps = template.boundListOps(key); | ||
225 | + return listOps.leftPushAll(values); | ||
226 | + }; | ||
227 | + | ||
228 | + public List<String> lrange(String key,long start, long end) { | ||
229 | + key = titan_Index + key; | ||
230 | + BoundListOperations<String, String> listOps = template.boundListOps(key); | ||
231 | + return listOps.range(start, end); | ||
232 | + }; | ||
233 | + | ||
234 | + /** | ||
235 | + * 返回列表 key 的长度。 | ||
236 | + * | ||
237 | + * @param key | ||
238 | + * @return | ||
239 | + */ | ||
240 | + public Long lsize(String key) { | ||
241 | + key = titan_Index + key; | ||
242 | + BoundListOperations<String, String> listOps = template.boundListOps(key); | ||
243 | + return listOps.size(); | ||
244 | + }; | ||
245 | +} |
titan-cache/src/main/java/com/dili/titan/rpc/ConfigRPC.java
0 → 100644
1 | +package com.dili.titan.rpc; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSON; | ||
4 | +import com.dili.titan.domain.RedisKeyConstant; | ||
5 | +import com.dili.titan.redis.JedisClient; | ||
6 | +import com.diligrp.website.web.interfaces.WebsiteClient; | ||
7 | +import com.diligrp.website.web.interfaces.domain.output.BaseResp; | ||
8 | +import com.diligrp.website.web.interfaces.domain.output.DataDictionaryValueResp; | ||
9 | +import com.diligrp.website.web.interfaces.domain.output.PickUpPointResp; | ||
10 | +import org.apache.commons.lang.StringUtils; | ||
11 | +import org.springframework.stereotype.Component; | ||
12 | + | ||
13 | +import javax.annotation.Resource; | ||
14 | + | ||
15 | +/** | ||
16 | + * <p>Title: 〈标题〉</p> | ||
17 | + * <p>Description: 〈描述〉</p> | ||
18 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
19 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
20 | + * <B>Company</B> 地利集团 | ||
21 | + * <p>CreateTime:2014/6/10</p> | ||
22 | + * | ||
23 | + * @author chenzhiwei | ||
24 | + */ | ||
25 | +@Component | ||
26 | +public class ConfigRPC { | ||
27 | + @Resource | ||
28 | + private WebsiteClient websiteClient; | ||
29 | + @Resource(name = "jedisClient") | ||
30 | + private JedisClient client; | ||
31 | + | ||
32 | + /** | ||
33 | + * 根据 市场ID获取市场 | ||
34 | + * @param id | ||
35 | + * @return | ||
36 | + */ | ||
37 | + public PickUpPointResp getPickUpInfoById(Long id){ | ||
38 | + PickUpPointResp resp = null; | ||
39 | + String rs = client.hget(RedisKeyConstant.PICKUPINFO,id.toString()); | ||
40 | + if(StringUtils.isEmpty(rs)){ | ||
41 | + resp = websiteClient.getPickUpApiService().getPickupById(id); | ||
42 | + if(resp!=null){ | ||
43 | + client.hput(RedisKeyConstant.PICKUPINFO,id.toString(), JSON.toJSONString(resp),1); | ||
44 | + } | ||
45 | + }else{ | ||
46 | + resp = JSON.parseObject(rs, PickUpPointResp.class); | ||
47 | + } | ||
48 | + return resp; | ||
49 | + } | ||
50 | + | ||
51 | +} |
titan-cache/src/main/java/com/dili/titan/service/impl/AttributeService.java
0 → 100644
1 | +package com.dili.titan.service.impl; | ||
2 | + | ||
3 | +import com.dili.titan.dao.impl.AttributeDao; | ||
4 | +import com.dili.titan.domain.Attribute; | ||
5 | +import com.dili.titan.domain.AttributeValue; | ||
6 | +import org.springframework.stereotype.Service; | ||
7 | + | ||
8 | +import javax.annotation.Resource; | ||
9 | +import java.util.List; | ||
10 | + | ||
11 | +@Service("attributeService") | ||
12 | +public class AttributeService { | ||
13 | + @Resource(name = "attributeDao") | ||
14 | + private AttributeDao attributeDao; | ||
15 | + | ||
16 | + /** | ||
17 | + * 根据属性ID获取属性信息 | ||
18 | + * | ||
19 | + * @param id | ||
20 | + * @return | ||
21 | + */ | ||
22 | + public Attribute getAttributeById(Long id) { | ||
23 | + return attributeDao.selectEntry(id); | ||
24 | + } | ||
25 | + | ||
26 | + /** | ||
27 | + * 查询属性的所有属性值 | ||
28 | + * | ||
29 | + * @return | ||
30 | + */ | ||
31 | + public List<Attribute> getAllAttribute() { | ||
32 | + return attributeDao.getAllAttribute(); | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * 查询属性的所有属性值 | ||
37 | + * | ||
38 | + * @param attrId | ||
39 | + * @return | ||
40 | + */ | ||
41 | + public List<AttributeValue> getAttributeValues(long attrId) { | ||
42 | + return attributeDao.getAttributeValues(attrId); | ||
43 | + } | ||
44 | + | ||
45 | +} |
titan-cache/src/main/java/com/dili/titan/service/impl/CategoryService.java
0 → 100644
1 | +package com.dili.titan.service.impl; | ||
2 | + | ||
3 | +import com.dili.titan.dao.impl.CategoryDao; | ||
4 | +import com.dili.titan.domain.Category; | ||
5 | +import com.dili.titan.domain.CategoryAttr; | ||
6 | +import org.springframework.stereotype.Service; | ||
7 | + | ||
8 | +import javax.annotation.Resource; | ||
9 | +import java.util.ArrayList; | ||
10 | +import java.util.Collections; | ||
11 | +import java.util.List; | ||
12 | + | ||
13 | +@Service("categoryService") | ||
14 | +public class CategoryService { | ||
15 | + @Resource(name = "categoryDao") | ||
16 | + private CategoryDao categoryDao; | ||
17 | + | ||
18 | + public List<Category> getAllCategory() { | ||
19 | + return categoryDao.selectAllCategory(); | ||
20 | + } | ||
21 | + | ||
22 | + public Category getCategoryById(int id) { | ||
23 | + return categoryDao.selectEntry(id); | ||
24 | + } | ||
25 | + | ||
26 | + public List<CategoryAttr> getCategoryAttrById(int cateId) { | ||
27 | + return categoryDao.getCategoryAttrById(cateId); | ||
28 | + } | ||
29 | + | ||
30 | + /** | ||
31 | + * this method is 可搜索属性 | ||
32 | + * @param cateId | ||
33 | + * @return | ||
34 | + * @createTime 2014年9月30日 上午11:15:52 | ||
35 | + * @author yangjianjun | ||
36 | + */ | ||
37 | + public List<CategoryAttr> getCategorySeacherAttrById(int cateId) { | ||
38 | + return categoryDao.getCategorySeacherAttrById(cateId); | ||
39 | + } | ||
40 | + | ||
41 | + | ||
42 | + public List<Integer> getChildByCid(int cateId) { | ||
43 | + return categoryDao.getChildByCid(cateId); | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * 根据分类ID获取当前分类的父分类 | ||
48 | + * @param cateId | ||
49 | + * @return | ||
50 | + */ | ||
51 | + public List<Integer> getAllParentCate(Integer cateId){ | ||
52 | + List<Integer> list = getAllParent(cateId,null); | ||
53 | + list.remove(cateId); | ||
54 | + Collections.sort(list); | ||
55 | + return list; | ||
56 | + } | ||
57 | + | ||
58 | + private List<Integer> getAllParent(int cateId,List<Integer> list){ | ||
59 | + if(list==null){ | ||
60 | + list = new ArrayList<Integer>(); | ||
61 | + } | ||
62 | + Category category = this.getCategoryById(cateId); | ||
63 | + if(category==null){ | ||
64 | + return list; | ||
65 | + } | ||
66 | + if (category.getParent()>0) { | ||
67 | + list.add(category.getId()); | ||
68 | + getAllParent(category.getParent().intValue(), list); | ||
69 | + }else{ | ||
70 | + list.add(category.getId()); | ||
71 | + } | ||
72 | + return list; | ||
73 | + } | ||
74 | +} |
titan-cache/src/main/java/com/dili/titan/service/impl/PresaleService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.service.impl; | ||
6 | + | ||
7 | +import com.alibaba.fastjson.JSON; | ||
8 | +import com.dili.titan.dao.gq.PresaleDao; | ||
9 | +import com.dili.titan.dao.gq.SupplyDao; | ||
10 | +import com.dili.titan.domain.Category; | ||
11 | +import com.dili.titan.domain.gq.Presale; | ||
12 | +import com.dili.titan.domain.gq.Supply; | ||
13 | +import com.dili.titan.redis.JedisClient; | ||
14 | +import org.apache.commons.collections.CollectionUtils; | ||
15 | +import org.apache.log4j.Logger; | ||
16 | +import org.springframework.stereotype.Service; | ||
17 | +import org.springframework.util.StringUtils; | ||
18 | + | ||
19 | +import javax.annotation.Resource; | ||
20 | +import java.util.ArrayList; | ||
21 | +import java.util.List; | ||
22 | + | ||
23 | +/** | ||
24 | + * <B>Description</B> 供应信息 <br /> | ||
25 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
26 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
27 | + * <B>Company</B> 地利集团 | ||
28 | + * | ||
29 | + * @createTime 2014年12月17日 下午4:31:29 | ||
30 | + * @author ywd | ||
31 | + */ | ||
32 | +@Service | ||
33 | +public class PresaleService { | ||
34 | + | ||
35 | + @Resource | ||
36 | + private PresaleDao presaleDao; | ||
37 | + /** | ||
38 | + * this method is 查看第三方供应信息 | ||
39 | + * @param pid | ||
40 | + * @return | ||
41 | + * @createTime 2014年12月17日 下午4:38:31 | ||
42 | + * @author ywd | ||
43 | + */ | ||
44 | + public Presale findByKey(Long pid) { | ||
45 | + return presaleDao.selectEntry(pid); | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * 更新用户手机号 | ||
50 | + * @param userId | ||
51 | + * @param phone | ||
52 | + */ | ||
53 | + public void updatePhone(Long userId,String phone){ | ||
54 | + presaleDao.updatePhone(userId, phone); | ||
55 | + } | ||
56 | + | ||
57 | + /** | ||
58 | + * 获取用户发布的所有信息 | ||
59 | + * @param userId | ||
60 | + * @return | ||
61 | + */ | ||
62 | + public List<Presale> findByUserId(Long userId){ | ||
63 | + Presale query = new Presale(); | ||
64 | + query.setUserId(userId); | ||
65 | + return presaleDao.selectEntryList(query); | ||
66 | + } | ||
67 | +} |
titan-cache/src/main/java/com/dili/titan/service/impl/ProductPopService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.service.impl; | ||
6 | + | ||
7 | +import com.dili.titan.dao.BaseDao; | ||
8 | +import com.dili.titan.dao.impl.ProductPopDao; | ||
9 | +import com.dili.titan.domain.ProductPop; | ||
10 | +import org.springframework.stereotype.Service; | ||
11 | + | ||
12 | +import javax.annotation.Resource; | ||
13 | +import java.util.List; | ||
14 | + | ||
15 | + | ||
16 | +/** | ||
17 | + * <B>Description</B> TODO <br /> | ||
18 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
19 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
20 | + * <B>Company</B> 地利集团 | ||
21 | + * @createTime 2014年11月25日 上午11:47:59 | ||
22 | + * @author ywd | ||
23 | + */ | ||
24 | +@Service("productPopService") | ||
25 | +public class ProductPopService{ | ||
26 | + | ||
27 | + @Resource | ||
28 | + private ProductPopDao productPopDao; | ||
29 | + | ||
30 | + public BaseDao<ProductPop,Long> getDao() { | ||
31 | + return productPopDao; | ||
32 | + } | ||
33 | + public int update(long shopId,long cityId){ | ||
34 | + return productPopDao.update(shopId, cityId); | ||
35 | + } | ||
36 | + | ||
37 | + public int updateCityId(long shopId,int cityId){ | ||
38 | + return productPopDao.updateCityId(shopId, cityId); | ||
39 | + } | ||
40 | + | ||
41 | + public List<Long> getProductPopList(long shopId){ | ||
42 | + return productPopDao.getProductPopList(shopId); | ||
43 | + } | ||
44 | + | ||
45 | + public int updateShopName(long shopId,String shopName){ | ||
46 | + return productPopDao.updateShopName(shopId, shopName); | ||
47 | + } | ||
48 | + | ||
49 | + public int updateUserName(long userId,String userName){ | ||
50 | + return productPopDao.updateUserName(userId, userName); | ||
51 | + } | ||
52 | + | ||
53 | + public int updateMarket(long shopId,long marketId,String marketName){ | ||
54 | + return productPopDao.updateMarket(shopId, marketId,marketName); | ||
55 | + } | ||
56 | + | ||
57 | + public List<Long> selectDropsProduct(Long shopId){ | ||
58 | + return productPopDao.selectDropsProduct(shopId); | ||
59 | + } | ||
60 | + | ||
61 | + public int dropsProduct(Long shopId){ | ||
62 | + return productPopDao.dropsProduct(shopId); | ||
63 | + } | ||
64 | + | ||
65 | + public List<Long> selectDelProduct(Long shopId){ | ||
66 | + return productPopDao.selectDelProduct(shopId); | ||
67 | + } | ||
68 | + | ||
69 | + public int delProduct(Long shopId){ | ||
70 | + return productPopDao.delProduct(shopId); | ||
71 | + } | ||
72 | + | ||
73 | +} | ||
0 | \ No newline at end of file | 74 | \ No newline at end of file |
titan-cache/src/main/java/com/dili/titan/service/impl/PurchaseService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.service.impl; | ||
6 | + | ||
7 | +import com.dili.titan.dao.gq.PurchaseDao; | ||
8 | +import com.dili.titan.domain.gq.Presale; | ||
9 | +import com.dili.titan.domain.gq.Purchase; | ||
10 | +import org.apache.log4j.Logger; | ||
11 | +import org.springframework.stereotype.Service; | ||
12 | + | ||
13 | +import javax.annotation.Resource; | ||
14 | +import java.util.List; | ||
15 | + | ||
16 | + | ||
17 | +/** | ||
18 | + * <B>Description</B> 求购信息 <br /> | ||
19 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
20 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
21 | + * <B>Company</B> 地利集团 | ||
22 | + * @createTime 2014年12月18日 下午5:00:00 | ||
23 | + * @author ywd | ||
24 | + */ | ||
25 | +@Service("purchaseService") | ||
26 | +public class PurchaseService{ | ||
27 | + | ||
28 | + @Resource | ||
29 | + private PurchaseDao purchaseDao; | ||
30 | + /** | ||
31 | + * this method is 查看第三方供应信息 | ||
32 | + * @param pid | ||
33 | + * @return | ||
34 | + * @createTime 2014年12月17日 下午4:38:31 | ||
35 | + * @author ywd | ||
36 | + */ | ||
37 | + public Purchase findByKey(Long pid) { | ||
38 | + return purchaseDao.selectEntry(pid); | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * 更新用户手机号 | ||
43 | + * @param userId | ||
44 | + * @param phone | ||
45 | + */ | ||
46 | + public void updatePhone(Long userId,String phone){ | ||
47 | + purchaseDao.updatePhone(userId,phone); | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * 获取用户发布的所有信息 | ||
52 | + * @param userId | ||
53 | + * @return | ||
54 | + */ | ||
55 | + public List<Purchase> findByUserId(Long userId){ | ||
56 | + Purchase query = new Purchase(); | ||
57 | + query.setUserId(userId); | ||
58 | + return purchaseDao.selectEntryList(query); | ||
59 | + } | ||
60 | +} |
titan-cache/src/main/java/com/dili/titan/service/impl/SupplyService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.service.impl; | ||
6 | + | ||
7 | +import com.dili.titan.dao.gq.SupplyDao; | ||
8 | +import com.dili.titan.domain.gq.Supply; | ||
9 | +import org.springframework.stereotype.Service; | ||
10 | + | ||
11 | +import javax.annotation.Resource; | ||
12 | +import java.util.List; | ||
13 | + | ||
14 | +/** | ||
15 | + * <B>Description</B> 供应信息 <br /> | ||
16 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
17 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
18 | + * <B>Company</B> 地利集团 | ||
19 | + * | ||
20 | + * @createTime 2014年12月17日 下午4:31:29 | ||
21 | + * @author ywd | ||
22 | + */ | ||
23 | +@Service("supplyService") | ||
24 | +public class SupplyService { | ||
25 | + @Resource | ||
26 | + private SupplyDao supplyDao; | ||
27 | + public Supply findByKey(Long pid) { | ||
28 | + return supplyDao.selectEntry(pid); | ||
29 | + } | ||
30 | + /** | ||
31 | + * 更新用户手机号 | ||
32 | + * @param userId | ||
33 | + * @param phone | ||
34 | + */ | ||
35 | + public void updatePhone(Long userId,String phone){ | ||
36 | + supplyDao.updatePhone(userId,phone); | ||
37 | + } | ||
38 | + /** | ||
39 | + * 获取用户发布的所有信息 | ||
40 | + * @param userId | ||
41 | + * @return | ||
42 | + */ | ||
43 | + public List<Supply> findByUserId(Long userId){ | ||
44 | + Supply query = new Supply(); | ||
45 | + query.setUserId(userId); | ||
46 | + return supplyDao.selectEntryList(query); | ||
47 | + } | ||
48 | + | ||
49 | +} |
titan-cache/src/main/resources/important.properties
0 → 100644
1 | +#数据库连接池信息 | ||
2 | +jdbc.driverClass=${titan.jdbc.driver} | ||
3 | +jdbc.maxActive=10 | ||
4 | +jdbc.initialSize=1 | ||
5 | +jdbc.maxWait=60000 | ||
6 | +jdbc.minIdle=1 | ||
7 | +jdbc.timeBetweenEvictionRunsMillis=60000 | ||
8 | +jdbc.minEvictableIdleTimeMillis=300000 | ||
9 | +jdbc.poolPreparedStatements=true | ||
10 | +jdbc.maxOpenPreparedStatements=20 | ||
11 | +#jdbc.maxConnectionsPerPartition=3 | ||
12 | +#jdbc.minConnectionsPerPartition=1 | ||
13 | +#jdbc.idleConnectionTestPeriod=10 | ||
14 | +#jdbc.idleMaxAge=240 | ||
15 | +#jdbc.partitionCount=2 | ||
16 | +#jdbc.acquireIncrement=5 | ||
17 | +#jdbc.statementsCacheSize=20 | ||
18 | +#jdbc.releaseHelperThreads=3 | ||
19 | + | ||
20 | +#数据库信息 | ||
21 | +jdbc.jdbcUrl=${titan.jdbc.url} | ||
22 | +jdbc.username=${titan.jdbc.username} | ||
23 | +jdbc.password=${titan.jdbc.password} | ||
24 | + | ||
25 | +mq.attribute.topic=Titan.Cache.Attribute | ||
26 | +mq.category.topic=Titan.Cache.Category | ||
27 | +mq.product.topic=Titan.Cache.Product | ||
28 | +mq.supply.topic=Titan.Cache.Supply | ||
29 | +mq.purchase.topic=Titan.Cache.Purchase | ||
30 | + | ||
31 | +mq.pnr.tag=pnr | ||
32 | +#MQ\u540d\u79f0\u7a7a\u95f4\u5730\u5740 | ||
33 | +mq.namesrvAddr=${conf.mq.namesrvAddr} | ||
34 | +#MQ\u751f\u4ea7\u8005\u7ec4 | ||
35 | +mq.producerGroup=${conf.mq.producerGroup} | ||
0 | \ No newline at end of file | 36 | \ No newline at end of file |
titan-cache/src/main/resources/log4j.xml
0 → 100644
1 | +<?xml version='1.0' encoding='UTF-8' ?> | ||
2 | +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> | ||
3 | +<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> | ||
4 | + <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> | ||
5 | + <layout class="org.apache.log4j.PatternLayout"> | ||
6 | + <param name="ConversionPattern" | ||
7 | + value="[%5p] [%d{yyyy-MM-dd HH:mm:ss SSS}] [%t] (%F:%L) %m%n"/> | ||
8 | + </layout> | ||
9 | + </appender> | ||
10 | + | ||
11 | + <!--默认日志 --> | ||
12 | + <appender name="FILE_ALL" class="org.apache.log4j.DailyRollingFileAppender"> | ||
13 | + <param name="Encoding" value="UTF-8"/> | ||
14 | + <param name="File" | ||
15 | + value="${dili_titan.log.path}/titan.cache.1n4j.com/all.log"/> | ||
16 | + <layout class="org.apache.log4j.PatternLayout"> | ||
17 | + <param name="ConversionPattern" | ||
18 | + value="[%5p] [%d{yyyy-MM-dd HH:mm:ss SSS}] [%t] (%F:%L) %m%n"/> | ||
19 | + </layout> | ||
20 | + </appender> | ||
21 | + | ||
22 | + <category name="DEFALUT" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | ||
23 | + <priority value="${dili_titan.log.level}"/> | ||
24 | + <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | ||
25 | + <appender-ref ref="${dili_titan.log.root.appender}"/> | ||
26 | + </category> | ||
27 | + | ||
28 | + <!--商品日志 --> | ||
29 | + <appender name="PRODUCT" class="org.apache.log4j.DailyRollingFileAppender"> | ||
30 | + <param name="Encoding" value="UTF-8"/> | ||
31 | + <param name="File" | ||
32 | + value="${dili_titan.log.path}/titan.cache.1n4j.com/product.log"/> | ||
33 | + <layout class="org.apache.log4j.PatternLayout"> | ||
34 | + <param name="ConversionPattern" | ||
35 | + value="[%p] [%d] [%r] [%c] - %m %n"/> | ||
36 | + </layout> | ||
37 | + </appender> | ||
38 | + | ||
39 | + <category name="TITAN_PRODUCT" | ||
40 | + additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | ||
41 | + <priority value="${dili_titan.log.level}"/> | ||
42 | + <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | ||
43 | + <appender-ref ref="${dili_titan.log.root.appender}"/> | ||
44 | + <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | ||
45 | + <appender-ref ref="PRODUCT"/> | ||
46 | + </category> | ||
47 | + | ||
48 | + <!--类目日志 --> | ||
49 | + <appender name="CATEGORY" class="org.apache.log4j.DailyRollingFileAppender"> | ||
50 | + <param name="Encoding" value="UTF-8"/> | ||
51 | + <param name="File" | ||
52 | + value="${dili_titan.log.path}/titan.cache.1n4j.com/category.log"/> | ||
53 | + <layout class="org.apache.log4j.PatternLayout"> | ||
54 | + <param name="ConversionPattern" | ||
55 | + value="[%p] [%d] [%r] [%c] - %m %n"/> | ||
56 | + </layout> | ||
57 | + </appender> | ||
58 | + | ||
59 | + <category name="TITAN_CATEGORY" | ||
60 | + additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | ||
61 | + <priority value="${dili_titan.log.level}"/> | ||
62 | + <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | ||
63 | + <appender-ref ref="${dili_titan.log.root.appender}"/> | ||
64 | + <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | ||
65 | + <appender-ref ref="CATEGORY"/> | ||
66 | + </category> | ||
67 | + | ||
68 | + <!--属性日志 --> | ||
69 | + <appender name="ATTRIBUTE" class="org.apache.log4j.DailyRollingFileAppender"> | ||
70 | + <param name="Encoding" value="UTF-8"/> | ||
71 | + <param name="File" | ||
72 | + value="${dili_titan.log.path}/titan.cache.1n4j.com/attribute.log"/> | ||
73 | + <layout class="org.apache.log4j.PatternLayout"> | ||
74 | + <param name="ConversionPattern" | ||
75 | + value="[%p] [%d] [%r] [%c] - %m %n"/> | ||
76 | + </layout> | ||
77 | + </appender> | ||
78 | + | ||
79 | + <category name="TITAN_ATTRIBUTE" | ||
80 | + additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | ||
81 | + <priority value="${dili_titan.log.level}"/> | ||
82 | + <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | ||
83 | + <appender-ref ref="${dili_titan.log.root.appender}"/> | ||
84 | + <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | ||
85 | + <appender-ref ref="CATEGORY"/> | ||
86 | + </category> | ||
87 | + | ||
88 | + <!--线下商品日志 --> | ||
89 | + <appender name="PRODUCT_OFFLINE" class="org.apache.log4j.DailyRollingFileAppender"> | ||
90 | + <param name="Encoding" value="UTF-8"/> | ||
91 | + <param name="File" | ||
92 | + value="${dili_titan.log.path}/titan.cache.1n4j.com/productOffline.log"/> | ||
93 | + <layout class="org.apache.log4j.PatternLayout"> | ||
94 | + <param name="ConversionPattern" | ||
95 | + value="[%p] [%d] [%r] [%c] - %m %n"/> | ||
96 | + </layout> | ||
97 | + </appender> | ||
98 | + | ||
99 | + <category name="TITAN_PRODUCT_OFFLINE" | ||
100 | + additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | ||
101 | + <priority value="${dili_titan.log.level}"/> | ||
102 | + <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | ||
103 | + <appender-ref ref="${dili_titan.log.root.appender}"/> | ||
104 | + <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | ||
105 | + <appender-ref ref="PRODUCT_OFFLINE"/> | ||
106 | + </category> | ||
107 | + | ||
108 | + <!--供应信息日志 --> | ||
109 | + <appender name="SUPPLY" | ||
110 | + class="org.apache.log4j.DailyRollingFileAppender"> | ||
111 | + <param name="Encoding" value="UTF-8"/> | ||
112 | + <param name="File" | ||
113 | + value="${dili_titan.log.path}/titan.cache.1n4j.com/supply.log"/> | ||
114 | + <layout class="org.apache.log4j.PatternLayout"> | ||
115 | + <param name="ConversionPattern" | ||
116 | + value="[%p] [%d] [%r] [%c] - %m %n"/> | ||
117 | + </layout> | ||
118 | + </appender> | ||
119 | + | ||
120 | + <category name="TITAN_SUPPLY" | ||
121 | + additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | ||
122 | + <priority value="${dili_titan.log.level}"/> | ||
123 | + <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | ||
124 | + <appender-ref ref="${dili_titan.log.root.appender}"/> | ||
125 | + <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | ||
126 | + <appender-ref ref="SUPPLY"/> | ||
127 | + </category> | ||
128 | + | ||
129 | + <!--预售信息日志 --> | ||
130 | + <appender name="PRESALE" | ||
131 | + class="org.apache.log4j.DailyRollingFileAppender"> | ||
132 | + <param name="Encoding" value="UTF-8"/> | ||
133 | + <param name="File" | ||
134 | + value="${dili_titan.log.path}/titan.cache.1n4j.com/presale.log"/> | ||
135 | + <layout class="org.apache.log4j.PatternLayout"> | ||
136 | + <param name="ConversionPattern" | ||
137 | + value="[%p] [%d] [%r] [%c] - %m %n"/> | ||
138 | + </layout> | ||
139 | + </appender> | ||
140 | + | ||
141 | + <category name="TITAN_PRESALE" | ||
142 | + additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | ||
143 | + <priority value="${dili_titan.log.level}"/> | ||
144 | + <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | ||
145 | + <appender-ref ref="${dili_titan.log.root.appender}"/> | ||
146 | + <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | ||
147 | + <appender-ref ref="PRESALE"/> | ||
148 | + </category> | ||
149 | + | ||
150 | + <!--求购信息日志 --> | ||
151 | + <appender name="PURCHASE" | ||
152 | + class="org.apache.log4j.DailyRollingFileAppender"> | ||
153 | + <param name="Encoding" value="UTF-8"/> | ||
154 | + <param name="File" | ||
155 | + value="${dili_titan.log.path}/titan.cache.1n4j.com/purchase.log"/> | ||
156 | + <layout class="org.apache.log4j.PatternLayout"> | ||
157 | + <param name="ConversionPattern" | ||
158 | + value="[%p] [%d] [%r] [%c] - %m %n"/> | ||
159 | + </layout> | ||
160 | + </appender> | ||
161 | + | ||
162 | + <category name="TITAN_PURCHASE" | ||
163 | + additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | ||
164 | + <priority value="${dili_titan.log.level}"/> | ||
165 | + <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | ||
166 | + <appender-ref ref="${dili_titan.log.root.appender}"/> | ||
167 | + <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | ||
168 | + <appender-ref ref="SUPPLY"/> | ||
169 | + </category> | ||
170 | + | ||
171 | + <!--MQ信息 --> | ||
172 | + <appender name="PRODUCT_MQ_FILE" | ||
173 | + class="org.apache.log4j.DailyRollingFileAppender"> | ||
174 | + <param name="Encoding" value="UTF-8"/> | ||
175 | + <param name="File" | ||
176 | + value="${dili_titan.log.path}/titan.cache.1n4j.com/mq.log"/> | ||
177 | + <layout class="org.apache.log4j.PatternLayout"> | ||
178 | + <param name="ConversionPattern" | ||
179 | + value="[%p] [%d] [%r] [%c] - %m %n"/> | ||
180 | + </layout> | ||
181 | + </appender> | ||
182 | + | ||
183 | + <category name="PRODUCT_MQ" | ||
184 | + additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | ||
185 | + <priority value="${dili_titan.log.level}"/> | ||
186 | + <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | ||
187 | + <appender-ref ref="${dili_titan.log.root.appender}"/> | ||
188 | + <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | ||
189 | + <appender-ref ref="PRODUCT_MQ_FILE"/> | ||
190 | + </category> | ||
191 | + | ||
192 | + <!--运行时异常 --> | ||
193 | + <appender name="EXCEPTION" | ||
194 | + class="org.apache.log4j.DailyRollingFileAppender"> | ||
195 | + <param name="Encoding" value="UTF-8"/> | ||
196 | + <param name="File" | ||
197 | + value="${dili_titan.log.path}/titan.cache.1n4j.com/exception.log"/> | ||
198 | + <layout class="org.apache.log4j.PatternLayout"> | ||
199 | + <param name="ConversionPattern" | ||
200 | + value="[%p] [%d] [%r] [%c] - %m %n"/> | ||
201 | + </layout> | ||
202 | + </appender> | ||
203 | + | ||
204 | + <category name="EXCEPTION" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | ||
205 | + <priority value="${dili_titan.log.level}"/> | ||
206 | + <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | ||
207 | + <appender-ref ref="${dili_titan.log.root.appender}"/> | ||
208 | + <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | ||
209 | + <appender-ref ref="EXCEPTION"/> | ||
210 | + </category> | ||
211 | + | ||
212 | + <category name="com.dili" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | ||
213 | + <priority value="${dili_titan.log.level}"/> | ||
214 | + <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | ||
215 | + <appender-ref ref="${dili_titan.log.root.appender}"/> | ||
216 | + <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | ||
217 | + </category> | ||
218 | + | ||
219 | + | ||
220 | + <root> | ||
221 | + <priority value="${dili_titan.log.level}"/> | ||
222 | + <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | ||
223 | + <appender-ref ref="${dili_titan.log.root.appender}"/> | ||
224 | + <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | ||
225 | + <!--<appender-ref ref="FILE"/>--> | ||
226 | + </root> | ||
227 | +</log4j:configuration> | ||
0 | \ No newline at end of file | 228 | \ No newline at end of file |
titan-cache/src/main/resources/spring-config-dao.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xmlns:context="http://www.springframework.org/schema/context" | ||
4 | + xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
5 | + http://www.springframework.org/schema/beans/spring-beans.xsd | ||
6 | + http://www.springframework.org/schema/context | ||
7 | + http://www.springframework.org/schema/context/spring-context.xsd" | ||
8 | + default-autowire="byName"> | ||
9 | + | ||
10 | + <context:component-scan base-package="com.dili.titan.dao" /> | ||
11 | + | ||
12 | + <!--<bean id="abstractDataSource" abstract="true" class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close">--> | ||
13 | + <!--<property name="driverClass" value="${jdbc.driverClass}" />--> | ||
14 | + <!--<property name="idleConnectionTestPeriodInMinutes" value="${jdbc.idleConnectionTestPeriod}" />--> | ||
15 | + <!--<property name="idleMaxAgeInMinutes" value="${jdbc.idleMaxAge}" />--> | ||
16 | + <!--<property name="maxConnectionsPerPartition" value="${jdbc.maxConnectionsPerPartition}" />--> | ||
17 | + <!--<property name="minConnectionsPerPartition" value="${jdbc.minConnectionsPerPartition}" />--> | ||
18 | + <!--<property name="partitionCount" value="${jdbc.partitionCount}" />--> | ||
19 | + <!--<property name="acquireIncrement" value="${jdbc.acquireIncrement}" />--> | ||
20 | + <!--<property name="statementsCacheSize" value="${jdbc.statementsCacheSize}" />--> | ||
21 | + <!--<property name="releaseHelperThreads" value="${jdbc.releaseHelperThreads}" />--> | ||
22 | + <!--</bean>--> | ||
23 | + <!--<bean id="masterDataSource" parent="abstractDataSource">--> | ||
24 | + <!--<property name="jdbcUrl" value="${jdbc.jdbcUrl}" />--> | ||
25 | + <!--<property name="username" value="${jdbc.username}" />--> | ||
26 | + <!--<property name="password" value="${jdbc.password}" />--> | ||
27 | + <!--</bean>--> | ||
28 | + | ||
29 | + <bean id="masterDataSource" class="com.alibaba.druid.pool.DruidDataSource" | ||
30 | + init-method="init" destroy-method="close"> | ||
31 | + <property name="driverClassName" value="${jdbc.driverClass}"/> | ||
32 | + <property name="url" value="${jdbc.jdbcUrl}"/> | ||
33 | + <property name="username" value="${jdbc.username}"/> | ||
34 | + <property name="password" value="${jdbc.password}"/> | ||
35 | + <property name="filters" value="stat"/> | ||
36 | + <property name="maxActive" value="${jdbc.maxActive}"/> | ||
37 | + <property name="initialSize" value="${jdbc.initialSize}"/> | ||
38 | + <property name="maxWait" value="${jdbc.maxWait}"/> | ||
39 | + <property name="minIdle" value="${jdbc.minIdle}"/> | ||
40 | + <property name="timeBetweenEvictionRunsMillis" | ||
41 | + value="${jdbc.timeBetweenEvictionRunsMillis}"/> | ||
42 | + <property name="minEvictableIdleTimeMillis" | ||
43 | + value="${jdbc.minEvictableIdleTimeMillis}"/> | ||
44 | + <property name="validationQuery" value="SELECT now()"/> | ||
45 | + <property name="testWhileIdle" value="true"/> | ||
46 | + <property name="testOnBorrow" value="false"/> | ||
47 | + <property name="testOnReturn" value="false"/> | ||
48 | + <property name="poolPreparedStatements" | ||
49 | + value="${jdbc.poolPreparedStatements}"/> | ||
50 | + <property name="maxOpenPreparedStatements" | ||
51 | + value="${jdbc.maxOpenPreparedStatements}"/> | ||
52 | + </bean> | ||
53 | + | ||
54 | + <bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> | ||
55 | + <property name="dataSource" ref="masterDataSource" /> | ||
56 | + <property name="configLocation" value="classpath:sqlmap/sqlmap-config.xml" /> | ||
57 | + </bean> | ||
58 | + | ||
59 | + <bean id="sqlTemplate" class="org.mybatis.spring.SqlSessionTemplate"> | ||
60 | + <constructor-arg index="0" ref="sessionFactory" /> | ||
61 | + </bean> | ||
62 | + | ||
63 | + <!-- 配置事务管理器 --> | ||
64 | + <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> | ||
65 | + <property name="dataSource" ref="masterDataSource" /> | ||
66 | + </bean> | ||
67 | +</beans> | ||
0 | \ No newline at end of file | 68 | \ No newline at end of file |
titan-cache/src/main/resources/spring-config-handler.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" | ||
4 | + xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
5 | + http://www.springframework.org/schema/beans/spring-beans.xsd | ||
6 | + http://www.springframework.org/schema/context | ||
7 | + http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" | ||
8 | + default-autowire="byName"> | ||
9 | + | ||
10 | + <context:component-scan base-package="com.dili.titan.handler" /> | ||
11 | + <!-- 启用对事务的注解支持 --> | ||
12 | + <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/> | ||
13 | +</beans> | ||
0 | \ No newline at end of file | 14 | \ No newline at end of file |
titan-cache/src/main/resources/spring-config-mq.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xmlns:context="http://www.springframework.org/schema/context" | ||
4 | + xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
5 | + http://www.springframework.org/schema/beans/spring-beans-3.2.xsd | ||
6 | + http://www.springframework.org/schema/context | ||
7 | + http://www.springframework.org/schema/context/spring-context-3.2.xsd"> | ||
8 | + | ||
9 | + <context:component-scan base-package="com.dili.titan.mq" /> | ||
10 | + <!-- 发送消息 --> | ||
11 | + <bean id="diliMQProducer" | ||
12 | + class="com.diligrp.util.rocketMQUtil.impl.DiliMQProducerImpl"/> | ||
13 | + <!-- 接收 --> | ||
14 | + <bean id="diliMQLauncher" | ||
15 | + class="com.diligrp.util.rocketMQUtil.DiliMQLauncher"/> | ||
16 | +</beans> | ||
0 | \ No newline at end of file | 17 | \ No newline at end of file |
titan-cache/src/main/resources/spring-config-redis.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xmlns:context="http://www.springframework.org/schema/context" | ||
4 | + xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
5 | + http://www.springframework.org/schema/beans/spring-beans.xsd | ||
6 | + http://www.springframework.org/schema/context | ||
7 | + http://www.springframework.org/schema/context/spring-context.xsd" | ||
8 | + default-autowire="byName"> | ||
9 | + | ||
10 | + <context:component-scan base-package="com.dili.titan.redis" /> | ||
11 | + | ||
12 | + <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig"> | ||
13 | + <property name="maxIdle" value="6"></property> | ||
14 | + <property name="minEvictableIdleTimeMillis" value="300000"></property> | ||
15 | + <property name="numTestsPerEvictionRun" value="3"></property> | ||
16 | + <property name="timeBetweenEvictionRunsMillis" value="60000"></property> | ||
17 | + </bean> | ||
18 | + | ||
19 | + <bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" | ||
20 | + destroy-method="destroy"> | ||
21 | + <property name="poolConfig" ref="jedisPoolConfig"></property> | ||
22 | + <property name="hostName" value="${cache.redis.url}"></property> | ||
23 | + <property name="port" value="${cache.redis.port}"></property> | ||
24 | + <property name="timeout" value="15000"></property> | ||
25 | + <property name="usePool" value="true"></property> | ||
26 | + </bean> | ||
27 | + | ||
28 | + <bean id="jedisTemplate" class="org.springframework.data.redis.core.RedisTemplate"> | ||
29 | + <property name="connectionFactory" ref="jedisConnectionFactory"></property> | ||
30 | + <property name="keySerializer"> | ||
31 | + <bean class="org.springframework.data.redis.serializer.StringRedisSerializer" /> | ||
32 | + </property> | ||
33 | + <property name="valueSerializer"> | ||
34 | + <bean class="org.springframework.data.redis.serializer.StringRedisSerializer" /> | ||
35 | + </property> | ||
36 | + </bean> | ||
37 | +</beans> | ||
0 | \ No newline at end of file | 38 | \ No newline at end of file |
titan-cache/src/main/resources/spring-config-rpc.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
2 | +<beans xmlns="http://www.springframework.org/schema/beans" | ||
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | + xmlns:context="http://www.springframework.org/schema/context" | ||
5 | + xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
6 | + http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd" | ||
7 | + default-autowire="byName"> | ||
8 | + <context:component-scan base-package="com.dili.titan.rpc" /> | ||
9 | + <bean id="websiteClient" class="com.diligrp.website.web.interfaces.WebsiteClient"> | ||
10 | + <constructor-arg name="token" value="aaa"></constructor-arg> | ||
11 | + <constructor-arg name="baseUrl" value="http://${dili_titan.website.url}/"></constructor-arg> | ||
12 | + </bean> | ||
13 | +</beans> |
titan-cache/src/main/resources/spring-config-service.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xmlns:context="http://www.springframework.org/schema/context" | ||
4 | + xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
5 | + http://www.springframework.org/schema/beans/spring-beans.xsd | ||
6 | + http://www.springframework.org/schema/context | ||
7 | + http://www.springframework.org/schema/context/spring-context.xsd" | ||
8 | + default-autowire="byName"> | ||
9 | + | ||
10 | + <context:component-scan base-package="com.dili.titan.service" /> | ||
11 | + | ||
12 | +</beans> | ||
0 | \ No newline at end of file | 13 | \ No newline at end of file |
titan-cache/src/main/resources/spring-config.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xmlns:mvc="http://www.springframework.org/schema/mvc" | ||
4 | + xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
5 | + http://www.springframework.org/schema/beans/spring-beans.xsd | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | + http://www.springframework.org/schema/mvc | ||
11 | + http://www.springframework.org/schema/mvc/spring-mvc.xsd" | ||
12 | + default-autowire="byName"> | ||
13 | + | ||
14 | + <mvc:annotation-driven /> | ||
15 | + | ||
16 | + <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> | ||
17 | + <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> | ||
18 | + <property name="ignoreResourceNotFound" value="true" /> | ||
19 | + <property name="locations"> | ||
20 | + <list> | ||
21 | + <value>classpath:important.properties</value> | ||
22 | + </list> | ||
23 | + </property> | ||
24 | + </bean> | ||
25 | + | ||
26 | + <import resource="classpath:spring-config-dao.xml" /> | ||
27 | + <import resource="classpath:spring-config-service.xml" /> | ||
28 | + <import resource="classpath:spring-config-handler.xml" /> | ||
29 | + <import resource="classpath:spring-config-mq.xml" /> | ||
30 | + <import resource="classpath:spring-config-redis.xml" /> | ||
31 | + <import resource="classpath:spring-config-rpc.xml" /> | ||
32 | +</beans> | ||
0 | \ No newline at end of file | 33 | \ No newline at end of file |
titan-cache/src/main/resources/sqlmap/Attribute.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
3 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
4 | +<mapper namespace="com.dili.titan.dao.AttributeDao"> | ||
5 | + | ||
6 | + <sql id="QUERY_WHERE_CLAUSE"> | ||
7 | + <where> | ||
8 | + <if test="attrId != null and attrId != ''"><![CDATA[AND id = #{id}]]></if> | ||
9 | + <if test="name != null and name != ''"><![CDATA[AND name = #{name}]]></if> | ||
10 | + <if test="alias != null and alias != ''"><![CDATA[AND alias = #{alias}]]></if> | ||
11 | + <if test="dealType != null"><![CDATA[deal_type = #{dealType},]]></if> | ||
12 | + <if test="inputtype != null and inputtype != ''"><![CDATA[AND inputtype = #{inputtype}]]></if> | ||
13 | + <if test="type != null and type != ''"><![CDATA[AND type = #{type}]]></if> | ||
14 | + <if test="required != null and required != ''"><![CDATA[AND required = #{required}]]></if> | ||
15 | + <if test="status != null and status != ''"><![CDATA[AND status = #{status}]]></if> | ||
16 | + <if test="ctime != null and ctime != ''"><![CDATA[AND ctime = #{ctime}]]></if> | ||
17 | + <if test="utime != null and utime != ''"><![CDATA[AND utime = #{utime}]]></if> | ||
18 | + </where> | ||
19 | + </sql> | ||
20 | + | ||
21 | + <sql id="QUERY_ORDER_LIMIT_CONDTION"> | ||
22 | + <if test="orderField != null and orderField != '' and orderType != null and orderType != ''"><![CDATA[ORDER BY ${orderField} ${orderType}]]></if> | ||
23 | + <if test="startIndex != null and startIndex >= 0 and pageSize != null and pageSize > 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if> | ||
24 | + </sql> | ||
25 | + | ||
26 | + <!-- 查询,通过主键IN(array) --> | ||
27 | + <select id="selectEntryArray" parameterType="java.lang.reflect.Array" resultType="attribute"> | ||
28 | + <![CDATA[ SELECT id AS attrId,name,alias,deal_type AS dealType,inputtype ,type,required,status,ctime,utime FROM attribute ]]> | ||
29 | + <![CDATA[WHERE id IN]]> | ||
30 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
31 | + <![CDATA[#{id}]]> | ||
32 | + </foreach> | ||
33 | + </select> | ||
34 | + <select id="selectEntry" parameterType="long" resultType="attribute"> | ||
35 | + <![CDATA[SELECT id AS attrId,name,alias,deal_type AS dealType,inputtype ,type,required,status,ctime,utime FROM attribute WHERE id = #{id}]]> | ||
36 | + </select> | ||
37 | + | ||
38 | + <select id="selectAllEntry" resultType="attribute"> | ||
39 | + <![CDATA[SELECT id AS attrId,name,alias,deal_type AS dealType,inputtype ,type,required,status,ctime,utime FROM attribute]]> | ||
40 | + </select> | ||
41 | + | ||
42 | + <select id="selectEntryList" parameterType="attribute" resultType="attribute"> | ||
43 | + <![CDATA[SELECT id AS attrId,name,alias,deal_type AS dealType,inputtype,type,required,status,ctime,utime FROM attribute]]> | ||
44 | + <include refid="QUERY_WHERE_CLAUSE" /> | ||
45 | + <include refid="QUERY_ORDER_LIMIT_CONDTION" /> | ||
46 | + </select> | ||
47 | + | ||
48 | + <select id="selectEntryListCount" parameterType="attribute" resultType="int"> | ||
49 | + <![CDATA[SELECT COUNT(id) AS dataCount FROM attribute]]> | ||
50 | + <include refid="QUERY_WHERE_CLAUSE" /> | ||
51 | + </select> | ||
52 | + | ||
53 | + <select id="selectAttributeValue" parameterType="long" resultType="attributeValue"> | ||
54 | + <![CDATA[SELECT id AS valueId,attr_id AS attrId,value,`order`,`show`,status FROM attribute_value WHERE attr_id = #{attrId} order by `order`]]> | ||
55 | + </select> | ||
56 | + | ||
57 | +</mapper> | ||
0 | \ No newline at end of file | 58 | \ No newline at end of file |
titan-cache/src/main/resources/sqlmap/Category.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
3 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
4 | +<mapper namespace="com.dili.titan.dao.CategoryDao"> | ||
5 | + <sql id="QUERY_WHERE_CLAUSE"> | ||
6 | + <where> | ||
7 | + <if test="id != null and id != ''"><![CDATA[AND id = #{id}]]></if> | ||
8 | + <if test="name != null and name != ''"><![CDATA[AND name = #{name}]]></if> | ||
9 | + <if test="jp != null and jp != ''"><![CDATA[AND jp = #{jp}]]></if> | ||
10 | + <if test="parent != null and parent != ''"><![CDATA[AND parent = #{parent}]]></if> | ||
11 | + <if test="dealType != null and dealType != ''"><![CDATA[AND deal_type = #{dealType}]]></if> | ||
12 | + <if test="template != null and template != ''"><![CDATA[AND template = #{template}]]></if> | ||
13 | + <if test="status != null and status != ''"><![CDATA[AND status = #{status}]]></if> | ||
14 | + <if test="activate != null and activate != ''"><![CDATA[AND activate = #{activate}]]></if> | ||
15 | + </where> | ||
16 | + </sql> | ||
17 | + | ||
18 | + <sql id="QUERY_ORDER_LIMIT_CONDTION"> | ||
19 | + <if test="orderField != null and orderField != '' and orderType != null and orderType != ''"><![CDATA[ORDER BY ${orderField} ${orderType}]]></if> | ||
20 | + <if test="startIndex != null and startIndex >= 0 and pageSize != null and pageSize > 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if> | ||
21 | + </sql> | ||
22 | + <!-- 查询,通过主键IN(array) --> | ||
23 | + <select id="selectEntryArray" parameterType="java.lang.reflect.Array" resultType="category"> | ||
24 | + <![CDATA[ SELECT id,name, jp ,alias,deal_type AS dealType,icon,parent,template,status,activate,`order` FROM category]]> | ||
25 | + <![CDATA[WHERE id IN]]> | ||
26 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
27 | + <![CDATA[#{id}]]> | ||
28 | + </foreach> | ||
29 | + </select> | ||
30 | + <select id="selectEntry" parameterType="int" resultType="category"> | ||
31 | + <![CDATA[SELECT id,name, jp ,alias,deal_type AS dealType,icon,parent,template,status,activate,`order` FROM category WHERE id = #{id} order by `order`]]> | ||
32 | + </select> | ||
33 | + | ||
34 | + <select id="selectEntryList" parameterType="category" resultType="category"> | ||
35 | + <![CDATA[SELECT id,name,jp ,alias,deal_type AS dealType,icon,parent,template,status,activate,`order` FROM category ]]> | ||
36 | + <include refid="QUERY_WHERE_CLAUSE" /> | ||
37 | + <include refid="QUERY_ORDER_LIMIT_CONDTION" /> | ||
38 | + order by `order` | ||
39 | + </select> | ||
40 | + | ||
41 | + <select id="selectAllEntry" resultType="category"> | ||
42 | + <![CDATA[SELECT id,name,jp ,alias,deal_type AS dealType,icon,parent,template,status,activate,`order` FROM category order by `order`]]> | ||
43 | + </select> | ||
44 | + | ||
45 | + <select id="selectEntryListCount" parameterType="category" resultType="int"> | ||
46 | + <![CDATA[SELECT COUNT(id) AS dataCount FROM category]]> | ||
47 | + <include refid="QUERY_WHERE_CLAUSE" /> | ||
48 | + </select> | ||
49 | + | ||
50 | + <select id="selectChildById" parameterType="int" resultType="int"> | ||
51 | + <![CDATA[SELECT id FROM category WHERE parent = #{id} AND status=1]]> | ||
52 | + </select> | ||
53 | + | ||
54 | + <select id="selectCateAttrById" parameterType="int" resultType="categoryAttr"> | ||
55 | + <![CDATA[SELECT id,cate_id AS catId,deal_type AS dealType,attr_id AS attrId,searchable,`order` from category_attr where cate_id = #{catId} order by `order`]]> | ||
56 | + </select> | ||
57 | + | ||
58 | + <select id="selectCateSeacherAttrById" parameterType="int" resultType="categoryAttr"> | ||
59 | + <![CDATA[SELECT id,cate_id AS catId,attr_id AS attrId,`order` FROM category_search_attr WHERE cate_id = #{catId} order by `order`]]> | ||
60 | + </select> | ||
61 | + | ||
62 | +</mapper> | ||
0 | \ No newline at end of file | 63 | \ No newline at end of file |
titan-cache/src/main/resources/sqlmap/ProductImg.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
3 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
4 | +<mapper namespace="com.dili.titan.dao.ProductImgDao"> | ||
5 | + | ||
6 | + <!-- product_img 所有查询列 --> | ||
7 | + <sql id="QUERY_COLUMN_LIST"> | ||
8 | + <![CDATA[id,pid,img_url AS imgUrl,img_title AS imgTitle,`order`,`desc`,ctime,utime]]> | ||
9 | + </sql> | ||
10 | + | ||
11 | + <!-- product_img 插入 --> | ||
12 | + <sql id="INSERT"> | ||
13 | + <![CDATA[INSERT INTO product_img (pid,img_url,img_title,`order`,`desc`,ctime,utime)]]> | ||
14 | + </sql> | ||
15 | + | ||
16 | + <!-- product_img 查询列来源表--> | ||
17 | + <sql id="QUERY_FROM_TABLE"><![CDATA[FROM product_img]]></sql> | ||
18 | + | ||
19 | + <!-- 全部条件(更多功能可以通过queryData扩展实现) --> | ||
20 | + <sql id="QUERY_WHERE_CLAUSE"> | ||
21 | + <where> | ||
22 | + <if test="id != null and id != ''"><![CDATA[AND id = #{id}]]></if> | ||
23 | + <if test="pid != null and pid != ''"><![CDATA[AND pid = #{pid}]]></if> | ||
24 | + <if test="imgUrl != null and imgUrl != ''"><![CDATA[AND img_url = #{imgUrl}]]></if> | ||
25 | + <if test="imgTitle != null and imgTitle != ''"><![CDATA[AND imgTitle = #{imgTitle}]]></if> | ||
26 | + <if test="order != null and order != ''"><![CDATA[AND `order` = #{order}]]></if> | ||
27 | + <if test="desc != null and desc != ''"><![CDATA[AND desc = #{desc}]]></if> | ||
28 | + <if test="ctime != null and ctime != ''"><![CDATA[AND ctime = #{ctime}]]></if> | ||
29 | + <if test="utime != null and utime != ''"><![CDATA[AND utime = #{utime}]]></if> | ||
30 | + </where> | ||
31 | + </sql> | ||
32 | + | ||
33 | + <!-- 智能排序与分页 --> | ||
34 | + <sql id="QUERY_ORDER_LIMIT_CONDTION"> | ||
35 | + <if test="orderField != null and orderField != '' and orderFieldType != null and orderFieldType != ''"><![CDATA[ORDER BY ${orderField} ${orderFieldType}]]></if> | ||
36 | + <if test="startIndex != null and startIndex >= 0 and pageSize != null and pageSize > 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if> | ||
37 | + </sql> | ||
38 | + | ||
39 | + <!-- 更新列字段,只要不为NULL则更新,除开主键列 --> | ||
40 | + <sql id="UPDATE_COLUMN_SET"> | ||
41 | + <set> | ||
42 | + <if test="pid != null"><![CDATA[pid = #{pid},]]></if> | ||
43 | + <if test="imgUrl != null"><![CDATA[img_url = #{imgUrl},]]></if> | ||
44 | + <if test="imgTitle != null"><![CDATA[img_title = #{imgTitle,]]></if> | ||
45 | + <if test="order != null"><![CDATA[`order` = #{order},]]></if> | ||
46 | + <if test="desc != null"><![CDATA[desc = #{desc},]]></if> | ||
47 | + <if test="ctime != null"><![CDATA[ctime = #{ctime},]]></if> | ||
48 | + <if test="utime != null"><![CDATA[utime = #{utime},]]></if> | ||
49 | + </set> | ||
50 | + </sql> | ||
51 | + | ||
52 | + <!-- 插入product_img记录 --> | ||
53 | + <insert id="insertEntry" parameterType="productImg" > | ||
54 | + <![CDATA[ | ||
55 | + INSERT INTO product_img (id,pid,img_url,img_title,`order`,desc,ctime,utime) | ||
56 | + VALUES (#{id},#{pid},#{imgUrl},#{imgTitle},#{order},#{desc},now(),#{utime}) | ||
57 | + ]]> | ||
58 | + </insert> | ||
59 | + | ||
60 | + <!-- 返回插入的编号,在事务开启状态下有效 --> | ||
61 | + <select id="lastSequence" resultType="int"><![CDATA[SELECT LAST_INSERT_ID() AS id]]></select> | ||
62 | + | ||
63 | + <!-- 删除记录,主键IN(array) --> | ||
64 | + <delete id="deleteByArrayKey" parameterType="java.lang.reflect.Array" > | ||
65 | + <![CDATA[DELETE FROM product_img WHERE id IN]]> | ||
66 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
67 | + <![CDATA[#{id}]]> | ||
68 | + </foreach> | ||
69 | + </delete> | ||
70 | + | ||
71 | + <!-- 删除,通过条件 --> | ||
72 | + <update id="deleteByCondtion" parameterType="productImg" > | ||
73 | + <![CDATA[DELETE FROM product_img]]> | ||
74 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
75 | + </update> | ||
76 | + | ||
77 | + <!-- 修改记录通过主键 --> | ||
78 | + <update id="updateByKey" parameterType="productImg" > | ||
79 | + <![CDATA[UPDATE product_img]]> | ||
80 | + <include refid="UPDATE_COLUMN_SET"/> | ||
81 | + <![CDATA[WHERE id = #{id}]]> | ||
82 | + </update> | ||
83 | + | ||
84 | + <!-- 查询,通过主键IN(array) --> | ||
85 | + <select id="selectEntryArray" parameterType="java.lang.reflect.Array" resultType="productImg"> | ||
86 | + <![CDATA[SELECT]]> | ||
87 | + <include refid="QUERY_COLUMN_LIST"/> | ||
88 | + <include refid="QUERY_FROM_TABLE"/> | ||
89 | + <![CDATA[WHERE id IN]]> | ||
90 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
91 | + <![CDATA[#{id}]]> | ||
92 | + </foreach> | ||
93 | + </select> | ||
94 | + | ||
95 | + <!-- 查询,通过条件 --> | ||
96 | + <select id="selectEntryList" parameterType="productImg" resultType="productImg"> | ||
97 | + <![CDATA[SELECT]]> | ||
98 | + <include refid="QUERY_COLUMN_LIST"/> | ||
99 | + <include refid="QUERY_FROM_TABLE"/> | ||
100 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
101 | + <include refid="QUERY_ORDER_LIMIT_CONDTION"/> | ||
102 | + </select> | ||
103 | + | ||
104 | + <!-- 总数查询,通过条件 --> | ||
105 | + <select id="selectEntryListCount" parameterType="productImg" resultType="int"> | ||
106 | + <![CDATA[SELECT COUNT(id) AS dataCount]]> | ||
107 | + <include refid="QUERY_FROM_TABLE"/> | ||
108 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
109 | + </select> | ||
110 | + | ||
111 | + <!-- 其它SQL语句 --> | ||
112 | + <!-- 批量添加图片 --> | ||
113 | + <insert id="batchInsert" parameterType="productImg"> | ||
114 | + <include refid="INSERT"/> | ||
115 | + VALUES | ||
116 | + <foreach collection="list" item="item" index="index" separator=","> | ||
117 | + <![CDATA[(#{item.pid},#{item.imgUrl},#{item.imgTitle},#{item.order},#{item.desc},now(),#{item.utime})]]> | ||
118 | + </foreach> | ||
119 | + </insert> | ||
120 | + | ||
121 | + <!-- 通过pid,查询图片 --> | ||
122 | + <select id="selectByPid" parameterType="Long" resultType="productImg"> | ||
123 | + <![CDATA[SELECT]]> | ||
124 | + <include refid="QUERY_COLUMN_LIST"/> | ||
125 | + <include refid="QUERY_FROM_TABLE"/> | ||
126 | + <![CDATA[WHERE pid=#{pid}]]> | ||
127 | + <![CDATA[ORDER BY `order` asc]]> | ||
128 | + </select> | ||
129 | + | ||
130 | + <!-- 通过id,删除图片 --> | ||
131 | + <delete id="deleteById" parameterType="Long"> | ||
132 | + <![CDATA[DELETE FROM product_img WHERE id=#{id}]]> | ||
133 | + </delete> | ||
134 | + | ||
135 | + <!-- 通过pid,删除图片 --> | ||
136 | + <delete id="deleteByPid" parameterType="Long"> | ||
137 | + <![CDATA[DELETE FROM product_img WHERE pid=#{pid}]]> | ||
138 | + </delete> | ||
139 | + | ||
140 | + <select id="getBySupplyId" parameterType="Long" resultType="productImg"> | ||
141 | + <![CDATA[SELECT]]> | ||
142 | + <include refid="QUERY_COLUMN_LIST"/> | ||
143 | + <include refid="QUERY_FROM_TABLE"/> | ||
144 | + <![CDATA[WHERE pid=#{supplyId} order by 'order']]> | ||
145 | + </select> | ||
146 | + | ||
147 | + <select id="getByPurchaseId" parameterType="Long" resultType="productImg"> | ||
148 | + <![CDATA[SELECT]]> | ||
149 | + <include refid="QUERY_COLUMN_LIST"/> | ||
150 | + <include refid="QUERY_FROM_TABLE"/> | ||
151 | + <![CDATA[WHERE pid=#{purchaseId} order by 'order']]> | ||
152 | + </select> | ||
153 | + | ||
154 | +</mapper> | ||
0 | \ No newline at end of file | 155 | \ No newline at end of file |
titan-cache/src/main/resources/sqlmap/ProductPop.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
3 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
4 | +<mapper namespace="com.dili.titan.dao.ProductPopDao"> | ||
5 | + | ||
6 | + <resultMap type="productPop" id="productPop"> | ||
7 | + <result property="pid" javaType="Long" column="pid"/> | ||
8 | + <result property="name" javaType="String" column="name"/> | ||
9 | + <result property="quotationType" javaType="Integer" column="quotation_type"/> | ||
10 | + <result property="cateId" javaType="Integer" column="cate_id"/> | ||
11 | + <result property="userDefined" javaType="Integer" column="user_defined"/> | ||
12 | + <result property="cate" javaType="String" column="cate"/> | ||
13 | + <result property="status" javaType="Integer" column="status"/> | ||
14 | + <result property="publishSettime" javaType="Date" column="publish_settime"/> | ||
15 | + <result property="publishTime" javaType="Date" column="publish_time"/> | ||
16 | + <result property="publishMode" javaType="Integer" column="publish_mode"/> | ||
17 | + <result property="prepareTime" javaType="Long" column="prepare_time"/> | ||
18 | + <result property="dropsTime" javaType="Date" column="drops_time"/> | ||
19 | + <result property="ctime" javaType="Date" column="ctime"/> | ||
20 | + <result property="utime" javaType="Date" column="utime"/> | ||
21 | + <result property="desc" javaType="String" column="desc"/> | ||
22 | + <result property="minPrice" javaType="Integer" column="minPrice"/> | ||
23 | + <result property="maxPrice" javaType="Integer" column="maxPrice"/> | ||
24 | + <result property="producingArea" javaType="Long" column="producing_area"/> | ||
25 | + <result property="localityArea" javaType="Long" column="locality_area"/> | ||
26 | + <result property="sellerName" javaType="String" column="seller_name"/> | ||
27 | + <result property="seller" javaType="Long" column="seller"/> | ||
28 | + <result property="shop" javaType="Long" column="shop"/> | ||
29 | + <result property="shopName" javaType="String" column="shop_name"/> | ||
30 | + <result property="indate" javaType="Integer" column="indate"/> | ||
31 | + <result property="defaultPic" javaType="String" column="img_url"/> | ||
32 | + <result property="storeUnit" javaType="Integer" column="store_unit"/> | ||
33 | +<!-- <collection property="deliveryArea" javaType="ArrayList" ofType="delivery"> | ||
34 | + <result property="deliId" column="deli_id" javaType="Integer"/> | ||
35 | + <result property="deliName" column="deli_name" javaType="String"/> | ||
36 | + <result property="deliType" column="deli_type" javaType="Integer"/> | ||
37 | + </collection> --> | ||
38 | + <collection property="subCateList" javaType="ArrayList" ofType="category"> | ||
39 | + <result property="id" column="id" javaType="Integer"/> | ||
40 | + </collection> | ||
41 | +<!-- <collection property="skus" javaType="ArrayList" ofType="sku"> --> | ||
42 | +<!-- <result property="sku" column="sku" javaType="String" /> --> | ||
43 | +<!-- <result property="remark" column="title" javaType="String" /> --> | ||
44 | +<!-- <result property="stockNum" column="store" javaType="Integer" /> --> | ||
45 | +<!-- <result property="minNum" column="mini_purchase" javaType="Integer"/> --> | ||
46 | +<!-- <result property="price" column="price" javaType="Integer"/> --> | ||
47 | +<!-- </collection> --> | ||
48 | + </resultMap> | ||
49 | + | ||
50 | + <!-- 全部条件(更多功能可以通过queryData扩展实现) 为防止column名重复,查询时将product_pop表取别名为a--> | ||
51 | + <sql id="QUERY_WHERE_CLAUSE"> | ||
52 | + <where> | ||
53 | + <if test="pid != null and pid != ''"><![CDATA[AND pid = #{pid}]]></if> | ||
54 | + <if test="name != null and name != ''"><![CDATA[AND a.name = #{name}]]></if> | ||
55 | + <if test="cateId != null and cateId != ''"><![CDATA[AND cate_id = #{cateId}]]></if> | ||
56 | + <if test="userDefined != null and userDefined != ''"><![CDATA[AND user_defined = #{userDefined}]]></if> | ||
57 | + <if test="producingArea != null and producingArea != ''"><![CDATA[AND producing_area = #{producingArea}]]></if> | ||
58 | + <if test="seller != null and seller != ''"><![CDATA[AND seller = #{seller}]]></if> | ||
59 | + <if test="sellerName != null and sellerName != ''"><![CDATA[AND seller_name = #{sellerName}]]></if> | ||
60 | + <if test="shop != null and shop != ''"><![CDATA[AND shop = #{shop}]]></if> | ||
61 | + <if test="publishMode != null and publishMode != ''"><![CDATA[AND publish_mode = #{publishMode}]]></if> | ||
62 | + <if test="publishTime != null and publishTime != ''"><![CDATA[AND publish_time = #{publishTime}]]></if> | ||
63 | + <if test="status != null and status != '' and status < 4"><![CDATA[AND a.status = #{status}]]></if> | ||
64 | + <if test="userDefined !=null and userDefined !='' "><![CDATA[AND user_defined = #{userDefined}]]></if> | ||
65 | + <if test="status != null and status != '' and status>=4"><![CDATA[AND a.status >3]]></if> | ||
66 | + <if test="startTime != null and endTime == null "><![CDATA[AND ctime > #{startTime}]]></if> | ||
67 | + <if test="startTime == null and endTime != null "><![CDATA[AND ctime < DATE_ADD(#{endTime},INTERVAL 1 DAY)]]></if> | ||
68 | + <if test="startTime != null and endTime != null and startTime != '' and endTime!= '' "><![CDATA[AND ctime between #{startTime} and DATE_ADD(#{endTime},INTERVAL 1 DAY)]]></if> | ||
69 | + <if test="utime != null and utime != ''"><![CDATA[AND utime = #{utime}]]></if> | ||
70 | + <![CDATA[AND a.status > 0]]> | ||
71 | + </where> | ||
72 | + </sql> | ||
73 | + | ||
74 | + <!-- 智能排序与分页 --> | ||
75 | + <sql id="QUERY_ORDER_LIMIT_CONDTION"> | ||
76 | + <if test="orderField != null and orderField != '' and orderFieldType != null and orderFieldType != ''"><![CDATA[ORDER BY ${orderField} ${orderFieldType}]]></if> | ||
77 | + <if test="startIndex != null and startIndex >= 0 and pageSize != null and pageSize > 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if> | ||
78 | + </sql> | ||
79 | + | ||
80 | + <sql id="UPDATE_COLUMN_SET"> | ||
81 | + <set> | ||
82 | + <if test="name != null and name != ''"><![CDATA[ name = #{name},]]></if> | ||
83 | + <if test="cateId != null and cateId != ''"><![CDATA[cate_id = #{cateId},]]></if> | ||
84 | + <if test="producingArea != null and producingArea != ''"><![CDATA[ producing_area = #{producingArea},]]></if> | ||
85 | + <if test="seller != null and seller != ''"><![CDATA[ seller = #{seller},]]></if> | ||
86 | + <if test="shop != null and shop != ''"><![CDATA[ shop = #{shop},]]></if> | ||
87 | + <if test="publishMode != null and publishMode != '' and publishMode > 0 "><![CDATA[ publish_mode = #{publishMode},]]></if> | ||
88 | + <if test="publishTime != null and publishTime != ''"><![CDATA[ publish_time = #{publishTime},]]></if> | ||
89 | + <if test="publishSettime != null and publishSettime != ''"><![CDATA[ publish_settime = #{publishSettime},]]></if> | ||
90 | + <if test="prepareTime != null and prepareTime != ''"><![CDATA[ prepare_time = #{prepareTime},]]></if> | ||
91 | + <if test="dropsTime != null and dropsTime != ''"><![CDATA[ drops_time = #{dropsTime},]]></if> | ||
92 | + <if test="status != null and status != ''"><![CDATA[`status` = #{status},]]></if> | ||
93 | + <if test="foreignPid != null and foreignPid != ''"><![CDATA[ foreign_pid = #{foreignPid},]]></if> | ||
94 | + <if test="ctime != null and ctime != ''"><![CDATA[ ctime = #{ctime},]]></if> | ||
95 | + <![CDATA[ utime = now()]]> | ||
96 | + </set> | ||
97 | + </sql> | ||
98 | + | ||
99 | + | ||
100 | + | ||
101 | + <!-- 插入product_pop记录 --> | ||
102 | + <insert id="insertEntry" parameterType="productPop"> | ||
103 | + <![CDATA[ | ||
104 | + INSERT INTO product_pop (pid,name,quotation_type,cate_id,producing_area,seller,seller_name,shop,shop_name,indate,publish_mode,publish_settime,status,ctime,prepare_time,foreign_pid,store_unit) | ||
105 | + VALUES (#{pid},#{quotationType},#{name},#{cateId},#{producingArea},#{seller},#{sellerName},#{shop},#{shopName},#{indate},#{publishMode},#{publishSettime},#{status},now(),#{prepareTime},#{foreignPid},#{storeUnit}) | ||
106 | + ]]> | ||
107 | + </insert> | ||
108 | + | ||
109 | + <!-- 删除,通过条件 --> | ||
110 | + <update id="deleteByCondtion" parameterType="productPop"> | ||
111 | + <![CDATA[DELETE FROM product_pop a]]> | ||
112 | + <include refid="QUERY_WHERE_CLAUSE" /> | ||
113 | + </update> | ||
114 | + | ||
115 | + <!-- 修改记录通过主键 --> | ||
116 | + <update id="updateByKey" parameterType="productPop"> | ||
117 | + <![CDATA[UPDATE product_pop]]> | ||
118 | + <include refid="UPDATE_COLUMN_SET"/> | ||
119 | + <![CDATA[WHERE pid = #{pid}]]> | ||
120 | + </update> | ||
121 | + | ||
122 | + <update id="setProductLocalityArea" parameterType="java.util.Map"> | ||
123 | + <![CDATA[UPDATE product_pop SET locality_area = #{cityId}]]> | ||
124 | + <![CDATA[ WHERE shop = #{shopId}]]> | ||
125 | + </update> | ||
126 | + <update id="setShopCityId" parameterType="java.util.Map"> | ||
127 | + <![CDATA[UPDATE product_pop SET shop_city_id = #{cityId}]]> | ||
128 | + <![CDATA[ WHERE shop = #{shopId}]]> | ||
129 | + </update> | ||
130 | + <select id="selectProductIdByShopId" parameterType="java.lang.Long" resultType="long"> | ||
131 | + <![CDATA[ select pid from product_pop where shop = #{shopId}]]> | ||
132 | + </select> | ||
133 | + | ||
134 | + <update id="setShopName" parameterType="java.util.Map"> | ||
135 | + <![CDATA[UPDATE product_pop SET shop_name = #{shopName}]]> | ||
136 | + <![CDATA[ WHERE shop = #{shopId}]]> | ||
137 | + </update> | ||
138 | + | ||
139 | + <update id="setUserName" parameterType="java.util.Map"> | ||
140 | + <![CDATA[UPDATE product_pop SET seller_name = #{userName}]]> | ||
141 | + <![CDATA[ WHERE seller = #{userId}]]> | ||
142 | + </update> | ||
143 | + | ||
144 | + <update id="setMarket" parameterType="java.util.Map"> | ||
145 | + <![CDATA[UPDATE product_pop SET market_id = #{marketId},market_name = #{marketName} ]]> | ||
146 | + <![CDATA[ WHERE shop = #{shopId} ]]> | ||
147 | + </update> | ||
148 | + | ||
149 | + <select id="selectDropsProduct" parameterType="java.lang.Long" resultType="long"> | ||
150 | + <![CDATA[ select pid from product_pop where shop = #{shopId} and (status = 3 or publish_mode = 3)]]> | ||
151 | + </select> | ||
152 | + | ||
153 | + <update id="dropsProduct" parameterType="java.lang.Long"> | ||
154 | + <![CDATA[ | ||
155 | + UPDATE product_pop SET status=4,drops_time =now(),publish_mode=1,publish_settime=null | ||
156 | + WHERE shop=#{shopId} and (status = 3 or publish_mode = 3) | ||
157 | + ]]> | ||
158 | + </update> | ||
159 | + | ||
160 | + <select id="selectDelProduct" parameterType="java.lang.Long" resultType="long"> | ||
161 | + <![CDATA[ select pid from product_pop where shop = #{shopId} and status>0 ]]> | ||
162 | + </select> | ||
163 | + | ||
164 | + <update id="delProduct" parameterType="java.lang.Long"> | ||
165 | + <![CDATA[ | ||
166 | + UPDATE product_pop SET status=-1 | ||
167 | + WHERE shop=#{shopId} and status>0 | ||
168 | + ]]> | ||
169 | + </update> | ||
170 | + | ||
171 | +</mapper> | ||
0 | \ No newline at end of file | 172 | \ No newline at end of file |
titan-cache/src/main/resources/sqlmap/gq/Presale.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
3 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
4 | +<mapper namespace="com.dili.titan.dao.gq.PresaleDao"> | ||
5 | + | ||
6 | + <!-- presale 所有查询列 --> | ||
7 | + <sql id="QUERY_COLUMN_LIST"> | ||
8 | + <![CDATA[id,title,user_name AS userName,category_id AS categoryId,locality_area_id AS localityAreaId,`count`,unit_id AS unitId,phone,status,user_id AS userId,source,reason,start_time AS startTime,end_time AS endTime,ctime,utime]]> | ||
9 | + </sql> | ||
10 | + | ||
11 | + <!-- presale 查询列来源表--> | ||
12 | + <sql id="QUERY_FROM_TABLE"><![CDATA[FROM presale]]></sql> | ||
13 | + | ||
14 | + <!-- 全部条件(更多功能可以通过queryData扩展实现) --> | ||
15 | + <sql id="QUERY_WHERE_CLAUSE"> | ||
16 | + <where> | ||
17 | + <if test="id != null and id != ''"><![CDATA[AND id = #{id}]]></if> | ||
18 | + <if test="title != null and title != ''"><![CDATA[AND title = #{title}]]></if> | ||
19 | + <if test="userName != null and userName != ''"><![CDATA[AND user_name = #{userName}]]></if> | ||
20 | + <if test="categoryId != null and categoryId != ''"><![CDATA[AND category_id = #{categoryId}]]></if> | ||
21 | + <if test="localityAreaId != null and localityAreaId != ''"><![CDATA[AND locality_area_id = #{localityAreaId}]]></if> | ||
22 | + <if test="count != null and count != ''"><![CDATA[AND `count` = #{count}]]></if> | ||
23 | + <if test="unitId != null and unitId != ''"><![CDATA[AND unit_id = #{unitId}]]></if> | ||
24 | + <if test="phone != null and phone != ''"><![CDATA[AND phone = #{phone}]]></if> | ||
25 | + <if test="status != null and status != ''"><![CDATA[AND status = #{status}]]></if> | ||
26 | + <if test="statuses != null and statuses != ''"> | ||
27 | + <![CDATA[AND status IN ]]> | ||
28 | + <foreach collection="statuses" item="status" open="(" separator="," close=")"> | ||
29 | + <![CDATA[#{status}]]> | ||
30 | + </foreach> | ||
31 | + </if> | ||
32 | + <if test="userId != null and userId != ''"><![CDATA[AND user_id = #{userId}]]></if> | ||
33 | + <if test="source != null and source != ''"><![CDATA[AND source = #{source}]]></if> | ||
34 | + <if test="reason != null and reason != ''"><![CDATA[AND reason = #{reason}]]></if> | ||
35 | + <if test="startTime != null and startTime != ''"><![CDATA[AND start_time = #{startTime}]]></if> | ||
36 | + <if test="endTime != null and endTime != ''"><![CDATA[AND end_time = #{endTime}]]></if> | ||
37 | + <if test="ctime != null and ctime != ''"><![CDATA[AND ctime = #{ctime}]]></if> | ||
38 | + <if test="utime != null and utime != ''"><![CDATA[AND utime = #{utime}]]></if> | ||
39 | + </where> | ||
40 | + </sql> | ||
41 | + | ||
42 | + <!-- 智能排序与分页 --> | ||
43 | + <sql id="QUERY_ORDER_LIMIT_CONDTION"> | ||
44 | + <if test="orderField != null and orderField != '' and orderFieldType != null and orderFieldType != ''"><![CDATA[ORDER BY ${orderField} ${orderFieldType}]]></if> | ||
45 | + <if test="startIndex != null and startIndex >= 0 and pageSize != null and pageSize > 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if> | ||
46 | + </sql> | ||
47 | + | ||
48 | + <!-- 更新列字段,只要不为NULL则更新,除开主键列 --> | ||
49 | + <sql id="UPDATE_COLUMN_SET"> | ||
50 | + <set> | ||
51 | + <if test="categoryId != null"><![CDATA[category_id = #{categoryId},]]></if> | ||
52 | + <if test="title != null"><![CDATA[title = #{title},]]></if> | ||
53 | + <if test="userName != null"><![CDATA[user_name = #{userName},]]></if> | ||
54 | + <if test="localityAreaId != null"><![CDATA[locality_area_id = #{localityAreaId},]]></if> | ||
55 | + <if test="count != null"><![CDATA[`count` = #{count},]]></if> | ||
56 | + <if test="unitId != null"><![CDATA[unit_id = #{unitId},]]></if> | ||
57 | + <if test="phone != null"><![CDATA[phone = #{phone},]]></if> | ||
58 | + <if test="status != null"><![CDATA[status = #{status},]]></if> | ||
59 | + <if test="userId != null"><![CDATA[user_id = #{userId},]]></if> | ||
60 | + <if test="source != null"><![CDATA[source = #{source},]]></if> | ||
61 | + <if test="reason != null"><![CDATA[reason = #{reason},]]></if> | ||
62 | + <if test="startTime != null"><![CDATA[start_time = #{startTime},]]></if> | ||
63 | + <if test="endTime != null"><![CDATA[end_time = #{endTime},]]></if> | ||
64 | + <if test="ctime != null"><![CDATA[ctime = #{ctime},]]></if> | ||
65 | + <![CDATA[ utime = now()]]> | ||
66 | + </set> | ||
67 | + </sql> | ||
68 | + | ||
69 | + <!-- 插入presale记录 --> | ||
70 | + <insert id="insertEntry" parameterType="presale" > | ||
71 | + <![CDATA[ | ||
72 | + INSERT INTO presale (id,title,user_name,category_id,locality_area_id,`count`,unit_id,phone,status,user_id,source,start_time,end_time,ctime) | ||
73 | + VALUES (#{id},#{title},#{userName},#{categoryId},#{localityAreaId},#{count},#{unitId},#{phone},#{status},#{userId},#{source},#{startTime},#{endTime},now()) | ||
74 | + ]]> | ||
75 | + </insert> | ||
76 | + | ||
77 | + <!-- 返回插入的编号,在事务开启状态下有效 --> | ||
78 | + <select id="lastSequence" resultType="int"><![CDATA[SELECT LAST_INSERT_ID() AS id]]></select> | ||
79 | + | ||
80 | + <!-- 删除记录,主键IN(array) --> | ||
81 | + <update id="deleteByArrayKey" parameterType="java.lang.reflect.Array" > | ||
82 | + <![CDATA[UPDATE presale SET status=-1 WHERE id IN]]> | ||
83 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
84 | + <![CDATA[#{id}]]> | ||
85 | + </foreach> | ||
86 | + </update> | ||
87 | + | ||
88 | + <!-- 删除,通过条件 --> | ||
89 | + <update id="deleteByCondtion" parameterType="presale" > | ||
90 | + <![CDATA[DELETE FROM presale]]> | ||
91 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
92 | + </update> | ||
93 | + | ||
94 | + <!-- 修改记录通过主键 --> | ||
95 | + <update id="updateByKey" parameterType="presale" > | ||
96 | + <![CDATA[UPDATE presale]]> | ||
97 | + <include refid="UPDATE_COLUMN_SET"/> | ||
98 | + <![CDATA[WHERE id = #{id}]]> | ||
99 | + </update> | ||
100 | + | ||
101 | + <!-- 查询,通过主键IN(array) --> | ||
102 | + <select id="selectEntryArray" parameterType="java.lang.reflect.Array" resultType="presale"> | ||
103 | + <![CDATA[SELECT]]> | ||
104 | + <include refid="QUERY_COLUMN_LIST"/> | ||
105 | + <include refid="QUERY_FROM_TABLE"/> | ||
106 | + <![CDATA[WHERE id IN]]> | ||
107 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
108 | + <![CDATA[#{id}]]> | ||
109 | + </foreach> | ||
110 | + </select> | ||
111 | + | ||
112 | + <!-- 查询,通过条件 --> | ||
113 | + <select id="selectEntryList" parameterType="presale" resultType="presale"> | ||
114 | + <![CDATA[SELECT]]> | ||
115 | + <include refid="QUERY_COLUMN_LIST"/> | ||
116 | + <include refid="QUERY_FROM_TABLE"/> | ||
117 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
118 | + <include refid="QUERY_ORDER_LIMIT_CONDTION"/> | ||
119 | + </select> | ||
120 | + | ||
121 | + <!-- 总数查询,通过条件 --> | ||
122 | + <select id="selectEntryListCount" parameterType="presale" resultType="int"> | ||
123 | + <![CDATA[SELECT COUNT(id) AS dataCount]]> | ||
124 | + <include refid="QUERY_FROM_TABLE"/> | ||
125 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
126 | + </select> | ||
127 | + | ||
128 | + <!-- 其它SQL语句 --> | ||
129 | + <update id="updatePhone" parameterType="java.util.Map" > | ||
130 | + <![CDATA[UPDATE presale SET phone={#phone} WHERE user_id = #{userId}]]> | ||
131 | + </update> | ||
132 | + | ||
133 | +</mapper> | ||
0 | \ No newline at end of file | 134 | \ No newline at end of file |
titan-cache/src/main/resources/sqlmap/gq/Purchase.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
3 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
4 | +<mapper namespace="com.dili.titan.dao.gq.PurchaseDao"> | ||
5 | + | ||
6 | + <!-- purchase 所有查询列 --> | ||
7 | + <sql id="QUERY_COLUMN_LIST"> | ||
8 | + <![CDATA[id,title,user_name AS userName,category_id AS categoryId,producing_area_id AS producingAreaId,locality_area_id AS localityAreaId,`count`,unit_id AS unitId,phone,expire_time AS expireTime,status,user_id AS userId,source,reason,ctime,utime]]> | ||
9 | + </sql> | ||
10 | + | ||
11 | + <!-- purchase 查询列来源表--> | ||
12 | + <sql id="QUERY_FROM_TABLE"><![CDATA[FROM purchase]]></sql> | ||
13 | + | ||
14 | + <!-- 全部条件(更多功能可以通过queryData扩展实现) --> | ||
15 | + <sql id="QUERY_WHERE_CLAUSE"> | ||
16 | + <where> | ||
17 | + <if test="id != null and id != ''"><![CDATA[AND id = #{id}]]></if> | ||
18 | + <if test="title != null and title != ''"><![CDATA[AND title = #{title}]]></if> | ||
19 | + <if test="userName != null and userName != ''"><![CDATA[AND user_name = #{userName}]]></if> | ||
20 | + <if test="categoryId != null and categoryId != ''"><![CDATA[AND category_id = #{categoryId}]]></if> | ||
21 | + <if test="producingAreaId != null and producingAreaId != ''"><![CDATA[AND producing_area_id = #{producingAreaId}]]></if> | ||
22 | + <if test="localityAreaId != null and localityAreaId != ''"><![CDATA[AND locality_area_id = #{localityAreaId}]]></if> | ||
23 | + <if test="count != null and count != ''"><![CDATA[AND count = #{`count`}]]></if> | ||
24 | + <if test="unitId != null and unitId != ''"><![CDATA[AND unit_id = #{unitId}]]></if> | ||
25 | + <if test="phone != null and phone != ''"><![CDATA[AND phone = #{phone}]]></if> | ||
26 | + <if test="expireTime != null and expireTime != ''"><![CDATA[AND expire_time = #{expireTime}]]></if> | ||
27 | + <if test="status != null and status != ''"><![CDATA[AND status = #{status}]]></if> | ||
28 | + <if test="statuses != null and statuses != ''"> | ||
29 | + <![CDATA[AND status IN ]]> | ||
30 | + <foreach collection="statuses" item="status" open="(" separator="," close=")"> | ||
31 | + <![CDATA[#{status}]]> | ||
32 | + </foreach> | ||
33 | + </if> | ||
34 | + <if test="userId != null and userId != ''"><![CDATA[AND user_id = #{userId}]]></if> | ||
35 | + <if test="source != null and source != ''"><![CDATA[AND source = #{source}]]></if> | ||
36 | + <if test="reason != null and reason != ''"><![CDATA[AND reason = #{reason}]]></if> | ||
37 | + <if test="ctime != null and ctime != ''"><![CDATA[AND ctime = #{ctime}]]></if> | ||
38 | + <if test="utime != null and utime != ''"><![CDATA[AND utime = #{utime}]]></if> | ||
39 | + </where> | ||
40 | + </sql> | ||
41 | + | ||
42 | + <!-- 智能排序与分页 --> | ||
43 | + <sql id="QUERY_ORDER_LIMIT_CONDTION"> | ||
44 | + <if test="orderField != null and orderField != '' and orderFieldType != null and orderFieldType != ''"><![CDATA[ORDER BY ${orderField} ${orderFieldType}]]></if> | ||
45 | + <if test="startIndex != null and startIndex >= 0 and pageSize != null and pageSize > 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if> | ||
46 | + </sql> | ||
47 | + | ||
48 | + <!-- 更新列字段,只要不为NULL则更新,除开主键列 --> | ||
49 | + <sql id="UPDATE_COLUMN_SET"> | ||
50 | + <set> | ||
51 | + <if test="categoryId != null"><![CDATA[category_id = #{categoryId},]]></if> | ||
52 | + <if test="title != null"><![CDATA[title = #{title},]]></if> | ||
53 | + <if test="userName != null"><![CDATA[user_name = #{userName},]]></if> | ||
54 | + <if test="producingAreaId != null"><![CDATA[producing_area_id = #{producingAreaId},]]></if> | ||
55 | + <if test="localityAreaId != null"><![CDATA[locality_area_id = #{localityAreaId},]]></if> | ||
56 | + <if test="count != null"><![CDATA[`count` = #{count},]]></if> | ||
57 | + <if test="unitId != null"><![CDATA[unit_id = #{unitId},]]></if> | ||
58 | + <if test="phone != null"><![CDATA[phone = #{phone},]]></if> | ||
59 | + <if test="expireTime != null"><![CDATA[expire_time = #{expireTime},]]></if> | ||
60 | + <if test="status != null"><![CDATA[status = #{status},]]></if> | ||
61 | + <if test="userId != null"><![CDATA[user_id = #{userId},]]></if> | ||
62 | + <if test="source != null"><![CDATA[source = #{source},]]></if> | ||
63 | + <if test="reason != null"><![CDATA[reason = #{reason},]]></if> | ||
64 | + <if test="ctime != null"><![CDATA[ctime = #{ctime},]]></if> | ||
65 | + <![CDATA[ utime = now()]]> | ||
66 | + </set> | ||
67 | + </sql> | ||
68 | + | ||
69 | + <!-- 插入purchase记录 --> | ||
70 | + <insert id="insertEntry" parameterType="purchase" > | ||
71 | + <![CDATA[ | ||
72 | + INSERT INTO purchase (id,title,user_name,category_id,producing_area_id,locality_area_id,`count`,unit_id,phone,expire_time,status,user_id,source,ctime) | ||
73 | + VALUES (#{id},#{title},#{userName},#{categoryId},#{producingAreaId},#{localityAreaId},#{count},#{unitId},#{phone},#{expireTime},#{status},#{userId},#{source},now()) | ||
74 | + ]]> | ||
75 | + </insert> | ||
76 | + | ||
77 | + <!-- 返回插入的编号,在事务开启状态下有效 --> | ||
78 | + <select id="lastSequence" resultType="int"><![CDATA[SELECT LAST_INSERT_ID() AS id]]></select> | ||
79 | + | ||
80 | + <!-- 删除记录,主键IN(array) --> | ||
81 | + <update id="deleteByArrayKey" parameterType="java.lang.reflect.Array" > | ||
82 | + <![CDATA[UPDATE purchase SET status=-1 WHERE id IN]]> | ||
83 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
84 | + <![CDATA[#{id}]]> | ||
85 | + </foreach> | ||
86 | + </update> | ||
87 | + | ||
88 | + <!-- 删除,通过条件 --> | ||
89 | + <update id="deleteByCondtion" parameterType="purchase" > | ||
90 | + <![CDATA[DELETE FROM purchase]]> | ||
91 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
92 | + </update> | ||
93 | + | ||
94 | + <!-- 修改记录通过主键 --> | ||
95 | + <update id="updateByKey" parameterType="purchase" > | ||
96 | + <![CDATA[UPDATE purchase]]> | ||
97 | + <include refid="UPDATE_COLUMN_SET"/> | ||
98 | + <![CDATA[WHERE id = #{id}]]> | ||
99 | + </update> | ||
100 | + | ||
101 | + <!-- 查询,通过主键IN(array) --> | ||
102 | + <select id="selectEntryArray" parameterType="java.lang.reflect.Array" resultType="purchase"> | ||
103 | + <![CDATA[SELECT]]> | ||
104 | + <include refid="QUERY_COLUMN_LIST"/> | ||
105 | + <include refid="QUERY_FROM_TABLE"/> | ||
106 | + <![CDATA[WHERE id IN]]> | ||
107 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
108 | + <![CDATA[#{id}]]> | ||
109 | + </foreach> | ||
110 | + </select> | ||
111 | + | ||
112 | + <!-- 查询,通过条件 --> | ||
113 | + <select id="selectEntryList" parameterType="purchase" resultType="purchase"> | ||
114 | + <![CDATA[SELECT]]> | ||
115 | + <include refid="QUERY_COLUMN_LIST"/> | ||
116 | + <include refid="QUERY_FROM_TABLE"/> | ||
117 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
118 | + <include refid="QUERY_ORDER_LIMIT_CONDTION"/> | ||
119 | + </select> | ||
120 | + | ||
121 | + <!-- 总数查询,通过条件 --> | ||
122 | + <select id="selectEntryListCount" parameterType="purchase" resultType="int"> | ||
123 | + <![CDATA[SELECT COUNT(id) AS dataCount]]> | ||
124 | + <include refid="QUERY_FROM_TABLE"/> | ||
125 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
126 | + </select> | ||
127 | + | ||
128 | + <!-- 其它SQL语句 --> | ||
129 | + <update id="updatePhone" parameterType="java.util.Map" > | ||
130 | + <![CDATA[UPDATE purchase SET phone={#phone} WHERE user_id = #{userId}]]> | ||
131 | + </update> | ||
132 | + | ||
133 | +</mapper> | ||
0 | \ No newline at end of file | 134 | \ No newline at end of file |
titan-cache/src/main/resources/sqlmap/gq/Supply.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
3 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
4 | +<mapper namespace="com.dili.titan.dao.gq.SupplyDao"> | ||
5 | + | ||
6 | + <!-- supply 所有查询列 --> | ||
7 | + <sql id="QUERY_COLUMN_LIST"> | ||
8 | + <![CDATA[id,title,user_name AS userName,category_id AS categoryId,locality_area_id AS localityAreaId,producing_area_id AS producingAreaId,price,`count`,unit_id AS unitId,user_id AS userId,phone,expire_time AS expireTime,status,source,reason,ctime,utime]]> | ||
9 | + </sql> | ||
10 | + | ||
11 | + <!-- supply 查询列来源表--> | ||
12 | + <sql id="QUERY_FROM_TABLE"><![CDATA[FROM supply]]></sql> | ||
13 | + | ||
14 | + <!-- 全部条件(更多功能可以通过queryData扩展实现) --> | ||
15 | + <sql id="QUERY_WHERE_CLAUSE"> | ||
16 | + <where> | ||
17 | + <if test="id != null and id != ''"><![CDATA[AND id = #{id}]]></if> | ||
18 | + <if test="title != null and title != ''"><![CDATA[AND title = #{title}]]></if> | ||
19 | + <if test="userName != null and userName != ''"><![CDATA[AND user_name = #{userName}]]></if> | ||
20 | + <if test="categoryId != null and categoryId != ''"><![CDATA[AND category_id = #{categoryId}]]></if> | ||
21 | + <if test="localityAreaId != null and localityAreaId != ''"><![CDATA[AND locality_area_id = #{localityAreaId}]]></if> | ||
22 | + <if test="producingAreaId != null and producingAreaId != ''"><![CDATA[AND producing_area_id = #{producingAreaId}]]></if> | ||
23 | + <if test="price != null and price != ''"><![CDATA[AND price = #{price}]]></if> | ||
24 | + <if test="count != null and count != ''"><![CDATA[AND `count` = #{count}]]></if> | ||
25 | + <if test="unitId != null and unitId != ''"><![CDATA[AND unit_id = #{unitId}]]></if> | ||
26 | + <if test="userId != null and userId != ''"><![CDATA[AND user_id = #{userId}]]></if> | ||
27 | + <if test="phone != null and phone != ''"><![CDATA[AND phone = #{phone}]]></if> | ||
28 | + <if test="expireTime != null and expireTime != ''"><![CDATA[AND expire_time = #{expireTime}]]></if> | ||
29 | + <if test="status != null and status != ''"><![CDATA[AND status = #{status}]]></if> | ||
30 | + <if test="statuses != null and statuses != ''"> | ||
31 | + <![CDATA[AND status IN ]]> | ||
32 | + <foreach collection="statuses" item="status" open="(" separator="," close=")"> | ||
33 | + <![CDATA[#{status}]]> | ||
34 | + </foreach> | ||
35 | + </if> | ||
36 | + <if test="source != null and source != ''"><![CDATA[AND source = #{source}]]></if> | ||
37 | + <if test="reason != null and reason != ''"><![CDATA[AND reason = #{reason}]]></if> | ||
38 | + <if test="ctime != null and ctime != ''"><![CDATA[AND ctime = #{ctime}]]></if> | ||
39 | + <if test="utime != null and utime != ''"><![CDATA[AND utime = #{utime}]]></if> | ||
40 | + </where> | ||
41 | + </sql> | ||
42 | + | ||
43 | + <!-- 智能排序与分页 --> | ||
44 | + <sql id="QUERY_ORDER_LIMIT_CONDTION"> | ||
45 | + <if test="orderField != null and orderField != '' and orderFieldType != null and orderFieldType != ''"><![CDATA[ORDER BY ${orderField} ${orderFieldType}]]></if> | ||
46 | + <if test="startIndex != null and startIndex >= 0 and pageSize != null and pageSize > 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if> | ||
47 | + </sql> | ||
48 | + | ||
49 | + <!-- 更新列字段,只要不为NULL则更新,除开主键列 --> | ||
50 | + <sql id="UPDATE_COLUMN_SET"> | ||
51 | + <set> | ||
52 | + <if test="categoryId != null"><![CDATA[category_id = #{categoryId},]]></if> | ||
53 | + <if test="title != null"><![CDATA[title = #{title},]]></if> | ||
54 | + <if test="userName != null"><![CDATA[user_name = #{userName},]]></if> | ||
55 | + <if test="localityAreaId != null"><![CDATA[locality_area_id = #{localityAreaId},]]></if> | ||
56 | + <if test="producingAreaId != null"><![CDATA[producing_area_id = #{producingAreaId},]]></if> | ||
57 | + <if test="price != null"><![CDATA[price = #{price},]]></if> | ||
58 | + <if test="count != null"><![CDATA[`count` = #{count},]]></if> | ||
59 | + <if test="unitId != null"><![CDATA[unit_id = #{unitId},]]></if> | ||
60 | + <if test="userId != null"><![CDATA[user_id = #{userId},]]></if> | ||
61 | + <if test="phone != null"><![CDATA[phone = #{phone},]]></if> | ||
62 | + <if test="expireTime != null"><![CDATA[expire_time = #{expireTime},]]></if> | ||
63 | + <if test="status != null"><![CDATA[status = #{status},]]></if> | ||
64 | + <if test="source != null"><![CDATA[source = #{source},]]></if> | ||
65 | + <if test="reason != null"><![CDATA[reason = #{reason},]]></if> | ||
66 | + <if test="ctime != null"><![CDATA[ctime = #{ctime},]]></if> | ||
67 | + <![CDATA[ utime = now()]]> | ||
68 | + </set> | ||
69 | + </sql> | ||
70 | + | ||
71 | + <!-- 插入supply记录 --> | ||
72 | + <insert id="insertEntry" parameterType="supply" > | ||
73 | + <![CDATA[ | ||
74 | + INSERT INTO supply (id,title,user_name,category_id,locality_area_id,producing_area_id,price,`count`,unit_id,user_id,phone,expire_time,status,source,ctime) | ||
75 | + VALUES (#{id},#{title},#{userName},#{categoryId},#{localityAreaId},#{producingAreaId},#{price},#{count},#{unitId},#{userId},#{phone},#{expireTime},#{status},#{source},now()) | ||
76 | + ]]> | ||
77 | + </insert> | ||
78 | + | ||
79 | + <!-- 返回插入的编号,在事务开启状态下有效 --> | ||
80 | + <select id="lastSequence" resultType="int"><![CDATA[SELECT LAST_INSERT_ID() AS id]]></select> | ||
81 | + | ||
82 | + <!-- 删除记录,主键IN(array) --> | ||
83 | + <update id="deleteByArrayKey" parameterType="java.lang.reflect.Array" > | ||
84 | + <![CDATA[UPDATE supply SET status=-1 WHERE id IN]]> | ||
85 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
86 | + <![CDATA[#{id}]]> | ||
87 | + </foreach> | ||
88 | + </update> | ||
89 | + | ||
90 | + <!-- 删除,通过条件 --> | ||
91 | + <update id="deleteByCondtion" parameterType="supply" > | ||
92 | + <![CDATA[DELETE FROM supply]]> | ||
93 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
94 | + </update> | ||
95 | + | ||
96 | + <!-- 修改记录通过主键 --> | ||
97 | + <update id="updateByKey" parameterType="supply" > | ||
98 | + <![CDATA[UPDATE supply]]> | ||
99 | + <include refid="UPDATE_COLUMN_SET"/> | ||
100 | + <![CDATA[WHERE id = #{id}]]> | ||
101 | + </update> | ||
102 | + | ||
103 | + <!-- 查询,通过主键IN(array) --> | ||
104 | + <select id="selectEntryArray" parameterType="java.lang.reflect.Array" resultType="supply"> | ||
105 | + <![CDATA[SELECT]]> | ||
106 | + <include refid="QUERY_COLUMN_LIST"/> | ||
107 | + <include refid="QUERY_FROM_TABLE"/> | ||
108 | + <![CDATA[WHERE id IN]]> | ||
109 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
110 | + <![CDATA[#{id}]]> | ||
111 | + </foreach> | ||
112 | + </select> | ||
113 | + | ||
114 | + <!-- 查询,通过条件 --> | ||
115 | + <select id="selectEntryList" parameterType="supply" resultType="supply"> | ||
116 | + <![CDATA[SELECT]]> | ||
117 | + <include refid="QUERY_COLUMN_LIST"/> | ||
118 | + <include refid="QUERY_FROM_TABLE"/> | ||
119 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
120 | + <include refid="QUERY_ORDER_LIMIT_CONDTION"/> | ||
121 | + </select> | ||
122 | + | ||
123 | + <!-- 总数查询,通过条件 --> | ||
124 | + <select id="selectEntryListCount" parameterType="supply" resultType="int"> | ||
125 | + <![CDATA[SELECT COUNT(id) AS dataCount]]> | ||
126 | + <include refid="QUERY_FROM_TABLE"/> | ||
127 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
128 | + </select> | ||
129 | + | ||
130 | + <!-- 其它SQL语句 --> | ||
131 | + <update id="updatePhone" parameterType="java.util.Map" > | ||
132 | + <![CDATA[UPDATE supply SET phone={#phone} WHERE user_id = #{userId}]]> | ||
133 | + </update> | ||
134 | + | ||
135 | +</mapper> | ||
0 | \ No newline at end of file | 136 | \ No newline at end of file |
titan-cache/src/main/resources/sqlmap/sqlmap-config.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE configuration PUBLIC "-//ibatis.apache.org//DTD Config 3.0//EN" "http://ibatis.apache.org/dtd/ibatis-3-config.dtd"> | ||
3 | + | ||
4 | +<configuration> | ||
5 | + <settings> | ||
6 | + <setting name="cacheEnabled" value="true" /> | ||
7 | + <setting name="multipleResultSetsEnabled" value="true" /> | ||
8 | + <setting name="useColumnLabel" value="true" /> | ||
9 | + <setting name="defaultStatementTimeout" value="25000" /> | ||
10 | + </settings> | ||
11 | + | ||
12 | + <typeAliases> | ||
13 | + <typeAlias type="com.dili.titan.domain.Category" alias="category" /> | ||
14 | + <typeAlias type="com.dili.titan.domain.CategoryAttr" alias="categoryAttr" /> | ||
15 | + <typeAlias type="com.dili.titan.domain.Attribute" alias="attribute" /> | ||
16 | + <typeAlias type="com.dili.titan.domain.AttributeValue" alias="attributeValue" /> | ||
17 | + <!--供求需求--> | ||
18 | + <typeAlias type="com.dili.titan.domain.gq.Purchase" alias="purchase" /> | ||
19 | + <typeAlias type="com.dili.titan.domain.gq.Supply" alias="supply" /> | ||
20 | + <typeAlias type="com.dili.titan.domain.gq.Presale" alias="presale" /> | ||
21 | + | ||
22 | + | ||
23 | + <typeAlias type="com.dili.titan.domain.ProductImg" alias="productImg" /> | ||
24 | + <typeAlias type="com.dili.titan.domain.ProductPop" alias="productPop" /> | ||
25 | + </typeAliases> | ||
26 | + | ||
27 | + <mappers> | ||
28 | + <mapper resource="sqlmap/Attribute.xml" /> | ||
29 | + <mapper resource="sqlmap/Category.xml" /> | ||
30 | + <!--供求需求--> | ||
31 | + <mapper resource="sqlmap/gq/Purchase.xml"/> | ||
32 | + <mapper resource="sqlmap/gq/Presale.xml"/> | ||
33 | + <mapper resource="sqlmap/gq/Supply.xml"/> | ||
34 | + <mapper resource="sqlmap/ProductImg.xml" /> | ||
35 | + <mapper resource="sqlmap/ProductPop.xml" /> | ||
36 | + </mappers> | ||
37 | + | ||
38 | +</configuration> | ||
0 | \ No newline at end of file | 39 | \ No newline at end of file |
titan-cache/src/main/webapp/WEB-INF/web.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" | ||
3 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | ||
4 | + id="WebApp_ID" version="2.5"> | ||
5 | + | ||
6 | + <display-name>titan-sync</display-name> | ||
7 | + <servlet> | ||
8 | + <servlet-name>springmvc</servlet-name> | ||
9 | + <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> | ||
10 | + <init-param> | ||
11 | + <param-name>contextConfigLocation</param-name> | ||
12 | + <param-value>classpath:spring-config.xml</param-value> | ||
13 | + </init-param> | ||
14 | + <load-on-startup>1</load-on-startup> | ||
15 | + </servlet> | ||
16 | + <servlet-mapping> | ||
17 | + <servlet-name>springmvc</servlet-name> | ||
18 | + <url-pattern>/*</url-pattern> | ||
19 | + </servlet-mapping> | ||
20 | + | ||
21 | + <filter> | ||
22 | + <filter-name>EncodingFilter</filter-name> | ||
23 | + <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> | ||
24 | + <init-param> | ||
25 | + <param-name>encoding</param-name> | ||
26 | + <param-value>UTF-8</param-value> | ||
27 | + </init-param> | ||
28 | + </filter> | ||
29 | + <filter> | ||
30 | + <filter-name>HiddenHttpMethodFilter</filter-name> | ||
31 | + <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class> | ||
32 | + </filter> | ||
33 | + <filter-mapping> | ||
34 | + <filter-name>EncodingFilter</filter-name> | ||
35 | + <servlet-name>springmvc</servlet-name> | ||
36 | + </filter-mapping> | ||
37 | + <filter-mapping> | ||
38 | + <filter-name>HiddenHttpMethodFilter</filter-name> | ||
39 | + <servlet-name>springmvc</servlet-name> | ||
40 | + </filter-mapping> | ||
41 | +</web-app> | ||
0 | \ No newline at end of file | 42 | \ No newline at end of file |
titan-cache/src/main/webapp/index.html
0 → 100644
titan-cache/src/test/java/com/dili/titan/worker/TestMessageListener.java
0 → 100644
1 | +package com.dili.titan.worker; | ||
2 | + | ||
3 | +import org.junit.Test; | ||
4 | +import org.junit.runner.RunWith; | ||
5 | +import org.springframework.test.context.ContextConfiguration; | ||
6 | +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||
7 | + | ||
8 | +@RunWith(SpringJUnit4ClassRunner.class) | ||
9 | +@ContextConfiguration(locations = "classpath*:spring-config.xml") | ||
10 | +public class TestMessageListener { | ||
11 | + | ||
12 | + @Test | ||
13 | + public void start() { | ||
14 | + while (true) { | ||
15 | + | ||
16 | + } | ||
17 | + } | ||
18 | +} |
titan-cache/src/test/java/com/dili/titan/worker/TestSender.java
0 → 100644
1 | +package com.dili.titan.worker; | ||
2 | + | ||
3 | +import com.dili.titan.mq.sender.TopicProducer; | ||
4 | +import org.junit.Test; | ||
5 | +import org.junit.runner.RunWith; | ||
6 | +import org.springframework.test.context.ContextConfiguration; | ||
7 | +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||
8 | + | ||
9 | +import javax.annotation.Resource; | ||
10 | + | ||
11 | +@RunWith(SpringJUnit4ClassRunner.class) | ||
12 | +@ContextConfiguration(locations = "classpath*:spring-config.xml") | ||
13 | +public class TestSender { | ||
14 | + | ||
15 | + @Resource(name = "topicProducer") | ||
16 | + private TopicProducer sender; | ||
17 | + | ||
18 | + @Test | ||
19 | + public void test() { | ||
20 | + sender.send("Titan.Product", "{test}"); | ||
21 | + } | ||
22 | +} |