| @@ -62,15 +62,6 @@ public class WxOrderController extends BaseController { | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| private WxAppinfoService wxAppinfoService; | |||
| @Autowired | |||
| private WxPayAccountService wxPayAccountService; | |||
| @Autowired | |||
| private MaUtil maUtil; | |||
| @Autowired | |||
| OrderFactory orderFactory; | |||
| @@ -289,23 +280,5 @@ public class WxOrderController extends BaseController { | |||
| } | |||
| @ApiOperation("") | |||
| @GetMapping("test") | |||
| @SystemControllerLog(description = "") | |||
| public ResultData test(Long composeOrderId) { | |||
| logger.debug("[" + getIpAddr() + "] WxOrderController::test"); | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO); | |||
| WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId()); | |||
| TtPayService ttPayService = maUtil.getTtPayService(appInfo, payAccount); | |||
| List<TtSettleResult> settleResultList = null; | |||
| try { | |||
| settleResultList = ttPayService.getProfitSharingV2Service().getOrderSettle(composeOrderId.toString()); | |||
| } catch (TtPayException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| return new ResultData(settleResultList); | |||
| } | |||
| } | |||
| @@ -1,20 +0,0 @@ | |||
| ALTER TABLE `mallink`.`wx_card_spend` | |||
| MODIFY COLUMN `remark` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注' AFTER `pos_order_id`; | |||
| CREATE TABLE `wx_card_set_price` ( | |||
| `id` bigint(20) NOT NULL COMMENT '主键ID', | |||
| `tenant_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID', | |||
| `parent_tenant_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID', | |||
| `card_password_id` bigint(20) NOT NULL COMMENT '卡密Id', | |||
| `ip` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'ip地址', | |||
| `price` int(10) DEFAULT NULL, | |||
| `create_date` datetime(0) NOT NULL COMMENT '创建时间', | |||
| `update_date` datetime(0) NOT NULL COMMENT '更新时间', | |||
| `operator_type` smallint(1) NOT NULL COMMENT '操作人类型', | |||
| `operator_id` bigint(20) DEFAULT NULL COMMENT '操作人', | |||
| `operator_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||
| `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', | |||
| PRIMARY KEY (`id`) USING BTREE, | |||
| UNIQUE INDEX `idx`(`id`) USING BTREE | |||
| ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; | |||
| @@ -1,3 +1,7 @@ | |||
| ALTER TABLE `mallink`.`wx_card_spend` | |||
| MODIFY COLUMN `remark` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注' AFTER `pos_order_id`; | |||
| CREATE TABLE `wx_card_daily_log` | |||
| ( | |||
| `id` bigint(20) NOT NULL COMMENT '主键ID', | |||
| @@ -0,0 +1,10 @@ | |||
| INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (653, '消费卡日志', 603, 'Y', NULL, 1, NULL, NULL, 'cardlog', NULL, 0, 653); | |||
| 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, 210, 211, 212, 221, 222, 224, 225, 251, 261, 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, 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, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 653, 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, 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, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201]' WHERE `id` = 1; | |||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 4, 5, 6, 7, 8, 9, 10, 50, 101, 102, 103, 104, 105, 106, 107, 201, 202, 203, 204, 205, 209, 210, 211, 212, 221, 222, 224, 225, 251, 261, 409, 410, 411, 416, 418, 420, 421, 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, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 653, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 961, 5502, 6610, 6611, 60701, 60702, 61201]' WHERE `id` = 2; | |||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[2, 4, 5, 6, 7, 10, 50, 201, 202, 205, 210, 211, 212, 221, 222, 224, 225, 251, 261, 409, 410, 411, 416, 418, 502, 503, 504, 505, 506, 507, 508, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 621, 622, 623, 624, 625, 626, 641, 642, 643, 644, 645, 646, 651, 652, 653, 661, 662, 663, 664, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 5502, 60701, 60702, 61201]' WHERE `id` = 3; | |||
| 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, 210, 211, 212, 221, 222, 223, 224, 225, 251, 261, 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, 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, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 652, 653, 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, 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, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201, 61202, 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, 210, 211, 212, 221, 222, 224, 225, 251, 261, 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, 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, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 653, 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, 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, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201]' 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, 210, 211, 212, 221, 222, 224, 225, 251, 261, 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, 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, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 653, 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, 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, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201]' 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, 210, 211, 212, 221, 222, 225, 223, 224, 251, 261, 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, 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, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 652, 653, 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, 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, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201, 61202, 61501, 61502]' WHERE `id` = 103500103610; | |||
| @@ -38,7 +38,7 @@ import java.util.Map; | |||
| @Slf4j | |||
| @RestController | |||
| @RequestMapping("/keTuoCarCallback") | |||
| @RequestMapping("/daHuaCarCallback") | |||
| public class WxCarDaHuaCallBackController extends WxParkCallBackBaseController { | |||
| @Autowired | |||
| @@ -6,9 +6,7 @@ import java.security.NoSuchAlgorithmException; | |||
| import java.util.*; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.douyin.pay.orderQuery.QueryMerchantResult; | |||
| import com.iformall.douyin.pay.orderQuery.QueryRefundResult; | |||
| import com.iformall.douyin.pay.orderQuery.QuerySettleResult; | |||
| import com.iformall.douyin.pay.orderQuery.*; | |||
| import com.iformall.douyin.pay.preOrder.*; | |||
| import com.iformall.enums.EnumPayStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -16,7 +14,6 @@ import com.iformall.utils.sign.SignUtils; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.douyin.pay.orderQuery.OrderQueryResult; | |||
| import com.iformall.utils.HttpUtil; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| @@ -352,8 +349,9 @@ public class DouYinPayHelper { | |||
| } | |||
| } | |||
| //可分账余额查询 | |||
| //https://developer.toutiao.com/api/apps/ecpay/v1/unsettle_amount | |||
| public static void unsettleAmount(String appId,String salt,String outOrderId,String thirdParytyId) { | |||
| public static QueryUnsettleAmount unsettleAmount(String appId, String salt, String outOrderId, String thirdParytyId) { | |||
| Map map = new HashMap(); | |||
| map.put("app_id",appId); | |||
| map.put("salt",salt); | |||
| @@ -363,19 +361,24 @@ public class DouYinPayHelper { | |||
| String response = doPost("https://developer.toutiao.com/api/apps/ecpay/v1/unsettle_amount", map); | |||
| log.info("查询待分账金额 request:"+map.toString()+" response:"+response); | |||
| JSONObject jsonObject = JSON.parseObject(response); | |||
| // Integer code = jsonObject.getInteger("err_no"); | |||
| // if (null != code && code.intValue() == 0 ) { | |||
| // JSONObject info = jsonObject.getJSONObject("settle_info"); | |||
| // QuerySettleResult result = new QuerySettleResult(); | |||
| // result.setSettleNo(info.getString("settle_no")); | |||
| // result.setSettleAmount(info.getInteger("settle_amount")); | |||
| // result.setSettleStatus(info.getString("settle_status")); | |||
| // result.setMsg(jsonObject.getString("err_tips")); | |||
| // return result; | |||
| // }else { | |||
| // log.error("settleQuery reponse error. request: "+JSON.toJSONString(map)+" response:"+response); | |||
| //// return null; | |||
| // } | |||
| Integer code = jsonObject.getInteger("err_no"); | |||
| if (null != code && code.intValue() == 0 ) { | |||
| JSONObject data = jsonObject.getJSONObject("data"); | |||
| QueryUnsettleAmount result = new QueryUnsettleAmount(); | |||
| result.setOutOrderNo(data.getString("out_order_no")); | |||
| result.setUnsettleAmount(data.getInteger("unsettle_amount")); | |||
| JSONObject detail = data.getJSONObject("detail"); | |||
| JSONObject payInfo = detail.getJSONObject("pay_info"); | |||
| result.setOutPayNo(payInfo.getString("out_order_no")); | |||
| result.setAmount(payInfo.getInteger("amount")); | |||
| result.setPaymentRake(detail.getInteger("payment_rake")); | |||
| result.setLifeRake(detail.getInteger("life_rake")); | |||
| result.setCommission(detail.getInteger("commission")); | |||
| return result; | |||
| }else { | |||
| log.error("unsettleAmount reponse error. request: "+JSON.toJSONString(map)+" response:"+response); | |||
| return null; | |||
| } | |||
| } | |||
| public static void main(String[] args) { | |||
| @@ -48,19 +48,5 @@ public interface ProfitSharingV2Service { | |||
| */ | |||
| List<TtSettleResult> getProfitSharingResult(String out_settle_no) throws TtPayException; | |||
| /** | |||
| * <pre> | |||
| * 查询分账接口 | |||
| * out_order_no string 否 开发者交易订单id,长度<64byte,数字ASCII字符 | |||
| * out_settle_no string 否 开发者分账单id,长度<64byte,数字、ASCII字符 | |||
| * order_id string 否 抖音开平侧订单id,长度<64byte,数字、ASCII | |||
| * settle_id string 否 抖音开平侧分账单id,长度<64byte,数字、ASCII | |||
| * - 查询优先级: settle_id > order_id > out_settle_no > out_order_no,4个参数选填一个 | |||
| * - 例如:请求填写了settle_id和order_id,服务只会按settle_id来查询,忽略order_id | |||
| * - 如果未查询到结果,会返回空数组 | |||
| * - 注意:对于担保交易和交易1.0的订单,如果需要根据order_id/out_order_no查询订单的分账记录,建议使用order_id(抖音开平侧支付单id查询),若使用out_order_no可能存在查询不到的情况 | |||
| * | |||
| */ | |||
| List<TtSettleResult> getOrderSettle(String out_order_no) throws TtPayException; | |||
| } | |||
| @@ -59,20 +59,6 @@ public class ProfitSharingV2ServiceImpl implements ProfitSharingV2Service { | |||
| } | |||
| } | |||
| @Override | |||
| public List<TtSettleResult> getOrderSettle(String out_order_no) throws TtPayException { | |||
| String url = String.format("%s/api/apps/trade/v2/query_settle", this.payService.getPayBaseUrl()); | |||
| JsonObject jsonObject = new JsonObject(); | |||
| jsonObject.addProperty("out_order_no",out_order_no); | |||
| String result = this.payService.postV2(url,jsonObject.toString()); | |||
| ProfitSharingResult sharingResult = GSON.fromJson(result, ProfitSharingResult.class); | |||
| if(sharingResult.isSuccess()){ | |||
| return sharingResult.getData(); | |||
| }else{ | |||
| throw new TtPayException(sharingResult.getErrTips()); | |||
| } | |||
| } | |||
| /** | |||
| * 校验通知签名 | |||
| @@ -0,0 +1,18 @@ | |||
| package com.iformall.douyin.pay.orderQuery; | |||
| import lombok.Data; | |||
| @Data | |||
| public class QueryUnsettleAmount { | |||
| private String outOrderNo;//商户侧的订单号 | |||
| private Integer unsettleAmount;//剩余待结算金额 | |||
| private String outPayNo;//外部支付单单号 | |||
| private Integer amount;//支付单总金额 | |||
| private Integer paymentRake;//平台支付手续费金额,单位为分 | |||
| private Integer lifeRake;//平台行业抽佣金额,单位为分 | |||
| private Integer commission;//平台达人分佣金额,单位为分 | |||
| } | |||
| @@ -14,11 +14,15 @@ | |||
| <result column="operator_id" jdbcType="BIGINT" property="operatorId"/> | |||
| <result column="operator_user" jdbcType="VARCHAR" property="operatorUser"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId"/> | |||
| <result column="card_info_id" jdbcType="BIGINT" property="cardInfoId"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="count" jdbcType="INTEGER" property="count"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`card_password_id`,`ip`,`create_date`,`update_date`, | |||
| `price`,`operator_type`,`operator_id`,`operator_user`, `remark` | |||
| `price`,`operator_type`,`operator_id`,`operator_user`, `remark`,`coupon_id`,`card_info_id`,`type`,`count` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -35,8 +39,14 @@ | |||
| <if test=" null != cardPasswordId "> | |||
| and `card_password_id` = #{cardPasswordId} | |||
| </if> | |||
| <if test=" null != operatorType "> | |||
| and `operator_type` = #{operatorType} | |||
| <if test=" null != couponId "> | |||
| and `coupon_id` = #{couponId} | |||
| </if> | |||
| <if test=" null != cardInfoId "> | |||
| and `card_info_id` = #{cardInfoId} | |||
| </if> | |||
| <if test=" null != type "> | |||
| and `type` = #{type} | |||
| </if> | |||
| <if test=" null != operatorId "> | |||
| and `operator_id` = #{operatorId} | |||
| @@ -56,7 +66,7 @@ | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxCardDailyLog" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_card_set_price | |||
| from wx_card_daily_log | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||