From f798f39f321b92585ba9a6beae1b2c60badff801 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 28 Feb 2023 15:07:25 +0800 Subject: [PATCH] //sharing --- .../V2023022700001__add_mall_permission.sql | 14 ++++++ .../schedule/SharingOrderRedoSchedule.java | 43 +++++++++++++++++++ .../impl/WxProfitSharingOrderServiceImpl.java | 8 ++-- .../share/douyin/TtPayShareService.java | 2 +- 4 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 mallinkAdmin/src/main/resources/db/migration/V2023022700001__add_mall_permission.sql diff --git a/mallinkAdmin/src/main/resources/db/migration/V2023022700001__add_mall_permission.sql b/mallinkAdmin/src/main/resources/db/migration/V2023022700001__add_mall_permission.sql new file mode 100644 index 000000000..43e496ad8 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V2023022700001__add_mall_permission.sql @@ -0,0 +1,14 @@ +UPDATE `mallink`.`mall_permission` SET `resource_type` = 0, `url` = NULL, `icon` = 'icon-jiesuancopy' WHERE `id` = 417; + +INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (41701, '账单结算', 417, 'Y', NULL, 1, NULL, NULL, 'auditManage', NULL, 0, 41701); + +INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (41702, '消费卡结算', 417, 'Y', NULL, 1, NULL, NULL, 'cardManage', NULL, 0, 41702); + + + +UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 201, 202, 203, 204, 205, 206, 209, 211, 212, 221, 222, 224, 225, 251, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 6611, 41701, 41702, 60701, 60702]' WHERE `id` = 1; +UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206, 209, 211, 212, 221, 222, 223, 224, 225, 251, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 615, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 6611, 41701, 41702, 60701, 60702, 61501, 61502]' WHERE `id` = 12; +UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 201, 202, 203, 204, 205, 206, 209, 211, 212, 221, 222, 224, 225, 251, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 6611, 41701, 41702, 60701, 60702]' WHERE `id` = 1028; +UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 201, 202, 203, 204, 205, 206, 209, 211, 212, 221, 222, 224, 225, 251, 299, 300, 307, 308, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 6611, 41701, 41702, 60701, 60702]' WHERE `id` = 1035001036; +UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206, 209, 211, 212, 221, 222, 225, 223, 224, 251, 299, 300, 307, 308, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 615, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 6611, 41701, 41702, 60701, 60702, 61501, 61502]' WHERE `id` = 103500103610; + diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/SharingOrderRedoSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/SharingOrderRedoSchedule.java index 8b9478372..a835a84dc 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/SharingOrderRedoSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/SharingOrderRedoSchedule.java @@ -7,6 +7,7 @@ import com.iformall.domain.dto.WxSharingOrderDto; import com.iformall.domain.po.WxMall; import com.iformall.domain.po.WxPayOrder; import com.iformall.domain.po.WxProfitSharingOrder; +import com.iformall.domain.po.base.TenantEntity; import com.iformall.enums.EnumPayStatus; import com.iformall.enums.EnumPayWay; import com.iformall.enums.EnumProfitSharingOrderStatus; @@ -165,4 +166,46 @@ public class SharingOrderRedoSchedule { // } // // } + +// @Async +// @Scheduled(cron = "0 15 2 * * ?") // 每天凌晨02:00分账重试 +// @Scheduled(cron = "0 15 */2 * * ?")// 每2个小时的15分钟 +// @Scheduled(cron = "0 0/1 * * * ?") // 测试 +// public void sharingOrderRedoScheduletest() { +// TenantEntity tenantEntity = new TenantEntity(); +// tenantEntity.setTenantId("789"); +// +// WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder(); +// wxProfitSharingOrder.setTenantId(tenantEntity.getTenantId()); +//// wxProfitSharingOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode()); +// wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_APPLY_FAILED.getCode()); +// List list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder); +// if (null != list) { +// list.stream().forEach(sharingOrder -> { +// try { +//// WxPayOrder wxPayOrder = new WxPayOrder(); +//// wxPayOrder.updateTenantInfo(sharingOrder); +//// wxPayOrder.setId(sharingOrder.getOrderId()); +//// wxPayOrder = wxPayOrderMapper.selectOne(new QueryWrapper(wxPayOrder)); +// WxPayOrder wxPayOrder = wxPayOrderMapper.selectById(sharingOrder.getOrderId(), sharingOrder.getTenantId()); +// if (null == wxPayOrder) { +// logger.error("分账重试失败:" + EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getMessage() +// + " ID:" + sharingOrder.getId() +// + " RES: wxPayOrder is null."); +// } +// ResultData result = wxProfitSharingOrderService.redoSharingOrder(sharingOrder, wxPayOrder); +// if (result.code != ResultData.SUCCESS) { +// logger.error("分账重试失败:" + EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getMessage() +// + " ID:" + sharingOrder.getId() +// + " RES:" + result.message); +// } +// +// } catch (Exception e) { +// logger.error("分账重试失败:" + EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getMessage() +// + " ID:" + sharingOrder.getId() +// + " MSG:" + e.getMessage()); +// } +// }); +// } +// } } \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java index 2d2c86ecd..7291e1f21 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java @@ -238,7 +238,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ int commissionAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), rate, true); wxComposeChildOrderShare.setCommissionAmount(commissionAmount); - int surplus = 0;//当广场抽成帐号与收款帐号相等,无法添加分账方,计入商管商户中 + int surplus = 0;//无法获取到各分账帐号时,计入收款帐号 //只有抖音才有抽成 //微信缺少流程(分账帐号绑定) 无法抽成 if(EnumPayWay.PAY_WAY_TT.getCode().equals(payOrder.getPayVendor()) @@ -271,8 +271,8 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ // int systemAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), payAccount.getSystemRate(), false); int systemAmount = selSysAmount - sellerAmount; wxComposeChildOrderShare.setSystemAmount(systemAmount); - if(isSeller){ - systemAmount += systemAmount; + if(isSeller){//未找到销售帐号时转入到系统帐号中 + systemAmount += sellerAmount; } boolean isSystem = false; if(systemAmount > 0){ @@ -297,7 +297,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ wxComposeChildOrderShare.setServiceAmount(serviceAmount); //商场分成 int mallAmount = wxComposeChildOrderShare.getRateAmount(); - if(isSystem){ + if(isSystem){//未找到系统帐号时转入商管商户中 mallAmount += systemAmount; } boolean isMall = false; diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/share/douyin/TtPayShareService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/share/douyin/TtPayShareService.java index 1be34fefa..514e43a5a 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/share/douyin/TtPayShareService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/share/douyin/TtPayShareService.java @@ -299,7 +299,7 @@ public class TtPayShareService extends PayShareBaseAdapterService{ WxProfitSharingReceiver record = wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.TOUTIAO); - if(ttPayWay != null){ + if(record != null && ttPayWay != null){ if(EnumTtPayChannel.WX_PAY.getCode().equals(ttPayWay) && !MerchantImportStatus.improt_success.getCode().equals(record.getWxImportStatus())){ log.error("支付方式【"+EnumTtPayChannel.WX_PAY.getMessage()+"】未开通");