Commit f81fe93fdccab375ccdc4e4a8ec9ea65b9a50316

Authored by alexyang
1 parent ba81783b

ini

Showing 51 changed files with 4776 additions and 0 deletions

Too many changes to show.

To preserve performance only 51 of 86 files are displayed.

titan-cache/pom.xml 0 → 100644
  1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  3 + <modelVersion>4.0.0</modelVersion>
  4 +
  5 + <groupId>com.dili.titan</groupId>
  6 + <artifactId>titan-Sync</artifactId>
  7 + <version>1.0</version>
  8 + <packaging>war</packaging>
  9 +
  10 +
  11 + <properties>
  12 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  13 + <spring.version>3.2.9.RELEASE</spring.version>
  14 + </properties>
  15 +
  16 + <profiles>
  17 + <profile>
  18 + <id>develop</id>
  19 + <activation>
  20 + <activeByDefault>true</activeByDefault>
  21 + </activation>
  22 + <properties>
  23 + <titan.jdbc.driver>com.mysql.jdbc.Driver</titan.jdbc.driver>
  24 + <titan.jdbc.url>jdbc:MySql://10.28.10.188:3306/agriez_titan?useUnicode=true&amp;characterEncoding=utf8</titan.jdbc.url>
  25 + <titan.jdbc.username>root</titan.jdbc.username>
  26 + <titan.jdbc.password>123456</titan.jdbc.password>
  27 + <!-- 日志 -->
  28 + <dili_titan.log.level>INFO</dili_titan.log.level>
  29 + <dili_titan.log.path>/export/logs</dili_titan.log.path>
  30 + <dili_titan.log.root.appender>CONSOLE</dili_titan.log.root.appender>
  31 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  32 + <!-- redis 地址 -->
  33 + <cache.redis.url>10.28.10.208</cache.redis.url>
  34 + <cache.redis.port>6379</cache.redis.port>
  35 + <!-- MQ 地址-->
  36 + <conf.mq.namesrvAddr>10.28.10.209:9876;10.28.10.149:9876</conf.mq.namesrvAddr>
  37 + <conf.mq.producerGroup>TitanCachePNR</conf.mq.producerGroup>
  38 + <dili_titan.website.url>manweb.1n4j.com</dili_titan.website.url>
  39 + </properties>
  40 + </profile>
  41 +
  42 + <profile>
  43 + <id>test</id>
  44 + <activation>
  45 + <activeByDefault>false</activeByDefault>
  46 + </activation>
  47 + <properties>
  48 + <titan.jdbc.driver>com.mysql.jdbc.Driver</titan.jdbc.driver>
  49 + <titan.jdbc.url>jdbc:MySql://10.28.6.156:3306/agriez_titan?useUnicode=true&amp;characterEncoding=utf8</titan.jdbc.url>
  50 + <titan.jdbc.username>root</titan.jdbc.username>
  51 + <titan.jdbc.password>123456</titan.jdbc.password>
  52 + <!-- 日志 -->
  53 + <dili_titan.log.level>INFO</dili_titan.log.level>
  54 + <dili_titan.log.path>/home/tomcat/export</dili_titan.log.path>
  55 + <dili_titan.log.root.appender>CONSOLE</dili_titan.log.root.appender>
  56 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  57 + <!-- redis 地址 -->
  58 + <cache.redis.url>10.28.10.207</cache.redis.url>
  59 + <cache.redis.port>6379</cache.redis.port>
  60 + <!-- MQ 地址-->
  61 + <conf.mq.namesrvAddr>10.28.10.230:9876</conf.mq.namesrvAddr>
  62 + <conf.mq.producerGroup>TitanCachePNR</conf.mq.producerGroup>
  63 + <dili_titan.website.url>manweb.1n4j.com</dili_titan.website.url>
  64 + </properties>
  65 + </profile>
  66 +
  67 + <profile>
  68 + <id>online</id>
  69 + <activation>
  70 + <activeByDefault>false</activeByDefault>
  71 + </activation>
  72 + <properties>
  73 + <titan.jdbc.driver>com.mysql.jdbc.Driver</titan.jdbc.driver>
  74 + <titan.jdbc.url>jdbc:MySql://titan.db.1n4j.com:3306/agriez_titan?useUnicode=true&amp;characterEncoding=utf8</titan.jdbc.url>
  75 + <titan.jdbc.username>appAccPayor</titan.jdbc.username>
  76 + <titan.jdbc.password>iTDYVBtI6MX4NQ3Er2Oh</titan.jdbc.password>
  77 + <dili_titan.log.level>INFO</dili_titan.log.level>
  78 + <dili_titan.log.path>/diliapp/servers/logs</dili_titan.log.path>
  79 + <dili_titan.log.root.appender>FILE_ALL</dili_titan.log.root.appender>
  80 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  81 + <!-- redis 地址 -->
  82 + <cache.redis.url>redis.1n4j.com</cache.redis.url>
  83 + <cache.redis.port>6379</cache.redis.port>
  84 + <!-- MQ 地址-->
  85 + <conf.mq.namesrvAddr>192.168.60.62:9876;192.168.60.63:9876</conf.mq.namesrvAddr>
  86 + <conf.mq.producerGroup>cachePNR</conf.mq.producerGroup>
  87 + <dili_titan.website.url>manweb.1n4j.com</dili_titan.website.url>
  88 + </properties>
  89 + </profile>
  90 +
  91 + <profile>
  92 + <id>pnr-clone</id>
  93 + <activation>
  94 + <activeByDefault>false</activeByDefault>
  95 + </activation>
  96 + <properties>
  97 + <titan.jdbc.driver>com.mysql.jdbc.Driver</titan.jdbc.driver>
  98 + <titan.jdbc.url>jdbc:MySql://10.28.5.236:3306/titan?useUnicode=true&amp;characterEncoding=utf8</titan.jdbc.url>
  99 + <titan.jdbc.username>root</titan.jdbc.username>
  100 + <titan.jdbc.password>123456</titan.jdbc.password>
  101 + <!-- 日志 -->
  102 + <dili_titan.log.level>INFO</dili_titan.log.level>
  103 + <dili_titan.log.path>/home/tomcat/export</dili_titan.log.path>
  104 + <dili_titan.log.root.appender>CONSOLE
  105 + </dili_titan.log.root.appender>
  106 + <project.build.sourceEncoding>UTF-8
  107 + </project.build.sourceEncoding>
  108 + <!-- redis 地址 -->
  109 + <cache.redis.url>10.28.5.200</cache.redis.url>
  110 + <cache.redis.port>6379</cache.redis.port>
  111 + <!-- MQ 地址-->
  112 + <conf.mq.namesrvAddr>10.28.5.202:9876;10.28.5.203:9876</conf.mq.namesrvAddr>
  113 + <conf.mq.producerGroup>cachePNR</conf.mq.producerGroup>
  114 + <dili_titan.website.url>manweb.1n4j.com</dili_titan.website.url>
  115 + </properties>
  116 + </profile>
  117 + </profiles>
  118 +
  119 + <dependencies>
  120 + <dependency>
  121 + <groupId>junit</groupId>
  122 + <artifactId>junit</artifactId>
  123 + <version>4.10</version>
  124 + <scope>test</scope>
  125 + </dependency>
  126 + <dependency>
  127 + <groupId>org.slf4j</groupId>
  128 + <artifactId>slf4j-api</artifactId>
  129 + <version>1.6.4</version>
  130 + </dependency>
  131 + <dependency>
  132 + <groupId>org.slf4j</groupId>
  133 + <artifactId>slf4j-log4j12</artifactId>
  134 + <version>1.6.4</version>
  135 + </dependency>
  136 + <dependency>
  137 + <groupId>log4j</groupId>
  138 + <artifactId>log4j</artifactId>
  139 + <version>1.2.17</version>
  140 + </dependency>
  141 + <dependency>
  142 + <groupId>commons-lang</groupId>
  143 + <artifactId>commons-lang</artifactId>
  144 + <version>2.5</version>
  145 + </dependency>
  146 + <dependency>
  147 + <groupId>commons-collections</groupId>
  148 + <artifactId>commons-collections</artifactId>
  149 + <version>3.2.1</version>
  150 + </dependency>
  151 + <dependency>
  152 + <groupId>commons-logging</groupId>
  153 + <artifactId>commons-logging</artifactId>
  154 + <version>1.1.3</version>
  155 + </dependency>
  156 + <dependency>
  157 + <groupId>org.springframework</groupId>
  158 + <artifactId>spring-jdbc</artifactId>
  159 + <version>${spring.version}</version>
  160 + </dependency>
  161 + <dependency>
  162 + <groupId>org.springframework</groupId>
  163 + <artifactId>spring-context-support</artifactId>
  164 + <version>${spring.version}</version>
  165 + </dependency>
  166 + <dependency>
  167 + <groupId>org.springframework</groupId>
  168 + <artifactId>spring-web</artifactId>
  169 + <version>${spring.version}</version>
  170 + </dependency>
  171 + <dependency>
  172 + <groupId>org.springframework</groupId>
  173 + <artifactId>spring-webmvc</artifactId>
  174 + <version>${spring.version}</version>
  175 + </dependency>
  176 + <dependency>
  177 + <groupId>org.mybatis</groupId>
  178 + <artifactId>mybatis</artifactId>
  179 + <version>3.2.1</version>
  180 + </dependency>
  181 + <dependency>
  182 + <groupId>org.mybatis</groupId>
  183 + <artifactId>mybatis-spring</artifactId>
  184 + <version>1.2.0</version>
  185 + </dependency>
  186 + <dependency>
  187 + <groupId>mysql</groupId>
  188 + <artifactId>mysql-connector-java</artifactId>
  189 + <version>5.1.30</version>
  190 + </dependency>
  191 + <dependency>
  192 + <groupId>com.alibaba</groupId>
  193 + <artifactId>druid</artifactId>
  194 + <version>1.0.11</version>
  195 + </dependency>
  196 + <dependency>
  197 + <groupId>org.springframework</groupId>
  198 + <artifactId>spring-context</artifactId>
  199 + <version>${spring.version}</version>
  200 + </dependency>
  201 + <dependency>
  202 + <groupId>com.diligrp.util.rocketMQUtil</groupId>
  203 + <artifactId>diligrp-util-rocketMQUtil</artifactId>
  204 + <version>0.0.1-SNAPSHOT</version>
  205 + <exclusions>
  206 + <exclusion>
  207 + <artifactId>jackson-core-asl</artifactId>
  208 + <groupId>org.codehaus.jackson</groupId>
  209 + </exclusion>
  210 + </exclusions>
  211 + </dependency>
  212 + <dependency>
  213 + <groupId>org.springframework</groupId>
  214 + <artifactId>spring-test</artifactId>
  215 + <version>${spring.version}</version>
  216 + <scope>test</scope>
  217 + </dependency>
  218 + <dependency>
  219 + <groupId>redis.clients</groupId>
  220 + <artifactId>jedis</artifactId>
  221 + <version>2.4.2</version>
  222 + </dependency>
  223 + <dependency>
  224 + <groupId>org.springframework.data</groupId>
  225 + <artifactId>spring-data-redis</artifactId>
  226 + <version>1.3.0.RELEASE</version>
  227 + </dependency>
  228 + <dependency>
  229 + <groupId>org.codehaus.jackson</groupId>
  230 + <artifactId>jackson-mapper-asl</artifactId>
  231 + <version>1.9.2</version>
  232 + </dependency>
  233 + <!-- JSON -->
  234 + <dependency>
  235 + <groupId>com.alibaba</groupId>
  236 + <artifactId>fastjson</artifactId>
  237 + <version>1.1.31</version>
  238 + </dependency>
  239 +
  240 + <dependency>
  241 + <groupId>com.yqyw.website.web</groupId>
  242 + <artifactId>diligrp-website-api</artifactId>
  243 + <version>1.0.3-SNAPSHOT</version>
  244 + </dependency>
  245 + <dependency>
  246 + <artifactId>diligrp-website-util</artifactId>
  247 + <groupId>com.diligrp.website</groupId>
  248 + <version>0.0.1-SNAPSHOT</version>
  249 + </dependency>
  250 +
  251 + </dependencies>
  252 +
  253 + <build>
  254 + <resources>
  255 + <resource>
  256 + <directory>src/main/resources</directory>
  257 + <filtering>true</filtering>
  258 + </resource>
  259 + </resources>
  260 + <plugins>
  261 + <plugin>
  262 + <groupId>org.apache.maven.plugins</groupId>
  263 + <artifactId>maven-war-plugin</artifactId>
  264 + <version>2.3</version>
  265 + </plugin>
  266 + <plugin>
  267 + <groupId>org.apache.maven.plugins</groupId>
  268 + <artifactId>maven-compiler-plugin</artifactId>
  269 + <version>2.5.1</version>
  270 + <configuration>
  271 + <source>1.6</source>
  272 + <target>1.6</target>
  273 + <encoding>UTF-8</encoding>
  274 + </configuration>
  275 + </plugin>
  276 + <plugin>
  277 + <groupId>org.apache.maven.plugins</groupId>
  278 + <artifactId>maven-surefire-plugin</artifactId>
  279 + <version>2.17</version>
  280 + <configuration>
  281 + <skipTests>true</skipTests>
  282 + </configuration>
  283 + </plugin>
  284 + <plugin>
  285 + <groupId>org.mortbay.jetty</groupId>
  286 + <artifactId>maven-jetty-plugin</artifactId>
  287 + <version>6.1.26</version>
  288 + <configuration>
  289 + <scanIntervalSeconds>3</scanIntervalSeconds>
  290 + <contextPath>/</contextPath>
  291 + <connectors>
  292 + <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
  293 + <port>80</port>
  294 + </connector>
  295 + </connectors>
  296 + </configuration>
  297 + </plugin>
  298 + </plugins>
  299 + </build>
  300 +</project>
titan-cache/src/main/java/com/dili/titan/dao/BaseDao.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.dao;
  6 +
  7 +
  8 +import java.io.Serializable;
  9 +import java.util.List;
  10 +
  11 +/**
  12 + * dao基类<实体,主键>
  13 + *
  14 + * @author dev-center
  15 + * @since 2014-05-10
  16 + * @param <T>
  17 + * 实体
  18 + * @param <KEY>
  19 + * 主键
  20 + */
  21 +public interface BaseDao<T, KEY extends Serializable> {
  22 +
  23 + /**
  24 + * 添加对象
  25 + *
  26 + * @param t
  27 + * @return 影响条数
  28 + */
  29 + int insertEntry(T... t);
  30 +
  31 + /**
  32 + * 删除对象,主键
  33 + *
  34 + * @param key
  35 + * @return 影响条数
  36 + */
  37 + int deleteByKey(KEY... key);
  38 +
  39 + /**
  40 + * 更新对象,条件主键ID
  41 + *
  42 + * @param t
  43 + * @return 影响条数
  44 + */
  45 + int updateByKey(T t);
  46 +
  47 + /**
  48 + * 查询对象,条件主键
  49 + *
  50 + * @param key
  51 + * @return
  52 + */
  53 + T selectEntry(KEY key);
  54 +
  55 + /**
  56 + * 查询对象,条件主键数组
  57 + *
  58 + * @param key
  59 + * @return
  60 + */
  61 + List<T> selectEntryList(KEY... key);
  62 +
  63 + /**
  64 + * 查询对象,只要不为NULL与空则为条件
  65 + *
  66 + * @param t
  67 + * @return
  68 + */
  69 + List<T> selectEntryList(T t);
  70 +
  71 + /**
  72 + * 查询对象总数
  73 + *
  74 + * @param t
  75 + * @return
  76 + */
  77 + Integer selectEntryListCount(T t);
  78 +}
titan-cache/src/main/java/com/dili/titan/dao/BaseDaoImpl.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.dao;
  6 +
  7 +
  8 +import java.io.Serializable;
  9 +import java.util.List;
  10 +
  11 +/**
  12 + * dao实现类
  13 + *
  14 + * @author dev-center
  15 + * @since 2014-05-10
  16 + * @param <T>
  17 + * 实体
  18 + * @param <KEY>
  19 + * 主键
  20 + */
  21 +public abstract class BaseDaoImpl<T, KEY extends Serializable> extends MyBatisSupport implements BaseDao<T, KEY> {
  22 + private static final String DEFAULT_INSERT_KEY = "insertEntry";
  23 + private static final String DEFAULT_DELETE_ARRAY_KEY = "deleteByArrayKey";
  24 + private static final String DEFAULT_UPDATE_KEY = "updateByKey";
  25 + private static final String DEFAULT_SELECT_ARRAY_KEY = "selectEntryArray";
  26 + private static final String DEFAULT_SELECT_CONDTION = "selectEntryList";
  27 + private static final String DEFAULT_SELECT_CONDTION_COUNT = "selectEntryListCount";
  28 +
  29 + /**
  30 + * 获取命名空间前缀
  31 + *
  32 + * @param statement
  33 + * @return
  34 + */
  35 + public abstract String getNameSpace(String statement);
  36 +
  37 + public int insertEntry(T... t) {
  38 + int result = 0;
  39 + if (t == null || t.length <= 0) {
  40 + return result;
  41 + }
  42 + for (T o : t) {
  43 + if (o != null) {
  44 + result += this.insert(getNameSpace(DEFAULT_INSERT_KEY), o);
  45 + }
  46 + }
  47 + return result;
  48 + }
  49 +
  50 +
  51 + public int deleteByKey(KEY... key) {
  52 + return this.delete(getNameSpace(DEFAULT_DELETE_ARRAY_KEY), key);
  53 + }
  54 +
  55 +
  56 + public int updateByKey(T t) {
  57 + return this.update(getNameSpace(DEFAULT_UPDATE_KEY), t);
  58 + }
  59 +
  60 + public T selectEntry(KEY key) {
  61 + @SuppressWarnings("unchecked")
  62 + List<T> list = this.selectEntryList(key);
  63 + if (list != null && list.size() > 0) {
  64 + return list.get(0);
  65 + }
  66 + return null;
  67 + }
  68 +
  69 + public List<T> selectEntryList(KEY... key) {
  70 + if (key == null || key.length <= 0) {
  71 + return null;
  72 + }
  73 + return this.selectList(getNameSpace(DEFAULT_SELECT_ARRAY_KEY), key);
  74 + }
  75 +
  76 + public List<T> selectEntryList(T t) {
  77 + return this.selectList(getNameSpace(DEFAULT_SELECT_CONDTION), t);
  78 + }
  79 +
  80 + public Integer selectEntryListCount(T t) {
  81 + return this.select(getNameSpace(DEFAULT_SELECT_CONDTION_COUNT), t);
  82 + }
  83 +
  84 +}
titan-cache/src/main/java/com/dili/titan/dao/MyBatisSupport.java 0 → 100644
  1 +package com.dili.titan.dao;
  2 +
  3 +import com.dili.titan.exception.TitanException;
  4 +import org.mybatis.spring.SqlSessionTemplate;
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +
  8 +import javax.annotation.Resource;
  9 +import java.util.List;
  10 +import java.util.Map;
  11 +
  12 +/**
  13 + *
  14 + *
  15 + */
  16 +abstract class MyBatisSupport {
  17 + protected static final Logger LOGGER = LoggerFactory.getLogger(MyBatisSupport.class);
  18 + @Resource
  19 + private SqlSessionTemplate sqlTemplate;
  20 +
  21 + /**
  22 + *
  23 + *
  24 + * @param readonly
  25 + * @return
  26 + */
  27 + protected SqlSessionTemplate getSqlTemplate(boolean readonly) {
  28 + if (readonly) {
  29 +
  30 + }
  31 + return sqlTemplate;
  32 + }
  33 +
  34 + /**
  35 + * 新增对象
  36 + *
  37 + * @param statement
  38 + * @param parameter
  39 + * @return
  40 + */
  41 + protected int insert(String statement, Object parameter) {
  42 + int res = 0;
  43 + try {
  44 + if (parameter != null) {
  45 + res = getSqlTemplate(false).insert(statement, parameter);
  46 + }
  47 + } catch (Exception ex) {
  48 + throw new TitanException("Mybatis执行新增异常", ex);
  49 + }
  50 + return res;
  51 + }
  52 +
  53 + /**
  54 + * 删除对象
  55 + *
  56 + * @param statement
  57 + * @param parameter
  58 + * @return
  59 + */
  60 + protected int delete(String statement, Object parameter) {
  61 + int res = 0;
  62 + try {
  63 + res = getSqlTemplate(false).delete(statement, parameter);
  64 + } catch (Exception ex) {
  65 + throw new TitanException("Mybatis执行删除异常", ex);
  66 + }
  67 + return res;
  68 + }
  69 +
  70 + /**
  71 + * 更新对象
  72 + *
  73 + * @param statement
  74 + * @param parameter
  75 + * @return
  76 + */
  77 + protected int update(String statement, Object parameter) {
  78 + int res = 0;
  79 + try {
  80 + if (parameter != null) {
  81 + res = getSqlTemplate(false).update(statement, parameter);
  82 + }
  83 + } catch (Exception ex) {
  84 + throw new TitanException("Mybatis执行更新异常", ex);
  85 + }
  86 + return res;
  87 + }
  88 +
  89 + /**
  90 + * 查询一条记录
  91 + *
  92 + * @param <T>
  93 + * @param statement
  94 + * @param parameter
  95 + * @param clz
  96 + * @return
  97 + */
  98 + @SuppressWarnings("unchecked")
  99 + protected <T> T select(String statement, Object parameter) {
  100 + T obj = null;
  101 + try {
  102 + obj = (T) getSqlTemplate(true).selectOne(statement, parameter);
  103 + } catch (Exception ex) {
  104 + throw new TitanException("Mybatis执行单条查询异常", ex);
  105 + }
  106 + return obj;
  107 + }
  108 +
  109 + /**
  110 + * 查询列表
  111 + *
  112 + * @param <T>
  113 + * @param statement
  114 + * @param parameter
  115 + * @param clz
  116 + * @return
  117 + */
  118 + protected <T> List<T> selectList(String statement, Object parameter) {
  119 + List<T> list = null;
  120 + try {
  121 + list = getSqlTemplate(true).selectList(statement, parameter);
  122 + } catch (Exception ex) {
  123 + throw new TitanException("Mybatis执行列表查询异常", ex);
  124 + }
  125 + return list;
  126 + }
  127 +
  128 + /**
  129 + * 查询列表(无参数)
  130 + *
  131 + * @param statement
  132 + * @return
  133 + */
  134 + protected <T> List<T> selectList(String statement) {
  135 + List<T> list = null;
  136 + try {
  137 + list = getSqlTemplate(true).selectList(statement);
  138 + } catch (Exception ex) {
  139 + throw new TitanException("Mybatis执行列表查询异常", ex);
  140 + }
  141 + return list;
  142 + }
  143 +
  144 + /**
  145 + * 查询Map
  146 + *
  147 + * @param <K>
  148 + * @param <V>
  149 + * @param statement
  150 + * @param parameter
  151 + * @param mapKey
  152 + * @return
  153 + */
  154 + protected <K, V> Map<K, V> selectMap(String statement, Object parameter, String mapKey) {
  155 + Map<K, V> map = null;
  156 + try {
  157 + map = getSqlTemplate(true).selectMap(statement, parameter, mapKey);
  158 + } catch (Exception ex) {
  159 + throw new TitanException("Mybatis执行Map查询异常", ex);
  160 + }
  161 + return map;
  162 + }
  163 +}
titan-cache/src/main/java/com/dili/titan/dao/gq/PresaleDao.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.dao.gq;
  6 +
  7 +
  8 +import com.dili.titan.dao.BaseDao;
  9 +import com.dili.titan.domain.gq.Presale;
  10 +import com.dili.titan.domain.gq.Supply;
  11 +
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * SupplyDao 接口
  16 + * @author dev-center
  17 + * @since 2014-12-16
  18 + */
  19 +public interface PresaleDao extends BaseDao<Presale,Long> {
  20 +
  21 + /**
  22 + * 更新用户手机号
  23 + * @param userId
  24 + * @param phone
  25 + */
  26 + public void updatePhone(Long userId,String phone);
  27 +}
0 \ No newline at end of file 28 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/dao/gq/PurchaseDao.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.dao.gq;
  6 +
  7 +
  8 +import com.dili.titan.dao.BaseDao;
  9 +import com.dili.titan.domain.gq.Purchase;
  10 +
  11 +import java.util.List;
  12 +
  13 +/**
  14 + * PurchaseDao 接口
  15 + * @author dev-center
  16 + * @since 2014-12-16
  17 + */
  18 +public interface PurchaseDao extends BaseDao<Purchase,Long> {
  19 + /**
  20 + * 更新用户手机号
  21 + * @param userId
  22 + * @param phone
  23 + */
  24 + public void updatePhone(Long userId,String phone);
  25 +}
0 \ No newline at end of file 26 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/dao/gq/SupplyDao.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.dao.gq;
  6 +
  7 +
  8 +import com.dili.titan.dao.BaseDao;
  9 +import com.dili.titan.domain.gq.Supply;
  10 +
  11 +import java.util.List;
  12 +
  13 +/**
  14 + * SupplyDao 接口
  15 + * @author dev-center
  16 + * @since 2014-12-16
  17 + */
  18 +public interface SupplyDao extends BaseDao<Supply,Long> {
  19 + /**
  20 + * 更新用户手机号
  21 + * @param userId
  22 + * @param phone
  23 + */
  24 + public void updatePhone(Long userId,String phone);
  25 +}
0 \ No newline at end of file 26 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/dao/gq/impl/PresaleDaoImpl.java 0 → 100644
  1 +package com.dili.titan.dao.gq.impl;
  2 +
  3 +import com.dili.titan.dao.BaseDaoImpl;
  4 +import com.dili.titan.dao.gq.PresaleDao;
  5 +import com.dili.titan.domain.gq.Presale;
  6 +import org.springframework.stereotype.Repository;
  7 +
  8 +import java.util.HashMap;
  9 +import java.util.Map;
  10 +
  11 +/**
  12 + * Created by gsz on 2015/7/27.
  13 + */
  14 +@Repository
  15 +public class PresaleDaoImpl extends BaseDaoImpl<Presale,Long> implements PresaleDao {
  16 + private final static String NAMESPACE = "com.dili.titan.dao.gq.PresaleDao.";
  17 +
  18 + //返回本DAO命名空间,并添加statement
  19 + public String getNameSpace(String statement) {
  20 + return NAMESPACE + statement;
  21 + }
  22 +
  23 + @Override
  24 + public void updatePhone(Long userId, String phone) {
  25 + Map<String,Object> conditionMap = new HashMap<String,Object>();
  26 + conditionMap.put("userId",userId);
  27 + conditionMap.put("phone",phone);
  28 + this.update(getNameSpace("updatePhone"),conditionMap);
  29 + }
  30 +}
titan-cache/src/main/java/com/dili/titan/dao/gq/impl/PurchaseDaoImpl.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.dao.gq.impl;
  6 +
  7 +import com.dili.titan.dao.BaseDaoImpl;
  8 +import com.dili.titan.dao.gq.PurchaseDao;
  9 +import com.dili.titan.domain.gq.Purchase;
  10 +import org.springframework.stereotype.Repository;
  11 +
  12 +import java.util.HashMap;
  13 +import java.util.List;
  14 +import java.util.Map;
  15 +
  16 +
  17 +/**
  18 + * PurchaseDao 实现类
  19 + * @author dev-center
  20 + * @since 2014-12-16
  21 + */
  22 +@Repository("purchaseDao")
  23 +public class PurchaseDaoImpl extends BaseDaoImpl<Purchase,Long> implements PurchaseDao {
  24 + private final static String NAMESPACE = "com.dili.titan.dao.gq.PurchaseDao.";
  25 +
  26 + //返回本DAO命名空间,并添加statement
  27 + public String getNameSpace(String statement) {
  28 + return NAMESPACE + statement;
  29 + }
  30 + @Override
  31 + public void updatePhone(Long userId, String phone) {
  32 + Map<String,Object> conditionMap = new HashMap<String,Object>();
  33 + conditionMap.put("userId",userId);
  34 + conditionMap.put("phone",phone);
  35 + this.update(getNameSpace("updatePhone"),conditionMap);
  36 + }
  37 +}
titan-cache/src/main/java/com/dili/titan/dao/gq/impl/SupplyDaoImpl.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.dao.gq.impl;
  6 +
  7 +import com.dili.titan.dao.BaseDaoImpl;
  8 +import com.dili.titan.dao.gq.SupplyDao;
  9 +import com.dili.titan.domain.gq.Supply;
  10 +import org.springframework.stereotype.Repository;
  11 +
  12 +import java.util.HashMap;
  13 +import java.util.List;
  14 +import java.util.Map;
  15 +
  16 +/**
  17 + * SupplyDao 实现类
  18 + *
  19 + * @author dev-center
  20 + * @since 2014-12-16
  21 + */
  22 +@Repository("supplyDao")
  23 +public class SupplyDaoImpl extends BaseDaoImpl<Supply, Long> implements
  24 + SupplyDao {
  25 + private final static String NAMESPACE = "com.dili.titan.dao.gq.SupplyDao.";
  26 +
  27 + // 返回本DAO命名空间,并添加statement
  28 + public String getNameSpace(String statement) {
  29 + return NAMESPACE + statement;
  30 + }
  31 + @Override
  32 + public void updatePhone(Long userId, String phone) {
  33 + Map<String,Object> conditionMap = new HashMap<String,Object>();
  34 + conditionMap.put("userId",userId);
  35 + conditionMap.put("phone",phone);
  36 + this.update(getNameSpace("updatePhone"),conditionMap);
  37 + }
  38 +}
titan-cache/src/main/java/com/dili/titan/dao/impl/AttributeDao.java 0 → 100644
  1 +package com.dili.titan.dao.impl;
  2 +
  3 +import com.dili.titan.dao.BaseDaoImpl;
  4 +import com.dili.titan.domain.Attribute;
  5 +import com.dili.titan.domain.AttributeValue;
  6 +import org.springframework.stereotype.Repository;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * AttributeDao 实现类
  12 + *
  13 + * @author dev-center
  14 + * @since 2014-05-10
  15 + */
  16 +@Repository("attributeDao")
  17 +public class AttributeDao extends BaseDaoImpl<Attribute, Long> {
  18 + private final static String NAMESPACE = "com.dili.titan.dao.AttributeDao.";
  19 +
  20 + // 返回本DAO命名空间,并添加statement
  21 + public String getNameSpace(String statement) {
  22 + return NAMESPACE + statement;
  23 + }
  24 +
  25 + /**
  26 + * 查询属性的所有属性值
  27 + *
  28 + * @param attrId
  29 + * @return
  30 + */
  31 + public List<AttributeValue> getAttributeValues(long attrId) {
  32 + return this.selectList(getNameSpace("selectAttributeValue"), attrId);
  33 + }
  34 +
  35 + /**
  36 + * 查询所有的属性
  37 + *
  38 + * @return
  39 + */
  40 + public List<Attribute> getAllAttribute() {
  41 + return this.selectList(getNameSpace("selectAllEntry"));
  42 + }
  43 +}
0 \ No newline at end of file 44 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/dao/impl/CategoryDao.java 0 → 100644
  1 +package com.dili.titan.dao.impl;
  2 +
  3 +import com.dili.titan.dao.BaseDaoImpl;
  4 +import com.dili.titan.domain.Category;
  5 +import com.dili.titan.domain.CategoryAttr;
  6 +import org.springframework.stereotype.Repository;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * CategoryDao 实现类
  12 + *
  13 + * @author dev-center
  14 + * @since 2014-05-10
  15 + */
  16 +@Repository("categoryDao")
  17 +public class CategoryDao extends BaseDaoImpl<Category, Integer> {
  18 + private final static String NAMESPACE = "com.dili.titan.dao.CategoryDao.";
  19 +
  20 + public String getNameSpace(String statement) {
  21 + return NAMESPACE + statement;
  22 + }
  23 +
  24 + public List<Category> selectAllCategory() {
  25 + return this.selectList(getNameSpace("selectAllEntry"));
  26 + }
  27 +
  28 + public List<CategoryAttr> getCategoryAttrById(int cateId) {
  29 + return this.selectList(getNameSpace("selectCateAttrById"), cateId);
  30 + }
  31 +
  32 + /**
  33 + * this method is可搜索属性
  34 + * @param cateId
  35 + * @return
  36 + * @createTime 2014年9月30日 上午11:16:33
  37 + * @author yangjianjun
  38 + */
  39 + public List<CategoryAttr> getCategorySeacherAttrById(int cateId) {
  40 + return this.selectList(getNameSpace("selectCateSeacherAttrById"), cateId);
  41 + }
  42 +
  43 + public List<Integer> getChildByCid(int cateId) {
  44 + return this.selectList(getNameSpace("selectChildById"), cateId);
  45 + }
  46 +}
0 \ No newline at end of file 47 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/dao/impl/ProductOfflineDao.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.dao.impl;
  6 +
  7 +import com.dili.titan.dao.BaseDaoImpl;
  8 +import com.dili.titan.domain.ProductOffline;
  9 +import org.springframework.stereotype.Repository;
  10 +
  11 +import java.util.HashMap;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +/**
  16 + * ProductOfflineDao 实现类
  17 + * @author dev-center
  18 + * @since 2014-11-14
  19 + */
  20 +@Repository("productOfflineDao")
  21 +public class ProductOfflineDao extends BaseDaoImpl<ProductOffline,Long>{
  22 + private final static String NAMESPACE = "com.dili.titan.dao.ProductOfflineDao.";
  23 +
  24 + //返回本DAO命名空间,并添加statement
  25 + public String getNameSpace(String statement) {
  26 + return NAMESPACE + statement;
  27 + }
  28 +
  29 + public int delProductInfo(List<Long> pids) {
  30 + Map<Object, Object> map = new HashMap<Object, Object>();
  31 + map.put("list", pids);
  32 + return this.delete(getNameSpace("delProduct"), map);
  33 + }
  34 +
  35 + public int deleteCateProducts(List<Long> cateIds, Long sellerId) {
  36 + Map<Object, Object> map = new HashMap<Object, Object>();
  37 + map.put("list", cateIds);
  38 + map.put("sellerId", sellerId);
  39 + return this.delete(getNameSpace("deleteCateProducts"), map);
  40 + }
  41 +
  42 + public ProductOffline selectCatePid(Long cateId) {
  43 + return this.select(getNameSpace("selectCatePid"), cateId);
  44 + }
  45 +
  46 + public List<Long> getSellerSaleCates(Long sellerId) {
  47 + return this.selectList(getNameSpace("selectSellerSaleCates"), sellerId);
  48 + }
  49 +}
0 \ No newline at end of file 50 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/dao/impl/ProductPopDao.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.dao.impl;
  6 +
  7 +import com.dili.titan.dao.BaseDaoImpl;
  8 +import com.dili.titan.domain.ProductPop;
  9 +import org.springframework.stereotype.Repository;
  10 +
  11 +import java.util.HashMap;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +/**
  16 + * ProductOfflineDao 实现类
  17 + * @author dev-center
  18 + * @since 2014-11-14
  19 + */
  20 +@Repository("productPopDao")
  21 +public class ProductPopDao extends BaseDaoImpl<ProductPop,Long>{
  22 + private final static String NAMESPACE = "com.dili.titan.dao.ProductPopDao.";
  23 +
  24 + //返回本DAO命名空间,并添加statement
  25 + public String getNameSpace(String statement) {
  26 + return NAMESPACE + statement;
  27 + }
  28 +
  29 + public int update(long shopId,long cityId){
  30 + Map<String,Object> param = new HashMap<String,Object>();
  31 + param.put("shopId", shopId);
  32 + param.put("cityId", cityId);
  33 + return this.update(getNameSpace("setProductLocalityArea"), param);
  34 + }
  35 +
  36 + public int updateCityId(long shopId,int cityId){
  37 + Map<String,Object> param = new HashMap<String,Object>();
  38 + param.put("shopId", shopId);
  39 + param.put("cityId", cityId);
  40 + return this.update(getNameSpace("setShopCityId"), param);
  41 + }
  42 +
  43 + public List<Long> getProductPopList(long shopId){
  44 + return this.selectList(getNameSpace("selectProductIdByShopId"), shopId);
  45 + }
  46 +
  47 + public int updateShopName(long shopId,String shopName){
  48 + Map<String,Object> param = new HashMap<String,Object>();
  49 + param.put("shopId", shopId);
  50 + param.put("shopName", shopName);
  51 + return this.update(getNameSpace("setShopName"), param);
  52 + }
  53 +
  54 + public int updateUserName(long userId,String userName){
  55 + Map<String,Object> param = new HashMap<String,Object>();
  56 + param.put("userId", userId);
  57 + param.put("userName", userName);
  58 + return this.update(getNameSpace("setUserName"), param);
  59 + }
  60 +
  61 + public int updateMarket(long shopId,long marketId,String marketName){
  62 + Map<String,Object> param = new HashMap<String,Object>();
  63 + param.put("shopId", shopId);
  64 + param.put("marketId", marketId);
  65 + param.put("marketName", marketName);
  66 + return this.update(getNameSpace("setMarket"), param);
  67 + }
  68 +
  69 +
  70 + public List<Long> selectDropsProduct(Long shopId){
  71 + return this.selectList(getNameSpace("selectDropsProduct"), shopId);
  72 + }
  73 +
  74 + public int dropsProduct(Long shopId){
  75 + return this.update(getNameSpace("dropsProduct"), shopId);
  76 + }
  77 +
  78 + public List<Long> selectDelProduct(Long shopId){
  79 + return this.selectList(getNameSpace("selectDelProduct"), shopId);
  80 + }
  81 +
  82 + public int delProduct(Long shopId){
  83 + return this.update(getNameSpace("delProduct"), shopId);
  84 + }
  85 +
  86 +
  87 +}
