| @@ -11,7 +11,7 @@ ALTER TABLE `wx_user_visit` | |||||
| ADD COLUMN `parent_tenant_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID' AFTER `tenant_id`; | ADD COLUMN `parent_tenant_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID' AFTER `tenant_id`; | ||||
| CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `root`@`%` SQL SECURITY DEFINER VIEW `mallink`.`view_touch_user` AS SELECT | |||||
| CREATE OR REPLACE VIEW `mallink`.`view_touch_user` AS SELECT | |||||
| date_format( `u`.`day_date`, '%Y-%m-%d' ) AS `xTime`, | date_format( `u`.`day_date`, '%Y-%m-%d' ) AS `xTime`, | ||||
| `u`.`tenant_id` AS `tenant_id`, | `u`.`tenant_id` AS `tenant_id`, | ||||
| `u`.`parent_tenant_id` AS `parent_tenant_id`, | `u`.`parent_tenant_id` AS `parent_tenant_id`, | ||||
| @@ -58,7 +58,7 @@ GROUP BY | |||||
| ) | ) | ||||
| ); | ); | ||||
| CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `root`@`%` SQL SECURITY DEFINER VIEW `mallink`.`view_coupon_data` AS SELECT | |||||
| CREATE OR REPLACE VIEW `mallink`.`view_coupon_data` AS SELECT | |||||
| `baseInfo`.`createTime` AS `createTime`, | `baseInfo`.`createTime` AS `createTime`, | ||||
| `baseInfo`.`couponId` AS `couponId`, | `baseInfo`.`couponId` AS `couponId`, | ||||
| `baseInfo`.`couponUserCount` AS `couponUserCount`, | `baseInfo`.`couponUserCount` AS `couponUserCount`, | ||||
| @@ -4,12 +4,14 @@ import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import lombok.ToString; | |||||
| import java.util.*; | import java.util.*; | ||||
| @TableName(value = "wx_pay_order") | @TableName(value = "wx_pay_order") | ||||
| @Data | @Data | ||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||
| @ToString | |||||
| public class WxPayOrder extends TenantEntity { | public class WxPayOrder extends TenantEntity { | ||||
| protected Long id; | protected Long id; | ||||
| @@ -398,8 +398,15 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| } | } | ||||
| } | } | ||||
| logger.debug("wxPayRecord md5 before:"+record.toString()); | |||||
| String beforemd5 = HashUtil.md5(record.toString()); | |||||
| PayAdapterResult payResult = PayServiceFactory.getPayAdapterService(payWay.getCode()).pay(payAccount, order, record,isShare,appInfo, currentDate, params); | PayAdapterResult payResult = PayServiceFactory.getPayAdapterService(payWay.getCode()).pay(payAccount, order, record,isShare,appInfo, currentDate, params); | ||||
| //成功或者失败都需要更新record | |||||
| String aftermd5 = HashUtil.md5(record.toString()); | |||||
| if (beforemd5.equals(aftermd5)) { | |||||
| logger.error("支付方式["+payWay.getCode()+"]支付接口【pay】过程中 WxPayOrder 未做更新.record:"+record.toString()); | |||||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(),"支付方式["+payWay.getCode()+"]支付接口【pay】过程中 WxPayOrder 未做更新"); | |||||
| } | |||||
| //成功或者失败都需要更新record, 更新的信息在各自的业务里面处理 | |||||
| try { | try { | ||||
| wxPayOrderMapper.updateById(record); | wxPayOrderMapper.updateById(record); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -3,7 +3,9 @@ package com.iformall.service.pay; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| import java.util.concurrent.ConcurrentHashMap; | import java.util.concurrent.ConcurrentHashMap; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.enums.EnumPayWay; | import com.iformall.enums.EnumPayWay; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.service.pay.impl.WxPayAdapterService; | import com.iformall.service.pay.impl.WxPayAdapterService; | ||||
| /** | /** | ||||
| @@ -14,7 +16,7 @@ public class PayServiceFactory { | |||||
| private static Map<Integer,PayAdapterService> serviceMap = new ConcurrentHashMap<Integer, PayAdapterService>(); | private static Map<Integer,PayAdapterService> serviceMap = new ConcurrentHashMap<Integer, PayAdapterService>(); | ||||
| public static PayAdapterService getPayAdapterService(Integer type) { | |||||
| public static PayAdapterService getPayAdapterService(Integer type) throws MallinkException{ | |||||
| if (serviceMap.containsKey(type)) { | if (serviceMap.containsKey(type)) { | ||||
| return serviceMap.get(type); | return serviceMap.get(type); | ||||
| }else { | }else { | ||||
| @@ -26,6 +28,10 @@ public class PayServiceFactory { | |||||
| } | } | ||||
| serviceMap.put(type, payService); | serviceMap.put(type, payService); | ||||
| } | } | ||||
| return serviceMap.get(type); | |||||
| PayAdapterService service = serviceMap.get(type); | |||||
| if (null == service) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"payType["+type+"] 支付service未找到"); | |||||
| } | |||||
| return service; | |||||
| } | } | ||||
| } | } | ||||