Compare commits
2 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
7c2f2c21e8 | 3 days ago |
|
|
7b39e636bd | 5 days ago |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,86 +0,0 @@
|
||||
# Details
|
||||
|
||||
Date : 2026-01-05 15:04:31
|
||||
|
||||
Directory c:\\Users\\87641\\Downloads\\simple-alipay-backend\\src
|
||||
|
||||
Total : 71 files, 3342 codes, 42 comments, 654 blanks, all 4038 lines
|
||||
|
||||
[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
|
||||
## Files
|
||||
| filename | language | code | comment | blank | total |
|
||||
| :--- | :--- | ---: | ---: | ---: | ---: |
|
||||
| [src/main/java/com/example/alipay/SimpleAlipayBackendApplication.java](/src/main/java/com/example/alipay/SimpleAlipayBackendApplication.java) | Java | 9 | 0 | 3 | 12 |
|
||||
| [src/main/java/com/example/alipay/config/DataLoader.java](/src/main/java/com/example/alipay/config/DataLoader.java) | Java | 51 | 0 | 5 | 56 |
|
||||
| [src/main/java/com/example/alipay/config/GlobalExceptionHandler.java](/src/main/java/com/example/alipay/config/GlobalExceptionHandler.java) | Java | 83 | 0 | 16 | 99 |
|
||||
| [src/main/java/com/example/alipay/config/fintech/SecurityConfig.java](/src/main/java/com/example/alipay/config/fintech/SecurityConfig.java) | Java | 77 | 5 | 9 | 91 |
|
||||
| [src/main/java/com/example/alipay/controller/CollectionController.java](/src/main/java/com/example/alipay/controller/CollectionController.java) | Java | 40 | 0 | 7 | 47 |
|
||||
| [src/main/java/com/example/alipay/controller/PaymentController.java](/src/main/java/com/example/alipay/controller/PaymentController.java) | Java | 68 | 0 | 8 | 76 |
|
||||
| [src/main/java/com/example/alipay/controller/SmartAssistantController.java](/src/main/java/com/example/alipay/controller/SmartAssistantController.java) | Java | 29 | 0 | 9 | 38 |
|
||||
| [src/main/java/com/example/alipay/controller/TravelController.java](/src/main/java/com/example/alipay/controller/TravelController.java) | Java | 41 | 0 | 8 | 49 |
|
||||
| [src/main/java/com/example/alipay/controller/admin/AdminAuthController.java](/src/main/java/com/example/alipay/controller/admin/AdminAuthController.java) | Java | 81 | 0 | 15 | 96 |
|
||||
| [src/main/java/com/example/alipay/controller/admin/AdminLogController.java](/src/main/java/com/example/alipay/controller/admin/AdminLogController.java) | Java | 29 | 0 | 8 | 37 |
|
||||
| [src/main/java/com/example/alipay/controller/admin/DiscountPolicyController.java](/src/main/java/com/example/alipay/controller/admin/DiscountPolicyController.java) | Java | 87 | 0 | 14 | 101 |
|
||||
| [src/main/java/com/example/alipay/controller/admin/UserManagementController.java](/src/main/java/com/example/alipay/controller/admin/UserManagementController.java) | Java | 72 | 0 | 13 | 85 |
|
||||
| [src/main/java/com/example/alipay/controller/fintech/AssetController.java](/src/main/java/com/example/alipay/controller/fintech/AssetController.java) | Java | 61 | 0 | 12 | 73 |
|
||||
| [src/main/java/com/example/alipay/controller/fintech/AuthController.java](/src/main/java/com/example/alipay/controller/fintech/AuthController.java) | Java | 124 | 0 | 16 | 140 |
|
||||
| [src/main/java/com/example/alipay/controller/fintech/BillController.java](/src/main/java/com/example/alipay/controller/fintech/BillController.java) | Java | 48 | 0 | 10 | 58 |
|
||||
| [src/main/java/com/example/alipay/controller/site/GateEventController.java](/src/main/java/com/example/alipay/controller/site/GateEventController.java) | Java | 82 | 1 | 15 | 98 |
|
||||
| [src/main/java/com/example/alipay/controller/site/StationManagementController.java](/src/main/java/com/example/alipay/controller/site/StationManagementController.java) | Java | 136 | 3 | 20 | 159 |
|
||||
| [src/main/java/com/example/alipay/model/AssistantMessage.java](/src/main/java/com/example/alipay/model/AssistantMessage.java) | Java | 29 | 1 | 8 | 38 |
|
||||
| [src/main/java/com/example/alipay/model/CollectionQRCode.java](/src/main/java/com/example/alipay/model/CollectionQRCode.java) | Java | 22 | 0 | 4 | 26 |
|
||||
| [src/main/java/com/example/alipay/model/Payment.java](/src/main/java/com/example/alipay/model/Payment.java) | Java | 35 | 0 | 4 | 39 |
|
||||
| [src/main/java/com/example/alipay/model/TravelPass.java](/src/main/java/com/example/alipay/model/TravelPass.java) | Java | 28 | 1 | 4 | 33 |
|
||||
| [src/main/java/com/example/alipay/model/TravelRecord.java](/src/main/java/com/example/alipay/model/TravelRecord.java) | Java | 32 | 1 | 4 | 37 |
|
||||
| [src/main/java/com/example/alipay/model/UserAccount.java](/src/main/java/com/example/alipay/model/UserAccount.java) | Java | 22 | 1 | 4 | 27 |
|
||||
| [src/main/java/com/example/alipay/model/admin/AdminOperationLog.java](/src/main/java/com/example/alipay/model/admin/AdminOperationLog.java) | Java | 22 | 0 | 8 | 30 |
|
||||
| [src/main/java/com/example/alipay/model/admin/AdminUser.java](/src/main/java/com/example/alipay/model/admin/AdminUser.java) | Java | 29 | 1 | 9 | 39 |
|
||||
| [src/main/java/com/example/alipay/model/admin/CreateAdminRequest.java](/src/main/java/com/example/alipay/model/admin/CreateAdminRequest.java) | Java | 8 | 0 | 3 | 11 |
|
||||
| [src/main/java/com/example/alipay/model/admin/DiscountPolicy.java](/src/main/java/com/example/alipay/model/admin/DiscountPolicy.java) | Java | 27 | 0 | 8 | 35 |
|
||||
| [src/main/java/com/example/alipay/model/fintech/BankCard.java](/src/main/java/com/example/alipay/model/fintech/BankCard.java) | Java | 14 | 0 | 3 | 17 |
|
||||
| [src/main/java/com/example/alipay/model/fintech/Bill.java](/src/main/java/com/example/alipay/model/fintech/Bill.java) | Java | 21 | 0 | 7 | 28 |
|
||||
| [src/main/java/com/example/alipay/model/fintech/User.java](/src/main/java/com/example/alipay/model/fintech/User.java) | Java | 39 | 0 | 11 | 50 |
|
||||
| [src/main/java/com/example/alipay/model/fintech/UserAudit.java](/src/main/java/com/example/alipay/model/fintech/UserAudit.java) | Java | 16 | 0 | 3 | 19 |
|
||||
| [src/main/java/com/example/alipay/model/fintech/UserStatus.java](/src/main/java/com/example/alipay/model/fintech/UserStatus.java) | Java | 7 | 0 | 2 | 9 |
|
||||
| [src/main/java/com/example/alipay/model/site/Gate.java](/src/main/java/com/example/alipay/model/site/Gate.java) | Java | 22 | 0 | 7 | 29 |
|
||||
| [src/main/java/com/example/alipay/model/site/GateEvent.java](/src/main/java/com/example/alipay/model/site/GateEvent.java) | Java | 28 | 0 | 9 | 37 |
|
||||
| [src/main/java/com/example/alipay/model/site/Station.java](/src/main/java/com/example/alipay/model/site/Station.java) | Java | 21 | 0 | 6 | 27 |
|
||||
| [src/main/java/com/example/alipay/repository/AssistantMessageRepository.java](/src/main/java/com/example/alipay/repository/AssistantMessageRepository.java) | Java | 7 | 1 | 2 | 10 |
|
||||
| [src/main/java/com/example/alipay/repository/CollectionQRCodeRepository.java](/src/main/java/com/example/alipay/repository/CollectionQRCodeRepository.java) | Java | 5 | 0 | 3 | 8 |
|
||||
| [src/main/java/com/example/alipay/repository/PaymentRepository.java](/src/main/java/com/example/alipay/repository/PaymentRepository.java) | Java | 10 | 0 | 4 | 14 |
|
||||
| [src/main/java/com/example/alipay/repository/TravelPassRepository.java](/src/main/java/com/example/alipay/repository/TravelPassRepository.java) | Java | 7 | 0 | 4 | 11 |
|
||||
| [src/main/java/com/example/alipay/repository/TravelRecordRepository.java](/src/main/java/com/example/alipay/repository/TravelRecordRepository.java) | Java | 7 | 0 | 4 | 11 |
|
||||
| [src/main/java/com/example/alipay/repository/UserAccountRepository.java](/src/main/java/com/example/alipay/repository/UserAccountRepository.java) | Java | 14 | 0 | 6 | 20 |
|
||||
| [src/main/java/com/example/alipay/repository/admin/AdminOperationLogRepository.java](/src/main/java/com/example/alipay/repository/admin/AdminOperationLogRepository.java) | Java | 8 | 0 | 3 | 11 |
|
||||
| [src/main/java/com/example/alipay/repository/admin/AdminUserRepository.java](/src/main/java/com/example/alipay/repository/admin/AdminUserRepository.java) | Java | 8 | 0 | 3 | 11 |
|
||||
| [src/main/java/com/example/alipay/repository/admin/DiscountPolicyRepository.java](/src/main/java/com/example/alipay/repository/admin/DiscountPolicyRepository.java) | Java | 8 | 0 | 3 | 11 |
|
||||
| [src/main/java/com/example/alipay/repository/fintech/BankCardRepository.java](/src/main/java/com/example/alipay/repository/fintech/BankCardRepository.java) | Java | 8 | 0 | 3 | 11 |
|
||||
| [src/main/java/com/example/alipay/repository/fintech/BillRepository.java](/src/main/java/com/example/alipay/repository/fintech/BillRepository.java) | Java | 11 | 0 | 3 | 14 |
|
||||
| [src/main/java/com/example/alipay/repository/fintech/UserAuditRepository.java](/src/main/java/com/example/alipay/repository/fintech/UserAuditRepository.java) | Java | 7 | 0 | 3 | 10 |
|
||||
| [src/main/java/com/example/alipay/repository/fintech/UserRepository.java](/src/main/java/com/example/alipay/repository/fintech/UserRepository.java) | Java | 18 | 0 | 7 | 25 |
|
||||
| [src/main/java/com/example/alipay/repository/site/GateEventRepository.java](/src/main/java/com/example/alipay/repository/site/GateEventRepository.java) | Java | 12 | 0 | 3 | 15 |
|
||||
| [src/main/java/com/example/alipay/repository/site/GateRepository.java](/src/main/java/com/example/alipay/repository/site/GateRepository.java) | Java | 12 | 0 | 3 | 15 |
|
||||
| [src/main/java/com/example/alipay/repository/site/StationRepository.java](/src/main/java/com/example/alipay/repository/site/StationRepository.java) | Java | 11 | 0 | 3 | 14 |
|
||||
| [src/main/java/com/example/alipay/security/fintech/CustomUserDetailsService.java](/src/main/java/com/example/alipay/security/fintech/CustomUserDetailsService.java) | Java | 31 | 0 | 6 | 37 |
|
||||
| [src/main/java/com/example/alipay/security/fintech/JwtAuthenticationFilter.java](/src/main/java/com/example/alipay/security/fintech/JwtAuthenticationFilter.java) | Java | 43 | 0 | 7 | 50 |
|
||||
| [src/main/java/com/example/alipay/security/fintech/JwtUtil.java](/src/main/java/com/example/alipay/security/fintech/JwtUtil.java) | Java | 38 | 0 | 9 | 47 |
|
||||
| [src/main/java/com/example/alipay/service/CollectionService.java](/src/main/java/com/example/alipay/service/CollectionService.java) | Java | 36 | 0 | 8 | 44 |
|
||||
| [src/main/java/com/example/alipay/service/PaymentService.java](/src/main/java/com/example/alipay/service/PaymentService.java) | Java | 195 | 0 | 19 | 214 |
|
||||
| [src/main/java/com/example/alipay/service/QrService.java](/src/main/java/com/example/alipay/service/QrService.java) | Java | 70 | 0 | 23 | 93 |
|
||||
| [src/main/java/com/example/alipay/service/SmartAssistantService.java](/src/main/java/com/example/alipay/service/SmartAssistantService.java) | Java | 151 | 1 | 35 | 187 |
|
||||
| [src/main/java/com/example/alipay/service/TravelService.java](/src/main/java/com/example/alipay/service/TravelService.java) | Java | 138 | 1 | 13 | 152 |
|
||||
| [src/main/java/com/example/alipay/service/admin/AdminAuthService.java](/src/main/java/com/example/alipay/service/admin/AdminAuthService.java) | Java | 54 | 0 | 12 | 66 |
|
||||
| [src/main/java/com/example/alipay/service/admin/AdminOperationLogService.java](/src/main/java/com/example/alipay/service/admin/AdminOperationLogService.java) | Java | 21 | 0 | 8 | 29 |
|
||||
| [src/main/java/com/example/alipay/service/admin/AdminOperationLogger.java](/src/main/java/com/example/alipay/service/admin/AdminOperationLogger.java) | Java | 60 | 0 | 9 | 69 |
|
||||
| [src/main/java/com/example/alipay/service/admin/DiscountPolicyService.java](/src/main/java/com/example/alipay/service/admin/DiscountPolicyService.java) | Java | 104 | 0 | 15 | 119 |
|
||||
| [src/main/java/com/example/alipay/service/admin/UserManagementService.java](/src/main/java/com/example/alipay/service/admin/UserManagementService.java) | Java | 84 | 1 | 13 | 98 |
|
||||
| [src/main/java/com/example/alipay/service/fintech/AssetService.java](/src/main/java/com/example/alipay/service/fintech/AssetService.java) | Java | 76 | 0 | 19 | 95 |
|
||||
| [src/main/java/com/example/alipay/service/fintech/AuthService.java](/src/main/java/com/example/alipay/service/fintech/AuthService.java) | Java | 62 | 0 | 11 | 73 |
|
||||
| [src/main/java/com/example/alipay/service/fintech/BillService.java](/src/main/java/com/example/alipay/service/fintech/BillService.java) | Java | 77 | 0 | 17 | 94 |
|
||||
| [src/main/java/com/example/alipay/service/site/GateEventService.java](/src/main/java/com/example/alipay/service/site/GateEventService.java) | Java | 155 | 10 | 33 | 198 |
|
||||
| [src/main/java/com/example/alipay/service/site/StationManagementService.java](/src/main/java/com/example/alipay/service/site/StationManagementService.java) | Java | 128 | 2 | 21 | 151 |
|
||||
| [src/main/resources/application.properties](/src/main/resources/application.properties) | Java Properties | 18 | 12 | 7 | 37 |
|
||||
| [src/test/java/com/example/alipay/service/PaymentServiceTest.java](/src/test/java/com/example/alipay/service/PaymentServiceTest.java) | Java | 108 | 0 | 20 | 128 |
|
||||
|
||||
[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
@ -1,15 +0,0 @@
|
||||
# Diff Details
|
||||
|
||||
Date : 2026-01-05 15:04:31
|
||||
|
||||
Directory c:\\Users\\87641\\Downloads\\simple-alipay-backend\\src
|
||||
|
||||
Total : 0 files, 0 codes, 0 comments, 0 blanks, all 0 lines
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
|
||||
|
||||
## Files
|
||||
| filename | language | code | comment | blank | total |
|
||||
| :--- | :--- | ---: | ---: | ---: | ---: |
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
|
||||
|
@ -1,19 +0,0 @@
|
||||
# Diff Summary
|
||||
|
||||
Date : 2026-01-05 15:04:31
|
||||
|
||||
Directory c:\\Users\\87641\\Downloads\\simple-alipay-backend\\src
|
||||
|
||||
Total : 0 files, 0 codes, 0 comments, 0 blanks, all 0 lines
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
|
||||
|
||||
## Languages
|
||||
| language | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
|
||||
## Directories
|
||||
| path | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
|
||||
[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
|
||||
@ -1,22 +0,0 @@
|
||||
Date : 2026-01-05 15:04:31
|
||||
Directory : c:\Users\87641\Downloads\simple-alipay-backend\src
|
||||
Total : 0 files, 0 codes, 0 comments, 0 blanks, all 0 lines
|
||||
|
||||
Languages
|
||||
+----------+------------+------------+------------+------------+------------+
|
||||
| language | files | code | comment | blank | total |
|
||||
+----------+------------+------------+------------+------------+------------+
|
||||
+----------+------------+------------+------------+------------+------------+
|
||||
|
||||
Directories
|
||||
+------+------------+------------+------------+------------+------------+
|
||||
| path | files | code | comment | blank | total |
|
||||
+------+------------+------------+------------+------------+------------+
|
||||
+------+------------+------------+------------+------------+------------+
|
||||
|
||||
Files
|
||||
+----------+----------+------------+------------+------------+------------+
|
||||
| filename | language | code | comment | blank | total |
|
||||
+----------+----------+------------+------------+------------+------------+
|
||||
| Total | | 0 | 0 | 0 | 0 |
|
||||
+----------+----------+------------+------------+------------+------------+
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,60 +0,0 @@
|
||||
# Summary
|
||||
|
||||
Date : 2026-01-05 15:04:31
|
||||
|
||||
Directory c:\\Users\\87641\\Downloads\\simple-alipay-backend\\src
|
||||
|
||||
Total : 71 files, 3342 codes, 42 comments, 654 blanks, all 4038 lines
|
||||
|
||||
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
|
||||
## Languages
|
||||
| language | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
| Java | 70 | 3,324 | 30 | 647 | 4,001 |
|
||||
| Java Properties | 1 | 18 | 12 | 7 | 37 |
|
||||
|
||||
## Directories
|
||||
| path | files | code | comment | blank | total |
|
||||
| :--- | ---: | ---: | ---: | ---: | ---: |
|
||||
| . | 71 | 3,342 | 42 | 654 | 4,038 |
|
||||
| main | 70 | 3,234 | 42 | 634 | 3,910 |
|
||||
| main\\java | 69 | 3,216 | 30 | 627 | 3,873 |
|
||||
| main\\java\\com | 69 | 3,216 | 30 | 627 | 3,873 |
|
||||
| main\\java\\com\\example | 69 | 3,216 | 30 | 627 | 3,873 |
|
||||
| main\\java\\com\\example\\alipay | 69 | 3,216 | 30 | 627 | 3,873 |
|
||||
| main\\java\\com\\example\\alipay (Files) | 1 | 9 | 0 | 3 | 12 |
|
||||
| main\\java\\com\\example\\alipay\\config | 3 | 211 | 5 | 30 | 246 |
|
||||
| main\\java\\com\\example\\alipay\\config (Files) | 2 | 134 | 0 | 21 | 155 |
|
||||
| main\\java\\com\\example\\alipay\\config\\fintech | 1 | 77 | 5 | 9 | 91 |
|
||||
| main\\java\\com\\example\\alipay\\controller | 13 | 898 | 4 | 155 | 1,057 |
|
||||
| main\\java\\com\\example\\alipay\\controller (Files) | 4 | 178 | 0 | 32 | 210 |
|
||||
| main\\java\\com\\example\\alipay\\controller\\admin | 4 | 269 | 0 | 50 | 319 |
|
||||
| main\\java\\com\\example\\alipay\\controller\\fintech | 3 | 233 | 0 | 38 | 271 |
|
||||
| main\\java\\com\\example\\alipay\\controller\\site | 2 | 218 | 4 | 35 | 257 |
|
||||
| main\\java\\com\\example\\alipay\\model | 18 | 422 | 5 | 104 | 531 |
|
||||
| main\\java\\com\\example\\alipay\\model (Files) | 6 | 168 | 4 | 28 | 200 |
|
||||
| main\\java\\com\\example\\alipay\\model\\admin | 4 | 86 | 1 | 28 | 115 |
|
||||
| main\\java\\com\\example\\alipay\\model\\fintech | 5 | 97 | 0 | 26 | 123 |
|
||||
| main\\java\\com\\example\\alipay\\model\\site | 3 | 71 | 0 | 22 | 93 |
|
||||
| main\\java\\com\\example\\alipay\\repository | 16 | 153 | 1 | 57 | 211 |
|
||||
| main\\java\\com\\example\\alipay\\repository (Files) | 6 | 50 | 1 | 23 | 74 |
|
||||
| main\\java\\com\\example\\alipay\\repository\\admin | 3 | 24 | 0 | 9 | 33 |
|
||||
| main\\java\\com\\example\\alipay\\repository\\fintech | 4 | 44 | 0 | 16 | 60 |
|
||||
| main\\java\\com\\example\\alipay\\repository\\site | 3 | 35 | 0 | 9 | 44 |
|
||||
| main\\java\\com\\example\\alipay\\security | 3 | 112 | 0 | 22 | 134 |
|
||||
| main\\java\\com\\example\\alipay\\security\\fintech | 3 | 112 | 0 | 22 | 134 |
|
||||
| main\\java\\com\\example\\alipay\\service | 15 | 1,411 | 15 | 256 | 1,682 |
|
||||
| main\\java\\com\\example\\alipay\\service (Files) | 5 | 590 | 2 | 98 | 690 |
|
||||
| main\\java\\com\\example\\alipay\\service\\admin | 5 | 323 | 1 | 57 | 381 |
|
||||
| main\\java\\com\\example\\alipay\\service\\fintech | 3 | 215 | 0 | 47 | 262 |
|
||||
| main\\java\\com\\example\\alipay\\service\\site | 2 | 283 | 12 | 54 | 349 |
|
||||
| main\\resources | 1 | 18 | 12 | 7 | 37 |
|
||||
| test | 1 | 108 | 0 | 20 | 128 |
|
||||
| test\\java | 1 | 108 | 0 | 20 | 128 |
|
||||
| test\\java\\com | 1 | 108 | 0 | 20 | 128 |
|
||||
| test\\java\\com\\example | 1 | 108 | 0 | 20 | 128 |
|
||||
| test\\java\\com\\example\\alipay | 1 | 108 | 0 | 20 | 128 |
|
||||
| test\\java\\com\\example\\alipay\\service | 1 | 108 | 0 | 20 | 128 |
|
||||
|
||||
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
|
||||
@ -1,134 +0,0 @@
|
||||
Date : 2026-01-05 15:04:31
|
||||
Directory : c:\Users\87641\Downloads\simple-alipay-backend\src
|
||||
Total : 71 files, 3342 codes, 42 comments, 654 blanks, all 4038 lines
|
||||
|
||||
Languages
|
||||
+-----------------+------------+------------+------------+------------+------------+
|
||||
| language | files | code | comment | blank | total |
|
||||
+-----------------+------------+------------+------------+------------+------------+
|
||||
| Java | 70 | 3,324 | 30 | 647 | 4,001 |
|
||||
| Java Properties | 1 | 18 | 12 | 7 | 37 |
|
||||
+-----------------+------------+------------+------------+------------+------------+
|
||||
|
||||
Directories
|
||||
+-----------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
| path | files | code | comment | blank | total |
|
||||
+-----------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
| . | 71 | 3,342 | 42 | 654 | 4,038 |
|
||||
| main | 70 | 3,234 | 42 | 634 | 3,910 |
|
||||
| main\java | 69 | 3,216 | 30 | 627 | 3,873 |
|
||||
| main\java\com | 69 | 3,216 | 30 | 627 | 3,873 |
|
||||
| main\java\com\example | 69 | 3,216 | 30 | 627 | 3,873 |
|
||||
| main\java\com\example\alipay | 69 | 3,216 | 30 | 627 | 3,873 |
|
||||
| main\java\com\example\alipay (Files) | 1 | 9 | 0 | 3 | 12 |
|
||||
| main\java\com\example\alipay\config | 3 | 211 | 5 | 30 | 246 |
|
||||
| main\java\com\example\alipay\config (Files) | 2 | 134 | 0 | 21 | 155 |
|
||||
| main\java\com\example\alipay\config\fintech | 1 | 77 | 5 | 9 | 91 |
|
||||
| main\java\com\example\alipay\controller | 13 | 898 | 4 | 155 | 1,057 |
|
||||
| main\java\com\example\alipay\controller (Files) | 4 | 178 | 0 | 32 | 210 |
|
||||
| main\java\com\example\alipay\controller\admin | 4 | 269 | 0 | 50 | 319 |
|
||||
| main\java\com\example\alipay\controller\fintech | 3 | 233 | 0 | 38 | 271 |
|
||||
| main\java\com\example\alipay\controller\site | 2 | 218 | 4 | 35 | 257 |
|
||||
| main\java\com\example\alipay\model | 18 | 422 | 5 | 104 | 531 |
|
||||
| main\java\com\example\alipay\model (Files) | 6 | 168 | 4 | 28 | 200 |
|
||||
| main\java\com\example\alipay\model\admin | 4 | 86 | 1 | 28 | 115 |
|
||||
| main\java\com\example\alipay\model\fintech | 5 | 97 | 0 | 26 | 123 |
|
||||
| main\java\com\example\alipay\model\site | 3 | 71 | 0 | 22 | 93 |
|
||||
| main\java\com\example\alipay\repository | 16 | 153 | 1 | 57 | 211 |
|
||||
| main\java\com\example\alipay\repository (Files) | 6 | 50 | 1 | 23 | 74 |
|
||||
| main\java\com\example\alipay\repository\admin | 3 | 24 | 0 | 9 | 33 |
|
||||
| main\java\com\example\alipay\repository\fintech | 4 | 44 | 0 | 16 | 60 |
|
||||
| main\java\com\example\alipay\repository\site | 3 | 35 | 0 | 9 | 44 |
|
||||
| main\java\com\example\alipay\security | 3 | 112 | 0 | 22 | 134 |
|
||||
| main\java\com\example\alipay\security\fintech | 3 | 112 | 0 | 22 | 134 |
|
||||
| main\java\com\example\alipay\service | 15 | 1,411 | 15 | 256 | 1,682 |
|
||||
| main\java\com\example\alipay\service (Files) | 5 | 590 | 2 | 98 | 690 |
|
||||
| main\java\com\example\alipay\service\admin | 5 | 323 | 1 | 57 | 381 |
|
||||
| main\java\com\example\alipay\service\fintech | 3 | 215 | 0 | 47 | 262 |
|
||||
| main\java\com\example\alipay\service\site | 2 | 283 | 12 | 54 | 349 |
|
||||
| main\resources | 1 | 18 | 12 | 7 | 37 |
|
||||
| test | 1 | 108 | 0 | 20 | 128 |
|
||||
| test\java | 1 | 108 | 0 | 20 | 128 |
|
||||
| test\java\com | 1 | 108 | 0 | 20 | 128 |
|
||||
| test\java\com\example | 1 | 108 | 0 | 20 | 128 |
|
||||
| test\java\com\example\alipay | 1 | 108 | 0 | 20 | 128 |
|
||||
| test\java\com\example\alipay\service | 1 | 108 | 0 | 20 | 128 |
|
||||
+-----------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+------------+------------+
|
||||
|
||||
Files
|
||||
+-----------------------------------------------------------------------------------------------------------------------------------+-----------------+------------+------------+------------+------------+
|
||||
| filename | language | code | comment | blank | total |
|
||||
+-----------------------------------------------------------------------------------------------------------------------------------+-----------------+------------+------------+------------+------------+
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\SimpleAlipayBackendApplication.java | Java | 9 | 0 | 3 | 12 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\config\DataLoader.java | Java | 51 | 0 | 5 | 56 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\config\GlobalExceptionHandler.java | Java | 83 | 0 | 16 | 99 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\config\fintech\SecurityConfig.java | Java | 77 | 5 | 9 | 91 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\controller\CollectionController.java | Java | 40 | 0 | 7 | 47 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\controller\PaymentController.java | Java | 68 | 0 | 8 | 76 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\controller\SmartAssistantController.java | Java | 29 | 0 | 9 | 38 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\controller\TravelController.java | Java | 41 | 0 | 8 | 49 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\controller\admin\AdminAuthController.java | Java | 81 | 0 | 15 | 96 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\controller\admin\AdminLogController.java | Java | 29 | 0 | 8 | 37 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\controller\admin\DiscountPolicyController.java | Java | 87 | 0 | 14 | 101 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\controller\admin\UserManagementController.java | Java | 72 | 0 | 13 | 85 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\controller\fintech\AssetController.java | Java | 61 | 0 | 12 | 73 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\controller\fintech\AuthController.java | Java | 124 | 0 | 16 | 140 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\controller\fintech\BillController.java | Java | 48 | 0 | 10 | 58 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\controller\site\GateEventController.java | Java | 82 | 1 | 15 | 98 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\controller\site\StationManagementController.java | Java | 136 | 3 | 20 | 159 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\AssistantMessage.java | Java | 29 | 1 | 8 | 38 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\CollectionQRCode.java | Java | 22 | 0 | 4 | 26 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\Payment.java | Java | 35 | 0 | 4 | 39 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\TravelPass.java | Java | 28 | 1 | 4 | 33 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\TravelRecord.java | Java | 32 | 1 | 4 | 37 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\UserAccount.java | Java | 22 | 1 | 4 | 27 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\admin\AdminOperationLog.java | Java | 22 | 0 | 8 | 30 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\admin\AdminUser.java | Java | 29 | 1 | 9 | 39 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\admin\CreateAdminRequest.java | Java | 8 | 0 | 3 | 11 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\admin\DiscountPolicy.java | Java | 27 | 0 | 8 | 35 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\fintech\BankCard.java | Java | 14 | 0 | 3 | 17 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\fintech\Bill.java | Java | 21 | 0 | 7 | 28 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\fintech\User.java | Java | 39 | 0 | 11 | 50 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\fintech\UserAudit.java | Java | 16 | 0 | 3 | 19 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\fintech\UserStatus.java | Java | 7 | 0 | 2 | 9 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\site\Gate.java | Java | 22 | 0 | 7 | 29 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\site\GateEvent.java | Java | 28 | 0 | 9 | 37 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\model\site\Station.java | Java | 21 | 0 | 6 | 27 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\AssistantMessageRepository.java | Java | 7 | 1 | 2 | 10 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\CollectionQRCodeRepository.java | Java | 5 | 0 | 3 | 8 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\PaymentRepository.java | Java | 10 | 0 | 4 | 14 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\TravelPassRepository.java | Java | 7 | 0 | 4 | 11 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\TravelRecordRepository.java | Java | 7 | 0 | 4 | 11 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\UserAccountRepository.java | Java | 14 | 0 | 6 | 20 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\admin\AdminOperationLogRepository.java | Java | 8 | 0 | 3 | 11 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\admin\AdminUserRepository.java | Java | 8 | 0 | 3 | 11 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\admin\DiscountPolicyRepository.java | Java | 8 | 0 | 3 | 11 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\fintech\BankCardRepository.java | Java | 8 | 0 | 3 | 11 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\fintech\BillRepository.java | Java | 11 | 0 | 3 | 14 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\fintech\UserAuditRepository.java | Java | 7 | 0 | 3 | 10 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\fintech\UserRepository.java | Java | 18 | 0 | 7 | 25 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\site\GateEventRepository.java | Java | 12 | 0 | 3 | 15 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\site\GateRepository.java | Java | 12 | 0 | 3 | 15 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\repository\site\StationRepository.java | Java | 11 | 0 | 3 | 14 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\security\fintech\CustomUserDetailsService.java | Java | 31 | 0 | 6 | 37 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\security\fintech\JwtAuthenticationFilter.java | Java | 43 | 0 | 7 | 50 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\security\fintech\JwtUtil.java | Java | 38 | 0 | 9 | 47 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\CollectionService.java | Java | 36 | 0 | 8 | 44 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\PaymentService.java | Java | 195 | 0 | 19 | 214 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\QrService.java | Java | 70 | 0 | 23 | 93 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\SmartAssistantService.java | Java | 151 | 1 | 35 | 187 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\TravelService.java | Java | 138 | 1 | 13 | 152 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\admin\AdminAuthService.java | Java | 54 | 0 | 12 | 66 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\admin\AdminOperationLogService.java | Java | 21 | 0 | 8 | 29 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\admin\AdminOperationLogger.java | Java | 60 | 0 | 9 | 69 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\admin\DiscountPolicyService.java | Java | 104 | 0 | 15 | 119 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\admin\UserManagementService.java | Java | 84 | 1 | 13 | 98 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\fintech\AssetService.java | Java | 76 | 0 | 19 | 95 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\fintech\AuthService.java | Java | 62 | 0 | 11 | 73 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\fintech\BillService.java | Java | 77 | 0 | 17 | 94 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\site\GateEventService.java | Java | 155 | 10 | 33 | 198 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\java\com\example\alipay\service\site\StationManagementService.java | Java | 128 | 2 | 21 | 151 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\main\resources\application.properties | Java Properties | 18 | 12 | 7 | 37 |
|
||||
| c:\Users\87641\Downloads\simple-alipay-backend\src\test\java\com\example\alipay\service\PaymentServiceTest.java | Java | 108 | 0 | 20 | 128 |
|
||||
| Total | | 3,342 | 42 | 654 | 4,038 |
|
||||
+-----------------------------------------------------------------------------------------------------------------------------------+-----------------+------------+------------+------------+------------+
|
||||
@ -1,8 +0,0 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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="simple-alipay-backend" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="simple-alipay-backend" options="-parameters" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="hewendi@localhost" uuid="a83a0cb9-1efd-49a3-a7ba-278fcebb7c0b">
|
||||
<driver-ref>sqlserver.ms</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<imported>true</imported>
|
||||
<remarks>$PROJECT_DIR$/src/main/resources/application.properties</remarks>
|
||||
<jdbc-driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc-driver>
|
||||
<jdbc-url>jdbc:sqlserver://localhost:1433;databaseName=hewendi</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>
|
||||
</project>
|
||||
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
@ -1,13 +0,0 @@
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
Binary file not shown.
@ -1,3 +0,0 @@
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"java.compile.nullAnalysis.mode": "automatic"
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
# simple-alipay-backend
|
||||
|
||||
Spring Boot 3.4.12 + JDK21 demo backend implementing simplified payment, collection QR, and travel code modules.
|
||||
|
||||
How to run:
|
||||
- Build with Maven: `mvn clean package`
|
||||
- Run: `java -jar target/simple-alipay-backend-0.0.1-SNAPSHOT.jar`
|
||||
- H2 console: http://localhost:8080/h2-console (jdbc url: jdbc:h2:mem:alipay)
|
||||
|
||||
APIs (examples):
|
||||
- POST /api/pay/execute -> {"fromUser":"alice","toMerchant":"bob","amount":"10.00","method":"balance"}
|
||||
- POST /api/collect/create -> {"merchantId":"bob","validSeconds":"120"}
|
||||
- POST /api/collect/refresh/{id}
|
||||
- POST /api/collect/parseFromBase64 -> {"imageBase64":"<base64 png>"}
|
||||
- POST /api/travel/open -> {"username":"alice","city":"Beijing","line":"Line1","payment":"balance"}
|
||||
- POST /api/travel/entry -> {"username":"alice","city":"Beijing","line":"Line1"}
|
||||
- POST /api/travel/exit/{recordId}
|
||||
- GET /api/travel/records/{username}
|
||||
|
||||
Note: This project is intentionally minimal and NOT production-ready. Security and advanced error handling are omitted as requested.
|
||||
@ -1,146 +0,0 @@
|
||||
# 金融科技模块集成说明
|
||||
|
||||
## 新增功能模块
|
||||
|
||||
### 1. 用户认证模块
|
||||
- **注册**: POST `/api/fintech/auth/register`
|
||||
- **登录**: POST `/api/fintech/auth/login`
|
||||
|
||||
### 2. 资产管理模块
|
||||
- **查询余额**: GET `/api/fintech/assets/balance/{userId}`
|
||||
- **添加银行卡**: POST `/api/fintech/assets/cards`
|
||||
- **查询银行卡**: GET `/api/fintech/assets/cards/{userId}`
|
||||
- **转账**: POST `/api/fintech/assets/transfer`
|
||||
|
||||
### 3. 账单管理模块
|
||||
- **查询账单**: GET `/api/fintech/bills/{userId}`
|
||||
- **按类型查询**: GET `/api/fintech/bills/{userId}/type/{type}`
|
||||
- **账单概览**: GET `/api/fintech/bills/{userId}/overview`
|
||||
- **创建账单**: POST `/api/fintech/bills/create`
|
||||
|
||||
## 安全特性
|
||||
- JWT令牌认证
|
||||
- 密码BCrypt加密
|
||||
- 无状态会话管理
|
||||
|
||||
## 数据库表结构
|
||||
- `fintech_users` - 用户表
|
||||
- `bank_card` - 银行卡表
|
||||
- `bill` - 账单表
|
||||
- `user_audit` - 用户审核表
|
||||
|
||||
## 与原项目的关系
|
||||
- 完全独立的新模块,不影响原有支付宝功能
|
||||
- 使用相同的数据库连接
|
||||
- 共享Spring Boot框架
|
||||
- 新增API路径前缀 `/api/fintech/`
|
||||
|
||||
## Postman 测试指南
|
||||
|
||||
### 1. 用户注册
|
||||
**请求:**
|
||||
- **方法**: POST
|
||||
- **URL**: `http://localhost:8080/api/fintech/auth/register`
|
||||
- **Headers**: `Content-Type: application/json`
|
||||
- **Body**:
|
||||
```json
|
||||
{
|
||||
"username": "testuser",
|
||||
"password": "123456",
|
||||
"phone": "13800138000"
|
||||
}
|
||||
```
|
||||
|
||||
**响应示例:**
|
||||
```json
|
||||
{
|
||||
"message": "注册成功",
|
||||
"userId": 1,
|
||||
"username": "testuser"
|
||||
}
|
||||
```
|
||||
|
||||
### 2. 用户登录
|
||||
**请求:**
|
||||
- **方法**: POST
|
||||
- **URL**: `http://localhost:8080/api/fintech/auth/login`
|
||||
- **Headers**: `Content-Type: application/json`
|
||||
- **Body**:
|
||||
```json
|
||||
{
|
||||
"username": "testuser",
|
||||
"password": "123456"
|
||||
}
|
||||
```
|
||||
|
||||
**响应示例:**
|
||||
```json
|
||||
{
|
||||
"message": "登录成功",
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
||||
"userId": 1,
|
||||
"username": "testuser",
|
||||
"balance": 0.00
|
||||
}
|
||||
```
|
||||
|
||||
### 3. 查询余额 (需要认证)
|
||||
**请求:**
|
||||
- **方法**: GET
|
||||
- **URL**: `http://localhost:8080/api/fintech/assets/balance/1`
|
||||
- **Headers**:
|
||||
- `Content-Type: application/json`
|
||||
- `Authorization: Bearer <your-jwt-token>`
|
||||
|
||||
**响应示例:**
|
||||
```json
|
||||
{
|
||||
"balance": 0.00
|
||||
}
|
||||
```
|
||||
|
||||
### 4. 添加银行卡
|
||||
**请求:**
|
||||
- **方法**: POST
|
||||
- **URL**: `http://localhost:8080/api/fintech/assets/cards`
|
||||
- **Headers**:
|
||||
- `Content-Type: application/json`
|
||||
- `Authorization: Bearer <your-jwt-token>`
|
||||
- **Body**:
|
||||
```json
|
||||
{
|
||||
"userId": 1,
|
||||
"bankName": "中国银行",
|
||||
"cardNumber": "6222021234567890123",
|
||||
"isDefault": true
|
||||
}
|
||||
```
|
||||
|
||||
### 5. 查询账单
|
||||
**请求:**
|
||||
- **方法**: GET
|
||||
- **URL**: `http://localhost:8080/api/fintech/bills/1`
|
||||
- **Headers**:
|
||||
- `Content-Type: application/json`
|
||||
- `Authorization: Bearer <your-jwt-token>`
|
||||
|
||||
### 6. 转账操作
|
||||
**请求:**
|
||||
- **方法**: POST
|
||||
- **URL**: `http://localhost:8080/api/fintech/assets/transfer`
|
||||
- **Headers**:
|
||||
- `Content-Type: application/json`
|
||||
- `Authorization: Bearer <your-jwt-token>`
|
||||
- **Body**:
|
||||
```json
|
||||
{
|
||||
"fromUserId": 1,
|
||||
"toUserId": 2,
|
||||
"amount": 100.00
|
||||
}
|
||||
```
|
||||
|
||||
## 注意事项
|
||||
- 金融科技模块需要认证才能访问资产和账单相关API
|
||||
- 认证API公开访问
|
||||
- 与原支付宝模块完全解耦,可以独立使用
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
MAVEN_PROJECTBASEDIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)"
|
||||
WRAPPER_DIR="$MAVEN_PROJECTBASEDIR/.mvn/wrapper"
|
||||
WRAPPER_JAR="$WRAPPER_DIR/maven-wrapper.jar"
|
||||
WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
|
||||
if [ ! -f "$WRAPPER_JAR" ]; then
|
||||
mkdir -p "$WRAPPER_DIR"
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL "$WRAPPER_URL" -o "$WRAPPER_JAR"
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
wget -q "$WRAPPER_URL" -O "$WRAPPER_JAR"
|
||||
else
|
||||
echo "Neither curl nor wget is available to download Maven Wrapper." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
exec java -Dmaven.multiModuleProjectDirectory="$MAVEN_PROJECTBASEDIR" -classpath "$WRAPPER_JAR" org.apache.maven.wrapper.MavenWrapperMain "$@"
|
||||
@ -1,17 +0,0 @@
|
||||
@ECHO OFF
|
||||
SETLOCAL
|
||||
|
||||
set "MAVEN_PROJECTBASEDIR=%~dp0"
|
||||
if "%MAVEN_PROJECTBASEDIR:~-1%"=="\" set "MAVEN_PROJECTBASEDIR=%MAVEN_PROJECTBASEDIR:~0,-1%"
|
||||
|
||||
set "WRAPPER_DIR=%MAVEN_PROJECTBASEDIR%\.mvn\wrapper"
|
||||
set "WRAPPER_JAR=%WRAPPER_DIR%\maven-wrapper.jar"
|
||||
set "WRAPPER_URL=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
|
||||
if not exist "%WRAPPER_JAR%" (
|
||||
if not exist "%WRAPPER_DIR%" mkdir "%WRAPPER_DIR%"
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -Command "try { Invoke-WebRequest -UseBasicParsing -Uri '%WRAPPER_URL%' -OutFile '%WRAPPER_JAR%' } catch { Write-Error $_; exit 1 }"
|
||||
if errorlevel 1 exit /b 1
|
||||
)
|
||||
|
||||
java -Dmaven.multiModuleProjectDirectory="%MAVEN_PROJECTBASEDIR%" -classpath "%WRAPPER_JAR%" org.apache.maven.wrapper.MavenWrapperMain %*
|
||||
@ -1,129 +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>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>simple-alipay-backend</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.4.12</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<java.version>21</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring Boot Web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Data JPA -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SQL Server JDBC 驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>mssql-jdbc</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- ZXing 二维码生成与解析 -->
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>3.5.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>javase</artifactId>
|
||||
<version>3.5.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON 时间处理 -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Bean 校验 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Security -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JWT -->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-api</artifactId>
|
||||
<version>0.11.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-impl</artifactId>
|
||||
<version>0.11.5</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-jackson</artifactId>
|
||||
<version>0.11.5</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Boot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<source>21</source>
|
||||
<target>21</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@ -1,11 +0,0 @@
|
||||
package com.example.alipay;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class SimpleAlipayBackendApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SimpleAlipayBackendApplication.class, args);
|
||||
}
|
||||
}
|
||||
@ -1,55 +0,0 @@
|
||||
package com.example.alipay.config;
|
||||
|
||||
import com.example.alipay.model.UserAccount;
|
||||
import com.example.alipay.model.fintech.User;
|
||||
import com.example.alipay.model.fintech.UserStatus;
|
||||
import com.example.alipay.repository.UserAccountRepository;
|
||||
import com.example.alipay.repository.fintech.UserRepository;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Configuration
|
||||
public class DataLoader {
|
||||
@Bean
|
||||
CommandLineRunner init(UserAccountRepository repo){
|
||||
return args -> {
|
||||
if (repo.findByUsername("alice").isEmpty()){
|
||||
UserAccount u = new UserAccount();
|
||||
u.setUsername("alice");
|
||||
u.setDisplayName("Alice");
|
||||
u.setDefaultPaymentMethod("balance");
|
||||
repo.save(u);
|
||||
}
|
||||
if (repo.findByUsername("bob").isEmpty()){
|
||||
UserAccount u2 = new UserAccount();
|
||||
u2.setUsername("bob");
|
||||
u2.setDisplayName("Bob Merchant");
|
||||
u2.setDefaultPaymentMethod("balance");
|
||||
repo.save(u2);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
CommandLineRunner initFintech(UserRepository userRepository, PasswordEncoder encoder){
|
||||
return args -> {
|
||||
if (!userRepository.existsByUsername("demo_payer")) {
|
||||
User user = User.builder()
|
||||
.username("demo_payer")
|
||||
.password(encoder.encode("demo123"))
|
||||
.phone("13800000000")
|
||||
.balance(new BigDecimal("100000000.00"))
|
||||
.status(UserStatus.ACTIVE)
|
||||
.build();
|
||||
user.setPayPassword(encoder.encode("123456"));
|
||||
user.setPayPwdFailedAttempts(0);
|
||||
user.setPayPwdLockedUntil(null);
|
||||
userRepository.save(user);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,98 +0,0 @@
|
||||
package com.example.alipay.config;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Map;
|
||||
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
||||
|
||||
private Map<String, Object> body(HttpStatus status, String error, String message, String exception, String path) {
|
||||
return Map.of(
|
||||
"status", status.value(),
|
||||
"error", error,
|
||||
"message", message,
|
||||
"exception", exception,
|
||||
"path", path,
|
||||
"timestamp", Instant.now().toString()
|
||||
);
|
||||
}
|
||||
|
||||
@ExceptionHandler(HttpMessageNotReadableException.class)
|
||||
public ResponseEntity<?> handleNotReadable(HttpMessageNotReadableException e, HttpServletRequest request) {
|
||||
log.warn("invalid_request: {}", e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(body(HttpStatus.BAD_REQUEST, "invalid_request", e.getMessage(), e.getClass().getSimpleName(), request.getRequestURI()));
|
||||
}
|
||||
|
||||
@ExceptionHandler(org.springframework.http.converter.HttpMessageNotWritableException.class)
|
||||
public ResponseEntity<?> handleNotWritable(org.springframework.http.converter.HttpMessageNotWritableException e, HttpServletRequest request) {
|
||||
log.error("message_not_writable", e);
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(body(HttpStatus.INTERNAL_SERVER_ERROR, "message_not_writable", e.getMessage(), e.getClass().getSimpleName(), request.getRequestURI()));
|
||||
}
|
||||
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
public ResponseEntity<?> handleValidation(MethodArgumentNotValidException e, HttpServletRequest request) {
|
||||
log.warn("validation_failed: {}", e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(body(HttpStatus.BAD_REQUEST, "validation_failed", e.getMessage(), e.getClass().getSimpleName(), request.getRequestURI()));
|
||||
}
|
||||
|
||||
@ExceptionHandler(IllegalArgumentException.class)
|
||||
public ResponseEntity<?> handleIllegalArgument(IllegalArgumentException e, HttpServletRequest request) {
|
||||
log.warn("invalid_argument: {}", e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(body(HttpStatus.BAD_REQUEST, "invalid_argument", e.getMessage(), e.getClass().getSimpleName(), request.getRequestURI()));
|
||||
}
|
||||
|
||||
@ExceptionHandler(AccessDeniedException.class)
|
||||
public ResponseEntity<?> handleAccessDenied(AccessDeniedException e, HttpServletRequest request) {
|
||||
log.warn("forbidden: {}", e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.FORBIDDEN).body(body(HttpStatus.FORBIDDEN, "forbidden", e.getMessage(), e.getClass().getSimpleName(), request.getRequestURI()));
|
||||
}
|
||||
|
||||
@ExceptionHandler({BadCredentialsException.class, UsernameNotFoundException.class})
|
||||
public ResponseEntity<?> handleAuth(Exception e, HttpServletRequest request) {
|
||||
log.warn("unauthorized: {}", e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(body(HttpStatus.UNAUTHORIZED, "unauthorized", e.getMessage(), e.getClass().getSimpleName(), request.getRequestURI()));
|
||||
}
|
||||
|
||||
@ExceptionHandler(DataAccessException.class)
|
||||
public ResponseEntity<?> handleDataAccess(DataAccessException e, HttpServletRequest request) {
|
||||
log.error("data_access_error", e);
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(body(HttpStatus.INTERNAL_SERVER_ERROR, "data_access_error", e.getMessage(), e.getClass().getSimpleName(), request.getRequestURI()));
|
||||
}
|
||||
|
||||
@ExceptionHandler(NullPointerException.class)
|
||||
public ResponseEntity<?> handleNpe(NullPointerException e, HttpServletRequest request) {
|
||||
log.error("null_pointer", e);
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(body(HttpStatus.INTERNAL_SERVER_ERROR, "null_pointer", e.getMessage(), e.getClass().getSimpleName(), request.getRequestURI()));
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ResponseEntity<?> handleGeneric(Exception e, HttpServletRequest request) {
|
||||
log.error("internal_error", e);
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(body(HttpStatus.INTERNAL_SERVER_ERROR, "internal_error", e.getMessage(), e.getClass().getSimpleName(), request.getRequestURI()));
|
||||
}
|
||||
|
||||
@ExceptionHandler(org.springframework.web.servlet.NoHandlerFoundException.class)
|
||||
public ResponseEntity<?> handleNoHandler(org.springframework.web.servlet.NoHandlerFoundException e, HttpServletRequest request) {
|
||||
log.warn("not_found: {}", e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(body(HttpStatus.NOT_FOUND, "not_found", e.getMessage(), e.getClass().getSimpleName(), request.getRequestURI()));
|
||||
}
|
||||
|
||||
@ExceptionHandler(org.springframework.web.servlet.resource.NoResourceFoundException.class)
|
||||
public ResponseEntity<?> handleNoResource(org.springframework.web.servlet.resource.NoResourceFoundException e, HttpServletRequest request) {
|
||||
log.warn("not_found: {}", e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(body(HttpStatus.NOT_FOUND, "not_found", e.getMessage(), e.getClass().getSimpleName(), request.getRequestURI()));
|
||||
}
|
||||
}
|
||||
@ -1,92 +0,0 @@
|
||||
package com.example.alipay.config.fintech;
|
||||
|
||||
import com.example.alipay.security.fintech.CustomUserDetailsService;
|
||||
import com.example.alipay.security.fintech.JwtAuthenticationFilter;
|
||||
import com.example.alipay.security.fintech.JwtUtil;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SecurityConfig {
|
||||
private final CustomUserDetailsService userDetailsService;
|
||||
private final JwtUtil jwtUtil;
|
||||
|
||||
public SecurityConfig(CustomUserDetailsService userDetailsService, JwtUtil jwtUtil) {
|
||||
this.userDetailsService = userDetailsService;
|
||||
this.jwtUtil = jwtUtil;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JwtAuthenticationFilter jwtAuthenticationFilter() {
|
||||
return new JwtAuthenticationFilter(userDetailsService, jwtUtil);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception {
|
||||
return authenticationConfiguration.getAuthenticationManager();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.csrf(csrf -> csrf.disable())
|
||||
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||
.authorizeHttpRequests(authz -> authz
|
||||
// 允许公开访问的API
|
||||
.requestMatchers("/api/fintech/auth/register", "/api/fintech/auth/login").permitAll()
|
||||
.requestMatchers("/api/fintech/auth/pay-password/**").authenticated()
|
||||
.requestMatchers("/api/admin/auth/**").permitAll()
|
||||
.requestMatchers("/api/pay/**").permitAll()
|
||||
.requestMatchers("/api/collect/**").permitAll()
|
||||
.requestMatchers("/api/travel/**").permitAll()
|
||||
.requestMatchers("/api/assistant/**").permitAll()
|
||||
.requestMatchers("/error").permitAll()
|
||||
.requestMatchers("/api/site/gates/*/entry").permitAll()
|
||||
.requestMatchers("/api/site/gates/*/exit").permitAll()
|
||||
.requestMatchers(HttpMethod.GET, "/api/site/stations/**").permitAll()
|
||||
// Actuator 健康检查端点
|
||||
.requestMatchers("/actuator/health").permitAll()
|
||||
// 管理员API需要SUPER_ADMIN角色
|
||||
.requestMatchers("/api/admin/**").hasRole("SUPER_ADMIN")
|
||||
// 站点管理API需要SITE_MANAGER角色
|
||||
.requestMatchers("/api/site/**").hasAnyRole("SITE_MANAGER", "SUPER_ADMIN")
|
||||
// 金融科技API需要认证
|
||||
.requestMatchers("/api/fintech/assets/**").authenticated()
|
||||
.requestMatchers("/api/fintech/bills/**").authenticated()
|
||||
.anyRequest().authenticated()
|
||||
)
|
||||
.exceptionHandling(ex -> ex
|
||||
.authenticationEntryPoint((request, response, authException) -> {
|
||||
response.setStatus(401);
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
String json = "{\"status\":401,\"error\":\"unauthorized\",\"message\":\"Authentication required\",\"path\":\"" + request.getRequestURI() + "\"}";
|
||||
response.getWriter().write(json);
|
||||
})
|
||||
.accessDeniedHandler((request, response, accessDeniedException) -> {
|
||||
response.setStatus(403);
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
String json = "{\"status\":403,\"error\":\"forbidden\",\"message\":\"Access denied\",\"path\":\"" + request.getRequestURI() + "\"}";
|
||||
response.getWriter().write(json);
|
||||
})
|
||||
)
|
||||
.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
|
||||
|
||||
return http.build();
|
||||
}
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
package com.example.alipay.controller;
|
||||
|
||||
import com.example.alipay.model.CollectionQRCode;
|
||||
import com.example.alipay.service.CollectionService;
|
||||
import com.example.alipay.service.QrService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/collect")
|
||||
public class CollectionController {
|
||||
private final CollectionService collectionService;
|
||||
private final QrService qrService;
|
||||
public CollectionController(CollectionService collectionService, QrService qrService){
|
||||
this.collectionService = collectionService;
|
||||
this.qrService = qrService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> create(@RequestBody Map<String,String> body) throws Exception {
|
||||
String merchantId = body.getOrDefault("merchantId","m1");
|
||||
int validSeconds = Integer.parseInt(body.getOrDefault("validSeconds","120"));
|
||||
CollectionQRCode q = collectionService.generateInitialQRCode(merchantId, validSeconds);
|
||||
String base64 = qrService.generateQrBase64(q.getContent(),300,300);
|
||||
return ResponseEntity.ok(Map.of("qrBase64", base64, "id", q.getId(), "expireAt", q.getExpireAt().toString()));
|
||||
}
|
||||
|
||||
@PostMapping("/refresh/{id}")
|
||||
public ResponseEntity<?> refresh(@PathVariable Long id, @RequestBody Map<String,String> body) throws Exception {
|
||||
int validSeconds = Integer.parseInt(body.getOrDefault("validSeconds","120"));
|
||||
CollectionQRCode q = collectionService.refreshQRCode(id, validSeconds);
|
||||
String base64 = qrService.generateQrBase64(q.getContent(),300,300);
|
||||
return ResponseEntity.ok(Map.of("qrBase64", base64, "id", q.getId(), "expireAt", q.getExpireAt().toString()));
|
||||
}
|
||||
|
||||
@PostMapping("/parseFromBase64")
|
||||
public ResponseEntity<?> parseFromBase64(@RequestBody Map<String,String> body) throws Exception {
|
||||
String b64 = body.get("imageBase64");
|
||||
byte[] bytes = Base64.getDecoder().decode(b64);
|
||||
String text = qrService.parseQrFromBytes(bytes);
|
||||
return ResponseEntity.ok(Map.of("text", text));
|
||||
}
|
||||
}
|
||||
@ -1,75 +0,0 @@
|
||||
package com.example.alipay.controller;
|
||||
|
||||
import com.example.alipay.model.Payment;
|
||||
import com.example.alipay.service.PaymentService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/pay")
|
||||
public class PaymentController {
|
||||
private final PaymentService paymentService;
|
||||
public PaymentController(PaymentService paymentService){this.paymentService = paymentService;}
|
||||
|
||||
@PostMapping("/execute")
|
||||
public ResponseEntity<?> executePayment(@RequestBody Map<String,String> body){
|
||||
String from = body.getOrDefault("fromUser","alice");
|
||||
String to = body.getOrDefault("toMerchant","merchant1");
|
||||
String amtS = body.getOrDefault("amount","0.00");
|
||||
String method = body.getOrDefault("method","qr");
|
||||
String paySource = body.get("paySource");
|
||||
String payCardIdS = body.get("payCardId");
|
||||
Long payCardId = (payCardIdS == null || payCardIdS.isBlank()) ? null : Long.valueOf(payCardIdS);
|
||||
String receiveSource = body.get("receiveSource");
|
||||
String receiveCardIdS = body.get("receiveCardId");
|
||||
Long receiveCardId = (receiveCardIdS == null || receiveCardIdS.isBlank()) ? null : Long.valueOf(receiveCardIdS);
|
||||
String payPassword = body.get("payPassword");
|
||||
BigDecimal amount = new BigDecimal(amtS);
|
||||
|
||||
String normalizedFrom = normalizeUserKey(from);
|
||||
String normalizedTo = normalizeUserKey(to);
|
||||
if (normalizedFrom.equals(normalizedTo)) {
|
||||
return ResponseEntity.status(422).body(Map.of("error", "BUSINESS_RULE"));
|
||||
}
|
||||
if ("balance".equalsIgnoreCase(paySource) || "card".equalsIgnoreCase(paySource)) {
|
||||
String pre = paymentService.preCheck(from, payPassword);
|
||||
if (pre != null) {
|
||||
if ("USER_NOT_FOUND".equals(pre)) {
|
||||
return ResponseEntity.status(404).body(Map.of("error", pre));
|
||||
}
|
||||
return ResponseEntity.status(403).body(Map.of("error", pre));
|
||||
}
|
||||
}
|
||||
|
||||
Payment p = paymentService.createAndExecutePayment(from,to,amount,method,paySource,payCardId,receiveSource,receiveCardId);
|
||||
if ("FAILED".equals(p.getStatus())) {
|
||||
String code = p.getErrorCode();
|
||||
if ("INSUFFICIENT_FUNDS".equals(code)) {
|
||||
return ResponseEntity.status(402).body(p);
|
||||
} else if ("CARD_NOT_FOUND".equals(code) || "CARD_OWNERSHIP_ERROR".equals(code)) {
|
||||
return ResponseEntity.status(404).body(p);
|
||||
} else if ("INVALID_PAY_SOURCE".equals(code)) {
|
||||
return ResponseEntity.status(422).body(p);
|
||||
} else if ("RECEIVER_NOT_FOUND".equals(code)) {
|
||||
return ResponseEntity.status(404).body(p);
|
||||
}
|
||||
}
|
||||
return ResponseEntity.ok(p);
|
||||
}
|
||||
|
||||
private String normalizeUserKey(String raw) {
|
||||
if (raw == null) return "";
|
||||
String v = raw.trim();
|
||||
if (v.startsWith("collect://")) {
|
||||
v = v.substring("collect://".length());
|
||||
}
|
||||
int slash = v.indexOf('/');
|
||||
if (slash > 0) {
|
||||
return v.substring(0, slash);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
package com.example.alipay.controller;
|
||||
|
||||
import com.example.alipay.model.AssistantMessage;
|
||||
import com.example.alipay.service.SmartAssistantService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/assistant")
|
||||
public class SmartAssistantController {
|
||||
|
||||
@Autowired
|
||||
private SmartAssistantService assistantService;
|
||||
|
||||
@GetMapping("/welcome")
|
||||
public String welcome() {
|
||||
return assistantService.getWelcomeMessage();
|
||||
}
|
||||
|
||||
@PostMapping("/chat")
|
||||
public AssistantMessage chat(@RequestParam String username, @RequestParam String content) {
|
||||
return assistantService.processChat(username, content);
|
||||
}
|
||||
|
||||
@GetMapping("/analysis/monthly")
|
||||
public Map<String, Object> getMonthlyAnalysis(@RequestParam String username) {
|
||||
return assistantService.analyzeMonthly(username);
|
||||
}
|
||||
|
||||
@GetMapping("/analysis/alerts")
|
||||
public List<?> getAbnormalRecords(@RequestParam String username) {
|
||||
return assistantService.getLargePayments(username);
|
||||
}
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
package com.example.alipay.controller;
|
||||
|
||||
import com.example.alipay.model.TravelPass;
|
||||
import com.example.alipay.model.TravelRecord;
|
||||
import com.example.alipay.service.TravelService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/travel")
|
||||
public class TravelController {
|
||||
private final TravelService travelService;
|
||||
public TravelController(TravelService travelService){this.travelService = travelService;}
|
||||
|
||||
@PostMapping("/open")
|
||||
public ResponseEntity<?> open(@RequestBody Map<String,String> body){
|
||||
String username = body.getOrDefault("username","alice");
|
||||
String city = body.getOrDefault("city","Beijing");
|
||||
String line = body.getOrDefault("line","Line1");
|
||||
String payment = body.getOrDefault("payment","balance");
|
||||
TravelPass p = travelService.openTravelPass(username,city,line,payment);
|
||||
return ResponseEntity.ok(p);
|
||||
}
|
||||
|
||||
@PostMapping("/entry")
|
||||
public ResponseEntity<?> entry(@RequestBody Map<String,String> body){
|
||||
String username = body.getOrDefault("username","alice");
|
||||
String city = body.getOrDefault("city","Beijing");
|
||||
String line = body.getOrDefault("line","Line1");
|
||||
TravelRecord r = travelService.entry(username,city,line);
|
||||
return ResponseEntity.ok(r);
|
||||
}
|
||||
|
||||
@PostMapping("/exit/{recordId}")
|
||||
public ResponseEntity<?> exit(@PathVariable Long recordId){
|
||||
TravelRecord r = travelService.exit(recordId);
|
||||
return ResponseEntity.ok(r);
|
||||
}
|
||||
|
||||
@GetMapping("/records/{username}")
|
||||
public ResponseEntity<?> records(@PathVariable String username){
|
||||
List<TravelRecord> list = travelService.listRecords(username);
|
||||
return ResponseEntity.ok(list);
|
||||
}
|
||||
}
|
||||
@ -1,95 +0,0 @@
|
||||
package com.example.alipay.controller.admin;
|
||||
|
||||
import com.example.alipay.model.admin.AdminUser;
|
||||
import com.example.alipay.model.admin.CreateAdminRequest;
|
||||
import com.example.alipay.security.fintech.JwtUtil;
|
||||
import com.example.alipay.service.admin.AdminAuthService;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/admin/auth")
|
||||
public class AdminAuthController {
|
||||
private final AdminAuthService adminAuthService;
|
||||
private final JwtUtil jwtUtil;
|
||||
|
||||
public AdminAuthController(AdminAuthService adminAuthService, JwtUtil jwtUtil) {
|
||||
this.adminAuthService = adminAuthService;
|
||||
this.jwtUtil = jwtUtil;
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
public ResponseEntity<?> login(@RequestBody Map<String, String> request) {
|
||||
return loginInternal(request.get("username"), request.get("password"));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
public ResponseEntity<?> loginForm(@RequestParam Map<String, String> request) {
|
||||
return loginInternal(request.get("username"), request.get("password"));
|
||||
}
|
||||
|
||||
private ResponseEntity<?> loginInternal(String username, String password) {
|
||||
|
||||
if (username == null || password == null) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "用户名和密码不能为空"));
|
||||
}
|
||||
|
||||
Optional<AdminUser> adminOpt = adminAuthService.authenticate(username, password);
|
||||
if (adminOpt.isPresent()) {
|
||||
AdminUser admin = adminOpt.get();
|
||||
String token = jwtUtil.generateToken(username);
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"message", "管理员登录成功",
|
||||
"token", token,
|
||||
"adminId", admin.getId(),
|
||||
"username", admin.getUsername(),
|
||||
"role", admin.getRole()
|
||||
));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "用户名或密码错误"));
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createAdmin(@RequestBody CreateAdminRequest request) {
|
||||
try {
|
||||
String username = request.getUsername();
|
||||
String password = request.getPassword();
|
||||
String role = request.getRole();
|
||||
|
||||
if (username == null || password == null || role == null) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "用户名、密码和角色不能为空"));
|
||||
}
|
||||
|
||||
AdminUser admin = adminAuthService.createAdmin(username, password, role);
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"message", "管理员创建成功",
|
||||
"adminId", admin.getId(),
|
||||
"username", admin.getUsername(),
|
||||
"role", admin.getRole()
|
||||
));
|
||||
} catch (RuntimeException e) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/admins")
|
||||
public ResponseEntity<?> listAdmins() {
|
||||
List<AdminUser> admins = adminAuthService.getAllAdmins();
|
||||
return ResponseEntity.ok(admins);
|
||||
}
|
||||
|
||||
@DeleteMapping("/admins/{adminId}")
|
||||
public ResponseEntity<?> deleteAdmin(@PathVariable Long adminId) {
|
||||
boolean success = adminAuthService.deleteAdmin(adminId);
|
||||
if (success) {
|
||||
return ResponseEntity.ok(Map.of("message", "管理员已删除", "adminId", adminId));
|
||||
}
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "管理员不存在", "adminId", adminId));
|
||||
}
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
package com.example.alipay.controller.admin;
|
||||
|
||||
import com.example.alipay.model.admin.AdminOperationLog;
|
||||
import com.example.alipay.service.admin.AdminOperationLogService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/admin/logs")
|
||||
public class AdminLogController {
|
||||
private final AdminOperationLogService logService;
|
||||
|
||||
public AdminLogController(AdminOperationLogService logService) {
|
||||
this.logService = logService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<?> getAllLogs() {
|
||||
List<AdminOperationLog> logs = logService.getAllLogs();
|
||||
return ResponseEntity.ok(logs);
|
||||
}
|
||||
|
||||
@GetMapping("/admin/{adminId}")
|
||||
public ResponseEntity<?> getLogsByAdmin(@PathVariable Long adminId) {
|
||||
List<AdminOperationLog> logs = logService.getLogsByAdmin(adminId);
|
||||
return ResponseEntity.ok(logs);
|
||||
}
|
||||
|
||||
@GetMapping("/type/{operationType}")
|
||||
public ResponseEntity<?> getLogsByType(@PathVariable String operationType) {
|
||||
List<AdminOperationLog> logs = logService.getLogsByType(operationType);
|
||||
return ResponseEntity.ok(logs);
|
||||
}
|
||||
}
|
||||
@ -1,100 +0,0 @@
|
||||
package com.example.alipay.controller.admin;
|
||||
|
||||
import com.example.alipay.model.admin.DiscountPolicy;
|
||||
import com.example.alipay.service.admin.DiscountPolicyService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/admin/policies")
|
||||
public class DiscountPolicyController {
|
||||
private final DiscountPolicyService discountPolicyService;
|
||||
|
||||
public DiscountPolicyController(DiscountPolicyService discountPolicyService) {
|
||||
this.discountPolicyService = discountPolicyService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<?> getAllPolicies() {
|
||||
List<DiscountPolicy> policies = discountPolicyService.getAllPolicies();
|
||||
return ResponseEntity.ok(policies);
|
||||
}
|
||||
|
||||
@GetMapping("/active")
|
||||
public ResponseEntity<?> getActivePolicies() {
|
||||
List<DiscountPolicy> policies = discountPolicyService.getActivePolicies();
|
||||
return ResponseEntity.ok(policies);
|
||||
}
|
||||
|
||||
@GetMapping("/{policyId}")
|
||||
public ResponseEntity<?> getPolicyById(@PathVariable Long policyId) {
|
||||
return discountPolicyService.getPolicyById(policyId)
|
||||
.map(ResponseEntity::ok)
|
||||
.orElse(ResponseEntity.notFound().build());
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<?> createPolicy(@RequestBody DiscountPolicy policy) {
|
||||
try {
|
||||
DiscountPolicy createdPolicy = discountPolicyService.createPolicy(policy);
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"message", "折扣策略创建成功",
|
||||
"policyId", createdPolicy.getId()
|
||||
));
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/{policyId}")
|
||||
public ResponseEntity<?> updatePolicy(@PathVariable Long policyId, @RequestBody DiscountPolicy policyDetails) {
|
||||
DiscountPolicy updatedPolicy = discountPolicyService.updatePolicy(policyId, policyDetails);
|
||||
if (updatedPolicy != null) {
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"message", "折扣策略更新成功",
|
||||
"policyId", updatedPolicy.getId()
|
||||
));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "策略不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/{policyId}/enable")
|
||||
public ResponseEntity<?> enablePolicy(@PathVariable Long policyId) {
|
||||
boolean success = discountPolicyService.enablePolicy(policyId);
|
||||
if (success) {
|
||||
return ResponseEntity.ok(Map.of("message", "折扣策略已启用"));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "策略不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/{policyId}/disable")
|
||||
public ResponseEntity<?> disablePolicy(@PathVariable Long policyId) {
|
||||
boolean success = discountPolicyService.disablePolicy(policyId);
|
||||
if (success) {
|
||||
return ResponseEntity.ok(Map.of("message", "折扣策略已禁用"));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "策略不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/{policyId}")
|
||||
public ResponseEntity<?> deletePolicy(@PathVariable Long policyId) {
|
||||
boolean success = discountPolicyService.deletePolicy(policyId);
|
||||
if (success) {
|
||||
return ResponseEntity.ok(Map.of("message", "折扣策略已删除"));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "策略不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/line/{line}")
|
||||
public ResponseEntity<?> getPoliciesByLine(@PathVariable String line) {
|
||||
List<DiscountPolicy> policies = discountPolicyService.getPoliciesByLine(line);
|
||||
return ResponseEntity.ok(policies);
|
||||
}
|
||||
}
|
||||
@ -1,84 +0,0 @@
|
||||
package com.example.alipay.controller.admin;
|
||||
|
||||
import com.example.alipay.model.fintech.User;
|
||||
import com.example.alipay.model.fintech.UserAudit;
|
||||
import com.example.alipay.service.admin.UserManagementService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/admin/users")
|
||||
public class UserManagementController {
|
||||
private final UserManagementService userManagementService;
|
||||
|
||||
public UserManagementController(UserManagementService userManagementService) {
|
||||
this.userManagementService = userManagementService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<?> getAllUsers() {
|
||||
List<User> users = userManagementService.getAllUsers();
|
||||
return ResponseEntity.ok(users);
|
||||
}
|
||||
|
||||
@GetMapping("/{userId}")
|
||||
public ResponseEntity<?> getUserById(@PathVariable Long userId) {
|
||||
return userManagementService.getUserById(userId)
|
||||
.map(ResponseEntity::ok)
|
||||
.orElse(ResponseEntity.notFound().build());
|
||||
}
|
||||
|
||||
@PostMapping("/{userId}/disable")
|
||||
public ResponseEntity<?> disableUser(@PathVariable Long userId) {
|
||||
boolean success = userManagementService.disableUser(userId);
|
||||
if (success) {
|
||||
return ResponseEntity.ok(Map.of("message", "用户已禁用"));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "用户不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/{userId}/enable")
|
||||
public ResponseEntity<?> enableUser(@PathVariable Long userId) {
|
||||
boolean success = userManagementService.enableUser(userId);
|
||||
if (success) {
|
||||
return ResponseEntity.ok(Map.of("message", "用户已启用"));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "用户不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/audits/pending")
|
||||
public ResponseEntity<?> getPendingAudits() {
|
||||
List<UserAudit> audits = userManagementService.getPendingAudits();
|
||||
return ResponseEntity.ok(audits);
|
||||
}
|
||||
|
||||
@PostMapping("/audits/{userId}/approve")
|
||||
public ResponseEntity<?> approveUserAudit(@PathVariable Long userId) {
|
||||
boolean success = userManagementService.approveUserAudit(userId);
|
||||
if (success) {
|
||||
return ResponseEntity.ok(Map.of("message", "用户审核已通过"));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "审核记录不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/audits/{userId}/reject")
|
||||
public ResponseEntity<?> rejectUserAudit(@PathVariable Long userId, @RequestBody Map<String, String> request) {
|
||||
String rejectReason = request.get("rejectReason");
|
||||
if (rejectReason == null || rejectReason.trim().isEmpty()) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "驳回原因不能为空"));
|
||||
}
|
||||
|
||||
boolean success = userManagementService.rejectUserAudit(userId, rejectReason);
|
||||
if (success) {
|
||||
return ResponseEntity.ok(Map.of("message", "用户审核已驳回"));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "审核记录不存在"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,72 +0,0 @@
|
||||
package com.example.alipay.controller.fintech;
|
||||
|
||||
import com.example.alipay.model.fintech.BankCard;
|
||||
import com.example.alipay.service.fintech.AssetService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/fintech/assets")
|
||||
public class AssetController {
|
||||
private final AssetService assetService;
|
||||
|
||||
public AssetController(AssetService assetService) {
|
||||
this.assetService = assetService;
|
||||
}
|
||||
|
||||
@GetMapping("/balance/{userId}")
|
||||
public ResponseEntity<?> getBalance(@PathVariable Long userId) {
|
||||
BigDecimal balance = assetService.getBalance(userId);
|
||||
return ResponseEntity.ok(Map.of("balance", balance));
|
||||
}
|
||||
|
||||
@PostMapping("/cards")
|
||||
public ResponseEntity<?> addBankCard(@RequestBody Map<String, Object> request) {
|
||||
try {
|
||||
Long userId = Long.valueOf(request.get("userId").toString());
|
||||
String bankName = (String) request.get("bankName");
|
||||
String cardNumber = (String) request.get("cardNumber");
|
||||
Boolean isDefault = (Boolean) request.get("isDefault");
|
||||
|
||||
if (isDefault == null) {
|
||||
isDefault = false;
|
||||
}
|
||||
|
||||
BankCard card = assetService.addBankCard(userId, bankName, cardNumber, isDefault);
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"message", "银行卡添加成功",
|
||||
"cardId", card.getId()
|
||||
));
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/cards/{userId}")
|
||||
public ResponseEntity<?> getUserCards(@PathVariable Long userId) {
|
||||
List<BankCard> cards = assetService.getUserCards(userId);
|
||||
return ResponseEntity.ok(cards);
|
||||
}
|
||||
|
||||
@PostMapping("/transfer")
|
||||
public ResponseEntity<?> transfer(@RequestBody Map<String, Object> request) {
|
||||
try {
|
||||
Long fromUserId = Long.valueOf(request.get("fromUserId").toString());
|
||||
Long toUserId = Long.valueOf(request.get("toUserId").toString());
|
||||
BigDecimal amount = new BigDecimal(request.get("amount").toString());
|
||||
|
||||
boolean success = assetService.transfer(fromUserId, toUserId, amount);
|
||||
if (success) {
|
||||
return ResponseEntity.ok(Map.of("message", "转账成功"));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "转账失败,余额不足或用户不存在"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", e.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,139 +0,0 @@
|
||||
package com.example.alipay.controller.fintech;
|
||||
|
||||
import com.example.alipay.model.fintech.User;
|
||||
import com.example.alipay.security.fintech.JwtUtil;
|
||||
import com.example.alipay.repository.fintech.UserAuditRepository;
|
||||
import com.example.alipay.service.fintech.AuthService;
|
||||
import com.example.alipay.service.admin.AdminOperationLogger;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/fintech/auth")
|
||||
public class AuthController {
|
||||
private final AuthService authService;
|
||||
private final JwtUtil jwtUtil;
|
||||
private final UserAuditRepository userAuditRepository;
|
||||
private final AdminOperationLogger adminOperationLogger;
|
||||
|
||||
public AuthController(AuthService authService, JwtUtil jwtUtil, UserAuditRepository userAuditRepository, AdminOperationLogger adminOperationLogger) {
|
||||
this.authService = authService;
|
||||
this.jwtUtil = jwtUtil;
|
||||
this.userAuditRepository = userAuditRepository;
|
||||
this.adminOperationLogger = adminOperationLogger;
|
||||
}
|
||||
|
||||
@PostMapping("/register")
|
||||
public ResponseEntity<?> register(@RequestBody Map<String, String> request) {
|
||||
try {
|
||||
String username = request.get("username");
|
||||
String password = request.get("password");
|
||||
String phone = request.get("phone");
|
||||
String realName = request.get("realName");
|
||||
String idCardNumber = request.get("idCardNumber");
|
||||
|
||||
if (username == null || password == null) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "用户名和密码不能为空"));
|
||||
}
|
||||
|
||||
User user = authService.register(username, password, phone, realName, idCardNumber);
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"message", "注册成功",
|
||||
"userId", user.getId(),
|
||||
"username", user.getUsername()
|
||||
));
|
||||
} catch (RuntimeException e) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "/register", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
public ResponseEntity<?> registerForm(@RequestParam Map<String, String> request) {
|
||||
return register(request);
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
public ResponseEntity<?> login(@RequestBody Map<String, String> request) {
|
||||
return loginInternal(request.get("username"), request.get("password"));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
public ResponseEntity<?> loginForm(@RequestParam Map<String, String> request) {
|
||||
return loginInternal(request.get("username"), request.get("password"));
|
||||
}
|
||||
|
||||
private ResponseEntity<?> loginInternal(String username, String password) {
|
||||
if (username == null || password == null) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "用户名和密码不能为空"));
|
||||
}
|
||||
|
||||
Optional<User> userOpt = authService.authenticate(username, password);
|
||||
if (userOpt.isEmpty()) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "用户名或密码错误"));
|
||||
}
|
||||
|
||||
User user = userOpt.get();
|
||||
switch (user.getStatus()) {
|
||||
case ACTIVE -> {
|
||||
String token = jwtUtil.generateToken(username);
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"message", "登录成功",
|
||||
"token", token,
|
||||
"userId", user.getId(),
|
||||
"username", user.getUsername(),
|
||||
"balance", user.getBalance()
|
||||
));
|
||||
}
|
||||
case PENDING_AUDIT -> {
|
||||
return ResponseEntity.status(403).body(Map.of(
|
||||
"error", "账户待审核,审核通过后方可登录"
|
||||
));
|
||||
}
|
||||
case REJECTED -> {
|
||||
String reason = userAuditRepository.findByUserId(user.getId())
|
||||
.map(a -> a.getRejectReason())
|
||||
.orElse("审核已被驳回,请重新提交或联系管理员");
|
||||
return ResponseEntity.status(403).body(Map.of(
|
||||
"error", reason
|
||||
));
|
||||
}
|
||||
case INACTIVE -> {
|
||||
return ResponseEntity.status(403).body(Map.of(
|
||||
"error", "账户已禁用,请联系管理员"
|
||||
));
|
||||
}
|
||||
default -> {
|
||||
return ResponseEntity.status(403).body(Map.of("error", "账户状态异常"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/pay-password/set")
|
||||
public ResponseEntity<?> setPayPassword(@RequestHeader(value = "Authorization", required = false) String auth,
|
||||
@RequestBody Map<String, String> request) {
|
||||
if (auth == null || !auth.startsWith("Bearer ")) {
|
||||
return ResponseEntity.status(401).body(Map.of("error", "unauthorized"));
|
||||
}
|
||||
String token = auth.substring(7);
|
||||
String requester = jwtUtil.extractUsername(token);
|
||||
|
||||
String userIdS = request.get("userId");
|
||||
String newPassword = request.get("newPassword");
|
||||
String oldPassword = request.get("oldPassword");
|
||||
if (userIdS == null || newPassword == null || newPassword.isBlank()) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "invalid_request"));
|
||||
}
|
||||
Long userId = Long.valueOf(userIdS);
|
||||
boolean ok = authService.setPayPassword(userId, newPassword, oldPassword, requester);
|
||||
adminOperationLogger.log("USER_SET_PAY_PASSWORD", "USER", userId, "set pay password", ok, ok ? null : "forbidden");
|
||||
if (ok) {
|
||||
return ResponseEntity.ok(Map.of("success", true, "message", "更新成功"));
|
||||
} else {
|
||||
return ResponseEntity.status(403).body(Map.of("error", "forbidden"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
package com.example.alipay.controller.fintech;
|
||||
|
||||
import com.example.alipay.model.fintech.Bill;
|
||||
import com.example.alipay.service.fintech.BillService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/fintech/bills")
|
||||
public class BillController {
|
||||
private final BillService billService;
|
||||
|
||||
public BillController(BillService billService) {
|
||||
this.billService = billService;
|
||||
}
|
||||
|
||||
@GetMapping("/{userId}")
|
||||
public ResponseEntity<?> getUserBills(@PathVariable Long userId) {
|
||||
List<Bill> bills = billService.getUserBills(userId);
|
||||
return ResponseEntity.ok(bills);
|
||||
}
|
||||
|
||||
@GetMapping("/{userId}/type/{type}")
|
||||
public ResponseEntity<?> getUserBillsByType(@PathVariable Long userId, @PathVariable String type) {
|
||||
List<Bill> bills = billService.getUserBillsByType(userId, type);
|
||||
return ResponseEntity.ok(bills);
|
||||
}
|
||||
|
||||
@GetMapping("/{userId}/overview")
|
||||
public ResponseEntity<?> getBillOverview(@PathVariable Long userId) {
|
||||
BillService.BillOverviewDto overview = billService.getBillOverview(userId);
|
||||
return ResponseEntity.ok(overview);
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createBill(@RequestBody Map<String, Object> request) {
|
||||
try {
|
||||
Long userId = Long.valueOf(request.get("userId").toString());
|
||||
BigDecimal amount = new BigDecimal(request.get("amount").toString());
|
||||
String type = (String) request.get("type");
|
||||
String category = (String) request.get("category");
|
||||
String remark = (String) request.get("remark");
|
||||
|
||||
Bill bill = billService.createBill(userId, amount, type, category, remark);
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"message", "账单创建成功",
|
||||
"billId", bill.getId()
|
||||
));
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", e.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,108 +0,0 @@
|
||||
package com.example.alipay.controller.site;
|
||||
|
||||
import com.example.alipay.model.site.GateEvent;
|
||||
import com.example.alipay.service.site.GateEventService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/site/gates")
|
||||
public class GateEventController {
|
||||
private final GateEventService gateEventService;
|
||||
|
||||
public GateEventController(GateEventService gateEventService) {
|
||||
this.gateEventService = gateEventService;
|
||||
}
|
||||
|
||||
@PostMapping("/{gateCode}/entry")
|
||||
public ResponseEntity<?> processEntry(@PathVariable String gateCode, @RequestBody Map<String, String> request) {
|
||||
String qrCode = request.get("qrCode");
|
||||
if (qrCode == null || qrCode.trim().isEmpty()) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "二维码不能为空"));
|
||||
}
|
||||
|
||||
Long stationId = parseStationId(request.get("stationId"));
|
||||
GateEvent event = gateEventService.processEntry(gateCode, qrCode, stationId);
|
||||
|
||||
if ("SUCCESS".equals(event.getStatus())) {
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"message", "进站成功",
|
||||
"eventId", event.getId(),
|
||||
"transactionId", event.getTransactionId(),
|
||||
"userId", event.getUserId(),
|
||||
"username", event.getUsername()
|
||||
));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of(
|
||||
"error", event.getErrorMessage(),
|
||||
"errorCode", event.getErrorCode(),
|
||||
"eventId", event.getId()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/{gateCode}/exit")
|
||||
public ResponseEntity<?> processExit(@PathVariable String gateCode, @RequestBody Map<String, String> request) {
|
||||
String qrCode = request.get("qrCode");
|
||||
if (qrCode == null || qrCode.trim().isEmpty()) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "二维码不能为空"));
|
||||
}
|
||||
|
||||
Long stationId = parseStationId(request.get("stationId"));
|
||||
GateEvent event = gateEventService.processExit(gateCode, qrCode, stationId);
|
||||
|
||||
if ("SUCCESS".equals(event.getStatus())) {
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"message", "出站成功",
|
||||
"eventId", event.getId(),
|
||||
"transactionId", event.getTransactionId(),
|
||||
"userId", event.getUserId(),
|
||||
"username", event.getUsername(),
|
||||
"fare", event.getFare(),
|
||||
"remark", event.getRemark()
|
||||
));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of(
|
||||
"error", event.getErrorMessage(),
|
||||
"errorCode", event.getErrorCode(),
|
||||
"eventId", event.getId()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/events/gate/{gateId}")
|
||||
public ResponseEntity<?> getGateEvents(@PathVariable Long gateId) {
|
||||
List<GateEvent> events = gateEventService.getGateEvents(gateId);
|
||||
return ResponseEntity.ok(events);
|
||||
}
|
||||
|
||||
@GetMapping("/events/user/{userId}")
|
||||
public ResponseEntity<?> getUserEvents(@PathVariable Long userId) {
|
||||
List<GateEvent> events = gateEventService.getUserEvents(userId);
|
||||
return ResponseEntity.ok(events);
|
||||
}
|
||||
|
||||
@GetMapping("/events/errors")
|
||||
public ResponseEntity<?> getErrorEvents() {
|
||||
List<GateEvent> events = gateEventService.getErrorEvents();
|
||||
return ResponseEntity.ok(events);
|
||||
}
|
||||
|
||||
@GetMapping("/events/{eventId}")
|
||||
public ResponseEntity<?> getEventById(@PathVariable Long eventId) {
|
||||
// 这里需要添加获取单个事件的方法
|
||||
return ResponseEntity.ok(Map.of("message", "获取事件详情功能待实现"));
|
||||
}
|
||||
|
||||
private Long parseStationId(String stationId) {
|
||||
if (stationId == null || stationId.isBlank()) return null;
|
||||
try {
|
||||
return Long.parseLong(stationId.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,172 +0,0 @@
|
||||
package com.example.alipay.controller.site;
|
||||
|
||||
import com.example.alipay.model.site.Station;
|
||||
import com.example.alipay.model.site.Gate;
|
||||
import com.example.alipay.service.site.StationManagementService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/site")
|
||||
public class StationManagementController {
|
||||
private final StationManagementService stationManagementService;
|
||||
|
||||
public StationManagementController(StationManagementService stationManagementService) {
|
||||
this.stationManagementService = stationManagementService;
|
||||
}
|
||||
|
||||
// 站点管理API
|
||||
@GetMapping("/stations")
|
||||
public ResponseEntity<?> getAllStations() {
|
||||
List<Station> stations = stationManagementService.getAllStations();
|
||||
return ResponseEntity.ok(stations);
|
||||
}
|
||||
|
||||
@GetMapping("/stations/active")
|
||||
public ResponseEntity<?> getActiveStations() {
|
||||
List<Station> stations = stationManagementService.getActiveStations();
|
||||
return ResponseEntity.ok(stations);
|
||||
}
|
||||
|
||||
@GetMapping("/stations/{stationId}")
|
||||
public ResponseEntity<?> getStationById(@PathVariable Long stationId) {
|
||||
return stationManagementService.getStationById(stationId)
|
||||
.map(ResponseEntity::ok)
|
||||
.orElse(ResponseEntity.notFound().build());
|
||||
}
|
||||
|
||||
@PostMapping("/stations")
|
||||
public ResponseEntity<?> createStation(@RequestBody Station station) {
|
||||
try {
|
||||
Station createdStation = stationManagementService.createStation(station);
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"message", "站点创建成功",
|
||||
"stationId", createdStation.getId()
|
||||
));
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/stations/{stationId}")
|
||||
public ResponseEntity<?> updateStation(@PathVariable Long stationId, @RequestBody Station stationDetails) {
|
||||
Station updatedStation = stationManagementService.updateStation(stationId, stationDetails);
|
||||
if (updatedStation != null) {
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"message", "站点更新成功",
|
||||
"stationId", updatedStation.getId()
|
||||
));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "站点不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/stations/{stationId}/enable")
|
||||
public ResponseEntity<?> enableStation(@PathVariable Long stationId) {
|
||||
boolean success = stationManagementService.enableStation(stationId);
|
||||
if (success) {
|
||||
return ResponseEntity.ok(Map.of("message", "站点已启用"));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "站点不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/stations/{stationId}/disable")
|
||||
public ResponseEntity<?> disableStation(@PathVariable Long stationId) {
|
||||
boolean success = stationManagementService.disableStation(stationId);
|
||||
if (success) {
|
||||
return ResponseEntity.ok(Map.of("message", "站点已禁用"));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "站点不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
// 闸机管理API
|
||||
@GetMapping("/stations/{stationId}/gates")
|
||||
public ResponseEntity<?> getGatesByStation(@PathVariable Long stationId) {
|
||||
List<Gate> gates = stationManagementService.getGatesByStation(stationId);
|
||||
return ResponseEntity.ok(gates);
|
||||
}
|
||||
|
||||
@GetMapping("/gates/direction/{direction}")
|
||||
public ResponseEntity<?> getGatesByDirection(@PathVariable String direction) {
|
||||
List<Gate> gates = stationManagementService.getGatesByDirection(direction);
|
||||
return ResponseEntity.ok(gates);
|
||||
}
|
||||
|
||||
@PostMapping("/gates")
|
||||
public ResponseEntity<?> createGate(@RequestBody Gate gate) {
|
||||
try {
|
||||
Gate createdGate = stationManagementService.createGate(gate);
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"message", "闸机创建成功",
|
||||
"gateId", createdGate.getId()
|
||||
));
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/gates/{gateId}")
|
||||
public ResponseEntity<?> updateGate(@PathVariable Long gateId, @RequestBody Gate gateDetails) {
|
||||
Gate updatedGate = stationManagementService.updateGate(gateId, gateDetails);
|
||||
if (updatedGate != null) {
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"message", "闸机更新成功",
|
||||
"gateId", updatedGate.getId()
|
||||
));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "闸机不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/gates/{gateId}/enable")
|
||||
public ResponseEntity<?> enableGate(@PathVariable Long gateId) {
|
||||
boolean success = stationManagementService.enableGate(gateId);
|
||||
if (success) {
|
||||
return ResponseEntity.ok(Map.of("message", "闸机已启用"));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "闸机不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/gates/{gateId}/disable")
|
||||
public ResponseEntity<?> disableGate(@PathVariable Long gateId) {
|
||||
boolean success = stationManagementService.disableGate(gateId);
|
||||
if (success) {
|
||||
return ResponseEntity.ok(Map.of("message", "闸机已禁用"));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "闸机不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/gates/{gateId}")
|
||||
public ResponseEntity<?> deleteGate(@PathVariable Long gateId) {
|
||||
try {
|
||||
boolean success = stationManagementService.deleteGate(gateId);
|
||||
if (success) {
|
||||
return ResponseEntity.ok(Map.of("message", "闸机已删除", "gateId", gateId));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "闸机不存在"));
|
||||
}
|
||||
} catch (IllegalStateException e) {
|
||||
return ResponseEntity.status(409).body(Map.of("error", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
// 查询API
|
||||
@GetMapping("/stations/city/{city}")
|
||||
public ResponseEntity<?> getStationsByCity(@PathVariable String city) {
|
||||
List<Station> stations = stationManagementService.getStationsByCity(city);
|
||||
return ResponseEntity.ok(stations);
|
||||
}
|
||||
|
||||
@GetMapping("/stations/line/{line}")
|
||||
public ResponseEntity<?> getStationsByLine(@PathVariable String line) {
|
||||
List<Station> stations = stationManagementService.getStationsByLine(line);
|
||||
return ResponseEntity.ok(stations);
|
||||
}
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
package com.example.alipay.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "assistant_messages")
|
||||
public class AssistantMessage {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
private String username; // 对应 UserAccount.username 和 Payment.fromUser
|
||||
|
||||
@Column(length = 1000)
|
||||
private String userContent; // 用户发送的内容
|
||||
|
||||
@Column(length = 1000)
|
||||
private String botReply; // 助手回复的内容
|
||||
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
public AssistantMessage() {
|
||||
this.createdAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
// Getters and Setters
|
||||
public Long getId() { return id; }
|
||||
public void setId(Long id) { this.id = id; }
|
||||
public String getUsername() { return username; }
|
||||
public void setUsername(String username) { this.username = username; }
|
||||
public String getUserContent() { return userContent; }
|
||||
public void setUserContent(String userContent) { this.userContent = userContent; }
|
||||
public String getBotReply() { return botReply; }
|
||||
public void setBotReply(String botReply) { this.botReply = botReply; }
|
||||
public LocalDateTime getCreatedAt() { return createdAt; }
|
||||
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
package com.example.alipay.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
public class CollectionQRCode {
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String merchantId;
|
||||
private String content;
|
||||
private LocalDateTime expireAt;
|
||||
private boolean active = true;
|
||||
|
||||
public Long getId(){return id;}
|
||||
public void setId(Long id){this.id = id;}
|
||||
public String getMerchantId(){return merchantId;}
|
||||
public void setMerchantId(String m){this.merchantId = m;}
|
||||
public String getContent(){return content;}
|
||||
public void setContent(String c){this.content = c;}
|
||||
public LocalDateTime getExpireAt(){return expireAt;}
|
||||
public void setExpireAt(LocalDateTime t){this.expireAt = t;}
|
||||
public boolean isActive(){return active;}
|
||||
public void setActive(boolean a){this.active = a;}
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
package com.example.alipay.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
public class Payment {
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String fromUser;
|
||||
private String toMerchant;
|
||||
private BigDecimal amount;
|
||||
private String paymentMethod;
|
||||
private String status;
|
||||
private LocalDateTime createdAt;
|
||||
private String errorCode;
|
||||
private String errorMessage;
|
||||
|
||||
public Long getId(){return id;}
|
||||
public void setId(Long id){this.id = id;}
|
||||
public String getFromUser(){return fromUser;}
|
||||
public void setFromUser(String u){this.fromUser = u;}
|
||||
public String getToMerchant(){return toMerchant;}
|
||||
public void setToMerchant(String m){this.toMerchant = m;}
|
||||
public BigDecimal getAmount(){return amount;}
|
||||
public void setAmount(BigDecimal a){this.amount = a;}
|
||||
public String getPaymentMethod(){return paymentMethod;}
|
||||
public void setPaymentMethod(String pm){this.paymentMethod = pm;}
|
||||
public String getStatus(){return status;}
|
||||
public void setStatus(String s){this.status = s;}
|
||||
public LocalDateTime getCreatedAt(){return createdAt;}
|
||||
public void setCreatedAt(LocalDateTime t){this.createdAt = t;}
|
||||
public String getErrorCode(){return errorCode;}
|
||||
public void setErrorCode(String c){this.errorCode = c;}
|
||||
public String getErrorMessage(){return errorMessage;}
|
||||
public void setErrorMessage(String m){this.errorMessage = m;}
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
package com.example.alipay.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
public class TravelPass {
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String username;
|
||||
private String city;
|
||||
private String line;
|
||||
private String boundPaymentMethod;
|
||||
private boolean enabled = true;
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
// getters/setters
|
||||
public Long getId(){return id;}
|
||||
public void setId(Long id){this.id = id;}
|
||||
public String getUsername(){return username;}
|
||||
public void setUsername(String u){this.username = u;}
|
||||
public String getCity(){return city;}
|
||||
public void setCity(String c){this.city = c;}
|
||||
public String getLine(){return line;}
|
||||
public void setLine(String l){this.line = l;}
|
||||
public String getBoundPaymentMethod(){return boundPaymentMethod;}
|
||||
public void setBoundPaymentMethod(String b){this.boundPaymentMethod = b;}
|
||||
public boolean isEnabled(){return enabled;}
|
||||
public void setEnabled(boolean e){this.enabled = e;}
|
||||
public java.time.LocalDateTime getUpdatedAt(){return updatedAt;}
|
||||
public void setUpdatedAt(java.time.LocalDateTime t){this.updatedAt = t;}
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
package com.example.alipay.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Entity
|
||||
public class TravelRecord {
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String username;
|
||||
private String city;
|
||||
private String line;
|
||||
private LocalDateTime entryTime;
|
||||
private LocalDateTime exitTime;
|
||||
private BigDecimal fare;
|
||||
private String status; // COMPLETED, IN_PROGRESS, EXCEPTION
|
||||
|
||||
// getters/setters
|
||||
public Long getId(){return id;}
|
||||
public void setId(Long id){this.id = id;}
|
||||
public String getUsername(){return username;}
|
||||
public void setUsername(String u){this.username = u;}
|
||||
public String getCity(){return city;}
|
||||
public void setCity(String c){this.city = c;}
|
||||
public String getLine(){return line;}
|
||||
public void setLine(String l){this.line = l;}
|
||||
public LocalDateTime getEntryTime(){return entryTime;}
|
||||
public void setEntryTime(LocalDateTime t){this.entryTime = t;}
|
||||
public LocalDateTime getExitTime(){return exitTime;}
|
||||
public void setExitTime(LocalDateTime t){this.exitTime = t;}
|
||||
public BigDecimal getFare(){return fare;}
|
||||
public void setFare(BigDecimal f){this.fare = f;}
|
||||
public String getStatus(){return status;}
|
||||
public void setStatus(String s){this.status = s;}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
package com.example.alipay.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Entity
|
||||
public class UserAccount {
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String username;
|
||||
private String displayName;
|
||||
private String defaultPaymentMethod; // simple string like "balance" or card id
|
||||
private BigDecimal balance = new BigDecimal("1000.00"); // default balance for demo
|
||||
|
||||
// getters/setters
|
||||
public Long getId(){return id;}
|
||||
public void setId(Long id){this.id = id;}
|
||||
public String getUsername(){return username;}
|
||||
public void setUsername(String username){this.username = username;}
|
||||
public String getDisplayName(){return displayName;}
|
||||
public void setDisplayName(String displayName){this.displayName = displayName;}
|
||||
public String getDefaultPaymentMethod(){return defaultPaymentMethod;}
|
||||
public void setDefaultPaymentMethod(String m){this.defaultPaymentMethod = m;}
|
||||
public BigDecimal getBalance(){return balance;}
|
||||
public void setBalance(BigDecimal b){this.balance = b;}
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
package com.example.alipay.model.admin;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "admin_operation_logs")
|
||||
@Data
|
||||
public class AdminOperationLog {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
private Long adminId; // 操作管理员ID
|
||||
private String adminUsername; // 操作管理员用户名
|
||||
|
||||
private String operationType; // 操作类型
|
||||
private String targetType; // 目标类型 (USER, POLICY, STATION, etc.)
|
||||
private Long targetId; // 目标ID
|
||||
|
||||
private String operationDetails; // 操作详情
|
||||
private String ipAddress; // 操作IP
|
||||
|
||||
private LocalDateTime operationTime;
|
||||
|
||||
private boolean success = true; // 操作是否成功
|
||||
private String errorMessage; // 错误信息
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
package com.example.alipay.model.admin;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "admin_users")
|
||||
@Data
|
||||
public class AdminUser implements UserDetails {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(unique = true, nullable = false)
|
||||
private String username;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String password;
|
||||
|
||||
private String role; // SUPER_ADMIN, SITE_MANAGER
|
||||
|
||||
private boolean enabled = true;
|
||||
|
||||
// Security UserDetails 实现方法
|
||||
@Override
|
||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||
return List.of(() -> "ROLE_" + role);
|
||||
}
|
||||
@Override public boolean isAccountNonExpired() { return true; }
|
||||
@Override public boolean isAccountNonLocked() { return true; }
|
||||
@Override public boolean isCredentialsNonExpired() { return true; }
|
||||
@Override public boolean isEnabled() { return enabled; }
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
package com.example.alipay.model.admin;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CreateAdminRequest {
|
||||
private String username;
|
||||
private String password;
|
||||
private String role;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue