Commit 8361cd525d27e2f38ccea30b873af82e5bc5fa0f

Authored by Jiang
1 parent 620febd3

重命名配置文件名

dtms-client/src/main/java/com/b2c/dtms/client/DtmsClient.java
1 1 package com.b2c.dtms.client;
2 2  
3   -import org.apache.commons.lang.StringUtils;
4   -
5   -import com.alibaba.fastjson.JSON;
6   -import com.b2c.dtms.client.domain.dto.request.DtmsProduceRequestDto;
7   -import com.b2c.dtms.client.domain.dto.response.DtmsResponseDto;
8   -import com.b2c.dtms.common.http.HttpRequester;
9   -import com.b2c.dtms.common.http.HttpResponse;
  3 +import com.b2c.dtms.client.service.DtmsService;
  4 +import com.b2c.dtms.client.service.DtmsServiceBean;
10 5  
11 6 public class DtmsClient {
12 7  
13   - public static final String DTMS_URL = "http://dtms.zandeapp.com";
  8 + private DtmsService dtmsService;
14 9  
15   - public DtmsResponseDto produceMessage(DtmsProduceRequestDto message) {
16   - HttpResponse httpResponse;
17   - try {
18   - httpResponse = HttpRequester.sendPost(DTMS_URL + "/api/rest/produce", null, JSON.toJSONString(message));
19   - if (httpResponse == null) {
20   - return null;
21   - }
22   - if (httpResponse.getStatusCode() != 200) {
23   - DtmsResponseDto response = new DtmsResponseDto();
24   - response.setMessage(String.format("无法完成请求,响应码%d", httpResponse.getStatusCode()));
25   - return response;
26   - }
27   - if (StringUtils.isBlank(httpResponse.getBody())) {
28   - return null;
29   - }
30   - return JSON.parseObject(httpResponse.getBody(), DtmsResponseDto.class);
31   - } catch (Exception e) {
32   - DtmsResponseDto response = new DtmsResponseDto();
33   - response.setMessage(e.getMessage());
34   - return response;
35   - }
  10 + public DtmsClient(String baseUrl, String token) {
  11 + this.dtmsService = new DtmsServiceBean(baseUrl, token);
  12 + }
36 13  
  14 + public DtmsService getDtmsService() {
  15 + return dtmsService;
37 16 }
  17 +
38 18 }
... ...
dtms-client/src/main/java/com/b2c/dtms/client/service/DtmsService.java 0 → 100644
  1 +package com.b2c.dtms.client.service;
  2 +
  3 +import com.b2c.dtms.client.domain.dto.request.DtmsProduceRequestDto;
  4 +import com.b2c.dtms.client.domain.dto.response.DtmsResponseDto;
  5 +
  6 +public interface DtmsService {
  7 +
  8 + DtmsResponseDto produceMessage(DtmsProduceRequestDto message);
  9 +}
... ...
dtms-client/src/main/java/com/b2c/dtms/client/service/DtmsServiceBean.java 0 → 100644
  1 +package com.b2c.dtms.client.service;
  2 +
  3 +import org.apache.commons.lang.StringUtils;
  4 +
  5 +import com.alibaba.fastjson.JSON;
  6 +import com.b2c.dtms.client.domain.dto.request.DtmsProduceRequestDto;
  7 +import com.b2c.dtms.client.domain.dto.response.DtmsResponseDto;
  8 +import com.b2c.dtms.common.http.HttpRequester;
  9 +import com.b2c.dtms.common.http.HttpResponse;
  10 +
  11 +public class DtmsServiceBean implements DtmsService {
  12 +
  13 + private String baseUrl;
  14 + private String token;
  15 +
  16 + public DtmsServiceBean(String baseUrl, String token) {
  17 + super();
  18 + this.baseUrl = baseUrl;
  19 + this.token = token;
  20 + }
  21 +
  22 + @Override
  23 + public DtmsResponseDto produceMessage(DtmsProduceRequestDto message) {
  24 + HttpResponse httpResponse;
  25 + try {
  26 + httpResponse = HttpRequester.sendPost(this.baseUrl + "/api/rest/produce", null, JSON.toJSONString(message));
  27 + if (httpResponse == null) {
  28 + return null;
  29 + }
  30 + if (httpResponse.getStatusCode() != 200) {
  31 + DtmsResponseDto response = new DtmsResponseDto();
  32 + response.setMessage(String.format("无法完成请求,响应码%d", httpResponse.getStatusCode()));
  33 + return response;
  34 + }
  35 + if (StringUtils.isBlank(httpResponse.getBody())) {
  36 + return null;
  37 + }
  38 + return JSON.parseObject(httpResponse.getBody(), DtmsResponseDto.class);
  39 + } catch (Exception e) {
  40 + DtmsResponseDto response = new DtmsResponseDto();
  41 + response.setMessage(e.getMessage());
  42 + return response;
  43 + }
  44 + }
  45 +
  46 +}
... ...
dtms-client/src/test/java/com/b2c/dtms/client/DtmsClientTestCase.java deleted 100644 → 0
1   -package com.b2c.dtms.client;
2   -
3   -import org.junit.Test;
4   -
5   -import com.b2c.dtms.client.domain.dto.request.DtmsProduceRequestDto;
6   -import com.b2c.dtms.client.domain.dto.response.DtmsResponseDto;
7   -import com.b2c.dtms.common.enums.dtms.DtmsMessageType;
8   -
9   -public class DtmsClientTestCase {
10   -
11   - @Test
12   - public void test() {
13   - DtmsClient client = new DtmsClient();
14   - DtmsProduceRequestDto message = new DtmsProduceRequestDto();
15   - message.setBizId("123456");
16   - message.setCallUrl("http://orders.zandeapp.com");
17   - message.setContent("abcdefg");
18   - message.setDelaySeconds(10);
19   - message.setType(DtmsMessageType.Timer.code());
20   - DtmsResponseDto response = client.produceMessage(message);
21   - System.out.println(response);
22   - }
23   -
24   -}
dtms-dao/src/main/resources/spring-config-dao.xml renamed to dtms-dao/src/main/resources/spring-dao.xml
dtms-dao/src/main/resources/sqlmap-config.xml
... ... @@ -11,12 +11,12 @@
11 11 <setting name="useColumnLabel" value="true" />
12 12 <!-- 数据库超过25000秒仍未响应则超时 -->
13 13 <setting name="defaultStatementTimeout" value="25000" />
14   - <setting name="logImpl" value="STDOUT_LOGGING" />
  14 + <!-- <setting name="logImpl" value="STDOUT_LOGGING" /> -->
15 15 </settings>
16 16  
17 17 <!-- 全局别名设置,在映射文件中只需写别名,而不必写出整个类路径 -->
18 18 <typeAliases>
19   - <typeAlias type="com.b2c.dtms.domain.OrderMaxid" alias="orderMaxid" />
  19 + <typeAlias type="com.b2c.dtms.domain.Maxid" alias="Maxid" />
20 20 <typeAlias type="com.b2c.dtms.domain.DtmsMessage" alias="dtmsMessage" />
21 21 <typeAlias type="com.b2c.dtms.domain.DtmsMessageException"
22 22 alias="dtmsMessageException" />
... ... @@ -33,7 +33,7 @@
33 33  
34 34 <!-- 映射文件路径 -->
35 35 <mappers>
36   - <mapper resource="sqlmap/OrderMaxid.xml" />
  36 + <mapper resource="sqlmap/Maxid.xml" />
37 37 <mapper resource="sqlmap/dtms/DtmsMessage.xml" />
38 38 <mapper resource="sqlmap/dtms/DtmsMessageException.xml" />
39 39 <mapper resource="sqlmap/dtms/DtmsMessageConfig.xml" />
... ...
dtms-dao/src/main/resources/sqlmap/OrderMaxid.xml renamed to dtms-dao/src/main/resources/sqlmap/Maxid.xml
1 1 <?xml version="1.0" encoding="UTF-8" ?>
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
3 3 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
4   -<mapper namespace="com.b2c.dtms.dao.OrderMaxidDao">
  4 +<mapper namespace="com.b2c.dtms.dao.MaxidDao">
5 5  
6 6 <!-- order_maxid 所有查询列 -->
7 7 <sql id="QUERY_COLUMN_LIST">
... ... @@ -54,7 +54,7 @@
54 54 </sql>
55 55  
56 56 <!-- 插入order_maxid记录 -->
57   - <insert id="insertEntry" parameterType="orderMaxid" >
  57 + <insert id="insertEntry" parameterType="Maxid" >
58 58 <![CDATA[
59 59 INSERT INTO order_maxid (id,id_type,id_value,memo,version_num)
60 60 VALUES (#{id},#{idType},#{idValue},#{memo},#{versionNum})
... ... @@ -73,20 +73,20 @@
73 73 </delete>
74 74  
75 75 <!-- 删除,通过条件 -->
76   - <update id="deleteByCondtion" parameterType="orderMaxid" >
  76 + <update id="deleteByCondtion" parameterType="Maxid" >
77 77 <![CDATA[DELETE FROM order_maxid]]>
78 78 <include refid="QUERY_WHERE_CLAUSE"/>
79 79 </update>
80 80  
81 81 <!-- 修改记录通过主键 -->
82   - <update id="updateByKey" parameterType="orderMaxid" >
  82 + <update id="updateByKey" parameterType="Maxid" >
83 83 <![CDATA[UPDATE order_maxid]]>
84 84 <include refid="UPDATE_COLUMN_SET"/>
85 85 <![CDATA[WHERE id = #{id} AND version_num = #{versionNum}]]>
86 86 </update>
87 87  
88 88 <!-- 查询,通过主键IN(array) -->
89   - <select id="selectEntryArray" parameterType="java.lang.reflect.Array" resultType="orderMaxid">
  89 + <select id="selectEntryArray" parameterType="java.lang.reflect.Array" resultType="Maxid">
90 90 <![CDATA[SELECT]]>
91 91 <include refid="QUERY_COLUMN_LIST"/>
92 92 <include refid="QUERY_FROM_TABLE"/>
... ... @@ -97,7 +97,7 @@
97 97 </select>
98 98  
99 99 <!-- 查询,通过条件 -->
100   - <select id="selectEntryList" parameterType="orderMaxid" resultType="orderMaxid">
  100 + <select id="selectEntryList" parameterType="Maxid" resultType="Maxid">
101 101 <![CDATA[SELECT]]>
102 102 <include refid="QUERY_COLUMN_LIST"/>
103 103 <include refid="QUERY_FROM_TABLE"/>
... ... @@ -106,7 +106,7 @@
106 106 </select>
107 107  
108 108 <!-- 总数查询,通过条件 -->
109   - <select id="selectEntryListCount" parameterType="orderMaxid" resultType="int">
  109 + <select id="selectEntryListCount" parameterType="Maxid" resultType="int">
110 110 <![CDATA[SELECT COUNT(id) AS dataCount]]>
111 111 <include refid="QUERY_FROM_TABLE"/>
112 112 <include refid="QUERY_WHERE_CLAUSE"/>
... ...
dtms-web/pom.xml
... ... @@ -168,4 +168,5 @@
168 168 <version>1.6.1</version>
169 169 </dependency>
170 170 </dependencies>
  171 +
171 172 </project>
172 173 \ No newline at end of file
... ...
dtms-web/src/main/resources/conf/orders-production.properties renamed to dtms-web/src/main/resources/conf/config.properties
dtms-web/src/main/resources/conf/important.properties renamed to dtms-web/src/main/resources/conf/jdbc.properties
dtms-web/src/main/resources/spring-config-dtms.xml renamed to dtms-web/src/main/resources/spring-dtms.xml
dtms-web/src/main/resources/spring-config-servlet.xml renamed to dtms-web/src/main/resources/spring-mvc.xml
dtms-web/src/main/resources/spring-config.xml renamed to dtms-web/src/main/resources/spring.xml
... ... @@ -25,8 +25,8 @@
25 25 <property name="ignoreResourceNotFound" value="true" />
26 26 <property name="locations">
27 27 <list>
28   - <value>classpath:conf/important.properties</value>
29   - <value>classpath:conf/orders-production.properties</value>
  28 + <value>classpath:conf/jdbc.properties</value>
  29 + <value>classpath:conf/config.properties</value>
30 30 <value>classpath:conf/manage.properties</value>
31 31 </list>
32 32 </property>
... ... @@ -53,8 +53,8 @@
53 53 <property name="cacheSeconds" value="60" />
54 54 </bean>
55 55  
56   - <import resource="classpath*:spring-config-service.xml" />
57   - <import resource="classpath*:spring-config-dao.xml" />
  56 + <import resource="classpath*:spring-service.xml" />
  57 + <import resource="classpath*:spring-dao.xml" />
58 58 <import resource="classpath*:spring-redis.xml" />
59   - <import resource="classpath*:spring-config-dtms.xml" />
  59 + <import resource="classpath*:spring-dtms.xml" />
60 60 </beans>
61 61 \ No newline at end of file
... ...
dtms-web/src/main/webapp/WEB-INF/web.xml
... ... @@ -7,7 +7,7 @@
7 7  
8 8 <context-param>
9 9 <param-name>contextConfigLocation</param-name>
10   - <param-value>classpath:spring-config.xml</param-value>
  10 + <param-value>classpath:spring.xml</param-value>
11 11 </context-param>
12 12 <listener>
13 13 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
... ... @@ -21,7 +21,7 @@
21 21 <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
22 22 <init-param>
23 23 <param-name>contextConfigLocation</param-name>
24   - <param-value>classpath:spring-config-servlet.xml</param-value>
  24 + <param-value>classpath:spring-mvc.xml</param-value>
25 25 </init-param>
26 26 <load-on-startup>1</load-on-startup>
27 27 </servlet>
... ...
... ... @@ -27,25 +27,25 @@
27 27 <pnr-shop-develop.version>0.0.1-SNAPSHOT</pnr-shop-develop.version>
28 28 <pnr-shop-product.version>0.0.1-SNAPSHOT</pnr-shop-product.version>
29 29 <lombox.version>1.16.10</lombox.version>
30   - <orders.cache.main.key>1n4j_orders:data</orders.cache.main.key>
  30 + <orders.cache.main.key>zandeapp_dtms:data</orders.cache.main.key>
31 31 <!--订单获系统缓存开关 -->
32 32 <orders.cache.enabled>true</orders.cache.enabled>
33 33 <!--统一管理平台配置 -->
34 34 <conf.manage.enable>true</conf.manage.enable>
35 35 <conf.manage.spider>true</conf.manage.spider>
36   - <conf.manage.system>orders</conf.manage.system>
37   - <conf.manage.domain>http://manage.1n4j.com/</conf.manage.domain>
  36 + <conf.manage.system>dtms</conf.manage.system>
  37 + <conf.manage.domain>http://manage.zandeapp.com/</conf.manage.domain>
38 38 <!--系统url并未以.do结尾,因此需要使用如下方式的正则表达式 -->
39 39 <conf.manage.includes>^/.*</conf.manage.includes>
40 40 <!--打包编码 -->
41 41 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
42   - <orders.contextPath>http://dtms.1n4j.com</orders.contextPath>
  42 + <orders.contextPath>http://dtms.zandeapp.com</orders.contextPath>
43 43 <!--权限拦截器在处理导出文件时会出错,导致文件打不开,比如Excel,因此对于导出,跳过拦截 -->
44 44 <conf.manage.excludes>^/noAccess.do$,^/welcome.do$,^/loginControl/.*,^/api/.*,^/cleanCache$,^/assets/.*,^/orderSelf/export/.*,^/monitor,^/druid/*,^/orderPrint/export/*</conf.manage.excludes>
45 45 <!-- 域名信息 -->
46   - <conf.domain.name>1n4j.com</conf.domain.name>
  46 + <conf.domain.name>zandeapp.com</conf.domain.name>
47 47 <!-- 静态资源地址 -->
48   - <project.static.path>http://static.1n4j.com/static</project.static.path>
  48 + <project.static.path>http://static.zandeapp.com/static</project.static.path>
49 49 <!-- 订单请求和响应参数 -->
50 50 <orders.paramLog.enabled>true</orders.paramLog.enabled>
51 51 </properties>
... ... @@ -63,11 +63,6 @@
63 63 <artifactId>commons-lang3</artifactId>
64 64 <version>3.5</version>
65 65 </dependency>
66   - <dependency>
67   - <groupId>com.yqyw</groupId>
68   - <artifactId>orders-client</artifactId>
69   - <version>${orders.client.sdk.version}</version>
70   - </dependency>
71 66 <!-- 需求中心SDK -->
72 67 <dependency>
73 68 <groupId>com.diligrp</groupId>
... ... @@ -91,7 +86,7 @@
91 86 <version>${user.client.devlop.version}</version> </dependency> -->
92 87 <!-- 数据字典 -->
93 88 <dependency>
94   - <groupId>com.yqyw.website.web</groupId>
  89 + <groupId>com.b2c.website.web</groupId>
95 90 <artifactId>diligrp-website-api</artifactId>
96 91 <version>1.0.3-SNAPSHOT</version>
97 92 <exclusions>
... ... @@ -102,9 +97,9 @@
102 97 </exclusions>
103 98 </dependency>
104 99 <dependency>
105   - <groupId>com.diligrp.website</groupId>
  100 + <groupId>com.b2c.website</groupId>
106 101 <artifactId>diligrp-website-util</artifactId>
107   - <version>0.0.1-SNAPSHOT</version>
  102 + <version>0.0.2-SNAPSHOT</version>
108 103 <exclusions>
109 104 <exclusion>
110 105 <groupId>velocity</groupId>
... ... @@ -118,7 +113,7 @@
118 113 </dependency>
119 114 <!--后台user -->
120 115 <dependency>
121   - <groupId>com.yqyw.manage</groupId>
  116 + <groupId>com.b2c.manage</groupId>
122 117 <artifactId>diligrp-manage-sdk</artifactId>
123 118 <version>0.0.3-SNAPSHOT</version>
124 119 <exclusions>
... ... @@ -410,14 +405,14 @@
410 405 <properties>
411 406 <!-- 数据库 -->
412 407 <orders.jdbc.driver>com.mysql.jdbc.Driver</orders.jdbc.driver>
413   - <orders.jdbc.url>jdbc:mysql://127.0.0.1:3306/dtms?characterEncoding=UTF-8</orders.jdbc.url>
  408 + <orders.jdbc.url>jdbc:mysql://10.28.11.162:3306/dtms?characterEncoding=UTF-8</orders.jdbc.url>
414 409 <orders.jdbc.username>root</orders.jdbc.username>
415 410 <orders.jdbc.password>123456</orders.jdbc.password>
416 411 <!-- 日志 -->
417 412 <orders.log.level>INFO</orders.log.level>
418 413 <orders.log.dtms.level>INFO</orders.log.dtms.level>
419 414 <!--redis -->
420   - <project.redis.host1>10.28.10.208</project.redis.host1>
  415 + <project.redis.host1>10.28.11.205</project.redis.host1>
421 416 <project.redis.port1>6379</project.redis.port1>
422 417 <!--订单系统短信通知开关 -->
423 418 <orders.sms.enabled>true</orders.sms.enabled>
... ... @@ -427,7 +422,7 @@
427 422 <!-- 店铺接口签名 -->
428 423 <orders.rpc.shopClient.sign>FzZGZxd2VycXdlYXNzZHZzdnp4Y3Z</orders.rpc.shopClient.sign>
429 424 <!-- 消息中心配置 -->
430   - <mq.namesrvAddr>10.28.10.209:9876;10.28.10.149:9876</mq.namesrvAddr>
  425 + <mq.namesrvAddr>10.28.11.158:9876</mq.namesrvAddr>
431 426 <mq.producerGroup>orders</mq.producerGroup>
432 427 </properties>
433 428 </profile>
... ... @@ -467,10 +462,11 @@
467 462 <version>2.2</version>
468 463 <configuration>
469 464 <path>/</path>
470   - <port>80</port>
  465 + <port>8080</port>
471 466 <uriEncoding>UTF-8</uriEncoding>
472   - <server>order_dev_server</server>
473   - <url>http://10.28.10.182/manager</url>
  467 + <username>admin</username>
  468 + <password>123456</password>
  469 + <url>http://10.28.11.197:8080/manager/text</url>
474 470 </configuration>
475 471 </plugin>
476 472 <plugin>
... ...