|
@@ -11,16 +11,20 @@ import com.ym.mec.biz.dal.enums.FeeTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
+import com.ym.mec.common.redis.service.RedisCache;
|
|
|
import com.ym.mec.thirdparty.adapay.ConfigInit;
|
|
|
import com.ym.mec.thirdparty.adapay.Payment;
|
|
|
import com.ym.mec.thirdparty.yqpay.YqPayUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
+import org.springframework.data.redis.core.ValueOperations;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -40,6 +44,8 @@ public class PayServiceImpl implements PayService {
|
|
|
private SellOrderService sellOrderService;
|
|
|
@Autowired
|
|
|
private HfMemberDao hfMemberDao;
|
|
|
+ @Autowired
|
|
|
+ private RedisCache<String, Object> redisCache;
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> getPayMap(BigDecimal amount, BigDecimal balanceAmount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, Integer organId, String receiver) throws Exception {
|
|
@@ -538,8 +544,26 @@ public class PayServiceImpl implements PayService {
|
|
|
List<PaymentChannelEnum> paymentChannelList = new ArrayList<>();
|
|
|
paymentChannelList.add(PaymentChannelEnum.ADAPAY);
|
|
|
|
|
|
- BigDecimal monthHasReceipt = studentPaymentRouteOrderDao.getRouteOrderAmount(routeScaleDto.getOrganId(), paymentChannelList, monthStartTime);
|
|
|
- monthHasReceipt = monthHasReceipt == null ? BigDecimal.ZERO : monthHasReceipt;
|
|
|
+// String key = "month_max_receipt_"+routeScaleDto.getOrganId();
|
|
|
+// if(redisCache.exists(key)){
|
|
|
+// RedisTemplate<String, Object> redisTemplate = redisCache.getRedisTemplate();
|
|
|
+// try {
|
|
|
+// ValueOperations<String, Object> valueOper = redisTemplate.opsForValue();
|
|
|
+// Long index = valueOper.increment(key, 1);
|
|
|
+// } catch (Exception ex) {
|
|
|
+// log.error("分布式订单号生成失败异常。。。。。", ex);
|
|
|
+// } finally {
|
|
|
+// redisTemplate.expire(key, 600, TimeUnit.SECONDS);// 保留10分钟内的key
|
|
|
+// }
|
|
|
+// }else {
|
|
|
+ BigDecimal monthHasReceipt = studentPaymentRouteOrderDao.getRouteOrderAmount(routeScaleDto.getOrganId(), paymentChannelList, monthStartTime);
|
|
|
+ monthHasReceipt = monthHasReceipt == null ? BigDecimal.ZERO : monthHasReceipt;
|
|
|
+ monthHasReceipt.multiply(new BigDecimal(100));
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if (routeScaleDto.getAmount().add(monthHasReceipt).compareTo(monthMaxReceipt) > 0) {
|
|
|
routeScaleDto.setMerNo(hfmember.getRouteMemberId());
|
|
|
routeScaleDto.setOrganId(hfmember.getRouteOrganId());
|