SpringBoot定時任務(wù)實現(xiàn)數(shù)據(jù)同步的方法
本文實例為大家分享了SpringBoot定時任務(wù)實現(xiàn)數(shù)據(jù)同步的具體代碼,供大家參考,具體內(nèi)容如下
前言
業(yè)務(wù)的需求是,通過中臺調(diào)用api接口獲得,設(shè)備數(shù)據(jù),要求現(xiàn)實設(shè)備數(shù)據(jù)的同步。
方案一:通過輪詢接口的方式執(zhí)行 pullData() 方法實現(xiàn)數(shù)據(jù)同步
該方式的原理是先清空之前的所有數(shù)據(jù),然后重新插入通過api調(diào)用獲取的最新數(shù)據(jù)。該方法的優(yōu)點,邏輯簡單。缺點是,頻繁刪除、插入數(shù)據(jù)。再調(diào)用查詢數(shù)據(jù)時候,某一時刻,數(shù)據(jù)全部刪除,還沒及時插入的時候。數(shù)據(jù)可能有異常。
方案二:通過輪詢接口的方式執(zhí)行 pullDataNew() 方法實現(xiàn)數(shù)據(jù)同步
該方式的原理是先查詢數(shù)據(jù)庫,已有數(shù)據(jù),然后和通過api調(diào)用獲取的最新數(shù)據(jù)進(jìn)行比對,找出數(shù)據(jù)中增量、減量和變量,進(jìn)行同步更新。該方法的優(yōu)點,減少對數(shù)據(jù)庫的頻繁操作,提升性能。缺點:無發(fā)現(xiàn)明顯缺點。
package com.hxtx.spacedata.task;
?
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.google.api.client.util.Lists;
import com.hxtx.spacedata.common.domain.ResponseDTO;
import com.hxtx.spacedata.config.SpringContextUtil;
import com.hxtx.spacedata.controller.file.FilesMinioController;
import com.hxtx.spacedata.domain.entity.entityconfig.EntityPointEntity;
import com.hxtx.spacedata.service.entityconfig.EntityPointService;
import com.hxtx.spacedata.util.HttpProxyUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
?
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
?
?
/**
?* 中臺設(shè)備數(shù)據(jù) 定時任務(wù)執(zhí)行
?*
?* @author Tarzan Liu
?* @version 1.0.0
?* @description
?* @date 2020/12/07
?*/
@Component
@Slf4j
public class EntityPointTask {
?
? ? @Autowired
? ? private EntityPointService entityPointService;
?
? ? @Value("${middleGround.server.host}")
? ? private String host;
?
? ? @Value("${middleGround.server.port}")
? ? private String port;
?
? ? private static FilesMinioController filesMinioController = SpringContextUtil.getBean(FilesMinioController.class);
?
? ? /**
? ? ?* 設(shè)備定義點數(shù)據(jù)拉取
? ? ?*
? ? ?* @author tarzan Liu
? ? ?* @date 2020/12/2
? ? ?*/
? ? @Scheduled(cron = "0/30 * * * * ?") // 30秒校驗一次
? ? public void pullDataTaskByCorn() {
? ? ? ? String result = HttpProxyUtil.sendGet("http://" + host + ":" + port + "/interface/system/list");
? ? ? ? JSONObject jsonObject = JSON.parseObject(result);
? ? ? ? if (Objects.nonNull(jsonObject)) {
? ? ? ? ? ? JSONArray array = jsonObject.getJSONArray("data");
? ? ? ? ? ? if (array != null && array.size() != 0) {
? ? ? ? ? ? ? ? for (int i = 0; i < array.size(); i++) {
? ? ? ? ? ? ? ? ? ? JSONObject obj = array.getJSONObject(i);
? ? ? ? ? ? ? ? ? ? String systemId = obj.getString("id");
? ? ? ? ? ? ? ? ? ? pullDataNew(systemId);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? }
?
?
? ? @Transactional(rollbackFor = Throwable.class)
? ? public ResponseDTO<String> pullData(String code) {
? ? ? ? List<EntityPointEntity> list = Lists.newArrayList();
? ? ? ? String result = HttpProxyUtil.sendGet("http://" + host + ":" + port + "/interface/defintionView/listBySystemId/" + code);
? ? ? ? JSONObject jsonObject = JSON.parseObject(result);
? ? ? ? if (Objects.nonNull(jsonObject)) {
? ? ? ? ? ? JSONArray array = jsonObject.getJSONArray("data");
? ? ? ? ? ? if (array != null && array.size() != 0) {
? ? ? ? ? ? ? ? for (int i = 0; i < array.size(); i++) {
? ? ? ? ? ? ? ? ? ? JSONObject obj = array.getJSONObject(i);
? ? ? ? ? ? ? ? ? ? String pointId = obj.getString("pointId");
? ? ? ? ? ? ? ? ? ? String name = obj.getString("name");
? ? ? ? ? ? ? ? ? ? list.add(EntityPointEntity.builder().pointId(pointId).name(name).code(code).build());
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? List<EntityPointEntity> existList = entityPointService.list(new LambdaQueryWrapper<EntityPointEntity>().eq(EntityPointEntity::getCode, code).isNotNull(EntityPointEntity::getValue));
? ? ? ? ? ? ? ? if (CollectionUtils.isNotEmpty(existList)) {
? ? ? ? ? ? ? ? ? ? Map<String, String> existMap = existList.stream().collect(Collectors.toMap(EntityPointEntity::getPointId, EntityPointEntity::getValue));
? ? ? ? ? ? ? ? ? ? list.forEach(e -> {
? ? ? ? ? ? ? ? ? ? ? ? String value = existMap.get(e.getPointId());
? ? ? ? ? ? ? ? ? ? ? ? if (value != null) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? e.setValue(value);
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? });
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? entityPointService.remove(new LambdaQueryWrapper<EntityPointEntity>().eq(EntityPointEntity::getCode, code));
? ? ? ? ? ? ? ? entityPointService.saveBatch(list);
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? return ResponseDTO.succ();
? ? }
?
?
? ? @Transactional(rollbackFor = Throwable.class)
? ? public ResponseDTO<String> pullDataNew(String code) {
? ? ? ? String result = HttpProxyUtil.sendGet("http://" + host + ":" + port + "/interface/defintionView/listBySystemId/" + code);
? ? ? ? JSONObject jsonObject = JSON.parseObject(result);
? ? ? ? if (Objects.nonNull(jsonObject)) {
? ? ? ? ? ? JSONArray data = jsonObject.getJSONArray("data");
? ? ? ? ? ? List<EntityPointEntity> list = data.toJavaList(EntityPointEntity.class);
? ? ? ? ? ? if (CollectionUtils.isNotEmpty(list)) {
? ? ? ? ? ? ? ? list.forEach(e -> e.setCode(code));
? ? ? ? ? ? ? ? List<EntityPointEntity> existList = entityPointService.list(new LambdaQueryWrapper<EntityPointEntity>().eq(EntityPointEntity::getCode, code));
? ? ? ? ? ? ? ? if (CollectionUtils.isNotEmpty(existList)) {
? ? ? ? ? ? ? ? ? ? //存在map
? ? ? ? ? ? ? ? ? ? Map<String, String> existMap = existList.stream().collect(Collectors.toMap(EntityPointEntity::getPointId, EntityPointEntity::getName));
? ? ? ? ? ? ? ? ? ? //傳輸map
? ? ? ? ? ? ? ? ? ? Map<String, String> dataMap = list.stream().collect(Collectors.toMap(EntityPointEntity::getPointId, EntityPointEntity::getName));
? ? ? ? ? ? ? ? ? ? //增量
? ? ? ? ? ? ? ? ? ? List<EntityPointEntity> increment = list.stream().filter(e -> existMap.get(e.getPointId()) == null).collect(Collectors.toList());
? ? ? ? ? ? ? ? ? ? if (CollectionUtils.isNotEmpty(increment)) {
? ? ? ? ? ? ? ? ? ? ? ? entityPointService.saveBatch(increment);
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? //減量
? ? ? ? ? ? ? ? ? ? List<EntityPointEntity> decrement = existList.stream().filter(e -> dataMap.get(e.getPointId()) == null).collect(Collectors.toList());
? ? ? ? ? ? ? ? ? ? if (CollectionUtils.isNotEmpty(decrement)) {
? ? ? ? ? ? ? ? ? ? ? ? entityPointService.removeByIds(decrement.stream().map(EntityPointEntity::getId).collect(Collectors.toList()));
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? //變量
? ? ? ? ? ? ? ? ? ? List<EntityPointEntity> variable = existList.stream().filter(e -> dataMap.get(e.getPointId()) != null && !dataMap.get(e.getPointId()).equals(e.getName())).collect(Collectors.toList());
? ? ? ? ? ? ? ? ? ? if (CollectionUtils.isNotEmpty(variable)) {
? ? ? ? ? ? ? ? ? ? ? ? variable.forEach(e -> {
? ? ? ? ? ? ? ? ? ? ? ? ? ? e.setName(dataMap.get(e.getPointId()));
? ? ? ? ? ? ? ? ? ? ? ? });
? ? ? ? ? ? ? ? ? ? ? ? entityPointService.updateBatchById(variable);
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? } else {
? ? ? ? ? ? ? ? ? ? entityPointService.saveBatch(list);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? return ResponseDTO.succ();
? ? }
?
?
}數(shù)據(jù)庫對應(yīng)實體類
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
?
import java.io.Serializable;
import java.util.Date;
?
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
@TableName(value = "t_entity_point")
public class EntityPointEntity implements Serializable {
?
? ? private static final long serialVersionUID = 2181036545424452651L;
?
? ? /**
? ? ?* 定義點id
? ? ?*/
? ? @TableId(value = "id", type = IdType.ASSIGN_ID)
? ? private Long id;
?
? ? /**
? ? ?* 定義點id
? ? ?*/
? ? private String pointId;
?
? ? /**
? ? ?* 名稱
? ? ?*/
? ? private String name;
?
? ? /**
? ? ?* 繪制數(shù)據(jù)
? ? ?*/
? ? private String value;
?
? ? /**
? ? ?* 編碼
? ? ?*/
? ? private String code;
?
? ? /**
? ? ?* 創(chuàng)建時間
? ? ?*/
? ? private Date createTime;
?
}HTTP請求代理工具類
import lombok.extern.slf4j.Slf4j;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustStrategy;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.util.EntityUtils;
?
import javax.net.ssl.SSLContext;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.URL;
import java.net.URLConnection;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
?
?
/**
?* HTTP請求代理類
?*
?* @author tarzan Liu
?* @description 發(fā)送Get Post請求
?*/
@Slf4j
public class HttpProxyUtil {
?
? ? /**
? ? ?* 使用URLConnection進(jìn)行GET請求
? ? ?*
? ? ?* @param api_url
? ? ?* @return
? ? ?*/
? ? public static String sendGet(String api_url) {
? ? ? ? return sendGet(api_url, "", "utf-8");
? ? }
?
? ? /**
? ? ?* 使用URLConnection進(jìn)行GET請求
? ? ?*
? ? ?* @param api_url
? ? ?* @param param
? ? ?* @return
? ? ?*/
? ? public static String sendGet(String api_url, String param) {
? ? ? ? return sendGet(api_url, param, "utf-8");
? ? }
?
? ? /**
? ? ?* 使用URLConnection進(jìn)行GET請求
? ? ?*
? ? ?* @param api_url 請求路徑
? ? ?* @param param ? 請求格式有name1=value1&name2=value2、json、xml、map或其他形式,具體要看接收方的取值, 可以為空
? ? ?* @param charset 字符集
? ? ?* @return
? ? ?*/
? ? public static String sendGet(String api_url, String param, String charset) {
? ? ? ? StringBuffer buffer = new StringBuffer();
? ? ? ? try {
? ? ? ? ? ? // 判斷有無參數(shù),若是拼接好的url,就不必再拼接了
? ? ? ? ? ? if (param != null && !"".equals(param)) {
? ? ? ? ? ? ? ? api_url = api_url + "?" + param;
? ? ? ? ? ? }
? ? ? ? ? ? log.info("請求的路徑是:" + api_url);
? ? ? ? ? ? URL realUrl = new URL(api_url);
? ? ? ? ? ? // 打開聯(lián)接
? ? ? ? ? ? URLConnection conn = realUrl.openConnection();
? ? ? ? ? ? // 設(shè)置通用的請求屬性
? ? ? ? ? ? conn.setRequestProperty("accept", "*/*");
? ? ? ? ? ? conn.setRequestProperty("connection", "Keep-Alive");
? ? ? ? ? ? conn.setRequestProperty("user-agent", "Mozilla/4.0(compatible; MSIE 6.0; Windows NT 5.1; SV1)");
? ? ? ? ? ? conn.setConnectTimeout(12000); ? ?//設(shè)置連接主機(jī)超時(單位:毫秒)
? ? ? ? ? ? conn.setReadTimeout(12000); ? ?// 設(shè)置從主機(jī)讀取數(shù)據(jù)超時(單位:毫秒)
? ? ? ? ? ? conn.connect(); ? ?// 建立實際的聯(lián)接
?
? ? ? ? ? ? // 定義 BufferedReader輸入流來讀取URL的相應(yīng)
? ? ? ? ? ? try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), charset))) {
? ? ? ? ? ? ? ? String line;
? ? ? ? ? ? ? ? while ((line = in.readLine()) != null) {
//?? ??? ??? ??? ??? ?buffer.append("\n"+line);
? ? ? ? ? ? ? ? ? ? buffer.append(line);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? } catch (Exception e) {
? ? ? ? ? ? log.error("發(fā)送GET請求出現(xiàn)異常! " + e.getMessage());
? ? ? ? ? ? return null;
? ? ? ? }
? ? ? ? // ?log.info("響應(yīng)返回數(shù)據(jù):" + buffer.toString());
? ? ? ? return buffer.toString();
? ? }
?
?
? ? /**
? ? ?* 使用URLConnection進(jìn)行POST請求
? ? ?*
? ? ?* @param api_url 請求路徑
? ? ?* @param param ? 請求格式有name1=value1&name2=value2、json、xml、map或其他形式,具體要看接收方的取值,最好不為空
? ? ?* @return
? ? ?*/
? ? public static String sendPost(String api_url, String param) {
? ? ? ? return sendPost(api_url, param, "utf-8");
? ? }
?
? ? /**
? ? ?* 使用URLConnection進(jìn)行POST請求
? ? ?*
? ? ?* @param api_url 請求路徑
? ? ?* @param param ? 請求格式有name1=value1&name2=value2、json、xml、map或其他形式,具體要看接收方的取值,最好不為空
? ? ?* @param charset 字符集
? ? ?* @return
? ? ?*/
? ? public static String sendPost(String api_url, String param, String charset) {
? ? ? ? StringBuffer buffer = new StringBuffer();
? ? ? ? try {
? ? ? ? ? ? log.info("請求的路徑是:" + api_url + ",參數(shù)是:" + param);
?
? ? ? ? ? ? URL realUrl = new URL(api_url);
? ? ? ? ? ? // 打開聯(lián)接
? ? ? ? ? ? URLConnection conn = realUrl.openConnection();
? ? ? ? ? ? // 設(shè)置通用的請求屬性
? ? ? ? ? ? conn.setRequestProperty("accept", "*/*");
? ? ? ? ? ? conn.setRequestProperty("connection", "Keep-Alive");
? ? ? ? ? ? conn.setRequestProperty("user-agent", "Mozilla/4.0(compatible; MSIE 6.0; Windows NT 5.1; SV1)");
? ? ? ? ? ? conn.setConnectTimeout(12000); ? ?//設(shè)置連接主機(jī)超時(單位:毫秒)
? ? ? ? ? ? conn.setReadTimeout(12000); ? ?// 設(shè)置從主機(jī)讀取數(shù)據(jù)超時(單位:毫秒)
?
? ? ? ? ? ? // 發(fā)送POST請求必須設(shè)置如下兩行
? ? ? ? ? ? conn.setDoOutput(true);
? ? ? ? ? ? conn.setDoInput(true);
?
? ? ? ? ? ? // 獲取URLConnection對象對應(yīng)的輸出流
? ? ? ? ? ? try (PrintWriter out = new PrintWriter(conn.getOutputStream())) {
? ? ? ? ? ? ? ? out.print(param); // 發(fā)送請求參數(shù)
? ? ? ? ? ? ? ? out.flush();// flush輸出流的緩沖
? ? ? ? ? ? }
? ? ? ? ? ? // 定義 BufferedReader輸入流來讀取URL的相應(yīng),得指明使用UTF-8編碼,否則到API服務(wù)器XML的中文不能被成功識別
? ? ? ? ? ? try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), charset))) {
? ? ? ? ? ? ? ? String line;
? ? ? ? ? ? ? ? while ((line = in.readLine()) != null) {
//?? ??? ??? ??? ??? ?buffer.append("\n"+line);
? ? ? ? ? ? ? ? ? ? buffer.append(line);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? } catch (Exception e) {
? ? ? ? ? ? log.error("發(fā)送POST請求出現(xiàn)異常! " + e.getMessage());
? ? ? ? ? ? e.printStackTrace();
? ? ? ? }
? ? ? ? log.info("響應(yīng)返回數(shù)據(jù):" + buffer.toString());
? ? ? ? return buffer.toString();
? ? }
?
? ? public static CloseableHttpClient createSSLClientDefault() throws Exception {
? ? ? ? SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new AllTrustStrategy()).build();
? ? ? ? SSLConnectionSocketFactory sslSf = new SSLConnectionSocketFactory(sslContext);
? ? ? ? return HttpClients.custom().setSSLSocketFactory(sslSf).build();
? ? }
?
? ? // 加載證書
? ? private static class AllTrustStrategy implements TrustStrategy {
? ? ? ? public boolean isTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
? ? ? ? ? ? return true;
? ? ? ? }
? ? }
?
? ? /**
? ? ?* 支持https請求
? ? ?*
? ? ?* @param url
? ? ?* @param param
? ? ?* @return
? ? ?* @throws Exception
? ? ?*/
? ? public static String sendHttpClientPost(String url, Map<String, String> param) throws Exception {
? ? ? ? CloseableHttpClient httpClient = createSSLClientDefault();
? ? ? ? HttpPost httpPost = null;
? ? ? ? CloseableHttpResponse response = null;
? ? ? ? String result = "";
? ? ? ? try {
? ? ? ? ? ? // 發(fā)起HTTP的POST請求
? ? ? ? ? ? httpPost = new HttpPost(url);
? ? ? ? ? ? List<NameValuePair> paramList = new ArrayList<NameValuePair>();
? ? ? ? ? ? for (String key : param.keySet()) {
? ? ? ? ? ? ? ? paramList.add(new BasicNameValuePair(key, param.get(key)));
? ? ? ? ? ? }
? ? ? ? ? ? log.info("http請求地址:" + url + ",參數(shù):" + paramList.toString());
? ? ? ? ? ? // UTF8+URL編碼
? ? ? ? ? ? httpPost.setEntity(new UrlEncodedFormEntity(paramList, Consts.UTF_8));
? ? ? ? ? ? httpPost.setConfig(RequestConfig.custom().setConnectTimeout(30000).setSocketTimeout(30000).build());
? ? ? ? ? ? response = httpClient.execute(httpPost);
? ? ? ? ? ? HttpEntity entity = response.getEntity();
? ? ? ? ? ? int statusCode = response.getStatusLine().getStatusCode();
? ? ? ? ? ? if (HttpStatus.SC_OK == statusCode) { // 如果響應(yīng)碼是200
?
? ? ? ? ? ? }
? ? ? ? ? ? result = EntityUtils.toString(entity);
? ? ? ? ? ? log.info("狀態(tài)碼:" + statusCode + ",響應(yīng)信息:" + result);
? ? ? ? } finally {
? ? ? ? ? ? if (response != null) {
? ? ? ? ? ? ? ? response.close();
? ? ? ? ? ? }
? ? ? ? ? ? if (httpPost != null) {
? ? ? ? ? ? ? ? httpPost.releaseConnection();
? ? ? ? ? ? }
? ? ? ? ? ? httpClient.close();
? ? ? ? }
? ? ? ? return result;
? ? }
}以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Java中各類日期和時間轉(zhuǎn)換超詳析總結(jié)(Date和LocalDateTime相互轉(zhuǎn)換等)
這篇文章主要介紹了Java中日期和時間處理的幾個階段,包括java.util.Date、java.sql.Date、java.sql.Time、java.sql.Timestamp、java.util.Calendar和java.util.GregorianCalendar等類,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下2025-01-01
MyBatis?Plus實現(xiàn)中文排序的兩種有效方法
在MyBatis?Plus項目開發(fā)中,針對中文數(shù)據(jù)的排序需求是一個常見的挑戰(zhàn),尤其是在需要按照拼音或特定語言邏輯排序時,本文整合了兩種有效的方法,旨在幫助開發(fā)者克服MyBatis?Plus在處理中文排序時遇到的障礙,需要的朋友可以參考下2024-08-08
日志模塊自定義@SkipLogAspect注解跳過切面的操作方法
文章介紹了一個自定義注解@SkipLogAspect,用于在日志模塊中跳過特定方法的日志切面,這個注解可以用于需要避免大對象轉(zhuǎn)換為JSON時導(dǎo)致的OOM問題,文章還提供了注解的實現(xiàn)代碼以及一個測試示例,展示了如何在控制器中使用該注解來跳過日志切面,感興趣的朋友一起看看吧2025-02-02