0 \ No newline at end of file 88 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/domain/Attribute.java 0 → 100644
  1 +package com.dili.titan.domain;
  2 +
  3 +import org.codehaus.jackson.annotate.JsonIgnore;
  4 +
  5 +import java.util.Date;
  6 +
  7 +/**
  8 + * attribute
  9 + *
  10 + * @author dev-center
  11 + * @since 2014-05-10
  12 + */
  13 +public class Attribute extends BaseQuery implements java.io.Serializable {
  14 + private static final long serialVersionUID = 5047017009144564235L;
  15 + private Long attrId;
  16 + private String name;
  17 + private String alias;
  18 + private String inputtype;
  19 + private Integer type;
  20 + private Integer dealType;
  21 + private Integer required;
  22 + private Integer status;
  23 + private Date ctime;
  24 + private Date utime;
  25 +
  26 + public Long getAttrId() {
  27 + return attrId;
  28 + }
  29 +
  30 + public void setAttrId(Long attrId) {
  31 + this.attrId = attrId;
  32 + }
  33 +
  34 + public String getName() {
  35 + return name;
  36 + }
  37 +
  38 + public void setName(String name) {
  39 + this.name = name;
  40 + }
  41 +
  42 + public String getAlias() {
  43 + return alias;
  44 + }
  45 +
  46 + public void setAlias(String alias) {
  47 + this.alias = alias;
  48 + }
  49 +
  50 + public String getInputtype() {
  51 + return inputtype;
  52 + }
  53 +
  54 + public void setInputtype(String inputtype) {
  55 + this.inputtype = inputtype;
  56 + }
  57 +
  58 + public Integer getType() {
  59 + return type;
  60 + }
  61 +
  62 + public void setType(Integer type) {
  63 + this.type = type;
  64 + }
  65 +
  66 + public Integer getRequired() {
  67 + return required;
  68 + }
  69 +
  70 + public void setRequired(Integer required) {
  71 + this.required = required;
  72 + }
  73 +
  74 + public Integer getStatus() {
  75 + return status;
  76 + }
  77 +
  78 + public void setStatus(Integer status) {
  79 + this.status = status;
  80 + }
  81 +
  82 + @JsonIgnore
  83 + public Date getCtime() {
  84 + return ctime;
  85 + }
  86 +
  87 + public void setCtime(Date ctime) {
  88 + this.ctime = ctime;
  89 + }
  90 +
  91 + @JsonIgnore
  92 + public Date getUtime() {
  93 + return utime;
  94 + }
  95 +
  96 + public void setUtime(Date utime) {
  97 + this.utime = utime;
  98 + }
  99 +
  100 + public Integer getDealType() {
  101 + return dealType;
  102 + }
  103 +
  104 + public void setDealType(Integer dealType) {
  105 + this.dealType = dealType;
  106 + }
  107 +
  108 +}
0 \ No newline at end of file 109 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/domain/AttributeValue.java 0 → 100644
  1 +package com.dili.titan.domain;
  2 +
  3 +/**
  4 + * attributeValue
  5 + *
  6 + * @author dev-center
  7 + * @since 2014-05-10
  8 + */
  9 +public class AttributeValue extends BaseQuery {
  10 + private static final long serialVersionUID = 1L;
  11 + private Long valueId;
  12 + private Long attrId;
  13 + private String value;
  14 + private Integer order;
  15 + private Integer show;
  16 + private Integer status;
  17 +
  18 + public AttributeValue() {
  19 + // 默认无参构造方法
  20 + }
  21 +
  22 + /**
  23 + * 获取 attrId
  24 + *
  25 + * @return
  26 + */
  27 + public Long getAttrId() {
  28 + return attrId;
  29 + }
  30 +
  31 + /**
  32 + * 设置 attrId
  33 + *
  34 + * @param attrId
  35 + */
  36 + public void setAttrId(Long attrId) {
  37 + this.attrId = attrId;
  38 + }
  39 +
  40 + /**
  41 + * 获取 value
  42 + *
  43 + * @return
  44 + */
  45 + public String getValue() {
  46 + return value;
  47 + }
  48 +
  49 + /**
  50 + * 设置 value
  51 + *
  52 + * @param value
  53 + */
  54 + public void setValue(String value) {
  55 + this.value = value;
  56 + }
  57 +
  58 + /**
  59 + * 获取 order
  60 + *
  61 + * @return
  62 + */
  63 + public Integer getOrder() {
  64 + return order;
  65 + }
  66 +
  67 + /**
  68 + * 设置 order
  69 + *
  70 + * @param order
  71 + */
  72 + public void setOrder(Integer order) {
  73 + this.order = order;
  74 + }
  75 +
  76 + /**
  77 + * 获取 show
  78 + *
  79 + * @return
  80 + */
  81 + public Integer getShow() {
  82 + return show;
  83 + }
  84 +
  85 + /**
  86 + * 设置 show
  87 + *
  88 + * @param show
  89 + */
  90 + public void setShow(Integer show) {
  91 + this.show = show;
  92 + }
  93 +
  94 + /**
  95 + * 获取 status
  96 + *
  97 + * @return
  98 + */
  99 + public Integer getStatus() {
  100 + return status;
  101 + }
  102 +
  103 + /**
  104 + * 设置 status
  105 + *
  106 + * @param status
  107 + */
  108 + public void setStatus(Integer status) {
  109 + this.status = status;
  110 + }
  111 +
  112 + public Long getValueId() {
  113 + return valueId;
  114 + }
  115 +
  116 + public void setValueId(Long valueId) {
  117 + this.valueId = valueId;
  118 + }
  119 +
  120 +}
0 \ No newline at end of file 121 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/domain/BaseQuery.java 0 → 100644
  1 +package com.dili.titan.domain;
  2 +
  3 +import org.codehaus.jackson.annotate.JsonIgnore;
  4 +
  5 +import java.io.Serializable;
  6 +
  7 +/**
  8 + * 基础查询类
  9 + *
  10 + * @author dev-center
  11 + * @since 2014-05-10
  12 + */
  13 +public class BaseQuery implements Serializable {
  14 + private static final long serialVersionUID = -4304410457539406430L;
  15 +
  16 + private transient Integer startIndex;// 开始索引
  17 +
  18 + private transient Integer endIndex;// 结束索引
  19 +
  20 + private transient String orderField;// 排序字段
  21 +
  22 + private transient String orderType;// 排序类型
  23 +
  24 + private transient String keyword;// 关键则查询
  25 +
  26 + @JsonIgnore
  27 + public Integer getStartIndex() {
  28 + return startIndex;
  29 + }
  30 +
  31 + public void setStartIndex(Integer startIndex) {
  32 + this.startIndex = startIndex;
  33 + }
  34 +
  35 + @JsonIgnore
  36 + public Integer getEndIndex() {
  37 + return endIndex;
  38 + }
  39 +
  40 + public void setEndIndex(Integer endIndex) {
  41 + this.endIndex = endIndex;
  42 + }
  43 +
  44 + @JsonIgnore
  45 + public Integer getPageSize() {
  46 + if (endIndex != null && startIndex != null) {
  47 + return endIndex - startIndex;
  48 + }
  49 + return null;
  50 + }
  51 +
  52 + @JsonIgnore
  53 + public String getOrderField() {
  54 + return orderField;
  55 + }
  56 +
  57 + public void setOrderField(String orderField) {
  58 + this.orderField = orderField;
  59 + }
  60 +
  61 + @JsonIgnore
  62 + public String getorderType() {
  63 + if ("DESC".equalsIgnoreCase(orderType) || "ASC".equalsIgnoreCase(orderType)) {
  64 + return orderType.toUpperCase();
  65 + }
  66 + return null;
  67 + }
  68 +
  69 + @JsonIgnore
  70 + public String getOrderNextType() {
  71 + if ("ASC".equalsIgnoreCase(orderType)) {
  72 + return "DESC";
  73 + }
  74 + return "ASC";
  75 + }
  76 +
  77 + public void setorderType(String orderType) {
  78 + this.orderType = orderType;
  79 + }
  80 +
  81 + public void setKeyword(String keyword) {
  82 + this.keyword = keyword;
  83 + }
  84 +
  85 + @JsonIgnore
  86 + public String getkeyword() {
  87 + return keyword;
  88 + }
  89 +}
titan-cache/src/main/java/com/dili/titan/domain/Category.java 0 → 100644
  1 +package com.dili.titan.domain;
  2 +
  3 +import com.mysql.jdbc.StringUtils;
  4 +
  5 +public class Category extends BaseQuery implements java.io.Serializable {
  6 + private static final long serialVersionUID = 2741179212701828528L;
  7 +
  8 + /**
  9 + * 交易场景 :线上
  10 + */
  11 + public static final int DEALTYPE_ONLINE = 1;
  12 + /**
  13 + * 交易场景 :线下
  14 + */
  15 + public static final int DEALTYPE_OFFLINE = 2;
  16 + /**
  17 + * 交易场景 :线上和线下
  18 + */
  19 + public static final int DEALTYPE_ONANDOFF = 3;
  20 +
  21 + //删除状态,对应数据库status字段
  22 + public static final Integer STATUS_DELETED = -1;
  23 +
  24 + private Integer id;
  25 + private String name;
  26 + private String jp;
  27 + private String alias;
  28 + private Integer parent;
  29 + private Integer order;
  30 + private Integer template;
  31 + private Integer status;
  32 + private Integer activate;
  33 + private String icon;
  34 + private Integer dealType;
  35 +
  36 + public Category() {
  37 + // 默认无参构造方法
  38 + }
  39 +
  40 + /**
  41 + * 获取 name
  42 + *
  43 + * @return
  44 + */
  45 + public String getName() {
  46 + return name;
  47 + }
  48 +
  49 + /**
  50 + * 设置 name
  51 + *
  52 + * @param name
  53 + */
  54 + public void setName(String name) {
  55 + this.name = name;
  56 + }
  57 +
  58 + public String getAlias() {
  59 + if(StringUtils.isNullOrEmpty(this.alias)) return "";
  60 + this.alias = this.alias.replaceAll(","," ").replaceAll(","," ");
  61 + return alias;
  62 + }
  63 +
  64 + public void setAlias(String alias) {
  65 + this.alias = alias;
  66 + }
  67 +
  68 + /**
  69 + * 获取 parent
  70 + *
  71 + * @return
  72 + */
  73 + public Integer getParent() {
  74 + return parent;
  75 + }
  76 +
  77 + /**
  78 + * 设置 parent
  79 + *
  80 + * @param parent
  81 + */
  82 + public void setParent(Integer parent) {
  83 + this.parent = parent;
  84 + }
  85 +
  86 + /**
  87 + * 获取 template
  88 + *
  89 + * @return
  90 + */
  91 + public Integer getTemplate() {
  92 + return template;
  93 + }
  94 +
  95 + /**
  96 + * 设置 template
  97 + *
  98 + * @param template
  99 + */
  100 + public void setTemplate(Integer template) {
  101 + this.template = template;
  102 + }
  103 +
  104 + /**
  105 + * 获取 status
  106 + *
  107 + * @return
  108 + */
  109 + public Integer getStatus() {
  110 + return status;
  111 + }
  112 +
  113 + /**
  114 + * 设置 status
  115 + *
  116 + * @param status
  117 + */
  118 + public void setStatus(Integer status) {
  119 + this.status = status;
  120 + }
  121 +
  122 + /**
  123 + * 获取 activate
  124 + *
  125 + * @return
  126 + */
  127 + public Integer getActivate() {
  128 + return activate;
  129 + }
  130 +
  131 + /**
  132 + * 设置 activate
  133 + *
  134 + * @param activate
  135 + */
  136 + public void setActivate(Integer activate) {
  137 + this.activate = activate;
  138 + }
  139 +
  140 + public Integer getId() {
  141 + return id;
  142 + }
  143 +
  144 + public void setId(Integer id) {
  145 + this.id = id;
  146 + }
  147 +
  148 + public Integer getOrder() {
  149 + return order;
  150 + }
  151 +
  152 + public void setOrder(Integer order) {
  153 + this.order = order;
  154 + }
  155 +
  156 + public String getIcon() {
  157 + return icon;
  158 + }
  159 +
  160 + public void setIcon(String icon) {
  161 + this.icon = icon;
  162 + }
  163 +
  164 + public Integer getDealType() {
  165 + return dealType;
  166 + }
  167 +
  168 + public void setDealType(Integer dealType) {
  169 + this.dealType = dealType;
  170 + }
  171 +
  172 + public String getJp() {
  173 + return jp;
  174 + }
  175 +
  176 + public void setJp(String jp) {
  177 + this.jp = jp;
  178 + }
  179 +}
0 \ No newline at end of file 180 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/domain/CategoryAttr.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.domain;
  6 +
  7 +
  8 +/**
  9 + * categoryAttr
  10 + *
  11 + * @author dev-center
  12 + * @since 2014-05-10
  13 + */
  14 +public class CategoryAttr extends BaseQuery {
  15 + private static final long serialVersionUID = 1L;
  16 + private Long id;
  17 + private Integer catId;
  18 + private Long attrId;
  19 + private Integer searchable;
  20 + private Integer order;
  21 + private Integer dealType;
  22 +
  23 + public Integer getCatId() {
  24 + return catId;
  25 + }
  26 +
  27 + public void setCatId(Integer catId) {
  28 + this.catId = catId;
  29 + }
  30 +
  31 + public Long getAttrId() {
  32 + return attrId;
  33 + }
  34 +
  35 + public void setAttrId(Long attrId) {
  36 + this.attrId = attrId;
  37 + }
  38 +
  39 + public Integer getSearchable() {
  40 + return searchable;
  41 + }
  42 +
  43 + public void setSearchable(Integer searchable) {
  44 + this.searchable = searchable;
  45 + }
  46 +
  47 + public Integer getOrder() {
  48 + return order;
  49 + }
  50 +
  51 + public void setOrder(Integer order) {
  52 + this.order = order;
  53 + }
  54 +
  55 + public Long getId() {
  56 + return id;
  57 + }
  58 +
  59 + public void setId(Long id) {
  60 + this.id = id;
  61 + }
  62 +
  63 + public Integer getDealType() {
  64 + return dealType;
  65 + }
  66 +
  67 + public void setDealType(Integer dealType) {
  68 + this.dealType = dealType;
  69 + }
  70 +}
0 \ No newline at end of file 71 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/domain/ProductImg.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.domain;
  6 +
  7 +import java.util.Date;
  8 +
  9 +/**
  10 + * productImg
  11 + * @author dev-center
  12 + * @since 2014-05-10
  13 + */
  14 +public class ProductImg extends BaseQuery {
  15 +
  16 + private static final long serialVersionUID = 1L;
  17 + private Long pid;
  18 + private String imgUrl;
  19 + private String imgTitle;
  20 + private Long order;
  21 + private String desc;
  22 + private Date ctime;
  23 + private Date utime;
  24 +
  25 + public ProductImg() {
  26 + // 默认无参构造方法
  27 + }
  28 +
  29 + /**
  30 + * 获取 pid
  31 + * @return
  32 + */
  33 + public Long getPid() {
  34 + return pid;
  35 + }
  36 +
  37 + /**
  38 + * 设置 pid
  39 + * @param pid
  40 + */
  41 + public void setPid(Long pid) {
  42 + this.pid = pid;
  43 + }
  44 +
  45 + /**
  46 + * 获取 imgUrl
  47 + * @return
  48 + */
  49 + public String getImgUrl() {
  50 + return imgUrl;
  51 + }
  52 +
  53 + /**
  54 + * 设置 imgUrl
  55 + * @param imgUrl
  56 + */
  57 + public void setImgUrl(String imgUrl) {
  58 + this.imgUrl = imgUrl;
  59 + }
  60 +
  61 + /**
  62 + * 获取 imgTitle
  63 + * @return
  64 + */
  65 + public String getImgTitle() {
  66 + return imgTitle;
  67 + }
  68 +
  69 + /**
  70 + * 设置 imgTitle
  71 + * @param imgTitle
  72 + */
  73 + public void setImgTitle(String imgTitle) {
  74 + this.imgTitle = imgTitle;
  75 + }
  76 +
  77 + /**
  78 + * 获取 order
  79 + * @return
  80 + */
  81 + public Long getOrder() {
  82 + return order;
  83 + }
  84 +
  85 + /**
  86 + * 设置 order
  87 + * @param order
  88 + */
  89 + public void setOrder(Long order) {
  90 + this.order = order;
  91 + }
  92 +
  93 + /**
  94 + * 获取 desc
  95 + * @return
  96 + */
  97 + public String getDesc() {
  98 + return desc;
  99 + }
  100 +
  101 + /**
  102 + * 设置 desc
  103 + * @param desc
  104 + */
  105 + public void setDesc(String desc) {
  106 + this.desc = desc;
  107 + }
  108 +
  109 + /**
  110 + * 获取 ctime
  111 + * @return
  112 + */
  113 + public Date getCtime() {
  114 + return ctime;
  115 + }
  116 +
  117 + /**
  118 + * 设置 ctime
  119 + * @param ctime
  120 + */
  121 + public void setCtime(Date ctime) {
  122 + this.ctime = ctime;
  123 + }
  124 +
  125 + /**
  126 + * 获取 utime
  127 + * @return
  128 + */
  129 + public Date getUtime() {
  130 + return utime;
  131 + }
  132 +
  133 + /**
  134 + * 设置 utime
  135 + * @param utime
  136 + */
  137 + public void setUtime(Date utime) {
  138 + this.utime = utime;
  139 + }
  140 +}
0 \ No newline at end of file 141 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/domain/ProductOffline.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.domain;
  6 +
  7 +import java.util.Date;
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * productOffline
  12 + * @author dev-center
  13 + * @since 2014-11-14
  14 + */
  15 +public class ProductOffline extends BaseQuery {
  16 + private static final long serialVersionUID = 1L;
  17 + private Long pid;
  18 + private Integer cateId;
  19 +
  20 + //商品正常状态
  21 + public static final Integer PRODUCT_NORMAL = 1;
  22 + //商品失效状态
  23 + public static final Integer PRODUCT_INVALID = 2;
  24 +
  25 + /**
  26 + * 类目名
  27 + */
  28 + private String cateName;
  29 + /**
  30 + * 品规
  31 + */
  32 + private String offlineAttrValue;
  33 + private String sellerName;
  34 + private Long price;
  35 + private Integer status;
  36 + private String uniqueKey;
  37 + private Long sellerUserId;
  38 + private Date ctime;
  39 + private Date utime;
  40 +
  41 + /** 分类ID */
  42 + private List<Integer> cateList;
  43 +
  44 + public ProductOffline(){
  45 + //默认无参构造方法
  46 + }
  47 +
  48 + public String getUniqueKey() {
  49 + return uniqueKey;
  50 + }
  51 +
  52 +
  53 +
  54 + public void setUniqueKey(String uniqueKey) {
  55 + this.uniqueKey = uniqueKey;
  56 + }
  57 +
  58 +
  59 +
  60 + public Long getSellerUserId() {
  61 + return sellerUserId;
  62 + }
  63 +
  64 + public void setSellerUserId(Long sellerUserId) {
  65 + this.sellerUserId = sellerUserId;
  66 + }
  67 +
  68 +
  69 +
  70 + public List<Integer> getCateList() {
  71 + return cateList;
  72 + }
  73 +
  74 +
  75 +
  76 + public void setCateList(List<Integer> cateList) {
  77 + this.cateList = cateList;
  78 + }
  79 +
  80 +
  81 +
  82 + /**
  83 + * 获取 pid
  84 + * @return
  85 + */
  86 + public Long getPid(){
  87 + return pid;
  88 + }
  89 +
  90 + /**
  91 + * 设置 pid
  92 + * @param pid
  93 + */
  94 + public void setPid(Long pid){
  95 + this.pid = pid;
  96 + }
  97 +
  98 + /**
  99 + * 获取 cateId
  100 + * @return
  101 + */
  102 + public Integer getCateId(){
  103 + return cateId;
  104 + }
  105 +
  106 + /**
  107 + * 设置 cateId
  108 + * @param cateId
  109 + */
  110 + public void setCateId(Integer cateId){
  111 + this.cateId = cateId;
  112 + }
  113 +
  114 + public String getCateName() {
  115 + return cateName;
  116 + }
  117 +
  118 + public void setCateName(String cateName) {
  119 + this.cateName = cateName;
  120 + }
  121 +
  122 + public String getOfflineAttrValue() {
  123 + return offlineAttrValue;
  124 + }
  125 +
  126 + public void setOfflineAttrValue(String offlineAttrValue) {
  127 + this.offlineAttrValue = offlineAttrValue;
  128 + }
  129 +
  130 + /**
  131 + * 获取 sellerName
  132 + * @return
  133 + */
  134 + public String getSellerName(){
  135 + return sellerName;
  136 + }
  137 +
  138 + /**
  139 + * 设置 sellerName
  140 + * @param sellerName
  141 + */
  142 + public void setSellerName(String sellerName){
  143 + this.sellerName = sellerName;
  144 + }
  145 +
  146 + /**
  147 + * 获取 price
  148 + * @return
  149 + */
  150 + public Long getPrice(){
  151 + return price;
  152 + }
  153 +
  154 + /**
  155 + * 设置 price
  156 + * @param price
  157 + */
  158 + public void setPrice(Long price){
  159 + this.price = price;
  160 + }
  161 +
  162 + /**
  163 + * 获取 status
  164 + * @return
  165 + */
  166 + public Integer getStatus(){
  167 + return status;
  168 + }
  169 +
  170 + /**
  171 + * 设置 status
  172 + * @param status
  173 + */
  174 + public void setStatus(Integer status){
  175 + this.status = status;
  176 + }
  177 +
  178 + /**
  179 + * 获取 ctime
  180 + * @return
  181 + */
  182 + public Date getCtime(){
  183 + return ctime;
  184 + }
  185 +
  186 + /**
  187 + * 设置 ctime
  188 + * @param ctime
  189 + */
  190 + public void setCtime(Date ctime){
  191 + this.ctime = ctime;
  192 + }
  193 +
  194 + public Date getUtime() {
  195 + return utime;
  196 + }
  197 +
  198 + public void setUtime(Date utime) {
  199 + this.utime = utime;
  200 + }
  201 +
  202 +
  203 +}
