spring boot + uniapp 微信公众号 jsapi 支付

后端支付类

package com.ruoyi.coupon.payment;import com.google.gson.Gson;
import com.ruoyi.coupon.payment.dto.PayParamJsapiDto;
import com.ruoyi.coupon.payment.dto.RefundParam;
import com.ruoyi.coupon.service.ICouponConfigService;
import com.wechat.pay.java.core.Config;
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
import com.wechat.pay.java.core.notification.NotificationConfig;import com.wechat.pay.java.core.notification.NotificationParser;
import com.wechat.pay.java.core.notification.RequestParam;
import com.wechat.pay.java.core.util.PemUtil;
import com.wechat.pay.java.service.payments.jsapi.JsapiService;
import com.wechat.pay.java.service.payments.jsapi.model.*;
import com.wechat.pay.java.service.payments.model.Transaction;
import com.wechat.pay.java.service.payments.model.TransactionAmount;
import com.wechat.pay.java.service.refund.RefundService;
import com.wechat.pay.java.service.refund.model.AmountReq;
import com.wechat.pay.java.service.refund.model.CreateRequest;
import com.wechat.pay.java.service.refund.model.Refund;
import com.wechat.pay.java.service.refund.model.RefundNotification;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.security.*;
import java.util.*;@Service
public class WeChatJsapiPayment {private static final String mchId = "165"; // 商户号private static final String mchSerialNo = "12C5F95"; // 商户证书序列号//商户私钥 //https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay3_1.shtmlprivate static final String privateKey = "-----BEGIN PRIVATE KEY-----" +"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDOo7rFC6cJF+kd" +"7cPFkmrHlbdihgznK2u5v2CDoSClwrY1hGE81VJMHjHic03Ky0Hx1lCZh+hOCZXk" +"4mnTnbeUlvq/6E6I6gexsM9ww6nz0YbPRZuNPPxBmP1rqKzlZO7LiLvIwg8x3cOr" +"qB4uPCo5Eh0Ty3r1kygfEXDyWEHWRYx1JVesmcxBp2n8HkfIpNA3tyPFnTFJEI4W" +"/7T4ScoSlRRUsYNrg0oox683HgFXWE9fAJloyt35EHPoBEx6gUGKC9Gm1luJNrSb" +"9GAQCPLVgtr3hq0kQHvVKcKsgpzPJA5G20bTM1X9Yo/nr+rt+HFZpbaNvviuhXg7" +"EvajkeprAgMBAAECggEAUXVTzBei2j/VwtmW4kys0U7gwvMLJRoF1mxt9JXRE+cl" +"AwXTezKwxZblnVpM4VOtBFOy5EMiPZkjwN3MUAKNewLliD9grjJrpA2KSO6pEZeY" +"aB8NiejvnEBeLlGJDsjyJcQaGrL9YHAGkaWteBZ5opPUaJg/OY2wNEcg2jgWhAui" +"eTqocUEnbowDCFlpHEJmAJKxuaLaV39Wad1jKs9N9CiqYyVNfNoeZJ7LSHekrz6v" +"SOVD8nz3y/1evf4LqkaIjLJwTS9UXVZuKjlyLcjsEpGf4X3cZ7hI/wJEqXDqKSL8" +"cgbnkZTI6YI32ukAIne/d3AOsRkbYomR26g3cqpeqQKBgQD9bxwYm+Z73SrfCJte" +"8Tj9ejrBWcAU1r8p1uu7kiL2gU0RVxwzBe0QNhLUybP5ciONzAtkS6/NPLkHU6HQ" +"frb9JqoipC6LT7c2R4kR+4wcLH9lbiscljPUji04sEEMzUrLWjwcAwLjlCNbqZ4m" +"UJ2y4skFFzVEa6a8uO7qX5qFpQKBgQDQu1Sgrhb2Yby/YuJyq2j8k5BRiHcjLmUI" +"Pi1uIq0lUof4F61EkFuua+bsr+oaiQxhqKIkPbURnjdkEG2bC5K/n+f2BbOFOfSz" +"14ygBoZaRGZvoS56xOETh9ao9sLCsQJgz1E3gwYpAIbh6DBvoU8w0prL/O0gbAC/" +"CywSvL1SzwKBgHJ413X+JTNZiN3JI3TU/Grx5Mwk3/AJt7sMStokfgpeCROGB0S8" +"roGeCw92NAa+GXUY7yRUU4oenWzDx9lHAxyBdGPFSQi/7v9jfHRU7MplBv4nru1w" +"ouSle6OZaSiBKgGENpZofcuRxA7JJJgl3bVJXocgHn1TKrMfzTqsCD3JAoGBAK8S";// 你的微信支付平台证书private static final String apiV3Key = "f2f4667bfeab441";//公众号appIdprivate static final String appid="wx29d5";private static final String secret = "58be861a9f6";public static Map<String,RSAAutoCertificateConfig> config=new HashMap<>();@Autowiredprivate ICouponConfigService couponConfigService;/*** 获取jsapi服务类* @return*/public JsapiService getJsapiService(){RSAAutoCertificateConfig rsaAutoCertificateConfig = config.get(this.mchId);if(rsaAutoCertificateConfig == null){RSAAutoCertificateConfig build = new RSAAutoCertificateConfig.Builder().merchantId(this.mchId).privateKey(this.privateKey)//.privateKeyFromPath(WxConfig.privateKeyPath).merchantSerialNumber(this.mchSerialNo).apiV3Key(this.apiV3Key).build();config.put(this.mchId,build);rsaAutoCertificateConfig = build;}JsapiService service = new JsapiService.Builder().config(rsaAutoCertificateConfig).build();return service;}/*** 进行支付* @param payParam* @return*/public String pay(PayParamJsapiDto payParam) {String apiUrl = couponConfigService.getValue("online_domain");JsapiService jsapiService = getJsapiService();PrepayRequest request = new PrepayRequest();Amount amount = new Amount();amount.setTotal((int)(Double.parseDouble(payParam.getAmount().toPlainString())*100));//amount.setTotal(1);request.setAmount(amount);request.setAppid(payParam.getAppid());request.setMchid(payParam.getMerchantId());request.setDescription(payParam.getDescription());request.setNotifyUrl(apiUrl +"api" + "/payment/weChatOfficialAccounts/payment/notify");//这个回调url必须是https开头的request.setOutTradeNo(payParam.getOutTradeNo());Payer payer = new Payer();payer.setOpenid(payParam.getOpenid());request.setPayer(payer);//设置回传参数Gson gson=new Gson();request.setAttach(gson.toJson(payParam.getParam()));PrepayResponse prepay = jsapiService.prepay(request);String prepayid=prepay.getPrepayId();return prepayid;}/** 商户订单号查询订单 */public Transaction queryOrderByOutTradeNo(String orderNum) {JsapiService jsapiService = getJsapiService();QueryOrderByOutTradeNoRequest request = new QueryOrderByOutTradeNoRequest();request.setOutTradeNo(orderNum);// 调用request.setXxx(val)设置所需参数,具体参数可见Request定义// 调用接口return jsapiService.queryOrderByOutTradeNo(request);}/*** 支付成功验签* @param request* @return*/public Map paySuccessCheck(HttpServletRequest request) {/*Config config =new RSAAutoCertificateConfig.Builder().merchantId(dto.getWechatpayMchid()).privateKey(dto.getWechatpayPrivatekey()).merchantSerialNumber(dto.getWechatpayMchserialno()).apiV3Key(dto.getWechatpayApiv3key()).build();*/RSAAutoCertificateConfig config1 = config.get(this.mchId);if(config1 == null){RSAAutoCertificateConfig build = new RSAAutoCertificateConfig.Builder().merchantId(this.mchId).privateKey(this.privateKey)//.privateKeyFromPath(WxConfig.privateKeyPath).merchantSerialNumber(this.mchSerialNo).apiV3Key(this.apiV3Key).build();config.put(this.mchId,build);config1 = build;}// 从请求头中获取信息String timestamp                        = request.getHeader("Wechatpay-Timestamp");String nonce                            = request.getHeader("Wechatpay-Nonce");String signature                        = request.getHeader("Wechatpay-Signature");String singType                         = request.getHeader("Wechatpay-Signature-Type");String wechatPayCertificateSerialNumber = request.getHeader("Wechatpay-Serial");String requestBody = getRequestBody(request);// 构造 RequestParamRequestParam requestParam = new RequestParam.Builder().serialNumber(wechatPayCertificateSerialNumber).nonce(nonce).signature(signature).signType(singType).timestamp(timestamp).body(requestBody).build();// 初始化解析器 NotificationParserNotificationParser parser = new NotificationParser((NotificationConfig) config1);// 这个Transaction是微信包里面的Transaction decryptObject = parser.parse(requestParam, Transaction.class);TransactionAmount amount = decryptObject.getAmount();String outTradeNo = decryptObject.getOutTradeNo();String attach = decryptObject.getAttach();Map map=new HashMap();map.put("amount",amount.getTotal());map.put("outTradeNo",outTradeNo);map.put("attach",attach);return map;}// 获取请求头里的数据private String getRequestBody(HttpServletRequest request) {StringBuffer sb = new StringBuffer();try (ServletInputStream inputStream = request.getInputStream();BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));) {String line;while ((line = reader.readLine()) != null) {sb.append(line);}} catch (IOException e) {System.out.println("读取数据流异常:"+e);}return sb.toString();}/*** 组装支付参数* @param prepayId* @return*/public Map getPayParameter(String prepayId){Map<String,String> map=new HashMap<>();map.put("appId",this.appid);map.put("timeStamp",String.valueOf(new Date().getTime()));map.put("nonceStr", UUID.randomUUID().toString().replace("-",""));map.put("package","prepay_id="+prepayId);map.put("signType","RSA");String s = map.get("appId") + "\n" + map.get("timeStamp") + "\n" + map.get("nonceStr") + "\n" + map.get("package") + "\n";try {PrivateKey privateKey1 = PemUtil.loadPrivateKeyFromString(this.privateKey);Signature sign = Signature.getInstance("SHA256withRSA");sign.initSign(privateKey1);sign.update(s.getBytes("utf-8"));String string = Base64.getEncoder().encodeToString(sign.sign());map.put("paySign",string);return map;} catch (NoSuchAlgorithmException e) {e.printStackTrace();} catch (InvalidKeyException e) {e.printStackTrace();} catch (UnsupportedEncodingException e) {e.printStackTrace();} catch (SignatureException e) {e.printStackTrace();}return null;}/*** 公众号 code 换取 openid* @param code* @return*/public String getOpenId(String code) {OkHttpClient client = new OkHttpClient();Request request = new Request.Builder().url("https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + this.appid + "&secret=" + this.secret + "&code=" + code + "&grant_type=authorization_code").build();try {Response response = client.newCall(request).execute();String string = response.body().string();//System.out.println(string);Gson gson = new Gson();Map map = gson.fromJson(string, Map.class);/*** {* 	"session_key": "G4YmjKXmPsqjDFdtcjp/9A==",* 	"openid": "o27Z36yx16I4EF84dpTslNdVhsQY"* }*/return (String) map.get("openid");} catch (IOException e) {e.printStackTrace();}return null;}/*** 申请退款* @param refundParam*/public void refundOrder(RefundParam refundParam) {String apiUrl = couponConfigService.getValue("online_domain");BigDecimal bigDecimal = new BigDecimal(100);int total = bigDecimal.multiply(new BigDecimal(refundParam.getTotal())).intValue();int refund = bigDecimal.multiply(new BigDecimal(refundParam.getRefund())).intValue();Config config =new RSAAutoCertificateConfig.Builder().merchantId(mchId).privateKey(privateKey).merchantSerialNumber(mchSerialNo).apiV3Key(apiV3Key).build();RefundService service = new RefundService.Builder().config(config).build();//生成随机退款订单号String s = UUID.randomUUID().toString().replace("-","");CreateRequest request = new CreateRequest();//金额信息AmountReq amount = new AmountReq();amount.setCurrency("CNY");amount.setTotal(Long.valueOf(total));amount.setRefund(Long.valueOf(refund));request.setAmount(amount);request.setOutTradeNo(refundParam.getOutTradeNo());request.setOutRefundNo(s);//request.setNotifyUrl("http://egevdr.natappfree.cc" + "/payment/weChatPay/refund/notify");request.setNotifyUrl(apiUrl +"api" + "/payment/weChatOfficialAccounts/refund/notify");//发送请求Refund refund1 = service.create(request);}public Map refundSuccessCheck(HttpServletRequest request) {Config config =new RSAAutoCertificateConfig.Builder().merchantId(mchId).privateKey(privateKey).merchantSerialNumber(mchSerialNo).apiV3Key(apiV3Key).build();// 从请求头中获取信息String timestamp                        = request.getHeader("Wechatpay-Timestamp");String nonce                            = request.getHeader("Wechatpay-Nonce");String signature                        = request.getHeader("Wechatpay-Signature");String singType                         = request.getHeader("Wechatpay-Signature-Type");String wechatPayCertificateSerialNumber = request.getHeader("Wechatpay-Serial");String requestBody = getRequestBody(request);// 构造 RequestParamRequestParam requestParam = new RequestParam.Builder().serialNumber(wechatPayCertificateSerialNumber).nonce(nonce).signature(signature).signType(singType).timestamp(timestamp).body(requestBody).build();// 初始化解析器 NotificationParserNotificationParser parser = new NotificationParser((NotificationConfig) config);// 这个Transaction是微信包里面的RefundNotification decryptObject = parser.parse(requestParam, RefundNotification.class);com.wechat.pay.java.service.refund.model.Amount amount = decryptObject.getAmount();String outTradeNo = decryptObject.getOutTradeNo();Map map=new HashMap();map.put("amount",amount.getTotal());map.put("outTradeNo",outTradeNo);return map;}
}

