Compare commits
8 Commits
Author | SHA1 | Date |
---|---|---|
|
afa42fc607 | |
|
1f408ba6d3 | |
|
0bdc8c88f9 | |
|
cd64663e08 | |
|
331d061358 | |
|
056778a476 | |
|
f189bca3f1 | |
|
c7199c4cbf |
|
@ -2,13 +2,23 @@
|
|||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="el-data-source-server" />
|
||||
<module name="etl-jwt-manage" />
|
||||
<module name="el-data-source-common" />
|
||||
<module name="etl-auth-server" />
|
||||
<module name="etl-common" />
|
||||
<module name="etl-gateway" />
|
||||
<module name="etl-heihei" />
|
||||
<module name="etl-groovy" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="etl-mysql" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="dataSourceStorageLocal" created-in="IU-232.8660.185">
|
||||
<data-source name="@182.254.221.163" uuid="aea9c88e-33a9-4819-8fdc-46a500215122">
|
||||
<database-info product="MySQL" version="5.7.44" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-java-8.0.25 (Revision: 08be9e9b4cba6aa115f9b27b215887af40b159e0)" dbms="MYSQL" exact-version="5.7.44" exact-driver-version="8.0">
|
||||
<extra-name-characters>#@</extra-name-characters>
|
||||
<identifier-quote-string>`</identifier-quote-string>
|
||||
</database-info>
|
||||
<case-sensitivity plain-identifiers="lower" quoted-identifiers="lower" />
|
||||
<secret-storage>master_key</secret-storage>
|
||||
<user-name>root</user-name>
|
||||
<schema-mapping>
|
||||
<introspection-scope>
|
||||
<node kind="schema" qname="yuekao" />
|
||||
</introspection-scope>
|
||||
</schema-mapping>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="@182.254.221.163" uuid="aea9c88e-33a9-4819-8fdc-46a500215122">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://182.254.221.163:3306</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,440 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<dataSource name="@182.254.221.163">
|
||||
<database-model serializer="dbm" dbms="MYSQL" family-id="MYSQL" format-version="4.49">
|
||||
<root id="1">
|
||||
<DefaultCasing>lower/lower</DefaultCasing>
|
||||
<DefaultEngine>InnoDB</DefaultEngine>
|
||||
<DefaultTmpEngine>InnoDB</DefaultTmpEngine>
|
||||
<ServerVersion>5.7.44</ServerVersion>
|
||||
</root>
|
||||
<schema id="2" parent="1" name="etl">
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="3" parent="1" name="health">
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="4" parent="1" name="information_schema">
|
||||
<CollationName>utf8_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="5" parent="1" name="mall">
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="6" parent="1" name="mall-cloud">
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="7" parent="1" name="mall-product">
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="8" parent="1" name="mall-search">
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="9" parent="1" name="mall-seata">
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="10" parent="1" name="mysql">
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="11" parent="1" name="nacos_config">
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="12" parent="1" name="performance_schema">
|
||||
<CollationName>utf8_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="13" parent="1" name="plm_material">
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="14" parent="1" name="product">
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="15" parent="1" name="ry-cloud">
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="16" parent="1" name="seata">
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="17" parent="1" name="skywalking">
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="18" parent="1" name="sys">
|
||||
<CollationName>utf8_general_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="19" parent="1" name="xxl_job">
|
||||
<CollationName>utf8mb4_unicode_ci</CollationName>
|
||||
</schema>
|
||||
<schema id="20" parent="1" name="yuekao">
|
||||
<IntrospectionTimestamp>2024-06-24.16:01:22</IntrospectionTimestamp>
|
||||
<LocalIntrospectionTimestamp>2024-06-24.08:01:21</LocalIntrospectionTimestamp>
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</schema>
|
||||
<table id="21" parent="20" name="car">
|
||||
<Engine>InnoDB</Engine>
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</table>
|
||||
<table id="22" parent="20" name="city">
|
||||
<Engine>InnoDB</Engine>
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</table>
|
||||
<table id="23" parent="20" name="dictionaries">
|
||||
<Engine>InnoDB</Engine>
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</table>
|
||||
<table id="24" parent="20" name="evaluate">
|
||||
<Engine>InnoDB</Engine>
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</table>
|
||||
<table id="25" parent="20" name="middle">
|
||||
<Engine>InnoDB</Engine>
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</table>
|
||||
<table id="26" parent="20" name="power">
|
||||
<Engine>InnoDB</Engine>
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</table>
|
||||
<table id="27" parent="20" name="power_address">
|
||||
<Engine>InnoDB</Engine>
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</table>
|
||||
<table id="28" parent="20" name="power_speed">
|
||||
<Engine>InnoDB</Engine>
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</table>
|
||||
<table id="29" parent="20" name="power_type">
|
||||
<Engine>InnoDB</Engine>
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</table>
|
||||
<table id="30" parent="20" name="user">
|
||||
<Engine>InnoDB</Engine>
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</table>
|
||||
<table id="31" parent="20" name="user_car">
|
||||
<Engine>InnoDB</Engine>
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</table>
|
||||
<table id="32" parent="20" name="user_power">
|
||||
<Engine>InnoDB</Engine>
|
||||
<CollationName>utf8mb4_general_ci</CollationName>
|
||||
</table>
|
||||
<column id="33" parent="21" name="id">
|
||||
<AutoIncrement>5</AutoIncrement>
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<NotNull>1</NotNull>
|
||||
<Position>1</Position>
|
||||
</column>
|
||||
<column id="34" parent="21" name="car_id">
|
||||
<DasType>varchar(11)|0s</DasType>
|
||||
<Position>2</Position>
|
||||
</column>
|
||||
<index id="35" parent="21" name="PRIMARY">
|
||||
<ColNames>id</ColNames>
|
||||
<Type>btree</Type>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="36" parent="21" name="PRIMARY">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>PRIMARY</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="37" parent="22" name="id">
|
||||
<AutoIncrement>4</AutoIncrement>
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<NotNull>1</NotNull>
|
||||
<Position>1</Position>
|
||||
</column>
|
||||
<column id="38" parent="22" name="city_name">
|
||||
<DasType>varchar(255)|0s</DasType>
|
||||
<Position>2</Position>
|
||||
</column>
|
||||
<index id="39" parent="22" name="PRIMARY">
|
||||
<ColNames>id</ColNames>
|
||||
<Type>btree</Type>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="40" parent="22" name="PRIMARY">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>PRIMARY</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="41" parent="23" name="id">
|
||||
<AutoIncrement>7</AutoIncrement>
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<NotNull>1</NotNull>
|
||||
<Position>1</Position>
|
||||
</column>
|
||||
<column id="42" parent="23" name="dictionaries_name">
|
||||
<DasType>varchar(255)|0s</DasType>
|
||||
<Position>2</Position>
|
||||
</column>
|
||||
<index id="43" parent="23" name="PRIMARY">
|
||||
<ColNames>id</ColNames>
|
||||
<Type>btree</Type>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="44" parent="23" name="PRIMARY">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>PRIMARY</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="45" parent="24" name="id">
|
||||
<AutoIncrement>7</AutoIncrement>
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<NotNull>1</NotNull>
|
||||
<Position>1</Position>
|
||||
</column>
|
||||
<column id="46" parent="24" name="evaluate">
|
||||
<DasType>varchar(255)|0s</DasType>
|
||||
<Position>2</Position>
|
||||
</column>
|
||||
<column id="47" parent="24" name="power_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>3</Position>
|
||||
</column>
|
||||
<column id="48" parent="24" name="data">
|
||||
<Comment>0-好评 1-差评</Comment>
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>4</Position>
|
||||
</column>
|
||||
<index id="49" parent="24" name="PRIMARY">
|
||||
<ColNames>id</ColNames>
|
||||
<Type>btree</Type>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="50" parent="24" name="PRIMARY">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>PRIMARY</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="51" parent="25" name="id">
|
||||
<AutoIncrement>5</AutoIncrement>
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<NotNull>1</NotNull>
|
||||
<Position>1</Position>
|
||||
</column>
|
||||
<column id="52" parent="25" name="power_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>2</Position>
|
||||
</column>
|
||||
<column id="53" parent="25" name="type_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>3</Position>
|
||||
</column>
|
||||
<column id="54" parent="25" name="speed_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>4</Position>
|
||||
</column>
|
||||
<column id="55" parent="25" name="address_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>5</Position>
|
||||
</column>
|
||||
<column id="56" parent="25" name="data">
|
||||
<Comment>0-未使用 1已使用</Comment>
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>6</Position>
|
||||
</column>
|
||||
<index id="57" parent="25" name="PRIMARY">
|
||||
<ColNames>id</ColNames>
|
||||
<Type>btree</Type>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="58" parent="25" name="PRIMARY">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>PRIMARY</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="59" parent="26" name="id">
|
||||
<AutoIncrement>6</AutoIncrement>
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<NotNull>1</NotNull>
|
||||
<Position>1</Position>
|
||||
</column>
|
||||
<column id="60" parent="26" name="power_station_name">
|
||||
<DasType>varchar(50)|0s</DasType>
|
||||
<Position>2</Position>
|
||||
</column>
|
||||
<column id="61" parent="26" name="city_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>3</Position>
|
||||
</column>
|
||||
<column id="62" parent="26" name="distance">
|
||||
<DasType>varchar(50)|0s</DasType>
|
||||
<Position>4</Position>
|
||||
</column>
|
||||
<column id="63" parent="26" name="dictionaries_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>5</Position>
|
||||
</column>
|
||||
<column id="64" parent="26" name="pic">
|
||||
<DasType>varchar(255)|0s</DasType>
|
||||
<Position>6</Position>
|
||||
</column>
|
||||
<column id="65" parent="26" name="type_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>7</Position>
|
||||
</column>
|
||||
<column id="66" parent="26" name="speed_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>8</Position>
|
||||
</column>
|
||||
<column id="67" parent="26" name="address_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>9</Position>
|
||||
</column>
|
||||
<column id="68" parent="26" name="collect_num">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>10</Position>
|
||||
</column>
|
||||
<index id="69" parent="26" name="PRIMARY">
|
||||
<ColNames>id</ColNames>
|
||||
<Type>btree</Type>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="70" parent="26" name="PRIMARY">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>PRIMARY</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="71" parent="27" name="id">
|
||||
<AutoIncrement>4</AutoIncrement>
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<NotNull>1</NotNull>
|
||||
<Position>1</Position>
|
||||
</column>
|
||||
<column id="72" parent="27" name="address_name">
|
||||
<DasType>varchar(255)|0s</DasType>
|
||||
<Position>2</Position>
|
||||
</column>
|
||||
<index id="73" parent="27" name="PRIMARY">
|
||||
<ColNames>id</ColNames>
|
||||
<Type>btree</Type>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="74" parent="27" name="PRIMARY">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>PRIMARY</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="75" parent="28" name="id">
|
||||
<AutoIncrement>5</AutoIncrement>
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<NotNull>1</NotNull>
|
||||
<Position>1</Position>
|
||||
</column>
|
||||
<column id="76" parent="28" name="speed_name">
|
||||
<DasType>varchar(255)|0s</DasType>
|
||||
<Position>2</Position>
|
||||
</column>
|
||||
<column id="77" parent="28" name="particulars">
|
||||
<DasType>varchar(255)|0s</DasType>
|
||||
<Position>3</Position>
|
||||
</column>
|
||||
<index id="78" parent="28" name="PRIMARY">
|
||||
<ColNames>id</ColNames>
|
||||
<Type>btree</Type>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="79" parent="28" name="PRIMARY">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>PRIMARY</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="80" parent="29" name="id">
|
||||
<AutoIncrement>5</AutoIncrement>
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<NotNull>1</NotNull>
|
||||
<Position>1</Position>
|
||||
</column>
|
||||
<column id="81" parent="29" name="type_name">
|
||||
<DasType>varchar(255)|0s</DasType>
|
||||
<Position>2</Position>
|
||||
</column>
|
||||
<column id="82" parent="29" name="particulars">
|
||||
<DasType>varchar(255)|0s</DasType>
|
||||
<Position>3</Position>
|
||||
</column>
|
||||
<index id="83" parent="29" name="PRIMARY">
|
||||
<ColNames>id</ColNames>
|
||||
<Type>btree</Type>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="84" parent="29" name="PRIMARY">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>PRIMARY</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="85" parent="30" name="id">
|
||||
<AutoIncrement>2</AutoIncrement>
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<NotNull>1</NotNull>
|
||||
<Position>1</Position>
|
||||
</column>
|
||||
<column id="86" parent="30" name="user_name">
|
||||
<DasType>varchar(16)|0s</DasType>
|
||||
<Position>2</Position>
|
||||
</column>
|
||||
<column id="87" parent="30" name="user_phone">
|
||||
<DasType>varchar(16)|0s</DasType>
|
||||
<Position>3</Position>
|
||||
</column>
|
||||
<column id="88" parent="30" name="open_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>4</Position>
|
||||
</column>
|
||||
<index id="89" parent="30" name="PRIMARY">
|
||||
<ColNames>id</ColNames>
|
||||
<Type>btree</Type>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="90" parent="30" name="PRIMARY">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>PRIMARY</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="91" parent="31" name="id">
|
||||
<AutoIncrement>4</AutoIncrement>
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<NotNull>1</NotNull>
|
||||
<Position>1</Position>
|
||||
</column>
|
||||
<column id="92" parent="31" name="user_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>2</Position>
|
||||
</column>
|
||||
<column id="93" parent="31" name="car_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>3</Position>
|
||||
</column>
|
||||
<index id="94" parent="31" name="PRIMARY">
|
||||
<ColNames>id</ColNames>
|
||||
<Type>btree</Type>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="95" parent="31" name="PRIMARY">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>PRIMARY</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="96" parent="32" name="id">
|
||||
<AutoIncrement>1</AutoIncrement>
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<NotNull>1</NotNull>
|
||||
<Position>1</Position>
|
||||
</column>
|
||||
<column id="97" parent="32" name="user_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>2</Position>
|
||||
</column>
|
||||
<column id="98" parent="32" name="power_id">
|
||||
<DasType>int(11)|0s</DasType>
|
||||
<Position>3</Position>
|
||||
</column>
|
||||
<index id="99" parent="32" name="PRIMARY">
|
||||
<ColNames>id</ColNames>
|
||||
<Type>btree</Type>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="100" parent="32" name="PRIMARY">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>PRIMARY</UnderlyingIndexName>
|
||||
</key>
|
||||
</database-model>
|
||||
</dataSource>
|
|
@ -0,0 +1,2 @@
|
|||
#n:information_schema
|
||||
!<md> [null, 0, null, null, -2147483648, -2147483648]
|
|
@ -0,0 +1,2 @@
|
|||
#n:mysql
|
||||
!<md> [null, 0, null, null, -2147483648, -2147483648]
|
|
@ -0,0 +1,2 @@
|
|||
#n:performance_schema
|
||||
!<md> [null, 0, null, null, -2147483648, -2147483648]
|
|
@ -0,0 +1,2 @@
|
|||
#n:sys
|
||||
!<md> [null, 0, null, null, -2147483648, -2147483648]
|
|
@ -0,0 +1,2 @@
|
|||
#n:yuekao
|
||||
!<md> [1719216082000, 0, null, null, -2147483648, -2147483648]
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EasyCodeTableSetting">
|
||||
<option name="tableInfoMap">
|
||||
<map>
|
||||
<entry key="yuekao.car">
|
||||
<value>
|
||||
<TableInfoDTO>
|
||||
<option name="fullColumn">
|
||||
<list>
|
||||
<ColumnInfoDTO>
|
||||
<option name="custom" value="false" />
|
||||
<option name="ext" value="{}" />
|
||||
<option name="name" value="id" />
|
||||
<option name="type" value="java.lang.Integer" />
|
||||
</ColumnInfoDTO>
|
||||
<ColumnInfoDTO>
|
||||
<option name="custom" value="false" />
|
||||
<option name="ext" value="{}" />
|
||||
<option name="name" value="carId" />
|
||||
<option name="type" value="java.lang.String" />
|
||||
</ColumnInfoDTO>
|
||||
</list>
|
||||
</option>
|
||||
<option name="name" value="Car" />
|
||||
<option name="preName" value="T" />
|
||||
<option name="saveModelName" value="etl-heihei" />
|
||||
<option name="savePackageName" value="com" />
|
||||
<option name="savePath" value="./etl-heihei/src/main/java/com" />
|
||||
<option name="templateGroupName" value="Default" />
|
||||
</TableInfoDTO>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -1,10 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/etl-auth/etl-auth-common/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-auth/etl-auth-common/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-auth/etl-auth-server/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-auth/etl-auth-server/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-auth/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-auth/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-common/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-common/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-data-source/el-data-source-common/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-data-source/el-data-source-common/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-data-source/el-data-source-server/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-data-source/el-data-source-server/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-data-source/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-data-source/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-gateway/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-gateway/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-groovy/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-groovy/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-heihei/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-heihei/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-jwt-manage/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-jwt-manage/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-mysql/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-mysql/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AliAccessStaticViaInstance" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliArrayNamingShouldHaveBracket" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliControlFlowStatementWithoutBraces" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliDeprecation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliEqualsAvoidNull" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliLongLiteralsEndingWithLowercaseL" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliMissingOverrideAnnotation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliWrapperTypeEquality" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAbstractClassShouldStartWithAbstractNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidApacheBeanUtilsCopy" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidCallStaticSimpleDateFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidCommentBehindStatement" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidComplexCondition" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidConcurrentCompetitionRandom" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidDoubleOrFloatEqualCompare" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidManuallyCreateThread" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidMissUseOfMathRandom" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidNegationOperator" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidNewDateGetTime" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidPatternCompileInMethod" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidReturnInFinally" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidStartWithDollarAndUnderLineNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidUseTimer" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaBigDecimalAvoidDoubleConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaBooleanPropertyShouldNotStartWithIs" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaClassCastExceptionWithSubListToArrayList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaClassCastExceptionWithToArray" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaClassMustHaveAuthor" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaClassNamingShouldBeCamel" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaCollectionInitShouldAssignCapacity" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaCommentsMustBeJavadocFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaConcurrentExceptionWithModifyOriginSubList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaConstantFieldShouldBeUpperCase" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaCountDownShouldInFinally" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaDontModifyInForeachCircle" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaEnumConstantsMustHaveComment" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaExceptionClassShouldEndWithException" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaIbatisMethodQueryForList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaLockShouldWithTryFinally" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaLowerCamelCaseVariableNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaMethodReturnWrapperType" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaMethodTooLong" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaPackageNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaPojoMustOverrideToString" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaPojoMustUsePrimitiveField" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaPojoNoDefaultValue" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaRemoveCommentedCode" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaServiceOrDaoClassShouldEndWithImpl" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaSneakyThrowsWithoutExceptionType" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaStringConcat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaSwitchExpression" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaSwitchStatement" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaTestClassShouldEndWithTestNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaThreadLocalShouldRemove" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaThreadPoolCreation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaThreadShouldSetName" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaTransactionMustHaveRollback" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaUndefineMagicConstant" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaUnsupportedExceptionWithModifyAsList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaUseQuietReferenceNotation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaUseRightCaseForDateFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="MapOrSetKeyShouldOverrideHashCodeEquals" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
|
@ -1,14 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/etl-mysql/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/etl-data-source/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/etl-data-source/el-data-source-server/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/etl-data-source/el-data-source-common/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/etl-groovy/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/etl-auth/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/etl-jwt-manage/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/etl-auth/etl-auth-common/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="ignoredFiles">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$/etl-mysql/pom.xml" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/../../love" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
|
||||
<component name="SuppressionsComponent">
|
||||
<option name="suppComments" value="[]" />
|
||||
</component>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/etl-auth-common.iml" filepath="$PROJECT_DIR$/etl-auth-common.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="AdditionalModuleElements">
|
||||
<content url="file://$MODULE_DIR$/etl-auth/etl-auth-common" dumb="true">
|
||||
<sourceFolder url="file://$MODULE_DIR$/etl-auth/etl-auth-common/src/main/java" isTestSource="false" />
|
||||
</content>
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>etl-auth</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<packaging>pom</packaging>
|
||||
<artifactId>etl-auth-common</artifactId>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<spring-boot.version>2.6.13</spring-boot.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>etl-common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,33 @@
|
|||
package com.auth.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("t_data_source")
|
||||
public class PathPermission {
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "权限代号")
|
||||
private String permissionCode;
|
||||
|
||||
@ApiModelProperty(value = "路由层次")
|
||||
private String hierarchy;
|
||||
|
||||
@ApiModelProperty(value = "路由")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "功能描述")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(value = "状态 0-废弃 1-正在使用")
|
||||
private boolean status;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.auth.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@TableName("t_role_source")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RolesPermission {
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "权限代号")
|
||||
private String permissionCode;
|
||||
|
||||
@ApiModelProperty(value = "角色")
|
||||
private String role;
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.auth.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("t_user")
|
||||
public class UserAccount {
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("角色")
|
||||
private String roles;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty("密码/")
|
||||
private String password;
|
||||
|
||||
// @ApiModelProperty("uuid")
|
||||
// private String UUID;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.auth.common.enums;
|
||||
|
||||
public class PermissionConstants {
|
||||
public static final String ROLES = "roles";
|
||||
public static final String CODE_LIST = "codeList";
|
||||
public static final String ROLE = "role";
|
||||
public static final String PERMISSION_CODE = "permission_code";
|
||||
public static final String USER_CACHE_KEY = "user:username:";
|
||||
public static final String USER_KEY = "user:key:";
|
||||
public static final String USER_NAME = "username";
|
||||
|
||||
public static final String USER_ID = "userId";
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>etl-auth</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>etl-auth-server</artifactId>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<spring-boot.version>2.6.13</spring-boot.version>
|
||||
<spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>etl-auth-common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
<!--shiro-->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-spring</artifactId>
|
||||
<version>1.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
|
||||
<version>4.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>etl-jwt-manage</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<groupId>javax.servlet</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>etl-common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
<version>3.1.7</version>
|
||||
</dependency>
|
||||
<!--shiro-->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-spring</artifactId>
|
||||
<version>1.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<configuration>
|
||||
<mainClass>com.auth.server.EtlAuthServerApplication</mainClass>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>repackage</id>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,25 @@
|
|||
package com.auth.server;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.auth.server.mapper")
|
||||
@ComponentScan(basePackages = {"com.etl.jwt.util", "com.etl.jwt.config",
|
||||
"com.auth.server.controller","com.auth.server.service","com.auth.server.service.impl","com.auth.server.config"})
|
||||
public class EtlAuthServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(EtlAuthServerApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public BCryptPasswordEncoder encryptPasswordEncoder(){
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.auth.server.config;
|
||||
|
||||
|
||||
import org.apache.http.util.TextUtils;
|
||||
import org.apache.shiro.crypto.hash.HashRequest;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/*
|
||||
* MD5 算法
|
||||
*/
|
||||
|
||||
public class MD5s {
|
||||
|
||||
public static String md5(String string) {
|
||||
if (TextUtils.isEmpty(string)) {
|
||||
return "";
|
||||
}
|
||||
MessageDigest md5 = null;
|
||||
try {
|
||||
md5 = MessageDigest.getInstance("MD5");
|
||||
byte[] bytes = md5.digest(string.getBytes());
|
||||
String result = "";
|
||||
for (byte b : bytes) {
|
||||
String temp = Integer.toHexString(b & 0xff);
|
||||
if (temp.length() == 1) {
|
||||
temp = "0" + temp;
|
||||
}
|
||||
result += temp;
|
||||
}
|
||||
return result;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
HashRequest request = new HashRequest.Builder()
|
||||
.setAlgorithmName("MD5") // 使用 SHA-256 算法
|
||||
.setSource(string.getBytes()) // 要散列的密码(作为字节数组)
|
||||
.build();
|
||||
//passwordService.encryptPassword(request);
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package com.auth.server.config;
|
||||
|
||||
|
||||
import com.auth.server.util.UserRealm;
|
||||
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
|
||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
public class ShiroConfig {
|
||||
|
||||
//此处用于实现授权功能,配置需要拦截的接口
|
||||
//此处用于实现授权功能,配置需要拦截的接口
|
||||
@Bean
|
||||
public ShiroFilterFactoryBean getShiroFilterFactoryBean(@Qualifier("getDefaultWebSecurityManager") DefaultWebSecurityManager defaultWebSecurityManager) {
|
||||
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
|
||||
shiroFilterFactoryBean.setSecurityManager(defaultWebSecurityManager);
|
||||
//拦截页面
|
||||
Map<String, String> filterMap = new LinkedHashMap<>();
|
||||
//登录/登出,所有人的权限
|
||||
filterMap.put("/user/login", "anon");
|
||||
filterMap.put("/user/logout", "anon");
|
||||
|
||||
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterMap);
|
||||
//未登录页面跳转
|
||||
shiroFilterFactoryBean.setLoginUrl("/user/show");
|
||||
//未有权限页面跳转
|
||||
shiroFilterFactoryBean.setUnauthorizedUrl("/user/unauthorized");
|
||||
|
||||
return shiroFilterFactoryBean;
|
||||
}
|
||||
|
||||
//注入对应的userRealm类
|
||||
@Bean
|
||||
public DefaultWebSecurityManager getDefaultWebSecurityManager(@Qualifier("userRealm") UserRealm userRealm) {
|
||||
DefaultWebSecurityManager SecurityManager = new DefaultWebSecurityManager();
|
||||
SecurityManager.setRealm(userRealm);
|
||||
return SecurityManager;
|
||||
}
|
||||
@Bean
|
||||
public UserRealm userRealm() {
|
||||
UserRealm userRealm = new UserRealm();
|
||||
//注册MD5加密
|
||||
userRealm.setCredentialsMatcher(hashedCredentialsMatcher());
|
||||
return userRealm;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置shiro加密方式
|
||||
* @return HashedCredentialsMatcher
|
||||
*/
|
||||
@Bean
|
||||
public HashedCredentialsMatcher hashedCredentialsMatcher(){
|
||||
HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher();
|
||||
// 使用md5 算法进行加密
|
||||
hashedCredentialsMatcher.setHashAlgorithmName("MD5");
|
||||
// 设置散列次数: 意为加密几次
|
||||
hashedCredentialsMatcher.setHashIterations(2);
|
||||
|
||||
return hashedCredentialsMatcher;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package com.auth.server.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.nacos.api.model.v2.Result;
|
||||
import com.auth.common.entity.UserAccount;
|
||||
import com.auth.common.enums.PermissionConstants;
|
||||
import com.auth.server.service.UserManageService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.etl.common.enums.ResponseCodeEnum;
|
||||
import com.etl.common.result.CommonResult;
|
||||
import com.etl.jwt.util.JwtTokenUtil;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.*;
|
||||
import org.apache.shiro.mgt.DefaultSecurityManager;
|
||||
import org.apache.shiro.realm.SimpleAccountRealm;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 登录 controller层
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@Api(tags = "登录-API")
|
||||
@RequestMapping("/user")
|
||||
public class LoginControler {
|
||||
@Autowired
|
||||
private UserManageService userManageService;
|
||||
|
||||
/**
|
||||
* 用户登录 (使用用户名)
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "用户登录")
|
||||
@ApiOperationSupport(author = "liz")
|
||||
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
||||
public Result<Object> userLogin(@RequestBody UserAccount user) {
|
||||
|
||||
return userManageService.userLogin(user);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 刷新JWT令牌,用旧的令牌换新的令牌
|
||||
* 参数为需要刷新的令牌
|
||||
* header中携带刷新令牌
|
||||
*/
|
||||
|
||||
/**
|
||||
* 当认证服务返回给客户端的 JWT 也就是 access_token 过期后,客户端如果需要再次通过发送登录请求重新拿到 access_token会使得用户体验很不友好。
|
||||
* 而JWT 生成后是不能篡改里面的内容,即使是 JWT 的有效期也不行。所以延长 access_token 有效期的做法并不适合,而且如果长期保持一个 access_token 有效,
|
||||
* 也是不安全的。所以我们时常使用refresh token来进行token的刷新。
|
||||
* <p>
|
||||
* 我们一般会把 refresh_token 设置的过期时间稍微长一点,比如两倍于 access_token,当 access_token 过期后,refresh_token 如果还没有过期,
|
||||
* 就可以利用两者的过期时间差进行重新生成令牌的操作,也就是刷新令牌,同时删除掉redis中缓存的旧令牌。
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/token/refresh", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "刷新令牌")
|
||||
@ApiOperationSupport(author = "liz")
|
||||
public CommonResult<Object> refreshToken(@RequestHeader(value = "${auth.jwt.header}") String token) {
|
||||
|
||||
return userManageService.refreshToken(token);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.auth.server.controller;
|
||||
|
||||
import com.auth.common.entity.PathPermission;
|
||||
import com.auth.common.entity.RolesPermission;
|
||||
import com.auth.common.enums.PermissionConstants;
|
||||
import com.auth.server.service.PathService;
|
||||
import com.auth.server.service.PermissionService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 角色权限 controller层
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags ="权限-API")
|
||||
@RequestMapping("/permission")
|
||||
public class PermissionController {
|
||||
@Autowired
|
||||
private PermissionService permissionService;
|
||||
|
||||
@Resource
|
||||
private PathService pathService;
|
||||
|
||||
@PostMapping("/permission/add")
|
||||
public boolean permissionAdd(@RequestBody Map<String,Object> map) {
|
||||
String roles = (String) map.get(PermissionConstants.ROLES);
|
||||
List<String> codeList = (List<String>) map.get(PermissionConstants.CODE_LIST);
|
||||
return permissionService.permissionAdd(roles, codeList);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
public List<String> pathGet(@RequestParam("roles") String roles) {
|
||||
RolesPermission permission = permissionService.getOne(new QueryWrapper<RolesPermission>().eq(PermissionConstants.ROLE,roles));
|
||||
String codes = StringUtils.strip(permission.getPermissionCode(), "[]");
|
||||
List<String> list = Arrays.asList(codes.split(","));
|
||||
List<String> pathList = new ArrayList<>();
|
||||
for(String code:list){
|
||||
String api = pathService.getOne(new QueryWrapper<PathPermission>().eq(PermissionConstants.PERMISSION_CODE,code.trim())).getPath();
|
||||
pathList.add(api);
|
||||
}
|
||||
return pathList;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
//package com.auth.server.interceptor;
|
||||
//import com.auth.server.mapper.UserMangeMapper;
|
||||
//import org.springframework.web.servlet.HandlerInterceptor;
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
//import javax.servlet.http.HttpSession;
|
||||
//public class UserInterceptor implements HandlerInterceptor {
|
||||
// private UserMangeMapper userMangeMapper;
|
||||
// public UserInterceptor(UserMangeMapper userMapper){
|
||||
// this.userMangeMapper=userMapper;
|
||||
// }
|
||||
// @Override
|
||||
// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
// HttpSession session = request.getSession();
|
||||
// String username = (String) session.getAttribute("username");
|
||||
// //数据库
|
||||
// String UUID=userMangeMapper.getUUID(username);
|
||||
// //session
|
||||
// String uuid = (String)session.getAttribute("uuid");
|
||||
// System.out.println("uuid = " + uuid);
|
||||
// System.out.println("UUID = " + UUID);
|
||||
// if(UUID.equals(uuid)){
|
||||
// return true;
|
||||
// }else {
|
||||
// System.out.println("拦截"+request.getRequestURI());
|
||||
// response.sendRedirect("/login");
|
||||
// response.setStatus(401);
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//}
|
|
@ -0,0 +1,8 @@
|
|||
package com.auth.server.mapper;
|
||||
|
||||
import com.auth.common.entity.PathPermission;
|
||||
import com.auth.common.entity.RolesPermission;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface PathMapper extends BaseMapper<PathPermission> {
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.auth.server.mapper;
|
||||
|
||||
|
||||
import com.auth.common.entity.RolesPermission;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface PermissionMapper extends BaseMapper<RolesPermission> {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.auth.server.mapper;
|
||||
|
||||
|
||||
import com.auth.common.entity.UserAccount;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UserMangeMapper extends BaseMapper<UserAccount> {
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.auth.server.service;
|
||||
|
||||
import com.auth.common.entity.PathPermission;
|
||||
import com.auth.common.entity.RolesPermission;
|
||||
import com.auth.common.entity.UserAccount;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface PathService extends IService<PathPermission> {
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.auth.server.service;
|
||||
|
||||
import com.auth.common.entity.RolesPermission;
|
||||
import com.auth.common.entity.UserAccount;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PermissionService extends IService<RolesPermission> {
|
||||
boolean permissionAdd(String roles, List<String> codeList);
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.auth.server.service;
|
||||
|
||||
import com.alibaba.nacos.api.model.v2.Result;
|
||||
import com.auth.common.entity.UserAccount;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.etl.common.result.CommonResult;
|
||||
|
||||
public interface UserManageService extends IService<UserAccount> {
|
||||
|
||||
|
||||
Result<Object> userLogin(UserAccount user);
|
||||
|
||||
CommonResult<Object> refreshToken(String token);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.auth.server.service.impl;
|
||||
|
||||
import com.auth.common.entity.PathPermission;
|
||||
import com.auth.common.entity.RolesPermission;
|
||||
import com.auth.server.mapper.PathMapper;
|
||||
import com.auth.server.mapper.PermissionMapper;
|
||||
import com.auth.server.service.PathService;
|
||||
import com.auth.server.service.PermissionService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PathServiceImpl extends ServiceImpl<PathMapper, PathPermission> implements PathService {
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.auth.server.service.impl;
|
||||
|
||||
import com.auth.common.entity.RolesPermission;
|
||||
import com.auth.common.enums.PermissionConstants;
|
||||
import com.auth.server.mapper.PermissionMapper;
|
||||
import com.auth.server.service.PermissionService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PermissionServiceImpl extends ServiceImpl<PermissionMapper, RolesPermission> implements PermissionService {
|
||||
@Autowired
|
||||
private PermissionMapper permissionMapper;
|
||||
|
||||
@Override
|
||||
public boolean permissionAdd(String roles, List<String> codeList) {
|
||||
RolesPermission rolesPermission = new RolesPermission();
|
||||
rolesPermission.setRole(roles);
|
||||
int result = 0;
|
||||
RolesPermission role = getRoleByName(roles);
|
||||
|
||||
if (role != null) {
|
||||
result = updateRolePermission(rolesPermission, role, codeList);
|
||||
} else {
|
||||
result = insertRolePermission(rolesPermission, codeList);
|
||||
}
|
||||
return result > 0;
|
||||
}
|
||||
|
||||
private RolesPermission getRoleByName(String roleName) {
|
||||
return permissionMapper.selectOne(new QueryWrapper<RolesPermission>().eq(PermissionConstants.ROLE, roleName));
|
||||
}
|
||||
|
||||
private int updateRolePermission(RolesPermission rolesPermission, RolesPermission role, List<String> codeList) {
|
||||
//去掉头尾括号,并转为列表
|
||||
List<String> list = new java.util.ArrayList<>(Collections.singletonList(
|
||||
StringUtils.strip(role.getPermissionCode(), "[]")));
|
||||
//将新数据添加至列表
|
||||
list.addAll(codeList);
|
||||
|
||||
rolesPermission.setPermissionCode(list.toString());
|
||||
rolesPermission.setId(role.getId());
|
||||
return permissionMapper.updateById(rolesPermission);
|
||||
}
|
||||
|
||||
private int insertRolePermission(RolesPermission rolesPermission, List<String> codeList) {
|
||||
if (codeList != null) {
|
||||
rolesPermission.setPermissionCode(codeList.toString());
|
||||
}
|
||||
return permissionMapper.insert(rolesPermission);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,168 @@
|
|||
package com.auth.server.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.nacos.api.model.v2.Result;
|
||||
import com.auth.common.entity.UserAccount;
|
||||
import com.auth.common.enums.PermissionConstants;
|
||||
import com.auth.server.config.MD5s;
|
||||
import com.auth.server.mapper.UserMangeMapper;
|
||||
import com.auth.server.service.UserManageService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.etl.common.enums.ResponseCodeEnum;
|
||||
import com.etl.common.result.CommonResult;
|
||||
import com.etl.jwt.util.JwtTokenUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.*;
|
||||
import org.apache.shiro.mgt.DefaultSecurityManager;
|
||||
import org.apache.shiro.realm.SimpleAccountRealm;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static java.lang.System.nanoTime;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class UserManageServiceImpl extends ServiceImpl<UserMangeMapper, UserAccount> implements UserManageService {
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Resource
|
||||
private JwtTokenUtil jwtTokenUtil;
|
||||
|
||||
@Autowired
|
||||
private UserMangeMapper UserMangeMapper;
|
||||
|
||||
@Override
|
||||
public Result<Object> userLogin(UserAccount user) {
|
||||
long startTime = nanoTime();
|
||||
// 获取用户名
|
||||
String username = user.getUsername();
|
||||
// 获取密码
|
||||
String password = user.getPassword();
|
||||
// 参数校验
|
||||
Result result = checkUser(username, password);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
// 创建SimpleAccountRealm并添加账户信息
|
||||
SimpleAccountRealm simpleAccountRealm = new SimpleAccountRealm();
|
||||
// 确保这里添加的用户名和密码与用户提供的匹配
|
||||
simpleAccountRealm.addAccount(username, password);
|
||||
// 配置SecurityManager并设置Realm
|
||||
DefaultSecurityManager securityManager = new DefaultSecurityManager(simpleAccountRealm);
|
||||
securityManager.setRealm(simpleAccountRealm);
|
||||
SecurityUtils.setSecurityManager(securityManager);
|
||||
//shiro验证
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
//根据用户名密码生成一个令牌
|
||||
AuthenticationToken token = new UsernamePasswordToken(username, password);
|
||||
try {
|
||||
//执行登录操作
|
||||
subject.login(token);
|
||||
//将用户信息存入redis
|
||||
saveUserInfoToRedis(username, user);
|
||||
} catch (UnknownAccountException e) {
|
||||
log.info("登录用户不存在:{}", e);
|
||||
return new Result<>(416, "用户不存在", username);
|
||||
} catch (IncorrectCredentialsException e) {
|
||||
log.info("登录密码错误:{}", e);
|
||||
return new Result<>(412, "密码错误,请重新登录", password);
|
||||
} catch (AuthenticationException e) {
|
||||
log.warn("用户登录异常:" + e.getMessage());
|
||||
return new Result<>(416, "账户异常", username);
|
||||
}
|
||||
String userInfo = stringRedisTemplate.opsForValue().get(PermissionConstants.USER_NAME + username);
|
||||
UserAccount account = null;
|
||||
if (userInfo != null) {
|
||||
account = JSON.parseObject(userInfo, UserAccount.class);
|
||||
} else {
|
||||
//获取登录用户信息
|
||||
account = UserMangeMapper.selectOne(new QueryWrapper<UserAccount>().eq(PermissionConstants.USER_NAME, username));
|
||||
stringRedisTemplate.opsForValue().set(PermissionConstants.USER_NAME + username, JSON.toJSONString(account));
|
||||
}
|
||||
// 通过 jwtTokenUtil 生成 JWT 令牌和刷新令牌
|
||||
Map<String, Object> tokenMap = jwtTokenUtil
|
||||
.generateTokenAndRefreshToken(String.valueOf(account.getId()), username);
|
||||
// 用户角色映射表中中查询用户角色
|
||||
account.getRoles();
|
||||
long endTime = nanoTime();
|
||||
// 计算耗时(单位为纳秒)
|
||||
long elapsedTime = endTime - startTime;
|
||||
// 将耗时转换为毫秒
|
||||
double elapsedTimeInMillis = elapsedTime / 1000000.0;
|
||||
// 输出结果
|
||||
System.out.println("程序运行耗时:" + elapsedTimeInMillis + " 毫秒");
|
||||
return Result.success(tokenMap);
|
||||
}
|
||||
|
||||
|
||||
private void saveUserInfoToRedis(String username, UserAccount user) {
|
||||
stringRedisTemplate.opsForValue().set(PermissionConstants.USER_CACHE_KEY + username,
|
||||
JSON.toJSONString(user), 30 * 60, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
private Result checkUser(String username, String password) {
|
||||
// 检查用户名和密码的合法性
|
||||
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
|
||||
return new Result<>(400, "用户名或密码不能为空");
|
||||
}
|
||||
if (username.length() < 3 || username.length() > 20) {
|
||||
return new Result<>(400, "用户名长度必须在6-20个字符之间");
|
||||
}
|
||||
if (password.length() < 3 || password.length() > 20) {
|
||||
return new Result<>(400, "密码长度必须在6-20个字符之间");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Object> refreshToken(String token) {
|
||||
token = com.auth.server.util.SecurityUtils.replaceTokenPrefix(token);
|
||||
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
return new CommonResult<>(ResponseCodeEnum.TOKEN_MISSION.getCode(),
|
||||
ResponseCodeEnum.TOKEN_MISSION.getMessage());
|
||||
}
|
||||
|
||||
// 对Token解签名,并验证Token是否过期
|
||||
boolean isJwtNotValid = jwtTokenUtil.isTokenExpired(token);
|
||||
if (isJwtNotValid) {
|
||||
return new CommonResult<>(ResponseCodeEnum.TOKEN_INVALID.getCode(),
|
||||
ResponseCodeEnum.TOKEN_INVALID.getMessage());
|
||||
}
|
||||
|
||||
// 验证 token 里面的 userId 是否为空
|
||||
String userId = jwtTokenUtil.getUserIdFromToken(token);
|
||||
String username = jwtTokenUtil.getUserNameFromToken(token);
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
return new CommonResult<>(ResponseCodeEnum.TOKEN_INVALID.getCode(),
|
||||
ResponseCodeEnum.TOKEN_INVALID.getMessage());
|
||||
}
|
||||
|
||||
// 这里为了保证 refreshToken 只能用一次,刷新后,会从 redis 中删除。
|
||||
// 如果用的不是 redis 中的 refreshToken 进行刷新令牌,则不能刷新。
|
||||
// 如果使用 redis 中已过期的 refreshToken 也不能刷新令牌。
|
||||
boolean isRefreshTokenNotExisted = jwtTokenUtil.isRefreshTokenNotExistCache(token);
|
||||
if (isRefreshTokenNotExisted) {
|
||||
return new CommonResult<>(ResponseCodeEnum.REFRESH_TOKEN_INVALID.getCode(),
|
||||
ResponseCodeEnum.REFRESH_TOKEN_INVALID.getMessage());
|
||||
}
|
||||
|
||||
//String us = jwtTokenUtil.getUserIdFromToken(token);
|
||||
Map<String, Object> tokenMap = jwtTokenUtil.refreshTokenAndGenerateToken(userId, username);
|
||||
|
||||
return new CommonResult<>(200, ResponseCodeEnum.SUCCESS.getMessage(), tokenMap);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.auth.server.util;
|
||||
|
||||
|
||||
import com.etl.common.constants.TokenConstants;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import static org.apache.logging.log4j.util.Strings.isEmpty;
|
||||
|
||||
/**
|
||||
* 权限获取工具类
|
||||
*
|
||||
*/
|
||||
public class SecurityUtils
|
||||
{
|
||||
|
||||
/**
|
||||
* 根据request获取请求token
|
||||
*/
|
||||
public static String getToken(HttpServletRequest request)
|
||||
{
|
||||
// 从header获取token标识
|
||||
String token = request.getHeader(TokenConstants.AUTHENTICATION);
|
||||
return replaceTokenPrefix(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* 裁剪token前缀
|
||||
*/
|
||||
public static String replaceTokenPrefix(String token) {
|
||||
// 如果前端设置了令牌前缀,则裁剪掉前缀
|
||||
if (!isEmpty(token) && token.startsWith(TokenConstants.PREFIX)) {
|
||||
token = token.replaceFirst(TokenConstants.PREFIX, "");
|
||||
}
|
||||
return token;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.auth.server.util;
|
||||
|
||||
|
||||
import com.auth.common.entity.UserAccount;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.auth.server.service.UserManageService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.*;
|
||||
import org.apache.shiro.authz.AuthorizationInfo;
|
||||
import org.apache.shiro.authz.SimpleAuthorizationInfo;
|
||||
import org.apache.shiro.realm.AuthorizingRealm;
|
||||
import org.apache.shiro.subject.PrincipalCollection;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.apache.shiro.util.ByteSource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@Slf4j
|
||||
public class UserRealm extends AuthorizingRealm {
|
||||
@Autowired
|
||||
private UserManageService userManageService;
|
||||
//授权
|
||||
@Override
|
||||
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
|
||||
/**配置权限
|
||||
*此处User实体需配置属性roles,用户权限
|
||||
*获取当前用户对象
|
||||
*/
|
||||
SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
|
||||
Subject subject= SecurityUtils.getSubject();
|
||||
UserAccount currentUser =(UserAccount) subject.getPrincipal();
|
||||
authorizationInfo.addStringPermission(currentUser.getRoles());
|
||||
log.info("用户权限为:"+currentUser.getRoles());
|
||||
return authorizationInfo;
|
||||
}
|
||||
//认证
|
||||
@Override
|
||||
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
|
||||
|
||||
UsernamePasswordToken token = (UsernamePasswordToken) authenticationToken;
|
||||
//用户名/密码认证
|
||||
//从接口处获取得到的用户名
|
||||
String username = token.getUsername();
|
||||
|
||||
//调用mybatis_plus中的方法,查询数据库中用户名对应的数据
|
||||
QueryWrapper<UserAccount> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("username",username);
|
||||
UserAccount user=userManageService.getOne(wrapper);
|
||||
|
||||
//为空,即用户名不存在
|
||||
if(user==null){
|
||||
return null;
|
||||
}else {
|
||||
log.info(user.getUsername());
|
||||
}
|
||||
//principal:认证的实体信息,可以是username,也可以是数据库表对应的用户的实体对象
|
||||
// Object principal = user.getUsername();
|
||||
ByteSource salt = ByteSource.Util.bytes(username);
|
||||
return new SimpleAuthenticationInfo(user.getUsername(), user.getPassword() , salt,getName());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
server:
|
||||
port: 9092
|
||||
spring:
|
||||
application:
|
||||
name: engine-auth
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://115.159.33.152:3306/etl
|
||||
username: root
|
||||
password: lzm@123
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
profiles:
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
#注册服务
|
||||
discovery:
|
||||
server-addr: 182.254.221.163:8848
|
||||
namespace: 10a15e4b-3457-44dc-9378-cc25849f1872
|
||||
# 配置
|
||||
config:
|
||||
server-addr: 182.254.221.163:8848
|
||||
namespace: 10a15e4b-3457-44dc-9378-cc25849f1872
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.bwie: DEBUG
|
||||
auth:
|
||||
jwt:
|
||||
enabled: true # 是否开启JWT登录认证功能
|
||||
secret: passjava # JWT 私钥,用于校验JWT令牌的合法性
|
||||
expiration: 1800000 # JWT 令牌的有效期,用于校验JWT令牌的合法性,半个小时
|
||||
header: Authorization # HTTP 请求的 Header 名称,该 Header作为参数传递 JWT 令牌
|
||||
userParamName: username # 用户登录认证用户名参数名称
|
||||
pwdParamName: password # 用户登录认证密码参数名称
|
||||
useDefaultController: true # 是否使用默认的JwtAuthController
|
||||
skipValidUrl:
|
||||
- /auth/login
|
||||
- /auth/logout
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:/mapper/*mapper.xml
|
||||
typeAliasesPackage: com.auth.common.entity
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.auth.server.mapper.PathMapper">
|
||||
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.auth.server.mapper.PermissionMapper">
|
||||
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.auth.server.mapper.UserMangeMapper">
|
||||
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,6 @@
|
|||
<html>
|
||||
<body>
|
||||
<h1>hello word!!!</h1>
|
||||
<p>this is a html page</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,31 @@
|
|||
package com.auth.server;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
|
||||
@SpringBootTest
|
||||
class EtlAuthServerApplicationTests {
|
||||
|
||||
@Autowired
|
||||
private BCryptPasswordEncoder bCryptPasswordEncoder;
|
||||
@Test
|
||||
public void enCoder() {
|
||||
String password="123";
|
||||
String encode = bCryptPasswordEncoder.encode(password);
|
||||
System.out.println("加密后的密码:"+encode);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchesPassword(){
|
||||
String encode="$2a$10$qyOS46MrKAm2wIyJl95.eO70ioBDvsgv8nnCCjhGJUxPIhPC56PTa";
|
||||
boolean matches = bCryptPasswordEncoder.matches("123", encode);
|
||||
if (matches){
|
||||
System.out.println("密码正确");
|
||||
}else {
|
||||
System.out.println("密码错误");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>etl-cloud</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>etl-auth</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>etl-auth-common</module>
|
||||
<module>etl-auth-server</module>
|
||||
</modules>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<spring-boot.version>2.6.13</spring-boot.version>
|
||||
<spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version>
|
||||
</properties>
|
||||
</project>
|
|
@ -9,13 +9,54 @@
|
|||
</parent>
|
||||
<artifactId>etl-common</artifactId>
|
||||
<description>etl-common</description>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<spring-boot.version>2.6.13</spring-boot.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>etl-cloud</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||
<version>3.21.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- SpringBoot Boot Redis -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!--knife4j-->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
|
||||
<version>4.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.tess4j</groupId>
|
||||
<artifactId>tess4j</artifactId>
|
||||
|
@ -98,40 +139,6 @@
|
|||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<configuration>
|
||||
<mainClass>com.health.cloud.common.HealthCloudCommonApplication</mainClass>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>repackage</id>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
|
@ -21,4 +21,12 @@ public class TokenConstants {
|
|||
* token标识
|
||||
*/
|
||||
public static final String TOKEN = "token";
|
||||
/**
|
||||
* 令牌自定义标识
|
||||
*/
|
||||
public static final String AUTHENTICATION = "Authorization";
|
||||
/**
|
||||
* 令牌前缀
|
||||
*/
|
||||
public static final String PREFIX = "Bearer ";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package com.etl.common.enums;
|
||||
|
||||
public enum ResponseCodeEnum {
|
||||
|
||||
SUCCESS(200, "成功"),
|
||||
FAIL(412, "失败"),
|
||||
LOGIN_ERROR(202, "用户名或密码错误"),
|
||||
|
||||
UNKNOWN_ERROR(500, "未知错误"),
|
||||
PARAMETER_ILLEGAL(400, "参数不合法"),
|
||||
|
||||
TOKEN_INVALID(412, "token 已过期或验证不正确!"),
|
||||
TOKEN_SIGNATURE_INVALID(403, "无效的签名"),
|
||||
TOKEN_MISSION(403, "token 缺失"),
|
||||
REFRESH_TOKEN_INVALID(412, "refreshToken 无效"),
|
||||
LOGOUT_ERROR(444, "用户登出失败");
|
||||
private final int code;
|
||||
private final String message;
|
||||
ResponseCodeEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.etl.common.exception;
|
||||
|
||||
public class LimitException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// 默认的构造函数
|
||||
public LimitException() {
|
||||
super();
|
||||
}
|
||||
|
||||
// 带错误信息的构造函数
|
||||
public LimitException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
// 带错误信息和原因的构造函数
|
||||
public LimitException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
// 带原因的构造函数
|
||||
public LimitException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.etl.common.result;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CommonResult<T>{
|
||||
private Integer code;
|
||||
private String message;
|
||||
private T data;
|
||||
private int dataSize;
|
||||
|
||||
public CommonResult(Integer code,String message){
|
||||
this(code,message,null,0);
|
||||
}
|
||||
public CommonResult(Integer code,String message,T data){
|
||||
this(code,message,data,0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
#org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
# com.health.common.handle.ExceptHandle
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,5 +0,0 @@
|
|||
#Generated by Maven
|
||||
#Tue Jun 18 19:06:20 CST 2024
|
||||
version=1.0-SNAPSHOT
|
||||
groupId=com.bwie
|
||||
artifactId=etl-common
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>etl-data-source</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>el-data-source-common</artifactId>
|
||||
<description>el-data-source-common</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<spring-boot.version>2.6.13</spring-boot.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>etl-common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,33 @@
|
|||
package com.etl.data.source.common.ennum;
|
||||
|
||||
public enum LimitType {
|
||||
IP,
|
||||
/**
|
||||
* 直接拒绝超过限流阈值的请求
|
||||
*/
|
||||
REJECT,
|
||||
|
||||
/**
|
||||
* 对超过限流阈值的请求进行排队,等待资源可用
|
||||
*/
|
||||
QUEUE,
|
||||
|
||||
/**
|
||||
* 允许超过限流阈值的请求,但可能需要更长时间处理
|
||||
* (比如降级服务到较慢的后端)
|
||||
*/
|
||||
DEGRADE,
|
||||
|
||||
/**
|
||||
* 自定义处理方式
|
||||
*/
|
||||
CUSTOM,
|
||||
|
||||
// 这里可以添加更多的处理方式...
|
||||
|
||||
/**
|
||||
* 默认的处理方式
|
||||
*/
|
||||
DEFAULT,
|
||||
CUSTOMER,
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.etl.data.source.common.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
公共类
|
||||
*/
|
||||
@Data
|
||||
public class BaseEntity {
|
||||
private Long createBy;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Long updateBy;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private Integer isDelete;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.etl.data.source.common.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 代码类
|
||||
*/
|
||||
@Data
|
||||
public class Code {
|
||||
private Integer id;
|
||||
private String codeContent;
|
||||
private Integer codeTypeId;
|
||||
private Integer ruleId;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.etl.data.source.common.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 代码类型
|
||||
*/
|
||||
@Data
|
||||
@TableName("code_type")
|
||||
public class CodeType {
|
||||
private Integer id; // 主键ID,自增长
|
||||
private String codeTypeName; // 编码类型名称
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.etl.data.source.common.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 数据源
|
||||
*/
|
||||
@Data
|
||||
@TableName("data_source")
|
||||
public class DataSource{
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@NotEmpty(message = "数据源描述不能为空")
|
||||
private String dataSourceDescribe;
|
||||
|
||||
@NotEmpty(message = "数据源连接地址不能为空")
|
||||
private String linkAddress;
|
||||
|
||||
@NotEmpty(message = "数据源用户名不能为空")
|
||||
private String userName;
|
||||
|
||||
@NotEmpty(message = "数据源密码不能为空")
|
||||
private String password;
|
||||
|
||||
@NotNull(message = "数据源端口不能为空")
|
||||
private Integer connectionPort;
|
||||
|
||||
private String connectionDatabaseName;
|
||||
|
||||
@NotEmpty(message = "数据源驱动不能为空")
|
||||
private String extraConfig;
|
||||
|
||||
@NotNull(message = "数据源状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
@NotEmpty(message = "数据源备注不能为空")
|
||||
private String remark;
|
||||
|
||||
private Integer dataSourceType;
|
||||
@TableField(exist = false)
|
||||
private String dataSourceTypeName;
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.etl.data.source.common.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 数据源类型
|
||||
*/
|
||||
@Data
|
||||
@TableName("data_source_type")
|
||||
public class DataSourceType {
|
||||
|
||||
@NotNull(message = "id不能为空")
|
||||
private int id;
|
||||
|
||||
@NotBlank(message = "数据源类型不能为空")
|
||||
private String dataSourceTypeName;
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.etl.data.source.common.pojo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "数据库配置")
|
||||
public class DatabaseConfig {
|
||||
@NotBlank(message = "驱动类不能为空")
|
||||
@ApiModelProperty(value = "驱动类")
|
||||
private String driverClassName;
|
||||
@NotBlank(message = "数据库连接地址不能为空")
|
||||
@ApiModelProperty(value = "数据库连接地址")
|
||||
private String url;
|
||||
@NotBlank(message = "数据库用户名不能为空")
|
||||
@ApiModelProperty(value = "数据库用户名")
|
||||
private String username;
|
||||
@NotBlank(message = "数据库密码不能为空")
|
||||
@ApiModelProperty(value = "数据库密码")
|
||||
private String password;
|
||||
@ApiModelProperty(value = "数据库表名")
|
||||
private String tableName;
|
||||
@ApiModelProperty(value = "数据库库名")
|
||||
private String warehouseName;
|
||||
@ApiModelProperty(value = "数据表输入输出状态 0:输入 1:输出")
|
||||
private Integer data;
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.etl.data.source.common.pojo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @ClassName DatabaseRedis
|
||||
* @Description 描述
|
||||
* @Author ZeZhang.Liu
|
||||
* @Date 2024/6/24 8:35
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "redis数据库配置")
|
||||
public class DatabaseRedis {
|
||||
@NotBlank(message = "redis连接地址不能为空")
|
||||
private String url;
|
||||
@NotNull(message = "redis端口号不能为空")
|
||||
private Integer port;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.etl.data.source.common.pojo;
|
||||
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @ClassName Persion
|
||||
* @Description 描述
|
||||
* @Author ZeZhang.Liu
|
||||
* @Date 2024/6/25 9:32
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Person {
|
||||
private String name;
|
||||
|
||||
private Integer age;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.etl.data.source.common.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
/**
|
||||
* 规则类
|
||||
*/
|
||||
@Data
|
||||
@TableName("rule")
|
||||
public class Rule {
|
||||
private Integer id; // 规则ID
|
||||
private String ruleId; // 规则编号
|
||||
private String ruleName; // 规则名称
|
||||
private Integer ruleTypeId; // 规则类型ID
|
||||
private Integer status; // 状态
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer codeTypeId; // 编码类型ID
|
||||
|
||||
private String classPath; // 类路径
|
||||
private Integer publicWay; // 公开方式
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.etl.data.source.common.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
/**
|
||||
* 规则类型
|
||||
*/
|
||||
@Data
|
||||
@TableName("rule_type")
|
||||
public class RuleType {
|
||||
private Integer id; // 主键ID,自增长
|
||||
private String ruleTypeName; // 规则类型名称
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.etl.data.source.common.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*任务类
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@TableName("task_manager")
|
||||
@ApiModel(value = "Task", description = "任务实体类")
|
||||
public class Task {
|
||||
|
||||
@ApiModelProperty(value = "主键ID", example = "1")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "任务名称", example = "完成订单")
|
||||
private String taskName;
|
||||
|
||||
@ApiModelProperty(value = "任务ID", example = "T12345")
|
||||
private String taskId;
|
||||
|
||||
@ApiModelProperty(value = "权重(1紧急, 2高, 3中, 4低)", example = "1")
|
||||
private Integer taskWeight;
|
||||
|
||||
@ApiModelProperty(value = "状态(1执行中, 2暂停)", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "创建人ID", example = "1001")
|
||||
private Integer createBy;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", example = "2023-03-15T10:15:30")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改人ID", example = "1002")
|
||||
private Integer updateBy;
|
||||
|
||||
@ApiModelProperty(value = "修改时间", example = "2023-03-16T12:30:00")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "是否删除(0未删除, 1已删除)", example = "0")
|
||||
private Integer isDelete;
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.etl.data.source.common.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 任务管理类
|
||||
*/
|
||||
@Data
|
||||
public class TaskManagerEntity extends BaseEntity{
|
||||
|
||||
@NotNull(message = "id不能为空")
|
||||
private int id;
|
||||
|
||||
@NotEmpty(message = "任务名称不能为空")
|
||||
private String taskName;
|
||||
|
||||
@NotEmpty(message = "任务id不能为空")
|
||||
private String taskId;
|
||||
|
||||
@NotEmpty(message = "任务code不能为空")
|
||||
private int taskCode;
|
||||
|
||||
@NotEmpty(message = "任务权重不能为空")
|
||||
private int taskWeight;
|
||||
|
||||
@NotEmpty(message = "任务状态不能为空")
|
||||
private int status;
|
||||
|
||||
@NotEmpty(message = "任务备注不能为空")
|
||||
private String remark;
|
||||
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
package com.etl.data.source.common.pojo.constants;
|
||||
|
||||
/**
|
||||
* 通用常量信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class Constants
|
||||
{
|
||||
/**
|
||||
* UTF-8 字符集
|
||||
*/
|
||||
public static final String UTF8 = "UTF-8";
|
||||
|
||||
/**
|
||||
* GBK 字符集
|
||||
*/
|
||||
public static final String GBK = "GBK";
|
||||
|
||||
/**
|
||||
* www主域
|
||||
*/
|
||||
public static final String WWW = "www.";
|
||||
|
||||
/**
|
||||
* RMI 远程方法调用
|
||||
*/
|
||||
public static final String LOOKUP_RMI = "rmi:";
|
||||
|
||||
/**
|
||||
* LDAP 远程方法调用
|
||||
*/
|
||||
public static final String LOOKUP_LDAP = "ldap:";
|
||||
|
||||
/**
|
||||
* LDAPS 远程方法调用
|
||||
*/
|
||||
public static final String LOOKUP_LDAPS = "ldaps:";
|
||||
|
||||
/**
|
||||
* http请求
|
||||
*/
|
||||
public static final String HTTP = "http://";
|
||||
|
||||
/**
|
||||
* https请求
|
||||
*/
|
||||
public static final String HTTPS = "https://";
|
||||
|
||||
/**
|
||||
* 成功标记
|
||||
*/
|
||||
public static final Integer SUCCESS = 200;
|
||||
|
||||
/**
|
||||
* 失败标记
|
||||
*/
|
||||
public static final Integer FAIL = 500;
|
||||
|
||||
/**
|
||||
* 登录成功状态
|
||||
*/
|
||||
public static final String LOGIN_SUCCESS_STATUS = "0";
|
||||
|
||||
/**
|
||||
* 登录失败状态
|
||||
*/
|
||||
public static final String LOGIN_FAIL_STATUS = "1";
|
||||
|
||||
/**
|
||||
* 登录成功
|
||||
*/
|
||||
public static final String LOGIN_SUCCESS = "Success";
|
||||
|
||||
/**
|
||||
* 注销
|
||||
*/
|
||||
public static final String LOGOUT = "Logout";
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
public static final String REGISTER = "Register";
|
||||
|
||||
/**
|
||||
* 登录失败
|
||||
*/
|
||||
public static final String LOGIN_FAIL = "Error";
|
||||
|
||||
/**
|
||||
* 当前记录起始索引
|
||||
*/
|
||||
public static final String PAGE_NUM = "pageNum";
|
||||
|
||||
/**
|
||||
* 每页显示记录数
|
||||
*/
|
||||
public static final String PAGE_SIZE = "pageSize";
|
||||
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
public static final String ORDER_BY_COLUMN = "orderByColumn";
|
||||
|
||||
/**
|
||||
* 排序的方向 "desc" 或者 "asc".
|
||||
*/
|
||||
public static final String IS_ASC = "isAsc";
|
||||
|
||||
/**
|
||||
* 验证码有效期(分钟)
|
||||
*/
|
||||
public static final long CAPTCHA_EXPIRATION = 2;
|
||||
|
||||
/**
|
||||
* 资源映射路径 前缀
|
||||
*/
|
||||
public static final String RESOURCE_PREFIX = "/profile";
|
||||
|
||||
/**
|
||||
* 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全)
|
||||
*/
|
||||
public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.ruoyi" };
|
||||
|
||||
/**
|
||||
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
|
||||
*/
|
||||
public static final String[] JOB_WHITELIST_STR = { "com.ruoyi.job.task" };
|
||||
|
||||
/**
|
||||
* 定时任务违规的字符
|
||||
*/
|
||||
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
||||
"org.springframework", "org.apache", "com.ruoyi.common.core.utils.file" };
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.etl.data.source.common.pojo.constants;
|
||||
|
||||
/**
|
||||
* @ClassName MysqlConstants
|
||||
* @Description 描述
|
||||
* @Author ZeZhang.Liu
|
||||
* @Date 2024/6/21 20:34
|
||||
*/
|
||||
public class MysqlConstants {
|
||||
public static final String MYSQL_USER = "user";
|
||||
|
||||
public static final String MYSQL_PASSWORD = "password";
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.etl.data.source.common.pojo.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName ConnectMysqlReq
|
||||
* @Description 描述
|
||||
* @Author ZeZhang.Liu
|
||||
* @Date 2024/6/21 15:32
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "连接mysql请求参数")
|
||||
public class ConnectMysqlReq {
|
||||
@ApiModelProperty(value = "数据库连接地址")
|
||||
private String url;
|
||||
@ApiModelProperty(value = "数据库用户名")
|
||||
private String user;
|
||||
@ApiModelProperty(value = "数据库密码")
|
||||
private String passWard;
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.etl.data.source.common.pojo.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "数据库配置")
|
||||
public class DataRinse {
|
||||
@NotBlank(message = "驱动类不能为空")
|
||||
@ApiModelProperty(value = "驱动类")
|
||||
private String driverClassName;
|
||||
@NotBlank(message = "数据库连接地址不能为空")
|
||||
@ApiModelProperty(value = "数据库连接地址")
|
||||
private String url;
|
||||
@NotBlank(message = "数据库用户名不能为空")
|
||||
@ApiModelProperty(value = "数据库用户名")
|
||||
private String username;
|
||||
@NotBlank(message = "数据库密码不能为空")
|
||||
@ApiModelProperty(value = "数据库密码")
|
||||
private String password;
|
||||
@ApiModelProperty(value = "数据库表名")
|
||||
private String tableName;
|
||||
@ApiModelProperty(value = "数据库库名")
|
||||
private String warehouseName;
|
||||
@ApiModelProperty(value = "数据表输入输出状态 0:输入 1:输出")
|
||||
private Integer data;
|
||||
@ApiModelProperty(value = "规则:0:数据清洗 1:数据脱敏")
|
||||
private Integer ruleTypeId;
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.etl.data.source.common.pojo.req;
|
||||
|
||||
import com.etl.data.source.common.pojo.DataSource;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName DataSourceColumn
|
||||
* @Description 描述
|
||||
* @Author TingTing.Yao
|
||||
* @Date 2024/06/21 21:40
|
||||
*/
|
||||
@Data
|
||||
public class DataSourceColumn extends DataSource {
|
||||
private String tableName;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.etl.data.source.common.pojo.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName DateSourceReq
|
||||
* @Description 描述
|
||||
* @Author TingTing.Yao
|
||||
* @Date 2024/06/23 10:02
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("查询数据源")
|
||||
public class DataSourceReq {
|
||||
@ApiModelProperty("页码")
|
||||
private Integer pageNum=1;
|
||||
@ApiModelProperty("每页条数")
|
||||
private Integer pageSize=3;
|
||||
@ApiModelProperty("数据源描述")
|
||||
private String dataSourceDescribe;
|
||||
@ApiModelProperty("数据源类型")
|
||||
private Integer dataSourceType;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.etl.data.source.common.pojo.req;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName RuleReq
|
||||
* @Description 描述
|
||||
* @Author TingTing.Yao
|
||||
* @Date 2024/06/25 11:01
|
||||
*/
|
||||
@Data
|
||||
public class RuleReq {
|
||||
private Integer pageNum=1;
|
||||
private Integer pageSize=3;
|
||||
private Integer ruleTypeId;
|
||||
private Integer codeTypeId;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.etl.data.source.common.pojo.resq;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "字段信息")
|
||||
public class ColumnInfo {
|
||||
@ApiModelProperty(value = "字段名")
|
||||
private String columnName;
|
||||
@ApiModelProperty(value = "字段类型")
|
||||
private String dataType;
|
||||
@ApiModelProperty(value = "字段长度")
|
||||
private Integer characterMaximumLength; // 注意这里可能是null
|
||||
@ApiModelProperty(value = "字段键类型")
|
||||
private String columnKey; // 主键、唯一键等
|
||||
@ApiModelProperty(value = "是否为空")
|
||||
private String isNullable; // YES 或 NO
|
||||
@ApiModelProperty(value = "字段注释")
|
||||
private String columnComment; // 列注释
|
||||
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
package com.etl.data.source.common.pojo.until;
|
||||
import com.etl.common.constants.Constants;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 响应信息主体
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class R<T> implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 成功 */
|
||||
public static final int SUCCESS = Constants.SUCCESS;
|
||||
|
||||
/** 失败 */
|
||||
public static final int FAIL = Constants.ERROR;
|
||||
|
||||
private int code;
|
||||
|
||||
private String msg;
|
||||
|
||||
private T data;
|
||||
|
||||
public static <T> R<T> ok()
|
||||
{
|
||||
return restResult(null, SUCCESS, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(T data)
|
||||
{
|
||||
return restResult(data, SUCCESS, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(T data, String msg)
|
||||
{
|
||||
return restResult(data, SUCCESS, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail()
|
||||
{
|
||||
return restResult(null, FAIL, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(String msg)
|
||||
{
|
||||
return restResult(null, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(T data)
|
||||
{
|
||||
return restResult(data, FAIL, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(T data, String msg)
|
||||
{
|
||||
return restResult(data, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(int code, String msg)
|
||||
{
|
||||
return restResult(null, code, msg);
|
||||
}
|
||||
|
||||
private static <T> R<T> restResult(T data, int code, String msg)
|
||||
{
|
||||
R<T> apiResult = new R<T>();
|
||||
apiResult.setCode(code);
|
||||
apiResult.setData(data);
|
||||
apiResult.setMsg(msg);
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg()
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg)
|
||||
{
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public T getData()
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data)
|
||||
{
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static <T> Boolean isError(R<T> ret)
|
||||
{
|
||||
return !isSuccess(ret);
|
||||
}
|
||||
|
||||
public static <T> Boolean isSuccess(R<T> ret)
|
||||
{
|
||||
return R.SUCCESS == ret.getCode();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>etl-data-source</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>el-data-source-server</artifactId>
|
||||
<description>el-data-source-server</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<spring-boot.version>2.6.13</spring-boot.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||
<version>3.21.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>el-data-source-common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
<version>3.1.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>3.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>31.1-jre</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.OpenAI.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
<version>2.5.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||
<version>1.3.8</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<configuration>
|
||||
<mainClass>com.etl.data.source.server.ElDataSourceServerApplication</mainClass>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>repackage</id>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,21 @@
|
|||
package com.etl.data.source.server;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.etl.data.source.server.mapper")
|
||||
public class ElDataSourceServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ElDataSourceServerApplication.class, args);
|
||||
System.out.println(" __ __ _ _ _ _");
|
||||
System.out.println(" ___ _ __ ___/ _|__ / /_ | | | | | | ___| |__");
|
||||
System.out.println(" / _ \\ '__/ _ \\ _/ _ \\ | '_ \\ | |_| | | |/ _ \\ '_ \\");
|
||||
System.out.println("| (_) | | | __/ | || __/| |_) || _ | | | __/ | | |");
|
||||
System.out.println(" \\___/|_| \\___|_| \\___| |_.__/ |_| |_| |_| \\___|_| |_|");
|
||||
System.out.println(" 数据源业务启动成功!");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.etl.data.source.server;
|
||||
|
||||
import com.etl.common.result.Result;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ControllerAdvice
|
||||
@Log4j2
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
public ResponseEntity<Result<String>> handleValidationExceptions(MethodArgumentNotValidException ex) {
|
||||
List<FieldError> fieldErrors = ex.getBindingResult().getFieldErrors();
|
||||
|
||||
String errorMessage = fieldErrors.stream()
|
||||
.map(FieldError::getDefaultMessage)
|
||||
.collect(Collectors.joining(", "));
|
||||
|
||||
log.error(errorMessage);
|
||||
|
||||
// 使用Result封装错误信息
|
||||
Result<String> result = Result.error(errorMessage);
|
||||
return new ResponseEntity<>(result, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ResponseEntity<Result<String>> handleException(Exception ex) {
|
||||
log.error("General exception", ex); // 最好打印堆栈信息以便排查问题
|
||||
|
||||
// 使用Result封装错误信息
|
||||
Result<String> result = Result.error(ex.getMessage());
|
||||
return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.etl.data.source.server.aop;
|
||||
|
||||
import com.etl.common.exception.LimitException;
|
||||
import com.etl.data.source.server.config.Limit;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.util.concurrent.RateLimiter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Aspect
|
||||
@Component
|
||||
public class LimitAspect {
|
||||
|
||||
private final Map<String, RateLimiter> limitMap = Maps.newConcurrentMap();
|
||||
|
||||
@Around("@annotation(com.etl.data.source.server.config.Limit)")
|
||||
public Object around(ProceedingJoinPoint pjp) throws Throwable {
|
||||
MethodSignature signature = (MethodSignature)pjp.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
//拿limit的注解
|
||||
Limit limit = method.getAnnotation(Limit.class);
|
||||
if (limit != null) {
|
||||
//key作用:不同的接口,不同的流量控制
|
||||
String key=limit.key();
|
||||
RateLimiter rateLimiter;
|
||||
//验证缓存是否有命中key
|
||||
if (!limitMap.containsKey(key)) {
|
||||
// 创建令牌桶
|
||||
rateLimiter = RateLimiter.create(limit.permitsPerSecond());
|
||||
limitMap.put(key, rateLimiter);
|
||||
log.info("新建了令牌桶={},容量={}",key,limit.permitsPerSecond());
|
||||
}
|
||||
rateLimiter = limitMap.get(key);
|
||||
// 拿令牌
|
||||
boolean acquire = rateLimiter.tryAcquire(limit.timeout(), limit.timeunit());
|
||||
// 拿不到命令,直接返回异常提示
|
||||
if (!acquire) {
|
||||
log.debug("令牌桶={},获取令牌失败",key);
|
||||
throw new LimitException(limit.msg());
|
||||
}
|
||||
}
|
||||
return pjp.proceed();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.etl.data.source.server.config;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
@Documented
|
||||
public @interface Limit {
|
||||
|
||||
// 资源key
|
||||
String key() default "";
|
||||
|
||||
// 最多访问次数
|
||||
double permitsPerSecond();
|
||||
|
||||
// 时间
|
||||
long timeout();
|
||||
|
||||
// 时间类型
|
||||
TimeUnit timeunit() default TimeUnit.MILLISECONDS;
|
||||
|
||||
// 提示信息
|
||||
String msg() default "系统繁忙,请稍后再试";
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.etl.data.source.server.config;
|
||||
|
||||
import com.etl.data.source.common.pojo.DatabaseRedis;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
import redis.clients.jedis.JedisPoolConfig;
|
||||
@Configuration
|
||||
public class RedisConfig {
|
||||
|
||||
private static JedisPool jedisPool;
|
||||
|
||||
public static synchronized JedisPool getJedisPool(DatabaseRedis databaseRedis) {
|
||||
if (jedisPool == null) {
|
||||
JedisPoolConfig poolConfig = new JedisPoolConfig();
|
||||
// 设置连接池参数,如最大连接数、最大空闲连接数等
|
||||
poolConfig.setMaxTotal(128);
|
||||
poolConfig.setMaxIdle(128);
|
||||
poolConfig.setMinIdle(16);
|
||||
poolConfig.setTestOnBorrow(true);
|
||||
poolConfig.setTestOnReturn(true);
|
||||
// 其他配置...
|
||||
|
||||
String host = databaseRedis.getUrl(); // Redis服务器地址
|
||||
int port = databaseRedis.getPort(); // Redis服务器端口
|
||||
jedisPool = new JedisPool(poolConfig, host, port);
|
||||
}
|
||||
return jedisPool;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue