|
@@ -9,11 +9,15 @@ import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
|
|
|
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
|
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
|
|
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
|
|
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
|
|
|
import com.github.binarywang.wxpay.service.WxPayService;
|
|
import com.github.binarywang.wxpay.service.WxPayService;
|
|
|
|
|
+import cn.binarywang.wx.miniapp.api.WxMaQrcodeService;
|
|
|
|
|
+import cn.binarywang.wx.miniapp.api.WxMaService;
|
|
|
|
|
+import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor;
|
|
|
import io.undertow.servlet.spec.HttpServletRequestImpl;
|
|
import io.undertow.servlet.spec.HttpServletRequestImpl;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
import org.apache.commons.io.IOUtils;
|
|
import org.apache.commons.io.IOUtils;
|
|
|
import org.dromara.common.core.domain.R;
|
|
import org.dromara.common.core.domain.R;
|
|
|
import org.dromara.common.log.annotation.Log;
|
|
import org.dromara.common.log.annotation.Log;
|
|
@@ -25,6 +29,7 @@ import org.dromara.system.domain.bo.TblDzbcStatisticsBo;
|
|
|
import org.dromara.system.domain.vo.TblDzbcOrderVo;
|
|
import org.dromara.system.domain.vo.TblDzbcOrderVo;
|
|
|
import org.dromara.system.service.ITblDzbcBannerService;
|
|
import org.dromara.system.service.ITblDzbcBannerService;
|
|
|
import org.dromara.system.service.ITblDzbcOrderService;
|
|
import org.dromara.system.service.ITblDzbcOrderService;
|
|
|
|
|
+import org.springframework.http.MediaType;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
@@ -50,6 +55,7 @@ public class CommonDzbcOtherController extends BaseController {
|
|
|
private final ITblDzbcOrderService orderService;
|
|
private final ITblDzbcOrderService orderService;
|
|
|
private final ITblDzbcCargoOrderService cargoOrderService;
|
|
private final ITblDzbcCargoOrderService cargoOrderService;
|
|
|
private final WxPayService wxPayService;
|
|
private final WxPayService wxPayService;
|
|
|
|
|
+ private final WxMaService wxMaService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -157,6 +163,51 @@ public class CommonDzbcOtherController extends BaseController {
|
|
|
QrCodeUtil.generate(content, width, height, "png", response.getOutputStream());
|
|
QrCodeUtil.generate(content, width, height, "png", response.getOutputStream());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 生成小程序码(无限制)
|
|
|
|
|
+ * @param scene 场景值,最多32个可见字符
|
|
|
|
|
+ * @param page 页面路径,必须是已经发布的小程序存在的页面
|
|
|
|
|
+ * @param checkPath 检查page是否存在,默认true
|
|
|
|
|
+ * @param envVersion 环境版本:release正式版, trial体验版, develop开发版,默认release
|
|
|
|
|
+ * @param width 小程序码宽度,默认430
|
|
|
|
|
+ * @param autoColor 自动配置线条颜色,默认true
|
|
|
|
|
+ * @param isHyaline 是否需要透明底色,默认false
|
|
|
|
|
+ * @param appid 小程序appid,默认使用第一个配置的小程序
|
|
|
|
|
+ * @param response HttpServletResponse
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/wxma/qrcode/unlimited")
|
|
|
|
|
+ public void getUnlimitedQRCode(
|
|
|
|
|
+ @RequestParam String scene,
|
|
|
|
|
+ @RequestParam(defaultValue = "") String page,
|
|
|
|
|
+ @RequestParam(defaultValue = "true") boolean checkPath,
|
|
|
|
|
+ @RequestParam(defaultValue = "release") String envVersion,
|
|
|
|
|
+ @RequestParam(defaultValue = "430") int width,
|
|
|
|
|
+ @RequestParam(defaultValue = "true") boolean autoColor,
|
|
|
|
|
+ @RequestParam(defaultValue = "false") boolean isHyaline,
|
|
|
|
|
+ @RequestParam(defaultValue = "wx5c9baacf2aab55b8") String appid,
|
|
|
|
|
+ HttpServletResponse response) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 切换到指定小程序
|
|
|
|
|
+ wxMaService.switchover(appid);
|
|
|
|
|
+ WxMaQrcodeService qrcodeService = wxMaService.getQrcodeService();
|
|
|
|
|
+
|
|
|
|
|
+ // 生成小程序码
|
|
|
|
|
+ // 参数顺序: scene, page, checkPath, envVersion, width, autoColor, lineColor, isHyaline
|
|
|
|
|
+ byte[] qrCodeBytes = qrcodeService.createWxaCodeUnlimitBytes(scene, page, checkPath, envVersion, width, autoColor, null, isHyaline);
|
|
|
|
|
+
|
|
|
|
|
+ // 返回图片
|
|
|
|
|
+ response.setContentType(MediaType.IMAGE_PNG_VALUE);
|
|
|
|
|
+ response.getOutputStream().write(qrCodeBytes);
|
|
|
|
|
+ response.getOutputStream().flush();
|
|
|
|
|
+ } catch (WxErrorException e) {
|
|
|
|
|
+ log.error("生成小程序码失败: {}", e.getMessage());
|
|
|
|
|
+ throw new RuntimeException("生成小程序码失败: " + e.getMessage());
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ log.error("输出小程序码失败: {}", e.getMessage());
|
|
|
|
|
+ throw new RuntimeException("输出小程序码失败: " + e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
@Log(title = "定制班车-订单微信退款回调", businessType = BusinessType.UPDATE)
|
|
@Log(title = "定制班车-订单微信退款回调", businessType = BusinessType.UPDATE)
|