Commit b7cb7cb727d2ca43435da8e8a225b807e7972e1c
1 parent
80bc4477
ini
Showing
63 changed files
with
4789 additions
and
0 deletions
Too many changes to show.
To preserve performance only 63 of 67 files are displayed.
titan-worker/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/maven-v4_0_0.xsd"> | ||
3 | + <modelVersion>4.0.0</modelVersion> | ||
4 | + <groupId>com.dili.titan</groupId> | ||
5 | + <artifactId>titan-worker</artifactId> | ||
6 | + <packaging>war</packaging> | ||
7 | + <version>1.0.0</version> | ||
8 | + <name>worker Maven Webapp</name> | ||
9 | + <url>http://maven.apache.org</url> | ||
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 | + <dili_titan.log.level>INFO</dili_titan.log.level> | ||
28 | + <dili_titan.log.path>/export/logs</dili_titan.log.path> | ||
29 | + <dili_titan.log.root.appender>CONSOLE</dili_titan.log.root.appender> | ||
30 | + <!-- website接口地址 --> | ||
31 | + <dili_titan.website.url>manweb.1n4j.com</dili_titan.website.url> | ||
32 | + <!-- MQ 地址--> | ||
33 | + <conf.mq.namesrvAddr>10.28.10.209:9876;10.28.10.149:9876</conf.mq.namesrvAddr> | ||
34 | + <conf.mq.producerGroup>titanPNR</conf.mq.producerGroup> | ||
35 | + <!--爱奇艺视频 --> | ||
36 | + <titan.aqy.appkey>e64a09bece964bb484e5decc30c0b950</titan.aqy.appkey> | ||
37 | + <titan.aqy.appSecret>f48d2b799f9661acdb6041e4ac7c142f</titan.aqy.appSecret> | ||
38 | + </properties> | ||
39 | + </profile> | ||
40 | + | ||
41 | + <profile> | ||
42 | + <id>test</id> | ||
43 | + <activation> | ||
44 | + <activeByDefault>false</activeByDefault> | ||
45 | + </activation> | ||
46 | + <properties> | ||
47 | + <titan.jdbc.datasource.type>dbcp</titan.jdbc.datasource.type> | ||
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 | + <!-- website接口地址 --> | ||
57 | + <dili_titan.website.url>manweb.1n4j.com</dili_titan.website.url> | ||
58 | + <!-- MQ 地址--> | ||
59 | + <conf.mq.namesrvAddr>10.28.10.230:9876</conf.mq.namesrvAddr> | ||
60 | + <conf.mq.producerGroup>titanPNR</conf.mq.producerGroup> | ||
61 | + <!--爱奇艺视频 --> | ||
62 | + <titan.aqy.appkey>e64a09bece964bb484e5decc30c0b950</titan.aqy.appkey> | ||
63 | + <titan.aqy.appSecret>f48d2b799f9661acdb6041e4ac7c142f</titan.aqy.appSecret> | ||
64 | + </properties> | ||
65 | + </profile> | ||
66 | + | ||
67 | + <profile> | ||
68 | + <id>online</id> | ||
69 | + <activation> | ||
70 | + <activeByDefault>false</activeByDefault> | ||
71 | + </activation> | ||
72 | + <properties> | ||
73 | + <titan.jdbc.datasource.type>dbcp</titan.jdbc.datasource.type> | ||
74 | + <titan.jdbc.driver>com.mysql.jdbc.Driver</titan.jdbc.driver> | ||
75 | + <titan.jdbc.url>jdbc:MySql://titan.db.1n4j.com:3306/agriez_titan?useUnicode=true&characterEncoding=utf8</titan.jdbc.url> | ||
76 | + <titan.jdbc.username>appAccPayor</titan.jdbc.username> | ||
77 | + <titan.jdbc.password>iTDYVBtI6MX4NQ3Er2Oh</titan.jdbc.password> | ||
78 | + <dili_titan.log.level>INFO</dili_titan.log.level> | ||
79 | + <dili_titan.log.path>/diliapp/servers/logs</dili_titan.log.path> | ||
80 | + <dili_titan.log.root.appender>FILE_ALL</dili_titan.log.root.appender> | ||
81 | + <!-- website接口地址 --> | ||
82 | + <dili_titan.website.url>manweb.1n4j.com</dili_titan.website.url> | ||
83 | + <!-- MQ 地址--> | ||
84 | + <conf.mq.namesrvAddr>192.168.60.62:9876;192.168.60.63:9876</conf.mq.namesrvAddr> | ||
85 | + <conf.mq.producerGroup>titanPNR</conf.mq.producerGroup> | ||
86 | + <!--爱奇艺视频 --> | ||
87 | + <titan.aqy.appkey>f689d13d9dce48039cae27e6e03940c6</titan.aqy.appkey> | ||
88 | + <titan.aqy.appSecret>8633dfebb9f4443d0f1244262bca94f6</titan.aqy.appSecret> | ||
89 | + </properties> | ||
90 | + </profile> | ||
91 | + | ||
92 | + <profile> | ||
93 | + <id>pnr-clone</id> | ||
94 | + <activation> | ||
95 | + <activeByDefault>false</activeByDefault> | ||
96 | + </activation> | ||
97 | + <properties> | ||
98 | + <titan.jdbc.datasource.type>dbcp</titan.jdbc.datasource.type> | ||
99 | + <titan.jdbc.driver>com.mysql.jdbc.Driver</titan.jdbc.driver> | ||
100 | + <titan.jdbc.url>jdbc:MySql://10.28.5.236:3306/titan?useUnicode=true&characterEncoding=utf8</titan.jdbc.url> | ||
101 | + <titan.jdbc.username>root</titan.jdbc.username> | ||
102 | + <titan.jdbc.password>123456</titan.jdbc.password> | ||
103 | + <dili_titan.log.level>INFO</dili_titan.log.level> | ||
104 | + <dili_titan.log.path>/home/tomcat/export</dili_titan.log.path> | ||
105 | + <dili_titan.log.root.appender>CONSOLE | ||
106 | + </dili_titan.log.root.appender> | ||
107 | + <!-- website接口地址 --> | ||
108 | + <dili_titan.website.url>manweb.1n4j.com | ||
109 | + </dili_titan.website.url> | ||
110 | + <!-- MQ 地址--> | ||
111 | + <conf.mq.namesrvAddr>10.28.5.202:9876;10.28.5.203:9876</conf.mq.namesrvAddr> | ||
112 | + <conf.mq.producerGroup>titanPNR</conf.mq.producerGroup> | ||
113 | + <!--爱奇艺视频 --> | ||
114 | + <titan.aqy.appkey>f689d13d9dce48039cae27e6e03940c6</titan.aqy.appkey> | ||
115 | + <titan.aqy.appSecret>8633dfebb9f4443d0f1244262bca94f6</titan.aqy.appSecret> | ||
116 | + </properties> | ||
117 | + </profile> | ||
118 | + </profiles> | ||
119 | + | ||
120 | + | ||
121 | + <dependencies> | ||
122 | + <dependency> | ||
123 | + <groupId>junit</groupId> | ||
124 | + <artifactId>junit</artifactId> | ||
125 | + <version>4.10</version> | ||
126 | + <scope>test</scope> | ||
127 | + </dependency> | ||
128 | + <dependency> | ||
129 | + <groupId>tomcat</groupId> | ||
130 | + <artifactId>servlet-api</artifactId> | ||
131 | + <version>5.5.23</version> | ||
132 | + <scope>test</scope> | ||
133 | + </dependency> | ||
134 | + <dependency> | ||
135 | + <groupId>org.slf4j</groupId> | ||
136 | + <artifactId>slf4j-api</artifactId> | ||
137 | + <version>1.6.4</version> | ||
138 | + </dependency> | ||
139 | + <dependency> | ||
140 | + <groupId>org.slf4j</groupId> | ||
141 | + <artifactId>slf4j-log4j12</artifactId> | ||
142 | + <version>1.6.4</version> | ||
143 | + </dependency> | ||
144 | + <dependency> | ||
145 | + <groupId>log4j</groupId> | ||
146 | + <artifactId>log4j</artifactId> | ||
147 | + <version>1.2.17</version> | ||
148 | + </dependency> | ||
149 | + <dependency> | ||
150 | + <groupId>commons-logging</groupId> | ||
151 | + <artifactId>commons-logging</artifactId> | ||
152 | + <version>1.1.3</version> | ||
153 | + </dependency> | ||
154 | + <dependency> | ||
155 | + <groupId>commons-collections</groupId> | ||
156 | + <artifactId>commons-collections</artifactId> | ||
157 | + <version>3.2.1</version> | ||
158 | + </dependency> | ||
159 | + <dependency> | ||
160 | + <groupId>org.springframework</groupId> | ||
161 | + <artifactId>spring-jdbc</artifactId> | ||
162 | + <version>${spring.version}</version> | ||
163 | + </dependency> | ||
164 | + <dependency> | ||
165 | + <groupId>org.springframework</groupId> | ||
166 | + <artifactId>spring-context-support</artifactId> | ||
167 | + <version>${spring.version}</version> | ||
168 | + </dependency> | ||
169 | + <dependency> | ||
170 | + <groupId>org.springframework</groupId> | ||
171 | + <artifactId>spring-web</artifactId> | ||
172 | + <version>${spring.version}</version> | ||
173 | + </dependency> | ||
174 | + <dependency> | ||
175 | + <groupId>org.springframework</groupId> | ||
176 | + <artifactId>spring-webmvc</artifactId> | ||
177 | + <version>${spring.version}</version> | ||
178 | + </dependency> | ||
179 | + <dependency> | ||
180 | + <groupId>org.mybatis</groupId> | ||
181 | + <artifactId>mybatis</artifactId> | ||
182 | + <version>3.2.1</version> | ||
183 | + </dependency> | ||
184 | + <dependency> | ||
185 | + <groupId>org.mybatis</groupId> | ||
186 | + <artifactId>mybatis-spring</artifactId> | ||
187 | + <version>1.2.0</version> | ||
188 | + </dependency> | ||
189 | + <dependency> | ||
190 | + <groupId>mysql</groupId> | ||
191 | + <artifactId>mysql-connector-java</artifactId> | ||
192 | + <version>5.1.30</version> | ||
193 | + </dependency> | ||
194 | + <dependency> | ||
195 | + <groupId>com.alibaba</groupId> | ||
196 | + <artifactId>druid</artifactId> | ||
197 | + <version>1.0.11</version> | ||
198 | + </dependency> | ||
199 | + <dependency> | ||
200 | + <groupId>org.springframework</groupId> | ||
201 | + <artifactId>spring-context</artifactId> | ||
202 | + <version>${spring.version}</version> | ||
203 | + </dependency> | ||
204 | + <dependency> | ||
205 | + <groupId>org.springframework</groupId> | ||
206 | + <artifactId>spring-test</artifactId> | ||
207 | + <version>${spring.version}</version> | ||
208 | + <scope>test</scope> | ||
209 | + </dependency> | ||
210 | + <!-- 数据字典 快照版--> | ||
211 | + <dependency> | ||
212 | + <groupId>com.yqyw.website.web</groupId> | ||
213 | + <artifactId>diligrp-website-api</artifactId> | ||
214 | + <version>1.0.3-SNAPSHOT</version> | ||
215 | + </dependency> | ||
216 | + <dependency> | ||
217 | + <groupId>com.diligrp.website</groupId> | ||
218 | + <artifactId>diligrp-website-util</artifactId> | ||
219 | + <version>0.0.1-SNAPSHOT</version> | ||
220 | + </dependency> | ||
221 | + <dependency> | ||
222 | + <groupId>org.apache.httpcomponents</groupId> | ||
223 | + <artifactId>httpclient</artifactId> | ||
224 | + <version>4.3.3</version> | ||
225 | + </dependency> | ||
226 | + <dependency> | ||
227 | + <groupId>com.diligrp.util.rocketMQUtil</groupId> | ||
228 | + <artifactId>diligrp-util-rocketMQUtil</artifactId> | ||
229 | + <version>0.0.1-SNAPSHOT</version> | ||
230 | + </dependency> | ||
231 | + <dependency> | ||
232 | + <groupId>com.github.kevinsawicki</groupId> | ||
233 | + <artifactId>http-request</artifactId> | ||
234 | + <version>5.6</version> | ||
235 | + </dependency> | ||
236 | + <dependency> | ||
237 | + <groupId>javax.servlet</groupId> | ||
238 | + <artifactId>servlet-api</artifactId> | ||
239 | + <version>2.4</version> | ||
240 | + <scope>provided</scope> | ||
241 | + </dependency> | ||
242 | + <dependency> | ||
243 | + <groupId>com.google.guava</groupId> | ||
244 | + <artifactId>guava</artifactId> | ||
245 | + <version>17.0</version> | ||
246 | + </dependency> | ||
247 | + </dependencies> | ||
248 | + | ||
249 | + <build> | ||
250 | + <resources> | ||
251 | + <resource> | ||
252 | + <directory>src/main/resources</directory> | ||
253 | + <filtering>true</filtering> | ||
254 | + </resource> | ||
255 | + </resources> | ||
256 | + <plugins> | ||
257 | + <plugin> | ||
258 | + <groupId>org.apache.maven.plugins</groupId> | ||
259 | + <artifactId>maven-war-plugin</artifactId> | ||
260 | + <version>2.3</version> | ||
261 | + </plugin> | ||
262 | + <plugin> | ||
263 | + <groupId>org.apache.maven.plugins</groupId> | ||
264 | + <artifactId>maven-compiler-plugin</artifactId> | ||
265 | + <version>2.5.1</version> | ||
266 | + <configuration> | ||
267 | + <source>1.6</source> | ||
268 | + <target>1.6</target> | ||
269 | + <encoding>UTF-8</encoding> | ||
270 | + </configuration> | ||
271 | + </plugin> | ||
272 | + <plugin> | ||
273 | + <groupId>org.apache.maven.plugins</groupId> | ||
274 | + <artifactId>maven-surefire-plugin</artifactId> | ||
275 | + <version>2.17</version> | ||
276 | + <configuration> | ||
277 | + <skipTests>true</skipTests> | ||
278 | + </configuration> | ||
279 | + </plugin> | ||
280 | + <plugin> | ||
281 | + <groupId>org.mortbay.jetty</groupId> | ||
282 | + <artifactId>maven-jetty-plugin</artifactId> | ||
283 | + <version>6.1.26</version> | ||
284 | + <configuration> | ||
285 | + <scanIntervalSeconds>3</scanIntervalSeconds> | ||
286 | + <contextPath>/</contextPath> | ||
287 | + <connectors> | ||
288 | + <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> | ||
289 | + <port>80</port> | ||
290 | + </connector> | ||
291 | + </connectors> | ||
292 | + </configuration> | ||
293 | + </plugin> | ||
294 | + </plugins> | ||
295 | + </build> | ||
296 | +</project> |
titan-worker/src/main/java/com/dili/titan/controller/PresaleController.java
0 → 100644
1 | +package com.dili.titan.controller; | ||
2 | + | ||
3 | +import com.dili.titan.domain.Page; | ||
4 | +import com.dili.titan.mq.TopicProducer; | ||
5 | +import com.dili.titan.service.PresaleService; | ||
6 | +import com.dili.titan.service.TimeTask; | ||
7 | +import org.apache.commons.collections.CollectionUtils; | ||
8 | +import org.slf4j.Logger; | ||
9 | +import org.slf4j.LoggerFactory; | ||
10 | +import org.springframework.stereotype.Controller; | ||
11 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
12 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
13 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
14 | + | ||
15 | +import javax.annotation.Resource; | ||
16 | +import javax.servlet.http.HttpServletRequest; | ||
17 | +import javax.servlet.http.HttpServletResponse; | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +/** | ||
21 | + * Created by gsz on 2015/6/5. | ||
22 | + */ | ||
23 | +@Controller | ||
24 | +@RequestMapping(value = "/presale", produces = "application/json; charset=UTF-8") | ||
25 | +public class PresaleController extends TimeTask { | ||
26 | + private static final Logger logger = LoggerFactory.getLogger(PresaleController.class); | ||
27 | + @Resource | ||
28 | + private PresaleService presaleService; | ||
29 | + @Resource(name = "topicProducer") | ||
30 | + private TopicProducer topicProducer;//注入MQ推送消息 | ||
31 | + | ||
32 | + @RequestMapping(method = {RequestMethod.POST, | ||
33 | + RequestMethod.GET}) | ||
34 | + public | ||
35 | + @ResponseBody | ||
36 | + String index(HttpServletRequest request, HttpServletResponse response) { | ||
37 | + logger.info("预售过期worker扫描开始"); | ||
38 | + int page=1; | ||
39 | + while (true){ | ||
40 | + Page<Long> result = presaleService.expirePresale(page); | ||
41 | + final List<Long> expireids = result.getResult(); | ||
42 | + if(CollectionUtils.isEmpty(expireids)){ | ||
43 | + break; | ||
44 | + } | ||
45 | + addTask(new Runnable() { | ||
46 | + @Override | ||
47 | + public void run() { | ||
48 | + presaleService.batchExpire(expireids); | ||
49 | + for(Long id : expireids){ | ||
50 | + topicProducer.sendMQPresale(id,2); | ||
51 | + } | ||
52 | + } | ||
53 | + }); | ||
54 | + page++; | ||
55 | + } | ||
56 | + logger.info("预售过期worker扫描结束"); | ||
57 | + return "预售过期worker扫描结束!"; | ||
58 | + } | ||
59 | +} |
titan-worker/src/main/java/com/dili/titan/controller/ProductAuthController.java
0 → 100644
1 | +package com.dili.titan.controller; | ||
2 | + | ||
3 | +import com.dili.titan.domain.ProductAuth; | ||
4 | +import com.dili.titan.mq.TopicProducer; | ||
5 | +import com.dili.titan.service.ProductAuthService; | ||
6 | +import org.apache.commons.collections.CollectionUtils; | ||
7 | +import org.slf4j.Logger; | ||
8 | +import org.slf4j.LoggerFactory; | ||
9 | +import org.springframework.stereotype.Controller; | ||
10 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
11 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
12 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
13 | + | ||
14 | +import javax.annotation.Resource; | ||
15 | +import javax.servlet.http.HttpServletRequest; | ||
16 | +import javax.servlet.http.HttpServletResponse; | ||
17 | +import java.util.List; | ||
18 | + | ||
19 | +/** | ||
20 | + * Created by gsz on 2015/6/5. | ||
21 | + */ | ||
22 | +@Controller | ||
23 | +@RequestMapping(value = "/auth", produces = "application/json; charset=UTF-8") | ||
24 | +public class ProductAuthController { | ||
25 | + private static final Logger logger = LoggerFactory.getLogger(ProductAuthController.class); | ||
26 | + @Resource | ||
27 | + private ProductAuthService productAuthService; | ||
28 | + @Resource(name = "topicProducer") | ||
29 | + private TopicProducer topicProducer;//注入MQ推送消息 | ||
30 | + | ||
31 | + | ||
32 | + @RequestMapping(method = {RequestMethod.POST, | ||
33 | + RequestMethod.GET}) | ||
34 | + public | ||
35 | + @ResponseBody | ||
36 | + String index(HttpServletRequest request, HttpServletResponse response) { | ||
37 | + logger.info("商品认证扫描开始!"); | ||
38 | + List<ProductAuth> paList = productAuthService.selectInvalidAuthData(); | ||
39 | + if (CollectionUtils.isEmpty(paList)) { | ||
40 | + logger.info("商品认证扫描结束!"); | ||
41 | + return "商品认证扫描结束!"; | ||
42 | + } | ||
43 | + int result = productAuthService.updateProductAuth(paList); | ||
44 | + if (result <= 0) { | ||
45 | + logger.info("商品认证扫描结束!"); | ||
46 | + return "商品认证扫描结束!"; | ||
47 | + } | ||
48 | + for (ProductAuth pa : paList) { | ||
49 | + //发送mq消息或直接清除redis缓存 | ||
50 | + topicProducer.sendMQProduct(pa.getPid(), 2, 4); | ||
51 | + } | ||
52 | + logger.info("商品认证扫描结束!"); | ||
53 | + return "商品认证扫描结束!"; | ||
54 | + } | ||
55 | +} |
titan-worker/src/main/java/com/dili/titan/controller/ProductPopController.java
0 → 100644
1 | +package com.dili.titan.controller; | ||
2 | + | ||
3 | +import com.dili.titan.domain.ProductPop; | ||
4 | +import com.dili.titan.mq.TopicProducer; | ||
5 | +import com.dili.titan.rpc.ConfigRPC; | ||
6 | +import com.dili.titan.service.ProductPopService; | ||
7 | +import com.dili.titan.service.TimeTask; | ||
8 | +import com.diligrp.website.web.interfaces.domain.output.DataDictionaryValueResp; | ||
9 | +import org.apache.commons.collections.CollectionUtils; | ||
10 | +import org.slf4j.Logger; | ||
11 | +import org.slf4j.LoggerFactory; | ||
12 | +import org.springframework.stereotype.Controller; | ||
13 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
14 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
15 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
16 | + | ||
17 | +import javax.annotation.Resource; | ||
18 | +import javax.servlet.http.HttpServletRequest; | ||
19 | +import javax.servlet.http.HttpServletResponse; | ||
20 | +import java.util.*; | ||
21 | + | ||
22 | +/** | ||
23 | + * Created by gsz on 2015/6/5. | ||
24 | + */ | ||
25 | +@Controller | ||
26 | +@RequestMapping(value = "/pop", produces = "application/json; charset=UTF-8") | ||
27 | +public class ProductPopController extends TimeTask { | ||
28 | + private static final Logger logger = LoggerFactory.getLogger(ProductPopController.class); | ||
29 | + @Resource(name = "productPopService") | ||
30 | + private ProductPopService productPopService; | ||
31 | + @Resource(name = "configRPC") | ||
32 | + private ConfigRPC configRPC; | ||
33 | + @Resource(name = "topicProducer") | ||
34 | + private TopicProducer topicProducer;//注入MQ推送消息 | ||
35 | + | ||
36 | + @RequestMapping(method = {RequestMethod.POST, | ||
37 | + RequestMethod.GET}) | ||
38 | + public | ||
39 | + @ResponseBody | ||
40 | + String index(HttpServletRequest request, HttpServletResponse response) { | ||
41 | + long start = System.currentTimeMillis(); | ||
42 | + logger.info("第三方商品上下架扫描开始"); | ||
43 | + final Map<Long, DataDictionaryValueResp> inDates = configRPC.getInDate(); | ||
44 | + int page = 1; | ||
45 | + while (true) { | ||
46 | + final List<ProductPop> list = productPopService.findUnsolved(page).getResult(); | ||
47 | + if (CollectionUtils.isEmpty(list)) { | ||
48 | + break; | ||
49 | + } | ||
50 | + addTask(new Runnable() { | ||
51 | + @Override | ||
52 | + public void run() { | ||
53 | + scanProduct(list,inDates); | ||
54 | + } | ||
55 | + }); | ||
56 | + page++; | ||
57 | + } | ||
58 | + logger.info("第三方商品上扫描结束!耗时:" + (System.currentTimeMillis() - start)); | ||
59 | + return "第三方商品上下架成功!"; | ||
60 | + } | ||
61 | + | ||
62 | + private void scanProduct(List<ProductPop> list,Map<Long, DataDictionaryValueResp> inDates) { | ||
63 | + for (final ProductPop product : list) { | ||
64 | + if (product.getStatus() == 3) { | ||
65 | + drop(product,inDates); | ||
66 | + } else if (product.getStatus() == 5 && product.getPublishMode() == 3) { | ||
67 | + pulish(product); | ||
68 | + } | ||
69 | + } | ||
70 | + } | ||
71 | + | ||
72 | + private void pulish(ProductPop product) { | ||
73 | + Calendar c = Calendar.getInstance(); | ||
74 | + c.setTime(product.getPublishSettime()); | ||
75 | + c.set(Calendar.SECOND, 0); | ||
76 | + Date setTime = c.getTime(); | ||
77 | + Date now = Calendar.getInstance().getTime(); | ||
78 | + if (setTime.before(now)) { | ||
79 | + ProductPop p = new ProductPop(); | ||
80 | + p.setPid(product.getPid()); | ||
81 | + p.setStatus(3); | ||
82 | + p.setPublishMode(2); | ||
83 | + p.setPublishTime(now); | ||
84 | + p.setUtime(now); | ||
85 | + | ||
86 | + int result = productPopService.publish(p); | ||
87 | + if (result > 0) { | ||
88 | + topicProducer.sendMQProduct(p.getPid(), 2, 7); | ||
89 | + } | ||
90 | + } | ||
91 | + } | ||
92 | + | ||
93 | + private void drop(ProductPop product,Map<Long, DataDictionaryValueResp> indates) { | ||
94 | + Calendar c = Calendar.getInstance(); | ||
95 | + Date publishTime = product.getPublishTime(); | ||
96 | + if (null != publishTime) { | ||
97 | + c.setTime(publishTime); | ||
98 | + } | ||
99 | + c.set(Calendar.SECOND, 0); | ||
100 | + DataDictionaryValueResp indateRes = indates.get(product.getIndate().longValue()) ; | ||
101 | + if(indateRes==null){ | ||
102 | + logger.error("没有获取到有效期!有效期ID="+product.getIndate()); | ||
103 | + return; | ||
104 | + } | ||
105 | + String inDate = indateRes.getName(); | ||
106 | + if (inDate != null) { | ||
107 | + c.add(Calendar.DAY_OF_YEAR, Integer.parseInt(inDate)); | ||
108 | + Date dropTime = c.getTime(); | ||
109 | + Date now = Calendar.getInstance().getTime(); | ||
110 | + if (dropTime.before(now)) { | ||
111 | + ProductPop p = new ProductPop(); | ||
112 | + p.setPid(product.getPid()); | ||
113 | + p.setStatus(6); | ||
114 | + p.setPublishMode(1); | ||
115 | + p.setDropsTime(now); | ||
116 | + p.setUtime(now); | ||
117 | + | ||
118 | + int result = productPopService.drop(p); | ||
119 | + if (result > 0) { | ||
120 | + topicProducer.sendMQProduct(p.getPid(), 2, 7); | ||
121 | + } | ||
122 | + } | ||
123 | + } | ||
124 | + } | ||
125 | + | ||
126 | + | ||
127 | +} |
titan-worker/src/main/java/com/dili/titan/controller/PurchaseController.java
0 → 100644
1 | +package com.dili.titan.controller; | ||
2 | + | ||
3 | +import com.dili.titan.domain.Page; | ||
4 | +import com.dili.titan.mq.TopicProducer; | ||
5 | +import com.dili.titan.service.PurchaseService; | ||
6 | +import com.dili.titan.service.TimeTask; | ||
7 | +import org.apache.commons.collections.CollectionUtils; | ||
8 | +import org.slf4j.Logger; | ||
9 | +import org.slf4j.LoggerFactory; | ||
10 | +import org.springframework.stereotype.Controller; | ||
11 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
12 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
13 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
14 | + | ||
15 | +import javax.annotation.Resource; | ||
16 | +import javax.servlet.http.HttpServletRequest; | ||
17 | +import javax.servlet.http.HttpServletResponse; | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +/** | ||
21 | + * Created by gsz on 2015/6/5. | ||
22 | + */ | ||
23 | +@Controller | ||
24 | +@RequestMapping(value = "/purchase", produces = "application/json; charset=UTF-8") | ||
25 | +public class PurchaseController extends TimeTask { | ||
26 | + private static final Logger logger = LoggerFactory.getLogger(PurchaseController.class); | ||
27 | + @Resource | ||
28 | + PurchaseService purchaseService; | ||
29 | + @Resource | ||
30 | + private TopicProducer topicProducer;// 注入MQ推送消息 | ||
31 | + | ||
32 | + | ||
33 | + @RequestMapping(method = {RequestMethod.POST, | ||
34 | + RequestMethod.GET}) | ||
35 | + public | ||
36 | + @ResponseBody | ||
37 | + String index(HttpServletRequest request, HttpServletResponse response) { | ||
38 | + logger.info("求购过期worker扫描开始"); | ||
39 | + int page=1; | ||
40 | + while (true){ | ||
41 | + Page<Long> result = purchaseService.expirePurchase(page); | ||
42 | + final List<Long> expireids = result.getResult(); | ||
43 | + if(CollectionUtils.isEmpty(expireids)){ | ||
44 | + break; | ||
45 | + } | ||
46 | + addTask(new Runnable() { | ||
47 | + @Override | ||
48 | + public void run() { | ||
49 | + purchaseService.batchExpire(expireids); | ||
50 | + for(Long id : expireids){ | ||
51 | + topicProducer.sendMQPurchase(id, 2); | ||
52 | + } | ||
53 | + } | ||
54 | + }); | ||
55 | + page++; | ||
56 | + } | ||
57 | + logger.info("求购过期worker扫描结束"); | ||
58 | + return "求购过期worker扫描结束!"; | ||
59 | + } | ||
60 | +} |
titan-worker/src/main/java/com/dili/titan/controller/SupplyController.java
0 → 100644
1 | +package com.dili.titan.controller; | ||
2 | + | ||
3 | +import com.dili.titan.domain.Page; | ||
4 | +import com.dili.titan.mq.TopicProducer; | ||
5 | +import com.dili.titan.service.PurchaseService; | ||
6 | +import com.dili.titan.service.SupplyService; | ||
7 | +import com.dili.titan.service.TimeTask; | ||
8 | +import org.apache.commons.collections.CollectionUtils; | ||
9 | +import org.slf4j.Logger; | ||
10 | +import org.slf4j.LoggerFactory; | ||
11 | +import org.springframework.stereotype.Controller; | ||
12 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
13 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
14 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
15 | + | ||
16 | +import javax.annotation.Resource; | ||
17 | +import javax.servlet.http.HttpServletRequest; | ||
18 | +import javax.servlet.http.HttpServletResponse; | ||
19 | +import java.util.List; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by gsz on 2015/6/5. | ||
23 | + */ | ||
24 | +@Controller | ||
25 | +@RequestMapping(value = "/supply", produces = "application/json; charset=UTF-8") | ||
26 | +public class SupplyController extends TimeTask { | ||
27 | + private static final Logger logger = LoggerFactory.getLogger(SupplyController.class); | ||
28 | + @Resource | ||
29 | + SupplyService supplyService; | ||
30 | + @Resource | ||
31 | + private TopicProducer topicProducer;// 注入MQ推送消息 | ||
32 | + | ||
33 | + | ||
34 | + @RequestMapping(method = {RequestMethod.POST, | ||
35 | + RequestMethod.GET}) | ||
36 | + public | ||
37 | + @ResponseBody | ||
38 | + String index(HttpServletRequest request, HttpServletResponse response) { | ||
39 | + logger.info("供应过期worker扫描开始"); | ||
40 | + int page=1; | ||
41 | + while (true){ | ||
42 | + Page<Long> result = supplyService.expireSupply(page); | ||
43 | + final List<Long> expireids = result.getResult(); | ||
44 | + if(CollectionUtils.isEmpty(expireids)){ | ||
45 | + break; | ||
46 | + } | ||
47 | + addTask(new Runnable() { | ||
48 | + @Override | ||
49 | + public void run() { | ||
50 | + supplyService.batchExpire(expireids); | ||
51 | + for(Long id : expireids){ | ||
52 | + topicProducer.sendMQSupply(id,2); | ||
53 | + } | ||
54 | + } | ||
55 | + }); | ||
56 | + page++; | ||
57 | + } | ||
58 | + logger.info("供应过期worker扫描结束"); | ||
59 | + return "供应过期worker扫描结束!"; | ||
60 | + } | ||
61 | +} |
titan-worker/src/main/java/com/dili/titan/controller/VideoController.java
0 → 100644
1 | +package com.dili.titan.controller; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSON; | ||
4 | +import com.alibaba.fastjson.JSONObject; | ||
5 | +import com.dili.titan.domain.Video; | ||
6 | +import com.dili.titan.mq.TopicProducer; | ||
7 | +import com.dili.titan.service.VideoService; | ||
8 | +import com.github.kevinsawicki.http.HttpRequest; | ||
9 | +import org.apache.commons.collections.CollectionUtils; | ||
10 | +import org.slf4j.Logger; | ||
11 | +import org.slf4j.LoggerFactory; | ||
12 | +import org.springframework.beans.factory.annotation.Value; | ||
13 | +import org.springframework.stereotype.Controller; | ||
14 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
15 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
16 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
17 | + | ||
18 | +import javax.annotation.Resource; | ||
19 | +import javax.servlet.http.HttpServletRequest; | ||
20 | +import javax.servlet.http.HttpServletResponse; | ||
21 | +import java.util.ArrayList; | ||
22 | +import java.util.List; | ||
23 | + | ||
24 | +/** | ||
25 | + * Created by gsz on 2015/6/5. | ||
26 | + */ | ||
27 | +@Controller | ||
28 | +@RequestMapping(value = "/video", produces = "application/json; charset=UTF-8") | ||
29 | +public class VideoController { | ||
30 | + private static final Logger logger = LoggerFactory.getLogger(VideoController.class); | ||
31 | + @Resource | ||
32 | + VideoService videoService; | ||
33 | + @Value("${appKey}") | ||
34 | + String appKey; | ||
35 | + @Value("${appSecret}") | ||
36 | + String appSecret; | ||
37 | + @Resource(name="topicProducer") | ||
38 | + private TopicProducer topicProducer;//注入MQ推送消息 | ||
39 | + | ||
40 | + | ||
41 | + @RequestMapping(method = {RequestMethod.POST, | ||
42 | + RequestMethod.GET}) | ||
43 | + public | ||
44 | + @ResponseBody | ||
45 | + String index(HttpServletRequest request, HttpServletResponse response) { | ||
46 | + logger.info("视频扫描开始"); | ||
47 | + Video video = new Video(); | ||
48 | + | ||
49 | + video.setAqyStatus(Video.STATUS_AUDIT_COMPLETE_BOTH); | ||
50 | + List<Video> dbVideoList = videoService.selectList(video); | ||
51 | + if(CollectionUtils.isEmpty(dbVideoList)){ | ||
52 | + logger.info("视频扫描结束"); | ||
53 | + return "视频扫描结束!"; | ||
54 | + } | ||
55 | + //从爱奇艺获取对应的视频信息 | ||
56 | + List<Video> listInfo = this.getVideoInfo(this.accesstoken(),dbVideoList); | ||
57 | + for(Video vo : listInfo) { | ||
58 | + if (vo.getStatus() == null) { | ||
59 | + continue; | ||
60 | + } | ||
61 | + videoService.updateByfileId(vo); | ||
62 | + if (Video.STATUS_AUDIT_REFUSE == vo.getStatus()) { | ||
63 | + List<Long> pids = videoService.findPidsByVideoId(vo.getId()); | ||
64 | + if (CollectionUtils.isNotEmpty(pids)) { | ||
65 | + for (Long pid : pids) { | ||
66 | + topicProducer.sendMQProduct(pid, 2,7); | ||
67 | + } | ||
68 | + } | ||
69 | + } | ||
70 | + } | ||
71 | + logger.info("视频扫描结束"); | ||
72 | + return "视频扫描结束!"; | ||
73 | + } | ||
74 | + | ||
75 | + /** | ||
76 | + * this method is 授权 | ||
77 | + * @return | ||
78 | + * @createTime 2015年1月5日 下午4:26:09 | ||
79 | + * @author yangwd | ||
80 | + */ | ||
81 | + public String accesstoken(){ | ||
82 | + String url = "https://openapi.iqiyi.com/api/iqiyi/authorize?client_id="+appKey+"&client_secret="+appSecret; | ||
83 | + HttpRequest request = HttpRequest.get(url); | ||
84 | + //针对单项证书给予忽略(注意,双向证书需要导入证书文件) | ||
85 | + request.trustAllCerts(); | ||
86 | + //信任所有地址 | ||
87 | + request.trustAllHosts(); | ||
88 | + String response = request.body(); | ||
89 | + JSONObject jo = JSON.parseObject(response); | ||
90 | + Object accessToken = jo.getJSONObject("data").get("access_token"); | ||
91 | + return accessToken.toString(); | ||
92 | + } | ||
93 | + | ||
94 | + /** | ||
95 | + * this method is 获取视频信息 | ||
96 | + * @param accessToken | ||
97 | + * @return | ||
98 | + * @createTime 2015年1月5日 下午4:26:01 | ||
99 | + * @author yangwd | ||
100 | + */ | ||
101 | + public List<Video> getVideoInfo(String accessToken,List<Video> dbVideoList){ | ||
102 | + //单个检查视频文件状态信息 | ||
103 | + List<Video> listVideo = new ArrayList<Video>(); | ||
104 | + StringBuffer fileIds = new StringBuffer(); | ||
105 | + HttpRequest requestCheckState =null; | ||
106 | + for(int i = dbVideoList.size()-1;i>=0;i--){ | ||
107 | + Video vo = dbVideoList.get(i); | ||
108 | + String checkStateUrl = "http://openapi.iqiyi.com/api/file/fullStatus?access_token="+accessToken+"&file_id="+vo.getFileId(); | ||
109 | + requestCheckState = HttpRequest.get(checkStateUrl); | ||
110 | + String response = requestCheckState.body(); | ||
111 | + JSONObject jResult = JSON.parseObject(response); | ||
112 | + String codeState = jResult.getString("code"); | ||
113 | + JSONObject data = jResult.getJSONObject("data"); | ||
114 | + if("A00000".equals(codeState)){ //视频处理完成 | ||
115 | + if(vo.getAqyStatus()== Video.STATUS_AUDIT_COMPLETE){ | ||
116 | + dbVideoList.remove(i); | ||
117 | + continue; | ||
118 | + } | ||
119 | + fileIds.append(vo.getFileId()+","); | ||
120 | + vo.setPageUrl(data.getString("swfurl")); | ||
121 | + vo.setStatus(Video.STATUS_AUDIT); | ||
122 | + vo.setAqyStatus(Video.STATUS_AUDIT_COMPLETE); | ||
123 | + vo.setImg(data.getString("img")); | ||
124 | + listVideo.add(vo); | ||
125 | + }else if((!"A00001".equals(codeState) && !"A00004".equals(codeState) ) || "A00002".equals(codeState)){ //A00001 视频发布中 | ||
126 | + if(vo.getAqyStatus()== Video.STATUS_AUDIT_REFUSE){ | ||
127 | + dbVideoList.remove(i); | ||
128 | + continue; | ||
129 | + } | ||
130 | + vo.setStatus(Video.STATUS_AUDIT_REFUSE); | ||
131 | + vo.setAqyStatus(Video.STATUS_AUDIT_REFUSE); | ||
132 | + if("A00002".equals(codeState)){ | ||
133 | + vo.setReason("视频审核失败"); | ||
134 | + }else{ | ||
135 | + logger.error("定时器向爱奇艺获取视频状态时,fileId="+vo.getFileId()+"的视频状态返回码"+codeState); | ||
136 | + } | ||
137 | + if("A00003".equals(codeState)){ | ||
138 | + vo.setReason("视频不存在"); | ||
139 | + } | ||
140 | + | ||
141 | + if("Q00001".equals(codeState)){ | ||
142 | + vo.setReason("视频处理失败"); | ||
143 | + } | ||
144 | + | ||
145 | + if("A00006".equals(codeState)){ | ||
146 | + vo.setReason("用户取消上传"); | ||
147 | + } | ||
148 | + | ||
149 | + if("A00007".equals(codeState)){ | ||
150 | + vo.setReason("视频发布失败"); | ||
151 | + } | ||
152 | + | ||
153 | + listVideo.add(vo); | ||
154 | + } | ||
155 | + } | ||
156 | + return listVideo; | ||
157 | + } | ||
158 | + | ||
159 | + public String getAppKey() { | ||
160 | + return appKey; | ||
161 | + } | ||
162 | + | ||
163 | + public void setAppKey(String appKey) { | ||
164 | + this.appKey = appKey; | ||
165 | + } | ||
166 | + | ||
167 | + public String getAppSecret() { | ||
168 | + return appSecret; | ||
169 | + } | ||
170 | + | ||
171 | + public void setAppSecret(String appSecret) { | ||
172 | + this.appSecret = appSecret; | ||
173 | + } | ||
174 | +} |
titan-worker/src/main/java/com/dili/titan/dao/PresaleDao.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 com.dili.titan.dao.base.BaseDao; | ||
9 | +import com.dili.titan.domain.Presale; | ||
10 | +import com.dili.titan.domain.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 | + * 批量设置过期 | ||
24 | + * @param ids | ||
25 | + * @return | ||
26 | + */ | ||
27 | + public int batchExpire(List<Long> ids); | ||
28 | + | ||
29 | + /** | ||
30 | + * 获取过期信息(分页) | ||
31 | + * @return | ||
32 | + */ | ||
33 | + public List<Long> selectExpire(Presale presale); | ||
34 | +} |
titan-worker/src/main/java/com/dili/titan/dao/ProductAuthDao.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.dao; | ||
6 | + | ||
7 | +import com.dili.titan.dao.base.BaseDao; | ||
8 | +import com.dili.titan.domain.ProductAuth; | ||
9 | + | ||
10 | +import java.util.List; | ||
11 | + | ||
12 | +/** | ||
13 | + * ProductAuthDao 接口 | ||
14 | + * @author dev-center | ||
15 | + * @since 2014-10-29 | ||
16 | + */ | ||
17 | +public interface ProductAuthDao extends BaseDao<ProductAuth,Long>{ | ||
18 | + //自定义扩展 | ||
19 | + | ||
20 | + | ||
21 | + /** | ||
22 | + * this method is 定时更新数据 | ||
23 | + * @return | ||
24 | + * @createTime 2014年11月4日 下午4:48:32 | ||
25 | + * @author yangweidong | ||
26 | + */ | ||
27 | + public int updateProductAuth(List<ProductAuth> paList); | ||
28 | + | ||
29 | + | ||
30 | + /** | ||
31 | + * this method is 查询将要失效的认证数据 | ||
32 | + * @return | ||
33 | + * @createTime 2015年6月3日 下午6:18:05 | ||
34 | + * @author yangwd | ||
35 | + */ | ||
36 | + public List<ProductAuth> selectInvalidAuthData(); | ||
37 | +} |
titan-worker/src/main/java/com/dili/titan/dao/ProductPopDao.java
0 → 100644
1 | +package com.dili.titan.dao; | ||
2 | + | ||
3 | +import com.dili.titan.dao.base.BaseDao; | ||
4 | +import com.dili.titan.domain.ProductPop; | ||
5 | + | ||
6 | +/** | ||
7 | + * ProductPopDao 接口 | ||
8 | + * | ||
9 | + * @author dev-center | ||
10 | + * @since 2014-05-10 | ||
11 | + */ | ||
12 | +public interface ProductPopDao extends BaseDao<ProductPop, Long> { | ||
13 | + | ||
14 | + public int publish(ProductPop p); | ||
15 | + | ||
16 | + public int drop(ProductPop p); | ||
17 | +} |
titan-worker/src/main/java/com/dili/titan/dao/PurchaseDao.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 com.dili.titan.dao.base.BaseDao; | ||
9 | +import com.dili.titan.domain.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 | + * 批量设置过期 | ||
22 | + * @param ids | ||
23 | + * @return | ||
24 | + */ | ||
25 | + public int batchExpire(List<Long> ids); | ||
26 | + | ||
27 | + /** | ||
28 | + * 获取过期信息(分页) | ||
29 | + * @return | ||
30 | + */ | ||
31 | + public List<Long> selectExpire(Purchase purchase); | ||
32 | +} |
titan-worker/src/main/java/com/dili/titan/dao/SupplyDao.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 com.dili.titan.dao.base.BaseDao; | ||
9 | +import com.dili.titan.domain.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 | + * 批量设置过期 | ||
22 | + * @param ids | ||
23 | + * @return | ||
24 | + */ | ||
25 | + public int batchExpire(List<Long> ids); | ||
26 | + | ||
27 | + /** | ||
28 | + * 获取过期信息(分页) | ||
29 | + * @return | ||
30 | + */ | ||
31 | + public List<Long> selectExpire(Supply supply); | ||
32 | +} |
titan-worker/src/main/java/com/dili/titan/dao/VideoDao.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.dao; | ||
6 | + | ||
7 | +import com.dili.titan.dao.base.BaseDao; | ||
8 | +import com.dili.titan.domain.Video; | ||
9 | + | ||
10 | +import java.util.List; | ||
11 | + | ||
12 | +/** | ||
13 | + * VideoDao 接口 | ||
14 | + * @author dev-center | ||
15 | + * @since 2014-12-26 | ||
16 | + */ | ||
17 | +public interface VideoDao extends BaseDao<Video,Long>{ | ||
18 | + //自定义扩展 | ||
19 | + | ||
20 | + /** | ||
21 | + * this method is 通过fileId更新数据 | ||
22 | + * @param video | ||
23 | + * @return | ||
24 | + * @createTime 2015年1月5日 下午4:32:44 | ||
25 | + * @author yangwd | ||
26 | + */ | ||
27 | + public int updateByfileId(Video video); | ||
28 | + | ||
29 | + public List<Long> findPidsByVideoId(Long videoId); | ||
30 | +} |
titan-worker/src/main/java/com/dili/titan/dao/base/BaseDao.java
0 → 100644
1 | +package com.dili.titan.dao.base; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | +import java.util.List; | ||
5 | + | ||
6 | +public interface BaseDao<T, KEY extends Serializable> { | ||
7 | + | ||
8 | + /** | ||
9 | + * 添加对象 | ||
10 | + * | ||
11 | + * @param t | ||
12 | + * @return 影响条数 | ||
13 | + */ | ||
14 | + int insert(T t); | ||
15 | + | ||
16 | + /** | ||
17 | + * 删除对象,条件 | ||
18 | + * | ||
19 | + * @param condtion | ||
20 | + * @return 影响条数 | ||
21 | + */ | ||
22 | + int deleteByCondtion(T condtion); | ||
23 | + | ||
24 | + /** | ||
25 | + * 更新对象,条件主键ID | ||
26 | + * | ||
27 | + * @param t | ||
28 | + * @return 影响条数 | ||
29 | + */ | ||
30 | + int updateByCondtion(T condtion); | ||
31 | + | ||
32 | + /** | ||
33 | + * 查询对象,条件主键 | ||
34 | + * | ||
35 | + * @param key | ||
36 | + * @return | ||
37 | + */ | ||
38 | + T select(KEY key); | ||
39 | + | ||
40 | + /** | ||
41 | + * 查询对象,条件主键数组 | ||
42 | + * | ||
43 | + * @param key | ||
44 | + * @return | ||
45 | + */ | ||
46 | + List<T> selectArray(KEY... key); | ||
47 | + | ||
48 | + /** | ||
49 | + * 查询对象,只要不为NULL与空则为条件 | ||
50 | + * | ||
51 | + * @param t | ||
52 | + * @return | ||
53 | + */ | ||
54 | + List<T> selectList(T t); | ||
55 | + | ||
56 | + /** | ||
57 | + * 查询对象总数 | ||
58 | + * | ||
59 | + * @param t | ||
60 | + * @return | ||
61 | + */ | ||
62 | + Integer selectListCount(T t); | ||
63 | + | ||
64 | + /** | ||
65 | + * 查询对象,只要不为NULL与空则为条件 | ||
66 | + * | ||
67 | + * @param t | ||
68 | + * @return | ||
69 | + */ | ||
70 | + List<T> selectEntryList(T t); | ||
71 | + | ||
72 | + /** | ||
73 | + * 查询对象总数 | ||
74 | + * | ||
75 | + * @param t | ||
76 | + * @return | ||
77 | + */ | ||
78 | + Integer selectEntryListCount(T t); | ||
79 | + | ||
80 | +} |
titan-worker/src/main/java/com/dili/titan/dao/base/BaseDaoImpl.java
0 → 100644
1 | +package com.dili.titan.dao.base; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | +import java.util.List; | ||
5 | + | ||
6 | +/** | ||
7 | + * | ||
8 | + * | ||
9 | + * @param <T> | ||
10 | + * @param <KEY> | ||
11 | + */ | ||
12 | +public abstract class BaseDaoImpl<T, KEY extends Serializable> extends MyBatisSupport implements BaseDao<T, KEY> { | ||
13 | + private static final String DEFAULT_INSERT_KEY = "insert"; | ||
14 | + private static final String DEFAULT_SELECT_KEY = "select"; | ||
15 | + private static final String DEFAULT_SELECT_ARRAY_KEY = "selectArray"; | ||
16 | + private static final String DEFAULT_DELETE_CONDTION = "deleteByCondtion"; | ||
17 | + private static final String DEFAULT_UPDATE_CONDTION = "updateByCondtion"; | ||
18 | + | ||
19 | + private static final String DEFAULT_SELECT_CONDTION = "selectList"; | ||
20 | + private static final String DEFAULT_SELECT_CONDTION_COUNT = "selectListCount"; | ||
21 | + | ||
22 | + /** | ||
23 | + * 获取命名空间前缀 | ||
24 | + * | ||
25 | + * @param statement | ||
26 | + * @return | ||
27 | + */ | ||
28 | + public abstract String getNameSpace(String statement); | ||
29 | + | ||
30 | + public int insert(T t) { | ||
31 | + int result = 0; | ||
32 | + if (t != null) { | ||
33 | + result += this.insert(getNameSpace(DEFAULT_INSERT_KEY), t); | ||
34 | + } | ||
35 | + return result; | ||
36 | + } | ||
37 | + | ||
38 | + public int deleteByCondtion(T t) { | ||
39 | + return this.delete(getNameSpace(DEFAULT_DELETE_CONDTION), t); | ||
40 | + } | ||
41 | + | ||
42 | + public int updateByCondtion(T condtion) { | ||
43 | + return this.update(getNameSpace(DEFAULT_UPDATE_CONDTION), condtion); | ||
44 | + } | ||
45 | + | ||
46 | + public T select(KEY key) { | ||
47 | + if (key == null) { | ||
48 | + return null; | ||
49 | + } | ||
50 | + return this.select(getNameSpace(DEFAULT_SELECT_KEY), key); | ||
51 | + } | ||
52 | + | ||
53 | + public List<T> selectArray(KEY... key) { | ||
54 | + if (key == null || key.length <= 0) { | ||
55 | + return null; | ||
56 | + } | ||
57 | + return this.selectList(getNameSpace(DEFAULT_SELECT_ARRAY_KEY), key); | ||
58 | + } | ||
59 | + | ||
60 | + public List<T> selectList(T t) { | ||
61 | + return this.selectList(getNameSpace(DEFAULT_SELECT_CONDTION), t); | ||
62 | + } | ||
63 | + | ||
64 | + public Integer selectListCount(T t) { | ||
65 | + return this.select(getNameSpace(DEFAULT_SELECT_CONDTION_COUNT), t); | ||
66 | + } | ||
67 | + public List<T> selectEntryList(T t) { | ||
68 | + return this.selectList(getNameSpace(DEFAULT_SELECT_CONDTION), t); | ||
69 | + } | ||
70 | + | ||
71 | + public Integer selectEntryListCount(T t) { | ||
72 | + return this.select(getNameSpace(DEFAULT_SELECT_CONDTION_COUNT), t); | ||
73 | + } | ||
74 | + | ||
75 | +} |
titan-worker/src/main/java/com/dili/titan/dao/base/MyBatisSupport.java
0 → 100644
1 | +package com.dili.titan.dao.base; | ||
2 | + | ||
3 | +import org.mybatis.spring.SqlSessionTemplate; | ||
4 | +import org.slf4j.Logger; | ||
5 | +import org.slf4j.LoggerFactory; | ||
6 | + | ||
7 | +import javax.annotation.Resource; | ||
8 | +import java.util.List; | ||
9 | +import java.util.Map; | ||
10 | + | ||
11 | +/** | ||
12 | + * 对mybatis的支持<br/> | ||
13 | + * spring配置文件需定义sqlTemplate | ||
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 | + * SqlSessionTemplate | ||
23 | + * | ||
24 | + * @return | ||
25 | + */ | ||
26 | + protected SqlSessionTemplate getSqlTemplate() { | ||
27 | + return sqlTemplate; | ||
28 | + } | ||
29 | + | ||
30 | + /** | ||
31 | + * 新增对象 | ||
32 | + * | ||
33 | + * @param statement | ||
34 | + * @param parameter | ||
35 | + * @return | ||
36 | + * @throws Exception | ||
37 | + */ | ||
38 | + protected int insert(String statement, Object parameter) { | ||
39 | + int res = 0; | ||
40 | + try { | ||
41 | + if (parameter != null) { | ||
42 | + res = getSqlTemplate().insert(statement, parameter); | ||
43 | + } | ||
44 | + } catch (Exception ex) { | ||
45 | + LOGGER.error("Mybatis执行新增异常", ex); | ||
46 | + throw new RuntimeException(ex); | ||
47 | + } | ||
48 | + return res; | ||
49 | + } | ||
50 | + | ||
51 | + /** | ||
52 | + * 删除对象 | ||
53 | + * | ||
54 | + * @param statement | ||
55 | + * @param parameter | ||
56 | + * @return | ||
57 | + */ | ||
58 | + protected int delete(String statement, Object parameter) { | ||
59 | + int res = 0; | ||
60 | + try { | ||
61 | + res = getSqlTemplate().delete(statement, parameter); | ||
62 | + } catch (Exception ex) { | ||
63 | + LOGGER.error("Mybatis执行删除异常", ex); | ||
64 | + throw new RuntimeException(ex); | ||
65 | + } | ||
66 | + return res; | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * 更新对象 | ||
71 | + * | ||
72 | + * @param statement | ||
73 | + * @param parameter | ||
74 | + * @return | ||
75 | + */ | ||
76 | + protected int update(String statement, Object parameter) { | ||
77 | + int res = 0; | ||
78 | + try { | ||
79 | + if (parameter != null) { | ||
80 | + res = getSqlTemplate().update(statement, parameter); | ||
81 | + } | ||
82 | + } catch (Exception ex) { | ||
83 | + LOGGER.error("Mybatis执行更新异常", ex); | ||
84 | + throw new RuntimeException(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().selectOne(statement, parameter); | ||
103 | + } catch (Exception ex) { | ||
104 | + LOGGER.error("Mybatis执行查询异常", ex); | ||
105 | + throw new RuntimeException(ex); | ||
106 | + } | ||
107 | + return obj; | ||
108 | + } | ||
109 | + | ||
110 | + /** | ||
111 | + * 查询列表 | ||
112 | + * | ||
113 | + * @param <T> | ||
114 | + * @param statement | ||
115 | + * @param parameter | ||
116 | + * @param clz | ||
117 | + * @return | ||
118 | + */ | ||
119 | + protected <T> List<T> selectList(String statement, Object parameter) { | ||
120 | + List<T> list = null; | ||
121 | + try { | ||
122 | + list = getSqlTemplate().selectList(statement, parameter); | ||
123 | + } catch (Exception ex) { | ||
124 | + LOGGER.error("Mybatis执行查询异常", ex); | ||
125 | + throw new RuntimeException(ex); | ||
126 | + } | ||
127 | + return list; | ||
128 | + } | ||
129 | + | ||
130 | + /** | ||
131 | + * 查询Map | ||
132 | + * | ||
133 | + * @param <K> | ||
134 | + * @param <V> | ||
135 | + * @param statement | ||
136 | + * @param parameter | ||
137 | + * @param mapKey | ||
138 | + * @return | ||
139 | + */ | ||
140 | + protected <K, V> Map<K, V> selectMap(String statement, Object parameter, String mapKey) { | ||
141 | + Map<K, V> map = null; | ||
142 | + try { | ||
143 | + map = getSqlTemplate().selectMap(statement, parameter, mapKey); | ||
144 | + } catch (Exception ex) { | ||
145 | + LOGGER.error("Mybatis执行查询异常", ex); | ||
146 | + throw new RuntimeException(ex); | ||
147 | + } | ||
148 | + return map; | ||
149 | + } | ||
150 | +} |
titan-worker/src/main/java/com/dili/titan/dao/impl/PresaleDaoImpl.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.PresaleDao; | ||
8 | +import com.dili.titan.dao.SupplyDao; | ||
9 | +import com.dili.titan.dao.base.BaseDaoImpl; | ||
10 | +import com.dili.titan.domain.Presale; | ||
11 | +import com.dili.titan.domain.Supply; | ||
12 | +import org.springframework.stereotype.Repository; | ||
13 | + | ||
14 | +import java.util.List; | ||
15 | + | ||
16 | + | ||
17 | +/** | ||
18 | + * SupplyDao 实现类 | ||
19 | + * @author dev-center | ||
20 | + * @since 2014-12-16 | ||
21 | + */ | ||
22 | +@Repository | ||
23 | +public class PresaleDaoImpl extends BaseDaoImpl<Presale,Long> implements PresaleDao { | ||
24 | + private final static String NAMESPACE = "com.dili.titan.dao.PresaleDao."; | ||
25 | + | ||
26 | + //返回本DAO命名空间,并添加statement | ||
27 | + public String getNameSpace(String statement) { | ||
28 | + return NAMESPACE + statement; | ||
29 | + } | ||
30 | + | ||
31 | + @Override | ||
32 | + public int batchExpire(List<Long> ids) { | ||
33 | + return this.update(getNameSpace("batchExpire"),ids); | ||
34 | + } | ||
35 | + | ||
36 | + @Override | ||
37 | + public List<Long> selectExpire(Presale presale) { | ||
38 | + return this.selectList(getNameSpace("selectExpire"),presale); | ||
39 | + } | ||
40 | +} |
titan-worker/src/main/java/com/dili/titan/dao/impl/ProductAuthDaoImpl.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.ProductAuthDao; | ||
8 | +import com.dili.titan.dao.base.BaseDaoImpl; | ||
9 | +import com.dili.titan.domain.ProductAuth; | ||
10 | +import org.springframework.stereotype.Repository; | ||
11 | + | ||
12 | +import java.util.List; | ||
13 | + | ||
14 | +/** | ||
15 | + * ProductAuthDao 实现类 | ||
16 | + * @author dev-center | ||
17 | + * @since 2014-10-29 | ||
18 | + */ | ||
19 | +@Repository("productAuthDao") | ||
20 | +public class ProductAuthDaoImpl extends BaseDaoImpl<ProductAuth,Long> implements ProductAuthDao { | ||
21 | + private final static String NAMESPACE = "com.dili.titan.dao.ProductAuthDao."; | ||
22 | + | ||
23 | + //返回本DAO命名空间,并添加statement | ||
24 | + public String getNameSpace(String statement) { | ||
25 | + return NAMESPACE + statement; | ||
26 | + } | ||
27 | + | ||
28 | + @Override | ||
29 | + public int updateProductAuth(List<ProductAuth> paList) { | ||
30 | + return this.update(getNameSpace("setAuthDataInvalid"),paList); | ||
31 | + } | ||
32 | + | ||
33 | + @Override | ||
34 | + public List<ProductAuth> selectInvalidAuthData() { | ||
35 | + return this.selectList(getNameSpace("selectInvalidAuthData"),null); | ||
36 | + } | ||
37 | + | ||
38 | +} |
titan-worker/src/main/java/com/dili/titan/dao/impl/ProductPopDaoImpl.java
0 → 100644
1 | +package com.dili.titan.dao.impl; | ||
2 | + | ||
3 | +import com.dili.titan.dao.ProductPopDao; | ||
4 | +import com.dili.titan.dao.base.BaseDaoImpl; | ||
5 | +import com.dili.titan.domain.ProductPop; | ||
6 | +import org.springframework.stereotype.Repository; | ||
7 | + | ||
8 | +@Repository("productPopDao") | ||
9 | +public class ProductPopDaoImpl extends BaseDaoImpl<ProductPop, Long> implements ProductPopDao { | ||
10 | + private static final String NAMESPACE = "com.dili.titan.dao.ProductPopDao."; | ||
11 | + | ||
12 | + @Override | ||
13 | + public String getNameSpace(String statement) { | ||
14 | + return NAMESPACE + statement; | ||
15 | + } | ||
16 | + | ||
17 | + @Override | ||
18 | + public int publish(ProductPop p) { | ||
19 | + return this.update(getNameSpace("publish"), p); | ||
20 | + } | ||
21 | + | ||
22 | + @Override | ||
23 | + public int drop(ProductPop p) { | ||
24 | + return this.update(getNameSpace("drop"), p); | ||
25 | + } | ||
26 | + | ||
27 | +} |
titan-worker/src/main/java/com/dili/titan/dao/impl/PurchaseDaoImpl.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.PurchaseDao; | ||
8 | +import com.dili.titan.dao.base.BaseDaoImpl; | ||
9 | +import com.dili.titan.domain.Purchase; | ||
10 | +import org.springframework.stereotype.Repository; | ||
11 | + | ||
12 | +import java.util.List; | ||
13 | + | ||
14 | + | ||
15 | +/** | ||
16 | + * PurchaseDao 实现类 | ||
17 | + * @author dev-center | ||
18 | + * @since 2014-12-16 | ||
19 | + */ | ||
20 | +@Repository("purchaseDao") | ||
21 | +public class PurchaseDaoImpl extends BaseDaoImpl<Purchase,Long> implements PurchaseDao { | ||
22 | + private final static String NAMESPACE = "com.dili.titan.dao.PurchaseDao."; | ||
23 | + | ||
24 | + //返回本DAO命名空间,并添加statement | ||
25 | + public String getNameSpace(String statement) { | ||
26 | + return NAMESPACE + statement; | ||
27 | + } | ||
28 | + | ||
29 | + @Override | ||
30 | + public int batchExpire(List<Long> ids) { | ||
31 | + return this.update(getNameSpace("batchExpire"),ids); | ||
32 | + } | ||
33 | + | ||
34 | + @Override | ||
35 | + public List<Long> selectExpire(Purchase purchase) { | ||
36 | + return this.selectList(getNameSpace("selectExpire"),purchase); | ||
37 | + } | ||
38 | +} |
titan-worker/src/main/java/com/dili/titan/dao/impl/SupplyDaoImpl.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.SupplyDao; | ||
8 | +import com.dili.titan.dao.base.BaseDaoImpl; | ||
9 | +import com.dili.titan.domain.Supply; | ||
10 | +import org.springframework.stereotype.Repository; | ||
11 | + | ||
12 | +import java.util.List; | ||
13 | + | ||
14 | + | ||
15 | +/** | ||
16 | + * SupplyDao 实现类 | ||
17 | + * @author dev-center | ||
18 | + * @since 2014-12-16 | ||
19 | + */ | ||
20 | +@Repository("supplyDao") | ||
21 | +public class SupplyDaoImpl extends BaseDaoImpl<Supply,Long> implements SupplyDao { | ||
22 | + private final static String NAMESPACE = "com.dili.titan.dao.SupplyDao."; | ||
23 | + | ||
24 | + //返回本DAO命名空间,并添加statement | ||
25 | + public String getNameSpace(String statement) { | ||
26 | + return NAMESPACE + statement; | ||
27 | + } | ||
28 | + | ||
29 | + @Override | ||
30 | + public int batchExpire(List<Long> ids) { | ||
31 | + return this.update(getNameSpace("batchExpire"),ids); | ||
32 | + } | ||
33 | + | ||
34 | + @Override | ||
35 | + public List<Long> selectExpire(Supply supply) { | ||
36 | + return this.selectList(getNameSpace("selectExpire"),supply); | ||
37 | + } | ||
38 | +} |
titan-worker/src/main/java/com/dili/titan/dao/impl/VideoDaoImpl.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.VideoDao; | ||
8 | +import com.dili.titan.dao.base.BaseDaoImpl; | ||
9 | +import com.dili.titan.domain.Video; | ||
10 | +import org.springframework.stereotype.Repository; | ||
11 | + | ||
12 | +import java.util.List; | ||
13 | + | ||
14 | +/** | ||
15 | + * VideoDao 实现类 | ||
16 | + * @author dev-center | ||
17 | + * @since 2014-12-26 | ||
18 | + */ | ||
19 | +@Repository("videoDao") | ||
20 | +public class VideoDaoImpl extends BaseDaoImpl<Video,Long> implements VideoDao { | ||
21 | + private final static String NAMESPACE = "com.dili.titan.dao.VideoDao."; | ||
22 | + | ||
23 | + //返回本DAO命名空间,并添加statement | ||
24 | + public String getNameSpace(String statement) { | ||
25 | + return NAMESPACE + statement; | ||
26 | + } | ||
27 | + | ||
28 | + @Override | ||
29 | + public int updateByfileId(Video video) { | ||
30 | + return this.update(this.getNameSpace("updateByfileId"), video); | ||
31 | + } | ||
32 | + | ||
33 | + @Override | ||
34 | + public List<Long> findPidsByVideoId(Long videoId) { | ||
35 | + return this.selectList(this.getNameSpace("findPidsByVideoId"), videoId); | ||
36 | + } | ||
37 | +} |
titan-worker/src/main/java/com/dili/titan/domain/BaseDomain.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 com.alibaba.fastjson.annotation.JSONField; | ||
8 | + | ||
9 | +import java.util.Date; | ||
10 | + | ||
11 | +/** | ||
12 | + * 领域模型基类(常规公共字段)<br/> | ||
13 | + * 一律使用引用类型 | ||
14 | + * @author dev-center | ||
15 | + * @since 2014-05-10 | ||
16 | + */ | ||
17 | +public class BaseDomain extends BaseQuery { | ||
18 | + private static final long serialVersionUID = 1L; | ||
19 | + private Long id;// 编号 | ||
20 | + | ||
21 | + private String uuid;// 唯一编号 | ||
22 | + | ||
23 | + private String code;// 编码 | ||
24 | + | ||
25 | + private String remark;// 备注 | ||
26 | + | ||
27 | + private Date createDate;// 创建日期 | ||
28 | + | ||
29 | + private String createUser;// 创建者 | ||
30 | + | ||
31 | + private Date modifyDate;// 最后修改日期 | ||
32 | + | ||
33 | + private String modifyUser;// 最后修改者 | ||
34 | + | ||
35 | + private Integer isDel;// 是否删除 | ||
36 | + | ||
37 | + private String createUserErp;//创建者erp | ||
38 | + | ||
39 | + private String modifyUserErp;//更新者erp | ||
40 | + | ||
41 | + public Long getId() { | ||
42 | + return id; | ||
43 | + } | ||
44 | + public void setId(Long id) { | ||
45 | + this.id = id; | ||
46 | + } | ||
47 | + @JSONField(serialize=false) | ||
48 | + public String getUuid() { | ||
49 | + return uuid; | ||
50 | + } | ||
51 | + public void setUuid(String uuid) { | ||
52 | + this.uuid = uuid; | ||
53 | + } | ||
54 | + | ||
55 | + @JSONField(serialize=false) | ||
56 | + public String getCode() { | ||
57 | + return code; | ||
58 | + } | ||
59 | + public void setCode(String code) { | ||
60 | + this.code = code; | ||
61 | + } | ||
62 | + | ||
63 | + @JSONField(serialize=false) | ||
64 | + public String getRemark() { | ||
65 | + return remark; | ||
66 | + } | ||
67 | + public void setRemark(String remark) { | ||
68 | + this.remark = remark; | ||
69 | + } | ||
70 | + | ||
71 | + @JSONField(serialize=false) | ||
72 | + public Date getCreateDate() { | ||
73 | + return createDate; | ||
74 | + } | ||
75 | + public void setCreateDate(Date createDate) { | ||
76 | + this.createDate = createDate; | ||
77 | + } | ||
78 | + | ||
79 | + @JSONField(serialize=false) | ||
80 | + public String getCreateUser() { | ||
81 | + return createUser; | ||
82 | + } | ||
83 | + public void setCreateUser(String createUser) { | ||
84 | + this.createUser = createUser; | ||
85 | + } | ||
86 | + | ||
87 | + @JSONField(serialize=false) | ||
88 | + public Date getModifyDate() { | ||
89 | + return modifyDate; | ||
90 | + } | ||
91 | + public void setModifyDate(Date modifyDate) { | ||
92 | + this.modifyDate = modifyDate; | ||
93 | + } | ||
94 | + | ||
95 | + @JSONField(serialize=false) | ||
96 | + public String getModifyUser() { | ||
97 | + return modifyUser; | ||
98 | + } | ||
99 | + public void setModifyUser(String modifyUser) { | ||
100 | + this.modifyUser = modifyUser; | ||
101 | + } | ||
102 | + | ||
103 | + @JSONField(serialize=false) | ||
104 | + public Integer getIsDel() { | ||
105 | + return isDel; | ||
106 | + } | ||
107 | + public void setIsDel(Integer isDel) { | ||
108 | + this.isDel = isDel; | ||
109 | + } | ||
110 | + | ||
111 | + public String getCreateUserErp() { | ||
112 | + return createUserErp; | ||
113 | + } | ||
114 | + public void setCreateUserErp(String createUserErp) { | ||
115 | + this.createUserErp = createUserErp; | ||
116 | + } | ||
117 | + public String getModifyUserErp() { | ||
118 | + return modifyUserErp; | ||
119 | + } | ||
120 | + public void setModifyUserErp(String modifyUserErp) { | ||
121 | + this.modifyUserErp = modifyUserErp; | ||
122 | + } | ||
123 | +} |
titan-worker/src/main/java/com/dili/titan/domain/BaseQuery.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 com.alibaba.fastjson.annotation.JSONField; | ||
8 | + | ||
9 | +import java.io.Serializable; | ||
10 | +import java.util.HashMap; | ||
11 | +import java.util.Map; | ||
12 | + | ||
13 | +/** | ||
14 | + * 基础查询类 | ||
15 | + * @author dev-center | ||
16 | + * @since 2014-05-10 | ||
17 | + */ | ||
18 | +public class BaseQuery implements Serializable { | ||
19 | + private static final long serialVersionUID = 1L; | ||
20 | + | ||
21 | + private transient Integer startIndex;// 开始索引 | ||
22 | + | ||
23 | + private transient Integer endIndex;// 结束索引 | ||
24 | + | ||
25 | + private transient String orderField;// 排序字段 | ||
26 | + | ||
27 | + private transient String orderFieldType;// 排序字段类型 | ||
28 | + | ||
29 | + private transient Map<String, Object> queryData;// 查询扩展 | ||
30 | + | ||
31 | + private transient String keyword;// 关键则查询 | ||
32 | + | ||
33 | + private transient Boolean isExcludeFailure; | ||
34 | + | ||
35 | + @JSONField(serialize=false) | ||
36 | + public Integer getStartIndex() { | ||
37 | + return startIndex; | ||
38 | + } | ||
39 | + public void setStartIndex(Integer startIndex) { | ||
40 | + this.startIndex = startIndex; | ||
41 | + } | ||
42 | + | ||
43 | + @JSONField(serialize=false) | ||
44 | + public Integer getEndIndex() { | ||
45 | + return endIndex; | ||
46 | + } | ||
47 | + public void setEndIndex(Integer endIndex) { | ||
48 | + this.endIndex = endIndex; | ||
49 | + } | ||
50 | + | ||
51 | + //每页显示条数 | ||
52 | + @JSONField(serialize=false) | ||
53 | + public Integer getPageSize() { | ||
54 | + if(endIndex != null && startIndex != null) { | ||
55 | + return endIndex - startIndex; | ||
56 | + } | ||
57 | + return null; | ||
58 | + } | ||
59 | + | ||
60 | + @JSONField(serialize=false) | ||
61 | + public String getOrderField() { | ||
62 | + return orderField; | ||
63 | + } | ||
64 | + public void setOrderField(String orderField) { | ||
65 | + this.orderField = orderField; | ||
66 | + } | ||
67 | + | ||
68 | + @JSONField(serialize=false) | ||
69 | + public String getOrderFieldType() { | ||
70 | + if("DESC".equalsIgnoreCase(orderFieldType) || "ASC".equalsIgnoreCase(orderFieldType)) { | ||
71 | + return orderFieldType.toUpperCase(); | ||
72 | + } | ||
73 | + return null; | ||
74 | + } | ||
75 | + | ||
76 | + @JSONField(serialize=false) | ||
77 | + public String getOrderFieldNextType() { | ||
78 | + if("ASC".equalsIgnoreCase(orderFieldType)) { | ||
79 | + return "DESC"; | ||
80 | + } | ||
81 | + return "ASC"; | ||
82 | + } | ||
83 | + | ||
84 | + public void setOrderFieldType(String orderFieldType) { | ||
85 | + this.orderFieldType = orderFieldType; | ||
86 | + } | ||
87 | + | ||
88 | + @JSONField(serialize=false) | ||
89 | + public Map<String, Object> getQueryData() { | ||
90 | + if(queryData != null && queryData.size() > 0) { | ||
91 | + return queryData; | ||
92 | + } | ||
93 | + return null; | ||
94 | + } | ||
95 | + | ||
96 | + //添加其它查询数据 | ||
97 | + public void addQueryData(String key,Object value) { | ||
98 | + if(queryData == null) { | ||
99 | + queryData = new HashMap<String, Object>(); | ||
100 | + } | ||
101 | + queryData.put(key, value); | ||
102 | + } | ||
103 | + | ||
104 | + public void setKeyword(String keyword) { | ||
105 | + this.keyword = keyword; | ||
106 | + } | ||
107 | + | ||
108 | + public String getkeyword() { | ||
109 | + return keyword; | ||
110 | + } | ||
111 | + | ||
112 | + public Boolean getIsExcludeFailure() { | ||
113 | + return isExcludeFailure; | ||
114 | + } | ||
115 | + | ||
116 | + public void setIsExcludeFailure(Boolean isExcludeFailure) { | ||
117 | + this.isExcludeFailure = isExcludeFailure; | ||
118 | + } | ||
119 | +} |
titan-worker/src/main/java/com/dili/titan/domain/Page.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.List; | ||
8 | + | ||
9 | +/** | ||
10 | + * 分页对象 | ||
11 | + * @author dev-center | ||
12 | + * @since 2014-05-10 | ||
13 | + * @param <T> 实体 | ||
14 | + */ | ||
15 | +public class Page<T> { | ||
16 | + //初始化size | ||
17 | + private final static int INIT_SIZE = 100; | ||
18 | + private int pageSize = INIT_SIZE; | ||
19 | + private int totalCount; | ||
20 | + private int currentPage; | ||
21 | + private List<T> data; | ||
22 | + | ||
23 | + public Page() { | ||
24 | + // 默认构造器 | ||
25 | + } | ||
26 | + | ||
27 | + public Page(int currentPage) { | ||
28 | + this.currentPage = currentPage; | ||
29 | + } | ||
30 | + | ||
31 | + public Page(int currentPage, int pageSize) { | ||
32 | + this.currentPage = currentPage; | ||
33 | + this.pageSize = pageSize; | ||
34 | + } | ||
35 | + | ||
36 | + /** | ||
37 | + * 获取开始索引 | ||
38 | + * @return | ||
39 | + */ | ||
40 | + public int getStartIndex() { | ||
41 | + return (getCurrentPage() - 1) * this.pageSize; | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * 获取结束索引 | ||
46 | + * @return | ||
47 | + */ | ||
48 | + public int getEndIndex() { | ||
49 | + return getCurrentPage() * this.pageSize; | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
53 | + * 是否第一页 | ||
54 | + * @return | ||
55 | + */ | ||
56 | + public boolean isFirstPage() { | ||
57 | + return getCurrentPage() <= 1; | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * 是否末页 | ||
62 | + * @return | ||
63 | + */ | ||
64 | + public boolean isLastPage() { | ||
65 | + return getCurrentPage() >= getPageCount(); | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * 获取下一页页码 | ||
70 | + * @return | ||
71 | + */ | ||
72 | + public int getNextPage() { | ||
73 | + if (isLastPage()) { | ||
74 | + return getCurrentPage(); | ||
75 | + } | ||
76 | + return getCurrentPage() + 1; | ||
77 | + } | ||
78 | + | ||
79 | + /** | ||
80 | + * 获取上一页页码 | ||
81 | + * @return | ||
82 | + */ | ||
83 | + public int getPreviousPage() { | ||
84 | + if (isFirstPage()) { | ||
85 | + return 1; | ||
86 | + } | ||
87 | + return getCurrentPage() - 1; | ||
88 | + } | ||
89 | + | ||
90 | + /** | ||
91 | + * 获取当前页页码 | ||
92 | + * @return | ||
93 | + */ | ||
94 | + public int getCurrentPage() { | ||
95 | + if (currentPage == 0) { | ||
96 | + currentPage = 1; | ||
97 | + } | ||
98 | + return currentPage; | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * 取得总页数 | ||
103 | + * @return | ||
104 | + */ | ||
105 | + public int getPageCount() { | ||
106 | + if (totalCount % pageSize == 0) { | ||
107 | + return totalCount / pageSize; | ||
108 | + } else { | ||
109 | + return totalCount / pageSize + 1; | ||
110 | + } | ||
111 | + } | ||
112 | + | ||
113 | + /** | ||
114 | + * 取总记录数. | ||
115 | + * @return | ||
116 | + */ | ||
117 | + public int getTotalCount() { | ||
118 | + return this.totalCount; | ||
119 | + } | ||
120 | + | ||
121 | + /** | ||
122 | + * 设置当前页 | ||
123 | + * @param currentPage | ||
124 | + */ | ||
125 | + public void setCurrentPage(int currentPage) { | ||
126 | + this.currentPage = currentPage; | ||
127 | + } | ||
128 | + | ||
129 | + /** | ||
130 | + * 获取每页数据容量. | ||
131 | + * @return | ||
132 | + */ | ||
133 | + public int getPageSize() { | ||
134 | + return pageSize; | ||
135 | + } | ||
136 | + | ||
137 | + public void setPageSize(int pageSize) { | ||
138 | + this.pageSize = pageSize; | ||
139 | + } | ||
140 | + /** | ||
141 | + * 该页是否有下一页. | ||
142 | + * @return | ||
143 | + */ | ||
144 | + public boolean hasNextPage() { | ||
145 | + return getCurrentPage() < getPageCount(); | ||
146 | + } | ||
147 | + | ||
148 | + /** | ||
149 | + * 该页是否有上一页. | ||
150 | + * @return | ||
151 | + */ | ||
152 | + public boolean hasPreviousPage() { | ||
153 | + return getCurrentPage() > 1; | ||
154 | + } | ||
155 | + | ||
156 | + /** | ||
157 | + * 获取数据集 | ||
158 | + * @return | ||
159 | + */ | ||
160 | + public List<T> getResult() { | ||
161 | + return data; | ||
162 | + } | ||
163 | + | ||
164 | + /** | ||
165 | + * 设置数据集 | ||
166 | + * @param data | ||
167 | + */ | ||
168 | + public void setResult(List<T> data) { | ||
169 | + this.data = data; | ||
170 | + } | ||
171 | + | ||
172 | + /** | ||
173 | + * 设置总记录条数 | ||
174 | + * @param totalCount | ||
175 | + */ | ||
176 | + public void setTotalCount(int totalCount) { | ||
177 | + this.totalCount = totalCount; | ||
178 | + } | ||
179 | + //==============扩展字段===============// | ||
180 | + private String unit = "条";//单位 | ||
181 | + private String extInfo;//扩展信息 | ||
182 | + public void setUnit(String unit) { | ||
183 | + this.unit = unit; | ||
184 | + } | ||
185 | + public String getUnit() { | ||
186 | + return unit; | ||
187 | + } | ||
188 | + public void setExtInfo(String extInfo) { | ||
189 | + this.extInfo = extInfo; | ||
190 | + } | ||
191 | + public String getExtInfo() { | ||
192 | + return extInfo; | ||
193 | + } | ||
194 | + | ||
195 | + public int getTotalPage() { | ||
196 | + return totalCount%pageSize==0?totalCount/pageSize:(totalCount/pageSize)+1; | ||
197 | + } | ||
198 | +} |
titan-worker/src/main/java/com/dili/titan/domain/PpsConstant.java
0 → 100644
1 | +package com.dili.titan.domain; | ||
2 | + | ||
3 | +/** | ||
4 | + *供应求购预售状态常量 | ||
5 | + */ | ||
6 | +public class PpsConstant { | ||
7 | + /** | ||
8 | + * 状态:待审核 | ||
9 | + */ | ||
10 | + public static final int STATUS_NEW = 1; | ||
11 | + /** | ||
12 | + * 状态:审核通过 | ||
13 | + */ | ||
14 | + public static final int STATUS_PASS = 2; | ||
15 | + /** | ||
16 | + * 状态:审核失败 | ||
17 | + */ | ||
18 | + public static final int STATUS_DENIED = 3; | ||
19 | + /** | ||
20 | + * 状态:过期 | ||
21 | + */ | ||
22 | + public static final int STATUS_EXPIRE = 4; | ||
23 | + /** | ||
24 | + * 状态:删除 | ||
25 | + */ | ||
26 | + public static final int STATUS_DEL = -1; | ||
27 | + | ||
28 | + /** | ||
29 | + * 来源:PC端 | ||
30 | + */ | ||
31 | + public static final int SOURCES_PC = 1; | ||
32 | + | ||
33 | + /** | ||
34 | + * 来源:手机端 | ||
35 | + */ | ||
36 | + public static final int SOURCES_MOBILE = 2; | ||
37 | +} |
titan-worker/src/main/java/com/dili/titan/domain/Presale.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2015 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 | + * presale | ||
12 | + * @author dev-center | ||
13 | + * @since 2015-07-24 | ||
14 | + */ | ||
15 | +public class Presale extends BaseDomain { | ||
16 | + private static final long serialVersionUID = 1L; | ||
17 | + private Long categoryId; | ||
18 | + private Long localityAreaId; | ||
19 | + private Integer count; | ||
20 | + private Integer unitId; | ||
21 | + private String phone; | ||
22 | + private Integer status; | ||
23 | + private Long userId; | ||
24 | + private Integer source; | ||
25 | + private String reason; | ||
26 | + private Date startTime; | ||
27 | + private Date endTime; | ||
28 | + private Date ctime; | ||
29 | + private String utime; | ||
30 | + //查询参数 | ||
31 | + private List<Integer> statuses; | ||
32 | + | ||
33 | + public Presale(){ | ||
34 | + //默认无参构造方法 | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * 获取 categoryId | ||
39 | + * @return | ||
40 | + */ | ||
41 | + public Long getCategoryId(){ | ||
42 | + return categoryId; | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * 设置 categoryId | ||
47 | + * @param categoryId | ||
48 | + */ | ||
49 | + public void setCategoryId(Long categoryId){ | ||
50 | + this.categoryId = categoryId; | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * 获取 count | ||
55 | + * @return | ||
56 | + */ | ||
57 | + public Integer getCount(){ | ||
58 | + return count; | ||
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * 设置 count | ||
63 | + * @param count | ||
64 | + */ | ||
65 | + public void setCount(Integer count){ | ||
66 | + this.count = count; | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * 获取 phone | ||
71 | + * @return | ||
72 | + */ | ||
73 | + public String getPhone(){ | ||
74 | + return phone; | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * 设置 phone | ||
79 | + * @param phone | ||
80 | + */ | ||
81 | + public void setPhone(String phone){ | ||
82 | + this.phone = phone; | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
86 | + * 获取 status | ||
87 | + * @return | ||
88 | + */ | ||
89 | + public Integer getStatus(){ | ||
90 | + return status; | ||
91 | + } | ||
92 | + | ||
93 | + /** | ||
94 | + * 设置 status | ||
95 | + * @param status | ||
96 | + */ | ||
97 | + public void setStatus(Integer status){ | ||
98 | + this.status = status; | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * 获取 userId | ||
103 | + * @return | ||
104 | + */ | ||
105 | + public Long getUserId(){ | ||
106 | + return userId; | ||
107 | + } | ||
108 | + | ||
109 | + /** | ||
110 | + * 设置 userId | ||
111 | + * @param userId | ||
112 | + */ | ||
113 | + public void setUserId(Long userId){ | ||
114 | + this.userId = userId; | ||
115 | + } | ||
116 | + | ||
117 | + /** | ||
118 | + * 获取 source | ||
119 | + * @return | ||
120 | + */ | ||
121 | + public Integer getSource(){ | ||
122 | + return source; | ||
123 | + } | ||
124 | + | ||
125 | + /** | ||
126 | + * 设置 source | ||
127 | + * @param source | ||
128 | + */ | ||
129 | + public void setSource(Integer source){ | ||
130 | + this.source = source; | ||
131 | + } | ||
132 | + | ||
133 | + /** | ||
134 | + * 获取 reason | ||
135 | + * @return | ||
136 | + */ | ||
137 | + public String getReason(){ | ||
138 | + return reason; | ||
139 | + } | ||
140 | + | ||
141 | + /** | ||
142 | + * 设置 reason | ||
143 | + * @param reason | ||
144 | + */ | ||
145 | + public void setReason(String reason){ | ||
146 | + this.reason = reason; | ||
147 | + } | ||
148 | + | ||
149 | + /** | ||
150 | + * 获取 startTime | ||
151 | + * @return | ||
152 | + */ | ||
153 | + public Date getStartTime(){ | ||
154 | + return startTime; | ||
155 | + } | ||
156 | + | ||
157 | + /** | ||
158 | + * 设置 startTime | ||
159 | + * @param startTime | ||
160 | + */ | ||
161 | + public void setStartTime(Date startTime){ | ||
162 | + this.startTime = startTime; | ||
163 | + } | ||
164 | + | ||
165 | + /** | ||
166 | + * 获取 endTime | ||
167 | + * @return | ||
168 | + */ | ||
169 | + public Date getEndTime(){ | ||
170 | + return endTime; | ||
171 | + } | ||
172 | + | ||
173 | + /** | ||
174 | + * 设置 endTime | ||
175 | + * @param endTime | ||
176 | + */ | ||
177 | + public void setEndTime(Date endTime){ | ||
178 | + this.endTime = endTime; | ||
179 | + } | ||
180 | + | ||
181 | + /** | ||
182 | + * 获取 ctime | ||
183 | + * @return | ||
184 | + */ | ||
185 | + public Date getCtime(){ | ||
186 | + return ctime; | ||
187 | + } | ||
188 | + | ||
189 | + /** | ||
190 | + * 设置 ctime | ||
191 | + * @param ctime | ||
192 | + */ | ||
193 | + public void setCtime(Date ctime){ | ||
194 | + this.ctime = ctime; | ||
195 | + } | ||
196 | + | ||
197 | + /** | ||
198 | + * 获取 utime | ||
199 | + * @return | ||
200 | + */ | ||
201 | + public String getUtime(){ | ||
202 | + return utime; | ||
203 | + } | ||
204 | + | ||
205 | + /** | ||
206 | + * 设置 utime | ||
207 | + * @param utime | ||
208 | + */ | ||
209 | + public void setUtime(String utime){ | ||
210 | + this.utime = utime; | ||
211 | + } | ||
212 | + | ||
213 | + public Long getLocalityAreaId() { | ||
214 | + return localityAreaId; | ||
215 | + } | ||
216 | + | ||
217 | + public void setLocalityAreaId(Long localityAreaId) { | ||
218 | + this.localityAreaId = localityAreaId; | ||
219 | + } | ||
220 | + | ||
221 | + public Integer getUnitId() { | ||
222 | + return unitId; | ||
223 | + } | ||
224 | + | ||
225 | + public void setUnitId(Integer unitId) { | ||
226 | + this.unitId = unitId; | ||
227 | + } | ||
228 | + | ||
229 | + public List<Integer> getStatuses() { | ||
230 | + return statuses; | ||
231 | + } | ||
232 | + | ||
233 | + public void setStatuses(List<Integer> statuses) { | ||
234 | + this.statuses = statuses; | ||
235 | + } | ||
236 | +} | ||
0 | \ No newline at end of file | 237 | \ No newline at end of file |
titan-worker/src/main/java/com/dili/titan/domain/ProductAuth.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 | + * productAuth | ||
11 | + * @author dev-center | ||
12 | + * @since 2014-10-29 | ||
13 | + */ | ||
14 | +public class ProductAuth extends BaseQuery implements java.io.Serializable{ | ||
15 | + private static final long serialVersionUID = 1L; | ||
16 | + private Long id; | ||
17 | + private Long pid; | ||
18 | + private Long authId; | ||
19 | + private String authUrl; | ||
20 | + private Integer status; | ||
21 | + private Date authEndTime; | ||
22 | + private Date ctime; | ||
23 | + private String utime; | ||
24 | + | ||
25 | + /** 状态 : 生效 */ | ||
26 | + public static final Integer PRODUCT_AUTH_STATE_VALID = 1; | ||
27 | + | ||
28 | + /** 状态:失效 */ | ||
29 | + public static final Integer PRODUCT_AUTH_STATE_INVALID = 2; | ||
30 | + | ||
31 | + public ProductAuth(){ | ||
32 | + //默认无参构造方法 | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * 获取 pid | ||
37 | + * @return | ||
38 | + */ | ||
39 | + public Long getPid(){ | ||
40 | + return pid; | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * 设置 pid | ||
45 | + * @param pid | ||
46 | + */ | ||
47 | + public void setPid(Long pid){ | ||
48 | + this.pid = pid; | ||
49 | + } | ||
50 | + | ||
51 | + /** | ||
52 | + * 获取 authId | ||
53 | + * @return | ||
54 | + */ | ||
55 | + public Long getAuthId(){ | ||
56 | + return authId; | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * 设置 authId | ||
61 | + * @param authId | ||
62 | + */ | ||
63 | + public void setAuthId(Long authId){ | ||
64 | + this.authId = authId; | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * 获取 authUrl | ||
69 | + * @return | ||
70 | + */ | ||
71 | + public String getAuthUrl(){ | ||
72 | + return authUrl; | ||
73 | + } | ||
74 | + | ||
75 | + /** | ||
76 | + * 设置 authUrl | ||
77 | + * @param authUrl | ||
78 | + */ | ||
79 | + public void setAuthUrl(String authUrl){ | ||
80 | + this.authUrl = authUrl; | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + * 获取 status | ||
85 | + * @return | ||
86 | + */ | ||
87 | + public Integer getStatus(){ | ||
88 | + return status; | ||
89 | + } | ||
90 | + | ||
91 | + /** | ||
92 | + * 设置 status | ||
93 | + * @param status | ||
94 | + */ | ||
95 | + public void setStatus(Integer status){ | ||
96 | + this.status = status; | ||
97 | + } | ||
98 | + | ||
99 | + /** | ||
100 | + * 获取 authEndTime | ||
101 | + * @return | ||
102 | + */ | ||
103 | + public Date getAuthEndTime(){ | ||
104 | + return authEndTime; | ||
105 | + } | ||
106 | + | ||
107 | + /** | ||
108 | + * 设置 authEndTime | ||
109 | + * @param authEndTime | ||
110 | + */ | ||
111 | + public void setAuthEndTime(Date authEndTime){ | ||
112 | + this.authEndTime = authEndTime; | ||
113 | + } | ||
114 | + | ||
115 | + /** | ||
116 | + * 获取 ctime | ||
117 | + * @return | ||
118 | + */ | ||
119 | + public Date getCtime(){ | ||
120 | + return ctime; | ||
121 | + } | ||
122 | + | ||
123 | + /** | ||
124 | + * 设置 ctime | ||
125 | + * @param ctime | ||
126 | + */ | ||
127 | + public void setCtime(Date ctime){ | ||
128 | + this.ctime = ctime; | ||
129 | + } | ||
130 | + | ||
131 | + /** | ||
132 | + * 获取 utime | ||
133 | + * @return | ||
134 | + */ | ||
135 | + public String getUtime(){ | ||
136 | + return utime; | ||
137 | + } | ||
138 | + | ||
139 | + public Long getId() { | ||
140 | + return id; | ||
141 | + } | ||
142 | + | ||
143 | + public void setId(Long id) { | ||
144 | + this.id = id; | ||
145 | + } | ||
146 | + | ||
147 | + /** | ||
148 | + * 设置 utime | ||
149 | + * @param utime | ||
150 | + */ | ||
151 | + public void setUtime(String utime){ | ||
152 | + this.utime = utime; | ||
153 | + } | ||
154 | +} |
titan-worker/src/main/java/com/dili/titan/domain/ProductPop.java
0 → 100644
1 | +package com.dili.titan.domain; | ||
2 | + | ||
3 | +import java.util.Date; | ||
4 | + | ||
5 | +public class ProductPop extends BaseQuery implements java.io.Serializable { | ||
6 | + | ||
7 | + private static final long serialVersionUID = 3118021493136949269L; | ||
8 | + | ||
9 | + private Long pid; | ||
10 | + private String name; | ||
11 | + private Integer indate; | ||
12 | + private Integer publishMode; | ||
13 | + private Date publishSettime; | ||
14 | + private Date publishTime; | ||
15 | + private Date dropsTime; | ||
16 | + private Integer status; | ||
17 | + private Date ctime; | ||
18 | + private Date utime; | ||
19 | + | ||
20 | + public Long getPid() { | ||
21 | + return pid; | ||
22 | + } | ||
23 | + | ||
24 | + public void setPid(Long pid) { | ||
25 | + this.pid = pid; | ||
26 | + } | ||
27 | + | ||
28 | + public String getName() { | ||
29 | + return name; | ||
30 | + } | ||
31 | + | ||
32 | + public void setName(String name) { | ||
33 | + this.name = name; | ||
34 | + } | ||
35 | + | ||
36 | + public Integer getIndate() { | ||
37 | + return indate; | ||
38 | + } | ||
39 | + | ||
40 | + public void setIndate(Integer indate) { | ||
41 | + this.indate = indate; | ||
42 | + } | ||
43 | + | ||
44 | + public Integer getPublishMode() { | ||
45 | + return publishMode; | ||
46 | + } | ||
47 | + | ||
48 | + public void setPublishMode(Integer publishMode) { | ||
49 | + this.publishMode = publishMode; | ||
50 | + } | ||
51 | + | ||
52 | + public Date getPublishSettime() { | ||
53 | + return publishSettime; | ||
54 | + } | ||
55 | + | ||
56 | + public void setPublishSettime(Date publishSettime) { | ||
57 | + this.publishSettime = publishSettime; | ||
58 | + } | ||
59 | + | ||
60 | + public Date getPublishTime() { | ||
61 | + return publishTime; | ||
62 | + } | ||
63 | + | ||
64 | + public void setPublishTime(Date publishTime) { | ||
65 | + this.publishTime = publishTime; | ||
66 | + } | ||
67 | + | ||
68 | + public Date getDropsTime() { | ||
69 | + return dropsTime; | ||
70 | + } | ||
71 | + | ||
72 | + public void setDropsTime(Date dropsTime) { | ||
73 | + this.dropsTime = dropsTime; | ||
74 | + } | ||
75 | + | ||
76 | + public Integer getStatus() { | ||
77 | + return status; | ||
78 | + } | ||
79 | + | ||
80 | + public void setStatus(Integer status) { | ||
81 | + this.status = status; | ||
82 | + } | ||
83 | + | ||
84 | + public Date getCtime() { | ||
85 | + return ctime; | ||
86 | + } | ||
87 | + | ||
88 | + public void setCtime(Date ctime) { | ||
89 | + this.ctime = ctime; | ||
90 | + } | ||
91 | + | ||
92 | + public Date getUtime() { | ||
93 | + return utime; | ||
94 | + } | ||
95 | + | ||
96 | + public void setUtime(Date utime) { | ||
97 | + this.utime = utime; | ||
98 | + } | ||
99 | + | ||
100 | +} |
titan-worker/src/main/java/com/dili/titan/domain/ProductVideo.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 | + * productVideo | ||
11 | + * @author dev-center | ||
12 | + * @since 2014-10-29 | ||
13 | + */ | ||
14 | +public class ProductVideo extends BaseQuery implements java.io.Serializable { | ||
15 | + private static final long serialVersionUID = 1L; | ||
16 | + /** | ||
17 | + * 状态:正常 | ||
18 | + */ | ||
19 | + public static final int STATUS_NORMAL = 1; | ||
20 | + /** | ||
21 | + * 状态:删除 | ||
22 | + */ | ||
23 | + public static final int STATUS_DEL = -1; | ||
24 | + private Long pid; | ||
25 | + private Long videoId; | ||
26 | + private Integer status; | ||
27 | + private Date ctime; | ||
28 | + private String utime; | ||
29 | + | ||
30 | + private String name; | ||
31 | + private Integer productStatus; | ||
32 | + | ||
33 | + public ProductVideo(){ | ||
34 | + //默认无参构造方法 | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * 获取 pid | ||
39 | + * @return | ||
40 | + */ | ||
41 | + public Long getPid(){ | ||
42 | + return pid; | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * 设置 pid | ||
47 | + * @param pid | ||
48 | + */ | ||
49 | + public void setPid(Long pid){ | ||
50 | + this.pid = pid; | ||
51 | + } | ||
52 | + | ||
53 | + | ||
54 | + public Long getVideoId() { | ||
55 | + return videoId; | ||
56 | + } | ||
57 | + | ||
58 | + public void setVideoId(Long videoId) { | ||
59 | + this.videoId = videoId; | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * 获取 status | ||
64 | + * @return | ||
65 | + */ | ||
66 | + public Integer getStatus(){ | ||
67 | + return status; | ||
68 | + } | ||
69 | + | ||
70 | + public String getName() { | ||
71 | + return name; | ||
72 | + } | ||
73 | + | ||
74 | + public void setName(String name) { | ||
75 | + this.name = name; | ||
76 | + } | ||
77 | + | ||
78 | + public Integer getProductStatus() { | ||
79 | + return productStatus; | ||
80 | + } | ||
81 | + | ||
82 | + public void setProductStatus(Integer productStatus) { | ||
83 | + this.productStatus = productStatus; | ||
84 | + } | ||
85 | + | ||
86 | + /** | ||
87 | + * 设置 status | ||
88 | + * @param status | ||
89 | + */ | ||
90 | + public void setStatus(Integer status){ | ||
91 | + this.status = status; | ||
92 | + } | ||
93 | + | ||
94 | + /** | ||
95 | + * 获取 ctime | ||
96 | + * @return | ||
97 | + */ | ||
98 | + public Date getCtime(){ | ||
99 | + return ctime; | ||
100 | + } | ||
101 | + | ||
102 | + /** | ||
103 | + * 设置 ctime | ||
104 | + * @param ctime | ||
105 | + */ | ||
106 | + public void setCtime(Date ctime){ | ||
107 | + this.ctime = ctime; | ||
108 | + } | ||
109 | + | ||
110 | + /** | ||
111 | + * 获取 utime | ||
112 | + * @return | ||
113 | + */ | ||
114 | + public String getUtime(){ | ||
115 | + return utime; | ||
116 | + } | ||
117 | + | ||
118 | + /** | ||
119 | + * 设置 utime | ||
120 | + * @param utime | ||
121 | + */ | ||
122 | + public void setUtime(String utime){ | ||
123 | + this.utime = utime; | ||
124 | + } | ||
125 | +} |
titan-worker/src/main/java/com/dili/titan/domain/Purchase.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2015 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.domain; | ||
6 | + | ||
7 | + | ||
8 | +import java.util.Date; | ||
9 | +import java.util.List; | ||
10 | + | ||
11 | +/** | ||
12 | + * purchase | ||
13 | + * @author dev-center | ||
14 | + * @since 2015-07-24 | ||
15 | + */ | ||
16 | +public class Purchase extends BaseDomain { | ||
17 | + private static final long serialVersionUID = 1L; | ||
18 | + | ||
19 | + private Long categoryId; | ||
20 | + private Long producingAreaId; | ||
21 | + private Long localityAreaId; | ||
22 | + private Integer count; | ||
23 | + private Integer unitId; | ||
24 | + private String phone; | ||
25 | + private Date expireTime; | ||
26 | + private Integer status; | ||
27 | + private Long userId; | ||
28 | + private Integer source; | ||
29 | + private String reason; | ||
30 | + private Date ctime; | ||
31 | + private String utime; | ||
32 | + | ||
33 | + //查询参数 | ||
34 | + private List<Integer> statuses; | ||
35 | + | ||
36 | + public Purchase(){ | ||
37 | + //默认无参构造方法 | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * 获取 categoryId | ||
42 | + * @return | ||
43 | + */ | ||
44 | + public Long getCategoryId(){ | ||
45 | + return categoryId; | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * 设置 categoryId | ||
50 | + * @param categoryId | ||
51 | + */ | ||
52 | + public void setCategoryId(Long categoryId){ | ||
53 | + this.categoryId = categoryId; | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * 获取 count | ||
58 | + * @return | ||
59 | + */ | ||
60 | + public Integer getCount(){ | ||
61 | + return count; | ||
62 | + } | ||
63 | + | ||
64 | + /** | ||
65 | + * 设置 count | ||
66 | + * @param count | ||
67 | + */ | ||
68 | + public void setCount(Integer count){ | ||
69 | + this.count = count; | ||
70 | + } | ||
71 | + | ||
72 | + /** | ||
73 | + * 获取 phone | ||
74 | + * @return | ||
75 | + */ | ||
76 | + public String getPhone(){ | ||
77 | + return phone; | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * 设置 phone | ||
82 | + * @param phone | ||
83 | + */ | ||
84 | + public void setPhone(String phone){ | ||
85 | + this.phone = phone; | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * 获取 expireTime | ||
90 | + * @return | ||
91 | + */ | ||
92 | + public Date getExpireTime(){ | ||
93 | + return expireTime; | ||
94 | + } | ||
95 | + | ||
96 | + /** | ||
97 | + * 设置 expireTime | ||
98 | + * @param expireTime | ||
99 | + */ | ||
100 | + public void setExpireTime(Date expireTime){ | ||
101 | + this.expireTime = expireTime; | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * 获取 status | ||
106 | + * @return | ||
107 | + */ | ||
108 | + public Integer getStatus(){ | ||
109 | + return status; | ||
110 | + } | ||
111 | + | ||
112 | + /** | ||
113 | + * 设置 status | ||
114 | + * @param status | ||
115 | + */ | ||
116 | + public void setStatus(Integer status){ | ||
117 | + this.status = status; | ||
118 | + } | ||
119 | + | ||
120 | + /** | ||
121 | + * 获取 userId | ||
122 | + * @return | ||
123 | + */ | ||
124 | + public Long getUserId(){ | ||
125 | + return userId; | ||
126 | + } | ||
127 | + | ||
128 | + /** | ||
129 | + * 设置 userId | ||
130 | + * @param userId | ||
131 | + */ | ||
132 | + public void setUserId(Long userId){ | ||
133 | + this.userId = userId; | ||
134 | + } | ||
135 | + | ||
136 | + /** | ||
137 | + * 获取 source | ||
138 | + * @return | ||
139 | + */ | ||
140 | + public Integer getSource(){ | ||
141 | + return source; | ||
142 | + } | ||
143 | + | ||
144 | + /** | ||
145 | + * 设置 source | ||
146 | + * @param source | ||
147 | + */ | ||
148 | + public void setSource(Integer source){ | ||
149 | + this.source = source; | ||
150 | + } | ||
151 | + | ||
152 | + /** | ||
153 | + * 获取 reason | ||
154 | + * @return | ||
155 | + */ | ||
156 | + public String getReason(){ | ||
157 | + return reason; | ||
158 | + } | ||
159 | + | ||
160 | + /** | ||
161 | + * 设置 reason | ||
162 | + * @param reason | ||
163 | + */ | ||
164 | + public void setReason(String reason){ | ||
165 | + this.reason = reason; | ||
166 | + } | ||
167 | + | ||
168 | + /** | ||
169 | + * 获取 ctime | ||
170 | + * @return | ||
171 | + */ | ||
172 | + public Date getCtime(){ | ||
173 | + return ctime; | ||
174 | + } | ||
175 | + | ||
176 | + /** | ||
177 | + * 设置 ctime | ||
178 | + * @param ctime | ||
179 | + */ | ||
180 | + public void setCtime(Date ctime){ | ||
181 | + this.ctime = ctime; | ||
182 | + } | ||
183 | + | ||
184 | + /** | ||
185 | + * 获取 utime | ||
186 | + * @return | ||
187 | + */ | ||
188 | + public String getUtime(){ | ||
189 | + return utime; | ||
190 | + } | ||
191 | + | ||
192 | + /** | ||
193 | + * 设置 utime | ||
194 | + * @param utime | ||
195 | + */ | ||
196 | + public void setUtime(String utime){ | ||
197 | + this.utime = utime; | ||
198 | + } | ||
199 | + | ||
200 | + public Long getLocalityAreaId() { | ||
201 | + return localityAreaId; | ||
202 | + } | ||
203 | + | ||
204 | + public void setLocalityAreaId(Long localityAreaId) { | ||
205 | + this.localityAreaId = localityAreaId; | ||
206 | + } | ||
207 | + | ||
208 | + public Integer getUnitId() { | ||
209 | + return unitId; | ||
210 | + } | ||
211 | + | ||
212 | + public void setUnitId(Integer unitId) { | ||
213 | + this.unitId = unitId; | ||
214 | + } | ||
215 | + | ||
216 | + public List<Integer> getStatuses() { | ||
217 | + return statuses; | ||
218 | + } | ||
219 | + | ||
220 | + public void setStatuses(List<Integer> statuses) { | ||
221 | + this.statuses = statuses; | ||
222 | + } | ||
223 | + | ||
224 | + public Long getProducingAreaId() { | ||
225 | + return producingAreaId; | ||
226 | + } | ||
227 | + | ||
228 | + public void setProducingAreaId(Long producingAreaId) { | ||
229 | + this.producingAreaId = producingAreaId; | ||
230 | + } | ||
231 | +} | ||
0 | \ No newline at end of file | 232 | \ No newline at end of file |
titan-worker/src/main/java/com/dili/titan/domain/Supply.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2015 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.domain; | ||
6 | + | ||
7 | + | ||
8 | +import java.util.Date; | ||
9 | +import java.util.List; | ||
10 | + | ||
11 | +/** | ||
12 | + * supply | ||
13 | + * @author dev-center | ||
14 | + * @since 2015-07-24 | ||
15 | + */ | ||
16 | +public class Supply extends BaseDomain { | ||
17 | + private static final long serialVersionUID = 1L; | ||
18 | + private Long categoryId; | ||
19 | + private Long localityAreaId; | ||
20 | + private Long producingAreaId; | ||
21 | + private Long price; | ||
22 | + private Integer count; | ||
23 | + private Integer unitId; | ||
24 | + private Long userId; | ||
25 | + private String phone; | ||
26 | + private Date expireTime; | ||
27 | + private Integer status; | ||
28 | + private Integer source; | ||
29 | + private String reason; | ||
30 | + private Date ctime; | ||
31 | + private String utime; | ||
32 | + //查询参数 | ||
33 | + private List<Integer> statuses; | ||
34 | + | ||
35 | + | ||
36 | + public Supply(){ | ||
37 | + //默认无参构造方法 | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * 获取 categoryId | ||
42 | + * @return | ||
43 | + */ | ||
44 | + public Long getCategoryId(){ | ||
45 | + return categoryId; | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * 设置 categoryId | ||
50 | + * @param categoryId | ||
51 | + */ | ||
52 | + public void setCategoryId(Long categoryId){ | ||
53 | + this.categoryId = categoryId; | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * 获取 price | ||
58 | + * @return | ||
59 | + */ | ||
60 | + public Long getPrice(){ | ||
61 | + return price; | ||
62 | + } | ||
63 | + | ||
64 | + /** | ||
65 | + * 设置 price | ||
66 | + * @param price | ||
67 | + */ | ||
68 | + public void setPrice(Long price){ | ||
69 | + this.price = price; | ||
70 | + } | ||
71 | + | ||
72 | + /** | ||
73 | + * 获取 count | ||
74 | + * @return | ||
75 | + */ | ||
76 | + public Integer getCount(){ | ||
77 | + return count; | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * 设置 count | ||
82 | + * @param count | ||
83 | + */ | ||
84 | + public void setCount(Integer count){ | ||
85 | + this.count = count; | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * 获取 userId | ||
90 | + * @return | ||
91 | + */ | ||
92 | + public Long getUserId(){ | ||
93 | + return userId; | ||
94 | + } | ||
95 | + | ||
96 | + /** | ||
97 | + * 设置 userId | ||
98 | + * @param userId | ||
99 | + */ | ||
100 | + public void setUserId(Long userId){ | ||
101 | + this.userId = userId; | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * 获取 phone | ||
106 | + * @return | ||
107 | + */ | ||
108 | + public String getPhone(){ | ||
109 | + return phone; | ||
110 | + } | ||
111 | + | ||
112 | + /** | ||
113 | + * 设置 phone | ||
114 | + * @param phone | ||
115 | + */ | ||
116 | + public void setPhone(String phone){ | ||
117 | + this.phone = phone; | ||
118 | + } | ||
119 | + | ||
120 | + /** | ||
121 | + * 获取 expireTime | ||
122 | + * @return | ||
123 | + */ | ||
124 | + public Date getExpireTime(){ | ||
125 | + return expireTime; | ||
126 | + } | ||
127 | + | ||
128 | + /** | ||
129 | + * 设置 expireTime | ||
130 | + * @param expireTime | ||
131 | + */ | ||
132 | + public void setExpireTime(Date expireTime){ | ||
133 | + this.expireTime = expireTime; | ||
134 | + } | ||
135 | + | ||
136 | + /** | ||
137 | + * 获取 status | ||
138 | + * @return | ||
139 | + */ | ||
140 | + public Integer getStatus(){ | ||
141 | + return status; | ||
142 | + } | ||
143 | + | ||
144 | + /** | ||
145 | + * 设置 status | ||
146 | + * @param status | ||
147 | + */ | ||
148 | + public void setStatus(Integer status){ | ||
149 | + this.status = status; | ||
150 | + } | ||
151 | + | ||
152 | + /** | ||
153 | + * 获取 source | ||
154 | + * @return | ||
155 | + */ | ||
156 | + public Integer getSource(){ | ||
157 | + return source; | ||
158 | + } | ||
159 | + | ||
160 | + /** | ||
161 | + * 设置 source | ||
162 | + * @param source | ||
163 | + */ | ||
164 | + public void setSource(Integer source){ | ||
165 | + this.source = source; | ||
166 | + } | ||
167 | + | ||
168 | + /** | ||
169 | + * 获取 reason | ||
170 | + * @return | ||
171 | + */ | ||
172 | + public String getReason(){ | ||
173 | + return reason; | ||
174 | + } | ||
175 | + | ||
176 | + /** | ||
177 | + * 设置 reason | ||
178 | + * @param reason | ||
179 | + */ | ||
180 | + public void setReason(String reason){ | ||
181 | + this.reason = reason; | ||
182 | + } | ||
183 | + | ||
184 | + /** | ||
185 | + * 获取 ctime | ||
186 | + * @return | ||
187 | + */ | ||
188 | + public Date getCtime(){ | ||
189 | + return ctime; | ||
190 | + } | ||
191 | + | ||
192 | + /** | ||
193 | + * 设置 ctime | ||
194 | + * @param ctime | ||
195 | + */ | ||
196 | + public void setCtime(Date ctime){ | ||
197 | + this.ctime = ctime; | ||
198 | + } | ||
199 | + | ||
200 | + /** | ||
201 | + * 获取 utime | ||
202 | + * @return | ||
203 | + */ | ||
204 | + public String getUtime(){ | ||
205 | + return utime; | ||
206 | + } | ||
207 | + | ||
208 | + /** | ||
209 | + * 设置 utime | ||
210 | + * @param utime | ||
211 | + */ | ||
212 | + public void setUtime(String utime){ | ||
213 | + this.utime = utime; | ||
214 | + } | ||
215 | + | ||
216 | + public Long getProducingAreaId() { | ||
217 | + return producingAreaId; | ||
218 | + } | ||
219 | + | ||
220 | + public void setProducingAreaId(Long producingAreaId) { | ||
221 | + this.producingAreaId = producingAreaId; | ||
222 | + } | ||
223 | + | ||
224 | + public Integer getUnitId() { | ||
225 | + return unitId; | ||
226 | + } | ||
227 | + | ||
228 | + public void setUnitId(Integer unitId) { | ||
229 | + this.unitId = unitId; | ||
230 | + } | ||
231 | + | ||
232 | + public List<Integer> getStatuses() { | ||
233 | + return statuses; | ||
234 | + } | ||
235 | + | ||
236 | + public void setStatuses(List<Integer> statuses) { | ||
237 | + this.statuses = statuses; | ||
238 | + } | ||
239 | + | ||
240 | + public Long getLocalityAreaId() { | ||
241 | + return localityAreaId; | ||
242 | + } | ||
243 | + | ||
244 | + public void setLocalityAreaId(Long localityAreaId) { | ||
245 | + this.localityAreaId = localityAreaId; | ||
246 | + } | ||
247 | +} | ||
0 | \ No newline at end of file | 248 | \ No newline at end of file |
titan-worker/src/main/java/com/dili/titan/domain/Video.java
0 → 100644
1 | +package com.dili.titan.domain; | ||
2 | + | ||
3 | +import java.util.Date; | ||
4 | +import java.util.List; | ||
5 | + | ||
6 | +/** | ||
7 | + * <B>Description</B> <br /> | ||
8 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
9 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
10 | + * <B>Company</B> 地利集团 | ||
11 | + * @createTime 2014-12-25 17:37:24 | ||
12 | + * @author template | ||
13 | + */public class Video extends BaseQuery { | ||
14 | + | ||
15 | + private Long id; | ||
16 | + | ||
17 | + /** | ||
18 | + * | ||
19 | + */ | ||
20 | + private String name; | ||
21 | + /** | ||
22 | + * | ||
23 | + */ | ||
24 | + private Long categoryId; | ||
25 | + | ||
26 | + private String categoryName; | ||
27 | + //视频资源id | ||
28 | + private String fileId; | ||
29 | + //视频url | ||
30 | + private String pageUrl; | ||
31 | + //视频图片 | ||
32 | + private String img; | ||
33 | + /** | ||
34 | + * | ||
35 | + */ | ||
36 | + private Integer status; | ||
37 | + | ||
38 | + private Integer aqyStatus; | ||
39 | + | ||
40 | + private String reason; | ||
41 | + | ||
42 | + /** | ||
43 | + * | ||
44 | + */ | ||
45 | + private String description; | ||
46 | + /** | ||
47 | + * | ||
48 | + */ | ||
49 | + private Date ctime; | ||
50 | + /** | ||
51 | + * | ||
52 | + */ | ||
53 | + private Date utime; | ||
54 | + | ||
55 | + /** | ||
56 | + * 用于页面条件查询的 | ||
57 | + */ | ||
58 | + private List<Integer> cateList; | ||
59 | + | ||
60 | + /*状态---删除*/ | ||
61 | + public static final int STATUS_DELETE = -1; | ||
62 | + /*状态--审核中*/ | ||
63 | + public static final int STATUS_AUDIT = 1; | ||
64 | + /*状态--审核通过*/ | ||
65 | + public static final int STATUS_AUDIT_COMPLETE = 2; | ||
66 | + /*状态--审核拒绝*/ | ||
67 | + public static final int STATUS_AUDIT_REFUSE = 3; | ||
68 | + /*状态--查询 审核通过或审核中并且图片为空的数据*/ | ||
69 | + public static final int STATUS_AUDIT_COMPLETE_BOTH = 5; | ||
70 | + | ||
71 | + public void setName (String name){ | ||
72 | + this.name = name; | ||
73 | + } | ||
74 | + public String getName(){ | ||
75 | + return this.name; | ||
76 | + } | ||
77 | + | ||
78 | + public void setCategoryId (Long categoryId){ | ||
79 | + this.categoryId = categoryId; | ||
80 | + } | ||
81 | + public Long getCategoryId(){ | ||
82 | + return this.categoryId; | ||
83 | + } | ||
84 | + | ||
85 | + public void setStatus (Integer status){ | ||
86 | + this.status = status; | ||
87 | + } | ||
88 | + public Integer getStatus(){ | ||
89 | + return this.status; | ||
90 | + } | ||
91 | + | ||
92 | + public Long getId() { | ||
93 | + return id; | ||
94 | + } | ||
95 | + public void setId(Long id) { | ||
96 | + this.id = id; | ||
97 | + } | ||
98 | + public void setDescription (String description){ | ||
99 | + this.description = description; | ||
100 | + } | ||
101 | + public String getDescription(){ | ||
102 | + return this.description; | ||
103 | + } | ||
104 | + | ||
105 | + public void setCtime (Date ctime){ | ||
106 | + this.ctime = ctime; | ||
107 | + } | ||
108 | + public Date getCtime(){ | ||
109 | + return this.ctime; | ||
110 | + } | ||
111 | + | ||
112 | + public void setUtime (Date utime){ | ||
113 | + this.utime = utime; | ||
114 | + } | ||
115 | + public Date getUtime(){ | ||
116 | + return this.utime; | ||
117 | + } | ||
118 | + public List<Integer> getCateList() { | ||
119 | + return cateList; | ||
120 | + } | ||
121 | + public void setCateList(List<Integer> cateList) { | ||
122 | + this.cateList = cateList; | ||
123 | + } | ||
124 | + public String getCategoryName() { | ||
125 | + return categoryName; | ||
126 | + } | ||
127 | + public void setCategoryName(String categoryName) { | ||
128 | + this.categoryName = categoryName; | ||
129 | + } | ||
130 | + public String getFileId() { | ||
131 | + return fileId; | ||
132 | + } | ||
133 | + public void setFileId(String fileId) { | ||
134 | + this.fileId = fileId; | ||
135 | + } | ||
136 | + public String getPageUrl() { | ||
137 | + return pageUrl; | ||
138 | + } | ||
139 | + public void setPageUrl(String pageUrl) { | ||
140 | + this.pageUrl = pageUrl; | ||
141 | + } | ||
142 | + public String getImg() { | ||
143 | + return img; | ||
144 | + } | ||
145 | + public void setImg(String img) { | ||
146 | + this.img = img; | ||
147 | + } | ||
148 | + | ||
149 | + public Integer getAqyStatus() { | ||
150 | + return aqyStatus; | ||
151 | + } | ||
152 | + | ||
153 | + public void setAqyStatus(Integer aqyStatus) { | ||
154 | + this.aqyStatus = aqyStatus; | ||
155 | + } | ||
156 | + | ||
157 | + public String getReason() { | ||
158 | + return reason; | ||
159 | + } | ||
160 | + | ||
161 | + public void setReason(String reason) { | ||
162 | + this.reason = reason; | ||
163 | + } | ||
164 | + | ||
165 | + @Override | ||
166 | + public String toString() { | ||
167 | + return "Video [id=" + id + ", name=" + name + ", categoryId=" | ||
168 | + + categoryId + ", categoryName=" + categoryName + ", fileId=" | ||
169 | + + fileId + ", pageUrl=" + pageUrl + ", img=" + img | ||
170 | + + ", status=" + status + ", description=" + description | ||
171 | + + ", ctime=" + ctime + ", utime=" + utime + ", cateList=" | ||
172 | + + cateList + "]"; | ||
173 | + } | ||
174 | + | ||
175 | + | ||
176 | +} |
titan-worker/src/main/java/com/dili/titan/mq/TopicProducer.java
0 → 100644
1 | +package com.dili.titan.mq; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONArray; | ||
4 | +import com.alibaba.rocketmq.common.message.Message; | ||
5 | +import com.diligrp.util.exception.DiliUtilException; | ||
6 | +import com.diligrp.util.rocketMQUtil.DiliMQProducer; | ||
7 | +import org.apache.commons.logging.Log; | ||
8 | +import org.apache.commons.logging.LogFactory; | ||
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 | + | ||
17 | +/** | ||
18 | + * <B>Description</B> 发送mq消息 <br /> | ||
19 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | ||
20 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | ||
21 | + * <B>Company</B> 地利集团 | ||
22 | + * @createTime 2014年7月19日 上午10:38:10 | ||
23 | + * @author yangjianjun | ||
24 | + */ | ||
25 | +@Component("topicProducer") | ||
26 | +public class TopicProducer { | ||
27 | + public static final Log logger = LogFactory.getLog(TopicProducer.class); | ||
28 | + @Autowired | ||
29 | + private DiliMQProducer diliMQProducer; | ||
30 | + | ||
31 | + /** | ||
32 | + * 发送消息 | ||
33 | + * | ||
34 | + * @param destination | ||
35 | + * @param message | ||
36 | + */ | ||
37 | + public void send(final String destination, final String message) { | ||
38 | + Message mesg = new Message(destination, "pnr", message.getBytes(Charset.forName("UTF-8"))); | ||
39 | + try { | ||
40 | + diliMQProducer.sendMsg(mesg); | ||
41 | + } catch (DiliUtilException e) { | ||
42 | + e.printStackTrace(); | ||
43 | + } | ||
44 | + logger.info( "发送MQ!KEY="+destination+",内容="+message); | ||
45 | + } | ||
46 | +// /** | ||
47 | +// * this method is 发送产品mq消息 | ||
48 | +// * @param pid | ||
49 | +// * @param oper | ||
50 | +// * @createTime 2014年7月10日 下午8:13:11 | ||
51 | +// * @author yangjianjun | ||
52 | +// */ | ||
53 | +// public void sendMQProduct(Object pid,int oper){ | ||
54 | +// if(pid.toString().startsWith("1")||pid.toString().startsWith("8")) { | ||
55 | +// Map<String, Object> mapMQ = new HashMap<String, Object>(); | ||
56 | +// mapMQ.put("pid", pid); | ||
57 | +// mapMQ.put("oper", oper); | ||
58 | +// this.send("Titan_Cache_Product", | ||
59 | +// JSONArray.toJSON(mapMQ).toString()); | ||
60 | +// } | ||
61 | +// } | ||
62 | +// | ||
63 | + /** | ||
64 | + * this method is 发送产品mq消息 | ||
65 | + * @param pid | ||
66 | + * @param oper 1: 插入商品,2:修改信息,3:删除商品 | ||
67 | + * @param sign 1:修改商品,2:修改商品价格或库存, 3: 删除商品, 4: 修改商品认证信息, 5: 更新商品状态,6:批量设置第三方商品自定义分类 ,7:修改商品基础信息 | ||
68 | + * @createTime 2015年6月4日 上午10:58:41 | ||
69 | + * @author yangwd | ||
70 | + */ | ||
71 | + public void sendMQProduct(Object pid, int oper,int sign) { | ||
72 | + if (pid.toString().startsWith("1") || pid.toString().startsWith("8")) { | ||
73 | + Map<String, Object> mapMQ = new HashMap<String, Object>(); | ||
74 | + mapMQ.put("pid", pid); | ||
75 | + mapMQ.put("oper", oper); | ||
76 | + mapMQ.put("sign", sign); | ||
77 | + this.send("Titan_Cache_Product", JSONArray.toJSON(mapMQ).toString()); | ||
78 | + } | ||
79 | + } | ||
80 | + | ||
81 | + /** | ||
82 | + * this method is 供应单mq消息 | ||
83 | + * @param oper | ||
84 | + * @createTime 2014年12月23日 下午4:47:19 | ||
85 | + * @author yangwd | ||
86 | + */ | ||
87 | + public void sendMQSupply(Object pid, int oper) { | ||
88 | + Map<String, Object> mapMQ = new HashMap<String, Object>(); | ||
89 | + mapMQ.put("pid", pid); | ||
90 | + mapMQ.put("oper", oper); | ||
91 | + this.send("Titan_Cache_Supply", JSONArray.toJSON(mapMQ).toString()); | ||
92 | + } | ||
93 | + | ||
94 | + /** | ||
95 | + * this method is 求购单mq消息 | ||
96 | + * @param oper | ||
97 | + * @createTime 2014年12月23日 下午4:47:35 | ||
98 | + * @author yangwd | ||
99 | + */ | ||
100 | + public void sendMQPurchase(Object pid, int oper) { | ||
101 | + Map<String, Object> mapMQ = new HashMap<String, Object>(); | ||
102 | + mapMQ.put("pid", pid); | ||
103 | + mapMQ.put("oper", oper); | ||
104 | + this.send("Titan_Cache_Purchase", JSONArray.toJSON(mapMQ).toString()); | ||
105 | + } | ||
106 | + | ||
107 | + public void sendMQPresale(Object pid, int oper) { | ||
108 | + Map<String, Object> mapMQ = new HashMap<String, Object>(); | ||
109 | + mapMQ.put("pid", pid); | ||
110 | + mapMQ.put("oper", oper); | ||
111 | + this.send("Titan_Cache_Presale", JSONArray.toJSON(mapMQ).toString()); | ||
112 | + } | ||
113 | +} |
titan-worker/src/main/java/com/dili/titan/rpc/ConfigRPC.java
0 → 100644
1 | +package com.dili.titan.rpc; | ||
2 | + | ||
3 | +import com.diligrp.website.web.interfaces.domain.output.DataDictionaryValueResp; | ||
4 | +import com.diligrp.website.web.interfaces.domain.output.PickUpPointResp; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | +import java.util.Map; | ||
8 | + | ||
9 | +public interface ConfigRPC { | ||
10 | + /** | ||
11 | + * this method is 获取所有有效期设置 | ||
12 | + * @return | ||
13 | + * @createTime 2014年7月17日 下午6:16:14 | ||
14 | + * @author yangjianjun | ||
15 | + */ | ||
16 | + Map<Long, DataDictionaryValueResp> getInDate(); | ||
17 | + | ||
18 | +} |
titan-worker/src/main/java/com/dili/titan/rpc/impl/ConfigRPCImpl.java
0 → 100644
1 | +package com.dili.titan.rpc.impl; | ||
2 | + | ||
3 | +import com.dili.titan.rpc.ConfigRPC; | ||
4 | +import com.diligrp.website.web.interfaces.WebsiteClient; | ||
5 | +import com.diligrp.website.web.interfaces.domain.output.DataDictionaryResp; | ||
6 | +import com.diligrp.website.web.interfaces.domain.output.DataDictionaryValueResp; | ||
7 | +import org.apache.commons.collections.CollectionUtils; | ||
8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
9 | +import org.springframework.stereotype.Service; | ||
10 | + | ||
11 | +import java.util.HashMap; | ||
12 | +import java.util.Map; | ||
13 | + | ||
14 | +@Service("configRPC") | ||
15 | +public class ConfigRPCImpl implements ConfigRPC { | ||
16 | + @Autowired | ||
17 | + private WebsiteClient websiteClient; | ||
18 | + @Override | ||
19 | + public Map<Long, DataDictionaryValueResp> getInDate() { | ||
20 | + DataDictionaryResp ddr = websiteClient.getDataDictionaryService() | ||
21 | + .getDataDictionary("DIC_TERM_OF_VALIDITY_SELLER"); | ||
22 | + Map<Long, DataDictionaryValueResp> map = new HashMap<Long, DataDictionaryValueResp>(); | ||
23 | + if(ddr==null || CollectionUtils.isEmpty(ddr.getValues())){ | ||
24 | + return map; | ||
25 | + } | ||
26 | + for(DataDictionaryValueResp ddvr : ddr.getValues()){ | ||
27 | + map.put(ddvr.getId(),ddvr); | ||
28 | + } | ||
29 | + return map; | ||
30 | + } | ||
31 | +} |
titan-worker/src/main/java/com/dili/titan/service/PresaleService.java
0 → 100644
1 | +package com.dili.titan.service; | ||
2 | + | ||
3 | +import com.dili.titan.domain.Page; | ||
4 | +import com.dili.titan.domain.Presale; | ||
5 | +import com.dili.titan.service.base.BaseService; | ||
6 | + | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | + | ||
10 | +/** | ||
11 | + * Created by gsz on 2015/7/28. | ||
12 | + */ | ||
13 | +public interface PresaleService extends BaseService<Presale,Long> { | ||
14 | + /** | ||
15 | + * 分页获取过期预售信息 | ||
16 | + * @param page | ||
17 | + * @return | ||
18 | + */ | ||
19 | + public Page<Long> expirePresale(int page); | ||
20 | + | ||
21 | + /** | ||
22 | + * 批量设置过期 | ||
23 | + * @param ids | ||
24 | + * @return | ||
25 | + */ | ||
26 | + public int batchExpire(List<Long> ids); | ||
27 | +} |
titan-worker/src/main/java/com/dili/titan/service/ProductAuthService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.service; | ||
6 | + | ||
7 | +import com.dili.titan.domain.ProductAuth; | ||
8 | +import com.dili.titan.service.base.BaseService; | ||
9 | + | ||
10 | +import java.util.List; | ||
11 | + | ||
12 | +/** | ||
13 | + * ProductAuthService接口 | ||
14 | + * @author dev-center | ||
15 | + * @since 2014-10-29 | ||
16 | + */ | ||
17 | +public interface ProductAuthService extends BaseService<ProductAuth,Long> { | ||
18 | + | ||
19 | + | ||
20 | + /** | ||
21 | + * this method is 定时更新数据 | ||
22 | + * @return | ||
23 | + * @createTime 2014年11月4日 下午4:48:32 | ||
24 | + * @author yangweidong | ||
25 | + */ | ||
26 | + public int updateProductAuth(List<ProductAuth> paList); | ||
27 | + | ||
28 | + /** | ||
29 | + * this method is 查询将要失效的认证数据 | ||
30 | + * @return | ||
31 | + * @createTime 2015年6月3日 下午6:18:05 | ||
32 | + * @author yangwd | ||
33 | + */ | ||
34 | + public List<ProductAuth> selectInvalidAuthData(); | ||
35 | +} |
titan-worker/src/main/java/com/dili/titan/service/ProductPopService.java
0 → 100644
1 | +package com.dili.titan.service; | ||
2 | + | ||
3 | +import com.dili.titan.domain.Page; | ||
4 | +import com.dili.titan.domain.ProductPop; | ||
5 | +import com.dili.titan.service.base.BaseService; | ||
6 | + | ||
7 | +public interface ProductPopService extends BaseService<ProductPop, Long> { | ||
8 | + | ||
9 | + public int publish(ProductPop p); | ||
10 | + | ||
11 | + public int drop(ProductPop p); | ||
12 | + /** | ||
13 | + * 获取未处理的商品(分页) | ||
14 | + * @return | ||
15 | + */ | ||
16 | + public Page<ProductPop> findUnsolved(int page); | ||
17 | +} |
titan-worker/src/main/java/com/dili/titan/service/PurchaseService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.service; | ||
6 | + | ||
7 | + | ||
8 | +import com.dili.titan.domain.Page; | ||
9 | +import com.dili.titan.domain.Purchase; | ||
10 | +import com.dili.titan.service.base.BaseService; | ||
11 | + | ||
12 | +import java.util.List; | ||
13 | + | ||
14 | +/** | ||
15 | + * PurchaseService接口 | ||
16 | + * @author dev-center | ||
17 | + * @since 2014-12-16 | ||
18 | + */ | ||
19 | +public interface PurchaseService extends BaseService<Purchase,Long> { | ||
20 | + /** | ||
21 | + * 分页获取过期求购信息 | ||
22 | + * @param page | ||
23 | + * @return | ||
24 | + */ | ||
25 | + public Page<Long> expirePurchase(int page); | ||
26 | + | ||
27 | + /** | ||
28 | + * 批量设置过期 | ||
29 | + * @param ids | ||
30 | + * @return | ||
31 | + */ | ||
32 | + public int batchExpire(List<Long> ids); | ||
33 | +} |
titan-worker/src/main/java/com/dili/titan/service/SupplyService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.service; | ||
6 | + | ||
7 | + | ||
8 | +import com.dili.titan.domain.Page; | ||
9 | +import com.dili.titan.domain.Supply; | ||
10 | +import com.dili.titan.service.base.BaseService; | ||
11 | + | ||
12 | +import java.util.List; | ||
13 | + | ||
14 | +/** | ||
15 | + * SupplyService接口 | ||
16 | + * @author dev-center | ||
17 | + * @since 2014-12-16 | ||
18 | + */ | ||
19 | +public interface SupplyService extends BaseService<Supply,Long> { | ||
20 | + | ||
21 | + /** | ||
22 | + * 分页获取过期供应信息 | ||
23 | + * @param page | ||
24 | + * @return | ||
25 | + */ | ||
26 | + public Page<Long> expireSupply(int page); | ||
27 | + | ||
28 | + /** | ||
29 | + * 批量设置过期 | ||
30 | + * @param ids | ||
31 | + * @return | ||
32 | + */ | ||
33 | + public int batchExpire(List<Long> ids); | ||
34 | + | ||
35 | +} |
titan-worker/src/main/java/com/dili/titan/service/TimeTask.java
0 → 100644
1 | +package com.dili.titan.service; | ||
2 | + | ||
3 | +import org.slf4j.Logger; | ||
4 | +import org.slf4j.LoggerFactory; | ||
5 | + | ||
6 | +import javax.annotation.PostConstruct; | ||
7 | +import javax.annotation.PreDestroy; | ||
8 | +import java.util.concurrent.Executors; | ||
9 | +import java.util.concurrent.RejectedExecutionException; | ||
10 | +import java.util.concurrent.ThreadPoolExecutor; | ||
11 | + | ||
12 | +/** | ||
13 | + * Created by gsz on 2015/7/28. | ||
14 | + */ | ||
15 | +public class TimeTask { | ||
16 | + public static final Logger log = LoggerFactory.getLogger(TimeTask.class); | ||
17 | + private ThreadPoolExecutor threadPool; | ||
18 | + private int queueMaxSize=1000;//队列中任务最大数 | ||
19 | + | ||
20 | + | ||
21 | + @PostConstruct | ||
22 | + public void init() { | ||
23 | + this.threadPool = (ThreadPoolExecutor)Executors.newFixedThreadPool(10); | ||
24 | + } | ||
25 | + | ||
26 | + protected void addTask(Runnable thread) { | ||
27 | + try { | ||
28 | + waitForFreeQueue(); | ||
29 | + threadPool.execute(thread); | ||
30 | + } catch (InterruptedException e) { | ||
31 | + log.error("【多线程任务调度器】等待任务完成被中断", e); | ||
32 | + } catch (RejectedExecutionException e) { | ||
33 | + log.error("【多线程任务调度器】线程队列饱和抛出异常,activeCount=" + threadPool.getActiveCount() + ",queueSize=" + threadPool.getQueue().size(), e); | ||
34 | + } catch (Exception e) { | ||
35 | + log.error("【多线程任务调度器】线程执行时出错了", e); | ||
36 | + } | ||
37 | + } | ||
38 | + | ||
39 | + private void waitForFreeQueue() throws InterruptedException { | ||
40 | + while (threadPool.getQueue().size() >= queueMaxSize) { | ||
41 | + log.info("【多线程任务调度器】队列有挤压,设置等待队列大小=" + queueMaxSize + ",实际使用队列大小=" + threadPool.getQueue().size()); | ||
42 | + Thread.sleep(500); | ||
43 | + } | ||
44 | + } | ||
45 | + | ||
46 | + @PreDestroy | ||
47 | + public void destroy(){ | ||
48 | + threadPool.shutdown(); | ||
49 | + } | ||
50 | +} |
titan-worker/src/main/java/com/dili/titan/service/VideoService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright (c) 2014 www.diligrp.com All rights reserved. | ||
3 | + * 本软件源代码版权归----所有,未经许可不得任意复制与传播. | ||
4 | + */ | ||
5 | +package com.dili.titan.service; | ||
6 | + | ||
7 | +import com.dili.titan.domain.Video; | ||
8 | +import com.dili.titan.service.base.BaseService; | ||
9 | + | ||
10 | +import java.util.List; | ||
11 | + | ||
12 | +/** | ||
13 | + * VideoService接口 | ||
14 | + * @author dev-center | ||
15 | + * @since 2014-12-26 | ||
16 | + */ | ||
17 | +public interface VideoService extends BaseService<Video,Long> { | ||
18 | + | ||
19 | + public int saveOrUpdate(Video video); | ||
20 | + | ||
21 | + /** | ||
22 | + * this method is 通过fileId更新数据 | ||
23 | + * @param video | ||
24 | + * @return | ||
25 | + * @createTime 2015年1月5日 下午4:32:44 | ||
26 | + * @author yangwd | ||
27 | + */ | ||
28 | + public int updateByfileId(Video video); | ||
29 | + | ||
30 | + public List<Long> findPidsByVideoId(Long videoId); | ||
31 | +} |
titan-worker/src/main/java/com/dili/titan/service/base/BaseService.java
0 → 100644
1 | +package com.dili.titan.service.base; | ||
2 | + | ||
3 | +import com.dili.titan.domain.Page; | ||
4 | + | ||
5 | +import java.io.Serializable; | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +public interface BaseService<T, KEY extends Serializable> { | ||
9 | + /** | ||
10 | + * 添加对象 | ||
11 | + * | ||
12 | + * @param t | ||
13 | + * @return 影响条数 | ||
14 | + */ | ||
15 | + int insert(T t); | ||
16 | + | ||
17 | + /** | ||
18 | + * 删除对象,条件 | ||
19 | + * | ||
20 | + * @param condtion | ||
21 | + * @return 影响条数 | ||
22 | + */ | ||
23 | + int deleteByCondtion(T condtion); | ||
24 | + | ||
25 | + /** | ||
26 | + * 更新对象,条件主键ID | ||
27 | + * | ||
28 | + * @param t | ||
29 | + * @return 影响条数 | ||
30 | + */ | ||
31 | + int updateByCondtion(T condtion); | ||
32 | + | ||
33 | + /** | ||
34 | + * 查询对象,条件主键 | ||
35 | + * | ||
36 | + * @param key | ||
37 | + * @return | ||
38 | + */ | ||
39 | + T select(KEY key); | ||
40 | + | ||
41 | + /** | ||
42 | + * 查询对象,条件主键数组 | ||
43 | + * | ||
44 | + * @param key | ||
45 | + * @return | ||
46 | + */ | ||
47 | + List<T> selectArray(KEY... key); | ||
48 | + | ||
49 | + /** | ||
50 | + * 查询对象,只要不为NULL与空则为条件 | ||
51 | + * | ||
52 | + * @param t | ||
53 | + * @return | ||
54 | + */ | ||
55 | + List<T> selectList(T t); | ||
56 | + | ||
57 | + /** | ||
58 | + * 查询对象总数 | ||
59 | + * | ||
60 | + * @param t | ||
61 | + * @return | ||
62 | + */ | ||
63 | + Integer selectListCount(T t); | ||
64 | + | ||
65 | + /** | ||
66 | + * 分页查询 | ||
67 | + * | ||
68 | + * @param condtion | ||
69 | + * 查询条件 | ||
70 | + * @return 分页对象 | ||
71 | + */ | ||
72 | + Page<T> selectPage(T condtion, Page<T> page); | ||
73 | +} |
titan-worker/src/main/java/com/dili/titan/service/base/BaseServiceImpl.java
0 → 100644
1 | +package com.dili.titan.service.base; | ||
2 | + | ||
3 | +import com.dili.titan.dao.base.BaseDao; | ||
4 | +import com.dili.titan.domain.Page; | ||
5 | + | ||
6 | +import java.io.Serializable; | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | +public abstract class BaseServiceImpl<T, KEY extends Serializable> implements BaseService<T, KEY> { | ||
10 | + /** | ||
11 | + * 获取DAO操作类 | ||
12 | + */ | ||
13 | + public abstract BaseDao<T, KEY> getDao(); | ||
14 | + | ||
15 | + public int insert(T t) { | ||
16 | + return this.getDao().insert(t); | ||
17 | + } | ||
18 | + | ||
19 | + public int deleteByCondtion(T condtion) { | ||
20 | + return this.getDao().deleteByCondtion(condtion); | ||
21 | + } | ||
22 | + | ||
23 | + public int updateByCondtion(T condtion) { | ||
24 | + return this.getDao().updateByCondtion(condtion); | ||
25 | + } | ||
26 | + | ||
27 | + public T select(KEY key) { | ||
28 | + return this.getDao().select(key); | ||
29 | + } | ||
30 | + | ||
31 | + public List<T> selectArray(KEY... key) { | ||
32 | + return this.getDao().selectArray(key); | ||
33 | + } | ||
34 | + | ||
35 | + public List<T> selectList(T t) { | ||
36 | + return this.getDao().selectList(t); | ||
37 | + } | ||
38 | + | ||
39 | + public Integer selectListCount(T t) { | ||
40 | + return this.getDao().selectListCount(t); | ||
41 | + } | ||
42 | + public Page<T> selectPage(T condtion, Page<T> page) { | ||
43 | + try { | ||
44 | + Class<?> clz = condtion.getClass(); | ||
45 | + clz.getMethod("setStartIndex", Integer.class).invoke(condtion, page.getStartIndex()); | ||
46 | + clz.getMethod("setEndIndex", Integer.class).invoke(condtion, page.getEndIndex()); | ||
47 | + } catch (Exception e) { | ||
48 | + throw new RuntimeException("设置分页参数失败"); | ||
49 | + } | ||
50 | + Integer size = getDao().selectEntryListCount(condtion); | ||
51 | + if (size == null || size <= 0) { | ||
52 | + return page; | ||
53 | + } | ||
54 | + page.setTotalCount(size); | ||
55 | + page.setResult(getDao().selectEntryList(condtion)); | ||
56 | + return page; | ||
57 | + } | ||
58 | + | ||
59 | + | ||
60 | +} |
titan-worker/src/main/java/com/dili/titan/service/impl/PresaleServiceImpl.java
0 → 100644
1 | +package com.dili.titan.service.impl; | ||
2 | + | ||
3 | +import com.dili.titan.dao.PresaleDao; | ||
4 | +import com.dili.titan.dao.base.BaseDao; | ||
5 | +import com.dili.titan.domain.Page; | ||
6 | +import com.dili.titan.domain.Presale; | ||
7 | +import com.dili.titan.service.PresaleService; | ||
8 | +import com.dili.titan.service.base.BaseServiceImpl; | ||
9 | +import org.springframework.stereotype.Service; | ||
10 | + | ||
11 | +import javax.annotation.Resource; | ||
12 | +import java.util.List; | ||
13 | + | ||
14 | +/** | ||
15 | + * Created by gsz on 2015/7/28. | ||
16 | + */ | ||
17 | +@Service | ||
18 | +public class PresaleServiceImpl extends BaseServiceImpl<Presale,Long> implements PresaleService{ | ||
19 | + @Resource | ||
20 | + private PresaleDao presaleDao; | ||
21 | + @Override | ||
22 | + public BaseDao<Presale, Long> getDao() { | ||
23 | + return presaleDao; | ||
24 | + } | ||
25 | + | ||
26 | + @Override | ||
27 | + public Page<Long> expirePresale(int page) { | ||
28 | + Page<Long> pageObj = new Page<Long>(page,50); | ||
29 | + Presale query = new Presale(); | ||
30 | + query.setStartIndex(pageObj.getStartIndex()); | ||
31 | + query.setEndIndex(pageObj.getEndIndex()); | ||
32 | + pageObj.setResult(presaleDao.selectExpire(query)); | ||
33 | + return pageObj; | ||
34 | + } | ||
35 | + | ||
36 | + @Override | ||
37 | + public int batchExpire(List<Long> ids) { | ||
38 | + return presaleDao.batchExpire(ids); | ||
39 | + } | ||
40 | +} |
titan-worker/src/main/java/com/dili/titan/service/impl/ProductAuthServiceImpl.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.ProductAuthDao; | ||
8 | +import com.dili.titan.dao.base.BaseDao; | ||
9 | +import com.dili.titan.domain.ProductAuth; | ||
10 | +import com.dili.titan.service.ProductAuthService; | ||
11 | +import com.dili.titan.service.base.BaseServiceImpl; | ||
12 | +import org.springframework.stereotype.Service; | ||
13 | +import org.springframework.transaction.annotation.Transactional; | ||
14 | + | ||
15 | +import javax.annotation.Resource; | ||
16 | +import java.util.List; | ||
17 | + | ||
18 | +/** | ||
19 | + * ProductAuthService 实现类 | ||
20 | + * @author dev-center | ||
21 | + * @since 2014-10-29 | ||
22 | + */ | ||
23 | +@Service("productAuthService") | ||
24 | +public class ProductAuthServiceImpl extends BaseServiceImpl<ProductAuth,Long> implements ProductAuthService { | ||
25 | + | ||
26 | + @Resource private ProductAuthDao productAuthDao; | ||
27 | + | ||
28 | + public BaseDao<ProductAuth,Long> getDao() { | ||
29 | + return productAuthDao; | ||
30 | + } | ||
31 | + | ||
32 | + @Transactional | ||
33 | + public int updateProductAuth(List<ProductAuth> paList) { | ||
34 | + return productAuthDao.updateProductAuth(paList); | ||
35 | + } | ||
36 | + | ||
37 | + @Override | ||
38 | + public List<ProductAuth> selectInvalidAuthData() { | ||
39 | + return productAuthDao.selectInvalidAuthData(); | ||
40 | + } | ||
41 | +} |
titan-worker/src/main/java/com/dili/titan/service/impl/ProductPopServiceImpl.java
0 → 100644
1 | +package com.dili.titan.service.impl; | ||
2 | + | ||
3 | +import com.dili.titan.dao.ProductPopDao; | ||
4 | +import com.dili.titan.dao.base.BaseDao; | ||
5 | +import com.dili.titan.domain.Page; | ||
6 | +import com.dili.titan.domain.ProductPop; | ||
7 | +import com.dili.titan.service.ProductPopService; | ||
8 | +import com.dili.titan.service.base.BaseServiceImpl; | ||
9 | +import org.springframework.stereotype.Service; | ||
10 | + | ||
11 | +import javax.annotation.Resource; | ||
12 | + | ||
13 | +@Service("productPopService") | ||
14 | +public class ProductPopServiceImpl extends BaseServiceImpl<ProductPop, Long> implements ProductPopService { | ||
15 | + | ||
16 | + @Resource(name = "productPopDao") | ||
17 | + private ProductPopDao productPopDao; | ||
18 | + | ||
19 | + @Override | ||
20 | + public BaseDao<ProductPop, Long> getDao() { | ||
21 | + return productPopDao; | ||
22 | + } | ||
23 | + | ||
24 | + @Override | ||
25 | + public int publish(ProductPop p) { | ||
26 | + return productPopDao.publish(p); | ||
27 | + } | ||
28 | + | ||
29 | + @Override | ||
30 | + public int drop(ProductPop p) { | ||
31 | + return productPopDao.drop(p); | ||
32 | + } | ||
33 | + @Override | ||
34 | + public Page<ProductPop> findUnsolved(int page) { | ||
35 | + Page<ProductPop> pageObj = new Page<ProductPop>(page); | ||
36 | + ProductPop query = new ProductPop(); | ||
37 | + query.setStartIndex(pageObj.getStartIndex()); | ||
38 | + query.setEndIndex(pageObj.getEndIndex()); | ||
39 | + pageObj.setResult(productPopDao.selectList(query)); | ||
40 | + return pageObj; | ||
41 | + } | ||
42 | +} |
titan-worker/src/main/java/com/dili/titan/service/impl/PurchaseServiceImpl.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.PurchaseDao; | ||
8 | +import com.dili.titan.dao.base.BaseDao; | ||
9 | +import com.dili.titan.domain.Page; | ||
10 | +import com.dili.titan.domain.Purchase; | ||
11 | +import com.dili.titan.service.PurchaseService; | ||
12 | +import com.dili.titan.service.base.BaseServiceImpl; | ||
13 | +import org.springframework.stereotype.Service; | ||
14 | + | ||
15 | +import javax.annotation.Resource; | ||
16 | +import java.util.List; | ||
17 | + | ||
18 | + | ||
19 | +/** | ||
20 | + * PurchaseService 实现类 | ||
21 | + * @author dev-center | ||
22 | + * @since 2014-12-16 | ||
23 | + */ | ||
24 | +@Service("purchaseService") | ||
25 | +public class PurchaseServiceImpl extends BaseServiceImpl<Purchase,Long> implements PurchaseService { | ||
26 | + | ||
27 | + @Resource | ||
28 | + private PurchaseDao purchaseDao; | ||
29 | + | ||
30 | + @Override | ||
31 | + public BaseDao<Purchase, Long> getDao() { | ||
32 | + return purchaseDao; | ||
33 | + } | ||
34 | + | ||
35 | + @Override | ||
36 | + public Page<Long> expirePurchase(int page) { | ||
37 | + Page<Long> pageObj = new Page<Long>(page,50); | ||
38 | + Purchase query = new Purchase(); | ||
39 | + query.setStartIndex(pageObj.getStartIndex()); | ||
40 | + query.setEndIndex(pageObj.getEndIndex()); | ||
41 | + pageObj.setResult(purchaseDao.selectExpire(query)); | ||
42 | + return pageObj; | ||
43 | + } | ||
44 | + | ||
45 | + @Override | ||
46 | + public int batchExpire(List<Long> ids) { | ||
47 | + return purchaseDao.batchExpire(ids); | ||
48 | + } | ||
49 | +} |
titan-worker/src/main/java/com/dili/titan/service/impl/SupplyServiceImpl.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.SupplyDao; | ||
8 | +import com.dili.titan.dao.base.BaseDao; | ||
9 | +import com.dili.titan.domain.Page; | ||
10 | +import com.dili.titan.domain.Supply; | ||
11 | +import com.dili.titan.service.SupplyService; | ||
12 | +import com.dili.titan.service.base.BaseServiceImpl; | ||
13 | +import org.springframework.stereotype.Service; | ||
14 | + | ||
15 | +import javax.annotation.Resource; | ||
16 | +import java.util.List; | ||
17 | + | ||
18 | + | ||
19 | +/** | ||
20 | + * SupplyService 实现类 | ||
21 | + * @author dev-center | ||
22 | + * @since 2014-12-16 | ||
23 | + */ | ||
24 | +@Service("supplyService") | ||
25 | +public class SupplyServiceImpl extends BaseServiceImpl<Supply,Long> implements SupplyService { | ||
26 | + | ||
27 | + @Resource | ||
28 | + private SupplyDao supplyDao; | ||
29 | + @Override | ||
30 | + public BaseDao<Supply, Long> getDao() { | ||
31 | + return supplyDao; | ||
32 | + } | ||
33 | + | ||
34 | + @Override | ||
35 | + public Page<Long> expireSupply(int page) { | ||
36 | + Page<Long> pageObj = new Page<Long>(page,50); | ||
37 | + Supply query = new Supply(); | ||
38 | + query.setStartIndex(pageObj.getStartIndex()); | ||
39 | + query.setEndIndex(pageObj.getEndIndex()); | ||
40 | + pageObj.setResult(supplyDao.selectExpire(query)); | ||
41 | + return pageObj; | ||
42 | + } | ||
43 | + | ||
44 | + @Override | ||
45 | + public int batchExpire(List<Long> ids) { | ||
46 | + return supplyDao.batchExpire(ids); | ||
47 | + } | ||
48 | +} |
titan-worker/src/main/java/com/dili/titan/service/impl/VideoServiceImpl.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.VideoDao; | ||
8 | +import com.dili.titan.dao.base.BaseDao; | ||
9 | +import com.dili.titan.domain.Video; | ||
10 | +import com.dili.titan.service.VideoService; | ||
11 | +import com.dili.titan.service.base.BaseServiceImpl; | ||
12 | +import org.springframework.stereotype.Service; | ||
13 | + | ||
14 | +import javax.annotation.Resource; | ||
15 | +import java.util.List; | ||
16 | + | ||
17 | +/** | ||
18 | + * VideoService 实现类 | ||
19 | + * @author dev-center | ||
20 | + * @since 2014-12-26 | ||
21 | + */ | ||
22 | +@Service("videoService") | ||
23 | +public class VideoServiceImpl extends BaseServiceImpl<Video,Long> implements VideoService { | ||
24 | + | ||
25 | + @Resource | ||
26 | + private VideoDao videoDao; | ||
27 | + | ||
28 | + public BaseDao<Video,Long> getDao() { | ||
29 | + return videoDao; | ||
30 | + } | ||
31 | + | ||
32 | + public int saveOrUpdate(Video video) { | ||
33 | + if (video != null && video.getId()!= null && video.getId() > 0 ) { | ||
34 | + return this.updateByCondtion(video); | ||
35 | + } | ||
36 | + return this.insert(video); | ||
37 | + } | ||
38 | + | ||
39 | + @Override | ||
40 | + public int updateByfileId(Video video) { | ||
41 | + return videoDao.updateByfileId(video); | ||
42 | + } | ||
43 | + | ||
44 | + @Override | ||
45 | + public List<Long> findPidsByVideoId(Long videoId) { | ||
46 | + return videoDao.findPidsByVideoId(videoId); | ||
47 | + } | ||
48 | +} |
titan-worker/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.driverClass=${titan.jdbc.driver} | ||
12 | +#jdbc.maxConnectionsPerPartition=3 | ||
13 | +#jdbc.minConnectionsPerPartition=1 | ||
14 | +#jdbc.idleConnectionTestPeriod=10 | ||
15 | +#jdbc.idleMaxAge=240 | ||
16 | +#jdbc.partitionCount=2 | ||
17 | +#jdbc.acquireIncrement=5 | ||
18 | +#jdbc.statementsCacheSize=20 | ||
19 | +#jdbc.releaseHelperThreads=3 | ||
20 | + | ||
21 | +#数据库信息 | ||
22 | +jdbc.jdbcUrl=${titan.jdbc.url} | ||
23 | +jdbc.username=${titan.jdbc.username} | ||
24 | +jdbc.password=${titan.jdbc.password} | ||
25 | + | ||
26 | + | ||
27 | +##quartz | ||
28 | +quartz-corePoolSize=5 | ||
29 | +quartz-maxPoolSize=50 | ||
30 | +quartz-queueCapacity=20 | ||
31 | + | ||
32 | +quartz-cron-pop=0 0/5 * * * ? | ||
33 | +quartz-cron-gq=0 0/20 * * * ? | ||
34 | +quartz-cron-video=0 0/5 * * * ? | ||
35 | +quartz-cron-auth=0 0/5 * * * ? | ||
36 | + | ||
37 | +##爱奇艺平台接入码 | ||
38 | +appKey=${titan.aqy.appkey} | ||
39 | +appSecret=${titan.aqy.appSecret} | ||
40 | + | ||
41 | +#MQ名称空间地址 | ||
42 | +mq.namesrvAddr=${conf.mq.namesrvAddr} | ||
43 | +#MQ生产者组 | ||
44 | +mq.producerGroup=${conf.mq.producerGroup} |
titan-worker/src/main/resources/log4j.xml
0 → 100644
1 | +<?xml version='1.0' encoding='UTF-8' ?> | ||
2 | +<!DOCTYPE log4j:configuration PUBLIC | ||
3 | + "-//APACHE//DTD LOG4J 1.2//EN" "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd"> | ||
4 | +<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> | ||
5 | + <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> | ||
6 | + <layout class="org.apache.log4j.PatternLayout"> | ||
7 | + <param name="ConversionPattern" value="[%5p] [%d{yyyy-MM-dd HH:mm:ss SSS}] [%t] (%F:%L) %m%n" /> | ||
8 | + </layout> | ||
9 | + <filter class="org.apache.log4j.varia.LevelRangeFilter"> | ||
10 | + <param name="LevelMin" value="${dili_titan.log.level}" /> | ||
11 | + </filter> | ||
12 | + </appender> | ||
13 | + | ||
14 | + <!-- 输出日志到文件 每天一个文件 --> | ||
15 | + <appender name="dailyRollingFile" | ||
16 | + class="org.apache.log4j.DailyRollingFileAppender"> | ||
17 | + <param name="Threshold" value="${dili_titan.log.level}"/> | ||
18 | + <param name="ImmediateFlush" value="true"/> | ||
19 | + <param name="File" value="${dili_titan.log.path}/titan.1n4j.com/titan_worker.log"/> | ||
20 | + <param name="DatePattern" value="'.'yyyy-MM-dd'.log'"/> | ||
21 | + <layout class="org.apache.log4j.PatternLayout"> | ||
22 | + <param name="ConversionPattern" value="[%5p] [%d{yyyy-MM-dd HH:mm:ss SSS}] [%t] (%F:%L) %m%n"/> | ||
23 | + </layout> | ||
24 | + </appender> | ||
25 | + | ||
26 | + <root> | ||
27 | + <priority value="${dili_titan.log.level}"/> | ||
28 | + <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | ||
29 | + <appender-ref ref="${dili_titan.log.root.appender}"/> | ||
30 | + <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | ||
31 | + <appender-ref ref="dailyRollingFile"/> | ||
32 | + </root> | ||
33 | +</log4j:configuration> | ||
0 | \ No newline at end of file | 34 | \ No newline at end of file |
titan-worker/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 | + <bean id="masterDataSource" class="com.alibaba.druid.pool.DruidDataSource" | ||
29 | + init-method="init" destroy-method="close"> | ||
30 | + <property name="driverClassName" value="${jdbc.driverClass}"/> | ||
31 | + <property name="url" value="${jdbc.jdbcUrl}"/> | ||
32 | + <property name="username" value="${jdbc.username}"/> | ||
33 | + <property name="password" value="${jdbc.password}"/> | ||
34 | + <property name="filters" value="stat"/> | ||
35 | + <property name="maxActive" value="${jdbc.maxActive}"/> | ||
36 | + <property name="initialSize" value="${jdbc.initialSize}"/> | ||
37 | + <property name="maxWait" value="${jdbc.maxWait}"/> | ||
38 | + <property name="minIdle" value="${jdbc.minIdle}"/> | ||
39 | + <property name="timeBetweenEvictionRunsMillis" | ||
40 | + value="${jdbc.timeBetweenEvictionRunsMillis}"/> | ||
41 | + <property name="minEvictableIdleTimeMillis" | ||
42 | + value="${jdbc.minEvictableIdleTimeMillis}"/> | ||
43 | + <property name="validationQuery" value="SELECT now()"/> | ||
44 | + <property name="testWhileIdle" value="true"/> | ||
45 | + <property name="testOnBorrow" value="false"/> | ||
46 | + <property name="testOnReturn" value="false"/> | ||
47 | + <property name="poolPreparedStatements" | ||
48 | + value="${jdbc.poolPreparedStatements}"/> | ||
49 | + <property name="maxOpenPreparedStatements" | ||
50 | + value="${jdbc.maxOpenPreparedStatements}"/> | ||
51 | + </bean> | ||
52 | + <bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> | ||
53 | + <property name="dataSource" ref="masterDataSource" /> | ||
54 | + <property name="configLocation" value="classpath:sqlmap/sqlmap-config.xml" /> | ||
55 | + </bean> | ||
56 | + | ||
57 | + <bean id="sqlTemplate" class="org.mybatis.spring.SqlSessionTemplate"> | ||
58 | + <constructor-arg index="0" ref="sessionFactory" /> | ||
59 | + </bean> | ||
60 | +</beans> | ||
0 | \ No newline at end of file | 61 | \ No newline at end of file |
titan-worker/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 | + <bean id="diliMQProducer" | ||
11 | + class="com.diligrp.util.rocketMQUtil.impl.DiliMQProducerImpl"/> | ||
12 | +</beans> | ||
0 | \ No newline at end of file | 13 | \ No newline at end of file |
titan-worker/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 | + | ||
10 | + <bean id="websiteClient" class="com.diligrp.website.web.interfaces.WebsiteClient"> | ||
11 | + <constructor-arg name="token" value="aaa"></constructor-arg> | ||
12 | + <constructor-arg name="baseUrl" value="http://${dili_titan.website.url}/"></constructor-arg> | ||
13 | + </bean> | ||
14 | +</beans> |
titan-worker/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" | ||
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.xsd | ||
7 | + http://www.springframework.org/schema/context | ||
8 | + http://www.springframework.org/schema/context/spring-context.xsd" | ||
9 | + default-autowire="byName"> | ||
10 | + | ||
11 | + <context:component-scan base-package="com.dili.titan.service" /> | ||
12 | + <context:component-scan base-package="com.dili.titan.controller" /> | ||
13 | + | ||
14 | +</beans> | ||
0 | \ No newline at end of file | 15 | \ No newline at end of file |
titan-worker/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" | ||
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | + xmlns:mvc="http://www.springframework.org/schema/mvc" | ||
5 | + xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
6 | + http://www.springframework.org/schema/beans/spring-beans.xsd | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | + | ||
11 | + http://www.springframework.org/schema/mvc | ||
12 | + http://www.springframework.org/schema/mvc/spring-mvc.xsd" | ||
13 | + default-autowire="byName"> | ||
14 | + | ||
15 | + <mvc:annotation-driven /> | ||
16 | + | ||
17 | + <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> | ||
18 | + <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> | ||
19 | + <property name="ignoreResourceNotFound" value="true" /> | ||
20 | + <property name="locations"> | ||
21 | + <list> | ||
22 | + <value>classpath:important.properties</value> | ||
23 | + </list> | ||
24 | + </property> | ||
25 | + </bean> | ||
26 | + | ||
27 | + <import resource="classpath:spring-config-dao.xml" /> | ||
28 | + <import resource="classpath:spring-config-service.xml" /> | ||
29 | + <import resource="classpath:spring-config-rpc.xml" /> | ||
30 | + <import resource="classpath:spring-config-mq.xml" /> | ||
31 | +</beans> | ||
0 | \ No newline at end of file | 32 | \ No newline at end of file |
titan-worker/src/main/resources/sqlmap/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.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="categoryId != null and categoryId != ''"><![CDATA[AND category_id = #{categoryId}]]></if> | ||
19 | + <if test="localityAreaId != null and localityAreaId != ''"><![CDATA[AND locality_area_id = #{localityAreaId}]]></if> | ||
20 | + <if test="count != null and count != ''"><![CDATA[AND `count` = #{count}]]></if> | ||
21 | + <if test="unitId != null and unitId != ''"><![CDATA[AND unit_id = #{unitId}]]></if> | ||
22 | + <if test="phone != null and phone != ''"><![CDATA[AND phone = #{phone}]]></if> | ||
23 | + <if test="status != null and status != ''"><![CDATA[AND status = #{status}]]></if> | ||
24 | + <if test="statuses != null and statuses != ''"> | ||
25 | + <![CDATA[AND status IN ]]> | ||
26 | + <foreach collection="statuses" item="status" open="(" separator="," close=")"> | ||
27 | + <![CDATA[#{status}]]> | ||
28 | + </foreach> | ||
29 | + </if> | ||
30 | + <if test="userId != null and userId != ''"><![CDATA[AND user_id = #{userId}]]></if> | ||
31 | + <if test="source != null and source != ''"><![CDATA[AND source = #{source}]]></if> | ||
32 | + <if test="reason != null and reason != ''"><![CDATA[AND reason = #{reason}]]></if> | ||
33 | + <if test="startTime != null and startTime != ''"><![CDATA[AND start_time = #{startTime}]]></if> | ||
34 | + <if test="endTime != null and endTime != ''"><![CDATA[AND end_time = #{endTime}]]></if> | ||
35 | + <if test="ctime != null and ctime != ''"><![CDATA[AND ctime = #{ctime}]]></if> | ||
36 | + <if test="utime != null and utime != ''"><![CDATA[AND utime = #{utime}]]></if> | ||
37 | + </where> | ||
38 | + </sql> | ||
39 | + | ||
40 | + <!-- 智能排序与分页 --> | ||
41 | + <sql id="QUERY_ORDER_LIMIT_CONDTION"> | ||
42 | + <if test="orderField != null and orderField != '' and orderFieldType != null and orderFieldType != ''"><![CDATA[ORDER BY ${orderField} ${orderFieldType}]]></if> | ||
43 | + <if test="startIndex != null and startIndex >= 0 and pageSize != null and pageSize > 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if> | ||
44 | + </sql> | ||
45 | + | ||
46 | + <!-- 更新列字段,只要不为NULL则更新,除开主键列 --> | ||
47 | + <sql id="UPDATE_COLUMN_SET"> | ||
48 | + <set> | ||
49 | + <if test="categoryId != null"><![CDATA[category_id = #{categoryId},]]></if> | ||
50 | + <if test="localityAreaId != null"><![CDATA[locality_area_id = #{localityAreaId},]]></if> | ||
51 | + <if test="count != null"><![CDATA[`count` = #{count},]]></if> | ||
52 | + <if test="unitId != null"><![CDATA[unit_id = #{unitId},]]></if> | ||
53 | + <if test="phone != null"><![CDATA[phone = #{phone},]]></if> | ||
54 | + <if test="status != null"><![CDATA[status = #{status},]]></if> | ||
55 | + <if test="userId != null"><![CDATA[user_id = #{userId},]]></if> | ||
56 | + <if test="source != null"><![CDATA[source = #{source},]]></if> | ||
57 | + <if test="reason != null"><![CDATA[reason = #{reason},]]></if> | ||
58 | + <if test="startTime != null"><![CDATA[start_time = #{startTime},]]></if> | ||
59 | + <if test="endTime != null"><![CDATA[end_time = #{endTime},]]></if> | ||
60 | + <if test="ctime != null"><![CDATA[ctime = #{ctime},]]></if> | ||
61 | + <![CDATA[ utime = now()]]> | ||
62 | + </set> | ||
63 | + </sql> | ||
64 | + | ||
65 | + <!-- 插入presale记录 --> | ||
66 | + <insert id="insertEntry" parameterType="presale" > | ||
67 | + <![CDATA[ | ||
68 | + 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) | ||
69 | + VALUES (#{id},#{title},#{userName},#{categoryId},#{localityAreaId},#{count},#{unitId},#{phone},#{status},#{userId},#{source},#{startTime},#{endTime},now()) | ||
70 | + ]]> | ||
71 | + </insert> | ||
72 | + | ||
73 | + <!-- 返回插入的编号,在事务开启状态下有效 --> | ||
74 | + <select id="lastSequence" resultType="int"><![CDATA[SELECT LAST_INSERT_ID() AS id]]></select> | ||
75 | + | ||
76 | + <!-- 删除记录,主键IN(array) --> | ||
77 | + <update id="deleteByArrayKey" parameterType="java.lang.reflect.Array" > | ||
78 | + <![CDATA[UPDATE presale SET status=-1 WHERE id IN]]> | ||
79 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
80 | + <![CDATA[#{id}]]> | ||
81 | + </foreach> | ||
82 | + </update> | ||
83 | + | ||
84 | + <!-- 删除,通过条件 --> | ||
85 | + <update id="deleteByCondtion" parameterType="presale" > | ||
86 | + <![CDATA[DELETE FROM presale]]> | ||
87 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
88 | + </update> | ||
89 | + | ||
90 | + <!-- 修改记录通过主键 --> | ||
91 | + <update id="updateByKey" parameterType="presale" > | ||
92 | + <![CDATA[UPDATE presale]]> | ||
93 | + <include refid="UPDATE_COLUMN_SET"/> | ||
94 | + <![CDATA[WHERE id = #{id}]]> | ||
95 | + </update> | ||
96 | + | ||
97 | + <!-- 查询,通过主键IN(array) --> | ||
98 | + <select id="selectEntryArray" parameterType="java.lang.reflect.Array" resultType="presale"> | ||
99 | + <![CDATA[SELECT]]> | ||
100 | + <include refid="QUERY_COLUMN_LIST"/> | ||
101 | + <include refid="QUERY_FROM_TABLE"/> | ||
102 | + <![CDATA[WHERE id IN]]> | ||
103 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
104 | + <![CDATA[#{id}]]> | ||
105 | + </foreach> | ||
106 | + </select> | ||
107 | + | ||
108 | + <!-- 查询,通过条件 --> | ||
109 | + <select id="selectEntryList" parameterType="presale" resultType="presale"> | ||
110 | + <![CDATA[SELECT]]> | ||
111 | + <include refid="QUERY_COLUMN_LIST"/> | ||
112 | + <include refid="QUERY_FROM_TABLE"/> | ||
113 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
114 | + <include refid="QUERY_ORDER_LIMIT_CONDTION"/> | ||
115 | + </select> | ||
116 | + | ||
117 | + <!-- 总数查询,通过条件 --> | ||
118 | + <select id="selectEntryListCount" parameterType="presale" resultType="int"> | ||
119 | + <![CDATA[SELECT COUNT(id) AS dataCount]]> | ||
120 | + <include refid="QUERY_FROM_TABLE"/> | ||
121 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
122 | + </select> | ||
123 | + | ||
124 | + <!-- 其它SQL语句 --> | ||
125 | + <update id="batchExpire" parameterType="java.util.List" > | ||
126 | + <![CDATA[UPDATE presale]]> | ||
127 | + set status = 4 , utime = now() | ||
128 | + <![CDATA[WHERE id IN]]> | ||
129 | + <foreach collection="list" item="id" open="(" separator="," close=")"> | ||
130 | + <![CDATA[#{id}]]> | ||
131 | + </foreach> | ||
132 | + </update> | ||
133 | + <select id="selectExpire" parameterType="presale" resultType="java.lang.Long"> | ||
134 | + <![CDATA[SELECT id ]]> | ||
135 | + <include refid="QUERY_FROM_TABLE"/> | ||
136 | + <![CDATA[WHERE status IN(1,2) and end_time <= now()]]> | ||
137 | + <include refid="QUERY_ORDER_LIMIT_CONDTION"/> | ||
138 | + </select> | ||
139 | +</mapper> | ||
0 | \ No newline at end of file | 140 | \ No newline at end of file |
titan-worker/src/main/resources/sqlmap/ProductAuth.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.ProductAuthDao"> | ||
5 | + | ||
6 | + <!-- product_auth 所有查询列 --> | ||
7 | + <sql id="QUERY_COLUMN_LIST"> | ||
8 | + <![CDATA[id,pid,auth_id AS authId,auth_url AS authUrl,status,auth_end_time AS authEndTime,ctime,utime]]> | ||
9 | + </sql> | ||
10 | + | ||
11 | + <!-- product_auth 查询列来源表--> | ||
12 | + <sql id="QUERY_FROM_TABLE"><![CDATA[FROM product_auth]]></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="pid != null and pid != ''"><![CDATA[AND pid = #{pid}]]></if> | ||
19 | + <if test="authId != null and authId != ''"><![CDATA[AND auth_id = #{authId}]]></if> | ||
20 | + <if test="authUrl != null and authUrl != ''"><![CDATA[AND auth_url = #{authUrl}]]></if> | ||
21 | + <if test="status != null and status != ''"><![CDATA[AND status = #{status}]]></if> | ||
22 | + <if test="authEndTime != null and authEndTime != ''"><![CDATA[AND auth_end_time = #{authEndTime}]]></if> | ||
23 | + <if test="ctime != null and ctime != ''"><![CDATA[AND ctime = #{ctime}]]></if> | ||
24 | + <if test="utime != null and utime != ''"><![CDATA[AND utime = #{utime}]]></if> | ||
25 | + <![CDATA[AND status != -1]]> | ||
26 | + </where> | ||
27 | + </sql> | ||
28 | + | ||
29 | + <!-- 智能排序与分页 --> | ||
30 | + <sql id="QUERY_ORDER_LIMIT_CONDTION"> | ||
31 | + <if test="orderField != null and orderField != '' and orderFieldType != null and orderFieldType != ''"><![CDATA[ORDER BY ${orderField} ${orderFieldType}]]></if> | ||
32 | + <if test="startIndex != null and startIndex >= 0 and pageSize != null and pageSize > 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if> | ||
33 | + </sql> | ||
34 | + | ||
35 | + | ||
36 | + <!-- 定时使过期数据失效 --> | ||
37 | + <update id="setAuthDataInvalid" parameterType="java.util.List"> | ||
38 | + UPDATE product_auth a set a.status=2 where a.id in | ||
39 | + <foreach collection="list" item="item" open="(" separator="," close=")"> | ||
40 | + #{item.id} | ||
41 | + </foreach> | ||
42 | + </update> | ||
43 | + | ||
44 | + <!-- 查询将要失效的认证数据 --> | ||
45 | + <select id="selectInvalidAuthData" resultType="productAuth"> | ||
46 | + <![CDATA[select ]]> | ||
47 | + <include refid="QUERY_COLUMN_LIST"/> | ||
48 | + <![CDATA[from product_auth a where NOW() >= date_add(a.auth_end_time, interval 1 day) and a.status = 1]]> | ||
49 | + </select> | ||
50 | + | ||
51 | +</mapper> | ||
0 | \ No newline at end of file | 52 | \ No newline at end of file |
titan-worker/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 | + <select id="selectList" parameterType="productPop" resultType="productPop"> | ||
6 | + <![CDATA[SELECT pid,name,indate,publish_mode AS publishMode,publish_time AS publishTime, publish_settime as publishSettime,drops_time AS dropsTime,`status`,ctime,utime FROM product_pop]]> | ||
7 | + <where> | ||
8 | + <![CDATA[(status = 3 or status = 5)]]> | ||
9 | + <if test="name != null and name != ''"><![CDATA[AND name = #{name}]]></if> | ||
10 | + <if test="indate != null and indate != ''"><![CDATA[AND indate = #{indate}]]></if> | ||
11 | + <if test="publishMode != null and publishMode != ''"><![CDATA[AND publish_mode = #{publishMode}]]></if> | ||
12 | + <if test="publishTime != null and publishTime != ''"><![CDATA[AND publish_time = #{publishTime}]]></if> | ||
13 | + <if test="dropsTime != null and dropsTime != ''"><![CDATA[AND drops_time = #{dropsTime}]]></if> | ||
14 | + <if test="ctime != null and ctime != ''"><![CDATA[AND ctime = #{ctime}]]></if> | ||
15 | + <if test="utime != null and utime != ''"><![CDATA[AND utime = #{utime}]]></if> | ||
16 | + </where> | ||
17 | + <if test="orderField != null and orderField != '' and orderType != null and orderType != ''"><![CDATA[ORDER BY ${orderField} ${orderType}]]></if> | ||
18 | + <if test="startIndex != null and startIndex >= 0 and pageSize != null and pageSize > 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if> | ||
19 | + </select> | ||
20 | + | ||
21 | + <update id="publish" parameterType="productPop"> | ||
22 | + <![CDATA[update product_pop ]]> | ||
23 | + <set> | ||
24 | + <if test="status != null and status != ''"><![CDATA[`status` = #{status},]]></if> | ||
25 | + <if test="publishTime != null and publishTime != ''"><![CDATA[ publish_time = #{publishTime},]]></if> | ||
26 | + <if test="publishMode != null and publishMode != ''"><![CDATA[ publish_mode = #{publishMode},publish_settime=null,]]></if> | ||
27 | + <if test="utime != null and utime != ''"><![CDATA[ utime = #{utime}]]></if> | ||
28 | + </set> | ||
29 | + <![CDATA[where pid = #{pid} ]]> | ||
30 | + </update> | ||
31 | + | ||
32 | + <update id="drop" parameterType="productPop"> | ||
33 | + <![CDATA[update product_pop ]]> | ||
34 | + <set> | ||
35 | + <if test="status != null and status != ''"><![CDATA[`status` = #{status},]]></if> | ||
36 | + <if test="dropsTime != null and dropsTime != ''"><![CDATA[ drops_time = #{dropsTime},]]></if> | ||
37 | + <if test="publishMode != null and publishMode != ''"><![CDATA[ publish_mode = #{publishMode},publish_settime=null,]]></if> | ||
38 | + <if test="utime != null and utime != ''"><![CDATA[ utime = #{utime}]]></if> | ||
39 | + </set> | ||
40 | + <![CDATA[where pid = #{pid} ]]> | ||
41 | + </update> | ||
42 | +</mapper> | ||
0 | \ No newline at end of file | 43 | \ No newline at end of file |
titan-worker/src/main/resources/sqlmap/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.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="categoryId != null and categoryId != ''"><![CDATA[AND category_id = #{categoryId}]]></if> | ||
19 | + <if test="localityAreaId != null and localityAreaId != ''"><![CDATA[AND locality_area_id = #{localityAreaId}]]></if> | ||
20 | + <if test="count != null and count != ''"><![CDATA[AND count = #{`count`}]]></if> | ||
21 | + <if test="unitId != null and unitId != ''"><![CDATA[AND unit_id = #{unitId}]]></if> | ||
22 | + <if test="phone != null and phone != ''"><![CDATA[AND phone = #{phone}]]></if> | ||
23 | + <if test="expireTime != null and expireTime != ''"><![CDATA[AND expire_time = #{expireTime}]]></if> | ||
24 | + <if test="status != null and status != ''"><![CDATA[AND status = #{status}]]></if> | ||
25 | + <if test="statuses != null and statuses != ''"> | ||
26 | + <![CDATA[AND status IN ]]> | ||
27 | + <foreach collection="statuses" item="status" open="(" separator="," close=")"> | ||
28 | + <![CDATA[#{status}]]> | ||
29 | + </foreach> | ||
30 | + </if> | ||
31 | + <if test="userId != null and userId != ''"><![CDATA[AND user_id = #{userId}]]></if> | ||
32 | + <if test="source != null and source != ''"><![CDATA[AND source = #{source}]]></if> | ||
33 | + <if test="reason != null and reason != ''"><![CDATA[AND reason = #{reason}]]></if> | ||
34 | + <if test="ctime != null and ctime != ''"><![CDATA[AND ctime = #{ctime}]]></if> | ||
35 | + <if test="utime != null and utime != ''"><![CDATA[AND utime = #{utime}]]></if> | ||
36 | + </where> | ||
37 | + </sql> | ||
38 | + | ||
39 | + <!-- 智能排序与分页 --> | ||
40 | + <sql id="QUERY_ORDER_LIMIT_CONDTION"> | ||
41 | + <if test="orderField != null and orderField != '' and orderFieldType != null and orderFieldType != ''"><![CDATA[ORDER BY ${orderField} ${orderFieldType}]]></if> | ||
42 | + <if test="startIndex != null and startIndex >= 0 and pageSize != null and pageSize > 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if> | ||
43 | + </sql> | ||
44 | + | ||
45 | + <!-- 更新列字段,只要不为NULL则更新,除开主键列 --> | ||
46 | + <sql id="UPDATE_COLUMN_SET"> | ||
47 | + <set> | ||
48 | + <if test="categoryId != null"><![CDATA[category_id = #{categoryId},]]></if> | ||
49 | + <if test="localityAreaId != null"><![CDATA[locality_area_id = #{localityAreaId},]]></if> | ||
50 | + <if test="count != null"><![CDATA[`count` = #{count},]]></if> | ||
51 | + <if test="unitId != null"><![CDATA[unit_id = #{unitId},]]></if> | ||
52 | + <if test="phone != null"><![CDATA[phone = #{phone},]]></if> | ||
53 | + <if test="expireTime != null"><![CDATA[expire_time = #{expireTime},]]></if> | ||
54 | + <if test="status != null"><![CDATA[status = #{status},]]></if> | ||
55 | + <if test="userId != null"><![CDATA[user_id = #{userId},]]></if> | ||
56 | + <if test="source != null"><![CDATA[source = #{source},]]></if> | ||
57 | + <if test="reason != null"><![CDATA[reason = #{reason},]]></if> | ||
58 | + <if test="ctime != null"><![CDATA[ctime = #{ctime},]]></if> | ||
59 | + <![CDATA[ utime = now()]]> | ||
60 | + </set> | ||
61 | + </sql> | ||
62 | + | ||
63 | + <!-- 插入purchase记录 --> | ||
64 | + <insert id="insertEntry" parameterType="purchase" > | ||
65 | + <![CDATA[ | ||
66 | + 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) | ||
67 | + VALUES (#{id},#{title},#{userName},#{categoryId},#{producingAreaId},#{localityAreaId},#{count},#{unitId},#{phone},#{expireTime},#{status},#{userId},#{source},now()) | ||
68 | + ]]> | ||
69 | + </insert> | ||
70 | + | ||
71 | + <!-- 返回插入的编号,在事务开启状态下有效 --> | ||
72 | + <select id="lastSequence" resultType="int"><![CDATA[SELECT LAST_INSERT_ID() AS id]]></select> | ||
73 | + | ||
74 | + <!-- 删除记录,主键IN(array) --> | ||
75 | + <delete id="deleteByArrayKey" parameterType="java.lang.reflect.Array" > | ||
76 | + <![CDATA[DELETE FROM purchase WHERE id IN]]> | ||
77 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
78 | + <![CDATA[#{id}]]> | ||
79 | + </foreach> | ||
80 | + </delete> | ||
81 | + | ||
82 | + <!-- 删除,通过条件 --> | ||
83 | + <update id="deleteByCondtion" parameterType="purchase" > | ||
84 | + <![CDATA[DELETE FROM purchase]]> | ||
85 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
86 | + </update> | ||
87 | + | ||
88 | + <!-- 修改记录通过主键 --> | ||
89 | + <update id="updateByKey" parameterType="purchase" > | ||
90 | + <![CDATA[UPDATE purchase]]> | ||
91 | + <include refid="UPDATE_COLUMN_SET"/> | ||
92 | + <![CDATA[WHERE id = #{id}]]> | ||
93 | + </update> | ||
94 | + | ||
95 | + <!-- 查询,通过主键IN(array) --> | ||
96 | + <select id="selectEntryArray" parameterType="java.lang.reflect.Array" resultType="purchase"> | ||
97 | + <![CDATA[SELECT]]> | ||
98 | + <include refid="QUERY_COLUMN_LIST"/> | ||
99 | + <include refid="QUERY_FROM_TABLE"/> | ||
100 | + <![CDATA[WHERE id IN]]> | ||
101 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
102 | + <![CDATA[#{id}]]> | ||
103 | + </foreach> | ||
104 | + </select> | ||
105 | + | ||
106 | + <!-- 查询,通过条件 --> | ||
107 | + <select id="selectEntryList" parameterType="purchase" resultType="purchase"> | ||
108 | + <![CDATA[SELECT]]> | ||
109 | + <include refid="QUERY_COLUMN_LIST"/> | ||
110 | + <include refid="QUERY_FROM_TABLE"/> | ||
111 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
112 | + <include refid="QUERY_ORDER_LIMIT_CONDTION"/> | ||
113 | + </select> | ||
114 | + | ||
115 | + <!-- 总数查询,通过条件 --> | ||
116 | + <select id="selectEntryListCount" parameterType="purchase" resultType="int"> | ||
117 | + <![CDATA[SELECT COUNT(id) AS dataCount]]> | ||
118 | + <include refid="QUERY_FROM_TABLE"/> | ||
119 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
120 | + </select> | ||
121 | + | ||
122 | + <!-- 其它SQL语句 --> | ||
123 | + <update id="batchExpire" parameterType="java.util.List" > | ||
124 | + <![CDATA[UPDATE purchase]]> | ||
125 | + set status = 4 , utime = now() | ||
126 | + <![CDATA[WHERE id IN]]> | ||
127 | + <foreach collection="list" item="id" open="(" separator="," close=")"> | ||
128 | + <![CDATA[#{id}]]> | ||
129 | + </foreach> | ||
130 | + </update> | ||
131 | + <select id="selectExpire" parameterType="purchase" resultType="java.lang.Long"> | ||
132 | + <![CDATA[SELECT id ]]> | ||
133 | + <include refid="QUERY_FROM_TABLE"/> | ||
134 | + <![CDATA[WHERE status IN(1,2) and expire_time <= now()]]> | ||
135 | + <include refid="QUERY_ORDER_LIMIT_CONDTION"/> | ||
136 | + </select> | ||
137 | +</mapper> | ||
0 | \ No newline at end of file | 138 | \ No newline at end of file |
titan-worker/src/main/resources/sqlmap/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.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 | + <!-- supply 查询列来源表--> | ||
11 | + <sql id="QUERY_FROM_TABLE"><![CDATA[FROM supply]]></sql> | ||
12 | + | ||
13 | + <!-- 全部条件(更多功能可以通过queryData扩展实现) --> | ||
14 | + <sql id="QUERY_WHERE_CLAUSE"> | ||
15 | + <where> | ||
16 | + <if test="id != null and id != ''"><![CDATA[AND id = #{id}]]></if> | ||
17 | + <if test="categoryId != null and categoryId != ''"><![CDATA[AND category_id = #{categoryId}]]></if> | ||
18 | + <if test="producingAreaId != null and producingAreaId != ''"><![CDATA[AND producing_area_id = #{producingAreaId}]]></if> | ||
19 | + <if test="price != null and price != ''"><![CDATA[AND price = #{price}]]></if> | ||
20 | + <if test="count != null and count != ''"><![CDATA[AND `count` = #{count}]]></if> | ||
21 | + <if test="unitId != null and unitId != ''"><![CDATA[AND unit_id = #{unitId}]]></if> | ||
22 | + <if test="userId != null and userId != ''"><![CDATA[AND user_id = #{userId}]]></if> | ||
23 | + <if test="phone != null and phone != ''"><![CDATA[AND phone = #{phone}]]></if> | ||
24 | + <if test="expireTime != null and expireTime != ''"><![CDATA[AND expire_time = #{expireTime}]]></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="source != null and source != ''"><![CDATA[AND source = #{source}]]></if> | ||
33 | + <if test="reason != null and reason != ''"><![CDATA[AND reason = #{reason}]]></if> | ||
34 | + <if test="ctime != null and ctime != ''"><![CDATA[AND ctime = #{ctime}]]></if> | ||
35 | + <if test="utime != null and utime != ''"><![CDATA[AND utime = #{utime}]]></if> | ||
36 | + </where> | ||
37 | + </sql> | ||
38 | + | ||
39 | + <!-- 智能排序与分页 --> | ||
40 | + <sql id="QUERY_ORDER_LIMIT_CONDTION"> | ||
41 | + <if test="orderField != null and orderField != '' and orderFieldType != null and orderFieldType != ''"><![CDATA[ORDER BY ${orderField} ${orderFieldType}]]></if> | ||
42 | + <if test="startIndex != null and startIndex >= 0 and pageSize != null and pageSize > 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if> | ||
43 | + </sql> | ||
44 | + | ||
45 | + <!-- 更新列字段,只要不为NULL则更新,除开主键列 --> | ||
46 | + <sql id="UPDATE_COLUMN_SET"> | ||
47 | + <set> | ||
48 | + <if test="categoryId != null"><![CDATA[category_id = #{categoryId},]]></if> | ||
49 | + <if test="producingAreaId != null"><![CDATA[producing_area_id = #{producingAreaId},]]></if> | ||
50 | + <if test="price != null"><![CDATA[price = #{price},]]></if> | ||
51 | + <if test="count != null"><![CDATA[`count` = #{count},]]></if> | ||
52 | + <if test="unitId != null"><![CDATA[unit_id = #{unitId},]]></if> | ||
53 | + <if test="userId != null"><![CDATA[user_id = #{userId},]]></if> | ||
54 | + <if test="phone != null"><![CDATA[phone = #{phone},]]></if> | ||
55 | + <if test="expireTime != null"><![CDATA[expire_time = #{expireTime},]]></if> | ||
56 | + <if test="status != null"><![CDATA[status = #{status},]]></if> | ||
57 | + <if test="source != null"><![CDATA[source = #{source},]]></if> | ||
58 | + <if test="reason != null"><![CDATA[reason = #{reason},]]></if> | ||
59 | + <if test="ctime != null"><![CDATA[ctime = #{ctime},]]></if> | ||
60 | + <![CDATA[ utime = now()]]> | ||
61 | + </set> | ||
62 | + </sql> | ||
63 | + | ||
64 | + <!-- 插入supply记录 --> | ||
65 | + <insert id="insertEntry" parameterType="supply" > | ||
66 | + <![CDATA[ | ||
67 | + 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) | ||
68 | + VALUES (#{id},#{title},#{userName},#{categoryId},#{localityAreaId},#{producingAreaId},#{price},#{count},#{unitId},#{userId},#{phone},#{expireTime},#{status},#{source},now()) | ||
69 | + ]]> | ||
70 | + </insert> | ||
71 | + | ||
72 | + <!-- 返回插入的编号,在事务开启状态下有效 --> | ||
73 | + <select id="lastSequence" resultType="int"><![CDATA[SELECT LAST_INSERT_ID() AS id]]></select> | ||
74 | + | ||
75 | + <!-- 删除记录,主键IN(array) --> | ||
76 | + <delete id="deleteByArrayKey" parameterType="java.lang.reflect.Array" > | ||
77 | + <![CDATA[DELETE FROM supply WHERE id IN]]> | ||
78 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
79 | + <![CDATA[#{id}]]> | ||
80 | + </foreach> | ||
81 | + </delete> | ||
82 | + | ||
83 | + <!-- 删除,通过条件 --> | ||
84 | + <update id="deleteByCondtion" parameterType="supply" > | ||
85 | + <![CDATA[DELETE FROM supply]]> | ||
86 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
87 | + </update> | ||
88 | + | ||
89 | + <!-- 修改记录通过主键 --> | ||
90 | + <update id="updateByKey" parameterType="supply" > | ||
91 | + <![CDATA[UPDATE supply]]> | ||
92 | + <include refid="UPDATE_COLUMN_SET"/> | ||
93 | + <![CDATA[WHERE id = #{id}]]> | ||
94 | + </update> | ||
95 | + | ||
96 | + <!-- 查询,通过主键IN(array) --> | ||
97 | + <select id="selectEntryArray" parameterType="java.lang.reflect.Array" resultType="supply"> | ||
98 | + <![CDATA[SELECT]]> | ||
99 | + <include refid="QUERY_COLUMN_LIST"/> | ||
100 | + <include refid="QUERY_FROM_TABLE"/> | ||
101 | + <![CDATA[WHERE id IN]]> | ||
102 | + <foreach collection="array" item="id" open="(" separator="," close=")"> | ||
103 | + <![CDATA[#{id}]]> | ||
104 | + </foreach> | ||
105 | + </select> | ||
106 | + | ||
107 | + <!-- 查询,通过条件 --> | ||
108 | + <select id="selectEntryList" parameterType="supply" resultType="supply"> | ||
109 | + <![CDATA[SELECT]]> | ||
110 | + <include refid="QUERY_COLUMN_LIST"/> | ||
111 | + <include refid="QUERY_FROM_TABLE"/> | ||
112 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
113 | + <include refid="QUERY_ORDER_LIMIT_CONDTION"/> | ||
114 | + </select> | ||
115 | + | ||
116 | + <!-- 总数查询,通过条件 --> | ||
117 | + <select id="selectEntryListCount" parameterType="supply" resultType="int"> | ||
118 | + <![CDATA[SELECT COUNT(id) AS dataCount]]> | ||
119 | + <include refid="QUERY_FROM_TABLE"/> | ||
120 | + <include refid="QUERY_WHERE_CLAUSE"/> | ||
121 | + </select> | ||
122 | + | ||
123 | + <!-- 其它SQL语句 --> | ||
124 | + <update id="batchExpire" parameterType="java.util.List" > | ||
125 | + <![CDATA[UPDATE supply]]> | ||
126 | + set status = 4 , utime = now() | ||
127 | + <![CDATA[WHERE id IN]]> | ||
128 | + <foreach collection="list" item="id" open="(" separator="," close=")"> | ||
129 | + <![CDATA[#{id}]]> | ||
130 | + </foreach> | ||
131 | + </update> | ||
132 | + <select id="selectExpire" parameterType="supply" resultType="java.lang.Long"> | ||
133 | + <![CDATA[SELECT id ]]> | ||
134 | + <include refid="QUERY_FROM_TABLE"/> | ||
135 | + <![CDATA[WHERE status IN(1,2) and expire_time <= now()]]> | ||
136 | + <include refid="QUERY_ORDER_LIMIT_CONDTION"/> | ||
137 | + </select> | ||
138 | +</mapper> | ||
0 | \ No newline at end of file | 139 | \ No newline at end of file |