| @@ -0,0 +1,205 @@ | |||
| ALTER TABLE `mallink`.`wx_pay_account` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `type`, | |||
| ADD COLUMN `open_pay` json COMMENT '总分模式开通收款方式状态' AFTER `mch_type`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_0` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_1` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_2` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_3` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_4` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_5` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_6` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_7` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_8` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_9` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_10` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_11` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_12` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_13` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_14` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_15` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_16` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_17` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_18` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_19` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_20` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_21` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_22` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_23` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_24` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_25` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_26` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_27` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_28` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_29` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_30` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_31` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_32` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_33` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_34` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_35` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_36` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_37` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_38` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_39` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_40` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_41` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_42` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_43` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_44` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_45` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_46` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_47` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_48` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_49` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_50` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_51` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_52` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_53` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_54` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_55` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_56` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_57` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_58` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_59` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_60` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_61` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_62` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_63` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_64` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_65` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_66` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_67` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_68` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_69` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_70` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_71` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_72` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_73` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_74` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_75` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_76` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_77` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_78` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_79` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_80` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_81` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_82` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_83` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_84` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_85` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_86` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_87` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_88` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_89` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_90` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_91` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_92` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_93` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_94` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_95` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_96` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_97` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_98` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| ALTER TABLE `mallink`.`wx_pay_order_99` | |||
| ADD COLUMN `mch_type` smallint(2) DEFAULT 0 COMMENT '0:总分,1:直连' AFTER `pay_param`; | |||
| @@ -252,20 +252,9 @@ public class WxOrderController extends BaseController { | |||
| data.put("out_order_no",order.getMainOrderId().toString()); | |||
| data.put("pay_expire_seconds",14*60); | |||
| data.put("order_entry_schema",wxOrderService.getOrderEntrySchema(order.getMainOrderId())); | |||
| List<Map<String,String>> order_goods_info = new ArrayList<>(); | |||
| for (CreateOrderCallback.Good good:createOrderCallback.getGoods()) { | |||
| Map<String,String> map_info = new HashMap<>(); | |||
| map_info.put("goods_id",good.getGoodsId()); | |||
| if("1028".equals(order.getTenantId())){ | |||
| map_info.put("merchant_uid","71228500084451433283"); | |||
| }else if("1030".equals(order.getTenantId())){ | |||
| map_info.put("merchant_uid","71252541927546739583"); | |||
| } | |||
| order_goods_info.add(map_info); | |||
| if(order.getExtParam() != null && !order.getExtParam().isEmpty()){ | |||
| data.put("order_goods_info",order.getExtParam()); | |||
| } | |||
| data.put("order_goods_info",order_goods_info); | |||
| // List<Map<String,Object>> goodsValid = new ArrayList<>(); | |||
| @@ -194,38 +194,38 @@ public class TtPayController extends BaseController { | |||
| } | |||
| } | |||
| }else if("refund".equals(type)){//退款回调 | |||
| // String cp_refundno,status; | |||
| // Integer refund_amount; | |||
| // if(is2_0){ | |||
| // cp_refundno = (String) pMap.get("out_refund_no"); | |||
| // status = (String) pMap.get("status"); | |||
| // refund_amount = (Integer) pMap.get("refund_total_amount"); | |||
| // }else{ | |||
| // cp_refundno = (String) pMap.get("cp_refundno"); | |||
| // status = (String) pMap.get("status"); | |||
| // refund_amount = (Integer) pMap.get("refund_amount"); | |||
| // } | |||
| // | |||
| // Map<String,String> map = new HashMap<>(); | |||
| // map.put("appid",appid); | |||
| // map.put("cp_refundno",cp_refundno); | |||
| // map.put("status",status); | |||
| // map.put("refund_amount",refund_amount.toString()); | |||
| //// wxRefundOrderService.notify(map, EnumPayWay.PAY_WAY_TT); | |||
| // | |||
| // String jsonMsg = JSON.toJSONString(map); | |||
| // | |||
| // FmInsideNotifyRefundSuccessMsg refundSuccessMsg = new FmInsideNotifyRefundSuccessMsg(); | |||
| // refundSuccessMsg.setMsgType(EnumMsgRecordType.INSIDE_NOTIFY_REFUND_SUCCESS.getCode()); | |||
| // refundSuccessMsg.setDelayTimeLevel(3); | |||
| // refundSuccessMsg.setPayWay(EnumPayWay.PAY_WAY_TT.getCode()); | |||
| // refundSuccessMsg.setJsonMsg(jsonMsg); | |||
| // | |||
| // // response = wxRefundOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | |||
| // mqBaseProducer.sendMessage(refundSuccessMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| // | |||
| // resultMap.put("err_no",0); | |||
| // resultMap.put("err_tips","success"); | |||
| String cp_refundno,status; | |||
| Integer refund_amount; | |||
| if(is2_0){ | |||
| cp_refundno = (String) pMap.get("out_refund_no"); | |||
| status = (String) pMap.get("status"); | |||
| refund_amount = (Integer) pMap.get("refund_total_amount"); | |||
| }else{ | |||
| cp_refundno = (String) pMap.get("cp_refundno"); | |||
| status = (String) pMap.get("status"); | |||
| refund_amount = (Integer) pMap.get("refund_amount"); | |||
| } | |||
| Map<String,String> map = new HashMap<>(); | |||
| map.put("appid",appid); | |||
| map.put("cp_refundno",cp_refundno); | |||
| map.put("status",status); | |||
| map.put("refund_amount",refund_amount.toString()); | |||
| // wxRefundOrderService.notify(map, EnumPayWay.PAY_WAY_TT); | |||
| String jsonMsg = JSON.toJSONString(map); | |||
| FmInsideNotifyRefundSuccessMsg refundSuccessMsg = new FmInsideNotifyRefundSuccessMsg(); | |||
| refundSuccessMsg.setMsgType(EnumMsgRecordType.INSIDE_NOTIFY_REFUND_SUCCESS.getCode()); | |||
| refundSuccessMsg.setDelayTimeLevel(3); | |||
| refundSuccessMsg.setPayWay(EnumPayWay.PAY_WAY_TT.getCode()); | |||
| refundSuccessMsg.setJsonMsg(jsonMsg); | |||
| // response = wxRefundOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | |||
| mqBaseProducer.sendMessage(refundSuccessMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| resultMap.put("err_no",0); | |||
| resultMap.put("err_tips","success"); | |||
| }else if("settle".equals(type)){ | |||
| } | |||
| @@ -69,20 +69,20 @@ public class TtWebController extends BaseController { | |||
| return resultMap; | |||
| } | |||
| // String header = request.getHeader("X-Douyin-Signature"); | |||
| // String sha1gen = SHA1.gen(appInfo.getSecret(), JSON.toJSONString(parameterMap)); | |||
| // //发邮件 | |||
| // String[] receivers = fmExceptionEmails.split(","); | |||
| // StringBuilder sb = new StringBuilder(); | |||
| // sb.append(DateUtils.date2String(new Date())); | |||
| // sb.append("\n"); | |||
| // sb.append("抖音开放平台通知{}"+JSON.toJSONString(parameterMap)); | |||
| // sb.append("\n"); | |||
| // sb.append("sha1gen{}"+sha1gen); | |||
| // sb.append("\n"); | |||
| // sb.append("header{}"+header); | |||
| // //发送邮件 | |||
| // mailService.sendSimpleMail(receivers, "抖音开放平台通知", sb.toString()); | |||
| String header = request.getHeader("X-Douyin-Signature"); | |||
| String sha1gen = SHA1.gen(appInfo.getSecret(), JSON.toJSONString(parameterMap)); | |||
| //发邮件 | |||
| String[] receivers = fmExceptionEmails.split(","); | |||
| StringBuilder sb = new StringBuilder(); | |||
| sb.append(DateUtils.date2String(new Date())); | |||
| sb.append("\n"); | |||
| sb.append("抖音开放平台通知{}"+JSON.toJSONString(parameterMap)); | |||
| sb.append("\n"); | |||
| sb.append("sha1gen{}"+sha1gen); | |||
| sb.append("\n"); | |||
| sb.append("header{}"+header); | |||
| //发送邮件 | |||
| mailService.sendSimpleMail(receivers, "抖音开放平台通知", sb.toString()); | |||
| if("life_goods_audit".equals(event)){ | |||
| @@ -76,12 +76,12 @@ public class WxMsgCallbackController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::receivemsgAliyun"); | |||
| logger.info(param.toString()); | |||
| try { | |||
| // if(param != null && param.size() > 0){ | |||
| // for (Map<String, String> p:param) { | |||
| // //解析param数据插入数据库中 | |||
| // wxMsgCallbackService.receivemsgAliyun(p); | |||
| // } | |||
| // } | |||
| if(param != null && param.size() > 0){ | |||
| for (Map<String, String> p:param) { | |||
| //解析param数据插入数据库中 | |||
| wxMsgCallbackService.receivemsgAliyun(p); | |||
| } | |||
| } | |||
| }catch(Exception e){ | |||
| logger.error("aliyun 短信回调ERROR",e); | |||
| @@ -130,17 +130,17 @@ public class WxPayController extends BaseController { | |||
| try { | |||
| xml = IOUtils.toString(request.getInputStream(), Charset.forName("UTF-8")); | |||
| logger.info(xml); | |||
| // paramMap = WxPayment.xmlToMap(xml); | |||
| // String jsonMsg = JSON.toJSONString(paramMap); | |||
| // | |||
| // FmInsideNotifyRefundSuccessMsg refundSuccessMsg = new FmInsideNotifyRefundSuccessMsg(); | |||
| // refundSuccessMsg.setMsgType(EnumMsgRecordType.INSIDE_NOTIFY_REFUND_SUCCESS.getCode()); | |||
| // refundSuccessMsg.setDelayTimeLevel(3); | |||
| // refundSuccessMsg.setPayWay(EnumPayWay.PAY_WAY_WECHAT.getCode()); | |||
| // refundSuccessMsg.setJsonMsg(jsonMsg); | |||
| // | |||
| // // response = wxRefundOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | |||
| // mqBaseProducer.sendMessage(refundSuccessMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| paramMap = WxPayment.xmlToMap(xml); | |||
| String jsonMsg = JSON.toJSONString(paramMap); | |||
| FmInsideNotifyRefundSuccessMsg refundSuccessMsg = new FmInsideNotifyRefundSuccessMsg(); | |||
| refundSuccessMsg.setMsgType(EnumMsgRecordType.INSIDE_NOTIFY_REFUND_SUCCESS.getCode()); | |||
| refundSuccessMsg.setDelayTimeLevel(3); | |||
| refundSuccessMsg.setPayWay(EnumPayWay.PAY_WAY_WECHAT.getCode()); | |||
| refundSuccessMsg.setJsonMsg(jsonMsg); | |||
| // response = wxRefundOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | |||
| mqBaseProducer.sendMessage(refundSuccessMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| logger.info("refund wxpay, notify success, req : " + xml + ", resp: " + response.toString()); | |||
| return response; | |||
| @@ -341,6 +341,7 @@ public enum ErrorCode{ | |||
| PAY_ORDER_IS_NOT_PAYMENT(12005, "不是支付订单"), | |||
| PREPAY_ID_IS_EMPTY(12006, "prepay_id是空值"), | |||
| PAY_ORDER_QUERY_ERROR(12007, "支付订单查询异常"), | |||
| PAY_ORDER_MERCHANT_UID_ERROR(12008, "直连模式,收款商户异常"), | |||
| REFUND_ORDER_EXIST(12010, "退款订单已存在"), | |||
| REFUND_PAY_ORDER_IS_NOT_EXIST(12011, "退款支付订单不存在"), | |||
| @@ -440,13 +440,14 @@ public class WxCoupon extends TenantEntity { | |||
| return false; | |||
| } | |||
| public boolean validDate(boolean isShare,boolean hasShareAmount,Date curr) { | |||
| public boolean validDate(boolean isShare,Date curr) { | |||
| if(this.getType().equals(EnumCouponType.COUPON_DOUYIN.getCode())){ | |||
| return true; | |||
| } | |||
| if(isShare){ | |||
| if(isShare && this.getSalePrice() > 0 && !this.checkIsCard()){ | |||
| Date valid_date = getOuterRealValidDate(curr); | |||
| Date limit_date = DateUtils.getTimeAfterDays(Constant.WX_LIMIT_DAYS, curr); | |||
| if (valid_date.after(limit_date)) { | |||
| return false; | |||
| } | |||
| @@ -463,7 +464,7 @@ public class WxCoupon extends TenantEntity { | |||
| // } | |||
| } | |||
| public Date getRealValidDate(boolean isShare,boolean hasShareAmount,Date curr) { | |||
| public Date getRealValidDate(Date curr) { | |||
| //券都上架卖出去了还判断个什么有效期 | |||
| // Map retMap = calcuteValidDate(isShare,hasShareAmount,curr); | |||
| // return (Date) retMap.get("realDate"); | |||
| @@ -1,9 +1,12 @@ | |||
| package com.iformall.domain.po; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.douyin.pay.orderQuery.QueryMerchantResult; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @TableName(value = "wx_pay_account") | |||
| @Data | |||
| @@ -40,6 +43,10 @@ public class WxPayAccount extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="商户模式-0:普通商户模式1:服务商模式",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="EnumPayMchType 0:总分1:直连",name="mchType") | |||
| private Integer mchType; | |||
| @io.swagger.annotations.ApiModelProperty(value="抖音用 ",name="openPay") | |||
| private String openPay; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否开启分账(0:未开启分账1:开启分账)",name="type") | |||
| private Integer share; | |||
| @io.swagger.annotations.ApiModelProperty(value="手续费(万分之几,默认60)",name="rate") | |||
| @@ -75,4 +82,17 @@ public class WxPayAccount extends TenantEntity { | |||
| // @io.swagger.annotations.ApiModelProperty(value="app平台 EnumAppPlat ",name="plat") | |||
| // private Integer plat; | |||
| public QueryMerchantResult getOpenPayResult(){ | |||
| QueryMerchantResult openPayResult = null; | |||
| try{ | |||
| if(StringUtils.isNotBlank(this.openPay)) { | |||
| openPayResult = JSON.parseObject(this.openPay, QueryMerchantResult.class); | |||
| } | |||
| }catch(Exception e){} | |||
| if(openPayResult == null){ | |||
| openPayResult = new QueryMerchantResult(); | |||
| } | |||
| return openPayResult; | |||
| } | |||
| } | |||
| @@ -61,6 +61,8 @@ public class WxPayOrder extends TenantEntity { | |||
| private boolean creatPay; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付额外参数",name="payParam") | |||
| private String payParam; | |||
| @io.swagger.annotations.ApiModelProperty(value="EnumPayMchType 0:总分1:直连",name="mchType") | |||
| private Integer mchType; | |||
| @io.swagger.annotations.ApiModelProperty(value="分账状态: 0-未分账;1-分账",name="payOrderStatus") | |||
| private Integer share; | |||
| @io.swagger.annotations.ApiModelProperty(value="分账金额(总金额扣除手续费后的金额)",name="shareAmount") | |||
| @@ -74,13 +76,13 @@ public class WxPayOrder extends TenantEntity { | |||
| public WxComposeChildOrderShare getChildOrderShare(Long wxOrderId) { | |||
| if (StringUtils.isBlank(this.childOrderShare)) { | |||
| return new WxComposeChildOrderShare(this.payAmount, this.shareAmount, this.rateAmount,null,null); | |||
| return new WxComposeChildOrderShare(this.payAmount, this.shareAmount, this.rateAmount,null,null,null); | |||
| } | |||
| Map childs = JSON.parseObject(this.childOrderShare, Map.class); | |||
| JSONObject childOrderShare = (JSONObject) childs.get(String.valueOf(wxOrderId)); | |||
| if (null != childOrderShare) { | |||
| return new WxComposeChildOrderShare(childOrderShare.getInteger("realPayMent"), childOrderShare.getInteger("shareAmount"), childOrderShare.getInteger("rateAmount"), | |||
| childOrderShare.getInteger("realRateAmount"), childOrderShare.getInteger("commissionAmount")); | |||
| childOrderShare.getInteger("realRateAmount"), childOrderShare.getInteger("commissionAmount"), childOrderShare.getString("merchantUid")); | |||
| } | |||
| return null; | |||
| } | |||
| @@ -0,0 +1,41 @@ | |||
| package com.iformall.douyin.pay.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum MerchantImportStatus { | |||
| //0-未进件、1-进件成功、2-进件失败、3-审核中、4-冻结中 | |||
| improt_no(0, "未进件"), | |||
| improt_success(1, "进件成功"), | |||
| improt_fail(2, "进件失败"), | |||
| improt_ing(3, "审核中"), | |||
| improt_freeze(4, "冻结中"), | |||
| ; | |||
| public static MerchantImportStatus getEnum(Integer code) { | |||
| for (MerchantImportStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| MerchantImportStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,35 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumPayMchType { | |||
| TOTAL(0, "总分"), | |||
| DIRECT(1, "直连"); | |||
| public static EnumPayMchType getEnum(Integer code) { | |||
| for (EnumPayMchType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumPayMchType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -9,6 +9,7 @@ import com.iformall.domain.vo.TtCouponChannelVo; | |||
| import com.iformall.domain.vo.WxCouponCVo; | |||
| import com.iformall.domain.vo.WxCouponChannelAddVo; | |||
| import com.iformall.domain.vo.WxCouponChannelVo; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @@ -82,4 +83,6 @@ public interface WxCouponChannelService { | |||
| PageInfo<TtCouponChannelVo> ttChannelList(TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize); | |||
| ResultData updateOnline(WxCouponChannel wxCouponChannel); | |||
| String getCouponOneMerchantUid(EnumPayWay payWay,Long couponChannelId, String tenantId); | |||
| } | |||
| @@ -21,7 +21,7 @@ public interface WxProfitSharingOrderService { | |||
| /** | |||
| * 创建分账订单 | |||
| */ | |||
| ResultData createSharingOrder(WxSharingOrderDto wxSharingOrderDto,Integer payway,Integer share); | |||
| ResultData createSharingOrder(WxSharingOrderDto wxSharingOrderDto,Integer payway,Integer mchType,Integer share); | |||
| /** | |||
| * 分账重试 | |||
| @@ -59,4 +59,5 @@ public interface WxProfitSharingReceiverService { | |||
| ResultData getTtReceiverBalanceURL(WxMerchant merchant, String appId, String payAccountKey); | |||
| ResultData updateTtReceiverIsUse(WxMerchant merchant, String appId, String payAccountKey); | |||
| } | |||
| @@ -6,11 +6,8 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.TtCouponChannelPoi; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.msg.FmInsideProductPushMsg; | |||
| import com.iformall.domain.vo.*; | |||
| import com.iformall.enums.*; | |||
| @@ -18,6 +15,7 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.pay.PayServiceFactory; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.RedisLock; | |||
| @@ -91,6 +89,12 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| @Autowired | |||
| private MqBaseProducer mqBaseProducer; | |||
| @Autowired | |||
| private PayServiceFactory payServiceFactory; | |||
| @Autowired | |||
| private WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; | |||
| /** | |||
| * B端业务端 | |||
| @@ -824,6 +828,25 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| return new ResultData(); | |||
| } | |||
| @Override | |||
| public String getCouponOneMerchantUid(EnumPayWay payWay,Long couponChannelId, String tenantId) { | |||
| WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantId); | |||
| List<Long> merchantIds = wxCouponMerchantMapper.findMerchantIdListByProduct(couponChannel.getCouponId(), tenantId); | |||
| if(merchantIds != null && merchantIds.size() == 1){ | |||
| WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | |||
| psReceiverQ.setTenantId(tenantId); | |||
| psReceiverQ.setMerchantId(merchantIds.get(0)); | |||
| psReceiverQ.setSharingType(payServiceFactory.getPayShareAdapterService(payWay.getCode()).getProfitSharingType()); | |||
| psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| psReceiverQ.setPlat(payWay.getPlat().getCode()); | |||
| List<WxProfitSharingReceiver> psReceiverList = wxProfitSharingReceiverMapper.findList(psReceiverQ); | |||
| if(psReceiverList != null && psReceiverList.size() == 1){ | |||
| return psReceiverList.get(0).getReceiverAccount(); | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| @Override | |||
| public WxCouponChannel getPriceAndStock(TenantEntity tenantEntity, Long couponChannelId) { | |||
| return wxCouponChannelMapper.getPriceAndStock(couponChannelId, tenantEntity.getTenantId()); | |||
| @@ -20,6 +20,7 @@ import com.iformall.domain.po.msg.FmInsideCouponVerifyMsg; | |||
| import com.iformall.domain.po.msg.MpAppMsg; | |||
| import com.iformall.domain.po.msg.SmartAppMsg; | |||
| import com.iformall.domain.vo.*; | |||
| import com.iformall.douyin.pay.enums.MerchantImportStatus; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| @@ -31,6 +32,7 @@ import com.iformall.service.order.OrderFactory; | |||
| import com.iformall.service.order.entity.WxComposeOrder; | |||
| import com.iformall.service.order.util.OrderHelper; | |||
| import com.iformall.service.pay.PayServiceFactory; | |||
| import com.iformall.service.pay.service.pay.douyin.miniApp.EnumTtPayChannel; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.PayUtils; | |||
| @@ -1296,34 +1298,17 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| } | |||
| if(merchantId != null){ | |||
| //如果开启了分账,就必须要配置分账账号 | |||
| WxAppinfo appInfo = getAppinfo(couponOrder,couponOrder.getPayVendor()); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||
| WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | |||
| psReceiverQ.updateTenantInfo(payAccount); | |||
| psReceiverQ.setMerchantId(merchantId); | |||
| psReceiverQ.setSharingType(payServiceFactory.getPayShareAdapterService(couponOrder.getPayVendor()).getProfitSharingType()); | |||
| psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| psReceiverQ.setPlat(appInfo.getPlat()); | |||
| if(EnumAppPlat.TOUTIAO.getCode().equals(psReceiverQ.getPlat())){ | |||
| psReceiverQ.setIsUse(EnumProfitSharingUse.YES.getCode()); | |||
| WxPayOrder wxPayOrderQ = new WxPayOrder(); | |||
| wxPayOrderQ.updateTenantInfo(couponOrder); | |||
| wxPayOrderQ.setOrderId(couponOrder.getComposeOrderId()); | |||
| wxPayOrderQ.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| WxPayOrder wxPayOrder = wxPayOrderMapper.selectOne(new QueryWrapper(wxPayOrderQ)); | |||
| if(wxPayOrder != null && EnumPayMchType.TOTAL.getCode().equals(wxPayOrder.getMchType()) | |||
| && EnumPayShare.YES.getCode().equals(wxPayOrder.getShare())){ | |||
| payServiceFactory.getPayShareAdapterService(wxPayOrder.getPayVendor()) | |||
| .getReceiverList(couponOrder, merchantId, wxPayOrder.getTtPayWay()); | |||
| } | |||
| List<WxProfitSharingReceiver> psReceiverList = wxProfitSharingReceiverMapper.findList(psReceiverQ); | |||
| if (null == payAccount.getShare()) { | |||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该租户payAccount未设置分账."); | |||
| } | |||
| if (EnumPayShare.YES.getCode().intValue() == payAccount.getShare().intValue()) { | |||
| if (null == psReceiverList || psReceiverList.size() == 0) { | |||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户未设置分账账号."); | |||
| }else { | |||
| for (WxProfitSharingReceiver receiver:psReceiverList) { | |||
| if (EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID.getCode().intValue() | |||
| == receiver.getReceiverType().intValue()) { | |||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户收款账号存在个人微信号方式,微信已停止支持,请重新设置."); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| int num = 0; | |||
| @@ -1582,21 +1567,23 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| @Override | |||
| public void actionAfterVerify(WxCouponOrder couponOrder, WxMerchant merchant) { | |||
| //如果是组合的,则为多次 | |||
| if (EnumComposeOrder.isSingle(couponOrder.getComposeOrderType())) { | |||
| try { | |||
| // 核销分账 | |||
| shareAfterVerify(couponOrder, merchant.getId(),couponOrder.getPayVendor(),false); | |||
| } catch (Exception e) { | |||
| logger.error("核销记账失败"+e.getMessage(),e); | |||
| } | |||
| }else { | |||
| try { | |||
| // 核销分账 | |||
| shareAfterVerify(couponOrder, merchant.getId(),couponOrder.getPayVendor(),true); | |||
| } catch (Exception e) { | |||
| logger.error("核销记账失败"+e.getMessage(),e); | |||
| try { | |||
| boolean mulityShare = true; | |||
| if(EnumComposeOrder.isSingle(couponOrder.getComposeOrderType())){ | |||
| mulityShare = false; | |||
| }else{ | |||
| WxOrder wxOrderQ = new WxOrder(); | |||
| wxOrderQ.updateTenantInfo(couponOrder); | |||
| wxOrderQ.setComposeOrderId(couponOrder.getComposeOrderId()); | |||
| Integer count = wxOrderMapper.countList(wxOrderQ); | |||
| if(count.intValue() == 1){ | |||
| mulityShare = false; | |||
| } | |||
| } | |||
| // 核销分账 | |||
| shareAfterVerify(couponOrder, merchant.getId(),couponOrder.getPayVendor(),mulityShare); | |||
| } catch (Exception e) { | |||
| logger.error("核销记账失败"+e.getMessage(),e); | |||
| } | |||
| try { | |||
| @@ -1607,14 +1594,12 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| } | |||
| boolean bSentCoupon = false; | |||
| // 核销发券 | |||
| try { | |||
| bSentCoupon = sendCouponAfterVerify(couponOrder); | |||
| } catch (Exception e) { | |||
| logger.error("核销记账失败"+e.getMessage(),e); | |||
| } | |||
| // 核销发模板消息 | |||
| try { | |||
| sendVerifyMsg(couponOrder, merchant, bSentCoupon); | |||
| @@ -1691,7 +1676,8 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| wxPayOrder.setOrderId(couponOrder.getComposeOrderId()); | |||
| wxPayOrder.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| wxPayOrder = wxPayOrderMapper.selectOne(new QueryWrapper(wxPayOrder)); | |||
| if(wxPayOrder != null && EnumPayShare.NO.getCode().equals(wxPayOrder.getShare())){ | |||
| if(wxPayOrder != null && EnumPayMchType.TOTAL.getCode().equals(wxPayOrder.getMchType()) | |||
| && EnumPayShare.NO.getCode().equals(wxPayOrder.getShare())){ | |||
| try { | |||
| // 订单购买时未分账 核销记账,并且往账户里面记帐 | |||
| if (couponOrder.getCouponPrice() > 0) { | |||
| @@ -1700,17 +1686,10 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| } catch (Exception e) { | |||
| logger.error("核销记账失败"+e.getMessage(),e); | |||
| } | |||
| }else if(wxPayOrder != null){ | |||
| WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | |||
| psReceiverQ.updateTenantInfo(wxPayOrder); | |||
| psReceiverQ.setMerchantId(merchantId); | |||
| psReceiverQ.setSharingType(payServiceFactory.getPayShareAdapterService(payWay).getProfitSharingType()); | |||
| psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| psReceiverQ.setPlat(EnumPayWay.getEnum(payWay).getPlat().getCode()); | |||
| if(EnumAppPlat.TOUTIAO.getCode().equals(psReceiverQ.getPlat())){ | |||
| psReceiverQ.setIsUse(EnumProfitSharingUse.YES.getCode()); | |||
| } | |||
| List<WxProfitSharingReceiver> psReceiverList = wxProfitSharingReceiverMapper.findList(psReceiverQ); | |||
| }else if(wxPayOrder != null && EnumPayMchType.TOTAL.getCode().equals(wxPayOrder.getMchType())){ | |||
| List<WxProfitSharingReceiver> psReceiverList = payServiceFactory.getPayShareAdapterService(payWay) | |||
| .getReceiverList(wxPayOrder,merchantId,wxPayOrder.getTtPayWay()); | |||
| if (psReceiverList == null || psReceiverList.size() == 0) { | |||
| try { | |||
| // 查询不到分账帐号,往账户里面记帐 | |||
| @@ -1741,7 +1720,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| wxSharingOrderDto.setPayTimeEnd(wxPayOrder.getPayTimeEnd()); | |||
| wxSharingOrderDto.updateTenantInfo(wxPayOrder); | |||
| wxSharingOrderDto.setTransactionId(wxPayOrder.getTransactionId()); | |||
| wxProfitSharingOrderService.createSharingOrder(wxSharingOrderDto,payWay,wxPayOrder.getShare()); | |||
| wxProfitSharingOrderService.createSharingOrder(wxSharingOrderDto,payWay,wxPayOrder.getMchType(),wxPayOrder.getShare()); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error("微信分账: " + e.getMessage()); | |||
| @@ -2671,12 +2650,14 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| throw new MallinkException(ErrorCode.VERIFY_ERROR.getCode(), "updatete num " + num); | |||
| } | |||
| } | |||
| EnumPayShare isShare = EnumPayShare.NO; | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(bUser,payWay.getPlat()); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||
| EnumPayShare isShare = EnumPayShare.NO; | |||
| if (payAccount.checkShare()) { | |||
| isShare = EnumPayShare.YES; | |||
| } | |||
| EnumPayShare paySHareEnum = EnumPayShare.getEnum(payAccount.getShare()); | |||
| if (paySHareEnum != null) { | |||
| isShare = paySHareEnum; | |||
| } | |||
| final Integer shareCode = isShare.getCode(); | |||
| // 添加payOrder | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| @@ -19,6 +19,8 @@ import com.iformall.domain.vo.*; | |||
| import com.iformall.domain.vo.excel.WxCardData; | |||
| import com.iformall.domain.vo.excel.WxCouponData; | |||
| import com.iformall.domain.vo.excel.WxPressData; | |||
| import com.iformall.douyin.pay.enums.MerchantImportStatus; | |||
| import com.iformall.douyin.pay.orderQuery.QueryMerchantResult; | |||
| import com.iformall.douyin.web.bean.GoodsTemplateGet; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -429,54 +431,11 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| } | |||
| } | |||
| List<JSONObject> merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class); | |||
| //有价券判断商户是否配置了分账账号 | |||
| if (!EnumCouponType.COUPON_GIFT.getCode().equals(record.getType()) | |||
| && record.getSalePrice() != null && record.getSalePrice() > 0) { | |||
| boolean share = false; | |||
| WxPayAccount payQ = new WxPayAccount(); | |||
| payQ.updateTenantInfo(record); | |||
| try { | |||
| WxPayAccount payAccount = payAccountMapper.selectOne(new QueryWrapper<>(payQ)); | |||
| if (payAccount != null) { | |||
| share = payAccount.checkShare(); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| if (share) { | |||
| StringBuilder sb = new StringBuilder(); | |||
| boolean flag = false; | |||
| for (int i = 0, size = merchantParamList.size(); i < size; i++) { | |||
| JSONObject jsonObject = merchantParamList.get(i); | |||
| Long id = jsonObject.getLong("id"); | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.setId(id); | |||
| WxMerchant merchant = wxMerchantMapper.selectById(id); | |||
| if (null == merchant) { | |||
| flag = true; | |||
| sb.append("[未查询到商户信息]"); | |||
| }else { | |||
| WxProfitSharingReceiver wxProfitSharingReceiverQ = new WxProfitSharingReceiver(); | |||
| wxProfitSharingReceiverQ.updateTenantInfo(record); | |||
| wxProfitSharingReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| // wxProfitSharingReceiverQ.setIsUse(EnumProfitSharingUse.YES.getCode()); | |||
| wxProfitSharingReceiverQ.setMerchantId(id); | |||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverMapper.findOne(wxProfitSharingReceiverQ); | |||
| if (null == receiver || receiver.getId() == null) { | |||
| flag = true; | |||
| sb.append("[").append(merchant.getName()).append("]"); | |||
| } | |||
| } | |||
| } | |||
| if (flag) { | |||
| String message = sb.toString(); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "商户:" + message + "还未配置分账账户"); | |||
| } | |||
| } | |||
| ResultData resultData = checkCouponMerchantReceiver(record); | |||
| if(resultData.code != 200){ | |||
| return resultData; | |||
| } | |||
| List<JSONObject> merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| if (record.getId() == null) { | |||
| @@ -666,6 +625,106 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| return new ResultData(record.getId()); | |||
| } | |||
| private ResultData checkCouponMerchantReceiver(WxCoupon record){ | |||
| List<JSONObject> merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class); | |||
| if(EnumCouponType.COUPON_GIFT.getCode().equals(record.getType())){ | |||
| return new ResultData(); | |||
| } | |||
| if((merchantParamList == null || merchantParamList.isEmpty())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未选择对应门店"); | |||
| } | |||
| if(record.getSalePrice() != null && record.getSalePrice() > 0) { | |||
| //todo 目前模式下券只能在一个平台下卖,即一个广场只有一个C端 | |||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(record, null); | |||
| if (cAppInfo == null) { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| EnumAppPlat plat = EnumAppPlat.WX; | |||
| EnumAppPlat platEnum = EnumAppPlat.getByCode(cAppInfo.getPlat()); | |||
| if (platEnum != null) { | |||
| plat = platEnum; | |||
| } | |||
| WxPayAccount payAccount = payAccountMapper.selectById(cAppInfo.getPayId()); | |||
| if (payAccount == null) { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| EnumPayMchType payMchType = EnumPayMchType.TOTAL; | |||
| EnumPayShare isShare = EnumPayShare.NO; | |||
| EnumPayMchType payMchTypeEnum = EnumPayMchType.getEnum(payAccount.getMchType()); | |||
| if (payMchTypeEnum != null) { | |||
| payMchType = payMchTypeEnum; | |||
| } | |||
| if (EnumPayMchType.DIRECT.equals(payMchType)) { | |||
| isShare = EnumPayShare.NO; | |||
| } else { | |||
| EnumPayShare paySHareEnum = EnumPayShare.getEnum(payAccount.getShare()); | |||
| if (paySHareEnum != null) { | |||
| isShare = paySHareEnum; | |||
| } | |||
| } | |||
| if (EnumPayMchType.DIRECT.equals(payMchType)) { | |||
| if (merchantParamList.size() > 1) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "直连模式只能选择一个对应门店"); | |||
| } | |||
| Long merchantId = merchantParamList.get(0).getLong("id"); | |||
| WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | |||
| psReceiverQ.updateTenantInfo(record); | |||
| psReceiverQ.setMerchantId(merchantId); | |||
| psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| psReceiverQ.setPlat(plat.getCode()); | |||
| WxProfitSharingReceiver one = wxProfitSharingReceiverMapper.findOne(psReceiverQ); | |||
| if (one == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "对应门店至少进件一种支付模式"); | |||
| } | |||
| if (EnumAppPlat.TOUTIAO.equals(plat)) { | |||
| if (!MerchantImportStatus.improt_success.getCode().equals(one.getWxImportStatus()) | |||
| && !MerchantImportStatus.improt_success.getCode().equals(one.getAlipayImportStatus()) | |||
| && !MerchantImportStatus.improt_success.getCode().equals(one.getHzImportStatus())) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "对应门店至少进件一种支付模式"); | |||
| } | |||
| } | |||
| } else if (EnumPayShare.YES.equals(isShare)) { | |||
| for (int i = 0, size = merchantParamList.size(); i < size; i++) { | |||
| JSONObject jsonObject = merchantParamList.get(i); | |||
| Long id = jsonObject.getLong("id"); | |||
| WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | |||
| psReceiverQ.updateTenantInfo(record); | |||
| psReceiverQ.setMerchantId(id); | |||
| psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| psReceiverQ.setPlat(plat.getCode()); | |||
| WxProfitSharingReceiver one = wxProfitSharingReceiverMapper.findOne(psReceiverQ); | |||
| int n = i + 1; | |||
| if (one == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户还未配置分账账户或未进件"); | |||
| } | |||
| if (EnumAppPlat.TOUTIAO.equals(plat)) { | |||
| QueryMerchantResult openPayResult = payAccount.getOpenPayResult(); | |||
| if(!EnumYesOrNo.YES.getCode().equals(openPayResult.getAlipay()) | |||
| && !EnumYesOrNo.YES.getCode().equals(openPayResult.getWx()) | |||
| && !EnumYesOrNo.YES.getCode().equals(openPayResult.getHz())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "分账模式未设置开通支付渠道"); | |||
| } | |||
| if(EnumYesOrNo.YES.getCode().equals(openPayResult.getAlipay()) | |||
| && !MerchantImportStatus.improt_success.getCode().equals(one.getAlipayImportStatus())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户未进件支付宝"); | |||
| } | |||
| if(EnumYesOrNo.YES.getCode().equals(openPayResult.getWx()) | |||
| && !MerchantImportStatus.improt_success.getCode().equals(one.getWxImportStatus())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户未进件微信"); | |||
| } | |||
| if(EnumYesOrNo.YES.getCode().equals(openPayResult.getHz()) | |||
| && !MerchantImportStatus.improt_success.getCode().equals(one.getHzImportStatus())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户未进件抖音"); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @Override | |||
| public ResultData updateTtProduct(WxCoupon record) { | |||
| if(StringUtils.isBlank(record.getProductAttrs()) || StringUtils.isBlank(record.getSkuAttrs())){ | |||
| @@ -1137,12 +1196,17 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| //有价券开启了分账,必须在30天以内。,停车券,积分券,积分停车券,卡无次限制 | |||
| @Override | |||
| public boolean validCouponDate(WxCoupon wxCoupon) { | |||
| EnumPayShare isShare = EnumPayShare.NO; | |||
| WxPayAccount payAccount = payAccountMapper.getByTenantId(wxCoupon.getTenantId()); | |||
| boolean isShare = false; | |||
| if (payAccount.checkShare()) { | |||
| isShare = true; | |||
| EnumPayShare paySHareEnum = EnumPayShare.getEnum(payAccount.getShare()); | |||
| if (paySHareEnum != null) { | |||
| isShare = paySHareEnum; | |||
| } | |||
| if (EnumPayShare.YES.equals(isShare)) { | |||
| return wxCoupon.validDate(true,new Date()); | |||
| }else{ | |||
| return wxCoupon.validDate(false,new Date()); | |||
| } | |||
| return wxCoupon.validDate(isShare,true,new Date()); | |||
| } | |||
| @Override | |||
| @@ -1005,16 +1005,16 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| } | |||
| } | |||
| List<Long> isUseMerchantIds = new ArrayList<Long>(); | |||
| if(record.getIsUse() != null){ | |||
| WxProfitSharingReceiver wxProfitSharingReceiver = new WxProfitSharingReceiver(); | |||
| wxProfitSharingReceiver.updateTenantInfo(record); | |||
| wxProfitSharingReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN.getCode()); | |||
| wxProfitSharingReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| wxProfitSharingReceiver.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||
| wxProfitSharingReceiver.setIsUse(EnumProfitSharingUse.YES.getCode()); | |||
| isUseMerchantIds = wxProfitSharingReceiverMapper.findMerchantIdList(wxProfitSharingReceiver); | |||
| } | |||
| // List<Long> isUseMerchantIds = new ArrayList<Long>(); | |||
| // if(record.getIsUse() != null){ | |||
| // WxProfitSharingReceiver wxProfitSharingReceiver = new WxProfitSharingReceiver(); | |||
| // wxProfitSharingReceiver.updateTenantInfo(record); | |||
| // wxProfitSharingReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN.getCode()); | |||
| // wxProfitSharingReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| // wxProfitSharingReceiver.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||
| // wxProfitSharingReceiver.setIsUse(EnumProfitSharingUse.YES.getCode()); | |||
| // isUseMerchantIds = wxProfitSharingReceiverMapper.findMerchantIdList(wxProfitSharingReceiver); | |||
| // } | |||
| List<Long> merchantIds = new ArrayList<Long>(); | |||
| String phone = StringUtils.trimToNull(record.getPhone()); | |||
| @@ -1043,13 +1043,13 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| } | |||
| } | |||
| if(EnumProfitSharingUse.YES.getCode().equals(record.getIsUse())){ | |||
| if(merchantIds.size() > 0){ | |||
| merchantIds.retainAll(isUseMerchantIds); | |||
| }else{ | |||
| merchantIds.addAll(isUseMerchantIds); | |||
| } | |||
| } | |||
| // if(EnumProfitSharingUse.YES.getCode().equals(record.getIsUse())){ | |||
| // if(merchantIds.size() > 0){ | |||
| // merchantIds.retainAll(isUseMerchantIds); | |||
| // }else{ | |||
| // merchantIds.addAll(isUseMerchantIds); | |||
| // } | |||
| // } | |||
| if (merchantIds.size() > 0 ) { | |||
| record.setIds(merchantIds); | |||
| @@ -1067,13 +1067,13 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| // record.setNotInids(usedMerchantIds); | |||
| } | |||
| } | |||
| if(EnumProfitSharingUse.NO.getCode().equals(record.getIsUse())){ | |||
| if(noMerchantIds.size() > 0){ | |||
| noMerchantIds.retainAll(isUseMerchantIds); | |||
| }else{ | |||
| noMerchantIds.addAll(isUseMerchantIds); | |||
| } | |||
| } | |||
| // if(EnumProfitSharingUse.NO.getCode().equals(record.getIsUse())){ | |||
| // if(noMerchantIds.size() > 0){ | |||
| // noMerchantIds.retainAll(isUseMerchantIds); | |||
| // }else{ | |||
| // noMerchantIds.addAll(isUseMerchantIds); | |||
| // } | |||
| // } | |||
| if(noMerchantIds.size() > 0){ | |||
| record.setNotInids(noMerchantIds); | |||
| @@ -1318,15 +1318,15 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| } | |||
| } | |||
| boolean hasShareAmount = false; | |||
| if (payOrder != null && payOrder.getShareAmount() != null) { | |||
| hasShareAmount = true; | |||
| } | |||
| boolean isShare = false; | |||
| if (null != payOrder && null != payOrder.getShare() && payOrder.getShare().intValue() > 0) { | |||
| isShare = true; | |||
| } | |||
| valid_date = coupon.getRealValidDate(isShare,hasShareAmount,curr); | |||
| // boolean hasShareAmount = false; | |||
| // if (payOrder != null && payOrder.getShareAmount() != null) { | |||
| // hasShareAmount = true; | |||
| // } | |||
| // boolean isShare = false; | |||
| // if (null != payOrder && null != payOrder.getShare() && payOrder.getShare().intValue() > 0) { | |||
| // isShare = true; | |||
| // } | |||
| valid_date = coupon.getRealValidDate(curr); | |||
| boolean isCard = false; | |||
| // 检查是否是储值卡 | |||
| @@ -2558,7 +2558,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| sharingOrder.setPayTimeEnd(wxPayOrder.getPayTimeEnd()); | |||
| sharingOrder.updateTenantInfo(wxPayOrder); | |||
| sharingOrder.setTransactionId(wxPayOrder.getTransactionId()); | |||
| wxProfitSharingOrderService.createSharingOrder(sharingOrder,payWay.getCode(),wxPayOrder.getShare()); | |||
| wxProfitSharingOrderService.createSharingOrder(sharingOrder,payWay.getCode(),wxPayOrder.getMchType(),wxPayOrder.getShare()); | |||
| } else { | |||
| logger.error("微信分账: 未找到payorder or merchant at orderid-" + orderId); | |||
| } | |||
| @@ -3628,7 +3628,11 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| public ResultData handlerPushOrder(TenantEntity tenantEntity, Long composeOrderId, String batchExtParam, List<CreateOrderCallback.Good> goods) { | |||
| WxBatchOrder wxBatchOrder = this.getWxBatchOrder(tenantEntity, composeOrderId); | |||
| if(wxBatchOrder == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到订单"); | |||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | |||
| } | |||
| WxPayOrder payOrder = wxPayOrderService.getById(composeOrderId, tenantEntity.getTenantId()); | |||
| if(payOrder == null){ | |||
| return new ResultData(ErrorCode.PAY_ORDER_NOT_FOUND); | |||
| } | |||
| WxBatchOrder updBatchOrder = new WxBatchOrder(); | |||
| updBatchOrder.updateTenantInfo(tenantEntity); | |||
| @@ -3643,10 +3647,18 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| Map<Long, List<WxOrder>> collect = childOrders.stream().collect(groupingBy(WxOrder::getCouponChannelId)); | |||
| Map<String, CreateOrderCallback.Good> maps = goods.stream().collect(Collectors.toMap(CreateOrderCallback.Good::getGoodsId, Function.identity())); | |||
| if(collect.keySet().size() == goods.size()){ | |||
| List<Map<String,String>> order_goods_info = new ArrayList<>(); | |||
| for (Long key: collect.keySet()) { | |||
| List<WxOrder> wxOrders = collect.get(key); | |||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectByChannelId(tenantEntity.getTenantId(),key); | |||
| CreateOrderCallback.Good good = maps.get(ttCouponChannelPoi.getSpuId()); | |||
| if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){ | |||
| Map<String,String> map_info = new HashMap<>(); | |||
| map_info.put("goods_id",good.getGoodsId()); | |||
| WxComposeChildOrderShare childOrderShare = payOrder.getChildOrderShare(wxOrders.get(0).getId()); | |||
| map_info.put("merchant_uid",childOrderShare.getMerchantUid()); | |||
| order_goods_info.add(map_info); | |||
| } | |||
| if(wxOrders.size() == good.getItemOrderInfoList().size()){ | |||
| for(int i=0;i<wxOrders.size();i++){ | |||
| WxOrder updOrder = new WxOrder(); | |||
| @@ -3665,6 +3677,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(),"数据异常"); | |||
| } | |||
| } | |||
| composeOrder.setExtParam(order_goods_info); | |||
| return new ResultData(composeOrder); | |||
| }else{ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(),"数据异常"); | |||
| @@ -3680,6 +3693,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| Map<Long, List<WxOrderCouponVo>> map = wxOrderCouponVos.stream().collect(Collectors.groupingBy(WxOrderCouponVo::getComposeOrderId)); | |||
| return map; | |||
| } | |||
| // private List<WxOrderCouponVo> batchOderToOrderCouponVoList(List<WxBatchOrder> batchOrderList) { | |||
| // if (null == batchOrderList || batchOrderList.size() <= 0 ) { | |||
| // return null; | |||
| @@ -128,6 +128,9 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| @Autowired | |||
| OrderSnapshotService orderSnapshotService; | |||
| @Autowired | |||
| WxCouponChannelService wxCouponChannelService; | |||
| @Autowired | |||
| OrderFactory orderFactory; | |||
| @@ -349,12 +352,22 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| public PayAdapterResult createPayOrder(WxAppinfo appInfo, WxCUserBasicInfo user,WxPayOrder record,WxComposeOrder composeOrder,List<WxOrder> childOrders, | |||
| String productName,EnumPayWay payWay,PayExtraParam params,boolean isCreatePay) { | |||
| IdWorker idworker = IdWorker.get(); | |||
| EnumPayMchType payMchType = EnumPayMchType.TOTAL; | |||
| EnumPayShare isShare = EnumPayShare.NO; | |||
| try { | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||
| if (payAccount.checkShare()) { | |||
| isShare = EnumPayShare.YES; | |||
| EnumPayMchType payMchTypeEnum = EnumPayMchType.getEnum(payAccount.getMchType()); | |||
| if(payMchTypeEnum != null){ | |||
| payMchType = payMchTypeEnum; | |||
| } | |||
| if(EnumPayMchType.DIRECT.equals(payMchType)){ | |||
| isShare = EnumPayShare.NO; | |||
| }else{ | |||
| EnumPayShare paySHareEnum = EnumPayShare.getEnum(payAccount.getShare()); | |||
| if (paySHareEnum != null) { | |||
| isShare = paySHareEnum; | |||
| } | |||
| } | |||
| Date currentDate = new Date(); | |||
| @@ -416,6 +429,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| record.setPayFrom(payWay.getCode()); | |||
| record.setPayVendor(payWay.getCode()); | |||
| record.setPayOrderStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); | |||
| record.setMchType(payMchType.getCode()); | |||
| record.setShare(isShare.getCode()); | |||
| record.setComposeOrder(composeOrder.getComposeOrderType()); | |||
| // if (isShare == EnumPayShare.YES) { | |||
| @@ -438,13 +452,20 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| int rate_amount = 0; | |||
| //todo 注意购物车模式(需测试)每笔子订单算法可能与总订单算法有差 | |||
| for (WxOrder o : orderList) { | |||
| String merchant_uid = ""; | |||
| if(EnumPayMchType.DIRECT.equals(payMchType)){//直连模式记录收款商户 | |||
| merchant_uid = wxCouponChannelService.getCouponOneMerchantUid(payWay,o.getCouponChannelId(),o.getTenantId()); | |||
| if(StringUtils.isBlank(merchant_uid)){ | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | |||
| } | |||
| } | |||
| int rate = payShareServie.getOfficialCommission(o,payAccount);//抖音分佣率 | |||
| logger.info("抖音分佣率"+rate); | |||
| PayShareCalculateAmount oShareAmount = payShareServie.calculateAmount(o.getPayment(),rate, payAccount); | |||
| logger.info("佣金明细"+ JSON.toJSONString(oShareAmount)); | |||
| share_amount += oShareAmount.getShareAmount(); | |||
| rate_amount += oShareAmount.getRateAmount(); | |||
| childShares.put(String.valueOf(o.getId()), new WxComposeChildOrderShare(oShareAmount)); | |||
| childShares.put(String.valueOf(o.getId()), new WxComposeChildOrderShare(oShareAmount,merchant_uid)); | |||
| } | |||
| record.setShareAmount(share_amount); | |||
| record.setRateAmount(rate_amount); | |||
| @@ -523,8 +544,9 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| return new ResultData(ErrorCode.PAY_ORDER_IS_NOT_PAYMENT); | |||
| } | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||
| if (payAccount.checkShare()) { | |||
| isShare = EnumPayShare.YES; | |||
| EnumPayShare paySHareEnum = EnumPayShare.getEnum(payAccount.getShare()); | |||
| if (paySHareEnum != null) { | |||
| isShare = paySHareEnum; | |||
| } | |||
| // 2. check 是否有支付订单 | |||
| @@ -1039,7 +1061,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| try { | |||
| return payServiceFactory.getPayAdapterService(EnumPayWay.PAY_WAY_TT.getCode()).queryPayStatus(payOrder, appInfo, payAccount); | |||
| } catch (Exception e) { | |||
| return new PayQueryAdapterResult(ErrorCode.SYS_SERVER_ERROR.getCode(), e.getMessage(),EnumPayWay.PAY_WAY_TT.getCode(),null,null,null); | |||
| return new PayQueryAdapterResult(ErrorCode.SYS_SERVER_ERROR.getCode(), e.getMessage(),null,null,null,null); | |||
| } | |||
| } | |||
| @@ -260,11 +260,15 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| @Override | |||
| // @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | |||
| public ResultData createSharingOrder(WxSharingOrderDto sharingOrderDto,Integer payWay,Integer share) { | |||
| public ResultData createSharingOrder(WxSharingOrderDto sharingOrderDto,Integer payWay,Integer mchType,Integer share) { | |||
| PayShareAdapterService payShareAdapterService = payServiceFactory.getPayShareAdapterService(payWay); | |||
| WxProfitSharingOrder record = payShareAdapterService.createSharingOrder(sharingOrderDto,share); | |||
| WxProfitSharingOrder record = payShareAdapterService.createSharingOrder(sharingOrderDto,mchType,share); | |||
| if(EnumPayWay.PAY_WAY_TT.getCode().equals(payWay)){ | |||
| return new ResultData(); | |||
| } | |||
| if (!sharingOrderDto.getType().equals(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode()) && | |||
| !sharingOrderDto.getType().equals(EnumProfitSharingOrderType.PROFIT_SHARING_MULTI.getCode())){ | |||
| @@ -272,7 +276,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| } | |||
| EnumProfitSharingOrderType shareType = EnumProfitSharingOrderType.getEnum(sharingOrderDto.getType()); | |||
| if (null == shareType) { | |||
| new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),sharingOrderDto.getType()+"在分账方式中不存在。EnumProfitSharingOrderType"); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),sharingOrderDto.getType()+"在分账方式中不存在。EnumProfitSharingOrderType"); | |||
| } | |||
| if(StringUtils.isNotBlank(record.getReceivers())){ | |||
| JSONArray jsonArray = JSONArray.parseArray(record.getReceivers()); | |||
| @@ -148,7 +148,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| receiver.setCreateTime(date); | |||
| receiver.setUpdateTime(date); | |||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| receiver.setIsUse(EnumProfitSharingUse.APPLY.getCode()); | |||
| // receiver.setIsUse(EnumProfitSharingUse.APPLY.getCode()); | |||
| receiver.setPlat(payWay.getPlat().getCode()); | |||
| //passed from uplevel | |||
| //receiver.setReceiverAccount(receiverParam.getReceiverAccount()); | |||
| @@ -320,7 +320,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| wxProfitSharingReceiver = oldReceiver; | |||
| wxProfitSharingReceiver.setReceiverType(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getCode()); | |||
| wxProfitSharingReceiver.setReceiverAccount("0"); | |||
| wxProfitSharingReceiver.setIsUse(EnumProfitSharingUse.APPLY.getCode()); | |||
| // wxProfitSharingReceiver.setIsUse(EnumProfitSharingUse.APPLY.getCode()); | |||
| wxProfitSharingReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| this.saveOrUpdate(wxProfitSharingReceiver); | |||
| } | |||
| @@ -343,13 +343,14 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| } | |||
| QueryMerchantResult queryMerchantResult = DouYinPayHelper.queryMerchantStatus(appId, payAccountKey, wxProfitSharingReceiver.getReceiverAccount(), wxProfitSharingReceiver.getMerchantId().toString(), null); | |||
| if(queryMerchantResult != null){ | |||
| if(queryMerchantResult.getWx().intValue() != 1){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"微信渠道未进件成功!"); | |||
| } | |||
| // if(queryMerchantResult.getWx().intValue() != 1){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"微信渠道未进件成功!"); | |||
| // } | |||
| // if(queryMerchantResult.getAlipay().intValue() != 1){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"支付宝渠道未进件成功!"); | |||
| // } | |||
| wxProfitSharingReceiver.setIsUse(EnumProfitSharingUse.YES.getCode()); | |||
| // wxProfitSharingReceiver.setIsUse(EnumProfitSharingUse.YES.getCode()); | |||
| wxProfitSharingReceiver.setTtImportStatus(JSON.toJSONString(queryMerchantResult)); | |||
| this.saveOrUpdate(wxProfitSharingReceiver); | |||
| return new ResultData(); | |||
| }else{ | |||
| @@ -11,20 +11,22 @@ import lombok.Data; | |||
| @Data | |||
| public class WxComposeChildOrderShare { | |||
| public WxComposeChildOrderShare(Integer realPayMent,Integer shareAmount,Integer rateAmount,Integer realRateAmount,Integer commissionAmount) { | |||
| public WxComposeChildOrderShare(Integer realPayMent,Integer shareAmount,Integer rateAmount,Integer realRateAmount,Integer commissionAmount,String merchantUid) { | |||
| this.realPayMent = realPayMent; | |||
| this.shareAmount = shareAmount; | |||
| this.rateAmount = rateAmount; | |||
| this.realRateAmount = realRateAmount; | |||
| this.commissionAmount = commissionAmount; | |||
| this.merchantUid = merchantUid; | |||
| } | |||
| public WxComposeChildOrderShare(PayShareCalculateAmount shareCalculateAmount) { | |||
| public WxComposeChildOrderShare(PayShareCalculateAmount shareCalculateAmount,String merchantUid) { | |||
| this.realPayMent = shareCalculateAmount.getPayAmount(); | |||
| this.shareAmount = shareCalculateAmount.getShareAmount(); | |||
| this.rateAmount = shareCalculateAmount.getRateAmount(); | |||
| this.realRateAmount = shareCalculateAmount.getRealRateAmount(); | |||
| this.commissionAmount = shareCalculateAmount.getCommissionAmount(); | |||
| this.merchantUid = merchantUid; | |||
| } | |||
| private Integer realPayMent;//付款金额 | |||
| @@ -35,4 +37,6 @@ public class WxComposeChildOrderShare { | |||
| private Integer realRateAmount;//平台手续费 | |||
| private Integer commissionAmount;//平台佣金 | |||
| private String merchantUid;//收款商户 | |||
| } | |||
| @@ -38,5 +38,7 @@ public class WxComposeOrder extends TenantEntity{ | |||
| private Map<Long,WxCouponChannel> couponChannelMap; | |||
| private Map<Long,WxCoupon> couponMap; | |||
| private List<Map<String,String>> extParam;//处理其他返回参数 | |||
| } | |||
| @@ -0,0 +1,36 @@ | |||
| package com.iformall.service.pay.service.pay.douyin.miniApp; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumTtPayChannel { | |||
| WX_PAY(1, "微信"), | |||
| ALI_PAY(2, "支付宝"), | |||
| HZ_PAY(10, "合众"), | |||
| ; | |||
| public static EnumTtPayChannel getEnum(Integer code) { | |||
| for (EnumTtPayChannel value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumTtPayChannel(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -73,7 +73,11 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen | |||
| @Override | |||
| public PayAdapterResult pay(WxPayAccount payAccount, WxPayOrder record,WxComposeOrder composeOrder,String productName,EnumPayShare isShare,WxAppinfo appInfo,Date currentDate, PayExtraParam params) throws Exception { | |||
| if(true){ | |||
| throw new MallinkException(ErrorCode.SYS_AUTH_ERROR.getCode(),"请升级抖音版本"); | |||
| } | |||
| //todo 去掉抖音低版本兼容 | |||
| if(!record.isCreatPay()){ | |||
| if(StringUtils.isBlank(record.getPayParam())){ | |||
| throw new MallinkException(ErrorCode.SYS_AUTH_ERROR.getCode(),"请升级抖音版本"); | |||
| @@ -1,11 +1,13 @@ | |||
| package com.iformall.service.pay.service.share; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxSharingOrderDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.enums.EnumProfitSharingOrderType; | |||
| import com.iformall.enums.EnumProfitSharingReceiverType; | |||
| @@ -122,5 +124,7 @@ public interface PayShareAdapterService { | |||
| ResultData handerSharingOrder(WxPayOrder payOrder, WxProfitSharingOrder sharingOrder); | |||
| WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, Integer share); | |||
| WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, Integer mchType,Integer share); | |||
| List<WxProfitSharingReceiver> getReceiverList(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay); | |||
| } | |||
| @@ -9,8 +9,10 @@ import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxSharingOrderDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.douyin.pay.DouYinPayHelper; | |||
| import com.iformall.douyin.pay.TtPayService; | |||
| import com.iformall.douyin.pay.enums.MerchantImportStatus; | |||
| import com.iformall.douyin.pay.exception.TtPayException; | |||
| import com.iformall.douyin.pay.orderQuery.QuerySettleResult; | |||
| import com.iformall.douyin.pay.preOrder.Settle; | |||
| @@ -22,6 +24,7 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.order.entity.WxComposeChildOrderShare; | |||
| import com.iformall.service.order.util.OrderHelper; | |||
| import com.iformall.service.pay.service.pay.douyin.miniApp.EnumTtPayChannel; | |||
| import com.iformall.service.pay.service.share.PayShareBaseAdapterService; | |||
| import com.iformall.service.pay.service.share.entity.PayShareCalculateAmount; | |||
| import com.iformall.service.pay.service.share.entity.PayShareQueryResult; | |||
| @@ -102,7 +105,7 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||
| String before3dayStr = DateUtils.getTimeBefore(2, new Date()); | |||
| Date before3day = DateUtils.stringToDate(before3dayStr); | |||
| if(before3day.before(record.getCreateTime())){ | |||
| return new PayShareResult(false, EnumProfitSharingOrderStatus.PROFIT_SHARING_READY.getCode(),"未满足D+3", null,null); | |||
| return new PayShareResult(false, EnumProfitSharingOrderStatus.PROFIT_SHARING_READY.getCode(),"未满足结算周期..", null,null); | |||
| } | |||
| try { | |||
| TtPayService ttPayService = maUtil.getTtPayService(appInfo, payAccount); | |||
| @@ -154,7 +157,7 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||
| String before3dayStr = DateUtils.getTimeBefore(2, new Date()); | |||
| Date before3day = DateUtils.stringToDate(before3dayStr); | |||
| if(before3day.before(record.getCreateTime())){ | |||
| return new PayShareResult(false, EnumProfitSharingOrderStatus.PROFIT_SHARING_APPLY_FAILED.getCode(),"未满足D+3", null,null); | |||
| return new PayShareResult(false, EnumProfitSharingOrderStatus.PROFIT_SHARING_APPLY_FAILED.getCode(),"未满足结算周期..", null,null); | |||
| } | |||
| try { | |||
| TtPayService ttPayService = maUtil.getTtPayService(appInfo, payAccount); | |||
| @@ -280,7 +283,7 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||
| public ResultData handerSharingOrder(WxPayOrder payOrder, WxProfitSharingOrder sharingOrder) { | |||
| if(!EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode().equals(sharingOrder.getType()) | |||
| && !EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE_FINISH.getCode().equals(sharingOrder.getType())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"分账类型错误"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"抖音暂不支持多次分账"); | |||
| } | |||
| WxCouponOrder couponOrder = new WxCouponOrder(); | |||
| couponOrder.updateTenantInfo(payOrder); | |||
| @@ -313,19 +316,8 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||
| Map<Long,WxCouponOrder> map = list.stream().collect(Collectors.toMap(WxCouponOrder::getOrderId, co -> co)); | |||
| for (WxOrder o:list1) { | |||
| WxCouponOrder co = map.get(o.getId()); | |||
| WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | |||
| psReceiverQ.updateTenantInfo(payOrder); | |||
| psReceiverQ.setMerchantId(co.getBMerchantId()); | |||
| psReceiverQ.setSharingType(this.getProfitSharingType()); | |||
| psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| psReceiverQ.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||
| psReceiverQ.setIsUse(EnumProfitSharingUse.YES.getCode()); | |||
| List<WxProfitSharingReceiver> psReceiverList = wxProfitSharingReceiverMapper.findList(psReceiverQ); | |||
| if(psReceiverList == null || psReceiverList.isEmpty() || psReceiverList.size() > 1){ | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"分账帐号异常{WxCouponOrder.getBMerchantId}"+co.getBMerchantId()); | |||
| } | |||
| WxProfitSharingReceiver receiver = psReceiverList.get(0); | |||
| List<WxProfitSharingReceiver> receiverList = getReceiverList(payOrder, co.getBMerchantId(), payOrder.getTtPayWay()); | |||
| WxProfitSharingReceiver receiver = receiverList.get(0); | |||
| WxComposeChildOrderShare childOrderShare = payOrder.getChildOrderShare(o.getId()); | |||
| int darenTakeAmount = 0; | |||
| if(EnumOrderCpsStatus.ORDER_IS_CPS.getCode().equals(o.getCpsStatus())){ | |||
| @@ -360,10 +352,10 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||
| } | |||
| @Override | |||
| public WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, Integer share) { | |||
| public WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, Integer mchType,Integer share) { | |||
| if(!EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode().equals(sharingOrderDto.getType()) | |||
| && !EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE_FINISH.getCode().equals(sharingOrderDto.getType())){ | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"分账类型错误"); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"抖音暂不支持多次分账"); | |||
| } | |||
| WxProfitSharingOrder record = new WxProfitSharingOrder(); | |||
| @@ -386,15 +378,51 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||
| record.setUpdateTime(currentDate); | |||
| record.setPayTimeStart(sharingOrderDto.getPayTimeStart()); | |||
| record.setPayTimeEnd(sharingOrderDto.getPayTimeEnd()); | |||
| if(EnumPayShare.YES.getCode().equals(share)){ | |||
| record.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode()); | |||
| }else{ | |||
| if(EnumPayMchType.DIRECT.getCode().equals(mchType)){ | |||
| record.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE_FINISH.getCode()); | |||
| }else{ | |||
| if(EnumPayShare.YES.getCode().equals(share)){ | |||
| record.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode()); | |||
| }else{ | |||
| record.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE_FINISH.getCode()); | |||
| } | |||
| } | |||
| wxProfitSharingOrderMapper.insert(record); | |||
| } | |||
| return record; | |||
| } | |||
| @Override | |||
| public List<WxProfitSharingReceiver> getReceiverList(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay) { | |||
| WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | |||
| psReceiverQ.updateTenantInfo(tenantEntity); | |||
| psReceiverQ.setMerchantId(merchantId); | |||
| psReceiverQ.setSharingType(this.getProfitSharingType()); | |||
| psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| psReceiverQ.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||
| String payMsg = ""; | |||
| if(EnumTtPayChannel.WX_PAY.getCode().equals(ttPayWay)){ | |||
| payMsg = EnumTtPayChannel.WX_PAY.getMessage(); | |||
| psReceiverQ.setWxImportStatus(MerchantImportStatus.improt_success.getCode()); | |||
| }else if(EnumTtPayChannel.ALI_PAY.getCode().equals(ttPayWay)){ | |||
| payMsg = EnumTtPayChannel.ALI_PAY.getMessage(); | |||
| psReceiverQ.setAlipayImportStatus(MerchantImportStatus.improt_success.getCode()); | |||
| }else if(EnumTtPayChannel.HZ_PAY.getCode().equals(ttPayWay)){ | |||
| payMsg = EnumTtPayChannel.HZ_PAY.getMessage(); | |||
| psReceiverQ.setHzImportStatus(MerchantImportStatus.improt_success.getCode()); | |||
| }else{ | |||
| log.error("该订单支付方式异常{}"); | |||
| } | |||
| List<WxProfitSharingReceiver> list = wxProfitSharingReceiverMapper.findList(psReceiverQ); | |||
| if(list == null || list.isEmpty()){ | |||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户未未进件."+payMsg); | |||
| } | |||
| if(list.size() > 1){ | |||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_UNKNOWN.getCode(),"该商户分账帐号异常."); | |||
| } | |||
| return list; | |||
| } | |||
| } | |||
| @@ -7,8 +7,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.dto.WxSharingOrderDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.douyin.pay.enums.MerchantImportStatus; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.pay.service.pay.douyin.miniApp.EnumTtPayChannel; | |||
| import net.sf.saxon.trans.Err; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -444,7 +447,10 @@ public class WxPayShareService extends PayShareBaseAdapterService{ | |||
| } | |||
| @Override | |||
| public WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, Integer share) { | |||
| public WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, Integer mchType,Integer share) { | |||
| if(EnumPayMchType.DIRECT.getCode().equals(mchType)){ | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"微信直连模式待开发"); | |||
| } | |||
| if(EnumYesOrNo.NO.getCode().equals(share)){ | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"微信不分账"); | |||
| } | |||
| @@ -473,14 +479,8 @@ public class WxPayShareService extends PayShareBaseAdapterService{ | |||
| wxProfitSharingOrderMapper.insert(record); | |||
| } | |||
| //准备分账列表 | |||
| WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | |||
| psReceiverQ.updateTenantInfo(sharingOrderDto); | |||
| psReceiverQ.setMerchantId(sharingOrderDto.getMerchantId()); | |||
| psReceiverQ.setSharingType(this.getProfitSharingType()); | |||
| psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| psReceiverQ.setPlat(EnumAppPlat.WX.getCode()); | |||
| List<WxProfitSharingReceiver> psReceiverList = wxProfitSharingReceiverMapper.findList(psReceiverQ); | |||
| List<WxProfitSharingReceiver> psReceiverList = getReceiverList(sharingOrderDto, sharingOrderDto.getMerchantId(), null); | |||
| if (psReceiverList != null && psReceiverList.size() > 50) { | |||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID); | |||
| } | |||
| @@ -531,6 +531,28 @@ public class WxPayShareService extends PayShareBaseAdapterService{ | |||
| return record; | |||
| } | |||
| @Override | |||
| public List<WxProfitSharingReceiver> getReceiverList(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay) { | |||
| WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | |||
| psReceiverQ.updateTenantInfo(tenantEntity); | |||
| psReceiverQ.setMerchantId(merchantId); | |||
| psReceiverQ.setSharingType(getProfitSharingType()); | |||
| psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| psReceiverQ.setPlat(EnumAppPlat.WX.getCode()); | |||
| List<WxProfitSharingReceiver> psReceiverList = wxProfitSharingReceiverMapper.findList(psReceiverQ); | |||
| if (null == psReceiverList || psReceiverList.size() == 0) { | |||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户未设置分账账号."); | |||
| }else { | |||
| for (WxProfitSharingReceiver receiver:psReceiverList) { | |||
| if (EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID.getCode().intValue() | |||
| == receiver.getReceiverType().intValue()) { | |||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户收款账号存在个人微信号方式,微信已停止支持,请重新设置."); | |||
| } | |||
| } | |||
| } | |||
| return psReceiverList; | |||
| } | |||
| private static String queryOrderShareAmount(String mchId,String transcationId,String apiKey) { | |||
| WxProfitSharingP psCmd = new WxProfitSharingP(); | |||
| psCmd.setMch_id(mchId);//服务商商户id | |||
| @@ -19,6 +19,8 @@ | |||
| <result column="merchant_cert_path" jdbcType="VARCHAR" property="merchantCertPath"/> | |||
| <result column="merchant_cert_pem_path" jdbcType="VARCHAR" property="merchantCertPemPath"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="mch_type" jdbcType="INTEGER" property="mchType"/> | |||
| <result column="open_pay" jdbcType="VARCHAR" property="openPay"/> | |||
| <result column="share" jdbcType="INTEGER" property="share"/> | |||
| <result column="rate" jdbcType="INTEGER" property="rate"/> | |||
| <result column="real_rate" jdbcType="INTEGER" property="realRate"/> | |||
| @@ -33,8 +35,9 @@ | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`mch_id`,`sub_mch_id`,`sub_app_id`,`api_key`,`merchant_api_key`,`notify_url`,`notify_token`,`cert_path`, | |||
| `merchant_cert_path`,`type`,`share`,`rate`,`real_rate`,`service_id`,`pay_score_notify_url`,`api_v3_key`,`cert_serial_no`,`private_key_path`, | |||
| `private_cert_pem_path`,`merchant_key_path`,`merchant_apiv3_key`,`merchant_cert_pem_path` | |||
| `merchant_cert_path`,`type`,`mch_type`,`open_pay`,`share`,`rate`,`real_rate`, | |||
| `service_id`,`pay_score_notify_url`,`api_v3_key`,`cert_serial_no`,`private_key_path`,`private_cert_pem_path`, | |||
| `merchant_key_path`,`merchant_apiv3_key`,`merchant_cert_pem_path` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -23,6 +23,7 @@ | |||
| <result column="pay_order_no" jdbcType="VARCHAR" property="payOrderNo"/> | |||
| <result column="pay_order_status" jdbcType="INTEGER" property="payOrderStatus"/> | |||
| <result column="pay_param" jdbcType="VARCHAR" property="payParam"/> | |||
| <result column="mch_type" jdbcType="INTEGER" property="mchType"/> | |||
| <result column="share" jdbcType="INTEGER" property="share"/> | |||
| <result column="share_amount" jdbcType="INTEGER" property="shareAmount"/> | |||
| <result column="rate_amount" jdbcType="INTEGER" property="rateAmount"/> | |||
| @@ -40,7 +41,7 @@ | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`order_id`,`c_user_id`,`open_id`,`b_user_id`, | |||
| `auth_code`,`ip`,`pay_amount`,`pay_time_start`,`pay_time_end`, | |||
| `prepay_id`,`transaction_id`,`pay_vendor`,`tt_pay_way`,`pay_order_no`, | |||
| `pay_order_status`,`pay_param`,`share`,`share_amount`,`rate_amount`,`fail_reason`, | |||
| `pay_order_status`,`pay_param`,`mch_type`,`share`,`share_amount`,`rate_amount`,`fail_reason`, | |||
| `pos_pay_order_id`,`pos_pay_order_time`,`pos_payment_type`,`pos_pay_order_no`,`pos_pay_des`,`compose_order`, | |||
| `child_order_share` | |||
| </sql> | |||