Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.czg.service.market.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.codec.Base64Encoder;
|
||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import com.czg.market.dto.MkDistributionConfigDTO;
|
||||
import com.czg.market.entity.MkDistributionConfig;
|
||||
import com.czg.market.entity.MkDistributionLevelConfig;
|
||||
@@ -16,6 +18,11 @@ import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 分销配置 服务层实现。
|
||||
*
|
||||
@@ -55,4 +62,27 @@ public class MkDistributionConfigServiceImpl extends ServiceImpl<MkDistributionC
|
||||
|
||||
return updateById(config);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String rechargeQrCode(Long shopId, BigDecimal amount) {
|
||||
try {
|
||||
// 生成二维码图片
|
||||
BufferedImage image = QrCodeUtil.generate(
|
||||
"https://cashier.sxczgkj.com/payTest?shopId=" + shopId + "&amount=" + amount,
|
||||
500,
|
||||
500
|
||||
);
|
||||
|
||||
// 转为字节流
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
ImageIO.write(image, "png", os);
|
||||
|
||||
// 转 Base64
|
||||
String base64 = Base64Encoder.encode(os.toByteArray());
|
||||
return "data:image/png;base64," + base64;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("生成二维码失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
|
||||
|
||||
@Override
|
||||
public void rechargeCallBack(Long userId, Long shopId, BigDecimal amount, Long paymentId) {
|
||||
public void rechargeCallBack(Long shopId, BigDecimal amount, Long paymentId) {
|
||||
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
|
||||
BigDecimal finalAmount = shopInfoService.updateAmount(shopId, amount);
|
||||
distributionAmountFlowService.save(new MkDistributionAmountFlow()
|
||||
|
||||
@@ -101,7 +101,7 @@ public class DistributionPayServiceImpl implements DistributionPayService {
|
||||
|
||||
@Override
|
||||
public Map<String, String> mchRecharge(String clientIP, MkDistributionPayDTO payParam) {
|
||||
InitInfo initInfo = initPayment(payParam.getUserId(), payParam, true);
|
||||
InitInfo initInfo = initPayment(payParam.getUserId() == null ? payParam.getShopId() : payParam.getUserId(), payParam, true);
|
||||
return wxService.v3Pay(initInfo.openId, payParam.getAmount(), "商户运营余额充值", initInfo.payment.getOrderNo(), initInfo.payment.getPayType());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user