Compare commits
30 Commits
Author | SHA1 | Date |
---|---|---|
|
9df23e4aa5 | |
|
0b54d0e840 | |
|
b8ff0aefe2 | |
|
b40b5b908a | |
|
5a88b571ae | |
|
e4d2d5db6d | |
|
7a1dfe1f90 | |
|
eb692d1e59 | |
|
7744803e41 | |
|
1a92ed6566 | |
|
eb0bfc5ed6 | |
|
d5aefb1383 | |
|
a0c15e85e6 | |
|
b760cc7927 | |
|
e62a81aca2 | |
|
17f1ec6357 | |
|
df0c5f403f | |
|
ebb669b42c | |
|
42ca5f147d | |
|
dcdf51f4e2 | |
|
9713efaf23 | |
|
ddf83fb546 | |
|
72a263f1b2 | |
|
3a445b42db | |
|
bf25dfba5e | |
|
e35e84dbf7 | |
|
76eca7b3ef | |
|
395c750eed | |
|
072e42f135 | |
|
61067dca43 |
|
@ -2,23 +2,19 @@
|
|||
<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-cleaning" />
|
||||
<module name="etl-spike" />
|
||||
<module name="etl-gateway" />
|
||||
<module name="etl-heihei" />
|
||||
<module name="etl-groovy" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="etl-mysql" target="1.8" />
|
||||
<module name="ays" target="1.8" />
|
||||
<module name="etl-ays-security" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
|
@ -1,17 +1,17 @@
|
|||
<?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">
|
||||
<component name="dataSourceStorageLocal" created-in="IU-241.17011.79">
|
||||
<data-source name="aysData" uuid="06140e5c-6fdb-4f9a-bb2b-176dc64f7745">
|
||||
<database-info product="MySQL" version="8.0.26" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-j-8.2.0 (Revision: 06a1f724497fd81c6a659131fda822c9e5085b6c)" dbms="MYSQL" exact-version="8.0.26" exact-driver-version="8.2">
|
||||
<extra-name-characters>#@</extra-name-characters>
|
||||
<identifier-quote-string>`</identifier-quote-string>
|
||||
</database-info>
|
||||
<case-sensitivity plain-identifiers="lower" quoted-identifiers="lower" />
|
||||
<case-sensitivity plain-identifiers="exact" quoted-identifiers="exact" />
|
||||
<secret-storage>master_key</secret-storage>
|
||||
<user-name>root</user-name>
|
||||
<schema-mapping>
|
||||
<introspection-scope>
|
||||
<node kind="schema" qname="yuekao" />
|
||||
<node kind="schema" qname="@" />
|
||||
</introspection-scope>
|
||||
</schema-mapping>
|
||||
</data-source>
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
<?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">
|
||||
<data-source source="LOCAL" name="aysData" uuid="06140e5c-6fdb-4f9a-bb2b-176dc64f7745">
|
||||
<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>
|
||||
<jdbc-url>jdbc:mysql://47.101.130.221:3306/etl</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,2 @@
|
|||
#n:etl
|
||||
!<md> [0, 0, null, null, -2147483648, -2147483648]
|
|
@ -1,440 +0,0 @@
|
|||
<?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>
|
|
@ -1,2 +0,0 @@
|
|||
#n:information_schema
|
||||
!<md> [null, 0, null, null, -2147483648, -2147483648]
|
|
@ -1,2 +0,0 @@
|
|||
#n:mysql
|
||||
!<md> [null, 0, null, null, -2147483648, -2147483648]
|
|
@ -1,2 +0,0 @@
|
|||
#n:performance_schema
|
||||
!<md> [null, 0, null, null, -2147483648, -2147483648]
|
|
@ -1,2 +0,0 @@
|
|||
#n:sys
|
||||
!<md> [null, 0, null, null, -2147483648, -2147483648]
|
|
@ -1,2 +0,0 @@
|
|||
#n:yuekao
|
||||
!<md> [1719216082000, 0, null, null, -2147483648, -2147483648]
|
|
@ -1,37 +0,0 @@
|
|||
<?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,30 +1,18 @@
|
|||
<?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-ays/etl-ays-security/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-ays/etl-ays-security/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-ays/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-ays/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-cleaning/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-cleaning/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$/etl-spike/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/etl-spike/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,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitToolBoxProjectSettings">
|
||||
<option name="commitMessageIssueKeyValidationOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
<option name="commitMessageValidationEnabledOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -2,67 +2,8 @@
|
|||
<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,28 +1,20 @@
|
|||
<?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" />
|
||||
<option value="$PROJECT_DIR$/etl-cleaning/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="ignoredFiles">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$/etl-mysql/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/etl-ays/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>
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
<?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,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="arthas.idea.plugin">
|
||||
<option name="selectProjectName" value="" />
|
||||
<option name="redisAddress" value="" />
|
||||
<option name="redisAuth" value="" />
|
||||
<option name="redisCacheKey" value="" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,4 @@
|
|||
<changelist name="在进行签出之前于_2024_6_19_下午6_50_取消提交了更改_[更改]" date="1718794249139" recycled="false" toDelete="true">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/在进行签出之前于_2024_6_19_下午6_50_取消提交了更改_[更改]/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="在进行签出之前于 2024/6/19 下午6:50 取消提交了更改 [更改]" />
|
||||
</changelist>
|
|
@ -0,0 +1,13 @@
|
|||
Index: etl-common/src/main/java/com/etl/common/util/Test.java
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
||||
<+>package com.etl.common.util;\r\n\r\npublic class Test {\r\n\r\n}\r\n
|
||||
===================================================================
|
||||
diff --git a/etl-common/src/main/java/com/etl/common/util/Test.java b/etl-common/src/main/java/com/etl/common/util/Test.java
|
||||
--- a/etl-common/src/main/java/com/etl/common/util/Test.java
|
||||
+++ b/etl-common/src/main/java/com/etl/common/util/Test.java
|
||||
@@ -3,3 +3,4 @@
|
||||
public class Test {
|
||||
|
||||
}
|
||||
+
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/server/MysqlServerTest.java" dialect="GenericSQL" />
|
||||
</component>
|
||||
</project>
|
File diff suppressed because one or more lines are too long
|
@ -1,8 +0,0 @@
|
|||
<?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>
|
|
@ -1,55 +0,0 @@
|
|||
<?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>
|
|
@ -1,33 +0,0 @@
|
|||
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;
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
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;
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
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;
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
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";
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
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 "";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
//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;
|
||||
// }
|
||||
// }
|
||||
//}
|
|
@ -1,8 +0,0 @@
|
|||
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> {
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package com.auth.server.mapper;
|
||||
|
||||
|
||||
import com.auth.common.entity.RolesPermission;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface PermissionMapper extends BaseMapper<RolesPermission> {
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
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> {
|
||||
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
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> {
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
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);
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
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);
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
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 {
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,168 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
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());
|
||||
}
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
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
|
|
@ -1,6 +0,0 @@
|
|||
<?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>
|
|
@ -1,6 +0,0 @@
|
|||
<?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>
|
|
@ -1,6 +0,0 @@
|
|||
<?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>
|
|
@ -1,6 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<h1>hello word!!!</h1>
|
||||
<p>this is a html page</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,31 +0,0 @@
|
|||
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("密码错误");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<?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>
|
|
@ -0,0 +1,33 @@
|
|||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
|
@ -2,98 +2,72 @@
|
|||
<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>
|
||||
<groupId>com.etl.cleaning</groupId>
|
||||
<artifactId>etl-cleaning</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>etl-cleaning</name>
|
||||
<description>etl-cleaning</description>
|
||||
<parent>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>etl-auth</artifactId>
|
||||
<artifactId>etl-cloud</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>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.0.5</version>
|
||||
</dependency>
|
||||
<!-- Jedis -->
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>3.7.0</version> <!-- 请检查并使用最新版本 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.anji-plus</groupId>
|
||||
<artifactId>spring-boot-starter-captcha</artifactId>
|
||||
<version>1.3.0</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>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
|
||||
<version>4.4.0</version>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<version>5.3.22</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>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.29</version> <!-- 请根据需要选择合适的版本 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</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>
|
||||
<artifactId>mybatis-plus-annotation</artifactId>
|
||||
<version>3.5.7</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
|
@ -105,13 +79,6 @@
|
|||
<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>
|
||||
|
||||
|
@ -132,7 +99,7 @@
|
|||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<configuration>
|
||||
<mainClass>com.auth.server.EtlAuthServerApplication</mainClass>
|
||||
<mainClass>com.etl.cleaning.EtlCleaningApplication</mainClass>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
<executions>
|
|
@ -0,0 +1,18 @@
|
|||
package com.etl.cleaning;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 数据清洗模块
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.etl.cleaning.mapper")
|
||||
@EnableScheduling
|
||||
public class EtlCleaningApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(EtlCleaningApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.etl.cleaning.config;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* mysql链接数据源测试
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class DatabaseConfig {
|
||||
/**
|
||||
* jdbc路径
|
||||
*/
|
||||
private String url;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
private String port;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.etl.cleaning.config;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 分页插件
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
/**
|
||||
* 添加分页插件
|
||||
*/
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); // 如果配置多个插件, 切记分页最后添加
|
||||
// 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.etl.cleaning.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.etl.cleaning.domian.pojo.DataPlace;
|
||||
import com.etl.cleaning.domian.request.TableRequest;
|
||||
import com.etl.cleaning.enums.EnumMsg;
|
||||
import com.etl.cleaning.server.GetTableServerTest;
|
||||
import com.etl.cleaning.service.PlaceService;
|
||||
import com.etl.common.result.Result;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获取表名控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dataTable")
|
||||
public class GetTableController {
|
||||
|
||||
|
||||
private final PlaceService placeService;
|
||||
|
||||
public GetTableController(PlaceService placeService) {
|
||||
this.placeService = placeService;
|
||||
}
|
||||
/**
|
||||
* 获取所有表名
|
||||
*
|
||||
* @param tableRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getTableName")
|
||||
public Result getTableName(@RequestBody @Valid TableRequest tableRequest) {
|
||||
LambdaUpdateWrapper<DataPlace> eqed = new LambdaUpdateWrapper<DataPlace>().eq(DataPlace::getName, tableRequest.getName()).or().eq(DataPlace::getTypeId, tableRequest.getTypeId());
|
||||
DataPlace dataPlace = placeService.getOne(eqed);
|
||||
if (dataPlace == null) {
|
||||
throw new RuntimeException("您所选中的数据源不存在");
|
||||
}
|
||||
String dataUrl = dataPlace.getDataUrl();
|
||||
String dataName = dataPlace.getDataName();
|
||||
String password = dataPlace.getPassword();
|
||||
String username = dataPlace.getUsername();
|
||||
String url = EnumMsg.URL_PRE.getMessage() + "://" + dataUrl + "/" + dataName;
|
||||
List<String> tableNames = GetTableServerTest.getTableNames(url, dataName, username, password);
|
||||
return Result.success(tableNames);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.etl.cleaning.controller;
|
||||
|
||||
import com.etl.cleaning.domian.request.InsertPlaceRequest;
|
||||
import com.etl.cleaning.domian.request.PlaceRequest;
|
||||
import com.etl.cleaning.service.PlaceService;
|
||||
import com.etl.common.result.Result;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数据源管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/place")
|
||||
public class PlaceController {
|
||||
private final PlaceService placeService;
|
||||
|
||||
public PlaceController(PlaceService placeService) {
|
||||
this.placeService = placeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据源管理列表展示
|
||||
* @param placeRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/showPlacePage")
|
||||
public Result showPlacePage(@RequestBody PlaceRequest placeRequest){
|
||||
Map<String, Object> stringObjectMap = placeService.showPlacePage(placeRequest);
|
||||
return Result.success(stringObjectMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/delAdd")
|
||||
public Result delAll(@RequestBody List<Long> ids){
|
||||
boolean b = placeService.removeBatchByIds(ids);
|
||||
return Result.success(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试连接
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/testMysql/{id}")
|
||||
public Result testMysql(@PathVariable Long id){
|
||||
String s = placeService.dataTest(id);
|
||||
return Result.success(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加数据源
|
||||
* @param insertPlaceRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/insertData")
|
||||
public Result insertData(@RequestBody @Validated InsertPlaceRequest insertPlaceRequest){
|
||||
Boolean b = placeService.insertDataPlace(insertPlaceRequest);
|
||||
return Result.success(b);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.etl.cleaning.controller;
|
||||
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.etl.cleaning.domian.pojo.DataPlace;
|
||||
import com.etl.cleaning.service.PlaceService;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
/**
|
||||
* 导入导出规整
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/poi/excel")
|
||||
public class PoiExcelApi {
|
||||
private final PlaceService placeService;
|
||||
|
||||
public PoiExcelApi(PlaceService placeService){
|
||||
this.placeService=placeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出到指定路径
|
||||
*/
|
||||
@PostMapping("/outPoi")
|
||||
public void outPoi(){
|
||||
//设置文件导出的路径
|
||||
String path = "D://poi/";
|
||||
File file=new File( path );
|
||||
if(!file.isDirectory()){
|
||||
file.mkdirs();
|
||||
}
|
||||
String fileName = path + "User" + System.currentTimeMillis() + ".xlsx";
|
||||
EasyExcel.write(fileName, DataPlace.class).sheet("数据源管理").doWrite(placeService.list());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.etl.cleaning.controller;
|
||||
|
||||
|
||||
import com.etl.cleaning.domian.pojo.DataRole;
|
||||
import com.etl.cleaning.service.RoleService;
|
||||
import com.etl.common.result.Result;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规则表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author test
|
||||
* @since 2024-06-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/data-role")
|
||||
public class RoleController {
|
||||
private final RoleService roleService;
|
||||
|
||||
public RoleController(RoleService roleService) {
|
||||
this.roleService = roleService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加规则
|
||||
* @param dataRole
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/insertRole")
|
||||
public Result insertRole(@RequestBody DataRole dataRole){
|
||||
boolean save = roleService.save(dataRole);
|
||||
return Result.success(save);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.etl.cleaning.controller;
|
||||
|
||||
|
||||
import com.etl.cleaning.domian.pojo.RoleType;
|
||||
import com.etl.cleaning.service.RoleTypeService;
|
||||
import com.etl.common.result.Result;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规则类型表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author test
|
||||
* @since 2024-06-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/role-type")
|
||||
public class RoleTypeController {
|
||||
private final RoleTypeService roleTypeService;
|
||||
public RoleTypeController(RoleTypeService roleTypeService) {
|
||||
this.roleTypeService = roleTypeService;
|
||||
}
|
||||
/**
|
||||
* 规则类型列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/showTypeList")
|
||||
public Result showTypeList(){
|
||||
List<RoleType> list = roleTypeService.list();
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package com.etl.cleaning.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.etl.cleaning.domian.pojo.DataTask;
|
||||
import com.etl.cleaning.domian.request.InsertTaskRequest;
|
||||
import com.etl.cleaning.domian.request.TaskRequest;
|
||||
import com.etl.cleaning.mapper.TaskMapper;
|
||||
import com.etl.cleaning.service.TaskService;
|
||||
import com.etl.common.result.Result;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 任务表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author test
|
||||
* @since 2024-06-30
|
||||
*/
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/data-task")
|
||||
public class TaskController {
|
||||
private final TaskMapper taskMapper;
|
||||
private final TaskService taskService;
|
||||
|
||||
public TaskController(TaskMapper taskMapper, TaskService taskService) {
|
||||
this.taskMapper = taskMapper;
|
||||
this.taskService = taskService;
|
||||
}
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
|
||||
/**
|
||||
* 展示任务列表
|
||||
* @param taskRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/showListPage")
|
||||
public Result showListPage(@RequestBody TaskRequest taskRequest){
|
||||
LambdaUpdateWrapper<DataTask> wrapper = new LambdaUpdateWrapper<>();
|
||||
if(taskRequest.getId() != null){
|
||||
wrapper.eq(DataTask::getTaskId, taskRequest.getId());
|
||||
}
|
||||
if(StringUtils.isNotBlank(taskRequest.getUrgentLevel())){
|
||||
wrapper.like(DataTask::getWeight, taskRequest.getUrgentLevel());
|
||||
}
|
||||
Page<DataTask> dataTaskPage = new Page<>(taskRequest.getPageNum(), taskRequest.getPageSize());
|
||||
List<DataTask> records = dataTaskPage.getRecords();
|
||||
long total = dataTaskPage.getTotal();
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
hashMap.put("total",total);
|
||||
hashMap.put("data",records);
|
||||
return Result.success(hashMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加任务管理
|
||||
* @param insertTaskRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/insertTask")
|
||||
public Result insertTask(@RequestBody @Validated InsertTaskRequest insertTaskRequest){
|
||||
//获取锁
|
||||
lock.lock();
|
||||
try {
|
||||
DataTask task = taskService.getOne(new LambdaQueryWrapper<DataTask>().eq(DataTask::getTaskName, insertTaskRequest.getTaskName()));
|
||||
if(task != null){
|
||||
throw new RuntimeException("任务名称已存在");
|
||||
}
|
||||
DataTask dataTask = DataTask.builder().taskId(insertTaskRequest.getTaskCode()).taskName(insertTaskRequest.getTaskName())
|
||||
.statue(1L).remark(insertTaskRequest.getRemark()).updateTime(new Date()).build();
|
||||
boolean save = taskService.save(dataTask);
|
||||
return Result.success(save);
|
||||
}catch (Exception e){
|
||||
log.info(e.getMessage());
|
||||
return Result.error();
|
||||
}finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.etl.cleaning.controller;
|
||||
|
||||
import com.etl.cleaning.domian.pojo.DateType;
|
||||
import com.etl.cleaning.service.TypeService;
|
||||
import com.etl.common.result.Result;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据源类型
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/type")
|
||||
public class TypeController {
|
||||
private final TypeService typeService;
|
||||
public TypeController(TypeService typeService) {
|
||||
this.typeService = typeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示类型列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/showTypeList")
|
||||
public Result showTypeList(){
|
||||
List<DateType> list = typeService.list();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/*
|
||||
测试mysql链接
|
||||
@return
|
||||
*/
|
||||
/*
|
||||
@GetMapping("/testMysql")
|
||||
public Result testMysql(){
|
||||
ServerTest.testDatabaseConnection()
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.etl.cleaning.controller;
|
||||
|
||||
import com.etl.cleaning.domian.request.UserRequest;
|
||||
import com.etl.common.result.Result;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 登录测试(滑块验证码)
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
/**
|
||||
* 登录测试
|
||||
* @param userRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public Result loginUser(@RequestBody UserRequest userRequest){
|
||||
if(!userRequest.getName().equals("admin")){
|
||||
throw new RuntimeException("用户名错误");
|
||||
}
|
||||
if(!userRequest.getPassword().equals("admin")){
|
||||
throw new RuntimeException("密码错误");
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package com.etl.cleaning.domian.pojo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
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 lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 数据源管理表
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("data_place")
|
||||
public class DataPlace {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 数据源描述
|
||||
*/
|
||||
@ExcelProperty("数据源描述")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty("备注")
|
||||
private String bank;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ExcelProperty("修改时间")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 类型ID
|
||||
*/
|
||||
@ExcelProperty("类型ID")
|
||||
private Long typeId;
|
||||
/**
|
||||
* 链接状态
|
||||
*/
|
||||
@ExcelProperty("/连接状态")
|
||||
private Long statue;
|
||||
/**
|
||||
* 连接类型
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@ExcelIgnore
|
||||
private String typeName;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@ExcelProperty("用户名")
|
||||
private String username;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@ExcelProperty("密码")
|
||||
private String password;
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
@ExcelProperty("端口")
|
||||
private String port;
|
||||
/**
|
||||
* 数据库名称
|
||||
*/
|
||||
@ExcelProperty("数据库")
|
||||
private String dataName;
|
||||
/**
|
||||
* 额外配置
|
||||
*/
|
||||
@ExcelProperty("配置")
|
||||
private String yaml;
|
||||
/**
|
||||
* 链接路径
|
||||
*/
|
||||
@ExcelProperty("路径")
|
||||
private String dataUrl;
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.etl.cleaning.domian.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 清洗规则表
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("data_role")
|
||||
public class DataRole {
|
||||
/**
|
||||
* 规则ID
|
||||
*/
|
||||
private Long roleId;
|
||||
/**
|
||||
* 规则名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* classPath
|
||||
*/
|
||||
private String rolePath;
|
||||
/**
|
||||
* 打开方式
|
||||
*/
|
||||
private String roleManner;
|
||||
/**
|
||||
* 类型关联ID
|
||||
*/
|
||||
private Long typeId;
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.etl.cleaning.domian.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 任务表
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("data_task")
|
||||
public class DataTask {
|
||||
/**
|
||||
* 主键ID自增
|
||||
*/
|
||||
private Long taskId;
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
private String taskName;
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 权重
|
||||
*/
|
||||
private String weight;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Long statue;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.etl.cleaning.domian.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 数据源类型
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("data_type")
|
||||
public class DateType {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.etl.cleaning.domian.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 规则类型表
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@TableName("role_type")
|
||||
public class RoleType {
|
||||
/**
|
||||
* id自增
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 规则类型名称
|
||||
*/
|
||||
private String name;
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.etl.cleaning.domian.request;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 添加数据源参数
|
||||
*/
|
||||
@Data
|
||||
public class InsertPlaceRequest {
|
||||
/**
|
||||
* 数据源描述
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String bank;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 类型ID
|
||||
*/
|
||||
@NotNull(message = "连接类型不能为空")
|
||||
private Long typeId;
|
||||
/**
|
||||
* 链接状态
|
||||
*/
|
||||
private Long statue;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
@NotBlank(message = "端口不能为空")
|
||||
private String port;
|
||||
/**
|
||||
* 数据库名称
|
||||
*/
|
||||
private String dataName;
|
||||
/**
|
||||
* 额外配置
|
||||
*/
|
||||
private String yaml;
|
||||
/**
|
||||
* 链接路径
|
||||
*/
|
||||
@NotBlank(message = "连接地址不能为空")
|
||||
private String dataUrl;
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.etl.cleaning.domian.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 添加任务
|
||||
*/
|
||||
@Data
|
||||
public class InsertTaskRequest {
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
|
||||
@NotBlank(message = "任务名称不能为空")
|
||||
private String taskName;
|
||||
|
||||
/**
|
||||
* 任务编号
|
||||
*/
|
||||
|
||||
@NotNull(message = "任务编号不能为空")
|
||||
private Long taskCode;
|
||||
|
||||
/**
|
||||
* 任务权重
|
||||
*/
|
||||
|
||||
@NotBlank(message = "任务权重不能为空")
|
||||
private String taskWeight;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
||||
@NotBlank(message = "任务备注不能为空")
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.etl.cleaning.domian.request;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* mysql链接参数
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class MysqlRequest {
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@NotBlank(message = "用户名不能为空")
|
||||
private String itemUsername;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@NotBlank(message = "密码不能为空")
|
||||
private String itemPass;
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
@NotBlank(message = "端口号不能为空")
|
||||
private String itemPort;
|
||||
/**
|
||||
* 连接数据库名称
|
||||
*/
|
||||
@NotBlank(message = "数据库名称不能为空")
|
||||
private String itemName;
|
||||
/**
|
||||
* 连接地址
|
||||
*/
|
||||
@NotBlank(message = "链接地址不能为空")
|
||||
private String place;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.etl.cleaning.domian.request;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 数据源管理查询参数
|
||||
*/
|
||||
@Data
|
||||
public class PlaceRequest {
|
||||
private String bank;
|
||||
private Long typeId;
|
||||
private Integer pageNum;
|
||||
private Integer pageSize;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.etl.cleaning.domian.request;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* redis链接参数
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class RedisRequest {
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@NotBlank(message = "密码不能为空")
|
||||
private String itemPass;
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
@NotNull(message = "端口号不能为空")
|
||||
private Integer port;
|
||||
/**
|
||||
* 连接地址
|
||||
*/
|
||||
@NotBlank(message = "链接地址不能为空")
|
||||
private String host;
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.etl.cleaning.domian.request;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 加载表参数
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TableRequest {
|
||||
/**
|
||||
* 数据源类型ID
|
||||
*/
|
||||
@NotNull(message = "数据源类型ID不能为空")
|
||||
private Long typeId;
|
||||
|
||||
|
||||
/**
|
||||
* 数据源描述
|
||||
*/
|
||||
@NotBlank(message = "数据源描述不能为空")
|
||||
private String name;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.etl.cleaning.domian.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 任务管理列表查询参数
|
||||
*/
|
||||
@Data
|
||||
public class TaskRequest {
|
||||
/**
|
||||
* 配置ID说明
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 紧急程度
|
||||
*/
|
||||
private String urgentLevel;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer statue;
|
||||
private Integer pageNum;
|
||||
private Integer pageSize;
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.etl.cleaning.domian.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 登录参数
|
||||
*/
|
||||
@Data
|
||||
public class UserRequest {
|
||||
private String name;
|
||||
private String password;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.etl.cleaning.domian.response;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 数据源管理返回列表
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class PlaceResponse {
|
||||
/**
|
||||
* 数据源描述
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String bank;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 链接状态
|
||||
*/
|
||||
private Long statue;
|
||||
/**
|
||||
* 连接类型
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String typeName;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.etl.cleaning.enums;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 枚举常量类
|
||||
*/
|
||||
@Getter
|
||||
public enum EnumMsg {
|
||||
// 定义一个带有错误码和描述性字符串的枚举常量
|
||||
NO_TYPE(401, "暂无类型"),
|
||||
DRIVER_CLASS_NAME(402,"com.mysql.cj.jdbc.Driver"),
|
||||
URL_PRE(403,"jdbc:mysql");
|
||||
|
||||
private final int code;
|
||||
private final String message;
|
||||
|
||||
EnumMsg(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.etl.cleaning.handler;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.etl.common.result.Result;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
/**
|
||||
* 全局异常捕获类
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
@Configuration
|
||||
@Log4j2
|
||||
public class CatchExceptions {
|
||||
@ExceptionHandler(value = RuntimeException.class)
|
||||
public Result<String> catchException(RuntimeException exception) {
|
||||
log.error("请求异常: [{}]",exception.getMessage(),exception);
|
||||
return Result.error(JSONObject.toJSONString(exception.getMessage()));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.etl.cleaning.job;
|
||||
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class Testaa {
|
||||
@Scheduled(fixedRate = 1000)
|
||||
public void test(){
|
||||
System.out.println ("aaaaaaaa");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.etl.cleaning.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.etl.cleaning.domian.pojo.DataPlace;
|
||||
|
||||
/**
|
||||
* 数据源管理
|
||||
*/
|
||||
public interface PlaceMapper extends BaseMapper<DataPlace> {
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.etl.cleaning.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.etl.cleaning.domian.pojo.DataRole;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规则表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author test
|
||||
* @since 2024-06-30
|
||||
*/
|
||||
public interface RoleMapper extends BaseMapper<DataRole> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.etl.cleaning.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.etl.cleaning.domian.pojo.RoleType;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规则类型表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author test
|
||||
* @since 2024-06-30
|
||||
*/
|
||||
public interface RoleTypeMapper extends BaseMapper<RoleType> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.etl.cleaning.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.etl.cleaning.domian.pojo.DataTask;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 任务表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author test
|
||||
* @since 2024-06-30
|
||||
*/
|
||||
public interface TaskMapper extends BaseMapper<DataTask> {
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.etl.cleaning.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.etl.cleaning.domian.pojo.DateType;
|
||||
|
||||
/**
|
||||
* 数据源类型
|
||||
*/
|
||||
public interface TypeMapper extends BaseMapper<DateType> {
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.etl.cleaning.server;
|
||||
|
||||
|
||||
import com.etl.cleaning.enums.EnumMsg;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获取数据库下的所有表名
|
||||
*/
|
||||
public class GetTableServerTest {
|
||||
public static List<String> getTableNames(String url,String dataName,String username,String password){
|
||||
ArrayList<String> tableNames = new ArrayList<>();
|
||||
Connection connection = null;
|
||||
try {
|
||||
Class.forName(EnumMsg.DRIVER_CLASS_NAME.getMessage());
|
||||
connection = DriverManager.getConnection(url, username, password);
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
ResultSet tables = metaData.getTables(dataName, null, "%", new String[]{"TABLE"});
|
||||
while (tables.next()){
|
||||
tableNames.add(tables.getString(3));
|
||||
}
|
||||
tables.close();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}finally {
|
||||
// 关闭连接(如果已打开)
|
||||
try {
|
||||
if (connection != null && !connection.isClosed()) {
|
||||
try {
|
||||
connection.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return tableNames;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.etl.cleaning.server;
|
||||
|
||||
import com.etl.cleaning.config.DatabaseConfig;
|
||||
import com.etl.cleaning.enums.EnumMsg;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
||||
|
||||
/**
|
||||
* mysql测试连接
|
||||
*/
|
||||
public class MysqlServerTest {
|
||||
public static String testDatabaseConnection(DatabaseConfig databaseConfig) {
|
||||
try {
|
||||
//创建数据源
|
||||
DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
||||
//设置数据源的驱动类名,URL,用户名,密码
|
||||
dataSource.setDriverClassName(EnumMsg.DRIVER_CLASS_NAME.getMessage());
|
||||
dataSource.setUrl(databaseConfig.getUrl());
|
||||
dataSource.setUsername(databaseConfig.getUsername());
|
||||
dataSource.setPassword(databaseConfig.getPassword());
|
||||
//创建数据源
|
||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
//sql测试
|
||||
jdbcTemplate.execute("select 1");
|
||||
return "ok";
|
||||
}catch (Exception e){
|
||||
//如果发生异常,打印异常信息
|
||||
e.printStackTrace();
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.etl.cleaning.server;
|
||||
|
||||
import com.etl.cleaning.domian.request.RedisRequest;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
/**
|
||||
* redis测试连接
|
||||
*/
|
||||
public class RedisServerTest {
|
||||
public static String testRedisData(RedisRequest redisRequest){
|
||||
try {
|
||||
// 创建Jedis对象(Redis客户端)
|
||||
Jedis jedis = new Jedis(redisRequest.getHost(), redisRequest.getPort());
|
||||
// 如果设置了密码,则进行认证
|
||||
if (redisRequest.getItemPass() != null && !redisRequest.getItemPass().isEmpty()) {
|
||||
jedis.auth(redisRequest.getItemPass());
|
||||
}
|
||||
// 测试连接是否成功,可以执行一个简单的命令,如ping
|
||||
String response = jedis.ping();
|
||||
if ("PONG".equals(response)) {
|
||||
// 连接成功
|
||||
return "ok";
|
||||
} else {
|
||||
// 连接失败或其他错误
|
||||
return "error";
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return "error";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.etl.cleaning.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.etl.cleaning.domian.pojo.DataPlace;
|
||||
import com.etl.cleaning.domian.request.InsertPlaceRequest;
|
||||
import com.etl.cleaning.domian.request.PlaceRequest;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数据源管理
|
||||
*/
|
||||
public interface PlaceService extends IService<DataPlace> {
|
||||
/**
|
||||
* 展示数据源管理列表
|
||||
* @param placeRequest
|
||||
* @return
|
||||
*/
|
||||
Map<String,Object> showPlacePage(PlaceRequest placeRequest);
|
||||
|
||||
|
||||
/**
|
||||
* 链接测试
|
||||
* @param id
|
||||
*/
|
||||
String dataTest(Long id);
|
||||
|
||||
/**
|
||||
* 添加数据源
|
||||
* @param insertItemRequest
|
||||
* @return
|
||||
*/
|
||||
Boolean insertDataPlace(InsertPlaceRequest insertItemRequest);
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.etl.cleaning.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.etl.cleaning.domian.pojo.DataRole;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规则表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author test
|
||||
* @since 2024-06-30
|
||||
*/
|
||||
public interface RoleService extends IService<DataRole> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.etl.cleaning.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.etl.cleaning.domian.pojo.RoleType;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规则类型表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author test
|
||||
* @since 2024-06-30
|
||||
*/
|
||||
public interface RoleTypeService extends IService<RoleType> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.etl.cleaning.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.etl.cleaning.domian.pojo.DataTask;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 任务表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author test
|
||||
* @since 2024-06-30
|
||||
*/
|
||||
public interface TaskService extends IService<DataTask> {
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.etl.cleaning.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.etl.cleaning.domian.pojo.DateType;
|
||||
|
||||
/**
|
||||
* 数据源类型
|
||||
*/
|
||||
public interface TypeService extends IService<DateType> {
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
package com.etl.cleaning.serviceimpl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.etl.cleaning.config.DatabaseConfig;
|
||||
import com.etl.cleaning.domian.pojo.DataPlace;
|
||||
import com.etl.cleaning.domian.pojo.DateType;
|
||||
import com.etl.cleaning.domian.request.InsertPlaceRequest;
|
||||
import com.etl.cleaning.domian.request.MysqlRequest;
|
||||
import com.etl.cleaning.domian.request.PlaceRequest;
|
||||
import com.etl.cleaning.domian.request.RedisRequest;
|
||||
import com.etl.cleaning.domian.response.PlaceResponse;
|
||||
import com.etl.cleaning.enums.EnumMsg;
|
||||
import com.etl.cleaning.mapper.PlaceMapper;
|
||||
import com.etl.cleaning.server.MysqlServerTest;
|
||||
import com.etl.cleaning.server.RedisServerTest;
|
||||
import com.etl.cleaning.service.PlaceService;
|
||||
import com.etl.cleaning.service.TypeService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 数据源管理
|
||||
*/
|
||||
@Service
|
||||
public class PlaceServiceImpl extends ServiceImpl<PlaceMapper, DataPlace> implements PlaceService {
|
||||
private final TypeService typeService;
|
||||
private final PlaceMapper placeMapper;
|
||||
public PlaceServiceImpl(TypeService typeService, PlaceMapper placeMapper) {
|
||||
this.typeService = typeService;
|
||||
this.placeMapper = placeMapper;
|
||||
}
|
||||
@Override
|
||||
public Map<String,Object> showPlacePage(PlaceRequest placeRequest) {
|
||||
LambdaQueryWrapper<DataPlace> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if(StringUtils.isNotBlank(placeRequest.getBank())){
|
||||
lambdaQueryWrapper.like(DataPlace::getName, placeRequest.getBank());
|
||||
}
|
||||
if(placeRequest.getTypeId()!=null){
|
||||
lambdaQueryWrapper.eq(DataPlace::getTypeId,placeRequest.getTypeId());
|
||||
}
|
||||
Page<DataPlace> page = new Page<>(placeRequest.getPageNum(), placeRequest.getPageSize());
|
||||
|
||||
Page<DataPlace> dataPlacePage = placeMapper.selectPage(page, lambdaQueryWrapper);
|
||||
|
||||
List<DataPlace> records = dataPlacePage.getRecords();
|
||||
if(CollectionUtils.isEmpty(records)){
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
List<Long> typeIds = records.stream().map(DataPlace::getTypeId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
List<DateType> dateTypes = typeService.listByIds(typeIds);
|
||||
Map<Long, DateType> typeMap = dateTypes.stream().collect(Collectors.toMap(DateType::getId, Function.identity()));
|
||||
List<PlaceResponse> dataPlaceList = records.stream().map(item -> {
|
||||
Long typeId = item.getTypeId();
|
||||
DateType dateType = typeMap.get(typeId);
|
||||
String typeName = dateType == null ? EnumMsg.NO_TYPE.getMessage() : dateType.getName();
|
||||
return PlaceResponse.builder()
|
||||
.typeName(typeName)
|
||||
.name(item.getName())
|
||||
.bank(item.getBank())
|
||||
.statue(item.getStatue())
|
||||
.updateTime(item.getUpdateTime())
|
||||
.build();
|
||||
}).collect(Collectors.toList());
|
||||
//查询总条数
|
||||
long total = dataPlacePage.getTotal();
|
||||
//查询当前页的总条数
|
||||
long size = dataPlacePage.getSize();
|
||||
//计算得出的总页数
|
||||
long pages = dataPlacePage.getPages();
|
||||
//当前页码
|
||||
long current = dataPlacePage.getCurrent();
|
||||
System.out.println(total);
|
||||
System.out.println(size);
|
||||
System.out.println(pages);
|
||||
System.out.println(current);
|
||||
HashMap<String,Object> map = new HashMap<>();
|
||||
map.put("total", total);
|
||||
map.put("data", dataPlaceList);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String dataTest(Long id) {
|
||||
DataPlace dataPlace = this.getOne(new LambdaQueryWrapper<DataPlace>().eq(DataPlace::getId, id));
|
||||
if(dataPlace.getTypeId() == 1){
|
||||
MysqlRequest mysqlRequest = MysqlRequest.builder()
|
||||
.place(dataPlace.getDataUrl())
|
||||
.itemPass(dataPlace.getPassword())
|
||||
.itemUsername(dataPlace.getUsername())
|
||||
.itemPort(dataPlace.getPort())
|
||||
.itemName(dataPlace.getDataName())
|
||||
.build();
|
||||
return this.insertItem(mysqlRequest);
|
||||
}
|
||||
if(dataPlace.getTypeId() == 2){
|
||||
RedisRequest redisRequest = RedisRequest.builder()
|
||||
.itemPass(dataPlace.getPassword())
|
||||
.host(dataPlace.getDataUrl())
|
||||
.port(Integer.valueOf(dataPlace.getPort()))
|
||||
.build();
|
||||
return RedisServerTest.testRedisData(redisRequest);
|
||||
}
|
||||
return "redis连接数据源失败";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertDataPlace(InsertPlaceRequest insertItemRequest) {
|
||||
DataPlace dataPlace = DataPlace.builder()
|
||||
.dataName(insertItemRequest.getDataName())
|
||||
.password(insertItemRequest.getPassword())
|
||||
.bank(insertItemRequest.getBank())
|
||||
.dataUrl(insertItemRequest.getDataUrl())
|
||||
.port(insertItemRequest.getPort())
|
||||
.username(insertItemRequest.getUsername())
|
||||
.yaml(insertItemRequest.getYaml())
|
||||
.typeId(insertItemRequest.getTypeId())
|
||||
.name(insertItemRequest.getName())
|
||||
.statue(insertItemRequest.getStatue())
|
||||
.updateTime(new Date())
|
||||
.build();
|
||||
return this.save(dataPlace);
|
||||
}
|
||||
|
||||
|
||||
private String insertItem(MysqlRequest mysqlRequest) {
|
||||
//拼接路径 测试mysql数据库连接
|
||||
String url =EnumMsg.URL_PRE.getMessage() + "://" + mysqlRequest.getPlace() + "/" +mysqlRequest.getItemName();
|
||||
DatabaseConfig databaseConfig = DatabaseConfig.builder()
|
||||
.url(url)
|
||||
.port(mysqlRequest.getItemPort())
|
||||
.username(mysqlRequest.getItemUsername())
|
||||
.password(mysqlRequest.getItemPass())
|
||||
.build();
|
||||
return MysqlServerTest.testDatabaseConnection(databaseConfig);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.etl.cleaning.serviceimpl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.etl.cleaning.domian.pojo.DataRole;
|
||||
import com.etl.cleaning.mapper.RoleMapper;
|
||||
import com.etl.cleaning.service.RoleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规则表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author test
|
||||
* @since 2024-06-30
|
||||
*/
|
||||
@Service
|
||||
public class RoleServiceImpl extends ServiceImpl<RoleMapper, DataRole> implements RoleService {
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue