Merge remote-tracking branch 'origin/develop' into develop

master
dalong306 4 years ago
commit 75f18f6ffb

@ -5,14 +5,14 @@
<parent> <parent>
<groupId>au.com.royalpay.payment</groupId> <groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId> <artifactId>payment-parent</artifactId>
<version>2.1.25</version> <version>2.1.48</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>2.2.5</version> <version>2.3.7</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>1.8.0</jib-maven-plugin.version> <jib-maven-plugin.version>2.2.0</jib-maven-plugin.version>
<docker-image.version>${project.version}</docker-image.version> <docker-image.version>${project.version}</docker-image.version>
</properties> </properties>
@ -33,30 +33,14 @@
<groupId>au.com.royalpay.payment</groupId> <groupId>au.com.royalpay.payment</groupId>
<artifactId>alipay-core</artifactId> <artifactId>alipay-core</artifactId>
</dependency> </dependency>
<dependency>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>hf-core</artifactId>
</dependency>
<dependency> <dependency>
<groupId>au.com.royalpay.payment</groupId> <groupId>au.com.royalpay.payment</groupId>
<artifactId>rppaymentsvc</artifactId> <artifactId>rppaymentsvc</artifactId>
</dependency> </dependency>
<dependency>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>jd-core</artifactId>
</dependency>
<dependency> <dependency>
<groupId>au.com.royalpay.payment</groupId> <groupId>au.com.royalpay.payment</groupId>
<artifactId>rpay-core</artifactId> <artifactId>rpay-core</artifactId>
</dependency> </dependency>
<dependency>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>yeepay-core</artifactId>
</dependency>
<dependency>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>bestpay-core</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.github.stuxuhai</groupId> <groupId>com.github.stuxuhai</groupId>
<artifactId>jpinyin</artifactId> <artifactId>jpinyin</artifactId>
@ -285,9 +269,11 @@
<tag>${docker-image.version}</tag> <tag>${docker-image.version}</tag>
</tags> </tags>
</to> </to>
<extraDirectory> <extraDirectories>
<path>extra/</path> <paths>
</extraDirectory> <path>extra/</path>
</paths>
</extraDirectories>
<allowInsecureRegistries>true</allowInsecureRegistries> <allowInsecureRegistries>true</allowInsecureRegistries>
</configuration> </configuration>
<executions> <executions>
@ -315,11 +301,14 @@
<image>hkccr.ccs.tencentyun.com/rpay/serverjre:openj9</image> <image>hkccr.ccs.tencentyun.com/rpay/serverjre:openj9</image>
</from> </from>
<to> <to>
<image>hkccr.ccs.tencentyun.com/cross-payment-dev/manage-dev:${docker-image.version}</image> <image>hkccr.ccs.tencentyun.com/cross-payment-dev/manage-dev:${docker-image.version}
</image>
</to> </to>
<extraDirectory> <extraDirectories>
<path>extra/</path> <paths>
</extraDirectory> <path>extra/</path>
</paths>
</extraDirectories>
<allowInsecureRegistries>true</allowInsecureRegistries> <allowInsecureRegistries>true</allowInsecureRegistries>
</configuration> </configuration>
<executions> <executions>
@ -349,9 +338,11 @@
<to> <to>
<image>hkccr.ccs.tencentyun.com/rpay/manage:${docker-image.version}</image> <image>hkccr.ccs.tencentyun.com/rpay/manage:${docker-image.version}</image>
</to> </to>
<extraDirectory> <extraDirectories>
<path>extra/</path> <paths>
</extraDirectory> <path>extra/</path>
</paths>
</extraDirectories>
<allowInsecureRegistries>true</allowInsecureRegistries> <allowInsecureRegistries>true</allowInsecureRegistries>
</configuration> </configuration>
<executions> <executions>

@ -0,0 +1,6 @@
FROM nginx:alpine
COPY openapi/* /usr/share/nginx/html/
COPY default.conf /etc/nginx/conf.d/
EXPOSE 80

@ -0,0 +1,13 @@
server {
listen 80;
server_name _ default;
location / {
root /usr/share/nginx/html/;
index index.html;
}
location =/ {
rewrite / /cn/ redirect;
}
}

@ -0,0 +1,430 @@
orderBasic:
required:
- description
- currency
- price
properties:
description:
type: string
maxLength: 128
description: 订单标题最大长度128字符超出自动截取
price:
type: integer
description: 订单金额单位为货币最小单位例如100表示AUD1.00
currency:
type: string
enum:
- AUD
- CNY
notify_url:
type: string
description: 支付通知回调url详见支付通知api不填不会推送支付通知。收到通知回调后强烈建议先进行主动查询再进行确认。
operator:
type: string
description: 操作人员标识
orderWithChannel:
allOf:
- $ref: '#/orderBasic'
- properties:
channel:
type: string
description: 支付渠道,大小写敏感
enum:
- Alipay
- Wechat
type: object
required:
- channel
cardCustomerParam:
type: object
properties:
name:
type: string
description: 消费者姓名,不填会取持卡人姓名
postcode:
type: string
example: 2000
description: 澳大利亚邮编
address:
type: string
description: 地址,可使用收货地址
city:
type: string
example: Sydney
state:
type: string
example: VIC
country:
type: string
description: 2位国家代码
example: AU
cardCustomerInfo:
title: 卡信息
properties:
bank:
type: string
description: 发卡行,可能拿不到
card_type:
type: string
description: 卡类型
example: credit/debit
card_alias:
type: string
description: 截断卡号包含前6位和后3位
example: 424242...242
card_scheme:
description: 发卡组织
type: string
example: VISA/MASTER
card_country:
description: 发卡国家
type: string
example: AU
customer_id:
type: string
description: 当下单时tokenize=true或customer_id不为空时存在
orderBasicResponse:
type: object
properties:
return_code:
type: string
description: 执行结果
result_code:
type: string
description: SUCCESS表示创建订单成功EXISTS表示订单已存在
channel:
type: string
description: 支付渠道
partner_code:
type: string
description: 商户编码
full_name:
type: string
description: 商户注册全名
partner_name:
type: string
description: 商户名称
order_id:
type: string
description: RoyalPay订单ID同时也是支付渠道订单ID最终支付成功的订单ID可能不同
partner_order_id:
type: string
description: 商户订单ID
orderStatus:
type: object
properties:
return_code:
type: string
description: 执行结果
example:
SUCCESS
result_code:
type: string
description: |
订单状态
- PAYING: 等待支付
- CREATE_FAIL: 创建失败
- CLOSED: 已关闭
- PAY_FAIL: 支付失败
- PAY_SUCCESS: 支付成功
- PARTIAL_REFUND: 部分退款
- FULL_REFUND: 全额退款
如果需要可以用相同订单号再次发起支付单,支付成功或支付中的无法重复发起订单
enum:
- PAYING
- CREATE_FAIL
- CLOSED
- PAY_FAIL
- PAY_SUCCESS
- PARTIAL_REFUND
- FULL_REFUND
order_id:
type: string
description: RoyalPay订单ID同时也是支付渠道订单ID最终支付成功的订单ID可能不同
partner_order_id:
type: string
description: 商户订单ID
channel_order_id:
type: string
description: 渠道方(支付宝、微信)交易流水号
total_fee:
type: integer
description: 订单金额,单位是货币最小面值单位
real_fee:
type: integer
description: 实际支付金额,单位是货币最小面值单位(目前等于订单金额,为卡券预留)
currency:
type: string
description: 币种通常为AUD
rate:
type: number
description: 交易时使用的汇率1AUD=?CNY
pay_time:
type: string
format: 'date-time'
pattern: yyyy-mm-dd HH:mm:ss
description: 支付时间yyyy-MM-dd HH:mm:ssGMT+10
create_time:
type: string
format: 'date-time'
pattern: yyyy-mm-dd HH:mm:ss
description: 订单创建时间最新订单为准yyyy-MM-dd HH:mm:ssGMT+10
settlement_date:
type: string
format: date
pattern: yyyy-mm-dd
description: 预期清算日期(可能受到账情况、节假日影响)(yyyy-MM-dd)
channel:
type: string
description: 支付渠道
customer_info:
anyOf:
- title: 支付宝用户
type: object
properties:
alipay_user_id:
type: string
description: 支付宝用户id
alipay_account:
type: string
description: 用户账号
- $ref: 'components_order.yml#/cardCustomerInfo'
refundStatus:
type: object
properties:
return_code:
type: string
description: 执行结果
example:
SUCCESS
result_code:
type: string
description: |
退款状态
- WAITING: 正在提交
- CREATE_FAILED: 提交失败
- SUCCESS: 提交成功,等待入账
- FAILED: 退款失败
- FINISHED: 退款成功,已入账
enum:
- WATING
- CREATE_FAILED
- SUCCESS
- FAILED
- FINISHED
refund_id:
type: string
description: RoyalPay退款单号
partner_refund_id:
type: string
description: 商户提交的退款单号
amount:
type: integer
description: 退款金额,单位是货币最小单位
currency:
type: string
description: 币种
example:
AUD
settlement_date:
type: string
format: date
pattern: yyyy-mm-dd
description: 预期清算日期(可能受到账情况、节假日影响)(yyyy-MM-dd)仅退款成功存在SUCCESS, FINISHED
transactionItem:
type: object
properties:
transaction_time:
type: string
format: 'date-time'
pattern: yyyyMMddHHmmss
description: 交易时间格式yyyyMMddHHmmssGMT+10
partner_code:
type: string
description: 订单关联商户
order_id:
type: string
description: RoyalPay订单ID
partner_order_id:
type: string
description: 商户订单ID
channel_order_id:
type: string
description: 渠道方订单号
refund_id:
type: string
description: RoyalPay退款单号仅退款或退款失败补正存在
partner_refund_id:
type: string
description: 商户系统提交退款ID(仅退款或退款失败补正)
gateway:
type: integer
description: |
下单接口
- 0: RoyalPay POS机付款码(扫描客户展示的付款码)
- 1: RoyalPay POS机聚合支付码(客户扫描POS展示的二维码)
- 2: RoyalPay 商户静态码
- 3: QRCode 网关
- 4: JSAPI 网关
- 5: 第三方POS付款码网关
- 6: 第三方POS聚合支付码网关
- 7: RoyalPay 商户静态码(已停用)
- 8: H5网关
- 9: WEB网关
- 10: SDK订单
- 11: RoyalPay账单码
- 12: 小程序
- 13: 原生二维码订单
- 14: RoyalPay账单链接
- 15: 原生JSAPI
- 16: 卡支付预订单
- 17: 卡支付订单
- 18: DirectDebit
channel:
type: string
description: 下单渠道
type:
type: string
description: 流水类别
enum:
- Credit
- Debit
currency:
type: string
description: 订单币种
example:
AUD
total_amount:
type: integer
description: 订单总金额,单位是货币最小单位
input_amount:
type: integer
description: 订单输入金额,单位是货币最小单位
customer_payment_amount:
type: integer
description: 用户实际支付金额,单位是货币最小单位
settle_amount:
type: integer
description: 结算金额币种为AUD单位是货币最小单位
transfer_amount:
type: integer
description: 打款金额(结算金额-手续费-GST币种为AUD单位是货币最小单位
surcharge:
type: integer
description: 手续费币种为AUD单位是货币最小单位
gst:
type: integer
description: GST金额币种为AUD单位是货币最小单位
exchange_rate:
type: number
description: 使用汇率
remark:
type: string
description: 备注
customInfo:
type: object
properties:
report_id:
type: string
description: RoyalPay海关单号
client_report_id:
type: string
description: 商户申请报关单号
report_status:
type: string
description: 报关单状态
enum:
- PROCESSING
- SUBMITED
- FAILED
- SUCCESS
channel:
type: string
description: 支付渠道
custom:
type: string
description: 海关编号
mch_custom_no:
type: string
description: 商户在海关备案的编号
mch_custom_name:
type: string
description: 商户海关备案名称
order_id:
type: string
description: RoyalPay订单号
transaction_id:
type: string
description: 支付渠道订单号
order_currency:
type: string
description: 币种
order_amount:
type: number
description: 订单金额
report_time:
type: string
format: 'date-time'
description: 报关时间
creation_date:
format: 'date-time'
type: string
description: 报关单创建时间
last_update_date:
type: string
format: 'date-time'
description: 更新时间
error_code:
type: string
description: 错误代码
error_msg:
type: string
description: 错误返回的信息描述
verify_department:
type: string
description: 验核机构
verify_department_trade_id:
type: string
description: 验核机构交易流水号
sub_orders:
type: array
items:
type: object
properties:
sub_order_no:
type: string
description: 商户子订单号
fee_type:
type: string
description: 币种代码
default: CNY
enum:
- CNY
order_fee:
type: number
description: 子订单金额
transport_fee:
type: number
description: 子订单物流金额
verify_department:
type: string
description: 验核机构
verify_department_trade_id:
type: string
description: 验核机构交易流水号
report_status:
type: string
description: 报关单状态
enum:
- PROCESSING
- SUBMITED
- FAILED
- SUCCESS
error_code:
type: string
description: 错误代码
error_msg:
type: string
description: 错误返回的信息描述

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 180 KiB

Before

Width:  |  Height:  |  Size: 184 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 139 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="394.5px" height="103.5px" viewBox="-30 -10 364.5 83.5" enable-background="new -30 -10 364.5 83.5" xml:space="preserve">
<g>
<path fill="#ED6B2C" d="M28.416,39.902"/>
</g>
<path fill="#ED6B2C" d="M48.971,50.572c0-3.301-2.532-6.009-5.758-6.29l-7.385-15.836c-0.144-0.309-0.044-0.674,0.234-0.871
c2.709-1.91,4.48-5.06,4.48-8.626c0-5.817-4.711-10.535-10.525-10.544h-0.019c-0.033,0-0.066,0.002-0.098,0.002V8.405h-11.83
c-0.388,0-0.703,0.315-0.703,0.703v4.919c0,0.388,0.315,0.703,0.703,0.703H29.9v0h0.018c2.288,0,4.236,1.779,4.318,4.065
c0.085,2.401-1.837,4.375-4.219,4.375H6.825V6.794c0-0.259-0.21-0.469-0.469-0.469H5.185C2.598,6.325,0.5,8.423,0.5,11.01v38.214
c0,0.049,0.002,0.096,0.003,0.144C0.502,49.415,0.5,49.461,0.5,49.508c0,3.718,2.748,6.794,6.325,7.304
c0.344,0.049,0.696,0.075,1.054,0.075c0.358,0,0.71-0.026,1.054-0.075c2.213-0.316,4.107-1.614,5.231-3.437
c0.693-1.111,1.094-2.419,1.094-3.82V37.948H29.9v-0.002c0.003,0,0.006,0,0.009,0c0.4,0.003,0.664-0.418,0.495-0.781l-2.392-5.136
c-0.115-0.248-0.364-0.406-0.637-0.406H9.636c-0.388,0-0.703,0.315-0.703,0.703v0.001l0,17.139c0,0.551-0.404,1.042-0.953,1.093
c-0.629,0.058-1.156-0.433-1.156-1.049V29.496h22.067c0.273,0,0.522,0.158,0.637,0.406l7.951,17.051
c-0.719,1.026-1.141,2.272-1.141,3.619c0,3.301,2.532,6.009,5.76,6.29l0.002,0.005l0.007-0.005c0.18,0.016,0.361,0.026,0.546,0.026
c2.139,0,4.027-1.064,5.17-2.689l0.009-0.005l-0.002-0.005C48.549,53.163,48.971,51.917,48.971,50.572z"/>
<path fill="#ED6B2C" d="M8.933,20.38V4.685C8.933,2.098,11.031,0,13.619,0h16.398c10.621,0.009,19.198,8.747,18.949,19.429
c-0.139,5.878-2.994,11.102-7.332,14.487c-0.282,0.22-0.696,0.122-0.847-0.202l-2.242-4.806c-0.127-0.272-0.069-0.597,0.15-0.803
c2.402-2.257,3.925-5.427,3.972-8.962c0.091-7.063-5.608-12.819-12.65-12.819H15.853c-0.329,0-0.595,0.266-0.595,0.595v13.46
c0,0.388-0.315,0.703-0.703,0.703H9.636C9.247,21.083,8.933,20.767,8.933,20.38z"/>
<g>
<path fill="#ED6B2C" d="M336.166,39.902"/>
</g>
<path fill="#ED6B2C" d="M84.512,25.763c-0.117-0.199-0.237-0.396-0.361-0.59c-0.78-1.075-2.047-1.776-3.476-1.776
c-2.373,0-4.296,1.923-4.296,4.294c0,0.792,0.213,1.534,0.59,2.172c0.021,0.037,0.047,0.077,0.07,0.117
c0.832,1.394,1.312,3.027,1.312,4.77c0,5.144-4.17,9.314-9.312,9.314c-5.144,0-9.314-4.17-9.314-9.314
c0-5.142,4.17-9.312,9.314-9.312c0.295,0,0.586,0.014,0.874,0.042c0.166,0.014,0.33,0.033,0.492,0.059
c0.084,0.005,0.169,0.007,0.255,0.007c2.371,0,4.294-1.923,4.294-4.296c0-2.071-1.466-3.8-3.418-4.205c-0.002,0-0.007,0-0.012-0.002
c-0.23-0.033-0.461-0.059-0.696-0.082c-0.588-0.059-1.185-0.089-1.79-0.089c-9.888,0-17.902,8.016-17.902,17.902
s8.014,17.902,17.902,17.902c9.886,0,17.902-8.016,17.902-17.902C86.942,31.488,86.056,28.41,84.512,25.763z"/>
<path fill="#ED6B2C" d="M115.331,17.272l-9.279,21.534l-9.33-21.536c-0.111-0.257-0.365-0.423-0.645-0.423h-7.493
c-0.337,0-0.564,0.345-0.43,0.655l13.655,30.979h0.073l-2.078,4.822c-0.393,0.912-1.291,1.503-2.284,1.503h-4.501
c-0.388,0-0.703,0.315-0.703,0.703v7.028c0,0.388,0.315,0.703,0.703,0.703h4.947c3.635,0,6.921-2.162,8.36-5.501L123.9,17.502
c0.133-0.309-0.094-0.654-0.43-0.654h-7.493C115.696,16.848,115.442,17.015,115.331,17.272z"/>
<path fill="#ED6B2C" d="M158.638,44.233V17.478c0-0.388-0.315-0.703-0.703-0.703h-15.11c-9.943,0-17.994,8.097-17.92,18.057
c0.073,9.881,8.264,17.785,18.145,17.785h0.844c2.319,0,4.199-1.88,4.199-4.199v0c0-2.319-1.88-4.199-4.199-4.199h-0.902
c-5.252,0-9.688-4.296-9.655-9.548c0.016-2.595,1.074-4.945,2.778-6.649c1.717-1.717,4.088-2.778,6.709-2.778h7.377v21.8
c0,3.105,2.517,5.622,5.622,5.622h4.45c0.259,0,0.469-0.21,0.469-0.469v-7.496c0-0.259-0.21-0.469-0.469-0.469H158.638z"/>
<path fill="#ED6B2C" d="M158.622,44.255"/>
<path fill="#ED6B2C" d="M175.502,44.233V4.87c0-0.388-0.315-0.703-0.703-0.703h-7.028c-0.388,0-0.703,0.315-0.703,0.703v39.363
v2.808c0,3.103,2.515,5.62,5.618,5.622l4.221,0.003c0.388,0,0.703-0.315,0.703-0.703v-7.028c0-0.388-0.315-0.703-0.703-0.703
H175.502z"/>
<path fill="#ED6B2C" d="M183.972,9.094v42.869c0,0.388,0.315,0.703,0.703,0.703h7.028c0.388,0,0.703-0.315,0.703-0.703V17.645
c0-0.388,0.315-0.703,0.703-0.703h13.109c4.011,0,7.262,3.251,7.262,7.262v0c0,4.011-3.251,7.262-7.262,7.262h-5.329
c-2.361,0-4.275,1.914-4.275,4.275v0c0,2.361,1.914,4.275,4.275,4.275h5.212c8.733,0,15.813-7.079,15.813-15.813v0
c0-8.733-7.079-15.813-15.813-15.813h-21.425C184.287,8.391,183.972,8.706,183.972,9.094z"/>
<path fill="#ED6B2C" d="M259.848,44.233V17.478c0-0.388-0.315-0.703-0.703-0.703h-15.11c-9.943,0-17.994,8.097-17.92,18.057
c0.073,9.881,8.264,17.785,18.145,17.785h0.844c2.319,0,4.199-1.88,4.199-4.199v0c0-2.319-1.88-4.199-4.199-4.199h-0.902
c-5.252,0-9.688-4.296-9.655-9.548c0.016-2.595,1.074-4.945,2.778-6.649c1.717-1.717,4.088-2.778,6.709-2.778h7.377v21.8
c0,3.105,2.517,5.622,5.622,5.622h4.45c0.259,0,0.469-0.21,0.469-0.469v-7.496c0-0.259-0.21-0.469-0.469-0.469H259.848z"/>
<path fill="#ED6B2C" d="M295.507,17.236l-9.279,21.534l-9.33-21.536c-0.111-0.257-0.365-0.423-0.645-0.423h-7.493
c-0.337,0-0.564,0.345-0.43,0.655l13.655,30.979h0.073l-2.078,4.822c-0.393,0.912-1.291,1.503-2.284,1.503h-4.501
c-0.388,0-0.703,0.315-0.703,0.703V62.5c0,0.388,0.315,0.703,0.703,0.703h4.947c3.635,0,6.921-2.162,8.36-5.501l17.573-40.237
c0.133-0.309-0.094-0.654-0.43-0.654h-7.493C295.871,16.811,295.618,16.978,295.507,17.236z"/>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>RoyalPay Document</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
<!--
ReDoc doesn't change outer page styles
-->
<style>
body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<redoc spec-url='document.yml' expand-responses="200" hide-download-button></redoc>
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"></script>
</body>
</html>

@ -0,0 +1,420 @@
orderBasic:
required:
- description
- currency
- price
properties:
description:
type: string
maxLength: 128
description: Order title(Max 128 characters. Will cut automatically if too long.)
price:
type: integer
description: Order price. Minimal unit of currency. eg, 100 for AUD 1.00
currency:
type: string
enum:
- AUD
- CNY
notify_url:
type: string
description: payment notification url. for details please visit notify api. will not post notifications if leave it null. Recommended to call order query api to confirm order status when received notification.
operator:
type: string
description: mark of operator
orderWithChannel:
allOf:
- $ref: '#/orderBasic'
- properties:
channel:
type: string
description: order channel. case sensitive
enum:
- Alipay
- Wechat
type: object
required:
- channel
cardCustomerParam:
properties:
name:
type: string
description: customer name. will use card holder name if leave it empty
postcode:
type: string
example: 2000
address:
type: string
city:
type: string
example: Sydney
state:
type: string
example: VIC
country:
type: string
description: 2-character country code
example: AU
cardCustomerInfo:
type: object
title: Card customer info
properties:
bank:
type: string
description: bank name who issued the card. may be empty
card_type:
type: string
description: card type
example: credit/debit
card_alias:
type: string
description: part of card number. for customers to recognize which card they used
example: 424242...242
card_scheme:
description: card scheme who issued the card
type: string
example: VISA/MASTER
card_country:
description: nation code who issued the card
type: string
example: AU
customer_id:
type: string
description: customer id. if you provided customer_id param or passed tokenize=true param. it will appear
orderBasicResponse:
type: object
properties:
return_code:
type: string
description: execute result
result_code:
type: string
description: SUCCESS/EXISTS all means success. EXISTS means the order_id was not first time to commit
channel:
type: string
description: payment channel
partner_code:
type: string
description: merchant code
full_name:
type: string
description: merchant full name
partner_name:
type: string
description: merchant name
order_id:
type: string
description: RoyalPay order ID, Will be channel order ID same time.
partner_order_id:
type: string
description: order id applied by merchant
orderStatus:
type: object
properties:
return_code:
type: string
description: execute result
example:
SUCCESS
result_code:
type: string
description: |
order status code
- PAYING: waiting for payment
- CREATE_FAIL: creation failed(final status, can be actived again if submitted another create order with same order id)
- CLOSED: order closed(final status, can be actived again if submitted another create order with same order id)
- PAY_FAIL: payment failed(final status, can be actived again if submitted another create order with same order id)
- PAY_SUCCESS: payment success(final status)
- PARTIAL_REFUND: payment success and partial refunds happened(final status)
- FULL_REFUND: payment success and was full refunded(final status)
If necessary. you can use same order id to call create order api in same gateway. but when origin order is paid or paying status will be failure
enum:
- PAYING
- CREATE_FAIL
- CLOSED
- PAY_FAIL
- PAY_SUCCESS
- PARTIAL_REFUND
- FULL_REFUND
order_id:
type: string
description: RoyalPay order ID, Will be channel order ID same time.
partner_order_id:
type: string
description: order id applied by merchant
channel_order_id:
type: string
description: transaction id from payment channel
total_fee:
type: integer
description: order amount. minimal unit of the currency.
real_fee:
type: integer
description: customer actual paid amount. minimal unit of the currency.(equals to total_fee at this moment. in case there were some discounts in the future)
currency:
type: string
rate:
type: number
description: exchange rate of trading. 1AUD=?CNY
pay_time:
type: string
format: 'date-time'
pattern: yyyy-mm-dd HH:mm:ss
description: paid time(yyyy-MM-dd HH:mm:ss, GMT+10)
create_time:
type: string
format: 'date-time'
pattern: yyyy-mm-dd HH:mm:ss
description: order creation time(yyyy-MM-dd HH:mm:ss, GMT+10)
settlement_date:
type: string
format: date
pattern: yyyy-mm-dd
description: target settlement date, maybe delay due to holidays and bank issues(yyyy-MM-dd)
channel:
type: string
description: payment channel
customer_info:
anyOf:
- description: Alipay User Info
title: Alipay Users
type: object
properties:
alipay_user_id:
type: string
description: Alipay user id
alipay_account:
type: string
description: user account
- $ref: 'components_order.yml#/cardCustomerInfo'
refundStatus:
type: object
properties:
return_code:
type: string
description: Execute result
example:
SUCCESS
result_code:
type: string
description: |
Refund status
- WAITING: Submitting
- CREATE_FAILED: Submit failed
- SUCCESS: Submit success. waiting for bank processing(for Wechat, it's final status)
- FAILED: Refund failed
- FINISHED: Refund success (final status)
enum:
- WATING
- CREATE_FAILED
- SUCCESS
- FAILED
- FINISHED
refund_id:
type: string
description: RoyalPay Refund ID
partner_refund_id:
type: string
description: Refund id submitted by merchant
amount:
type: integer
description: refund amount. minimal unit of the currency.
currency:
type: string
example:
AUD
settlement_date:
type: string
format: date
pattern: yyyy-mm-dd
description: target settlement date, maybe delay due to holidays and bank issues(yyyy-MM-dd). only exists when status is SUCCESS or FINISHED
transactionItem:
type: object
properties:
transaction_time:
type: string
format: 'date-time'
pattern: yyyyMMddHHmmss
description: trading time, format is yyyyMMddHHmmss, GMT+10
partner_code:
type: string
description: transaction related partner code
order_id:
type: string
description: RoyalPay order id
partner_order_id:
type: string
description: merchant order id
channel_order_id:
type: string
description: channel order id
refund_id:
type: string
description: RoyalPay refund id (only exists on refund or refund failure payback transactions)
partner_refund_id:
type: string
description: merchant submitted refund id (only exists on refund or refund failure payback transactions)
gateway:
type: integer
description: |
gateway
- 0: RoyalPay EftPOS with payment code (scanning payment code provided by customer)
- 1: RoyalPay EftPOS with collection code (customer scan qr code provided by EftPOS)
- 2: RoyalPay Merchant's static QR Code
- 3: QRCode Gateway
- 4: JSAPI Gateway
- 5: Third EftPOS payment code gateway
- 6: Third EftPOS collection code gateway
- 7: RoyalPay Merchant's static QR Code(deprecated)
- 8: H5 Gateway
- 9: WEB Gateway
- 10: SDK order Gateway
- 11: RoyalPay Bill QR Code
- 12: Mini Program Gateway
- 13: Native QR Code Gateway
- 14: RoyalPay Bill link
- 15: Native JSAPI Gateway
- 16: Card Order(Pre order mode)
- 17: Card Order
- 18: DirectDebit
channel:
type: string
description: Trading channel
type:
type: string
description: Transaction type
enum:
- Credit
- Debit
currency:
type: string
example:
AUD
total_amount:
type: integer
description: Total amount for order. minimal unit of the currency.
input_amount:
type: integer
description: Input amount for order. minimal unit of the currency.
customer_payment_amount:
type: integer
description: Customer actual paid amount. minimal unit of the currency.
settle_amount:
type: integer
description: Amount calculated to merchant. note that it did not sub surcharge and GST yet. AUD currency. minimal unit of the currency.
transfer_amount:
type: integer
description: Pay amount to merchant. settle_amount - surcharge - GST. AUD currency. minimal unit of the currency.
surcharge:
type: integer
description: surcharge for this transaction. AUD currency. minimal unit of the currency.
gst:
type: integer
description: GST. AUD currency. minimal unit of the currency.
exchange_rate:
type: number
description: used exchange rate.
remark:
type: string
description: transaction remark
customInfo:
type: object
properties:
report_id:
type: string
description: RoyalPay customs report id
client_report_id:
type: string
description: merchant submitted customs report id
report_status:
type: string
description: report status
enum:
- PROCESSING
- SUBMITED
- FAILED
- SUCCESS
channel:
type: string
description: payment channel
custom:
type: string
description: customs code
mch_custom_no:
type: string
description: merchant's customs no registered in customs system
mch_custom_name:
type: string
description: merchant's name registered in customs system
order_id:
type: string
description: RoyalPay order id
transaction_id:
type: string
description: channel transaction id
order_currency:
type: string
description: order currency
order_amount:
type: number
description: order amount
report_time:
type: string
format: 'date-time'
description: report customs time
creation_date:
format: 'date-time'
type: string
description: report create time
last_update_date:
type: string
format: 'date-time'
description: update time
error_code:
type: string
description: error code
error_msg:
type: string
description: error message
verify_department:
type: string
verify_department_trade_id:
type: string
sub_orders:
type: array
items:
type: object
properties:
sub_order_no:
type: string
description: merchant's sub order no
fee_type:
type: string
description: currency code
default: CNY
enum:
- CNY
order_fee:
type: number
description: sub order fee
transport_fee:
type: number
description: sub order transport fee
verify_department:
type: string
verify_department_trade_id:
type: string
report_status:
type: string
description: report status
enum:
- PROCESSING
- SUBMITED
- FAILED
- SUCCESS
error_code:
type: string
error_msg:
type: string

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 190 KiB

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 126 KiB

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="394.5px" height="103.5px" viewBox="-30 -10 364.5 83.5" enable-background="new -30 -10 364.5 83.5" xml:space="preserve">
<g>
<path fill="#ED6B2C" d="M28.416,39.902"/>
</g>
<path fill="#ED6B2C" d="M48.971,50.572c0-3.301-2.532-6.009-5.758-6.29l-7.385-15.836c-0.144-0.309-0.044-0.674,0.234-0.871
c2.709-1.91,4.48-5.06,4.48-8.626c0-5.817-4.711-10.535-10.525-10.544h-0.019c-0.033,0-0.066,0.002-0.098,0.002V8.405h-11.83
c-0.388,0-0.703,0.315-0.703,0.703v4.919c0,0.388,0.315,0.703,0.703,0.703H29.9v0h0.018c2.288,0,4.236,1.779,4.318,4.065
c0.085,2.401-1.837,4.375-4.219,4.375H6.825V6.794c0-0.259-0.21-0.469-0.469-0.469H5.185C2.598,6.325,0.5,8.423,0.5,11.01v38.214
c0,0.049,0.002,0.096,0.003,0.144C0.502,49.415,0.5,49.461,0.5,49.508c0,3.718,2.748,6.794,6.325,7.304
c0.344,0.049,0.696,0.075,1.054,0.075c0.358,0,0.71-0.026,1.054-0.075c2.213-0.316,4.107-1.614,5.231-3.437
c0.693-1.111,1.094-2.419,1.094-3.82V37.948H29.9v-0.002c0.003,0,0.006,0,0.009,0c0.4,0.003,0.664-0.418,0.495-0.781l-2.392-5.136
c-0.115-0.248-0.364-0.406-0.637-0.406H9.636c-0.388,0-0.703,0.315-0.703,0.703v0.001l0,17.139c0,0.551-0.404,1.042-0.953,1.093
c-0.629,0.058-1.156-0.433-1.156-1.049V29.496h22.067c0.273,0,0.522,0.158,0.637,0.406l7.951,17.051
c-0.719,1.026-1.141,2.272-1.141,3.619c0,3.301,2.532,6.009,5.76,6.29l0.002,0.005l0.007-0.005c0.18,0.016,0.361,0.026,0.546,0.026
c2.139,0,4.027-1.064,5.17-2.689l0.009-0.005l-0.002-0.005C48.549,53.163,48.971,51.917,48.971,50.572z"/>
<path fill="#ED6B2C" d="M8.933,20.38V4.685C8.933,2.098,11.031,0,13.619,0h16.398c10.621,0.009,19.198,8.747,18.949,19.429
c-0.139,5.878-2.994,11.102-7.332,14.487c-0.282,0.22-0.696,0.122-0.847-0.202l-2.242-4.806c-0.127-0.272-0.069-0.597,0.15-0.803
c2.402-2.257,3.925-5.427,3.972-8.962c0.091-7.063-5.608-12.819-12.65-12.819H15.853c-0.329,0-0.595,0.266-0.595,0.595v13.46
c0,0.388-0.315,0.703-0.703,0.703H9.636C9.247,21.083,8.933,20.767,8.933,20.38z"/>
<g>
<path fill="#ED6B2C" d="M336.166,39.902"/>
</g>
<path fill="#ED6B2C" d="M84.512,25.763c-0.117-0.199-0.237-0.396-0.361-0.59c-0.78-1.075-2.047-1.776-3.476-1.776
c-2.373,0-4.296,1.923-4.296,4.294c0,0.792,0.213,1.534,0.59,2.172c0.021,0.037,0.047,0.077,0.07,0.117
c0.832,1.394,1.312,3.027,1.312,4.77c0,5.144-4.17,9.314-9.312,9.314c-5.144,0-9.314-4.17-9.314-9.314
c0-5.142,4.17-9.312,9.314-9.312c0.295,0,0.586,0.014,0.874,0.042c0.166,0.014,0.33,0.033,0.492,0.059
c0.084,0.005,0.169,0.007,0.255,0.007c2.371,0,4.294-1.923,4.294-4.296c0-2.071-1.466-3.8-3.418-4.205c-0.002,0-0.007,0-0.012-0.002
c-0.23-0.033-0.461-0.059-0.696-0.082c-0.588-0.059-1.185-0.089-1.79-0.089c-9.888,0-17.902,8.016-17.902,17.902
s8.014,17.902,17.902,17.902c9.886,0,17.902-8.016,17.902-17.902C86.942,31.488,86.056,28.41,84.512,25.763z"/>
<path fill="#ED6B2C" d="M115.331,17.272l-9.279,21.534l-9.33-21.536c-0.111-0.257-0.365-0.423-0.645-0.423h-7.493
c-0.337,0-0.564,0.345-0.43,0.655l13.655,30.979h0.073l-2.078,4.822c-0.393,0.912-1.291,1.503-2.284,1.503h-4.501
c-0.388,0-0.703,0.315-0.703,0.703v7.028c0,0.388,0.315,0.703,0.703,0.703h4.947c3.635,0,6.921-2.162,8.36-5.501L123.9,17.502
c0.133-0.309-0.094-0.654-0.43-0.654h-7.493C115.696,16.848,115.442,17.015,115.331,17.272z"/>
<path fill="#ED6B2C" d="M158.638,44.233V17.478c0-0.388-0.315-0.703-0.703-0.703h-15.11c-9.943,0-17.994,8.097-17.92,18.057
c0.073,9.881,8.264,17.785,18.145,17.785h0.844c2.319,0,4.199-1.88,4.199-4.199v0c0-2.319-1.88-4.199-4.199-4.199h-0.902
c-5.252,0-9.688-4.296-9.655-9.548c0.016-2.595,1.074-4.945,2.778-6.649c1.717-1.717,4.088-2.778,6.709-2.778h7.377v21.8
c0,3.105,2.517,5.622,5.622,5.622h4.45c0.259,0,0.469-0.21,0.469-0.469v-7.496c0-0.259-0.21-0.469-0.469-0.469H158.638z"/>
<path fill="#ED6B2C" d="M158.622,44.255"/>
<path fill="#ED6B2C" d="M175.502,44.233V4.87c0-0.388-0.315-0.703-0.703-0.703h-7.028c-0.388,0-0.703,0.315-0.703,0.703v39.363
v2.808c0,3.103,2.515,5.62,5.618,5.622l4.221,0.003c0.388,0,0.703-0.315,0.703-0.703v-7.028c0-0.388-0.315-0.703-0.703-0.703
H175.502z"/>
<path fill="#ED6B2C" d="M183.972,9.094v42.869c0,0.388,0.315,0.703,0.703,0.703h7.028c0.388,0,0.703-0.315,0.703-0.703V17.645
c0-0.388,0.315-0.703,0.703-0.703h13.109c4.011,0,7.262,3.251,7.262,7.262v0c0,4.011-3.251,7.262-7.262,7.262h-5.329
c-2.361,0-4.275,1.914-4.275,4.275v0c0,2.361,1.914,4.275,4.275,4.275h5.212c8.733,0,15.813-7.079,15.813-15.813v0
c0-8.733-7.079-15.813-15.813-15.813h-21.425C184.287,8.391,183.972,8.706,183.972,9.094z"/>
<path fill="#ED6B2C" d="M259.848,44.233V17.478c0-0.388-0.315-0.703-0.703-0.703h-15.11c-9.943,0-17.994,8.097-17.92,18.057
c0.073,9.881,8.264,17.785,18.145,17.785h0.844c2.319,0,4.199-1.88,4.199-4.199v0c0-2.319-1.88-4.199-4.199-4.199h-0.902
c-5.252,0-9.688-4.296-9.655-9.548c0.016-2.595,1.074-4.945,2.778-6.649c1.717-1.717,4.088-2.778,6.709-2.778h7.377v21.8
c0,3.105,2.517,5.622,5.622,5.622h4.45c0.259,0,0.469-0.21,0.469-0.469v-7.496c0-0.259-0.21-0.469-0.469-0.469H259.848z"/>
<path fill="#ED6B2C" d="M295.507,17.236l-9.279,21.534l-9.33-21.536c-0.111-0.257-0.365-0.423-0.645-0.423h-7.493
c-0.337,0-0.564,0.345-0.43,0.655l13.655,30.979h0.073l-2.078,4.822c-0.393,0.912-1.291,1.503-2.284,1.503h-4.501
c-0.388,0-0.703,0.315-0.703,0.703V62.5c0,0.388,0.315,0.703,0.703,0.703h4.947c3.635,0,6.921-2.162,8.36-5.501l17.573-40.237
c0.133-0.309-0.094-0.654-0.43-0.654h-7.493C295.871,16.811,295.618,16.978,295.507,17.236z"/>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>RoyalPay Document</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
<!--
ReDoc doesn't change outer page styles
-->
<style>
body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<redoc spec-url='document.yml' expand-responses="200" hide-download-button></redoc>
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"></script>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

@ -16,5 +16,4 @@ public interface PlatformClearService {
void generateAliPaySettleLogs(); void generateAliPaySettleLogs();
void doVerifyHFSettleLog(JSONObject param);
} }

@ -35,14 +35,9 @@ public class ChannelsAnalysisServiceImpl implements ChannelsAnalysisService {
}*/ }*/
List<JSONObject> listChannel = new ArrayList<>(); List<JSONObject> listChannel = new ArrayList<>();
listChannel.add(putParam(params,"Wechat")); listChannel.add(putParam(params,"Wechat"));
listChannel.add(putParam(params,"Bestpay"));
listChannel.add(putParam(params,"Alipay")); listChannel.add(putParam(params,"Alipay"));
listChannel.add(putParam(params,"AlipayOnline")); listChannel.add(putParam(params,"AlipayOnline"));
listChannel.add(putParam(params,"jd"));
listChannel.add(putParam(params,"hf"));
listChannel.add(putParam(params,"Rpay")); listChannel.add(putParam(params,"Rpay"));
listChannel.add(putParam(params,"Yeepay"));
listChannel.add(putParam(params,"LakalaPay"));
listChannel.add(putParam(params,"rpaypmt_card")); listChannel.add(putParam(params,"rpaypmt_card"));
listChannel.add(putParam(params,"rpaypmt_dd")); listChannel.add(putParam(params,"rpaypmt_dd"));
return listChannel; return listChannel;
@ -55,7 +50,7 @@ public class ChannelsAnalysisServiceImpl implements ChannelsAnalysisService {
} }
List<JSONObject> list = new ArrayList<>(); List<JSONObject> list = new ArrayList<>();
Map<Date,JSONObject> analysisMap = new TreeMap<>(); Map<Date,JSONObject> analysisMap = new TreeMap<>();
String[] channels = {"Wechat","Bestpay","Alipay","jd","AlipayOnline","hf", "Rpay","Yeepay","LakalaPay","rpaypmt_card","rpaypmt_dd"}; String[] channels = {"Wechat","Alipay","AlipayOnline","Rpay","rpaypmt_card","rpaypmt_dd"};
for (String channel:channels){ for (String channel:channels){
analysisChannelCustomers(params, analysisMap, channel); analysisChannelCustomers(params, analysisMap, channel);
} }

@ -92,12 +92,7 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
List<String> channels = new ArrayList<>(); List<String> channels = new ArrayList<>();
if (params.get("channel") == null) { if (params.get("channel") == null) {
channels.add("Bestpay");
channels.add("Yeepay");
channels.add("Rpay"); channels.add("Rpay");
channels.add("hf");
channels.add("jd");
channels.add("LakalaPay");
channels.add("rpaypmt_card"); channels.add("rpaypmt_card");
channels.add("rpaypmt_dd"); channels.add("rpaypmt_dd");
params.put("channels", channels); params.put("channels", channels);

@ -16,6 +16,7 @@ import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.lang3.time.DurationFormatUtils; import org.apache.commons.lang3.time.DurationFormatUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -558,36 +559,13 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
record.put("new_customers",newCustomers); record.put("new_customers",newCustomers);
record.put("old_customers",oldCustomers); record.put("old_customers",oldCustomers);
record.put("client_id",client.getIntValue("client_id")); record.put("client_id",client.getIntValue("client_id"));
customerAndOrdersStatisticsMapper.save(record); if (StringUtils.equalsIgnoreCase("rpaypmt_card", record.getString("channel")) || StringUtils.equalsIgnoreCase("rpaypmt_dd", record.getString("channel"))) {
record.put("single_amount", record.getBigDecimal("total").divide(record.getBigDecimal("orders"), 2, RoundingMode.HALF_UP));
}
customerAndOrdersStatisticsMapper.save(record);
} }
} }
} }
/* @Override
public JSONObject getPlatformAmount(JSONObject params) {
JSONObject resp = new JSONObject();
params.put("channel","Bestpay");
resp.put("bestPayAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount"));
resp.put("bestPay_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count"));
params.put("channel","Wechat");
resp.put("wechatAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount"));
resp.put("wechat_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count"));
params.put("channel","Alipay");
resp.put("alipayAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount"));
resp.put("alipay_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count"));
params.put("channel","jd");
resp.put("jdAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount"));
resp.put("jd_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count"));
params.put("channel","AlipayOnline");
resp.put("aliOnlineAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount"));
resp.put("aliOnline_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count"));
return resp;
}*/
@Override @Override
public JSONObject getPlatformAmount(JSONObject params) { public JSONObject getPlatformAmount(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("org_ChannelAnalysis" + params.getString("org_id")+params.getString("begin")).get(); String jsonStr = stringRedisTemplate.boundValueOps("org_ChannelAnalysis" + params.getString("org_id")+params.getString("begin")).get();
@ -610,7 +588,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
} }
} }
private JSONObject getTodayChannelCount(JSONObject params){ private JSONObject getTodayChannelCount(JSONObject params){
String[] channels = new String[]{"Bestpay", "Wechat", "Alipay", "jd", "AlipayOnline", "hf", "Rpay", "Yeepay", "LakalaPay", "rpaypmt_card", "rpaypmt_dd"}; String[] channels = new String[]{"Wechat", "Alipay", "AlipayOnline", "Rpay", "rpaypmt_card", "rpaypmt_dd"};
JSONObject resp = new JSONObject(); JSONObject resp = new JSONObject();
for(String channel:channels) { for(String channel:channels) {
params.put("channel", channel); params.put("channel", channel);

@ -293,16 +293,6 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService {
} }
List<JSONObject> hfSettle = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "hf");
if (hfSettle != null && hfSettle.size() > 0) {
for (JSONObject logs : hfSettle) {
dayInfo.put("hfSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee"));
dayInfo.put("platformGetSettleFee", dayInfo.getBigDecimal("hfSettleFee_" + logs.getString("merchants")));
}
} else {
dayInfo.put("platformGetSettleFee", BigDecimal.ZERO);
}
List<JSONObject> alipaySettleLogs = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "Alipay"); List<JSONObject> alipaySettleLogs = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "Alipay");
for (JSONObject logs : alipaySettleLogs) { for (JSONObject logs : alipaySettleLogs) {
dayInfo.put("aliSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee")); dayInfo.put("aliSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee"));

@ -11,10 +11,8 @@ import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService; import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
@ -23,12 +21,11 @@ import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
/** /**
* Created by yishuqian on 20/02/2017. * Created by yishuqian on 20/02/2017.
*/ */
@ -63,7 +60,6 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
client.put("transaction_time", DateFormatUtils.format(earlistOrder.getDate("transaction_time"), "yyyy-MM-dd")); client.put("transaction_time", DateFormatUtils.format(earlistOrder.getDate("transaction_time"), "yyyy-MM-dd"));
} }
JSONObject res = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Wechat"); JSONObject res = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Wechat");
JSONObject best_pay = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Bestpay");
JSONObject ali_pay = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Alipay"); JSONObject ali_pay = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Alipay");
JSONObject rate_value = new JSONObject(); JSONObject rate_value = new JSONObject();
if (res != null) { if (res != null) {
@ -72,9 +68,6 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
client.put("clean_days", res.getIntValue("clean_days")); client.put("clean_days", res.getIntValue("clean_days"));
} }
} }
if (best_pay != null) {
rate_value.put("best_rate_value", best_pay.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN));
}
if (ali_pay != null) { if (ali_pay != null) {
rate_value.put("ali_rate_value", ali_pay.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN)); rate_value.put("ali_rate_value", ali_pay.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN));
} }