后端下单

String openId=weChatJsapiPayment.getOpenId(code);PayParamJsapiDto payParam = new PayParamJsapiDto();//payParam.setSubject(StringUtils.isBlank(byId2.getGoodsName())?byId2.getGoodsSuffixName():byId2.getGoodsName());payParam.setDescription(StringUtils.isBlank(byId2.getGoodsName())?byId2.getGoodsSuffixName():byId2.getGoodsName());payParam.setOutTradeNo(couponOrder.getOrderNum());//payParam.setAmount(new BigDecimal("0.01"));payParam.setAmount(new BigDecimal(price.toString()));payParam.setAppid("wx29d50");payParam.setMerchantId("1651");payParam.setOpenid(openId);String pay = weChatJsapiPayment.pay(payParam);Map payParameter = weChatJsapiPayment.getPayParameter(pay);

后端退款

RefundParam param=new RefundParam();param.setOutTradeNo(byId.getOrderNum());param.setBody("卡券权益退款");param.setRefund(byId.getPayMoney().toString());param.setTotal(byId.getPayMoney().toString());//微信退款weChatJsapiPayment.refundOrder(param);

下单和退款的dto

package com.ruoyi.coupon.payment.dto;import lombok.Data;/*** 退款参数封装*/
@Data
public class RefundParam {//订单号private  String outTradeNo;//本次退款金额金额private  String refund;//订单总金额private  String total;//备注private  String body;
}
package com.ruoyi.coupon.payment.dto;import lombok.Data;import java.math.BigDecimal;
@Data
public class PayParamJsapiDto {private String appid;private String merchantId;//支付描述private String description;private String openid;private String outTradeNo;//需支付金额private BigDecimal amount;private PassbackParamsJsapiDto param;
}
package com.ruoyi.coupon.payment.dto;import lombok.Data;@Data
public class PassbackParamsJsapiDto {
}