0 \ No newline at end of file 204 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/domain/ProductPop.java 0 → 100644
  1 +package com.dili.titan.domain;
  2 +
  3 +import java.util.Date;
  4 +import java.util.List;
  5 +
  6 +
  7 +public class ProductPop extends BaseQuery implements java.io.Serializable {
  8 + private static final long serialVersionUID = 1L;
  9 +
  10 + /**报价类型:规格报价 */
  11 + public static final int QUOTATION_TYPE_GG = 1;
  12 + /**报价类型:区间报价 */
  13 + public static final int QUOTATION_TYPE_QJ = 2;
  14 + /**
  15 + * 商品
  16 + */
  17 + private Long pid;
  18 + /**
  19 + * 商品名称
  20 + */
  21 + private String name;
  22 + /**
  23 + * 分类
  24 + */
  25 + private Integer cateId;
  26 +
  27 + /**
  28 + * 自定义分类ID
  29 + */
  30 + private Integer userDefined;
  31 + /**
  32 + * 分类名称
  33 + */
  34 + private String cate;
  35 + /**
  36 + * 产地id
  37 + */
  38 + private Long producingArea;
  39 + /**
  40 + * 卖家ID
  41 + */
  42 + private Long seller;
  43 + /**
  44 + * 卖家名称
  45 + */
  46 + private String sellerName;
  47 + /**
  48 + * 店铺ID
  49 + */
  50 + private Long shop;
  51 + /**
  52 + * 店铺名称
  53 + */
  54 + private String shopName;
  55 + /**
  56 + * 商品有效期
  57 + */
  58 + private Integer indate;
  59 + /**
  60 + * 上架模式, 放入仓库1,审核后立即上架2,指定上架时间3
  61 + */
  62 + private Integer publishMode;
  63 + /**
  64 + * 设置上架时间
  65 + */
  66 + private Date publishSettime;
  67 + /**
  68 + * 上架时间
  69 + */
  70 + private Date publishTime;
  71 + /**
  72 + * 下架时间
  73 + */
  74 + private Date dropsTime;
  75 + /**
  76 + * 商品状态 预览-2,删除-1,新建1,审核未通过2,强制下架3,待上架4,在架5,已下架6
  77 + */
  78 + private Integer status;
  79 +
  80 + /**
  81 + * 创建时间
  82 + */
  83 + private Date ctime;
  84 + /**
  85 + * 更新时间
  86 + */
  87 + private Date utime;
  88 + /**
  89 + * 商品描述
  90 + */
  91 + private String desc;
  92 +
  93 + /**
  94 + * 商品备货时长在数据字典中的
  95 + */
  96 + private Long prepareTime;
  97 +
  98 + /**
  99 + * 商品最低价格
  100 + */
  101 + private Integer minPrice;
  102 + /**
  103 + * 商品最高价格
  104 + */
  105 + private Integer maxPrice;
  106 + ///**
  107 + // * 商品交割地
  108 + // */
  109 + //private List<Delivery> deliveryArea;
  110 +
  111 + /**
  112 + * 商品默认图片
  113 + */
  114 + private String defaultPic;
  115 + /**
  116 + * 图片列表
  117 + */
  118 + private List<String> pictures;
  119 +
  120 + /**
  121 + * SKU列表信息
  122 + */
  123 +// private List<Sku> skus;
  124 + /**
  125 + * 按时间查询,开始时间
  126 + */
  127 + private Date startTime;
  128 +
  129 + /**
  130 + * 商品库存单位ID
  131 + */
  132 + private Integer storeUnit;
  133 + private String unitName;
  134 + /**
  135 + * 按时间查询,结束时间
  136 + */
  137 + private Date endTime;
  138 +
  139 + //子分类附带其父分类
  140 + private List<Category> subCateList;
  141 +
  142 + /**
  143 + * 所在地ID
  144 + */
  145 + private Long localityArea;
  146 + /** 所在国家地*/
  147 + private Long countryAreaId;
  148 + /** 自定义国家所在城市名(国外)*/
  149 + private String foreignCityName;
  150 + /** 商品发布地ID*/
  151 + private Long publishedLocationID;
  152 +
  153 + /*1:规格报价 & 2:区间报价类型*/
  154 + private Integer quotationType;
  155 +
  156 + public Long getPid() {
  157 + return pid;
  158 + }
  159 +
  160 + public void setPid(Long pid) {
  161 + this.pid = pid;
  162 + }
  163 +
  164 + public String getName() {
  165 + return name;
  166 + }
  167 +
  168 + public void setName(String name) {
  169 + this.name = name;
  170 + }
  171 +
  172 + public Integer getCateId() {
  173 + return cateId;
  174 + }
  175 +
  176 + public void setCateId(Integer cateId) {
  177 + this.cateId = cateId;
  178 + }
  179 +
  180 + public Integer getUserDefined() {
  181 + return userDefined;
  182 + }
  183 +
  184 + public void setUserDefined(Integer userDefined) {
  185 + this.userDefined = userDefined;
  186 + }
  187 +
  188 + public String getCate() {
  189 + return cate;
  190 + }
  191 +
  192 + public void setCate(String cate) {
  193 + this.cate = cate;
  194 + }
  195 +
  196 + public Long getProducingArea() {
  197 + return producingArea;
  198 + }
  199 +
  200 + public void setProducingArea(Long producingArea) {
  201 + this.producingArea = producingArea;
  202 + }
  203 +
  204 + public Long getSeller() {
  205 + return seller;
  206 + }
  207 +
  208 + public void setSeller(Long seller) {
  209 + this.seller = seller;
  210 + }
  211 +
  212 + public String getSellerName() {
  213 + return sellerName;
  214 + }
  215 +
  216 + public void setSellerName(String sellerName) {
  217 + this.sellerName = sellerName;
  218 + }
  219 +
  220 + public Long getShop() {
  221 + return shop;
  222 + }
  223 +
  224 + public void setShop(Long shop) {
  225 + this.shop = shop;
  226 + }
  227 +
  228 + public String getShopName() {
  229 + return shopName;
  230 + }
  231 +
  232 + public void setShopName(String shopName) {
  233 + this.shopName = shopName;
  234 + }
  235 +
  236 + public Integer getIndate() {
  237 + return indate;
  238 + }
  239 +
  240 + public void setIndate(Integer indate) {
  241 + this.indate = indate;
  242 + }
  243 +
  244 + public Integer getPublishMode() {
  245 + return publishMode;
  246 + }
  247 +
  248 + public void setPublishMode(Integer publishMode) {
  249 + this.publishMode = publishMode;
  250 + }
  251 +
  252 + public Date getPublishSettime() {
  253 + return publishSettime;
  254 + }
  255 +
  256 + public void setPublishSettime(Date publishSettime) {
  257 + this.publishSettime = publishSettime;
  258 + }
  259 +
  260 + public Date getPublishTime() {
  261 + return publishTime;
  262 + }
  263 +
  264 + public void setPublishTime(Date publishTime) {
  265 + this.publishTime = publishTime;
  266 + }
  267 +
  268 + public Date getDropsTime() {
  269 + return dropsTime;
  270 + }
  271 +
  272 + public void setDropsTime(Date dropsTime) {
  273 + this.dropsTime = dropsTime;
  274 + }
  275 +
  276 + public Integer getStatus() {
  277 + return status;
  278 + }
  279 +
  280 + public void setStatus(Integer status) {
  281 + this.status = status;
  282 + }
  283 +
  284 + public Date getCtime() {
  285 + return ctime;
  286 + }
  287 +
  288 + public void setCtime(Date ctime) {
  289 + this.ctime = ctime;
  290 + }
  291 +
  292 + public Date getUtime() {
  293 + return utime;
  294 + }
  295 +
  296 + public void setUtime(Date utime) {
  297 + this.utime = utime;
  298 + }
  299 +
  300 + public String getDesc() {
  301 + return desc;
  302 + }
  303 +
  304 + public void setDesc(String desc) {
  305 + this.desc = desc;
  306 + }
  307 +
  308 + public Long getPrepareTime() {
  309 + return prepareTime;
  310 + }
  311 +
  312 + public void setPrepareTime(Long prepareTime) {
  313 + this.prepareTime = prepareTime;
  314 + }
  315 +
  316 + public Integer getMinPrice() {
  317 + return minPrice;
  318 + }
  319 +
  320 + public void setMinPrice(Integer minPrice) {
  321 + this.minPrice = minPrice;
  322 + }
  323 +
  324 + public Integer getMaxPrice() {
  325 + return maxPrice;
  326 + }
  327 +
  328 + public void setMaxPrice(Integer maxPrice) {
  329 + this.maxPrice = maxPrice;
  330 + }
  331 +
  332 + public String getDefaultPic() {
  333 + return defaultPic;
  334 + }
  335 +
  336 + public void setDefaultPic(String defaultPic) {
  337 + this.defaultPic = defaultPic;
  338 + }
  339 +
  340 + public List<String> getPictures() {
  341 + return pictures;
  342 + }
  343 +
  344 + public void setPictures(List<String> pictures) {
  345 + this.pictures = pictures;
  346 + }
  347 +
  348 + public Date getStartTime() {
  349 + return startTime;
  350 + }
  351 +
  352 + public void setStartTime(Date startTime) {
  353 + this.startTime = startTime;
  354 + }
  355 +
  356 + public Integer getStoreUnit() {
  357 + return storeUnit;
  358 + }
  359 +
  360 + public void setStoreUnit(Integer storeUnit) {
  361 + this.storeUnit = storeUnit;
  362 + }
  363 +
  364 + public String getUnitName() {
  365 + return unitName;
  366 + }
  367 +
  368 + public void setUnitName(String unitName) {
  369 + this.unitName = unitName;
  370 + }
  371 +
  372 + public Date getEndTime() {
  373 + return endTime;
  374 + }
  375 +
  376 + public void setEndTime(Date endTime) {
  377 + this.endTime = endTime;
  378 + }
  379 +
  380 + public List<Category> getSubCateList() {
  381 + return subCateList;
  382 + }
  383 +
  384 + public void setSubCateList(List<Category> subCateList) {
  385 + this.subCateList = subCateList;
  386 + }
  387 +
  388 + public Long getLocalityArea() {
  389 + return localityArea;
  390 + }
  391 +
  392 + public void setLocalityArea(Long localityArea) {
  393 + this.localityArea = localityArea;
  394 + }
  395 +
  396 + public Long getCountryAreaId() {
  397 + return countryAreaId;
  398 + }
  399 +
  400 + public void setCountryAreaId(Long countryAreaId) {
  401 + this.countryAreaId = countryAreaId;
  402 + }
  403 +
  404 + public String getForeignCityName() {
  405 + return foreignCityName;
  406 + }
  407 +
  408 + public void setForeignCityName(String foreignCityName) {
  409 + this.foreignCityName = foreignCityName;
  410 + }
  411 +
  412 + public Long getPublishedLocationID() {
  413 + return publishedLocationID;
  414 + }
  415 +
  416 + public void setPublishedLocationID(Long publishedLocationID) {
  417 + this.publishedLocationID = publishedLocationID;
  418 + }
  419 +
  420 + public Integer getQuotationType() {
  421 + return quotationType;
  422 + }
  423 +
  424 + public void setQuotationType(Integer quotationType) {
  425 + this.quotationType = quotationType;
  426 + }
  427 +
  428 + //private List<Delivery> deliveryList;
  429 +// private List<ProductSkuPop> skuList;
  430 +// private List<ProductPopAttr> attrList;
  431 +// private List<ProductImg> imgList;
  432 +// private List<ProductPopAttr> saleAttrList;
  433 +// private List<ProductPopAttr> descAttrList;
  434 +// private List<ProductPopPriceRange> productPopPriceRanges;
  435 +// private List<ProductAuth> productAuthList;
  436 +// private ProductVideo productVideo;
  437 +
  438 +
  439 +
  440 +}
0 \ No newline at end of file 441 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/domain/RedisKeyConstant.java 0 → 100644
  1 +package com.dili.titan.domain;
  2 +
  3 +/**
  4 + * Created by gsz on 2015/6/4.
  5 + */
  6 +public class RedisKeyConstant {
  7 + public static final String ATTRIBUTE = "Attribute";//属性
  8 + public static final String ATTR_VALUE = "Attr_value";//属性值
  9 + public static final String CATEGORY = "Category";//分类
  10 + public static final String CATE_ATTR = "Cate_Attr";//分类属性
  11 + public static final String CATE_SEARCH_ATTRA ="Cate_Search_Attr";//可搜索属性
  12 + public static final String CATE_ALLPARENT = "Cate_AllParent_";//分类所有父分类
  13 + public static final String CATE_CHILD = "Cate_Child_";//分类子节点
  14 + public static final String PURCHASE = "Purchase";//求购信息
  15 + public static final String NEW_SUPPLY_KEY = "New_Supply";//最新供应信息
  16 + public static final String SUPPLY = "Supply";//供应信息
  17 + public static final String PRESALE = "Presale";//预售信息
  18 + public static final String PRODUCT_POP = "product_Pop";//第三方商品
  19 + public static final String PICKUPINFO = "pickupinfo";//提货点
  20 +}
titan-cache/src/main/java/com/dili/titan/domain/gq/Presale.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2015 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.domain.gq;
  6 +
  7 +
  8 +import java.util.Date;
  9 +
  10 +/**
  11 + * presale
  12 + * @author dev-center
  13 + * @since 2015-07-24
  14 + */
  15 +public class Presale {
  16 + private Long id;
  17 + private String title;
  18 + private String userName;
  19 + private Long categoryId;
  20 + private Long localityAreaId;
  21 + private Integer count;
  22 + private Integer unitId;
  23 + private String phone;
  24 + private Integer status;
  25 + private Long userId;
  26 + private Integer source;
  27 + private String reason;
  28 + private Date startTime;
  29 + private Date endTime;
  30 + private Date ctime;
  31 + private String utime;
  32 +
  33 + public Presale(){
  34 + //默认无参构造方法
  35 + }
  36 +
  37 + public Long getId() {
  38 + return id;
  39 + }
  40 +
  41 + public void setId(Long id) {
  42 + this.id = id;
  43 + }
  44 +
  45 + public String getTitle() {
  46 + return title;
  47 + }
  48 +
  49 + public void setTitle(String title) {
  50 + this.title = title;
  51 + }
  52 +
  53 + public String getUserName() {
  54 + return userName;
  55 + }
  56 +
  57 + public void setUserName(String userName) {
  58 + this.userName = userName;
  59 + }
  60 +
  61 + public Long getCategoryId() {
  62 + return categoryId;
  63 + }
  64 +
  65 + public void setCategoryId(Long categoryId) {
  66 + this.categoryId = categoryId;
  67 + }
  68 +
  69 + public Long getLocalityAreaId() {
  70 + return localityAreaId;
  71 + }
  72 +
  73 + public void setLocalityAreaId(Long localityAreaId) {
  74 + this.localityAreaId = localityAreaId;
  75 + }
  76 +
  77 + public Integer getCount() {
  78 + return count;
  79 + }
  80 +
  81 + public void setCount(Integer count) {
  82 + this.count = count;
  83 + }
  84 +
  85 + public Integer getUnitId() {
  86 + return unitId;
  87 + }
  88 +
  89 + public void setUnitId(Integer unitId) {
  90 + this.unitId = unitId;
  91 + }
  92 +
  93 + public String getPhone() {
  94 + return phone;
  95 + }
  96 +
  97 + public void setPhone(String phone) {
  98 + this.phone = phone;
  99 + }
  100 +
  101 + public Integer getStatus() {
  102 + return status;
  103 + }
  104 +
  105 + public void setStatus(Integer status) {
  106 + this.status = status;
  107 + }
  108 +
  109 + public Long getUserId() {
  110 + return userId;
  111 + }
  112 +
  113 + public void setUserId(Long userId) {
  114 + this.userId = userId;
  115 + }
  116 +
  117 + public Integer getSource() {
  118 + return source;
  119 + }
  120 +
  121 + public void setSource(Integer source) {
  122 + this.source = source;
  123 + }
  124 +
  125 + public String getReason() {
  126 + return reason;
  127 + }
  128 +
  129 + public void setReason(String reason) {
  130 + this.reason = reason;
  131 + }
  132 +
  133 + public Date getStartTime() {
  134 + return startTime;
  135 + }
  136 +
  137 + public void setStartTime(Date startTime) {
  138 + this.startTime = startTime;
  139 + }
  140 +
  141 + public Date getEndTime() {
  142 + return endTime;
  143 + }
  144 +
  145 + public void setEndTime(Date endTime) {
  146 + this.endTime = endTime;
  147 + }
  148 +
  149 + public Date getCtime() {
  150 + return ctime;
  151 + }
  152 +
  153 + public void setCtime(Date ctime) {
  154 + this.ctime = ctime;
  155 + }
  156 +
  157 + public String getUtime() {
  158 + return utime;
  159 + }
  160 +
  161 + public void setUtime(String utime) {
  162 + this.utime = utime;
  163 + }
  164 +}