@ -12,40 +12,23 @@ import au.com.royalpay.payment.manage.mappers.log.PlatformSettlementMapper;
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient; import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils; import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import cn.yixblog.platform.http.HttpRequestGenerator;
@Service @Service
public class PlatformClearAnalysisServiceImpl implements PlatformClearService { public class PlatformClearAnalysisServiceImpl implements PlatformClearService {
@ -104,7 +87,7 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService {
doVerifyAlipayOnlineSettleLog(sdfClear.parse(end_date)); doVerifyAlipayOnlineSettleLog(sdfClear.parse(end_date));
} catch (Exception e) { } catch (Exception e) {
logger.error("PlatformClearAnalysisServiceImpl.verifySettleLogByDate ==> 校验" + end_date + "支付宝Online到账失败", e); logger.error("PlatformClearAnalysisServiceImpl.verifySettleLogByDate ==> 校验" + end_date + "支付宝Online到账失败", e);
throw new ChannelNetworkException("校验失败:",e); throw new ChannelNetworkException("校验失败:", e);
} }
} }
if (StringUtils.equals("Wechat", channel)) { if (StringUtils.equals("Wechat", channel)) {
@ -276,9 +259,9 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService {
JSONObject alipaySettleLog = new JSONObject(); JSONObject alipaySettleLog = new JSONObject();
JSONArray payments = aliSettleLog.getJSONArray("payments"); JSONArray payments = aliSettleLog.getJSONArray("payments");
BigDecimal credit = new BigDecimal(0.00); BigDecimal credit = BigDecimal.ZERO;
BigDecimal creditFee = new BigDecimal(0.00); BigDecimal creditFee = BigDecimal.ZERO;
BigDecimal creditSettle = new BigDecimal(0.00); BigDecimal creditSettle = BigDecimal.ZERO;
if (payments != null) { if (payments != null) {
for (int i = 0; i < payments.size(); i++) { for (int i = 0; i < payments.size(); i++) {
JSONObject json = payments.getJSONObject(i); JSONObject json = payments.getJSONObject(i);
@ -297,21 +280,19 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService {
JSONArray refunds = aliSettleLog.getJSONArray("refunds"); JSONArray refunds = aliSettleLog.getJSONArray("refunds");
logger.info("alipay的refunds清算总信息" + refunds.toJSONString()); logger.info("alipay的refunds清算总信息" + refunds.toJSONString());
BigDecimal debit = new BigDecimal(0.00); BigDecimal debit = BigDecimal.ZERO;
BigDecimal debitFee = new BigDecimal(0.00); BigDecimal debitFee = BigDecimal.ZERO;
BigDecimal debitSettle = new BigDecimal(0.00); BigDecimal debitSettle = BigDecimal.ZERO;
if (refunds != null) { for (int i = 0; i < refunds.size(); i++) {
for (int i = 0; i < refunds.size(); i++) { JSONObject json = refunds.getJSONObject(i);
JSONObject json = refunds.getJSONObject(i); BigDecimal transactionAmount = json.getBigDecimal("transaction_amount");
BigDecimal transactionAmount = json.getBigDecimal("transaction_amount"); BigDecimal chargeFee = json.getBigDecimal("charge_fee");
BigDecimal chargeFee = json.getBigDecimal("charge_fee"); debit = debit.add(transactionAmount);
debit = debit.add(transactionAmount); debitFee = debitFee.add(chargeFee);
debitFee = debitFee.add(chargeFee); if (json.containsKey("settle_amount")) {
if (json.containsKey("settle_amount")) { debitSettle = debitSettle.add(json.getBigDecimal("settle_amount"));
debitSettle = debitSettle.add(json.getBigDecimal("settle_amount")); } else {
} else { debitSettle = debitSettle.add(transactionAmount.subtract(chargeFee));
debitSettle = debitSettle.add(transactionAmount.subtract(chargeFee));
}
} }
} }
alipaySettleLog.put("debit", debit); alipaySettleLog.put("debit", debit);
@ -370,7 +351,7 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService {
sysLogs.put("sys_net_fee", creditLogs.getBigDecimal("aud_amount").subtract(debitLogs.getBigDecimal("aud_amount"))); sysLogs.put("sys_net_fee", creditLogs.getBigDecimal("aud_amount").subtract(debitLogs.getBigDecimal("aud_amount")));
if (StringUtils.equals("Alipay", channel)) { if (StringUtils.equals("Alipay", channel)) {
sysLogs.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start_date, end_date, channel, new BigDecimal(0.006))); sysLogs.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start_date, end_date, channel, BigDecimal.valueOf(0.006)));
} else if (StringUtils.equals("AlipayOnline", channel)) { } else if (StringUtils.equals("AlipayOnline", channel)) {
sysLogs.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start_date, end_date, channel, alipay_online_rate)); sysLogs.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start_date, end_date, channel, alipay_online_rate));
} else { } else {
@ -385,121 +366,4 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService {
} }
return null; return null;
} }
@Override
public void doVerifyHFSettleLog(JSONObject param) {
String end = param.getString("end");
String start = param.getString("start");
JSONObject hfSettle = handleHFSettleFile(param.getString("fileId"));
if (hfSettle == null) {
return;
}
JSONObject record = new JSONObject();
record.put("settle_date", end);
record.put("start_date", start);
record.put("end_date", end);
record.put("channel", "hf");
record.put("last_update_date", new Date());
JSONObject syscleardata = getHFSystemClearingAmount(start, end);
if (syscleardata != null && syscleardata.size() > 0) {
record.put("sys_pay_fee", syscleardata.getBigDecimal("sys_pay_fee"));
record.put("sys_refund_fee", syscleardata.getBigDecimal("sys_refund_fee"));
record.put("sys_net_fee", syscleardata.getBigDecimal("sys_net_fee"));
record.put("sys_surcharge", syscleardata.getBigDecimal("sys_surcharge"));
record.put("sys_settlement_fee", syscleardata.getBigDecimal("sys_settle_fee"));
}
record.put("pay_fee", BigDecimal.ZERO);
record.put("refund_fee", BigDecimal.ZERO);
record.put("net_fee", hfSettle.getBigDecimal("orderAmount"));
record.put("settlement_fee", hfSettle.getBigDecimal("clearingAmount"));
record.put("surcharge", hfSettle.getBigDecimal("surcharge"));
record.put("unsettle_fee", BigDecimal.ZERO);
List<JSONObject> check = null;
try {
check = platformSettlementMapper.findBySettleDate(DateUtils.parseDate(end, "yyyy-MM-dd"), "hf");
} catch (ParseException e) {
e.printStackTrace();
}
if (CollectionUtils.isNotEmpty(check)) {
record.put("log_id", check.get(0).getString("log_id"));
platformSettlementMapper.update(record);
} else {
platformSettlementMapper.save(record);
}
logger.info("汇付清算记录查询完成");
}
private JSONObject handleHFSettleFile(String fileId) {
try {
HttpRequestGenerator gen = new HttpRequestGenerator(attachmentClient.getFileUrl(fileId), RequestMethod.GET);
HSSFWorkbook workbook = new HSSFWorkbook(gen.execute().getResponseContentStream());
HSSFSheet sheet = workbook.getSheetAt(0);
Iterator<Row> rowIterator = sheet.rowIterator();
Row row = null;
Cell cell = null;
// 跳过第一行
rowIterator.next();
JSONObject result = new JSONObject();
BigDecimal orderAmount = BigDecimal.ZERO;
BigDecimal surcharge = BigDecimal.ZERO;
BigDecimal clearingAmount = BigDecimal.ZERO;
while (rowIterator.hasNext()) {
row = rowIterator.next();
cell = row.getCell(0);
if (cell != null) {
continue;
}
cell = row.getCell(15);
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
if (cell != null) {
String orderAmountStr = cell.getStringCellValue().trim();
if (StringUtils.isNotEmpty(orderAmountStr)) {
result.put("orderAmount", new BigDecimal(orderAmountStr));
}
}
cell = row.getCell(16);
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
if (cell != null) {
String surchargeStr = cell.getStringCellValue().trim();
if (StringUtils.isNotEmpty(surchargeStr)) {
result.put("surcharge", new BigDecimal(surchargeStr));
}
}
cell = row.getCell(17);
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
if (cell != null) {
String clearingAmounStr = cell.getStringCellValue().trim();
if (StringUtils.isNotEmpty(clearingAmounStr)) {
result.put("clearingAmount", new BigDecimal(clearingAmounStr));
}
}
}
return result;
} catch (Exception e) {
logger.debug("处理汇付清算文件出错", e);
}
return null;
}
private JSONObject getHFSystemClearingAmount(String start, String end) {
JSONObject result = new JSONObject();
try {
JSONObject creditLogs = platformSettlementMapper.calculateSysSettleLog(start, end, "hf", "Credit", new BigDecimal(0.008));
result.put("sys_pay_fee", creditLogs.getBigDecimal("aud_amount"));
JSONObject debitLogs = platformSettlementMapper.calculateSysSettleLog(start, end, "hf", "Debit", new BigDecimal(0.008));
result.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start, end, "hf", new BigDecimal(0.008)));
result.put("sys_refund_fee", debitLogs.getBigDecimal("aud_amount"));
result.put("sys_net_fee", creditLogs.getBigDecimal("aud_amount").subtract(debitLogs.getBigDecimal("aud_amount")));
result.put("sys_settle_fee", result.getBigDecimal("sys_net_fee").subtract(result.getBigDecimal("sys_surcharge")));
return result;
} catch (Exception ignore) {
ignore.printStackTrace();
}
return null;
}
} }

@ -17,7 +17,7 @@ import java.util.List;
@Service @Service
public class PlatformRevenueImpl implements PlatformRevenueService { public class PlatformRevenueImpl implements PlatformRevenueService {
private org.slf4j.Logger logger = LoggerFactory.getLogger(getClass()); private org.slf4j.Logger logger = LoggerFactory.getLogger(getClass());
String[] channelArr = { "Wechat", "Alipay", "Bestpay" }; String[] channelArr = { "Wechat", "Alipay" };
@Resource @Resource
private ClearingLogMapper clearingLogMapper; private ClearingLogMapper clearingLogMapper;

@ -4,19 +4,11 @@ import au.com.royalpay.payment.manage.analysis.core.PlatformClearService;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.pos.datasource.ReadOnlyConnection; import au.com.royalpay.payment.manage.pos.datasource.ReadOnlyConnection;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.ParseException;
@RestController @RestController
@RequestMapping(value = "/platform/analysis") @RequestMapping(value = "/platform/analysis")
@ -49,8 +41,4 @@ public class PlatformClearAController {
platformClearService.generateSettleLogs(); platformClearService.generateSettleLogs();
} }
@ManagerMapping(value = "/generate/hf/settle", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.DEVELOPER})
public void generatehfSettleLogs(@RequestBody JSONObject param) {
platformClearService.doVerifyHFSettleLog(param);
}
} }

@ -0,0 +1,28 @@
package au.com.royalpay.payment.manage.appclient.beans;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotEmpty;
/**
* @author taylor.dang
* @date 2020-04-20 21:26
*/
@Getter
@Setter
public class AppleLoginBean {
@JSONField(name = "identityToken")
@NotEmpty
private String identityToken;
@JSONField(name = "user")
@NotEmpty
private String user;
@JSONField(name = "devId")
@NotEmpty
private String devId;
@JSONField(name = "authorizationCode")
@NotEmpty
private String authorizationCode;
}

@ -1,9 +1,6 @@
package au.com.royalpay.payment.manage.appclient.core; package au.com.royalpay.payment.manage.appclient.core;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; import au.com.royalpay.payment.manage.appclient.beans.*;
import au.com.royalpay.payment.manage.appclient.beans.AppPaymentConfigBean;
import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean;
import au.com.royalpay.payment.manage.appclient.beans.RetailAppMessage;
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo; import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientKycFilesInfo; import au.com.royalpay.payment.manage.merchants.beans.ClientKycFilesInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientUpdateInfo; import au.com.royalpay.payment.manage.merchants.beans.ClientUpdateInfo;
@ -201,6 +198,8 @@ public interface RetailAppService {
void updateLoginClientAccountPhone(JSONObject account,String contactPhone, String nationCode); void updateLoginClientAccountPhone(JSONObject account,String contactPhone, String nationCode);
void updateLoginClientAccountOpenId(JSONObject client,JSONObject params); void updateLoginClientAccountOpenId(JSONObject client,JSONObject params);
void updateLoginClientAccountAppleId(JSONObject client,JSONObject params);
/** /**
* 退 * 退
*/ */
@ -251,6 +250,10 @@ public interface RetailAppService {
JSONObject bindAccountWechat(JSONObject device, JSONObject params); JSONObject bindAccountWechat(JSONObject device, JSONObject params);
JSONObject unbindAccountApple(JSONObject device);
JSONObject bindAccountApple(JSONObject device, AppleLoginBean appleLoginBean);
JSONObject getAccountBindInfos(JSONObject device); JSONObject getAccountBindInfos(JSONObject device);
JSONObject postAppMessage(JSONObject device, RetailAppMessage message); JSONObject postAppMessage(JSONObject device, RetailAppMessage message);

@ -6,10 +6,7 @@ import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.manage.activities.app_index.core.AppActService; import au.com.royalpay.payment.manage.activities.app_index.core.AppActService;
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper; import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper; import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; import au.com.royalpay.payment.manage.appclient.beans.*;
import au.com.royalpay.payment.manage.appclient.beans.AppPaymentConfigBean;
import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean;
import au.com.royalpay.payment.manage.appclient.beans.RetailAppMessage;
import au.com.royalpay.payment.manage.appclient.core.RetailAppService; import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
import au.com.royalpay.payment.manage.appclient.extend.GatewayOAuthRegister; import au.com.royalpay.payment.manage.appclient.extend.GatewayOAuthRegister;
import au.com.royalpay.payment.manage.cashback.core.CashbackService; import au.com.royalpay.payment.manage.cashback.core.CashbackService;
@ -73,6 +70,8 @@ import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor; import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor;
import au.com.royalpay.payment.tools.utils.*; import au.com.royalpay.payment.tools.utils.*;
import au.com.royalpay.payment.tools.utils.apple.AppleAuthUtils;
import au.com.royalpay.payment.tools.utils.apple.UserClaim;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -290,6 +289,12 @@ public class RetailAppServiceImp implements RetailAppService {
res.put("rate", paymentApi.channelApi("Wechat").queryExchangeRateDecimal(clientId)); res.put("rate", paymentApi.channelApi("Wechat").queryExchangeRateDecimal(clientId));
res.put("alipay_rate", paymentApi.channelApi("Alipay").queryExchangeRateDecimal(clientId)); res.put("alipay_rate", paymentApi.channelApi("Alipay").queryExchangeRateDecimal(clientId));
} }
params.put("channel", "system");
res.put("sys_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)).setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
params.put("channel", "rpaypmt_card");
res.put("rpaypmt_card_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)).setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
params.put("channel", "rpaypmt_dd");
res.put("rpaypmt_dd_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)).setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
return res; return res;
} }
@ -1660,7 +1665,6 @@ public class RetailAppServiceImp implements RetailAppService {
channels[0] = getChannel(clientId, now, "Wechat"); channels[0] = getChannel(clientId, now, "Wechat");
channels[1] = getChannel(clientId, now, "Alipay"); channels[1] = getChannel(clientId, now, "Alipay");
channels[2] = getChannel(clientId, now, "Bestpay");
res.put("channels", channels); res.put("channels", channels);
return res; return res;
@ -1777,12 +1781,11 @@ public class RetailAppServiceImp implements RetailAppService {
List<JSONObject> newActs = new ArrayList<>(); List<JSONObject> newActs = new ArrayList<>();
for (JSONObject act : JSON.parseArray(acts.toJSONString(), JSONObject.class)) { for (JSONObject act : JSON.parseArray(acts.toJSONString(), JSONObject.class)) {
if (act.getString("page_desc") != null && !act.getString("page_desc").equals("0")) { if (act.getString("page_desc") != null && !act.getString("page_desc").equals("0")) {
logger.info("app get banner{}-{}", device.getIntValue("client_id"), act.toJSONString());
if (StringUtils.equalsIgnoreCase(act.getString("page_keywords"), "RYCBSM")) { if (StringUtils.equalsIgnoreCase(act.getString("page_keywords"), "RYCBSM")) {
if (geekShowActVersion(device.getString("version"))) { if (geekShowActVersion(device.getString("version"))) {
newActs.add(act); newActs.add(act);
} }
}else { } else {
newActs.add(act); newActs.add(act);
} }
} }
@ -2322,6 +2325,14 @@ public class RetailAppServiceImp implements RetailAppService {
clientAccountMapper.update(updateAccount); clientAccountMapper.update(updateAccount);
} }
@Override
public void updateLoginClientAccountAppleId(JSONObject account, JSONObject params) {
JSONObject updateAccount = new JSONObject();
updateAccount.put("account_id", account.getString("account_id"));
updateAccount.put("apple_userid", params.getString("apple_userid"));
clientAccountMapper.update(updateAccount);
}
@Override @Override
public JSONObject unbindAccountPhone(JSONObject device, JSONObject params) { public JSONObject unbindAccountPhone(JSONObject device, JSONObject params) {
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(device.getString("account_id"))).get(); String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(device.getString("account_id"))).get();
@ -2379,6 +2390,36 @@ public class RetailAppServiceImp implements RetailAppService {
return result; return result;
} }
@Override
public JSONObject unbindAccountApple(JSONObject device) {
JSONObject account = new JSONObject();
account.put("account_id", device.getString("account_id"));
account.put("apple_userid", null);
clientAccountMapper.update(account);
JSONObject result = new JSONObject();
result.put("status", "success");
return result;
}
@Override
public JSONObject bindAccountApple(JSONObject device, AppleLoginBean appleLoginBean) {
UserClaim userClaim = AppleAuthUtils.verifyIdentifyToken(appleLoginBean.getIdentityToken());
if (!StringUtils.equalsIgnoreCase(userClaim.getSub(), appleLoginBean.getUser())) {
throw new ForbiddenException("apple userinfo is error");
}
JSONObject account = clientAccountMapper.findByAppleUserId(userClaim.getSub());
if (account != null) {
throw new BadRequestException("Apple UserID has been bound to other accounts, please unbind it before binding");
}
JSONObject updateAccount = new JSONObject();
updateAccount.put("account_id", device.getString("account_id"));
updateAccount.put("apple_userid", userClaim.getSub());
clientAccountMapper.update(updateAccount);
JSONObject result = new JSONObject();
result.put("status", "success");
return result;
}
@Override @Override
public JSONObject getAccountBindInfos(JSONObject device) { public JSONObject getAccountBindInfos(JSONObject device) {
JSONObject account = clientAccountMapper.findById(device.getString("account_id")); JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
@ -2391,6 +2432,7 @@ public class RetailAppServiceImp implements RetailAppService {
result.put("nation_code", account.getString("nation_code")); result.put("nation_code", account.getString("nation_code"));
} }
result.put("wechat_bind_status", account.containsKey("wx_unionid")); result.put("wechat_bind_status", account.containsKey("wx_unionid"));
result.put("apple_bind_status", account.containsKey("apple_userid"));
if (account.containsKey("wx_unionid")) { if (account.containsKey("wx_unionid")) {
result.put("wechat_name", account.getString("wechat_name")); result.put("wechat_name", account.getString("wechat_name"));
} }
@ -2536,7 +2578,7 @@ public class RetailAppServiceImp implements RetailAppService {
} }
JSONObject compliance = clientComplianceCompanyMapper.findFileByClientId(account.getIntValue("client_id")); JSONObject compliance = clientComplianceCompanyMapper.findFileByClientId(account.getIntValue("client_id"));
if (compliance != null) { if (compliance != null) {
if (compliance.getIntValue("status")==0 || compliance.getIntValue("status")==1) { if (compliance.getIntValue("status") == 0 || compliance.getIntValue("status") == 1) {
authFileStatus.put("client_less_file", false); authFileStatus.put("client_less_file", false);
} }
} }
@ -2555,14 +2597,14 @@ public class RetailAppServiceImp implements RetailAppService {
authFileStatus.put("content", messageSource.getMessage("client.auth.file.title", null, RequestEnvironment.getLocale())); authFileStatus.put("content", messageSource.getMessage("client.auth.file.title", null, RequestEnvironment.getLocale()));
List<JSONObject> supplement_array = new ArrayList<>(); List<JSONObject> supplement_array = new ArrayList<>();
JSONObject complianceFilesNotice = complianceFilesNotice(client,account); JSONObject complianceFilesNotice = complianceFilesNotice(client, account);
JSONObject kycFilesNotice = kycFilesNotice(client,account); JSONObject kycFilesNotice = kycFilesNotice(client, account);
if(complianceFilesNotice != null && kycFilesNotice != null){ if (complianceFilesNotice != null && kycFilesNotice != null) {
if( !kycFilesNotice.getBoolean("client_less_file") && !complianceFilesNotice.getBoolean("client_less_file")){ if (!kycFilesNotice.getBoolean("client_less_file") && !complianceFilesNotice.getBoolean("client_less_file")) {
authFileStatus.put("isNeedShowKycAlert",false); authFileStatus.put("isNeedShowKycAlert", false);
}else{ } else {
authFileStatus.put("isNeedShowKycAlert",true); authFileStatus.put("isNeedShowKycAlert", true);
} }
} }
if (PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) { if (PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) {
@ -2652,20 +2694,20 @@ public class RetailAppServiceImp implements RetailAppService {
complianceFilesNotice.put("auth_type", FilesAuthTypeEnum.COMPLIANCE.getAuthType()); complianceFilesNotice.put("auth_type", FilesAuthTypeEnum.COMPLIANCE.getAuthType());
complianceFilesNotice.put("type", messageSource.getMessage("client.auth.file.compliance.type", null, RequestEnvironment.getLocale())); complianceFilesNotice.put("type", messageSource.getMessage("client.auth.file.compliance.type", null, RequestEnvironment.getLocale()));
complianceFilesNotice.put("client_less_file",complianceFileStatus.getBoolean("client_less_file")); complianceFilesNotice.put("client_less_file", complianceFileStatus.getBoolean("client_less_file"));
if(compliance != null){ if (compliance != null) {
if (compliance.getIntValue("status")==0 || compliance.getIntValue("status")==1) { if (compliance.getIntValue("status") == 0 || compliance.getIntValue("status") == 1) {
complianceFilesNotice.put("client_less_file", false); complianceFilesNotice.put("client_less_file", false);
} }
if(complianceFileStatus.getBoolean("client_less_file")){ if (complianceFileStatus.getBoolean("client_less_file")) {
complianceFilesNotice.put("client_refuse_reason",compliance.getString("description")); complianceFilesNotice.put("client_refuse_reason", compliance.getString("description"));
} }
complianceFilesNotice.put("status",compliance.getString("status")); complianceFilesNotice.put("status", compliance.getString("status"));
complianceFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(compliance.getIntValue("status")) ); complianceFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(compliance.getIntValue("status")));
}else if( !complianceFileStatus.getBoolean("client_less_file")){ } else if (!complianceFileStatus.getBoolean("client_less_file")) {
complianceFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(1) ); complianceFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(1));
}else{ } else {
complianceFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(-1) ); complianceFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(-1));
} }
complianceFilesNotice.put("status_type_description", messageSource.getMessage("client.auth.file.status." + complianceFilesNotice.getString("status_type").toLowerCase(), null, RequestEnvironment.getLocale())); complianceFilesNotice.put("status_type_description", messageSource.getMessage("client.auth.file.status." + complianceFilesNotice.getString("status_type").toLowerCase(), null, RequestEnvironment.getLocale()));
return complianceFilesNotice; return complianceFilesNotice;
@ -2683,15 +2725,15 @@ public class RetailAppServiceImp implements RetailAppService {
kycFilesNotice.put("auth_type", FilesAuthTypeEnum.KYC.getAuthType()); kycFilesNotice.put("auth_type", FilesAuthTypeEnum.KYC.getAuthType());
kycFilesNotice.put("type", messageSource.getMessage("client.auth.file.kyc.type", null, RequestEnvironment.getLocale())); kycFilesNotice.put("type", messageSource.getMessage("client.auth.file.kyc.type", null, RequestEnvironment.getLocale()));
kycFilesNotice.put("client_less_file",kycFileStatus.getBoolean("client_less_file")); kycFilesNotice.put("client_less_file", kycFileStatus.getBoolean("client_less_file"));
if(compliance != null){ if (compliance != null) {
if(kycFilesNotice.getBoolean("client_less_file")){ if (kycFilesNotice.getBoolean("client_less_file")) {
kycFilesNotice.put("client_refuse_reason",compliance.getString("description")); kycFilesNotice.put("client_refuse_reason", compliance.getString("description"));
} }
kycFilesNotice.put("status",compliance.getString("status")); kycFilesNotice.put("status", compliance.getString("status"));
kycFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(compliance.getIntValue("status")) ); kycFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(compliance.getIntValue("status")));
}else{ } else {
kycFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(-1) ); kycFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(-1));
} }
kycFilesNotice.put("status_type_description", messageSource.getMessage("client.auth.file.status." + kycFilesNotice.getString("status_type").toLowerCase(), null, RequestEnvironment.getLocale())); kycFilesNotice.put("status_type_description", messageSource.getMessage("client.auth.file.status." + kycFilesNotice.getString("status_type").toLowerCase(), null, RequestEnvironment.getLocale()));
return kycFilesNotice; return kycFilesNotice;
@ -2745,22 +2787,6 @@ public class RetailAppServiceImp implements RetailAppService {
throw new BadRequestException("Merchant Rate Not Configure,Please Contact Customer Service"); throw new BadRequestException("Merchant Rate Not Configure,Please Contact Customer Service");
} }
try {
JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay");
if (bestPayRate != null) {
client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
}
JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd");
if (jdRate != null) {
client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
}
} catch (Exception ignored) {
JSONObject rate = sysConfigRate.getJSONObject("t" + weChatRate.getString("clean_days"));
client.put("bestpay_rate", rate.getBigDecimal("Bestpay").setScale(2, RoundingMode.DOWN));
client.put("jd_rate", rate.getBigDecimal("JDpay").setScale(2, RoundingMode.DOWN));
}
JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id")); JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id"));
if (bankAccount == null || bankAccount.size() <= 0) { if (bankAccount == null || bankAccount.size() <= 0) {
throw new BadRequestException("The Partner's Account is not config!"); throw new BadRequestException("The Partner's Account is not config!");
@ -3055,14 +3081,6 @@ public class RetailAppServiceImp implements RetailAppService {
if (alipay.containsKey("channel")) { if (alipay.containsKey("channel")) {
channels.add(alipay); channels.add(alipay);
} }
JSONObject bestpay = getChannel(clientId, now, "Bestpay");
if (bestpay.containsKey("channel")) {
channels.add(bestpay);
}
JSONObject jd = getChannel(clientId, now, "jd");
if (jd.containsKey("channel")) {
channels.add(jd);
}
JSONObject alipayOnline = getChannel(clientId, now, "AlipayOnline"); JSONObject alipayOnline = getChannel(clientId, now, "AlipayOnline");
if (alipayOnline.containsKey("channel")) { if (alipayOnline.containsKey("channel")) {
channels.add(alipayOnline); channels.add(alipayOnline);
@ -3071,7 +3089,15 @@ public class RetailAppServiceImp implements RetailAppService {
if (cbBankPay.containsKey("channel")) { if (cbBankPay.containsKey("channel")) {
channels.add(cbBankPay); channels.add(cbBankPay);
} }
JSONObject cardPaymentPay = getChannel(clientId, now, "rpaypmt_card");
if (cardPaymentPay.containsKey("channel")) {
channels.add(cardPaymentPay);
}
res.put("channels", channels); res.put("channels", channels);
if (res.containsKey("rate_value")) {
BigDecimal minRate = res.getBigDecimal("rate_value").add(BigDecimal.valueOf(0.01)).setScale(2, RoundingMode.DOWN);
res.put("customer_rage_title", (minRate.toPlainString() + "~" + res.getString("max_customer_surcharge_rate")));
}
return res; return res;
} }
@ -3103,7 +3129,7 @@ public class RetailAppServiceImp implements RetailAppService {
int clientId = account.getIntValue("client_id"); int clientId = account.getIntValue("client_id");
JSONObject displayInfo = actPartnerReadMapper.displayInfo(actId, clientId, accountId); JSONObject displayInfo = actPartnerReadMapper.displayInfo(actId, clientId, accountId);
if (displayInfo == null) { if (displayInfo == null) {
displayInfo = new JSONObject(){{ displayInfo = new JSONObject() {{
put("display_client_id", UUID.randomUUID().toString()); put("display_client_id", UUID.randomUUID().toString());
put("act_id", actId); put("act_id", actId);
put("client_id", clientId); put("client_id", clientId);
@ -3117,7 +3143,7 @@ public class RetailAppServiceImp implements RetailAppService {
int accountDisplayCount = displayInfo.getIntValue("display_count"); int accountDisplayCount = displayInfo.getIntValue("display_count");
if (accountDisplayCount < displayCount) { if (accountDisplayCount < displayCount) {
displayInfo.put("last_read_time", new Date()); displayInfo.put("last_read_time", new Date());
displayInfo.put("display_count", (accountDisplayCount+1)); displayInfo.put("display_count", (accountDisplayCount + 1));
actPartnerReadMapper.update(displayInfo); actPartnerReadMapper.update(displayInfo);
return false; return false;
} }

@ -18,11 +18,11 @@ import au.com.royalpay.payment.tools.encryptalgorithm.SignUtils;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.mappers.CommonIncrementalChannelMapper; import au.com.royalpay.payment.tools.mappers.CommonIncrementalChannelMapper;
import org.apache.commons.codec.binary.Base64;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.Feature; import com.alibaba.fastjson.parser.Feature;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.net.util.Base64;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

@ -3,10 +3,7 @@ package au.com.royalpay.payment.manage.appclient.web;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException; import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.manage.activities.app_index.core.AppActService; import au.com.royalpay.payment.manage.activities.app_index.core.AppActService;
import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelaySettleService; import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelaySettleService;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; import au.com.royalpay.payment.manage.appclient.beans.*;
import au.com.royalpay.payment.manage.appclient.beans.AppPaymentConfigBean;
import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean;
import au.com.royalpay.payment.manage.appclient.beans.RetailAppMessage;
import au.com.royalpay.payment.manage.appclient.core.RetailAppService; import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
import au.com.royalpay.payment.manage.bill.bean.NewBillBean; import au.com.royalpay.payment.manage.bill.bean.NewBillBean;
import au.com.royalpay.payment.manage.bill.bean.QueryBillBean; import au.com.royalpay.payment.manage.bill.bean.QueryBillBean;
@ -206,7 +203,7 @@ public class RetailAppController {
@GetMapping("/notice/unread") @GetMapping("/notice/unread")
public List<JSONObject> latestNotice(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { public List<JSONObject> latestNotice(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getLatestNotice(device,device.getIntValue("client_id")); return retailAppService.getLatestNotice(device, device.getIntValue("client_id"));
} }
/* 消息模块end */ /* 消息模块end */
@ -774,32 +771,53 @@ public class RetailAppController {
* @throws Exception * @throws Exception
*/ */
@PutMapping("/account/phone/unbind") @PutMapping("/account/phone/unbind")
public JSONObject unbindAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params) throws Exception { public JSONObject unbindAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params) throws Exception {
return retailAppService.unbindAccountPhone(device, params); return retailAppService.unbindAccountPhone(device, params);
} }
/** /**
* *
* @param device *
* @param device
* @param params * @param params
*/ */
@PutMapping("/account/wechat/bind") @PutMapping("/account/wechat/bind")
public JSONObject bindAccountWechat(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params){ public JSONObject bindAccountWechat(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params) {
return retailAppService.bindAccountWechat(device,params); return retailAppService.bindAccountWechat(device, params);
} }
/** /**
* *
*
* @param device * @param device
*/ */
@PutMapping("/account/wechat/unbind") @PutMapping("/account/wechat/unbind")
public JSONObject unbindAccountWechat(@ModelAttribute(RETAIL_DEVICE) JSONObject device){ public JSONObject unbindAccountWechat(@ModelAttribute(RETAIL_DEVICE) JSONObject device) {
return retailAppService.unbindAccountWechat(device); return retailAppService.unbindAccountWechat(device);
} }
/**
* Apple
*
* @param device
*/
@PutMapping("/account/apple/bind")
public JSONObject bindAccountApple(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @Valid @RequestBody AppleLoginBean appleLoginBean) {
return retailAppService.bindAccountApple(device, appleLoginBean);
}
/**
* Apple
*
* @param device
*/
@PutMapping("/account/apple/unbind")
public JSONObject unbindAccountApple(@ModelAttribute(RETAIL_DEVICE) JSONObject device) {
return retailAppService.unbindAccountApple(device);
}
/** /**
* 退 * 退
@ -918,9 +936,9 @@ public class RetailAppController {
* @param device * @param device
*/ */
@PostMapping("/client/kyc_auth_file") @PostMapping("/client/kyc_auth_file")
public JSONObject uploadKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestParam MultipartFile file, @RequestParam("fileType") String fileType)throws Exception{ public JSONObject uploadKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestParam MultipartFile file, @RequestParam("fileType") String fileType) throws Exception {
JSONObject fileInfo = attachmentClient.uploadFile(file, false); JSONObject fileInfo = attachmentClient.uploadFile(file, false);
retailAppService.uploadKycAuthFilesForApp(device, fileInfo,fileType); retailAppService.uploadKycAuthFilesForApp(device, fileInfo, fileType);
return fileInfo; return fileInfo;
} }
@ -930,7 +948,7 @@ public class RetailAppController {
* @param device * @param device
*/ */
@PostMapping("/client/auth_file/commit_to_kyc") @PostMapping("/client/auth_file/commit_to_kyc")
public void commitToKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device,@RequestBody JSONObject params) { public void commitToKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params) {
retailAppService.commitAuthFilesToKyc(device, params); retailAppService.commitAuthFilesToKyc(device, params);
} }
@ -960,12 +978,13 @@ public class RetailAppController {
/** /**
* () * ()
*
* @param device * @param device
* @return * @return
*/ */
@GetMapping("/client/account/bind/infos") @GetMapping("/client/account/bind/infos")
public JSONObject findClientAccountBindStatusInfos(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){ public JSONObject findClientAccountBindStatusInfos(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getAccountBindInfos(device); return retailAppService.getAccountBindInfos(device);
} }
} }

@ -1,5 +1,6 @@
package au.com.royalpay.payment.manage.appclient.web; package au.com.royalpay.payment.manage.appclient.web;
import au.com.royalpay.payment.manage.appclient.beans.AppleLoginBean;
import au.com.royalpay.payment.manage.appclient.beans.RetailLoginInfo; import au.com.royalpay.payment.manage.appclient.beans.RetailLoginInfo;
import au.com.royalpay.payment.manage.appclient.core.ManageAppService; import au.com.royalpay.payment.manage.appclient.core.ManageAppService;
import au.com.royalpay.payment.manage.appclient.core.RetailAppService; import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
@ -138,6 +139,35 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
return res; return res;
} }
@PostMapping("/apple_signin")
public JSONObject mchAppleSignIn(@Valid @RequestBody AppleLoginBean appleLoginBean) {
return signInStatusManager.mchAppleSignIn(appleLoginBean);
}
/**
*
*
* @param params
* @return
*/
@PostMapping("/login/apple_bind")
public JSONObject appleLoginBind(@RequestBody JSONObject params) {
LoginInfo loginInfo = new LoginInfo();
loginInfo.setLoginId(params.getString("loginId"));
loginInfo.setPassword(params.getString("password"));
String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo, "apple");
JSONObject account = signInStatusManager.getCurrentClient(signKey);
retailAppService.updateLoginClientAccountAppleId(account, params);
account = JSON.parseObject(account.toJSONString());
JSONObject result = new JSONObject();
account.put("sign_key", signKey);
result.put("account", account);
result.put("bind_status", true);
result.put("status", "success");
this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat"));
return result;
}
@GetMapping("/captcha") @GetMapping("/captcha")
public JSONObject getCaptchaForDevice(@RequestParam(defaultValue = "false") boolean imgurl) throws IOException { public JSONObject getCaptchaForDevice(@RequestParam(defaultValue = "false") boolean imgurl) throws IOException {
String capText = RandomStringUtils.random(4, false, true); String capText = RandomStringUtils.random(4, false, true);
@ -186,9 +216,9 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
@PostMapping("/send/{phone_number}/verify_code") @PostMapping("/send/{phone_number}/verify_code")
@ResponseBody @ResponseBody
public JSONObject sendLoginMobileVerifyCode(@PathVariable("phone_number") String phoneNumber, public JSONObject sendLoginMobileVerifyCode(@PathVariable("phone_number") String phoneNumber,
@RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode, @RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode,
HttpServletRequest request) { HttpServletRequest request) {
simpleClientApplyService.getAndSendLoginSmsCode(phoneNumber, nationCode, request); simpleClientApplyService.getAndSendLoginSmsCode(phoneNumber, nationCode, request);
return new JSONObject(); return new JSONObject();
} }
@ -201,58 +231,59 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
*/ */
@PostMapping("/login/verify/{contact_phone}/verify_code") @PostMapping("/login/verify/{contact_phone}/verify_code")
public JSONObject verifyLoginMobileCode(@PathVariable("contact_phone") String contactPhone, public JSONObject verifyLoginMobileCode(@PathVariable("contact_phone") String contactPhone,
@RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode, @RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode,
@RequestBody JSONObject params, @RequestBody JSONObject params,
@ModelAttribute(CommonConsts.MANAGER_DEVICE) JSONObject device, @ModelAttribute(CommonConsts.MANAGER_DEVICE) JSONObject device,
Errors errors) { Errors errors) {
HttpUtils.handleValidErrors(errors); HttpUtils.handleValidErrors(errors);
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
simpleClientApplyService.verifyLoginSMSCode(params.getString("verify_code"), contactPhone); simpleClientApplyService.verifyLoginSMSCode(params.getString("verify_code"), contactPhone);
String signKey = signInStatusManager.getClientInfoByPhoneStatusKey(contactPhone, nationCode); String signKey = signInStatusManager.getClientInfoByPhoneStatusKey(contactPhone, nationCode);
if(signKey!=null){ if (signKey != null) {
JSONObject account = signInStatusManager.getCurrentClient(signKey); JSONObject account = signInStatusManager.getCurrentClient(signKey);
account = JSON.parseObject(account.toJSONString()); account = JSON.parseObject(account.toJSONString());
if (params.getString("devId") != null) { if (params.getString("devId") != null) {
deviceSupport.validDeviceWithClient(account, params.getString("devId")); deviceSupport.validDeviceWithClient(account, params.getString("devId"));
} }
account.put("sign_key", signKey); account.put("sign_key", signKey);
result.put("account",account); result.put("account", account);
result.put("status","success"); result.put("status", "success");
result.put("bind_status", true); result.put("bind_status", true);
this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "MOBILE")); this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "MOBILE"));
}else{ } else {
result.put("status","success"); result.put("status", "success");
result.put("bind_status", false); result.put("bind_status", false);
result.put("contact_phone",contactPhone); result.put("contact_phone", contactPhone);
result.put("nation_code",nationCode); result.put("nation_code", nationCode);
} }
return result; return result;
} }
/** /**
* - * -
*
* @param contactPhone * @param contactPhone
* @param nationCode * @param nationCode
* @param params * @param params
*/ */
@PostMapping("/login/mobile/{contact_phone}/bind") @PostMapping("/login/mobile/{contact_phone}/bind")
public JSONObject mobileLoginBind(@PathVariable("contact_phone")String contactPhone, public JSONObject mobileLoginBind(@PathVariable("contact_phone") String contactPhone,
@RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode, @RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode,
@RequestBody JSONObject params, @RequestBody JSONObject params,
Errors errors){ Errors errors) {
HttpUtils.handleValidErrors(errors); HttpUtils.handleValidErrors(errors);
LoginInfo loginInfo = new LoginInfo(); LoginInfo loginInfo = new LoginInfo();
loginInfo.setLoginId(params.getString("loginId")); loginInfo.setLoginId(params.getString("loginId"));
loginInfo.setPassword(params.getString("password")); loginInfo.setPassword(params.getString("password"));
String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo,"phone"); String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo, "phone");
signInStatusManager.verifyClientLoginPhoneBindCode(contactPhone,nationCode); signInStatusManager.verifyClientLoginPhoneBindCode(contactPhone, nationCode);
JSONObject account = signInStatusManager.getCurrentClient(signKey); JSONObject account = signInStatusManager.getCurrentClient(signKey);
retailAppService.updateLoginClientAccountPhone(account, contactPhone,nationCode); retailAppService.updateLoginClientAccountPhone(account, contactPhone, nationCode);
account.put("sign_key", signKey); account.put("sign_key", signKey);
account = JSON.parseObject(account.toJSONString()); account = JSON.parseObject(account.toJSONString());
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("account",account); result.put("account", account);
result.put("bind_status", true); result.put("bind_status", true);
this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "MOBILE")); this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "MOBILE"));
return result; return result;
@ -260,6 +291,7 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
/** /**
* App * App
*
* @param params * @param params
* @return * @return
*/ */
@ -268,7 +300,7 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
Errors errors) { Errors errors) {
HttpUtils.handleValidErrors(errors); HttpUtils.handleValidErrors(errors);
JSONObject account = signInStatusManager.clientAppWechatSignIn(params.getString("code")); JSONObject account = signInStatusManager.clientAppWechatSignIn(params.getString("code"));
if(!account.getBoolean("bind_status")){ if (!account.getBoolean("bind_status")) {
deviceSupport.validDeviceWithClient(account, params.getString("app_openid")); deviceSupport.validDeviceWithClient(account, params.getString("app_openid"));
return account; return account;
} }
@ -278,26 +310,27 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
/** /**
* *
*
* @param params * @param params
* @return * @return
*/ */
@PostMapping("/login/wechat_bind") @PostMapping("/login/wechat_bind")
public JSONObject wechatLoginBind(@RequestBody JSONObject params){ public JSONObject wechatLoginBind(@RequestBody JSONObject params) {
LoginInfo loginInfo = new LoginInfo(); LoginInfo loginInfo = new LoginInfo();
loginInfo.setLoginId(params.getString("loginId")); loginInfo.setLoginId(params.getString("loginId"));
loginInfo.setPassword(params.getString("password")); loginInfo.setPassword(params.getString("password"));
String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo,"wechat"); String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo, "wechat");
JSONObject wechatInfo = signInStatusManager.verifyClientLoginWechatBindCode(params.getString("wechat_openid")); JSONObject wechatInfo = signInStatusManager.verifyClientLoginWechatBindCode(params.getString("wechat_openid"));
JSONObject account = signInStatusManager.getCurrentClient(signKey); JSONObject account = signInStatusManager.getCurrentClient(signKey);
params.put("nick_name",wechatInfo.getString("nick_name")); params.put("nick_name", wechatInfo.getString("nick_name"));
params.put("union_id",wechatInfo.getString("union_id")); params.put("union_id", wechatInfo.getString("union_id"));
retailAppService.updateLoginClientAccountOpenId(account,params); retailAppService.updateLoginClientAccountOpenId(account, params);
account = JSON.parseObject(account.toJSONString()); account = JSON.parseObject(account.toJSONString());
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
account.put("sign_key", signKey); account.put("sign_key", signKey);
result.put("account",account); result.put("account", account);
result.put("bind_status", true); result.put("bind_status", true);
result.put("status","success"); result.put("status", "success");
this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat")); this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat"));
return result; return result;
} }

