diff --git a/docs/sql/init.sql b/docs/sql/init.sql index 0aa6c0e..20029f9 100644 --- a/docs/sql/init.sql +++ b/docs/sql/init.sql @@ -460,6 +460,9 @@ insert into t_sys_entitlement values('ENT_ORDER', '订单管理', 'transaction', insert into t_sys_entitlement values('ENT_REFUND_ORDER', '退款订单', 'exception', '/refund', 'RefundOrderListPage', 'ML', 0, 1, 'ENT_ORDER', '20', 'MGR', now(), now()); insert into t_sys_entitlement values('ENT_REFUND_LIST', '页面:退款订单列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_REFUND_ORDER', '0', 'MGR', now(), now()); insert into t_sys_entitlement values('ENT_REFUND_ORDER_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_REFUND_ORDER', '0', 'MGR', now(), now()); + insert into t_sys_entitlement values('ENT_TRANSFER_ORDER', '转账订单', 'property-safety', '/transfer', 'TransferOrderListPage', 'ML', 0, 1, 'ENT_ORDER', '25', 'MGR', now(), now()); + insert into t_sys_entitlement values('ENT_TRANSFER_ORDER_LIST', '页面:转账订单列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_TRANSFER_ORDER', '0', 'MGR', now(), now()); + insert into t_sys_entitlement values('ENT_TRANSFER_ORDER_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_TRANSFER_ORDER', '0', 'MGR', now(), now()); insert into t_sys_entitlement values('ENT_MCH_NOTIFY', '商户通知', 'notification', '/notify', 'MchNotifyListPage', 'ML', 0, 1, 'ENT_ORDER', '30', 'MGR', now(), now()); insert into t_sys_entitlement values('ENT_NOTIFY_LIST', '页面:商户通知列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_NOTIFY', '0', 'MGR', now(), now()); insert into t_sys_entitlement values('ENT_MCH_NOTIFY_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_NOTIFY', '0', 'MGR', now(), now()); @@ -553,6 +556,9 @@ insert into t_sys_entitlement values('ENT_ORDER', '订单中心', 'transaction', insert into t_sys_entitlement values('ENT_REFUND_ORDER', '退款记录', 'exception', '/refund', 'RefundOrderListPage', 'ML', 0, 1, 'ENT_ORDER', '20', 'MCH', now(), now()); insert into t_sys_entitlement values('ENT_REFUND_LIST', '页面:退款订单列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_REFUND_ORDER', '0', 'MCH', now(), now()); insert into t_sys_entitlement values('ENT_REFUND_ORDER_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_REFUND_ORDER', '0', 'MCH', now(), now()); + insert into t_sys_entitlement values('ENT_TRANSFER_ORDER', '转账订单', 'property-safety', '/transfer', 'TransferOrderListPage', 'ML', 0, 1, 'ENT_ORDER', '30', 'MCH', now(), now()); + insert into t_sys_entitlement values('ENT_TRANSFER_ORDER_LIST', '页面:转账订单列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_TRANSFER_ORDER', '0', 'MCH', now(), now()); + insert into t_sys_entitlement values('ENT_TRANSFER_ORDER_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_TRANSFER_ORDER', '0', 'MCH', now(), now()); -- 【商户系统】 系统管理 insert into t_sys_entitlement values('ENT_SYS_CONFIG', '系统管理', 'setting', '', 'RouteView', 'ML', 0, 1, 'ROOT', '200', 'MCH', now(), now()); diff --git a/docs/sql/patch.sql b/docs/sql/patch.sql index 1c6f371..65a920d 100644 --- a/docs/sql/patch.sql +++ b/docs/sql/patch.sql @@ -43,3 +43,49 @@ VALUES ('ysfpay', '云闪付官方', 0, 1, 1, 'http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/ysfpay.png', 'red', 1, '云闪付官方通道'); ## -- ++++ ++++ + +## -- ++++ [v1.5.1] ===> [v1.6.0] ++++ +## -- 新增: 转账接口 + +-- 转账订单表 +DROP TABLE IF EXISTS t_transfer_order; +CREATE TABLE `t_transfer_order` ( + `transfer_id` VARCHAR(32) NOT NULL COMMENT '转账订单号', + `mch_no` VARCHAR(64) NOT NULL COMMENT '商户号', + `isv_no` VARCHAR(64) COMMENT '服务商号', + `app_id` VARCHAR(64) NOT NULL COMMENT '应用ID', + `mch_name` VARCHAR(30) NOT NULL COMMENT '商户名称', + `mch_type` TINYINT(6) NOT NULL COMMENT '类型: 1-普通商户, 2-特约商户(服务商模式)', + `mch_order_no` VARCHAR(64) NOT NULL COMMENT '商户订单号', + `if_code` VARCHAR(20) NOT NULL COMMENT '支付接口代码', + `entry_type` VARCHAR(20) NOT NULL COMMENT '入账方式: WX_CASH-微信零钱; ALIPAY_CASH-支付宝转账; BANK_CARD-银行卡', + `amount` BIGINT(20) NOT NULL COMMENT '转账金额,单位分', + `currency` VARCHAR(3) NOT NULL DEFAULT 'cny' COMMENT '三位货币代码,人民币:cny', + `account_no` VARCHAR(64) NOT NULL COMMENT '收款账号', + `account_name` VARCHAR(64) COMMENT '收款人姓名', + `bank_name` VARCHAR(32) COMMENT '收款人开户行名称', + `transfer_desc` VARCHAR(128) NOT NULL DEFAULT '' COMMENT '转账备注信息', + `client_ip` VARCHAR(32) DEFAULT NULL COMMENT '客户端IP', + `state` TINYINT(6) NOT NULL DEFAULT '0' COMMENT '支付状态: 0-订单生成, 1-转账中, 2-转账成功, 3-转账失败, 4-订单关闭', + `channel_extra` VARCHAR(512) DEFAULT NULL COMMENT '特定渠道发起额外参数', + `channel_order_no` VARCHAR(64) DEFAULT NULL COMMENT '渠道订单号', + `err_code` VARCHAR(128) DEFAULT NULL COMMENT '渠道支付错误码', + `err_msg` VARCHAR(256) DEFAULT NULL COMMENT '渠道支付错误描述', + `ext_param` VARCHAR(128) DEFAULT NULL COMMENT '商户扩展参数', + `notify_url` VARCHAR(128) NOT NULL default '' COMMENT '异步通知地址', + `success_time` DATETIME DEFAULT NULL COMMENT '转账成功时间', + `created_at` TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间', + `updated_at` TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '更新时间', + PRIMARY KEY (`transfer_id`), + UNIQUE KEY `Uni_MchNo_MchOrderNo` (`mch_no`, `mch_order_no`), + INDEX(`created_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='转账订单表'; + +-- 菜单项 +insert into t_sys_entitlement values('ENT_TRANSFER_ORDER', '转账订单', 'property-safety', '/transfer', 'TransferOrderListPage', 'ML', 0, 1, 'ENT_ORDER', '25', 'MGR', now(), now()); +insert into t_sys_entitlement values('ENT_TRANSFER_ORDER_LIST', '页面:转账订单列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_TRANSFER_ORDER', '0', 'MGR', now(), now()); +insert into t_sys_entitlement values('ENT_TRANSFER_ORDER_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_TRANSFER_ORDER', '0', 'MGR', now(), now()); +insert into t_sys_entitlement values('ENT_TRANSFER_ORDER', '转账订单', 'property-safety', '/transfer', 'TransferOrderListPage', 'ML', 0, 1, 'ENT_ORDER', '30', 'MCH', now(), now()); +insert into t_sys_entitlement values('ENT_TRANSFER_ORDER_LIST', '页面:转账订单列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_TRANSFER_ORDER', '0', 'MCH', now(), now()); +insert into t_sys_entitlement values('ENT_TRANSFER_ORDER_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_TRANSFER_ORDER', '0', 'MCH', now(), now()); +## -- ++++ ++++ diff --git a/jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/TransferOrder.java b/jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/TransferOrder.java index 48a2e19..4e54030 100644 --- a/jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/TransferOrder.java +++ b/jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/TransferOrder.java @@ -15,6 +15,7 @@ */ package com.jeequan.jeepay.core.entity; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.Data; @@ -60,6 +61,7 @@ public class TransferOrder implements Serializable { /** * 转账订单号 */ + @TableId private String transferId; /** diff --git a/jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/order/TransferOrderController.java b/jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/order/TransferOrderController.java new file mode 100644 index 0000000..b25edb1 --- /dev/null +++ b/jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/order/TransferOrderController.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com). + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jeequan.jeepay.mgr.ctrl.order; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.jeequan.jeepay.core.constants.ApiCodeEnum; +import com.jeequan.jeepay.core.entity.TransferOrder; +import com.jeequan.jeepay.core.model.ApiRes; +import com.jeequan.jeepay.mgr.ctrl.CommonCtrl; +import com.jeequan.jeepay.service.impl.TransferOrderService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + + +/** +* 转账订单api +* +* @author terrfly +* @site https://www.jeepay.vip +* @date 2021/8/13 10:52 +*/ +@RestController +@RequestMapping("/api/transferOrders") +public class TransferOrderController extends CommonCtrl { + + @Autowired private TransferOrderService transferOrderService; + + /** list **/ + @PreAuthorize("hasAuthority('ENT_TRANSFER_ORDER_LIST')") + @RequestMapping(value="", method = RequestMethod.GET) + public ApiRes list() { + + TransferOrder refundOrder = getObject(TransferOrder.class); + JSONObject paramJSON = getReqParamJSON(); + LambdaQueryWrapper wrapper = TransferOrder.gw(); + if (StringUtils.isNotEmpty(refundOrder.getTransferId())) { + wrapper.eq(TransferOrder::getTransferId, refundOrder.getTransferId()); + } + if (StringUtils.isNotEmpty(refundOrder.getMchOrderNo())) { + wrapper.eq(TransferOrder::getMchOrderNo, refundOrder.getMchOrderNo()); + } + if (StringUtils.isNotEmpty(refundOrder.getChannelOrderNo())) { + wrapper.eq(TransferOrder::getChannelOrderNo, refundOrder.getChannelOrderNo()); + } + if (StringUtils.isNotEmpty(refundOrder.getMchNo())) { + wrapper.eq(TransferOrder::getMchNo, refundOrder.getMchNo()); + } + if (refundOrder.getState() != null) { + wrapper.eq(TransferOrder::getState, refundOrder.getState()); + } + if (StringUtils.isNotEmpty(refundOrder.getAppId())) { + wrapper.eq(TransferOrder::getAppId, refundOrder.getAppId()); + } + if (paramJSON != null) { + if (StringUtils.isNotEmpty(paramJSON.getString("createdStart"))) { + wrapper.ge(TransferOrder::getCreatedAt, paramJSON.getString("createdStart")); + } + if (StringUtils.isNotEmpty(paramJSON.getString("createdEnd"))) { + wrapper.le(TransferOrder::getCreatedAt, paramJSON.getString("createdEnd")); + } + } + wrapper.orderByDesc(TransferOrder::getCreatedAt); + IPage pages = transferOrderService.page(getIPage(), wrapper); + + return ApiRes.page(pages); + } + + /** detail **/ + @PreAuthorize("hasAuthority('ENT_TRANSFER_ORDER_VIEW')") + @RequestMapping(value="/{recordId}", method = RequestMethod.GET) + public ApiRes detail(@PathVariable("recordId") String transferId) { + TransferOrder refundOrder = transferOrderService.getById(transferId); + if (refundOrder == null) { + return ApiRes.fail(ApiCodeEnum.SYS_OPERATION_FAIL_SELETE); + } + return ApiRes.ok(refundOrder); + } +} diff --git a/jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/ctrl/order/TransferOrderController.java b/jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/ctrl/order/TransferOrderController.java new file mode 100644 index 0000000..c01b419 --- /dev/null +++ b/jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/ctrl/order/TransferOrderController.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com). + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jeequan.jeepay.mch.ctrl.order; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.jeequan.jeepay.core.constants.ApiCodeEnum; +import com.jeequan.jeepay.core.entity.TransferOrder; +import com.jeequan.jeepay.core.model.ApiRes; +import com.jeequan.jeepay.mch.ctrl.CommonCtrl; +import com.jeequan.jeepay.service.impl.TransferOrderService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + + +/** +* 转账订单api +* +* @author terrfly +* @site https://www.jeepay.vip +* @date 2021/8/13 10:52 +*/ +@RestController +@RequestMapping("/api/transferOrders") +public class TransferOrderController extends CommonCtrl { + + @Autowired private TransferOrderService transferOrderService; + + /** list **/ + @PreAuthorize("hasAuthority('ENT_TRANSFER_ORDER_LIST')") + @RequestMapping(value="", method = RequestMethod.GET) + public ApiRes list() { + + TransferOrder refundOrder = getObject(TransferOrder.class); + JSONObject paramJSON = getReqParamJSON(); + LambdaQueryWrapper wrapper = TransferOrder.gw(); + if (StringUtils.isNotEmpty(refundOrder.getTransferId())) { + wrapper.eq(TransferOrder::getTransferId, refundOrder.getTransferId()); + } + if (StringUtils.isNotEmpty(refundOrder.getMchOrderNo())) { + wrapper.eq(TransferOrder::getMchOrderNo, refundOrder.getMchOrderNo()); + } + if (StringUtils.isNotEmpty(refundOrder.getChannelOrderNo())) { + wrapper.eq(TransferOrder::getChannelOrderNo, refundOrder.getChannelOrderNo()); + } + if (StringUtils.isNotEmpty(refundOrder.getMchNo())) { + wrapper.eq(TransferOrder::getMchNo, refundOrder.getMchNo()); + } + if (refundOrder.getState() != null) { + wrapper.eq(TransferOrder::getState, refundOrder.getState()); + } + if (StringUtils.isNotEmpty(refundOrder.getAppId())) { + wrapper.eq(TransferOrder::getAppId, refundOrder.getAppId()); + } + if (paramJSON != null) { + if (StringUtils.isNotEmpty(paramJSON.getString("createdStart"))) { + wrapper.ge(TransferOrder::getCreatedAt, paramJSON.getString("createdStart")); + } + if (StringUtils.isNotEmpty(paramJSON.getString("createdEnd"))) { + wrapper.le(TransferOrder::getCreatedAt, paramJSON.getString("createdEnd")); + } + } + + wrapper.eq(TransferOrder::getMchNo, getCurrentMchNo()); + + wrapper.orderByDesc(TransferOrder::getCreatedAt); + IPage pages = transferOrderService.page(getIPage(), wrapper); + + return ApiRes.page(pages); + } + + /** detail **/ + @PreAuthorize("hasAuthority('ENT_TRANSFER_ORDER_VIEW')") + @RequestMapping(value="/{recordId}", method = RequestMethod.GET) + public ApiRes detail(@PathVariable("recordId") String transferId) { + TransferOrder refundOrder = transferOrderService.queryMchOrder(getCurrentMchNo(), null, transferId); + if (refundOrder == null) { + return ApiRes.fail(ApiCodeEnum.SYS_OPERATION_FAIL_SELETE); + } + return ApiRes.ok(refundOrder); + } +}