1
This commit is contained in:
@@ -2,6 +2,8 @@ package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -376,9 +378,38 @@ public class JDOrderListController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 一次性批量更新历史订单:将赔付金额大于0的订单标记为后返到账
|
||||
* 此方法只应执行一次,用于处理历史数据
|
||||
* 列表刷新后:对利润未手动的订单按规则重算,仅结果变化时落库(不解除售价/利润锁定)
|
||||
*/
|
||||
@Log(title = "JD订单同步自动利润", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/tools/sync-auto-profit")
|
||||
@SuppressWarnings("unchecked")
|
||||
public AjaxResult syncAutoProfit(@RequestBody(required = false) Map<String, Object> body) {
|
||||
if (body == null || !body.containsKey("ids")) {
|
||||
return AjaxResult.error("请传入 ids 数组");
|
||||
}
|
||||
Object raw = body.get("ids");
|
||||
if (!(raw instanceof List)) {
|
||||
return AjaxResult.error("ids 须为数组");
|
||||
}
|
||||
List<?> idList = (List<?>) raw;
|
||||
if (idList.isEmpty()) {
|
||||
Map<String, Object> empty = new HashMap<>(2);
|
||||
empty.put("updated", 0);
|
||||
return AjaxResult.success(empty);
|
||||
}
|
||||
List<Long> ids = new ArrayList<>(idList.size());
|
||||
for (Object o : idList) {
|
||||
if (o == null) {
|
||||
continue;
|
||||
}
|
||||
ids.add(((Number) o).longValue());
|
||||
}
|
||||
int n = jdOrderProfitService.syncAutoProfitIfChanged(ids);
|
||||
Map<String, Object> data = new HashMap<>(2);
|
||||
data.put("updated", n);
|
||||
return AjaxResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按 ID 批量重算售价(自动从型号配置回填)与利润(清除手动锁定后按规则计算)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user