@ -338,8 +338,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
apply.put("alipay_rate",rate.getString("Alipay")); apply.put("alipay_rate",rate.getString("Alipay"));
apply.put("alipay_online_rate",rate.getString("AlipayOnline")); apply.put("alipay_online_rate",rate.getString("AlipayOnline"));
apply.put("cbbank_rate",rate.getString("CB_Bankpay")); apply.put("cbbank_rate",rate.getString("CB_Bankpay"));
apply.put("bestpay_rate",rate.getString("Bestpay"));
apply.put("jd_rate",rate.getString("JDpay"));
JSONObject bankInfo = getBankInfo(apply.getString("bsb_no")); JSONObject bankInfo = getBankInfo(apply.getString("bsb_no"));
apply.put("bank", bankInfo.getString("bank")); apply.put("bank", bankInfo.getString("bank"));
@ -506,8 +504,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
apply.put("alipay_rate",rate.getString("Alipay")); apply.put("alipay_rate",rate.getString("Alipay"));
apply.put("alipay_online_rate",rate.getString("AlipayOnline")); apply.put("alipay_online_rate",rate.getString("AlipayOnline"));
apply.put("cbbank_rate",rate.getString("CB_Bankpay")); apply.put("cbbank_rate",rate.getString("CB_Bankpay"));
apply.put("bestpay_rate",rate.getString("Bestpay"));
apply.put("jd_rate",rate.getString("JDpay"));
JSONObject bankInfo = getBankInfo(apply.getString("bsb_no")); JSONObject bankInfo = getBankInfo(apply.getString("bsb_no"));
apply.put("bank", bankInfo.getString("bank")); apply.put("bank", bankInfo.getString("bank"));
@ -759,8 +755,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
configNewClientRate(sysRate, clientId, "Wechat", "Wechat"); configNewClientRate(sysRate, clientId, "Wechat", "Wechat");
configNewClientRate(sysRate, clientId, "Alipay", "Alipay"); configNewClientRate(sysRate, clientId, "Alipay", "Alipay");
configNewClientRate(sysRate, clientId, "AlipayOnline", "AlipayOnline"); configNewClientRate(sysRate, clientId, "AlipayOnline", "AlipayOnline");
configNewClientRate(sysRate, clientId, "Bestpay", "Bestpay");
configNewClientRate(sysRate, clientId, "jd", "JDpay");
configNewClientRate(sysRate, clientId, "CB_BankPay", "CB_Bankpay"); configNewClientRate(sysRate, clientId, "CB_BankPay", "CB_Bankpay");
Runnable task2 = () -> { Runnable task2 = () -> {
try { try {

@ -42,9 +42,7 @@ public class ContentController {
model.addAttribute("wechat_rate", contractInfo.getString("wechat_rate")); model.addAttribute("wechat_rate", contractInfo.getString("wechat_rate"));
model.addAttribute("cbbank_rate", contractInfo.getString("cbbank_rate")); model.addAttribute("cbbank_rate", contractInfo.getString("cbbank_rate"));
model.addAttribute("alipay_online_rate", contractInfo.getString("alipay_online_rate")); model.addAttribute("alipay_online_rate", contractInfo.getString("alipay_online_rate"));
model.addAttribute("bestpay_rate", contractInfo.getString("bestpay_rate"));
model.addAttribute("alipay_rate", contractInfo.getString("alipay_rate")); model.addAttribute("alipay_rate", contractInfo.getString("alipay_rate"));
model.addAttribute("jd_rate", contractInfo.getString("jd_rate"));
return "contract_for_compliance"; return "contract_for_compliance";
} }

@ -1,61 +0,0 @@
package au.com.royalpay.payment.manage.apps.events.listeners;
import au.com.royalpay.payment.core.events.AfterPaymentFinishEvent;
import au.com.royalpay.payment.manage.customers.core.CustomerPaymentInfoService;
import au.com.royalpay.payment.manage.mappers.system.SysCustomerPaymentInfoMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* Created by wangning on 17/01/2018.
*/
@Service
public class AfterPaymentFinishListener implements ApplicationListener<AfterPaymentFinishEvent> {
@Resource
private SysCustomerPaymentInfoMapper sysCustomerPaymentInfoMapper;
@Resource
private CustomerPaymentInfoService customerPaymentInfoService;
@Resource
private ClientManager clientManager;
@Override
public void onApplicationEvent(AfterPaymentFinishEvent event) {
JSONObject order = event.getFinishedEvent().getOrder();
if(!"hf".equals(order.getString("channel"))&&!"Yeepay".equals(order.getString("channel"))){
return;
}
switch (order.getString("channel")){
case "hf":
if(StringUtils.isEmpty(order.getString("ext_params"))){
return;
}
JSONObject extParam = JSONObject.parseObject(order.getString("ext_params"));
JSONObject orderInfo = sysCustomerPaymentInfoMapper.selectPaymentInfo(order.getString("customer_id"));
if (orderInfo != null) {
orderInfo.put("idcard_name", extParam.getString("payer_name"));
orderInfo.put("idcard_no", extParam.getString("payer_identity_card"));
orderInfo.put("bankcard", extParam.getString("card_number"));
orderInfo.put("bank", extParam.getString("bankId"));
sysCustomerPaymentInfoMapper.update(orderInfo);
}else {
JSONObject lastOrderInfo = new JSONObject();
lastOrderInfo.put("wechat_openid", order.getString("customer_id"));
lastOrderInfo.put("idcard_name", extParam.getString("payer_name"));
lastOrderInfo.put("idcard_no", extParam.getString("payer_identity_card"));
lastOrderInfo.put("bankcard", extParam.getString("card_number"));
lastOrderInfo.put("bank", extParam.getString("bankId"));
customerPaymentInfoService.save(lastOrderInfo);
}
clientManager.sendHfEmailNotice(order);
return;
case "Yeepay":
clientManager.sendGatewayEmailNotice(order);
return;
}
}
}

@ -81,7 +81,7 @@ public class BDPrizeServiceImpl implements BDPrizeService {
private static BigDecimal percent = new BigDecimal(100); private static BigDecimal percent = new BigDecimal(100);
private static String[] channels = new String[]{"Wechat", "Alipay", "Bestpay", "jd", "AlipayOnline","hf", "Rpay","Yeepay","LakalaPay", "rpaypmt_card", "rpaypmt_dd"}; private static String[] channels = new String[]{"Wechat", "Alipay","AlipayOnline", "Rpay","rpaypmt_card", "rpaypmt_dd"};
private static Logger logger = LoggerFactory.getLogger(BDPrizeServiceImpl.class); private static Logger logger = LoggerFactory.getLogger(BDPrizeServiceImpl.class);
@Override @Override
@ -463,17 +463,17 @@ public class BDPrizeServiceImpl implements BDPrizeService {
} }
if (config.getString("bc_config_id") != null && !"".equals(config.getString("bc_config_id"))) { if (config.getString("bc_config_id") != null && !"".equals(config.getString("bc_config_id"))) {
config.put("LAST_UPDATE_DATE", new Date()); config.put("last_update_date", new Date());
config.put("LAST_UPDATE_BY", manager.getString("display_name")); config.put("last_update_by", manager.getString("display_name"));
financialBDCommissionConfigMapper.updateCommissionConfig(config); financialBDCommissionConfigMapper.updateCommissionConfig(config);
} else { } else {
String[] firLasDay = getMonthFisrtLastDay(month); String[] firLasDay = getMonthFisrtLastDay(month);
config.put("START_DATE", firLasDay[0]); config.put("start_date", firLasDay[0]);
config.put("END_DATE", firLasDay[1]); config.put("end_date", firLasDay[1]);
config.put("CREATION_DATE", new Date()); config.put("creation_date", new Date());
config.put("CREATION_BY", manager.getString("display_name")); config.put("creation_by", manager.getString("display_name"));
config.put("LAST_UPDATE_DATE", new Date()); config.put("last_update_date", new Date());
config.put("LAST_UPDATE_BY", manager.getString("display_name")); config.put("last_update_by", manager.getString("display_name"));
financialBDCommissionConfigMapper.insertCommissionConfig(config); financialBDCommissionConfigMapper.insertCommissionConfig(config);
} }
} }
@ -501,8 +501,8 @@ public class BDPrizeServiceImpl implements BDPrizeService {
@Override @Override
public void updateBdKpiConfig(List<JSONObject> configs, JSONObject manager) throws ParseException { public void updateBdKpiConfig(List<JSONObject> configs, JSONObject manager) throws ParseException {
for (JSONObject config : configs){ for (JSONObject config : configs){
config.put("LAST_UPDATE_DATE", new Date()); config.put("last_update_date", new Date());
config.put("LAST_UPDATE_BY", manager.getString("display_name")); config.put("last_update_by", manager.getString("display_name"));
financialBDConfigMapper.updateBDConfig(config); financialBDConfigMapper.updateBDConfig(config);
} }
} }

@ -62,10 +62,6 @@ public class AgentCommissionAnalysis {
orgCharge = grossAmount.multiply(org.getBigDecimal("wechat_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)); orgCharge = grossAmount.multiply(org.getBigDecimal("wechat_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP));
orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("wechat_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP))); orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("wechat_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)));
break; break;
case "jd":
orgCharge = grossAmount.multiply(org.getBigDecimal("jd_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP));
orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("jd_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)));
break;
case "alipayonline": case "alipayonline":
orgCharge = grossAmount.multiply(org.getBigDecimal("alipayonline_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)); orgCharge = grossAmount.multiply(org.getBigDecimal("alipayonline_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP));
orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("alipayonline_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP))); orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("alipayonline_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)));
@ -143,4 +139,4 @@ public class AgentCommissionAnalysis {
} }
return list; return list;
} }
} }

