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: '更新文件不存在' };
}
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();

View File

@@ -332,19 +332,11 @@ onMounted(async () => {
<div class="step-card">
<div class="step-header"><div class="title">获取数据</div></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="mini-hint" v-if="pendingAsins.length">已导入 {{ pendingAsins.length }} ASIN</div>
<div class="progress-section" v-if="progressVisible">
<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 class="action-buttons column">
<el-button size="small" class="w100 btn-blue" :disabled="!pendingAsins.length || loading" @click="startQueuedFetch">{{ loading ? '处理中...' : '获取数据' }}</el-button>
<el-button size="small" class="w100" :disabled="!loading" @click="stopFetch">停止获取</el-button>
</div>
<!-- 左侧不再显示进度条 -->
<div class="mini-hint" v-if="pendingAsins.length">已导入 {{ pendingAsins.length }} ASIN</div>
</div>
</div>
<!-- 4 -->
@@ -354,10 +346,7 @@ onMounted(async () => {
<div class="step-header"><div class="title">导出数据</div></div>
<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" plain :disabled="!loading" @click="stopFetch">停止获取</el-button>
<el-button size="small" class="w100 btn-blue" :loading="genmaiLoading" @click="openGenmaiSpirit">{{ genmaiLoading ? '启动中...' : '跟卖精灵' }}</el-button>
</div>
</div>
</div>
@@ -382,6 +371,20 @@ onMounted(async () => {
</template>
</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">
<table class="table">
<thead>
@@ -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; }

View File

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

View File

@@ -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;

View File

@@ -81,15 +81,17 @@ public class ExcelExportUtil {
* 填充行数据 - 需要子类实现具体逻辑
*/
private static void fillRowData(Row dataRow, Map<String, Object> 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,10 +123,14 @@ 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);