Showing
90 changed files
with
3298 additions
and
433 deletions
| 1 | -echo '###############################自动打包,打包后的文件生成在../../server目录下####################################' | 1 | +echo '###############################自动打包,打包后的文件生成在../../package目录下####################################' |
| 2 | #环境 | 2 | #环境 |
| 3 | -profile='prod' | 3 | +profile=$1 |
| 4 | echo '######## 打包环境: '${profile} | 4 | echo '######## 打包环境: '${profile} |
| 5 | -#maven打包版本 | ||
| 6 | echo '######## maven打包版本: '${sVersion} | 5 | echo '######## maven打包版本: '${sVersion} |
| 7 | 6 | ||
| 8 | -sh ./init.sh | 7 | +echo init start! |
| 9 | - | 8 | +cd ../../ |
| 10 | -cd ../../server | ||
| 11 | base_dir=`pwd` | 9 | base_dir=`pwd` |
| 10 | +pName='package' | ||
| 11 | +server='server' | ||
| 12 | 12 | ||
| 13 | -rm -f $base_dir/*.war | 13 | +mkdir $base_dir/${pName} |
| 14 | -echo '######## 删除所有war包' | 14 | +rm -f $base_dir/${pName}/*.war |
| 15 | +echo '######## 清除历史war包' | ||
| 15 | 16 | ||
| 16 | -moduleName='bus-customer' | 17 | +cd $base_dir/${server}/common-dao |
| 17 | -version='1.2.9' | 18 | +mvn clean install -Dmaven.test.skip=true |
| 18 | -echo '######## 打包模块: '${moduleName} | ||
| 19 | -cd $base_dir/${moduleName} | ||
| 20 | -mvn clean install -Dmaven.test.skip=true -P$profile | ||
| 21 | -oriName=exp-${moduleName}-${version}_${profile}.war.original | ||
| 22 | -tarName=exp-${moduleName}-${version}_${profile}.war | ||
| 23 | -cp target/${oriName} $base_dir && mv $base_dir/${oriName} $base_dir/${tarName} | ||
| 24 | -echo '######## 打包完成目录: '$base_dir/${tarName} | ||
| 25 | 19 | ||
| 26 | -moduleName='bus-employees' | 20 | +cd $base_dir/${server}/common-dependencies |
| 27 | -version='1.2.9' | 21 | +mvn clean install -Dmaven.test.skip=true |
| 28 | -echo '######## 打包模块: '${moduleName} | ||
| 29 | -cd $base_dir/${moduleName} | ||
| 30 | -mvn clean install -Dmaven.test.skip=true -P$profile | ||
| 31 | -oriName=exp-${moduleName}-${version}_${profile}.war.original | ||
| 32 | -tarName=exp-${moduleName}-${version}_${profile}.war | ||
| 33 | -cp target/${oriName} $base_dir && mv $base_dir/${oriName} $base_dir/${tarName} | ||
| 34 | -echo '######## 打包完成目录: '$base_dir/${tarName} | ||
| 35 | 22 | ||
| 36 | -moduleName='kafka-cndc-output' | 23 | +moduleName='kafka-cndc-server' |
| 37 | -version='1.2.9' | 24 | +sVersion='1.0.0' |
| 25 | +version='1.0.0' | ||
| 38 | echo '######## 打包模块: '${moduleName} | 26 | echo '######## 打包模块: '${moduleName} |
| 39 | -cd $base_dir/${moduleName} | 27 | +cd $base_dir/${server}/${moduleName} |
| 40 | mvn clean install -Dmaven.test.skip=true -P$profile | 28 | mvn clean install -Dmaven.test.skip=true -P$profile |
| 41 | -oriName=exp-${moduleName}-${version}_${profile}.war.original | 29 | +oriName=${moduleName}-${sVersion}_${profile}.war.original |
| 42 | -tarName=exp-${moduleName}-${version}_${profile}.war | 30 | +tarName=${moduleName}-${version}_${profile}.war |
| 43 | -cp target/${oriName} $base_dir && mv $base_dir/${oriName} $base_dir/${tarName} | 31 | +cp target/${oriName} $base_dir && mv $base_dir/${oriName} $base_dir/${pName}/${tarName} |
| 44 | -echo '######## 打包完成目录: '$base_dir/${tarName} | 32 | +echo '######## 打包完成目录: '$base_dir/${pName}/${tarName} |
| 45 | 33 | ||
| 46 | -moduleName='manager-server' | 34 | +moduleName='biz-customer' |
| 47 | -version='1.2.9' | 35 | +sVersion='1.0.0' |
| 36 | +version='1.0.0' | ||
| 48 | echo '######## 打包模块: '${moduleName} | 37 | echo '######## 打包模块: '${moduleName} |
| 49 | -cd $base_dir/${moduleName} | 38 | +cd $base_dir/${server}/${moduleName} |
| 50 | mvn clean install -Dmaven.test.skip=true -P$profile | 39 | mvn clean install -Dmaven.test.skip=true -P$profile |
| 51 | -oriName=exp-${moduleName}-${version}_${profile}.war.original | 40 | +oriName=${moduleName}-${sVersion}_${profile}.war.original |
| 52 | -tarName=exp-${moduleName}-${version}_${profile}.war | 41 | +tarName=${moduleName}-${version}_${profile}.war |
| 53 | -cp target/${oriName} $base_dir && mv $base_dir/${oriName} $base_dir/${tarName} | 42 | +cp target/${oriName} $base_dir && mv $base_dir/${oriName} $base_dir/${pName}/${tarName} |
| 54 | -echo '######## 打包完成目录: '$base_dir/${tarName} | 43 | +echo '######## 打包完成目录: '$base_dir/${pName}/${tarName} |
| 55 | 44 | ||
| 56 | -moduleName='openapi-server' | 45 | +moduleName='manager-server' |
| 57 | -version='1.2.9' | 46 | +sVersion='1.0.0' |
| 58 | -echo '######## 打包模块: '${moduleName} | 47 | +version='1.0.0' |
| 59 | -cd $base_dir/${moduleName} | ||
| 60 | -mvn clean install -Dmaven.test.skip=true -P$profile | ||
| 61 | -oriName=exp-${moduleName}-${version}_${profile}.war.original | ||
| 62 | -tarName=exp-${moduleName}-${version}_${profile}.war | ||
| 63 | -cp target/${oriName} $base_dir && mv $base_dir/${oriName} $base_dir/${tarName} | ||
| 64 | -echo '######## 打包完成目录: '$base_dir/${tarName} | ||
| 65 | - | ||
| 66 | -moduleName='task-schedule' | ||
| 67 | -version='1.2.9' | ||
| 68 | echo '######## 打包模块: '${moduleName} | 48 | echo '######## 打包模块: '${moduleName} |
| 69 | -cd $base_dir/${moduleName} | 49 | +cd $base_dir/${server}/${moduleName} |
| 70 | mvn clean install -Dmaven.test.skip=true -P$profile | 50 | mvn clean install -Dmaven.test.skip=true -P$profile |
| 71 | -oriName=exp-${moduleName}-${version}_${profile}.war.original | 51 | +oriName=${moduleName}-${sVersion}_${profile}.war.original |
| 72 | -tarName=exp-${moduleName}-${version}_${profile}.war | 52 | +tarName=${moduleName}-${version}_${profile}.war |
| 73 | -cp target/${oriName} $base_dir && mv $base_dir/${oriName} $base_dir/${tarName} | 53 | +cp target/${oriName} $base_dir && mv $base_dir/${oriName} $base_dir/${pName}/${tarName} |
| 74 | -echo '######## 打包完成目录: '$base_dir/${tarName} | 54 | +echo '######## 打包完成目录: '$base_dir/${pName}/${tarName} |
| 75 | 55 | ||
| 76 | -moduleName='config-center' | 56 | +moduleName='manager-server' |
| 77 | -version='1.2.9' | 57 | +sVersion='1.0.0' |
| 58 | +version='1.0.0' | ||
| 78 | echo '######## 打包模块: '${moduleName} | 59 | echo '######## 打包模块: '${moduleName} |
| 79 | -cd $base_dir/${moduleName} | 60 | +cd $base_dir/${server}/${moduleName} |
| 80 | mvn clean install -Dmaven.test.skip=true -P$profile | 61 | mvn clean install -Dmaven.test.skip=true -P$profile |
| 81 | -oriName=exp-${moduleName}-${version}_${profile}.war.original | 62 | +oriName=${moduleName}-${sVersion}_${profile}.war.original |
| 82 | -tarName=exp-${moduleName}-${version}_${profile}.war | 63 | +tarName=${moduleName}-${version}_${profile}.war |
| 83 | -cp target/${oriName} $base_dir && mv $base_dir/${oriName} $base_dir/${tarName} | 64 | +cp target/${oriName} $base_dir && mv $base_dir/${oriName} $base_dir/${pName}/${tarName} |
| 84 | -echo '######## 打包完成目录: '$base_dir/${tarName} | 65 | +echo '######## 打包完成目录: '$base_dir/${pName}/${tarName} |
| 85 | 66 | ||
| 86 | -echo install finished! | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 67 | +echo install finished! | ... | ... |
| ... | @@ -239,12 +239,6 @@ | ... | @@ -239,12 +239,6 @@ |
| 239 | <version>2.9.2</version> | 239 | <version>2.9.2</version> |
| 240 | </dependency> | 240 | </dependency> |
| 241 | <dependency> | 241 | <dependency> |
| 242 | - <groupId>org.mybatis.generator</groupId> | ||
| 243 | - <artifactId>mybatis-generator-core</artifactId> | ||
| 244 | - <version>1.3.3</version> | ||
| 245 | - <scope>provided</scope> | ||
| 246 | - </dependency> | ||
| 247 | - <dependency> | ||
| 248 | <groupId>com.oracle.database.jdbc</groupId> | 242 | <groupId>com.oracle.database.jdbc</groupId> |
| 249 | <artifactId>ojdbc8</artifactId> | 243 | <artifactId>ojdbc8</artifactId> |
| 250 | <version>12.2.0.1</version> | 244 | <version>12.2.0.1</version> | ... | ... |
| ... | @@ -35,11 +35,15 @@ | ... | @@ -35,11 +35,15 @@ |
| 35 | </dependency> | 35 | </dependency> |
| 36 | <dependency> | 36 | <dependency> |
| 37 | <groupId>com.fedex.connect</groupId> | 37 | <groupId>com.fedex.connect</groupId> |
| 38 | + <artifactId>common-dependencies</artifactId> | ||
| 39 | + <version>1.0.0</version> | ||
| 40 | + </dependency> | ||
| 41 | + <dependency> | ||
| 42 | + <groupId>com.fedex.connect</groupId> | ||
| 38 | <artifactId>base-starter</artifactId> | 43 | <artifactId>base-starter</artifactId> |
| 39 | <version>1.0.0</version> | 44 | <version>1.0.0</version> |
| 40 | <scope>${install.scope}</scope> | 45 | <scope>${install.scope}</scope> |
| 41 | </dependency> | 46 | </dependency> |
| 42 | - | ||
| 43 | <dependency> | 47 | <dependency> |
| 44 | <groupId>org.springframework.boot</groupId> | 48 | <groupId>org.springframework.boot</groupId> |
| 45 | <artifactId>spring-boot-starter-web</artifactId> | 49 | <artifactId>spring-boot-starter-web</artifactId> | ... | ... |
| 1 | server: | 1 | server: |
| 2 | - port: 8086 | 2 | + port: 8081 |
| 3 | servlet: | 3 | servlet: |
| 4 | context-path: /biz-customer | 4 | context-path: /biz-customer |
| 5 | session: | 5 | session: |
| ... | @@ -22,8 +22,7 @@ spring: | ... | @@ -22,8 +22,7 @@ spring: |
| 22 | 22 | ||
| 23 | mybatis: | 23 | mybatis: |
| 24 | mapper-locations: | 24 | mapper-locations: |
| 25 | - - classpath*:com/fedex/export/**/mapper/*.xml | 25 | + - classpath*:com/fedex/connect/**/mapper/**/*.xml |
| 26 | - - classpath*:com/fedex/export/**/mapper/log/*.xml | ||
| 27 | configuration: | 26 | configuration: |
| 28 | #开启驼峰与下划线转换 | 27 | #开启驼峰与下划线转换 |
| 29 | map-underscore-to-camel-case: true | 28 | map-underscore-to-camel-case: true | ... | ... |
| ... | @@ -2,11 +2,11 @@ | ... | @@ -2,11 +2,11 @@ |
| 2 | <configuration> | 2 | <configuration> |
| 3 | <springProfile name="dev,uat,prod"> | 3 | <springProfile name="dev,uat,prod"> |
| 4 | <!-- 日志存放路径 --> | 4 | <!-- 日志存放路径 --> |
| 5 | - <property name="log.path" value="/var/fedex/iclearconnect/weblogic/iclearconnect/export-tw-server" /> | 5 | + <property name="log.path" value="/var/fedex/iclearConnect/weblogic/iclearConnect/biz-customer" /> |
| 6 | </springProfile> | 6 | </springProfile> |
| 7 | <springProfile name="test"> | 7 | <springProfile name="test"> |
| 8 | <!-- 日志存放路径 --> | 8 | <!-- 日志存放路径 --> |
| 9 | - <property name="log.path" value="/app/Oracle/Middleware/user_projects/domains/base_domain/iclearconnect/export-tw-server"></property> | 9 | + <property name="log.path" value="/app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/biz-customer"></property> |
| 10 | </springProfile> | 10 | </springProfile> |
| 11 | <!-- 日志输出格式 --> | 11 | <!-- 日志输出格式 --> |
| 12 | <property name="log.pattern" | 12 | <property name="log.pattern" |
| ... | @@ -109,10 +109,16 @@ | ... | @@ -109,10 +109,16 @@ |
| 109 | <root level="info"> | 109 | <root level="info"> |
| 110 | <appender-ref ref="console"></appender-ref> | 110 | <appender-ref ref="console"></appender-ref> |
| 111 | </root> | 111 | </root> |
| 112 | - <logger name="com.fedex.export.repository.dao" level="debug"> | 112 | + <logger name="com.fedex.connect.common.dao" level="debug"> |
| 113 | <appender-ref ref="file_debug"></appender-ref> | 113 | <appender-ref ref="file_debug"></appender-ref> |
| 114 | </logger> | 114 | </logger> |
| 115 | - <logger name="com.fedex.export.repository.mapper" level="debug"> | 115 | + <logger name="com.fedex.connect.common.mapper" level="debug"> |
| 116 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 117 | + </logger> | ||
| 118 | + <logger name="com.fedex.connect.customer.repository.dao" level="debug"> | ||
| 119 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 120 | + </logger> | ||
| 121 | + <logger name="com.fedex.connect.customer.repository.mapper" level="debug"> | ||
| 116 | <appender-ref ref="file_debug"></appender-ref> | 122 | <appender-ref ref="file_debug"></appender-ref> |
| 117 | </logger> | 123 | </logger> |
| 118 | </springProfile> | 124 | </springProfile> |
| ... | @@ -121,10 +127,16 @@ | ... | @@ -121,10 +127,16 @@ |
| 121 | <appender-ref ref="file_info"></appender-ref> | 127 | <appender-ref ref="file_info"></appender-ref> |
| 122 | <appender-ref ref="file_error"></appender-ref> | 128 | <appender-ref ref="file_error"></appender-ref> |
| 123 | </root> | 129 | </root> |
| 124 | - <logger name="com.fedex.export.repository.dao" level="debug"> | 130 | + <logger name="com.fedex.connect.common.dao" level="debug"> |
| 131 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 132 | + </logger> | ||
| 133 | + <logger name="com.fedex.connect.common.mapper" level="debug"> | ||
| 134 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 135 | + </logger> | ||
| 136 | + <logger name="com.fedex.connect.customer.repository.dao" level="debug"> | ||
| 125 | <appender-ref ref="file_debug"></appender-ref> | 137 | <appender-ref ref="file_debug"></appender-ref> |
| 126 | </logger> | 138 | </logger> |
| 127 | - <logger name="com.fedex.export.repository.mapper" level="debug"> | 139 | + <logger name="com.fedex.connect.customer.repository.mapper" level="debug"> |
| 128 | <appender-ref ref="file_debug"></appender-ref> | 140 | <appender-ref ref="file_debug"></appender-ref> |
| 129 | </logger> | 141 | </logger> |
| 130 | </springProfile> | 142 | </springProfile> | ... | ... |
| ... | @@ -20,9 +20,16 @@ | ... | @@ -20,9 +20,16 @@ |
| 20 | <version>1.0.0</version> | 20 | <version>1.0.0</version> |
| 21 | </dependency> | 21 | </dependency> |
| 22 | <dependency> | 22 | <dependency> |
| 23 | + <groupId>org.mybatis.generator</groupId> | ||
| 24 | + <artifactId>mybatis-generator-core</artifactId> | ||
| 25 | + <version>1.3.3</version> | ||
| 26 | + <scope>provided</scope> | ||
| 27 | + </dependency> | ||
| 28 | + <dependency> | ||
| 23 | <groupId>com.erry</groupId> | 29 | <groupId>com.erry</groupId> |
| 24 | <artifactId>imac-common</artifactId> | 30 | <artifactId>imac-common</artifactId> |
| 25 | <version>0.0.1</version> | 31 | <version>0.0.1</version> |
| 32 | + <scope>provided</scope> | ||
| 26 | </dependency> | 33 | </dependency> |
| 27 | </dependencies> | 34 | </dependencies> |
| 28 | 35 | ... | ... |
server/common-dao/src/main/java/com/fedex/connect/common/dao/bi/package-info.java
deleted
100644 → 0
| 1 | -package com.fedex.connect.common.dao.bi; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | -package com.fedex.connect.common.dao; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -2,9 +2,8 @@ package com.fedex.connect.common.dao.sys; | ... | @@ -2,9 +2,8 @@ package com.fedex.connect.common.dao.sys; |
| 2 | 2 | ||
| 3 | import com.fedex.connect.common.model.sys.KafkaStorageHistory; | 3 | import com.fedex.connect.common.model.sys.KafkaStorageHistory; |
| 4 | import com.fedex.connect.common.model.sys.KafkaStorageHistoryExample; | 4 | import com.fedex.connect.common.model.sys.KafkaStorageHistoryExample; |
| 5 | -import org.apache.ibatis.annotations.Param; | ||
| 6 | - | ||
| 7 | import java.util.List; | 5 | import java.util.List; |
| 6 | +import org.apache.ibatis.annotations.Param; | ||
| 8 | 7 | ||
| 9 | public interface KafkaStorageHistoryMapper { | 8 | public interface KafkaStorageHistoryMapper { |
| 10 | long countByExample(KafkaStorageHistoryExample example); | 9 | long countByExample(KafkaStorageHistoryExample example); | ... | ... |
server/common-dao/src/main/java/com/fedex/connect/common/mapper/bi/package-info.java
deleted
100644 → 0
| 1 | -package com.fedex.connect.common.mapper.bi; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/common-dao/src/main/java/com/fedex/connect/common/mapper/package-info.java
deleted
100644 → 0
| 1 | -package com.fedex.connect.common.mapper; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed. Click to expand it.
| ... | @@ -10,7 +10,7 @@ | ... | @@ -10,7 +10,7 @@ |
| 10 | <result column="SEND_TIME" jdbcType="TIMESTAMP" property="sendTime" /> | 10 | <result column="SEND_TIME" jdbcType="TIMESTAMP" property="sendTime" /> |
| 11 | <result column="CONSIGNMENT_CODE" jdbcType="VARCHAR" property="consignmentCode" /> | 11 | <result column="CONSIGNMENT_CODE" jdbcType="VARCHAR" property="consignmentCode" /> |
| 12 | <result column="FREQUENCY" jdbcType="NUMERIC" property="frequency" /> | 12 | <result column="FREQUENCY" jdbcType="NUMERIC" property="frequency" /> |
| 13 | - <result column="STATUS_ID" jdbcType="NUMERIC" property="statusId" /> | 13 | + <result column="STATUS" jdbcType="NUMERIC" property="status" /> |
| 14 | <result column="STATUS_NAME" jdbcType="VARCHAR" property="statusName" /> | 14 | <result column="STATUS_NAME" jdbcType="VARCHAR" property="statusName" /> |
| 15 | <result column="REMARK" jdbcType="VARCHAR" property="remark" /> | 15 | <result column="REMARK" jdbcType="VARCHAR" property="remark" /> |
| 16 | <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" /> | 16 | <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" /> |
| ... | @@ -83,7 +83,7 @@ | ... | @@ -83,7 +83,7 @@ |
| 83 | </sql> | 83 | </sql> |
| 84 | <sql id="Base_Column_List"> | 84 | <sql id="Base_Column_List"> |
| 85 | ID, MESSAGE_ID, MESSAGE_CODE, SENDER_ID, RECEIVER_ID, SEND_TIME, CONSIGNMENT_CODE, | 85 | ID, MESSAGE_ID, MESSAGE_CODE, SENDER_ID, RECEIVER_ID, SEND_TIME, CONSIGNMENT_CODE, |
| 86 | - FREQUENCY, STATUS_ID, STATUS_NAME, REMARK, CREATE_TIME, CREATE_USER_ID, CREATE_USER_NAME, | 86 | + FREQUENCY, STATUS, STATUS_NAME, REMARK, CREATE_TIME, CREATE_USER_ID, CREATE_USER_NAME, |
| 87 | MODIFY_TIME, MODIFY_USER_ID, MODIFY_USER_NAME | 87 | MODIFY_TIME, MODIFY_USER_ID, MODIFY_USER_NAME |
| 88 | </sql> | 88 | </sql> |
| 89 | <sql id="Blob_Column_List"> | 89 | <sql id="Blob_Column_List"> |
| ... | @@ -98,7 +98,7 @@ | ... | @@ -98,7 +98,7 @@ |
| 98 | <include refid="Base_Column_List" /> | 98 | <include refid="Base_Column_List" /> |
| 99 | , | 99 | , |
| 100 | <include refid="Blob_Column_List" /> | 100 | <include refid="Blob_Column_List" /> |
| 101 | - from T_SYS_KAFKA_STORAGE_HISTORY | 101 | + from T_SYS_KAFKA_TEMPORARY_STORAGE |
| 102 | <if test="_parameter != null"> | 102 | <if test="_parameter != null"> |
| 103 | <include refid="Example_Where_Clause" /> | 103 | <include refid="Example_Where_Clause" /> |
| 104 | </if> | 104 | </if> |
| ... | @@ -114,7 +114,7 @@ | ... | @@ -114,7 +114,7 @@ |
| 114 | </if> | 114 | </if> |
| 115 | 'true' as QUERYID, | 115 | 'true' as QUERYID, |
| 116 | <include refid="Base_Column_List" /> | 116 | <include refid="Base_Column_List" /> |
| 117 | - from T_SYS_KAFKA_STORAGE_HISTORY | 117 | + from T_SYS_KAFKA_TEMPORARY_STORAGE |
| 118 | <if test="_parameter != null"> | 118 | <if test="_parameter != null"> |
| 119 | <include refid="Example_Where_Clause" /> | 119 | <include refid="Example_Where_Clause" /> |
| 120 | </if> | 120 | </if> |
| ... | @@ -128,33 +128,33 @@ | ... | @@ -128,33 +128,33 @@ |
| 128 | <include refid="Base_Column_List" /> | 128 | <include refid="Base_Column_List" /> |
| 129 | , | 129 | , |
| 130 | <include refid="Blob_Column_List" /> | 130 | <include refid="Blob_Column_List" /> |
| 131 | - from T_SYS_KAFKA_STORAGE_HISTORY | 131 | + from T_SYS_KAFKA_TEMPORARY_STORAGE |
| 132 | where ID = #{id,jdbcType=NUMERIC} | 132 | where ID = #{id,jdbcType=NUMERIC} |
| 133 | </select> | 133 | </select> |
| 134 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> | 134 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| 135 | - delete from T_SYS_KAFKA_STORAGE_HISTORY | 135 | + delete from T_SYS_KAFKA_TEMPORARY_STORAGE |
| 136 | where ID = #{id,jdbcType=NUMERIC} | 136 | where ID = #{id,jdbcType=NUMERIC} |
| 137 | </delete> | 137 | </delete> |
| 138 | <delete id="deleteByExample" parameterType="com.fedex.connect.common.model.sys.KafkaTemporaryStorageExample"> | 138 | <delete id="deleteByExample" parameterType="com.fedex.connect.common.model.sys.KafkaTemporaryStorageExample"> |
| 139 | - delete from T_SYS_KAFKA_STORAGE_HISTORY | 139 | + delete from T_SYS_KAFKA_TEMPORARY_STORAGE |
| 140 | <if test="_parameter != null"> | 140 | <if test="_parameter != null"> |
| 141 | <include refid="Example_Where_Clause" /> | 141 | <include refid="Example_Where_Clause" /> |
| 142 | </if> | 142 | </if> |
| 143 | </delete> | 143 | </delete> |
| 144 | <insert id="insert" parameterType="com.fedex.connect.common.model.sys.KafkaTemporaryStorage"> | 144 | <insert id="insert" parameterType="com.fedex.connect.common.model.sys.KafkaTemporaryStorage"> |
| 145 | <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long"> | 145 | <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long"> |
| 146 | - SELECT SEQ_T_SYS_KAFKA_STORAGE_HISTORY.NEXTVAL FROM DUAL | 146 | + SELECT SEQ_T_SYS_KAFKA_TEMPORARY_STORAGE.NEXTVAL FROM DUAL |
| 147 | </selectKey> | 147 | </selectKey> |
| 148 | - insert into T_SYS_KAFKA_STORAGE_HISTORY (ID, MESSAGE_ID, MESSAGE_CODE, | 148 | + insert into T_SYS_KAFKA_TEMPORARY_STORAGE (ID, MESSAGE_ID, MESSAGE_CODE, |
| 149 | SENDER_ID, RECEIVER_ID, SEND_TIME, | 149 | SENDER_ID, RECEIVER_ID, SEND_TIME, |
| 150 | - CONSIGNMENT_CODE, FREQUENCY, STATUS_ID, | 150 | + CONSIGNMENT_CODE, FREQUENCY, STATUS, |
| 151 | STATUS_NAME, REMARK, CREATE_TIME, | 151 | STATUS_NAME, REMARK, CREATE_TIME, |
| 152 | CREATE_USER_ID, CREATE_USER_NAME, MODIFY_TIME, | 152 | CREATE_USER_ID, CREATE_USER_NAME, MODIFY_TIME, |
| 153 | MODIFY_USER_ID, MODIFY_USER_NAME, DATA | 153 | MODIFY_USER_ID, MODIFY_USER_NAME, DATA |
| 154 | ) | 154 | ) |
| 155 | values (#{id,jdbcType=NUMERIC}, #{messageId,jdbcType=VARCHAR}, #{messageCode,jdbcType=VARCHAR}, | 155 | values (#{id,jdbcType=NUMERIC}, #{messageId,jdbcType=VARCHAR}, #{messageCode,jdbcType=VARCHAR}, |
| 156 | #{senderId,jdbcType=VARCHAR}, #{receiverId,jdbcType=VARCHAR}, #{sendTime,jdbcType=TIMESTAMP}, | 156 | #{senderId,jdbcType=VARCHAR}, #{receiverId,jdbcType=VARCHAR}, #{sendTime,jdbcType=TIMESTAMP}, |
| 157 | - #{consignmentCode,jdbcType=VARCHAR}, #{frequency,jdbcType=NUMERIC}, #{statusId,jdbcType=NUMERIC}, | 157 | + #{consignmentCode,jdbcType=VARCHAR}, #{frequency,jdbcType=NUMERIC}, #{status,jdbcType=NUMERIC}, |
| 158 | #{statusName,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, | 158 | #{statusName,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, |
| 159 | #{createUserId,jdbcType=NUMERIC}, #{createUserName,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP}, | 159 | #{createUserId,jdbcType=NUMERIC}, #{createUserName,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP}, |
| 160 | #{modifyUserId,jdbcType=NUMERIC}, #{modifyUserName,jdbcType=VARCHAR}, #{data,jdbcType=CLOB} | 160 | #{modifyUserId,jdbcType=NUMERIC}, #{modifyUserName,jdbcType=VARCHAR}, #{data,jdbcType=CLOB} |
| ... | @@ -162,9 +162,9 @@ | ... | @@ -162,9 +162,9 @@ |
| 162 | </insert> | 162 | </insert> |
| 163 | <insert id="insertSelective" parameterType="com.fedex.connect.common.model.sys.KafkaTemporaryStorage"> | 163 | <insert id="insertSelective" parameterType="com.fedex.connect.common.model.sys.KafkaTemporaryStorage"> |
| 164 | <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long"> | 164 | <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long"> |
| 165 | - SELECT SEQ_T_SYS_KAFKA_STORAGE_HISTORY.NEXTVAL FROM DUAL | 165 | + SELECT SEQ_T_SYS_KAFKA_TEMPORARY_STORAGE.NEXTVAL FROM DUAL |
| 166 | </selectKey> | 166 | </selectKey> |
| 167 | - insert into T_SYS_KAFKA_STORAGE_HISTORY | 167 | + insert into T_SYS_KAFKA_TEMPORARY_STORAGE |
| 168 | <trim prefix="(" suffix=")" suffixOverrides=","> | 168 | <trim prefix="(" suffix=")" suffixOverrides=","> |
| 169 | ID, | 169 | ID, |
| 170 | <if test="messageId != null"> | 170 | <if test="messageId != null"> |
| ... | @@ -188,8 +188,8 @@ | ... | @@ -188,8 +188,8 @@ |
| 188 | <if test="frequency != null"> | 188 | <if test="frequency != null"> |
| 189 | FREQUENCY, | 189 | FREQUENCY, |
| 190 | </if> | 190 | </if> |
| 191 | - <if test="statusId != null"> | 191 | + <if test="status != null"> |
| 192 | - STATUS_ID, | 192 | + STATUS, |
| 193 | </if> | 193 | </if> |
| 194 | <if test="statusName != null"> | 194 | <if test="statusName != null"> |
| 195 | STATUS_NAME, | 195 | STATUS_NAME, |
| ... | @@ -242,8 +242,8 @@ | ... | @@ -242,8 +242,8 @@ |
| 242 | <if test="frequency != null"> | 242 | <if test="frequency != null"> |
| 243 | #{frequency,jdbcType=NUMERIC}, | 243 | #{frequency,jdbcType=NUMERIC}, |
| 244 | </if> | 244 | </if> |
| 245 | - <if test="statusId != null"> | 245 | + <if test="status != null"> |
| 246 | - #{statusId,jdbcType=NUMERIC}, | 246 | + #{status,jdbcType=NUMERIC}, |
| 247 | </if> | 247 | </if> |
| 248 | <if test="statusName != null"> | 248 | <if test="statusName != null"> |
| 249 | #{statusName,jdbcType=VARCHAR}, | 249 | #{statusName,jdbcType=VARCHAR}, |
| ... | @@ -275,13 +275,13 @@ | ... | @@ -275,13 +275,13 @@ |
| 275 | </trim> | 275 | </trim> |
| 276 | </insert> | 276 | </insert> |
| 277 | <select id="countByExample" parameterType="com.fedex.connect.common.model.sys.KafkaTemporaryStorageExample" resultType="java.lang.Long"> | 277 | <select id="countByExample" parameterType="com.fedex.connect.common.model.sys.KafkaTemporaryStorageExample" resultType="java.lang.Long"> |
| 278 | - select count(*) from T_SYS_KAFKA_STORAGE_HISTORY | 278 | + select count(*) from T_SYS_KAFKA_TEMPORARY_STORAGE |
| 279 | <if test="_parameter != null"> | 279 | <if test="_parameter != null"> |
| 280 | <include refid="Example_Where_Clause" /> | 280 | <include refid="Example_Where_Clause" /> |
| 281 | </if> | 281 | </if> |
| 282 | </select> | 282 | </select> |
| 283 | <update id="updateByExampleSelective" parameterType="map"> | 283 | <update id="updateByExampleSelective" parameterType="map"> |
| 284 | - update T_SYS_KAFKA_STORAGE_HISTORY | 284 | + update T_SYS_KAFKA_TEMPORARY_STORAGE |
| 285 | <set> | 285 | <set> |
| 286 | <if test="record.id != null"> | 286 | <if test="record.id != null"> |
| 287 | ID = #{record.id,jdbcType=NUMERIC}, | 287 | ID = #{record.id,jdbcType=NUMERIC}, |
| ... | @@ -307,8 +307,8 @@ | ... | @@ -307,8 +307,8 @@ |
| 307 | <if test="record.frequency != null"> | 307 | <if test="record.frequency != null"> |
| 308 | FREQUENCY = #{record.frequency,jdbcType=NUMERIC}, | 308 | FREQUENCY = #{record.frequency,jdbcType=NUMERIC}, |
| 309 | </if> | 309 | </if> |
| 310 | - <if test="record.statusId != null"> | 310 | + <if test="record.status != null"> |
| 311 | - STATUS_ID = #{record.statusId,jdbcType=NUMERIC}, | 311 | + STATUS = #{record.status,jdbcType=NUMERIC}, |
| 312 | </if> | 312 | </if> |
| 313 | <if test="record.statusName != null"> | 313 | <if test="record.statusName != null"> |
| 314 | STATUS_NAME = #{record.statusName,jdbcType=VARCHAR}, | 314 | STATUS_NAME = #{record.statusName,jdbcType=VARCHAR}, |
| ... | @@ -343,7 +343,7 @@ | ... | @@ -343,7 +343,7 @@ |
| 343 | </if> | 343 | </if> |
| 344 | </update> | 344 | </update> |
| 345 | <update id="updateByExampleWithBLOBs" parameterType="map"> | 345 | <update id="updateByExampleWithBLOBs" parameterType="map"> |
| 346 | - update T_SYS_KAFKA_STORAGE_HISTORY | 346 | + update T_SYS_KAFKA_TEMPORARY_STORAGE |
| 347 | set ID = #{record.id,jdbcType=NUMERIC}, | 347 | set ID = #{record.id,jdbcType=NUMERIC}, |
| 348 | MESSAGE_ID = #{record.messageId,jdbcType=VARCHAR}, | 348 | MESSAGE_ID = #{record.messageId,jdbcType=VARCHAR}, |
| 349 | MESSAGE_CODE = #{record.messageCode,jdbcType=VARCHAR}, | 349 | MESSAGE_CODE = #{record.messageCode,jdbcType=VARCHAR}, |
| ... | @@ -352,7 +352,7 @@ | ... | @@ -352,7 +352,7 @@ |
| 352 | SEND_TIME = #{record.sendTime,jdbcType=TIMESTAMP}, | 352 | SEND_TIME = #{record.sendTime,jdbcType=TIMESTAMP}, |
| 353 | CONSIGNMENT_CODE = #{record.consignmentCode,jdbcType=VARCHAR}, | 353 | CONSIGNMENT_CODE = #{record.consignmentCode,jdbcType=VARCHAR}, |
| 354 | FREQUENCY = #{record.frequency,jdbcType=NUMERIC}, | 354 | FREQUENCY = #{record.frequency,jdbcType=NUMERIC}, |
| 355 | - STATUS_ID = #{record.statusId,jdbcType=NUMERIC}, | 355 | + STATUS = #{record.status,jdbcType=NUMERIC}, |
| 356 | STATUS_NAME = #{record.statusName,jdbcType=VARCHAR}, | 356 | STATUS_NAME = #{record.statusName,jdbcType=VARCHAR}, |
| 357 | REMARK = #{record.remark,jdbcType=VARCHAR}, | 357 | REMARK = #{record.remark,jdbcType=VARCHAR}, |
| 358 | CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP}, | 358 | CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP}, |
| ... | @@ -367,7 +367,7 @@ | ... | @@ -367,7 +367,7 @@ |
| 367 | </if> | 367 | </if> |
| 368 | </update> | 368 | </update> |
| 369 | <update id="updateByExample" parameterType="map"> | 369 | <update id="updateByExample" parameterType="map"> |
| 370 | - update T_SYS_KAFKA_STORAGE_HISTORY | 370 | + update T_SYS_KAFKA_TEMPORARY_STORAGE |
| 371 | set ID = #{record.id,jdbcType=NUMERIC}, | 371 | set ID = #{record.id,jdbcType=NUMERIC}, |
| 372 | MESSAGE_ID = #{record.messageId,jdbcType=VARCHAR}, | 372 | MESSAGE_ID = #{record.messageId,jdbcType=VARCHAR}, |
| 373 | MESSAGE_CODE = #{record.messageCode,jdbcType=VARCHAR}, | 373 | MESSAGE_CODE = #{record.messageCode,jdbcType=VARCHAR}, |
| ... | @@ -376,7 +376,7 @@ | ... | @@ -376,7 +376,7 @@ |
| 376 | SEND_TIME = #{record.sendTime,jdbcType=TIMESTAMP}, | 376 | SEND_TIME = #{record.sendTime,jdbcType=TIMESTAMP}, |
| 377 | CONSIGNMENT_CODE = #{record.consignmentCode,jdbcType=VARCHAR}, | 377 | CONSIGNMENT_CODE = #{record.consignmentCode,jdbcType=VARCHAR}, |
| 378 | FREQUENCY = #{record.frequency,jdbcType=NUMERIC}, | 378 | FREQUENCY = #{record.frequency,jdbcType=NUMERIC}, |
| 379 | - STATUS_ID = #{record.statusId,jdbcType=NUMERIC}, | 379 | + STATUS = #{record.status,jdbcType=NUMERIC}, |
| 380 | STATUS_NAME = #{record.statusName,jdbcType=VARCHAR}, | 380 | STATUS_NAME = #{record.statusName,jdbcType=VARCHAR}, |
| 381 | REMARK = #{record.remark,jdbcType=VARCHAR}, | 381 | REMARK = #{record.remark,jdbcType=VARCHAR}, |
| 382 | CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP}, | 382 | CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP}, |
| ... | @@ -390,7 +390,7 @@ | ... | @@ -390,7 +390,7 @@ |
| 390 | </if> | 390 | </if> |
| 391 | </update> | 391 | </update> |
| 392 | <update id="updateByPrimaryKeySelective" parameterType="com.fedex.connect.common.model.sys.KafkaTemporaryStorage"> | 392 | <update id="updateByPrimaryKeySelective" parameterType="com.fedex.connect.common.model.sys.KafkaTemporaryStorage"> |
| 393 | - update T_SYS_KAFKA_STORAGE_HISTORY | 393 | + update T_SYS_KAFKA_TEMPORARY_STORAGE |
| 394 | <set> | 394 | <set> |
| 395 | <if test="messageId != null"> | 395 | <if test="messageId != null"> |
| 396 | MESSAGE_ID = #{messageId,jdbcType=VARCHAR}, | 396 | MESSAGE_ID = #{messageId,jdbcType=VARCHAR}, |
| ... | @@ -413,8 +413,8 @@ | ... | @@ -413,8 +413,8 @@ |
| 413 | <if test="frequency != null"> | 413 | <if test="frequency != null"> |
| 414 | FREQUENCY = #{frequency,jdbcType=NUMERIC}, | 414 | FREQUENCY = #{frequency,jdbcType=NUMERIC}, |
| 415 | </if> | 415 | </if> |
| 416 | - <if test="statusId != null"> | 416 | + <if test="status != null"> |
| 417 | - STATUS_ID = #{statusId,jdbcType=NUMERIC}, | 417 | + STATUS = #{status,jdbcType=NUMERIC}, |
| 418 | </if> | 418 | </if> |
| 419 | <if test="statusName != null"> | 419 | <if test="statusName != null"> |
| 420 | STATUS_NAME = #{statusName,jdbcType=VARCHAR}, | 420 | STATUS_NAME = #{statusName,jdbcType=VARCHAR}, |
| ... | @@ -447,7 +447,7 @@ | ... | @@ -447,7 +447,7 @@ |
| 447 | where ID = #{id,jdbcType=NUMERIC} | 447 | where ID = #{id,jdbcType=NUMERIC} |
| 448 | </update> | 448 | </update> |
| 449 | <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.fedex.connect.common.model.sys.KafkaTemporaryStorage"> | 449 | <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.fedex.connect.common.model.sys.KafkaTemporaryStorage"> |
| 450 | - update T_SYS_KAFKA_STORAGE_HISTORY | 450 | + update T_SYS_KAFKA_TEMPORARY_STORAGE |
| 451 | set MESSAGE_ID = #{messageId,jdbcType=VARCHAR}, | 451 | set MESSAGE_ID = #{messageId,jdbcType=VARCHAR}, |
| 452 | MESSAGE_CODE = #{messageCode,jdbcType=VARCHAR}, | 452 | MESSAGE_CODE = #{messageCode,jdbcType=VARCHAR}, |
| 453 | SENDER_ID = #{senderId,jdbcType=VARCHAR}, | 453 | SENDER_ID = #{senderId,jdbcType=VARCHAR}, |
| ... | @@ -455,7 +455,7 @@ | ... | @@ -455,7 +455,7 @@ |
| 455 | SEND_TIME = #{sendTime,jdbcType=TIMESTAMP}, | 455 | SEND_TIME = #{sendTime,jdbcType=TIMESTAMP}, |
| 456 | CONSIGNMENT_CODE = #{consignmentCode,jdbcType=VARCHAR}, | 456 | CONSIGNMENT_CODE = #{consignmentCode,jdbcType=VARCHAR}, |
| 457 | FREQUENCY = #{frequency,jdbcType=NUMERIC}, | 457 | FREQUENCY = #{frequency,jdbcType=NUMERIC}, |
| 458 | - STATUS_ID = #{statusId,jdbcType=NUMERIC}, | 458 | + STATUS = #{status,jdbcType=NUMERIC}, |
| 459 | STATUS_NAME = #{statusName,jdbcType=VARCHAR}, | 459 | STATUS_NAME = #{statusName,jdbcType=VARCHAR}, |
| 460 | REMARK = #{remark,jdbcType=VARCHAR}, | 460 | REMARK = #{remark,jdbcType=VARCHAR}, |
| 461 | CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}, | 461 | CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}, |
| ... | @@ -468,7 +468,7 @@ | ... | @@ -468,7 +468,7 @@ |
| 468 | where ID = #{id,jdbcType=NUMERIC} | 468 | where ID = #{id,jdbcType=NUMERIC} |
| 469 | </update> | 469 | </update> |
| 470 | <update id="updateByPrimaryKey" parameterType="com.fedex.connect.common.model.sys.KafkaTemporaryStorage"> | 470 | <update id="updateByPrimaryKey" parameterType="com.fedex.connect.common.model.sys.KafkaTemporaryStorage"> |
| 471 | - update T_SYS_KAFKA_STORAGE_HISTORY | 471 | + update T_SYS_KAFKA_TEMPORARY_STORAGE |
| 472 | set MESSAGE_ID = #{messageId,jdbcType=VARCHAR}, | 472 | set MESSAGE_ID = #{messageId,jdbcType=VARCHAR}, |
| 473 | MESSAGE_CODE = #{messageCode,jdbcType=VARCHAR}, | 473 | MESSAGE_CODE = #{messageCode,jdbcType=VARCHAR}, |
| 474 | SENDER_ID = #{senderId,jdbcType=VARCHAR}, | 474 | SENDER_ID = #{senderId,jdbcType=VARCHAR}, |
| ... | @@ -476,7 +476,7 @@ | ... | @@ -476,7 +476,7 @@ |
| 476 | SEND_TIME = #{sendTime,jdbcType=TIMESTAMP}, | 476 | SEND_TIME = #{sendTime,jdbcType=TIMESTAMP}, |
| 477 | CONSIGNMENT_CODE = #{consignmentCode,jdbcType=VARCHAR}, | 477 | CONSIGNMENT_CODE = #{consignmentCode,jdbcType=VARCHAR}, |
| 478 | FREQUENCY = #{frequency,jdbcType=NUMERIC}, | 478 | FREQUENCY = #{frequency,jdbcType=NUMERIC}, |
| 479 | - STATUS_ID = #{statusId,jdbcType=NUMERIC}, | 479 | + STATUS = #{status,jdbcType=NUMERIC}, |
| 480 | STATUS_NAME = #{statusName,jdbcType=VARCHAR}, | 480 | STATUS_NAME = #{statusName,jdbcType=VARCHAR}, |
| 481 | REMARK = #{remark,jdbcType=VARCHAR}, | 481 | REMARK = #{remark,jdbcType=VARCHAR}, |
| 482 | CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}, | 482 | CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}, | ... | ... |
| 1 | -package com.fedex.connect.common.model; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -4,8 +4,8 @@ import java.io.Serializable; | ... | @@ -4,8 +4,8 @@ import java.io.Serializable; |
| 4 | import java.util.Date; | 4 | import java.util.Date; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | - * DESC: KAFKA临时表 | 7 | + * DESC: KAFKA数据历史表 |
| 8 | - * TABLE: T_SYS_KAFKA_TEMPORARY_STORAGE | 8 | + * TABLE: T_SYS_KAFKA_STORAGE_HISTORY |
| 9 | */ | 9 | */ |
| 10 | public class KafkaStorageHistory implements Serializable { | 10 | public class KafkaStorageHistory implements Serializable { |
| 11 | /** | 11 | /** |
| ... | @@ -49,12 +49,12 @@ public class KafkaStorageHistory implements Serializable { | ... | @@ -49,12 +49,12 @@ public class KafkaStorageHistory implements Serializable { |
| 49 | private Long frequency; | 49 | private Long frequency; |
| 50 | 50 | ||
| 51 | /** | 51 | /** |
| 52 | - * KAFKA消息状态ID,关联数据字典表。指定字典目录CODE:KAFKA_MSG_STATUS | 52 | + * KAFKA消息数据状态(0:待处理,1:已处理,2:处理失败) |
| 53 | */ | 53 | */ |
| 54 | - private Long statusId; | 54 | + private Long status; |
| 55 | 55 | ||
| 56 | /** | 56 | /** |
| 57 | - * KAFKA消息状态NAME | 57 | + * KAFKA消息数据状态NAME,(0:待处理,1:已处理,2:处理失败) |
| 58 | */ | 58 | */ |
| 59 | private String statusName; | 59 | private String statusName; |
| 60 | 60 | ||
| ... | @@ -164,12 +164,12 @@ public class KafkaStorageHistory implements Serializable { | ... | @@ -164,12 +164,12 @@ public class KafkaStorageHistory implements Serializable { |
| 164 | this.frequency = frequency; | 164 | this.frequency = frequency; |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | - public Long getStatusId() { | 167 | + public Long getStatus() { |
| 168 | - return statusId; | 168 | + return status; |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | - public void setStatusId(Long statusId) { | 171 | + public void setStatus(Long status) { |
| 172 | - this.statusId = statusId; | 172 | + this.status = status; |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | public String getStatusName() { | 175 | public String getStatusName() { |
| ... | @@ -258,7 +258,7 @@ public class KafkaStorageHistory implements Serializable { | ... | @@ -258,7 +258,7 @@ public class KafkaStorageHistory implements Serializable { |
| 258 | sb.append(", sendTime=").append(sendTime); | 258 | sb.append(", sendTime=").append(sendTime); |
| 259 | sb.append(", consignmentCode=").append(consignmentCode); | 259 | sb.append(", consignmentCode=").append(consignmentCode); |
| 260 | sb.append(", frequency=").append(frequency); | 260 | sb.append(", frequency=").append(frequency); |
| 261 | - sb.append(", statusId=").append(statusId); | 261 | + sb.append(", status=").append(status); |
| 262 | sb.append(", statusName=").append(statusName); | 262 | sb.append(", statusName=").append(statusName); |
| 263 | sb.append(", remark=").append(remark); | 263 | sb.append(", remark=").append(remark); |
| 264 | sb.append(", createTime=").append(createTime); | 264 | sb.append(", createTime=").append(createTime); | ... | ... |
| ... | @@ -655,63 +655,63 @@ public class KafkaStorageHistoryExample { | ... | @@ -655,63 +655,63 @@ public class KafkaStorageHistoryExample { |
| 655 | return (Criteria) this; | 655 | return (Criteria) this; |
| 656 | } | 656 | } |
| 657 | 657 | ||
| 658 | - public Criteria andStatusIdIsNull() { | 658 | + public Criteria andStatusIsNull() { |
| 659 | - addCriterion("STATUS_ID is null"); | 659 | + addCriterion("STATUS is null"); |
| 660 | return (Criteria) this; | 660 | return (Criteria) this; |
| 661 | } | 661 | } |
| 662 | 662 | ||
| 663 | - public Criteria andStatusIdIsNotNull() { | 663 | + public Criteria andStatusIsNotNull() { |
| 664 | - addCriterion("STATUS_ID is not null"); | 664 | + addCriterion("STATUS is not null"); |
| 665 | return (Criteria) this; | 665 | return (Criteria) this; |
| 666 | } | 666 | } |
| 667 | 667 | ||
| 668 | - public Criteria andStatusIdEqualTo(Long value) { | 668 | + public Criteria andStatusEqualTo(Long value) { |
| 669 | - addCriterion("STATUS_ID =", value, "statusId"); | 669 | + addCriterion("STATUS =", value, "status"); |
| 670 | return (Criteria) this; | 670 | return (Criteria) this; |
| 671 | } | 671 | } |
| 672 | 672 | ||
| 673 | - public Criteria andStatusIdNotEqualTo(Long value) { | 673 | + public Criteria andStatusNotEqualTo(Long value) { |
| 674 | - addCriterion("STATUS_ID <>", value, "statusId"); | 674 | + addCriterion("STATUS <>", value, "status"); |
| 675 | return (Criteria) this; | 675 | return (Criteria) this; |
| 676 | } | 676 | } |
| 677 | 677 | ||
| 678 | - public Criteria andStatusIdGreaterThan(Long value) { | 678 | + public Criteria andStatusGreaterThan(Long value) { |
| 679 | - addCriterion("STATUS_ID >", value, "statusId"); | 679 | + addCriterion("STATUS >", value, "status"); |
| 680 | return (Criteria) this; | 680 | return (Criteria) this; |
| 681 | } | 681 | } |
| 682 | 682 | ||
| 683 | - public Criteria andStatusIdGreaterThanOrEqualTo(Long value) { | 683 | + public Criteria andStatusGreaterThanOrEqualTo(Long value) { |
| 684 | - addCriterion("STATUS_ID >=", value, "statusId"); | 684 | + addCriterion("STATUS >=", value, "status"); |
| 685 | return (Criteria) this; | 685 | return (Criteria) this; |
| 686 | } | 686 | } |
| 687 | 687 | ||
| 688 | - public Criteria andStatusIdLessThan(Long value) { | 688 | + public Criteria andStatusLessThan(Long value) { |
| 689 | - addCriterion("STATUS_ID <", value, "statusId"); | 689 | + addCriterion("STATUS <", value, "status"); |
| 690 | return (Criteria) this; | 690 | return (Criteria) this; |
| 691 | } | 691 | } |
| 692 | 692 | ||
| 693 | - public Criteria andStatusIdLessThanOrEqualTo(Long value) { | 693 | + public Criteria andStatusLessThanOrEqualTo(Long value) { |
| 694 | - addCriterion("STATUS_ID <=", value, "statusId"); | 694 | + addCriterion("STATUS <=", value, "status"); |
| 695 | return (Criteria) this; | 695 | return (Criteria) this; |
| 696 | } | 696 | } |
| 697 | 697 | ||
| 698 | - public Criteria andStatusIdIn(List<Long> values) { | 698 | + public Criteria andStatusIn(List<Long> values) { |
| 699 | - addCriterion("STATUS_ID in", values, "statusId"); | 699 | + addCriterion("STATUS in", values, "status"); |
| 700 | return (Criteria) this; | 700 | return (Criteria) this; |
| 701 | } | 701 | } |
| 702 | 702 | ||
| 703 | - public Criteria andStatusIdNotIn(List<Long> values) { | 703 | + public Criteria andStatusNotIn(List<Long> values) { |
| 704 | - addCriterion("STATUS_ID not in", values, "statusId"); | 704 | + addCriterion("STATUS not in", values, "status"); |
| 705 | return (Criteria) this; | 705 | return (Criteria) this; |
| 706 | } | 706 | } |
| 707 | 707 | ||
| 708 | - public Criteria andStatusIdBetween(Long value1, Long value2) { | 708 | + public Criteria andStatusBetween(Long value1, Long value2) { |
| 709 | - addCriterion("STATUS_ID between", value1, value2, "statusId"); | 709 | + addCriterion("STATUS between", value1, value2, "status"); |
| 710 | return (Criteria) this; | 710 | return (Criteria) this; |
| 711 | } | 711 | } |
| 712 | 712 | ||
| 713 | - public Criteria andStatusIdNotBetween(Long value1, Long value2) { | 713 | + public Criteria andStatusNotBetween(Long value1, Long value2) { |
| 714 | - addCriterion("STATUS_ID not between", value1, value2, "statusId"); | 714 | + addCriterion("STATUS not between", value1, value2, "status"); |
| 715 | return (Criteria) this; | 715 | return (Criteria) this; |
| 716 | } | 716 | } |
| 717 | 717 | ... | ... |
| ... | @@ -4,8 +4,8 @@ import java.io.Serializable; | ... | @@ -4,8 +4,8 @@ import java.io.Serializable; |
| 4 | import java.util.Date; | 4 | import java.util.Date; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | - * DESC: KAFKA数据历史表 | 7 | + * DESC: KAFKA临时表 |
| 8 | - * TABLE: T_SYS_KAFKA_STORAGE_HISTORY | 8 | + * TABLE: T_SYS_KAFKA_TEMPORARY_STORAGE |
| 9 | */ | 9 | */ |
| 10 | public class KafkaTemporaryStorage implements Serializable { | 10 | public class KafkaTemporaryStorage implements Serializable { |
| 11 | /** | 11 | /** |
| ... | @@ -49,12 +49,12 @@ public class KafkaTemporaryStorage implements Serializable { | ... | @@ -49,12 +49,12 @@ public class KafkaTemporaryStorage implements Serializable { |
| 49 | private Long frequency; | 49 | private Long frequency; |
| 50 | 50 | ||
| 51 | /** | 51 | /** |
| 52 | - * KAFKA消息状态ID,关联数据字典表。指定字典目录CODE:KAFKA_MSG_STATUS | 52 | + * KAFKA消息数据状态(0:待处理,1:已处理,2:处理失败) |
| 53 | */ | 53 | */ |
| 54 | - private Long statusId; | 54 | + private Long status; |
| 55 | 55 | ||
| 56 | /** | 56 | /** |
| 57 | - * KAFKA消息状态NAME | 57 | + * KAFKA消息数据状态NAME,(0:待处理,1:已处理,2:处理失败) |
| 58 | */ | 58 | */ |
| 59 | private String statusName; | 59 | private String statusName; |
| 60 | 60 | ||
| ... | @@ -98,6 +98,11 @@ public class KafkaTemporaryStorage implements Serializable { | ... | @@ -98,6 +98,11 @@ public class KafkaTemporaryStorage implements Serializable { |
| 98 | */ | 98 | */ |
| 99 | private String data; | 99 | private String data; |
| 100 | 100 | ||
| 101 | + /** | ||
| 102 | + * 消息字符串 | ||
| 103 | + */ | ||
| 104 | + private String message; | ||
| 105 | + | ||
| 101 | private static final long serialVersionUID = 1L; | 106 | private static final long serialVersionUID = 1L; |
| 102 | 107 | ||
| 103 | public Long getId() { | 108 | public Long getId() { |
| ... | @@ -164,12 +169,12 @@ public class KafkaTemporaryStorage implements Serializable { | ... | @@ -164,12 +169,12 @@ public class KafkaTemporaryStorage implements Serializable { |
| 164 | this.frequency = frequency; | 169 | this.frequency = frequency; |
| 165 | } | 170 | } |
| 166 | 171 | ||
| 167 | - public Long getStatusId() { | 172 | + public Long getStatus() { |
| 168 | - return statusId; | 173 | + return status; |
| 169 | } | 174 | } |
| 170 | 175 | ||
| 171 | - public void setStatusId(Long statusId) { | 176 | + public void setStatus(Long status) { |
| 172 | - this.statusId = statusId; | 177 | + this.status = status; |
| 173 | } | 178 | } |
| 174 | 179 | ||
| 175 | public String getStatusName() { | 180 | public String getStatusName() { |
| ... | @@ -244,6 +249,14 @@ public class KafkaTemporaryStorage implements Serializable { | ... | @@ -244,6 +249,14 @@ public class KafkaTemporaryStorage implements Serializable { |
| 244 | this.data = data == null ? null : data.trim(); | 249 | this.data = data == null ? null : data.trim(); |
| 245 | } | 250 | } |
| 246 | 251 | ||
| 252 | + public String getMessage() { | ||
| 253 | + return message; | ||
| 254 | + } | ||
| 255 | + | ||
| 256 | + public void setMessage(String message) { | ||
| 257 | + this.message = message; | ||
| 258 | + } | ||
| 259 | + | ||
| 247 | @Override | 260 | @Override |
| 248 | public String toString() { | 261 | public String toString() { |
| 249 | StringBuilder sb = new StringBuilder(); | 262 | StringBuilder sb = new StringBuilder(); |
| ... | @@ -258,7 +271,7 @@ public class KafkaTemporaryStorage implements Serializable { | ... | @@ -258,7 +271,7 @@ public class KafkaTemporaryStorage implements Serializable { |
| 258 | sb.append(", sendTime=").append(sendTime); | 271 | sb.append(", sendTime=").append(sendTime); |
| 259 | sb.append(", consignmentCode=").append(consignmentCode); | 272 | sb.append(", consignmentCode=").append(consignmentCode); |
| 260 | sb.append(", frequency=").append(frequency); | 273 | sb.append(", frequency=").append(frequency); |
| 261 | - sb.append(", statusId=").append(statusId); | 274 | + sb.append(", status=").append(status); |
| 262 | sb.append(", statusName=").append(statusName); | 275 | sb.append(", statusName=").append(statusName); |
| 263 | sb.append(", remark=").append(remark); | 276 | sb.append(", remark=").append(remark); |
| 264 | sb.append(", createTime=").append(createTime); | 277 | sb.append(", createTime=").append(createTime); | ... | ... |
server/common-dao/src/main/java/com/fedex/connect/common/model/sys/KafkaTemporaryStorageExample.java
| ... | @@ -655,63 +655,63 @@ public class KafkaTemporaryStorageExample { | ... | @@ -655,63 +655,63 @@ public class KafkaTemporaryStorageExample { |
| 655 | return (Criteria) this; | 655 | return (Criteria) this; |
| 656 | } | 656 | } |
| 657 | 657 | ||
| 658 | - public Criteria andStatusIdIsNull() { | 658 | + public Criteria andStatusIsNull() { |
| 659 | - addCriterion("STATUS_ID is null"); | 659 | + addCriterion("STATUS is null"); |
| 660 | return (Criteria) this; | 660 | return (Criteria) this; |
| 661 | } | 661 | } |
| 662 | 662 | ||
| 663 | - public Criteria andStatusIdIsNotNull() { | 663 | + public Criteria andStatusIsNotNull() { |
| 664 | - addCriterion("STATUS_ID is not null"); | 664 | + addCriterion("STATUS is not null"); |
| 665 | return (Criteria) this; | 665 | return (Criteria) this; |
| 666 | } | 666 | } |
| 667 | 667 | ||
| 668 | - public Criteria andStatusIdEqualTo(Long value) { | 668 | + public Criteria andStatusEqualTo(Long value) { |
| 669 | - addCriterion("STATUS_ID =", value, "statusId"); | 669 | + addCriterion("STATUS =", value, "status"); |
| 670 | return (Criteria) this; | 670 | return (Criteria) this; |
| 671 | } | 671 | } |
| 672 | 672 | ||
| 673 | - public Criteria andStatusIdNotEqualTo(Long value) { | 673 | + public Criteria andStatusNotEqualTo(Long value) { |
| 674 | - addCriterion("STATUS_ID <>", value, "statusId"); | 674 | + addCriterion("STATUS <>", value, "status"); |
| 675 | return (Criteria) this; | 675 | return (Criteria) this; |
| 676 | } | 676 | } |
| 677 | 677 | ||
| 678 | - public Criteria andStatusIdGreaterThan(Long value) { | 678 | + public Criteria andStatusGreaterThan(Long value) { |
| 679 | - addCriterion("STATUS_ID >", value, "statusId"); | 679 | + addCriterion("STATUS >", value, "status"); |
| 680 | return (Criteria) this; | 680 | return (Criteria) this; |
| 681 | } | 681 | } |
| 682 | 682 | ||
| 683 | - public Criteria andStatusIdGreaterThanOrEqualTo(Long value) { | 683 | + public Criteria andStatusGreaterThanOrEqualTo(Long value) { |
| 684 | - addCriterion("STATUS_ID >=", value, "statusId"); | 684 | + addCriterion("STATUS >=", value, "status"); |
| 685 | return (Criteria) this; | 685 | return (Criteria) this; |
| 686 | } | 686 | } |
| 687 | 687 | ||
| 688 | - public Criteria andStatusIdLessThan(Long value) { | 688 | + public Criteria andStatusLessThan(Long value) { |
| 689 | - addCriterion("STATUS_ID <", value, "statusId"); | 689 | + addCriterion("STATUS <", value, "status"); |
| 690 | return (Criteria) this; | 690 | return (Criteria) this; |
| 691 | } | 691 | } |
| 692 | 692 | ||
| 693 | - public Criteria andStatusIdLessThanOrEqualTo(Long value) { | 693 | + public Criteria andStatusLessThanOrEqualTo(Long value) { |
| 694 | - addCriterion("STATUS_ID <=", value, "statusId"); | 694 | + addCriterion("STATUS <=", value, "status"); |
| 695 | return (Criteria) this; | 695 | return (Criteria) this; |
| 696 | } | 696 | } |
| 697 | 697 | ||
| 698 | - public Criteria andStatusIdIn(List<Long> values) { | 698 | + public Criteria andStatusIn(List<Long> values) { |
| 699 | - addCriterion("STATUS_ID in", values, "statusId"); | 699 | + addCriterion("STATUS in", values, "status"); |
| 700 | return (Criteria) this; | 700 | return (Criteria) this; |
| 701 | } | 701 | } |
| 702 | 702 | ||
| 703 | - public Criteria andStatusIdNotIn(List<Long> values) { | 703 | + public Criteria andStatusNotIn(List<Long> values) { |
| 704 | - addCriterion("STATUS_ID not in", values, "statusId"); | 704 | + addCriterion("STATUS not in", values, "status"); |
| 705 | return (Criteria) this; | 705 | return (Criteria) this; |
| 706 | } | 706 | } |
| 707 | 707 | ||
| 708 | - public Criteria andStatusIdBetween(Long value1, Long value2) { | 708 | + public Criteria andStatusBetween(Long value1, Long value2) { |
| 709 | - addCriterion("STATUS_ID between", value1, value2, "statusId"); | 709 | + addCriterion("STATUS between", value1, value2, "status"); |
| 710 | return (Criteria) this; | 710 | return (Criteria) this; |
| 711 | } | 711 | } |
| 712 | 712 | ||
| 713 | - public Criteria andStatusIdNotBetween(Long value1, Long value2) { | 713 | + public Criteria andStatusNotBetween(Long value1, Long value2) { |
| 714 | - addCriterion("STATUS_ID not between", value1, value2, "statusId"); | 714 | + addCriterion("STATUS not between", value1, value2, "status"); |
| 715 | return (Criteria) this; | 715 | return (Criteria) this; |
| 716 | } | 716 | } |
| 717 | 717 | ... | ... |
| ... | @@ -40,7 +40,7 @@ | ... | @@ -40,7 +40,7 @@ |
| 40 | sys:系统 系统相关表,例如kafka表 | 40 | sys:系统 系统相关表,例如kafka表 |
| 41 | log: 日志 日志记录表,例如邮件发送日志表 | 41 | log: 日志 日志记录表,例如邮件发送日志表 |
| 42 | --> | 42 | --> |
| 43 | - <javaModelGenerator targetPackage="com.fedex.connect.common.model.log" targetProject="src/main/java"> | 43 | + <javaModelGenerator targetPackage="com.fedex.connect.common.model.sys" targetProject="src/main/java"> |
| 44 | <!---enableSubPackages:如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性--> | 44 | <!---enableSubPackages:如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性--> |
| 45 | <property name="enableSubPackages" value="false"/> | 45 | <property name="enableSubPackages" value="false"/> |
| 46 | <!--该属性只对MyBatis3有效,如果true就会使用构造方法入参,如果false就会使用setter方式。默认为false--> | 46 | <!--该属性只对MyBatis3有效,如果true就会使用构造方法入参,如果false就会使用setter方式。默认为false--> |
| ... | @@ -52,13 +52,13 @@ | ... | @@ -52,13 +52,13 @@ |
| 52 | </javaModelGenerator> | 52 | </javaModelGenerator> |
| 53 | 53 | ||
| 54 | <!-- 生成映射文件*.xml的位置--> | 54 | <!-- 生成映射文件*.xml的位置--> |
| 55 | - <sqlMapGenerator targetPackage="mapper.log" targetProject="src/main/java/com/fedex/connect/common"> | 55 | + <sqlMapGenerator targetPackage="mapper.sys" targetProject="src/main/java/com/fedex/connect/common"> |
| 56 | <!--如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性。默认为false--> | 56 | <!--如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性。默认为false--> |
| 57 | <property name="enableSubPackages" value="false"/> | 57 | <property name="enableSubPackages" value="false"/> |
| 58 | </sqlMapGenerator> | 58 | </sqlMapGenerator> |
| 59 | 59 | ||
| 60 | <!-- 生成DAO的包名和位置 --> | 60 | <!-- 生成DAO的包名和位置 --> |
| 61 | - <javaClientGenerator type="XMLMAPPER" targetPackage="com.fedex.connect.common.dao.log" targetProject="src/main/java"> | 61 | + <javaClientGenerator type="XMLMAPPER" targetPackage="com.fedex.connect.common.dao.sys" targetProject="src/main/java"> |
| 62 | <!--如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性。默认为false--> | 62 | <!--如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性。默认为false--> |
| 63 | <property name="enableSubPackages" value="false"/> | 63 | <property name="enableSubPackages" value="false"/> |
| 64 | </javaClientGenerator> | 64 | </javaClientGenerator> |
| ... | @@ -73,18 +73,18 @@ | ... | @@ -73,18 +73,18 @@ |
| 73 | generatedKey 指定KEY,Oracle需要指定序列。 | 73 | generatedKey 指定KEY,Oracle需要指定序列。 |
| 74 | sqlStatement 指定序列名称 | 74 | sqlStatement 指定序列名称 |
| 75 | --> | 75 | --> |
| 76 | - <table tableName="T_LOG_OPERATION" domainObjectName="Operation" | 76 | +<!-- <table tableName="T_LOG_OPERATION" domainObjectName="Operation"--> |
| 77 | - enableCountByExample="true" enableUpdateByExample="true" | 77 | +<!-- enableCountByExample="true" enableUpdateByExample="true"--> |
| 78 | - enableDeleteByExample="true" enableSelectByExample="true" | 78 | +<!-- enableDeleteByExample="true" enableSelectByExample="true"--> |
| 79 | - selectByExampleQueryId="true"> | 79 | +<!-- selectByExampleQueryId="true">--> |
| 80 | - <generatedKey column="ID" sqlStatement="SELECT SEQ_T_LOG_OPERATION.NEXTVAL FROM DUAL" /> | 80 | +<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_LOG_OPERATION.NEXTVAL FROM DUAL" />--> |
| 81 | - </table> | 81 | +<!-- </table>--> |
| 82 | - <table tableName="T_LOG_EMAIL_HISTORY" domainObjectName="EmailHistory" | 82 | +<!-- <table tableName="T_LOG_EMAIL_HISTORY" domainObjectName="EmailHistory"--> |
| 83 | - enableCountByExample="true" enableUpdateByExample="true" | 83 | +<!-- enableCountByExample="true" enableUpdateByExample="true"--> |
| 84 | - enableDeleteByExample="true" enableSelectByExample="true" | 84 | +<!-- enableDeleteByExample="true" enableSelectByExample="true"--> |
| 85 | - selectByExampleQueryId="true"> | 85 | +<!-- selectByExampleQueryId="true">--> |
| 86 | - <generatedKey column="ID" sqlStatement="SELECT SEQ_T_LOG_EMAIL_HISTORY.NEXTVAL FROM DUAL" /> | 86 | +<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_LOG_EMAIL_HISTORY.NEXTVAL FROM DUAL" />--> |
| 87 | - </table> | 87 | +<!-- </table>--> |
| 88 | 88 | ||
| 89 | 89 | ||
| 90 | 90 | ||
| ... | @@ -141,13 +141,13 @@ | ... | @@ -141,13 +141,13 @@ |
| 141 | <!-- selectByExampleQueryId="true">--> | 141 | <!-- selectByExampleQueryId="true">--> |
| 142 | <!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_REDIS_SLAB.NEXTVAL FROM DUAL" />--> | 142 | <!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_REDIS_SLAB.NEXTVAL FROM DUAL" />--> |
| 143 | <!-- </table>--> | 143 | <!-- </table>--> |
| 144 | -<!-- <table tableName="T_SYS_KAFKA_STORAGE_HISTORY" domainObjectName="KafkaTemporaryStorage"--> | 144 | + <table tableName="T_SYS_KAFKA_STORAGE_HISTORY" domainObjectName="KafkaStorageHistory" |
| 145 | -<!-- enableCountByExample="true" enableUpdateByExample="true"--> | 145 | + enableCountByExample="true" enableUpdateByExample="true" |
| 146 | -<!-- enableDeleteByExample="true" enableSelectByExample="true"--> | 146 | + enableDeleteByExample="true" enableSelectByExample="true" |
| 147 | -<!-- selectByExampleQueryId="true">--> | 147 | + selectByExampleQueryId="true"> |
| 148 | -<!-- <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_KAFKA_STORAGE_HISTORY.NEXTVAL FROM DUAL" />--> | 148 | + <generatedKey column="ID" sqlStatement="SELECT SEQ_T_SYS_KAFKA_STORAGE_HISTORY.NEXTVAL FROM DUAL" /> |
| 149 | -<!-- </table>--> | 149 | + </table> |
| 150 | -<!-- <table tableName="T_SYS_KAFKA_TEMPORARY_STORAGE" domainObjectName="KafkaStorageHistory"--> | 150 | +<!-- <table tableName="T_SYS_KAFKA_TEMPORARY_STORAGE" domainObjectName="KafkaTemporaryStorage"--> |
| 151 | <!-- enableCountByExample="true" enableUpdateByExample="true"--> | 151 | <!-- enableCountByExample="true" enableUpdateByExample="true"--> |
| 152 | <!-- enableDeleteByExample="true" enableSelectByExample="true"--> | 152 | <!-- enableDeleteByExample="true" enableSelectByExample="true"--> |
| 153 | <!-- selectByExampleQueryId="true">--> | 153 | <!-- selectByExampleQueryId="true">--> | ... | ... |
| 1 | package com.fedex.connect.common.dependencies.arithmetic; | 1 | package com.fedex.connect.common.dependencies.arithmetic; |
| 2 | 2 | ||
| 3 | -import com.fedex.export.common.util.BytesUtils; | 3 | +import com.fedex.connect.common.dependencies.util.BytesUtils; |
| 4 | import org.apache.commons.lang3.StringUtils; | 4 | import org.apache.commons.lang3.StringUtils; |
| 5 | 5 | ||
| 6 | import javax.crypto.*; | 6 | import javax.crypto.*; | ... | ... |
| ... | @@ -9,7 +9,7 @@ import org.springframework.security.crypto.password.StandardPasswordEncoder; | ... | @@ -9,7 +9,7 @@ import org.springframework.security.crypto.password.StandardPasswordEncoder; |
| 9 | public class EncryptProvider { | 9 | public class EncryptProvider { |
| 10 | 10 | ||
| 11 | //加密密钥 | 11 | //加密密钥 |
| 12 | - private static final PasswordEncoder ENCODER = new StandardPasswordEncoder("exportTw"); | 12 | + private static final PasswordEncoder ENCODER = new StandardPasswordEncoder("iclearConnect"); |
| 13 | 13 | ||
| 14 | /** | 14 | /** |
| 15 | * Spring-security-crypto加密方式 | 15 | * Spring-security-crypto加密方式 | ... | ... |
| 1 | package com.fedex.connect.common.dependencies.authentication; | 1 | package com.fedex.connect.common.dependencies.authentication; |
| 2 | 2 | ||
| 3 | -import com.fedex.export.authentication.exception.JwtAccessDeniedHandler; | 3 | +import com.fedex.connect.common.dependencies.authentication.exception.JwtAccessDeniedHandler; |
| 4 | -import com.fedex.export.authentication.exception.JwtAuthenticationEntryPoint; | 4 | +import com.fedex.connect.common.dependencies.authentication.exception.JwtAuthenticationEntryPoint; |
| 5 | -import com.fedex.export.authentication.filter.JwtAuthorizationFilter; | 5 | +import com.fedex.connect.common.dependencies.authentication.filter.JwtAuthorizationFilter; |
| 6 | import org.springframework.context.annotation.Bean; | 6 | import org.springframework.context.annotation.Bean; |
| 7 | import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; | 7 | import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; |
| 8 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; | 8 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
| ... | @@ -28,13 +28,13 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ... | @@ -28,13 +28,13 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
| 28 | @Override | 28 | @Override |
| 29 | protected void configure(HttpSecurity http) throws Exception { | 29 | protected void configure(HttpSecurity http) throws Exception { |
| 30 | //放行白名单(这个配置会比读取配置文件优先进行,别问我怎么知道的) | 30 | //放行白名单(这个配置会比读取配置文件优先进行,别问我怎么知道的) |
| 31 | - String[] whiteList = {"/icleartw/login.html","/icleartw/auth/login","/icleartw/auth/addUser", | 31 | + String[] whiteList = {"/login.html","/auth/login","/auth/addUser", |
| 32 | - "/icleartw/oss/ossLogin", "/icleartw/sysUser/logout","/icleartw/auth/getUser","/icleartw/static/*", | 32 | + "/oss/ossLogin", "/sysUser/logout","/auth/getUser","/static/*", |
| 33 | - "/icleartw/swagger-ui.html","/icleartw/swagger-resources","/icleartw/webjars","/icleartw/swagger-ui/*", "/icleartw/v2/api-docs","/**"}; | 33 | + "/swagger-ui.html","/swagger-resources","/webjars","/swagger-ui/*", "/v2/api-docs","/**"}; |
| 34 | 34 | ||
| 35 | //formLogin配置登录页面和成功/失败的响应 | 35 | //formLogin配置登录页面和成功/失败的响应 |
| 36 | http.formLogin() | 36 | http.formLogin() |
| 37 | - .loginPage("/icleartw/login.html").permitAll() | 37 | + .loginPage("/login.html").permitAll() |
| 38 | //.successHandler(new MyAuthenticationSuccessHandler("/main")) | 38 | //.successHandler(new MyAuthenticationSuccessHandler("/main")) |
| 39 | //.failureHandler(new MyAuthenticationFailureHandler("/403.html")) | 39 | //.failureHandler(new MyAuthenticationFailureHandler("/403.html")) |
| 40 | .and() | 40 | .and() | ... | ... |
| 1 | package com.fedex.connect.common.dependencies.authentication.filter; | 1 | package com.fedex.connect.common.dependencies.authentication.filter; |
| 2 | 2 | ||
| 3 | -import com.fedex.export.authentication.SecurityConstants; | 3 | +import com.fedex.connect.common.dependencies.authentication.SecurityConstants; |
| 4 | -import com.fedex.export.common.contants.RedisConstants; | 4 | +import com.fedex.connect.common.dependencies.contants.RedisConstants; |
| 5 | -import com.fedex.export.common.i18n.LocaleMessageUtil; | 5 | +import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; |
| 6 | -import com.fedex.export.common.util.JsonUtils; | 6 | +import com.fedex.connect.common.dependencies.service.sys.IRedisSlabService; |
| 7 | -import com.fedex.export.common.util.JwtTokenUtils; | 7 | +import com.fedex.connect.common.dependencies.util.JsonUtils; |
| 8 | -import com.fedex.export.common.util.SpringBeanUtil; | 8 | +import com.fedex.connect.common.dependencies.util.JwtTokenUtils; |
| 9 | -import com.fedex.export.common.util.Utils; | 9 | +import com.fedex.connect.common.dependencies.util.SpringBeanUtil; |
| 10 | -import com.fedex.export.repository.entity.RedisSlab; | 10 | +import com.fedex.connect.common.dependencies.util.Utils; |
| 11 | -import com.fedex.export.service.system.RedisUtilService; | 11 | +import com.fedex.connect.common.model.sys.RedisSlab; |
| 12 | import io.jsonwebtoken.Claims; | 12 | import io.jsonwebtoken.Claims; |
| 13 | import io.jsonwebtoken.ExpiredJwtException; | 13 | import io.jsonwebtoken.ExpiredJwtException; |
| 14 | import org.apache.commons.lang3.StringUtils; | 14 | import org.apache.commons.lang3.StringUtils; |
| ... | @@ -71,7 +71,7 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { | ... | @@ -71,7 +71,7 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { |
| 71 | 71 | ||
| 72 | //使用context手动注入 | 72 | //使用context手动注入 |
| 73 | LocaleMessageUtil localeMessageUtil = SpringBeanUtil.getBean(LocaleMessageUtil.class); | 73 | LocaleMessageUtil localeMessageUtil = SpringBeanUtil.getBean(LocaleMessageUtil.class); |
| 74 | - RedisUtilService redisUtilService = SpringBeanUtil.getBean(RedisUtilService.class); | 74 | + IRedisSlabService redisSlabService = SpringBeanUtil.getBean(IRedisSlabService.class); |
| 75 | 75 | ||
| 76 | if (token == null || !token.startsWith(SecurityConstants.TOKEN_PREFIX)) { | 76 | if (token == null || !token.startsWith(SecurityConstants.TOKEN_PREFIX)) { |
| 77 | SecurityContextHolder.clearContext(); | 77 | SecurityContextHolder.clearContext(); |
| ... | @@ -105,7 +105,7 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { | ... | @@ -105,7 +105,7 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { |
| 105 | logger.debug("TOKEN 过期时间为 :{}", expiredTime); | 105 | logger.debug("TOKEN 过期时间为 :{}", expiredTime); |
| 106 | String id = JwtTokenUtils.getId(tokenValue); | 106 | String id = JwtTokenUtils.getId(tokenValue); |
| 107 | String redisKey = RedisConstants.REDIS_KEY_TOKEN + id; | 107 | String redisKey = RedisConstants.REDIS_KEY_TOKEN + id; |
| 108 | - RedisSlab redisSlab = redisUtilService.get(redisKey); | 108 | + RedisSlab redisSlab = redisSlabService.get(redisKey); |
| 109 | String tokenRedis = redisSlab != null ? Optional.ofNullable(redisSlab.getRedisMsg()).orElse(null): null; | 109 | String tokenRedis = redisSlab != null ? Optional.ofNullable(redisSlab.getRedisMsg()).orElse(null): null; |
| 110 | /*String tokenRedis = redisUtilService.get(redisKey);*/ | 110 | /*String tokenRedis = redisUtilService.get(redisKey);*/ |
| 111 | if (StringUtils.isEmpty(tokenRedis)) { | 111 | if (StringUtils.isEmpty(tokenRedis)) { |
| ... | @@ -129,7 +129,7 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { | ... | @@ -129,7 +129,7 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { |
| 129 | response.setHeader("Token", newToken);*/ | 129 | response.setHeader("Token", newToken);*/ |
| 130 | } catch (ExpiredJwtException ee) { | 130 | } catch (ExpiredJwtException ee) { |
| 131 | //已经过期了,直接踢 | 131 | //已经过期了,直接踢 |
| 132 | - logger.info("CODE_301 requestURL:{},reason:{}" , request.getRequestURL(),"ExpiredJwtException ",ee); | 132 | + logger.error("CODE_301 requestURL:{},reason:{}" , request.getRequestURL(),"ExpiredJwtException ",ee); |
| 133 | Claims claims = ee.getClaims(); | 133 | Claims claims = ee.getClaims(); |
| 134 | String id = claims.getId(); | 134 | String id = claims.getId(); |
| 135 | Map<String, Object> result = new HashMap<>(); | 135 | Map<String, Object> result = new HashMap<>(); |
| ... | @@ -154,6 +154,4 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { | ... | @@ -154,6 +154,4 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { |
| 154 | chain.doFilter(request, response); | 154 | chain.doFilter(request, response); |
| 155 | return; | 155 | return; |
| 156 | } | 156 | } |
| 157 | -} | 157 | +} |
| 158 | - | ||
| 159 | - | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | +package com.fedex.connect.common.dependencies.contants; | ||
| 2 | + | ||
| 3 | +import java.math.BigDecimal; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @Author mt | ||
| 7 | + * @Description 用于数字的常量管理 | ||
| 8 | + * @Date 2024/10/31 | ||
| 9 | + */ | ||
| 10 | +public interface DigitConstants { | ||
| 11 | + | ||
| 12 | + /** | ||
| 13 | + * @Description 数字-1 | ||
| 14 | + * @Author mt | ||
| 15 | + * @Date 2024-10-27 | ||
| 16 | + */ | ||
| 17 | + int DIGIT_MINUS_ONE = -1; | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * @Description 数字0 | ||
| 21 | + * @Author mt | ||
| 22 | + * @Date 2024-10-09 | ||
| 23 | + */ | ||
| 24 | + int DIGIT_ZERO = 0; | ||
| 25 | + /** | ||
| 26 | + * @Description 数字1 | ||
| 27 | + * @Author mt | ||
| 28 | + * @Date 2024-10-11 | ||
| 29 | + */ | ||
| 30 | + int DIGIT_ONE = 1; | ||
| 31 | + /** | ||
| 32 | + * @Description 数字2 | ||
| 33 | + * @Author mt | ||
| 34 | + * @Date 2024-10-27 | ||
| 35 | + */ | ||
| 36 | + int DIGIT_TWO = 2; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * @Description 数字3 | ||
| 40 | + * @Author mt | ||
| 41 | + * @Date 2024-10-27 | ||
| 42 | + */ | ||
| 43 | + int DIGIT_THREE = 3; | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * @Description 数字4 | ||
| 47 | + * @Author mt | ||
| 48 | + * @Date 2024-10-27 | ||
| 49 | + */ | ||
| 50 | + int DIGIT_FOUR = 4; | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * @Description 数字5 | ||
| 54 | + * @Author mt | ||
| 55 | + * @Date 2024-10-27 | ||
| 56 | + */ | ||
| 57 | + int DIGIT_FIVE = 5; | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * @Description 数字6 | ||
| 61 | + * @Author mt | ||
| 62 | + * @Date 2024-10-27 | ||
| 63 | + */ | ||
| 64 | + int DIGIT_SIX = 6; | ||
| 65 | + /** | ||
| 66 | + * @Description 数字7 | ||
| 67 | + * @Author mt | ||
| 68 | + * @Date 2024-10-27 | ||
| 69 | + */ | ||
| 70 | + int DIGIT_SEVEN = 7; | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * @Description 数字8 | ||
| 74 | + * @Author mt | ||
| 75 | + * @Date 2024-10-27 | ||
| 76 | + */ | ||
| 77 | + int DIGIT_EIGHT = 8; | ||
| 78 | + /** | ||
| 79 | + * @Description 数字9 | ||
| 80 | + * @Author mt | ||
| 81 | + * @Date 2024-10-27 | ||
| 82 | + */ | ||
| 83 | + int DIGIT_NINE = 9; | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * @Description 数字10 | ||
| 87 | + * @Author mt | ||
| 88 | + * @Date 2023-1-9 | ||
| 89 | + */ | ||
| 90 | + int DIGIT_TEN = 10; | ||
| 91 | + /** | ||
| 92 | + * @Description 数字11 | ||
| 93 | + * @Author mt | ||
| 94 | + * @Date 2023-1-9 | ||
| 95 | + */ | ||
| 96 | + int DIGIT_ELEVEN = 11; | ||
| 97 | + | ||
| 98 | + /** | ||
| 99 | + * @Description 数字12 | ||
| 100 | + * @Author mt | ||
| 101 | + * @Date 2024-10-27 | ||
| 102 | + */ | ||
| 103 | + int DIGIT_TWELVE = 12; | ||
| 104 | + | ||
| 105 | + /** | ||
| 106 | + * @Description 数字13 | ||
| 107 | + * @Author mt | ||
| 108 | + * @Date 2024-10-27 | ||
| 109 | + */ | ||
| 110 | + int DIGIT_THIRTEEN = 13; | ||
| 111 | + | ||
| 112 | + /** | ||
| 113 | + * @Description 数字14 | ||
| 114 | + * @Author mt | ||
| 115 | + * @Date 2024-10-27 | ||
| 116 | + */ | ||
| 117 | + int DIGIT_FOURTEEN = 14; | ||
| 118 | + | ||
| 119 | + /** | ||
| 120 | + * @Description 数字15 | ||
| 121 | + * @Author mt | ||
| 122 | + * @Date 2024-10-27 | ||
| 123 | + */ | ||
| 124 | + int DIGIT_FIFTEEN = 15; | ||
| 125 | + | ||
| 126 | + /** | ||
| 127 | + * @Description 数字16 | ||
| 128 | + * @Author mt | ||
| 129 | + * @Date 2024-10-27 | ||
| 130 | + */ | ||
| 131 | + int DIGIT_SIXTEEN = 16; | ||
| 132 | + /** | ||
| 133 | + * @Description 数字17 | ||
| 134 | + * @Author mt | ||
| 135 | + * @Date 2024-10-27 | ||
| 136 | + */ | ||
| 137 | + int DIGIT_SEVENTEEN = 17; | ||
| 138 | + | ||
| 139 | + /** | ||
| 140 | + * @Description 数字18 | ||
| 141 | + * @Author mt | ||
| 142 | + * @Date 2023-1-9 | ||
| 143 | + */ | ||
| 144 | + int DIGIT_EIGHTEEN = 18; | ||
| 145 | + | ||
| 146 | + /** | ||
| 147 | + * @Description 数字19 | ||
| 148 | + * @Author mt | ||
| 149 | + * @Date 2023-1-30 | ||
| 150 | + */ | ||
| 151 | + int DIGIT_NINETEEN = 19; | ||
| 152 | + | ||
| 153 | + /** | ||
| 154 | + * @Description 数字20 | ||
| 155 | + * @Author mt | ||
| 156 | + * @Date 2024-10-27 | ||
| 157 | + */ | ||
| 158 | + int DIGIT_TWENTY = 20; | ||
| 159 | + | ||
| 160 | + /** | ||
| 161 | + * @Description 数字21 | ||
| 162 | + * @Author mt | ||
| 163 | + * @Date 2024-10-27 | ||
| 164 | + */ | ||
| 165 | + int DIGIT_TWENTY_ONE = 21; | ||
| 166 | + /** | ||
| 167 | + * @Description 数字22 | ||
| 168 | + * @Author mt | ||
| 169 | + * @Date 2024-10-27 | ||
| 170 | + */ | ||
| 171 | + int DIGIT_TWENTY_TWO = 22; | ||
| 172 | + | ||
| 173 | + /** | ||
| 174 | + * @Description 数字23 | ||
| 175 | + * @Author mt | ||
| 176 | + * @Date 2024-10-27 | ||
| 177 | + */ | ||
| 178 | + int DIGIT_TWENTY_THREE = 23; | ||
| 179 | + | ||
| 180 | + /** | ||
| 181 | + * @Description 数字24 | ||
| 182 | + * @Author mt | ||
| 183 | + * @Date 2024-10-27 | ||
| 184 | + */ | ||
| 185 | + int DIGIT_TWENTY_FOUR = 24; | ||
| 186 | + | ||
| 187 | + /** | ||
| 188 | + * @Description 数字25 | ||
| 189 | + * @Author mt | ||
| 190 | + * @Date 2024-10-27 | ||
| 191 | + */ | ||
| 192 | + int DIGIT_TWENTY_FIVE = 25; | ||
| 193 | + | ||
| 194 | + /** | ||
| 195 | + * @Description 数字26 | ||
| 196 | + * @Author mt | ||
| 197 | + * @Date 2024-10-27 | ||
| 198 | + */ | ||
| 199 | + int DIGIT_TWENTY_SIX = 26; | ||
| 200 | + /** | ||
| 201 | + * @Description 数字27 | ||
| 202 | + * @Author mt | ||
| 203 | + * @Date 2024-10-27 | ||
| 204 | + */ | ||
| 205 | + int DIGIT_TWENTY_SEVEN = 27; | ||
| 206 | + | ||
| 207 | + /** | ||
| 208 | + * @Description 数字28 | ||
| 209 | + * @Author mt | ||
| 210 | + * @Date 2024-10-27 | ||
| 211 | + */ | ||
| 212 | + int DIGIT_TWENTY_EIGHT = 28; | ||
| 213 | + | ||
| 214 | + /** | ||
| 215 | + * @author lxy | ||
| 216 | + * @description 属性说明 数字29 | ||
| 217 | + * @date 2024/9/19 | ||
| 218 | + */ | ||
| 219 | + int DIGIT_TWENTY_NINE = 29; | ||
| 220 | + | ||
| 221 | + /** | ||
| 222 | + * @Description 数字30 | ||
| 223 | + * @Author mt | ||
| 224 | + * @Date 2024-10-27 | ||
| 225 | + */ | ||
| 226 | + int DIGIT_THIRTY = 30; | ||
| 227 | + /** | ||
| 228 | + * @Description 数字31 | ||
| 229 | + * @Author mt | ||
| 230 | + * @Date 2024-10-27 | ||
| 231 | + */ | ||
| 232 | + int DIGIT_THIRTY_ONE = 31; | ||
| 233 | + /** | ||
| 234 | + * @Description 数字32 | ||
| 235 | + * @Author mt | ||
| 236 | + * @Date 2024-10-27 | ||
| 237 | + */ | ||
| 238 | + int DIGIT_THIRTY_TWO = 32; | ||
| 239 | + /** | ||
| 240 | + * @Description 数字33 | ||
| 241 | + * @Author mt | ||
| 242 | + * @Date 2024-10-27 | ||
| 243 | + */ | ||
| 244 | + int DIGIT_THIRTY_THREE = 33; | ||
| 245 | + /** | ||
| 246 | + * @Description 数字34 | ||
| 247 | + * @Author mt | ||
| 248 | + * @Date 2024-10-27 | ||
| 249 | + */ | ||
| 250 | + int DIGIT_THIRTY_FOUR = 34; | ||
| 251 | + /** | ||
| 252 | + * @Description 数字39 | ||
| 253 | + * @Author mt | ||
| 254 | + * @Date 2024-10-27 | ||
| 255 | + */ | ||
| 256 | + int DIGIT_THIRTY_NINE = 39; | ||
| 257 | + | ||
| 258 | + /** | ||
| 259 | + * @Description 数字40 | ||
| 260 | + * @Author mt | ||
| 261 | + * @Date 2024-10-27 | ||
| 262 | + */ | ||
| 263 | + int DIGIT_FORTY = 40; | ||
| 264 | + /** | ||
| 265 | + * @Description 数字42 | ||
| 266 | + * @Author mt | ||
| 267 | + * @Date 2024-10-27 | ||
| 268 | + */ | ||
| 269 | + int DIGIT_FORTY_TWO = 42; | ||
| 270 | + /** | ||
| 271 | + * @Description 数字47 | ||
| 272 | + * @Author mt | ||
| 273 | + * @Date 2024-10-27 | ||
| 274 | + */ | ||
| 275 | + int DIGIT_FORTY_SEVEN = 47; | ||
| 276 | + | ||
| 277 | + /** | ||
| 278 | + * @Description 数字50 | ||
| 279 | + * @Author mt | ||
| 280 | + * @Date 2024-10-27 | ||
| 281 | + */ | ||
| 282 | + int DIGIT_FIFTY = 50; | ||
| 283 | + | ||
| 284 | + /** | ||
| 285 | + * @Description 数字58 | ||
| 286 | + * @Author mt | ||
| 287 | + * @Date 2024-10-27 | ||
| 288 | + */ | ||
| 289 | + int DIGIT_FIFTY_EIGHT = 58; | ||
| 290 | + /** | ||
| 291 | + * @Description 数字60 | ||
| 292 | + * @Author mt | ||
| 293 | + * @Date 2024-10-27 | ||
| 294 | + */ | ||
| 295 | + int DIGIT_SIXTY = 60; | ||
| 296 | + /** | ||
| 297 | + * @Description 数字64 | ||
| 298 | + * @Author mt | ||
| 299 | + * @Date 2024-10-27 | ||
| 300 | + */ | ||
| 301 | + int DIGIT_SIXTY_FOUR = 64; | ||
| 302 | + | ||
| 303 | + /** | ||
| 304 | + * @Description 数字70 | ||
| 305 | + * @Author mt | ||
| 306 | + * @Date 2024-10-27 | ||
| 307 | + */ | ||
| 308 | + int DIGIT_SEVENTY = 70; | ||
| 309 | + /** | ||
| 310 | + * @Description 数字90 | ||
| 311 | + * @Author mt | ||
| 312 | + * @Date 2024-10-11 | ||
| 313 | + */ | ||
| 314 | + int DIGIT_NINETY = 90; | ||
| 315 | + /** | ||
| 316 | + * @Description 数字91 | ||
| 317 | + * @Author mt | ||
| 318 | + * @Date 2024-10-11 | ||
| 319 | + */ | ||
| 320 | + int DIGIT_NINETY_ONE = 91; | ||
| 321 | + /** | ||
| 322 | + * @Description 数94 | ||
| 323 | + * @Author mt | ||
| 324 | + * @Date 2024-10-11 | ||
| 325 | + */ | ||
| 326 | + int DIGIT_NINETY_FOUR = 94; | ||
| 327 | + /** | ||
| 328 | + * @Description 数96 | ||
| 329 | + * @Author mt | ||
| 330 | + * @Date 2024-10-11 | ||
| 331 | + */ | ||
| 332 | + int DIGIT_NINETY_SIX = 96; | ||
| 333 | + /** | ||
| 334 | + * @Description 数字100 | ||
| 335 | + * @Author mt | ||
| 336 | + * @Date 2024-10-11 | ||
| 337 | + */ | ||
| 338 | + int DIGIT_ONE_HUNDRED = 100; | ||
| 339 | + | ||
| 340 | + /** | ||
| 341 | + * @Description 数字123 | ||
| 342 | + * @Author mt | ||
| 343 | + * @Date 2024-10-11 | ||
| 344 | + */ | ||
| 345 | + int DIGIT_ONE_HUNDRED_AND_TWENTY_THREE = 123; | ||
| 346 | + /** | ||
| 347 | + * @Description 数字180 | ||
| 348 | + * @Author mt | ||
| 349 | + * @Date 2024-10-11 | ||
| 350 | + */ | ||
| 351 | + int DIGIT_ONE_HUNDRED_AND_EIGHTY = 180; | ||
| 352 | + | ||
| 353 | + /** | ||
| 354 | + * @Description 数字200 | ||
| 355 | + * @Author mt | ||
| 356 | + * @Date 2024-10-11 | ||
| 357 | + */ | ||
| 358 | + int DIGIT_TWO_HUNDRED = 200; | ||
| 359 | + | ||
| 360 | + /** | ||
| 361 | + * @Description 数字255 | ||
| 362 | + * @Author mt | ||
| 363 | + * @Date 2024-10-27 | ||
| 364 | + */ | ||
| 365 | + int DIGIT_TWO_HUNDRED_FIFTY_FIVE = 255; | ||
| 366 | + | ||
| 367 | + /** | ||
| 368 | + * @Description 数字300 | ||
| 369 | + * @Author mt | ||
| 370 | + * @Date 2024-10-27 | ||
| 371 | + */ | ||
| 372 | + int DIGIT_THREE_HUNDRED = 300; | ||
| 373 | + | ||
| 374 | + /** | ||
| 375 | + * @Description 数字365 | ||
| 376 | + * @Author mt | ||
| 377 | + * @Date 2024-10-27 | ||
| 378 | + */ | ||
| 379 | + int DIGIT_THREE_HUNDRED_AND_SIXTY_FIVE = 365; | ||
| 380 | + | ||
| 381 | + /** | ||
| 382 | + * @Description 数字400 | ||
| 383 | + * @Author mt | ||
| 384 | + * @Date 2024-10-27 | ||
| 385 | + */ | ||
| 386 | + int DIGIT_FOUR_HUNDRED = 400; | ||
| 387 | + | ||
| 388 | + int DIGIT_FIVE_HUNDRED = 500; | ||
| 389 | + | ||
| 390 | + /** | ||
| 391 | + * @Description 数字1000 | ||
| 392 | + * @Author mt | ||
| 393 | + * @Date 2024-10-27 | ||
| 394 | + */ | ||
| 395 | + int DIGIT_ONE_THOUSAND = 1000; | ||
| 396 | + | ||
| 397 | + /** | ||
| 398 | + * 5000 | ||
| 399 | + */ | ||
| 400 | + int DIGIT_FIVE_THOUSAND = 5000; | ||
| 401 | + | ||
| 402 | + /** | ||
| 403 | + * 10000 | ||
| 404 | + */ | ||
| 405 | + int DIGIT_TEN_THOUSAND = 10000; | ||
| 406 | + /** | ||
| 407 | + * @Description 数字86400 | ||
| 408 | + * @Author mt | ||
| 409 | + * @Date 2024-10-27 | ||
| 410 | + */ | ||
| 411 | + int DIGIT_EIGHTY_SIX_THOUSAND_AND_FOUR_HUNDRED = 86400; | ||
| 412 | + | ||
| 413 | +//----------------------------------------------------以下为String类型---------------------------------------------------------// | ||
| 414 | + String DIGIT_ZEROZERO_STRING = "00"; | ||
| 415 | + | ||
| 416 | + String DIGIT_ZERO_STRING = "0"; | ||
| 417 | + | ||
| 418 | + String DIGIT_ONE_STRING = "1"; | ||
| 419 | + | ||
| 420 | + String DIGIT_TWO_STRING = "2"; | ||
| 421 | + | ||
| 422 | + String DIGIT_THREE_STRING = "3"; | ||
| 423 | + | ||
| 424 | + String DIGIT_FOUR_STRING = "4"; | ||
| 425 | + | ||
| 426 | + String DIGIT_FIVE_STRING = "5"; | ||
| 427 | + | ||
| 428 | + String DIGIT_SIXTEEN_STRING = "16"; | ||
| 429 | +//----------------------------------------------------以下为BigDecimal类型---------------------------------------------------------// | ||
| 430 | + BigDecimal DIGIT_ZERO_POINT_TWO_BIG = new BigDecimal("0.2"); | ||
| 431 | + BigDecimal DIGIT_TWO_BIG = new BigDecimal("2"); | ||
| 432 | + BigDecimal DIGIT_FIVE_HUNDRED_BIG = new BigDecimal("500"); | ||
| 433 | + BigDecimal DIGIT_ONE_THOUSAND_BIG = new BigDecimal("1000"); | ||
| 434 | + | ||
| 435 | +//----------------------------------------------------以下为BigDecimal类型---------------------------------------------------------// | ||
| 436 | + /** | ||
| 437 | + * @Description 数字0 | ||
| 438 | + * @Author mt | ||
| 439 | + * @Date 2024年10月31日 | ||
| 440 | + */ | ||
| 441 | + long DIGIT_ZERO_LONG = 0L; | ||
| 442 | + /** | ||
| 443 | + * @Description 数字1 | ||
| 444 | + * @Author mt | ||
| 445 | + * @Date 2024年10月31日 | ||
| 446 | + */ | ||
| 447 | + long DIGIT_ONE_LONG = 1L; | ||
| 448 | + | ||
| 449 | + /** | ||
| 450 | + * @Description 数字2 | ||
| 451 | + * @Author mt | ||
| 452 | + * @Date 2024年10月31日 | ||
| 453 | + */ | ||
| 454 | + long DIGIT_TWO_LONG = 2L; | ||
| 455 | + | ||
| 456 | + /** | ||
| 457 | + * @Description 数字3 | ||
| 458 | + * @Author mt | ||
| 459 | + * @Date 2024年10月31日 | ||
| 460 | + */ | ||
| 461 | + long DIGIT_THREE_LONG = 3L; | ||
| 462 | + | ||
| 463 | + /** | ||
| 464 | + * @Description 数字100 | ||
| 465 | + * @Author mt | ||
| 466 | + * @Date 2024年10月31日 | ||
| 467 | + */ | ||
| 468 | + long DIGIT_ONE_HUNDRED_LONG = 100L; | ||
| 469 | +} |
| 1 | +package com.fedex.connect.common.dependencies.data.bo; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.dependencies.util.DateUtil; | ||
| 4 | +import com.fedex.connect.common.model.sys.RedisSlab; | ||
| 5 | + | ||
| 6 | +import java.util.Date; | ||
| 7 | + | ||
| 8 | +public class RedisSlabBo { | ||
| 9 | + | ||
| 10 | + public static RedisSlab toDao(String key, String value, int validDuration){ | ||
| 11 | + RedisSlab dao = new RedisSlab(); | ||
| 12 | + dao.setRedisKey(key); | ||
| 13 | + dao.setRedisMsg(value); | ||
| 14 | + dao.setValidDuration(validDuration != 0 ? Long.valueOf(validDuration) : 0L); | ||
| 15 | + dao.setDisTime(DateUtil.getHoursAgoTime(validDuration)); | ||
| 16 | + dao.setCreateTime(new Date()); | ||
| 17 | + return dao; | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * ID自增 | ||
| 23 | + */ | ||
| 24 | + private Long id; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * Redis key | ||
| 28 | + */ | ||
| 29 | + private String redisKey; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * Redis信息 | ||
| 33 | + */ | ||
| 34 | + private String redisMsg; | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 有效时长 | ||
| 38 | + */ | ||
| 39 | + private Long validDuration; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 失效时间 | ||
| 43 | + */ | ||
| 44 | + private Date disTime; | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 创建时间 | ||
| 48 | + */ | ||
| 49 | + private Date createTime; | ||
| 50 | + | ||
| 51 | + public Long getId() { | ||
| 52 | + return id; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public void setId(Long id) { | ||
| 56 | + this.id = id; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public String getRedisKey() { | ||
| 60 | + return redisKey; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public void setRedisKey(String redisKey) { | ||
| 64 | + this.redisKey = redisKey; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public String getRedisMsg() { | ||
| 68 | + return redisMsg; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public void setRedisMsg(String redisMsg) { | ||
| 72 | + this.redisMsg = redisMsg; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public Long getValidDuration() { | ||
| 76 | + return validDuration; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public void setValidDuration(Long validDuration) { | ||
| 80 | + this.validDuration = validDuration; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public Date getDisTime() { | ||
| 84 | + return disTime; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + public void setDisTime(Date disTime) { | ||
| 88 | + this.disTime = disTime; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public Date getCreateTime() { | ||
| 92 | + return createTime; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + public void setCreateTime(Date createTime) { | ||
| 96 | + this.createTime = createTime; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public RedisSlabBo() { | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + public RedisSlabBo(Long id, String redisKey, String redisMsg, Long validDuration, Date disTime, Date createTime) { | ||
| 103 | + this.id = id; | ||
| 104 | + this.redisKey = redisKey; | ||
| 105 | + this.redisMsg = redisMsg; | ||
| 106 | + this.validDuration = validDuration; | ||
| 107 | + this.disTime = disTime; | ||
| 108 | + this.createTime = createTime; | ||
| 109 | + } | ||
| 110 | +} |
| 1 | +package com.fedex.connect.common.dependencies.enums.sys; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * @Author mt | ||
| 5 | + * @Description 类说明 | ||
| 6 | + * @Date 2024/10/31 | ||
| 7 | + */ | ||
| 8 | +public enum KafkaStatusEnum { | ||
| 9 | + PENDING(0L, "待处理"), | ||
| 10 | + PROCESSED(1L, "已处理"), | ||
| 11 | + PROCESSING_FAILED(2L, "处理失败"); | ||
| 12 | + | ||
| 13 | + private Long code; | ||
| 14 | + private String msg; | ||
| 15 | + | ||
| 16 | + KafkaStatusEnum(Long code, String msg) { | ||
| 17 | + this.code = code; | ||
| 18 | + this.msg = msg; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + public Long getCode() { | ||
| 22 | + return code; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public String getMsg() { | ||
| 26 | + return msg; | ||
| 27 | + } | ||
| 28 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | -package com.fedex.connect.common.dependencies; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.common.dependencies.repository.base; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.dao.sys.RedisSlabMapper; | ||
| 4 | +import com.fedex.connect.common.dependencies.repository.dao.UserMapperExt; | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | + | ||
| 7 | +public class BaseDao { | ||
| 8 | + @Autowired | ||
| 9 | + public UserMapperExt userMapperExt; | ||
| 10 | + @Autowired | ||
| 11 | + public RedisSlabMapper redisSlabMapper; | ||
| 12 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.common.dependencies.repository.dao; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.User; | ||
| 4 | +import org.apache.ibatis.annotations.Mapper; | ||
| 5 | +import org.apache.ibatis.annotations.Param; | ||
| 6 | +import org.apache.ibatis.annotations.Select; | ||
| 7 | + | ||
| 8 | +@Mapper | ||
| 9 | +public interface UserMapperExt { | ||
| 10 | + @Select( "<script>" + | ||
| 11 | + "select * from T_SYS_USER where ID = #{id} AND STATUS = 1 " + | ||
| 12 | + "</script>") | ||
| 13 | + User findOne(@Param("id") Long id); | ||
| 14 | +} |
| 1 | +package com.fedex.connect.common.dependencies.repository.repo; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.RedisSlab; | ||
| 4 | +import com.fedex.connect.common.model.sys.RedisSlabExample; | ||
| 5 | + | ||
| 6 | +import java.util.List; | ||
| 7 | + | ||
| 8 | +public interface IRedisSlabRepository { | ||
| 9 | + int insert(RedisSlab record); | ||
| 10 | + | ||
| 11 | + List<RedisSlab> selectByExample(RedisSlabExample example); | ||
| 12 | + | ||
| 13 | + int deleteByPrimaryKey(Long id); | ||
| 14 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.common.dependencies.repository.repo.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.dependencies.repository.base.BaseDao; | ||
| 4 | +import com.fedex.connect.common.dependencies.repository.repo.IRedisSlabRepository; | ||
| 5 | +import com.fedex.connect.common.model.sys.RedisSlab; | ||
| 6 | +import com.fedex.connect.common.model.sys.RedisSlabExample; | ||
| 7 | +import org.springframework.stereotype.Repository; | ||
| 8 | + | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +@Repository | ||
| 12 | +public class RedisSlabRepositoryImpl extends BaseDao implements IRedisSlabRepository { | ||
| 13 | + | ||
| 14 | + @Override | ||
| 15 | + public int insert(RedisSlab record) { | ||
| 16 | + return redisSlabMapper.insert(record); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + @Override | ||
| 20 | + public List<RedisSlab> selectByExample(RedisSlabExample example) { | ||
| 21 | + return redisSlabMapper.selectByExample(example); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + @Override | ||
| 25 | + public int deleteByPrimaryKey(Long id) { | ||
| 26 | + return redisSlabMapper.deleteByPrimaryKey(id); | ||
| 27 | + } | ||
| 28 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.common.dependencies.repository.repo.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.dependencies.repository.base.BaseDao; | ||
| 4 | +import com.fedex.connect.common.dependencies.repository.repo.IUserRepository; | ||
| 5 | +import com.fedex.connect.common.model.sys.User; | ||
| 6 | +import org.springframework.stereotype.Repository; | ||
| 7 | + | ||
| 8 | +@Repository | ||
| 9 | +public class UserRepositoryImpl extends BaseDao implements IUserRepository { | ||
| 10 | + | ||
| 11 | + @Override | ||
| 12 | + public User findOne(Long id){ | ||
| 13 | + return this.userMapperExt.findOne(id); | ||
| 14 | + } | ||
| 15 | +} |
| 1 | +package com.fedex.connect.common.dependencies.service.base; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.dependencies.repository.repo.IRedisSlabRepository; | ||
| 4 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @Author mt | ||
| 8 | + * @Description 用于管理公共Service | ||
| 9 | + * @Date 2024/4/18 | ||
| 10 | + */ | ||
| 11 | +public class BaseService { | ||
| 12 | + @Autowired | ||
| 13 | + protected IRedisSlabRepository redisSlabRepository; | ||
| 14 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.common.dependencies.service.sys; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.RedisSlab; | ||
| 4 | + | ||
| 5 | +public interface IRedisSlabService { | ||
| 6 | + Boolean set(String key, String value,int expireTimeH); | ||
| 7 | + | ||
| 8 | + Boolean set(String key, String value); | ||
| 9 | + | ||
| 10 | + RedisSlab get(String key,String value); | ||
| 11 | + | ||
| 12 | + RedisSlab get(String key); | ||
| 13 | + | ||
| 14 | + <T> T get(String key, Class<T> clazz); | ||
| 15 | + | ||
| 16 | + int del(String key); | ||
| 17 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.common.dependencies.service.sys.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.dependencies.data.bo.RedisSlabBo; | ||
| 4 | +import com.fedex.connect.common.dependencies.service.base.BaseService; | ||
| 5 | +import com.fedex.connect.common.dependencies.service.sys.IRedisSlabService; | ||
| 6 | +import com.fedex.connect.common.dependencies.util.GsonUtils; | ||
| 7 | +import com.fedex.connect.common.model.sys.RedisSlab; | ||
| 8 | +import com.fedex.connect.common.model.sys.RedisSlabExample; | ||
| 9 | +import com.google.gson.Gson; | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 12 | +import org.springframework.stereotype.Service; | ||
| 13 | +import org.springframework.transaction.annotation.Transactional; | ||
| 14 | +import org.springframework.util.CollectionUtils; | ||
| 15 | + | ||
| 16 | +import java.util.Optional; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * @Author mt | ||
| 20 | + * @Description 类说明 | ||
| 21 | + * @Date 2024/10/31 | ||
| 22 | + */ | ||
| 23 | +@Service | ||
| 24 | +public class RedisSlabServiceImpl extends BaseService implements IRedisSlabService { | ||
| 25 | + private static Logger logger = LoggerFactory.getLogger(IRedisSlabService.class); | ||
| 26 | + | ||
| 27 | + @Transactional(rollbackFor = Exception.class) | ||
| 28 | + public Boolean set(String key, String value,int expireTimeH) { | ||
| 29 | + RedisSlab dao = RedisSlabBo.toDao(key,value, expireTimeH); | ||
| 30 | + | ||
| 31 | + RedisSlab redisSlab = get(key); | ||
| 32 | + if (redisSlab != null){ | ||
| 33 | + del(key); | ||
| 34 | + } | ||
| 35 | + try { | ||
| 36 | + int ct = redisSlabRepository.insert(dao); | ||
| 37 | + if (ct > 0) { | ||
| 38 | + return true; | ||
| 39 | + } | ||
| 40 | + return false; | ||
| 41 | + } catch (Exception e) { | ||
| 42 | + logger.error("REDIS SLAB 异常 [SET]: " + e); | ||
| 43 | + throw e; | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public Boolean set(String key, String value) { | ||
| 48 | + return set(key,value, 1); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public RedisSlab get(String key,String value){ | ||
| 52 | + try { | ||
| 53 | + RedisSlabExample example = new RedisSlabExample(); | ||
| 54 | + RedisSlabExample.Criteria criteria = example.createCriteria(); | ||
| 55 | + criteria.andRedisKeyEqualTo(key); | ||
| 56 | + criteria.andRedisMsgEqualTo(value); | ||
| 57 | + return CollectionUtils.firstElement(redisSlabRepository.selectByExample(example)); | ||
| 58 | + }catch (Exception e){ | ||
| 59 | + logger.error("REDIS SLAB 异常 [GET]: " + e); | ||
| 60 | + throw e; | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + public RedisSlab get(String key){ | ||
| 65 | + try { | ||
| 66 | + RedisSlabExample example = new RedisSlabExample(); | ||
| 67 | + RedisSlabExample.Criteria criteria = example.createCriteria(); | ||
| 68 | + criteria.andRedisKeyEqualTo(key); | ||
| 69 | + return CollectionUtils.firstElement(redisSlabRepository.selectByExample(example)); | ||
| 70 | + }catch (Exception e){ | ||
| 71 | + logger.error("REDIS SLAB 异常 [GET]: " + e); | ||
| 72 | + throw e; | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public <T> T get(String key, Class<T> clazz) { | ||
| 77 | + try { | ||
| 78 | + RedisSlab redisSlab = get(key); | ||
| 79 | + String str = redisSlab != null ? Optional.ofNullable(redisSlab.getRedisMsg()).orElse(null): null; | ||
| 80 | + T t = GsonUtils.stringToBean(str, clazz); | ||
| 81 | + return t; | ||
| 82 | + }catch (Exception e){ | ||
| 83 | + logger.error("REDIS SLAB 异常 [GET]: " + e); | ||
| 84 | + throw e; | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + @Transactional(rollbackFor = Exception.class) | ||
| 89 | + public int del(String key){ | ||
| 90 | + try { | ||
| 91 | + logger.info("del db redis key:{}",key); | ||
| 92 | + RedisSlab redisSlab = get(key); | ||
| 93 | + logger.info("del db redis key get info:{}", new Gson().toJson(redisSlab)); | ||
| 94 | + if (redisSlab != null){ | ||
| 95 | + logger.info("get info not null"); | ||
| 96 | + int delct = redisSlabRepository.deleteByPrimaryKey(redisSlab.getId()); | ||
| 97 | + logger.info("redisSlabMapper.deleteByPrimaryKey result :{}", delct); | ||
| 98 | + return delct; | ||
| 99 | + } | ||
| 100 | + return 0; | ||
| 101 | + }catch (Exception e){ | ||
| 102 | + logger.error("REDIS SLAB 异常 [DEL]: " + e); | ||
| 103 | + throw e; | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | +} |
server/common-dependencies/src/main/java/com/fedex/connect/common/dependencies/util/JsonToJava.java
0 → 100644
| 1 | +package com.fedex.connect.common.dependencies.util; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 4 | +import com.alibaba.fastjson.serializer.SerializerFeature; | ||
| 5 | +import com.fasterxml.jackson.annotation.JsonInclude; | ||
| 6 | +import com.fasterxml.jackson.core.JsonProcessingException; | ||
| 7 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 8 | + | ||
| 9 | +import java.beans.BeanInfo; | ||
| 10 | +import java.beans.Introspector; | ||
| 11 | +import java.beans.PropertyDescriptor; | ||
| 12 | +import java.io.File; | ||
| 13 | +import java.io.FileOutputStream; | ||
| 14 | +import java.io.OutputStreamWriter; | ||
| 15 | +import java.io.Writer; | ||
| 16 | +import java.lang.reflect.Method; | ||
| 17 | +import java.util.HashMap; | ||
| 18 | +import java.util.List; | ||
| 19 | +import java.util.Map; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * json转java对象 | ||
| 23 | + * mt | ||
| 24 | + * 2023年10月25日17:39:44 | ||
| 25 | + */ | ||
| 26 | +public class JsonToJava { | ||
| 27 | + | ||
| 28 | + /* | ||
| 29 | + Json字符串转Java对象 | ||
| 30 | + */ | ||
| 31 | + public static <T>T parseJsonApi(String jsonStr, Class cla) { | ||
| 32 | + Object jsonRootBean = JSONObject.parseObject(jsonStr, cla); | ||
| 33 | + return (T)jsonRootBean; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + /* | ||
| 37 | + 对象转Json串 | ||
| 38 | + */ | ||
| 39 | + public static String toJson(Object object) { | ||
| 40 | + //String jsonString = new JSONObject().toJSONString(object); | ||
| 41 | + String jsonString = JSONObject.toJSONString(object, SerializerFeature.WriteMapNullValue); | ||
| 42 | + return jsonString; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + public static <T> Map<String, List<String>> json2map(String jsonString) { | ||
| 46 | + ObjectMapper mapper = new ObjectMapper(); | ||
| 47 | + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); | ||
| 48 | + Map map = null; | ||
| 49 | + try { | ||
| 50 | + map = mapper.readValue(jsonString, Map.class); | ||
| 51 | + } catch (JsonProcessingException e) { | ||
| 52 | + throw new RuntimeException(e); | ||
| 53 | + } | ||
| 54 | + return map; | ||
| 55 | + } | ||
| 56 | + /** | ||
| 57 | + * javaBean 转map | ||
| 58 | + */ | ||
| 59 | + public static Map<String, Object> obj2Map(Object obj) { | ||
| 60 | + if (obj == null) { | ||
| 61 | + return null; | ||
| 62 | + } | ||
| 63 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 64 | + try { | ||
| 65 | + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); | ||
| 66 | + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); | ||
| 67 | + for (PropertyDescriptor property : propertyDescriptors) { | ||
| 68 | + String key = property.getName(); | ||
| 69 | + // 过滤class属性 | ||
| 70 | + if (!key.equals("class")) { | ||
| 71 | + // 得到property对应的getter方法 | ||
| 72 | + Method getter = property.getReadMethod(); | ||
| 73 | + Object value = getter.invoke(obj); | ||
| 74 | + map.put(key, value); | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + } catch (Exception e) { | ||
| 78 | + e.printStackTrace(); | ||
| 79 | + } | ||
| 80 | + return map; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + /* | ||
| 84 | + 创建JSON文件 | ||
| 85 | + */ | ||
| 86 | + public static boolean createJsonFile(String jsonString, String filePath, String fileName) { | ||
| 87 | + boolean flag = true; | ||
| 88 | + String fullPath = filePath + File.separator + fileName + ".json"; | ||
| 89 | + | ||
| 90 | + // 生成json格式文件 | ||
| 91 | + try { | ||
| 92 | + // 保证创建一个新文件 | ||
| 93 | + File file = new File(fullPath); | ||
| 94 | + if (!file.getParentFile().exists()) { // 如果父目录不存在,创建父目录 | ||
| 95 | + file.getParentFile().mkdirs(); | ||
| 96 | + } | ||
| 97 | + if (file.exists()) { // 如果已存在,删除旧文件 | ||
| 98 | + file.delete(); | ||
| 99 | + } | ||
| 100 | + file.createNewFile(); | ||
| 101 | + if (jsonString.indexOf("'") != -1) { | ||
| 102 | + //将单引号转义一下,因为JSON串中的字符串类型可以单引号引起来的 | ||
| 103 | + jsonString = jsonString.replaceAll("'", "\\'"); | ||
| 104 | + } | ||
| 105 | + if (jsonString.indexOf("\"") != -1) { | ||
| 106 | + //将双引号转义一下,因为JSON串中的字符串类型可以单引号引起来的 | ||
| 107 | + jsonString = jsonString.replaceAll("\"", "\\\""); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + if (jsonString.indexOf("\r\n") != -1) { | ||
| 111 | + //将回车换行转换一下,因为JSON串中字符串不能出现显式的回车换行 | ||
| 112 | + jsonString = jsonString.replaceAll("\r\n", "\\u000d\\u000a"); | ||
| 113 | + } | ||
| 114 | + if (jsonString.indexOf("\n") != -1) { | ||
| 115 | + //将换行转换一下,因为JSON串中字符串不能出现显式的换行 | ||
| 116 | + jsonString = jsonString.replaceAll("\n", "\\u000a"); | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + // jsonString = JsonFormatTool.formatJson(jsonString); | ||
| 120 | + // 将格式化后的字符串写入文件 | ||
| 121 | + Writer write = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); | ||
| 122 | + write.write(jsonString); | ||
| 123 | + write.flush(); | ||
| 124 | + write.close(); | ||
| 125 | + } catch (Exception e) { | ||
| 126 | + flag = false; | ||
| 127 | + e.printStackTrace(); | ||
| 128 | + } | ||
| 129 | + return flag; | ||
| 130 | + } | ||
| 131 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/common-dependencies/src/main/java/com/fedex/connect/common/dependencies/util/JsonUtils.java
0 → 100644
| 1 | +package com.fedex.connect.common.dependencies.util; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonInclude; | ||
| 4 | +import com.fasterxml.jackson.core.JsonProcessingException; | ||
| 5 | +import com.fasterxml.jackson.core.type.TypeReference; | ||
| 6 | +import com.fasterxml.jackson.databind.DeserializationFeature; | ||
| 7 | +import com.fasterxml.jackson.databind.JavaType; | ||
| 8 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 9 | + | ||
| 10 | +import java.beans.BeanInfo; | ||
| 11 | +import java.beans.Introspector; | ||
| 12 | +import java.beans.PropertyDescriptor; | ||
| 13 | +import java.lang.reflect.Method; | ||
| 14 | +import java.util.ArrayList; | ||
| 15 | +import java.util.HashMap; | ||
| 16 | +import java.util.List; | ||
| 17 | +import java.util.Map; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * @author erry | ||
| 21 | + */ | ||
| 22 | +public class JsonUtils { | ||
| 23 | + | ||
| 24 | + // 定义jackson对象 | ||
| 25 | + private static final ObjectMapper objectMapper = new ObjectMapper(); | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 将对象转换成json字符串。 | ||
| 29 | + * <p>Title: pojoToJson</p> | ||
| 30 | + * <p>Description: </p> | ||
| 31 | + * | ||
| 32 | + * @param data | ||
| 33 | + * @return | ||
| 34 | + */ | ||
| 35 | + public static String objectToJson(Object data) { | ||
| 36 | + try { | ||
| 37 | + String string = objectMapper.writeValueAsString(data); | ||
| 38 | + return string; | ||
| 39 | + } catch (JsonProcessingException e) { | ||
| 40 | + e.printStackTrace(); | ||
| 41 | + } | ||
| 42 | + return null; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * javaBean、列表数组转换为json字符串,忽略空值 | ||
| 47 | + */ | ||
| 48 | + public static String obj2jsonIgnoreNull(Object obj) throws Exception { | ||
| 49 | + ObjectMapper mapper = new ObjectMapper(); | ||
| 50 | + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); | ||
| 51 | + return mapper.writeValueAsString(obj); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * json 转JavaBean | ||
| 56 | + */ | ||
| 57 | + | ||
| 58 | + public static <T> T json2pojo(String jsonString, Class<T> clazz) throws Exception { | ||
| 59 | + objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); | ||
| 60 | + return objectMapper.readValue(jsonString, clazz); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * json字符串转换为map | ||
| 65 | + */ | ||
| 66 | + public static <T> Map<String, Object> json2map(String jsonString) throws Exception { | ||
| 67 | + ObjectMapper mapper = new ObjectMapper(); | ||
| 68 | + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); | ||
| 69 | + return mapper.readValue(jsonString, Map.class); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * json字符串转换为map | ||
| 74 | + */ | ||
| 75 | + public static <T> Map<String, T> json2map(String jsonString, Class<T> clazz) throws Exception { | ||
| 76 | + Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) objectMapper.readValue(jsonString, new TypeReference<Map<String, T>>() { | ||
| 77 | + }); | ||
| 78 | + Map<String, T> result = new HashMap<String, T>(); | ||
| 79 | + for (Map.Entry<String, Map<String, Object>> entry : map.entrySet()) { | ||
| 80 | + result.put(entry.getKey(), map2pojo(entry.getValue(), clazz)); | ||
| 81 | + } | ||
| 82 | + return result; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * 深度转换json成map | ||
| 87 | + * | ||
| 88 | + * @param json | ||
| 89 | + * @return | ||
| 90 | + */ | ||
| 91 | + public static Map<String, Object> json2mapDeeply(String json) throws Exception { | ||
| 92 | + return json2MapRecursion(json, objectMapper); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * 把json解析成list,如果list内部的元素存在jsonString,继续解析 | ||
| 97 | + * | ||
| 98 | + * @param json | ||
| 99 | + * @param mapper 解析工具 | ||
| 100 | + * @return | ||
| 101 | + * @throws Exception | ||
| 102 | + */ | ||
| 103 | + private static List<Object> json2ListRecursion(String json, ObjectMapper mapper) throws Exception { | ||
| 104 | + if (json == null) { | ||
| 105 | + return null; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + List<Object> list = mapper.readValue(json, List.class); | ||
| 109 | + | ||
| 110 | + for (Object obj : list) { | ||
| 111 | + if (obj != null && obj instanceof String) { | ||
| 112 | + String str = (String) obj; | ||
| 113 | + if (str.startsWith("[")) { | ||
| 114 | + obj = json2ListRecursion(str, mapper); | ||
| 115 | + } else if (obj.toString().startsWith("{")) { | ||
| 116 | + obj = json2MapRecursion(str, mapper); | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + return list; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * 把json解析成map,如果map内部的value存在jsonString,继续解析 | ||
| 126 | + * | ||
| 127 | + * @param json | ||
| 128 | + * @param mapper | ||
| 129 | + * @return | ||
| 130 | + * @throws Exception | ||
| 131 | + */ | ||
| 132 | + private static Map<String, Object> json2MapRecursion(String json, ObjectMapper mapper) throws Exception { | ||
| 133 | + if (json == null) { | ||
| 134 | + return null; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + Map<String, Object> map = mapper.readValue(json, Map.class); | ||
| 138 | + | ||
| 139 | + for (Map.Entry<String, Object> entry : map.entrySet()) { | ||
| 140 | + Object obj = entry.getValue(); | ||
| 141 | + if (obj != null && obj instanceof String) { | ||
| 142 | + String str = ((String) obj); | ||
| 143 | + | ||
| 144 | + if (str.startsWith("[")) { | ||
| 145 | + List<?> list = json2ListRecursion(str, mapper); | ||
| 146 | + map.put(entry.getKey(), list); | ||
| 147 | + } else if (str.startsWith("{")) { | ||
| 148 | + Map<String, Object> mapRecursion = json2MapRecursion(str, mapper); | ||
| 149 | + map.put(entry.getKey(), mapRecursion); | ||
| 150 | + } | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + return map; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + /** | ||
| 158 | + * 与javaBean json数组字符串转换为列表 | ||
| 159 | + */ | ||
| 160 | + public static <T> List<T> json2list(String jsonArrayStr, Class<T> clazz) throws Exception { | ||
| 161 | + | ||
| 162 | + JavaType javaType = getCollectionType(ArrayList.class, clazz); | ||
| 163 | + List<T> lst = (List<T>) objectMapper.readValue(jsonArrayStr, javaType); | ||
| 164 | + return lst; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + | ||
| 168 | + /** | ||
| 169 | + * 获取泛型的Collection Type | ||
| 170 | + * | ||
| 171 | + * @param collectionClass 泛型的Collection | ||
| 172 | + * @param elementClasses 元素类 | ||
| 173 | + * @return JavaType Java类型 | ||
| 174 | + * @since 1.0 | ||
| 175 | + */ | ||
| 176 | + public static JavaType getCollectionType(Class<?> collectionClass, Class<?>... elementClasses) { | ||
| 177 | + return objectMapper.getTypeFactory().constructParametricType(collectionClass, elementClasses); | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + | ||
| 181 | + /** | ||
| 182 | + * map 转JavaBean | ||
| 183 | + */ | ||
| 184 | + public static <T> T map2pojo(Map map, Class<T> clazz) { | ||
| 185 | + return objectMapper.convertValue(map, clazz); | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + /** | ||
| 189 | + * map 转json | ||
| 190 | + * | ||
| 191 | + * @param map | ||
| 192 | + * @return | ||
| 193 | + */ | ||
| 194 | + public static String mapToJson(Map map) { | ||
| 195 | + try { | ||
| 196 | + return objectMapper.writeValueAsString(map); | ||
| 197 | + } catch (Exception e) { | ||
| 198 | + e.printStackTrace(); | ||
| 199 | + } | ||
| 200 | + return ""; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + /** | ||
| 204 | + * map 转JavaBean | ||
| 205 | + */ | ||
| 206 | + public static <T> T obj2pojo(Object obj, Class<T> clazz) { | ||
| 207 | + return objectMapper.convertValue(obj, clazz); | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + /** | ||
| 211 | + * javaBean 转map | ||
| 212 | + */ | ||
| 213 | + public static Map<String, Object> pojo2Map(Object obj) { | ||
| 214 | + if (obj == null) { | ||
| 215 | + return null; | ||
| 216 | + } | ||
| 217 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 218 | + try { | ||
| 219 | + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); | ||
| 220 | + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); | ||
| 221 | + for (PropertyDescriptor property : propertyDescriptors) { | ||
| 222 | + String key = property.getName(); | ||
| 223 | + // 过滤class属性 | ||
| 224 | + if (!key.equals("class")) { | ||
| 225 | + // 得到property对应的getter方法 | ||
| 226 | + Method getter = property.getReadMethod(); | ||
| 227 | + Object value = getter.invoke(obj); | ||
| 228 | + map.put(key, value); | ||
| 229 | + } | ||
| 230 | + } | ||
| 231 | + } catch (Exception e) { | ||
| 232 | + e.printStackTrace(); | ||
| 233 | + } | ||
| 234 | + return map; | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + | ||
| 238 | +} |
| ... | @@ -2,9 +2,9 @@ package com.fedex.connect.common.dependencies.util; | ... | @@ -2,9 +2,9 @@ package com.fedex.connect.common.dependencies.util; |
| 2 | 2 | ||
| 3 | import com.fedex.connect.common.dependencies.authentication.SecurityConstants; | 3 | import com.fedex.connect.common.dependencies.authentication.SecurityConstants; |
| 4 | import com.fedex.connect.common.dependencies.contants.RedisConstants; | 4 | import com.fedex.connect.common.dependencies.contants.RedisConstants; |
| 5 | -import com.fedex.export.data.dto.SecurityUserDetails; | 5 | +import com.fedex.connect.common.dependencies.date.dto.SecurityUserDetails; |
| 6 | -import com.fedex.export.repository.dao.SysUserMapperExt; | 6 | +import com.fedex.connect.common.dependencies.repository.repo.IUserRepository; |
| 7 | -import com.fedex.export.repository.entity.SysUser; | 7 | +import com.fedex.connect.common.model.sys.User; |
| 8 | import io.jsonwebtoken.Claims; | 8 | import io.jsonwebtoken.Claims; |
| 9 | import io.jsonwebtoken.Jwts; | 9 | import io.jsonwebtoken.Jwts; |
| 10 | import io.jsonwebtoken.SignatureAlgorithm; | 10 | import io.jsonwebtoken.SignatureAlgorithm; |
| ... | @@ -26,7 +26,7 @@ import java.util.stream.Collectors; | ... | @@ -26,7 +26,7 @@ import java.util.stream.Collectors; |
| 26 | */ | 26 | */ |
| 27 | public class JwtTokenUtils { | 27 | public class JwtTokenUtils { |
| 28 | 28 | ||
| 29 | - private static final SysUserMapperExt sysUserMapper = com.fedex.export.common.util.SpringBeanUtil.getBean(SysUserMapperExt.class); | 29 | + private static final IUserRepository userRepository = SpringBeanUtil.getBean(IUserRepository.class); |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | * 生成足够的安全随机密钥,以适合符合规范的签名 | 32 | * 生成足够的安全随机密钥,以适合符合规范的签名 |
| ... | @@ -44,7 +44,7 @@ public class JwtTokenUtils { | ... | @@ -44,7 +44,7 @@ public class JwtTokenUtils { |
| 44 | .signWith(SECRET_KEY, SignatureAlgorithm.HS256) | 44 | .signWith(SECRET_KEY, SignatureAlgorithm.HS256) |
| 45 | .claim(SecurityConstants.ROLE_CLAIMS, String.join(",", roles)) | 45 | .claim(SecurityConstants.ROLE_CLAIMS, String.join(",", roles)) |
| 46 | .setId(id) | 46 | .setId(id) |
| 47 | - .setIssuer("EXPORT_TW") //证书发行者 | 47 | + .setIssuer("ICLEAR_CONNECT") //证书发行者 |
| 48 | .setIssuedAt(createdDate) | 48 | .setIssuedAt(createdDate) |
| 49 | .setSubject(username) | 49 | .setSubject(username) |
| 50 | .setExpiration(expirationDate) | 50 | .setExpiration(expirationDate) |
| ... | @@ -62,7 +62,7 @@ public class JwtTokenUtils { | ... | @@ -62,7 +62,7 @@ public class JwtTokenUtils { |
| 62 | .signWith(SECRET_KEY, SignatureAlgorithm.HS256) | 62 | .signWith(SECRET_KEY, SignatureAlgorithm.HS256) |
| 63 | .claim(SecurityConstants.ROLE_CLAIMS, String.join(",", roles)) | 63 | .claim(SecurityConstants.ROLE_CLAIMS, String.join(",", roles)) |
| 64 | .setId(id) | 64 | .setId(id) |
| 65 | - .setIssuer("EXPORT_TW") | 65 | + .setIssuer("ICLEAR_CONNECT") |
| 66 | .setIssuedAt(createdDate) | 66 | .setIssuedAt(createdDate) |
| 67 | .setSubject(username) | 67 | .setSubject(username) |
| 68 | .setExpiration(expirationDate) | 68 | .setExpiration(expirationDate) |
| ... | @@ -115,7 +115,7 @@ public class JwtTokenUtils { | ... | @@ -115,7 +115,7 @@ public class JwtTokenUtils { |
| 115 | SecurityUserDetails userDetails = new SecurityUserDetails(); | 115 | SecurityUserDetails userDetails = new SecurityUserDetails(); |
| 116 | userDetails.setId(Long.parseLong(id)); | 116 | userDetails.setId(Long.parseLong(id)); |
| 117 | userDetails.setUsername(userName); | 117 | userDetails.setUsername(userName); |
| 118 | - SysUser user = sysUserMapper.findOne(Long.parseLong(id)); | 118 | + User user = userRepository.findOne(Long.parseLong(id)); |
| 119 | userDetails.setUser(user); | 119 | userDetails.setUser(user); |
| 120 | 120 | ||
| 121 | return new UsernamePasswordAuthenticationToken(userDetails, token, authorities); | 121 | return new UsernamePasswordAuthenticationToken(userDetails, token, authorities); | ... | ... |
| ... | @@ -35,6 +35,11 @@ | ... | @@ -35,6 +35,11 @@ |
| 35 | </dependency> | 35 | </dependency> |
| 36 | <dependency> | 36 | <dependency> |
| 37 | <groupId>com.fedex.connect</groupId> | 37 | <groupId>com.fedex.connect</groupId> |
| 38 | + <artifactId>common-dependencies</artifactId> | ||
| 39 | + <version>1.0.0</version> | ||
| 40 | + </dependency> | ||
| 41 | + <dependency> | ||
| 42 | + <groupId>com.fedex.connect</groupId> | ||
| 38 | <artifactId>base-starter</artifactId> | 43 | <artifactId>base-starter</artifactId> |
| 39 | <version>1.0.0</version> | 44 | <version>1.0.0</version> |
| 40 | <scope>${install.scope}</scope> | 45 | <scope>${install.scope}</scope> | ... | ... |
| 1 | +package com.fedex.connect.kafka; | ||
| 2 | + | ||
| 3 | +import org.mybatis.spring.annotation.MapperScan; | ||
| 4 | +import org.springframework.boot.SpringApplication; | ||
| 5 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| 6 | +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; | ||
| 7 | +import org.springframework.boot.builder.SpringApplicationBuilder; | ||
| 8 | +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | ||
| 9 | +import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
| 10 | +import org.springframework.web.WebApplicationInitializer; | ||
| 11 | +import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
| 12 | + | ||
| 13 | +@SpringBootApplication(exclude = SecurityAutoConfiguration.class) | ||
| 14 | +@MapperScan("com.fedex.connect.kafka.repository.dao") | ||
| 15 | +@EnableTransactionManagement | ||
| 16 | +@EnableSwagger2 | ||
| 17 | +public class KafkaApplication extends SpringBootServletInitializer implements WebApplicationInitializer { | ||
| 18 | + public static void main(String[] args) { | ||
| 19 | + SpringApplication.run(KafkaApplication.class, args); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + @Override | ||
| 23 | + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { | ||
| 24 | + return builder.sources(KafkaApplication.class); | ||
| 25 | + } | ||
| 26 | +} |
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/config/ConsumerThreadHandler.java
0 → 100644
| 1 | +package com.fedex.connect.kafka.config; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.kafka.service.IKafkaDmService; | ||
| 4 | +import org.apache.kafka.clients.CommonClientConfigs; | ||
| 5 | +import org.apache.kafka.clients.consumer.*; | ||
| 6 | +import org.apache.kafka.common.TopicPartition; | ||
| 7 | +import org.apache.kafka.common.config.SaslConfigs; | ||
| 8 | +import org.apache.kafka.common.errors.WakeupException; | ||
| 9 | +import org.apache.kafka.common.serialization.StringDeserializer; | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 12 | + | ||
| 13 | +import java.time.Duration; | ||
| 14 | +import java.util.*; | ||
| 15 | +import java.util.concurrent.ArrayBlockingQueue; | ||
| 16 | +import java.util.concurrent.ExecutorService; | ||
| 17 | +import java.util.concurrent.ThreadPoolExecutor; | ||
| 18 | +import java.util.concurrent.TimeUnit; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * kafka消费handler | ||
| 22 | + * mt | ||
| 23 | + * 2024年10月31日10:19:56 | ||
| 24 | + */ | ||
| 25 | +public class ConsumerThreadHandler{ | ||
| 26 | + private Logger logger = LoggerFactory.getLogger(ConsumerThreadHandler.class); | ||
| 27 | + | ||
| 28 | + KafKaConfig kafKaConfig; | ||
| 29 | + private ExecutorService executors; | ||
| 30 | + private KafkaConsumer<String, String> consumer; | ||
| 31 | + //待提交offset | ||
| 32 | + private final Map<TopicPartition, OffsetAndMetadata> offsets = new HashMap<>(); | ||
| 33 | + private IKafkaDmService kafkaDmService; | ||
| 34 | + | ||
| 35 | + public ConsumerThreadHandler(KafKaConfig kafKaConfig,IKafkaDmService kafkaDmService){ | ||
| 36 | + this.kafKaConfig = kafKaConfig; | ||
| 37 | + this.kafkaDmService = kafkaDmService; | ||
| 38 | + props(); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + public KafkaConsumer<String, String> props() { | ||
| 42 | + Properties props = new Properties(); | ||
| 43 | + //设置Kafka服务器地址 | ||
| 44 | + props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, this.kafKaConfig.getBootstrapServers()); | ||
| 45 | + //# 指定默认消费者group id --> 由于在kafka中,同一组中的consumer不会读取到同一个消息,依靠groud.id设置组名 | ||
| 46 | + props.put(ConsumerConfig.GROUP_ID_CONFIG, this.kafKaConfig.getGroupId()); | ||
| 47 | + //设置数据key的反序列化处理类 | ||
| 48 | + props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); | ||
| 49 | + //设置数据value的反序列化处理类 | ||
| 50 | + props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); | ||
| 51 | + //enable.auto.commit:true --> 设置手动提交offset | ||
| 52 | + props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, this.kafKaConfig.getEnableAutoCommit()); | ||
| 53 | + //#如果'enable.auto.commit'为true,则消费者偏移自动提交给Kafka的频率(以毫秒为单位),默认值为5000。 | ||
| 54 | + props.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, this.kafKaConfig.getAutoCommitInterval()); | ||
| 55 | + props.put(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, "30000"); | ||
| 56 | + //# smallest和largest才有效,如果smallest重新0开始读取,如果是largest从logfile的offset读取。一般情况下我们都是设置smallest | ||
| 57 | + props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, this.kafKaConfig.getAutoOffsetReset()); | ||
| 58 | + //每次kafka消费量 | ||
| 59 | + props.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, this.kafKaConfig.getMaxPollRecordsConfig()); | ||
| 60 | + //kafka配置kerberos,认证必须加 | ||
| 61 | + if("uat".equals(this.kafKaConfig.getSpringProfilesActive())||"prod".equals(this.kafKaConfig.getSpringProfilesActive())){ | ||
| 62 | + props.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SASL_PLAINTEXT"); | ||
| 63 | + props.put(SaslConfigs.SASL_KERBEROS_SERVICE_NAME, "kafka"); | ||
| 64 | + } | ||
| 65 | + consumer = new KafkaConsumer<>(props); | ||
| 66 | + //订阅指定Topic的消息 | ||
| 67 | + consumer.subscribe(Arrays.asList(this.kafKaConfig.getTopic()), new ConsumerRebalanceListener() { | ||
| 68 | + @Override | ||
| 69 | + public void onPartitionsRevoked(Collection<TopicPartition> partitions) { | ||
| 70 | + consumer.commitSync(offsets); | ||
| 71 | + } | ||
| 72 | + @Override | ||
| 73 | + public void onPartitionsAssigned(Collection<TopicPartition> partitions) { | ||
| 74 | + offsets.clear(); | ||
| 75 | + } | ||
| 76 | + }); | ||
| 77 | + return consumer; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * 消费主方法 | ||
| 82 | + */ | ||
| 83 | + public void consume(){ | ||
| 84 | + executors = new ThreadPoolExecutor(this.kafKaConfig.getThreadNum(), this.kafKaConfig.getThreadNum(), 0L, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(1000), new ThreadPoolExecutor.CallerRunsPolicy()); | ||
| 85 | + try { | ||
| 86 | + while(true) { | ||
| 87 | + ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(1000)); | ||
| 88 | + if(!records.isEmpty()) { | ||
| 89 | + executors.submit(new ConsumerWorker<>(records,this.offsets,this.kafkaDmService)); | ||
| 90 | + } | ||
| 91 | + commitOffsets(); | ||
| 92 | + } | ||
| 93 | + } catch (WakeupException e) { | ||
| 94 | + logger.error("consume() error:{}",e); | ||
| 95 | + } finally { | ||
| 96 | + commitOffsets(); | ||
| 97 | + consumer.close(); | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * 手动提交offset | ||
| 103 | + */ | ||
| 104 | + private void commitOffsets() { | ||
| 105 | + Map<TopicPartition, OffsetAndMetadata> unmodfiedMap; | ||
| 106 | + synchronized (offsets) { | ||
| 107 | + if(offsets.isEmpty()) { | ||
| 108 | + return; | ||
| 109 | + } | ||
| 110 | + unmodfiedMap = Collections.unmodifiableMap(new HashMap<>(offsets)); | ||
| 111 | + offsets.clear(); | ||
| 112 | + } | ||
| 113 | + try { | ||
| 114 | + consumer.commitSync(unmodfiedMap); | ||
| 115 | + }catch (Exception e){ | ||
| 116 | + logger.error("consumer.commitSync() error:",e); | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/config/ConsumerWorker.java
0 → 100644
| 1 | +package com.fedex.connect.kafka.config; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 4 | +import com.fedex.connect.common.dependencies.contants.DigitConstants; | ||
| 5 | +import com.fedex.connect.common.dependencies.enums.sys.KafkaStatusEnum; | ||
| 6 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 7 | +import com.fedex.connect.kafka.constants.Constant; | ||
| 8 | +import com.fedex.connect.kafka.service.IKafkaDmService; | ||
| 9 | +import org.apache.kafka.clients.consumer.ConsumerRecord; | ||
| 10 | +import org.apache.kafka.clients.consumer.ConsumerRecords; | ||
| 11 | +import org.apache.kafka.clients.consumer.OffsetAndMetadata; | ||
| 12 | +import org.apache.kafka.common.TopicPartition; | ||
| 13 | +import org.slf4j.Logger; | ||
| 14 | +import org.slf4j.LoggerFactory; | ||
| 15 | + | ||
| 16 | +import java.util.*; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * 消费者线程 | ||
| 20 | + * mt | ||
| 21 | + * 2024年10月31日10:20:04 | ||
| 22 | + */ | ||
| 23 | +public class ConsumerWorker<K, V> implements Runnable { | ||
| 24 | + private Logger logger = LoggerFactory.getLogger(ConsumerWorker.class); | ||
| 25 | + | ||
| 26 | + private final ConsumerRecords<K, V> records; | ||
| 27 | + private final IKafkaDmService kafkaDmService; | ||
| 28 | + //处理消息类 | ||
| 29 | + private final List<String> dmKeys = new ArrayList<>(); | ||
| 30 | + //记录已消费的offset | ||
| 31 | + private final Map<TopicPartition, OffsetAndMetadata> offsets; | ||
| 32 | + | ||
| 33 | + public ConsumerWorker(ConsumerRecords<K, V> records, Map<TopicPartition, OffsetAndMetadata> offsets, IKafkaDmService kafkaDmService) { | ||
| 34 | + this.records = records; | ||
| 35 | + this.offsets = offsets; | ||
| 36 | + this.kafkaDmService = kafkaDmService; | ||
| 37 | + dmKeys.add(Constant.KAFKA_KEYS.DM501); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public void run() { | ||
| 42 | + try{ | ||
| 43 | + Map<String,List<String>> messageMap = new HashMap<String,List<String>>(); | ||
| 44 | + for (TopicPartition partition : records.partitions()) { | ||
| 45 | + List<ConsumerRecord<K, V>> partitionRecords = records.records(partition); | ||
| 46 | + //存储待处理数据 | ||
| 47 | + List<KafkaTemporaryStorage> kafkaTemporaryStorageList = new ArrayList<>(); | ||
| 48 | + for (ConsumerRecord<K, V> record : partitionRecords) { | ||
| 49 | + //1、处理消息 | ||
| 50 | + String message = (String) record.value(); | ||
| 51 | +// logger.info(String.format("接收到消息 topic=%s, partition=%d, offset=%d ,value=%s", record.topic(), record.partition(), record.offset(),message)); | ||
| 52 | + try{ | ||
| 53 | + KafkaTemporaryStorage kafkaTemporaryStorage = JSONObject.parseObject(message, KafkaTemporaryStorage.class); | ||
| 54 | + //判断消息接收方是否为出口dm数据,初始化数据 | ||
| 55 | + if(isExpDmData(kafkaTemporaryStorage)){ | ||
| 56 | + //设置消息状态为待处理 | ||
| 57 | + kafkaTemporaryStorage.setStatus(KafkaStatusEnum.PENDING.getCode()); | ||
| 58 | + //设置入库时间 | ||
| 59 | + kafkaTemporaryStorage.setCreateTime(new Date()); | ||
| 60 | + //设置处理次数初始为0次 | ||
| 61 | + kafkaTemporaryStorage.setFrequency(DigitConstants.DIGIT_ZERO_LONG); | ||
| 62 | + //设置消息字符串 | ||
| 63 | + kafkaTemporaryStorage.setMessage(message); | ||
| 64 | + kafkaTemporaryStorageList.add(kafkaTemporaryStorage); | ||
| 65 | + } | ||
| 66 | + }catch(Exception ex){ | ||
| 67 | + //处理出现异常将异常消息写入日志中 | ||
| 68 | + logger.error("监听获取kafka消息处理失败 JSONObject.parseObject:" + ex.getMessage() + ",message :" + message, ex); | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + //数据下发 | ||
| 73 | + this.dataDistribution(partition,partitionRecords,kafkaTemporaryStorageList,messageMap); | ||
| 74 | + } | ||
| 75 | + //数据下发 | ||
| 76 | + kafkaDmService.pushMessageList(messageMap); | ||
| 77 | + }catch (Exception e){ | ||
| 78 | + logger.error("ConsumerWorker() error:{}",e); | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * 数据下发至指定业务模块进行处理 | ||
| 84 | + * @param partition | ||
| 85 | + * @param partitionRecords | ||
| 86 | + * @param kafkaTemporaryStorageList | ||
| 87 | + * @param messageMap | ||
| 88 | + */ | ||
| 89 | + private void dataDistribution(TopicPartition partition, | ||
| 90 | + List<ConsumerRecord<K, V>> partitionRecords, | ||
| 91 | + List<KafkaTemporaryStorage> kafkaTemporaryStorageList | ||
| 92 | + ,Map<String,List<String>> messageMap){ | ||
| 93 | + boolean result = false; | ||
| 94 | + try { | ||
| 95 | + if(kafkaTemporaryStorageList.size() > 0){ | ||
| 96 | + //批量保存消息,并将保存后的id更新至消息ID中 | ||
| 97 | + List<KafkaTemporaryStorage> storageList = kafkaDmService.saveKafkaTemporaryStorageAll(kafkaTemporaryStorageList); | ||
| 98 | + storageList.forEach(k -> { | ||
| 99 | + try { | ||
| 100 | + //将kafka临时表id追加至kafka json字符串中 | ||
| 101 | + String msg = kafkaDmService.addKafkaTempId(k.getMessage(), k.getId()); | ||
| 102 | + //将数据封装至map中 | ||
| 103 | + kafkaDmService.pushMessageMap(k.getMessageCode(), msg, messageMap); | ||
| 104 | + }catch(Exception ex){ | ||
| 105 | + //处理出现异常将异常消息写入日志中 | ||
| 106 | + logger.error("kafka消息下发处理失败 addKafkaTempId:" + ex.getMessage(), ex); | ||
| 107 | + } | ||
| 108 | + }); | ||
| 109 | + } | ||
| 110 | + result = true; | ||
| 111 | + }catch(Exception ex){ | ||
| 112 | + //处理出现异常将异常消息写入日志中 | ||
| 113 | + logger.error("kafka消息下发处理失败 dataDistribution:" + ex.getMessage(), ex); | ||
| 114 | + }finally{ | ||
| 115 | + kafkaTemporaryStorageList.clear(); | ||
| 116 | + //正常处理完成,则记录offsets | ||
| 117 | + if(result) { | ||
| 118 | + // offset+1 | ||
| 119 | + long lastOffset = partitionRecords.get(partitionRecords.size() - 1).offset(); | ||
| 120 | + synchronized (offsets) { | ||
| 121 | + if (!offsets.containsKey(partition)) { | ||
| 122 | + offsets.put(partition, new OffsetAndMetadata(lastOffset + 1)); | ||
| 123 | + } else { | ||
| 124 | + long curr = offsets.get(partition).offset(); | ||
| 125 | + if (curr <= lastOffset + 1) { | ||
| 126 | + offsets.put(partition, new OffsetAndMetadata(lastOffset + 1)); | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + /** | ||
| 135 | + * 判断消息接收方是否为出口dm数据 | ||
| 136 | + * 判断消息发出方,消息接收方,消息类型是否满足要求 | ||
| 137 | + * @return | ||
| 138 | + */ | ||
| 139 | + private boolean isExpDmData(KafkaTemporaryStorage kafKaTemporaryStorage){ | ||
| 140 | + if(kafKaTemporaryStorage.getSenderId().equals(Constant.KAFKA_KEYS.SENDER_ID) | ||
| 141 | + && kafKaTemporaryStorage.getReceiverId().equals(Constant.KAFKA_KEYS.RECEIVER_ID) | ||
| 142 | + && dmKeys.contains(kafKaTemporaryStorage.getMessageCode())){ | ||
| 143 | + return true; | ||
| 144 | + }else{ | ||
| 145 | + return false; | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | +} |
| 1 | +package com.fedex.connect.kafka.config; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +@Data | ||
| 6 | +public class KafKaConfig { | ||
| 7 | + public KafKaConfig(String bootstrapServers, | ||
| 8 | + String groupId, | ||
| 9 | + String topic, | ||
| 10 | + String enableAutoCommit, | ||
| 11 | + String autoCommitInterval, | ||
| 12 | + String autoOffsetReset, | ||
| 13 | + String springProfilesActive, | ||
| 14 | + Integer maxPollRecordsConfig, | ||
| 15 | + Integer threadNum) { | ||
| 16 | + this.bootstrapServers = bootstrapServers; | ||
| 17 | + this.groupId = groupId; | ||
| 18 | + this.topic = topic; | ||
| 19 | + this.enableAutoCommit = enableAutoCommit; | ||
| 20 | + this.autoCommitInterval = autoCommitInterval; | ||
| 21 | + this.autoOffsetReset = autoOffsetReset; | ||
| 22 | + this.springProfilesActive = springProfilesActive; | ||
| 23 | + this.maxPollRecordsConfig = maxPollRecordsConfig; | ||
| 24 | + this.threadNum = threadNum; | ||
| 25 | + } | ||
| 26 | + private String bootstrapServers; | ||
| 27 | + private String groupId; | ||
| 28 | + private String topic; | ||
| 29 | + private String enableAutoCommit; | ||
| 30 | + private String autoCommitInterval; | ||
| 31 | + private String autoOffsetReset; | ||
| 32 | + private String springProfilesActive; | ||
| 33 | + private Integer maxPollRecordsConfig; | ||
| 34 | + private Integer threadNum; | ||
| 35 | +} |
| 1 | +package com.fedex.connect.kafka.config; | ||
| 2 | + | ||
| 3 | +import org.springframework.context.annotation.Bean; | ||
| 4 | +import org.springframework.context.annotation.Configuration; | ||
| 5 | +import org.springframework.context.annotation.Profile; | ||
| 6 | +import springfox.documentation.builders.ApiInfoBuilder; | ||
| 7 | +import springfox.documentation.builders.PathSelectors; | ||
| 8 | +import springfox.documentation.builders.RequestHandlerSelectors; | ||
| 9 | +import springfox.documentation.service.ApiInfo; | ||
| 10 | +import springfox.documentation.service.ApiKey; | ||
| 11 | +import springfox.documentation.service.AuthorizationScope; | ||
| 12 | +import springfox.documentation.service.SecurityReference; | ||
| 13 | +import springfox.documentation.spi.DocumentationType; | ||
| 14 | +import springfox.documentation.spi.service.contexts.SecurityContext; | ||
| 15 | +import springfox.documentation.spring.web.plugins.Docket; | ||
| 16 | +import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
| 17 | + | ||
| 18 | +import java.util.ArrayList; | ||
| 19 | +import java.util.List; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * SwaggerConfig配置类.开启Swagger2,自动生成文档 | ||
| 23 | + * | ||
| 24 | + * @author EDY | ||
| 25 | + */ | ||
| 26 | +@Configuration | ||
| 27 | +@EnableSwagger2 | ||
| 28 | +@Profile({"dev", "test", "uat"}) | ||
| 29 | +public class SwaggerConfig { | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 扫描Controller包的路径 | ||
| 33 | + */ | ||
| 34 | + public static final String BASE_PACKAGE = "com.fedex.export.controller"; | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * API信息 | ||
| 38 | + */ | ||
| 39 | + public static final String API_INFO = "Export TW APIs"; | ||
| 40 | + public static final String API_VERSION = "1.0"; | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 创建API应用 | ||
| 44 | + * | ||
| 45 | + * @return | ||
| 46 | + */ | ||
| 47 | + @Bean | ||
| 48 | + public Docket restApi() { | ||
| 49 | + return new Docket(DocumentationType.SWAGGER_2) | ||
| 50 | + .apiInfo(apiInfo(API_INFO, API_VERSION)) | ||
| 51 | + .useDefaultResponseMessages(true) | ||
| 52 | + .forCodeGeneration(false) | ||
| 53 | + .select() | ||
| 54 | + // 扫描指定目录的API | ||
| 55 | + .apis(RequestHandlerSelectors.basePackage(BASE_PACKAGE)) | ||
| 56 | + .paths(PathSelectors.any()) | ||
| 57 | + .build() | ||
| 58 | + //配置全局io.swagger.model | ||
| 59 | + .securitySchemes(securitySchemes()) | ||
| 60 | + //配置将安全上下文应用于哪些api操作(通过正则表达式模式)和HTTP方法 | ||
| 61 | + .securityContexts(securityContexts()); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * API的基本信息 | ||
| 66 | + * | ||
| 67 | + * @return | ||
| 68 | + */ | ||
| 69 | + private ApiInfo apiInfo(String title, String version) { | ||
| 70 | + return new ApiInfoBuilder().title(title).description(API_INFO).version(version).build(); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + private List<ApiKey> securitySchemes() { | ||
| 74 | + List<ApiKey> apiKeys = new ArrayList<>(); | ||
| 75 | + /*SecurityConstants.TOKEN_HEADER*/ | ||
| 76 | + apiKeys.add(new ApiKey("Authorization", "Authorization", "header")); | ||
| 77 | + return apiKeys; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + private List<SecurityContext> securityContexts() { | ||
| 81 | + List<SecurityContext> securityContexts = new ArrayList<>(); | ||
| 82 | + securityContexts.add(SecurityContext.builder() | ||
| 83 | + .securityReferences(defaultAuth()) | ||
| 84 | + //指定/auth 请求下不会携带全局参数 | ||
| 85 | + .forPaths(PathSelectors.regex("^(?!/auth).*$")).build()); | ||
| 86 | + return securityContexts; | ||
| 87 | + } | ||
| 88 | + private List<SecurityReference> defaultAuth() { | ||
| 89 | + AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); | ||
| 90 | + AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; | ||
| 91 | + authorizationScopes[0] = authorizationScope; | ||
| 92 | + List<SecurityReference> securityReferences = new ArrayList<>(); | ||
| 93 | + securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); | ||
| 94 | + return securityReferences; | ||
| 95 | + } | ||
| 96 | +} |
| 1 | +package com.fedex.connect.kafka.config.producer;//package com.fedex.export.config.producer; | ||
| 2 | +// | ||
| 3 | +//import org.apache.kafka.clients.CommonClientConfigs; | ||
| 4 | +//import org.apache.kafka.clients.producer.KafkaProducer; | ||
| 5 | +//import org.apache.kafka.clients.producer.ProducerConfig; | ||
| 6 | +//import org.apache.kafka.common.config.SaslConfigs; | ||
| 7 | +//import org.apache.kafka.common.serialization.StringSerializer; | ||
| 8 | +//import org.slf4j.Logger; | ||
| 9 | +//import org.slf4j.LoggerFactory; | ||
| 10 | +//import org.springframework.beans.factory.annotation.Value; | ||
| 11 | +//import org.springframework.context.annotation.Bean; | ||
| 12 | +//import org.springframework.context.annotation.Configuration; | ||
| 13 | +//import java.util.Properties; | ||
| 14 | +// | ||
| 15 | +//@Configuration | ||
| 16 | +//public class KafkaProducerConfig { | ||
| 17 | +// private Logger logger = LoggerFactory.getLogger(KafkaProducerConfig.class); | ||
| 18 | +// | ||
| 19 | +// @Value("${spring.kafka.bootstrap-servers}") | ||
| 20 | +// private String bootstrapServers; | ||
| 21 | +// @Value("${spring.kafka.producer.acks}") | ||
| 22 | +// private String acks; | ||
| 23 | +// @Value("${spring.kafka.producer.retries}") | ||
| 24 | +// private Integer retries; | ||
| 25 | +// @Value("${spring.kafka.producer.batch-size}") | ||
| 26 | +// private Integer batchSize; | ||
| 27 | +// @Value("${spring.kafka.producer.properties.linger.ms}") | ||
| 28 | +// private Integer lingerMs; | ||
| 29 | +// @Value("${spring.kafka.producer.buffer-memory}") | ||
| 30 | +// private Integer bufferMemory; | ||
| 31 | +// @Value("${spring.kafka.producer.properties.max.block.ms}") | ||
| 32 | +// private Integer blockMs; | ||
| 33 | +// @Value("${spring.profiles.env}") | ||
| 34 | +// private String springProfilesActive; | ||
| 35 | +// @Value("${spring.kafka.iclear-kerberos-jaasPath}") | ||
| 36 | +// private String iclearKerberosJaasPath; | ||
| 37 | +// @Value("${spring.kafka.iclear-kerberos-krb5}") | ||
| 38 | +// private String iclearKerberosKrb5; | ||
| 39 | +// | ||
| 40 | +// @Bean(destroyMethod = "close") | ||
| 41 | +// public KafkaProducer<String, String> kafkaProducer() { | ||
| 42 | +// try { | ||
| 43 | +// logger.info("init producer kerberos start...."); | ||
| 44 | +// System.setProperty("java.security.auth.login.config",this.iclearKerberosJaasPath); | ||
| 45 | +// System.setProperty("java.security.krb5.conf", this.iclearKerberosKrb5); | ||
| 46 | +// logger.info("init producer kerberos end...."); | ||
| 47 | +// }catch (Exception e){ | ||
| 48 | +// logger.error("init producer kerberos error:{}",e); | ||
| 49 | +// } | ||
| 50 | +// return new KafkaProducer<>(getProps()); | ||
| 51 | +// } | ||
| 52 | +// | ||
| 53 | +// private Properties getProps() { | ||
| 54 | +// Properties props = new Properties(); | ||
| 55 | +// //设置Kafka服务器地址 | ||
| 56 | +// props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, this.bootstrapServers); | ||
| 57 | +// //设置数据key的序列化处理类 | ||
| 58 | +// props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); | ||
| 59 | +// //设置数据value的序列化处理类 | ||
| 60 | +// props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); | ||
| 61 | +// //-1(默认):等待所有follower同步完消息后再发送(绝对不会丢数据) | ||
| 62 | +// props.put(ProducerConfig.ACKS_CONFIG, this.acks); | ||
| 63 | +// //发生错误消息重发次数 | ||
| 64 | +// props.put(ProducerConfig.RETRIES_CONFIG, this.retries); | ||
| 65 | +// //消息累计到batch-size的值后,才会发送消息,默认为16384 | ||
| 66 | +// props.put(ProducerConfig.BATCH_SIZE_CONFIG, this.batchSize); | ||
| 67 | +// //如果kafka迟迟不发送消息(这里指的是消息没堆积到指定数量),那么过了这个时间(单位:毫秒)开始发送 | ||
| 68 | +// props.put(ProducerConfig.LINGER_MS_CONFIG, this.lingerMs); | ||
| 69 | +// //produce积累数据一次发送,缓存大小达到buffer.memory就发送数据 | ||
| 70 | +// props.put(ProducerConfig.BUFFER_MEMORY_CONFIG, this.bufferMemory); | ||
| 71 | +// //控制block的时长,当buffer空间不够或者metadata丢失时产生block | ||
| 72 | +// props.put(ProducerConfig.MAX_BLOCK_MS_CONFIG, this.blockMs); | ||
| 73 | +// //kafka配置kerberos,认证必须加 | ||
| 74 | +// if("uat".equals(springProfilesActive)||"prod".equals(springProfilesActive)){ | ||
| 75 | +// props.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SASL_PLAINTEXT"); | ||
| 76 | +// props.put(SaslConfigs.SASL_KERBEROS_SERVICE_NAME, "kafka"); | ||
| 77 | +// } | ||
| 78 | +// return props; | ||
| 79 | +// } | ||
| 80 | +//} |
| 1 | +package com.fedex.connect.kafka.constants; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * @Author mt | ||
| 5 | + * @Description 类说明 常量接口 | ||
| 6 | + * @Date 2024/4/18 | ||
| 7 | + */ | ||
| 8 | +public interface Constant { | ||
| 9 | + //返回常量 | ||
| 10 | + interface RESULT_KEYS{ | ||
| 11 | + //返回至前端实体对象 | ||
| 12 | + String CONSIGNMENT = "consignment"; | ||
| 13 | + //返回消息 | ||
| 14 | + String MESSAGE = "message"; | ||
| 15 | + //返回消息英文 | ||
| 16 | + String MESSAGE_US = "messageUS"; | ||
| 17 | + //是否成功 | ||
| 18 | + String SUCCESS = "success"; | ||
| 19 | + //是否成功 | ||
| 20 | + String CODE = "code"; | ||
| 21 | + //异常 | ||
| 22 | + String ERROR = "error"; | ||
| 23 | + } | ||
| 24 | + //kafka常量 | ||
| 25 | + interface KAFKA_KEYS{ | ||
| 26 | + //发送程序ID | ||
| 27 | + String SENDER_ID = "DM"; | ||
| 28 | + //接受程序ID | ||
| 29 | + String RECEIVER_ID = "IMP"; | ||
| 30 | + //业务标志DM501 | ||
| 31 | + String DM501 = "DM501"; | ||
| 32 | + } | ||
| 33 | + //地址类型常量 | ||
| 34 | + interface CE_INFO_ADDRESS_KEYS{ | ||
| 35 | + //发件人 | ||
| 36 | + String SHIPPER = "SHIPPER"; | ||
| 37 | + //收件人 | ||
| 38 | + String RECIPIENT = "RECIPIENT"; | ||
| 39 | + //代理人 | ||
| 40 | + String BROKEN = "BROKEN"; | ||
| 41 | + } | ||
| 42 | + //地址类型常量 | ||
| 43 | + interface CE_INFO_KEYS{ | ||
| 44 | + //发件人国家 | ||
| 45 | + String TW = "TW"; | ||
| 46 | + //收件人国家 | ||
| 47 | + String CN = "CN"; | ||
| 48 | + } | ||
| 49 | +} |
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/controller/base/BaseController.java
0 → 100644
| 1 | +package com.fedex.connect.kafka.controller.base; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.kafka.service.IDm501Service; | ||
| 4 | +import com.fedex.connect.kafka.service.IKafkaDmService; | ||
| 5 | +import com.fedex.connect.kafka.service.IKafkaProducerService; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | + | ||
| 10 | +public class BaseController { | ||
| 11 | + public Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 12 | + @Autowired | ||
| 13 | + protected IKafkaDmService kafkaDmService; | ||
| 14 | + @Autowired | ||
| 15 | + protected IDm501Service dm501Service; | ||
| 16 | + @Autowired | ||
| 17 | + protected IKafkaProducerService kafkaProducerService; | ||
| 18 | +} |
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/controller/impl/KafkaController.java
0 → 100644
| 1 | +package com.fedex.connect.kafka.controller.impl; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 4 | +import com.fedex.connect.common.dependencies.util.JsonToJava; | ||
| 5 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 6 | +import com.fedex.connect.kafka.constants.Constant; | ||
| 7 | +import com.fedex.connect.kafka.controller.IKafkaController; | ||
| 8 | +import com.fedex.connect.kafka.controller.base.BaseController; | ||
| 9 | +import io.swagger.annotations.Api; | ||
| 10 | +import io.swagger.annotations.ApiOperation; | ||
| 11 | +import org.springframework.beans.factory.annotation.Value; | ||
| 12 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 13 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 14 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 15 | +import org.springframework.web.bind.annotation.RestController; | ||
| 16 | + | ||
| 17 | +import java.util.ArrayList; | ||
| 18 | +import java.util.HashMap; | ||
| 19 | +import java.util.List; | ||
| 20 | +import java.util.Map; | ||
| 21 | + | ||
| 22 | +@RestController | ||
| 23 | +@RequestMapping(value = "/rpcKafka", name = "kafka生产者发送消息rpc接口") | ||
| 24 | +@Api(value = "KafkaController", tags = {"kafka生产者发送消息rpc接口"}) | ||
| 25 | +public class KafkaController extends BaseController implements IKafkaController { | ||
| 26 | + | ||
| 27 | + @Value("${spring.profiles.env}") | ||
| 28 | + private String env; | ||
| 29 | + | ||
| 30 | + @PostMapping("/rpcKafkaReceive") | ||
| 31 | + @ApiOperation(value = "重新消费dm报文", notes = "重新消费dm报文") | ||
| 32 | + public void rpcKafkaReceive(@RequestBody String json) { | ||
| 33 | + //接收需要重新消费报文 | ||
| 34 | + Map<String, List<String>> map = JsonToJava.json2map(json); | ||
| 35 | + kafkaDmService.pushMessageList(map); | ||
| 36 | + logger.info("已接收需要重新消费dm报文 | 报文为:{}",json); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @PostMapping("/sendDm501") | ||
| 40 | + @ApiOperation(value = "发送DM501", notes = "发送DM501") | ||
| 41 | + public String sendDm001(@RequestBody String json) { | ||
| 42 | + String result = Constant.RESULT_KEYS.SUCCESS; | ||
| 43 | + try { | ||
| 44 | + try { | ||
| 45 | + //把相应的DM501json转换成kafka临时表dto | ||
| 46 | + KafkaTemporaryStorage kafKaTemporaryStorage = JSONObject.parseObject(json, KafkaTemporaryStorage.class); | ||
| 47 | + Map<String, List<String>> map = new HashMap<String,List<String>>(); | ||
| 48 | + List<String> list = new ArrayList<>(); | ||
| 49 | + list.add(json); | ||
| 50 | + map.put(kafKaTemporaryStorage.getMessageCode(),list); | ||
| 51 | + kafkaDmService.pushMessageList(map); | ||
| 52 | + }catch (Exception ex){ | ||
| 53 | + logger.error("DM501监听消息异常:" +ex.getMessage(),ex); | ||
| 54 | + } | ||
| 55 | + }catch(Exception ex){ | ||
| 56 | + logger.error("发送kafka报文Exp失败,{} ",ex.getMessage(),ex); | ||
| 57 | + result = Constant.RESULT_KEYS.ERROR; | ||
| 58 | + }finally{ | ||
| 59 | + String jsonStr = JSONObject.toJSONString(result); | ||
| 60 | + return jsonStr; | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @PostMapping("/sendDmJson") | ||
| 65 | + @ApiOperation(value = "发送kafka报文DmJson内容到kafka", notes = "发送kafka报文DmJson内容到kafka") | ||
| 66 | + public String sendDmJson(@RequestBody String json) { | ||
| 67 | + String result = Constant.RESULT_KEYS.SUCCESS; | ||
| 68 | + try { | ||
| 69 | + if(!env.equals("prod")){ | ||
| 70 | + kafkaProducerService.sendMessage(json); | ||
| 71 | + result = Constant.RESULT_KEYS.SUCCESS; | ||
| 72 | + }else{ | ||
| 73 | + result = "禁止该接口访问!"; | ||
| 74 | + } | ||
| 75 | + }catch(Exception ex){ | ||
| 76 | + logger.error("发送kafka报文DmJson内容到kafka失败,{} ",ex.getMessage(),ex); | ||
| 77 | + result = Constant.RESULT_KEYS.ERROR; | ||
| 78 | + }finally{ | ||
| 79 | + String jsonStr = JSONObject.toJSONString(result); | ||
| 80 | + return jsonStr; | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/data/dto/DmProcessResults.java
0 → 100644
| 1 | +package com.fedex.connect.kafka.data.dto; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * DM处理结果 | ||
| 7 | + * mt | ||
| 8 | + * 2022年11月15日17:21:13 | ||
| 9 | + */ | ||
| 10 | +@Data | ||
| 11 | +public class DmProcessResults { | ||
| 12 | + //处理结果 | ||
| 13 | + boolean resultFlag = true; | ||
| 14 | + //处理返回信息 | ||
| 15 | + String result; | ||
| 16 | + //运单号 | ||
| 17 | + private String consignmentCode; | ||
| 18 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.kafka.data.dto.dm.dm501; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @Author mt | ||
| 7 | + * @Description 地址信息 | ||
| 8 | + * @Date 2024/4/19 | ||
| 9 | + */ | ||
| 10 | +@Data | ||
| 11 | +public class Dm501ConAddresses { | ||
| 12 | + //类型 | ||
| 13 | + String type; | ||
| 14 | + //账号 | ||
| 15 | + String account; | ||
| 16 | + //公司名称 | ||
| 17 | + String companyName; | ||
| 18 | + //地址行1 | ||
| 19 | + String addressDesc1; | ||
| 20 | + //地址行2 | ||
| 21 | + String addressDesc2; | ||
| 22 | + //地址行3 | ||
| 23 | + String addressDesc3; | ||
| 24 | + //邮件编码 | ||
| 25 | + String postalCode; | ||
| 26 | + //城市名称 | ||
| 27 | + String cityName; | ||
| 28 | + //国家 | ||
| 29 | + String country; | ||
| 30 | + //省/州 | ||
| 31 | + String stateCode; | ||
| 32 | + //联系人姓名 | ||
| 33 | + String contactName; | ||
| 34 | + //联系人电话 | ||
| 35 | + String contactPhoneNumber; | ||
| 36 | +} |
| 1 | +package com.fedex.connect.kafka.data.dto.dm.dm501; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @Author mt | ||
| 7 | + * @Description 商品明细 | ||
| 8 | + * @Date 2024/4/19 | ||
| 9 | + */ | ||
| 10 | +@Data | ||
| 11 | +public class Dm501ConCommodities { | ||
| 12 | + //商品金额 | ||
| 13 | + String commodityAmount; | ||
| 14 | + //商品货币代码 | ||
| 15 | + String commodityCurrency; | ||
| 16 | + //商品数量单位 | ||
| 17 | + String commodityQtyUnit; | ||
| 18 | + //商品数量 | ||
| 19 | + String commodityQuantity; | ||
| 20 | + //货品名称 | ||
| 21 | + String contentDescription; | ||
| 22 | + //商品原产国 | ||
| 23 | + String countryOfManufacture; | ||
| 24 | + //海关货币代码 | ||
| 25 | + String customsCurrency; | ||
| 26 | + //该货品申报价值 | ||
| 27 | + String customsValue; | ||
| 28 | + //HS Code | ||
| 29 | + String hsCode; | ||
| 30 | + //件数 | ||
| 31 | + String pieces; | ||
| 32 | + //商品重量 | ||
| 33 | + String weight; | ||
| 34 | + //商品重量单位 | ||
| 35 | + String weightUnit; | ||
| 36 | +} |
| 1 | +package com.fedex.connect.kafka.data.dto.dm.dm501; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @Author mt | ||
| 7 | + * @Description 特殊要求代码 | ||
| 8 | + * @Date 2024/4/19 | ||
| 9 | + */ | ||
| 10 | +@Data | ||
| 11 | +public class Dm501ConHandlingCodes { | ||
| 12 | + //特殊要求代码 | ||
| 13 | + String specialHandlingCd; | ||
| 14 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/data/dto/dm/dm501/Dm501ConItems.java
0 → 100644
| 1 | +package com.fedex.connect.kafka.data.dto.dm.dm501; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @Author mt | ||
| 7 | + * @Description 子件信息 | ||
| 8 | + * @Date 2024/4/19 | ||
| 9 | + */ | ||
| 10 | +@Data | ||
| 11 | +public class Dm501ConItems { | ||
| 12 | + //-- | ||
| 13 | + String associationType; | ||
| 14 | + //母单号下的关系代码 | ||
| 15 | + String relationshipCd; | ||
| 16 | + //件号/第几件 | ||
| 17 | + String shipmentPkgNumber; | ||
| 18 | +} |
| 1 | +package com.fedex.connect.kafka.data.dto.dm.dm501; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import java.io.Serializable; | ||
| 6 | +import java.util.Date; | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @Author mt | ||
| 11 | + * @Description DM501运单部分 | ||
| 12 | + * @Date 2024/4/19 | ||
| 13 | + */ | ||
| 14 | +@Data | ||
| 15 | +public class Dm501Consignments implements Serializable { | ||
| 16 | + //运单号 | ||
| 17 | + String trackingNumber; | ||
| 18 | + //参考信息 | ||
| 19 | + String shipperReferenceNotes; | ||
| 20 | + //运费付款人 | ||
| 21 | + String paymentPayorCode; | ||
| 22 | + //Billing Account付费方账号 | ||
| 23 | + String billToAccountNumber; | ||
| 24 | + //税金费用付款人 | ||
| 25 | + String dutyTaxPayorCode; | ||
| 26 | + //税金费用Fedex 账号 | ||
| 27 | + String dutyTaxPayorAccount; | ||
| 28 | + //文件或包裹 | ||
| 29 | + String docNondocFlag; | ||
| 30 | + //件数 | ||
| 31 | + String quantity; | ||
| 32 | + //初始站点 | ||
| 33 | + String originStation; | ||
| 34 | + //目的地站点 | ||
| 35 | + String destStation; | ||
| 36 | + //申报货币 | ||
| 37 | + String customsCurrency; | ||
| 38 | + //申报价值 | ||
| 39 | + String customsValue; | ||
| 40 | + //申报重量 | ||
| 41 | + String weight; | ||
| 42 | + //申报重量单位 | ||
| 43 | + String weightUnit; | ||
| 44 | + //预计取件时间 | ||
| 45 | + String shipDate; | ||
| 46 | + //Form CD | ||
| 47 | + String formCd; | ||
| 48 | + //始发国口岸代码 | ||
| 49 | + String originIataCode; | ||
| 50 | + //目的国口岸代码 | ||
| 51 | + String destIataCode; | ||
| 52 | + //扫描状态日期 | ||
| 53 | + Date scanDate; | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * @Author mt | ||
| 57 | + * @Description 地址信息 | ||
| 58 | + * @Date 2024/4/19 | ||
| 59 | + */ | ||
| 60 | + List<Dm501ConAddresses> addresses; | ||
| 61 | + /** | ||
| 62 | + * @Author mt | ||
| 63 | + * @Description 商品明细 | ||
| 64 | + * @Date 2024/4/19 | ||
| 65 | + */ | ||
| 66 | + List<Dm501ConCommodities> commodities; | ||
| 67 | + /** | ||
| 68 | + * @Author mt | ||
| 69 | + * @Description 子件信息 | ||
| 70 | + * @Date 2024/4/19 | ||
| 71 | + */ | ||
| 72 | + List<Dm501ConItems> items; | ||
| 73 | + /** | ||
| 74 | + * @Author mt | ||
| 75 | + * @Description 特殊要求代码 | ||
| 76 | + * @Date 2024/4/19 | ||
| 77 | + */ | ||
| 78 | + List<Dm501ConHandlingCodes> handlingCodes; | ||
| 79 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/data/dto/dm/dm501/Dm501Data.java
0 → 100644
| 1 | +package com.fedex.connect.kafka.data.dto.dm.dm501; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import java.io.Serializable; | ||
| 6 | +import java.util.List; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @Author mt | ||
| 10 | + * @Description DM501 data | ||
| 11 | + * @Date 2024/4/19 | ||
| 12 | + */ | ||
| 13 | +@Data | ||
| 14 | +public class Dm501Data implements Serializable { | ||
| 15 | + private List<Dm501Consignments> consignments; | ||
| 16 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.kafka.init; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.kafka.config.ConsumerThreadHandler; | ||
| 4 | +import com.fedex.connect.kafka.config.KafKaConfig; | ||
| 5 | +import com.fedex.connect.kafka.service.IKafkaDmService; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.beans.factory.annotation.Value; | ||
| 10 | +import org.springframework.boot.CommandLineRunner; | ||
| 11 | +import org.springframework.core.annotation.Order; | ||
| 12 | +import org.springframework.stereotype.Component; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 系统初始化类 | ||
| 16 | + * mt | ||
| 17 | + * 2022年11月21日18:53:41 | ||
| 18 | + */ | ||
| 19 | +@Component | ||
| 20 | +@Order(value = 1) | ||
| 21 | +public class SystemInit implements CommandLineRunner { | ||
| 22 | + | ||
| 23 | + private Logger logger = LoggerFactory.getLogger(SystemInit.class); | ||
| 24 | + @Autowired | ||
| 25 | + private IKafkaDmService kafkaDmService; | ||
| 26 | + | ||
| 27 | + @Value("${spring.profiles.env}") | ||
| 28 | + private String springProfilesActive; | ||
| 29 | + @Value("${spring.kafka.bootstrap-servers}") | ||
| 30 | + private String bootstrapServers; | ||
| 31 | + @Value("${spring.kafka.iclear-kerberos-jaasPath}") | ||
| 32 | + private String iclearKerberosJaasPath; | ||
| 33 | + @Value("${spring.kafka.iclear-kerberos-krb5}") | ||
| 34 | + private String iclearKerberosKrb5; | ||
| 35 | + | ||
| 36 | + @Value("${spring.kafka.consumer.topic-name}") | ||
| 37 | + private String topic; | ||
| 38 | + @Value("${spring.kafka.consumer.group-id}") | ||
| 39 | + private String groupId; | ||
| 40 | + @Value("${spring.kafka.consumer.enable-auto-commit}") | ||
| 41 | + private String enableAutoCommit; | ||
| 42 | + @Value("${spring.kafka.consumer.auto-commit-interval}") | ||
| 43 | + private String autoCommitInterval; | ||
| 44 | + @Value("${spring.kafka.consumer.auto-offset-reset}") | ||
| 45 | + private String autoOffsetReset; | ||
| 46 | + @Value("${spring.kafka.consumer.max-poll-records}") | ||
| 47 | + private Integer maxPollRecordsConfig; | ||
| 48 | + @Value("${spring.kafka.consumer.spring-kafka-threadNum}") | ||
| 49 | + private Integer threadNum; | ||
| 50 | + | ||
| 51 | + @Override | ||
| 52 | + public void run(String... args) throws Exception { | ||
| 53 | + logger.info("init SystemConstant start...."); | ||
| 54 | + //加载kerberos配置文件 | ||
| 55 | + this.loadKerberosConfPath(); | ||
| 56 | + KafKaConfig kafKaConfig = new KafKaConfig( | ||
| 57 | + this.bootstrapServers, | ||
| 58 | + this.groupId, | ||
| 59 | + this.topic, | ||
| 60 | + this.enableAutoCommit, | ||
| 61 | + this.autoCommitInterval, | ||
| 62 | + this.autoOffsetReset, | ||
| 63 | + this.springProfilesActive, | ||
| 64 | + this.maxPollRecordsConfig, | ||
| 65 | + this.threadNum | ||
| 66 | + ); | ||
| 67 | + | ||
| 68 | + //启动kafka消费者 | ||
| 69 | + final ConsumerThreadHandler handler = new ConsumerThreadHandler(kafKaConfig,this.kafkaDmService); | ||
| 70 | + new Thread(() -> handler.consume()).start(); | ||
| 71 | + logger.info("init SystemConstant end...."); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 读取kerberos路径的配置文件,然后根据该文件中的 配置加载kerberos | ||
| 77 | + */ | ||
| 78 | + private void loadKerberosConfPath(){ | ||
| 79 | + try { | ||
| 80 | + logger.info("init consumer kerberos start...."); | ||
| 81 | + System.setProperty("java.security.auth.login.config",this.iclearKerberosJaasPath); | ||
| 82 | + System.setProperty("java.security.krb5.conf", this.iclearKerberosKrb5); | ||
| 83 | + logger.info("init consumer kerberos end...."); | ||
| 84 | + }catch (Exception e){ | ||
| 85 | + logger.error("init consumer kerberos error:{}",e); | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.kafka.listener.dmlistener; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 4 | +import com.fedex.connect.common.model.sys.KafkaStorageHistory; | ||
| 5 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 6 | +import com.fedex.connect.kafka.data.dto.DmProcessResults; | ||
| 7 | +import com.fedex.connect.kafka.listener.DmListenerInterface; | ||
| 8 | +import com.fedex.connect.kafka.service.IDm501Service; | ||
| 9 | +import com.fedex.connect.kafka.service.IKafkaDmService; | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 13 | +import org.springframework.boot.CommandLineRunner; | ||
| 14 | +import org.springframework.stereotype.Component; | ||
| 15 | + | ||
| 16 | +import java.util.List; | ||
| 17 | +import java.util.concurrent.ArrayBlockingQueue; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * @Author mt | ||
| 21 | + * @Description 监听消息队列DM501数据 | ||
| 22 | + * @Date 2024/4/18 | ||
| 23 | + */ | ||
| 24 | +@Component("dm501Listener") | ||
| 25 | +public class Dm501Listener implements DmListenerInterface, CommandLineRunner { | ||
| 26 | + private final Logger logger = LoggerFactory.getLogger(Dm501Listener.class); | ||
| 27 | + | ||
| 28 | + //DM501消息队列 | ||
| 29 | + private static final ArrayBlockingQueue<List<String>> dm501Queue = new ArrayBlockingQueue<List<String>>(50000); | ||
| 30 | + @Autowired | ||
| 31 | + private IKafkaDmService kafkaDmService; | ||
| 32 | + @Autowired | ||
| 33 | + private IDm501Service dm501Service; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 启动监听dm001消息队列 | ||
| 37 | + */ | ||
| 38 | + @Override | ||
| 39 | + public void run(String... args) { | ||
| 40 | + new Thread(() -> { | ||
| 41 | + while(true){ | ||
| 42 | + List<String> messageList = null; | ||
| 43 | + try { | ||
| 44 | + messageList = this.dm501Queue.take(); | ||
| 45 | + messageList.forEach(message ->{ | ||
| 46 | + //把相应的DM004json转换成kafka临时表dto | ||
| 47 | + KafkaTemporaryStorage kafKaTemporaryStorage = JSONObject.parseObject(message, KafkaTemporaryStorage.class); | ||
| 48 | + //将消息转换为kafka历史表对象 | ||
| 49 | + KafkaStorageHistory kafKaStorageHistory = JSONObject.parseObject(message, KafkaStorageHistory.class); | ||
| 50 | + try { | ||
| 51 | + //处理DM501文件 | ||
| 52 | + DmProcessResults processResults = this.dm501Service.dm501Process(kafKaTemporaryStorage); | ||
| 53 | + //kafka临时表转历史表 | ||
| 54 | + this.kafkaDmService.kafkaTemporaryTransferToHistory(processResults,kafKaTemporaryStorage, kafKaStorageHistory); | ||
| 55 | + }catch (Exception ex){ | ||
| 56 | + logger.error("DM501监听消息异常:" +ex.getMessage(),ex); | ||
| 57 | + } | ||
| 58 | + }); | ||
| 59 | + }catch(Exception ex){ | ||
| 60 | + logger.error("DM501监听消息异常:" +ex.getMessage() + ",message : " + messageList,ex); | ||
| 61 | + }finally{ | ||
| 62 | + if(messageList != null){ | ||
| 63 | + messageList.clear(); | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + }).start(); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + @Override | ||
| 71 | + public synchronized void pushMessageList(List<String> messageList) { | ||
| 72 | + dm501Queue.add(messageList); | ||
| 73 | + } | ||
| 74 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | -package com.fedex.connect.kafka; |
| 1 | +package com.fedex.connect.kafka.repository.base; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.dao.biz.CeInfoMapper; | ||
| 4 | +import com.fedex.connect.common.dao.sys.KafkaStorageHistoryMapper; | ||
| 5 | +import com.fedex.connect.common.dao.sys.KafkaTemporaryStorageMapper; | ||
| 6 | +import com.fedex.connect.kafka.repository.dao.CeInfoMapperExt; | ||
| 7 | +import com.fedex.connect.kafka.repository.dao.KafkaTemporaryStorageMapperExt; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | + | ||
| 10 | +public class AbstractDaoRepository { | ||
| 11 | + @Autowired | ||
| 12 | + protected KafkaTemporaryStorageMapper kafkaTemporaryStorageMapper; | ||
| 13 | + @Autowired | ||
| 14 | + protected KafkaStorageHistoryMapper kafkaStorageHistoryMapper; | ||
| 15 | + @Autowired | ||
| 16 | + protected CeInfoMapper ceInfoMapper; | ||
| 17 | + @Autowired | ||
| 18 | + protected CeInfoMapperExt ceInfoMapperExt; | ||
| 19 | + @Autowired | ||
| 20 | + protected KafkaTemporaryStorageMapperExt kafkaTemporaryStorageMapperExt; | ||
| 21 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/repository/dao/CeInfoMapperExt.java
0 → 100644
| 1 | +package com.fedex.connect.kafka.repository.dao; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.biz.CeInfo; | ||
| 4 | +import org.apache.ibatis.annotations.Mapper; | ||
| 5 | +import org.apache.ibatis.annotations.Param; | ||
| 6 | +import org.apache.ibatis.annotations.Select; | ||
| 7 | + | ||
| 8 | +import java.util.Date; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * @Author mt | ||
| 12 | + * @Description CE数据Mapper | ||
| 13 | + * @Date 2024/4/22 | ||
| 14 | + */ | ||
| 15 | +@Mapper | ||
| 16 | +public interface CeInfoMapperExt { | ||
| 17 | + /** | ||
| 18 | + * 获取创建时间为1个月内CE数据 | ||
| 19 | + * @return | ||
| 20 | + */ | ||
| 21 | + @Select( "<script>" + | ||
| 22 | + "SELECT * FROM T_BIZ_CE_INFO WHERE CONSIGNMENT_CODE = #{consignmentCode,jdbcType=VARCHAR} " + | ||
| 23 | + " AND CREATE_TIME > #{curDate,jdbcType=TIMESTAMP} AND ROWNUM <= 1" + | ||
| 24 | + "</script>") | ||
| 25 | + CeInfo findBizCeInfoContainsByConsignmentCode(@Param("consignmentCode") String consignmentCode, @Param("curDate") Date curDate); | ||
| 26 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.kafka.repository.dao; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 4 | +import org.apache.ibatis.annotations.Delete; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | +import org.apache.ibatis.annotations.Param; | ||
| 7 | +import org.apache.ibatis.annotations.Update; | ||
| 8 | + | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * kafka临时表dao | ||
| 13 | + * mt | ||
| 14 | + * 2022年11月3日15:30:53 | ||
| 15 | + */ | ||
| 16 | +@Mapper | ||
| 17 | +public interface KafkaTemporaryStorageMapperExt { | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 根据kafka临时表id更新备注,处理次数,状态为2,处理失败 | ||
| 21 | + * @param id id | ||
| 22 | + * @param consCode | ||
| 23 | + * @param remark | ||
| 24 | + */ | ||
| 25 | + @Update("<script>" + | ||
| 26 | + "UPDATE T_SYS_KAFKA_TEMPORARY_STORAGE " + | ||
| 27 | + "SET STATUS = 2, FREQUENCY = FREQUENCY + 1,CONSIGNMENT_CODE =#{consCode,jdbcType=VARCHAR}, " + | ||
| 28 | + "REMARK =#{remark,jdbcType=VARCHAR} where ID =#{id,jdbcType=NUMERIC}" + | ||
| 29 | + "</script>") | ||
| 30 | + void updateKafkaTemporaryStorageById(@Param("consCode") String consCode | ||
| 31 | + , @Param("remark") String remark | ||
| 32 | + , @Param("id") Long id); | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 根据id删除kafka临时表 | ||
| 36 | + * @param id | ||
| 37 | + * @return | ||
| 38 | + */ | ||
| 39 | + @Delete("<script>" + | ||
| 40 | + "DELETE FROM T_SYS_KAFKA_TEMPORARY_STORAGE WHERE ID = #{id,jdbcType=NUMERIC} " + | ||
| 41 | + "</script>") | ||
| 42 | + void deleteKafkaTemporaryStorageById(@Param("id") Long id); | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 根据集合批量删除kafka临时表 | ||
| 46 | + * @param list | ||
| 47 | + * @return | ||
| 48 | + */ | ||
| 49 | + @Delete("<script>" + | ||
| 50 | + "DELETE T_SYS_KAFKA_TEMPORARY_STORAGE WHERE ID IN\n" + | ||
| 51 | + " <foreach item=\"item\" index=\"index\" collection=\"list\" open=\"(\" separator=\",\" close=\")\">\n" + | ||
| 52 | + " #{item.id}\n" + | ||
| 53 | + " </foreach>" + | ||
| 54 | + "</script>") | ||
| 55 | + int deleteInBatch(@Param("list") List<KafkaTemporaryStorage> list); | ||
| 56 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.kafka.repository.repo; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.biz.CeInfo; | ||
| 4 | + | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @Author mt | ||
| 9 | + * @Description CE数据repository | ||
| 10 | + * @Date 2024/4/22 | ||
| 11 | + */ | ||
| 12 | +public interface ICeInfoRepository { | ||
| 13 | + CeInfo save(CeInfo entity); | ||
| 14 | + void saveAll(List<CeInfo> list); | ||
| 15 | + /** | ||
| 16 | + * @Author mt | ||
| 17 | + * @Description 获取创建时间为1个月内CE数据 | ||
| 18 | + * @Date 2024/4/22 | ||
| 19 | + * @param consignmentCode | ||
| 20 | + * @return com.fedex.export.repository.entity.BizCeInfo | ||
| 21 | + */ | ||
| 22 | + CeInfo findBizCeInfoContainsByConsignmentCode(String consignmentCode); | ||
| 23 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.kafka.repository.repo; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.KafkaStorageHistory; | ||
| 4 | + | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * kafka历史表dao | ||
| 9 | + * mt | ||
| 10 | + * 2022年11月3日15:30:53 | ||
| 11 | + */ | ||
| 12 | +public interface IKafkaStorageHistoryRepository { | ||
| 13 | + KafkaStorageHistory save(KafkaStorageHistory entity); | ||
| 14 | + void saveAll(List<KafkaStorageHistory> list); | ||
| 15 | +} |
| 1 | +package com.fedex.connect.kafka.repository.repo; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 4 | + | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * kafka临时表dao | ||
| 9 | + * mt | ||
| 10 | + * 2022年11月3日15:30:53 | ||
| 11 | + */ | ||
| 12 | +public interface IKafkaTemporaryStorageRepository { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 根据kafka临时表id更新备注,处理次数,状态为2,处理失败 | ||
| 16 | + * @param id id | ||
| 17 | + * @param consCode | ||
| 18 | + * @param remark | ||
| 19 | + */ | ||
| 20 | + void updateKafkaTemporaryStorageById(String consCode, String remark, Long id); | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 根据id删除kafka临时表 | ||
| 24 | + * @param id | ||
| 25 | + * @return | ||
| 26 | + */ | ||
| 27 | + void deleteKafkaTemporaryStorageById(Long id); | ||
| 28 | + int deleteInBatch(List<KafkaTemporaryStorage> list); | ||
| 29 | + List<KafkaTemporaryStorage> saveAll(List<KafkaTemporaryStorage> list); | ||
| 30 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.kafka.repository.repo.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.biz.CeInfo; | ||
| 4 | +import com.fedex.connect.kafka.repository.base.AbstractDaoRepository; | ||
| 5 | +import com.fedex.connect.kafka.repository.repo.ICeInfoRepository; | ||
| 6 | +import org.springframework.stereotype.Repository; | ||
| 7 | + | ||
| 8 | +import java.util.Calendar; | ||
| 9 | +import java.util.Date; | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * @Author mt | ||
| 14 | + * @Description CE数据repository | ||
| 15 | + * @Date 2024/4/22 | ||
| 16 | + */ | ||
| 17 | +@Repository | ||
| 18 | +public class CeInfoRepositoryImpl extends AbstractDaoRepository implements ICeInfoRepository { | ||
| 19 | + @Override | ||
| 20 | + public CeInfo save(CeInfo entity) { | ||
| 21 | + if(entity != null) { | ||
| 22 | + if (entity.getId() == null || entity.getId().longValue() <= 0) { | ||
| 23 | + ceInfoMapper.insertSelective(entity); | ||
| 24 | + } else if (entity.getId() != null && entity.getId().longValue() > 0){ | ||
| 25 | + ceInfoMapper.updateByPrimaryKeySelective(entity); | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | + return entity; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + @Override | ||
| 32 | + public void saveAll(List<CeInfo> list) { | ||
| 33 | + list.stream().forEach(p->{ | ||
| 34 | + if(p.getId() == null || p.getId().longValue() <=0){ | ||
| 35 | + ceInfoMapper.insertSelective(p); | ||
| 36 | + }else if(p.getId() != null && p.getId().longValue() >0){ | ||
| 37 | + ceInfoMapper.updateByPrimaryKeySelective(p); | ||
| 38 | + } | ||
| 39 | + }); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * @Author mt | ||
| 44 | + * @Description 获取创建时间为获取30天内CE数据 | ||
| 45 | + * @Date 2024/4/22 | ||
| 46 | + * @param consignmentCode | ||
| 47 | + * @return com.fedex.export.repository.entity.BizCeInfo | ||
| 48 | + */ | ||
| 49 | + @Override | ||
| 50 | + public CeInfo findBizCeInfoContainsByConsignmentCode(String consignmentCode){ | ||
| 51 | + //获取30天内CE数据 | ||
| 52 | + Calendar calendar = Calendar.getInstance(); | ||
| 53 | + calendar.add(Calendar.DAY_OF_MONTH, -30); | ||
| 54 | + Date thirtyDaysAgo = calendar.getTime(); | ||
| 55 | + return ceInfoMapperExt.findBizCeInfoContainsByConsignmentCode(consignmentCode,thirtyDaysAgo); | ||
| 56 | + } | ||
| 57 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.kafka.repository.repo.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.KafkaStorageHistory; | ||
| 4 | +import com.fedex.connect.kafka.repository.base.AbstractDaoRepository; | ||
| 5 | +import com.fedex.connect.kafka.repository.repo.IKafkaStorageHistoryRepository; | ||
| 6 | +import org.springframework.stereotype.Repository; | ||
| 7 | + | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * kafka历史表dao | ||
| 12 | + * mt | ||
| 13 | + * 2022年11月3日15:30:53 | ||
| 14 | + */ | ||
| 15 | +@Repository | ||
| 16 | +public class KafkaStorageHistoryRepositoryImpl extends AbstractDaoRepository implements IKafkaStorageHistoryRepository { | ||
| 17 | + @Override | ||
| 18 | + public KafkaStorageHistory save(KafkaStorageHistory entity){ | ||
| 19 | + if(entity != null) { | ||
| 20 | + if (entity.getId() == null || entity.getId().longValue() <= 0) { | ||
| 21 | + kafkaStorageHistoryMapper.insertSelective(entity); | ||
| 22 | + } else if (entity.getId() != null && entity.getId().longValue() > 0){ | ||
| 23 | + kafkaStorageHistoryMapper.updateByPrimaryKeySelective(entity); | ||
| 24 | + } | ||
| 25 | + } | ||
| 26 | + return entity; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + @Override | ||
| 30 | + public void saveAll(List<KafkaStorageHistory> list){ | ||
| 31 | + list.stream().forEach(p->{ | ||
| 32 | + if(p.getId() == null || p.getId().longValue() <=0){ | ||
| 33 | + kafkaStorageHistoryMapper.insertSelective(p); | ||
| 34 | + }else if(p.getId() != null && p.getId().longValue() >0){ | ||
| 35 | + kafkaStorageHistoryMapper.updateByPrimaryKeySelective(p); | ||
| 36 | + } | ||
| 37 | + }); | ||
| 38 | + } | ||
| 39 | +} |
| 1 | +package com.fedex.connect.kafka.repository.repo.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 4 | +import com.fedex.connect.kafka.repository.base.AbstractDaoRepository; | ||
| 5 | +import com.fedex.connect.kafka.repository.repo.IKafkaTemporaryStorageRepository; | ||
| 6 | +import org.springframework.stereotype.Repository; | ||
| 7 | + | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * kafka临时表dao | ||
| 12 | + * mt | ||
| 13 | + * 2022年11月3日15:30:53 | ||
| 14 | + */ | ||
| 15 | +@Repository | ||
| 16 | +public class KafkaTemporaryStorageRepositoryImpl extends AbstractDaoRepository implements IKafkaTemporaryStorageRepository { | ||
| 17 | + | ||
| 18 | + @Override | ||
| 19 | + public void updateKafkaTemporaryStorageById(String consCode, String remark, Long id) { | ||
| 20 | + kafkaTemporaryStorageMapperExt.updateKafkaTemporaryStorageById( consCode, remark, id); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + @Override | ||
| 24 | + public void deleteKafkaTemporaryStorageById(Long id) { | ||
| 25 | + kafkaTemporaryStorageMapperExt.deleteKafkaTemporaryStorageById( id); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + @Override | ||
| 29 | + public int deleteInBatch(List<KafkaTemporaryStorage> list) { | ||
| 30 | + return kafkaTemporaryStorageMapperExt.deleteInBatch(list); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + @Override | ||
| 34 | + public List<KafkaTemporaryStorage> saveAll(List<KafkaTemporaryStorage> list) { | ||
| 35 | + list.stream().forEach(p->{ | ||
| 36 | + if(p.getId() == null || p.getId().longValue() <=0){ | ||
| 37 | + kafkaTemporaryStorageMapper.insertSelective(p); | ||
| 38 | + }else if(p.getId() != null && p.getId().longValue() >0){ | ||
| 39 | + kafkaTemporaryStorageMapper.updateByPrimaryKeySelective(p); | ||
| 40 | + } | ||
| 41 | + }); | ||
| 42 | + return list; | ||
| 43 | + } | ||
| 44 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/service/IDm501Service.java
0 → 100644
| 1 | +package com.fedex.connect.kafka.service; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 4 | +import com.fedex.connect.kafka.data.dto.DmProcessResults; | ||
| 5 | + | ||
| 6 | +public interface IDm501Service { | ||
| 7 | + DmProcessResults dm501Process(KafkaTemporaryStorage kafKaTemporaryStorage); | ||
| 8 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/service/IKafkaDmService.java
0 → 100644
| 1 | +package com.fedex.connect.kafka.service; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.KafkaStorageHistory; | ||
| 4 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 5 | +import com.fedex.connect.kafka.data.dto.DmProcessResults; | ||
| 6 | + | ||
| 7 | +import java.util.List; | ||
| 8 | +import java.util.Map; | ||
| 9 | + | ||
| 10 | +public interface IKafkaDmService { | ||
| 11 | + | ||
| 12 | + /** | ||
| 13 | + * Kafka临时表保存 | ||
| 14 | + * @param kafkaTemporaryStorageList | ||
| 15 | + */ | ||
| 16 | + List<KafkaTemporaryStorage> saveKafkaTemporaryStorageAll(List<KafkaTemporaryStorage> kafkaTemporaryStorageList); | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * Kafka历史表保存 | ||
| 20 | + * @param kafkaStorageHistory | ||
| 21 | + */ | ||
| 22 | + KafkaStorageHistory saveKafkaStorageHistory(KafkaStorageHistory kafkaStorageHistory); | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 根据id删除Kafka临时表 | ||
| 26 | + * @param id | ||
| 27 | + */ | ||
| 28 | + void deleteKafkaTemporaryStorage(Long id); | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 将消息对象推送至指定DM处理监听中 | ||
| 32 | + * @param messageMap | ||
| 33 | + */ | ||
| 34 | + void pushMessageList(Map<String, List<String>> messageMap); | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 将数据封装至map | ||
| 38 | + * @param messageCode | ||
| 39 | + * @param message | ||
| 40 | + * @param messageMap | ||
| 41 | + */ | ||
| 42 | + void pushMessageMap(String messageCode, String message, Map<String, List<String>> messageMap); | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 业务处理成功则,Kafka临时表转历史表,失败则更新临时表数据 | ||
| 46 | + * @param kafkaStorageHistory 该实体id为临时表ID | ||
| 47 | + */ | ||
| 48 | + void kafkaTemporaryTransferToHistory(DmProcessResults processResults, | ||
| 49 | + KafkaTemporaryStorage kafkaTemporaryStorage, | ||
| 50 | + KafkaStorageHistory kafkaStorageHistory); | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 将Kafka临时表id追加至kafka json字符串中 | ||
| 54 | + * @param message | ||
| 55 | + * @param id | ||
| 56 | + * @return | ||
| 57 | + * @throws Exception | ||
| 58 | + */ | ||
| 59 | + String addKafkaTempId(String message, Long id) throws Exception; | ||
| 60 | +} |
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/service/base/BaseService.java
0 → 100644
| 1 | +package com.fedex.connect.kafka.service.base; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.kafka.repository.repo.ICeInfoRepository; | ||
| 4 | +import com.fedex.connect.kafka.repository.repo.IKafkaStorageHistoryRepository; | ||
| 5 | +import com.fedex.connect.kafka.repository.repo.IKafkaTemporaryStorageRepository; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @Author mt | ||
| 10 | + * @Description 用于管理公共Service | ||
| 11 | + * @Date 2024/4/18 | ||
| 12 | + */ | ||
| 13 | +public class BaseService { | ||
| 14 | + @Autowired | ||
| 15 | + protected IKafkaStorageHistoryRepository kafkaStorageHistoryRepository; | ||
| 16 | + @Autowired | ||
| 17 | + protected IKafkaTemporaryStorageRepository kafkaTemporaryStorageRepository; | ||
| 18 | + @Autowired | ||
| 19 | + protected ICeInfoRepository ceInfoRepository; | ||
| 20 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/service/impl/Dm501ServiceImpl.java
0 → 100644
| 1 | +package com.fedex.connect.kafka.service.impl; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 4 | +import com.fedex.connect.common.dependencies.util.DateUtil; | ||
| 5 | +import com.fedex.connect.common.dependencies.util.Utils; | ||
| 6 | +import com.fedex.connect.common.model.biz.CeInfo; | ||
| 7 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 8 | +import com.fedex.connect.kafka.constants.Constant; | ||
| 9 | +import com.fedex.connect.kafka.data.dto.DmProcessResults; | ||
| 10 | +import com.fedex.connect.kafka.data.dto.dm.dm501.Dm501ConAddresses; | ||
| 11 | +import com.fedex.connect.kafka.data.dto.dm.dm501.Dm501Consignments; | ||
| 12 | +import com.fedex.connect.kafka.data.dto.dm.dm501.Dm501Data; | ||
| 13 | +import com.fedex.connect.kafka.service.IDm501Service; | ||
| 14 | +import com.fedex.connect.kafka.service.base.BaseService; | ||
| 15 | +import org.apache.commons.lang3.StringUtils; | ||
| 16 | +import org.springframework.stereotype.Service; | ||
| 17 | + | ||
| 18 | +import java.util.Date; | ||
| 19 | +import java.util.List; | ||
| 20 | +import java.util.Objects; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * @Author mt | ||
| 24 | + * @Description dm501消息处理 | ||
| 25 | + * @Date 2024/4/19 | ||
| 26 | + */ | ||
| 27 | +@Service | ||
| 28 | +public class Dm501ServiceImpl extends BaseService implements IDm501Service { | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * @Author mt | ||
| 32 | + * @Description 处理dm501消息 | ||
| 33 | + * @Date 2024/4/19 | ||
| 34 | + * @param kafKaTemporaryStorage | ||
| 35 | + * @return com.fedex.connect.kafka.data.dto.DmProcessResults | ||
| 36 | + */ | ||
| 37 | + public DmProcessResults dm501Process(KafkaTemporaryStorage kafKaTemporaryStorage){ | ||
| 38 | + //DM001处理结果 | ||
| 39 | + DmProcessResults processResults = new DmProcessResults(); | ||
| 40 | + processResults.setResultFlag(true); | ||
| 41 | + //获取数据 | ||
| 42 | + Dm501Data data = JSONObject.parseObject(kafKaTemporaryStorage.getData(), Dm501Data.class); | ||
| 43 | + List<Dm501Consignments> dm501Consignments = data.getConsignments(); | ||
| 44 | + //遍历dm501 | ||
| 45 | + Utils.listOf(dm501Consignments).stream().filter(Objects::nonNull).forEach(consignment -> { | ||
| 46 | + CeInfo bizCeInfo = ceInfoRepository.findBizCeInfoContainsByConsignmentCode(consignment.getTrackingNumber()); | ||
| 47 | + //将运单号保存 | ||
| 48 | + processResults.setConsignmentCode(consignment.getTrackingNumber()); | ||
| 49 | + //该运单号不存在创建时间为1个月内CE数据 | ||
| 50 | + if(Objects.isNull(bizCeInfo)){ | ||
| 51 | + CeInfo ceInfo = this.generateCeInfo(kafKaTemporaryStorage.getSendTime(),consignment); | ||
| 52 | + ceInfoRepository.save(ceInfo); | ||
| 53 | + } | ||
| 54 | + }); | ||
| 55 | + return processResults; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * @Author mt | ||
| 60 | + * @Description 生成CE数据实体 | ||
| 61 | + * @Date 2024/4/22 | ||
| 62 | + * @param dm501Consignment | ||
| 63 | + * @return com.fedex.connect.common.model.biz.CeInfo | ||
| 64 | + */ | ||
| 65 | + private CeInfo generateCeInfo(Date sendTime,Dm501Consignments dm501Consignment){ | ||
| 66 | + CeInfo bizCeInfo = new CeInfo(); | ||
| 67 | + bizCeInfo.setConsignmentCode(dm501Consignment.getTrackingNumber()); | ||
| 68 | + bizCeInfo.setCreateTime(new Date()); | ||
| 69 | + bizCeInfo.setDestIataCode(dm501Consignment.getDestIataCode()); | ||
| 70 | + //地址信息 | ||
| 71 | + List<Dm501ConAddresses> addressList = dm501Consignment.getAddresses(); | ||
| 72 | + //没有地址信息,不需要处理,不进CE业务表 | ||
| 73 | + if(addressList == null){ | ||
| 74 | + return null; | ||
| 75 | + } | ||
| 76 | + //发件人 | ||
| 77 | + Dm501ConAddresses shipperAddress = this.queryDM501Addresses(addressList, Constant.CE_INFO_ADDRESS_KEYS.SHIPPER); | ||
| 78 | + //收件人 | ||
| 79 | + Dm501ConAddresses recipientAddress = this.queryDM501Addresses(addressList, Constant.CE_INFO_ADDRESS_KEYS.RECIPIENT); | ||
| 80 | + //没有收发件人地址信息,不需要处理,不进CE业务表 | ||
| 81 | + if(shipperAddress == null || recipientAddress == null){ | ||
| 82 | + return null; | ||
| 83 | + } | ||
| 84 | + //发件人国家 | ||
| 85 | + String shipperCountry = shipperAddress.getCountry(); | ||
| 86 | + //始发国(二字码) | ||
| 87 | + bizCeInfo.setShipperCountry(shipperCountry); | ||
| 88 | + //发件人国家不为TW,不需要处理,不进CE业务表 | ||
| 89 | + if(StringUtils.isEmpty(shipperCountry) || !shipperCountry.trim().equals(Constant.CE_INFO_KEYS.TW)){ | ||
| 90 | + return null; | ||
| 91 | + } | ||
| 92 | + //收件人国家 | ||
| 93 | + String recipientCountry = recipientAddress.getCountry(); | ||
| 94 | + //目的国家二字码 | ||
| 95 | + bizCeInfo.setRecipientCountry(recipientCountry); | ||
| 96 | + //收件人国家不为CN,不需要处理,不进CE业务表 | ||
| 97 | + if(StringUtils.isEmpty(recipientCountry) || !recipientCountry.trim().equals(Constant.CE_INFO_KEYS.CN)){ | ||
| 98 | + return null; | ||
| 99 | + } | ||
| 100 | + bizCeInfo.setSendTime(sendTime); | ||
| 101 | + String shipDate = dm501Consignment.getShipDate(); | ||
| 102 | + if(StringUtils.isNotEmpty(shipDate)){ | ||
| 103 | + bizCeInfo.setShipDate(DateUtil.parse(shipDate)); | ||
| 104 | + } | ||
| 105 | + return bizCeInfo; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + /** | ||
| 109 | + * 根据类型获取地址信息 | ||
| 110 | + * SHIPPER/发件人---RECIPIENT/收件人---BROKEN/代理人 | ||
| 111 | + * @param type | ||
| 112 | + * @return | ||
| 113 | + */ | ||
| 114 | + private Dm501ConAddresses queryDM501Addresses(List<Dm501ConAddresses> addressList,String type){ | ||
| 115 | + Dm501ConAddresses address = null; | ||
| 116 | + for(int i = 0 ; i < addressList.size() ; i ++){ | ||
| 117 | + Dm501ConAddresses ad = addressList.get(i); | ||
| 118 | + if(ad.getType().equals(type)){ | ||
| 119 | + address = ad; | ||
| 120 | + break; | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + return address; | ||
| 124 | + } | ||
| 125 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/kafka-cndc-server/src/main/java/com/fedex/connect/kafka/service/impl/KafkaDmServiceImpl.java
0 → 100644
| 1 | +package com.fedex.connect.kafka.service.impl; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 4 | +import com.fasterxml.jackson.databind.node.ObjectNode; | ||
| 5 | +import com.fedex.connect.common.model.sys.KafkaStorageHistory; | ||
| 6 | +import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | ||
| 7 | +import com.fedex.connect.kafka.data.dto.DmProcessResults; | ||
| 8 | +import com.fedex.connect.kafka.listener.DmListenerInterface; | ||
| 9 | +import com.fedex.connect.kafka.service.IKafkaDmService; | ||
| 10 | +import com.fedex.connect.kafka.service.base.BaseService; | ||
| 11 | +import org.slf4j.Logger; | ||
| 12 | +import org.slf4j.LoggerFactory; | ||
| 13 | +import org.springframework.beans.BeansException; | ||
| 14 | +import org.springframework.context.ApplicationContext; | ||
| 15 | +import org.springframework.context.ApplicationContextAware; | ||
| 16 | +import org.springframework.stereotype.Service; | ||
| 17 | +import org.springframework.transaction.annotation.Transactional; | ||
| 18 | + | ||
| 19 | +import java.util.ArrayList; | ||
| 20 | +import java.util.Date; | ||
| 21 | +import java.util.List; | ||
| 22 | +import java.util.Map; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * kafka操作service | ||
| 26 | + * mt | ||
| 27 | + * 2022年11月3日16:09:48 | ||
| 28 | + */ | ||
| 29 | +@Service | ||
| 30 | +public class KafkaDmServiceImpl extends BaseService implements ApplicationContextAware, IKafkaDmService { | ||
| 31 | + private Logger logger = LoggerFactory.getLogger(KafkaDmServiceImpl.class); | ||
| 32 | + | ||
| 33 | + private ApplicationContext applicationContext = null; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * kafka临时表保存 | ||
| 37 | + * @param kafkaTemporaryStorageList | ||
| 38 | + */ | ||
| 39 | + @Override | ||
| 40 | + public List<KafkaTemporaryStorage> saveKafkaTemporaryStorageAll(List<KafkaTemporaryStorage> kafkaTemporaryStorageList){ | ||
| 41 | + return kafkaTemporaryStorageRepository.saveAll(kafkaTemporaryStorageList); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * kafka历史表保存 | ||
| 46 | + * @param kafkaStorageHistory | ||
| 47 | + */ | ||
| 48 | + @Override | ||
| 49 | + public KafkaStorageHistory saveKafkaStorageHistory(KafkaStorageHistory kafkaStorageHistory){ | ||
| 50 | + return kafkaStorageHistoryRepository.save(kafkaStorageHistory); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 根据id删除kafka临时表 | ||
| 55 | + * @param id | ||
| 56 | + */ | ||
| 57 | + @Override | ||
| 58 | + public void deleteKafkaTemporaryStorage(Long id){ | ||
| 59 | + kafkaTemporaryStorageRepository.deleteKafkaTemporaryStorageById(id); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 将消息对象推送至指定DM处理监听中 | ||
| 64 | + * @param messageMap | ||
| 65 | + */ | ||
| 66 | + @Override | ||
| 67 | + public void pushMessageList(Map<String,List<String>> messageMap){ | ||
| 68 | + try { | ||
| 69 | + messageMap.forEach((key, value) -> { | ||
| 70 | + //messageCode转换为小写 | ||
| 71 | + key = key.toLowerCase(); | ||
| 72 | + DmListenerInterface dmListener = applicationContext.getBean(key + "Listener", DmListenerInterface.class); | ||
| 73 | + dmListener.pushMessageList(value); | ||
| 74 | + }); | ||
| 75 | + }catch(Exception ex){ | ||
| 76 | + logger.error("pushMessageList error : " + ex.getMessage() , ex); | ||
| 77 | + }finally{ | ||
| 78 | + messageMap.clear(); | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * 将数据封装至map | ||
| 84 | + * @param messageCode | ||
| 85 | + * @param message | ||
| 86 | + * @param messageMap | ||
| 87 | + */ | ||
| 88 | + @Override | ||
| 89 | + public void pushMessageMap(String messageCode,String message,Map<String,List<String>> messageMap){ | ||
| 90 | + //将数据进行分类 | ||
| 91 | + if(messageMap.containsKey(messageCode)){ | ||
| 92 | + List<String> messageList = messageMap.get(messageCode); | ||
| 93 | + messageList.add(message); | ||
| 94 | + messageMap.put(messageCode,messageList); | ||
| 95 | + }else{ | ||
| 96 | + List<String> messageList = new ArrayList<String>(); | ||
| 97 | + messageList.add(message); | ||
| 98 | + messageMap.put(messageCode,messageList); | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * 业务处理成功则,kafka临时表转历史表,失败则更新临时表数据 | ||
| 104 | + * @param kafkaStorageHistory 该实体id为临时表ID | ||
| 105 | + */ | ||
| 106 | + @Transactional(rollbackFor = Exception.class) | ||
| 107 | + @Override | ||
| 108 | + public void kafkaTemporaryTransferToHistory(DmProcessResults processResults, | ||
| 109 | + KafkaTemporaryStorage kafkaTemporaryStorage, | ||
| 110 | + KafkaStorageHistory kafkaStorageHistory){ | ||
| 111 | + //判断程序处理是否正常 | ||
| 112 | + if(processResults.isResultFlag()){ | ||
| 113 | + //处理成功将临时表数据备份至历史表 | ||
| 114 | + this.deleteKafkaTemporaryStorage(kafkaTemporaryStorage.getId()); | ||
| 115 | + //将数据保存至kafka历史表,将id清除 | ||
| 116 | + kafkaStorageHistory.setId(null); | ||
| 117 | + //设置创建时间 | ||
| 118 | + kafkaStorageHistory.setCreateTime(new Date()); | ||
| 119 | + //将消息状态设置为已处理 | ||
| 120 | + kafkaStorageHistory.setStatus(1L); | ||
| 121 | + //设置运单号 | ||
| 122 | + kafkaStorageHistory.setConsignmentCode(processResults.getConsignmentCode()); | ||
| 123 | + //保存至kafka历史表 | ||
| 124 | + this.saveKafkaStorageHistory(kafkaStorageHistory); | ||
| 125 | + }else{ | ||
| 126 | + kafkaTemporaryStorageRepository.updateKafkaTemporaryStorageById(processResults.getConsignmentCode(),processResults.getResult(),kafkaStorageHistory.getId()); | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + @Override | ||
| 131 | + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | ||
| 132 | + this.applicationContext = applicationContext; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * 将kafka临时表id追加至kafka json字符串中 | ||
| 137 | + * @param message | ||
| 138 | + * @param id | ||
| 139 | + * @return | ||
| 140 | + * @throws Exception | ||
| 141 | + */ | ||
| 142 | + @Override | ||
| 143 | + public String addKafkaTempId(String message,Long id) throws Exception{ | ||
| 144 | + ObjectMapper objectMapper = new ObjectMapper(); | ||
| 145 | + ObjectNode jsonNodes = null; | ||
| 146 | + jsonNodes = objectMapper.readValue(message, ObjectNode.class); | ||
| 147 | + jsonNodes.put("id", id); | ||
| 148 | + String json = objectMapper.writeValueAsString(jsonNodes); | ||
| 149 | + return json; | ||
| 150 | + } | ||
| 151 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.kafka.service.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.kafka.service.IKafkaProducerService; | ||
| 4 | +import org.apache.kafka.clients.producer.KafkaProducer; | ||
| 5 | +import org.springframework.beans.factory.annotation.Value; | ||
| 6 | +import org.springframework.stereotype.Service; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @Author mt | ||
| 10 | + * @Description kafka生产者service | ||
| 11 | + * @Date 2024/4/26 | ||
| 12 | + */ | ||
| 13 | +@Service | ||
| 14 | +public class KafkaProducerServiceImpl implements IKafkaProducerService { | ||
| 15 | + | ||
| 16 | + @Value("${spring.kafka.consumer.topic-name}") | ||
| 17 | + private String dmTopic; | ||
| 18 | + | ||
| 19 | +// @Autowired | ||
| 20 | + private KafkaProducer<String, String> kafkaProducer; | ||
| 21 | + | ||
| 22 | + public void sendMessage(String message){ | ||
| 23 | +// //发送kafka | ||
| 24 | +// ProducerRecord pr = new ProducerRecord<String, String>(dmTopic,message); | ||
| 25 | +// kafkaProducer.send(pr); | ||
| 26 | + } | ||
| 27 | +} |
| 1 | spring: | 1 | spring: |
| 2 | datasource: | 2 | datasource: |
| 3 | url: jdbc:oracle:thin:@192.168.1.250:1521:orcl | 3 | url: jdbc:oracle:thin:@192.168.1.250:1521:orcl |
| 4 | - username: icleartw | 4 | + username: iclearimp |
| 5 | - password: icleartw | 5 | + password: iclearimp |
| 6 | driver-class-name: oracle.jdbc.OracleDriver | 6 | driver-class-name: oracle.jdbc.OracleDriver |
| 7 | profiles: | 7 | profiles: |
| 8 | #系统环境 | 8 | #系统环境 |
| ... | @@ -12,8 +12,8 @@ spring: | ... | @@ -12,8 +12,8 @@ spring: |
| 12 | # 指定kafka server的地址,集群配多个,中间,逗号隔开 | 12 | # 指定kafka server的地址,集群配多个,中间,逗号隔开 |
| 13 | bootstrap-servers: 47.103.140.98:9092 | 13 | bootstrap-servers: 47.103.140.98:9092 |
| 14 | #验证文件地址 | 14 | #验证文件地址 |
| 15 | - iclear-kerberos-jaasPath: /opt/fedex/icleartw/conf/app_3537251_iclear_jaas.conf | 15 | + iclear-kerberos-jaasPath: /opt/fedex/iclearConnect/conf/app_3537251_iclear_jaas.conf |
| 16 | - iclear-kerberos-krb5: /opt/fedex/icleartw/conf/krb5.conf | 16 | + iclear-kerberos-krb5: /opt/fedex/iclearConnect/conf/krb5.conf |
| 17 | #=============== provider ======================= | 17 | #=============== provider ======================= |
| 18 | producer: | 18 | producer: |
| 19 | #可以设置的值为:all, -1, 0, 1 | 19 | #可以设置的值为:all, -1, 0, 1 |
| ... | @@ -47,36 +47,4 @@ spring: | ... | @@ -47,36 +47,4 @@ spring: |
| 47 | #每次kafka消费量 | 47 | #每次kafka消费量 |
| 48 | max-poll-records: 1000 | 48 | max-poll-records: 1000 |
| 49 | #kafka消费线程数 | 49 | #kafka消费线程数 |
| 50 | - spring-kafka-threadNum: 10 | 50 | + spring-kafka-threadNum: 10 |
| 51 | -export: | ||
| 52 | - jwt: | ||
| 53 | - securityKey: C*F-JaNdRgUkXn2r5u8x/A?D(G+KbPeShVmYq3s6v9y$B&E)H@McQfTjWnZr4u7w | ||
| 54 | - urlWhiteList: | ||
| 55 | - - /icleartw/auth | ||
| 56 | - - /icleartw/sysUser/logout | ||
| 57 | - - /icleartw/swagger-resources | ||
| 58 | - - /icleartw/webjars | ||
| 59 | - uriWhiteList: | ||
| 60 | - - /icleartw/swagger-ui.html | ||
| 61 | - - /icleartw/swagger-ui/* | ||
| 62 | - - /icleartw/v2/api-docs | ||
| 63 | - - /icleartw/login.html | ||
| 64 | - expire_1H: 7200 | ||
| 65 | - expire_1D: 604800 | ||
| 66 | - mail: | ||
| 67 | - smtp: | ||
| 68 | - host: smtp.qiye.aliyun.com | ||
| 69 | - port: 25 | ||
| 70 | - needauth: true | ||
| 71 | - proxy: | ||
| 72 | - startFlag: false | ||
| 73 | - host: sin-proxy.apac.fedex.com | ||
| 74 | - port: 3128 | ||
| 75 | - mailAccountFlag: true | ||
| 76 | - mailgroup: | ||
| 77 | - declare: { from: 'kexin.zhou@erry.com',password: 'Zhou1234',to: 'kexin.zhou@erry.com',cc: 'kexin.zhou@erry.com' } | ||
| 78 | - resetpwd: { from: 'tao.mo@erry.com',password: 'xiaozhen!1'} | ||
| 79 | -# propertyPath: | ||
| 80 | -# redis: /opt/fedex/exporttw/redis/export-redis.properties | ||
| 81 | - language: zh_TW | ||
| 82 | - emailActiveTime: 60 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | spring: | 1 | spring: |
| 2 | datasource: | 2 | datasource: |
| 3 | - jndi-name: jdbc/icleartwDS | 3 | + jndi-name: jdbc/iclearConnectDS |
| 4 | profiles: | 4 | profiles: |
| 5 | #系统环境 | 5 | #系统环境 |
| 6 | env: prod | 6 | env: prod |
| ... | @@ -9,8 +9,8 @@ spring: | ... | @@ -9,8 +9,8 @@ spring: |
| 9 | # 指定kafka server的地址,集群配多个,中间,逗号隔开 | 9 | # 指定kafka server的地址,集群配多个,中间,逗号隔开 |
| 10 | bootstrap-servers: papc0014.cndczmd.apac.fedex.com:52094,papc0015.cndczmd.apac.fedex.com:52094,papc0016.cndczmd.apac.fedex.com:52094,papc0017.cndczmd.apac.fedex.com:52094,papc0018.cndczmd.apac.fedex.com:52094,papc0019.cndczmd.apac.fedex.com:52094 | 10 | bootstrap-servers: papc0014.cndczmd.apac.fedex.com:52094,papc0015.cndczmd.apac.fedex.com:52094,papc0016.cndczmd.apac.fedex.com:52094,papc0017.cndczmd.apac.fedex.com:52094,papc0018.cndczmd.apac.fedex.com:52094,papc0019.cndczmd.apac.fedex.com:52094 |
| 11 | #验证文件地址 | 11 | #验证文件地址 |
| 12 | - iclear-kerberos-jaasPath: /opt/fedex/icleartw/conf/app_3537251_iclear_jaas.conf | 12 | + iclear-kerberos-jaasPath: /opt/fedex/iclearConnect/conf/app_3537251_iclear_jaas.conf |
| 13 | - iclear-kerberos-krb5: /opt/fedex/icleartw/conf/krb5.conf | 13 | + iclear-kerberos-krb5: /opt/fedex/iclearConnect/conf/krb5.conf |
| 14 | #=============== provider ======================= | 14 | #=============== provider ======================= |
| 15 | producer: | 15 | producer: |
| 16 | #可以设置的值为:all, -1, 0, 1 | 16 | #可以设置的值为:all, -1, 0, 1 |
| ... | @@ -44,34 +44,4 @@ spring: | ... | @@ -44,34 +44,4 @@ spring: |
| 44 | #每次kafka消费量 | 44 | #每次kafka消费量 |
| 45 | max-poll-records: 1000 | 45 | max-poll-records: 1000 |
| 46 | #kafka消费线程数 | 46 | #kafka消费线程数 |
| 47 | - spring-kafka-threadNum: 10 | 47 | + spring-kafka-threadNum: 10 |
| 48 | - | ||
| 49 | -export: | ||
| 50 | - jwt: | ||
| 51 | - securityKey: C*F-JaNdRgUkXn2r5u8x/A?D(G+KbPeShVmYq3s6v9y$B&E)H@McQfTjWnZr4u7w | ||
| 52 | - urlWhiteList: | ||
| 53 | - - /icleartw/auth | ||
| 54 | - - /icleartw/sysUser/logout | ||
| 55 | - - /icleartw/swagger-resources | ||
| 56 | - - /icleartw/webjars | ||
| 57 | - uriWhiteList: | ||
| 58 | - - /icleartw/swagger-ui.html | ||
| 59 | - - /icleartw/swagger-ui/* | ||
| 60 | - - /icleartw/v2/api-docs | ||
| 61 | - - /icleartw/login.html | ||
| 62 | - expire_1H: 7200 | ||
| 63 | - expire_1D: 604800 | ||
| 64 | - mail: | ||
| 65 | - smtp: | ||
| 66 | - host: mapper.gslb.fedex.com | ||
| 67 | - port: 25 | ||
| 68 | - needauth: true | ||
| 69 | - proxy: | ||
| 70 | - startFlag: false | ||
| 71 | - host: sg2-proxy.apac.fedex.com | ||
| 72 | - port: 3128 | ||
| 73 | - mailAccountFlag: false | ||
| 74 | -# propertyPath: | ||
| 75 | -# redis: /opt/fedex/exporttw/redis/export-redis.properties | ||
| 76 | - language: zh_TW | ||
| 77 | - emailActiveTime: 60 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | spring: | 1 | spring: |
| 2 | datasource: | 2 | datasource: |
| 3 | - jndi-name: jdbc/icleartwDS | 3 | + jndi-name: jdbc/iclearConnectDS |
| 4 | profiles: | 4 | profiles: |
| 5 | #系统环境 | 5 | #系统环境 |
| 6 | env: test | 6 | env: test |
| ... | @@ -9,8 +9,8 @@ spring: | ... | @@ -9,8 +9,8 @@ spring: |
| 9 | # 指定kafka server的地址,集群配多个,中间,逗号隔开 | 9 | # 指定kafka server的地址,集群配多个,中间,逗号隔开 |
| 10 | bootstrap-servers: 47.103.140.98:9092 | 10 | bootstrap-servers: 47.103.140.98:9092 |
| 11 | #验证文件地址 | 11 | #验证文件地址 |
| 12 | - iclear-kerberos-jaasPath: /opt/fedex/icleartw/conf/app_3537251_iclear_jaas.conf | 12 | + iclear-kerberos-jaasPath: /opt/fedex/iclearConnect/conf/app_3537251_iclear_jaas.conf |
| 13 | - iclear-kerberos-krb5: /opt/fedex/icleartw/conf/krb5.conf | 13 | + iclear-kerberos-krb5: /opt/fedex/iclearConnect/conf/krb5.conf |
| 14 | #=============== provider ======================= | 14 | #=============== provider ======================= |
| 15 | producer: | 15 | producer: |
| 16 | #可以设置的值为:all, -1, 0, 1 | 16 | #可以设置的值为:all, -1, 0, 1 |
| ... | @@ -44,34 +44,4 @@ spring: | ... | @@ -44,34 +44,4 @@ spring: |
| 44 | #每次kafka消费量 | 44 | #每次kafka消费量 |
| 45 | max-poll-records: 1000 | 45 | max-poll-records: 1000 |
| 46 | #kafka消费线程数 | 46 | #kafka消费线程数 |
| 47 | - spring-kafka-threadNum: 10 | ||
| 48 | - | ||
| 49 | -export: | ||
| 50 | - jwt: | ||
| 51 | - securityKey: C*F-JaNdRgUkXn2r5u8x/A?D(G+KbPeShVmYq3s6v9y$B&E)H@McQfTjWnZr4u7w | ||
| 52 | - urlWhiteList: | ||
| 53 | - - /icleartw/auth | ||
| 54 | - - /icleartw/sysUser/logout | ||
| 55 | - - /icleartw/swagger-resources | ||
| 56 | - - /icleartw/webjars | ||
| 57 | - uriWhiteList: | ||
| 58 | - - /icleartw/swagger-ui.html | ||
| 59 | - - /icleartw/swagger-ui/* | ||
| 60 | - - /icleartw/v2/api-docs | ||
| 61 | - - /icleartw/login.html | ||
| 62 | - expire_1H: 7200 | ||
| 63 | - expire_1D: 604800 | ||
| 64 | - mail: | ||
| 65 | - smtp: | ||
| 66 | - host: smtp.qiye.aliyun.com | ||
| 67 | - port: 25 | ||
| 68 | - needauth: true | ||
| 69 | - proxy: | ||
| 70 | - startFlag: false | ||
| 71 | - host: sin-proxy.apac.fedex.com | ||
| 72 | - port: 3128 | ||
| 73 | - mailAccountFlag: true | ||
| 74 | -# propertyPath: | ||
| 75 | -# redis: /opt/fedex/exporttw/redis/export-redis.properties | ||
| 76 | - language: zh_TW | ||
| 77 | - emailActiveTime: 60 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 47 | + spring-kafka-threadNum: 10 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | spring: | 1 | spring: |
| 2 | datasource: | 2 | datasource: |
| 3 | - jndi-name: jdbc/icleartwDS | 3 | + jndi-name: jdbc/iclearConnectDS |
| 4 | profiles: | 4 | profiles: |
| 5 | #系统环境 | 5 | #系统环境 |
| 6 | env: uat | 6 | env: uat |
| ... | @@ -9,8 +9,8 @@ spring: | ... | @@ -9,8 +9,8 @@ spring: |
| 9 | # 指定kafka server的地址,集群配多个,中间,逗号隔开 | 9 | # 指定kafka server的地址,集群配多个,中间,逗号隔开 |
| 10 | bootstrap-servers: uapc0004.cndczmd.apac.fedex.com:52094,uapc0005.cndczmd.apac.fedex.com:52094,uapc0006.cndczmd.apac.fedex.com:52094,uapc0007.cndczmd.apac.fedex.com:52094,uapc0008.cndczmd.apac.fedex.com:52094,uapc0009.cndczmd.apac.fedex.com:52094 | 10 | bootstrap-servers: uapc0004.cndczmd.apac.fedex.com:52094,uapc0005.cndczmd.apac.fedex.com:52094,uapc0006.cndczmd.apac.fedex.com:52094,uapc0007.cndczmd.apac.fedex.com:52094,uapc0008.cndczmd.apac.fedex.com:52094,uapc0009.cndczmd.apac.fedex.com:52094 |
| 11 | #验证文件地址 | 11 | #验证文件地址 |
| 12 | - iclear-kerberos-jaasPath: /opt/fedex/icleartw/conf/app_3537251_iclear_jaas.conf | 12 | + iclear-kerberos-jaasPath: /opt/fedex/iclearConnect/conf/app_3537251_iclear_jaas.conf |
| 13 | - iclear-kerberos-krb5: /opt/fedex/icleartw/conf/krb5.conf | 13 | + iclear-kerberos-krb5: /opt/fedex/iclearConnect/conf/krb5.conf |
| 14 | #=============== provider ======================= | 14 | #=============== provider ======================= |
| 15 | producer: | 15 | producer: |
| 16 | #可以设置的值为:all, -1, 0, 1 | 16 | #可以设置的值为:all, -1, 0, 1 |
| ... | @@ -44,34 +44,4 @@ spring: | ... | @@ -44,34 +44,4 @@ spring: |
| 44 | #每次kafka消费量 | 44 | #每次kafka消费量 |
| 45 | max-poll-records: 1000 | 45 | max-poll-records: 1000 |
| 46 | #kafka消费线程数 | 46 | #kafka消费线程数 |
| 47 | - spring-kafka-threadNum: 10 | ||
| 48 | - | ||
| 49 | -export: | ||
| 50 | - jwt: | ||
| 51 | - securityKey: C*F-JaNdRgUkXn2r5u8x/A?D(G+KbPeShVmYq3s6v9y$B&E)H@McQfTjWnZr4u7w | ||
| 52 | - urlWhiteList: | ||
| 53 | - - /icleartw/auth | ||
| 54 | - - /icleartw/sysUser/logout | ||
| 55 | - - /icleartw/swagger-resources | ||
| 56 | - - /icleartw/webjars | ||
| 57 | - uriWhiteList: | ||
| 58 | - - /icleartw/swagger-ui.html | ||
| 59 | - - /icleartw/swagger-ui/* | ||
| 60 | - - /icleartw/v2/api-docs | ||
| 61 | - - /icleartw/login.html | ||
| 62 | - expire_1H: 7200 | ||
| 63 | - expire_1D: 604800 | ||
| 64 | - mail: | ||
| 65 | - smtp: | ||
| 66 | - host: mapper.gslb.fedex.com | ||
| 67 | - port: 25 | ||
| 68 | - needauth: true | ||
| 69 | - proxy: | ||
| 70 | - startFlag: false | ||
| 71 | - host: sg2-proxy.apac.fedex.com | ||
| 72 | - port: 3128 | ||
| 73 | - mailAccountFlag: false | ||
| 74 | -# propertyPath: | ||
| 75 | -# redis: /opt/fedex/exporttw/redis/export-redis.properties | ||
| 76 | - language: zh_TW | ||
| 77 | - emailActiveTime: 60 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 47 | + spring-kafka-threadNum: 10 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | server: | 1 | server: |
| 2 | - port: 8088 | 2 | + port: 8082 |
| 3 | servlet: | 3 | servlet: |
| 4 | context-path: /kafka-cndc-server | 4 | context-path: /kafka-cndc-server |
| 5 | spring: | 5 | spring: |
| ... | @@ -13,7 +13,7 @@ spring: | ... | @@ -13,7 +13,7 @@ spring: |
| 13 | 13 | ||
| 14 | mybatis: | 14 | mybatis: |
| 15 | mapper-locations: | 15 | mapper-locations: |
| 16 | - - classpath*:com/fedex/export/**/mapper/*.xml | 16 | + - classpath*:com/fedex/connect/**/mapper/**/*.xml |
| 17 | configuration: | 17 | configuration: |
| 18 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl | 18 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| 19 | #开启驼峰与下划线转换 | 19 | #开启驼峰与下划线转换 | ... | ... |
| ... | @@ -2,11 +2,11 @@ | ... | @@ -2,11 +2,11 @@ |
| 2 | <configuration> | 2 | <configuration> |
| 3 | <springProfile name="dev,uat,prod"> | 3 | <springProfile name="dev,uat,prod"> |
| 4 | <!-- 日志存放路径 --> | 4 | <!-- 日志存放路径 --> |
| 5 | - <property name="log.path" value="/var/fedex/iclearconnect/weblogic/iclearconnect/export-tw-kafka"></property> | 5 | + <property name="log.path" value="/var/fedex/iclearConnect/weblogic/iclearConnect/kafka-cndc-server"></property> |
| 6 | </springProfile> | 6 | </springProfile> |
| 7 | <springProfile name="test"> | 7 | <springProfile name="test"> |
| 8 | <!-- 日志存放路径 --> | 8 | <!-- 日志存放路径 --> |
| 9 | - <property name="log.path" value="/app/Oracle/Middleware/user_projects/domains/base_domain/iclearconnect/export-tw-kafka"></property> | 9 | + <property name="log.path" value="/app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/kafka-cndc-server"></property> |
| 10 | </springProfile> | 10 | </springProfile> |
| 11 | <!-- 日志输出格式 --> | 11 | <!-- 日志输出格式 --> |
| 12 | <property name="log.pattern" | 12 | <property name="log.pattern" |
| ... | @@ -109,10 +109,16 @@ | ... | @@ -109,10 +109,16 @@ |
| 109 | <root level="info"> | 109 | <root level="info"> |
| 110 | <appender-ref ref="console"></appender-ref> | 110 | <appender-ref ref="console"></appender-ref> |
| 111 | </root> | 111 | </root> |
| 112 | - <logger name="com.fedex.export.repository.dao" level="debug"> | 112 | + <logger name="com.fedex.connect.common.dao" level="debug"> |
| 113 | <appender-ref ref="file_debug"></appender-ref> | 113 | <appender-ref ref="file_debug"></appender-ref> |
| 114 | </logger> | 114 | </logger> |
| 115 | - <logger name="com.fedex.export.repository.mapper" level="debug"> | 115 | + <logger name="com.fedex.connect.common.mapper" level="debug"> |
| 116 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 117 | + </logger> | ||
| 118 | + <logger name="com.fedex.connect.kafka.repository.dao" level="debug"> | ||
| 119 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 120 | + </logger> | ||
| 121 | + <logger name="com.fedex.connect.kafka.repository.mapper" level="debug"> | ||
| 116 | <appender-ref ref="file_debug"></appender-ref> | 122 | <appender-ref ref="file_debug"></appender-ref> |
| 117 | </logger> | 123 | </logger> |
| 118 | </springProfile> | 124 | </springProfile> |
| ... | @@ -121,10 +127,16 @@ | ... | @@ -121,10 +127,16 @@ |
| 121 | <appender-ref ref="file_info"></appender-ref> | 127 | <appender-ref ref="file_info"></appender-ref> |
| 122 | <appender-ref ref="file_error"></appender-ref> | 128 | <appender-ref ref="file_error"></appender-ref> |
| 123 | </root> | 129 | </root> |
| 124 | - <logger name="com.fedex.export.repository.dao" level="debug"> | 130 | + <logger name="com.fedex.connect.common.dao" level="debug"> |
| 131 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 132 | + </logger> | ||
| 133 | + <logger name="com.fedex.connect.common.mapper" level="debug"> | ||
| 134 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 135 | + </logger> | ||
| 136 | + <logger name="com.fedex.connect.kafka.repository.dao" level="debug"> | ||
| 125 | <appender-ref ref="file_debug"></appender-ref> | 137 | <appender-ref ref="file_debug"></appender-ref> |
| 126 | </logger> | 138 | </logger> |
| 127 | - <logger name="com.fedex.export.repository.mapper" level="debug"> | 139 | + <logger name="com.fedex.connect.kafka.repository.mapper" level="debug"> |
| 128 | <appender-ref ref="file_debug"></appender-ref> | 140 | <appender-ref ref="file_debug"></appender-ref> |
| 129 | </logger> | 141 | </logger> |
| 130 | </springProfile> | 142 | </springProfile> | ... | ... |
| ... | @@ -35,6 +35,11 @@ | ... | @@ -35,6 +35,11 @@ |
| 35 | </dependency> | 35 | </dependency> |
| 36 | <dependency> | 36 | <dependency> |
| 37 | <groupId>com.fedex.connect</groupId> | 37 | <groupId>com.fedex.connect</groupId> |
| 38 | + <artifactId>common-dependencies</artifactId> | ||
| 39 | + <version>1.0.0</version> | ||
| 40 | + </dependency> | ||
| 41 | + <dependency> | ||
| 42 | + <groupId>com.fedex.connect</groupId> | ||
| 38 | <artifactId>base-starter</artifactId> | 43 | <artifactId>base-starter</artifactId> |
| 39 | <version>1.0.0</version> | 44 | <version>1.0.0</version> |
| 40 | <scope>${install.scope}</scope> | 45 | <scope>${install.scope}</scope> | ... | ... |
server/manager-server/src/main/java/com/fedex/connect/manager/dao/base/BaseDao.java
deleted
100644 → 0
| 1 | -package com.fedex.connect.manager.dao.base; | ||
| 2 | - | ||
| 3 | -import com.fedex.connect.common.dao.base.DictionaryEntriesMapper; | ||
| 4 | -import com.fedex.connect.common.dao.log.UserLoginInfoMapper; | ||
| 5 | -import com.fedex.connect.common.dao.sys.RedisSlabMapper; | ||
| 6 | -import com.fedex.connect.common.dao.sys.RoleMapper; | ||
| 7 | -import com.fedex.connect.common.dao.sys.UserMapper; | ||
| 8 | -import com.fedex.connect.common.dao.sys.UserRoleMapper; | ||
| 9 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | - | ||
| 11 | -public class BaseDao { | ||
| 12 | - @Autowired | ||
| 13 | - public UserLoginInfoMapper userLoginInfoMapper; | ||
| 14 | - @Autowired | ||
| 15 | - public RedisSlabMapper redisSlabMapper; | ||
| 16 | - @Autowired | ||
| 17 | - public RoleMapper roleMapper; | ||
| 18 | - @Autowired | ||
| 19 | - public UserRoleMapper userRoleMapper; | ||
| 20 | - @Autowired | ||
| 21 | - public UserMapper userMapper; | ||
| 22 | - @Autowired | ||
| 23 | - public DictionaryEntriesMapper dictionaryEntriesMapper; | ||
| 24 | -} |
| 1 | server: | 1 | server: |
| 2 | - port: 8086 | 2 | + port: 8083 |
| 3 | servlet: | 3 | servlet: |
| 4 | context-path: /manager-server | 4 | context-path: /manager-server |
| 5 | session: | 5 | session: |
| ... | @@ -22,8 +22,7 @@ spring: | ... | @@ -22,8 +22,7 @@ spring: |
| 22 | 22 | ||
| 23 | mybatis: | 23 | mybatis: |
| 24 | mapper-locations: | 24 | mapper-locations: |
| 25 | - - classpath*:com/fedex/export/**/mapper/*.xml | 25 | + - classpath*:com/fedex/connect/**/mapper/**/*.xml |
| 26 | - - classpath*:com/fedex/export/**/mapper/log/*.xml | ||
| 27 | configuration: | 26 | configuration: |
| 28 | #开启驼峰与下划线转换 | 27 | #开启驼峰与下划线转换 |
| 29 | map-underscore-to-camel-case: true | 28 | map-underscore-to-camel-case: true | ... | ... |
| ... | @@ -2,11 +2,11 @@ | ... | @@ -2,11 +2,11 @@ |
| 2 | <configuration> | 2 | <configuration> |
| 3 | <springProfile name="dev,uat,prod"> | 3 | <springProfile name="dev,uat,prod"> |
| 4 | <!-- 日志存放路径 --> | 4 | <!-- 日志存放路径 --> |
| 5 | - <property name="log.path" value="/var/fedex/iclearconnect/weblogic/iclearconnect/export-tw-server" /> | 5 | + <property name="log.path" value="/var/fedex/iclearConnect/weblogic/iclearConnect/manager-server" /> |
| 6 | </springProfile> | 6 | </springProfile> |
| 7 | <springProfile name="test"> | 7 | <springProfile name="test"> |
| 8 | <!-- 日志存放路径 --> | 8 | <!-- 日志存放路径 --> |
| 9 | - <property name="log.path" value="/app/Oracle/Middleware/user_projects/domains/base_domain/iclearconnect/export-tw-server"></property> | 9 | + <property name="log.path" value="/app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/manager-server"></property> |
| 10 | </springProfile> | 10 | </springProfile> |
| 11 | <!-- 日志输出格式 --> | 11 | <!-- 日志输出格式 --> |
| 12 | <property name="log.pattern" | 12 | <property name="log.pattern" |
| ... | @@ -109,10 +109,16 @@ | ... | @@ -109,10 +109,16 @@ |
| 109 | <root level="info"> | 109 | <root level="info"> |
| 110 | <appender-ref ref="console"></appender-ref> | 110 | <appender-ref ref="console"></appender-ref> |
| 111 | </root> | 111 | </root> |
| 112 | - <logger name="com.fedex.export.repository.dao" level="debug"> | 112 | + <logger name="com.fedex.connect.common.dao" level="debug"> |
| 113 | <appender-ref ref="file_debug"></appender-ref> | 113 | <appender-ref ref="file_debug"></appender-ref> |
| 114 | </logger> | 114 | </logger> |
| 115 | - <logger name="com.fedex.export.repository.mapper" level="debug"> | 115 | + <logger name="com.fedex.connect.common.mapper" level="debug"> |
| 116 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 117 | + </logger> | ||
| 118 | + <logger name="com.fedex.connect.manager.repository.dao" level="debug"> | ||
| 119 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 120 | + </logger> | ||
| 121 | + <logger name="com.fedex.connect.manager.repository.mapper" level="debug"> | ||
| 116 | <appender-ref ref="file_debug"></appender-ref> | 122 | <appender-ref ref="file_debug"></appender-ref> |
| 117 | </logger> | 123 | </logger> |
| 118 | </springProfile> | 124 | </springProfile> |
| ... | @@ -121,10 +127,16 @@ | ... | @@ -121,10 +127,16 @@ |
| 121 | <appender-ref ref="file_info"></appender-ref> | 127 | <appender-ref ref="file_info"></appender-ref> |
| 122 | <appender-ref ref="file_error"></appender-ref> | 128 | <appender-ref ref="file_error"></appender-ref> |
| 123 | </root> | 129 | </root> |
| 124 | - <logger name="com.fedex.export.repository.dao" level="debug"> | 130 | + <logger name="com.fedex.connect.common.dao" level="debug"> |
| 131 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 132 | + </logger> | ||
| 133 | + <logger name="com.fedex.connect.common.mapper" level="debug"> | ||
| 134 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 135 | + </logger> | ||
| 136 | + <logger name="com.fedex.connect.manager.repository.dao" level="debug"> | ||
| 125 | <appender-ref ref="file_debug"></appender-ref> | 137 | <appender-ref ref="file_debug"></appender-ref> |
| 126 | </logger> | 138 | </logger> |
| 127 | - <logger name="com.fedex.export.repository.mapper" level="debug"> | 139 | + <logger name="com.fedex.connect.manager.repository.mapper" level="debug"> |
| 128 | <appender-ref ref="file_debug"></appender-ref> | 140 | <appender-ref ref="file_debug"></appender-ref> |
| 129 | </logger> | 141 | </logger> |
| 130 | </springProfile> | 142 | </springProfile> | ... | ... |
| ... | @@ -35,6 +35,11 @@ | ... | @@ -35,6 +35,11 @@ |
| 35 | </dependency> | 35 | </dependency> |
| 36 | <dependency> | 36 | <dependency> |
| 37 | <groupId>com.fedex.connect</groupId> | 37 | <groupId>com.fedex.connect</groupId> |
| 38 | + <artifactId>common-dependencies</artifactId> | ||
| 39 | + <version>1.0.0</version> | ||
| 40 | + </dependency> | ||
| 41 | + <dependency> | ||
| 42 | + <groupId>com.fedex.connect</groupId> | ||
| 38 | <artifactId>base-starter</artifactId> | 43 | <artifactId>base-starter</artifactId> |
| 39 | <version>1.0.0</version> | 44 | <version>1.0.0</version> |
| 40 | <scope>${install.scope}</scope> | 45 | <scope>${install.scope}</scope> | ... | ... |
| 1 | server: | 1 | server: |
| 2 | - port: 8087 | 2 | + port: 8084 |
| 3 | servlet: | 3 | servlet: |
| 4 | context-path: /task-schedule | 4 | context-path: /task-schedule |
| 5 | spring: | 5 | spring: |
| ... | @@ -13,9 +13,7 @@ spring: | ... | @@ -13,9 +13,7 @@ spring: |
| 13 | 13 | ||
| 14 | mybatis: | 14 | mybatis: |
| 15 | mapper-locations: | 15 | mapper-locations: |
| 16 | - - classpath*:com/fedex/export/**/mapper/*.xml | 16 | + - classpath*:com/fedex/connect/**/mapper/**/*.xml |
| 17 | - - classpath*:com/fedex/export/**/mapper/log/*.xml | ||
| 18 | - - classpath*:com/fedex/export/**/mapper/sys/*.xml | ||
| 19 | configuration: | 17 | configuration: |
| 20 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl | 18 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| 21 | #开启驼峰与下划线转换 | 19 | #开启驼峰与下划线转换 | ... | ... |
| ... | @@ -2,11 +2,11 @@ | ... | @@ -2,11 +2,11 @@ |
| 2 | <configuration> | 2 | <configuration> |
| 3 | <springProfile name="dev,uat,prod"> | 3 | <springProfile name="dev,uat,prod"> |
| 4 | <!-- 日志存放路径 --> | 4 | <!-- 日志存放路径 --> |
| 5 | - <property name="log.path" value="/var/fedex/iclearconnect/weblogic/iclearconnect/export-tw-task" /> | 5 | + <property name="log.path" value="/var/fedex/iclearConnect/weblogic/iclearConnect/task-schedule" /> |
| 6 | </springProfile> | 6 | </springProfile> |
| 7 | <springProfile name="test"> | 7 | <springProfile name="test"> |
| 8 | <!-- 日志存放路径 --> | 8 | <!-- 日志存放路径 --> |
| 9 | - <property name="log.path" value="/app/Oracle/Middleware/user_projects/domains/base_domain/iclearconnect/export-tw-task"></property> | 9 | + <property name="log.path" value="/app/Oracle/Middleware/user_projects/domains/base_domain/iclearConnect/task-schedule"></property> |
| 10 | </springProfile> | 10 | </springProfile> |
| 11 | <!-- 日志输出格式 --> | 11 | <!-- 日志输出格式 --> |
| 12 | <property name="log.pattern" | 12 | <property name="log.pattern" |
| ... | @@ -109,10 +109,16 @@ | ... | @@ -109,10 +109,16 @@ |
| 109 | <root level="info"> | 109 | <root level="info"> |
| 110 | <appender-ref ref="console"></appender-ref> | 110 | <appender-ref ref="console"></appender-ref> |
| 111 | </root> | 111 | </root> |
| 112 | - <logger name="com.fedex.export.repository.dao" level="debug"> | 112 | + <logger name="com.fedex.connect.common.dao" level="debug"> |
| 113 | <appender-ref ref="file_debug"></appender-ref> | 113 | <appender-ref ref="file_debug"></appender-ref> |
| 114 | </logger> | 114 | </logger> |
| 115 | - <logger name="com.fedex.export.repository.mapper" level="debug"> | 115 | + <logger name="com.fedex.connect.common.mapper" level="debug"> |
| 116 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 117 | + </logger> | ||
| 118 | + <logger name="com.fedex.connect.task.repository.dao" level="debug"> | ||
| 119 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 120 | + </logger> | ||
| 121 | + <logger name="com.fedex.connect.task.repository.mapper" level="debug"> | ||
| 116 | <appender-ref ref="file_debug"></appender-ref> | 122 | <appender-ref ref="file_debug"></appender-ref> |
| 117 | </logger> | 123 | </logger> |
| 118 | </springProfile> | 124 | </springProfile> |
| ... | @@ -121,10 +127,16 @@ | ... | @@ -121,10 +127,16 @@ |
| 121 | <appender-ref ref="file_info"></appender-ref> | 127 | <appender-ref ref="file_info"></appender-ref> |
| 122 | <appender-ref ref="file_error"></appender-ref> | 128 | <appender-ref ref="file_error"></appender-ref> |
| 123 | </root> | 129 | </root> |
| 124 | - <logger name="com.fedex.export.repository.dao" level="debug"> | 130 | + <logger name="com.fedex.connect.common.dao" level="debug"> |
| 131 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 132 | + </logger> | ||
| 133 | + <logger name="com.fedex.connect.common.mapper" level="debug"> | ||
| 134 | + <appender-ref ref="file_debug"></appender-ref> | ||
| 135 | + </logger> | ||
| 136 | + <logger name="com.fedex.connect.task.repository.dao" level="debug"> | ||
| 125 | <appender-ref ref="file_debug"></appender-ref> | 137 | <appender-ref ref="file_debug"></appender-ref> |
| 126 | </logger> | 138 | </logger> |
| 127 | - <logger name="com.fedex.export.repository.mapper" level="debug"> | 139 | + <logger name="com.fedex.connect.task.repository.mapper" level="debug"> |
| 128 | <appender-ref ref="file_debug"></appender-ref> | 140 | <appender-ref ref="file_debug"></appender-ref> |
| 129 | </logger> | 141 | </logger> |
| 130 | </springProfile> | 142 | </springProfile> | ... | ... |
-
Please register or login to post a comment