Java導出通過Word模板導出docx文件并通過QQ郵箱發送

一、創建Word模板

{{company}}{{Date}}服務器運行情況報告一、服務器:總告警次數:{{ServerTotal}}
服務器IP:{{IPA}},總共告警次數:{{ServerATotal}} 
服務器IP:{{IPB}},總共告警次數:{{ServerBTotal}} 
服務器IP:{{IPC}},總共告警次數:{{ServerCTotal}} 二、應用程序:總告警次數{{ApplicationTotal}} 
服務器IP:{{IPA}},包含{{ApplicationAName}}應用程序服務,總共告警次數:{{ApplicationATotal}}
服務器IP:{{IPB}},包含{{ApplicationBName}}應用程序服務,總共告警次數:{{ApplicationBTotal}}
服務器IP:{{IPC}},包含{{ApplicationCName}}應用程序服務,總共告警次數:{{ApplicationCTotal}}三、數據庫:總告警次數{{DBTotal}} 
服務器IP:{{IPA}},包含{{DBAName}}數據庫,總共告警次數:{{DBATotal}}
服務器IP:{{IPB}},包含{{DBBName}}數據庫,總共告警次數:{{DBBTotal}}
服務器IP:{{IPC}},包含{{DBCName}}數據庫,總共告警次數:{{DBCTotal}}四、中間件:總告警次數{{MiddleWareTotal}} 
服務器IP:{{IPA}},包含{{MiddleWareAName}}中間件,總共告警次數:{{MiddleWareATotal}}
服務器IP:{{IPB}},包含{{MiddleWareBName}}中間件,總共告警次數:{{MiddleWareBTotal}}
服務器IP:{{IPC}},包含{{MiddleWareCName}}中間件,總共告警次數:{{MiddleWareCTotal}} 五、接口:總告警次數{{InterfaceTotal}} 
服務器IP:{{IPA}},包含{{InterfaceAName}}接口服務,總共告警次數:{{InterfaceATotal}}
服務器IP:{{IPB}},包含{{InterfaceBName}}接口服務,總共告警次數:{{InterfaceBTotal}}
服務器IP:{{IPC}},包含{{InterfaceCName}}接口服務,總共告警次數:{{InterfaceCTotal}}

將上述內容存入一個docx文件中,放到resources文件夾下
在這里插入圖片描述

二、編寫代碼