0 \ No newline at end of file 165 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/domain/gq/Purchase.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2015 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.domain.gq;
  6 +
  7 +import java.util.Date;
  8 +
  9 +/**
  10 + * purchase
  11 + * @author dev-center
  12 + * @since 2015-07-24
  13 + */
  14 +public class Purchase {
  15 + private Long id;
  16 + private String title;
  17 + private String userName;
  18 + private Long categoryId;
  19 + private Long producingAreaId;
  20 + private Long localityAreaId;
  21 + private Integer count;
  22 + private Integer unitId;
  23 + private String phone;
  24 + private Date expireTime;
  25 + private Integer status;
  26 + private Long userId;
  27 + private Integer source;
  28 + private String reason;
  29 + private Date ctime;
  30 + private String utime;
  31 +
  32 + public Purchase(){
  33 + //默认无参构造方法
  34 + }
  35 +
  36 + public Long getId() {
  37 + return id;
  38 + }
  39 +
  40 + public void setId(Long id) {
  41 + this.id = id;
  42 + }
  43 +
  44 + public String getTitle() {
  45 + return title;
  46 + }
  47 +
  48 + public void setTitle(String title) {
  49 + this.title = title;
  50 + }
  51 +
  52 + public String getUserName() {
  53 + return userName;
  54 + }
  55 +
  56 + public void setUserName(String userName) {
  57 + this.userName = userName;
  58 + }
  59 +
  60 + public Long getCategoryId() {
  61 + return categoryId;
  62 + }
  63 +
  64 + public void setCategoryId(Long categoryId) {
  65 + this.categoryId = categoryId;
  66 + }
  67 +
  68 + public Long getLocalityAreaId() {
  69 + return localityAreaId;
  70 + }
  71 +
  72 + public void setLocalityAreaId(Long localityAreaId) {
  73 + this.localityAreaId = localityAreaId;
  74 + }
  75 +
  76 + public Integer getCount() {
  77 + return count;
  78 + }
  79 +
  80 + public void setCount(Integer count) {
  81 + this.count = count;
  82 + }
  83 +
  84 + public Integer getUnitId() {
  85 + return unitId;
  86 + }
  87 +
  88 + public void setUnitId(Integer unitId) {
  89 + this.unitId = unitId;
  90 + }
  91 +
  92 + public String getPhone() {
  93 + return phone;
  94 + }
  95 +
  96 + public void setPhone(String phone) {
  97 + this.phone = phone;
  98 + }
  99 +
  100 + public Date getExpireTime() {
  101 + return expireTime;
  102 + }
  103 +
  104 + public void setExpireTime(Date expireTime) {
  105 + this.expireTime = expireTime;
  106 + }
  107 +
  108 + public Integer getStatus() {
  109 + return status;
  110 + }
  111 +
  112 + public void setStatus(Integer status) {
  113 + this.status = status;
  114 + }
  115 +
  116 + public Long getUserId() {
  117 + return userId;
  118 + }
  119 +
  120 + public void setUserId(Long userId) {
  121 + this.userId = userId;
  122 + }
  123 +
  124 + public Integer getSource() {
  125 + return source;
  126 + }
  127 +
  128 + public void setSource(Integer source) {
  129 + this.source = source;
  130 + }
  131 +
  132 + public String getReason() {
  133 + return reason;
  134 + }
  135 +
  136 + public void setReason(String reason) {
  137 + this.reason = reason;
  138 + }
  139 +
  140 + public Date getCtime() {
  141 + return ctime;
  142 + }
  143 +
  144 + public void setCtime(Date ctime) {
  145 + this.ctime = ctime;
  146 + }
  147 +
  148 + public String getUtime() {
  149 + return utime;
  150 + }
  151 +
  152 + public void setUtime(String utime) {
  153 + this.utime = utime;
  154 + }
  155 +
  156 + public Long getProducingAreaId() {
  157 + return producingAreaId;
  158 + }
  159 +
  160 + public void setProducingAreaId(Long producingAreaId) {
  161 + this.producingAreaId = producingAreaId;
  162 + }
  163 +}
0 \ No newline at end of file 164 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/domain/gq/Supply.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2015 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.domain.gq;
  6 +
  7 +
  8 +import java.util.Date;
  9 +
  10 +/**
  11 + * supply
  12 + * @author dev-center
  13 + * @since 2015-07-24
  14 + */
  15 +public class Supply {
  16 + private Long id;
  17 + private String title;
  18 + private String userName;
  19 + private Long categoryId;
  20 + private Long localityAreaId;
  21 + private Long producingAreaId;
  22 + private Long price;
  23 + private Integer count;
  24 + private Integer unitId;
  25 + private Long userId;
  26 + private String phone;
  27 + private Date expireTime;
  28 + private Integer status;
  29 + private Integer source;
  30 + private String reason;
  31 + private Date ctime;
  32 + private String utime;
  33 +
  34 + public Supply(){
  35 + //默认无参构造方法
  36 + }
  37 +
  38 + public Long getId() {
  39 + return id;
  40 + }
  41 +
  42 + public void setId(Long id) {
  43 + this.id = id;
  44 + }
  45 +
  46 + public String getTitle() {
  47 + return title;
  48 + }
  49 +
  50 + public void setTitle(String title) {
  51 + this.title = title;
  52 + }
  53 +
  54 + public String getUserName() {
  55 + return userName;
  56 + }
  57 +
  58 + public void setUserName(String userName) {
  59 + this.userName = userName;
  60 + }
  61 +
  62 + public Long getCategoryId() {
  63 + return categoryId;
  64 + }
  65 +
  66 + public void setCategoryId(Long categoryId) {
  67 + this.categoryId = categoryId;
  68 + }
  69 +
  70 + public Long getProducingAreaId() {
  71 + return producingAreaId;
  72 + }
  73 +
  74 + public void setProducingAreaId(Long producingAreaId) {
  75 + this.producingAreaId = producingAreaId;
  76 + }
  77 +
  78 + public Long getPrice() {
  79 + return price;
  80 + }
  81 +
  82 + public void setPrice(Long price) {
  83 + this.price = price;
  84 + }
  85 +
  86 + public Integer getCount() {
  87 + return count;
  88 + }
  89 +
  90 + public void setCount(Integer count) {
  91 + this.count = count;
  92 + }
  93 +
  94 + public Integer getUnitId() {
  95 + return unitId;
  96 + }
  97 +
  98 + public void setUnitId(Integer unitId) {
  99 + this.unitId = unitId;
  100 + }
  101 +
  102 + public Long getUserId() {
  103 + return userId;
  104 + }
  105 +
  106 + public void setUserId(Long userId) {
  107 + this.userId = userId;
  108 + }
  109 +
  110 + public String getPhone() {
  111 + return phone;
  112 + }
  113 +
  114 + public void setPhone(String phone) {
  115 + this.phone = phone;
  116 + }
  117 +
  118 + public Date getExpireTime() {
  119 + return expireTime;
  120 + }
  121 +
  122 + public void setExpireTime(Date expireTime) {
  123 + this.expireTime = expireTime;
  124 + }
  125 +
  126 + public Integer getStatus() {
  127 + return status;
  128 + }
  129 +
  130 + public void setStatus(Integer status) {
  131 + this.status = status;
  132 + }
  133 +
  134 + public Integer getSource() {
  135 + return source;
  136 + }
  137 +
  138 + public void setSource(Integer source) {
  139 + this.source = source;
  140 + }
  141 +
  142 + public String getReason() {
  143 + return reason;
  144 + }
  145 +
  146 + public void setReason(String reason) {
  147 + this.reason = reason;
  148 + }
  149 +
  150 + public Date getCtime() {
  151 + return ctime;
  152 + }
  153 +
  154 + public void setCtime(Date ctime) {
  155 + this.ctime = ctime;
  156 + }
  157 +
  158 + public String getUtime() {
  159 + return utime;
  160 + }
  161 +
  162 + public void setUtime(String utime) {
  163 + this.utime = utime;
  164 + }
  165 +
  166 + public Long getLocalityAreaId() {
  167 + return localityAreaId;
  168 + }
  169 +
  170 + public void setLocalityAreaId(Long localityAreaId) {
  171 + this.localityAreaId = localityAreaId;
  172 + }
  173 +}
0 \ No newline at end of file 174 \ No newline at end of file
titan-cache/src/main/java/com/dili/titan/domain/log/LogBusinessIdUtils.java 0 → 100644
  1 +package com.dili.titan.domain.log;
  2 +
  3 +import org.apache.commons.lang.StringUtils;
  4 +
  5 +import java.util.UUID;
  6 +
  7 +/**
  8 + * 用于设置线程的UUID,用于打印日志
  9 + * @author cdwangyong3
  10 + *
  11 + */
  12 +public class LogBusinessIdUtils {
  13 + private static final ThreadLocal<String> businessLocal = new ThreadLocal<String>();
  14 + /**
  15 + * 返回当前线程对应的uuid
  16 + * @return
  17 + */
  18 + public static String getCurBusinessId(){
  19 + String uuid = businessLocal.get();
  20 + if(StringUtils.isEmpty(uuid)){
  21 + uuid = UUID.randomUUID().toString().replace("-", "");
  22 + businessLocal.set(uuid);
  23 + }
  24 + return uuid;
  25 + }
  26 +
  27 +
  28 + /**
  29 + * 给当前线程重新设置
  30 + */
  31 + public static void clear(){
  32 + businessLocal.set(null);
  33 + }
  34 +}
titan-cache/src/main/java/com/dili/titan/domain/log/LogHelper.java 0 → 100644
  1 +package com.dili.titan.domain.log;
  2 +
  3 +import org.apache.commons.lang.StringUtils;
  4 +import org.apache.commons.logging.Log;
  5 +import org.apache.commons.logging.LogFactory;
  6 +
  7 +import java.io.PrintWriter;
  8 +import java.io.StringWriter;
  9 +import java.util.HashMap;
  10 +import java.util.Map;
  11 +
  12 +/**
  13 + * Describe: User: BjYangKai Date: 2011-4-21 Time: 12:00:33
  14 + */
  15 +public class LogHelper {
  16 +
  17 + /**
  18 + * stock相关重要日志
  19 + */
  20 + private static Map<LogTypeEnum, Log> logMap = new HashMap<LogTypeEnum, Log>();
  21 +
  22 + static {
  23 + for (LogTypeEnum ft : LogTypeEnum.values()) {
  24 + logMap.put(ft, LogFactory.getLog(ft.getKey()));
  25 + }
  26 + }
  27 +
  28 + /**
  29 + *
  30 + * @param str
  31 + * @return
  32 + */
  33 + public static String addLogbusinessId(String str) {
  34 + if (StringUtils.isEmpty(str)) {
  35 + return str;
  36 + } else {
  37 + return "业务标示ID[" + LogBusinessIdUtils.getCurBusinessId() + "],"
  38 + + str;
  39 + }
  40 + }
  41 +
  42 + /**
  43 + * 使用默认的文件记录debug信息
  44 + *
  45 + * @param str 日志信息
  46 + */
  47 + public static void debug(String str, Object... args) {
  48 + debug(LogTypeEnum.DEFAULT, str, args);
  49 + }
  50 +
  51 + /**
  52 + * 使用默认的文件记录info信息
  53 + *
  54 + * @param str 日志信息
  55 + */
  56 + public static void info(String str, Object... args) {
  57 + info(LogTypeEnum.DEFAULT, str, args);
  58 + }
  59 +
  60 + /**
  61 + * 使用默认的文件记录warn信息
  62 + *
  63 + * @param str 日志信息
  64 + */
  65 + public static void warn(String str, Object... args) {
  66 + warn(LogTypeEnum.DEFAULT, str, args);
  67 + }
  68 +
  69 + /**
  70 + * 使用默认的文件记录error信息
  71 + *
  72 + * @param str 日志信息
  73 + */
  74 + public static void error(Throwable e, String str, Object... args) {
  75 + error(LogTypeEnum.DEFAULT, e, str, args);
  76 + }
  77 +
  78 + /**
  79 + * 使用默认的文件记录fatal信息
  80 + *
  81 + * @param str 日志信息
  82 + */
  83 + public static void fatal(Throwable e, String str, Object... args) {
  84 + fatal(LogTypeEnum.DEFAULT, e, str, args);
  85 + }
  86 +
  87 + /**
  88 + * 记录运行期错误信息
  89 + *
  90 + * @param e
  91 + */
  92 + public static void execption(Throwable e) {
  93 + error(LogTypeEnum.EXCEPTION, getExceptionTrace(e));
  94 + }
  95 +
  96 + /**
  97 + * 打印错误信息
  98 + *
  99 + * @param e
  100 + * @return
  101 + */
  102 + public static String getExceptionTrace(Throwable e) {
  103 + if (e != null) {
  104 + StringWriter sw = new StringWriter();
  105 + PrintWriter pw = new PrintWriter(sw);
  106 + e.printStackTrace(pw);
  107 + return sw.toString();
  108 + } else
  109 + return null;
  110 + }
  111 +
  112 + public static Log getLog(LogTypeEnum type) {
  113 + if (logMap.get(type) == null) {
  114 + return LogFactory.getLog(LogHelper.class);
  115 + } else {
  116 + return logMap.get(type);
  117 + }
  118 + }
  119 +
  120 + /**
  121 + * 日志消息占位符形式的替换,按照传入参数依次替换"{}"
  122 + *
  123 + * @param str 带占位符的日志消息
  124 + * @param args 需要被替换的参数,除了字符串和基本类型的对象形式外,其他类型需要自己实现toString方法
  125 + * @return
  126 + */
  127 + public static <T extends Object> String replace(String str, T... args) {
  128 + if (str == null) {
  129 + return str;
  130 + }
  131 + if (args == null || args.length < 1) {
  132 + return addLogbusinessId(str.replaceAll("\\{\\}", " null"));
  133 + }
  134 + StringBuilder builder = new StringBuilder(str);
  135 + int start = builder.indexOf("{");
  136 + int end = builder.indexOf("}", start);
  137 + for (Object arg : args) {
  138 + if (start == -1) {
  139 + break;
  140 + }
  141 + if (arg == null) {
  142 + arg = "null";
  143 + }
  144 + builder.replace(start, end + 1, arg.toString());
  145 + start = start + arg.toString().length();
  146 + start = builder.indexOf("{", start);
  147 + end = builder.indexOf("}", start);
  148 + }
  149 + return addLogbusinessId(builder.toString());
  150 + }
  151 +
  152 + /**
  153 + * 记录DEBUG信息
  154 + *
  155 + * @param type 日志业务类型
  156 + * @param str
  157 + */
  158 + public static void debug(LogTypeEnum type, String str, Object... args) {
  159 + Log log = getLog(type);
  160 + if (log.isDebugEnabled()) {
  161 + String msg = replace(str, args);
  162 + log.debug(msg);
  163 + }
  164 + }
  165 +
  166 + /**
  167 + * 记录INFO信息
  168 + *
  169 + * @param type 日志业务类型
  170 + * @param str
  171 + */
  172 + public static void info(LogTypeEnum type, String str, Object... args) {
  173 + Log log = getLog(type);
  174 + if (log.isInfoEnabled()) {
  175 + String msg = replace(str, args);
  176 + log.info(msg);
  177 + }
  178 + }
  179 +
  180 + /**
  181 + * 记录warn信息
  182 + *
  183 + * @param type 日志业务类型
  184 + * @param str
  185 + */
  186 + public static void warn(LogTypeEnum type, String str, Object... args) {
  187 + Log log = getLog(type);
  188 + if (log.isWarnEnabled()) {
  189 + String msg = replace(str, args);
  190 + log.warn(msg);
  191 + }
  192 + }
  193 +
  194 + /**
  195 + * 记录error信息
  196 + *
  197 + * @param type 日志业务类型
  198 + * @param str
  199 + */
  200 + public static void error(LogTypeEnum type, String str, Object... args) {
  201 + Log log = getLog(type);
  202 + if (log.isErrorEnabled()) {
  203 + String msg = replace(str, args);
  204 + log.error(msg);
  205 + }
  206 + }
  207 +
  208 + /**
  209 + * 记录fatal信息
  210 + *
  211 + * @param type 日志业务类型
  212 + * @param str 日志信息
  213 + */
  214 + public static void fatal(LogTypeEnum type, String str, Object... args) {
  215 + Log log = getLog(type);
  216 + if (log.isFatalEnabled()) {
  217 + String msg = replace(str, args);
  218 + log.fatal(msg);
  219 + }
  220 + }
  221 +
  222 + /**
  223 + * 记录error信息
  224 + *
  225 + * @param type 日志业务类型
  226 + * @param str
  227 + */
  228 + public static void error(LogTypeEnum type, Throwable e, String str,
  229 + Object... args) {
  230 + Log log = getLog(type);
  231 + if (log.isErrorEnabled()) {
  232 + String msg = replace(str, args);
  233 + log.error(msg, e);
  234 + }
  235 + }
  236 +
  237 + /**
  238 + * 记录fatal信息
  239 + *
  240 + * @param type 日志业务类型
  241 + * @param str 日志信息
  242 + */
  243 + public static void fatal(LogTypeEnum type, Throwable e, String str,
  244 + Object... args) {
  245 + Log log = getLog(type);
  246 + if (log.isFatalEnabled()) {
  247 + String msg = replace(str, args);
  248 + log.fatal(msg, e);
  249 + }
  250 + }
  251 +
  252 + public static void main(String[] args) {
  253 + LogHelper.debug(LogTypeEnum.DEFAULT, "aaaa");
  254 + System.out.println();
  255 + }
  256 +}
titan-cache/src/main/java/com/dili/titan/domain/log/LogTypeEnum.java 0 → 100644
  1 +package com.dili.titan.domain.log;
  2 +
  3 +import org.apache.commons.lang.StringUtils;
  4 +import org.apache.commons.logging.Log;
  5 +
  6 +/**
  7 + * 日志的业务类型,对重要的业务日志需要在这里定义类型
  8 + *
  9 + * @author dingjun
  10 + */
  11 +public enum LogTypeEnum {
  12 + DEFAULT("DEFAULT", "默认"),
  13 + SUPPLY("TITAN_SUPPLY", "供应单"),
  14 + PRESALE("TITAN_PRESALE", "供应单"),
  15 + PURCHASE("TITAN_PURCHASE", "求购信息"),
  16 + CATEGORY("TITAN_CATEGORY", "类目"),
  17 + ATTRIBUTE("TITAN_ATTRIBUTE", "属性"),
  18 + PRODUCT("TITAN_PRODUCT", "线上商品"),
  19 + PRODUCT_OFFLINE("TITAN_PRODUCT_OFFLINE", "线下商品"),
  20 + PRODUCT_MQ("PRODUCT_MQ", "MQ消息"),
  21 + //AUTH("TITAN_AUTH", "商品认证"),
  22 + //STOCK("TITAN_STOCK", "库存"),
  23 + //PRODUCT_TP("TITAN_SUPPLIER", "供应商商品"),
  24 + EXCEPTION("EXCEPTION", "运行错误");
  25 +
  26 + private String key;
  27 + private String value;
  28 +
  29 + LogTypeEnum() {
  30 + }
  31 +
  32 + LogTypeEnum(String key, String value) {
  33 + this.key = key;
  34 + this.value = value;
  35 + }
  36 +
  37 + public static String getValue(String key) {
  38 + for (LogTypeEnum ft : LogTypeEnum.values()) {
  39 + if (ft.getKey().equals(key)) {
  40 + return ft.getValue();
  41 + }
  42 + }
  43 + return null;
  44 + }
  45 +
  46 + public String getKey() {
  47 + return key;
  48 + }
  49 +
  50 + public String getValue() {
  51 + return value;
  52 + }
  53 +
  54 + public Log getLog() {
  55 + return LogHelper.getLog(this);
  56 + }
  57 +}
