From e35a1158f324f7bd3b3827b2db554755854b22b4 Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 15 Feb 2023 15:07:38 +0800 Subject: [PATCH] //sharing --- .../V2023021300001__add_分账类型.sql | 2 + .../controller/WxMerchantController.java | 79 ++++++++++++------- .../enums/EnumProfitPaymentReceiverType.java | 4 +- 3 files changed, 55 insertions(+), 30 deletions(-) diff --git a/mallinkAdmin/src/main/resources/db/migration/V2023021300001__add_分账类型.sql b/mallinkAdmin/src/main/resources/db/migration/V2023021300001__add_分账类型.sql index ec7acf57c..fe0607b3c 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V2023021300001__add_分账类型.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V2023021300001__add_分账类型.sql @@ -31,6 +31,8 @@ INSERT INTO `mallink`.`wx_profit_payment_receiver`(`id`, `tenant_id`, `parent_te (select `id`, `tenant_id`, `parent_tenant_id`, `merchant_id`, `receiver_type`, `receiver_account`, `create_time`, `update_time`, `status`, `plat`, `tt_import_status`, `tt_import_url`, `tt_balance_url` from wx_profit_sharing_receiver where plat = 3 and sharing_type = 3); +update wx_profit_payment_receiver set receiver_type = 10 where plat = 3; + update wx_profit_sharing_receiver set receiver_type = 10 where plat = 3 and sharing_type = 3; update wx_profit_sharing_receiver set sharing_type = 1 where sharing_type != 2; diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java index dee795c3e..b5fbdadc2 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java @@ -63,22 +63,9 @@ public class WxMerchantController extends BaseController { if(payAccount == null){ return new ResultData(ErrorCode.API_KEY_NOT_FOUND); } - return new ResultData(wxProfitSharingReceiverService.findReceiver(tenantInfo,wxMerchant.getId(), EnumAppPlat.WX)); } - @ApiOperation("抖音查询收款账户信息") - @GetMapping("/findTtAccountById") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - public ResultData findTtAccountById(@ModelAttribute WxMerchant wxMerchant) { - log.debug("[" + getIpAddr() + "] WxMerchantController::findTtAccountById"); - if (wxMerchant.getId() == null) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); - } - wxMerchant.updateTenantInfo(getTenantInfo()); - return new ResultData(wxProfitPaymentReceiverService.findReceiver(getTenantInfo(),wxMerchant.getId(), EnumAppPlat.TOUTIAO)); - } - @ApiOperation("更新收款账户信息:必填项 id(商户ID) name(商户名称) accountId(账号ID) accountTypeValue(账号类型) accountName(账号名称)") @PostMapping("/updateAccount") public ResultData addAccount(@RequestBody WxMerchant wxMerchant) { @@ -120,13 +107,7 @@ public class WxMerchantController extends BaseController { return wxProfitSharingReceiverService.delReceiver(receiver, EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode()); } - @ApiOperation("查询是否有权限修改账户") - @GetMapping("/permitModifiy") - public ResultData permitModifiy() { - log.debug("[" + getIpAddr() + "] WxMerchantController::permitModifiy"); - boolean has = hasPermission(); - return new ResultData(has); - } + @TenantIgnore @ApiOperation("获取微信OpenId") @@ -160,6 +141,56 @@ public class WxMerchantController extends BaseController { } } + @ApiOperation("微信查询收款信息") + @GetMapping("/findPaymentAccountById") + @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) + public ResultData findPaymentAccountById(@ModelAttribute WxMerchant wxMerchant) { + log.debug("[" + getIpAddr() + "] WxMerchantController::findPaymentAccountById"); + if (wxMerchant.getId() == null) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); + } + TenantEntity tenantInfo = getTenantInfo(); + wxMerchant.updateTenantInfo(tenantInfo); + + WxPayAccount payAccount = payAccountService.getPayAccount(tenantInfo, EnumAppPlat.WX); + if(payAccount == null){ + return new ResultData(ErrorCode.API_KEY_NOT_FOUND); + } + return new ResultData(wxProfitPaymentReceiverService.findReceiver(tenantInfo,wxMerchant.getId(), EnumAppPlat.WX)); + } + + + + @ApiOperation("查询是否有权限修改账户") + @GetMapping("/permitModifiy") + public ResultData permitModifiy() { + log.debug("[" + getIpAddr() + "] WxMerchantController::permitModifiy"); + boolean has = hasPermission(); + return new ResultData(has); + } + + + public boolean hasPermission() { + WxMerchantBUser user = getLoginBUser(); + CUser buser = getCUser(); + WxMerchant wxMerchant = wxMerchantService.selectById(user.getMerchantId()); + return wxMerchant != null && wxMerchant.getLinkPhone().equals(buser.getPhone()); + } + + + @ApiOperation("抖音查询收款账户信息") + @GetMapping("/findTtAccountById") + @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) + public ResultData findTtAccountById(@ModelAttribute WxMerchant wxMerchant) { + log.debug("[" + getIpAddr() + "] WxMerchantController::findTtAccountById"); + if (wxMerchant.getId() == null) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); + } + wxMerchant.updateTenantInfo(getTenantInfo()); + return new ResultData(wxProfitPaymentReceiverService.findReceiver(getTenantInfo(),wxMerchant.getId(), EnumAppPlat.TOUTIAO)); + } + + @RedisCache() @ApiOperation("获取进件/余额页面") @GetMapping("/getTtReceiverUrl") @@ -189,14 +220,6 @@ public class WxMerchantController extends BaseController { }else{ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); } - - } - - public boolean hasPermission() { - WxMerchantBUser user = getLoginBUser(); - CUser buser = getCUser(); - WxMerchant wxMerchant = wxMerchantService.selectById(user.getMerchantId()); - return wxMerchant != null && wxMerchant.getLinkPhone().equals(buser.getPhone()); } } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumProfitPaymentReceiverType.java b/mallinkService/src/main/java/com/iformall/enums/EnumProfitPaymentReceiverType.java index 76215f157..d606d9110 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumProfitPaymentReceiverType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumProfitPaymentReceiverType.java @@ -4,9 +4,9 @@ package com.iformall.enums; * Created by Stormeye on 2018/08/09. */ public enum EnumProfitPaymentReceiverType { - wx_special_merchant_number(0, "MERCHANT_ID"),//微信特约商户号 + wx_special_merchant_number(0, "MERCHANT_ID"),//微信商户号 wx_personal_wechatid(1, "PERSONAL_WECHATID"),//微信号 已不支持 - wx_personal_openid(2, "PERSONAL_OPENID"),//v2,v3 + wx_personal_openid(2, "PERSONAL_OPENID"),// wx_personal_sub_openid(3, "PERSONAL_SUB_OPENID"), tt_merchant_number(10,"")//抖音商户号