This commit is contained in:
van
2026-06-03 12:06:43 +08:00
parent 6412168cc6
commit 67e6723685
12 changed files with 278 additions and 29 deletions

View File

@@ -32,6 +32,7 @@ import com.ruoyi.jarvis.domain.dto.JDOrderSimpleDTO;
import com.ruoyi.jarvis.domain.dto.QuickRecordModelOption;
import com.ruoyi.jarvis.domain.dto.QuickRecordModelShopOption;
import com.ruoyi.jarvis.util.QuickRecordModelShopOptionUtil;
import com.ruoyi.jarvis.service.IJDOrderModelShopService;
import com.ruoyi.jarvis.service.IJDOrderProfitService;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.jarvis.service.IJDOrderService;
@@ -58,6 +59,7 @@ public class JDOrderListController extends BaseController
private final ObjectMapper objectMapper;
private final ISysConfigService sysConfigService;
private final IJDOrderModelShopService jdOrderModelShopService;
public JDOrderListController(IJDOrderService jdOrderService, IJDOrderProfitService jdOrderProfitService,
IOrderRowsService orderRowsService,
@@ -65,7 +67,8 @@ public class JDOrderListController extends BaseController
GroupRebateExcelImportService groupRebateExcelImportService,
IGroupRebateExcelUploadService groupRebateExcelUploadService,
ObjectMapper objectMapper,
ISysConfigService sysConfigService) {
ISysConfigService sysConfigService,
IJDOrderModelShopService jdOrderModelShopService) {
this.jdOrderService = jdOrderService;
this.jdOrderProfitService = jdOrderProfitService;
this.orderRowsService = orderRowsService;
@@ -74,6 +77,7 @@ public class JDOrderListController extends BaseController
this.groupRebateExcelUploadService = groupRebateExcelUploadService;
this.objectMapper = objectMapper;
this.sysConfigService = sysConfigService;
this.jdOrderModelShopService = jdOrderModelShopService;
}
/**
@@ -196,6 +200,16 @@ public class JDOrderListController extends BaseController
return AjaxResult.success(options);
}
/**
* 一键迁移:将 model_number 末尾匹配的店铺前缀写入 model_shop并从 model_number 截掉。
* 需先配置 quickRecord.modelShopOptions。
*/
@Log(title = "JD订单型号店铺拆分迁移", businessType = BusinessType.UPDATE)
@PostMapping("/migrateModelShop")
public AjaxResult migrateModelShop() {
return AjaxResult.success(jdOrderService.migrateModelShopSplit());
}
/**
* 导入跟团返现类 Excel按「单号/订单号」匹配系统订单,将「是否返现」「总共返现」等写入后返备注(可多次导入累加);文件落盘并记上传记录。
*/
@@ -331,6 +345,7 @@ public class JDOrderListController extends BaseController
public AjaxResult edit(@RequestBody JsonNode root) throws JsonProcessingException {
JDOrder jdOrder = objectMapper.treeToValue(root, JDOrder.class);
applyExtraCostFromPayload(root, jdOrder);
jdOrderModelShopService.normalizeOrder(jdOrder);
jdOrderProfitService.recalculate(jdOrder);
jdOrder.getParams().put("applyProfitFields", Boolean.TRUE);
int rows = jdOrderService.updateJDOrder(jdOrder);
@@ -642,8 +657,8 @@ public class JDOrderListController extends BaseController
String duoduoOrderNo = o.getThirdPartyOrderNo() != null && !o.getThirdPartyOrderNo().trim().isEmpty()
? o.getThirdPartyOrderNo() : (o.getRemark() != null ? o.getRemark() : "");
// 型号
String modelNumber = o.getModelNumber() != null ? o.getModelNumber() : "";
// 型号(对外完整型号 = 本体 + 店铺前缀)
String modelNumber = QuickRecordModelShopOptionUtil.fullModelNumber(o);
// 数量固定为1
String quantity = "1";