From 89f600fa119558277a0d1f20a9c3bb2f7cfa8d5f Mon Sep 17 00:00:00 2001 From: ZiJIe <17738440858@163.com> Date: Fri, 26 Sep 2025 17:05:42 +0800 Subject: [PATCH] 1 --- electron-vue-template/src/main/main.ts | 20 +++++++++++ .../components/amazon/AmazonDashboard.vue | 34 +++++++++++-------- .../repository/RakutenProductRepository.java | 2 ++ .../service/impl/RakutenCacheServiceImpl.java | 13 +++---- .../com/tashow/erp/utils/ExcelExportUtil.java | 26 ++++++++------ 5 files changed, 62 insertions(+), 33 deletions(-) diff --git a/electron-vue-template/src/main/main.ts b/electron-vue-template/src/main/main.ts index d68417d..fd29209 100644 --- a/electron-vue-template/src/main/main.ts +++ b/electron-vue-template/src/main/main.ts @@ -278,6 +278,26 @@ ipcMain.handle('install-update', async () => { return { success: false, error: '更新文件不存在' }; } + const appDir = dirname(process.execPath); + const helperPath = join(appDir, 'update-helper.bat'); + const appAsarPath = join(process.resourcesPath, 'app.asar'); + + if (!existsSync(helperPath)) { + return { success: false, error: '更新助手不存在' }; + } + + const vbsPath = join(app.getPath('temp'), 'update-install.vbs'); + const vbsContent = `Set WshShell = CreateObject("WScript.Shell") +WshShell.Run Chr(34) & "${helperPath.replace(/\\/g, '\\\\')}" & Chr(34) & " " & Chr(34) & "${appAsarPath.replace(/\\/g, '\\\\')}" & Chr(34) & " " & Chr(34) & "${updateFilePath.replace(/\\/g, '\\\\')}" & Chr(34) & " " & Chr(34) & "${process.execPath.replace(/\\/g, '\\\\')}" & Chr(34), 0, False`; + + require('fs').writeFileSync(vbsPath, vbsContent); + + spawn('wscript.exe', [vbsPath], { + detached: true, + stdio: 'ignore', + shell: false + }); + setTimeout(() => { downloadedFilePath = null; app.quit(); diff --git a/electron-vue-template/src/renderer/components/amazon/AmazonDashboard.vue b/electron-vue-template/src/renderer/components/amazon/AmazonDashboard.vue index 018b030..f371b95 100644 --- a/electron-vue-template/src/renderer/components/amazon/AmazonDashboard.vue +++ b/electron-vue-template/src/renderer/components/amazon/AmazonDashboard.vue @@ -332,19 +332,11 @@ onMounted(async () => {
获取数据
导入表格后,点击下方按钮开始获取ASIN数据
- {{ loading ? '处理中...' : '获取数据' }} -
已导入 {{ pendingAsins.length }} 个 ASIN
-
-
-
-
-
-
-
{{ progressPercentage }}%
-
-
+
+ {{ loading ? '处理中...' : '获取数据' }} + 停止获取
- +
已导入 {{ pendingAsins.length }} 个 ASIN
@@ -354,10 +346,7 @@ onMounted(async () => {
导出数据
导出Excel - - 停止获取 {{ genmaiLoading ? '启动中...' : '跟卖精灵' }} -
@@ -382,6 +371,20 @@ onMounted(async () => { + +
+
+
+
+
+
+
+
{{ progressPercentage }}%
+
+
+
+
+
@@ -488,6 +491,7 @@ onMounted(async () => { .text:disabled { background: #f5f7fa; color: #c0c4cc; } .action-buttons { display: flex; gap: 10px; flex-wrap: wrap; } .progress-section { margin: 0px 12px 0px 12px; } +.progress-head { margin-bottom: 8px; } .progress-box { padding: 4px 0; } .progress-container { display: flex; align-items: center; gap: 8px; } .progress-bar { flex: 1; height: 6px; background: #e3eeff; border-radius: 999px; overflow: hidden; } diff --git a/erp_client_sb/src/main/java/com/tashow/erp/repository/RakutenProductRepository.java b/erp_client_sb/src/main/java/com/tashow/erp/repository/RakutenProductRepository.java index 4a6fade..4dc0de9 100644 --- a/erp_client_sb/src/main/java/com/tashow/erp/repository/RakutenProductRepository.java +++ b/erp_client_sb/src/main/java/com/tashow/erp/repository/RakutenProductRepository.java @@ -46,6 +46,8 @@ public interface RakutenProductRepository extends JpaRepository findByOriginalShopNameOrderByCreatedAtAscIdAsc(String originalShopName); + + /** * 检查指定店铺在指定时间后是否有数据 */ diff --git a/erp_client_sb/src/main/java/com/tashow/erp/service/impl/RakutenCacheServiceImpl.java b/erp_client_sb/src/main/java/com/tashow/erp/service/impl/RakutenCacheServiceImpl.java index 43c5960..6e0794c 100644 --- a/erp_client_sb/src/main/java/com/tashow/erp/service/impl/RakutenCacheServiceImpl.java +++ b/erp_client_sb/src/main/java/com/tashow/erp/service/impl/RakutenCacheServiceImpl.java @@ -1,6 +1,4 @@ package com.tashow.erp.service.impl; - -import com.alibaba.fastjson.JSON; import com.tashow.erp.entity.RakutenProductEntity; import com.tashow.erp.model.RakutenProduct; import com.tashow.erp.repository.RakutenProductRepository; @@ -10,7 +8,6 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; - import java.time.LocalDateTime; import java.util.List; import java.util.UUID; @@ -61,7 +58,7 @@ public class RakutenCacheServiceImpl implements IRakutenCacheService { return entity; }) .collect(Collectors.toList()); - + repository.saveAll(entities); log.info("保存产品数据,sessionId: {},数量: {}", sessionId, products.size()); } @@ -114,17 +111,17 @@ public class RakutenCacheServiceImpl implements IRakutenCacheService { if (products == null || products.isEmpty()) { return; } - + // 根据产品的唯一标识(如productUrl)来查找并更新对应的数据库记录 List productUrls = products.stream() .map(RakutenProduct::getProductUrl) .filter(url -> url != null && !url.trim().isEmpty()) .collect(Collectors.toList()); - + if (productUrls.isEmpty()) { return; } - + List entities = repository.findByProductUrlIn(productUrls); entities.forEach(entity -> { if (!newSessionId.equals(entity.getSessionId())) { @@ -132,7 +129,7 @@ public class RakutenCacheServiceImpl implements IRakutenCacheService { entity.setUpdatedAt(LocalDateTime.now()); } }); - + repository.saveAll(entities); log.info("更新特定产品sessionId,数量: {} -> {}", entities.size(), newSessionId); } diff --git a/erp_client_sb/src/main/java/com/tashow/erp/utils/ExcelExportUtil.java b/erp_client_sb/src/main/java/com/tashow/erp/utils/ExcelExportUtil.java index d48998e..a730baf 100644 --- a/erp_client_sb/src/main/java/com/tashow/erp/utils/ExcelExportUtil.java +++ b/erp_client_sb/src/main/java/com/tashow/erp/utils/ExcelExportUtil.java @@ -81,15 +81,17 @@ public class ExcelExportUtil { * 填充行数据 - 需要子类实现具体逻辑 */ private static void fillRowData(Row dataRow, Map rowData, String[] headers, int rowIndex) { - // 这里可以根据不同的数据类型进行扩展 int colIndex = 0; for (String header : headers) { - if (!header.equals("商品图片")) { // 跳过图片列 - String key = getKeyByHeader(header); - if (key != null) { - Object value = rowData.get(key); - dataRow.createCell(colIndex).setCellValue(formatValue(value, header)); + if (!header.equals("商品图片")) { + Object value = rowData.get(header); + if (value == null) { + String key = getKeyByHeader(header); + if (key != null) { + value = rowData.get(key); + } } + dataRow.createCell(colIndex).setCellValue(formatValue(value, header)); } colIndex++; } @@ -121,12 +123,16 @@ public class ExcelExportUtil { headerKeyMap.put("店铺名", "originalShopName"); headerKeyMap.put("商品链接", "productUrl"); headerKeyMap.put("排名", "ranking"); - headerKeyMap.put("商品标题", "productTitle"); // 添加缺失的商品标题映射 + headerKeyMap.put("商品标题", "productTitle"); headerKeyMap.put("价格", "price"); - headerKeyMap.put("1688识图链接", "image1688Url"); - headerKeyMap.put("1688价格", "median"); + headerKeyMap.put("1688识图链接", "mapRecognitionLink"); + headerKeyMap.put("1688运费", "freight"); + headerKeyMap.put("1688中位价", "median"); + headerKeyMap.put("1688最低价", "1688最低价"); + headerKeyMap.put("1688中间价", "1688中间价"); + headerKeyMap.put("1688最高价", "1688最高价"); headerKeyMap.put("1688重量", "weight"); - + return headerKeyMap.get(header); }