titan-cache/src/main/java/com/dili/titan/domain/log/MarkConstant.java 0 → 100644
  1 +package com.dili.titan.domain.log;
  2 +
  3 +/**
  4 + * <p>Title: 〈标题〉</p>
  5 + * <p>Description: 〈描述〉</p>
  6 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  7 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  8 + * <B>Company</B> 地利集团
  9 + * <p>CreateTime:2014/10/13</p>
  10 + *
  11 + * @author gongsz
  12 + */
  13 +public class MarkConstant {
  14 + /**
  15 + * 分隔符 -
  16 + */
  17 + public static final String SPLIT_CODE = "-";
  18 + /**
  19 + * 冒号
  20 + */
  21 + public static final String COLON = ":";
  22 + /**
  23 + * 逗号
  24 + */
  25 + public static final String COMMA = ",";
  26 +
  27 + /**
  28 + * 左方括号
  29 + */
  30 + public static final String LEFT_BRACKETS="[";
  31 + /**
  32 + * 右方括号
  33 + */
  34 + public static final String RIGHT_BRACKETS="]";
  35 + /**
  36 + * 换行
  37 + */
  38 + public static final String NEW_LINE = "\n";;
  39 +
  40 + /**
  41 + * 符号:点
  42 + */
  43 + public static final String SYMBOL_POINT = ".";
  44 +
  45 + /**
  46 + * 符号:/
  47 + */
  48 + public static final String SPRIT = "/";
  49 + /**
  50 + * 符号:下划线
  51 + */
  52 + public static final String UNDERLINE = "_";
  53 + /**
  54 + * 符号:&
  55 + */
  56 + public static final String AND = "&";
  57 + /**
  58 + * 空格
  59 + */
  60 + public static final String BLANK= " ";
  61 +
  62 + /**
  63 + * 左括号
  64 + */
  65 + public static final String LEFT_BRACKET= "(";
  66 +
  67 + /**
  68 + * 右括号
  69 + */
  70 + public static final String RIGHT_BRACKET= ")";
  71 +
  72 +}
titan-cache/src/main/java/com/dili/titan/exception/TitanException.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.dili.titan.exception;
  6 +
  7 +/**
  8 + * AppException
  9 + * @author dev-center
  10 + * @since 2014-05-10
  11 + */
  12 +public class TitanException extends RuntimeException{
  13 + private static final long serialVersionUID = 1L;
  14 + public TitanException() {
  15 + super();
  16 + }
  17 +
  18 + public TitanException(String message) {
  19 + super(message);
  20 + }
  21 +
  22 + public TitanException(String message, Throwable cause) {
  23 + super(message, cause);
  24 + }
  25 +
  26 + public TitanException(Throwable cause) {
  27 + super(cause);
  28 + }
  29 +}
titan-cache/src/main/java/com/dili/titan/handler/AttributeHandler.java 0 → 100644
  1 +package com.dili.titan.handler;
  2 +
  3 +import com.dili.titan.domain.Attribute;
  4 +import com.dili.titan.domain.AttributeValue;
  5 +import com.dili.titan.domain.RedisKeyConstant;
  6 +import com.dili.titan.domain.log.LogHelper;
  7 +import com.dili.titan.domain.log.LogTypeEnum;
  8 +import com.dili.titan.mq.sender.TopicProducer;
  9 +import com.dili.titan.redis.JedisClient;
  10 +import com.dili.titan.service.impl.AttributeService;
  11 +import org.codehaus.jackson.JsonNode;
  12 +import org.codehaus.jackson.map.ObjectMapper;
  13 +import org.springframework.stereotype.Component;
  14 +
  15 +import javax.annotation.PostConstruct;
  16 +import javax.annotation.Resource;
  17 +import java.util.List;
  18 +
  19 +/**
  20 + * <B>Description</B> TODO 属性监控<br />
  21 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  22 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  23 + * <B>Company</B> 地利集团
  24 + * @createTime 2014年9月22日 下午2:49:22
  25 + * @author yangjianjun
  26 + */
  27 +@Component
  28 +public class AttributeHandler implements BaseHandler {
  29 +
  30 + private ObjectMapper mapper = new ObjectMapper();
  31 +
  32 + @Resource(name = "attributeService")
  33 + private AttributeService attributeService;
  34 +
  35 + @Resource(name = "jedisClient")
  36 + private JedisClient jedisClient;
  37 +
  38 + @Resource(name = "topicProducer")
  39 + private TopicProducer topicProducer;
  40 +
  41 + @Override
  42 + public void handle(String message) throws Exception {
  43 + try {
  44 + JsonNode node = mapper.readTree(message);
  45 + long attrId = node.get("attrId").asLong();
  46 + int operType = node.get("oper").asInt();
  47 +
  48 + switch (operType) {
  49 + case 1:
  50 + add(attrId);
  51 + topicProducer.sendMQAttribute(attrId, operType);
  52 + break;
  53 + case 2:
  54 + update(attrId);
  55 + topicProducer.sendMQAttribute(attrId, operType);
  56 + break;
  57 + case 3:
  58 + delete(attrId);
  59 + topicProducer.sendMQAttribute(attrId, operType);
  60 + break;
  61 + default:
  62 + LogHelper.error(LogTypeEnum.ATTRIBUTE,
  63 + "Attribute operType error");
  64 + break;
  65 + }
  66 + } catch (Exception e) {
  67 + LogHelper.error(LogTypeEnum.ATTRIBUTE, e, "handle error!",
  68 + e.getMessage());
  69 + throw e;
  70 + }
  71 + }
  72 +
  73 + /**
  74 + * 新增属性
  75 + *
  76 + * @param attrId
  77 + */
  78 + private void add(long attrId) throws Exception {
  79 + putAddUpdateAttr(attrId);
  80 + putAddUpdateAttrValue(attrId);
  81 + }
  82 +
  83 + /**
  84 + * 修改属性
  85 + *
  86 + */
  87 + private void update(long attrId) throws Exception {
  88 + putAddUpdateAttr(attrId);
  89 + putAddUpdateAttrValue(attrId);
  90 + }
  91 +
  92 + private void delete(long attrId) throws Exception {
  93 + delAttr(attrId);
  94 + delAttrValue(attrId);
  95 + }
  96 +
  97 + private void putAddUpdateAttr(long attrId) throws Exception {
  98 + try {
  99 + Attribute attribute = attributeService.getAttributeById(attrId);
  100 + String json = mapper.writeValueAsString(attribute);
  101 + jedisClient.hput(RedisKeyConstant.ATTRIBUTE,
  102 + String.valueOf(attribute.getAttrId()), json,JedisClient.expireTime);
  103 +
  104 + List<Attribute> attributes = attributeService.getAllAttribute();
  105 + for (Attribute a : attributes) {
  106 + try {
  107 + String jsons = mapper.writeValueAsString(a);
  108 + jedisClient.hput(RedisKeyConstant.ATTRIBUTE,
  109 + String.valueOf(a.getAttrId()), jsons,JedisClient.expireTime);
  110 + putAddUpdateAttrValue(a.getAttrId());
  111 + } catch (Exception e) {
  112 + LogHelper.error(LogTypeEnum.ATTRIBUTE, e,
  113 + "load attribute error!attrId={}", attrId);
  114 + throw e;
  115 + }
  116 + }
  117 +
  118 + } catch (Exception e) {
  119 + LogHelper.error(LogTypeEnum.ATTRIBUTE, e,
  120 + "load addAttr error!attrId={}", attrId);
  121 + throw e;
  122 + }
  123 + }
  124 +
  125 + private void putAddUpdateAttrValue(long attrId) throws Exception {
  126 + try {
  127 + List<AttributeValue> values = attributeService
  128 + .getAttributeValues(attrId);
  129 + String json = mapper.writeValueAsString(values);
  130 + jedisClient.hput(RedisKeyConstant.ATTR_VALUE, String.valueOf(attrId), json,JedisClient.expireTime);
  131 + } catch (Exception e) {
  132 + LogHelper.error(LogTypeEnum.ATTRIBUTE, e,
  133 + "load addAttrValue error!attrId={}", attrId);
  134 + throw e;
  135 + }
  136 + }
  137 +
  138 + private void delAttr(long attrId) throws Exception {
  139 + try {
  140 + jedisClient.hdel(RedisKeyConstant.ATTRIBUTE, String.valueOf(attrId));
  141 + putAddUpdateAttr(attrId);
  142 + } catch (Exception e) {
  143 + LogHelper.error(LogTypeEnum.ATTRIBUTE, e,
  144 + "load delAttr error!attrId={}", attrId);
  145 + throw e;
  146 + }
  147 + }
  148 +
  149 + private void delAttrValue(long attrId) throws Exception {
  150 + try {
  151 + jedisClient.hdel(RedisKeyConstant.ATTR_VALUE, String.valueOf(attrId));
  152 + putAddUpdateAttrValue(attrId);
  153 + } catch (Exception e) {
  154 + LogHelper.error(LogTypeEnum.ATTRIBUTE, e,
  155 + "load delAttrValue error!attrId={}", attrId);
  156 + throw e;
  157 + }
  158 + }
  159 +
  160 + /**
  161 + * 应用启动时自动执行load方法,加载所有的属性信息
  162 + *
  163 + */
  164 + @PostConstruct
  165 + public void load() {
  166 + LogHelper.info(LogTypeEnum.ATTRIBUTE, "begin load attribute info");
  167 + List<Attribute> attributes = attributeService.getAllAttribute();
  168 + for (Attribute a : attributes) {
  169 + try {
  170 + String json = mapper.writeValueAsString(a);
  171 + jedisClient.hput(RedisKeyConstant.ATTRIBUTE, String.valueOf(a.getAttrId()),
  172 + json,JedisClient.expireTime);
  173 + putAddUpdateAttrValue(a.getAttrId());
  174 + } catch (Exception e) {
  175 + LogHelper.error(LogTypeEnum.ATTRIBUTE, e,
  176 + "load attribute error!attrId={}", a.getAttrId());
  177 + }
  178 + }
  179 + LogHelper.info(LogTypeEnum.ATTRIBUTE, "load attribute info done");
  180 + }
  181 +}
titan-cache/src/main/java/com/dili/titan/handler/BaseHandler.java 0 → 100644
  1 +package com.dili.titan.handler;
  2 +
  3 +public interface BaseHandler {
  4 +
  5 + public void handle(String message) throws Exception;
  6 +
  7 +}
