This commit is contained in:
van
2026-06-10 17:09:05 +08:00
parent 1f6625f296
commit e890039dea
3 changed files with 88 additions and 0 deletions

View File

@@ -17,8 +17,12 @@ import com.ruoyi.jarvis.domain.OrderRows;
import com.ruoyi.jarvis.service.IGroupRebateExcelUploadService;
import com.ruoyi.jarvis.service.impl.GroupRebateExcelImportService;
import com.ruoyi.jarvis.service.IOrderRowsService;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -50,6 +54,14 @@ import com.ruoyi.common.core.page.TableDataInfo;
public class JDOrderListController extends BaseController
{
private static final String JARVIS_JAVA_SKEY = "2192057370ef8140c201079969c956a3";
@Value("${jarvis.server.jarvis-java.base-url:http://127.0.0.1:6666}")
private String jarvisJavaBaseUrl;
@Value("${jarvis.server.jarvis-java.jd-api-path:/jd}")
private String jdApiPath;
private final IJDOrderService jdOrderService;
private final IJDOrderProfitService jdOrderProfitService;
private final IOrderRowsService orderRowsService;
@@ -749,4 +761,44 @@ public class JDOrderListController extends BaseController
}
return out;
}
/**
* 回填京粉订单 goodsInfo店铺名、商品图
* Body: { "orderIds": "352543902480387,3525433002460987" }
* 或: { "missing": true, "limit": 100 }
*/
@Log(title = "京粉订单goodsInfo回填", businessType = BusinessType.OTHER)
@PostMapping("/orderRows/backfillGoodsInfo")
public AjaxResult backfillGoodsInfo(@RequestBody Map<String, Object> body) {
try {
JSONObject param = new JSONObject();
param.put("skey", JARVIS_JAVA_SKEY);
if (body != null) {
if (body.get("orderIds") != null) {
param.put("orderIds", body.get("orderIds"));
}
if (body.get("missing") != null) {
param.put("missing", body.get("missing"));
}
if (body.get("limit") != null) {
param.put("limit", body.get("limit"));
}
}
String url = jarvisJavaBaseUrl + jdApiPath + "/backfillGoodsInfo";
String resp = HttpUtils.sendJsonPost(url, param.toJSONString());
if (StringUtils.isEmpty(resp)) {
return AjaxResult.error("Jarvis 服务无响应,请检查 jarvis.server.jarvis-java.base-url");
}
Object parsed = JSON.parse(resp);
if (parsed instanceof JSONObject) {
JSONObject obj = (JSONObject) parsed;
if (obj.containsKey("error")) {
return AjaxResult.error(String.valueOf(obj.get("error")));
}
}
return AjaxResult.success(parsed);
} catch (Exception e) {
return AjaxResult.error("回填失败: " + e.getMessage());
}
}
}