package com.gitee.pifeng.monitoring.server.business.server.controller;import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gitee.pifeng.monitoring.server.business.server.dao.*;
import com.gitee.pifeng.monitoring.server.business.server.entity.*;
import com.gitee.pifeng.monitoring.server.business.server.service.IAlarmService;
import com.gitee.pifeng.monitoring.server.config.WordTemplateConfig;import com.gitee.pifeng.monitoring.server.util.db.SelectEmailsService;
import org.apache.poi.util.StringUtil;
import org.apache.poi.xwpf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.thymeleaf.util.StringUtils;import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;/*** description 導出word版本的報表** @author yhj* @date 2025-01-06 17:08:15*/@RequestMapping("/ExportWord")
@RestController
public class ExportWordReportController {@Autowiredprivate WordTemplateConfig wordTemplateConfig;/*** 告警服務接口*/@Autowiredprivate IAlarmService alarmService;@Autowiredprivate IMonitorInstanceDao monitorInstanceDao;@Autowiredprivate IMonitorAlarmRecordDao monitorAlarmRecordDao;@Autowiredprivate IMonitorDbDao monitorDbDao;@Autowiredprivate IMonitorTcpDao monitorTcpDao;@Autowiredprivate IMonitorHttpDao monitorHttpDao;@Autowiredprivate SelectEmailsService emailsService;public void exportWordTemplate(HttpServletResponse response, Map<String, String> data, String filename) {String companyName = emailsService.selectCompanyName();data.put("company", companyName);try {String filePath = URLDecoder.decode(getClass().getClassLoader().getResource("templates/static/WordReportTemplete.docx").getPath(), "UTF-8");// 讀取Word模板FileInputStream fis = new FileInputStream(filePath);XWPFDocument document = new XWPFDocument(fis);// 將填充后的文檔寫入響應輸出流wordTemplateConfig.replaceTextInDocument(document, data);// 設置響應頭,指定下載文件類型和名稱response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + filename + ".docx");document.write(response.getOutputStream());// 關閉資源document.close();fis.close();} catch (IOException e) {e.printStackTrace();}}private void exportEmptyWordTemplate(HttpServletResponse response, Map<String, String> data) {String companyName = emailsService.selectCompanyName();String filename = URLEncoder.encode(String.valueOf(new StringBuilder(companyName).append("現場暫無數據"))).replaceAll("\\+", "%20");data.put("company", companyName);try {String filePath = URLDecoder.decode(getClass().getClassLoader().getResource("templates/static/EmptyWordReportTemplete.docx").getPath(), "UTF-8");// 讀取Word模板FileInputStream fis = new FileInputStream(filePath);XWPFDocument document = new XWPFDocument(fis);// 將填充后的文檔寫入響應輸出流wordTemplateConfig.replaceTextInDocument(document, data);// 設置響應頭,指定下載文件類型和名稱response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + filename + ".docx");document.write(response.getOutputStream());// 關閉資源document.close();fis.close();} catch (IOException e) {e.printStackTrace();}}/*** 本日服務器報錯信息word導出** @param response*/@GetMapping("/getThisDayWordReport")public void getDayWordReport(HttpServletResponse response) {String companyName = emailsService.selectCompanyName();Map<String, String> data = new HashMap<>();SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");Date date = new Date();String TodayDay = simpleDateFormat.format(date);data.put("Date", TodayDay);Integer flag = 0;  // 0代表今日//文件名,以下方法用于防止中文編碼錯誤String name = String.valueOf(new StringBuilder(companyName).append(TodayDay).append("服務器報錯信息"));String filename = URLEncoder.encode(name).replaceAll("\\+", "%20");thisWordInfo(response, flag, TodayDay, data, filename);}// 將導出的信息填充給wordprivate void thisWordInfo(HttpServletResponse response, Integer flag, String Date, Map<String, String> data, String filename) {// 查詢所有IPList<String> IpList = getIpList();if (IpList.size() == 0) {exportEmptyWordTemplate(response, data);} else {List<ExportWordReport> listA = new ArrayList<>();if (!IpList.get(0).isEmpty()) {String IPA = IpList.get(0);if (flag == 0) {// 當日報錯個數listA = alarmService.selectWordDayAlarmTotal(IPA, Date);} else if (flag == 1) {// 本周報錯個數listA = alarmService.selectWordWeekAlarmTotal(IPA, Date);} else if (flag == 2) {// 本月報錯個數listA = alarmService.selectWordMonthAlarmTotal(IPA, Date);} else if (flag == 3) {// 本年報錯個數listA = alarmService.selectWordYearAlarmTotal(IPA, Date);}// 匯總各項報錯個數Map<String, Integer> mapA = listA.stream().collect(Collectors.toMap(ExportWordReport::getName, ExportWordReport::getTotal));// 查詢該IP下所有應用程序的名稱String applicationName = getApplicationNameList(IPA);// 查詢該IP下所有數據庫名字String DBName = getDBNameList(IPA);// 查詢該IP下所有中間件名字String MiddleWareName = getMiddleNameList(IPA);// 查詢該IP下所有接口名稱String InterfaceName = getInterfaceNameList(IPA);// 填充word里面的字段data.put("IPA", IPA);data.put("ApplicationAName", !applicationName.isEmpty() ? applicationName : "0個");data.put("DBAName", !DBName.isEmpty() ? DBName : "0個");data.put("MiddleWareAName", !MiddleWareName.isEmpty() ? MiddleWareName : "0個");data.put("InterfaceAName", !InterfaceName.isEmpty() ? InterfaceName : "0個");// 服務器data.put("ServerATotal", mapA.get("SERVER") != null ? String.valueOf(mapA.get("SERVER")) : "0");// 應用data.put("ApplicationATotal", mapA.get("INSTANCE") != null ? String.valueOf(mapA.get("INSTANCE")) : "0");// 數據庫data.put("DBATotal", mapA.get("DATABASE") != null ? String.valueOf(mapA.get("DATABASE")) : "0");// 中間件data.put("MiddleWareATotal", mapA.get("TCP4SERVICE") != null ? String.valueOf(mapA.get("TCP4SERVICE")) : "0");// 接口data.put("InterfaceATotal", mapA.get("HTTP4SERVICE") != null ? String.valueOf(mapA.get("HTTP4SERVICE")) : "0");}if (!IpList.get(1).isEmpty()) {List<ExportWordReport> listB = new ArrayList<>();String IPB = IpList.get(1);if (flag == 0) {listB = alarmService.selectWordDayAlarmTotal(IPB, Date);} else if (flag == 1) {// 本周報錯信息listB = alarmService.selectWordWeekAlarmTotal(IPB, Date);} else if (flag == 2) {// 本月報錯個數listB = alarmService.selectWordMonthAlarmTotal(IPB, Date);} else if (flag == 3) {// 本年報錯個數listB = alarmService.selectWordYearAlarmTotal(IPB, Date);}// 匯總各項報錯個數Map<String, Integer> mapB = listB.stream().collect(Collectors.toMap(ExportWordReport::getName, ExportWordReport::getTotal));// 查詢該IP下所有應用程序的名稱String applicationName = getApplicationNameList(IPB);// 查詢該IP下所有數據庫名字String DBName = getDBNameList(IPB);// 查詢該IP下所有中間件名字String MiddleWareName = getMiddleNameList(IPB);// 查詢該IP下所有接口名稱String InterfaceName = getInterfaceNameList(IPB);data.put("IPB", IPB);data.put("ApplicationBName", !applicationName.isEmpty() ? applicationName : "0個");data.put("DBBName", !DBName.isEmpty() ? DBName : "0個");data.put("MiddleWareBName", !MiddleWareName.isEmpty() ? MiddleWareName : "0個");data.put("InterfaceBName", !InterfaceName.isEmpty() ? InterfaceName : "0個");// 服務器data.put("ServerBTotal", mapB.get("SERVER") != null ? String.valueOf(mapB.get("SERVER")) : "0");// 應用data.put("ApplicationBTotal", mapB.get("INSTANCE") != null ? String.valueOf(mapB.get("INSTANCE")) : "0");// 數據庫data.put("DBBTotal", mapB.get("DATABASE") != null ? String.valueOf(mapB.get("DATABASE")) : "0");// 中間件data.put("MiddleWareBTotal", mapB.get("TCP4SERVICE") != null ? String.valueOf(mapB.get("TCP4SERVICE")) : "0");// 接口data.put("InterfaceBTotal", mapB.get("HTTP4SERVICE") != null ? String.valueOf(mapB.get("HTTP4SERVICE")) : "0");}if (!IpList.get(2).isEmpty()) {List<ExportWordReport> listC = new ArrayList<>();String IPC = IpList.get(2);if (flag == 0) {listC = alarmService.selectWordDayAlarmTotal(IPC, Date);} else if (flag == 1) {// 本周報錯個數listC = alarmService.selectWordWeekAlarmTotal(IPC, Date);} else if (flag == 2) {// 本月報錯個數listC = alarmService.selectWordMonthAlarmTotal(IPC, Date);} else if (flag == 3) {// 本年報錯個數listC = alarmService.selectWordYearAlarmTotal(IPC, Date);}// 匯總各項報錯個數Map<String, Integer> mapC = listC.stream().collect(Collectors.toMap(ExportWordReport::getName, ExportWordReport::getTotal));// 查詢該IP下所有應用程序的名稱String applicationName = getApplicationNameList(IPC);// 查詢該IP下所有數據庫名字String DBName = getDBNameList(IPC);// 查詢該IP下所有中間件名字String MiddleWareName = getMiddleNameList(IPC);// 查詢該IP下所有接口名稱String InterfaceName = getInterfaceNameList(IPC);data.put("IPC", IPC);data.put("ApplicationCName", !applicationName.isEmpty() ? applicationName : "0個");data.put("DBCName", DBName);data.put("MiddleWareCName", !MiddleWareName.isEmpty() ? MiddleWareName : "0個");data.put("InterfaceCName", !InterfaceName.isEmpty() ? InterfaceName : "0個");// 服務器data.put("ServerCTotal", mapC.get("SERVER") != null ? String.valueOf(mapC.get("SERVER")) : "0");// 應用data.put("ApplicationCTotal", mapC.get("INSTANCE") != null ? String.valueOf(mapC.get("INSTANCE")) : "0");// 數據庫data.put("DBCTotal", mapC.get("DATABASE") != null ? String.valueOf(mapC.get("DATABASE")) : "0");// 中間件data.put("MiddleWareCTotal", mapC.get("TCP4SERVICE") != null ? String.valueOf(mapC.get("TCP4SERVICE")) : "0");// 接口data.put("InterfaceCTotal", mapC.get("HTTP4SERVICE") != null ? String.valueOf(mapC.get("HTTP4SERVICE")) : "0");}// 所有服務器報錯信息條數總和int ServerTotal = Integer.parseInt(data.get("ServerATotal")) + Integer.parseInt(data.get("ServerBTotal")) + Integer.parseInt(data.get("ServerCTotal"));data.put("ServerTotal", String.valueOf(ServerTotal));// 所有應用程序報錯信息總和int ApplicationTotal = Integer.parseInt(data.get("ApplicationATotal")) + Integer.parseInt(data.get("ApplicationBTotal")) + Integer.parseInt(data.get("ApplicationCTotal"));data.put("ApplicationTotal", String.valueOf(ApplicationTotal));//所有數據庫報錯信息總和int DBTotal = Integer.parseInt(data.get("DBATotal")) + Integer.parseInt(data.get("DBBTotal")) + Integer.parseInt(data.get("DBCTotal"));data.put("DBTotal", String.valueOf(DBTotal));//所有中間件報錯信息總和int MiddleWareTotal = Integer.parseInt(data.get("MiddleWareATotal")) + Integer.parseInt(data.get("MiddleWareBTotal")) + Integer.parseInt(data.get("MiddleWareCTotal"));data.put("MiddleWareTotal", String.valueOf(MiddleWareTotal));//所有接口報錯信息總和int InterfaceTotal = Integer.parseInt(data.get("InterfaceATotal")) + Integer.parseInt(data.get("InterfaceBTotal")) + Integer.parseInt(data.get("InterfaceCTotal"));data.put("InterfaceTotal", String.valueOf(InterfaceTotal));exportWordTemplate(response, data, filename);}}// 查詢所有接口名稱private String getInterfaceNameList(String IP) {LambdaQueryWrapper<MonitorHttp> queryInterfaceNameWrapper = new LambdaQueryWrapper<>();queryInterfaceNameWrapper.select(MonitorHttp::getDescr).ne(MonitorHttp::getDescr,null).ne(MonitorHttp::getDescr,"").eq(MonitorHttp::getHostnameSource, IP).groupBy(MonitorHttp::getDescr);List<String> InterfaceList = monitorHttpDao.selectList(queryInterfaceNameWrapper).stream().filter(item -> item!=null).map(MonitorHttp::getDescr).collect(Collectors.toList());String InterfaceName = InterfaceList.stream().map(String::toString).collect(Collectors.joining("、"));return InterfaceName;}// 查詢所有IPprivate List<String> getIpList() {LambdaQueryWrapper<MonitorAlarmRecord> queryIPWrapper = new LambdaQueryWrapper<>();queryIPWrapper.select(MonitorAlarmRecord::getIp).groupBy(MonitorAlarmRecord::getIp);List<String> IpList = monitorAlarmRecordDao.selectList(queryIPWrapper).stream().filter(item -> item != null).map(MonitorAlarmRecord::getIp).collect(Collectors.toList());return IpList;}// 查詢該IP下所有中間件的名稱private String getMiddleNameList(String IP) {LambdaQueryWrapper<MonitorTcp> queryMiddleNameWrapper = new LambdaQueryWrapper<>();queryMiddleNameWrapper.select(MonitorTcp::getDescr).ne(MonitorTcp::getDescr,"").ne(MonitorTcp::getDescr,null).eq(MonitorTcp::getHostnameSource, IP).groupBy(MonitorTcp::getDescr);List<String> MiddleWareList = monitorTcpDao.selectList(queryMiddleNameWrapper).stream().filter(item -> item != null).map(MonitorTcp::getDescr).collect(Collectors.toList());String MiddleWareName = MiddleWareList.stream().map(String::toString).collect(Collectors.joining("、"));return MiddleWareName;}// 查詢該IP下所有應用程序的名稱private String getApplicationNameList(String IP) {// 查詢該IP下所有應用程序的名稱LambdaQueryWrapper<MonitorInstance> queryInstanceNameWrapper = new LambdaQueryWrapper<>();queryInstanceNameWrapper.select(MonitorInstance::getInstanceName) // 指定查詢字段.ne(MonitorInstance::getInstanceName,"").ne(MonitorInstance::getInstanceName,null).eq(MonitorInstance::getIp, IP)          // 添加 IP 條件.groupBy(MonitorInstance::getInstanceName); // 去重(相當于 DISTINCT)List<String> ApplicationNameList = monitorInstanceDao.selectList(queryInstanceNameWrapper).stream().map(MonitorInstance::getInstanceName) // 提取字段值.distinct().collect(Collectors.toList());// 確保去重String applicationName = ApplicationNameList.stream().map(String::toString).collect(Collectors.joining("、"));return applicationName;}// 查詢所有數據庫名字公共方法private String getDBNameList(String IP) {LambdaQueryWrapper<MonitorDb> queryDBListWrapper = new LambdaQueryWrapper<>();queryDBListWrapper.select(MonitorDb::getDbType).ne(MonitorDb::getDbType,"").ne(MonitorDb::getDbType,null).eq(MonitorDb::getIp, IP).groupBy(MonitorDb::getDbType);List<String> DBList = monitorDbDao.selectList(queryDBListWrapper).stream().filter(item -> item != null).map(MonitorDb::getDbType).collect(Collectors.toList());String DBName = DBList.stream().map(String::toString).collect(Collectors.joining("、"));return DBName;}}

工具類,主要讀取信息并寫入word模板內

package com.gitee.pifeng.monitoring.server.config;
import org.apache.poi.xwpf.usermodel.*;
import org.springframework.stereotype.Component;import java.util.List;
import java.util.Map;@Component
public class WordTemplateConfig {public void replaceTextInDocument(XWPFDocument document, Map<String, String> data) {// 替換段落中的占位符for (XWPFParagraph paragraph : document.getParagraphs()) {StringBuilder paragraphText = new StringBuilder();List<XWPFRun> runs = paragraph.getRuns();if (runs != null) {// 收集段落中的所有文本for (XWPFRun run : runs) {paragraphText.append(run.getText(0) != null ? run.getText(0) : "");}// 替換占位符String replacedText = paragraphText.toString();for (Map.Entry<String, String> entry : data.entrySet()) {replacedText = replacedText.replace("{{" + entry.getKey() + "}}", entry.getValue() != null ? entry.getValue() : "");}// 清空原有 runsfor (int i = runs.size() - 1; i >= 0; i--) {paragraph.removeRun(i);}// 重新設置替換后的文本XWPFRun newRun = paragraph.createRun();newRun.setText(replacedText);}}// 替換表格中的占位符for (XWPFTable table : document.getTables()) {for (XWPFTableRow row : table.getRows()) {for (XWPFTableCell cell : row.getTableCells()) {for (XWPFParagraph paragraph : cell.getParagraphs()) {for (XWPFRun run : paragraph.getRuns()) {String text = run.getText(0);if (text != null) {for (Map.Entry<String, String> entry : data.entrySet()) {if (text.contains("{{" + entry.getKey() + "}}")) {text = text.replace("{{" + entry.getKey() + "}}", entry.getValue());run.setText(text, 0);}}}}}}}}}
}

三、發送郵箱

@RequestMapping("/SendWord")
@RestController
public class SendWordReportController {@Autowiredprivate EmailSender emailSender;@Autowiredprivate SelectEmailsService emailsService;SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");String date = simpleDateFormat.format(new Date());/*** 發送日報表*/@PostMapping("/sendDayWordReport")public void sendDayWordReport()  {List<String> emails = emailsService.findEmail();String companyName = emailsService.selectCompanyName();String name = companyName+new StringBuilder(date).append("日服務器報錯信息匯總");try {// 調用接口下載 Excel 文件String apiUrl = "http://localhost:16000/phoenix-server/ExportWord/getThisDayWordReport";File wordFile = FileDownloader.downloadWordFile(apiUrl);// 接收郵件的郵箱for (String email: emails) {emailSender.sendEmailWithAttachment(email,wordFile,name);}
//            emailSender.sendEmailWithAttachment(toEmail,wordFile,name);} catch (IOException | MessagingException e) {e.printStackTrace();}}}}
package com.gitee.pifeng.monitoring.server.config;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Component;import javax.mail.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import java.io.File;
import java.io.IOException;
import java.util.Properties;/*** description 發送報表數據** @author yhj* @date 2025-01-02 15:39:08*/@Component
public class EmailSender {@Value("${spring.mail.username}")private String username;@Value("${spring.mail.password}")private String password;@Autowiredprivate JavaMailSender sender;public void sendEmailWithAttachment(String toEmail,File attachmentFile,String name) throws MessagingException, IOException {// 設置郵件屬性Properties properties = new Properties();properties.put("mail.smtp.host","smtp.exmail.qq.com");properties.put("mail.smtp.port",465);properties.put("mail.smtp.auth","true");properties.put("mail.smtp.starttls.enable","true");// 獲取郵件會話
//        Session session = Session.getInstance(properties, new Authenticator() {
//            @Override
//            protected PasswordAuthentication getPasswordAuthentication() {
//                // 填寫發送者郵箱和授權碼
//                return new PasswordAuthentication(username, password);
//            }
//        });//創建郵件內容// 創建MimeMessage對象MimeMessage message = sender.createMimeMessage();MimeMessageHelper helper = new MimeMessageHelper(message, true); // true表示支持附件helper.setFrom("249@qq.com");helper.setTo(toEmail);
//        String subject = String.valueOf(new StringBuilder(companyName).append("服務器運行狀況報表"));message.setSubject(name);// 創建一個Multipart對象,包含郵件正文和附件Multipart multipart = new MimeMultipart();// 郵件正文部分
//        MimeBodyPart messageBodyPart = new MimeBodyPart();
//        messageBodyPart.setText(name);
//        multipart.addBodyPart(messageBodyPart);// 郵件附件部分MimeBodyPart attachmentPart = new MimeBodyPart();attachmentPart.attachFile(attachmentFile);attachmentPart.setFileName(name+".docx");multipart.addBodyPart(attachmentPart);// 附加附件文件message.setContent(multipart);// 發送郵件sender.send(message);System.out.println("郵件發送成功!");}
}

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/66730.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/66730.shtml
英文地址,請注明出處:http://en.pswp.cn/web/66730.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

【22】Word:小李-高新技術企業政策?

目錄 題目? NO1.2 NO3 NO4 NO5.6 NO7.8 NO9.10 若文章中存在刪除空白行等要求&#xff0c;可以到最后來完成。注意最后一定要檢查此部分&#xff01;注意&#xff1a;大多是和事例一樣即可&#xff0c;不用一摸一樣&#xff0c;但也不要差太多。 題目 NO1.2 F12Fn&a…

自動化部署(三):項目管理平臺

一、項目管理平臺作用 幫助團隊高效規劃、執行和監控項目進度&#xff0c;確保任務按時完成并實現目標 敏捷開發&#xff1a;提供標準敏捷研發管理&#xff0c;支持Scrum 與 Kanban 規模化敏捷&#xff1a;支持大型研發團隊跨項目協同&#xff0c;實現多項目路線圖規劃和資源管…

常用集合-數據結構-MySql

目錄 java核心&#xff1a; 常用集合與數據結構: 單例集合: 雙列集合: 線程安全的集合: ConcurrentHashMap集合: HashTable集合: CopyOnWriteArrayList集合: CopyOnWriteArraySet集合: ConcurrentLinkedQueue隊列: ConcurrentSkipListMap和ConcurrentSkipListSet&…

IP屬地與視頻定位位置不一致:現象解析與影響探討

在數字化時代&#xff0c;IP屬地和視頻定位位置已成為我們獲取網絡信息、判斷內容真實性的重要依據。然而&#xff0c;有時我們會發現&#xff0c;某些視頻內容中展示的定位位置與其發布者的IP屬地并不一致。這種不一致現象引發了廣泛的關注和討論。本文旨在深入剖析IP屬地與視…

計算機畢業設計hadoop+spark股票基金推薦系統 股票基金預測系統 股票基金可視化系統 股票基金數據分析 股票基金大數據 股票基金爬蟲

溫馨提示&#xff1a;文末有 CSDN 平臺官方提供的學長聯系方式的名片&#xff01; 溫馨提示&#xff1a;文末有 CSDN 平臺官方提供的學長聯系方式的名片&#xff01; 溫馨提示&#xff1a;文末有 CSDN 平臺官方提供的學長聯系方式的名片&#xff01; 作者簡介&#xff1a;Java領…

機器學習-數據集劃分

文章目錄 一. 為什么要劃分數據集二. 數據集劃分的方法1. 留出法&#xff1a;2. 交叉驗證&#xff1a;將數據集劃分為訓練集&#xff0c;驗證集&#xff0c;測試集3. 留一法&#xff1a;4. 自助法&#xff1a; 一. 為什么要劃分數據集 為了能夠評估模型的泛化能力&#xff0c;可…

根據當前用戶的活動、當地天氣和喜歡音樂類型,然后根據這些信息來播放相應的Spotify音樂 附python代碼

這段代碼是一個Python腳本,它使用了幾個外部庫來創建一個簡單的圖形用戶界面(GUI),讓用戶根據當前用戶的活動、當地天氣和喜歡音樂類型,然后根據這些信息來播放相應的音樂。 1. **導入庫**: - `openai`:用于與OpenAI API交互(盡管在這段代碼中沒有使用)。 - `sp…

excel導入數據處理前端

dialogErrorVisible false;dialogErrorTitle ;//錯誤標題public get gridErrorOptions(): GridOptions {return {headerHeight: 30, // 表頭高度rowHeight: 30, // 行高columnDefs: [//列定義{headerName: "序號",field: "SerialNumber",width: 40,pinne…

Vue 攔截監聽原理

Vue 漸進式JavaScript 框架 學習筆記 - Vue 攔截監聽原理 目錄 攔截監聽原理 如何跟蹤變化 攔截監聽示例 觀察者 注意:vue3的變化 總結 攔截監聽原理 如何跟蹤變化 當你把一個普通的Javascript 對象傳入 Vue 實例作為data選項&#xff0c;Vue 將遍歷此對象所有的proper…

全面評測 DOCA 開發環境下的 DPU:性能表現、機器學習與金融高頻交易下的計算能力分析

本文介紹了我在 DOCA 開發環境下對 DPU 進行測評和計算能力測試的一些真實體驗和記錄。在測評過程中&#xff0c;我主要關注了 DPU 在高并發數據傳輸和深度學習場景下的表現&#xff0c;以及基本的系統性能指標&#xff0c;包括 CPU 計算、內存帶寬、多線程/多進程能力和 I/O 性…

基于JAVA的校園二手商品交易平臺的設計與開發

摘 要&#xff1a;政府政策引導與社會觀念的轉變使得國內大學生的創業意識逐漸提高&#xff0c;很多高校大學生開始自主創業。目前我國各大高校暫且還沒有較為成型的針對校內學生創業者的校園網絡服務平臺。本文首先主要是介紹了關于java語言以及web開發的相關技術&#xff0c;…

HarmonyOS Next 應用UI生成工具介紹

背景 HarmonyOS Next適配開發過程中難買難要參考之前邏輯&#xff0c;但是可能時間較長文檔不全&#xff0c;只能參考Android或iOS代碼&#xff0c;有些邏輯較重的場景還可以通過AI工具將Android 的Java代碼邏輯轉成TS完成部分復用。對于一些UI場景只能手動去寫&#xff0c;雖…

總結6..

背包問題的解決過程 在解決問題之前&#xff0c;為描述方便&#xff0c;首先定義一些變量&#xff1a;Vi表示第 i 個物品的價值&#xff0c;Wi表示第 i 個物品的體積&#xff0c;定義V(i,j)&#xff1a;當前背包容量 j&#xff0c;前 i 個物品最佳組合對應的價值&#xff0c;同…

代碼隨想錄day1

704.二分查找&#xff1a; 1.左閉右閉 int search(vector<int>& nums, int target) {int right nums.size() - 1;int left 0;while(left < right){int middle left ((right - left) >> 1);if(nums.at(middle) target){return middle;}else if(nums[m…

四級詞匯第六期

1.accomplish 完成 2.implication 暗示 3.complicated 復雜的 4.extent 范圍 5.sufficient 充足的 6.remarkable 引人注目的 7.insight 洞察 8.executive 管理的 9.overlook 俯瞰 忽略 10.urge 渴望 激勵 11.urgent 緊急的 12.accumulate 積累 13.appreciate 賞識 …

OpenHarmony OTA升級參考資料記錄

OpenHarmony 作為一個開源分布式操作系統,通過其強大的 OTA(Over-The-Air)升級能力,為開發者和廠商提供了一套靈活而安全的系統升級方案。 OTA升級方式 根據升級包的應用方式,OpenHarmony 的 OTA 升級可以分為兩種:本地升級和網絡OTA升級。 本地升級 本地升級是將已制作…

【數據結構篇】順序表 超詳細

目錄 一.順序表的定義 1.順序表的概念及結構 1.1線性表 2.順序表的分類 2.1靜態順序表 2.2動態順序表 二.動態順序表的實現 1.準備工作和注意事項 2.順序表的基本接口&#xff1a; 2.0 創建一個順序表 2.1 順序表的初始化 2.2 順序表的銷毀 2.3 順序表的打印 3.順序…

SDL2基本的繪制流程與步驟

SDL2(Simple DirectMedia Layer 2)是一個跨平臺的多媒體庫,它為游戲開發和圖形應用提供了一個簡單的接口,允許程序直接訪問音頻、鍵盤、鼠標、硬件加速的渲染等功能。在 SDL2 中,屏幕繪制的流程通常涉及到窗口的創建、渲染目標的設置、圖像的繪制、事件的處理等幾個步驟。…

上位機工作感想-2024年工作總結和來年計劃

隨著工作年限的增增長&#xff0c;發現自己越來越不喜歡在博客里面寫一些摻雜自己感想的東西了&#xff0c;或許是逐漸被工作逼得“成熟”了吧。2024年&#xff0c;學到了很多東西&#xff0c;做了很多項目&#xff0c;也幫別人解決了很多問題&#xff0c;唯獨沒有漲工資。來這…

阿里云-銀行核心系統轉型之業務建模與技術建模

業務領域建模包括業務建模和技術建模&#xff0c;整體建模流程圖如下&#xff1a; 業務建模包括業務流程建模和業務對象建模 業務流程建模&#xff1a;通過對業務流程現狀分析&#xff0c;結合目標核心系統建設能力要求&#xff0c;參考行業建 模成果&#xff0c;形成結構化的…