titan-cache/src/main/java/com/dili/titan/handler/CategoryHandler.java 0 → 100644
  1 +package com.dili.titan.handler;
  2 +
  3 +import com.dili.titan.domain.Category;
  4 +import com.dili.titan.domain.CategoryAttr;
  5 +import com.dili.titan.domain.RedisKeyConstant;
  6 +import com.dili.titan.domain.log.LogHelper;
  7 +import com.dili.titan.domain.log.LogTypeEnum;
  8 +import com.dili.titan.mq.sender.TopicProducer;
  9 +import com.dili.titan.redis.JedisClient;
  10 +import com.dili.titan.service.impl.CategoryService;
  11 +
  12 +import org.apache.commons.collections.CollectionUtils;
  13 +import org.apache.commons.lang.StringUtils;
  14 +import org.codehaus.jackson.JsonNode;
  15 +import org.codehaus.jackson.map.DeserializationConfig;
  16 +import org.codehaus.jackson.map.ObjectMapper;
  17 +import org.springframework.stereotype.Component;
  18 +
  19 +import javax.annotation.PostConstruct;
  20 +import javax.annotation.Resource;
  21 +
  22 +import java.util.ArrayList;
  23 +import java.util.List;
  24 +import java.util.Set;
  25 +
  26 +/**
  27 + * <B>Description</B> TODO 类目监控<br />
  28 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  29 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  30 + * <B>Company</B> 地利集团
  31 + * @createTime 2014年9月22日 下午2:49:30
  32 + * @author yangjianjun
  33 + */
  34 +@Component
  35 +public class CategoryHandler implements BaseHandler {
  36 +
  37 + private ObjectMapper mapper = new ObjectMapper().configure(
  38 + DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  39 +
  40 + @Resource(name = "categoryService")
  41 + private CategoryService categoryService;
  42 +
  43 + @Resource(name = "jedisClient")
  44 + private JedisClient jedisClient;
  45 +
  46 + @Resource(name = "topicProducer")
  47 + private TopicProducer topicProducer;
  48 +
  49 + @Override
  50 + public void handle(String message) throws Exception {
  51 + try {
  52 + JsonNode node = mapper.readTree(message);
  53 + int cateId = node.get("cateId").asInt();
  54 + int operType = node.get("oper").asInt();
  55 +
  56 + switch (operType) {
  57 + case 1:
  58 + add(cateId);
  59 + topicProducer.sendMQCategory(cateId, operType);
  60 + break;
  61 + case 2:
  62 + update(cateId);
  63 + topicProducer.sendMQCategory(cateId, operType);
  64 + break;
  65 + case 3:
  66 + update(cateId);
  67 + topicProducer.sendMQCategory(cateId, operType);
  68 + break;
  69 + default:
  70 + LogHelper
  71 + .error(LogTypeEnum.CATEGORY, "Category operType error");
  72 + break;
  73 + }
  74 + } catch (Exception e) {
  75 + LogHelper.error(LogTypeEnum.CATEGORY, e, e.getMessage());
  76 + throw e;
  77 + }
  78 + }
  79 +
  80 + private void add(int cateId) throws Exception {
  81 + putCateParent(cateId);
  82 + putAddUpdateCate(cateId);
  83 + putAddUpdateCateAttr(cateId);
  84 + }
  85 +
  86 + /**
  87 + * 修改属性
  88 + *
  89 + */
  90 + private void update(int cateId) throws Exception {
  91 + putAddUpdateCate(cateId);
  92 + putAddUpdateCateAttr(cateId);
  93 + }
  94 +
  95 + private void putAddUpdateCate(int cateId) throws Exception {
  96 + try {
  97 + Category category = categoryService.getCategoryById(cateId);
  98 + String json = mapper.writeValueAsString(category);
  99 + jedisClient
  100 + .hput(RedisKeyConstant.CATEGORY, String.valueOf(category.getId()), json,JedisClient.expireTime);
  101 + setCateChildRedis(category);
  102 + } catch (Exception e) {
  103 + LogHelper.error(LogTypeEnum.CATEGORY, e,
  104 + "putAddUpdateCate error! cateId={}", cateId);
  105 + throw e;
  106 + }
  107 + }
  108 +
  109 + private void putAddUpdateCateAttr(int cateId) throws Exception {
  110 + try {
  111 + List<CategoryAttr> values = categoryService
  112 + .getCategoryAttrById(cateId);
  113 + String json = mapper.writeValueAsString(values);
  114 + jedisClient.hput(RedisKeyConstant.CATE_ATTR, String.valueOf(cateId), json,JedisClient.expireTime);
  115 +
  116 + List<CategoryAttr> seacherValues = categoryService
  117 + .getCategorySeacherAttrById(cateId);
  118 + String seacherAttrJson = mapper.writeValueAsString(seacherValues);
  119 + jedisClient.hput(RedisKeyConstant.CATE_SEARCH_ATTRA, String.valueOf(cateId),
  120 + seacherAttrJson,JedisClient.expireTime);// 可搜索属性
  121 + } catch (Exception e) {
  122 + LogHelper.error(LogTypeEnum.CATEGORY, e,
  123 + "putAddUpdateCateAttr error! cateId={}", cateId);
  124 + throw e;
  125 + }
  126 + }
  127 +
  128 + private void putCateParent(int cateId) throws Exception {
  129 + try {
  130 + List<Integer> parents = categoryService.getAllParentCate(cateId);
  131 + if (CollectionUtils.isEmpty(parents)) {
  132 + return;
  133 + }
  134 + jedisClient.sadd(RedisKeyConstant.CATE_ALLPARENT + cateId,JedisClient.expireTime, mapper
  135 + .writeValueAsString(parents.toArray(new Integer[parents
  136 + .size()])));
  137 + } catch (Exception e) {
  138 + LogHelper.error(LogTypeEnum.CATEGORY, e,
  139 + "putCateParent error! cateId={}", cateId);
  140 + throw e;
  141 +
  142 + }
  143 + }
  144 +
  145 + /**
  146 + * 应用启动时自动执行load方法,加载所有的类目信息
  147 + *
  148 + */
  149 + @PostConstruct
  150 + public void load() {
  151 + LogHelper.info(LogTypeEnum.CATEGORY, "begin load category info");
  152 + List<Category> categorys = categoryService.getAllCategory();
  153 + for (Category c : categorys) {
  154 + try {
  155 + String json = mapper.writeValueAsString(c);
  156 + jedisClient.hput(RedisKeyConstant.CATEGORY, String.valueOf(c.getId()), json,JedisClient.expireTime);
  157 + setCateChildRedis(c);
  158 + putAddUpdateCateAttr(c.getId());
  159 + putCateParent(c.getId());
  160 + } catch (Exception e) {
  161 + LogHelper.error(LogTypeEnum.CATEGORY, e,
  162 + "load category error!cateId={}", c.getId());
  163 + }
  164 + }
  165 + LogHelper.info(LogTypeEnum.CATEGORY, "load category info done");
  166 + }
  167 +
  168 + private void setCateChildRedis(Category c) {
  169 + List<Integer> cids = categoryService.getChildByCid(c.getParent());
  170 + jedisClient.delKey(RedisKeyConstant.CATE_CHILD+ c.getParent());
  171 + if(CollectionUtils.isNotEmpty(cids)){
  172 + jedisClient.sadd(RedisKeyConstant.CATE_CHILD+ c.getParent(),JedisClient.expireTime,
  173 + StringUtils.join(cids.toArray(),",").split(","));
  174 + }
  175 + }
  176 +
  177 +}
titan-cache/src/main/java/com/dili/titan/handler/CloseShopHandler.java 0 → 100644
  1 +package com.dili.titan.handler;
  2 +
  3 +import com.dili.titan.domain.RedisKeyConstant;
  4 +import com.dili.titan.domain.log.LogHelper;
  5 +import com.dili.titan.domain.log.LogTypeEnum;
  6 +import com.dili.titan.mq.sender.TopicProducer;
  7 +import com.dili.titan.redis.JedisClient;
  8 +import com.dili.titan.service.impl.ProductPopService;
  9 +import org.apache.commons.collections.CollectionUtils;
  10 +import org.codehaus.jackson.JsonNode;
  11 +import org.codehaus.jackson.map.DeserializationConfig;
  12 +import org.codehaus.jackson.map.ObjectMapper;
  13 +import org.springframework.stereotype.Component;
  14 +
  15 +import javax.annotation.Resource;
  16 +import java.util.List;
  17 +
  18 +
  19 +/**
  20 + * <B>Description</B> 求购信息 <br />
  21 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  22 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  23 + * <B>Company</B> 地利集团
  24 + * @createTime 2014年12月22日 下午6:24:00
  25 + * @author ywd
  26 + */
  27 +@Component
  28 +public class CloseShopHandler implements BaseHandler {
  29 +
  30 + private ObjectMapper mapper = new ObjectMapper().configure(
  31 + DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  32 +
  33 + @Resource(name = "productPopService")
  34 + private ProductPopService productPopService;
  35 +
  36 + @Resource(name = "topicProducer")
  37 + private TopicProducer topicProducer;
  38 +
  39 + @Resource(name = "jedisClient")
  40 + private JedisClient client;
  41 +
  42 + @Override
  43 + public void handle(String message) throws Exception {
  44 + try {
  45 + JsonNode node = mapper.readTree(message);
  46 + long shopId = node.get("shopId").asLong();
  47 + int shopState = node.get("shopState").asInt();
  48 + if(shopState==4) {
  49 + update(shopId);
  50 + }
  51 + if(shopState==5) {
  52 + del(shopId);
  53 + }
  54 + } catch (Exception e) {
  55 + LogHelper.error(LogTypeEnum.PRODUCT, e, e.getMessage());
  56 + throw e;
  57 + }
  58 + }
  59 +
  60 + public void del(long shopId) throws Exception{
  61 + List<Long> pids = productPopService.selectDelProduct(shopId);
  62 + if(CollectionUtils.isEmpty(pids)){
  63 + return;
  64 + }
  65 + productPopService.delProduct(shopId);
  66 + for (Long pid: pids ) {
  67 + client.hdel(RedisKeyConstant.PRODUCT_POP, String.valueOf(pid));
  68 + topicProducer.sendMQProduct(pid,1);
  69 + }
  70 + }
  71 +
  72 + public void update(long shopId) throws Exception{
  73 + List<Long> pids = productPopService.selectDropsProduct(shopId);
  74 + if(CollectionUtils.isEmpty(pids)){
  75 + return;
  76 + }
  77 + productPopService.dropsProduct(shopId);
  78 + for (Long pid: pids ) {
  79 + client.hdel(RedisKeyConstant.PRODUCT_POP, String.valueOf(pid));
  80 + topicProducer.sendMQProduct(pid,1);
  81 + }
  82 + }
  83 +
  84 +}
titan-cache/src/main/java/com/dili/titan/handler/PresaleHandler.java 0 → 100644
  1 +package com.dili.titan.handler;
  2 +
  3 +import com.dili.titan.domain.RedisKeyConstant;
  4 +import com.dili.titan.domain.gq.Presale;
  5 +import com.dili.titan.domain.log.LogHelper;
  6 +import com.dili.titan.domain.log.LogTypeEnum;
  7 +import com.dili.titan.mq.sender.TopicProducer;
  8 +import com.dili.titan.redis.JedisClient;
  9 +import com.dili.titan.service.impl.PresaleService;
  10 +import org.codehaus.jackson.JsonNode;
  11 +import org.codehaus.jackson.map.DeserializationConfig;
  12 +import org.codehaus.jackson.map.ObjectMapper;
  13 +import org.springframework.stereotype.Component;
  14 +
  15 +import javax.annotation.Resource;
  16 +
  17 +
  18 +/**
  19 + * <B>Description</B> 供应信息 <br />
  20 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  21 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  22 + * <B>Company</B> 地利集团
  23 + * @createTime 2014年12月23日 下午4:42:36
  24 + * @author ywd
  25 + */
  26 +@Component
  27 +public class PresaleHandler implements BaseHandler {
  28 +
  29 + private ObjectMapper mapper = new ObjectMapper().configure(
  30 + DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  31 +
  32 + @Resource
  33 + private PresaleService presaleService;
  34 +
  35 + @Resource(name = "jedisClient")
  36 + private JedisClient jedisClient;
  37 +
  38 + @Resource(name = "topicProducer")
  39 + private TopicProducer topicProducer;
  40 +
  41 + @Override
  42 + public void handle(String message) throws Exception {
  43 + try {
  44 + JsonNode node = mapper.readTree(message);
  45 + int operType = node.get("oper").asInt();
  46 + Long pid = node.get("pid").asLong();
  47 + put(pid);
  48 + topicProducer.sendMQPresale(pid,operType);
  49 + } catch (Exception e) {
  50 + LogHelper.error(LogTypeEnum.PRESALE, e, e.getMessage());
  51 + throw e;
  52 + }
  53 + }
  54 +
  55 + /**
  56 + * this method is 根据供应ID存储供应
  57 + * @createTime 2014年12月22日 下午5:14:24
  58 + * @author ywd
  59 + */
  60 + private void put(Long pid)throws Exception{
  61 + try {
  62 + Presale presale= presaleService.findByKey(pid);
  63 + if(presale == null){
  64 + LogHelper.error(LogTypeEnum.PRESALE ,
  65 + "can't find Presale by pid={}", pid);
  66 + return;
  67 + }
  68 + String json = mapper.writeValueAsString(presale);
  69 + jedisClient.hput(RedisKeyConstant.PRESALE,presale.getId().toString(), json,JedisClient.expireTime);
  70 + } catch (Exception e) {
  71 + LogHelper.error(LogTypeEnum.PRESALE, e,
  72 + "load putPresale error!pid={}", pid);
  73 + throw e;
  74 + }
  75 + }
  76 +}
titan-cache/src/main/java/com/dili/titan/handler/ProductHandler.java 0 → 100644
  1 +package com.dili.titan.handler;
  2 +
  3 +import com.dili.titan.mq.sender.TopicProducer;
  4 +import com.dili.titan.redis.JedisClient;
  5 +import org.apache.log4j.Logger;
  6 +import org.codehaus.jackson.JsonNode;
  7 +import org.codehaus.jackson.map.ObjectMapper;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +import javax.annotation.Resource;
  11 +/**
  12 + * <B>Description</B> TODO 商品监控 <br />
  13 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  14 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  15 + * <B>Company</B> 地利集团
  16 + * @createTime 2014年9月22日 下午2:49:15
  17 + * @author yangjianjun
  18 + */
  19 +@Component
  20 +public class ProductHandler implements BaseHandler {
  21 + private Logger logger = Logger.getLogger(ProductHandler.class);
  22 + private ObjectMapper mapper = new ObjectMapper();
  23 + @Resource(name="topicProducer")
  24 + private TopicProducer topicProducer;
  25 + @Resource(name="jedisClient")
  26 + private JedisClient client;
  27 + /**
  28 + * 第三方销售
  29 + */
  30 + public static final String SALE_TYPE_POP = "30";
  31 +
  32 + @Override
  33 + public void handle(String message) {
  34 + JsonNode node;
  35 + try {
  36 + node = mapper.readTree(message);
  37 + long pid = node.get("pid").asLong();
  38 + int operType = node.get("oper").asInt();
  39 + int sign = node.get("sign").asInt(); // 1:修改商品,2:修改商品价格或库存(实时 ), 3: 删除商品, 4: 修改商品认证信息, 5: 更新商品状态,6:批量设置第三方商品自定义分类
  40 + switch (operType) {
  41 + case 1:
  42 + topicProducer.sendMQProduct(pid, operType);
  43 + break;
  44 + case 2:
  45 + if(sign == 1){ //1:修改商品
  46 + deleteProductAllInfo(pid);
  47 + }else if(sign == 4){ // 4: 修改商品认证信息
  48 + client.hdel("product_Auth", String.valueOf(pid));
  49 + }else if(sign == 5 || sign == 7){ //5: 更新商品状态
  50 + String saleType = getSaleType(pid);
  51 + if (SALE_TYPE_POP.equals(saleType)) {
  52 + client.hdel("product_Pop", String.valueOf(pid));
  53 + }
  54 + }else if(sign == 6){ //6:批量设置第三方商品自定义分类
  55 + client.hdel("product_Subcate_Id", String.valueOf(pid));
  56 + }else if(sign == 7){ //7:清除视频缓存
  57 + client.hdel("product_Video", String.valueOf(pid));
  58 + }
  59 + topicProducer.sendMQProduct(pid, operType);
  60 + break;
  61 + case 3:
  62 + if(sign == 3){ //3: 删除商品
  63 + deleteProductAllInfo(pid);
  64 + }
  65 + topicProducer.sendMQProduct(pid, operType);
  66 + break;
  67 + default:
  68 + break;
  69 + }
  70 + } catch (Exception e) {
  71 + logger.error("handle error", e);
  72 + }
  73 + }
  74 +
  75 + /**
  76 + * this method is 删除商品所有缓存
  77 + * @param pid
  78 + * @createTime 2015年6月4日 下午2:06:23
  79 + * @author yangwd
  80 + */
  81 + private void deleteProductAllInfo(long pid){
  82 + String saleType = getSaleType(pid);
  83 + if (SALE_TYPE_POP.equals(saleType)) {
  84 + client.hdel("product_Pop", String.valueOf(pid));
  85 + client.hdel("product_Pop_Attr", String.valueOf(pid));
  86 + }
  87 + client.hdel("product_Img", String.valueOf(pid));
  88 + client.hdel("product_Auth", String.valueOf(pid));
  89 + client.hdel("product_Video", String.valueOf(pid));
  90 + }
  91 +
  92 + public String getSaleType(Long pid) {
  93 + if (pid >= 1000000000l && pid < 5000000000l) {
  94 + return SALE_TYPE_POP;
  95 + } else {
  96 + return null;
  97 + }
  98 + }
  99 +
  100 +}
titan-cache/src/main/java/com/dili/titan/handler/ProductSearchHandler.java 0 → 100644
  1 +package com.dili.titan.handler;
  2 +
  3 +import com.dili.titan.domain.log.LogHelper;
  4 +import com.dili.titan.domain.log.LogTypeEnum;
  5 +import com.dili.titan.mq.sender.TopicProducer;
  6 +import org.codehaus.jackson.JsonNode;
  7 +import org.codehaus.jackson.map.ObjectMapper;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +import javax.annotation.Resource;
  11 +
  12 +/**
  13 + * <B>Description</B> TODO 商品监控 <br />
  14 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  15 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  16 + * <B>Company</B> 地利集团
  17 + *
  18 + * @author yangjianjun
  19 + * @createTime 2014年9月22日 下午2:49:15
  20 + */
  21 +@Component
  22 +public class ProductSearchHandler implements BaseHandler {
  23 + private ObjectMapper mapper = new ObjectMapper();
  24 + @Resource(name = "topicProducer")
  25 + private TopicProducer topicProducer;
  26 +
  27 + @Override
  28 + public void handle(String message) {
  29 + JsonNode node;
  30 + try {
  31 + node = mapper.readTree(message);
  32 + long pid = node.get("cid").asLong();
  33 + int type = node.get("type").asInt();
  34 + int operType = node.get("oper").asInt();
  35 + topicProducer.sendMQProductSearch(pid,type, operType);
  36 + } catch (Exception e) {
  37 + LogHelper.error(LogTypeEnum.PRODUCT, e, "ProductSearchHandler error", e);
  38 + }
  39 + }
  40 +}
titan-cache/src/main/java/com/dili/titan/handler/PurchaseHandler.java 0 → 100644
  1 +package com.dili.titan.handler;
  2 +
  3 +import com.dili.titan.domain.RedisKeyConstant;
  4 +import com.dili.titan.domain.gq.Purchase;
  5 +import com.dili.titan.domain.log.LogHelper;
  6 +import com.dili.titan.domain.log.LogTypeEnum;
  7 +import com.dili.titan.mq.sender.TopicProducer;
  8 +import com.dili.titan.redis.JedisClient;
  9 +import com.dili.titan.service.impl.PurchaseService;
  10 +import org.apache.commons.collections.CollectionUtils;
  11 +import org.codehaus.jackson.JsonNode;
  12 +import org.codehaus.jackson.map.DeserializationConfig;
  13 +import org.codehaus.jackson.map.ObjectMapper;
  14 +import org.springframework.stereotype.Component;
  15 +
  16 +import javax.annotation.PostConstruct;
  17 +import javax.annotation.Resource;
  18 +import java.util.ArrayList;
  19 +import java.util.List;
  20 +
  21 +
  22 +/**
  23 + * <B>Description</B> 求购信息 <br />
  24 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  25 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  26 + * <B>Company</B> 地利集团
  27 + * @createTime 2014年12月22日 下午6:24:00
  28 + * @author ywd
  29 + */
  30 +@Component
  31 +public class PurchaseHandler implements BaseHandler {
  32 +
  33 + private ObjectMapper mapper = new ObjectMapper().configure(
  34 + DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  35 +
  36 + @Resource
  37 + private PurchaseService purchaseService;
  38 +
  39 + @Resource(name = "jedisClient")
  40 + private JedisClient jedisClient;
  41 +
  42 + @Resource(name = "topicProducer")
  43 + private TopicProducer topicProducer;
  44 +
  45 + @Override
  46 + public void handle(String message) throws Exception {
  47 + try {
  48 + JsonNode node = mapper.readTree(message);
  49 + int operType = node.get("oper").asInt();
  50 + Long pid = node.get("pid").asLong();
  51 + put(pid);
  52 + topicProducer.sendMQPurchase(pid,operType);
  53 + } catch (Exception e) {
  54 + LogHelper.error(LogTypeEnum.PURCHASE, e, e.getMessage());
  55 + throw e;
  56 + }
  57 + }
  58 +
  59 + /**
  60 + * this method is 根据供应ID存储供应
  61 + * @createTime 2014年12月22日 下午5:14:24
  62 + * @author ywd
  63 + */
  64 + private void put(Long pid)throws Exception{
  65 + try {
  66 + Purchase purchase= purchaseService.findByKey(pid);
  67 + if(purchase == null){
  68 + LogHelper.error(LogTypeEnum.PURCHASE ,
  69 + "can't find Purchase by pid={}", pid);
  70 + return;
  71 + }
  72 + String json = mapper.writeValueAsString(purchase);
  73 + jedisClient.hput(RedisKeyConstant.PURCHASE,purchase.getId().toString(), json,JedisClient.expireTime);
  74 + } catch (Exception e) {
  75 + LogHelper.error(LogTypeEnum.PURCHASE, e,
  76 + "load putPurchase error!pid={}", pid);
  77 + throw e;
  78 + }
  79 + }
  80 +
  81 +}
titan-cache/src/main/java/com/dili/titan/handler/ShopAddressHandler.java 0 → 100644
  1 +package com.dili.titan.handler;
  2 +
  3 +import com.dili.titan.domain.log.LogHelper;
  4 +import com.dili.titan.domain.log.LogTypeEnum;
  5 +import com.dili.titan.service.impl.ProductPopService;
  6 +import org.codehaus.jackson.JsonNode;
  7 +import org.codehaus.jackson.map.DeserializationConfig;
  8 +import org.codehaus.jackson.map.ObjectMapper;
  9 +import org.springframework.stereotype.Component;
  10 +
  11 +import javax.annotation.Resource;
  12 +
  13 +
  14 +/**
  15 + * <B>Description</B> 求购信息 <br />
  16 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  17 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  18 + * <B>Company</B> 地利集团
  19 + * @createTime 2014年12月22日 下午6:24:00
  20 + * @author ywd
  21 + */
  22 +@Component
  23 +public class ShopAddressHandler implements BaseHandler {
  24 +
  25 + private ObjectMapper mapper = new ObjectMapper().configure(
  26 + DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  27 +
  28 + @Resource(name = "productPopService")
  29 + private ProductPopService productPopService;
  30 +
  31 + @Override
  32 + public void handle(String message) throws Exception {
  33 + try {
  34 + JsonNode node = mapper.readTree(message);
  35 + long shopId = node.get("shopId").asLong();
  36 + int cityId = node.get("cityId").asInt();
  37 + update(shopId, cityId);
  38 + } catch (Exception e) {
  39 + LogHelper.error(LogTypeEnum.PRODUCT, e, e.getMessage());
  40 + throw e;
  41 + }
  42 + }
  43 +
  44 + public void update(long shopId,int cityId) throws Exception{
  45 + productPopService.updateCityId(shopId, cityId);
  46 + }
  47 +
  48 +}
titan-cache/src/main/java/com/dili/titan/handler/ShopMarketHandler.java 0 → 100644
  1 +package com.dili.titan.handler;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.dili.titan.domain.log.LogHelper;
  5 +import com.dili.titan.domain.log.LogTypeEnum;
  6 +import com.dili.titan.rpc.ConfigRPC;
  7 +import com.dili.titan.service.impl.ProductPopService;
  8 +import com.diligrp.website.web.interfaces.domain.output.PickUpPointResp;
  9 +import org.springframework.stereotype.Component;
  10 +import org.springframework.transaction.annotation.Transactional;
  11 +
  12 +import javax.annotation.Resource;
  13 +
  14 +
  15 +/**
  16 + * <B>Description</B> 求购信息 <br />
  17 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  18 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  19 + * <B>Company</B> 地利集团
  20 + *
  21 + * @author ywd
  22 + * @createTime 2014年12月22日 下午6:24:00
  23 + */
  24 +@Component
  25 +public class ShopMarketHandler implements BaseHandler {
  26 +
  27 + @Resource
  28 + private ProductPopService productPopService;
  29 + @Resource
  30 + ConfigRPC configRPC;
  31 +
  32 + @Override
  33 + public void handle(String message) throws Exception {
  34 + try {
  35 + JSONObject node = JSONObject.parseObject(message);
  36 + Long shopId = node.getLong("shopId");
  37 + Long marketId = node.getLong("statisticsMarket");
  38 + update(shopId, marketId);
  39 + } catch (Exception e) {
  40 + LogHelper.error(LogTypeEnum.PRODUCT, e, e.getMessage());
  41 + throw e;
  42 + }
  43 + }
  44 +
  45 + @Transactional
  46 + public void update(Long shopId,Long marketId) throws Exception {
  47 + if(marketId==0){
  48 + productPopService.updateMarket(shopId,marketId,"");
  49 + return;
  50 + }
  51 + PickUpPointResp resp = configRPC.getPickUpInfoById(marketId);
  52 + if(resp==null){
  53 + throw new Exception("市场ID不存在!");
  54 + }
  55 + productPopService.updateMarket(shopId,marketId,resp.getPickName());
  56 + }
  57 +
  58 +}
titan-cache/src/main/java/com/dili/titan/handler/ShopNameHandler.java 0 → 100644
  1 +package com.dili.titan.handler;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.dili.titan.domain.log.LogHelper;
  5 +import com.dili.titan.domain.log.LogTypeEnum;
  6 +import com.dili.titan.service.impl.ProductPopService;
  7 +import org.codehaus.jackson.JsonNode;
  8 +import org.codehaus.jackson.map.DeserializationConfig;
  9 +import org.codehaus.jackson.map.ObjectMapper;
  10 +import org.springframework.stereotype.Component;
  11 +
  12 +import javax.annotation.Resource;
  13 +
  14 +
  15 +/**
  16 + * <B>Description</B> 求购信息 <br />
  17 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  18 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  19 + * <B>Company</B> 地利集团
  20 + * @createTime 2014年12月22日 下午6:24:00
  21 + * @author ywd
  22 + */
  23 +@Component
  24 +public class ShopNameHandler implements BaseHandler {
  25 +
  26 + @Resource(name = "productPopService")
  27 + private ProductPopService productPopService;
  28 +
  29 + @Override
  30 + public void handle(String message) throws Exception {
  31 + try {
  32 + JSONObject node = JSONObject.parseObject(message);
  33 + long shopId = node.getLong("shopId");
  34 + String shopName = node.getString("shopName");
  35 + update(shopId, shopName);
  36 + } catch (Exception e) {
  37 + LogHelper.error(LogTypeEnum.PRODUCT, e, e.getMessage());
  38 + throw e;
  39 + }
  40 + }
  41 +
  42 + public void update(long shopId,String shopName) throws Exception{
  43 + productPopService.updateShopName(shopId, shopName);
  44 + }
  45 +
  46 +}
titan-cache/src/main/java/com/dili/titan/handler/SupplyHandler.java 0 → 100644
  1 +package com.dili.titan.handler;
  2 +
  3 +import com.dili.titan.domain.RedisKeyConstant;
  4 +import com.dili.titan.domain.gq.Supply;
  5 +import com.dili.titan.domain.log.LogHelper;
  6 +import com.dili.titan.domain.log.LogTypeEnum;
  7 +import com.dili.titan.mq.sender.TopicProducer;
  8 +import com.dili.titan.redis.JedisClient;
  9 +import com.dili.titan.service.impl.SupplyService;
  10 +import org.codehaus.jackson.JsonNode;
  11 +import org.codehaus.jackson.map.DeserializationConfig;
  12 +import org.codehaus.jackson.map.ObjectMapper;
  13 +import org.springframework.stereotype.Component;
  14 +
  15 +import javax.annotation.Resource;
  16 +
  17 +
  18 +/**
  19 + * <B>Description</B> 供应信息 <br />
  20 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  21 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  22 + * <B>Company</B> 地利集团
  23 + * @createTime 2014年12月23日 下午4:42:36
  24 + * @author ywd
  25 + */
  26 +@Component
  27 +public class SupplyHandler implements BaseHandler {
  28 +
  29 + private ObjectMapper mapper = new ObjectMapper().configure(
  30 + DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  31 +
  32 + @Resource(name = "supplyService")
  33 + private SupplyService supplyService;
  34 +
  35 + @Resource(name = "jedisClient")
  36 + private JedisClient jedisClient;
  37 +
  38 + @Resource(name = "topicProducer")
  39 + private TopicProducer topicProducer;
  40 +
  41 + @Override
  42 + public void handle(String message) throws Exception {
  43 + try {
  44 + JsonNode node = mapper.readTree(message);
  45 + int operType = node.get("oper").asInt();
  46 + Long pid = node.get("pid").asLong();
  47 + put(pid);
  48 + topicProducer.sendMQSupply(pid,operType);
  49 + } catch (Exception e) {
  50 + LogHelper.error(LogTypeEnum.SUPPLY, e, e.getMessage());
  51 + throw e;
  52 + }
  53 + }
  54 +
  55 + /**
  56 + * this method is 根据供应ID存储供应
  57 + * @createTime 2014年12月22日 下午5:14:24
  58 + * @author ywd
  59 + */
  60 + private void put(Long pid)throws Exception{
  61 + try {
  62 + Supply supply= supplyService.findByKey(pid);
  63 + if(supply == null){
  64 + LogHelper.error(LogTypeEnum.SUPPLY ,
  65 + "can't find Supply by pid={}", pid);
  66 + return;
  67 + }
  68 + String json = mapper.writeValueAsString(supply);
  69 + jedisClient.hput(RedisKeyConstant.SUPPLY,supply.getId().toString(), json,JedisClient.expireTime);
  70 + } catch (Exception e) {
  71 + LogHelper.error(LogTypeEnum.SUPPLY, e,
  72 + "load putSupply error!pid={}", pid);
  73 + throw e;
  74 + }
  75 + }
  76 +}
titan-cache/src/main/java/com/dili/titan/handler/UserHandler.java 0 → 100644
  1 +package com.dili.titan.handler;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.dili.titan.domain.RedisKeyConstant;
  5 +import com.dili.titan.domain.gq.Presale;
  6 +import com.dili.titan.domain.gq.Purchase;
  7 +import com.dili.titan.domain.gq.Supply;
  8 +import com.dili.titan.domain.log.LogHelper;
  9 +import com.dili.titan.domain.log.LogTypeEnum;
  10 +import com.dili.titan.redis.JedisClient;
  11 +import com.dili.titan.service.impl.PresaleService;
  12 +import com.dili.titan.service.impl.ProductPopService;
  13 +import com.dili.titan.service.impl.PurchaseService;
  14 +import com.dili.titan.service.impl.SupplyService;
  15 +import org.apache.commons.collections.CollectionUtils;
  16 +import org.springframework.stereotype.Component;
  17 +import org.springframework.transaction.annotation.Transactional;
  18 +
  19 +import javax.annotation.Resource;
  20 +import java.util.List;
  21 +
  22 +
  23 +/**
  24 + * <B>Description</B> 求购信息 <br />
  25 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  26 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  27 + * <B>Company</B> 地利集团
  28 + *
  29 + * @author ywd
  30 + * @createTime 2014年12月22日 下午6:24:00
  31 + */
  32 +@Component
  33 +public class UserHandler implements BaseHandler {
  34 +
  35 + @Resource
  36 + private ProductPopService productPopService;
  37 +
  38 + @Override
  39 + public void handle(String message) throws Exception {
  40 + try {
  41 + JSONObject node = JSONObject.parseObject(message);
  42 + Long userId = node.getLong("id");
  43 + String userName = node.getString("accountName");
  44 + update(userId, userName);
  45 + } catch (Exception e) {
  46 + LogHelper.error(LogTypeEnum.PRODUCT, e, e.getMessage());
  47 + throw e;
  48 + }
  49 + }
  50 +
  51 + @Transactional
  52 + public void update(Long userId, String userName) throws Exception {
  53 + productPopService.updateUserName(userId,userName);
  54 + }
  55 +
  56 +}
titan-cache/src/main/java/com/dili/titan/handler/UserShopHandler.java 0 → 100644
  1 +package com.dili.titan.handler;
  2 +
  3 +import com.dili.titan.domain.RedisKeyConstant;
  4 +import com.dili.titan.domain.log.LogHelper;
  5 +import com.dili.titan.domain.log.LogTypeEnum;
  6 +import com.dili.titan.mq.sender.TopicProducer;
  7 +import com.dili.titan.redis.JedisClient;
  8 +import com.dili.titan.service.impl.ProductPopService;
  9 +import org.codehaus.jackson.JsonNode;
  10 +import org.codehaus.jackson.map.DeserializationConfig;
  11 +import org.codehaus.jackson.map.ObjectMapper;
  12 +import org.springframework.stereotype.Component;
  13 +
  14 +import javax.annotation.Resource;
  15 +
  16 +import java.util.List;
  17 +
  18 +
  19 +/**
  20 + * <B>Description</B> 求购信息 <br />
  21 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  22 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  23 + * <B>Company</B> 地利集团
  24 + * @createTime 2014年12月22日 下午6:24:00
  25 + * @author ywd
  26 + */
  27 +@Component
  28 +public class UserShopHandler implements BaseHandler {
  29 +
  30 + private ObjectMapper mapper = new ObjectMapper().configure(
  31 + DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  32 +
  33 + @Resource(name = "productPopService")
  34 + private ProductPopService productPopService;
  35 +
  36 + @Resource(name = "topicProducer")
  37 + private TopicProducer topicProducer;
  38 +
  39 + @Resource(name = "jedisClient")
  40 + private JedisClient client;
  41 +
  42 + @Override
  43 + public void handle(String message) throws Exception {
  44 + try {
  45 + JsonNode node = mapper.readTree(message);
  46 + boolean provinceChange = node.get("provinceChange").asBoolean();
  47 + long shopId = node.get("shopId").asLong();
  48 + long cityId = node.get("cityId").asLong();
  49 + update(provinceChange, shopId, cityId);
  50 + } catch (Exception e) {
  51 + LogHelper.error(LogTypeEnum.PRODUCT, e, e.getMessage());
  52 + throw e;
  53 + }
  54 + }
  55 +
  56 + public void update(boolean provinceChange,long shopId,long cityId) throws Exception{
  57 + int result = productPopService.update(shopId, cityId);
  58 + if(result >0){
  59 + List<Long> listPro = productPopService.getProductPopList(shopId);
  60 + for (int i = 0; i < listPro.size(); i++) {
  61 + client.hdel(RedisKeyConstant.PRODUCT_POP, String.valueOf(listPro.get(i)));
  62 + if(provinceChange){
  63 + topicProducer.sendMQProduct(listPro.get(i),1);
  64 + }
  65 + }
  66 + }
  67 + }
  68 +
  69 +}
titan-cache/src/main/java/com/dili/titan/mq/listener/AttributeMessageHandler.java 0 → 100644
  1 +package com.dili.titan.mq.listener;
  2 +
  3 +import com.alibaba.rocketmq.common.message.MessageExt;
  4 +import com.dili.titan.domain.log.LogHelper;
  5 +import com.dili.titan.domain.log.LogTypeEnum;
  6 +import com.dili.titan.handler.AttributeHandler;
  7 +import com.diligrp.util.rocketMQUtil.DiliMQListener;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +import javax.annotation.Resource;
  11 +/**
  12 + * <B>Description</B> 属性消息监听 <br />
  13 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  14 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  15 + * <B>Company</B> 地利集团
  16 + * @createTime 2014年7月24日 下午3:16:34
  17 + * @author yangjianjun
  18 + */
  19 +@Component
  20 +public class AttributeMessageHandler implements DiliMQListener {
  21 + @Resource
  22 + private AttributeHandler attributeHandler;
  23 + private String topic = "Titan_Cache_Attribute";
  24 + private String tags="pnr";
  25 +
  26 + @Override
  27 + public String getTags() {
  28 + return tags;
  29 + }
  30 +
  31 + @Override
  32 + public String getTopic() {
  33 + return topic;
  34 + }
  35 +
  36 + @Override
  37 + public void operate(MessageExt messageExt) {
  38 + if (messageExt == null) {
  39 + LogHelper.warn(LogTypeEnum.ATTRIBUTE,
  40 + "listener AttributeMessageHandler content is null");
  41 + return;
  42 + }
  43 + try {
  44 + byte[] bytesMessage = messageExt.getBody();
  45 + String json = new String(bytesMessage,"UTF-8");
  46 + LogHelper.info(LogTypeEnum.ATTRIBUTE, "listener AttributeMessageHandler context={}", json);
  47 + attributeHandler.handle(json);
  48 + } catch (Exception e) {
  49 + LogHelper.error(LogTypeEnum.ATTRIBUTE, e, "listener AttributeMessageHandler Exception:",
  50 + e.getMessage());
  51 + throw new RuntimeException(e);
  52 + }
  53 + }
  54 +}
titan-cache/src/main/java/com/dili/titan/mq/listener/CategoryMessageHandler.java 0 → 100644
  1 +package com.dili.titan.mq.listener;
  2 +
  3 +import com.alibaba.rocketmq.common.message.MessageExt;
  4 +import com.dili.titan.domain.log.LogHelper;
  5 +import com.dili.titan.domain.log.LogTypeEnum;
  6 +import com.dili.titan.handler.CategoryHandler;
  7 +import com.diligrp.util.rocketMQUtil.DiliMQListener;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +import javax.annotation.Resource;
  11 +
  12 +/**
  13 + * <B>Description</B>类目消息监听 <br />
  14 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  15 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  16 + * <B>Company</B> 地利集团
  17 + * @createTime 2014年7月24日 下午3:15:25
  18 + * @author yangjianjun
  19 + */
  20 +@Component
  21 +public class CategoryMessageHandler implements DiliMQListener {
  22 + @Resource
  23 + private CategoryHandler categoryHandler;
  24 + private String topic = "Titan_Cache_Category";
  25 + private String tags = "pnr";
  26 +
  27 + @Override
  28 + public String getTags() {
  29 + return tags;
  30 + }
  31 +
  32 + @Override
  33 + public String getTopic() {
  34 + return topic;
  35 + }
  36 +
  37 + @Override
  38 + public void operate(MessageExt message) {
  39 + if (message == null) {
  40 + LogHelper.warn(LogTypeEnum.CATEGORY,
  41 + "listener CategoryMessageHandler content is null");
  42 + return;
  43 + }
  44 + try {
  45 + byte[] bytesMessage = message.getBody();
  46 + String json = new String(bytesMessage,"UTF-8");
  47 + LogHelper.info(LogTypeEnum.CATEGORY, "listener CategoryMessageHandler context={}", json);
  48 + categoryHandler.handle(json);
  49 + } catch (Exception e) {
  50 + LogHelper.error(LogTypeEnum.CATEGORY, e, "listener CategoryMessageHandler EXCEPTION!",
  51 + e.getMessage());
  52 + throw new RuntimeException(e);
  53 + }
  54 + }
  55 +
  56 +}
titan-cache/src/main/java/com/dili/titan/mq/listener/CloseShopMessageHandler.java 0 → 100644
  1 +package com.dili.titan.mq.listener;
  2 +
  3 +import com.alibaba.rocketmq.common.message.MessageExt;
  4 +import com.dili.titan.domain.log.LogHelper;
  5 +import com.dili.titan.domain.log.LogTypeEnum;
  6 +import com.dili.titan.handler.CloseShopHandler;
  7 +import com.dili.titan.handler.UserHandler;
  8 +import com.diligrp.util.rocketMQUtil.DiliMQListener;
  9 +import org.springframework.stereotype.Component;
  10 +
  11 +import javax.annotation.Resource;
  12 +
  13 +
  14 +/**
  15 + * <B>Description</B> TODO <br />
  16 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  17 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  18 + * <B>Company</B> 地利集团
  19 + * @createTime 2014年11月25日 上午11:48:14
  20 + * @author ywd
  21 + */
  22 +@Component
  23 +public class CloseShopMessageHandler implements DiliMQListener {
  24 + @Resource
  25 + private CloseShopHandler closeShopHandler;
  26 + private String topic = "user_shop_state";
  27 + private String tags = "change";
  28 +
  29 + @Override
  30 + public String getTags() {
  31 + return tags;
  32 + }
  33 +
  34 + @Override
  35 + public String getTopic() {
  36 + return topic;
  37 + }
  38 +
  39 + @Override
  40 + public void operate(MessageExt message) {
  41 + if (message == null) {
  42 + LogHelper.warn(LogTypeEnum.PRODUCT,
  43 + "listener UserMessageHandler content is null");
  44 + return;
  45 + }
  46 + try {
  47 + byte[] bytesMessage = message.getBody();
  48 + String json = new String(bytesMessage,"UTF-8");
  49 + LogHelper.info(LogTypeEnum.PRODUCT,
  50 + "listener UserMessageHandler context={}", json);
  51 + closeShopHandler.handle(json);
  52 + } catch (Exception e) {
  53 + LogHelper.error(LogTypeEnum.PRODUCT, e,
  54 + "listener UserMessageHandler EXCEPTION!",
  55 + e.getMessage());
  56 + throw new RuntimeException(e);
  57 + }
  58 + }
  59 +}
titan-cache/src/main/java/com/dili/titan/mq/listener/MessageHandler.java 0 → 100644
  1 +package com.dili.titan.mq.listener;
  2 +
  3 +import com.alibaba.rocketmq.common.message.MessageExt;
  4 +import com.dili.titan.domain.log.LogHelper;
  5 +import com.dili.titan.domain.log.LogTypeEnum;
  6 +import com.dili.titan.handler.ProductHandler;
  7 +import com.diligrp.util.rocketMQUtil.DiliMQListener;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +import javax.annotation.Resource;
  11 +
  12 +@Component
  13 +public class MessageHandler implements DiliMQListener {
  14 +
  15 + @Resource
  16 + private ProductHandler productHandler;
  17 + private String topic = "Titan_Cache_Product";
  18 + private String tags = "pnr";
  19 +
  20 + @Override
  21 + public String getTags() {
  22 + return tags;
  23 + }
  24 +
  25 + @Override
  26 + public String getTopic() {
  27 + return topic;
  28 + }
  29 +
  30 + @Override
  31 + public void operate(MessageExt message) {
  32 + if (message == null) {
  33 + LogHelper.warn(LogTypeEnum.PRODUCT,
  34 + "listener MessageHandler content is null");
  35 + return;
  36 + }
  37 + try {
  38 + byte[] bytesMessage = message.getBody();
  39 + String json = new String(bytesMessage,"UTF-8");
  40 + LogHelper.info(LogTypeEnum.PRODUCT,
  41 + "listener MessageHandler context={}", json);
  42 + productHandler.handle(json);
  43 + } catch (Exception e) {
  44 + LogHelper.error(LogTypeEnum.PRODUCT, e,
  45 + "listener MessageHandler EXCEPTION!",
  46 + e.getMessage());
  47 + throw new RuntimeException(e);
  48 + }
  49 + }
  50 +}
titan-cache/src/main/java/com/dili/titan/mq/listener/PresaleMessageHandler.java 0 → 100644
  1 +package com.dili.titan.mq.listener;
  2 +
  3 +import com.alibaba.rocketmq.common.message.MessageExt;
  4 +import com.dili.titan.domain.log.LogHelper;
  5 +import com.dili.titan.domain.log.LogTypeEnum;
  6 +import com.dili.titan.handler.PresaleHandler;
  7 +import com.dili.titan.handler.SupplyHandler;
  8 +import com.diligrp.util.rocketMQUtil.DiliMQListener;
  9 +import org.springframework.stereotype.Component;
  10 +
  11 +import javax.annotation.Resource;
  12 +
  13 +/**
  14 + * <B>Description</B> 供应信息监听器 <br />
  15 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  16 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  17 + * <B>Company</B> 地利集团
  18 + * @createTime 2014年11月25日 上午11:48:14
  19 + * @author ywd
  20 + */
  21 +@Component
  22 +public class PresaleMessageHandler implements DiliMQListener {
  23 + @Resource
  24 + private PresaleHandler presaleHandler;
  25 + private String topic = "Titan_Cache_Presale";
  26 + private String tags = "pnr";
  27 +
  28 + @Override
  29 + public String getTags() {
  30 + return tags;
  31 + }
  32 +
  33 + @Override
  34 + public String getTopic() {
  35 + return topic;
  36 + }
  37 +
  38 + @Override
  39 + public void operate(MessageExt message) {
  40 + if (message == null) {
  41 + LogHelper.warn(LogTypeEnum.SUPPLY,
  42 + "listener PresaleMessageHandler content is null");
  43 + return;
  44 + }
  45 + try {
  46 + byte[] bytesMessage = message.getBody();
  47 + String json = new String(bytesMessage,"UTF-8");
  48 + LogHelper.info(LogTypeEnum.SUPPLY,
  49 + "listener PresaleMessageHandler context={}", json);
  50 + presaleHandler.handle(json);
  51 + } catch (Exception e) {
  52 + LogHelper.error(LogTypeEnum.SUPPLY, e,
  53 + "listener PresaleMessageHandler EXCEPTION!",
  54 + e.getMessage());
  55 + throw new RuntimeException(e);
  56 + }
  57 + }
  58 +}
titan-cache/src/main/java/com/dili/titan/mq/listener/ProductSearchMessageHandler.java 0 → 100644
  1 +package com.dili.titan.mq.listener;
  2 +
  3 +import com.alibaba.rocketmq.common.message.MessageExt;
  4 +import com.dili.titan.domain.log.LogHelper;
  5 +import com.dili.titan.domain.log.LogTypeEnum;
  6 +import com.dili.titan.handler.ProductHandler;
  7 +import com.dili.titan.handler.ProductSearchHandler;
  8 +import com.diligrp.util.rocketMQUtil.DiliMQListener;
  9 +import org.springframework.stereotype.Component;
  10 +
  11 +import javax.annotation.Resource;
  12 +
  13 +@Component
  14 +public class ProductSearchMessageHandler implements DiliMQListener {
  15 +
  16 + @Resource
  17 + private ProductSearchHandler productSearchHandler;
  18 + private String topic = "Titan_Cache_Product_Search_Cate";
  19 + private String tags = "pnr";
  20 +
  21 + @Override
  22 + public String getTags() {
  23 + return tags;
  24 + }
  25 +
  26 + @Override
  27 + public String getTopic() {
  28 + return topic;
  29 + }
  30 +
  31 + @Override
  32 + public void operate(MessageExt message) {
  33 + if (message == null) {
  34 + LogHelper.warn(LogTypeEnum.PRODUCT,
  35 + "listener ProductSearchMessageHandler content is null");
  36 + return;
  37 + }
  38 + try {
  39 + byte[] bytesMessage = message.getBody();
  40 + String json = new String(bytesMessage,"UTF-8");
  41 + LogHelper.info(LogTypeEnum.PRODUCT,
  42 + "listener ProductSearchMessageHandler context={}", json);
  43 + productSearchHandler.handle(json);
  44 + } catch (Exception e) {
  45 + LogHelper.error(LogTypeEnum.PRODUCT, e,
  46 + "listener ProductSearchMessageHandler EXCEPTION!",
  47 + e.getMessage());
  48 + throw new RuntimeException(e);
  49 + }
  50 + }
  51 +}