Springboot集成支付宝沙箱支付(退款功能)

包括:
支付宝沙箱 支付 + 异步通知 + 退款功能

正式版本的sdk

通用版本SDK文档:https://opendocs.alipay.com/open/02np94

<dependency><groupId>com.alipay.sdk</groupId><artifactId>alipay-sdk-java</artifactId><version>4.22.110.ALL</version></dependency>

AlipayConfig.java 只需要获取配置alipay的参数即可

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;@Data
@Component
@ConfigurationProperties(prefix = "alipay")
public class AliPayConfig {private String appId;private String appPrivateKey;private String alipayPublicKey;private String notifyUrl;}

参数更新:

import lombok.Data;@Data
public class AliPay {private String traceNo;private double totalAmount;private String subject;private String alipayTraceNo;
}

完整的支付宝通用版本支付代码:

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONObject;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.internal.util.AlipaySignature;
import com.alipay.api.request.AlipayTradePagePayRequest;
import com.alipay.api.request.AlipayTradeRefundRequest;
import com.alipay.api.response.AlipayTradeRefundResponse;
import com.example.springboot.common.Result;
import com.example.springboot.config.AliPayConfig;
import com.example.springboot.controller.dto.AliPay;
import com.example.springboot.entity.Orders;
import com.example.springboot.mapper.OrdersMapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;// xjlugv6874@sandbox.com
// 9428521.24 - 30 = 9428491.24 + 30 = 9428521.24
@RestController
@RequestMapping("/alipay")
public class AliPayController {private static final String GATEWAY_URL = "https://openapi.alipaydev.com/gateway.do";private static final String FORMAT = "JSON";private static final String CHARSET = "UTF-8";//签名方式private static final String SIGN_TYPE = "RSA2";@Resourceprivate AliPayConfig aliPayConfig;@Resourceprivate OrdersMapper ordersMapper;@GetMapping("/pay") // &subject=xxx&traceNo=xxx&totalAmount=xxxpublic void pay(AliPay aliPay, HttpServletResponse httpResponse) throws Exception {// 1. 创建Client,通用SDK提供的Client,负责调用支付宝的APIAlipayClient alipayClient = new DefaultAlipayClient(GATEWAY_URL, aliPayConfig.getAppId(),aliPayConfig.getAppPrivateKey(), FORMAT, CHARSET, aliPayConfig.getAlipayPublicKey(), SIGN_TYPE);// 2. 创建 Request并设置Request参数AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();  // 发送请求的 Request类request.setNotifyUrl(aliPayConfig.getNotifyUrl());JSONObject bizContent = new JSONObject();bizContent.set("out_trade_no", aliPay.getTraceNo());  // 我们自己生成的订单编号bizContent.set("total_amount", aliPay.getTotalAmount()); // 订单的总金额bizContent.set("subject", aliPay.getSubject());   // 支付的名称bizContent.set("product_code", "FAST_INSTANT_TRADE_PAY");  // 固定配置request.setBizContent(bizContent.toString());// 执行请求,拿到响应的结果,返回给浏览器String form = "";try {form = alipayClient.pageExecute(request).getBody(); // 调用SDK生成表单} catch (AlipayApiException e) {e.printStackTrace();}httpResponse.setContentType("text/html;charset=" + CHARSET);httpResponse.getWriter().write(form);// 直接将完整的表单html输出到页面httpResponse.getWriter().flush();httpResponse.getWriter().close();}@PostMapping("/notify")  // 注意这里必须是POST接口public String payNotify(HttpServletRequest request) throws Exception {if (request.getParameter("trade_status").equals("TRADE_SUCCESS")) {System.out.println("=========支付宝异步回调========");Map<String, String> params = new HashMap<>();Map<String, String[]> requestParams = request.getParameterMap();for (String name : requestParams.keySet()) {params.put(name, request.getParameter(name));// System.out.println(name + " = " + request.getParameter(name));}String tradeNo = params.get("out_trade_no");String gmtPayment = params.get("gmt_payment");String alipayTradeNo = params.get("trade_no");String sign = params.get("sign");String content = AlipaySignature.getSignCheckContentV1(params);boolean checkSignature = AlipaySignature.rsa256CheckContent(content, sign, aliPayConfig.getAlipayPublicKey(), "UTF-8"); // 验证签名// 支付宝验签if (checkSignature) {// 验签通过System.out.println("交易名称: " + params.get("subject"));System.out.println("交易状态: " + params.get("trade_status"));System.out.println("支付宝交易凭证号: " + params.get("trade_no"));System.out.println("商户订单号: " + params.get("out_trade_no"));System.out.println("交易金额: " + params.get("total_amount"));System.out.println("买家在支付宝唯一id: " + params.get("buyer_id"));System.out.println("买家付款时间: " + params.get("gmt_payment"));System.out.println("买家付款金额: " + params.get("buyer_pay_amount"));// 更新订单未已支付ordersMapper.updateState(tradeNo, "已支付", gmtPayment, alipayTradeNo);}}return "success";}@GetMapping("/return")public Result returnPay(AliPay aliPay) throws AlipayApiException {// 7天无理由退款String now = DateUtil.now();Orders orders = ordersMapper.getByNo(aliPay.getTraceNo());if (orders != null) {// hutool工具类,判断时间间隔long between = DateUtil.between(DateUtil.parseDateTime(orders.getPaymentTime()), DateUtil.parseDateTime(now), DateUnit.DAY);if (between > 7) {return Result.error("-1", "该订单已超过7天,不支持退款");}}// 1. 创建Client,通用SDK提供的Client,负责调用支付宝的APIAlipayClient alipayClient = new DefaultAlipayClient(GATEWAY_URL,aliPayConfig.getAppId(), aliPayConfig.getAppPrivateKey(), FORMAT, CHARSET,aliPayConfig.getAlipayPublicKey(), SIGN_TYPE);// 2. 创建 Request,设置参数AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();JSONObject bizContent = new JSONObject();bizContent.set("trade_no", aliPay.getAlipayTraceNo());  // 支付宝回调的订单流水号bizContent.set("refund_amount", aliPay.getTotalAmount());  // 订单的总金额bizContent.set("out_request_no", aliPay.getTraceNo());   //  我的订单编号// 返回参数选项,按需传入//JSONArray queryOptions = new JSONArray();//queryOptions.add("refund_detail_item_list");//bizContent.put("query_options", queryOptions);request.setBizContent(bizContent.toString());// 3. 执行请求AlipayTradeRefundResponse response = alipayClient.execute(request);if (response.isSuccess()) {  // 退款成功,isSuccess 为trueSystem.out.println("调用成功");// 4. 更新数据库状态ordersMapper.updatePayState(aliPay.getTraceNo(), "已退款", now);return Result.success();} else {   // 退款失败,isSuccess 为falseSystem.out.println(response.getBody());return Result.error(response.getCode(), response.getBody());}}}

至此,后端集成完毕。

注意事项

img
如果你在支付的过程中出现了这样的一个界面,不用慌,直接使用 隐私窗口打开即可。
img

参考SQL

商品表:

CREATE TABLE `goods` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名称',`price` decimal(10,2) DEFAULT NULL COMMENT '单价',`store` int(10) DEFAULT NULL COMMENT '库存',`unit` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '单位',`img` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '封面',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

订单表

CREATE TABLE `orders` (`id` int(11) NOT NULL AUTO_INCREMENT,`no` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '订单编号',`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名称',`time` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '订单时间',`state` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '待支付' COMMENT '支付状态',`total` decimal(10,2) DEFAULT NULL COMMENT '订单总价',`user_id` int(11) DEFAULT NULL COMMENT '用户id',`payment_time` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付时间',`alipay_no` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付宝交易号',`return_time` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '退款时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

购买下订单的模拟接口:

@PostMapping("/{goodsId}/{num}")public Result createOrder(@PathVariable Integer goodsId, @PathVariable Integer num) {Goods goods = goodsService.getById(goodsId);if (goods == null) {throw new ServiceException("-1", "未找到商品");}User currentUser = TokenUtils.getCurrentUser();Integer userId = currentUser.getId();Orders orders = new Orders();orders.setName(goods.getName());orders.setNo(DateUtil.format(new Date(), "yyyyMMdd") + System.currentTimeMillis());orders.setTime(DateUtil.now());orders.setUserId(userId);orders.setTotal(goods.getPrice().multiply(BigDecimal.valueOf(num)));ordersService.save(orders);return Result.success();}

附赠前端调用代码:
Goods.vue

<template><div><div style="margin: 10px 0"><el-input style="width: 200px" placeholder="请输入名称" suffix-icon="el-icon-search" v-model="name"></el-input>
<!--      <el-input style="width: 200px" placeholder="请输入" suffix-icon="el-icon-message" class="ml-5" v-model="email"></el-input>-->
<!--      <el-input style="width: 200px" placeholder="请输入" suffix-icon="el-icon-position" class="ml-5" v-model="address"></el-input>--><el-button class="ml-5" type="primary" @click="load">搜索</el-button><el-button type="warning" @click="reset">重置</el-button></div><div style="margin: 10px 0"><el-button type="primary" @click="handleAdd">新增 <i class="el-icon-circle-plus-outline"></i></el-button><el-popconfirmclass="ml-5"confirm-button-text='确定'cancel-button-text='我再想想'icon="el-icon-info"icon-color="red"title="您确定批量删除这些数据吗?"@confirm="delBatch"><el-button type="danger" slot="reference">批量删除 <i class="el-icon-remove-outline"></i></el-button></el-popconfirm><!-- <el-upload action="http://localhost:9090/goods/import" :show-file-list="false" accept="xlsx" :on-success="handleExcelImportSuccess" style="display: inline-block"><el-button type="primary" class="ml-5">导入 <i class="el-icon-bottom"></i></el-button></el-upload><el-button type="primary" @click="exp" class="ml-5">导出 <i class="el-icon-top"></i></el-button> --></div><el-table :data="tableData" border stripe :header-cell-class-name="'headerBg'"  @selection-change="handleSelectionChange"><el-table-column type="selection" width="55"></el-table-column><el-table-column prop="id" label="ID" width="80" sortable></el-table-column><el-table-column prop="name" label="名称"></el-table-column><el-table-column prop="price" label="单价"></el-table-column><el-table-column prop="store" label="库存"></el-table-column><el-table-column prop="unit" label="单位"></el-table-column><el-table-column label="图片"><template slot-scope="scope"><el-image style="width: 100px; height: 100px" :src="scope.row.img" :preview-src-list="[scope.row.img]"></el-image></template></el-table-column><el-table-column label="购买"  width="180" align="center"><template v-slot="scope"><el-button type="primary" @click="buy(scope.row.id)">购 买</el-button></template></el-table-column><el-table-column label="操作"  width="180" align="center"><template slot-scope="scope"><el-button type="success" @click="handleEdit(scope.row)">编辑 <i class="el-icon-edit"></i></el-button><el-popconfirmclass="ml-5"confirm-button-text='确定'cancel-button-text='我再想想'icon="el-icon-info"icon-color="red"title="您确定删除吗?"@confirm="del(scope.row.id)"><el-button type="danger" slot="reference">删除 <i class="el-icon-remove-outline"></i></el-button></el-popconfirm></template></el-table-column></el-table><div style="padding: 10px 0"><el-pagination@size-change="handleSizeChange"@current-change="handleCurrentChange":current-page="pageNum":page-sizes="[2, 5, 10, 20]":page-size="pageSize"layout="total, sizes, prev, pager, next, jumper":total="total"></el-pagination></div><el-dialog title="信息" :visible.sync="dialogFormVisible" width="30%" :close-on-click-modal="false"><el-form label-width="100px" size="small" style="width: 90%"><el-form-item label="名称"><el-input v-model="form.name" autocomplete="off"></el-input></el-form-item><el-form-item label="单价"><el-input v-model="form.price" autocomplete="off"></el-input></el-form-item><el-form-item label="库存"><el-input v-model="form.store" autocomplete="off"></el-input></el-form-item><el-form-item label="单位"><el-input v-model="form.unit" autocomplete="off"></el-input></el-form-item><el-form-item label="封面"><el-upload action="http://localhost:9090/file/upload" ref="img" :on-success="handleImgUploadSuccess"><el-button size="small" type="primary">点击上传</el-button></el-upload></el-form-item></el-form><div slot="footer" class="dialog-footer"><el-button @click="dialogFormVisible = false">取 消</el-button><el-button type="primary" @click="save">确 定</el-button></div></el-dialog></div>
</template><script>
export default {name: "Goods",data() {return {tableData: [],total: 0,pageNum: 1,pageSize: 10,name: "",form: {},dialogFormVisible: false,multipleSelection: [],user: localStorage.getItem("user") ? JSON.parse(localStorage.getItem("user")) : {}}},created() {this.load()},methods: {buy(goodsId) {this.request.post("/orders/" +  goodsId + "/" + 1).then(res => {if (res.code === '200') {this.$message.success("购买成功,请前往订单页面支付")} else {this.$message.error(res.msg)}})},load() {this.request.get("/goods/page", {params: {pageNum: this.pageNum,pageSize: this.pageSize,name: this.name,}}).then(res => {this.tableData = res.data.recordsthis.total = res.data.total})},save() {this.request.post("/goods", this.form).then(res => {if (res.code === '200') {this.$message.success("保存成功")this.dialogFormVisible = falsethis.load()} else {this.$message.error("保存失败")}})},handleAdd() {this.dialogFormVisible = truethis.form = {}this.$nextTick(() => {if(this.$refs.img) {this.$refs.img.clearFiles();}if(this.$refs.file) {this.$refs.file.clearFiles();}})},handleEdit(row) {this.form = JSON.parse(JSON.stringify(row))this.dialogFormVisible = truethis.$nextTick(() => {if(this.$refs.img) {this.$refs.img.clearFiles();}if(this.$refs.file) {this.$refs.file.clearFiles();}})},del(id) {this.request.delete("/goods/" + id).then(res => {if (res.code === '200') {this.$message.success("删除成功")this.load()} else {this.$message.error("删除失败")}})},handleSelectionChange(val) {console.log(val)this.multipleSelection = val},delBatch() {if (!this.multipleSelection.length) {this.$message.error("请选择需要删除的数据")return}let ids = this.multipleSelection.map(v => v.id)  // [{}, {}, {}] => [1,2,3]this.request.post("/goods/del/batch", ids).then(res => {if (res.code === '200') {this.$message.success("批量删除成功")this.load()} else {this.$message.error("批量删除失败")}})},reset() {this.name = ""this.load()},handleSizeChange(pageSize) {console.log(pageSize)this.pageSize = pageSizethis.load()},handleCurrentChange(pageNum) {console.log(pageNum)this.pageNum = pageNumthis.load()},handleFileUploadSuccess(res) {this.form.file = res},handleImgUploadSuccess(res) {this.form.img = res},download(url) {window.open(url)},exp() {window.open("http://localhost:9090/goods/export")},handleExcelImportSuccess() {this.$message.success("导入成功")this.load()}}
}
</script><style>
.headerBg {background: #eee!important;
}
</style>

Orders.vue

<template><div><div style="margin: 10px 0"><el-input style="width: 200px" placeholder="请输入名称" suffix-icon="el-icon-search" v-model="name"></el-input>
<!--      <el-input style="width: 200px" placeholder="请输入" suffix-icon="el-icon-message" class="ml-5" v-model="email"></el-input>-->
<!--      <el-input style="width: 200px" placeholder="请输入" suffix-icon="el-icon-position" class="ml-5" v-model="address"></el-input>--><el-button class="ml-5" type="primary" @click="load">搜索</el-button><el-button type="warning" @click="reset">重置</el-button></div><div style="margin: 10px 0"><el-button type="primary" @click="handleAdd">新增 <i class="el-icon-circle-plus-outline"></i></el-button><el-popconfirmclass="ml-5"confirm-button-text='确定'cancel-button-text='我再想想'icon="el-icon-info"icon-color="red"title="您确定批量删除这些数据吗?"@confirm="delBatch"><el-button type="danger" slot="reference">批量删除 <i class="el-icon-remove-outline"></i></el-button></el-popconfirm><!-- <el-upload action="http://localhost:9090/orders/import" :show-file-list="false" accept="xlsx" :on-success="handleExcelImportSuccess" style="display: inline-block"><el-button type="primary" class="ml-5">导入 <i class="el-icon-bottom"></i></el-button></el-upload><el-button type="primary" @click="exp" class="ml-5">导出 <i class="el-icon-top"></i></el-button> --></div><el-table :data="tableData" border stripe :header-cell-class-name="'headerBg'"  @selection-change="handleSelectionChange"><el-table-column type="selection" width="55"></el-table-column><el-table-column prop="id" label="ID" width="80" sortable></el-table-column><el-table-column prop="no" label="订单编号"></el-table-column><el-table-column prop="name" label="名称"></el-table-column><el-table-column prop="time" label="订单时间"></el-table-column><el-table-column prop="state" label="支付状态"></el-table-column><el-table-column prop="total" label="订单总价"></el-table-column><el-table-column prop="paymentTime" label="支付时间"></el-table-column><el-table-column prop="alipayNo" label="支付宝宝流水号"></el-table-column><el-table-column prop="returnTime" label="退款时间"></el-table-column><el-table-column label="支付"  width="180" align="center"><template v-slot="scope"><el-button type="primary" @click="pay(scope.row)" :disabled="scope.row.state !== '待支付'">支 付</el-button><el-button type="danger" @click="returnPay(scope.row)" :disabled="scope.row.state !== '已支付'">退款</el-button></template></el-table-column><el-table-column label="操作"  width="180" align="center"><template slot-scope="scope"><el-button type="success" @click="handleEdit(scope.row)">编辑 <i class="el-icon-edit"></i></el-button><el-popconfirmclass="ml-5"confirm-button-text='确定'cancel-button-text='我再想想'icon="el-icon-info"icon-color="red"title="您确定删除吗?"@confirm="del(scope.row.id)"><el-button type="danger" slot="reference">删除 <i class="el-icon-remove-outline"></i></el-button></el-popconfirm></template></el-table-column></el-table><div style="padding: 10px 0"><el-pagination@size-change="handleSizeChange"@current-change="handleCurrentChange":current-page="pageNum":page-sizes="[2, 5, 10, 20]":page-size="pageSize"layout="total, sizes, prev, pager, next, jumper":total="total"></el-pagination></div><el-dialog title="信息" :visible.sync="dialogFormVisible" width="30%" :close-on-click-modal="false"><el-form label-width="100px" size="small" style="width: 90%"><el-form-item label="订单编号"><el-input v-model="form.no" autocomplete="off"></el-input></el-form-item><el-form-item label="名称"><el-input v-model="form.name" autocomplete="off"></el-input></el-form-item><el-form-item label="订单时间"><el-date-picker v-model="form.time" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期时间"></el-date-picker></el-form-item><el-form-item label="支付状态"><el-input v-model="form.state" autocomplete="off"></el-input></el-form-item><el-form-item label="订单总价"><el-input v-model="form.total" autocomplete="off"></el-input></el-form-item></el-form><div slot="footer" class="dialog-footer"><el-button @click="dialogFormVisible = false">取 消</el-button><el-button type="primary" @click="save">确 定</el-button></div></el-dialog></div>
</template><script>
export default {name: "Orders",data() {return {tableData: [],total: 0,pageNum: 1,pageSize: 10,name: "",form: {},dialogFormVisible: false,multipleSelection: [],user: localStorage.getItem("user") ? JSON.parse(localStorage.getItem("user")) : {}}},created() {this.load()},methods: {pay(row) {const url = `http://localhost:9090/alipay/pay?subject=${row.name}&traceNo=${row.no}&totalAmount=${row.total}`window.open(url);  //  得到一个url,这个url就是支付宝支付的界面url, 新窗口打开这个url就可以了},returnPay(row) {const url = `http://localhost:9090/alipay/return?totalAmount=${row.total}&alipayTraceNo=${row.alipayNo}&traceNo=${row.no}`this.request.get(url).then(res => {if(res.code === '200') {this.$message.success("退款成功")}  else {this.$message.error("退款失败")}this.load()})},load() {this.request.get("/orders/page", {params: {pageNum: this.pageNum,pageSize: this.pageSize,name: this.name,}}).then(res => {this.tableData = res.data.recordsthis.total = res.data.total})},save() {this.request.post("/orders", this.form).then(res => {if (res.code === '200') {this.$message.success("保存成功")this.dialogFormVisible = falsethis.load()} else {this.$message.error("保存失败")}})},handleAdd() {this.dialogFormVisible = truethis.form = {}this.$nextTick(() => {if(this.$refs.img) {this.$refs.img.clearFiles();}if(this.$refs.file) {this.$refs.file.clearFiles();}})},handleEdit(row) {this.form = JSON.parse(JSON.stringify(row))this.dialogFormVisible = truethis.$nextTick(() => {if(this.$refs.img) {this.$refs.img.clearFiles();}if(this.$refs.file) {this.$refs.file.clearFiles();}})},del(id) {this.request.delete("/orders/" + id).then(res => {if (res.code === '200') {this.$message.success("删除成功")this.load()} else {this.$message.error("删除失败")}})},handleSelectionChange(val) {console.log(val)this.multipleSelection = val},delBatch() {if (!this.multipleSelection.length) {this.$message.error("请选择需要删除的数据")return}let ids = this.multipleSelection.map(v => v.id)  // [{}, {}, {}] => [1,2,3]this.request.post("/orders/del/batch", ids).then(res => {if (res.code === '200') {this.$message.success("批量删除成功")this.load()} else {this.$message.error("批量删除失败")}})},reset() {this.name = ""this.load()},handleSizeChange(pageSize) {console.log(pageSize)this.pageSize = pageSizethis.load()},handleCurrentChange(pageNum) {console.log(pageNum)this.pageNum = pageNumthis.load()},handleFileUploadSuccess(res) {this.form.file = res},handleImgUploadSuccess(res) {this.form.img = res},download(url) {window.open(url)},exp() {window.open("http://localhost:9090/orders/export")},handleExcelImportSuccess() {this.$message.success("导入成功")this.load()}}
}
</script><style>
.headerBg {background: #eee!important;
}
</style>

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

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

相关文章

oracle 数据库日期定义,Oracle数据库实现日期遍历功能

遍历开始日期到结束日期的每一天&#xff0c;若有查询某段日期下有什么业务或者事件发生时&#xff0c;可用到此函数。 Oracle SQL Developer create or replace type class_date as object( year varchar2(10), month varchar2(10), day varchar2(20))--定义所需要的日期类---…

linux tomcat php配置文件在哪个文件夹下,tomcat下,怎么安配备置php ?(linux系统)

(一)、JDK安装tar.gz为解压后就可使用的版本&#xff0c;这里我们将jdk-8u45-linux-i586.tar.gz解压到/usr/local/下。1、解压[rootTomcat~]#tar-zxvfjdk-8u45-linux-i586.tar.gz2、环境配置[rootTomcat~]#sudovi/etc/profile#setjavaenvironmentJAVA_HOME/usr/local/jdk1.8.0C…

Java递归生成树

1.建菜单表 CREATE TABLE t_menu (id int(11) NOT NULL AUTO_INCREMENT,pid int(11) NOT NULL,name varchar(255) DEFAULT NULL,PRIMARY KEY (id) ) ENGINEInnoDB AUTO_INCREMENT11 DEFAULT CHARSETutf8mb4;2.造一些数据 注意&#xff1a;根节点的pid0&#xff0c;其他节点的p…

linux内核时钟驱动,4.9版本的linux内核中实时时钟芯片pcf85263的驱动源码在哪里

SQL添加维护 计划失败在sql要求数据库每天自动备份这个是大家都会遇到的问题,我遇到了这个问题如图: 是因为这个服务组件没有安装CSS Hack汇总快查&lpar;CSS兼容代码演示&rpar;文章出处和来源网址:http://www.divcss5.com/css-hack/c284.shtml 以下是常用CSS HACK问题及…

Springboot获取公网IP和当前所在城市(非常简单)

最近我们发现各大社交平台都出现了一个新的功能&#xff1a;IP属地。 比如某乎&#xff1a; 这个IP属地是怎么做到的呢&#xff1f;今天我来教教你&#xff0c;保证你看完直呼Easy~ 百度搜索 打开百度&#xff0c;搜索IP&#xff0c;你就能看到你当前的IP地址&#xff0c;类…

linux启动脚本卡住,linux 服务脚本启动问题

对于使用了 systemd 的系统&#xff0c;所有的 service 服务都会默认转为 systemd 服务之后再由 systemd 来执行&#xff0c;转换之后&#xff0c;你也可以直接使用 systemd 来执行了(它的用户工具就是你用的 systemctl)&#xff0c;除非是一些非 service 标准的命令&#xff0…

Springboot集成百度地图实现定位打卡功能

打卡sign表sql CREATE TABLE sign (id int(11) NOT NULL AUTO_INCREMENT,user varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 用户名称,location varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 打卡位置,time varchar(255) COLLATE utf8mb4…

linux版本i686,linux-x86_64平台上的gcc i686

我在RHEL X86_64上安装GCC i686时遇到一些麻烦.确实,我必须在此平台上构建一些32位软件和共享库.我可以在32位平台(Linux或Windows)上构建这些软件和库.我的问题在这篇文章的结尾.我的第一个问题是这个错误&#xff1a;(在buil期间,在Eclipse -helios下)In file included from …

线程死锁——死锁产生的条件

什么是线程死锁 线程死锁是指由于两个或者多个线程互相持有对方所需要的资源&#xff0c;导致这些线程处于相互等待状态&#xff0c;若无外力作用&#xff0c;它们将无法继续执行下去。 造成死锁的原因可以概括成三句话&#xff1a; 当前线程拥有其他线程需要的资源当前线程…

linux查看正在运行的窗口,获取linux中打开的应用程序窗口的数量

我想检测由窗口管理器管理的特定应用程序的实例数量.目前,我有这个&#xff1a;#!/bin/bash# wmctrl requiredpids$(pidof $1)IFS read -a pid_arr <<< "$pids"matches0for pid in "${pid_arr[]}"domatching_lines$(wmctrl -l -p | egrep -c &qu…

TortoiseGit的使用详解

Git是什么&#xff0c;相信大家都很清楚。Git不就是分布式版本控制系统嘛&#xff1f;那你知道TortoiseGit是什么吗&#xff1f;下面我们就介绍一下TortoiseGit它是什么&#xff1f;如何使用&#xff1f;   TortoiseGit其实是一款开源的git的版本控制系统&#xff0c;也叫海龟…

linux gpt分区看不到,Linux无法看到我的任何分区 – 备份GPT表不在磁盘的末尾

我正在尝试在HP Pavilion 14英寸超极本上安装Linux,但没有任何成功.起初我尝试在其上安装Ubuntu;一切都很顺利,我进入了Live DVD(是的,我就像那样老了),然后去我的磁盘上安装系统.发生的第一个奇怪的事情是,我没有被提示选择在Windows旁边安装Ubuntu,而是直接用分区表抛入窗口.…

将项目上传到Gitee上(命令方式使用TortoiseGit方式)

如何将项目上传到Gitee上&#xff08;命令方式&#xff09; 目录 将项目上传到Gitee是我们经常需要使用到的操作&#xff0c;因此我们要熟悉这些步骤 一、首先保证本机已经安装了Git git官网安装完成之后&#xff0c;鼠标右键会出现Git GUI Here和Git Bash Here 二、上传代…

linux自动重新启动,linux 系统自动重新启动,请帮忙看看

在查了一下,的确有这个log其中有一段之后系统开始重新启动&#xff0c;请帮忙看看是什么原因&#xff1a;谢谢[2011-01-25 11:33:36 xend.XendDomainInfo 2990] DEBUG (XendDomainInfo:228) XendDomainInfo.recreate({paused: 0, cpu_time: 41195236230L, ssidref: 0, hvm: 0, …

java.awt.Color类

Color类概述 Color是用来封装颜色的&#xff0c;支持多种颜色空间&#xff0c;默认为RGB颜色空间。每个Color对象都有一个alpha通道&#xff0c;值为0到255&#xff0c;代表透明度&#xff0c;当alpha通道值为255时&#xff0c;表示完全不透明&#xff1b;当alpha通道值为0时&…

BufferedImage类、Image类、Graphics类

BufferedImage Image是一个抽象类&#xff0c;BufferedImage是其实现类&#xff0c;是一个带缓冲区图像类&#xff0c;主要作用是将一幅图片加载到内存中&#xff08;BufferedImage生成的图片在内存里有一个图像缓冲区&#xff0c;利用这个缓冲区我们可以很方便地操作这个图片&…

linux远程连接最大数是多少,Linux Shell 脚本限制ssh最大用户登录数

我撰写本文原来的意图是想把“复制SSH渠道”和"copy SSH Session"这样的功能从远程ssh客户端中剔除掉.因此想到可以在SSH服务端设置一下&#xff0c;但查阅了sshd_config的man手册,发现里面的看起来限制ssh连接数量的参数(MaxSessions &#xff0c;ClientAliveCountM…

linux 文件名带特殊符号,Linux删除含有特殊符号文件名的文件

Web前端面试题目及答案汇总HTML/CSS部分 1.什么是盒子模型? 在网页中,一个元素占有空间的大小由几个部分构成,其中包括元素的内容(content),元素的内边距(padding),元素的边框(border),元素的外边 ...Delphi中滚动文字的应用1.添加一个Timer控件,Interval属性设置为20. 2.添加…

Vue this.$refs的作用

案例一、ref 写在标签上时 <!-- ref 写在标签上时&#xff1a;this.$refs.名字 获取的是标签对应的dom元素ref 写在组件上时&#xff1a;这时候获取到的是 子组件&#xff08;比如counter&#xff09;的引用--><div id"root"><!-- ref hello&#…

linux电脑合盖后卡住了,解决ubuntu合盖后无法唤醒

解决办法&#xff1a;安装laptop-mode-tools工具包。1.检查是否安装了grep laptop-mode-tools 工具包$ dpkg -l | grep laptop-mode-tools如果执行命令无结果输出&#xff0c;表示未安装(如果已安装&#xff0c;忽略第2步)2.安装laptop-mode执行命令&#xff1a;$ sudo apt-get…