feat 分账接收方开发

This commit is contained in:
xxm1995
2024-04-02 23:41:02 +08:00
parent 4a00dcb4f6
commit e9c50e41c4
21 changed files with 408 additions and 62 deletions

View File

@@ -1,6 +1,10 @@
# Dromara Dax-Pay(开源支付系统)
<p>
<p align="center">
<img src="_doc/images/dax-pay.svg" width="45%">
</p>
<p align="center">
<img src="https://img.shields.io/github/stars/dromara/dax-pay?style=flat&label=Github">
<img src='https://gitee.com/bootx/dax-pay/badge/star.svg?theme=dark' alt='star'/>
<img src="https://img.shields.io/badge/Dax%20Pay-2.0.4-success.svg" alt="Build Status"/>
<img src="https://img.shields.io/badge/Boot%20Platform-1.3.6-success.svg" alt="Build Status"/>
@@ -9,6 +13,7 @@
<img src="https://img.shields.io/badge/license-Apache%20License%202.0-green.svg"/>
</p>
# Dromara Dax-Pay(开源支付系统)
## ❗使用须知
`DaxPay`是一款基于`Apache License 2.0`协议分发的开源软件,受中华人民共和国相关法律法规的保护和限制,可以在符合[《用户授权使用协议》](用户授权使用协议.txt)和
@@ -24,6 +29,7 @@
- 封装各类支付通道的接口为统一的接口,方便业务系统进行调用,简化对接多种支付方式的复杂度
- 已对接`微信支付``支付宝`和云闪付相关的接口,后续版本将支持`V3`版本的接口
- 支持组合支付,满足用户系统需要多种方式同时进行支付的场景。
- 支持支付、退款、对账、分账等支付相关的能力
- 提供`HTTP`方式接口调用能力,和`Java`版本的`SDK`,方便业务系统进行对接
- 接口请求和响应数据支持启用签名机制,可根据实际需要进行开关,保证交易安全可靠
- 提供管理平台方便运营人员进行管理和操作不需要懂IT技术也可以轻松使用
@@ -204,12 +210,9 @@ Apache License Version 2.0
display: flex;
flex-wrap: wrap;
}
.member-project a {
padding: 10px;
}
.member-project a img {
height: 40px;
}

View File

@@ -1,12 +1,12 @@
2.0.5:
- [ ] 资金流水优化
- [ ] 支付通道配置是否支持分账
- [x] 支付通道配置是否支持分账
- [ ] 分账接收方管理
- [ ] 分账组管理
- [ ] 分账订单管理
- [ ] 统计报表功能
- [x] 修复创建支付订单报错时, 订单保存数据不完整
- [ ] DEMI增加获取微信OpenID和支付宝OpenId功能
- [ ] DEMO增加获取微信OpenID和支付宝OpenId功能
2.0.x 版本内容
- [ ] 三方支付外部订单号规则优化: 支付P、退款R、分账A根据环境加前缀DEV_、DEMO_、PRE_
@@ -20,6 +20,7 @@
- [ ] 同步接口
- [ ] 对账接口
- [ ] 增加通道开通能力管理,在操作发起前的校验时提前进行拦截
- [ ] 支付通道两个独立的配置进行合并为一个
**任务池**
- [ ] 对账改造:

31
_doc/images/dax-pay.svg Normal file
View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="722pt" height="650pt" viewBox="0 0 722 650" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g id="#ffffffff">
</g>
<g id="#ebb54bff">
<path fill="#ebb54b" opacity="1.00" d=" M 385.30 34.17 C 413.94 21.41 445.58 14.10 477.02 17.02 C 499.54 19.35 521.55 27.58 539.55 41.39 C 555.51 53.33 567.69 69.71 576.82 87.30 C 594.68 122.41 599.79 162.74 598.13 201.72 C 590.63 202.08 583.14 201.81 575.64 201.74 C 575.13 193.17 575.47 184.56 574.94 175.99 C 574.20 154.84 570.48 133.71 563.24 113.80 C 557.09 97.09 547.99 81.26 535.40 68.56 C 519.07 52.38 497.00 41.86 474.00 40.17 C 446.36 37.24 418.76 44.65 393.63 55.69 C 375.09 63.78 358.09 74.88 341.52 86.39 C 300.72 115.44 266.63 153.06 238.13 194.04 C 236.03 196.80 234.01 200.13 230.55 201.30 C 222.44 203.25 214.10 201.76 205.90 201.59 C 219.15 179.22 234.92 158.41 251.67 138.55 C 265.12 122.79 279.42 107.72 294.97 94.01 C 321.65 69.44 351.99 48.67 385.30 34.17 Z" />
<path fill="#ebb54b" opacity="1.00" d=" M 128.90 449.65 C 136.23 448.24 143.70 448.70 151.08 449.37 C 152.16 472.12 154.88 495.05 162.48 516.64 C 168.98 534.99 178.92 552.42 193.07 565.95 C 206.02 578.32 222.51 586.93 240.05 590.53 C 253.81 593.58 268.08 593.52 282.02 591.79 C 300.13 589.43 317.57 583.51 334.32 576.38 C 352.35 568.75 368.78 557.93 384.78 546.78 C 420.35 521.19 451.03 489.25 477.20 454.21 C 479.59 450.55 483.82 448.95 488.07 448.93 C 494.80 448.31 501.52 449.43 508.26 449.49 C 500.67 462.72 491.08 474.66 481.47 486.46 C 458.03 515.22 431.43 541.57 401.53 563.60 C 370.21 586.42 335.18 605.23 296.96 613.13 C 280.92 616.44 264.43 616.11 248.15 615.32 C 228.33 613.61 208.94 606.67 192.55 595.38 C 168.95 579.23 151.69 554.89 141.90 528.20 C 134.40 508.26 130.45 487.14 128.66 465.97 C 128.17 460.53 128.36 455.07 128.90 449.65 Z" />
</g>
<g id="#403f3bff">
<path fill="#403f3b" opacity="1.00" d=" M 108.06 218.59 C 115.31 217.28 122.69 217.66 130.02 217.68 C 142.31 217.88 155.07 216.95 166.83 221.24 C 173.98 223.72 179.61 229.72 181.98 236.87 C 185.78 247.96 184.17 259.93 181.96 271.18 C 179.12 284.97 173.16 298.85 161.88 307.80 C 150.93 316.35 136.51 318.53 122.97 318.26 C 112.12 318.52 101.27 318.20 90.42 318.24 C 94.10 292.74 99.20 267.48 103.46 242.07 C 104.85 234.22 105.80 226.26 108.06 218.59 M 124.59 246.40 C 121.56 264.05 118.61 281.72 115.49 299.35 C 125.69 299.53 136.95 300.67 145.99 294.95 C 154.47 289.13 157.75 278.67 159.66 269.05 C 160.92 262.78 161.25 256.30 160.48 249.95 C 159.85 244.97 156.66 240.20 151.86 238.42 C 144.02 235.64 135.56 235.99 127.39 236.44 C 126.10 239.65 125.17 242.99 124.59 246.40 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 387.30 218.48 C 399.83 216.76 412.50 218.04 425.10 217.85 C 434.11 218.39 444.39 219.05 451.02 225.99 C 456.81 232.15 456.19 241.30 455.31 249.07 C 453.74 258.73 451.17 268.89 444.29 276.23 C 437.76 283.07 428.21 285.85 419.05 286.77 C 411.65 287.53 404.20 287.53 396.77 287.78 C 394.88 297.92 393.14 308.08 391.35 318.23 C 383.97 318.26 376.59 318.26 369.21 318.25 C 373.72 291.10 378.82 264.04 383.35 236.89 C 384.40 230.70 385.20 224.43 387.30 218.48 M 406.52 235.47 C 402.76 246.55 401.87 258.28 399.89 269.75 C 407.67 269.64 415.88 270.61 423.20 267.39 C 430.01 264.12 432.38 255.99 432.74 249.00 C 433.07 244.84 432.44 239.78 428.42 237.53 C 421.58 234.42 413.82 234.52 406.52 235.47 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 221.33 240.43 C 223.86 238.88 227.07 239.29 229.92 238.88 C 240.32 238.62 251.20 238.08 261.01 242.11 C 265.88 244.08 270.05 248.45 270.60 253.83 C 271.59 262.27 269.43 270.61 268.04 278.87 C 265.73 292.02 263.24 305.14 261.01 318.30 C 254.75 318.25 248.49 318.23 242.23 318.27 C 241.91 315.77 241.68 313.27 241.43 310.77 C 235.16 314.59 228.69 318.81 221.17 319.46 C 213.71 320.15 205.60 320.10 198.98 316.10 C 194.99 313.85 192.44 309.52 191.97 305.01 C 190.87 295.43 193.87 284.87 201.48 278.56 C 208.12 273.30 216.85 271.85 225.08 271.35 C 232.89 271.19 240.71 271.35 248.53 271.29 C 248.13 267.14 249.58 262.02 246.37 258.71 C 237.20 254.59 226.82 256.98 217.19 257.74 C 218.26 251.93 218.50 245.72 221.33 240.43 M 217.68 287.78 C 213.08 290.54 210.47 298.95 215.74 302.27 C 223.62 305.40 233.02 303.58 239.91 298.87 C 244.21 295.92 244.82 290.35 245.98 285.69 C 236.57 285.41 226.62 284.04 217.68 287.78 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 488.19 240.51 C 496.26 238.16 504.75 238.76 513.05 238.90 C 521.26 239.50 530.77 240.87 535.99 248.01 C 540.11 254.65 538.35 262.84 537.26 270.08 C 534.29 286.12 531.46 302.18 528.64 318.25 C 522.36 318.27 516.08 318.25 509.80 318.24 C 509.62 315.73 509.39 313.23 509.17 310.73 C 498.28 318.70 483.77 322.17 470.68 318.23 C 465.11 316.63 460.44 311.84 459.65 306.01 C 457.69 294.21 462.94 280.45 474.24 275.28 C 487.47 269.42 502.24 271.78 516.24 271.29 C 515.85 266.96 517.38 260.77 512.87 258.16 C 503.88 254.87 494.19 257.06 484.93 257.61 C 485.58 251.84 486.55 246.09 488.19 240.51 M 485.56 287.53 C 481.67 289.79 479.93 294.76 480.76 299.07 C 481.71 302.62 485.74 303.52 488.92 303.72 C 495.43 304.03 502.24 302.42 507.59 298.60 C 511.76 295.67 512.34 290.20 513.69 285.69 C 504.35 285.44 494.47 284.04 485.56 287.53 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 289.31 240.42 C 297.01 239.76 304.80 239.35 312.49 240.43 C 318.03 247.95 320.25 257.17 324.18 265.51 C 329.90 259.38 334.73 252.52 339.84 245.90 C 341.91 243.26 344.40 240.33 348.02 240.12 C 354.71 239.41 361.48 239.82 368.18 240.46 C 358.49 253.53 347.33 265.41 337.17 278.11 C 343.45 291.55 350.46 304.65 356.46 318.22 C 348.23 318.29 340.00 318.24 331.78 318.26 C 327.89 309.28 324.15 300.23 319.70 291.51 C 313.90 298.14 308.63 305.20 303.23 312.15 C 301.08 314.73 298.76 317.91 295.10 318.17 C 287.99 318.78 280.85 318.38 273.73 318.17 C 284.32 304.63 295.87 291.87 307.13 278.89 C 301.89 265.74 294.67 253.51 289.31 240.42 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 555.10 239.97 C 562.50 239.66 569.91 239.86 577.31 239.81 C 580.70 258.43 582.80 277.27 586.44 295.85 C 596.42 277.48 604.56 258.18 614.53 239.83 C 621.73 239.70 628.92 240.13 636.11 240.36 C 626.09 260.89 614.42 280.55 603.75 300.74 C 599.13 309.07 594.71 317.54 589.37 325.45 C 584.36 332.63 578.29 339.58 570.11 343.17 C 562.32 346.69 553.62 347.06 545.22 347.52 C 546.24 341.64 547.27 335.76 548.39 329.90 C 554.01 328.75 560.00 328.09 564.92 324.90 C 567.45 323.05 569.92 320.39 569.93 317.07 C 569.99 312.59 568.92 308.21 567.96 303.88 C 564.56 288.93 561.33 273.94 557.98 258.98 C 556.62 252.71 554.94 246.43 555.10 239.97 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 248.35 376.30 C 249.96 375.38 251.73 374.82 253.45 374.13 C 253.31 377.65 253.25 381.19 253.21 384.72 C 261.23 384.77 269.26 384.82 277.28 384.58 C 277.25 386.21 277.28 387.85 277.12 389.48 C 276.01 390.54 274.38 389.91 273.04 390.00 C 266.44 389.60 259.82 389.76 253.22 389.68 C 253.03 392.67 252.84 395.66 252.76 398.66 C 258.19 398.74 263.63 398.76 269.06 398.98 C 265.47 406.97 260.08 414.00 254.28 420.51 C 261.60 423.42 269.38 424.88 277.21 425.50 C 275.87 427.57 274.52 429.63 273.17 431.69 C 267.30 430.33 261.47 428.72 255.89 426.43 C 253.06 425.45 250.06 423.78 246.99 424.75 C 240.32 426.82 234.11 430.73 226.99 431.13 C 224.52 430.53 222.73 428.57 220.80 427.05 C 228.94 425.10 237.11 423.17 244.96 420.23 C 239.56 413.09 234.18 405.93 228.18 399.28 C 234.59 399.06 240.99 398.62 247.42 398.55 C 247.40 395.60 247.37 392.65 247.34 389.70 C 239.49 389.72 231.64 389.76 223.79 389.84 C 223.79 388.12 223.79 386.41 223.80 384.71 C 231.22 384.73 238.65 384.80 246.08 384.68 C 246.73 381.86 247.14 378.94 248.35 376.30 M 239.15 403.78 C 242.50 408.46 245.96 413.08 249.85 417.34 C 253.89 412.99 257.76 408.49 261.33 403.75 C 253.94 403.66 246.54 403.64 239.15 403.78 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 177.10 375.75 C 179.03 375.93 180.96 376.12 182.89 376.30 C 182.79 382.28 182.86 388.26 182.81 394.24 C 187.97 394.20 193.14 394.20 198.30 394.21 C 198.30 395.94 198.31 397.68 198.31 399.41 C 193.10 399.53 187.89 399.58 182.68 399.59 C 182.67 407.90 182.65 416.21 182.63 424.52 C 188.82 424.79 195.02 424.67 201.22 424.79 C 201.21 426.40 201.20 428.02 201.20 429.65 C 187.72 429.69 174.25 429.68 160.78 429.60 C 161.00 428.02 161.23 426.43 161.45 424.85 C 166.58 424.79 171.71 424.69 176.85 424.68 C 176.78 414.78 177.37 404.89 177.11 394.99 C 177.28 388.57 176.71 382.16 177.10 375.75 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 305.01 391.99 C 308.00 386.68 309.84 380.82 312.88 375.54 C 314.96 375.62 317.05 375.71 319.14 375.80 C 316.64 381.66 313.41 387.49 313.27 394.02 C 313.11 406.88 313.19 419.74 313.71 432.59 C 311.72 432.61 309.74 432.63 307.76 432.65 C 307.74 421.41 307.75 410.17 307.49 398.94 C 305.73 401.58 303.99 404.25 302.25 406.90 C 300.69 405.84 299.13 404.79 297.58 403.74 C 300.09 399.85 302.77 396.06 305.01 391.99 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 340.40 376.26 C 342.33 376.27 344.27 376.29 346.20 376.32 C 346.24 380.37 346.45 384.41 346.59 388.46 C 350.01 389.24 353.41 390.17 356.64 391.57 C 353.33 392.98 350.01 394.37 346.71 395.78 C 345.87 405.52 346.43 415.29 346.16 425.05 C 345.98 426.84 345.90 429.33 343.82 429.99 C 340.19 431.48 336.21 431.62 332.36 432.06 C 332.31 430.23 332.26 428.41 332.22 426.60 C 334.89 425.87 337.56 425.15 340.23 424.45 C 340.56 414.54 340.47 404.63 340.20 394.72 C 332.51 394.73 324.82 394.78 317.13 394.83 C 317.13 392.99 317.14 391.14 317.16 389.30 C 324.86 389.51 332.56 389.53 340.25 389.37 C 340.29 385.00 340.33 380.63 340.40 376.26 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 480.89 376.70 C 485.01 376.98 487.93 381.00 492.08 381.60 C 497.34 382.05 502.65 381.74 507.92 381.37 C 507.78 385.11 507.66 388.86 507.60 392.61 C 505.87 392.56 504.14 392.51 502.42 392.46 C 501.99 390.37 501.56 388.30 501.15 386.22 C 488.49 386.19 475.82 386.11 463.16 386.26 C 462.74 388.31 462.42 390.39 461.75 392.38 C 459.98 392.61 458.20 392.63 456.43 392.71 C 456.45 388.92 456.51 385.13 456.60 381.34 C 463.74 381.85 470.94 382.10 478.06 381.21 C 478.95 379.67 479.76 378.08 480.89 376.70 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 540.71 377.31 C 553.32 376.11 565.96 377.59 578.58 376.71 C 578.56 384.34 578.58 391.97 578.64 399.61 C 570.62 399.69 562.59 399.73 554.57 399.81 C 553.49 401.26 552.43 402.72 551.39 404.20 C 562.14 404.57 572.89 404.52 583.64 404.23 C 582.70 411.70 582.91 419.46 580.41 426.63 C 577.60 430.49 572.28 430.66 568.07 431.86 C 567.50 430.04 566.93 428.23 566.35 426.43 C 569.41 425.61 572.49 424.87 575.58 424.16 C 576.47 419.00 577.00 413.80 577.65 408.61 C 575.52 408.80 573.41 409.03 571.31 409.28 C 568.43 413.93 565.48 418.64 561.47 422.42 C 556.47 427.22 550.06 430.21 543.60 432.50 C 540.77 433.77 539.12 430.11 537.15 428.67 C 543.80 426.54 550.72 424.59 556.43 420.39 C 560.68 417.23 563.53 412.65 565.98 408.04 C 561.65 409.26 557.50 411.15 554.07 414.11 C 548.85 418.45 543.09 422.10 537.11 425.31 C 535.77 423.92 534.43 422.52 533.12 421.12 C 540.46 418.04 547.85 414.46 553.36 408.55 C 546.44 409.03 540.03 411.87 533.94 414.99 C 532.89 413.70 531.86 412.42 530.83 411.12 C 536.66 408.64 542.17 405.45 547.26 401.68 C 544.91 400.97 542.55 400.30 540.20 399.62 C 540.12 392.18 539.34 384.70 540.71 377.31 M 543.68 385.24 C 553.25 386.85 562.97 386.19 572.62 386.18 C 572.57 384.69 572.52 383.21 572.47 381.73 C 564.96 381.77 557.44 381.34 549.94 381.78 C 547.40 381.84 545.63 383.89 543.68 385.24 M 545.08 390.76 C 545.16 392.24 545.25 393.73 545.35 395.22 C 554.37 395.19 563.38 395.22 572.40 395.21 C 572.48 393.72 572.56 392.22 572.64 390.74 C 563.45 390.70 554.27 390.68 545.08 390.76 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 149.30 379.15 C 151.18 378.62 153.06 378.09 154.94 377.56 C 157.30 380.72 159.60 383.93 161.84 387.19 C 159.87 388.41 157.91 389.63 155.96 390.85 C 153.65 387.00 151.36 383.14 149.30 379.15 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 375.76 382.15 C 377.37 380.18 379.06 377.59 381.96 377.77 C 398.36 377.55 414.77 377.95 431.18 377.55 C 431.17 379.27 431.17 380.99 431.17 382.71 C 422.99 382.72 414.82 382.30 406.64 382.57 C 406.63 384.28 406.63 386.00 406.64 387.73 C 412.82 387.75 419.01 387.79 425.19 387.85 C 425.18 395.28 425.15 402.72 425.19 410.15 C 419.07 410.28 412.96 410.62 406.84 410.69 C 405.73 414.40 404.61 418.12 403.86 421.93 C 413.11 424.15 422.61 425.23 432.12 425.30 C 431.37 427.18 430.63 429.06 429.92 430.96 C 422.87 430.82 415.91 429.49 409.08 427.82 C 406.11 427.16 403.07 426.25 400.00 426.71 C 393.84 427.84 388.26 431.31 381.94 431.67 C 379.18 431.24 377.07 429.16 374.81 427.68 C 381.58 426.12 388.44 424.95 395.16 423.14 C 392.36 419.94 389.59 416.72 386.69 413.62 C 388.19 413.09 389.69 412.58 391.20 412.07 C 394.00 414.23 396.75 416.46 399.49 418.70 C 400.22 416.03 400.90 413.35 401.59 410.67 C 395.59 410.63 389.59 410.61 383.60 410.55 C 383.55 402.95 383.55 395.36 383.63 387.76 C 389.66 387.75 395.68 387.78 401.71 387.78 C 401.71 385.99 401.71 384.21 401.71 382.43 C 393.06 382.47 384.39 382.95 375.76 382.15 M 387.05 396.51 C 391.91 396.78 396.76 397.20 401.63 397.25 C 401.66 395.40 401.70 393.56 401.73 391.73 C 396.53 391.69 389.64 390.74 387.05 396.51 M 409.28 392.50 C 407.34 393.21 406.15 395.01 404.79 396.45 C 409.56 396.84 414.34 397.29 419.14 397.23 C 419.18 395.38 419.22 393.53 419.27 391.69 C 415.93 391.78 412.50 391.45 409.28 392.50 M 389.68 401.37 C 388.97 403.00 388.26 404.63 387.55 406.27 C 392.23 406.49 396.92 406.61 401.61 406.68 C 401.64 404.68 401.68 402.68 401.71 400.69 C 397.69 400.62 393.66 400.75 389.68 401.37 M 407.66 401.45 C 406.91 403.04 406.15 404.63 405.41 406.23 C 409.98 406.47 414.56 406.64 419.15 406.65 C 419.16 404.63 419.18 402.62 419.20 400.61 C 415.34 400.63 411.47 400.81 407.66 401.45 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 473.47 389.34 C 475.27 389.39 476.93 390.24 478.63 390.76 C 473.81 395.00 468.53 398.68 463.06 402.01 C 461.73 400.58 460.40 399.15 459.08 397.73 C 463.78 394.78 468.34 391.50 473.47 389.34 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 485.80 391.16 C 487.57 390.61 489.34 390.08 491.13 389.55 C 496.05 391.55 500.64 394.28 504.92 397.43 C 503.64 398.94 502.37 400.45 501.10 401.96 C 495.90 398.49 490.40 395.41 485.80 391.16 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 471.25 402.28 C 474.63 399.70 477.30 396.23 480.97 394.03 C 485.88 396.92 489.24 401.92 494.44 404.43 C 499.33 406.70 504.69 407.61 509.89 408.93 C 509.21 410.41 508.52 411.89 507.84 413.37 C 504.95 413.23 502.07 413.04 499.20 412.72 C 499.08 418.94 498.71 425.16 498.78 431.39 C 494.69 429.59 490.62 427.44 486.10 426.97 C 479.05 426.11 472.10 428.16 465.39 430.04 C 465.42 424.17 465.46 418.31 465.45 412.44 C 462.39 413.28 459.32 414.13 456.23 414.83 C 455.07 413.45 453.92 412.10 452.76 410.74 C 459.16 408.54 465.94 406.69 471.25 402.28 M 468.60 410.31 C 476.97 410.99 485.39 410.85 493.78 410.55 C 489.92 407.13 485.88 403.94 481.82 400.77 C 477.28 403.77 472.83 406.90 468.60 410.31 M 471.38 415.39 C 470.92 418.12 470.53 420.87 470.16 423.62 C 477.93 423.72 485.71 423.74 493.49 423.63 C 493.48 420.70 493.48 417.76 493.44 414.84 C 486.08 414.77 478.69 414.33 471.38 415.39 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 143.15 394.62 C 148.03 394.67 152.91 394.73 157.79 394.70 C 158.26 403.04 158.37 411.40 157.83 419.73 C 160.47 417.54 163.05 415.28 165.68 413.08 C 166.17 415.21 168.10 418.08 165.70 419.73 C 161.78 423.21 158.33 427.39 153.75 430.02 C 151.45 420.25 152.61 410.16 152.62 400.23 C 149.49 400.21 146.37 400.16 143.25 400.04 C 143.19 398.23 143.15 396.42 143.15 394.62 Z" />
<path fill="#403f3b" opacity="1.00" d=" M 321.70 402.50 C 323.56 401.73 325.43 400.95 327.30 400.19 C 329.69 404.41 332.07 408.65 334.39 412.92 C 332.80 413.95 331.22 414.99 329.62 416.00 C 326.94 411.52 324.16 407.10 321.70 402.50 Z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,101 @@
package cn.bootx.platform.daxpay.admin.controller.allocation;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.Res;
import cn.bootx.platform.common.core.rest.ResResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.core.util.ValidationUtil;
import cn.bootx.platform.daxpay.service.core.payment.allocation.service.AllocationGroupService;
import cn.bootx.platform.daxpay.service.dto.allocation.AllocationGroupDto;
import cn.bootx.platform.daxpay.service.dto.allocation.AllocationGroupReceiverResult;
import cn.bootx.platform.daxpay.service.param.allocation.AllocationGroupBindParam;
import cn.bootx.platform.daxpay.service.param.allocation.AllocationGroupParam;
import cn.bootx.platform.daxpay.service.param.allocation.AllocationGroupUnbindParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 分账组
* @author xxm
* @since 2024/4/2
*/
@Tag(name = "分账组")
@RestController
@RequestMapping("/allocation/group")
@RequiredArgsConstructor
public class AllocationGroupController {
private final AllocationGroupService allocationGroupService;
@Operation(summary = "分页")
@GetMapping("/page")
public ResResult<PageResult<AllocationGroupDto>> page(PageParam pageParam, AllocationGroupParam query){
return Res.ok(allocationGroupService.page(pageParam,query));
}
@Operation(summary = "查询详情")
@GetMapping("/findById")
public ResResult<AllocationGroupDto> findById(Long id){
return Res.ok(allocationGroupService.findById(id));
}
@Operation(summary = "查询分账接收方信息")
@GetMapping("/findReceiversByGroups")
public ResResult<List<AllocationGroupReceiverResult>> findReceiversByGroups(Long groupId){
return Res.ok(allocationGroupService.findReceiversByGroups(groupId));
}
@Operation(summary = "创建")
@PostMapping("/create")
public ResResult<Void> create(@RequestBody AllocationGroupParam param){
allocationGroupService.create(param);
return Res.ok();
}
@Operation(summary = "修改")
@PostMapping("/update")
public ResResult<Void> update(@RequestBody AllocationGroupParam param){
allocationGroupService.update(param);
return Res.ok();
}
@Operation(summary = "删除")
@PostMapping("/delete")
public ResResult<Void> delete(Long id){
allocationGroupService.delete(id);
return Res.ok();
}
@Operation(summary = "批量绑定接收者")
@PostMapping("/bindReceivers")
public ResResult<Void> bindReceivers(@RequestBody AllocationGroupBindParam param){
ValidationUtil.validateParam(param);
allocationGroupService.bindReceivers(param);
return Res.ok();
}
@Operation(summary = "批量取消绑定接收者")
@PostMapping("/unbindReceivers")
public ResResult<Void> unbindReceivers(@RequestBody AllocationGroupUnbindParam param){
allocationGroupService.unbindReceivers(param);
return Res.ok();
}
@Operation(summary = "取消绑定接收者")
@PostMapping("/unbindReceiver")
public ResResult<Void> unbindReceiver(Long receiverId){
allocationGroupService.unbindReceiver(receiverId);
return Res.ok();
}
@Operation(summary = "修改分账比例")
@PostMapping("/updateRate")
public ResResult<Void> updateRate(Long receiverId, Integer rate){
allocationGroupService.updateRate(receiverId,rate);
return Res.ok();
}
}

View File

@@ -3,6 +3,7 @@ package cn.bootx.platform.daxpay.admin.controller.allocation;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.Res;
import cn.bootx.platform.common.core.rest.ResResult;
import cn.bootx.platform.common.core.rest.dto.LabelValue;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.daxpay.service.core.payment.allocation.service.AllocationReceiverService;
import cn.bootx.platform.daxpay.service.dto.allocation.AllocationReceiverDto;
@@ -11,10 +12,9 @@ import cn.bootx.platform.daxpay.service.param.allocation.AllocationReceiverQuery
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 对账接收方控制器
@@ -41,20 +41,38 @@ public class AllocationReceiverController {
return Res.ok(receiverService.findById(id));
}
@Operation(summary = "获取可以分账的通道")
@GetMapping("/findChannels")
public ResResult<List<LabelValue>> findChannels(){
return Res.ok(receiverService.findChannels());
}
@Operation(summary = "根据通道获取分账接收方类型")
@GetMapping("/findReceiverTypeByChannel")
public ResResult<List<LabelValue>> findReceiverTypeByChannel(String channel){
return Res.ok(receiverService.findReceiverTypeByChannel(channel));
}
@Operation(summary = "新增")
@PostMapping("")
public ResResult<Void> add(AllocationReceiverParam param){
@PostMapping("add")
public ResResult<Void> add(@RequestBody AllocationReceiverParam param){
receiverService.add(param);
return Res.ok();
}
@Operation(summary = "修改")
@PostMapping("update")
public ResResult<Void> update(AllocationReceiverParam param){
public ResResult<Void> update(@RequestBody AllocationReceiverParam param){
receiverService.update(param);
return Res.ok();
}
@Operation(summary = "删除")
@PostMapping("delete")
public ResResult<Void> delete(Long id){
receiverService.remove(id);
return Res.ok();
}
@Operation(summary = "同步到三方支付系统中")
@PostMapping("registerByGateway")
public ResResult<Void> registerByGateway(Long id){

View File

@@ -3,8 +3,12 @@ package cn.bootx.platform.daxpay.code;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* 分账接收方类型枚举
* 分账接收方类型
* @author xxm
* @since 2024/4/1
*/
@@ -12,18 +16,27 @@ import lombok.Getter;
@AllArgsConstructor
public enum AllocationReceiverTypeEnum {
/** 个人 */
WX_PERSONAL("PERSONAL_OPENID", "个人"),
WX_PERSONAL("wx_personal","PERSONAL_OPENID", "个人"),
/** 商户 */
WX_MERCHANT("MERCHANT_ID", "商户"),
WX_MERCHANT("wx_merchant","MERCHANT_ID", "商户"),
/** userId 以2088开头的纯16位数字 */
ALI_USER_ID("userId", "账号ID"),
ALI_USER_ID("ali_user_id","userId", "用户ID"),
/** openId */
ALI_OPEN_ID("openId", "登录号"),
ALI_OPEN_ID("ali_open_id","openId", "openId"),
/** 账号 */
ALI_LOGIN_NAME("loginName", "openId");
ALI_LOGIN_NAME("ali_login_name","loginName", "账号");
/** 编码 */
private final String code;
/** 外部编码, 三方支付系统使用的编码 */
private final String outCode;
/** 名称 */
private final String name;
/** 微信支持类型 */
public static final List<AllocationReceiverTypeEnum> WECHAT_LIST = Collections.unmodifiableList(Arrays.asList(WX_PERSONAL, WX_MERCHANT));
/** 支付宝支持类型 */
public static final List<AllocationReceiverTypeEnum> ALI_LIST = Collections.unmodifiableList(Arrays.asList(ALI_OPEN_ID, ALI_USER_ID, ALI_LOGIN_NAME));
}

View File

@@ -45,12 +45,6 @@ public enum PayChannelEnum {
.orElseThrow(() -> new PayFailureException("不存在的支付通道"));
}
/** 支付宝 UA */
public static final String UA_ALI_PAY = "Alipay";
/** 微信 UA */
public static final String UA_WECHAT_PAY = "MicroMessenger";
/** 异步支付通道 */
public static final List<PayChannelEnum> ASYNC_TYPE = Collections.unmodifiableList(Arrays.asList(ALI, WECHAT, UNION_PAY));
/** 异步支付通道的编码 */

View File

@@ -32,7 +32,7 @@ public class AliPayAllocationReceiverService {
* 校验
*/
public boolean validation(AllocationReceiver allocationReceiver){
List<String> list = Arrays.asList(ALI_USER_ID.getCode(), ALI_OPEN_ID.getCode(), ALI_LOGIN_NAME.getCode());
List<String> list = Arrays.asList(ALI_USER_ID.getOutCode(), ALI_OPEN_ID.getOutCode(), ALI_LOGIN_NAME.getOutCode());
String receiverType = allocationReceiver.getReceiverType();
return list.contains(receiverType);
}

View File

@@ -33,7 +33,7 @@ public class WeChatPayAllocationReceiverService {
* 校验参数是否合法
*/
public boolean validation(AllocationReceiver allocationReceiver){
List<String> list = Arrays.asList(WX_MERCHANT.getCode(), WX_MERCHANT.getCode());
List<String> list = Arrays.asList(WX_MERCHANT.getOutCode(), WX_MERCHANT.getOutCode());
String receiverType = allocationReceiver.getReceiverType();
return !list.contains(receiverType);
}

View File

@@ -1,7 +1,7 @@
package cn.bootx.platform.daxpay.service.core.payment.allocation.convert;
import cn.bootx.platform.daxpay.service.core.payment.allocation.entity.AllocationGroupReceiver;
import cn.bootx.platform.daxpay.service.dto.allocation.AllocationGroupReceiverDto;
import cn.bootx.platform.daxpay.service.dto.allocation.AllocationGroupReceiverResult;
import cn.bootx.platform.daxpay.service.param.allocation.AllocationGroupReceiverParam;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@@ -15,7 +15,7 @@ import org.mapstruct.factory.Mappers;
public interface AllocationGroupReceiverConvert {
AllocationGroupReceiverConvert CONVERT = Mappers.getMapper(AllocationGroupReceiverConvert.class);
AllocationGroupReceiverDto convert(AllocationGroupReceiver in);
AllocationGroupReceiverResult convert(AllocationGroupReceiver in);
AllocationGroupReceiver convert(AllocationGroupReceiverParam in);
}

View File

@@ -1,7 +1,13 @@
package cn.bootx.platform.daxpay.service.core.payment.allocation.dao;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.common.query.generator.QueryGenerator;
import cn.bootx.platform.daxpay.service.core.payment.allocation.entity.AllocationGroup;
import cn.bootx.platform.daxpay.service.param.allocation.AllocationGroupParam;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
@@ -15,4 +21,10 @@ import org.springframework.stereotype.Repository;
@Repository
@RequiredArgsConstructor
public class AllocationGroupManager extends BaseManager<AllocationGroupMapper,AllocationGroup> {
public Page<AllocationGroup> page(PageParam pageParam, AllocationGroupParam query) {
Page<AllocationGroup> mpPage = MpUtil.getMpPage(pageParam, AllocationGroup.class);
QueryWrapper<AllocationGroup> generator = QueryGenerator.generator(query);
return page(mpPage,generator);
}
}

View File

@@ -6,6 +6,8 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 分账组关联接收方
* @author xxm
@@ -22,4 +24,18 @@ public class AllocationGroupReceiverManager extends BaseManager<AllocationGroupR
public boolean isUsed(Long receiverId){
return existedByField(AllocationGroupReceiver::getReceiverId, receiverId);
}
/**
* 根据分组ID进行查询
*/
public List<AllocationGroupReceiver> findByGroupId(Long groupId){
return findAllByField(AllocationGroupReceiver::getGroupId, groupId);
}
/**
* 根据分组ID进行批量删除
*/
public void deleteByGroupId(Long groupId){
deleteByField(AllocationGroupReceiver::getGroupId, groupId);
}
}

View File

@@ -6,6 +6,7 @@ import cn.bootx.platform.daxpay.service.core.payment.allocation.convert.Allocati
import cn.bootx.platform.daxpay.service.dto.allocation.AllocationGroupDto;
import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbComment;
import cn.bootx.table.modify.annotation.DbTable;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -21,6 +22,7 @@ import lombok.experimental.Accessors;
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@DbTable(comment = "分账组")
@TableName("pay_allocation_receiver_group")
public class AllocationGroup extends MpBaseEntity implements EntityBaseFunction<AllocationGroupDto> {

View File

@@ -2,6 +2,8 @@ package cn.bootx.platform.daxpay.service.core.payment.allocation.entity;
import cn.bootx.platform.common.mybatisplus.base.MpCreateEntity;
import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbTable;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@@ -14,9 +16,11 @@ import lombok.experimental.Accessors;
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@DbTable(comment = "分账接收组关系")
@TableName("pay_allocation_group_receiver")
public class AllocationGroupReceiver extends MpCreateEntity {
@DbColumn(comment = "分账ID")
@DbColumn(comment = "分账ID")
private Long groupId;
@DbColumn(comment = "接收者ID")

View File

@@ -8,8 +8,10 @@ import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.service.core.payment.allocation.convert.AllocationReceiverConvert;
import cn.bootx.platform.daxpay.service.dto.allocation.AllocationReceiverDto;
import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbTable;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@@ -22,6 +24,8 @@ import lombok.experimental.Accessors;
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@DbTable(comment = "分账接收方")
@TableName("pay_allocation_receiver")
public class AllocationReceiver extends MpBaseEntity implements EntityBaseFunction<AllocationReceiverDto> {
@DbColumn(comment = "账号别名")
@@ -67,6 +71,9 @@ public class AllocationReceiver extends MpBaseEntity implements EntityBaseFuncti
@DbColumn(comment = "是否已经同步到网关")
private boolean sync;
@DbColumn(comment = "备注")
private String remark;
/**
* 转换
*/

View File

@@ -1,6 +1,10 @@
package cn.bootx.platform.daxpay.service.core.payment.allocation.service;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.common.core.function.CollectorsFunction;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.service.core.payment.allocation.convert.AllocationGroupConvert;
import cn.bootx.platform.daxpay.service.core.payment.allocation.dao.AllocationGroupManager;
@@ -9,6 +13,8 @@ import cn.bootx.platform.daxpay.service.core.payment.allocation.dao.AllocationRe
import cn.bootx.platform.daxpay.service.core.payment.allocation.entity.AllocationGroup;
import cn.bootx.platform.daxpay.service.core.payment.allocation.entity.AllocationGroupReceiver;
import cn.bootx.platform.daxpay.service.core.payment.allocation.entity.AllocationReceiver;
import cn.bootx.platform.daxpay.service.dto.allocation.AllocationGroupDto;
import cn.bootx.platform.daxpay.service.dto.allocation.AllocationGroupReceiverResult;
import cn.bootx.platform.daxpay.service.param.allocation.AllocationGroupBindParam;
import cn.bootx.platform.daxpay.service.param.allocation.AllocationGroupParam;
import cn.bootx.platform.daxpay.service.param.allocation.AllocationGroupReceiverParam;
@@ -21,6 +27,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@@ -36,13 +44,57 @@ public class AllocationGroupService {
private final AllocationGroupReceiverManager groupReceiverManager;
private final AllocationReceiverManager receiverManager;
/**
* 分页
*/
public PageResult<AllocationGroupDto> page(PageParam pageParam, AllocationGroupParam query){
return MpUtil.convert2DtoPageResult(groupManager.page(pageParam,query));
}
/**
* 查询详情
*/
public AllocationGroupDto findById(Long id){
return groupManager.findById(id).map(AllocationGroup::toDto).orElseThrow(()->new DataNotExistException("分账组不存在"));
}
/**
* 查询分账接收方
*/
public List<AllocationGroupReceiverResult> findReceiversByGroups(Long groupId){
List<AllocationGroupReceiver> groupReceivers = groupReceiverManager.findByGroupId(groupId);
List<Long> receiverIds = groupReceivers.stream()
.map(AllocationGroupReceiver::getReceiverId)
.collect(Collectors.toList());
// 查询关联接收方信息
Map<Long, AllocationReceiver> receiverMap = receiverManager.findAllByIds(receiverIds)
.stream()
.collect(Collectors.toMap(AllocationReceiver::getId, Function.identity(), CollectorsFunction::retainLatest));
// 组装信息
return groupReceivers.stream()
.map(o -> {
AllocationReceiver allocationReceiver = receiverMap.get(o.getReceiverId());
return new AllocationGroupReceiverResult()
.setId(o.getId())
.setReceiverId(allocationReceiver.getId())
.setReceiverAccount(allocationReceiver.getReceiverAccount())
.setReceiverName(allocationReceiver.getReceiverName())
.setRate(o.getRate())
.setReceiverType(allocationReceiver.getReceiverType())
.setRelationName(allocationReceiver.getRelationName())
.setRelationType(allocationReceiver.getRelationType());
})
.collect(Collectors.toList());
}
/**
* 创建分账组
*/
public void create(AllocationGroupParam param){
PayChannelEnum.findByCode(param.getChannel());
AllocationGroup allocation = AllocationGroupConvert.CONVERT.convert(param);
groupManager.save(allocation);
AllocationGroup group = AllocationGroupConvert.CONVERT.convert(param);
group.setTotalRate(0);
groupManager.save(group);
}
/**
@@ -52,22 +104,24 @@ public class AllocationGroupService {
AllocationGroup group = groupManager.findById(param.getId())
.orElseThrow(() -> new DataNotExistException("未找到分账组"));
BeanUtil.copyProperties(param,group, CopyOptions.create().ignoreNullValue());
group.setTotalRate(0);
group.setTotalRate(null);
groupManager.updateById(group);
}
/**
* 删除分账组
*/
public void delete(){
@Transactional(rollbackFor = Exception.class)
public void delete(Long id){
groupManager.deleteById(id);
groupReceiverManager.deleteByGroupId(id);
}
/**
* 绑定分账接收方
*/
@Transactional(rollbackFor = Exception.class)
public void bind(AllocationGroupBindParam param) {
public void bindReceivers(AllocationGroupBindParam param) {
// 分账组
AllocationGroup group = groupManager.findById(param.getGroupId())
.orElseThrow(() -> new DataNotExistException("未找到分账组"));
@@ -108,7 +162,7 @@ public class AllocationGroupService {
* 批量删除分账接收方
*/
@Transactional(rollbackFor = Exception.class)
public void removeReceivers(AllocationGroupUnbindParam param){
public void unbindReceivers(AllocationGroupUnbindParam param){
// 分账组
AllocationGroup group = groupManager.findById(param.getGroupId())
.orElseThrow(() -> new DataNotExistException("未找到分账组"));
@@ -130,7 +184,7 @@ public class AllocationGroupService {
* 删除单个分账接收方
*/
@Transactional
public void removeReceiver(Long receiverId){
public void unbindReceiver(Long receiverId){
AllocationGroupReceiver groupReceiver = groupReceiverManager.findById(receiverId)
.orElseThrow(() -> new DataNotExistException("未找到分账接收方"));
AllocationGroup group = groupManager.findById(groupReceiver.getGroupId())
@@ -145,6 +199,7 @@ public class AllocationGroupService {
/**
* 修改分账比例
*/
@Transactional(rollbackFor = Exception.class)
public void updateRate(Long receiverId, Integer rate){
AllocationGroupReceiver groupReceiver = groupReceiverManager.findById(receiverId)
.orElseThrow(() -> new DataNotExistException("未找到分账接收方"));

View File

@@ -1,9 +1,12 @@
package cn.bootx.platform.daxpay.service.core.payment.allocation.service;
import cn.bootx.platform.common.core.exception.BizException;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.dto.LabelValue;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
import cn.bootx.platform.daxpay.service.core.payment.allocation.convert.AllocationReceiverConvert;
@@ -19,6 +22,10 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* 分账接收方服务类
* @author xxm
@@ -47,6 +54,34 @@ public class AllocationReceiverService {
return manager.findById(id).map(AllocationReceiver::toDto).orElseThrow(() -> new DataNotExistException("分账接收方不存在"));
}
/**
* 获取可以分账的通道
*/
public List<LabelValue> findChannels(){
return Arrays.asList(
new LabelValue(PayChannelEnum.ALI.getName(),PayChannelEnum.ALI.getCode()),
new LabelValue(PayChannelEnum.WECHAT.getName(),PayChannelEnum.WECHAT.getCode())
);
}
/**
* 根据通道获取分账接收方类型
*/
public List<LabelValue> findReceiverTypeByChannel(String channel){
PayChannelEnum channelEnum = PayChannelEnum.findByCode(channel);
List<AllocationReceiverTypeEnum> list;
if (channelEnum == PayChannelEnum.ALI){
list = AllocationReceiverTypeEnum.ALI_LIST;
} else if (channelEnum == PayChannelEnum.WECHAT){
list = AllocationReceiverTypeEnum.WECHAT_LIST;
} else {
throw new BizException("非法的分账通道类型");
}
return list.stream()
.map(item -> new LabelValue(item.getName(),item.getCode()))
.collect(Collectors.toList());
}
/**
* 添加分账接收方
*/
@@ -69,16 +104,26 @@ public class AllocationReceiverService {
* 修改信息
*/
public void update(AllocationReceiverParam param){
// 未同步状态可以修改
AllocationReceiver receiver = manager.findById(param.getId()).orElseThrow(() -> new PayFailureException("未找到分账接收方"));
receiver.setName(param.getName())
.setRemark(param.getRemark());
manager.updateById(receiver);
}
/**
* 删除分账接收方
*/
public void remove(Long id){
// 未同步可以删除
AllocationReceiver receiver = manager.findById(id).orElseThrow(() -> new PayFailureException("未找到分账接收方"));
if (receiver.isSync()){
throw new BizException("该接收方已同步到三方支付系统中,无法删除");
}
// 判断是否绑定了分账组
if (groupReceiverManager.isUsed(id)){
throw new PayFailureException("该接收方已被分账组使用,无法删除");
}
manager.deleteById(id);
}
/**
@@ -120,4 +165,5 @@ public class AllocationReceiverService {
receiver.setSync(false);
manager.updateById(receiver);
}
}

View File

@@ -1,19 +0,0 @@
package cn.bootx.platform.daxpay.service.dto.allocation;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
*
* @author xxm
* @since 2024/4/1
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@Schema(title = "")
public class AllocationGroupReceiverDto extends BaseDto {
}

View File

@@ -0,0 +1,52 @@
package cn.bootx.platform.daxpay.service.dto.allocation;
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
import cn.bootx.platform.daxpay.code.AllocationRelationTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 分账组接收方信息
* @author xxm
* @since 2024/4/1
*/
@Data
@Accessors(chain = true)
@Schema(title = "分账组接收方信息")
public class AllocationGroupReceiverResult {
@Schema(description = "主键")
private Long id;
@Schema(description = "接收者ID")
private Long receiverId;
@Schema(description = "分账比例(万分之多少)")
private Integer rate;
/**
* 分账接收方类型
* @see AllocationReceiverTypeEnum
*/
@Schema(description = "分账接收方类型")
private String receiverType;
@Schema(description = "接收方账号")
private String receiverAccount;
/** 接收方姓名 */
@Schema(description = "接收方姓名")
private String receiverName;
/**
* 分账关系类型
* @see AllocationRelationTypeEnum
*/
@Schema(description = "分账关系类型")
private String relationType;
@Schema(description = "关系名称")
private String relationName;
}

View File

@@ -1,6 +1,7 @@
package cn.bootx.platform.daxpay.service.dto.allocation;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
import cn.bootx.platform.daxpay.code.AllocationRelationTypeEnum;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -33,6 +34,7 @@ public class AllocationReceiverDto extends BaseDto {
/**
* 分账接收方类型 个人/商户
* @see AllocationReceiverTypeEnum
*/
@Schema(description = "分账接收方类型")
private String receiverType;
@@ -57,4 +59,7 @@ public class AllocationReceiverDto extends BaseDto {
@Schema(description = "是否已经同步到网关")
private boolean sync;
@Schema(description = "备注")
private String remark;
}

View File

@@ -1,5 +1,6 @@
package cn.bootx.platform.daxpay.service.param.allocation;
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
import cn.bootx.platform.daxpay.code.AllocationRelationTypeEnum;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -31,6 +32,7 @@ public class AllocationReceiverParam {
/**
* 分账接收方类型 个人/商户
* @see AllocationReceiverTypeEnum
*/
@Schema(description = "分账接收方类型")
private String receiverType;
@@ -56,4 +58,7 @@ public class AllocationReceiverParam {
@Schema(description = "是否已经同步到网关")
private boolean sync;
@Schema(description = "备注")
private String remark;
}