@ -222,9 +222,6 @@ public class CityPartnerCommissionAnalysis {
case "wechat": case "wechat":
thirdPartyPaymentCharge = total.multiply(wechatChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); thirdPartyPaymentCharge = total.multiply(wechatChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP);
break; break;
case "jd":
thirdPartyPaymentCharge = total.multiply(jdChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP);
break;
case "alipayonline": case "alipayonline":
thirdPartyPaymentCharge = total.multiply(alipayonlineChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); thirdPartyPaymentCharge = total.multiply(alipayonlineChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP);
break; break;

@ -226,9 +226,6 @@ public class CityPartnerSeniorCommissionAnalysis {
case "wechat": case "wechat":
thirdPartyPaymentCharge = total.multiply(wechatChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); thirdPartyPaymentCharge = total.multiply(wechatChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP);
break; break;
case "jd":
thirdPartyPaymentCharge = total.multiply(jdChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP);
break;
case "alipayonline": case "alipayonline":
thirdPartyPaymentCharge = total.multiply(alipayonlineChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); thirdPartyPaymentCharge = total.multiply(alipayonlineChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP);
break; break;

@ -1,88 +1,39 @@
package au.com.royalpay.payment.manage.citypartner.core.impls; package au.com.royalpay.payment.manage.citypartner.core.impls;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.swing.plaf.basic.BasicScrollPaneUI;
import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONObject;
import au.com.royalpay.payment.manage.citypartner.beans.AgentCommissionAnalysis; import au.com.royalpay.payment.manage.citypartner.beans.AgentCommissionAnalysis;
import au.com.royalpay.payment.manage.citypartner.beans.CityPartnerCommissionAnalysis; import au.com.royalpay.payment.manage.citypartner.beans.CityPartnerCommissionAnalysis;
import au.com.royalpay.payment.manage.citypartner.beans.ReferrerCommissionAnalysis; import au.com.royalpay.payment.manage.citypartner.beans.ReferrerCommissionAnalysis;
import au.com.royalpay.payment.manage.citypartner.core.CityPartnerPrizeService; import au.com.royalpay.payment.manage.citypartner.core.CityPartnerPrizeService;
import au.com.royalpay.payment.manage.mappers.financial.FinancialAgentCommissionDetailMapper; import au.com.royalpay.payment.manage.mappers.financial.*;
import au.com.royalpay.payment.manage.mappers.financial.FinancialAgentCommissionMapper;
import au.com.royalpay.payment.manage.mappers.financial.FinancialPartnerCommissionDetailMapper;
import au.com.royalpay.payment.manage.mappers.financial.FinancialPartnerCommissionMapper;
import au.com.royalpay.payment.manage.mappers.financial.FinancialReferrerCommissionDetailMapper;
import au.com.royalpay.payment.manage.mappers.financial.FinancialReferrerCommissionMapper;
import au.com.royalpay.payment.manage.mappers.financial.FinancialSeniorPartnerCommissionDetailMapper;
import au.com.royalpay.payment.manage.mappers.financial.FinancialSeniorPartnerCommissionMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper; import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Calendar; import java.util.stream.Collectors;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
/** /**
* Created by yixian on 2017-03-08. * Created by yixian on 2017-03-08.
@ -333,8 +284,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
HashMap<String, String> channelMap = new HashMap<>(); HashMap<String, String> channelMap = new HashMap<>();
channelMap.put("Alipay", "Alipay"); channelMap.put("Alipay", "Alipay");
channelMap.put("Wechat", "Wechat"); channelMap.put("Wechat", "Wechat");
channelMap.put("Bestpay", "Bestpay");
channelMap.put("jd", "jd");
channelMap.put("AlipayOnline", "AlipayOnline"); channelMap.put("AlipayOnline", "AlipayOnline");
Set<Integer> orgIds = new HashSet<>(); Set<Integer> orgIds = new HashSet<>();
List<JSONObject> transactionAnalysis = transactionMapper.listTransactionsForCityPartnerCommission(year, month); List<JSONObject> transactionAnalysis = transactionMapper.listTransactionsForCityPartnerCommission(year, month);
@ -476,22 +425,22 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
BigDecimal total_surage = BigDecimal.ZERO; BigDecimal total_surage = BigDecimal.ZERO;
BigDecimal net_surage = BigDecimal.ZERO; BigDecimal net_surage = BigDecimal.ZERO;
BigDecimal royalpay_surage = BigDecimal.ZERO; BigDecimal royalpay_surage = BigDecimal.ZERO;
BigDecimal transaction_fee = BigDecimal.ZERO;
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
String channel = oneChannel.getKey(); String channel = oneChannel.getKey();
if ("hf".equals(oneChannel.getKey().toLowerCase()) || "yeepay".equals(oneChannel.getKey().toLowerCase()) || "lakalapay".equals(oneChannel.getKey().toLowerCase())) { if (orgInfo.get(channel.toLowerCase() + "_rate_value") == null) {
channel = "cb_bankpay"; throw new ServerErrorException(orgInfo.getString("name") + "组织下" + oneChannel.getKey() + "成本手续费未设置");
if (orgInfo.get("cb_bankpay_rate_value") == null) {
throw new ServerErrorException(orgInfo.getString("name") + "组织下" + "cbbankpay" + "成本手续费未设置");
}
} else {
if (orgInfo.get(channel.toLowerCase() + "_rate_value") == null) {
throw new ServerErrorException(orgInfo.getString("name") + "组织下" + oneChannel.getKey() + "成本手续费未设置");
}
} }
for (JSONObject params : oneChannel.getValue()) { for (JSONObject params : oneChannel.getValue()) {
BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : params.getBigDecimal("clearing_amount"); BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : params.getBigDecimal("clearing_amount");
BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN));
BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); //增加transaction_fee为null异常
if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) {
params.put("transaction_fee", BigDecimal.ZERO);
}
BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge")
.subtract(params.getBigDecimal("surcharge_cashback"))
.subtract(params.getBigDecimal("transaction_fee"));
//增加货币判断 //增加货币判断
int i = currencyScale(params.getString("clearing_currency")); int i = currencyScale(params.getString("clearing_currency"));
total = total.add(tmpClearingAmount); total = total.add(tmpClearingAmount);
@ -499,11 +448,13 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
royalpay_surage = royalpay_surage.add(tmpClearingAmount.multiply(channelRate).setScale(i, RoundingMode.HALF_UP)); royalpay_surage = royalpay_surage.add(tmpClearingAmount.multiply(channelRate).setScale(i, RoundingMode.HALF_UP));
// net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge)); // net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge));
net_surage = net_surage.add(params.getBigDecimal("channel_surcharge")); net_surage = net_surage.add(params.getBigDecimal("channel_surcharge"));
transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee"));
} }
BigDecimal org_charge = total_surage.subtract(royalpay_surage); BigDecimal org_charge = total_surage.subtract(royalpay_surage);
json.put("channel", oneChannel.getKey()); json.put("channel", oneChannel.getKey());
json.put("gross_amount", total); json.put("gross_amount", total);
json.put("total_charge", total_surage); json.put("total_charge", total_surage);
json.put("transaction_fee", transaction_fee);
json.put("net_charge", net_surage); json.put("net_charge", net_surage);
json.put("org_rate", orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value")); json.put("org_rate", orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value"));
json.put("royalpay_charge", royalpay_surage); json.put("royalpay_charge", royalpay_surage);
@ -525,16 +476,19 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
BigDecimal net_surage = BigDecimal.ZERO; BigDecimal net_surage = BigDecimal.ZERO;
BigDecimal royalpay_surage = BigDecimal.ZERO; BigDecimal royalpay_surage = BigDecimal.ZERO;
BigDecimal share_surage = BigDecimal.ZERO; BigDecimal share_surage = BigDecimal.ZERO;
BigDecimal transaction_fee = BigDecimal.ZERO;
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
String channel = oneChannel.getKey(); String channel = oneChannel.getKey();
if ("hf".equals(oneChannel.getKey().toLowerCase()) || "yeepay".equals(oneChannel.getKey().toLowerCase()) || "lakalapay".equals(oneChannel.getKey().toLowerCase())) {
channel = "cb_bankpay";
}
for (JSONObject params : oneChannel.getValue()) { for (JSONObject params : oneChannel.getValue()) {
BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : params.getBigDecimal("clearing_amount"); BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : params.getBigDecimal("clearing_amount");
BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN));
BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); //增加transaction_fee为null异常
if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) {
params.put("transaction_fee", BigDecimal.ZERO);
}
BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge")
.subtract(params.getBigDecimal("surcharge_cashback"))
.subtract(params.getBigDecimal("transaction_fee"));
//增加货币判断 //增加货币判断
int i = currencyScale(params.getString("clearing_currency")); int i = currencyScale(params.getString("clearing_currency"));
BigDecimal parent_surage = tmpClearingAmount.multiply(parentOrgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(i, RoundingMode.HALF_UP); BigDecimal parent_surage = tmpClearingAmount.multiply(parentOrgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(i, RoundingMode.HALF_UP);
@ -545,6 +499,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
//net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge)); //net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge));
net_surage = net_surage.add(params.getBigDecimal("channel_surcharge")); net_surage = net_surage.add(params.getBigDecimal("channel_surcharge"));
share_surage = share_surage.add(roy_surage.subtract(parent_surage)).setScale(i, RoundingMode.HALF_UP); share_surage = share_surage.add(roy_surage.subtract(parent_surage)).setScale(i, RoundingMode.HALF_UP);
transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee"));
} }
BigDecimal org_charge = total_surage.subtract(royalpay_surage); BigDecimal org_charge = total_surage.subtract(royalpay_surage);
@ -556,6 +511,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
json.put("partner_charge", royalpay_surage); json.put("partner_charge", royalpay_surage);
json.put("share_charge", share_surage); json.put("share_charge", share_surage);
json.put("org_charge", org_charge); json.put("org_charge", org_charge);
json.put("transaction_fee", transaction_fee);
json.put("commission_type", "1"); json.put("commission_type", "1");
json.put("create_time", new Date()); json.put("create_time", new Date());
amountByChannel.add(json); amountByChannel.add(json);
@ -579,15 +535,12 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
BigDecimal total_surage = BigDecimal.ZERO; BigDecimal total_surage = BigDecimal.ZERO;
BigDecimal net_surage = BigDecimal.ZERO; BigDecimal net_surage = BigDecimal.ZERO;
BigDecimal royalpay_surage = BigDecimal.ZERO; BigDecimal royalpay_surage = BigDecimal.ZERO;
BigDecimal transaction_fee = BigDecimal.ZERO;
Date datefrom = new Date(); Date datefrom = new Date();
Date dateto = new Date(); Date dateto = new Date();
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
String channel = oneChannel.getKey(); String channel = oneChannel.getKey();
String rateChannel = oneChannel.getKey(); String rateChannel = oneChannel.getKey();
if ("hf".equals(oneChannel.getKey().toLowerCase()) || "yeepay".equals(oneChannel.getKey().toLowerCase()) || "lakalapay".equals(oneChannel.getKey().toLowerCase())) {
channel = "cb_bankpay";
rateChannel = "CB_BankPay";
}
JSONObject clientRate = null; JSONObject clientRate = null;
try { try {
clientRate = merchantInfoProvider.clientCurrentRate(clientId, oneChannel.getValue().get(0).getDate("transaction_time"), clientRate = merchantInfoProvider.clientCurrentRate(clientId, oneChannel.getValue().get(0).getDate("transaction_time"),
@ -599,6 +552,10 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN));
BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback"));
//增加货币判断 //增加货币判断
//增加transaction_fee为null异常
if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) {
params.put("transaction_fee", BigDecimal.ZERO);
}
int i = currencyScale(params.getString("clearing_currency")); int i = currencyScale(params.getString("clearing_currency"));
if (total.compareTo(BigDecimal.ZERO) == 0) { if (total.compareTo(BigDecimal.ZERO) == 0) {
datefrom = params.getDate("transaction_time"); datefrom = params.getDate("transaction_time");
@ -617,6 +574,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
royalpay_surage = royalpay_surage.add(tmpClearingAmount.multiply(channelRate).setScale(i, RoundingMode.HALF_UP)); royalpay_surage = royalpay_surage.add(tmpClearingAmount.multiply(channelRate).setScale(i, RoundingMode.HALF_UP));
//net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge)); //net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge));
net_surage = net_surage.add(params.getBigDecimal("channel_surcharge")); net_surage = net_surage.add(params.getBigDecimal("channel_surcharge"));
transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee"));
} }
BigDecimal org_charge = total_surage.subtract(royalpay_surage); BigDecimal org_charge = total_surage.subtract(royalpay_surage);
if (channel.toLowerCase().equals("alipay_direct")) { if (channel.toLowerCase().equals("alipay_direct")) {
@ -628,7 +586,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
json.put("client_id", clientId); json.put("client_id", clientId);
if (clientRate != null) { if (clientRate != null) {
json.put("client_rate", clientRate.getBigDecimal("rate_value")); json.put("client_rate", clientRate.getBigDecimal("rate_value"));
}else { } else {
json.put("client_rate", oneChannel.getValue().get(0).getBigDecimal("surcharge_rate").multiply(CommonConsts.HUNDRED)); json.put("client_rate", oneChannel.getValue().get(0).getBigDecimal("surcharge_rate").multiply(CommonConsts.HUNDRED));
} }
json.put("gross_amount", total); json.put("gross_amount", total);
@ -642,6 +600,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
json.put("org_net_charge", net_surage); json.put("org_net_charge", net_surage);
} }
json.put("org_charge", org_charge); json.put("org_charge", org_charge);
json.put("transaction_fee", transaction_fee);
json.put("commission_type", "1"); json.put("commission_type", "1");
json.put("create_time", new Date()); json.put("create_time", new Date());
json.put("date_from", DateFormatUtils.format(datefrom, "yyyy-MM-dd")); json.put("date_from", DateFormatUtils.format(datefrom, "yyyy-MM-dd"));
@ -676,9 +635,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
case "Wechat": case "Wechat":
thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("wechatChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2, RoundingMode.HALF_UP); thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("wechatChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2, RoundingMode.HALF_UP);
break; break;
case "jd":
thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("jdChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2, RoundingMode.HALF_UP);
break;
case "AlipayOnline": case "AlipayOnline":
thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("alipayonlineChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2, RoundingMode.HALF_UP); thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("alipayonlineChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2, RoundingMode.HALF_UP);
break; break;
@ -747,8 +703,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
HashMap<String, String> channelMap = new HashMap<>(); HashMap<String, String> channelMap = new HashMap<>();
channelMap.put("Alipay", "Alipay"); channelMap.put("Alipay", "Alipay");
channelMap.put("Wechat", "Wechat"); channelMap.put("Wechat", "Wechat");
channelMap.put("Bestpay", "Bestpay");
channelMap.put("jd", "jd");
channelMap.put("AlipayOnline", "AlipayOnline"); channelMap.put("AlipayOnline", "AlipayOnline");
List<JSONObject> transactionAnalysis = transactionMapper.listTransactionsForAgentCommission(year, month, org.getIntValue("parent_org_id")); List<JSONObject> transactionAnalysis = transactionMapper.listTransactionsForAgentCommission(year, month, org.getIntValue("parent_org_id"));
Map<String, AgentCommissionAnalysis> results = new HashMap<>(); Map<String, AgentCommissionAnalysis> results = new HashMap<>();
@ -825,6 +779,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
temp.put("total_charge", 0); temp.put("total_charge", 0);
temp.put("royalpay_charge", 0); temp.put("royalpay_charge", 0);
temp.put("org_charge", 0); temp.put("org_charge", 0);
temp.put("transaction_fee", 0);
temp.put("share_charge", 0); temp.put("share_charge", 0);
temp.put("channel", channel.getString("channel")); temp.put("channel", channel.getString("channel"));
temp.put("net_charge", 0); temp.put("net_charge", 0);
@ -839,28 +794,8 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
mineCommission.put("share_charge", mineCommission.getBigDecimal("share_charge").subtract(channel.getBigDecimal("share_charge"))); mineCommission.put("share_charge", mineCommission.getBigDecimal("share_charge").subtract(channel.getBigDecimal("share_charge")));
financialPartnerCommissionMapper.update(mineCommission); financialPartnerCommissionMapper.update(mineCommission);
} }
channel.put("month", month);
channel.put("year", year);
channel.put("org_id", orgId);
//撤销agent表
// financialAgentCommissionMapper.save(channel);
} }
} }
//撤销agent表
// Map<Integer, List<JSONObject>> groupByClientMap = transactionDetail.stream().collect(Collectors.groupingBy(e -> e.getInteger("client_id")));
// for (Map.Entry<Integer, List<JSONObject>> oneClient : groupByClientMap.entrySet()) {
//
// JSONObject org = orgMapper.findOne(oneClient.getValue().get(0).getInteger("org_id"));
// Map<String, List<JSONObject>> groupByChannel = oneClient.getValue().stream().collect(Collectors.groupingBy(e -> e.getString("channel")));
//
// List<JSONObject> clientChannelAmount = clientChannelAmount(oneClient.getKey(),org, groupByChannel, channelCharge,year,month,2);
// for (JSONObject channel : clientChannelAmount) {
// financialAgentCommissionDetailMapper.save(channel);
// }
//
// }
} }
@Override @Override
@ -1288,7 +1223,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("net_charge") == null ? BigDecimal.ZERO.toPlainString() : log.getBigDecimal("net_charge").toPlainString()); row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("net_charge") == null ? BigDecimal.ZERO.toPlainString() : log.getBigDecimal("net_charge").toPlainString());
if (log.getBigDecimal("org_charge").compareTo(BigDecimal.ZERO) == 1) { if (log.getBigDecimal("org_charge").compareTo(BigDecimal.ZERO) == 1) {
row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("org_charge").toPlainString()); row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("org_charge").toPlainString());
}else { } else {
row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(BigDecimal.ZERO.toPlainString()); row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(BigDecimal.ZERO.toPlainString());
} }
row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("share_charge") == null ? BigDecimal.ZERO.toPlainString() : log.getBigDecimal("share_charge").toPlainString()); row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("share_charge") == null ? BigDecimal.ZERO.toPlainString() : log.getBigDecimal("share_charge").toPlainString());

@ -1,9 +0,0 @@
package au.com.royalpay.payment.manage.dev.core;
import com.alibaba.fastjson.JSONObject;
public interface HfClearAmountService {
JSONObject hfjsonobject(String dateto,String datefrom);
}

@ -1,11 +0,0 @@
package au.com.royalpay.payment.manage.dev.core;
import com.alibaba.fastjson.JSONObject;
public interface HfUpdateService {
String updateStatus();
String rpayUpdate();
}

@ -14,8 +14,8 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.SysWxMerchantApplyMapper; import au.com.royalpay.payment.manage.mappers.system.SysWxMerchantApplyMapper;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeepay.shade.org.apache.commons.lang3.StringUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;

@ -1,57 +0,0 @@
package au.com.royalpay.payment.manage.dev.core.impl;
import au.com.royalpay.payment.manage.dev.core.HfClearAmountService;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.List;
@Service
public class HfClearAmountServiceImpl implements HfClearAmountService {
@Resource
private TransactionMapper transactionMapper;
@Override
public JSONObject hfjsonobject(String dateto, String datefrom) {
JSONObject params = new JSONObject();
try {
params.put("datefrom", DateUtils.addMinutes(DateUtils.parseDate(datefrom, "yyyy-MM-dd"), PlatformEnvironment.getEnv().getTimeZoneOffsetMinutes()));
params.put("dateto", DateUtils.addMinutes(DateUtils.parseDate(dateto, "yyyy-MM-dd"), PlatformEnvironment.getEnv().getTimeZoneOffsetMinutes()));
} catch (ParseException e) {
throw new ServerErrorException("时间转换异常");
}
List<JSONObject> hfClearAmountResult = transactionMapper.getHfClearAmount(params);
JSONObject result = new JSONObject();
result.put("payment_amount", BigDecimal.ZERO);
result.put("refund_amount", BigDecimal.ZERO);
result.put("gross_amount", BigDecimal.ZERO);
result.put("charge_amount", BigDecimal.ZERO);
result.put("clear_amount", BigDecimal.ZERO);
result.put("payment_surcharge", BigDecimal.ZERO);
result.put("refund_surcharge", BigDecimal.ZERO);
if (hfClearAmountResult.isEmpty()) {
return result;
}
hfClearAmountResult.forEach(dbResult -> {
if ("Credit".equals(dbResult.getString("transaction_type"))) {
result.put("payment_amount", dbResult.getBigDecimal("clear_amount"));
result.put("payment_surcharge", dbResult.getBigDecimal("charge_amount"));
}
if ("Debit".equals(dbResult.getString("transaction_type"))) {
result.put("refund_amount", dbResult.getBigDecimal("clear_amount"));
result.put("refund_surcharge", dbResult.getBigDecimal("charge_amount"));
}
});
result.put("gross_amount", result.getBigDecimal("payment_amount").subtract(result.getBigDecimal("refund_amount")));
result.put("charge_amount", result.getBigDecimal("payment_surcharge").subtract(result.getBigDecimal("refund_surcharge")));
result.put("clear_amount", result.getBigDecimal("gross_amount").subtract(result.getBigDecimal("charge_amount")));
return result;
}
}

@ -1,66 +0,0 @@
package au.com.royalpay.payment.manage.dev.core.impl;
import au.com.royalpay.payment.channels.rpay.runtime.RpayApi;
import au.com.royalpay.payment.manage.dev.core.HfUpdateService;
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.List;
import javax.annotation.Resource;
@Service
public class HfUpdateImpl implements HfUpdateService {
@Resource
private ClientMapper clientMapper;
@Resource
private MpWechatApiProvider mpWechatApiProvider;
@Resource
private ClientConfigMapper clientConfigMapper;
@Resource
private RpayApi rpayApi;
private Logger logger = LoggerFactory.getLogger(getClass());
@Override
public String updateStatus() {
List<JSONObject> clientIds = clientMapper.findByhfPayUrlNotNull();
clientIds.forEach(dbResult -> {
String longUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/" + dbResult.getString("client_moniker") + "/jump/pc");
MpWechatApi api = mpWechatApiProvider.getNewPaymentApi();
String url = api.registerShortUrl(longUrl);
dbResult.put("hf_pay_url", url);
JSONObject config = new JSONObject();
config.put("client_id",dbResult.getString("client_id"));
config.put("hf_pay_url", url);
clientConfigMapper.update(config);
clientMapper.update(dbResult);
});
return "ok";
}
@Override
public String rpayUpdate() {
List<JSONObject> clientIds = clientMapper.findByrpayNotNull();
StringBuffer sb = new StringBuffer();
clientIds.forEach(dbResult -> {
try {
// rpayApi.modifySurchargeConfig(dbResult);
} catch (Exception e) {
sb.append("【" + dbResult.getString("client_moniker") + "】、");
}
});
logger.info("test for update rpay clearing date,fail + " + sb.toString());
return "ok";
}
}

@ -1,70 +0,0 @@
package au.com.royalpay.payment.manage.dev.web;
import au.com.royalpay.payment.manage.analysis.core.DashboardService;
import com.alibaba.fastjson.JSONObject;
import org.joda.time.DateTime;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping(value = "/dev/pine")
public class TestAPPController {
@Resource
private DashboardService dashboardService;
@GetMapping("/trade_log")
public List<JSONObject> getTradeLogs(HttpServletResponse response) {
response.addHeader("Access-Control-Allow-Origin", "*");
response.addHeader("Access-Control-Allow-Credentials", "true");
response.addHeader("Access-Control-Allow-Headers", "Authorization,Origin, X-Requested-With, Content-Type, Accept");
response.addHeader("Access-Control-Allow-Methods", "*");
List<JSONObject> logs = new ArrayList<>();
for (int i = 0; i < 5; i++) {
JSONObject json = new JSONObject();
json.put("channel", "Alipay");
json.put("order_id", "PINE-r67783ej392u38ry982");
json.put("status", "1");
json.put("amount","9.99");
logs.add(json);
}
for (int i = 0; i < 5; i++) {
JSONObject json = new JSONObject();
json.put("channel", "Wechat");
json.put("order_id", "PINE-r67783ej392u38ry982");
json.put("status", "2");
json.put("amount","9.99");
logs.add(json);
}
for (int i = 0; i < 5; i++) {
JSONObject json = new JSONObject();
json.put("channel", "Bestpay");
json.put("order_id", "PINE-r67783ej392u38ry982");
json.put("status", "3");
json.put("amount","9.99");
logs.add(json);
}
return logs;
}
@RequestMapping(value = "/customer",method = RequestMethod.GET)
public void generateCustomersAndOrdersStatistics(){
DateTime dt17 = new DateTime(2018,5,17,11,11);
DateTime dt18 = new DateTime(2018,5,18,11,11);
DateTime dt19 = new DateTime(2018,5,19,11,11);
dashboardService.generateCustomersAndOrdersStatistics(dt17.toDate());
dashboardService.generateCustomersAndOrdersStatistics(dt18.toDate());
dashboardService.generateCustomersAndOrdersStatistics(dt19.toDate());
}
}

@ -2,11 +2,8 @@ package au.com.royalpay.payment.manage.dev.web;
import au.com.royalpay.payment.channels.alipay.config.AlipayEnvironment; import au.com.royalpay.payment.channels.alipay.config.AlipayEnvironment;
import au.com.royalpay.payment.channels.alipay.runtime.AlipayClient; import au.com.royalpay.payment.channels.alipay.runtime.AlipayClient;
import au.com.royalpay.payment.channels.bestpay.runtime.BestPayClient;
import au.com.royalpay.payment.channels.jd.runtime.JDClient;
import au.com.royalpay.payment.channels.rpay.runtime.RpayClient; import au.com.royalpay.payment.channels.rpay.runtime.RpayClient;
import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient; import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient;
import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient;
import au.com.royalpay.payment.core.PaymentApi; import au.com.royalpay.payment.core.PaymentApi;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.core.exceptions.OrderNotExistsException; import au.com.royalpay.payment.core.exceptions.OrderNotExistsException;
@ -19,8 +16,6 @@ import au.com.royalpay.payment.manage.dev.bean.AliExcel;
import au.com.royalpay.payment.manage.dev.bean.Message; import au.com.royalpay.payment.manage.dev.bean.Message;
import au.com.royalpay.payment.manage.dev.bean.SendWechatMessage; import au.com.royalpay.payment.manage.dev.bean.SendWechatMessage;
import au.com.royalpay.payment.manage.dev.core.AliforexcelService; import au.com.royalpay.payment.manage.dev.core.AliforexcelService;
import au.com.royalpay.payment.manage.dev.core.HfClearAmountService;
import au.com.royalpay.payment.manage.dev.core.HfUpdateService;
import au.com.royalpay.payment.manage.dev.core.WechatMessageService; import au.com.royalpay.payment.manage.dev.core.WechatMessageService;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.payment.RefundMapper; import au.com.royalpay.payment.manage.mappers.payment.RefundMapper;
@ -37,7 +32,6 @@ import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.defines.TradeType; import au.com.royalpay.payment.tools.defines.TradeType;
import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.http.HttpUtils; import au.com.royalpay.payment.tools.http.HttpUtils;
@ -112,14 +106,8 @@ public class TestController {
@Resource @Resource
private AlipayClient alipayClient; private AlipayClient alipayClient;
@Resource @Resource
private BestPayClient bestPayClient;
@Resource
private JDClient jdClient;
@Resource
private RpayClient rpayClient; private RpayClient rpayClient;
@Resource @Resource
private YeePayClient yeepayClient;
@Resource
private TradeLogService tradeLogService; private TradeLogService tradeLogService;
@Resource @Resource
private RetailAppService retailAppService; private RetailAppService retailAppService;
@ -128,14 +116,8 @@ public class TestController {
@Resource @Resource
private AliforexcelService aliforexcelService; private AliforexcelService aliforexcelService;
@Resource @Resource
private HfClearAmountService hfClearAmountService;
@Resource
private HfUpdateService hfUpdateService;
@Resource
private ClientManager clientManager; private ClientManager clientManager;
@Resource @Resource
private SysConfigManager sysConfigManager;
@Resource
private MpWechatApiProvider mpWechatApiProvider; private MpWechatApiProvider mpWechatApiProvider;
@Resource @Resource
private SysClientLegalPersonMapper sysClientLegalPersonMapper; private SysClientLegalPersonMapper sysClientLegalPersonMapper;
@ -234,17 +216,6 @@ public class TestController {
if (alipayRate != null) { if (alipayRate != null) {
client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
} }
JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay");
if (bestPayRate != null) {
client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd");
if (jdRate != null) {
client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline"); JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline");
if (alipayOnlineRate != null) { if (alipayOnlineRate != null) {
client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
@ -334,16 +305,6 @@ public class TestController {
xmlStr = XmlFormatUtils.formatXml(elem); xmlStr = XmlFormatUtils.formatXml(elem);
res.put("xml", xmlStr); res.put("xml", xmlStr);
break; break;
case "Bestpay":
JSONObject status = bestPayClient.queryOrderStatus(order.getString("order_id"), order.getDate("create_time"));
String json = JSON.toJSONString(status, SerializerFeature.PrettyFormat);
res.put("xml", json);
break;
case "jd":
elem = jdClient.queryTransaction(orderId, orderId, JDClient.TRADE_TYPE_PAY);
xmlStr = XmlFormatUtils.formatXml(elem);
res.put("xml", xmlStr);
break;
case "AlipayOnline": case "AlipayOnline":
elem = alipayClient.checkOnlineOrderStatusByOrderId(orderId, AlipayEnvironment.getEnv().getAlipayOnlineMerchant().getPid()); elem = alipayClient.checkOnlineOrderStatusByOrderId(orderId, AlipayEnvironment.getEnv().getAlipayOnlineMerchant().getPid());
xmlStr = XmlFormatUtils.formatXml(elem); xmlStr = XmlFormatUtils.formatXml(elem);
@ -354,9 +315,6 @@ public class TestController {
String rpayjson = JSON.toJSONString(orderInfo, SerializerFeature.PrettyFormat); String rpayjson = JSON.toJSONString(orderInfo, SerializerFeature.PrettyFormat);
res.put("xml", rpayjson); res.put("xml", rpayjson);
break; break;
case "Yeepay":
res.put("xml", yeepayClient.queryOrderStd(orderId).toString());
break;
default: default:
throw new BadRequestException("Not Support channel:" + channel); throw new BadRequestException("Not Support channel:" + channel);
} }
@ -386,24 +344,11 @@ public class TestController {
String xmlStr = XmlFormatUtils.formatXml(elem); String xmlStr = XmlFormatUtils.formatXml(elem);
res.put("xml", xmlStr); res.put("xml", xmlStr);
break; break;
case "Bestpay":
JSONObject status = bestPayClient.queryRefundStatus(order.getString("order_id"), refundId, refundOrder.getDate("create_time"));
String json = JSON.toJSONString(status, SerializerFeature.PrettyFormat);
res.put("xml", json);
break;
case "jd":
elem = jdClient.queryTransaction(refundId, order.getString("order_id"), JDClient.TRADE_TYPE_REFUND);
xmlStr = XmlFormatUtils.formatXml(elem);
res.put("xml", xmlStr);
break;
case "AlipayOnline": case "AlipayOnline":
elem = alipayClient.onlineRefund(refundOrder, AlipayEnvironment.getEnv().getAlipayOnlineMerchant().getPid(), type == TradeType.GATEWAY_H5); elem = alipayClient.onlineRefund(refundOrder, AlipayEnvironment.getEnv().getAlipayOnlineMerchant().getPid(), type == TradeType.GATEWAY_H5);
xmlStr = XmlFormatUtils.formatXml(elem); xmlStr = XmlFormatUtils.formatXml(elem);
res.put("xml", xmlStr); res.put("xml", xmlStr);
break; break;
case "Yeepay":
res.put("xml", yeepayClient.queryRefundStd(refundOrder.getString("out_refund_id")).toString());
break;
default: default:
throw new BadRequestException("Not Support channel:" + channel); throw new BadRequestException("Not Support channel:" + channel);
} }
@ -444,33 +389,11 @@ public class TestController {
wechatMessageService.sendMessageByOpenId(sendWechatMessage); wechatMessageService.sendMessageByOpenId(sendWechatMessage);
} }
/* @ManagerMapping(value = "/orgusertest", method = RequestMethod.POST, role = {ManagerRole.ADMIN,ManagerRole.DEVELOPER})
public JSONObject orgusertest(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody @Valid ClientTestRegisterInfo registery,
Errors errors) {
HttpUtils.handleValidErrors(errors);
return newpartnerService.registerClient(null, registery, manager);
}*/
@ManagerMapping(value = "/aliforexcel", method = RequestMethod.GET, role = ManagerRole.DEVELOPER) @ManagerMapping(value = "/aliforexcel", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
public void aliforexcel(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse, AliExcel query) throws Exception { public void aliforexcel(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse, AliExcel query) throws Exception {
aliforexcelService.listClients(httpResponse, manager, query); aliforexcelService.listClients(httpResponse, manager, query);
} }
@ManagerMapping(value = "/hfClearAmount", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
public JSONObject hfUpdate(@RequestParam String datefrom, @RequestParam String dateto) {
return hfClearAmountService.hfjsonobject(dateto, datefrom);
}
@ManagerMapping(value = "/hfUpdate", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
public String hfClearAmount() {
return hfUpdateService.updateStatus();
}
@ManagerMapping(value = "/rpayUpdate", method = RequestMethod.PUT, role = ManagerRole.DEVELOPER)
public String rpayUpdateClearing() {
return hfUpdateService.rpayUpdate();
}
@ManagerMapping(value = "/partner/reset_password", method = RequestMethod.GET, role = ManagerRole.DEVELOPER) @ManagerMapping(value = "/partner/reset_password", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
public void resetPartnerPassword() { public void resetPartnerPassword() {
clientManager.updateAllPartnerPassword("PINE"); clientManager.updateAllPartnerPassword("PINE");

@ -128,8 +128,6 @@ public class ClientRegisterInfo {
rate.put("wechat_rate_value", settleConfig.getWechatRate()); rate.put("wechat_rate_value", settleConfig.getWechatRate());
rate.put("alipay_rate_value", settleConfig.getAlipayRate()); rate.put("alipay_rate_value", settleConfig.getAlipayRate());
rate.put("alipayonline_rate_value", settleConfig.getAlipayOnlineRate()); rate.put("alipayonline_rate_value", settleConfig.getAlipayOnlineRate());
rate.put("bestpay_rate_value", getDefaultRate(defaultRateConfig, String.valueOf(settleConfig.getCleanDays()),"Bestpay"));
rate.put("jd_rate_value", getDefaultRate(defaultRateConfig, String.valueOf(settleConfig.getCleanDays()),"JDpay"));
rate.put("Rpay_rate_value", getDefaultRate(defaultRateConfig, String.valueOf(settleConfig.getCleanDays()),"Rpay")); rate.put("Rpay_rate_value", getDefaultRate(defaultRateConfig, String.valueOf(settleConfig.getCleanDays()),"Rpay"));
rate.put("cb_bankpay_rate_value", getDefaultRate(defaultRateConfig, String.valueOf(settleConfig.getCleanDays()),"CB_Bankpay")); rate.put("cb_bankpay_rate_value", getDefaultRate(defaultRateConfig, String.valueOf(settleConfig.getCleanDays()),"CB_Bankpay"));
rate.put("transaction_fee", settleConfig.getTransactionFee()); rate.put("transaction_fee", settleConfig.getTransactionFee());

@ -42,7 +42,7 @@ public class ClientSettleConfig {
@JSONField(name = "alipay_online_rate") @JSONField(name = "alipay_online_rate")
private String alipayOnlineRate; private String alipayOnlineRate;
@JSONField(name = "transaction_fee") @JSONField(name = "transaction_fee")
private String transactionFee; private String transactionFee ="0.00";
@JSONField(name = "active_time") @JSONField(name = "active_time")
private String activeTime; private String activeTime;
@JSONField(name = "expire_time") @JSONField(name = "expire_time")

@ -46,11 +46,11 @@ public interface CleanService {
void settlementXlsx(Date date, HttpServletResponse response) throws IOException; void settlementXlsx(Date date, HttpServletResponse response) throws IOException;
List<JSONObject> getXlsx(Date dt, String bank, List<JSONObject> logs) throws IOException; List<JSONObject> getXlsx(Date dt, List<JSONObject> logs) throws IOException;
List<JSONObject> getSettleLogs(Date dt, List<String> clearIds); List<JSONObject> getSettleLogs(Date dt, List<String> clearIds);
List<ABAFile> getAba(Date dt, String bank, List<JSONObject> logs) throws IOException; List<ABAFile> getAba(Date dt, List<JSONObject> logs) throws IOException;
void settlementAba(Date date, HttpServletResponse response) throws IOException; void settlementAba(Date date, HttpServletResponse response) throws IOException;
@ -105,4 +105,6 @@ public interface CleanService {
void undoSettle(Date date, int clearingId); void undoSettle(Date date, int clearingId);
ByteArrayResource downloadBatchSettleReportXlsx(int batchId); ByteArrayResource downloadBatchSettleReportXlsx(int batchId);
JSONObject findSettleLog(int clearingId);
} }

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.management.clearing.core.impl;
import au.com.royalpay.payment.core.PaymentApi; import au.com.royalpay.payment.core.PaymentApi;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.core.tasksupport.SettlementSupport; import au.com.royalpay.payment.core.tasksupport.SettlementSupport;
import au.com.royalpay.payment.core.utils.ExtParamsUtils;
import au.com.royalpay.payment.manage.management.clearing.core.CleanService; import au.com.royalpay.payment.manage.management.clearing.core.CleanService;
import au.com.royalpay.payment.manage.mappers.log.*; import au.com.royalpay.payment.manage.mappers.log.*;
import au.com.royalpay.payment.manage.mappers.payment.TaskManualSettleMapper; import au.com.royalpay.payment.manage.mappers.payment.TaskManualSettleMapper;
@ -32,6 +33,7 @@ import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.locale.LocaleSupport; import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.lock.Locker; import au.com.royalpay.payment.tools.lock.Locker;
import au.com.royalpay.payment.tools.merchants.beans.BalanceGroup;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.tasksupport.TaskFinishNotifyEvent; import au.com.royalpay.payment.tools.tasksupport.TaskFinishNotifyEvent;
import au.com.royalpay.payment.tools.utils.DateVaildUtil; import au.com.royalpay.payment.tools.utils.DateVaildUtil;
@ -321,7 +323,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
JSONObject client = clientManager.getClientInfo(clientId); JSONObject client = clientManager.getClientInfo(clientId);
Assert.notNull(client, "Client ID invalid"); Assert.notNull(client, "Client ID invalid");
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
List<JSONObject> transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate,clientId, List<JSONObject> transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate, clientId,
new PageBounds(Order.formString("order_id.asc"))); new PageBounds(Order.formString("order_id.asc")));
clearClient.put("report", transactions); clearClient.put("report", transactions);
List<JSONObject> channels = clearingDetailAnalysisMapper.listReportChannelsOfMergeSettle(reportDate, clientId); List<JSONObject> channels = clearingDetailAnalysisMapper.listReportChannelsOfMergeSettle(reportDate, clientId);
@ -433,28 +435,17 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
} }
@Override @Override
public List<JSONObject> getXlsx(Date dt, String bank, List<JSONObject> logs) throws IOException { public List<JSONObject> getXlsx(Date dt, List<JSONObject> logs) throws IOException {
List<JSONObject> result = new ArrayList<>(); List<JSONObject> result = new ArrayList<>();
int fileIndex = 1; for (JSONObject log : logs) {
if (logs.size() > 1) { List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id"));
for (JSONObject log : logs) { List<String> banks = details.stream().map(detail -> detail.getString("settle_bank")).distinct().collect(Collectors.toList());
String filename = "Merchant_Settlement_Info_" + DateFormatUtils.format(dt, "yyyyMMdd") + "_" + fileIndex + ".xlsx"; for (String bank : banks) {
JSONObject file = new JSONObject(); String filename = String.format("Merchant_Setlement_Info_%s_%s.xlsx", bank, DateFormatUtils.format(log.getDate("operate_time"), "yyyyMMddHHmmss"));
file.put("name", filename);
List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id"));
details = mergeBatchSettleClients(details);
file.put("byteArr", generateSettleXlsxFile(dt, details, bank));
result.add(file);
fileIndex++;
}
} else {
for (JSONObject log : logs) {
String filename = "Merchant_Settlement_Info_" + DateFormatUtils.format(dt, "yyyyMMdd") + ".xlsx";
JSONObject file = new JSONObject(); JSONObject file = new JSONObject();
file.put("name", filename); file.put("name", filename);
List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); List<JSONObject> mergedDetails = mergeBatchSettleClients(details.stream().filter(detail -> bank.equals(detail.getString("settle_bank"))).collect(Collectors.toList()));
details = mergeBatchSettleClients(details); file.put("byteArr", generateSettleXlsxFile(dt, mergedDetails, bank));
file.put("byteArr", generateSettleXlsxFile(dt, details, bank));
result.add(file); result.add(file);
} }
} }
@ -536,15 +527,16 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
} }
@Override @Override
public List<ABAFile> getAba(Date dt, String bank, List<JSONObject> logs) { public List<ABAFile> getAba(Date dt, List<JSONObject> logs) {
List<ABAFile> files = new ArrayList<>(); List<ABAFile> files = new ArrayList<>();
for (JSONObject log : logs) { for (JSONObject log : logs) {
List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id"));
details = mergeBatchSettleClients(details); details = mergeBatchSettleClients(details);
String remark = extractSettleRemark(log); String remark = extractSettleRemark(log);
files.addAll(generateSettleAbaFiles(dt, details, log.getDate("operate_time"), remark)); BalanceGroup group = BalanceGroup.valueOf(log.getString("balance_group"));
files.addAll(generateSettleAbaFiles(dt, group, details, log.getDate("operate_time"), remark));
} }
return files.stream().filter(file -> bank.equals(file.bank())).collect(Collectors.toList()); return files;
} }
public String extractSettleRemark(JSONObject log) { public String extractSettleRemark(JSONObject log) {
@ -589,7 +581,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
for (JSONObject log : logs) { for (JSONObject log : logs) {
List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id"));
details = mergeBatchSettleClients(details); details = mergeBatchSettleClients(details);
files.addAll(generateSettleAbaFiles(dt, details, log.getDate("operate_time"), extractSettleRemark(log))); BalanceGroup group = BalanceGroup.valueOf(log.getString("balance_group"));
files.addAll(generateSettleAbaFiles(dt, group, details, log.getDate("operate_time"), extractSettleRemark(log)));
} }
OutputStream ous = resp.getOutputStream(); OutputStream ous = resp.getOutputStream();
if (files.size() == 1) { if (files.size() == 1) {
@ -633,7 +626,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
resp.addHeader("Content-Disposition", "attachment; filename=" + zipName); resp.addHeader("Content-Disposition", "attachment; filename=" + zipName);
OutputStream ous = resp.getOutputStream(); OutputStream ous = resp.getOutputStream();
List<ABAFile> abaFiles = generateSettleAbaFiles(settleDate, details, opTime, extractSettleRemark(clearing)); BalanceGroup group = BalanceGroup.valueOf(clearing.getString("balance_group"));
List<ABAFile> abaFiles = generateSettleAbaFiles(settleDate, group, details, opTime, extractSettleRemark(clearing));
try (ZipOutputStream zos = new ZipOutputStream(ous)) { try (ZipOutputStream zos = new ZipOutputStream(ous)) {
for (ABAFile aba : abaFiles) { for (ABAFile aba : abaFiles) {
zos.putNextEntry(new ZipEntry(aba.filename())); zos.putNextEntry(new ZipEntry(aba.filename()));
@ -644,16 +638,16 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
} }
} }
private List<ABAFile> generateSettleAbaFiles(Date dt, List<JSONObject> settlements, Date operateTime, String remark) { private List<ABAFile> generateSettleAbaFiles(Date dt, BalanceGroup group, List<JSONObject> settlements, Date operateTime, String remark) {
List<String> banks = settlements.stream().map(detail -> detail.getString("settle_bank")).distinct().collect(Collectors.toList()); List<String> banks = settlements.stream().map(detail -> detail.getString("settle_bank")).distinct().collect(Collectors.toList());
return banks.stream().map(bank -> generateSettleAbaFile(bank, dt, settlements)) return banks.stream().map(bank -> generateSettleAbaFile(bank, group, dt, settlements))
.peek(file -> file.setOperateTime(operateTime)) .peek(file -> file.setOperateTime(operateTime))
.peek(file -> file.setRemark(remark)) .peek(file -> file.setRemark(remark))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
private ABAFile generateSettleAbaFile(String bank, Date dt, List<JSONObject> settlements) { private ABAFile generateSettleAbaFile(String bank, BalanceGroup group, Date dt, List<JSONObject> settlements) {
ABAFile aba = ABATemplate.getConfig().initFile(bank, dt); ABAFile aba = ABATemplate.getConfig().initFile(group, bank, dt);
for (JSONObject settle : settlements) { for (JSONObject settle : settlements) {
if (!bank.equals(settle.getString("settle_bank"))) { if (!bank.equals(settle.getString("settle_bank"))) {
continue; continue;
@ -890,7 +884,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
if (clearClient == null) { if (clearClient == null) {
throw new NotFoundException(); throw new NotFoundException();
} }
List<JSONObject> transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate,client_id, List<JSONObject> transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate, client_id,
new PageBounds(Order.formString("order_id.asc"))); new PageBounds(Order.formString("order_id.asc")));
String timezone_client = client.getString("timezone"); String timezone_client = client.getString("timezone");
@ -1026,10 +1020,10 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
} }
@Override @Override
public void exportListClearingTransactions(int client_id, String clearingDetailId, JSONObject partner, HttpServletResponse resp) { public void exportListClearingTransactions(int clientId, String clearingDetailId, JSONObject partner, HttpServletResponse resp) {
OutputStream ous = null; OutputStream ous = null;
try { try {
JSONObject clearTransation = listClearingTransactions(client_id, clearingDetailId, partner); JSONObject clearTransation = listClearingTransactions(clientId, clearingDetailId, partner);
resp.setContentType("application/octet-stream;"); resp.setContentType("application/octet-stream;");
Date reportDate = clearTransation.getDate("report_date"); Date reportDate = clearTransation.getDate("report_date");
resp.addHeader("Content-Disposition", resp.addHeader("Content-Disposition",
@ -1114,7 +1108,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() : settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() :
"-" + settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); "-" + settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null); cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
row.createCell(15, Cell.CELL_TYPE_STRING).setCellValue(settle.containsKey("order_detail")?settle.getString("order_detail"):settle.getString("remark")); row.createCell(15, Cell.CELL_TYPE_STRING).setCellValue(settle.containsKey("order_detail") ? settle.getString("order_detail") : settle.getString("remark"));
String clientDevId = StringUtils.defaultString(settle.getString("dev_id"), "-"); String clientDevId = StringUtils.defaultString(settle.getString("dev_id"), "-");
JSONObject device = clientDeviceMapper.find(settle.getString("dev_id")); JSONObject device = clientDeviceMapper.find(settle.getString("dev_id"));
String clientDevRemark = "-"; String clientDevRemark = "-";
@ -1174,7 +1168,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
Sheet sheet = wb.createSheet("Merchant_Settlement_Info_" + reportDate); Sheet sheet = wb.createSheet("Merchant_Settlement_Info_" + reportDate);
int rowNum = 0; int rowNum = 0;
Row row = sheet.createRow(rowNum); Row row = sheet.createRow(rowNum);
String[] title = {"Client Moniker","Short Name","order Id", "Client Order Id", "Transaction Time", "Channel", "Gateway", "Exchange Rate", "Transaction Type", "Currency", String[] title = {"Client Moniker", "Short Name", "order Id", "Client Order Id", "Transaction Time", "Channel", "Gateway", "Exchange Rate", "Transaction Type", "Currency",
"Input Amount", "Total Amount", "Clearing Amount(AUD)", "Sruchange Rate", "Surcharge(AUD)", "GST(AUD)", "Settle Amount(AUD)", "Remark", "Dev No", "Dev Remark"}; "Input Amount", "Total Amount", "Clearing Amount(AUD)", "Sruchange Rate", "Surcharge(AUD)", "GST(AUD)", "Settle Amount(AUD)", "Remark", "Dev No", "Dev Remark"};
String[] analysis = {"Total Credit(AUD)", "Total Debit(AUD)", "Gross Amount(AUD)", "Total GST(AUD)", "Total Charge(AUD)", "Net Amount(AUD)"}; String[] analysis = {"Total Credit(AUD)", "Total Debit(AUD)", "Gross Amount(AUD)", "Total GST(AUD)", "Total Charge(AUD)", "Net Amount(AUD)"};
for (int i = 0; i < title.length; i++) { for (int i = 0; i < title.length; i++) {
@ -1368,7 +1362,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
List<JSONObject> attachList = new ArrayList<>(); List<JSONObject> attachList = new ArrayList<>();
JSONObject attach1 = new JSONObject(); JSONObject attach1 = new JSONObject();
List<JSONObject> clearLogs = getSettleLogs(date, clearIds); List<JSONObject> clearLogs = getSettleLogs(date, clearIds);
List<JSONObject> xlsxFileList = getXlsx(date, "CBA", clearLogs); List<JSONObject> xlsxFileList = getXlsx(date, clearLogs);
if (xlsxFileList.size() > 1) { if (xlsxFileList.size() > 1) {
fileName1 += ".zip"; fileName1 += ".zip";
attach1.put("content", Base64.encodeBase64String(getZipByteArr(xlsxFileList))); attach1.put("content", Base64.encodeBase64String(getZipByteArr(xlsxFileList)));
@ -1380,7 +1374,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
attachList.add(attach1); attachList.add(attach1);
JSONObject attach2 = new JSONObject(); JSONObject attach2 = new JSONObject();
List<ABAFile> abaFileList = getAba(date, "CBA", clearLogs); List<ABAFile> abaFileList = getAba(date, clearLogs);
String fileName2 = "Merchant_Settlement_Info_aba_" + DateFormatUtils.format(date, "yyyyMMdd"); String fileName2 = "Merchant_Settlement_Info_aba_" + DateFormatUtils.format(date, "yyyyMMdd");
if (abaFileList.size() > 1) { if (abaFileList.size() > 1) {
fileName2 += ".zip"; fileName2 += ".zip";
@ -1429,7 +1423,12 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
settleMailRecord.put("notice_status", 0); settleMailRecord.put("notice_status", 0);
logSettleMailMapper.save(settleMailRecord); logSettleMailMapper.save(settleMailRecord);
} }
sendTaskFinishMessages(ManagerRole.FINANCIAL_STAFF, "清算文件已发送清算方", "发送清算通知"); String detailDescription = clearLogs.stream()
.map(log -> String.format("[%s]%s", log.getString("clearing_id"),
ExtParamsUtils.getExtParamsValue(log.getString("plan_detail"),
detail -> StringUtils.defaultIfEmpty(detail.getString("remark"), detail.getString("plan_id")))))
.collect(Collectors.joining(","));
sendTaskFinishMessages(ManagerRole.FINANCIAL_STAFF, "清算文件已发送清算方:" + detailDescription, "发送清算通知");
if (autoMarkSent) { if (autoMarkSent) {
if (!clearIds.isEmpty()) { if (!clearIds.isEmpty()) {
clearingLogMapper.lockSettlementsById(clearLogs.stream().map(log -> log.getString("clearing_id")).collect(Collectors.toList())); clearingLogMapper.lockSettlementsById(clearLogs.stream().map(log -> log.getString("clearing_id")).collect(Collectors.toList()));
@ -1523,7 +1522,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
throw new ForbiddenException("Settlement log has been sent and unable to edit"); throw new ForbiddenException("Settlement log has been sent and unable to edit");
} }
ABAConfig config = ABATemplate.getConfig(); ABAConfig config = ABATemplate.getConfig();
String defaultBank = config.getRemainsTo(); BalanceGroup group = BalanceGroup.valueOf(log.getString("balance_group"));
String defaultBank = config.getRemainsTo(group);
clearingDetailMapper.updateAllBanks(defaultBank, clearingId); clearingDetailMapper.updateAllBanks(defaultBank, clearingId);
List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(clearingId); List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(clearingId);
details = mergeBatchSettleClients(details); details = mergeBatchSettleClients(details);
@ -1547,6 +1547,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
if (base == null) { if (base == null) {
throw new BadRequestException("Invalid bank code:" + bank); throw new BadRequestException("Invalid bank code:" + bank);
} }
if (base.acceptBalanceGroup(group)) {
throw new BadRequestException("Balance group not match:" + group + ":" + bank);
}
BigDecimal bankAmount = bankDistribution.getBigDecimal(bank); BigDecimal bankAmount = bankDistribution.getBigDecimal(bank);
for (JSONObject detail : details) { for (JSONObject detail : details) {
String detailBank = detail.getString("settle_bank"); String detailBank = detail.getString("settle_bank");
@ -1639,6 +1642,15 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
} }
} }
@Override
public JSONObject findSettleLog(int clearingId) {
JSONObject clearing = clearingLogMapper.findById(clearingId);
if (clearing == null) {
throw new NotFoundException("Settle record not found:" + clearingId);
}
return clearing;
}
private void releaseDistributedSurcharge(JSONObject clearingDetail) { private void releaseDistributedSurcharge(JSONObject clearingDetail) {
int clientId = clearingDetail.getIntValue("client_id"); int clientId = clearingDetail.getIntValue("client_id");
BigDecimal distributedSurcharge = clearingDetail.getBigDecimal("distributed_surcharge"); BigDecimal distributedSurcharge = clearingDetail.getBigDecimal("distributed_surcharge");

@ -31,7 +31,7 @@ public class ArrivalNoticeController {
@RequestParam("date") String date) throws ParseException { @RequestParam("date") String date) throws ParseException {
JSONArray reports = new JSONArray(); JSONArray reports = new JSONArray();
Date dt = DateUtils.parseDate(date, new String[]{"yyyyMMdd"}); Date dt = DateUtils.parseDate(date, "yyyyMMdd");
JSONObject reportItem = validationLogMapper.findByDate(dt); JSONObject reportItem = validationLogMapper.findByDate(dt);
if (reportItem != null) { if (reportItem != null) {
JSONObject result = JSON.parseObject(reportItem.getString("result")); JSONObject result = JSON.parseObject(reportItem.getString("result"));
@ -50,11 +50,6 @@ public class ArrivalNoticeController {
} }
channelItem.put("analysis", analysis); channelItem.put("analysis", analysis);
} }
if (channel.equals("Bestpay") && result.containsKey("bestpay_valid_analysis")) {
List<JSONObject> analysis = new ArrayList<>();
analysis.add(result.getJSONObject("bestpay_valid_analysis"));
reports.getJSONObject(i).put("analysis", analysis);
}
} }
} }
map.put("reports", reports); map.put("reports", reports);

@ -6,6 +6,7 @@ import au.com.royalpay.payment.manage.permission.manager.RequireManager;
import au.com.royalpay.payment.manage.support.abafile.ABATemplate; import au.com.royalpay.payment.manage.support.abafile.ABATemplate;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.merchants.beans.BalanceGroup;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.ByteArrayResource;
@ -56,11 +57,13 @@ public class SettlementDevController {
} }
} }
@GetMapping("/available_banks") @GetMapping("/clearings/{clearingId}/available_banks")
public JSONObject getAvailableBanks() { public JSONObject getAvailableBanks(@PathVariable int clearingId) {
List<String> banks = ABATemplate.getConfig().availableBanks(); JSONObject clearing = cleanService.findSettleLog(clearingId);
BalanceGroup group = BalanceGroup.valueOf(clearing.getString("balance_group"));
List<String> banks = ABATemplate.getConfig().availableBanks(group);
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
res.put("remains_to", ABATemplate.getConfig().getRemainsTo()); res.put("remains_to", ABATemplate.getConfig().getRemainsTo(group));
res.put("banks", banks); res.put("banks", banks);
return res; return res;
} }

@ -28,7 +28,7 @@ public interface ClientAccountMapper {
@AutoSql(SqlType.SELECT) @AutoSql(SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1") @AdvanceSelect(addonWhereClause = "is_valid=1")
List<JSONObject> findByPhone(@Param("contact_phone") String contact_phone,@Param("nation_code")String nation_code); List<JSONObject> findByPhone(@Param("contact_phone") String contact_phone, @Param("nation_code") String nation_code);
@AutoSql(SqlType.SELECT) @AutoSql(SqlType.SELECT)
JSONObject findDetail(@Param("account_id") String accountId); JSONObject findDetail(@Param("account_id") String accountId);
@ -51,6 +51,10 @@ public interface ClientAccountMapper {
@AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"}) @AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"})
JSONObject findByAppOpenId(@Param("wxapp_openid") String openId); JSONObject findByAppOpenId(@Param("wxapp_openid") String openId);
@AutoSql(SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"})
JSONObject findByAppleUserId(@Param("apple_userid") String appleUserId);
@AutoSql(SqlType.SELECT) @AutoSql(SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"}) @AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"})
JSONObject findByWxUnioinId(@Param("wx_unionid") String wx_unionid); JSONObject findByWxUnioinId(@Param("wx_unionid") String wx_unionid);
@ -85,22 +89,23 @@ public interface ClientAccountMapper {
/** /**
* *
*
* @param unionId * @param unionId
* @return * @return
*/ */
JSONObject findOneByUnionIdAndCreateTimeDesc(@Param("wx_unionid")String unionId); JSONObject findOneByUnionIdAndCreateTimeDesc(@Param("wx_unionid") String unionId);
JSONObject findOneByPhoneAndCreateTimeDesc(@Param("contact_phone")String contactPhone,@Param("nation_code")String nationCode); JSONObject findOneByPhoneAndCreateTimeDesc(@Param("contact_phone") String contactPhone, @Param("nation_code") String nationCode);
@AutoSql(SqlType.SELECT) @AutoSql(SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"}) @AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"})
List<JSONObject> findByWechatOpenId(@Param("wechat_openid")String openid); List<JSONObject> findByWechatOpenId(@Param("wechat_openid") String openid);
@AutoSql(SqlType.SELECT) @AutoSql(SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"}) @AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"})
List<JSONObject> findByWechatUnionId(@Param("wx_unionid")String unionId); List<JSONObject> findByWechatUnionId(@Param("wx_unionid") String unionId);
@AutoSql(SqlType.SELECT) @AutoSql(SqlType.SELECT)
JSONObject findRSvcClientInfo(@Param("account_id")String accountId); JSONObject findRSvcClientInfo(@Param("account_id") String accountId);
} }

@ -20,5 +20,5 @@ public interface ClientAuditProcessMapper {
int update(JSONObject partner); int update(JSONObject partner);
@AutoSql(SqlType.SELECT) @AutoSql(SqlType.SELECT)
PageList<JSONObject> getAuditLog(@Param("client_id") int client_id, PageBounds pagination); PageList<JSONObject> getAuditLog(@Param("client_id") int client_id, @Param("type") int type, PageBounds pagination);
} }

@ -52,6 +52,8 @@ public interface ClientFilesMapper {
JSONObject getSourceAgreeFilesByClientId(@Param("client_id") int clientId); JSONObject getSourceAgreeFilesByClientId(@Param("client_id") int clientId);
JSONObject getSourceCardAgreeFilesByClientId(@Param("client_id") int clientId,@Param("file_name")String file_name);
void deleteByClientAndFileId(@Param("file_id") String file_id); void deleteByClientAndFileId(@Param("file_id") String file_id);
void deleteAggreeByClientId(@Param("client_id") int file_id); void deleteAggreeByClientId(@Param("client_id") int file_id);

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.mappers.system; package au.com.royalpay.payment.manage.mappers.system;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.yixsoft.support.mybatis.autosql.annotations.AdvanceSelect; import com.yixsoft.support.mybatis.autosql.annotations.AdvanceSelect;
import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper;
import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; import com.yixsoft.support.mybatis.autosql.annotations.AutoSql;
@ -22,5 +23,10 @@ public interface ClientMWFilesMapper {
@AutoSql(SqlType.SELECT) @AutoSql(SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid = 1") @AdvanceSelect(addonWhereClause = "is_valid = 1")
List<JSONObject> findClientFile(@Param("client_id") int clientId); List<JSONObject> findClientFile(@Param("client_id") int clientId, PageBounds pageBounds);
@AutoSql(SqlType.SELECT)
JSONObject findFileById(@Param("file_id") String file_id);
void deleteByClientAndFileId(@Param("file_id") String file_id);
} }

@ -44,6 +44,8 @@ public interface ClientMapper {
@AutoSql(SqlType.SELECT) @AutoSql(SqlType.SELECT)
JSONObject findClientIgnoreInvalid(int clientId); JSONObject findClientIgnoreInvalid(int clientId);
JSONObject findClientAprrovingStatus(@Param("client_id") int clientId);
@AutoSql(SqlType.SELECT) @AutoSql(SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1") @AdvanceSelect(addonWhereClause = "is_valid=1")
JSONObject findClientByMoniker(@Param("client_moniker") String clientMoniker); JSONObject findClientByMoniker(@Param("client_moniker") String clientMoniker);

@ -20,6 +20,9 @@ public interface ClientRateMapper {
List<JSONObject> listClientRates(@Param("client_id") int clientId, @Param("rate_name") String rateName); List<JSONObject> listClientRates(@Param("client_id") int clientId, @Param("rate_name") String rateName);
@AutoSql(SqlType.SELECT)
JSONObject findRateByRateId(@Param("client_rate_id") String rateId);
@AutoSql(SqlType.INSERT) @AutoSql(SqlType.INSERT)
void saveRate(JSONObject rateConfig); void saveRate(JSONObject rateConfig);
@ -39,21 +42,22 @@ public interface ClientRateMapper {
@Param("clean_days") Integer cleanDays, @Param("rate_name") String rateName); @Param("clean_days") Integer cleanDays, @Param("rate_name") String rateName);
List<JSONObject> latestConfig(@Param("client_id") int client_id, @Param("rate_name") String rate_name);
List<JSONObject> latestConfig(@Param("client_id")int client_id,@Param("rate_name") String rate_name);
//Task //Task
List<JSONObject> maxChannelExpiryTime(@Param("client_id")int client_id,@Param("rate_name")String rate_name); List<JSONObject> maxChannelExpiryTime(@Param("client_id") int client_id, @Param("rate_name") String rate_name);
List<JSONObject> getAllExpiry(@Param("expiry_date")Date expiry_date); List<JSONObject> getAllExpiry(@Param("expiry_date") Date expiry_date);
List<JSONObject> getAllClientRateExpiryMerchants(); List<JSONObject> getAllClientRateExpiryMerchants();
void postponeMerchantRateByClientId(int clientId); void postponeMerchantRateByClientId(int clientId);
JSONObject latestChannelCleanDays(@Param("rate_name")String rate_name, @Param("client_id")int client_id); JSONObject latestChannelCleanDays(@Param("rate_name") String rate_name, @Param("client_id") int client_id);
JSONObject latestCardChannelCleanDays(@Param("rate_name") String rate_name, @Param("client_id") int client_id);
JSONObject latestExpiryConfig(@Param("client_id")int client_id,@Param("rate_name") String rate_name); JSONObject latestExpiryConfig(@Param("client_id") int client_id, @Param("rate_name") String rate_name);
} }

@ -0,0 +1,19 @@
package au.com.royalpay.payment.manage.mappers.system;
import com.alibaba.fastjson.JSONObject;
import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper;
import com.yixsoft.support.mybatis.autosql.annotations.AutoSql;
import com.yixsoft.support.mybatis.autosql.annotations.SqlType;
import org.apache.ibatis.annotations.Param;
@AutoMapper(tablename = "sys_client_upay_profile", pkName = "client_id")
public interface SysClientUpayProfileMapper {
@AutoSql(SqlType.INSERT)
void save(JSONObject info);
@AutoSql(SqlType.UPDATE)
void update(JSONObject info);
@AutoSql(SqlType.SELECT)
JSONObject findInfo(@Param("client_id") int clientId);
}

@ -7,13 +7,20 @@ import org.apache.commons.lang3.StringUtils;
* Created by yishuqian on 07/03/2017. * Created by yishuqian on 07/03/2017.
*/ */
public class ClientMWAuthFilesInfo { public class ClientMWAuthFilesInfo {
private String upay_application_form; private String client_bank_file;
private String upay_agreement_file; private String client_company_file;
private String refund_exchange_policy;
private String upay_privacy_policy;
private String card_security_policy;
private String upay_promotional_offer;
private String upay_terms_conditions;
private String upay_offer_letter; private String upay_offer_letter;
private String upay_driver_license; private String upay_driver_license;
private String upay_residence_certificate; private String kyc_utility_bill_file;
private String upay_risk_level; private String upay_risk_level;
private String upay_risk_remark; private String upay_risk_remark;
private String upay_application_form;
private String upay_desc_file;
public JSONObject toJson(){ public JSONObject toJson(){
return (JSONObject)JSONObject.toJSON(this); return (JSONObject)JSONObject.toJSON(this);
@ -30,14 +37,6 @@ public class ClientMWAuthFilesInfo {
return params; return params;
} }
public String getUpay_agreement_file() {
return upay_agreement_file;
}
public String getUpay_application_form() {
return upay_application_form;
}
public String getUpay_driver_license() { public String getUpay_driver_license() {
return upay_driver_license; return upay_driver_license;
} }
@ -46,18 +45,6 @@ public class ClientMWAuthFilesInfo {
return upay_offer_letter; return upay_offer_letter;
} }
public void setUpay_agreement_file(String upay_agreement_file) {
this.upay_agreement_file = upay_agreement_file;
}
public void setUpay_application_form(String upay_application_form) {
this.upay_application_form = upay_application_form;
}
public String getUpay_residence_certificate() {
return upay_residence_certificate;
}
public String getUpay_risk_level() { public String getUpay_risk_level() {
return upay_risk_level; return upay_risk_level;
} }
@ -70,10 +57,6 @@ public class ClientMWAuthFilesInfo {
this.upay_offer_letter = upay_offer_letter; this.upay_offer_letter = upay_offer_letter;
} }
public void setUpay_residence_certificate(String upay_residence_certificate) {
this.upay_residence_certificate = upay_residence_certificate;
}
public String getUpay_risk_remark() { public String getUpay_risk_remark() {
return upay_risk_remark; return upay_risk_remark;
} }
@ -85,4 +68,84 @@ public class ClientMWAuthFilesInfo {
public void setUpay_risk_remark(String upay_risk_remark) { public void setUpay_risk_remark(String upay_risk_remark) {
this.upay_risk_remark = upay_risk_remark; this.upay_risk_remark = upay_risk_remark;
} }
public String getCard_security_policy() {
return card_security_policy;
}
public String getClient_bank_file() {
return client_bank_file;
}
public String getClient_company_file() {
return client_company_file;
}
public String getUpay_privacy_policy() {
return upay_privacy_policy;
}
public String getUpay_promotional_offer() {
return upay_promotional_offer;
}
public void setCard_security_policy(String card_security_policy) {
this.card_security_policy = card_security_policy;
}
public String getUpay_terms_conditions() {
return upay_terms_conditions;
}
public void setClient_bank_file(String client_bank_file) {
this.client_bank_file = client_bank_file;
}
public void setClient_company_file(String client_company_file) {
this.client_company_file = client_company_file;
}
public void setUpay_privacy_policy(String upay_privacy_policy) {
this.upay_privacy_policy = upay_privacy_policy;
}
public void setUpay_promotional_offer(String upay_promotional_offer) {
this.upay_promotional_offer = upay_promotional_offer;
}
public void setUpay_terms_conditions(String upay_terms_conditions) {
this.upay_terms_conditions = upay_terms_conditions;
}
public String getRefund_exchange_policy() {
return refund_exchange_policy;
}
public void setRefund_exchange_policy(String refund_exchange_policy) {
this.refund_exchange_policy = refund_exchange_policy;
}
public String getKyc_utility_bill_file() {
return kyc_utility_bill_file;
}
public void setKyc_utility_bill_file(String kyc_utility_bill_file) {
this.kyc_utility_bill_file = kyc_utility_bill_file;
}
public void setUpay_application_form(String upay_application_form) {
this.upay_application_form = upay_application_form;
}
public String getUpay_application_form() {
return upay_application_form;
}
public String getUpay_desc_file() {
return upay_desc_file;
}
public void setUpay_desc_file(String upay_desc_file) {
this.upay_desc_file = upay_desc_file;
}
} }

@ -25,7 +25,7 @@ public class ClientRateConfig {
@JSONField(name = "transaction_fee") @JSONField(name = "transaction_fee")
@NotNull(message = "error.payment.valid.param_missing") @NotNull(message = "error.payment.valid.param_missing")
private Double transactionFee; private Double transactionFee = 0.00;
@JSONField(name = "active_time") @JSONField(name = "active_time")
@NotNull(message = "error.payment.valid.param_missing") @NotNull(message = "error.payment.valid.param_missing")

@ -25,13 +25,13 @@ public class ClientRegisterInfo {
private String businessName; private String businessName;
@JSONField(name = "business_structure") @JSONField(name = "business_structure")
private String businessStructure; private String businessStructure;
// @NotEmpty(message = "error.payment.valid.param_missing") // @NotEmpty(message = "error.payment.valid.param_missing")
private String abn; private String abn;
private String acn; private String acn;
// @NotEmpty(message = "error.payment.valid.param_missing") // @NotEmpty(message = "error.payment.valid.param_missing")
private String industry; private String industry;
@JSONField(name = "alipayindustry") @JSONField(name = "alipayindustry")
/* @NotEmpty(message = "error.payment.valid.param_missing")*/ /* @NotEmpty(message = "error.payment.valid.param_missing")*/
private String alipayIndustry; private String alipayIndustry;
@JSONField(name = "company_photo") @JSONField(name = "company_photo")
private String companyPhoto; private String companyPhoto;
@ -60,7 +60,7 @@ public class ClientRegisterInfo {
private String postcode; private String postcode;
private String state; private String state;
@JSONField(name = "legal_representative_person") @JSONField(name = "legal_representative_person")
private String representativePerson ; private String representativePerson;
@JSONField(name = "legal_representative_phone") @JSONField(name = "legal_representative_phone")
private String representativePhone; private String representativePhone;
@JSONField(name = "legal_representative_email") @JSONField(name = "legal_representative_email")
@ -68,7 +68,7 @@ public class ClientRegisterInfo {
@JSONField(name = "legal_representative_job") @JSONField(name = "legal_representative_job")
private String representativeJobTitle; private String representativeJobTitle;
@JSONField(name = "marketing_person") @JSONField(name = "marketing_person")
private String marketingPerson ; private String marketingPerson;
@JSONField(name = "marketing_phone") @JSONField(name = "marketing_phone")
private String marketingPhone; private String marketingPhone;
@JSONField(name = "marketing_email") @JSONField(name = "marketing_email")
@ -112,10 +112,29 @@ public class ClientRegisterInfo {
private String client_pay_type; private String client_pay_type;
@NotEmpty(message = "error.payment.valid.param_missing") @NotEmpty(message = "error.payment.valid.param_missing")
private String client_pay_desc; private String client_pay_desc;
@JSONField(name = "it_contact_person_email")
private String itContactPersonEmail;
@JSONField(name = "acceptor_name")
private String acceptorName;
@JSONField(name = "expected_card_revenue")
private String expectCardRevenue;
@JSONField(name = "average_card_transaction")
private String averageCardTransaction;
@JSONField(name = "mw_industry")
private String mwIndustry;
@JSONField(name = "enable_international_card")
private boolean enableInternaltionCard;
@JSONField(name = "enable_cross_payment")
private boolean enableCrossPayment = true;
@JSONField(name = "enable_card_payment")
private boolean enableCardPayment = false;
public JSONObject insertObject() { public JSONObject insertObject() {
if (industry == null) {
setIndustry("331");
}
JSONObject res = (JSONObject) JSON.toJSON(this); JSONObject res = (JSONObject) JSON.toJSON(this);
if (client_apply_id==null){ if (client_apply_id == null) {
res.remove("client_apply_id"); res.remove("client_apply_id");
} }
return res; return res;
@ -550,4 +569,68 @@ public class ClientRegisterInfo {
public void setMarketingWechatId(String marketingWechatId) { public void setMarketingWechatId(String marketingWechatId) {
this.marketingWechatId = marketingWechatId; this.marketingWechatId = marketingWechatId;
} }
public String getItContactPersonEmail() {
return itContactPersonEmail;
}
public void setItContactPersonEmail(String itContactPersonEmail) {
this.itContactPersonEmail = itContactPersonEmail;
}
public void setAcceptorName(String acceptorName) {
this.acceptorName = acceptorName;
}
public String getAcceptorName() {
return acceptorName;
}
public boolean isEnableInternaltionCard() {
return enableInternaltionCard;
}
public String getAverageCardTransaction() {
return averageCardTransaction;
}
public String getExpectCardRevenue() {
return expectCardRevenue;
}
public String getMwIndustry() {
return mwIndustry;
}
public void setAverageCardTransaction(String averageCardTransaction) {
this.averageCardTransaction = averageCardTransaction;
}
public void setEnableInternaltionCard(boolean enableInternaltionCard) {
this.enableInternaltionCard = enableInternaltionCard;
}
public void setExpectCardRevenue(String expectCardRevenue) {
this.expectCardRevenue = expectCardRevenue;
}
public void setMwIndustry(String mwIndustry) {
this.mwIndustry = mwIndustry;
}
public boolean isEnableCardPayment() {
return enableCardPayment;
}
public boolean isEnableCrossPayment() {
return enableCrossPayment;
}
public void setEnableCardPayment(boolean enableCardPayment) {
this.enableCardPayment = enableCardPayment;
}
public void setEnableCrossPayment(boolean enableCrossPayment) {
this.enableCrossPayment = enableCrossPayment;
}
} }

@ -51,6 +51,7 @@ public class PartnerQuery {
private boolean bd_upload_material = false; private boolean bd_upload_material = false;
private boolean is_valid = false; private boolean is_valid = false;
private String merchant_id; private String merchant_id;
private boolean card_approving = false;
public String getClient_moniker() { public String getClient_moniker() {
return StringUtils.isEmpty(client_moniker) ? null : client_moniker; return StringUtils.isEmpty(client_moniker) ? null : client_moniker;
@ -120,6 +121,9 @@ public class PartnerQuery {
if (approving) { if (approving) {
param.put("approving", true); param.put("approving", true);
} }
if(card_approving){
param.put("card_approving",true);
}
if (org_id != null) { if (org_id != null) {
param.put("org_id", org_id); param.put("org_id", org_id);
} }
@ -472,4 +476,12 @@ public class PartnerQuery {
public void setSuburb(String suburb) { public void setSuburb(String suburb) {
this.suburb = suburb; this.suburb = suburb;
} }
public boolean isCard_approving() {
return card_approving;
}
public void setCard_approving(boolean card_approving) {
this.card_approving = card_approving;
}
} }

@ -69,9 +69,6 @@ public interface ClientManager {
@Transactional @Transactional
void updateClientRpayPaymentConfig(JSONObject manager, String clientMoniker, JSONObject rpaySubMerchantInfo); void updateClientRpayPaymentConfig(JSONObject manager, String clientMoniker, JSONObject rpaySubMerchantInfo);
@Transactional
void updateClientYeepayPaymentConfig(JSONObject manager, String clientMoniker, JSONObject yeepaySubMerchantInfo);
@Transactional @Transactional
void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo); void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo);
@ -82,23 +79,24 @@ public interface ClientManager {
void auditClient(JSONObject manager, String clientMoniker, int pass); void auditClient(JSONObject manager, String clientMoniker, int pass);
@Transactional(noRollbackFor = EmailException.class) @Transactional(noRollbackFor = EmailException.class)
void auditClientGreenChannel(JSONObject manager, String clientMoniker); void auditCardClient(JSONObject manager, String clientMoniker, int pass);
void checkAndSendInitEmail(JSONObject manager, String clientMoniker); @Transactional(noRollbackFor = EmailException.class)
void auditClientGreenChannel(JSONObject manager, String clientMoniker);
void sendOpenEmail(final JSONObject client, String username, String pwd); void checkAndSendInitEmail(JSONObject manager, String clientMoniker,String type);
// void sendInitEmail(JSONObject account,JSONObject client, String username, String pwd);
void markApproveEmailSendStatus(String clientMoniker, JSONObject manager); void markApproveEmailSendStatus(String clientMoniker, JSONObject manager);
void checkEmailStatus(); void checkEmailStatus();
void newCheckEmailStatus();
@Transactional @Transactional
void switchPermission(JSONObject manager, String clientMoniker, String permissionKey, boolean allow); void switchPermission(JSONObject manager, String clientMoniker, String permissionKey, boolean allow);
@Transactional
void modifyUPayProfile(JSONObject manager, String clientMoniker, String profileKey, boolean allow);
@Transactional @Transactional
void switchChannelPermission(JSONObject manager, String clientMoniker, String channel, boolean allow); void switchChannelPermission(JSONObject manager, String clientMoniker, String channel, boolean allow);
@ -176,7 +174,7 @@ public interface ClientManager {
List<JSONObject> listSubClients(JSONObject manager, String clientMoniker); List<JSONObject> listSubClients(JSONObject manager, String clientMoniker);
JSONObject listSubClientsByPage(JSONObject manager, String clientMoniker,String searchText, int page); JSONObject listSubClientsByPage(JSONObject manager, String clientMoniker, String searchText, int page);
List<JSONObject> listSubClients(int clientId); List<JSONObject> listSubClients(int clientId);
@ -210,6 +208,7 @@ public interface ClientManager {
/** /**
* Id * Id
*
* @param clientMoniker * @param clientMoniker
* @param client_type * @param client_type
* @param client_ids * @param client_ids
@ -253,9 +252,9 @@ public interface ClientManager {
void revertClient(String clientMoniker, JSONObject manager); void revertClient(String clientMoniker, JSONObject manager);
void updateClientIdInfo(String clientMoniker,JSONObject params, JSONObject manager); void updateClientIdInfo(String clientMoniker, JSONObject params, JSONObject manager);
void updateMWRiskInfoByClient(String clientMoniker,JSONObject params, JSONObject manager); void updateMWRiskInfoByClient(String clientMoniker, JSONObject params, JSONObject manager);
JSONObject getAuthFiles(JSONObject manager, String clientMoniker); JSONObject getAuthFiles(JSONObject manager, String clientMoniker);
@ -269,10 +268,14 @@ public interface ClientManager {
JSONObject getSourceAgreeFiles(JSONObject manage, String clientMoniker); JSONObject getSourceAgreeFiles(JSONObject manage, String clientMoniker);
JSONObject getSourceCardAgreeFiles(String clientMoniker, JSONObject manager, String fileName);
void deleteAuthFiles(String fileId); void deleteAuthFiles(String fileId);
void deleteAuthFilesByAdmin(String fileId); void deleteAuthFilesByAdmin(String fileId);
void deleteMWAuthFilesByAdmin(String fileId);
void uploadAuthFiles(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo); void uploadAuthFiles(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo);
void uploadAuthFilesManager(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo); void uploadAuthFilesManager(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo);
@ -283,7 +286,7 @@ public interface ClientManager {
List<JSONObject> uploadKycFilesForWaitCompliance(JSONObject manager, String clientMoniker, ClientKycFilesInfo filesInfo); List<JSONObject> uploadKycFilesForWaitCompliance(JSONObject manager, String clientMoniker, ClientKycFilesInfo filesInfo);
List<JSONObject> uploadKycFilesForWaitComplianceForApp(JSONObject account, String clientMoniker, JSONObject filesInfo,String fileType); List<JSONObject> uploadKycFilesForWaitComplianceForApp(JSONObject account, String clientMoniker, JSONObject filesInfo, String fileType);
List<JSONObject> uploadAuthFilesForWaitCompliance(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo); List<JSONObject> uploadAuthFilesForWaitCompliance(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo);
@ -297,8 +300,18 @@ public interface ClientManager {
void commitToCompliance(String clientMoniker, JSONObject manager); void commitToCompliance(String clientMoniker, JSONObject manager);
void commitToCardCompliance(String clientMoniker, JSONObject manager);
void commitToDoAgreeFile(String clientMoniker, JSONObject manager); void commitToDoAgreeFile(String clientMoniker, JSONObject manager);
/**
*
*
* @param clientMoniker
* @param manager
*/
void commitToDoCardAgreeFile(String clientMoniker, JSONObject manager);
void commitToGreenChannel(String clientMoniker, JSONObject manager); void commitToGreenChannel(String clientMoniker, JSONObject manager);
void changePaymentPage(JSONObject manager, String clientMoniker, String paypad_version); void changePaymentPage(JSONObject manager, String clientMoniker, String paypad_version);
@ -335,6 +348,8 @@ public interface ClientManager {
void refusePartner(String clientMoniker, JSONObject manager, String refuse_remark); void refusePartner(String clientMoniker, JSONObject manager, String refuse_remark);
void cardRefusePartner(String clientMoniker, JSONObject manager, String refuse_remark);
JSONArray getAllClientIds(int clientId); JSONArray getAllClientIds(int clientId);
void updateAppClient(JSONObject account, int client_id, AppClientBean appClientBean); void updateAppClient(JSONObject account, int client_id, AppClientBean appClientBean);
@ -375,6 +390,10 @@ public interface ClientManager {
void getAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception; void getAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception;
void getAggregateCardAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception;
void getAggregateCardPromotionaAgreeFile(String clientMoniker, JSONObject manager, boolean renewal,String rateid,HttpServletResponse httpResponse);
void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception; void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception;
void temporaryExportPdf(String clientMoniker, JSONObject manager, HttpServletResponse httpResponse) throws Exception; void temporaryExportPdf(String clientMoniker, JSONObject manager, HttpServletResponse httpResponse) throws Exception;
@ -383,6 +402,8 @@ public interface ClientManager {
void completeAgree(String clientMoniker, JSONObject manager); void completeAgree(String clientMoniker, JSONObject manager);
void cardCompleteAgree(String clientMoniker, JSONObject manager);
void downloadComplianceZip(@PathVariable String clientMoniker, HttpServletResponse response) throws Exception; void downloadComplianceZip(@PathVariable String clientMoniker, HttpServletResponse response) throws Exception;
void downloadMWComplianceZip(@PathVariable String clientMoniker, HttpServletResponse response) throws Exception; void downloadMWComplianceZip(@PathVariable String clientMoniker, HttpServletResponse response) throws Exception;
@ -410,8 +431,6 @@ public interface ClientManager {
List<JSONObject> listRpaySubMerchantIdApplys(JSONObject manager, String clientMoniker); List<JSONObject> listRpaySubMerchantIdApplys(JSONObject manager, String clientMoniker);
List<JSONObject> listYeepaySubMerchantIdApplys(JSONObject manager, String clientMoniker);
String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager); String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager);
void registerAlipayGms(String clientMoniker, JSONObject manager); void registerAlipayGms(String clientMoniker, JSONObject manager);
@ -468,12 +487,6 @@ public interface ClientManager {
void subRpayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager); void subRpayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager);
void subYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager);
void subYeepayMerchantAdd(String clientMoniker, JSONObject merchantInfo, JSONObject manager);
void reSubYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager);
void updateAllPartnerPassword(String clientMoniker); void updateAllPartnerPassword(String clientMoniker);
void postponeClientRate(Date now, Date yearTomorrow, String expireDate, JSONObject client); void postponeClientRate(Date now, Date yearTomorrow, String expireDate, JSONObject client);
@ -574,7 +587,7 @@ public interface ClientManager {
boolean getMergeSettleStatus(JSONObject client); boolean getMergeSettleStatus(JSONObject client);
void changeExtParams(String clientMoniker,JSONObject manager, JSONObject params); void changeExtParams(String clientMoniker, JSONObject manager, JSONObject params);
RPayMerchantEntity applyMWMerchantId(String clientMoniker, JSONObject manager); RPayMerchantEntity applyMWMerchantId(String clientMoniker, JSONObject manager);

@ -1,19 +1,21 @@
package au.com.royalpay.payment.manage.merchants.core; package au.com.royalpay.payment.manage.merchants.core;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify; import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModifyOperation;
/** /**
* Create by yixian at 2018-04-12 16:24 * Create by yixian at 2018-04-12 16:24
*/ */
public interface ClientModifySupport { public interface ClientModifySupport {
void processModify(ClientModifyOperation modify);
void processClientModify(ClientModify clientModify); void processClientModify(ClientModify clientModify);
void processClientConfigModify(ClientConfigModify clientConfigModify); void processClientConfigModify(ClientModify clientConfigModify);
void processClientConfigModify(ClientConfigModify clientConfigModify, boolean onlyModifyConfig); void processClientConfigModify(ClientModify clientConfigModify, boolean onlyModifyConfig);
void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify); void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify);
} }

@ -5,11 +5,10 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.MerchantSignInfoMapper; import au.com.royalpay.payment.manage.mappers.system.MerchantSignInfoMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport; import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport;
import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport; import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify; import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModifyOperation;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -34,26 +33,36 @@ public class ClientModifySupportImpl implements ClientModifySupport {
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
@Override @Override
public void processClientModify(ClientModify modify) { public void processModify(ClientModifyOperation modify) {
int clientId = modify.doModify(merchantInfoProvider, clientMapper,mongoTemplate); int clientId = modify.processModify(merchantInfoProvider, mongoTemplate);
clientInfoCacheSupport.clearClientCache(clientId); clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
public void processClientConfigModify(ClientConfigModify clientConfigModify) { public void processClientModify(ClientModify modify) {
int clientId =clientConfigModify.doModify(merchantInfoProvider, clientConfigMapper,clientMapper,mongoTemplate); processModify(modify.setModifyConsumer(modifyObj -> clientMapper.update(modifyObj)));
clientInfoCacheSupport.clearClientCache(clientId);
} }
@Override @Override
public void processClientConfigModify(ClientConfigModify clientConfigModify,boolean onlyModifyConfig) { public void processClientConfigModify(ClientModify clientConfigModify) {
int clientId =clientConfigModify.doModify(merchantInfoProvider, clientConfigMapper,clientMapper,mongoTemplate,onlyModifyConfig); processModify(clientConfigModify.setModifyConsumer(modifyObj -> {
clientInfoCacheSupport.clearClientConfigCache(clientId); clientMapper.update(modifyObj);
clientConfigMapper.update(modifyObj);
}));
}
@Override
public void processClientConfigModify(ClientModify clientConfigModify, boolean onlyModifyConfig) {
processModify(clientConfigModify.setModifyConsumer(modifyObj -> {
if (!onlyModifyConfig) {
clientMapper.update(modifyObj);
}
clientConfigMapper.update(modifyObj);
}));
} }
@Override @Override
public void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify) { public void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify) {
int clientId =clientGatewaySignModify.doModify(merchantInfoProvider, merchantSignInfoMapper,mongoTemplate); processModify(clientGatewaySignModify.setMerchantSignInfoMapper(merchantSignInfoMapper));
clientInfoCacheSupport.clearClientCache(clientId);
} }
} }

@ -1,78 +1,39 @@
package au.com.royalpay.payment.manage.merchants.entity; package au.com.royalpay.payment.manage.merchants.entity;
import au.com.royalpay.payment.manage.mappers.system.MerchantSignInfoMapper; import au.com.royalpay.payment.manage.mappers.system.MerchantSignInfoMapper;
import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.id.IdUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.function.Consumer;
import java.util.stream.Collectors;
/** /**
* Create by yixian at 2018-04-12 16:19 * Create by yixian at 2018-04-12 16:19
*/ */
public abstract class ClientGatewaySignModify { public abstract class ClientGatewaySignModify extends ClientModifyOperation {
private JSONObject account; private MerchantSignInfoMapper merchantSignInfoMapper;
private String clientMoniker;
public ClientGatewaySignModify(JSONObject account, String clientMoniker) { public ClientGatewaySignModify(JSONObject account, String clientMoniker) {
this.account = account; super(account, clientMoniker);
this.clientMoniker = clientMoniker;
} }
protected abstract String business(); protected abstract String business();
protected abstract JSONObject getModifyResult(); protected abstract JSONObject getModifyResult();
@Transactional @Override
public int doModify(MerchantInfoProvider merchantInfoProvider, MerchantSignInfoMapper merchantSignInfoMapper, MongoTemplate mongoTemplate) { protected Consumer<JSONObject> getModifyProcess() {
JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker); return client -> {
JSONObject clientGatewaySign = merchantSignInfoMapper.findClientSign(clientMoniker); JSONObject modifyResult = getModifyResult();
JSONObject modifyResult = getModifyResult(); modifyResult.put("client_moniker", getClientMoniker());
try { modifyResult.put("last_update_by", getAccount().getString("account_id"));
saveModifyHistory(clientGatewaySign, modifyResult, mongoTemplate); modifyResult.put("last_update_date", new Date());
}catch (Exception e){ merchantSignInfoMapper.update(modifyResult);
};
}
int clientId = client.getIntValue("client_id");
modifyResult.put("client_moniker", clientMoniker);
modifyResult.put("last_update_by", account.getString("account_id"));
modifyResult.put("last_update_date", new Date());
merchantSignInfoMapper.update(modifyResult);
return clientId;
} }
private void saveModifyHistory(JSONObject clientGatewaySign, JSONObject modifyResult, MongoTemplate mongoTemplate) { public ClientGatewaySignModify setMerchantSignInfoMapper(MerchantSignInfoMapper merchantSignInfoMapper) {
if (account == null) { this.merchantSignInfoMapper = merchantSignInfoMapper;
return; return this;
}
ClientConfigLog clientConfigLog = new ClientConfigLog();
clientConfigLog.setId(IdUtil.getId());
clientConfigLog.setBusiness(business());
clientConfigLog.setClientId(clientGatewaySign.getIntValue("client_id"));
boolean isPartner = true;
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
isPartner = true;
}
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
isPartner = false;
}
clientConfigLog.setUserType(isPartner ? "Merchant" : "Manager");
clientConfigLog.setCreateTime(new Date());
clientConfigLog.setNewData(modifyResult.toJSONString());
clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id"));
Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, clientGatewaySign::get));
clientConfigLog.setOriginData(JSON.toJSONString(beforeModify));
clientConfigLog.setUserName(isPartner ? account.getString("display_name") : account.getString("display_name"));
mongoTemplate.save(clientConfigLog);
} }
} }

@ -1,77 +1,32 @@
package au.com.royalpay.payment.manage.merchants.entity; package au.com.royalpay.payment.manage.merchants.entity;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.id.IdUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import java.util.function.Consumer;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* Create by yixian at 2018-04-12 16:19 * Create by yixian at 2018-04-12 16:19
*/ */
public abstract class ClientModify { public abstract class ClientModify extends ClientModifyOperation {
private JSONObject account; private Consumer<JSONObject> modifyConsumer;
private String clientMoniker;
public ClientModify(JSONObject account, String clientMoniker) { public ClientModify(JSONObject account, String clientMoniker) {
this.account = account; super(account, clientMoniker);
this.clientMoniker = clientMoniker;
} }
protected abstract String business(); @Override
protected Consumer<JSONObject> getModifyProcess() {
protected abstract JSONObject getModifyResult(); return client -> {
JSONObject modifyResult = getModifyResult();
@Transactional int clientId = client.getIntValue("client_id");
public int doModify(MerchantInfoProvider merchantInfoProvider, ClientMapper clientMapper, MongoTemplate mongoTemplate) { modifyResult.put("client_id", clientId);
JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker); modifyConsumer.accept(modifyResult);
JSONObject modifyResult = getModifyResult(); };
try {
saveModifyHistory(client, modifyResult, mongoTemplate);
}catch (Exception e){
}
int clientId = client.getIntValue("client_id");
modifyResult.put("client_id", clientId);
clientMapper.update(modifyResult);
return clientId;
} }
private void saveModifyHistory(JSONObject client, JSONObject modifyResult, MongoTemplate mongoTemplate) { public ClientModify setModifyConsumer(Consumer<JSONObject> modifyConsumer) {
if (account == null) { this.modifyConsumer = modifyConsumer;
return; return this;
}
ClientConfigLog clientConfigLog = new ClientConfigLog();
clientConfigLog.setId(IdUtil.getId());
clientConfigLog.setBusiness(business());
clientConfigLog.setClientId(client.getIntValue("client_id"));
boolean isPartner = true;
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
isPartner = true;
}
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
isPartner = false;
}
clientConfigLog.setUserType(isPartner ? "Merchant" : "Manager");
clientConfigLog.setCreateTime(new Date());
clientConfigLog.setNewData(modifyResult.toJSONString());
clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id"));
Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, client::get));
clientConfigLog.setOriginData(JSON.toJSONString(beforeModify));
clientConfigLog.setUserName(isPartner ? account.getString("display_name") : account.getString("display_name"));
mongoTemplate.save(clientConfigLog);
} }
} }

@ -1,32 +1,26 @@
package au.com.royalpay.payment.manage.merchants.entity; package au.com.royalpay.payment.manage.merchants.entity;
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog; import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.id.IdUtil; import au.com.royalpay.payment.tools.utils.id.IdUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* Create by yixian at 2018-04-12 16:19 * Create by davep at 2020-05-12 14:32
*/ */
public abstract class ClientConfigModify { public abstract class ClientModifyOperation {
private final JSONObject account;
private JSONObject account; private final String clientMoniker;
private String clientMoniker;
public ClientConfigModify(JSONObject account, String clientMoniker) { protected ClientModifyOperation(JSONObject account, String clientMoniker) {
this.account = account; this.account = account;
this.clientMoniker = clientMoniker; this.clientMoniker = clientMoniker;
} }
@ -35,36 +29,21 @@ public abstract class ClientConfigModify {
protected abstract JSONObject getModifyResult(); protected abstract JSONObject getModifyResult();
public int doModify(MerchantInfoProvider merchantInfoProvider, ClientConfigMapper clientConfigMapper, ClientMapper clientMapper, MongoTemplate mongoTemplate) { protected abstract Consumer<JSONObject> getModifyProcess();
JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker);
JSONObject modifyResult = getModifyResult();
try {
saveModifyHistory(client, modifyResult, mongoTemplate);
}catch (Exception e){
} public int processModify(MerchantInfoProvider merchantInfoProvider, MongoTemplate mongoTemplate) {
int clientId = client.getIntValue("client_id"); JSONObject client = merchantInfoProvider.getClientInfoByMoniker(getClientMoniker());
modifyResult.put("client_id", clientId);
clientConfigMapper.update(modifyResult);
clientMapper.update(modifyResult);
return clientId;
}
public int doModify(MerchantInfoProvider merchantInfoProvider, ClientConfigMapper clientConfigMapper, ClientMapper clientMapper, MongoTemplate mongoTemplate,boolean onlyModifyConfig) {
JSONObject clientConfig = merchantInfoProvider.getClientConfigInfoByMoniker(clientMoniker);
JSONObject modifyResult = getModifyResult(); JSONObject modifyResult = getModifyResult();
try { try {
saveModifyHistory(clientConfig, modifyResult, mongoTemplate); saveModifyHistory(client, modifyResult, mongoTemplate);
}catch (Exception e){ } catch (Exception e) {
} }
int clientId = clientConfig.getIntValue("client_id"); getModifyProcess().accept(client);
modifyResult.put("client_id", clientId); return client.getIntValue("client_id");
clientConfigMapper.update(modifyResult);
return clientId;
} }
private void saveModifyHistory(JSONObject client, JSONObject modifyResult,MongoTemplate mongoTemplate) { protected void saveModifyHistory(JSONObject client, JSONObject modifyResult, MongoTemplate mongoTemplate) {
if (account == null) { if (account == null) {
return; return;
} }
@ -86,7 +65,15 @@ public abstract class ClientConfigModify {
clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id")); clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id"));
Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, client::get)); Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, client::get));
clientConfigLog.setOriginData(JSON.toJSONString(beforeModify)); clientConfigLog.setOriginData(JSON.toJSONString(beforeModify));
clientConfigLog.setUserName(isPartner ? account.getString("display_name") : account.getString("display_name")); clientConfigLog.setUserName(account.getString("display_name"));
mongoTemplate.insert(clientConfigLog); mongoTemplate.insert(clientConfigLog);
} }
public JSONObject getAccount() {
return account;
}
public String getClientMoniker() {
return clientMoniker;
}
} }

@ -1,17 +1,17 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class CBBankPaypadVersionModify extends ClientConfigModify { public class CBBankPaypadVersionModify extends ClientModify {
private String cbbank_paypad_version; private String cbbankPaypadVersion;
public CBBankPaypadVersionModify(JSONObject account, String clientMoniker, String paypad_version) { public CBBankPaypadVersionModify(JSONObject account, String clientMoniker, String paypad_version) {
super(account, clientMoniker); super(account, clientMoniker);
this.cbbank_paypad_version = paypad_version; this.cbbankPaypadVersion = paypad_version;
} }
@Override @Override
@ -23,7 +23,7 @@ public class CBBankPaypadVersionModify extends ClientConfigModify {
@Override @Override
protected JSONObject getModifyResult() { protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject(); JSONObject modify = new JSONObject();
modify.put("cbbank_paypad_version", cbbank_paypad_version); modify.put("cbbank_paypad_version", cbbankPaypadVersion);
return modify; return modify;
} }
} }

@ -1,30 +1,29 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class ClearDaysModify extends ClientConfigModify { public class ClearDaysModify extends ClientModify {
private int settle_hour; private int settleHour;
public ClearDaysModify(JSONObject account, String clientMoniker, int settle_hour) { public ClearDaysModify(JSONObject account, String clientMoniker, int settleHour) {
super(account, clientMoniker); super(account, clientMoniker);
this.settle_hour = settle_hour; this.settleHour = settleHour;
} }
@Override @Override
protected String business() { protected String business() {
return "修改商户清算截止时间为:"+settle_hour; return "修改商户清算截止时间为:" + settleHour;
} }
@Override @Override
protected JSONObject getModifyResult() { protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject(); JSONObject modify = new JSONObject();
modify.put("settle_hour", settle_hour); modify.put("settle_hour", settleHour);
return modify; return modify;
} }
} }

@ -1,19 +1,18 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class CredentialCodeModify extends ClientConfigModify { public class CredentialCodeModify extends ClientModify {
private String credential_code; private String credentialCode;
public CredentialCodeModify(JSONObject account, String clientMoniker, String credential_code) { public CredentialCodeModify(JSONObject account, String clientMoniker, String credentialCode) {
super(account, clientMoniker); super(account, clientMoniker);
this.credential_code = credential_code; this.credentialCode = credentialCode;
} }
@Override @Override
@ -24,7 +23,7 @@ public class CredentialCodeModify extends ClientConfigModify {
@Override @Override
protected JSONObject getModifyResult() { protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject(); JSONObject modify = new JSONObject();
modify.put("credential_code", credential_code); modify.put("credential_code", credentialCode);
return modify; return modify;
} }
} }

@ -0,0 +1,43 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientModifyOperation;
import com.alibaba.fastjson.JSONObject;
import java.util.function.Consumer;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class CustomSwitchModify extends ClientModifyOperation {
private final String key;
private final boolean value;
private final Consumer<JSONObject> modifyProcess;
public CustomSwitchModify(JSONObject account, String clientMoniker, String key, boolean value, Consumer<JSONObject> modifyProcess) {
super(account, clientMoniker);
this.key = key;
this.value = value;
this.modifyProcess = modifyProcess;
}
@Override
protected String business() {
return (value ? "开启 " : "关闭 ") + key;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put(key, value);
return modify;
}
@Override
protected Consumer<JSONObject> getModifyProcess() {
return modifyProcess;
}
}

@ -1,7 +1,6 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -9,24 +8,24 @@ import java.math.BigDecimal;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class CustomerSurchargeRateModify extends ClientConfigModify { public class CustomerSurchargeRateModify extends ClientModify {
private BigDecimal customer_surcharge_rate; private BigDecimal customerSurchargeRate;
public CustomerSurchargeRateModify(JSONObject account, String clientMoniker, BigDecimal customer_surcharge_rate) { public CustomerSurchargeRateModify(JSONObject account, String clientMoniker, BigDecimal customerSurchargeRate) {
super(account, clientMoniker); super(account, clientMoniker);
this.customer_surcharge_rate = customer_surcharge_rate; this.customerSurchargeRate = customerSurchargeRate;
} }
@Override @Override
protected String business() { protected String business() {
return "修改商户客户手续费率为:"+customer_surcharge_rate; return "修改商户客户手续费率为:" + customerSurchargeRate;
} }
@Override @Override
protected JSONObject getModifyResult() { protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject(); JSONObject modify = new JSONObject();
modify.put("customer_surcharge_rate", customer_surcharge_rate); modify.put("customer_surcharge_rate", customerSurchargeRate);
return modify; return modify;
} }
} }

@ -1,7 +1,6 @@
package au.com.royalpay.payment.manage.merchants.entity.impls; package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -9,24 +8,24 @@ import java.math.BigDecimal;
/** /**
* Create by yixian at 2018-04-12 16:43 * Create by yixian at 2018-04-12 16:43
*/ */
public class EmailSendStandByModify extends ClientConfigModify { public class EmailSendStandByModify extends ClientModify {
private BigDecimal max_order_amount; private BigDecimal maxOrderAmount;
public EmailSendStandByModify(JSONObject account, String clientMoniker, BigDecimal max_order_amount) { public EmailSendStandByModify(JSONObject account, String clientMoniker, BigDecimal maxOrderAmount) {
super(account, clientMoniker); super(account, clientMoniker);
this.max_order_amount = max_order_amount; this.maxOrderAmount = maxOrderAmount;
} }
@Override @Override
protected String business() { protected String business() {
return "修改商户最大订单额为:"+max_order_amount; return "修改商户最大订单额为:" + maxOrderAmount;
} }
@Override @Override
protected JSONObject getModifyResult() { protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject(); JSONObject modify = new JSONObject();
modify.put("max_order_amount", max_order_amount); modify.put("max_order_amount", maxOrderAmount);
return modify; return modify;
} }
} }

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save