This commit is contained in:
2025-09-26 17:05:42 +08:00
parent fcc5755dad
commit 89f600fa11
5 changed files with 62 additions and 33 deletions

View File

@@ -278,6 +278,26 @@ ipcMain.handle('install-update', async () => {
return { success: false, error: '更新文件不存在' }; 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(() => { setTimeout(() => {
downloadedFilePath = null; downloadedFilePath = null;
app.quit(); app.quit();

View File

@@ -332,19 +332,11 @@ onMounted(async () => {
<div class="step-card"> <div class="step-card">
<div class="step-header"><div class="title">获取数据</div></div> <div class="step-header"><div class="title">获取数据</div></div>
<div class="desc">导入表格后点击下方按钮开始获取ASIN数据</div> <div class="desc">导入表格后点击下方按钮开始获取ASIN数据</div>
<el-button size="small" class="w100 btn-blue" :disabled="!pendingAsins.length || loading" @click="startQueuedFetch">{{ loading ? '处理中...' : '获取数据' }}</el-button> <div class="action-buttons column">
<div class="mini-hint" v-if="pendingAsins.length">已导入 {{ pendingAsins.length }} ASIN</div> <el-button size="small" class="w100 btn-blue" :disabled="!pendingAsins.length || loading" @click="startQueuedFetch">{{ loading ? '处理中...' : '获取数据' }}</el-button>
<div class="progress-section" v-if="progressVisible"> <el-button size="small" class="w100" :disabled="!loading" @click="stopFetch">停止获取</el-button>
<div class="progress-box">
<div class="progress-container">
<div class="progress-bar">
<div class="progress-fill" :style="{ width: progressPercentage + '%' }"></div>
</div>
<div class="progress-text">{{ progressPercentage }}%</div>
</div>
</div>
</div> </div>
<!-- 左侧不再显示进度条 --> <div class="mini-hint" v-if="pendingAsins.length">已导入 {{ pendingAsins.length }} ASIN</div>
</div> </div>
</div> </div>
<!-- 4 --> <!-- 4 -->
@@ -354,10 +346,7 @@ onMounted(async () => {
<div class="step-header"><div class="title">导出数据</div></div> <div class="step-header"><div class="title">导出数据</div></div>
<div class="action-buttons column"> <div class="action-buttons column">
<el-button size="small" class="w100 btn-blue" :disabled="!localProductData.length || loading" @click="exportToExcel">导出Excel</el-button> <el-button size="small" class="w100 btn-blue" :disabled="!localProductData.length || loading" @click="exportToExcel">导出Excel</el-button>
<el-button size="small" class="w100 btn-blue" plain :disabled="!loading" @click="stopFetch">停止获取</el-button>
<el-button size="small" class="w100 btn-blue" :loading="genmaiLoading" @click="openGenmaiSpirit">{{ genmaiLoading ? '启动中...' : '跟卖精灵' }}</el-button> <el-button size="small" class="w100 btn-blue" :loading="genmaiLoading" @click="openGenmaiSpirit">{{ genmaiLoading ? '启动中...' : '跟卖精灵' }}</el-button>
</div> </div>
</div> </div>
</div> </div>
@@ -382,6 +371,20 @@ onMounted(async () => {
</template> </template>
</el-dialog> </el-dialog>
<!-- 表格上方进度条 -->
<div v-if="progressVisible" class="progress-head">
<div class="progress-section">
<div class="progress-box">
<div class="progress-container">
<div class="progress-bar">
<div class="progress-fill" :style="{ width: progressPercentage + '%' }"></div>
</div>
<div class="progress-text">{{ progressPercentage }}%</div>
</div>
</div>
</div>
</div>
<div class="table-wrapper"> <div class="table-wrapper">
<table class="table"> <table class="table">
<thead> <thead>
@@ -488,6 +491,7 @@ onMounted(async () => {
.text:disabled { background: #f5f7fa; color: #c0c4cc; } .text:disabled { background: #f5f7fa; color: #c0c4cc; }
.action-buttons { display: flex; gap: 10px; flex-wrap: wrap; } .action-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.progress-section { margin: 0px 12px 0px 12px; } .progress-section { margin: 0px 12px 0px 12px; }
.progress-head { margin-bottom: 8px; }
.progress-box { padding: 4px 0; } .progress-box { padding: 4px 0; }
.progress-container { display: flex; align-items: center; gap: 8px; } .progress-container { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 6px; background: #e3eeff; border-radius: 999px; overflow: hidden; } .progress-bar { flex: 1; height: 6px; background: #e3eeff; border-radius: 999px; overflow: hidden; }

View File

@@ -46,6 +46,8 @@ public interface RakutenProductRepository extends JpaRepository<RakutenProductEn
*/ */
List<RakutenProductEntity> findByOriginalShopNameOrderByCreatedAtAscIdAsc(String originalShopName); List<RakutenProductEntity> findByOriginalShopNameOrderByCreatedAtAscIdAsc(String originalShopName);
/** /**
* 检查指定店铺在指定时间后是否有数据 * 检查指定店铺在指定时间后是否有数据
*/ */

View File

@@ -1,6 +1,4 @@
package com.tashow.erp.service.impl; package com.tashow.erp.service.impl;
import com.alibaba.fastjson.JSON;
import com.tashow.erp.entity.RakutenProductEntity; import com.tashow.erp.entity.RakutenProductEntity;
import com.tashow.erp.model.RakutenProduct; import com.tashow.erp.model.RakutenProduct;
import com.tashow.erp.repository.RakutenProductRepository; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;

View File

@@ -81,15 +81,17 @@ public class ExcelExportUtil {
* 填充行数据 - 需要子类实现具体逻辑 * 填充行数据 - 需要子类实现具体逻辑
*/ */
private static void fillRowData(Row dataRow, Map<String, Object> rowData, String[] headers, int rowIndex) { private static void fillRowData(Row dataRow, Map<String, Object> rowData, String[] headers, int rowIndex) {
// 这里可以根据不同的数据类型进行扩展
int colIndex = 0; int colIndex = 0;
for (String header : headers) { for (String header : headers) {
if (!header.equals("商品图片")) { // 跳过图片列 if (!header.equals("商品图片")) {
String key = getKeyByHeader(header); Object value = rowData.get(header);
if (key != null) { if (value == null) {
Object value = rowData.get(key); String key = getKeyByHeader(header);
dataRow.createCell(colIndex).setCellValue(formatValue(value, header)); if (key != null) {
value = rowData.get(key);
}
} }
dataRow.createCell(colIndex).setCellValue(formatValue(value, header));
} }
colIndex++; colIndex++;
} }
@@ -121,10 +123,14 @@ public class ExcelExportUtil {
headerKeyMap.put("店铺名", "originalShopName"); headerKeyMap.put("店铺名", "originalShopName");
headerKeyMap.put("商品链接", "productUrl"); headerKeyMap.put("商品链接", "productUrl");
headerKeyMap.put("排名", "ranking"); headerKeyMap.put("排名", "ranking");
headerKeyMap.put("商品标题", "productTitle"); // 添加缺失的商品标题映射 headerKeyMap.put("商品标题", "productTitle");
headerKeyMap.put("价格", "price"); headerKeyMap.put("价格", "price");
headerKeyMap.put("1688识图链接", "image1688Url"); headerKeyMap.put("1688识图链接", "mapRecognitionLink");
headerKeyMap.put("1688价格", "median"); headerKeyMap.put("1688运费", "freight");
headerKeyMap.put("1688中位价", "median");
headerKeyMap.put("1688最低价", "1688最低价");
headerKeyMap.put("1688中间价", "1688中间价");
headerKeyMap.put("1688最高价", "1688最高价");
headerKeyMap.put("1688重量", "weight"); headerKeyMap.put("1688重量", "weight");
return headerKeyMap.get(header); return headerKeyMap.get(header);