|
|
@@ -12,6 +12,7 @@ import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
|
|
import com.github.binarywang.wxpay.constant.WxPayConstants;
|
|
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
|
|
import com.github.binarywang.wxpay.service.WxPayService;
|
|
|
+import com.google.common.base.Splitter;
|
|
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
|
|
import com.huifu.adapay.model.AdapayCommon;
|
|
|
import com.huifu.adapay.model.Payment;
|
|
|
@@ -31,6 +32,7 @@ import com.izouma.nineth.exception.BusinessException;
|
|
|
import com.izouma.nineth.repo.*;
|
|
|
import com.izouma.nineth.security.Authority;
|
|
|
import com.izouma.nineth.service.sms.SmsService;
|
|
|
+import com.izouma.nineth.utils.AESEncryptUtil;
|
|
|
import com.izouma.nineth.utils.JpaUtils;
|
|
|
import com.izouma.nineth.utils.SnowflakeIdWorker;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
@@ -88,7 +90,18 @@ public class OrderService {
|
|
|
return orderRepo.findAll(JpaUtils.toSpecification(pageQuery, Order.class), JpaUtils.toPageRequest(pageQuery));
|
|
|
}
|
|
|
|
|
|
- public String mqCreate(Long userId, Long collectionId, int qty, Long addressId, Long userCouponId, Long invitor) {
|
|
|
+ public String mqCreate(Long userId, Long collectionId, int qty, Long addressId, Long userCouponId, Long invitor, String sign) {
|
|
|
+ String qs = null;
|
|
|
+ try {
|
|
|
+ qs = AESEncryptUtil.decrypt(sign);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BusinessException("签名错误");
|
|
|
+ }
|
|
|
+ final Map<String, String> map = Splitter.on('&').trimResults().withKeyValueSeparator('=').split(qs);
|
|
|
+ if (Math.abs(MapUtils.getLong(map, "ts") - System.currentTimeMillis()) > 90000) {
|
|
|
+ throw new BusinessException("签名已过期");
|
|
|
+ }
|
|
|
+
|
|
|
Long id = snowflakeIdWorker.nextId();
|
|
|
SendResult result = rocketMQTemplate.syncSend(generalProperties.getCreateOrderTopic(),
|
|
|
new CreateOrderEvent(id, userId, collectionId, qty, addressId, userCouponId, invitor), 100000);
|