后端支付回调类

package com.ruoyi.api.controller.coupon.payment.rest;import com.ruoyi.coupon.payment.WeChatJsapiPayment;
import com.ruoyi.coupon.payment.WeChatPayment;
import com.ruoyi.coupon.payment.event.PaymentEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;/*** 商城支付项微信支付的回调接口*/
@Slf4j
@RestController
@RequestMapping("/payment/weChatOfficialAccounts")
public class WeChatOfficialAccountsNotify {@Autowiredprivate ApplicationEventPublisher publisher;@Autowiredprivate WeChatJsapiPayment weChatJsapiPayment;/*** 微信支付/充值回调*/@PostMapping("/payment/notify")public ResponseEntity.BodyBuilder  renotify(HttpServletRequest request) {Map map = weChatJsapiPayment.paySuccessCheck(request);Integer amount = (Integer)map.get("amount");String outTradeNo = (String)map.get("outTradeNo");String attach = (String)map.get("attach");Map<String, Object> map1 = new HashMap<>();//将附加信息 attach 解析到 map1 中,因为现在没有传递任何参数,所以没有解析BigDecimal divide = new BigDecimal(amount).divide(new BigDecimal("100"));publisher.publishEvent(new PaymentEvent(this, outTradeNo,0,map1,divide.toString()));return ResponseEntity.status(HttpStatus.OK);}/*** 微信退款回调*/@PostMapping("/refund/notify")public ResponseEntity.BodyBuilder parseRefundNotifyResult(HttpServletRequest request) {Map map = weChatJsapiPayment.refundSuccessCheck(request);Long amount = (Long)map.get("amount");String outTradeNo = (String)map.get("outTradeNo");BigDecimal divide = new BigDecimal(amount).divide(new BigDecimal("100"));publisher.publishEvent(new PaymentEvent(this, outTradeNo,1,null,divide.toString()));return ResponseEntity.status(HttpStatus.OK);}
}

回调参数封装

package com.ruoyi.coupon.payment.event;import org.springframework.context.ApplicationEvent;
import org.springframework.core.annotation.Order;import java.util.Map;/*** 商城支付项的支付成功和退款成功事件*/
@Order(500)
public class PaymentEvent extends ApplicationEvent {private static final long serialVersionUID = 1L;private final String orderId;private final Integer type;//0:支付成功 1:退款成功private final Map passbackParams; //回传参数private final String actionMoney; //支付或退款金额public PaymentEvent(Object source, String orderId, Integer type, Map passbackParams,String actionMoney) {super(source);this.orderId=orderId;this.type=type;this.passbackParams=passbackParams;this.actionMoney=actionMoney;}public String getOrderId() {return this.orderId;}public Integer getType() {return this.type;}public Map getPassbackParams() {return this.passbackParams;}public String getActionMoney() {return this.actionMoney;}
}

uniapp端获取公众号code

//获取codeuni.navigateTo({url:"/pages/WeChatOfficialAccounts/getCode"})
<template><view>获取信息中...</view>
</template><script>export default {data() {return {code:''}},onLoad(){let appid = 'wx29d501';let redirect_uri='http://qy.gsjf.cc/h5/#/pages/WeChatOfficialAccounts/getCode'redirect_uri  = encodeURIComponent(redirect_uri)//console.log('redirect_uri', redirect_uri);let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=STATE&connect_redirect=1#wechat_redirect`;this.code = this.getUrlCode().code;if (this.code == null || this.code === '' ) {//window.location.href = url;}else{//获取到code后的逻辑console.log('code', this.code);/*let pages = getCurrentPages(); // 当前页页⾯实例console.log('pages',pages);//let nowPage = pages[pages.length -1]; //当前页⾯实例let prevPage = pages[pages.length -2]; // 上一页面实例let object ={code: this.code};prevPage.$vm.getCodeBack(object);*//* uni.navigateBack({  //uni.navigateTo跳转的返回,默认1为返回上一级delta: 2}); */localStorage.setItem('weChatOfficialAccountsCode', this.code);window.history.go(-2);}},methods: {getUrlCode() { // 截取url中的code方法var url = location.searchvar theRequest = new Object()if (url.indexOf("?") != -1) {var str = url.substr(1)var strs = str.split("&");for (var i = 0; i < strs.length; i++) {theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1])}}// console.log(theRequest)console.log(theRequest)return theRequest},}}
</script><style></style>

获取code后,返回跳转前页面,在跳转前页面获取code

onLoad() {const data = localStorage.getItem('weChatOfficialAccountsCode');if(data != null){this.getCodeBack(data);}else{//获取codeuni.navigateTo({url:"/pages/WeChatOfficialAccounts/getCode"})}},onShow(){const data = localStorage.getItem('weChatOfficialAccountsCode');if(data != null){this.getCodeBack(data);}else{//获取codeuni.navigateTo({url:"/pages/WeChatOfficialAccounts/getCode"})}},onUnload(){localStorage.removeItem('weChatOfficialAccountsCode');this.weChatOfficialAccountsCode=null;},

前端调起支付接口

npm install jweixin-module
localStorage.removeItem('weChatOfficialAccountsCode');this.weChatOfficialAccountsCode=null;let dataV=JSON.parse(res.data.payStrand)jweixin.config({debug: false,appId: dataV.appId,timestamp: dataV.timeStamp,nonceStr: dataV.nonceStr,signature: dataV.signature,jsApiList: ['chooseWXPay']});jweixin.ready(function() {jweixin.chooseWXPay({timestamp: dataV.timeStamp,nonceStr: dataV.nonceStr,package: dataV.package,signType: dataV.signType,paySign: dataV.paySign,success: function() {uni.showToast({title: '支付成功',icon: 'none'});},cancel: function(res) {uni.showToast({title: '支付失败',icon: 'none'});},complete: function() {}});});

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/211692.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

FFmpeg抽取视频h264数据重定向

根据视频重定向技术解析中的 截获解码视频流的思路&#xff0c;首先需要解决如何输出视频码流的问题。 目前只针对h264码流进行获取&#xff0c;步骤如下&#xff1a; 打开mp4文件并创建一个空文件用于存储H264数据 提取一路视频流资源 循环读取流中所有的包(AVPacket),为…

redis中使用pipeline批量处理请求提升系统性能

在操作数据库时&#xff0c;为了加快程序的执行速度&#xff0c;在新增或更新数据时&#xff0c;可以通过批量提交的方式来减少应用和数据库间的传输次数&#xff1b;在redis中也有这样的技术实现批量处理&#xff0c;也就是管道——Pipeline。它也是通过批量提交数据的方式来实…

线程安全3--wait和notify

文章目录 wait and notify&#xff08;等待通知机制notify补充 wait and notify&#xff08;等待通知机制 引入wait notify就是为了能够从应用层面上&#xff0c;干预到多个不同线程代码的执行顺序&#xff0c;这里说的干预&#xff0c;不是影响系统的线程调度策略&#xff08…

uni-app应用设置 可以根据手机屏幕旋转进行 (横/竖) 屏切换

首先 我们打开项目的 manifest.json 在左侧导航栏中找到 源码视图 然后找到 app-plus 配置 在下面加上 "orientation": [//竖屏正方向"portrait-primary",//竖屏反方向"portrait-secondary",//横屏正方向"landscape-primary",//横屏…

第57天:django学习(六)

模版之过滤器 语法&#xff1a; {{obj|filter__name:param}} 变量名字|过滤器名称&#xff1a;变量 default 如果一个变量是false或者为空&#xff0c;使用给定的默认值。否则&#xff0c;使用变量的值。例如&#xff1a; {{ value|default:"nothing"}} length …

IDEA启动应用时报错:错误: 找不到或无法加载主类 @C:\Users\xxx\AppData\Local\Temp\idea_arg_filexxx

IDEA启动应用时报错&#xff0c;详细错误消息如下&#xff1a; C:\devel\jdk1.8.0_201\bin\java.exe -agentlib:jdwptransportdt_socket,address127.0.0.1:65267,suspendy,servern -XX:TieredStopAtLevel1 -noverify -Dspring.output.ansi.enabledalways -Dcom.sun.management…

基于以太坊的智能合约开发Solidity(事件日志篇)

//声明版本号&#xff08;程序中的版本号要和编译器版本号一致&#xff09; pragma solidity ^0.5.17; //合约 contract EventTest {//状态变量uint public Variable;//构造函数constructor() public{Variable 100;}event ValueChanged(uint newValue); //事件声明event Log(…

ElasticSearch之cat plugins API

命令样例如下&#xff1a; curl -X GET "https://localhost:9200/_cat/plugins?vtrue&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPHQBEs5*lo7F9"执行结果输出如下&#xff1a; name component version…

class064 Dijkstra算法、分层图最短路【算法】

class064 Dijkstra算法、分层图最短路【算法】 算法讲解064【必备】Dijkstra算法、分层图最短路 code1 743. 网络延迟时间 // Dijkstra算法模版&#xff08;Leetcode&#xff09; // 网络延迟时间 // 有 n 个网络节点&#xff0c;标记为 1 到 n // 给你一个列表 times&…

法律服务网站建设效果如何

律师事务所及法律知识咨询机构等往往是众多人群需求的服务&#xff0c;服务多样化及内容多元化&#xff0c;市场中也有大量品牌&#xff0c;在实际消费服务中大多以本地事务所为主&#xff0c;而线上咨询服务则一般没有区域限制&#xff0c;同行增多及人们知识获取渠道增加&…

C++-引用和指针区别

文章目录 1.变量的组成2.指针2.1 定义2.2 使用指针操作变量2.3 为什么使用指针 3.引用3.1 定义3.2 引用注意事项 4.引用和指针的区别 1.变量的组成 变量的组成&#xff1a;变量地址&#xff0c;变量名&#xff0c;变量值 例&#xff1a; int i 12;2.指针 2.1 定义 指针用于存…

如何为游戏角色3D模型设置纹理贴图

在线工具推荐&#xff1a; 3D数字孪生场景编辑器 - GLTF/GLB材质纹理编辑器 - 3D模型在线转换 - Three.js AI自动纹理开发包 - YOLO 虚幻合成数据生成器 - 三维模型预览图生成器 - 3D模型语义搜索引擎 当谈到游戏角色的3D模型风格时&#xff0c;有几种不同的风格&#xf…

Mybatis中的查询操作

单表查询 单表查询在《初始Mybatis》中已经介绍过&#xff0c;这里就不在介绍了。咱们这里只说单表查询中的“like查询”。like查询单独使用#{}报错 <select id"selectByKeyword" resultType"com.example.demo.entity.Userinfo">select * from use…

计网Lesson8 - NAT技术与链路层概述

文章目录 NAT 技术1. 因特网的接入方式2. 公网和私网3. NAT 技术 链路层1. 数据链路层概述2. 数据链路层的三个问题2.1 封装成帧2.2 透明传输2.3 差错检测 NAT 技术 1. 因特网的接入方式 光猫将电信号转换为数字信号发送给路由器 光纤入户 光纤传递的就是数字信号&#xff0c…

python+pytest接口自动化(12)-自动化用例编写思路 (使用pytest编写一个测试脚本)

经过之前的学习铺垫&#xff0c;我们尝试着利用pytest框架编写一条接口自动化测试用例&#xff0c;来厘清接口自动化用例编写的思路。 我们在百度搜索天气查询&#xff0c;会出现如下图所示结果&#xff1a; 接下来&#xff0c;我们以该天气查询接口为例&#xff0c;编写接口测…

错题总结(三)

1.写代码将三个整数数按从大到小输出。 例如&#xff1a; 输入&#xff1a;2 3 1 输出&#xff1a;3 2 1 int main() {int a 0;int b 0;int c 0;int tep 0;scanf("%d%d%d", &a, &b, &c);if (a < b){tep a;a b;b tep;}if (b < c){tep b…

每日一练2023.12.9—— 矩阵A乘以B【PTA】

题目链接&#xff1a;L1-048 矩阵A乘以B 题目要求&#xff1a; 给定两个矩阵A和B&#xff0c;要求你计算它们的乘积矩阵AB。需要注意的是&#xff0c;只有规模匹配的矩阵才可以相乘。即若A有Ra​行、Ca​列&#xff0c;B有Rb​行、Cb​列&#xff0c;则只有Ca​与Rb​相等时&a…

Linux Shell 基础命令

Linux 是一个开源的操作系统&#xff0c;其命令行界面是它的重要组成部分。在这个界面下&#xff0c;Shell 是一个能够与操作系统进行交互的工具。Shell 是一种程序&#xff0c;它能够接收用户输入的命令&#xff0c;并将这些命令发送到操作系统中进行处理。 在 Linux 中&…

Docker实战笔记 三 Docker私有库

1.拉取私有库image rootcenots-7.5:/root#docker pull registry Using default tag: latest latest: Pulling from library/registry c926b61bad3b: Pull complete 5501dced60f8: Pull complete e875fe5e6b9c: Pull complete 21f4bf2f86f9: Pull complete 98513cca25bb: P…

VINS-MONO代码解读5----vins_estimator(marginalization部分)

文章目录 0. 前言1.1 Marginalization Pipiline 1. marg factor构建1.1 变量及维度理解1.2 IMUFactor1.3 ProjectionTdFactor(ProjectionFactor)1.4 MarginalizationFactor( e p e_p ep​推导更新&#xff0c;FEJ解决的问题)1.4.1 先验残差的更新1.4.2 先验Jacobian的更新 2. R…