Compare commits
85 Commits
f02de5950e
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
546cd8eb04 | ||
|
|
e890039dea | ||
|
|
1f6625f296 | ||
|
|
90e6904b5d | ||
|
|
0022a197cc | ||
|
|
8d3f1337e9 | ||
|
|
67e6723685 | ||
|
|
6412168cc6 | ||
|
|
a8a6d57a72 | ||
|
|
8f8333e324 | ||
|
|
b107eece07 | ||
|
|
8fcd7be160 | ||
|
|
4aec0177dd | ||
|
|
379a11ae63 | ||
|
|
0963b8af59 | ||
|
|
6fa6cf624e | ||
|
|
7ef9c16ae7 | ||
|
|
77776802f2 | ||
|
|
8770ea92ed | ||
|
|
0a3a9c46f6 | ||
|
|
17ec7fa131 | ||
|
|
746be8c633 | ||
|
|
46e6143a87 | ||
|
|
810625e0a9 | ||
|
|
78610826a3 | ||
|
|
37f7169147 | ||
|
|
e93b5960cb | ||
|
|
83dc41f3a5 | ||
|
|
217ea3afdc | ||
|
|
7582d22d2a | ||
|
|
30ff4077fe | ||
|
|
f4697481fa | ||
|
|
12e9598734 | ||
|
|
afd93884fa | ||
|
|
e78cc67476 | ||
|
|
6fb46cc203 | ||
|
|
7582868b2c | ||
|
|
9d03cca517 | ||
|
|
8b5abb44ee | ||
|
|
e75f71d37b | ||
|
|
5da74a155c | ||
|
|
a88600788a | ||
|
|
cf8008bdc1 | ||
|
|
d97a977a0e | ||
|
|
1f25cc5d15 | ||
|
|
66aa339906 | ||
|
|
acd693f122 | ||
|
|
751844493b | ||
|
|
256b54ffab | ||
|
|
0ff357148b | ||
|
|
7cd7440f1f | ||
|
|
f5f14c730f | ||
|
|
a7068053e1 | ||
|
|
babe687679 | ||
|
|
de335831d4 | ||
|
|
a10d561fcb | ||
|
|
656f3d28a9 | ||
|
|
e420aaeb9e | ||
|
|
01bea5005e | ||
|
|
c825c6b81a | ||
|
|
1446ea2432 | ||
|
|
52b8f13b2d | ||
|
|
94f319514e | ||
|
|
5205d8c155 | ||
|
|
fed0158444 | ||
|
|
24cf538475 | ||
|
|
c50975bce5 | ||
|
|
042068ccf1 | ||
|
|
52d0adfc85 | ||
|
|
ede30b5f36 | ||
|
|
ce3af838bd | ||
|
|
0205fe2c09 | ||
|
|
6f482256c5 | ||
|
|
31e7e6853b | ||
|
|
a2c4589046 | ||
|
|
16bcd45c63 | ||
|
|
e94f17973c | ||
|
|
c9876df3de | ||
|
|
2d4f933791 | ||
|
|
a22d17de73 | ||
|
|
9af1a369f7 | ||
|
|
49c855ff78 | ||
|
|
0838d16652 | ||
|
|
6a43af0a34 | ||
|
|
1b4a73cd25 |
7
pom.xml
7
pom.xml
@@ -35,6 +35,7 @@
|
|||||||
<logback.version>1.2.13</logback.version>
|
<logback.version>1.2.13</logback.version>
|
||||||
<spring-security.version>5.7.12</spring-security.version>
|
<spring-security.version>5.7.12</spring-security.version>
|
||||||
<spring-framework.version>5.3.39</spring-framework.version>
|
<spring-framework.version>5.3.39</spring-framework.version>
|
||||||
|
<rocketmq-spring.version>2.2.3</rocketmq-spring.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<!-- 依赖声明 -->
|
<!-- 依赖声明 -->
|
||||||
@@ -218,6 +219,12 @@
|
|||||||
<version>${ruoyi.version}</version>
|
<version>${ruoyi.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.rocketmq</groupId>
|
||||||
|
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
||||||
|
<version>${rocketmq-spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,6 +15,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|||||||
*/
|
*/
|
||||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
|
@EnableAsync
|
||||||
public class RuoYiApplication
|
public class RuoYiApplication
|
||||||
{
|
{
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.ruoyi.jarvis.wecom;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import com.ruoyi.jarvis.service.IPhoneForwardActivePush;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class PhoneForwardActivePushImpl implements IPhoneForwardActivePush {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WxSendWeComPushClient wxSendWeComPushClient;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean schedulePushChunks(String toUser, String wecomCallbackAgentId, List<String> chunks) {
|
||||||
|
return wxSendWeComPushClient.pushAfterPassiveDelaySync(toUser, wecomCallbackAgentId, chunks);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ import java.net.HttpURLConnection;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@@ -33,29 +34,83 @@ public class WxSendWeComPushClient {
|
|||||||
private String pushSecret;
|
private String pushSecret;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在被动回复返回后延迟再发,保证企微侧先出现首条被动消息。
|
* 与 {@link #scheduleActivePushes(String, String, List)} 相同顺序与延迟,但在当前线程同步执行,并返回是否全部成功。
|
||||||
|
* {@code wecomCallbackAgentId} 与回调 XML 中 AgentId 一致时须传入,便于 wxSend 选用对应应用 secret 调用 message/send。
|
||||||
*/
|
*/
|
||||||
public void scheduleActivePushes(String toUser, List<String> contents) {
|
public boolean pushAfterPassiveDelaySync(String toUser, String wecomCallbackAgentId, List<String> contents) {
|
||||||
if (!StringUtils.hasText(wxsendBaseUrl) || !StringUtils.hasText(pushSecret)
|
final String userId = toUser != null ? toUser.trim() : "";
|
||||||
|| !StringUtils.hasText(toUser) || contents == null || contents.isEmpty()) {
|
final List<String> list = contents != null ? new ArrayList<>(contents) : Collections.emptyList();
|
||||||
|
final String agentOpt = StringUtils.hasText(wecomCallbackAgentId) ? wecomCallbackAgentId.trim() : null;
|
||||||
|
|
||||||
|
if (!StringUtils.hasText(wxsendBaseUrl)) {
|
||||||
|
log.error("企微主动推送未执行:未配置 jarvis.wecom.wxsend-base-url(用户会话中收不到查询结果或报错)");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!StringUtils.hasText(pushSecret)) {
|
||||||
|
log.error("企微主动推送未执行:未配置 jarvis.wecom.push-secret");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!StringUtils.hasText(userId)) {
|
||||||
|
log.error("企微主动推送未执行:目标成员 UserID 为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
log.warn("企微主动推送未执行:推送内容为空 userId={}", userId);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(450);
|
||||||
|
String base = normalizeBase(wxsendBaseUrl);
|
||||||
|
String url = base + "/wecom/active-push";
|
||||||
|
boolean anySent = false;
|
||||||
|
boolean allOk = true;
|
||||||
|
for (String c : list) {
|
||||||
|
if (!StringUtils.hasText(c)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
anySent = true;
|
||||||
|
if (!postJson(url, userId, c.trim(), agentOpt)) {
|
||||||
|
allOk = false;
|
||||||
|
}
|
||||||
|
Thread.sleep(120);
|
||||||
|
}
|
||||||
|
if (!anySent) {
|
||||||
|
log.error("企微主动推送:无有效正文段 userId={}", userId);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!allOk) {
|
||||||
|
log.error("企微主动推送部分失败 userId={}(请检查 wxSend /wecom/active-push 与密钥)", userId);
|
||||||
|
}
|
||||||
|
return allOk;
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
log.error("企微主动推送被中断 userId={}", userId, e);
|
||||||
|
return false;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("企微主动推送异常 userId={}", userId, e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在被动回复返回后再发,保证企微侧先出现首条被动消息。
|
||||||
|
* 无分段(如「开/慢开」仅异步 TG、被动已单独回执)时不调度,避免空列表告警。
|
||||||
|
*/
|
||||||
|
public void scheduleActivePushes(String toUser, String wecomCallbackAgentId, List<String> contents) {
|
||||||
|
final String agentPass = wecomCallbackAgentId != null ? wecomCallbackAgentId.trim() : "";
|
||||||
|
final List<String> list = contents != null ? new ArrayList<>(contents) : Collections.emptyList();
|
||||||
|
if (list.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final String userId = toUser.trim();
|
final String userId = toUser != null ? toUser.trim() : "";
|
||||||
final List<String> list = new ArrayList<>(contents);
|
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
try {
|
boolean ok = pushAfterPassiveDelaySync(
|
||||||
Thread.sleep(450);
|
userId, StringUtils.hasText(agentPass) ? agentPass : null, list);
|
||||||
String base = normalizeBase(wxsendBaseUrl);
|
if (!ok) {
|
||||||
String url = base + "/wecom/active-push";
|
log.error(
|
||||||
for (String c : list) {
|
"scheduleActivePushes 未完全成功 userId={}(用户可能未收到会话内的后续分段)",
|
||||||
if (!StringUtils.hasText(c)) {
|
userId);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
postJson(url, userId, c.trim());
|
|
||||||
Thread.sleep(120);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.warn("企微主动推送任务异常 userId={} msg={}", userId, e.toString());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -68,10 +123,14 @@ public class WxSendWeComPushClient {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void postJson(String url, String toUser, String content) {
|
/** @return HTTP 2xx 且无异常时为 true */
|
||||||
|
private boolean postJson(String url, String toUser, String content, String agentIdOpt) {
|
||||||
JSONObject body = new JSONObject();
|
JSONObject body = new JSONObject();
|
||||||
body.put("toUser", toUser);
|
body.put("toUser", toUser);
|
||||||
body.put("content", content);
|
body.put("content", content);
|
||||||
|
if (StringUtils.hasText(agentIdOpt)) {
|
||||||
|
body.put("agentId", agentIdOpt.trim());
|
||||||
|
}
|
||||||
byte[] bytes = body.toJSONString().getBytes(StandardCharsets.UTF_8);
|
byte[] bytes = body.toJSONString().getBytes(StandardCharsets.UTF_8);
|
||||||
HttpURLConnection conn = null;
|
HttpURLConnection conn = null;
|
||||||
try {
|
try {
|
||||||
@@ -89,12 +148,30 @@ public class WxSendWeComPushClient {
|
|||||||
InputStream is = code >= 200 && code < 300 ? conn.getInputStream() : conn.getErrorStream();
|
InputStream is = code >= 200 && code < 300 ? conn.getInputStream() : conn.getErrorStream();
|
||||||
String resp = readAll(is);
|
String resp = readAll(is);
|
||||||
if (code < 200 || code >= 300) {
|
if (code < 200 || code >= 300) {
|
||||||
log.warn("wxSend active-push HTTP {} body={}", code, resp);
|
log.error("wxSend active-push HTTP {} url={} body={}", code, url, resp);
|
||||||
} else {
|
return false;
|
||||||
log.debug("wxSend active-push OK http={} resp={}", code, resp);
|
|
||||||
}
|
}
|
||||||
|
if (StringUtils.hasText(resp)) {
|
||||||
|
try {
|
||||||
|
JSONObject jo = JSONObject.parseObject(resp);
|
||||||
|
if (jo != null && jo.containsKey("code")) {
|
||||||
|
Integer biz = jo.getInteger("code");
|
||||||
|
if (biz != null && biz != 200) {
|
||||||
|
log.error(
|
||||||
|
"wxSend active-push 业务失败 http={} code={} msg={} body={}",
|
||||||
|
code, biz, jo.getString("msg"), resp);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception parseSkip) {
|
||||||
|
// 非 JSON 则仅以 HTTP 为准
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.debug("wxSend active-push OK http={} resp={}", code, resp);
|
||||||
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("wxSend active-push 请求失败 url={} err={}", url, e.toString());
|
log.error("wxSend active-push 请求失败 url={} err={}", url, e.toString(), e);
|
||||||
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
conn.disconnect();
|
conn.disconnect();
|
||||||
|
|||||||
@@ -1,74 +1,129 @@
|
|||||||
package com.ruoyi.web.controller.common;
|
package com.ruoyi.web.controller.common;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.erp.request.IERPAccount;
|
||||||
|
import com.ruoyi.jarvis.service.IErpGoofishOrderService;
|
||||||
|
import com.ruoyi.jarvis.service.erp.ErpAccountResolver;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开放平台回调接收端
|
* 闲管家开放平台推送回调(请在开放平台填写真实 URL)
|
||||||
* 注意:/product/receive 与 /order/receive 为示例路径,请在开放平台配置时使用你自己的正式回调地址
|
* 订单:POST .../open/callback/order/receive?appid=×tamp=&sign=
|
||||||
|
* <p>
|
||||||
|
* 成功/失败体须与《订单推送通知》OpenAPI 一致:{@code result=success|fail} + {@code msg};
|
||||||
|
* 仅当 {@code result} 为 success 时平台认为接收成功(失败最多重试 3 次;建议业务异步处理、快速返回)。
|
||||||
*/
|
*/
|
||||||
|
@Anonymous
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/open/callback")
|
@RequestMapping("/open/callback")
|
||||||
public class OpenCallbackController extends BaseController {
|
public class OpenCallbackController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ErpAccountResolver erpAccountResolver;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IErpGoofishOrderService erpGoofishOrderService;
|
||||||
|
|
||||||
@PostMapping("/product/receive")
|
@PostMapping("/product/receive")
|
||||||
public JSONObject receiveProductCallback(
|
public JSONObject receiveProductCallback(
|
||||||
@RequestParam("appid") String appid,
|
@RequestParam("appid") String appid,
|
||||||
@RequestParam(value = "timestamp", required = false) Long timestamp,
|
@RequestParam(value = "timestamp", required = false) Long timestamp,
|
||||||
|
@RequestParam(value = "seller_id", required = false) Long sellerId,
|
||||||
@RequestParam("sign") String sign,
|
@RequestParam("sign") String sign,
|
||||||
@RequestBody JSONObject body
|
@RequestBody(required = false) String rawBody
|
||||||
) {
|
) {
|
||||||
if (!verifySign(appid, timestamp, sign, body)) {
|
String normalizedBody = normalizeJsonBody(rawBody);
|
||||||
JSONObject fail = new JSONObject();
|
IERPAccount account = erpAccountResolver.resolveStrict(appid);
|
||||||
fail.put("result", "fail");
|
if (!verifyGoofishSign(account, timestamp, sellerId, sign, normalizedBody)) {
|
||||||
fail.put("msg", "签名失败");
|
return failCallback("签名失败");
|
||||||
return fail;
|
|
||||||
}
|
}
|
||||||
JSONObject ok = new JSONObject();
|
return successCallback();
|
||||||
ok.put("result", "success");
|
|
||||||
ok.put("msg", "接收成功");
|
|
||||||
return ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/order/receive")
|
@PostMapping("/order/receive")
|
||||||
public JSONObject receiveOrderCallback(
|
public JSONObject receiveOrderCallback(
|
||||||
@RequestParam("appid") String appid,
|
@RequestParam("appid") String appid,
|
||||||
@RequestParam(value = "timestamp", required = false) Long timestamp,
|
@RequestParam(value = "timestamp", required = false) Long timestamp,
|
||||||
|
@RequestParam(value = "seller_id", required = false) Long sellerId,
|
||||||
@RequestParam("sign") String sign,
|
@RequestParam("sign") String sign,
|
||||||
@RequestBody JSONObject body
|
@RequestBody(required = false) String rawBody
|
||||||
) {
|
) {
|
||||||
if (!verifySign(appid, timestamp, sign, body)) {
|
String normalizedBody = normalizeJsonBody(rawBody);
|
||||||
JSONObject fail = new JSONObject();
|
IERPAccount account = erpAccountResolver.resolveStrict(appid);
|
||||||
fail.put("result", "fail");
|
if (account == null) {
|
||||||
fail.put("msg", "签名失败");
|
return failCallback("未找到启用的 AppKey 配置");
|
||||||
return fail;
|
|
||||||
}
|
}
|
||||||
|
if (!verifyGoofishSign(account, timestamp, sellerId, sign, normalizedBody)) {
|
||||||
|
return failCallback("签名失败");
|
||||||
|
}
|
||||||
|
JSONObject body;
|
||||||
|
try {
|
||||||
|
body = "{}".equals(normalizedBody) ? new JSONObject() : JSON.parseObject(normalizedBody);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return failCallback("请求体不是合法JSON");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
erpGoofishOrderService.publishOrProcessNotify(appid, timestamp, body);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return failCallback("入队异常");
|
||||||
|
}
|
||||||
|
return successCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 与开放平台示例一致:签名字符串 = md5(appKey + "," + md5(body原文) + "," + timestamp + [,sellerId] + "," + appSecret)
|
||||||
|
* body 须与推送原文完全一致后做 MD5,不能用解析后再 toJSONString(字段顺序变化会导致验签失败)。
|
||||||
|
*/
|
||||||
|
private boolean verifyGoofishSign(IERPAccount account, Long timestamp, Long sellerId, String sign, String bodyExactForMd5) {
|
||||||
|
if (account == null || StringUtils.isEmpty(sign)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String jsonForMd5 = bodyExactForMd5 == null || bodyExactForMd5.isEmpty() ? "{}" : bodyExactForMd5;
|
||||||
|
String bodyMd5 = md5Hex(jsonForMd5);
|
||||||
|
long ts = timestamp == null ? 0L : timestamp;
|
||||||
|
String data;
|
||||||
|
if (sellerId != null) {
|
||||||
|
data = account.getApiKey() + "," + bodyMd5 + "," + ts + "," + sellerId + "," + account.getApiKeySecret();
|
||||||
|
} else {
|
||||||
|
data = account.getApiKey() + "," + bodyMd5 + "," + ts + "," + account.getApiKeySecret();
|
||||||
|
}
|
||||||
|
String local = md5Hex(data);
|
||||||
|
return StringUtils.equalsIgnoreCase(local, sign.trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String normalizeJsonBody(String rawBody) {
|
||||||
|
if (rawBody == null) {
|
||||||
|
return "{}";
|
||||||
|
}
|
||||||
|
String t = rawBody.trim();
|
||||||
|
return t.isEmpty() ? "{}" : t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 与《订单推送通知》notify_resp_ok 一致:result=success 时平台才停止重试 */
|
||||||
|
private static JSONObject successCallback() {
|
||||||
JSONObject ok = new JSONObject();
|
JSONObject ok = new JSONObject();
|
||||||
ok.put("result", "success");
|
ok.put("result", "success");
|
||||||
ok.put("msg", "接收成功");
|
ok.put("msg", "接收成功");
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean verifySign(String appid, Long timestamp, String sign, JSONObject body) {
|
/** 与 notify_resp_fail 一致:result=fail */
|
||||||
// TODO: 这里需要根据appid查出对应的 appKey/appSecret
|
private static JSONObject failCallback(String msg) {
|
||||||
// 为了示例,直接使用 ERPAccount.ACCOUNT_HUGE 的常量。生产请替换为从数据库/配置读取
|
JSONObject j = new JSONObject();
|
||||||
String appKey = "1016208368633221";
|
j.put("result", "fail");
|
||||||
String appSecret = "waLiRMgFcixLbcLjUSSwo370Hp1nBcBu";
|
j.put("msg", msg == null || msg.isEmpty() ? "处理失败" : msg);
|
||||||
|
return j;
|
||||||
String json = body == null ? "{}" : body.toJSONString();
|
|
||||||
String data = appKey + "," + md5(json) + "," + (timestamp == null ? 0 : timestamp) + "," + appSecret;
|
|
||||||
String local = md5(data);
|
|
||||||
return StringUtils.equalsIgnoreCase(local, sign);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String md5(String str) {
|
private String md5Hex(String str) {
|
||||||
try {
|
try {
|
||||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
byte[] digest = md.digest(str.getBytes(StandardCharsets.UTF_8));
|
byte[] digest = md.digest(str.getBytes(StandardCharsets.UTF_8));
|
||||||
@@ -82,5 +137,3 @@ public class OpenCallbackController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ import com.ruoyi.common.utils.StringUtils;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import com.ruoyi.erp.request.ERPAccount;
|
import com.ruoyi.erp.request.ERPAccount;
|
||||||
|
import com.ruoyi.erp.request.IERPAccount;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpOpenConfig;
|
||||||
|
import com.ruoyi.jarvis.service.IErpOpenConfigService;
|
||||||
|
import com.ruoyi.jarvis.service.erp.ErpAccountResolver;
|
||||||
import com.ruoyi.erp.request.ProductCreateRequest;
|
import com.ruoyi.erp.request.ProductCreateRequest;
|
||||||
import com.ruoyi.erp.request.ProductCategoryListQueryRequest;
|
import com.ruoyi.erp.request.ProductCategoryListQueryRequest;
|
||||||
import com.ruoyi.erp.request.ProductPropertyListQueryRequest;
|
import com.ruoyi.erp.request.ProductPropertyListQueryRequest;
|
||||||
@@ -20,6 +24,7 @@ import com.ruoyi.erp.request.ProductDownShelfRequest;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -36,13 +41,19 @@ public class ProductController extends BaseController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IOuterIdGeneratorService outerIdGeneratorService;
|
private IOuterIdGeneratorService outerIdGeneratorService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ErpAccountResolver erpAccountResolver;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IErpOpenConfigService erpOpenConfigService;
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(ProductController.class);
|
private static final Logger log = LoggerFactory.getLogger(ProductController.class);
|
||||||
|
|
||||||
@PostMapping("/createByPromotion")
|
@PostMapping("/createByPromotion")
|
||||||
public R<?> createByPromotion(@RequestBody @Validated CreateProductFromPromotionRequest req) {
|
public R<?> createByPromotion(@RequestBody @Validated CreateProductFromPromotionRequest req) {
|
||||||
try {
|
try {
|
||||||
ERPAccount account = resolveAccount(req.getAppid());
|
IERPAccount account = resolveAccount(req.getAppid());
|
||||||
// 1) 组装 ERPShop
|
// 1) 组装 ERPShop
|
||||||
ERPShop erpShop = new ERPShop();
|
ERPShop erpShop = new ERPShop();
|
||||||
erpShop.setChannelCatid(req.getChannelCatId());
|
erpShop.setChannelCatid(req.getChannelCatId());
|
||||||
@@ -143,7 +154,7 @@ public class ProductController extends BaseController {
|
|||||||
@PostMapping("/publish")
|
@PostMapping("/publish")
|
||||||
public R<?> publish(@RequestBody @Validated PublishRequest req) {
|
public R<?> publish(@RequestBody @Validated PublishRequest req) {
|
||||||
try {
|
try {
|
||||||
ERPAccount account = resolveAccount(req.getAppid());
|
IERPAccount account = resolveAccount(req.getAppid());
|
||||||
ProductPublishRequest publishRequest = new ProductPublishRequest(account);
|
ProductPublishRequest publishRequest = new ProductPublishRequest(account);
|
||||||
publishRequest.setProductId(req.getProductId());
|
publishRequest.setProductId(req.getProductId());
|
||||||
publishRequest.setUserName(req.getUserName());
|
publishRequest.setUserName(req.getUserName());
|
||||||
@@ -344,10 +355,22 @@ public class ProductController extends BaseController {
|
|||||||
String name = firstNonBlank(row.getString("user_name"), row.getString("xy_name"), row.getString("username"), row.getString("nick"));
|
String name = firstNonBlank(row.getString("user_name"), row.getString("xy_name"), row.getString("username"), row.getString("nick"));
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
String label = name;
|
String label = name;
|
||||||
for (ERPAccount a : ERPAccount.values()) {
|
List<ErpOpenConfig> cfgs = erpOpenConfigService.selectEnabledOrderBySort();
|
||||||
if (name.equals(a.getXyName())) {
|
if (cfgs != null) {
|
||||||
label = name + "(" + a.getRemark() + ")";
|
for (ErpOpenConfig c : cfgs) {
|
||||||
break;
|
if (name.equals(c.getXyUserName())) {
|
||||||
|
String r = c.getRemark() != null ? c.getRemark() : c.getAppKey();
|
||||||
|
label = name + "(" + r + ")";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (label.equals(name)) {
|
||||||
|
for (ERPAccount a : ERPAccount.values()) {
|
||||||
|
if (name.equals(a.getXyName())) {
|
||||||
|
label = name + "(" + a.getRemark() + ")";
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
options.add(new Option(name, label));
|
options.add(new Option(name, label));
|
||||||
@@ -376,20 +399,24 @@ public class ProductController extends BaseController {
|
|||||||
@GetMapping("/ERPAccount")
|
@GetMapping("/ERPAccount")
|
||||||
public R<?> erpAccounts() {
|
public R<?> erpAccounts() {
|
||||||
java.util.List<Option> list = new java.util.ArrayList<>();
|
java.util.List<Option> list = new java.util.ArrayList<>();
|
||||||
|
List<ErpOpenConfig> cfgs = erpOpenConfigService.selectEnabledOrderBySort();
|
||||||
|
if (cfgs != null) {
|
||||||
|
for (ErpOpenConfig c : cfgs) {
|
||||||
|
String label = StringUtils.isNotEmpty(c.getRemark()) ? c.getRemark() : c.getXyUserName();
|
||||||
|
if (StringUtils.isEmpty(label)) {
|
||||||
|
label = c.getAppKey();
|
||||||
|
}
|
||||||
|
list.add(new Option(c.getAppKey(), "【配置】" + label));
|
||||||
|
}
|
||||||
|
}
|
||||||
for (ERPAccount a : ERPAccount.values()) {
|
for (ERPAccount a : ERPAccount.values()) {
|
||||||
// 仅显示备注作为 label,value 仍为 appid
|
list.add(new Option(a.getApiKey(), "【内置】" + a.getRemark()));
|
||||||
list.add(new Option(a.getApiKey(), a.getRemark()));
|
|
||||||
}
|
}
|
||||||
return R.ok(list);
|
return R.ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ERPAccount resolveAccount(String appid) {
|
private IERPAccount resolveAccount(String appid) {
|
||||||
if (appid != null && !appid.isEmpty()) {
|
return erpAccountResolver.resolve(appid);
|
||||||
for (ERPAccount a : ERPAccount.values()) {
|
|
||||||
if (a.getApiKey().equals(appid)) return a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ERPAccount.ACCOUNT_HUGE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -558,7 +585,7 @@ public class ProductController extends BaseController {
|
|||||||
@PostMapping("/downShelf")
|
@PostMapping("/downShelf")
|
||||||
public R<?> downShelf(@RequestBody @Validated DownShelfRequest req) {
|
public R<?> downShelf(@RequestBody @Validated DownShelfRequest req) {
|
||||||
try {
|
try {
|
||||||
ERPAccount account = resolveAccount(req.getAppid());
|
IERPAccount account = resolveAccount(req.getAppid());
|
||||||
ProductDownShelfRequest downShelfRequest = new ProductDownShelfRequest(account);
|
ProductDownShelfRequest downShelfRequest = new ProductDownShelfRequest(account);
|
||||||
downShelfRequest.setProductId(req.getProductId());
|
downShelfRequest.setProductId(req.getProductId());
|
||||||
String resp = downShelfRequest.getResponseBody();
|
String resp = downShelfRequest.getResponseBody();
|
||||||
@@ -576,7 +603,7 @@ public class ProductController extends BaseController {
|
|||||||
@PostMapping("/batchPublish")
|
@PostMapping("/batchPublish")
|
||||||
public R<?> batchPublish(@RequestBody @Validated BatchPublishRequest req) {
|
public R<?> batchPublish(@RequestBody @Validated BatchPublishRequest req) {
|
||||||
try {
|
try {
|
||||||
ERPAccount account = resolveAccount(req.getAppid());
|
IERPAccount account = resolveAccount(req.getAppid());
|
||||||
List<Long> productIds = req.getProductIds();
|
List<Long> productIds = req.getProductIds();
|
||||||
|
|
||||||
if (productIds == null || productIds.isEmpty()) {
|
if (productIds == null || productIds.isEmpty()) {
|
||||||
@@ -651,7 +678,7 @@ public class ProductController extends BaseController {
|
|||||||
@PostMapping("/batchDownShelf")
|
@PostMapping("/batchDownShelf")
|
||||||
public R<?> batchDownShelf(@RequestBody @Validated BatchDownShelfRequest req) {
|
public R<?> batchDownShelf(@RequestBody @Validated BatchDownShelfRequest req) {
|
||||||
try {
|
try {
|
||||||
ERPAccount account = resolveAccount(req.getAppid());
|
IERPAccount account = resolveAccount(req.getAppid());
|
||||||
List<Long> productIds = req.getProductIds();
|
List<Long> productIds = req.getProductIds();
|
||||||
|
|
||||||
if (productIds == null || productIds.isEmpty()) {
|
if (productIds == null || productIds.isEmpty()) {
|
||||||
|
|||||||
@@ -0,0 +1,140 @@
|
|||||||
|
package com.ruoyi.web.controller.jarvis;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.jarvis.config.JarvisGoofishProperties;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpGoofishOrder;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpGoofishOrderEventLog;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpGoofishOrderEventLogQuery;
|
||||||
|
import com.ruoyi.jarvis.dto.GoofishShipPreviewVo;
|
||||||
|
import com.ruoyi.jarvis.service.IErpGoofishOrderService;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/jarvis/erpGoofishOrder")
|
||||||
|
public class ErpGoofishOrderController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IErpGoofishOrderService erpGoofishOrderService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private JarvisGoofishProperties goofishProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单变更日志全表检索(跨订单排查),须配置在 /{id} 之前避免歧义;对应日志标记 [goofish-order-event]
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpGoofishOrder:list')")
|
||||||
|
@GetMapping("/eventLog/list")
|
||||||
|
public TableDataInfo eventLogList(ErpGoofishOrderEventLogQuery query) {
|
||||||
|
startPage();
|
||||||
|
List<ErpGoofishOrderEventLog> list = erpGoofishOrderService.selectEventLogList(query);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpGoofishOrder:list')")
|
||||||
|
@GetMapping("/stats/rrsLogistics")
|
||||||
|
public AjaxResult rrsLogisticsStats() {
|
||||||
|
return AjaxResult.success(erpGoofishOrderService.selectRrsJdLinkedLogisticsStats());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpGoofishOrder:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(ErpGoofishOrder query) {
|
||||||
|
startPage();
|
||||||
|
List<ErpGoofishOrder> list = erpGoofishOrderService.selectList(query);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpGoofishOrder:query')")
|
||||||
|
@GetMapping("/shipPreview/{id}")
|
||||||
|
public AjaxResult shipPreview(@PathVariable Long id) {
|
||||||
|
GoofishShipPreviewVo vo = erpGoofishOrderService.shipPreview(id);
|
||||||
|
return AjaxResult.success(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpGoofishOrder:query')")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long id) {
|
||||||
|
return AjaxResult.success(erpGoofishOrderService.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpGoofishOrder:query')")
|
||||||
|
@GetMapping("/{id}/eventLogs")
|
||||||
|
public AjaxResult eventLogs(@PathVariable Long id) {
|
||||||
|
List<ErpGoofishOrderEventLog> list = erpGoofishOrderService.listEventLogsByOrderId(id);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpGoofishOrder:edit')")
|
||||||
|
@Log(title = "闲管家拉单", businessType = BusinessType.OTHER)
|
||||||
|
@PostMapping("/pull/{appKey}")
|
||||||
|
public AjaxResult pullOne(@PathVariable String appKey, @RequestParam(value = "hours", required = false) Integer hours) {
|
||||||
|
int h = hours == null ? goofishProperties.getPullLookbackHours() : hours;
|
||||||
|
int n = erpGoofishOrderService.pullOrdersForAppKey(appKey, h);
|
||||||
|
Map<String, Object> data = new LinkedHashMap<>();
|
||||||
|
data.put("processedItems", n);
|
||||||
|
data.put("lookbackHours", h);
|
||||||
|
return AjaxResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpGoofishOrder:edit')")
|
||||||
|
@Log(title = "闲管家全量拉单", businessType = BusinessType.OTHER)
|
||||||
|
@PostMapping("/pullAll")
|
||||||
|
public AjaxResult pullAll(@RequestParam(value = "hours", required = false) Integer hours) {
|
||||||
|
int h = hours == null ? goofishProperties.getPullLookbackHours() : hours;
|
||||||
|
int n = erpGoofishOrderService.pullAllEnabled(h);
|
||||||
|
Map<String, Object> data = new LinkedHashMap<>();
|
||||||
|
data.put("processedItems", n);
|
||||||
|
data.put("lookbackHours", h);
|
||||||
|
return AjaxResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpGoofishOrder:edit')")
|
||||||
|
@Log(title = "闲管家历史全量拉单", businessType = BusinessType.OTHER)
|
||||||
|
@PostMapping("/pull/{appKey}/full")
|
||||||
|
public AjaxResult pullOneFull(@PathVariable String appKey) {
|
||||||
|
int n = erpGoofishOrderService.pullOrdersForAppKeyFullHistory(appKey);
|
||||||
|
Map<String, Object> data = new LinkedHashMap<>();
|
||||||
|
data.put("processedItems", n);
|
||||||
|
data.put("pullFullHistoryDays", goofishProperties.getPullFullHistoryDays());
|
||||||
|
data.put("pullTimeChunkSeconds", goofishProperties.getPullTimeChunkSeconds());
|
||||||
|
return AjaxResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpGoofishOrder:edit')")
|
||||||
|
@Log(title = "闲管家全账号历史全量拉单", businessType = BusinessType.OTHER)
|
||||||
|
@PostMapping("/pullAll/full")
|
||||||
|
public AjaxResult pullAllFull() {
|
||||||
|
int n = erpGoofishOrderService.pullAllEnabledFullHistory();
|
||||||
|
Map<String, Object> data = new LinkedHashMap<>();
|
||||||
|
data.put("processedItems", n);
|
||||||
|
data.put("pullFullHistoryDays", goofishProperties.getPullFullHistoryDays());
|
||||||
|
data.put("pullTimeChunkSeconds", goofishProperties.getPullTimeChunkSeconds());
|
||||||
|
return AjaxResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpGoofishOrder:edit')")
|
||||||
|
@Log(title = "闲管家订单详情刷新", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/refreshDetail/{id}")
|
||||||
|
public AjaxResult refreshDetail(@PathVariable Long id) {
|
||||||
|
erpGoofishOrderService.refreshDetail(id);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpGoofishOrder:edit')")
|
||||||
|
@Log(title = "闲管家重试发货", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/retryShip/{id}")
|
||||||
|
public AjaxResult retryShip(@PathVariable Long id) {
|
||||||
|
erpGoofishOrderService.retryShip(id);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
package com.ruoyi.web.controller.jarvis;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.ruoyi.erp.request.ExpressCompaniesQueryRequest;
|
||||||
|
import com.ruoyi.erp.request.IERPAccount;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpOpenConfig;
|
||||||
|
import com.ruoyi.jarvis.service.IErpOpenConfigService;
|
||||||
|
import com.ruoyi.jarvis.service.erp.ErpAccountResolver;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/jarvis/erpOpenConfig")
|
||||||
|
public class ErpOpenConfigController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IErpOpenConfigService erpOpenConfigService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ErpAccountResolver erpAccountResolver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询闲管家快递公司列表(POST body 固定为 {},与签名规则一致)
|
||||||
|
*
|
||||||
|
* @param appKey 与配置中心一致;不传则按 {@link ErpAccountResolver#resolve(String)} 默认账号
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpOpenConfig:list')")
|
||||||
|
@GetMapping("/expressCompanies")
|
||||||
|
public AjaxResult expressCompanies(@RequestParam(required = false) String appKey) {
|
||||||
|
try {
|
||||||
|
IERPAccount cred = erpAccountResolver.resolve(appKey);
|
||||||
|
ExpressCompaniesQueryRequest req = new ExpressCompaniesQueryRequest(cred);
|
||||||
|
String resp = req.getResponseBody();
|
||||||
|
JSONObject o = JSONObject.parseObject(resp);
|
||||||
|
if (o == null) {
|
||||||
|
return AjaxResult.error("开放平台返回空");
|
||||||
|
}
|
||||||
|
if (o.getIntValue("code") != 0) {
|
||||||
|
return AjaxResult.error(o.getString("msg") != null ? o.getString("msg") : resp);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(o.get("data"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error("调用快递公司接口失败: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpOpenConfig:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(ErpOpenConfig query) {
|
||||||
|
startPage();
|
||||||
|
List<ErpOpenConfig> list = erpOpenConfigService.selectList(query);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpOpenConfig:query')")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long id) {
|
||||||
|
return AjaxResult.success(erpOpenConfigService.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpOpenConfig:add')")
|
||||||
|
@Log(title = "闲管家应用配置", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody ErpOpenConfig row) {
|
||||||
|
return toAjax(erpOpenConfigService.insert(row));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpOpenConfig:edit')")
|
||||||
|
@Log(title = "闲管家应用配置", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody ErpOpenConfig row) {
|
||||||
|
return toAjax(erpOpenConfigService.update(row));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:erpOpenConfig:remove')")
|
||||||
|
@Log(title = "闲管家应用配置", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
|
int n = 0;
|
||||||
|
if (ids != null) {
|
||||||
|
for (Long id : ids) {
|
||||||
|
n += erpOpenConfigService.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return toAjax(n);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.web.controller.jarvis;
|
package com.ruoyi.web.controller.jarvis;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -17,7 +18,9 @@ import com.ruoyi.common.core.controller.BaseController;
|
|||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.jarvis.domain.ErpProduct;
|
import com.ruoyi.jarvis.domain.ErpProduct;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpProductExportRow;
|
||||||
import com.ruoyi.jarvis.service.IErpProductService;
|
import com.ruoyi.jarvis.service.IErpProductService;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
@@ -51,12 +54,14 @@ public class ErpProductController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('jarvis:erpProduct:export')")
|
@PreAuthorize("@ss.hasPermi('jarvis:erpProduct:export')")
|
||||||
@Log(title = "闲鱼商品", businessType = BusinessType.EXPORT)
|
@Log(title = "闲鱼商品", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public AjaxResult export(ErpProduct erpProduct)
|
public void export(HttpServletResponse response, ErpProduct erpProduct)
|
||||||
{
|
{
|
||||||
List<ErpProduct> list = erpProductService.selectErpProductList(erpProduct);
|
List<ErpProduct> list = erpProductService.selectErpProductList(erpProduct);
|
||||||
ExcelUtil<ErpProduct> util = new ExcelUtil<ErpProduct>(ErpProduct.class);
|
String batchAt = DateUtils.getTime();
|
||||||
return util.exportExcel(list, "闲鱼商品数据");
|
List<ErpProductExportRow> rows = ErpProductExportRow.fromList(list, batchAt);
|
||||||
|
ExcelUtil<ErpProductExportRow> util = new ExcelUtil<ErpProductExportRow>(ErpProductExportRow.class);
|
||||||
|
util.exportExcel(response, rows, "闲鱼商品_AI明细");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ public class InstructionController extends BaseController {
|
|||||||
public AjaxResult execute(@RequestBody Map<String, Object> body) {
|
public AjaxResult execute(@RequestBody Map<String, Object> body) {
|
||||||
String cmd = body != null ? (body.get("command") != null ? String.valueOf(body.get("command")) : null) : null;
|
String cmd = body != null ? (body.get("command") != null ? String.valueOf(body.get("command")) : null) : null;
|
||||||
boolean forceGenerate = body != null && body.get("forceGenerate") != null && Boolean.parseBoolean(String.valueOf(body.get("forceGenerate")));
|
boolean forceGenerate = body != null && body.get("forceGenerate") != null && Boolean.parseBoolean(String.valueOf(body.get("forceGenerate")));
|
||||||
// 控制台入口,传递 isFromConsole=true,跳过订单查询校验
|
// 控制台入口:全量统计视角(排除后台标记不参与统计的联盟),非单个企微成员
|
||||||
java.util.List<String> result = instructionService.execute(cmd, forceGenerate, true);
|
java.util.List<String> result = instructionService.execute(cmd, forceGenerate, true, null);
|
||||||
return AjaxResult.success(result);
|
return AjaxResult.success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.ruoyi.common.utils.http.HttpUtils;
|
|||||||
import com.ruoyi.jarvis.domain.JDOrder;
|
import com.ruoyi.jarvis.domain.JDOrder;
|
||||||
import com.ruoyi.jarvis.domain.OrderRows;
|
import com.ruoyi.jarvis.domain.OrderRows;
|
||||||
import com.ruoyi.jarvis.service.IJDOrderService;
|
import com.ruoyi.jarvis.service.IJDOrderService;
|
||||||
|
import com.ruoyi.jarvis.service.ILogisticsService;
|
||||||
import com.ruoyi.jarvis.service.IOrderRowsService;
|
import com.ruoyi.jarvis.service.IOrderRowsService;
|
||||||
import com.ruoyi.jarvis.service.IGiftCouponService;
|
import com.ruoyi.jarvis.service.IGiftCouponService;
|
||||||
import com.ruoyi.jarvis.domain.GiftCoupon;
|
import com.ruoyi.jarvis.domain.GiftCoupon;
|
||||||
@@ -41,6 +42,7 @@ public class JDOrderController extends BaseController {
|
|||||||
private final IOrderRowsService orderRowsService;
|
private final IOrderRowsService orderRowsService;
|
||||||
private final IGiftCouponService giftCouponService;
|
private final IGiftCouponService giftCouponService;
|
||||||
private final ISysConfigService sysConfigService;
|
private final ISysConfigService sysConfigService;
|
||||||
|
private final ILogisticsService logisticsService;
|
||||||
private static final String CONFIG_KEY_PREFIX = "logistics.push.touser.";
|
private static final String CONFIG_KEY_PREFIX = "logistics.push.touser.";
|
||||||
private static final java.util.regex.Pattern URL_DETECT_PATTERN = java.util.regex.Pattern.compile(
|
private static final java.util.regex.Pattern URL_DETECT_PATTERN = java.util.regex.Pattern.compile(
|
||||||
"(https?://[^\\s]+)|(u\\.jd\\.com/[^\\s]+)",
|
"(https?://[^\\s]+)|(u\\.jd\\.com/[^\\s]+)",
|
||||||
@@ -53,11 +55,13 @@ public class JDOrderController extends BaseController {
|
|||||||
java.util.regex.Pattern.CASE_INSENSITIVE);
|
java.util.regex.Pattern.CASE_INSENSITIVE);
|
||||||
|
|
||||||
public JDOrderController(IJDOrderService jdOrderService, IOrderRowsService orderRowsService,
|
public JDOrderController(IJDOrderService jdOrderService, IOrderRowsService orderRowsService,
|
||||||
IGiftCouponService giftCouponService, ISysConfigService sysConfigService) {
|
IGiftCouponService giftCouponService, ISysConfigService sysConfigService,
|
||||||
|
ILogisticsService logisticsService) {
|
||||||
this.jdOrderService = jdOrderService;
|
this.jdOrderService = jdOrderService;
|
||||||
this.orderRowsService = orderRowsService;
|
this.orderRowsService = orderRowsService;
|
||||||
this.giftCouponService = giftCouponService;
|
this.giftCouponService = giftCouponService;
|
||||||
this.sysConfigService = sysConfigService;
|
this.sysConfigService = sysConfigService;
|
||||||
|
this.logisticsService = logisticsService;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static String skey = "2192057370ef8140c201079969c956a3";
|
private final static String skey = "2192057370ef8140c201079969c956a3";
|
||||||
@@ -68,12 +72,6 @@ public class JDOrderController extends BaseController {
|
|||||||
@Value("${jarvis.server.jarvis-java.jd-api-path:/jd}")
|
@Value("${jarvis.server.jarvis-java.jd-api-path:/jd}")
|
||||||
private String jdApiPath;
|
private String jdApiPath;
|
||||||
|
|
||||||
@Value("${jarvis.server.logistics.base-url:http://127.0.0.1:5001}")
|
|
||||||
private String logisticsBaseUrl;
|
|
||||||
|
|
||||||
@Value("${jarvis.server.logistics.fetch-path:/fetch_logistics}")
|
|
||||||
private String logisticsFetchPath;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取JD接口请求URL
|
* 获取JD接口请求URL
|
||||||
*/
|
*/
|
||||||
@@ -947,9 +945,7 @@ public class JDOrderController extends BaseController {
|
|||||||
logger.info("手动获取物流信息 - 订单ID: {}, 订单号: {}, 分销标识: {}, 物流链接: {}",
|
logger.info("手动获取物流信息 - 订单ID: {}, 订单号: {}, 分销标识: {}, 物流链接: {}",
|
||||||
orderId, order.getOrderId(), distributionMark, logisticsLink);
|
orderId, order.getOrderId(), distributionMark, logisticsLink);
|
||||||
|
|
||||||
// 构建外部接口URL
|
String externalUrl = logisticsService.buildFetchLogisticsRequestUrl(logisticsLink);
|
||||||
String externalUrl = logisticsBaseUrl + logisticsFetchPath + "?tracking_url=" +
|
|
||||||
java.net.URLEncoder.encode(logisticsLink, "UTF-8");
|
|
||||||
|
|
||||||
logger.info("准备调用外部接口 - URL: {}", externalUrl);
|
logger.info("准备调用外部接口 - URL: {}", externalUrl);
|
||||||
|
|
||||||
@@ -1057,22 +1053,30 @@ public class JDOrderController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 构建配置键名
|
String trimmed = distributionMark.trim();
|
||||||
String configKey = CONFIG_KEY_PREFIX + distributionMark.trim();
|
String configKey = CONFIG_KEY_PREFIX + trimmed;
|
||||||
|
|
||||||
// 从系统配置中获取接收人列表
|
|
||||||
String configValue = sysConfigService.selectConfigByKey(configKey);
|
String configValue = sysConfigService.selectConfigByKey(configKey);
|
||||||
|
|
||||||
if (StringUtils.hasText(configValue)) {
|
if (StringUtils.hasText(configValue)) {
|
||||||
// 清理配置值(去除空格)
|
|
||||||
String touser = configValue.trim().replaceAll(",\\s+", ",");
|
String touser = configValue.trim().replaceAll(",\\s+", ",");
|
||||||
logger.info("从配置获取接收人列表 - 分销标识: {}, 配置键: {}, 接收人: {}",
|
logger.info("从配置获取接收人列表 - 分销标识: {}, 配置键: {}, 接收人: {}",
|
||||||
distributionMark, configKey, touser);
|
distributionMark, configKey, touser);
|
||||||
return touser;
|
return touser;
|
||||||
} else {
|
|
||||||
logger.debug("未找到接收人配置 - 分销标识: {}, 配置键: {}", distributionMark, configKey);
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
if (trimmed.startsWith("F-") || "F".equals(trimmed)) {
|
||||||
|
if (!trimmed.equals("F")) {
|
||||||
|
String fallbackKey = CONFIG_KEY_PREFIX + "F";
|
||||||
|
String fallbackVal = sysConfigService.selectConfigByKey(fallbackKey);
|
||||||
|
if (StringUtils.hasText(fallbackVal)) {
|
||||||
|
String touser = fallbackVal.trim().replaceAll(",\\s+", ",");
|
||||||
|
logger.info("从配置获取接收人列表(F 系回退) - 分销标识: {}, 配置键: {}, 接收人: {}",
|
||||||
|
distributionMark, fallbackKey, touser);
|
||||||
|
return touser;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.debug("未找到接收人配置 - 分销标识: {}, 配置键: {}", distributionMark, configKey);
|
||||||
|
return null;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("获取接收人配置失败 - 分销标识: {}, 错误: {}", distributionMark, e.getMessage(), e);
|
logger.error("获取接收人配置失败 - 分销标识: {}, 错误: {}", distributionMark, e.getMessage(), e);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -178,6 +178,8 @@ public class OrderRowsController extends BaseController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建统计数据。
|
* 构建统计数据。
|
||||||
|
* <p>汇总口径:{@code totalCommission} 为预估佣金合计,排除取消单(validCode=3);{@code totalActualFee} 为实际佣金,仅统计已完成(validCode=17);
|
||||||
|
* {@code estimatePaidPending} 为已付款待收货(validCode=16)的预估佣金,与分组 {@code paid} 一致。</p>
|
||||||
* @param forList true=与列表同数据源(不排除 isCount=0),保证总订单数与分页一致;false=独立统计(排除 isCount=0)
|
* @param forList true=与列表同数据源(不排除 isCount=0),保证总订单数与分页一致;false=独立统计(排除 isCount=0)
|
||||||
*/
|
*/
|
||||||
private Map<String, Object> buildStatistics(OrderRows orderRows, Date beginTime, Date endTime, boolean forList) {
|
private Map<String, Object> buildStatistics(OrderRows orderRows, Date beginTime, Date endTime, boolean forList) {
|
||||||
@@ -209,7 +211,7 @@ public class OrderRowsController extends BaseController
|
|||||||
groupStats.put("cancel", createGroupStat("取消", "cancel"));
|
groupStats.put("cancel", createGroupStat("取消", "cancel"));
|
||||||
groupStats.put("invalid", createGroupStat("无效", "invalid"));
|
groupStats.put("invalid", createGroupStat("无效", "invalid"));
|
||||||
groupStats.put("pending", createGroupStat("待付款", "pending"));
|
groupStats.put("pending", createGroupStat("待付款", "pending"));
|
||||||
groupStats.put("paid", createGroupStat("已付款", "paid"));
|
groupStats.put("paid", createGroupStat("已付款(待结算)", "paid"));
|
||||||
groupStats.put("finished", createGroupStat("已完成", "finished"));
|
groupStats.put("finished", createGroupStat("已完成", "finished"));
|
||||||
groupStats.put("deposit", createGroupStat("已付定金", "deposit"));
|
groupStats.put("deposit", createGroupStat("已付定金", "deposit"));
|
||||||
groupStats.put("illegal", createGroupStat("违规", "illegal"));
|
groupStats.put("illegal", createGroupStat("违规", "illegal"));
|
||||||
@@ -263,8 +265,14 @@ public class OrderRowsController extends BaseController
|
|||||||
actualFeeAmount = row.getActualFee() != null ? row.getActualFee() : 0;
|
actualFeeAmount = row.getActualFee() != null ? row.getActualFee() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
totalCommission += commissionAmount;
|
// 顶部「预估佣金」汇总:排除取消单(validCode=3),其余状态累加单条 commissionAmount
|
||||||
totalActualFee += actualFeeAmount;
|
if (!"3".equals(validCode)) {
|
||||||
|
totalCommission += commissionAmount;
|
||||||
|
}
|
||||||
|
// 顶部「实际佣金」汇总:仅已完成(validCode=17),与联盟「已结算」口径一致
|
||||||
|
if ("17".equals(validCode)) {
|
||||||
|
totalActualFee += actualFeeAmount;
|
||||||
|
}
|
||||||
|
|
||||||
if (validCode != null) {
|
if (validCode != null) {
|
||||||
for (Map.Entry<String, List<String>> group : groups.entrySet()) {
|
for (Map.Entry<String, List<String>> group : groups.entrySet()) {
|
||||||
@@ -290,6 +298,8 @@ public class OrderRowsController extends BaseController
|
|||||||
result.put("totalCosPrice", totalCosPrice);
|
result.put("totalCosPrice", totalCosPrice);
|
||||||
result.put("totalCommission", totalCommission);
|
result.put("totalCommission", totalCommission);
|
||||||
result.put("totalActualFee", totalActualFee);
|
result.put("totalActualFee", totalActualFee);
|
||||||
|
// 已付款待结算:与分组 paid 的预估佣金口径一致,便于独立展示卡片
|
||||||
|
result.put("estimatePaidPending", (Double) groupStats.get("paid").get("commission"));
|
||||||
result.put("totalSkuNum", totalSkuNum);
|
result.put("totalSkuNum", totalSkuNum);
|
||||||
result.put("violationOrders", violationOrders);
|
result.put("violationOrders", violationOrders);
|
||||||
result.put("violationCommission", violationCommission);
|
result.put("violationCommission", violationCommission);
|
||||||
|
|||||||
@@ -297,9 +297,7 @@ public class SocialMediaController extends BaseController
|
|||||||
public AjaxResult generateXianyuWenan(@RequestBody Map<String, Object> request)
|
public AjaxResult generateXianyuWenan(@RequestBody Map<String, Object> request)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
String title = (String) request.get("title");
|
Map<String, Object> result = socialMediaService.generateXianyuWenan(request);
|
||||||
String remark = (String) request.get("remark");
|
|
||||||
Map<String, Object> result = socialMediaService.generateXianyuWenan(title, remark);
|
|
||||||
if (Boolean.TRUE.equals(result.get("success"))) {
|
if (Boolean.TRUE.equals(result.get("success"))) {
|
||||||
return AjaxResult.success(result);
|
return AjaxResult.success(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ public class TencentDocController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private com.ruoyi.jarvis.service.ITencentDocDelayedPushService delayedPushService;
|
private com.ruoyi.jarvis.service.ITencentDocDelayedPushService delayedPushService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private com.ruoyi.jarvis.wecom.WxSendGoofishNotifyClient wxSendGoofishNotifyClient;
|
||||||
|
|
||||||
/** 单次请求最大行数(腾讯文档 API:行数≤1000) */
|
/** 单次请求最大行数(腾讯文档 API:行数≤1000) */
|
||||||
private static final int API_MAX_ROWS_PER_REQUEST = 200;
|
private static final int API_MAX_ROWS_PER_REQUEST = 200;
|
||||||
/** 用 rowTotal 时接口实际单次只能读 200 行 */
|
/** 用 rowTotal 时接口实际单次只能读 200 行 */
|
||||||
@@ -596,7 +599,8 @@ public class TencentDocController extends BaseController {
|
|||||||
if (cell.containsKey("cellValue")) {
|
if (cell.containsKey("cellValue")) {
|
||||||
String cellText = cell.getJSONObject("cellValue").getString("text");
|
String cellText = cell.getJSONObject("cellValue").getString("text");
|
||||||
if (cellText != null) {
|
if (cellText != null) {
|
||||||
if (cellText.contains("单号")) {
|
// 「物流单号」也含「单号」,须排除,否则会误把物流列当成单号列
|
||||||
|
if (cellText.contains("单号") && !cellText.contains("物流")) {
|
||||||
orderNoColumn = i;
|
orderNoColumn = i;
|
||||||
} else if (cellText.contains("物流")) {
|
} else if (cellText.contains("物流")) {
|
||||||
logisticsColumn = i;
|
logisticsColumn = i;
|
||||||
@@ -608,7 +612,7 @@ public class TencentDocController extends BaseController {
|
|||||||
if (orderNoColumn == -1 || logisticsColumn == -1) {
|
if (orderNoColumn == -1 || logisticsColumn == -1) {
|
||||||
logOperation(null, fileId, sheetId, "WRITE_SINGLE", thirdPartyOrderNo, null, logisticsLink,
|
logOperation(null, fileId, sheetId, "WRITE_SINGLE", thirdPartyOrderNo, null, logisticsLink,
|
||||||
"FAILED", "未找到'单号'或'物流'列");
|
"FAILED", "未找到'单号'或'物流'列");
|
||||||
return AjaxResult.error("未找到'单号'或'物流'列,请检查表头配置");
|
return AjaxResult.error("未找到「单号/客户单号/第三方单号」或「物流」列,请检查表头配置");
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("表头解析完成 - 单号列: {}, 物流列: {}", orderNoColumn, logisticsColumn);
|
log.info("表头解析完成 - 单号列: {}, 物流列: {}", orderNoColumn, logisticsColumn);
|
||||||
@@ -896,6 +900,56 @@ public class TencentDocController extends BaseController {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量同步中出现报错时,将摘要推送到企业微信(wxSend 闲鱼应用通道)
|
||||||
|
*/
|
||||||
|
private void pushTencentDocRowErrorsToWeCom(String batchId, String fileId, String sheetId,
|
||||||
|
int filledCount, int skippedCount, int errorCount,
|
||||||
|
List<Map<String, Object>> errorLogs) {
|
||||||
|
if (errorCount <= 0 && (errorLogs == null || errorLogs.isEmpty())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("【腾讯文档推送】同步存在报错\n");
|
||||||
|
if (batchId != null && !batchId.isEmpty()) {
|
||||||
|
sb.append("批次: ").append(batchId).append("\n");
|
||||||
|
}
|
||||||
|
if (fileId != null && !fileId.isEmpty()) {
|
||||||
|
sb.append("fileId: ").append(fileId).append("\n");
|
||||||
|
}
|
||||||
|
if (sheetId != null && !sheetId.isEmpty()) {
|
||||||
|
sb.append("sheetId: ").append(sheetId).append("\n");
|
||||||
|
}
|
||||||
|
sb.append(String.format("成功队列: %d, 跳过: %d, 错误: %d\n", filledCount, skippedCount, errorCount));
|
||||||
|
if (errorLogs != null && !errorLogs.isEmpty()) {
|
||||||
|
int max = Math.min(15, errorLogs.size());
|
||||||
|
for (int i = 0; i < max; i++) {
|
||||||
|
Map<String, Object> el = errorLogs.get(i);
|
||||||
|
Object on = el != null ? el.get("orderNo") : null;
|
||||||
|
Object row = el != null ? el.get("row") : null;
|
||||||
|
Object em = el != null ? el.get("errorMessage") : null;
|
||||||
|
Object et = el != null ? el.get("errorType") : null;
|
||||||
|
sb.append(String.format("%d. 单号:%s 行:%s", i + 1,
|
||||||
|
on != null ? on : "-", row != null ? row : "-"));
|
||||||
|
if (et != null && String.valueOf(et).length() > 0) {
|
||||||
|
sb.append(" ").append(et);
|
||||||
|
}
|
||||||
|
sb.append("\n");
|
||||||
|
if (em != null) {
|
||||||
|
String msg = String.valueOf(em);
|
||||||
|
if (msg.length() > 120) {
|
||||||
|
msg = msg.substring(0, 119) + "…";
|
||||||
|
}
|
||||||
|
sb.append(" ").append(msg).append("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (errorLogs.size() > max) {
|
||||||
|
sb.append("… 共 ").append(errorLogs.size()).append(" 条错误\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wxSendGoofishNotifyClient.pushGoofishAgentText(null, "", sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合并同一行的腾讯文档填充任务(物流更新与仅补京东单号合并为一次 batchUpdate)
|
* 合并同一行的腾讯文档填充任务(物流更新与仅补京东单号合并为一次 batchUpdate)
|
||||||
*/
|
*/
|
||||||
@@ -938,6 +992,7 @@ public class TencentDocController extends BaseController {
|
|||||||
@Anonymous
|
@Anonymous
|
||||||
@PostMapping("/fillLogisticsByOrderNo")
|
@PostMapping("/fillLogisticsByOrderNo")
|
||||||
public AjaxResult fillLogisticsByOrderNo(@RequestBody Map<String, Object> params) {
|
public AjaxResult fillLogisticsByOrderNo(@RequestBody Map<String, Object> params) {
|
||||||
|
String batchId = null;
|
||||||
try {
|
try {
|
||||||
// 直接尝试刷新token(如果失败,说明需要首次授权)
|
// 直接尝试刷新token(如果失败,说明需要首次授权)
|
||||||
String accessToken;
|
String accessToken;
|
||||||
@@ -955,7 +1010,7 @@ public class TencentDocController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 从参数获取批次ID(如果是批量调用会传入)
|
// 从参数获取批次ID(如果是批量调用会传入)
|
||||||
String batchId = params.get("batchId") != null ? String.valueOf(params.get("batchId")) : null;
|
batchId = params.get("batchId") != null ? String.valueOf(params.get("batchId")) : null;
|
||||||
|
|
||||||
// 从参数或配置中获取文档信息
|
// 从参数或配置中获取文档信息
|
||||||
String fileId = (String) params.get("fileId");
|
String fileId = (String) params.get("fileId");
|
||||||
@@ -1056,7 +1111,7 @@ public class TencentDocController extends BaseController {
|
|||||||
return AjaxResult.error("无法识别表头,表头数据为空");
|
return AjaxResult.error("无法识别表头,表头数据为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 列名须与表格完全一致(仅忽略首尾空白、不间断空格等):备注、是否安排、物流单号、下单电话、标记、京东下单订单号;另需「单号」或「第三方单号」
|
// 列名须与表格完全一致(仅忽略首尾空白、不间断空格等):备注、是否安排、物流单号、下单电话、标记、京东下单订单号;另需「单号」「客户单号」或「第三方单号」之一
|
||||||
log.info("开始识别表头列(完全匹配列名),共 {} 列", headerRowData.size());
|
log.info("开始识别表头列(完全匹配列名),共 {} 列", headerRowData.size());
|
||||||
for (int i = 0; i < headerRowData.size(); i++) {
|
for (int i = 0; i < headerRowData.size(); i++) {
|
||||||
String cellValue = headerRowData.getString(i);
|
String cellValue = headerRowData.getString(i);
|
||||||
@@ -1074,6 +1129,10 @@ public class TencentDocController extends BaseController {
|
|||||||
orderNoColumn = i;
|
orderNoColumn = i;
|
||||||
log.info("✓ 列名完全匹配「单号」:第 {} 列(索引{})", i + 1, i);
|
log.info("✓ 列名完全匹配「单号」:第 {} 列(索引{})", i + 1, i);
|
||||||
}
|
}
|
||||||
|
if (orderNoColumn == null && TencentDocDataParser.headerEquals(cellValue, "客户单号")) {
|
||||||
|
orderNoColumn = i;
|
||||||
|
log.info("\u2713 列名完全匹配「客户单号」:第 {} 列(索引{})", i + 1, i);
|
||||||
|
}
|
||||||
if (orderNoColumn == null && TencentDocDataParser.headerEquals(cellValue, "第三方单号")) {
|
if (orderNoColumn == null && TencentDocDataParser.headerEquals(cellValue, "第三方单号")) {
|
||||||
orderNoColumn = i;
|
orderNoColumn = i;
|
||||||
log.info("✓ 列名完全匹配「第三方单号」:第 {} 列(索引{})", i + 1, i);
|
log.info("✓ 列名完全匹配「第三方单号」:第 {} 列(索引{})", i + 1, i);
|
||||||
@@ -1107,7 +1166,7 @@ public class TencentDocController extends BaseController {
|
|||||||
|
|
||||||
// 检查必需的列是否都已识别
|
// 检查必需的列是否都已识别
|
||||||
if (orderNoColumn == null) {
|
if (orderNoColumn == null) {
|
||||||
return AjaxResult.error("无法找到列名完全为「单号」或「第三方单号」的列(请与表格列名一致,勿加空格或后缀)");
|
return AjaxResult.error("无法找到列名完全为「单号」「客户单号」或「第三方单号」的列(请与表格列名一致,勿加空格或后缀)");
|
||||||
}
|
}
|
||||||
if (logisticsLinkColumn == null) {
|
if (logisticsLinkColumn == null) {
|
||||||
return AjaxResult.error("无法找到列名完全为「物流单号」的列(兼容「物流链接」);请与表格列名一致");
|
return AjaxResult.error("无法找到列名完全为「物流单号」的列(兼容「物流链接」);请与表格列名一致");
|
||||||
@@ -1400,7 +1459,7 @@ public class TencentDocController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 根据第三方单号查询订单
|
// 根据第三方单号查询订单(与文档「单号/客户单号/第三方单号」列单元格一致)
|
||||||
JDOrder order = jdOrderService.selectJDOrderByThirdPartyOrderNo(orderNo);
|
JDOrder order = jdOrderService.selectJDOrderByThirdPartyOrderNo(orderNo);
|
||||||
|
|
||||||
if (order == null) {
|
if (order == null) {
|
||||||
@@ -1920,7 +1979,7 @@ public class TencentDocController extends BaseController {
|
|||||||
if (errorCount > 0 && successUpdates == 0) {
|
if (errorCount > 0 && successUpdates == 0) {
|
||||||
status = "FAILED";
|
status = "FAILED";
|
||||||
} else if (errorCount > 0) {
|
} else if (errorCount > 0) {
|
||||||
status = "PARTIAL_SUCCESS";
|
status = "PARTIAL";
|
||||||
}
|
}
|
||||||
batchPushService.updateBatchPushRecord(batchId, status, successUpdates, skippedCount, errorCount,
|
batchPushService.updateBatchPushRecord(batchId, status, successUpdates, skippedCount, errorCount,
|
||||||
message, null);
|
message, null);
|
||||||
@@ -1948,7 +2007,21 @@ public class TencentDocController extends BaseController {
|
|||||||
return AjaxResult.success("填充物流链接完成", result);
|
return AjaxResult.success("填充物流链接完成", result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("填充物流链接失败", e);
|
log.error("填充物流链接失败", e);
|
||||||
return AjaxResult.error("填充物流链接失败: " + e.getMessage());
|
String errMsg = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName();
|
||||||
|
if (batchId != null && !batchId.trim().isEmpty()) {
|
||||||
|
try {
|
||||||
|
batchPushService.updateBatchPushRecord(batchId, "FAILED", 0, 0, 0, null, errMsg);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("异常后更新批量推送记录失败 batchId={}", batchId, ex);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
wxSendGoofishNotifyClient.pushGoofishAgentText(null, "",
|
||||||
|
"【腾讯文档推送】批量同步异常\n批次: " + batchId + "\n" + errMsg);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.warn("腾讯文档推送异常企微通知失败: {}", ex.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AjaxResult.error("填充物流链接失败: " + errMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2093,6 +2166,10 @@ public class TencentDocController extends BaseController {
|
|||||||
String fileId = tencentDocConfig.getFileId();
|
String fileId = tencentDocConfig.getFileId();
|
||||||
String sheetId = tencentDocConfig.getSheetId();
|
String sheetId = tencentDocConfig.getSheetId();
|
||||||
|
|
||||||
|
if (fileId != null && !fileId.trim().isEmpty()) {
|
||||||
|
batchPushService.reconcileStaleRunningRecords(fileId);
|
||||||
|
}
|
||||||
|
|
||||||
if (fileId != null && sheetId != null) {
|
if (fileId != null && sheetId != null) {
|
||||||
com.ruoyi.jarvis.domain.TencentDocBatchPushRecord lastSuccess =
|
com.ruoyi.jarvis.domain.TencentDocBatchPushRecord lastSuccess =
|
||||||
batchPushService.getLastSuccessRecord(fileId, sheetId);
|
batchPushService.getLastSuccessRecord(fileId, sheetId);
|
||||||
@@ -2239,6 +2316,10 @@ public class TencentDocController extends BaseController {
|
|||||||
orderNoColumn = i;
|
orderNoColumn = i;
|
||||||
log.info("✓ 列名完全匹配「单号」:第 {} 列(索引{})", i + 1, i);
|
log.info("✓ 列名完全匹配「单号」:第 {} 列(索引{})", i + 1, i);
|
||||||
}
|
}
|
||||||
|
if (orderNoColumn == null && TencentDocDataParser.headerEquals(cellValue, "客户单号")) {
|
||||||
|
orderNoColumn = i;
|
||||||
|
log.info("\u2713 列名完全匹配「客户单号」:第 {} 列(索引{})", i + 1, i);
|
||||||
|
}
|
||||||
if (orderNoColumn == null && TencentDocDataParser.headerEquals(cellValue, "第三方单号")) {
|
if (orderNoColumn == null && TencentDocDataParser.headerEquals(cellValue, "第三方单号")) {
|
||||||
orderNoColumn = i;
|
orderNoColumn = i;
|
||||||
log.info("✓ 列名完全匹配「第三方单号」:第 {} 列(索引{})", i + 1, i);
|
log.info("✓ 列名完全匹配「第三方单号」:第 {} 列(索引{})", i + 1, i);
|
||||||
@@ -2254,7 +2335,7 @@ public class TencentDocController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (orderNoColumn == null || logisticsLinkColumn == null) {
|
if (orderNoColumn == null || logisticsLinkColumn == null) {
|
||||||
return AjaxResult.error("无法识别表头列,请确保存在列名完全为「单号」或「第三方单号」,以及「物流单号」(或「物流链接」)");
|
return AjaxResult.error("无法识别表头列,请确保存在列名完全为「单号」「客户单号」或「第三方单号」,以及「物流单号」(或「物流链接」)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 统计结果
|
// 统计结果
|
||||||
@@ -2543,6 +2624,10 @@ public class TencentDocController extends BaseController {
|
|||||||
orderNoColumn = i;
|
orderNoColumn = i;
|
||||||
log.info("✓ 列名完全匹配「单号」:第 {} 列(索引{})", i + 1, i);
|
log.info("✓ 列名完全匹配「单号」:第 {} 列(索引{})", i + 1, i);
|
||||||
}
|
}
|
||||||
|
if (orderNoColumn == null && TencentDocDataParser.headerEquals(cellValue, "客户单号")) {
|
||||||
|
orderNoColumn = i;
|
||||||
|
log.info("\u2713 列名完全匹配「客户单号」:第 {} 列(索引{})", i + 1, i);
|
||||||
|
}
|
||||||
if (orderNoColumn == null && TencentDocDataParser.headerEquals(cellValue, "第三方单号")) {
|
if (orderNoColumn == null && TencentDocDataParser.headerEquals(cellValue, "第三方单号")) {
|
||||||
orderNoColumn = i;
|
orderNoColumn = i;
|
||||||
log.info("✓ 列名完全匹配「第三方单号」:第 {} 列(索引{})", i + 1, i);
|
log.info("✓ 列名完全匹配「第三方单号」:第 {} 列(索引{})", i + 1, i);
|
||||||
@@ -2558,7 +2643,7 @@ public class TencentDocController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (orderNoColumn == null || logisticsLinkColumn == null) {
|
if (orderNoColumn == null || logisticsLinkColumn == null) {
|
||||||
return AjaxResult.error("无法识别表头列,请确保存在列名完全为「单号」或「第三方单号」,以及「物流单号」(或「物流链接」)");
|
return AjaxResult.error("无法识别表头列,请确保存在列名完全为「单号」「客户单号」或「第三方单号」,以及「物流单号」(或「物流链接」)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 统计结果
|
// 统计结果
|
||||||
@@ -2650,11 +2735,10 @@ public class TencentDocController extends BaseController {
|
|||||||
String cleanedLogisticsLink = cleanLogisticsLink(logisticsLinkFromDoc);
|
String cleanedLogisticsLink = cleanLogisticsLink(logisticsLinkFromDoc);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 通过第三方单号查找本地订单
|
// 通过第三方单号查找本地订单;找不到再按内部单号(remark)
|
||||||
JDOrder order = jdOrderService.selectJDOrderByThirdPartyOrderNo(orderNoFromDoc.trim());
|
JDOrder order = jdOrderService.selectJDOrderByThirdPartyOrderNo(orderNoFromDoc.trim());
|
||||||
|
|
||||||
if (order == null) {
|
if (order == null) {
|
||||||
// 如果通过第三方单号找不到,尝试通过内部单号(remark)查找
|
|
||||||
order = jdOrderService.selectJDOrderByRemark(orderNoFromDoc.trim());
|
order = jdOrderService.selectJDOrderByRemark(orderNoFromDoc.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3080,6 +3164,14 @@ public class TencentDocController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errorCount > 0 || (errorLogs != null && !errorLogs.isEmpty())) {
|
||||||
|
try {
|
||||||
|
pushTencentDocRowErrorsToWeCom(batchId, fileId, sheetId, filledCount, skippedCount, errorCount, errorLogs);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.warn("腾讯文档报错企微推送失败: {}", ex.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 构建请求体
|
// 构建请求体
|
||||||
JSONObject requestBody = new JSONObject();
|
JSONObject requestBody = new JSONObject();
|
||||||
requestBody.put("title", "腾讯文档同步成功");
|
requestBody.put("title", "腾讯文档同步成功");
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package com.ruoyi.web.controller.jarvis;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.jarvis.domain.TgScalperPhone;
|
||||||
|
import com.ruoyi.jarvis.service.ITgScalperPhoneService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TG 管理 - 黄牛电话库
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/jarvis/tgScalperPhone")
|
||||||
|
public class TgScalperPhoneController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ITgScalperPhoneService tgScalperPhoneService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:tg:scalperPhone:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(TgScalperPhone q)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<TgScalperPhone> list = tgScalperPhoneService.selectTgScalperPhoneList(q);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:tg:scalperPhone:export')")
|
||||||
|
@Log(title = "TG黄牛电话库", businessType = BusinessType.EXPORT)
|
||||||
|
@GetMapping("/export")
|
||||||
|
public AjaxResult export(TgScalperPhone q)
|
||||||
|
{
|
||||||
|
List<TgScalperPhone> list = tgScalperPhoneService.selectTgScalperPhoneList(q);
|
||||||
|
ExcelUtil<TgScalperPhone> util = new ExcelUtil<>(TgScalperPhone.class);
|
||||||
|
return util.exportExcel(list, "TG黄牛电话库");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:tg:scalperPhone:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(tgScalperPhoneService.selectTgScalperPhoneById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:tg:scalperPhone:add')")
|
||||||
|
@Log(title = "TG黄牛电话库", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody TgScalperPhone row)
|
||||||
|
{
|
||||||
|
return toAjax(tgScalperPhoneService.insertTgScalperPhone(row));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:tg:scalperPhone:edit')")
|
||||||
|
@Log(title = "TG黄牛电话库", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody TgScalperPhone row)
|
||||||
|
{
|
||||||
|
return toAjax(tgScalperPhoneService.updateTgScalperPhone(row));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:tg:scalperPhone:remove')")
|
||||||
|
@Log(title = "TG黄牛电话库", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(tgScalperPhoneService.deleteTgScalperPhoneByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import com.ruoyi.jarvis.domain.dto.WeComInboundRequest;
|
|||||||
import com.ruoyi.jarvis.domain.dto.WeComInboundResult;
|
import com.ruoyi.jarvis.domain.dto.WeComInboundResult;
|
||||||
import com.ruoyi.jarvis.service.IWeComInboundService;
|
import com.ruoyi.jarvis.service.IWeComInboundService;
|
||||||
import com.ruoyi.jarvis.service.IWeComInboundTraceService;
|
import com.ruoyi.jarvis.service.IWeComInboundTraceService;
|
||||||
|
import com.ruoyi.jarvis.service.SuperAdminService;
|
||||||
import com.ruoyi.jarvis.wecom.WxSendWeComPushClient;
|
import com.ruoyi.jarvis.wecom.WxSendWeComPushClient;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
@@ -32,6 +33,8 @@ public class WeComInboundController {
|
|||||||
private IWeComInboundTraceService weComInboundTraceService;
|
private IWeComInboundTraceService weComInboundTraceService;
|
||||||
@Resource
|
@Resource
|
||||||
private WxSendWeComPushClient wxSendWeComPushClient;
|
private WxSendWeComPushClient wxSendWeComPushClient;
|
||||||
|
@Resource
|
||||||
|
private SuperAdminService superAdminService;
|
||||||
|
|
||||||
@PostMapping("/inbound")
|
@PostMapping("/inbound")
|
||||||
public AjaxResult inbound(
|
public AjaxResult inbound(
|
||||||
@@ -46,7 +49,12 @@ public class WeComInboundController {
|
|||||||
Map<String, Object> data = new HashMap<>(4);
|
Map<String, Object> data = new HashMap<>(4);
|
||||||
data.put("reply", result.getPassiveReply());
|
data.put("reply", result.getPassiveReply());
|
||||||
data.put("activePushCount", result.getActivePushContents().size());
|
data.put("activePushCount", result.getActivePushContents().size());
|
||||||
wxSendWeComPushClient.scheduleActivePushes(req.getFromUserName(), result.getActivePushContents());
|
String pipeTouser = superAdminService.resolveTouserPipeForActivePush(req.getFromUserName());
|
||||||
|
if (!StringUtils.hasText(pipeTouser) && StringUtils.hasText(req.getFromUserName())) {
|
||||||
|
pipeTouser = req.getFromUserName().trim();
|
||||||
|
}
|
||||||
|
String callbackAgentId = StringUtils.hasText(req.getAgentId()) ? req.getAgentId().trim() : null;
|
||||||
|
wxSendWeComPushClient.scheduleActivePushes(pipeTouser, callbackAgentId, result.getActivePushContents());
|
||||||
return AjaxResult.success(data);
|
return AjaxResult.success(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.ruoyi.jarvis.service.ILogisticsService;
|
|||||||
import com.ruoyi.jarvis.service.IWeComShareLinkLogisticsJobService;
|
import com.ruoyi.jarvis.service.IWeComShareLinkLogisticsJobService;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -70,6 +71,9 @@ public class WeComShareLinkLogisticsJobController extends BaseController {
|
|||||||
if (job == null) {
|
if (job == null) {
|
||||||
return AjaxResult.error("任务不存在");
|
return AjaxResult.error("任务不存在");
|
||||||
}
|
}
|
||||||
|
if ("CANCELLED".equalsIgnoreCase(job.getStatus())) {
|
||||||
|
return AjaxResult.error("任务已取消扫描,请先恢复或新建任务");
|
||||||
|
}
|
||||||
if (!StringUtils.hasText(job.getTrackingUrl())) {
|
if (!StringUtils.hasText(job.getTrackingUrl())) {
|
||||||
return AjaxResult.error("该任务无物流短链");
|
return AjaxResult.error("该任务无物流短链");
|
||||||
}
|
}
|
||||||
@@ -109,4 +113,49 @@ public class WeComShareLinkLogisticsJobController extends BaseController {
|
|||||||
r.put("hint", "为单次弹栈处理条数;每项内部仍可能因未出单重新入队");
|
r.put("hint", "为单次弹栈处理条数;每项内部仍可能因未出单重新入队");
|
||||||
return AjaxResult.success(r);
|
return AjaxResult.success(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单取消等:标记为 CANCELLED,不再被定时对账入队;队列弹出时也会跳过物流请求与推送。
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:wecom:shareLinkLog:list')")
|
||||||
|
@PostMapping("/cancel")
|
||||||
|
public AjaxResult cancel(@RequestBody Map<String, Object> body) {
|
||||||
|
if (body == null || body.get("jobKey") == null) {
|
||||||
|
return AjaxResult.error("jobKey 不能为空");
|
||||||
|
}
|
||||||
|
String jobKey = body.get("jobKey").toString().trim();
|
||||||
|
if (!StringUtils.hasText(jobKey)) {
|
||||||
|
return AjaxResult.error("jobKey 不能为空");
|
||||||
|
}
|
||||||
|
WeComShareLinkLogisticsJob job = weComShareLinkLogisticsJobService.selectByJobKey(jobKey);
|
||||||
|
if (job == null) {
|
||||||
|
return AjaxResult.error("任务不存在");
|
||||||
|
}
|
||||||
|
if ("CANCELLED".equalsIgnoreCase(job.getStatus())) {
|
||||||
|
return AjaxResult.success("已是取消状态");
|
||||||
|
}
|
||||||
|
String extra = body.get("lastNote") != null ? body.get("lastNote").toString().trim() : "";
|
||||||
|
String note = "manual_cancel";
|
||||||
|
if (StringUtils.hasText(extra)) {
|
||||||
|
note = note + "|" + extra;
|
||||||
|
}
|
||||||
|
if (note.length() > 500) {
|
||||||
|
note = note.substring(0, 500) + "…";
|
||||||
|
}
|
||||||
|
weComShareLinkLogisticsJobMapper.updateByJobKey(jobKey, "CANCELLED", note, null, null);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物理删除任务行(Redis 中已存在的同 jobKey 队列项仍可能被弹出,但会因库中无行而跳过扫描)。
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('jarvis:wecom:shareLinkLog:list')")
|
||||||
|
@DeleteMapping("/{jobKey}")
|
||||||
|
public AjaxResult remove(@PathVariable("jobKey") String jobKey) {
|
||||||
|
if (!StringUtils.hasText(jobKey)) {
|
||||||
|
return AjaxResult.error("jobKey 不能为空");
|
||||||
|
}
|
||||||
|
weComShareLinkLogisticsJobMapper.deleteByJobKey(jobKey.trim());
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
@@ -12,6 +13,7 @@ import com.ruoyi.common.utils.http.HttpUtils;
|
|||||||
import com.ruoyi.framework.web.domain.Server;
|
import com.ruoyi.framework.web.domain.Server;
|
||||||
import com.ruoyi.jarvis.service.ILogisticsService;
|
import com.ruoyi.jarvis.service.ILogisticsService;
|
||||||
import com.ruoyi.jarvis.service.IWxSendService;
|
import com.ruoyi.jarvis.service.IWxSendService;
|
||||||
|
import com.ruoyi.jarvis.wecom.WxSendGoofishNotifyClient;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -32,6 +34,9 @@ public class ServerController
|
|||||||
@Resource
|
@Resource
|
||||||
private IWxSendService wxSendService;
|
private IWxSendService wxSendService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WxSendGoofishNotifyClient wxSendGoofishNotifyClient;
|
||||||
|
|
||||||
/** Ollama 服务地址,用于健康检查 */
|
/** Ollama 服务地址,用于健康检查 */
|
||||||
@Value("${jarvis.ollama.base-url:http://192.168.8.34:11434}")
|
@Value("${jarvis.ollama.base-url:http://192.168.8.34:11434}")
|
||||||
private String ollamaBaseUrl;
|
private String ollamaBaseUrl;
|
||||||
@@ -72,23 +77,23 @@ public class ServerController
|
|||||||
healthMap.put("logistics", logisticsMap);
|
healthMap.put("logistics", logisticsMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 微信推送服务健康检测
|
// 微信推送:不在此自动下发消息,仅展示配置地址;真实检测见 POST /monitor/server/health/wx-send-test
|
||||||
try {
|
Map<String, Object> wxSendMap = new HashMap<>();
|
||||||
IWxSendService.HealthCheckResult wxSendHealth = wxSendService.checkHealth();
|
wxSendMap.put("manualOnly", true);
|
||||||
Map<String, Object> wxSendMap = new HashMap<>();
|
wxSendMap.put("healthy", null);
|
||||||
wxSendMap.put("healthy", wxSendHealth.isHealthy());
|
wxSendMap.put("status", "未检测");
|
||||||
wxSendMap.put("status", wxSendHealth.getStatus());
|
wxSendMap.put("message", "点击「测试」将发送一条健康检查消息(会真实推送到微信)");
|
||||||
wxSendMap.put("message", wxSendHealth.getMessage());
|
wxSendMap.put("serviceUrl", wxSendService.getHealthCheckServiceUrl());
|
||||||
wxSendMap.put("serviceUrl", wxSendHealth.getServiceUrl());
|
healthMap.put("wxSend", wxSendMap);
|
||||||
healthMap.put("wxSend", wxSendMap);
|
|
||||||
} catch (Exception e) {
|
// 企微闲鱼通知:仅展示接口地址;真实检测见 POST /monitor/server/health/goofish-notify-test
|
||||||
Map<String, Object> wxSendMap = new HashMap<>();
|
Map<String, Object> goofishMap = new HashMap<>();
|
||||||
wxSendMap.put("healthy", false);
|
goofishMap.put("manualOnly", true);
|
||||||
wxSendMap.put("status", "异常");
|
goofishMap.put("healthy", null);
|
||||||
wxSendMap.put("message", "健康检测异常: " + e.getMessage());
|
goofishMap.put("status", "未检测");
|
||||||
wxSendMap.put("serviceUrl", "");
|
goofishMap.put("message", "点击「测试」将经 wxSend 向企微闲鱼应用发送一条测试文本");
|
||||||
healthMap.put("wxSend", wxSendMap);
|
goofishMap.put("serviceUrl", wxSendGoofishNotifyClient.getGoofishPushEndpointDisplay());
|
||||||
}
|
healthMap.put("goofishNotify", goofishMap);
|
||||||
|
|
||||||
// Ollama 服务健康检测(调试用)
|
// Ollama 服务健康检测(调试用)
|
||||||
try {
|
try {
|
||||||
@@ -115,6 +120,54 @@ public class ServerController
|
|||||||
|
|
||||||
return AjaxResult.success(healthMap);
|
return AjaxResult.success(healthMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动测试微信推送(会真实下发一条消息)
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
||||||
|
@PostMapping("/health/wx-send-test")
|
||||||
|
public AjaxResult testWxSendHealth() {
|
||||||
|
try {
|
||||||
|
IWxSendService.HealthCheckResult r = wxSendService.checkHealth();
|
||||||
|
Map<String, Object> m = new HashMap<>();
|
||||||
|
m.put("manualOnly", true);
|
||||||
|
m.put("healthy", r.isHealthy());
|
||||||
|
m.put("status", r.getStatus());
|
||||||
|
m.put("message", r.getMessage());
|
||||||
|
m.put("serviceUrl", r.getServiceUrl());
|
||||||
|
return AjaxResult.success(m);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Map<String, Object> m = new HashMap<>();
|
||||||
|
m.put("manualOnly", true);
|
||||||
|
m.put("healthy", false);
|
||||||
|
m.put("status", "异常");
|
||||||
|
m.put("message", "检测异常: " + e.getMessage());
|
||||||
|
m.put("serviceUrl", wxSendService.getHealthCheckServiceUrl());
|
||||||
|
return AjaxResult.success(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动测试企微闲鱼通知(经 wxSend POST /wx/send/goofish,与 /send/pdd 相同 vanToken + title/text/touser)
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
||||||
|
@PostMapping("/health/goofish-notify-test")
|
||||||
|
public AjaxResult testGoofishNotify() {
|
||||||
|
String err = wxSendGoofishNotifyClient.testGoofishNotify();
|
||||||
|
Map<String, Object> m = new HashMap<>();
|
||||||
|
m.put("manualOnly", true);
|
||||||
|
m.put("serviceUrl", wxSendGoofishNotifyClient.getGoofishPushEndpointDisplay());
|
||||||
|
if (err == null) {
|
||||||
|
m.put("healthy", true);
|
||||||
|
m.put("status", "正常");
|
||||||
|
m.put("message", "闲鱼通知测试消息已发送");
|
||||||
|
} else {
|
||||||
|
m.put("healthy", false);
|
||||||
|
m.put("status", "异常");
|
||||||
|
m.put("message", err);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(m);
|
||||||
|
}
|
||||||
|
|
||||||
private void putOllamaUnhealthy(Map<String, Object> healthMap, String url, String message) {
|
private void putOllamaUnhealthy(Map<String, Object> healthMap, String url, String message) {
|
||||||
Map<String, Object> ollamaMap = new HashMap<>();
|
Map<String, Object> ollamaMap = new HashMap<>();
|
||||||
|
|||||||
@@ -0,0 +1,157 @@
|
|||||||
|
package com.ruoyi.web.controller.publicapi;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
import com.ruoyi.common.annotation.RateLimiter;
|
||||||
|
import com.ruoyi.common.constant.CacheConstants;
|
||||||
|
import com.ruoyi.common.enums.LimitType;
|
||||||
|
import com.ruoyi.jarvis.domain.GoodsInfo;
|
||||||
|
import com.ruoyi.jarvis.domain.OrderRows;
|
||||||
|
import com.ruoyi.jarvis.domain.dto.PromoterOrderInfoVO;
|
||||||
|
import com.ruoyi.jarvis.enums.ValidCodeConverter;
|
||||||
|
import com.ruoyi.jarvis.service.IGoodsInfoService;
|
||||||
|
import com.ruoyi.jarvis.service.IOrderRowsService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 京东开放接口(免登录,路径统一 /open/jd/)
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/open/jd")
|
||||||
|
public class PublicPromoterOrderController {
|
||||||
|
|
||||||
|
private static final String DEFAULT_SHOP_LOGO = "https://www.jd.com/favicon.ico";
|
||||||
|
private static final SimpleDateFormat DATE_FMT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IOrderRowsService orderRowsService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IGoodsInfoService goodsInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟团订单查询(兼容 jiadiantemai 接口格式)
|
||||||
|
*/
|
||||||
|
@GetMapping("/queryTkOrder")
|
||||||
|
@RateLimiter(key = CacheConstants.RATE_LIMIT_KEY, time = 60, count = 30, limitType = LimitType.IP)
|
||||||
|
public Map<String, Object> queryTkOrder(
|
||||||
|
@RequestParam String orderId,
|
||||||
|
@RequestParam(required = false) String t) {
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
String trimmedOrderId = orderId != null ? orderId.trim() : "";
|
||||||
|
if (trimmedOrderId.isEmpty()) {
|
||||||
|
result.put("code", 200);
|
||||||
|
result.put("count", 0);
|
||||||
|
result.put("msg", "请输入订单编号");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<OrderRows> rows = orderRowsService.selectOrderRowsByOrderNo(trimmedOrderId);
|
||||||
|
if (rows == null || rows.isEmpty()) {
|
||||||
|
result.put("code", 200);
|
||||||
|
result.put("count", 0);
|
||||||
|
result.put("msg", "未查找到对应订单信息~");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<Long> goodsInfoIds = new HashSet<>();
|
||||||
|
for (OrderRows row : rows) {
|
||||||
|
if (row.getGoodsInfoId() != null) {
|
||||||
|
goodsInfoIds.add(row.getGoodsInfoId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<Long, GoodsInfo> goodsInfoMap = goodsInfoService.selectGoodsInfoMapByIds(goodsInfoIds);
|
||||||
|
|
||||||
|
List<PromoterOrderInfoVO> orderInfoList = new ArrayList<>();
|
||||||
|
ValidCodeConverter validCodeConverter = new ValidCodeConverter();
|
||||||
|
for (OrderRows row : rows) {
|
||||||
|
GoodsInfo goodsInfo = row.getGoodsInfoId() != null
|
||||||
|
? goodsInfoMap.get(row.getGoodsInfoId()) : null;
|
||||||
|
orderInfoList.add(toPromoterOrderInfo(row, goodsInfo, validCodeConverter));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (orderInfoList.isEmpty()) {
|
||||||
|
result.put("code", 200);
|
||||||
|
result.put("count", 0);
|
||||||
|
result.put("msg", "未查找到对应订单信息~");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.put("code", 200);
|
||||||
|
result.put("orderInfoList", orderInfoList);
|
||||||
|
result.put("msg", "查询成功");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private PromoterOrderInfoVO toPromoterOrderInfo(OrderRows row, GoodsInfo goodsInfo,
|
||||||
|
ValidCodeConverter validCodeConverter) {
|
||||||
|
PromoterOrderInfoVO vo = new PromoterOrderInfoVO();
|
||||||
|
String shopName = goodsInfo != null && goodsInfo.getShopName() != null && !goodsInfo.getShopName().isEmpty()
|
||||||
|
? goodsInfo.getShopName() : "京东商城";
|
||||||
|
vo.setShopName(shopName);
|
||||||
|
vo.setShopLogo(DEFAULT_SHOP_LOGO);
|
||||||
|
vo.setOrderSource("京东");
|
||||||
|
vo.setTraceTypeStr(row.getTraceType() != null && row.getTraceType() == 2 ? "同店" : "跨店");
|
||||||
|
if (row.getParentId() != null && row.getParentId() > 0) {
|
||||||
|
vo.setParentId(String.valueOf(row.getParentId()));
|
||||||
|
}
|
||||||
|
if (row.getOrderId() != null) {
|
||||||
|
vo.setOrderId(String.valueOf(row.getOrderId()));
|
||||||
|
}
|
||||||
|
vo.setValidCodeMsg(validCodeConverter.getCodeDescription(row.getValidCode()));
|
||||||
|
if (goodsInfo != null && goodsInfo.getImageUrl() != null && !goodsInfo.getImageUrl().isEmpty()) {
|
||||||
|
vo.setSkuImageUrl(goodsInfo.getImageUrl());
|
||||||
|
} else if (row.getSkuId() != null) {
|
||||||
|
vo.setSkuImageUrl("https://img14.360buyimg.com/n5/s450x450_" + row.getSkuId() + ".jpg");
|
||||||
|
}
|
||||||
|
vo.setSkuName(row.getSkuName());
|
||||||
|
if (row.getSkuId() != null) {
|
||||||
|
vo.setSkuId(String.valueOf(row.getSkuId()));
|
||||||
|
}
|
||||||
|
vo.setItemId(row.getItemId());
|
||||||
|
vo.setSkuNum(row.getSkuNum() != null ? row.getSkuNum() : 1);
|
||||||
|
vo.setCosPrice(formatPrice(row));
|
||||||
|
vo.setOrderTime(formatDate(row.getOrderTime()));
|
||||||
|
vo.setFinishTime(formatDate(row.getFinishTime()));
|
||||||
|
Double proPrice = row.getProPriceAmount();
|
||||||
|
if (proPrice != null && proPrice > 0) {
|
||||||
|
vo.setProPriceAmount(String.format("%.2f", proPrice));
|
||||||
|
vo.setProPriceTime(formatDate(row.getModifyTime()));
|
||||||
|
} else {
|
||||||
|
vo.setProPriceAmount("0.00");
|
||||||
|
}
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String formatPrice(OrderRows row) {
|
||||||
|
Double price = row.getActualCosPrice();
|
||||||
|
if (price == null || price <= 0) {
|
||||||
|
price = row.getEstimateCosPrice();
|
||||||
|
}
|
||||||
|
if (price == null) {
|
||||||
|
return "0.00";
|
||||||
|
}
|
||||||
|
return String.format("%.2f", price);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String formatDate(java.util.Date date) {
|
||||||
|
if (date == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
synchronized (DATE_FMT) {
|
||||||
|
return DATE_FMT.format(date);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,18 +2,27 @@ package com.ruoyi.web.controller.system;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.ruoyi.jarvis.domain.GroupRebateExcelUpload;
|
import com.ruoyi.jarvis.domain.GroupRebateExcelUpload;
|
||||||
import com.ruoyi.jarvis.domain.OrderRows;
|
import com.ruoyi.jarvis.domain.OrderRows;
|
||||||
import com.ruoyi.jarvis.service.IGroupRebateExcelUploadService;
|
import com.ruoyi.jarvis.service.IGroupRebateExcelUploadService;
|
||||||
import com.ruoyi.jarvis.service.impl.GroupRebateExcelImportService;
|
import com.ruoyi.jarvis.service.impl.GroupRebateExcelImportService;
|
||||||
import com.ruoyi.jarvis.service.IOrderRowsService;
|
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.StringUtils;
|
||||||
import com.ruoyi.common.utils.file.FileUtils;
|
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.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -24,7 +33,12 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.jarvis.domain.JDOrder;
|
import com.ruoyi.jarvis.domain.JDOrder;
|
||||||
import com.ruoyi.jarvis.domain.dto.JDOrderSimpleDTO;
|
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.jarvis.service.IJDOrderProfitService;
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import com.ruoyi.jarvis.service.IJDOrderService;
|
import com.ruoyi.jarvis.service.IJDOrderService;
|
||||||
import com.ruoyi.jarvis.service.IInstructionService;
|
import com.ruoyi.jarvis.service.IInstructionService;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
@@ -40,6 +54,14 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||||||
public class JDOrderListController extends BaseController
|
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 IJDOrderService jdOrderService;
|
||||||
private final IJDOrderProfitService jdOrderProfitService;
|
private final IJDOrderProfitService jdOrderProfitService;
|
||||||
private final IOrderRowsService orderRowsService;
|
private final IOrderRowsService orderRowsService;
|
||||||
@@ -47,17 +69,27 @@ public class JDOrderListController extends BaseController
|
|||||||
private final GroupRebateExcelImportService groupRebateExcelImportService;
|
private final GroupRebateExcelImportService groupRebateExcelImportService;
|
||||||
private final IGroupRebateExcelUploadService groupRebateExcelUploadService;
|
private final IGroupRebateExcelUploadService groupRebateExcelUploadService;
|
||||||
|
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
private final ISysConfigService sysConfigService;
|
||||||
|
private final IJDOrderModelShopService jdOrderModelShopService;
|
||||||
|
|
||||||
public JDOrderListController(IJDOrderService jdOrderService, IJDOrderProfitService jdOrderProfitService,
|
public JDOrderListController(IJDOrderService jdOrderService, IJDOrderProfitService jdOrderProfitService,
|
||||||
IOrderRowsService orderRowsService,
|
IOrderRowsService orderRowsService,
|
||||||
IInstructionService instructionService,
|
IInstructionService instructionService,
|
||||||
GroupRebateExcelImportService groupRebateExcelImportService,
|
GroupRebateExcelImportService groupRebateExcelImportService,
|
||||||
IGroupRebateExcelUploadService groupRebateExcelUploadService) {
|
IGroupRebateExcelUploadService groupRebateExcelUploadService,
|
||||||
|
ObjectMapper objectMapper,
|
||||||
|
ISysConfigService sysConfigService,
|
||||||
|
IJDOrderModelShopService jdOrderModelShopService) {
|
||||||
this.jdOrderService = jdOrderService;
|
this.jdOrderService = jdOrderService;
|
||||||
this.jdOrderProfitService = jdOrderProfitService;
|
this.jdOrderProfitService = jdOrderProfitService;
|
||||||
this.orderRowsService = orderRowsService;
|
this.orderRowsService = orderRowsService;
|
||||||
this.instructionService = instructionService;
|
this.instructionService = instructionService;
|
||||||
this.groupRebateExcelImportService = groupRebateExcelImportService;
|
this.groupRebateExcelImportService = groupRebateExcelImportService;
|
||||||
this.groupRebateExcelUploadService = groupRebateExcelUploadService;
|
this.groupRebateExcelUploadService = groupRebateExcelUploadService;
|
||||||
|
this.objectMapper = objectMapper;
|
||||||
|
this.sysConfigService = sysConfigService;
|
||||||
|
this.jdOrderModelShopService = jdOrderModelShopService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,7 +133,12 @@ public class JDOrderListController extends BaseController
|
|||||||
if ("true".equalsIgnoreCase(request.getParameter("hasRebateRemark"))) {
|
if ("true".equalsIgnoreCase(request.getParameter("hasRebateRemark"))) {
|
||||||
query.getParams().put("hasRebateRemark", true);
|
query.getParams().put("hasRebateRemark", true);
|
||||||
}
|
}
|
||||||
|
if ("true".equalsIgnoreCase(request.getParameter("rebateWithoutUploadLink"))) {
|
||||||
|
query.getParams().put("rebateWithoutUploadLink", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
applyModelNumberExcludeFilter(query);
|
||||||
|
|
||||||
java.util.List<JDOrder> list;
|
java.util.List<JDOrder> list;
|
||||||
if (orderBy != null && !orderBy.isEmpty()) {
|
if (orderBy != null && !orderBy.isEmpty()) {
|
||||||
// 设置排序参数
|
// 设置排序参数
|
||||||
@@ -124,10 +161,12 @@ public class JDOrderListController extends BaseController
|
|||||||
jdOrder.setProPriceAmount(orderRows.getProPriceAmount());
|
jdOrder.setProPriceAmount(orderRows.getProPriceAmount());
|
||||||
jdOrder.setFinishTime(orderRows.getFinishTime());
|
jdOrder.setFinishTime(orderRows.getFinishTime());
|
||||||
jdOrder.setOrderStatus(orderRows.getValidCode());
|
jdOrder.setOrderStatus(orderRows.getValidCode());
|
||||||
|
jdOrder.setExpressStatus(orderRows.getExpressStatus());
|
||||||
} else {
|
} else {
|
||||||
jdOrder.setProPriceAmount(0.0);
|
jdOrder.setProPriceAmount(0.0);
|
||||||
jdOrder.setFinishTime(null);
|
jdOrder.setFinishTime(null);
|
||||||
jdOrder.setOrderStatus(null);
|
jdOrder.setOrderStatus(null);
|
||||||
|
jdOrder.setExpressStatus(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 过滤掉完成时间为空的订单
|
// 过滤掉完成时间为空的订单
|
||||||
@@ -142,9 +181,11 @@ public class JDOrderListController extends BaseController
|
|||||||
jdOrder.setProPriceAmount(orderRows.getProPriceAmount());
|
jdOrder.setProPriceAmount(orderRows.getProPriceAmount());
|
||||||
jdOrder.setFinishTime(orderRows.getFinishTime());
|
jdOrder.setFinishTime(orderRows.getFinishTime());
|
||||||
jdOrder.setOrderStatus(orderRows.getValidCode());
|
jdOrder.setOrderStatus(orderRows.getValidCode());
|
||||||
|
jdOrder.setExpressStatus(orderRows.getExpressStatus());
|
||||||
} else {
|
} else {
|
||||||
jdOrder.setProPriceAmount(0.0);
|
jdOrder.setProPriceAmount(0.0);
|
||||||
jdOrder.setOrderStatus(null);
|
jdOrder.setOrderStatus(null);
|
||||||
|
jdOrder.setExpressStatus(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,6 +193,35 @@ public class JDOrderListController extends BaseController
|
|||||||
return dataTable;
|
return dataTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快捷录单页:型号下拉数据;每型号取 jd_order 主键最大的一条的付款与后返(通常即最近落库单)
|
||||||
|
*/
|
||||||
|
@GetMapping("/quickRecord/modelOptions")
|
||||||
|
public AjaxResult quickRecordModelOptions() {
|
||||||
|
List<QuickRecordModelOption> options = jdOrderService.selectQuickRecordModelOptions();
|
||||||
|
return AjaxResult.success(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快捷录单页:型号后缀店铺下拉(系统参数 quickRecord.modelShopOptions,每行格式:短前缀(完整店名))
|
||||||
|
*/
|
||||||
|
@GetMapping("/quickRecord/shopOptions")
|
||||||
|
public AjaxResult quickRecordShopOptions() {
|
||||||
|
String raw = sysConfigService.selectConfigByKey(QuickRecordModelShopOptionUtil.CONFIG_KEY);
|
||||||
|
List<QuickRecordModelShopOption> options = QuickRecordModelShopOptionUtil.parseOptions(raw);
|
||||||
|
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:按「单号/订单号」匹配系统订单,将「是否返现」「总共返现」等写入后返备注(可多次导入累加);文件落盘并记上传记录。
|
* 导入跟团返现类 Excel:按「单号/订单号」匹配系统订单,将「是否返现」「总共返现」等写入后返备注(可多次导入累加);文件落盘并记上传记录。
|
||||||
*/
|
*/
|
||||||
@@ -243,6 +313,8 @@ public class JDOrderListController extends BaseController
|
|||||||
{
|
{
|
||||||
String fileName = "JD订单数据";
|
String fileName = "JD订单数据";
|
||||||
|
|
||||||
|
applyModelNumberExcludeFilter(jdOrder);
|
||||||
|
|
||||||
List<JDOrder> list = jdOrderService.selectJDOrderList(jdOrder);
|
List<JDOrder> list = jdOrderService.selectJDOrderList(jdOrder);
|
||||||
|
|
||||||
// 设置响应头,指定文件名
|
// 设置响应头,指定文件名
|
||||||
@@ -277,15 +349,54 @@ public class JDOrderListController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改JD订单
|
* 修改JD订单(PUT body 使用 JsonNode:extraCost / extra_cost 从原始 JSON 显式写入实体,
|
||||||
|
* 避免个别 Jackson + Lombok 场景下 treeToValue 未映射导致重算利润仍按 0 计算)
|
||||||
*/
|
*/
|
||||||
@Log(title = "JD订单", businessType = BusinessType.UPDATE)
|
@Log(title = "JD订单", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody JDOrder jdOrder)
|
public AjaxResult edit(@RequestBody JsonNode root) throws JsonProcessingException {
|
||||||
{
|
JDOrder jdOrder = objectMapper.treeToValue(root, JDOrder.class);
|
||||||
|
applyExtraCostFromPayload(root, jdOrder);
|
||||||
|
jdOrderModelShopService.normalizeOrder(jdOrder);
|
||||||
jdOrderProfitService.recalculate(jdOrder);
|
jdOrderProfitService.recalculate(jdOrder);
|
||||||
jdOrder.getParams().put("applyProfitFields", Boolean.TRUE);
|
jdOrder.getParams().put("applyProfitFields", Boolean.TRUE);
|
||||||
return toAjax(jdOrderService.updateJDOrder(jdOrder));
|
int rows = jdOrderService.updateJDOrder(jdOrder);
|
||||||
|
if (rows <= 0) {
|
||||||
|
return AjaxResult.error("更新失败或订单不存在");
|
||||||
|
}
|
||||||
|
return AjaxResult.success(jdOrderService.selectJDOrderById(jdOrder.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applyExtraCostFromPayload(JsonNode root, JDOrder order) {
|
||||||
|
if (root == null || order == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JsonNode n = root.get("extraCost");
|
||||||
|
if (readExtraCostNumber(n, order)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
n = root.get("extra_cost");
|
||||||
|
readExtraCostNumber(n, order);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @return true 已从节点解析并写入 order */
|
||||||
|
private static boolean readExtraCostNumber(JsonNode n, JDOrder order) {
|
||||||
|
if (n == null || n.isNull()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (n.isNumber()) {
|
||||||
|
order.setExtraCost(n.asDouble());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (n.isTextual()) {
|
||||||
|
try {
|
||||||
|
order.setExtraCost(Double.parseDouble(n.asText().trim()));
|
||||||
|
return true;
|
||||||
|
} catch (NumberFormatException ignored) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -376,9 +487,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 批量重算售价(自动从型号配置回填)与利润(清除手动锁定后按规则计算)
|
* 按 ID 批量重算售价(自动从型号配置回填)与利润(清除手动锁定后按规则计算)
|
||||||
*/
|
*/
|
||||||
@@ -456,7 +596,18 @@ public class JDOrderListController extends BaseController
|
|||||||
if (orderSearch != null && !orderSearch.trim().isEmpty()) {
|
if (orderSearch != null && !orderSearch.trim().isEmpty()) {
|
||||||
query.getParams().put("orderSearch", orderSearch.trim());
|
query.getParams().put("orderSearch", orderSearch.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String rebateRemarkAbnormal = request.getParameter("rebateRemarkHasAbnormal");
|
||||||
|
if (rebateRemarkAbnormal != null && !rebateRemarkAbnormal.isEmpty()) {
|
||||||
|
query.setRebateRemarkHasAbnormal(Integer.valueOf(rebateRemarkAbnormal));
|
||||||
|
}
|
||||||
|
if ("true".equalsIgnoreCase(request.getParameter("hasRebateRemark"))) {
|
||||||
|
query.getParams().put("hasRebateRemark", true);
|
||||||
|
}
|
||||||
|
if ("true".equalsIgnoreCase(request.getParameter("rebateWithoutUploadLink"))) {
|
||||||
|
query.getParams().put("rebateWithoutUploadLink", true);
|
||||||
|
}
|
||||||
|
|
||||||
// 处理其他查询参数
|
// 处理其他查询参数
|
||||||
if (query.getRemark() != null && !query.getRemark().trim().isEmpty()) {
|
if (query.getRemark() != null && !query.getRemark().trim().isEmpty()) {
|
||||||
query.setRemark(query.getRemark().trim());
|
query.setRemark(query.getRemark().trim());
|
||||||
@@ -467,6 +618,7 @@ public class JDOrderListController extends BaseController
|
|||||||
if (query.getModelNumber() != null && !query.getModelNumber().trim().isEmpty()) {
|
if (query.getModelNumber() != null && !query.getModelNumber().trim().isEmpty()) {
|
||||||
query.setModelNumber(query.getModelNumber().trim());
|
query.setModelNumber(query.getModelNumber().trim());
|
||||||
}
|
}
|
||||||
|
applyModelNumberExcludeFilter(query);
|
||||||
if (query.getBuyer() != null && !query.getBuyer().trim().isEmpty()) {
|
if (query.getBuyer() != null && !query.getBuyer().trim().isEmpty()) {
|
||||||
query.setBuyer(query.getBuyer().trim());
|
query.setBuyer(query.getBuyer().trim());
|
||||||
}
|
}
|
||||||
@@ -517,8 +669,8 @@ public class JDOrderListController extends BaseController
|
|||||||
String duoduoOrderNo = o.getThirdPartyOrderNo() != null && !o.getThirdPartyOrderNo().trim().isEmpty()
|
String duoduoOrderNo = o.getThirdPartyOrderNo() != null && !o.getThirdPartyOrderNo().trim().isEmpty()
|
||||||
? o.getThirdPartyOrderNo() : (o.getRemark() != null ? o.getRemark() : "");
|
? o.getThirdPartyOrderNo() : (o.getRemark() != null ? o.getRemark() : "");
|
||||||
|
|
||||||
// 型号
|
// 型号(对外完整型号 = 本体 + 店铺前缀)
|
||||||
String modelNumber = o.getModelNumber() != null ? o.getModelNumber() : "";
|
String modelNumber = QuickRecordModelShopOptionUtil.fullModelNumber(o);
|
||||||
|
|
||||||
// 数量(固定为1)
|
// 数量(固定为1)
|
||||||
String quantity = "1";
|
String quantity = "1";
|
||||||
@@ -581,4 +733,72 @@ public class JDOrderListController extends BaseController
|
|||||||
return AjaxResult.error("生成失败: " + e.getMessage());
|
return AjaxResult.error("生成失败: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 型号不含:支持逗号、中文逗号、空格、换行分隔的多个关键词,型号不得包含任一关键词。
|
||||||
|
*/
|
||||||
|
private void applyModelNumberExcludeFilter(JDOrder query) {
|
||||||
|
if (query == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<String> terms = parseModelNumberExcludeTerms(query.getModelNumberExclude());
|
||||||
|
if (!terms.isEmpty()) {
|
||||||
|
query.getParams().put("modelNumberExcludeList", terms);
|
||||||
|
}
|
||||||
|
query.setModelNumberExclude(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<String> parseModelNumberExcludeTerms(String raw) {
|
||||||
|
List<String> out = new ArrayList<>();
|
||||||
|
if (StringUtils.isEmpty(raw)) {
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
for (String part : raw.split("[,,\\s\\n]+")) {
|
||||||
|
String t = part.trim();
|
||||||
|
if (!t.isEmpty() && !out.contains(t)) {
|
||||||
|
out.add(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,10 +200,18 @@ jarvis:
|
|||||||
# 物流接口服务地址
|
# 物流接口服务地址
|
||||||
logistics:
|
logistics:
|
||||||
base-url: http://192.168.8.88:5001
|
base-url: http://192.168.8.88:5001
|
||||||
|
# 同机多进程多端口时配置逗号分隔列表;非空时仅按下列地址轮询,不再使用 base-url
|
||||||
|
base-urls: http://192.168.8.88:5001,http://192.168.8.88:5002,http://192.168.8.88:5003
|
||||||
fetch-path: /fetch_logistics
|
fetch-path: /fetch_logistics
|
||||||
health-path: /health
|
health-path: /health
|
||||||
# 每次定时任务最多处理多少条企微分享链待队列(RPUSH 入队、LPOP 出队)
|
# 每次定时任务最多处理多少条企微分享链待队列(RPUSH 入队、LPOP 出队)
|
||||||
adhoc-pending-batch-size: 50
|
adhoc-pending-batch-size: 50
|
||||||
|
# 物流扫描(LogisticsScanTask):轮询 JD 单拉运单 + drain 分享链队列
|
||||||
|
scan:
|
||||||
|
cron: "0 */5 * * * ?"
|
||||||
|
order-delay-ms: 250
|
||||||
|
# 0=不限制;例如 40 可控制单轮最长耗时(余下下轮再扫)
|
||||||
|
max-orders-per-round: 0
|
||||||
# 获取评论接口服务地址(后端转发,避免前端跨域)
|
# 获取评论接口服务地址(后端转发,避免前端跨域)
|
||||||
fetch-comments:
|
fetch-comments:
|
||||||
base-url: http://192.168.8.60:5008
|
base-url: http://192.168.8.60:5008
|
||||||
@@ -214,11 +222,15 @@ jarvis:
|
|||||||
wxsend-base-url: http://127.0.0.1:36699
|
wxsend-base-url: http://127.0.0.1:36699
|
||||||
# 须与 wxSend jarvis.wecom.push-secret 一致(Header X-WxSend-WeCom-Push-Secret)
|
# 须与 wxSend jarvis.wecom.push-secret 一致(Header X-WxSend-WeCom-Push-Secret)
|
||||||
push-secret: jarvis_wecom_push_change_me
|
push-secret: jarvis_wecom_push_change_me
|
||||||
|
# 与 /wx/send/pdd、/wx/send/goofish 请求头 vanToken 一致(wxSend TokenUtil)
|
||||||
|
wxsend-van-token: super_token_b62190c26
|
||||||
|
# 接收企微通知的成员 UserID,多个逗号或 |;留空则不推送
|
||||||
|
goofish-notify-touser: "LinPinFan"
|
||||||
# 多轮会话:与 JDUtil interaction_state 类似,TTL 与空闲超时(分钟)
|
# 多轮会话:与 JDUtil interaction_state 类似,TTL 与空闲超时(分钟)
|
||||||
session-ttl-minutes: 30
|
session-ttl-minutes: 30
|
||||||
session-idle-timeout-minutes: 30
|
session-idle-timeout-minutes: 30
|
||||||
session-sweep-ms: 60000
|
session-sweep-ms: 60000
|
||||||
# 企微「开」+ 手机号:Jarvis POST 该局域网接口,将响应中的 reply_text 被动回复给用户
|
# 企微「开」/「慢开」+ 手机号:POST body 含 text(手机号)与 bot;响应 reply_text 被动回复用户
|
||||||
phone-forward:
|
phone-forward:
|
||||||
enabled: true
|
enabled: true
|
||||||
base-url: http://192.168.8.60:18080
|
base-url: http://192.168.8.60:18080
|
||||||
@@ -227,7 +239,19 @@ jarvis:
|
|||||||
# wait_reply 时服务端会等多条 Bot 回复,宜适当加大
|
# wait_reply 时服务端会等多条 Bot 回复,宜适当加大
|
||||||
read-timeout-ms: 120000
|
read-timeout-ms: 120000
|
||||||
wait-reply: true
|
wait-reply: true
|
||||||
reply-take-nth: 2
|
# 多台企微线程同时触发时串行调用 tg_bridge;排队超过该毫秒则提示「正忙」(0 表示一直等到上一条结束)
|
||||||
|
lock-acquire-timeout-ms: 180000
|
||||||
|
# 连续失败后熔断,不再发起 HTTP(与 tg_bridge 侧熔断互不替代)
|
||||||
|
circuit-failure-threshold: 5
|
||||||
|
circuit-open-ms: 120000
|
||||||
|
# 先查库 jarvis_tg_scalper_phone(启用+有备注),命中则不请求 tg_bridge
|
||||||
|
scalper-library-enabled: true
|
||||||
|
# 被动立即回「收到电话」,TG 结果经 wxSend /wecom/active-push 推送
|
||||||
|
async-result-push-enabled: true
|
||||||
|
# 同一企微 MsgId(wxSend 已透传)在 TTL 内复用首次成功结果,防重试重复计费;错误文案不缓存
|
||||||
|
dedup-enabled: true
|
||||||
|
dedup-ttl-seconds: 900
|
||||||
|
# reply_take_nth:仅「开」用 2;「慢开」由 tg_bridge reply_adaptive_skip_middle_ad 在 2/3 条间自适应
|
||||||
# Ollama 大模型服务(监控健康度调试用)
|
# Ollama 大模型服务(监控健康度调试用)
|
||||||
ollama:
|
ollama:
|
||||||
base-url: http://192.168.8.34:11434
|
base-url: http://192.168.8.34:11434
|
||||||
@@ -254,5 +278,32 @@ tencent:
|
|||||||
# 刷新Token地址(用于通过refresh_token刷新access_token)
|
# 刷新Token地址(用于通过refresh_token刷新access_token)
|
||||||
refresh-token-url: https://docs.qq.com/oauth/v2/token
|
refresh-token-url: https://docs.qq.com/oauth/v2/token
|
||||||
|
|
||||||
|
# 闲管家订单:RocketMQ(配置后订单推送走 MQ;不配则走线程池异步)
|
||||||
|
#rocketmq:
|
||||||
|
# name-server: 127.0.0.1:9876
|
||||||
|
# producer:
|
||||||
|
# group: jarvis-goofish-producer
|
||||||
|
# send-message-timeout: 3000
|
||||||
|
|
||||||
|
jarvis:
|
||||||
|
goofish-order:
|
||||||
|
mq-topic: jarvis-goofish-erp-order
|
||||||
|
consumer-group: jarvis-goofish-order-consumer
|
||||||
|
pull-lookback-hours: 72
|
||||||
|
pull-cron: "0 * * * * ?"
|
||||||
|
auto-ship-cron: "0 2/10 * * * ?"
|
||||||
|
# 订单列表:每页条数(最大 100)
|
||||||
|
pull-page-size: 100
|
||||||
|
# 每授权单次最大页数(最大 100;与 page_size 乘积勿超 10000)
|
||||||
|
pull-max-pages-per-shop: 100
|
||||||
|
# 全量拉单按 update_time 分段(秒),默认 7 天(且不超过 pull-max-update-time-range-seconds)
|
||||||
|
pull-time-chunk-seconds: 604800
|
||||||
|
# 单次列表请求 update_time 最大跨度(秒),须满足平台「6个月内」;默认 180 天
|
||||||
|
pull-max-update-time-range-seconds: 15552000
|
||||||
|
# 全量拉单起点:距今多少天(默认约 3 年)
|
||||||
|
pull-full-history-days: 1095
|
||||||
|
# true=仅拉 auto-ship-order-statuses(省调用,其它状态依赖推送);false=时间窗内全状态(推荐,与本地对齐)
|
||||||
|
pull-list-only-auto-ship-statuses: false
|
||||||
|
auto-ship-batch-size: 20
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -200,16 +200,24 @@ jarvis:
|
|||||||
# 物流接口服务地址
|
# 物流接口服务地址
|
||||||
logistics:
|
logistics:
|
||||||
base-url: http://127.0.0.1:5001
|
base-url: http://127.0.0.1:5001
|
||||||
|
# 同机多进程多端口时配置逗号分隔列表;非空时仅按下列地址轮询,不再使用 base-url
|
||||||
|
base-urls: http://127.0.0.1:5001,http://127.0.0.1:5002,http://127.0.0.1:5003
|
||||||
fetch-path: /fetch_logistics
|
fetch-path: /fetch_logistics
|
||||||
health-path: /health
|
health-path: /health
|
||||||
adhoc-pending-batch-size: 50
|
adhoc-pending-batch-size: 50
|
||||||
|
scan:
|
||||||
|
cron: "0 */5 * * * ?"
|
||||||
|
order-delay-ms: 250
|
||||||
|
max-orders-per-round: 0
|
||||||
# 获取评论接口服务地址(后端转发)
|
# 获取评论接口服务地址(后端转发)
|
||||||
fetch-comments:
|
fetch-comments:
|
||||||
base-url: http://192.168.8.60:5008
|
base-url: http://192.168.8.60:5008
|
||||||
wecom:
|
wecom:
|
||||||
inbound-secret: jarvis_wecom_bridge_change_me
|
inbound-secret: jarvis_wecom_bridge_change_me
|
||||||
wxsend-base-url: http://127.0.0.1:36699
|
wxsend-base-url: https://wxts.van333.cn
|
||||||
push-secret: jarvis_wecom_push_change_me
|
push-secret: jarvis_wecom_push_change_me
|
||||||
|
wxsend-van-token: super_token_b62190c26
|
||||||
|
goofish-notify-touser: "LinPingFan"
|
||||||
session-ttl-minutes: 30
|
session-ttl-minutes: 30
|
||||||
session-idle-timeout-minutes: 30
|
session-idle-timeout-minutes: 30
|
||||||
session-sweep-ms: 60000
|
session-sweep-ms: 60000
|
||||||
@@ -220,7 +228,14 @@ jarvis:
|
|||||||
connect-timeout-ms: 8000
|
connect-timeout-ms: 8000
|
||||||
read-timeout-ms: 120000
|
read-timeout-ms: 120000
|
||||||
wait-reply: true
|
wait-reply: true
|
||||||
reply-take-nth: 2
|
lock-acquire-timeout-ms: 180000
|
||||||
|
circuit-failure-threshold: 5
|
||||||
|
circuit-open-ms: 120000
|
||||||
|
scalper-library-enabled: true
|
||||||
|
async-result-push-enabled: true
|
||||||
|
dedup-enabled: true
|
||||||
|
dedup-ttl-seconds: 900
|
||||||
|
# 「开」取第 2 条;「慢开」由桥接自适应第 2/3 条
|
||||||
# Ollama 大模型服务(监控健康度调试用)
|
# Ollama 大模型服务(监控健康度调试用)
|
||||||
ollama:
|
ollama:
|
||||||
base-url: http://192.168.8.34:11434
|
base-url: http://192.168.8.34:11434
|
||||||
|
|||||||
114
ruoyi-admin/src/main/resources/sql/erp_goofish_init.sql
Normal file
114
ruoyi-admin/src/main/resources/sql/erp_goofish_init.sql
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
-- 闲管家开放平台:应用配置中心 + ERP 订单落库(执行前请备份)
|
||||||
|
-- 说明:菜单需在「系统管理-菜单管理」中自行新增,组件路径示例:
|
||||||
|
-- 配置中心 system/goofish/erpOpenConfig/index
|
||||||
|
-- 订单跟踪 system/goofish/erpGoofishOrder/index
|
||||||
|
-- 变更日志(跨单排查,对接 GET /jarvis/erpGoofishOrder/eventLog/list)system/goofish/erpGoofishEventLog/index
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS erp_open_config (
|
||||||
|
id bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
app_key varchar(64) NOT NULL COMMENT '开放平台 AppKey(appid)',
|
||||||
|
app_secret varchar(128) NOT NULL COMMENT '开放平台 AppSecret',
|
||||||
|
xy_user_name varchar(128) DEFAULT NULL COMMENT '默认闲鱼会员名(展示)',
|
||||||
|
express_code varchar(64) DEFAULT NULL COMMENT '发货用快递公司编码(日日顺物流在官方列表中为 rrs,以「查询快递公司」接口为准)',
|
||||||
|
express_name varchar(64) DEFAULT NULL COMMENT '快递公司名称(展示)',
|
||||||
|
status char(1) NOT NULL DEFAULT '0' COMMENT '0正常 1停用',
|
||||||
|
order_num int(11) NOT NULL DEFAULT 0 COMMENT '排序(小优先)',
|
||||||
|
create_by varchar(64) DEFAULT '',
|
||||||
|
create_time datetime DEFAULT NULL,
|
||||||
|
update_by varchar(64) DEFAULT '',
|
||||||
|
update_time datetime DEFAULT NULL,
|
||||||
|
remark varchar(500) DEFAULT NULL COMMENT '备注',
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
UNIQUE KEY uk_app_key (app_key)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='闲管家开放平台应用配置';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS erp_goofish_order (
|
||||||
|
id bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
app_key varchar(64) NOT NULL COMMENT 'AppKey',
|
||||||
|
seller_id bigint(20) DEFAULT NULL COMMENT '商家ID',
|
||||||
|
user_name varchar(128) DEFAULT NULL COMMENT '闲鱼会员名',
|
||||||
|
order_no varchar(64) NOT NULL COMMENT '闲鱼订单号',
|
||||||
|
order_type int(11) DEFAULT NULL COMMENT '订单类型',
|
||||||
|
order_status int(11) DEFAULT NULL COMMENT '订单状态(推送/列表)',
|
||||||
|
refund_status int(11) DEFAULT NULL COMMENT '退款状态',
|
||||||
|
modify_time bigint(20) DEFAULT NULL COMMENT '订单更新时间(秒)',
|
||||||
|
product_id bigint(20) DEFAULT NULL COMMENT '管家商品ID',
|
||||||
|
item_id bigint(20) DEFAULT NULL COMMENT '闲鱼商品ID',
|
||||||
|
goods_title varchar(512) DEFAULT NULL COMMENT '商品标题(详情 goods.title)',
|
||||||
|
goods_image_url varchar(1024) DEFAULT NULL COMMENT '商品主图 URL(goods.images 首图)',
|
||||||
|
buyer_nick varchar(256) DEFAULT NULL COMMENT '买家昵称(详情 buyer_nick)',
|
||||||
|
pay_amount bigint(20) DEFAULT NULL COMMENT '实付金额(分) pay_amount',
|
||||||
|
detail_waybill_no varchar(128) DEFAULT NULL COMMENT '闲管家详情回传运单号 waybill_no',
|
||||||
|
detail_express_code varchar(64) DEFAULT NULL COMMENT '详情快递编码 express_code',
|
||||||
|
detail_express_name varchar(128) DEFAULT NULL COMMENT '详情快递名称 express_name',
|
||||||
|
receiver_name varchar(128) DEFAULT NULL COMMENT '收货人(详情有则落库)',
|
||||||
|
receiver_mobile varchar(64) DEFAULT NULL COMMENT '收货手机',
|
||||||
|
receiver_address varchar(1000) DEFAULT NULL COMMENT '收货详细地址(address)',
|
||||||
|
receiver_region varchar(256) DEFAULT NULL COMMENT '省市区街道等拼接展示',
|
||||||
|
recv_prov_name varchar(64) DEFAULT NULL COMMENT 'prov_name',
|
||||||
|
recv_city_name varchar(64) DEFAULT NULL COMMENT 'city_name',
|
||||||
|
recv_area_name varchar(64) DEFAULT NULL COMMENT 'area_name',
|
||||||
|
recv_town_name varchar(128) DEFAULT NULL COMMENT 'town_name',
|
||||||
|
detail_json longtext COMMENT '订单详情接口全量 JSON',
|
||||||
|
last_notify_json longtext COMMENT '最近一次推送原文 JSON',
|
||||||
|
jd_order_id bigint(20) DEFAULT NULL COMMENT '关联 jd_order.id(第三方单号=闲鱼单号)',
|
||||||
|
local_waybill_no varchar(128) DEFAULT NULL COMMENT '本地物流扫描得到的运单号',
|
||||||
|
ship_status tinyint(4) NOT NULL DEFAULT '0' COMMENT '0未发货 1已调用发货成功 2发货失败',
|
||||||
|
ship_error varchar(500) DEFAULT NULL COMMENT '发货失败原因',
|
||||||
|
ship_time datetime DEFAULT NULL COMMENT '发货调用成功时间',
|
||||||
|
ship_express_code varchar(64) DEFAULT NULL COMMENT '实际发货使用的快递编码',
|
||||||
|
create_time datetime DEFAULT NULL,
|
||||||
|
update_time datetime DEFAULT NULL,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
UNIQUE KEY uk_app_order (app_key, order_no),
|
||||||
|
KEY idx_jd_order (jd_order_id),
|
||||||
|
KEY idx_order_status (order_status),
|
||||||
|
KEY idx_modify_time (modify_time)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='闲管家 ERP 订单(全量跟踪)';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS erp_goofish_order_event_log (
|
||||||
|
id bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
order_id bigint(20) NOT NULL COMMENT 'erp_goofish_order.id',
|
||||||
|
app_key varchar(64) DEFAULT NULL,
|
||||||
|
order_no varchar(64) NOT NULL,
|
||||||
|
event_type varchar(32) NOT NULL COMMENT 'ORDER_SYNC/LOGISTICS_SYNC/SHIP',
|
||||||
|
source varchar(64) NULL COMMENT 'NOTIFY/LIST/DETAIL_REFRESH 等',
|
||||||
|
message varchar(1024) NOT NULL,
|
||||||
|
create_time datetime DEFAULT NULL,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
KEY idx_goofish_evt_order (order_id),
|
||||||
|
KEY idx_goofish_evt_time (create_time)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='闲管家订单状态/物流/发货变更日志';
|
||||||
|
|
||||||
|
-- 可选:从旧枚举迁入两条示例(密钥请上线后立即修改)
|
||||||
|
-- INSERT INTO erp_open_config (app_key,app_secret,xy_user_name,remark,express_code,express_name,status,order_num)
|
||||||
|
-- VALUES ('1016208368633221','***','余生请多关照66','海尔胡歌',NULL,'日日顺','0',1);
|
||||||
|
|
||||||
|
-- 若依菜单(在「菜单管理」手工添加时参考)
|
||||||
|
-- 父菜单:系统管理下新增目录「闲管家ERP」
|
||||||
|
-- 子菜单1:组件 system/goofish/erpOpenConfig/index 权限前缀 jarvis:erpOpenConfig
|
||||||
|
-- 子菜单2:组件 system/goofish/erpGoofishOrder/index 权限前缀 jarvis:erpGoofishOrder
|
||||||
|
-- 子菜单3:组件 system/goofish/erpGoofishEventLog/index 权限沿用 jarvis:erpGoofishOrder:list 即可(仅列表查询)
|
||||||
|
-- 路由地址建议与订单页同级,如订单为 …/erpGoofishOrder 则本页 …/erpGoofishEventLog(订单页「变更日志排查」按钮依赖此规则)
|
||||||
|
-- 按钮权限示例:
|
||||||
|
-- jarvis:erpOpenConfig:list,query,add,edit,remove
|
||||||
|
-- jarvis:erpGoofishOrder:list,query,edit
|
||||||
|
|
||||||
|
-- —— 已建表升级:详情摘要字段(若列已存在会报错,可逐条执行并忽略)——
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN goods_title varchar(512) NULL COMMENT '商品标题' AFTER item_id;
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN goods_image_url varchar(1024) NULL COMMENT '商品主图URL' AFTER goods_title;
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN buyer_nick varchar(256) NULL COMMENT '买家昵称' AFTER goods_image_url;
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN pay_amount bigint(20) NULL COMMENT '实付金额(分)' AFTER buyer_nick;
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN detail_waybill_no varchar(128) NULL COMMENT '详情运单号' AFTER pay_amount;
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN detail_express_code varchar(64) NULL COMMENT '详情快递编码' AFTER detail_waybill_no;
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN detail_express_name varchar(128) NULL COMMENT '详情快递名称' AFTER detail_express_code;
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN receiver_name varchar(128) NULL COMMENT '收货人' AFTER detail_express_name;
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN receiver_mobile varchar(64) NULL COMMENT '收货手机' AFTER receiver_name;
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN receiver_address varchar(1000) NULL COMMENT '收货地址' AFTER receiver_mobile;
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN receiver_region varchar(256) NULL COMMENT '省市区' AFTER receiver_address;
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN recv_prov_name varchar(64) NULL COMMENT 'prov_name' AFTER receiver_region;
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN recv_city_name varchar(64) NULL COMMENT 'city_name' AFTER recv_prov_name;
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN recv_area_name varchar(64) NULL COMMENT 'area_name' AFTER recv_city_name;
|
||||||
|
-- ALTER TABLE erp_goofish_order ADD COLUMN recv_town_name varchar(128) NULL COMMENT 'town_name' AFTER recv_area_name;
|
||||||
|
|
||||||
|
-- 已建库一键升级(可重复执行、自动判存):请使用同目录 erp_goofish_upgrade.sql
|
||||||
212
ruoyi-admin/src/main/resources/sql/erp_goofish_upgrade.sql
Normal file
212
ruoyi-admin/src/main/resources/sql/erp_goofish_upgrade.sql
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
-- =============================================================================
|
||||||
|
-- 闲管家 ERP:erp_open_config / erp_goofish_order 一键升级脚本
|
||||||
|
-- =============================================================================
|
||||||
|
-- 用法:
|
||||||
|
-- 1. 先备份数据库;连接目标库后执行(或在文件开头加 USE your_database;)
|
||||||
|
-- 2. 可重复执行:已存在的列/索引会自动跳过
|
||||||
|
-- 3. ADD COLUMN 一律不指定 AFTER,避免旧表缺中间列时升级失败(新列落在表尾,不影响业务)
|
||||||
|
-- 环境:MySQL 5.7+ / 8.x(MariaDB 未逐项验证)
|
||||||
|
-- =============================================================================
|
||||||
|
|
||||||
|
SET @schema := DATABASE();
|
||||||
|
|
||||||
|
-- -----------------------------------------------------------------------------
|
||||||
|
-- 1) 表不存在时创建完整结构(与 erp_goofish_init.sql 一致)
|
||||||
|
-- -----------------------------------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS erp_open_config (
|
||||||
|
id bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
app_key varchar(64) NOT NULL COMMENT '开放平台 AppKey(appid)',
|
||||||
|
app_secret varchar(128) NOT NULL COMMENT '开放平台 AppSecret',
|
||||||
|
xy_user_name varchar(128) DEFAULT NULL COMMENT '默认闲鱼会员名(展示)',
|
||||||
|
express_code varchar(64) DEFAULT NULL COMMENT '发货用快递公司编码(日日顺物流在官方列表中为 rrs)',
|
||||||
|
express_name varchar(64) DEFAULT NULL COMMENT '快递公司名称(展示)',
|
||||||
|
status char(1) NOT NULL DEFAULT '0' COMMENT '0正常 1停用',
|
||||||
|
order_num int(11) NOT NULL DEFAULT 0 COMMENT '排序(小优先)',
|
||||||
|
create_by varchar(64) DEFAULT '',
|
||||||
|
create_time datetime DEFAULT NULL,
|
||||||
|
update_by varchar(64) DEFAULT '',
|
||||||
|
update_time datetime DEFAULT NULL,
|
||||||
|
remark varchar(500) DEFAULT NULL COMMENT '备注',
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
UNIQUE KEY uk_app_key (app_key)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='闲管家开放平台应用配置';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS erp_goofish_order (
|
||||||
|
id bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
app_key varchar(64) NOT NULL COMMENT 'AppKey',
|
||||||
|
seller_id bigint(20) DEFAULT NULL COMMENT '商家ID',
|
||||||
|
user_name varchar(128) DEFAULT NULL COMMENT '闲鱼会员名',
|
||||||
|
order_no varchar(64) NOT NULL COMMENT '闲鱼订单号',
|
||||||
|
order_type int(11) DEFAULT NULL COMMENT '订单类型',
|
||||||
|
order_status int(11) DEFAULT NULL COMMENT '订单状态(推送/列表)',
|
||||||
|
refund_status int(11) DEFAULT NULL COMMENT '退款状态',
|
||||||
|
modify_time bigint(20) DEFAULT NULL COMMENT '订单更新时间(秒)',
|
||||||
|
product_id bigint(20) DEFAULT NULL COMMENT '管家商品ID',
|
||||||
|
item_id bigint(20) DEFAULT NULL COMMENT '闲鱼商品ID',
|
||||||
|
goods_title varchar(512) DEFAULT NULL COMMENT '商品标题(详情 goods.title)',
|
||||||
|
goods_image_url varchar(1024) DEFAULT NULL COMMENT '商品主图 URL(goods.images 首图)',
|
||||||
|
buyer_nick varchar(256) DEFAULT NULL COMMENT '买家昵称(详情 buyer_nick)',
|
||||||
|
pay_amount bigint(20) DEFAULT NULL COMMENT '实付金额(分) pay_amount',
|
||||||
|
detail_waybill_no varchar(128) DEFAULT NULL COMMENT '闲管家详情回传运单号 waybill_no',
|
||||||
|
detail_express_code varchar(64) DEFAULT NULL COMMENT '详情快递编码 express_code',
|
||||||
|
detail_express_name varchar(128) DEFAULT NULL COMMENT '详情快递名称 express_name',
|
||||||
|
receiver_name varchar(128) DEFAULT NULL COMMENT '收货人(详情有则落库)',
|
||||||
|
receiver_mobile varchar(64) DEFAULT NULL COMMENT '收货手机',
|
||||||
|
receiver_address varchar(1000) DEFAULT NULL COMMENT '收货详细地址(address)',
|
||||||
|
receiver_region varchar(256) DEFAULT NULL COMMENT '省市区街道等拼接展示',
|
||||||
|
recv_prov_name varchar(64) DEFAULT NULL COMMENT 'prov_name',
|
||||||
|
recv_city_name varchar(64) DEFAULT NULL COMMENT 'city_name',
|
||||||
|
recv_area_name varchar(64) DEFAULT NULL COMMENT 'area_name',
|
||||||
|
recv_town_name varchar(128) DEFAULT NULL COMMENT 'town_name',
|
||||||
|
detail_json longtext COMMENT '订单详情接口全量 JSON',
|
||||||
|
last_notify_json longtext COMMENT '最近一次推送原文 JSON',
|
||||||
|
jd_order_id bigint(20) DEFAULT NULL COMMENT '关联 jd_order.id(第三方单号=闲鱼单号)',
|
||||||
|
local_waybill_no varchar(128) DEFAULT NULL COMMENT '本地物流扫描得到的运单号',
|
||||||
|
ship_status tinyint(4) NOT NULL DEFAULT '0' COMMENT '0未发货 1已调用发货成功 2发货失败',
|
||||||
|
ship_error varchar(500) DEFAULT NULL COMMENT '发货失败原因',
|
||||||
|
ship_time datetime DEFAULT NULL COMMENT '发货调用成功时间',
|
||||||
|
ship_express_code varchar(64) DEFAULT NULL COMMENT '实际发货使用的快递编码',
|
||||||
|
create_time datetime DEFAULT NULL,
|
||||||
|
update_time datetime DEFAULT NULL,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
UNIQUE KEY uk_app_order (app_key, order_no),
|
||||||
|
KEY idx_jd_order (jd_order_id),
|
||||||
|
KEY idx_order_status (order_status),
|
||||||
|
KEY idx_modify_time (modify_time)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='闲管家 ERP 订单(全量跟踪)';
|
||||||
|
|
||||||
|
-- -----------------------------------------------------------------------------
|
||||||
|
-- 2) 存储过程:列不存在则 ADD
|
||||||
|
-- -----------------------------------------------------------------------------
|
||||||
|
DROP PROCEDURE IF EXISTS jarvis_erp_goofish_add_column;
|
||||||
|
DROP PROCEDURE IF EXISTS jarvis_erp_goofish_add_index;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
|
||||||
|
CREATE PROCEDURE jarvis_erp_goofish_add_column(
|
||||||
|
IN p_table VARCHAR(64),
|
||||||
|
IN p_column VARCHAR(64),
|
||||||
|
IN p_ddl TEXT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
DECLARE col_exists INT DEFAULT 0;
|
||||||
|
SELECT COUNT(*) INTO col_exists
|
||||||
|
FROM information_schema.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = @schema
|
||||||
|
AND TABLE_NAME = p_table
|
||||||
|
AND COLUMN_NAME = p_column;
|
||||||
|
IF col_exists = 0 THEN
|
||||||
|
SET @stmt := CONCAT('ALTER TABLE `', p_table, '` ADD COLUMN `', p_column, '` ', p_ddl);
|
||||||
|
PREPARE ps FROM @stmt;
|
||||||
|
EXECUTE ps;
|
||||||
|
DEALLOCATE PREPARE ps;
|
||||||
|
END IF;
|
||||||
|
END$$
|
||||||
|
|
||||||
|
CREATE PROCEDURE jarvis_erp_goofish_add_index(
|
||||||
|
IN p_table VARCHAR(64),
|
||||||
|
IN p_index VARCHAR(64),
|
||||||
|
IN p_columns VARCHAR(200)
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
DECLARE idx_exists INT DEFAULT 0;
|
||||||
|
SELECT COUNT(*) INTO idx_exists
|
||||||
|
FROM information_schema.statistics
|
||||||
|
WHERE TABLE_SCHEMA = @schema
|
||||||
|
AND TABLE_NAME = p_table
|
||||||
|
AND INDEX_NAME = p_index;
|
||||||
|
IF idx_exists = 0 THEN
|
||||||
|
SET @stmt := CONCAT('ALTER TABLE `', p_table, '` ADD INDEX `', p_index, '` (', p_columns, ')');
|
||||||
|
PREPARE ps FROM @stmt;
|
||||||
|
EXECUTE ps;
|
||||||
|
DEALLOCATE PREPARE ps;
|
||||||
|
END IF;
|
||||||
|
END$$
|
||||||
|
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
|
-- -----------------------------------------------------------------------------
|
||||||
|
-- 3) erp_goofish_order:补齐缺列(与当前 Java 实体 / erp_goofish_init.sql 一致)
|
||||||
|
-- -----------------------------------------------------------------------------
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'seller_id', 'bigint(20) NULL COMMENT ''商家ID''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'user_name', 'varchar(128) NULL COMMENT ''闲鱼会员名''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'order_type', 'int(11) NULL COMMENT ''订单类型''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'order_status', 'int(11) NULL COMMENT ''订单状态(推送/列表)''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'refund_status', 'int(11) NULL COMMENT ''退款状态''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'modify_time', 'bigint(20) NULL COMMENT ''订单更新时间(秒)''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'product_id', 'bigint(20) NULL COMMENT ''管家商品ID''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'item_id', 'bigint(20) NULL COMMENT ''闲鱼商品ID''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'goods_title', 'varchar(512) NULL COMMENT ''商品标题(详情 goods.title)''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'goods_image_url', 'varchar(1024) NULL COMMENT ''商品主图 URL(goods.images 首图)''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'buyer_nick', 'varchar(256) NULL COMMENT ''买家昵称(详情 buyer_nick)''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'pay_amount', 'bigint(20) NULL COMMENT ''实付金额(分) pay_amount''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'detail_waybill_no', 'varchar(128) NULL COMMENT ''闲管家详情回传运单号 waybill_no''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'detail_express_code', 'varchar(64) NULL COMMENT ''详情快递编码 express_code''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'detail_express_name', 'varchar(128) NULL COMMENT ''详情快递名称 express_name''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'receiver_name', 'varchar(128) NULL COMMENT ''收货人(详情有则落库)''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'receiver_mobile', 'varchar(64) NULL COMMENT ''收货手机''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'receiver_address', 'varchar(1000) NULL COMMENT ''收货详细地址(address)''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'receiver_region', 'varchar(256) NULL COMMENT ''省市区街道等拼接展示''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'recv_prov_name', 'varchar(64) NULL COMMENT ''prov_name''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'recv_city_name', 'varchar(64) NULL COMMENT ''city_name''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'recv_area_name', 'varchar(64) NULL COMMENT ''area_name''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'recv_town_name', 'varchar(128) NULL COMMENT ''town_name''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'detail_json', 'longtext NULL COMMENT ''订单详情接口全量 JSON''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'last_notify_json', 'longtext NULL COMMENT ''最近一次推送原文 JSON''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'jd_order_id', 'bigint(20) NULL COMMENT ''关联 jd_order.id(第三方单号=闲鱼单号)''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'local_waybill_no', 'varchar(128) NULL COMMENT ''本地物流扫描得到的运单号''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'ship_status', 'tinyint(4) NOT NULL DEFAULT 0 COMMENT ''0未发货 1已调用发货成功 2发货失败''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'ship_error', 'varchar(500) NULL COMMENT ''发货失败原因''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'ship_time', 'datetime NULL COMMENT ''发货调用成功时间''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'ship_express_code', 'varchar(64) NULL COMMENT ''实际发货使用的快递编码''');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'create_time', 'datetime NULL');
|
||||||
|
CALL jarvis_erp_goofish_add_column('erp_goofish_order', 'update_time', 'datetime NULL');
|
||||||
|
|
||||||
|
-- -----------------------------------------------------------------------------
|
||||||
|
-- 4) 索引(手工建表可能缺)
|
||||||
|
-- -----------------------------------------------------------------------------
|
||||||
|
CALL jarvis_erp_goofish_add_index('erp_goofish_order', 'idx_jd_order', '`jd_order_id`');
|
||||||
|
CALL jarvis_erp_goofish_add_index('erp_goofish_order', 'idx_order_status', '`order_status`');
|
||||||
|
CALL jarvis_erp_goofish_add_index('erp_goofish_order', 'idx_modify_time', '`modify_time`');
|
||||||
|
|
||||||
|
-- -----------------------------------------------------------------------------
|
||||||
|
-- 5) 唯一键 uk_app_order
|
||||||
|
-- 若已存在同名约束则跳过;若 (app_key,order_no) 有重复行会报错,需先清洗数据。
|
||||||
|
-- 若已通过其它名称建了 (app_key,order_no) 唯一索引,请勿重复执行本节(可能报 Duplicate key)。
|
||||||
|
-- -----------------------------------------------------------------------------
|
||||||
|
SET @uk := (
|
||||||
|
SELECT COUNT(*) FROM information_schema.table_constraints
|
||||||
|
WHERE table_schema = @schema AND table_name = 'erp_goofish_order'
|
||||||
|
AND constraint_name = 'uk_app_order' AND constraint_type = 'UNIQUE'
|
||||||
|
);
|
||||||
|
SET @sql_uk := IF(@uk = 0,
|
||||||
|
'ALTER TABLE erp_goofish_order ADD UNIQUE KEY uk_app_order (app_key, order_no)',
|
||||||
|
'SELECT ''uk_app_order 已存在,跳过'' AS note');
|
||||||
|
PREPARE puk FROM @sql_uk;
|
||||||
|
EXECUTE puk;
|
||||||
|
DEALLOCATE PREPARE puk;
|
||||||
|
|
||||||
|
-- -----------------------------------------------------------------------------
|
||||||
|
-- 5.5) 订单变更事件日志表
|
||||||
|
-- -----------------------------------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS erp_goofish_order_event_log (
|
||||||
|
id bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
order_id bigint(20) NOT NULL COMMENT 'erp_goofish_order.id',
|
||||||
|
app_key varchar(64) DEFAULT NULL,
|
||||||
|
order_no varchar(64) NOT NULL,
|
||||||
|
event_type varchar(32) NOT NULL COMMENT 'ORDER_SYNC/LOGISTICS_SYNC/SHIP',
|
||||||
|
source varchar(64) NULL COMMENT 'NOTIFY/LIST/DETAIL_REFRESH 等',
|
||||||
|
message varchar(1024) NOT NULL,
|
||||||
|
create_time datetime DEFAULT NULL,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
KEY idx_goofish_evt_order (order_id),
|
||||||
|
KEY idx_goofish_evt_time (create_time)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='闲管家订单状态/物流/发货变更日志';
|
||||||
|
|
||||||
|
-- -----------------------------------------------------------------------------
|
||||||
|
-- 6) 清理存储过程
|
||||||
|
-- -----------------------------------------------------------------------------
|
||||||
|
DROP PROCEDURE IF EXISTS jarvis_erp_goofish_add_column;
|
||||||
|
DROP PROCEDURE IF EXISTS jarvis_erp_goofish_add_index;
|
||||||
|
|
||||||
|
SELECT 'erp_goofish_upgrade.sql 执行结束' AS message;
|
||||||
@@ -114,6 +114,8 @@ public class SecurityConfig
|
|||||||
requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
|
requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
|
||||||
// 公开接口,允许匿名访问
|
// 公开接口,允许匿名访问
|
||||||
.antMatchers("/public/**").permitAll()
|
.antMatchers("/public/**").permitAll()
|
||||||
|
// 开放页面接口(京东等),允许匿名访问
|
||||||
|
.antMatchers("/open/**").permitAll()
|
||||||
// 腾讯文档OAuth回调接口,允许匿名访问
|
// 腾讯文档OAuth回调接口,允许匿名访问
|
||||||
.antMatchers("/jarvis/tendoc/oauth/callback").permitAll()
|
.antMatchers("/jarvis/tendoc/oauth/callback").permitAll()
|
||||||
// 腾讯文档OAuth回调接口(备用路径),允许匿名访问
|
// 腾讯文档OAuth回调接口(备用路径),允许匿名访问
|
||||||
|
|||||||
@@ -28,6 +28,11 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.rocketmq</groupId>
|
||||||
|
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
* 授权列表查询请求(示例类)
|
* 授权列表查询请求(示例类)
|
||||||
*/
|
*/
|
||||||
public class AuthorizeListQueryRequest extends ERPRequestBase {
|
public class AuthorizeListQueryRequest extends ERPRequestBase {
|
||||||
public AuthorizeListQueryRequest(ERPAccount erpAccount) {
|
public AuthorizeListQueryRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/user/authorize/list", erpAccount);
|
super("https://open.goofish.pro/api/open/user/authorize/list", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import lombok.Getter;
|
|||||||
* @description:ERP账户枚举类
|
* @description:ERP账户枚举类
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum ERPAccount {
|
public enum ERPAccount implements IERPAccount {
|
||||||
// 胡歌1016208368633221
|
// 胡歌1016208368633221
|
||||||
ACCOUNT_HUGE("1016208368633221", "waLiRMgFcixLbcLjUSSwo370Hp1nBcBu","余生请多关照66","海尔胡歌"),
|
ACCOUNT_HUGE("1016208368633221", "waLiRMgFcixLbcLjUSSwo370Hp1nBcBu","余生请多关照66","海尔胡歌"),
|
||||||
// 刘强东anotherApiKey
|
// 刘强东anotherApiKey
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ public abstract class ERPRequestBase {
|
|||||||
|
|
||||||
protected String url;
|
protected String url;
|
||||||
protected String sign;
|
protected String sign;
|
||||||
protected ERPAccount erpAccount;
|
protected IERPAccount erpAccount;
|
||||||
@Setter
|
@Setter
|
||||||
protected JSONObject requestBody;
|
protected JSONObject requestBody;
|
||||||
protected long timestamp; // 统一时间戳字段
|
protected long timestamp; // 统一时间戳字段
|
||||||
|
|
||||||
public ERPRequestBase(String url, ERPAccount erpAccount) {
|
public ERPRequestBase(String url, IERPAccount erpAccount) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.erpAccount = erpAccount;
|
this.erpAccount = erpAccount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
package com.ruoyi.erp.request;
|
package com.ruoyi.erp.request;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询快递公司请求
|
* 查询快递公司请求
|
||||||
*
|
* <p>
|
||||||
* 对应接口:POST /api/open/express/companies
|
* 对应接口:POST /api/open/express/companies<br>
|
||||||
|
* 闲管家规定:无业务参数时应对 <strong>空 JSON 对象</strong> 做 {@code md5("{}")},且 POST 原文必须与之一致;
|
||||||
|
* Apifox 调试时请勿留空 body,须填 {@code {}},否则签名与平台不一致会拉不到数据。
|
||||||
*/
|
*/
|
||||||
public class ExpressCompaniesQueryRequest extends ERPRequestBase {
|
public class ExpressCompaniesQueryRequest extends ERPRequestBase {
|
||||||
public ExpressCompaniesQueryRequest(ERPAccount erpAccount) {
|
public ExpressCompaniesQueryRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/express/companies", erpAccount);
|
super("https://open.goofish.pro/api/open/express/companies", erpAccount);
|
||||||
|
this.requestBody = new JSONObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.erp.request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闲管家开放平台凭证({@link ERPAccount} 或库表配置行均可实现本接口)
|
||||||
|
*/
|
||||||
|
public interface IERPAccount {
|
||||||
|
|
||||||
|
String getApiKey();
|
||||||
|
|
||||||
|
String getApiKeySecret();
|
||||||
|
|
||||||
|
/** 闲鱼会员名(授权维度展示用,可为空) */
|
||||||
|
String getXyName();
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
* 对应接口:POST /api/open/order/detail
|
* 对应接口:POST /api/open/order/detail
|
||||||
*/
|
*/
|
||||||
public class OrderDetailQueryRequest extends ERPRequestBase {
|
public class OrderDetailQueryRequest extends ERPRequestBase {
|
||||||
public OrderDetailQueryRequest(ERPAccount erpAccount) {
|
public OrderDetailQueryRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/order/detail", erpAccount);
|
super("https://open.goofish.pro/api/open/order/detail", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
* 对应接口:POST /api/open/order/kam/list
|
* 对应接口:POST /api/open/order/kam/list
|
||||||
*/
|
*/
|
||||||
public class OrderKamListQueryRequest extends ERPRequestBase {
|
public class OrderKamListQueryRequest extends ERPRequestBase {
|
||||||
public OrderKamListQueryRequest(ERPAccount erpAccount) {
|
public OrderKamListQueryRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/order/kam/list", erpAccount);
|
super("https://open.goofish.pro/api/open/order/kam/list", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
* 对应接口:POST /api/open/order/list
|
* 对应接口:POST /api/open/order/list
|
||||||
*/
|
*/
|
||||||
public class OrderListQueryRequest extends ERPRequestBase {
|
public class OrderListQueryRequest extends ERPRequestBase {
|
||||||
public OrderListQueryRequest(ERPAccount erpAccount) {
|
public OrderListQueryRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/order/list", erpAccount);
|
super("https://open.goofish.pro/api/open/order/list", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
* 对应接口:POST /api/open/order/modify/price
|
* 对应接口:POST /api/open/order/modify/price
|
||||||
*/
|
*/
|
||||||
public class OrderModifyPriceRequest extends ERPRequestBase {
|
public class OrderModifyPriceRequest extends ERPRequestBase {
|
||||||
public OrderModifyPriceRequest(ERPAccount erpAccount) {
|
public OrderModifyPriceRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/order/modify/price", erpAccount);
|
super("https://open.goofish.pro/api/open/order/modify/price", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
* 对应接口:POST /api/open/order/ship
|
* 对应接口:POST /api/open/order/ship
|
||||||
*/
|
*/
|
||||||
public class OrderShipRequest extends ERPRequestBase {
|
public class OrderShipRequest extends ERPRequestBase {
|
||||||
public OrderShipRequest(ERPAccount erpAccount) {
|
public OrderShipRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/order/ship", erpAccount);
|
super("https://open.goofish.pro/api/open/order/ship", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
* 限制:每批次最多50个商品
|
* 限制:每批次最多50个商品
|
||||||
*/
|
*/
|
||||||
public class ProductBatchCreateRequest extends ERPRequestBase {
|
public class ProductBatchCreateRequest extends ERPRequestBase {
|
||||||
public ProductBatchCreateRequest(ERPAccount erpAccount) {
|
public ProductBatchCreateRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/product/batchCreate", erpAccount);
|
super("https://open.goofish.pro/api/open/product/batchCreate", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
* - flash_sale_type(选填):闲鱼特卖类型
|
* - flash_sale_type(选填):闲鱼特卖类型
|
||||||
*/
|
*/
|
||||||
public class ProductCategoryListQueryRequest extends ERPRequestBase {
|
public class ProductCategoryListQueryRequest extends ERPRequestBase {
|
||||||
public ProductCategoryListQueryRequest(ERPAccount erpAccount) {
|
public ProductCategoryListQueryRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/product/category/list", erpAccount);
|
super("https://open.goofish.pro/api/open/product/category/list", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class ProductCreateRequest extends ERPRequestBase {
|
|||||||
private final JSONArray publishShop = new JSONArray();
|
private final JSONArray publishShop = new JSONArray();
|
||||||
private final JSONArray skuItems = new JSONArray();
|
private final JSONArray skuItems = new JSONArray();
|
||||||
|
|
||||||
public ProductCreateRequest(ERPAccount erpAccount) {
|
public ProductCreateRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/product/create", erpAccount);
|
super("https://open.goofish.pro/api/open/product/create", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
* 对应接口:POST /api/open/product/delete
|
* 对应接口:POST /api/open/product/delete
|
||||||
*/
|
*/
|
||||||
public class ProductDeleteRequest extends ERPRequestBase {
|
public class ProductDeleteRequest extends ERPRequestBase {
|
||||||
public ProductDeleteRequest(ERPAccount erpAccount) {
|
public ProductDeleteRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/product/delete", erpAccount);
|
super("https://open.goofish.pro/api/open/product/delete", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
* - product_id(必填):管家商品ID
|
* - product_id(必填):管家商品ID
|
||||||
*/
|
*/
|
||||||
public class ProductDetailQueryRequest extends ERPRequestBase {
|
public class ProductDetailQueryRequest extends ERPRequestBase {
|
||||||
public ProductDetailQueryRequest(ERPAccount erpAccount) {
|
public ProductDetailQueryRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/product/detail", erpAccount);
|
super("https://open.goofish.pro/api/open/product/detail", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
* 对应接口:POST /api/open/product/downShelf
|
* 对应接口:POST /api/open/product/downShelf
|
||||||
*/
|
*/
|
||||||
public class ProductDownShelfRequest extends ERPRequestBase {
|
public class ProductDownShelfRequest extends ERPRequestBase {
|
||||||
public ProductDownShelfRequest(ERPAccount erpAccount) {
|
public ProductDownShelfRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/product/downShelf", erpAccount);
|
super("https://open.goofish.pro/api/open/product/downShelf", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class ProductEditRequest extends ERPRequestBase {
|
|||||||
private final JSONArray publishShop = new JSONArray();
|
private final JSONArray publishShop = new JSONArray();
|
||||||
private final JSONArray skuItems = new JSONArray();
|
private final JSONArray skuItems = new JSONArray();
|
||||||
|
|
||||||
public ProductEditRequest(ERPAccount erpAccount) {
|
public ProductEditRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/product/edit", erpAccount);
|
super("https://open.goofish.pro/api/open/product/edit", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
* 对应接口:POST /api/open/product/edit/stock
|
* 对应接口:POST /api/open/product/edit/stock
|
||||||
*/
|
*/
|
||||||
public class ProductEditStockRequest extends ERPRequestBase {
|
public class ProductEditStockRequest extends ERPRequestBase {
|
||||||
public ProductEditStockRequest(ERPAccount erpAccount) {
|
public ProductEditStockRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/product/edit/stock", erpAccount);
|
super("https://open.goofish.pro/api/open/product/edit/stock", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.ruoyi.erp.request;
|
|||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
|
||||||
public class ProductListQueryRequest extends ERPRequestBase {
|
public class ProductListQueryRequest extends ERPRequestBase {
|
||||||
public ProductListQueryRequest(ERPAccount erpAccount) {
|
public ProductListQueryRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/product/list", erpAccount);
|
super("https://open.goofish.pro/api/open/product/list", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
* - sub_property_id(选填):属性值ID(用于二级属性查询)
|
* - sub_property_id(选填):属性值ID(用于二级属性查询)
|
||||||
*/
|
*/
|
||||||
public class ProductPropertyListQueryRequest extends ERPRequestBase {
|
public class ProductPropertyListQueryRequest extends ERPRequestBase {
|
||||||
public ProductPropertyListQueryRequest(ERPAccount erpAccount) {
|
public ProductPropertyListQueryRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/product/pv/list", erpAccount);
|
super("https://open.goofish.pro/api/open/product/pv/list", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
* 对应接口:POST /api/open/product/publish
|
* 对应接口:POST /api/open/product/publish
|
||||||
*/
|
*/
|
||||||
public class ProductPublishRequest extends ERPRequestBase {
|
public class ProductPublishRequest extends ERPRequestBase {
|
||||||
public ProductPublishRequest(ERPAccount erpAccount) {
|
public ProductPublishRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/product/publish", erpAccount);
|
super("https://open.goofish.pro/api/open/product/publish", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import java.util.Collection;
|
|||||||
* - product_id(必填):管家商品ID数组,最多100个
|
* - product_id(必填):管家商品ID数组,最多100个
|
||||||
*/
|
*/
|
||||||
public class ProductSkuListQueryRequest extends ERPRequestBase {
|
public class ProductSkuListQueryRequest extends ERPRequestBase {
|
||||||
public ProductSkuListQueryRequest(ERPAccount erpAccount) {
|
public ProductSkuListQueryRequest(IERPAccount erpAccount) {
|
||||||
super("https://open.goofish.pro/api/open/product/sku/list", erpAccount);
|
super("https://open.goofish.pro/api/open/product/sku/list", erpAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.ruoyi.jarvis.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class GoofishAsyncConfig {
|
||||||
|
|
||||||
|
@Bean("goofishTaskExecutor")
|
||||||
|
public Executor goofishTaskExecutor() {
|
||||||
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
|
// 仅用于未配置 RocketMQ 时 HTTP 回调路径的 @Async;过小易在拉单/回调并发时排队拖慢企微通知
|
||||||
|
executor.setCorePoolSize(4);
|
||||||
|
executor.setMaxPoolSize(16);
|
||||||
|
executor.setQueueCapacity(500);
|
||||||
|
executor.setThreadNamePrefix("goofish-");
|
||||||
|
executor.initialize();
|
||||||
|
return executor;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package com.ruoyi.jarvis.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闲管家订单:MQ 主题、定时拉单与自动发货调度
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "jarvis.goofish-order")
|
||||||
|
public class JarvisGoofishProperties {
|
||||||
|
|
||||||
|
/** RocketMQ Topic(需配置 rocketmq.name-server 后生效) */
|
||||||
|
private String mqTopic = "jarvis-goofish-erp-order";
|
||||||
|
|
||||||
|
private String consumerGroup = "jarvis-goofish-order-consumer";
|
||||||
|
|
||||||
|
/** 回溯拉单小时数(定时/增量) */
|
||||||
|
private int pullLookbackHours = 72;
|
||||||
|
|
||||||
|
/** 拉单定时 cron */
|
||||||
|
private String pullCron = "0 * * * * ?";
|
||||||
|
|
||||||
|
/** 同步运单 + 自动发货 cron */
|
||||||
|
private String autoShipCron = "0 2/10 * * * ?";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单列表 page_size(开放平台最大 100)
|
||||||
|
*/
|
||||||
|
private int pullPageSize = 100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单次拉单每授权最大页数(开放平台 page_no 最大 100;page_no×page_size 勿超过 10000)
|
||||||
|
*/
|
||||||
|
private int pullMaxPagesPerShop = 100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全量/长历史拉单时,按 update_time 切片的窗口长度(秒),避免单窗内订单量过大触发平台限制
|
||||||
|
*/
|
||||||
|
private int pullTimeChunkSeconds = 604800;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单列表单次请求中 update_time 区间最大跨度(秒)。开放平台返回「只能查询时间范围6个月内的数据」时须≤此值;默认约 180 天留余量
|
||||||
|
*/
|
||||||
|
private int pullMaxUpdateTimeRangeSeconds = 15552000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全量拉单从「当前时间」往前推多少天作为起点(仅 full 接口;可自行改大)
|
||||||
|
*/
|
||||||
|
private int pullFullHistoryDays = 1095;
|
||||||
|
|
||||||
|
private int autoShipBatchSize = 20;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许触发闲鱼开放平台「发货」的本地 order_status(逗号分隔,与推送/列表一致)。默认 12 通常表示待发货。
|
||||||
|
*/
|
||||||
|
private String autoShipOrderStatuses = "12";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 为 true 时定时/增量列表拉单仅按 {@link #autoShipOrderStatuses} 过滤(减少调用量,但会漏掉其它状态)。
|
||||||
|
* 默认 false:按时间窗拉全状态,与本地 upsert 对齐,推送仍可用于更低延迟。
|
||||||
|
*/
|
||||||
|
private boolean pullListOnlyAutoShipStatuses = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未在 erp_open_config 配置 express_code 时,自动发货使用的默认快递公司编码(官方列表中日日顺多为 rrs)。
|
||||||
|
*/
|
||||||
|
private String defaultShipExpressCode = "rrs";
|
||||||
|
|
||||||
|
/** 与 defaultShipExpressCode 配套的展示名称 */
|
||||||
|
private String defaultShipExpressName = "日日顺";
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package com.ruoyi.jarvis.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闲管家 ERP 订单(推送 + 拉单 + 详情全量)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ErpGoofishOrder {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String appKey;
|
||||||
|
private Long sellerId;
|
||||||
|
private String userName;
|
||||||
|
private String orderNo;
|
||||||
|
private Integer orderType;
|
||||||
|
private Integer orderStatus;
|
||||||
|
private Integer refundStatus;
|
||||||
|
private Long modifyTime;
|
||||||
|
private Long productId;
|
||||||
|
private Long itemId;
|
||||||
|
/** 详情 goods.title */
|
||||||
|
private String goodsTitle;
|
||||||
|
/** goods.images 首张或其它单图字段 */
|
||||||
|
private String goodsImageUrl;
|
||||||
|
private String buyerNick;
|
||||||
|
/** 开放平台 pay_amount,单位:分 */
|
||||||
|
private Long payAmount;
|
||||||
|
/** 闲管家详情 waybill_no */
|
||||||
|
private String detailWaybillNo;
|
||||||
|
private String detailExpressCode;
|
||||||
|
private String detailExpressName;
|
||||||
|
private String receiverName;
|
||||||
|
private String receiverMobile;
|
||||||
|
private String receiverAddress;
|
||||||
|
/** 省市区拼接 */
|
||||||
|
private String receiverRegion;
|
||||||
|
/** 待发货等状态下开放平台返回的分级地址(与 prov_name/city_name/area_name/town_name 一致) */
|
||||||
|
private String recvProvName;
|
||||||
|
private String recvCityName;
|
||||||
|
private String recvAreaName;
|
||||||
|
private String recvTownName;
|
||||||
|
private String detailJson;
|
||||||
|
private String lastNotifyJson;
|
||||||
|
private Long jdOrderId;
|
||||||
|
private String localWaybillNo;
|
||||||
|
/** 0未发货 1成功 2失败 */
|
||||||
|
private Integer shipStatus;
|
||||||
|
private String shipError;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date shipTime;
|
||||||
|
private String shipExpressCode;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/** 联查:第三方单号(jd_order) */
|
||||||
|
private String jdThirdPartyOrderNo;
|
||||||
|
/** 联查:内部备注单号 */
|
||||||
|
private String jdRemark;
|
||||||
|
/** 联查:本地京东单收件地址 jd_order.address(闲鱼详情常不返回明文地址) */
|
||||||
|
private String jdAddress;
|
||||||
|
/** 联查:京东单型号 jd_order.model_number */
|
||||||
|
private String jdModelNumber;
|
||||||
|
|
||||||
|
// --------- 以下为列表查询扩展条件(不参与 insert/update) ---------
|
||||||
|
/** 运单关键字:命中详情运单号或本地运单号(模糊) */
|
||||||
|
private String waybillKeyword;
|
||||||
|
/** 开放平台 modify_time 下限(Unix 秒,含边界) */
|
||||||
|
private Long modifyTimeBegin;
|
||||||
|
/** 开放平台 modify_time 上限(Unix 秒,含边界) */
|
||||||
|
private Long modifyTimeEnd;
|
||||||
|
/** 是否已关联京东单:1 已关联 jd_order_id 非空;0 未关联;null 不限 */
|
||||||
|
private Integer jdLinkFilter;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.ruoyi.jarvis.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闲管家订单变更日志:状态刷新、物流变动、发货结果等
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ErpGoofishOrderEventLog {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
/** erp_goofish_order.id */
|
||||||
|
private Long orderId;
|
||||||
|
private String appKey;
|
||||||
|
private String orderNo;
|
||||||
|
/** ORDER_SYNC / LOGISTICS_SYNC / SHIP */
|
||||||
|
private String eventType;
|
||||||
|
/** NOTIFY、LIST、DETAIL_REFRESH、JD_LOGISTICS_PUSH、REDIS_WAYBILL、AUTO_SHIP 等 */
|
||||||
|
private String source;
|
||||||
|
private String message;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.ruoyi.jarvis.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闲管家订单变更日志(全表检索,用于排查)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class ErpGoofishOrderEventLogQuery extends BaseEntity {
|
||||||
|
|
||||||
|
private Long orderId;
|
||||||
|
private String appKey;
|
||||||
|
private String orderNo;
|
||||||
|
private String eventType;
|
||||||
|
private String source;
|
||||||
|
/** 模糊匹配 message */
|
||||||
|
private String messageKeyword;
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.ruoyi.jarvis.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import com.ruoyi.erp.request.IERPAccount;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闲管家开放平台应用配置(配置中心)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class ErpOpenConfig extends BaseEntity implements IERPAccount {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String appKey;
|
||||||
|
private String appSecret;
|
||||||
|
private String xyUserName;
|
||||||
|
/** 发货:快递公司编码(如日日顺,需与开放平台一致) */
|
||||||
|
private String expressCode;
|
||||||
|
private String expressName;
|
||||||
|
private String status;
|
||||||
|
private Integer orderNum;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getApiKey() {
|
||||||
|
return appKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getApiKeySecret() {
|
||||||
|
return appSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getXyName() {
|
||||||
|
return xyUserName;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,478 @@
|
|||||||
|
package com.ruoyi.jarvis.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闲鱼商品导出专用行(字段偏多,便于给 AI / 离线分析使用)
|
||||||
|
*/
|
||||||
|
public class ErpProductExportRow implements Serializable
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Excel(name = "导出批次时间", width = 22, sort = 1)
|
||||||
|
private String exportBatchAt;
|
||||||
|
|
||||||
|
@Excel(name = "本表主键ID", sort = 2)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Excel(name = "管家商品ID", sort = 3)
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
@Excel(name = "管家商品ID文本", width = 22, sort = 4)
|
||||||
|
private String productIdText;
|
||||||
|
|
||||||
|
@Excel(name = "商品标题", width = 45, sort = 5)
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Excel(name = "主图URL", width = 55, sort = 6)
|
||||||
|
private String mainImage;
|
||||||
|
|
||||||
|
@Excel(name = "价格_分_原始整数", sort = 7)
|
||||||
|
private Long priceFen;
|
||||||
|
|
||||||
|
@Excel(name = "价格_元_可读", sort = 8)
|
||||||
|
private String priceYuan;
|
||||||
|
|
||||||
|
@Excel(name = "库存", sort = 9)
|
||||||
|
private Integer stock;
|
||||||
|
|
||||||
|
@Excel(name = "商品状态_码", sort = 10)
|
||||||
|
private Integer productStatusCode;
|
||||||
|
|
||||||
|
@Excel(name = "商品状态_说明", width = 14, sort = 11)
|
||||||
|
private String productStatusLabel;
|
||||||
|
|
||||||
|
@Excel(name = "销售状态_码", sort = 12)
|
||||||
|
private Integer saleStatusCode;
|
||||||
|
|
||||||
|
@Excel(name = "闲鱼会员名", width = 18, sort = 13)
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Excel(name = "ERP应用appid", width = 22, sort = 14)
|
||||||
|
private String appid;
|
||||||
|
|
||||||
|
@Excel(name = "商品链接", width = 55, sort = 15)
|
||||||
|
private String productUrl;
|
||||||
|
|
||||||
|
@Excel(name = "上架时间_unix秒", width = 18, sort = 16)
|
||||||
|
private Long onlineTimeUnix;
|
||||||
|
|
||||||
|
@Excel(name = "上架时间_可读", width = 22, sort = 17)
|
||||||
|
private String onlineTimeReadable;
|
||||||
|
|
||||||
|
@Excel(name = "下架时间_unix秒", width = 18, sort = 18)
|
||||||
|
private Long offlineTimeUnix;
|
||||||
|
|
||||||
|
@Excel(name = "下架时间_可读", width = 22, sort = 19)
|
||||||
|
private String offlineTimeReadable;
|
||||||
|
|
||||||
|
@Excel(name = "售出时间_unix秒", width = 18, sort = 20)
|
||||||
|
private Long soldTimeUnix;
|
||||||
|
|
||||||
|
@Excel(name = "售出时间_可读", width = 22, sort = 21)
|
||||||
|
private String soldTimeReadable;
|
||||||
|
|
||||||
|
@Excel(name = "闲鱼创建_unix秒", width = 18, sort = 22)
|
||||||
|
private Long createTimeXyUnix;
|
||||||
|
|
||||||
|
@Excel(name = "闲鱼创建_可读", width = 22, sort = 23)
|
||||||
|
private String createTimeXyReadable;
|
||||||
|
|
||||||
|
@Excel(name = "闲鱼更新_unix秒", width = 18, sort = 24)
|
||||||
|
private Long updateTimeXyUnix;
|
||||||
|
|
||||||
|
@Excel(name = "闲鱼更新_可读", width = 22, sort = 25)
|
||||||
|
private String updateTimeXyReadable;
|
||||||
|
|
||||||
|
@Excel(name = "备注_本表", width = 30, sort = 26)
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Excel(name = "库创建时间", width = 22, dateFormat = "yyyy-MM-dd HH:mm:ss", sort = 27)
|
||||||
|
private Date dbCreateTime;
|
||||||
|
|
||||||
|
@Excel(name = "库更新时间", width = 22, dateFormat = "yyyy-MM-dd HH:mm:ss", sort = 28)
|
||||||
|
private Date dbUpdateTime;
|
||||||
|
|
||||||
|
public static List<ErpProductExportRow> fromList(List<ErpProduct> list, String exportBatchAt)
|
||||||
|
{
|
||||||
|
List<ErpProductExportRow> rows = new ArrayList<>(list.size());
|
||||||
|
for (ErpProduct p : list)
|
||||||
|
{
|
||||||
|
rows.add(from(p, exportBatchAt));
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ErpProductExportRow from(ErpProduct p, String exportBatchAt)
|
||||||
|
{
|
||||||
|
ErpProductExportRow r = new ErpProductExportRow();
|
||||||
|
r.setExportBatchAt(exportBatchAt != null ? exportBatchAt : "");
|
||||||
|
if (p == null)
|
||||||
|
{
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
r.setId(p.getId());
|
||||||
|
r.setProductId(p.getProductId());
|
||||||
|
r.setProductIdText(p.getProductId() != null ? String.valueOf(p.getProductId()) : "");
|
||||||
|
r.setTitle(p.getTitle());
|
||||||
|
r.setMainImage(p.getMainImage());
|
||||||
|
r.setPriceFen(p.getPrice());
|
||||||
|
if (p.getPrice() != null)
|
||||||
|
{
|
||||||
|
r.setPriceYuan(BigDecimal.valueOf(p.getPrice()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP).toPlainString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
r.setPriceYuan("");
|
||||||
|
}
|
||||||
|
r.setStock(p.getStock());
|
||||||
|
r.setProductStatusCode(p.getProductStatus());
|
||||||
|
r.setProductStatusLabel(productStatusLabel(p.getProductStatus()));
|
||||||
|
r.setSaleStatusCode(p.getSaleStatus());
|
||||||
|
r.setUserName(p.getUserName());
|
||||||
|
r.setAppid(p.getAppid());
|
||||||
|
r.setProductUrl(p.getProductUrl());
|
||||||
|
|
||||||
|
r.setOnlineTimeUnix(p.getOnlineTime());
|
||||||
|
r.setOnlineTimeReadable(formatUnixSeconds(p.getOnlineTime()));
|
||||||
|
r.setOfflineTimeUnix(p.getOfflineTime());
|
||||||
|
r.setOfflineTimeReadable(formatUnixSeconds(p.getOfflineTime()));
|
||||||
|
r.setSoldTimeUnix(p.getSoldTime());
|
||||||
|
r.setSoldTimeReadable(formatUnixSeconds(p.getSoldTime()));
|
||||||
|
r.setCreateTimeXyUnix(p.getCreateTimeXy());
|
||||||
|
r.setCreateTimeXyReadable(formatUnixSeconds(p.getCreateTimeXy()));
|
||||||
|
r.setUpdateTimeXyUnix(p.getUpdateTimeXy());
|
||||||
|
r.setUpdateTimeXyReadable(formatUnixSeconds(p.getUpdateTimeXy()));
|
||||||
|
|
||||||
|
r.setRemark(p.getRemark());
|
||||||
|
r.setDbCreateTime(p.getCreateTime());
|
||||||
|
r.setDbUpdateTime(p.getUpdateTime());
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String formatUnixSeconds(Long unixSeconds)
|
||||||
|
{
|
||||||
|
if (unixSeconds == null || unixSeconds <= 0)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date(unixSeconds * 1000L));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String productStatusLabel(Integer status)
|
||||||
|
{
|
||||||
|
if (status == null)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
switch (status)
|
||||||
|
{
|
||||||
|
case -1:
|
||||||
|
return "删除";
|
||||||
|
case 10:
|
||||||
|
return "其它(10)";
|
||||||
|
case 21:
|
||||||
|
return "待发布";
|
||||||
|
case 22:
|
||||||
|
return "销售中";
|
||||||
|
case 23:
|
||||||
|
return "已售罄";
|
||||||
|
case 31:
|
||||||
|
return "手动下架";
|
||||||
|
case 33:
|
||||||
|
return "售出下架";
|
||||||
|
case 36:
|
||||||
|
return "自动下架";
|
||||||
|
default:
|
||||||
|
return "未知(" + status + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExportBatchAt()
|
||||||
|
{
|
||||||
|
return exportBatchAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExportBatchAt(String exportBatchAt)
|
||||||
|
{
|
||||||
|
this.exportBatchAt = exportBatchAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getProductId()
|
||||||
|
{
|
||||||
|
return productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductId(Long productId)
|
||||||
|
{
|
||||||
|
this.productId = productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProductIdText()
|
||||||
|
{
|
||||||
|
return productIdText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductIdText(String productIdText)
|
||||||
|
{
|
||||||
|
this.productIdText = productIdText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle()
|
||||||
|
{
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title)
|
||||||
|
{
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMainImage()
|
||||||
|
{
|
||||||
|
return mainImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainImage(String mainImage)
|
||||||
|
{
|
||||||
|
this.mainImage = mainImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getPriceFen()
|
||||||
|
{
|
||||||
|
return priceFen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriceFen(Long priceFen)
|
||||||
|
{
|
||||||
|
this.priceFen = priceFen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPriceYuan()
|
||||||
|
{
|
||||||
|
return priceYuan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriceYuan(String priceYuan)
|
||||||
|
{
|
||||||
|
this.priceYuan = priceYuan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStock()
|
||||||
|
{
|
||||||
|
return stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStock(Integer stock)
|
||||||
|
{
|
||||||
|
this.stock = stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getProductStatusCode()
|
||||||
|
{
|
||||||
|
return productStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductStatusCode(Integer productStatusCode)
|
||||||
|
{
|
||||||
|
this.productStatusCode = productStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProductStatusLabel()
|
||||||
|
{
|
||||||
|
return productStatusLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductStatusLabel(String productStatusLabel)
|
||||||
|
{
|
||||||
|
this.productStatusLabel = productStatusLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSaleStatusCode()
|
||||||
|
{
|
||||||
|
return saleStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSaleStatusCode(Integer saleStatusCode)
|
||||||
|
{
|
||||||
|
this.saleStatusCode = saleStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName()
|
||||||
|
{
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName)
|
||||||
|
{
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppid()
|
||||||
|
{
|
||||||
|
return appid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppid(String appid)
|
||||||
|
{
|
||||||
|
this.appid = appid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProductUrl()
|
||||||
|
{
|
||||||
|
return productUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductUrl(String productUrl)
|
||||||
|
{
|
||||||
|
this.productUrl = productUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getOnlineTimeUnix()
|
||||||
|
{
|
||||||
|
return onlineTimeUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnlineTimeUnix(Long onlineTimeUnix)
|
||||||
|
{
|
||||||
|
this.onlineTimeUnix = onlineTimeUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOnlineTimeReadable()
|
||||||
|
{
|
||||||
|
return onlineTimeReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnlineTimeReadable(String onlineTimeReadable)
|
||||||
|
{
|
||||||
|
this.onlineTimeReadable = onlineTimeReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getOfflineTimeUnix()
|
||||||
|
{
|
||||||
|
return offlineTimeUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOfflineTimeUnix(Long offlineTimeUnix)
|
||||||
|
{
|
||||||
|
this.offlineTimeUnix = offlineTimeUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOfflineTimeReadable()
|
||||||
|
{
|
||||||
|
return offlineTimeReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOfflineTimeReadable(String offlineTimeReadable)
|
||||||
|
{
|
||||||
|
this.offlineTimeReadable = offlineTimeReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSoldTimeUnix()
|
||||||
|
{
|
||||||
|
return soldTimeUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSoldTimeUnix(Long soldTimeUnix)
|
||||||
|
{
|
||||||
|
this.soldTimeUnix = soldTimeUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSoldTimeReadable()
|
||||||
|
{
|
||||||
|
return soldTimeReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSoldTimeReadable(String soldTimeReadable)
|
||||||
|
{
|
||||||
|
this.soldTimeReadable = soldTimeReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCreateTimeXyUnix()
|
||||||
|
{
|
||||||
|
return createTimeXyUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTimeXyUnix(Long createTimeXyUnix)
|
||||||
|
{
|
||||||
|
this.createTimeXyUnix = createTimeXyUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreateTimeXyReadable()
|
||||||
|
{
|
||||||
|
return createTimeXyReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTimeXyReadable(String createTimeXyReadable)
|
||||||
|
{
|
||||||
|
this.createTimeXyReadable = createTimeXyReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUpdateTimeXyUnix()
|
||||||
|
{
|
||||||
|
return updateTimeXyUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTimeXyUnix(Long updateTimeXyUnix)
|
||||||
|
{
|
||||||
|
this.updateTimeXyUnix = updateTimeXyUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUpdateTimeXyReadable()
|
||||||
|
{
|
||||||
|
return updateTimeXyReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTimeXyReadable(String updateTimeXyReadable)
|
||||||
|
{
|
||||||
|
this.updateTimeXyReadable = updateTimeXyReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemark()
|
||||||
|
{
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemark(String remark)
|
||||||
|
{
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDbCreateTime()
|
||||||
|
{
|
||||||
|
return dbCreateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDbCreateTime(Date dbCreateTime)
|
||||||
|
{
|
||||||
|
this.dbCreateTime = dbCreateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDbUpdateTime()
|
||||||
|
{
|
||||||
|
return dbUpdateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDbUpdateTime(Date dbUpdateTime)
|
||||||
|
{
|
||||||
|
this.dbUpdateTime = dbUpdateTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.ruoyi.jarvis.domain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 京东订单商品信息 goods_info
|
||||||
|
*/
|
||||||
|
public class GoodsInfo {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String owner;
|
||||||
|
private String mainSkuId;
|
||||||
|
private String productId;
|
||||||
|
private String imageUrl;
|
||||||
|
private String shopName;
|
||||||
|
private String shopId;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwner() {
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwner(String owner) {
|
||||||
|
this.owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMainSkuId() {
|
||||||
|
return mainSkuId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainSkuId(String mainSkuId) {
|
||||||
|
this.mainSkuId = mainSkuId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProductId() {
|
||||||
|
return productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductId(String productId) {
|
||||||
|
this.productId = productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImageUrl() {
|
||||||
|
return imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageUrl(String imageUrl) {
|
||||||
|
this.imageUrl = imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShopName() {
|
||||||
|
return shopName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShopName(String shopName) {
|
||||||
|
this.shopName = shopName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShopId() {
|
||||||
|
return shopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShopId(String shopId) {
|
||||||
|
this.shopId = shopId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.ruoyi.jarvis.domain;
|
|||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.annotation.Excel.ColumnType;
|
import com.ruoyi.common.annotation.Excel.ColumnType;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.data.annotation.Transient;
|
import org.springframework.data.annotation.Transient;
|
||||||
|
|
||||||
@@ -26,10 +27,18 @@ public class JDOrder extends BaseEntity {
|
|||||||
@Excel(name = "分销标记")
|
@Excel(name = "分销标记")
|
||||||
private String distributionMark;
|
private String distributionMark;
|
||||||
|
|
||||||
/** 型号 */
|
/** 型号(本体,不含店铺后缀) */
|
||||||
@Excel(name = "型号")
|
@Excel(name = "型号")
|
||||||
private String modelNumber;
|
private String modelNumber;
|
||||||
|
|
||||||
|
/** 型号店铺短前缀(如海尔厨房;完整型号 = modelNumber + modelShop) */
|
||||||
|
@Excel(name = "型号店铺")
|
||||||
|
private String modelShop;
|
||||||
|
|
||||||
|
/** 列表筛选:型号不含这些子串(逗号/空格分隔,对应 SQL 多条 NOT LIKE),不入库 */
|
||||||
|
@Transient
|
||||||
|
private String modelNumberExclude;
|
||||||
|
|
||||||
/** 链接 */
|
/** 链接 */
|
||||||
@Excel(name = "链接")
|
@Excel(name = "链接")
|
||||||
private String link;
|
private String link;
|
||||||
@@ -85,6 +94,10 @@ public class JDOrder extends BaseEntity {
|
|||||||
@Excel(name = "订单状态")
|
@Excel(name = "订单状态")
|
||||||
private Integer orderStatus;
|
private Integer orderStatus;
|
||||||
|
|
||||||
|
/** 发货状态(从 order_rows.express_status 查询,10=待发货) */
|
||||||
|
@Transient
|
||||||
|
private Integer expressStatus;
|
||||||
|
|
||||||
/** 是否参与统计(0否 1是) */
|
/** 是否参与统计(0否 1是) */
|
||||||
@Excel(name = "参与统计")
|
@Excel(name = "参与统计")
|
||||||
private Integer isCountEnabled;
|
private Integer isCountEnabled;
|
||||||
@@ -169,6 +182,11 @@ public class JDOrder extends BaseEntity {
|
|||||||
/** 利润是否手动锁定(1 是:保存时不再自动重算) */
|
/** 利润是否手动锁定(1 是:保存时不再自动重算) */
|
||||||
private Integer profitManual;
|
private Integer profitManual;
|
||||||
|
|
||||||
|
/** 额外成本(计入自动利润:从 netReceipt − 成本中再减去此项,默认 0) */
|
||||||
|
@JsonAlias({ "extra_cost" })
|
||||||
|
@Excel(name = "额外成本")
|
||||||
|
private Double extraCost;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class TencentDocBatchPushRecord extends BaseEntity {
|
|||||||
/** 错误数量 */
|
/** 错误数量 */
|
||||||
private Integer errorCount;
|
private Integer errorCount;
|
||||||
|
|
||||||
/** 状态:RUNNING-执行中,SUCCESS-成功,PARTIAL-部分成功,FAILED-失败 */
|
/** 状态:RUNNING-执行中,SUCCESS-成功,PARTIAL-部分成功,FAILED-失败,INTERRUPTED-已中断(超时/未正常结束) */
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 结果消息 */
|
/** 结果消息 */
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.ruoyi.jarvis.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TG黄牛电话库(开/慢开前置命中则不走TG,一条可含多个 11 位手机号)
|
||||||
|
*
|
||||||
|
* @author jarvis
|
||||||
|
*/
|
||||||
|
public class TgScalperPhone extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** JSON 数组字符串,如 ["13800138000","13900139000"] */
|
||||||
|
@Excel(name = "手机号数组")
|
||||||
|
private String phones;
|
||||||
|
|
||||||
|
/** 列表查询条件:匹配号码(JSON 数组包含精确匹配,或 phones 文本模糊) */
|
||||||
|
private String phoneQuery;
|
||||||
|
|
||||||
|
@Excel(name = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/** 0禁用 1启用 */
|
||||||
|
@Excel(name = "状态", readConverterExp = "0=禁用,1=启用")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
public Long getId() { return id; }
|
||||||
|
public void setId(Long id) { this.id = id; }
|
||||||
|
public String getPhones() { return phones; }
|
||||||
|
public void setPhones(String phones) { this.phones = phones; }
|
||||||
|
public String getPhoneQuery() { return phoneQuery; }
|
||||||
|
public void setPhoneQuery(String phoneQuery) { this.phoneQuery = phoneQuery; }
|
||||||
|
public String getRemark() { return remark; }
|
||||||
|
public void setRemark(String remark) { this.remark = remark; }
|
||||||
|
public Integer getStatus() { return status; }
|
||||||
|
public void setStatus(Integer status) { this.status = status; }
|
||||||
|
@Override
|
||||||
|
public Date getCreateTime() { return createTime; }
|
||||||
|
@Override
|
||||||
|
public void setCreateTime(Date createTime) { this.createTime = createTime; }
|
||||||
|
@Override
|
||||||
|
public Date getUpdateTime() { return updateTime; }
|
||||||
|
@Override
|
||||||
|
public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "TgScalperPhone{id=" + id + ", phones=" + phones + ", remark=" + remark + ", status=" + status + "}";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,8 @@ import com.ruoyi.common.annotation.Excel;
|
|||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 企微分享链物流任务 wecom_share_link_logistics_job
|
* 企微分享链物流任务 wecom_share_link_logistics_job。
|
||||||
|
* 状态含 CANCELLED:不再参与对账入队与队列扫描(订单取消等场景)。
|
||||||
*/
|
*/
|
||||||
public class WeComShareLinkLogisticsJob extends BaseEntity {
|
public class WeComShareLinkLogisticsJob extends BaseEntity {
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,163 @@
|
|||||||
|
package com.ruoyi.jarvis.domain.dto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟团查询页订单信息
|
||||||
|
*/
|
||||||
|
public class PromoterOrderInfoVO {
|
||||||
|
|
||||||
|
private String shopName;
|
||||||
|
private String shopLogo;
|
||||||
|
private String orderSource;
|
||||||
|
private String traceTypeStr;
|
||||||
|
private String parentId;
|
||||||
|
private String orderId;
|
||||||
|
private String validCodeMsg;
|
||||||
|
private String skuImageUrl;
|
||||||
|
private String skuId;
|
||||||
|
private String skuName;
|
||||||
|
private String itemId;
|
||||||
|
private Integer skuNum;
|
||||||
|
private String cosPrice;
|
||||||
|
private String orderTime;
|
||||||
|
private String finishTime;
|
||||||
|
/** 价保/赔付金额 */
|
||||||
|
private String proPriceAmount;
|
||||||
|
/** 价保/赔付更新时间(有金额时取订单 modify_time) */
|
||||||
|
private String proPriceTime;
|
||||||
|
|
||||||
|
public String getShopName() {
|
||||||
|
return shopName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShopName(String shopName) {
|
||||||
|
this.shopName = shopName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShopLogo() {
|
||||||
|
return shopLogo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShopLogo(String shopLogo) {
|
||||||
|
this.shopLogo = shopLogo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderSource() {
|
||||||
|
return orderSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderSource(String orderSource) {
|
||||||
|
this.orderSource = orderSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTraceTypeStr() {
|
||||||
|
return traceTypeStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTraceTypeStr(String traceTypeStr) {
|
||||||
|
this.traceTypeStr = traceTypeStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentId() {
|
||||||
|
return parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentId(String parentId) {
|
||||||
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderId() {
|
||||||
|
return orderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderId(String orderId) {
|
||||||
|
this.orderId = orderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValidCodeMsg() {
|
||||||
|
return validCodeMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValidCodeMsg(String validCodeMsg) {
|
||||||
|
this.validCodeMsg = validCodeMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSkuImageUrl() {
|
||||||
|
return skuImageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSkuImageUrl(String skuImageUrl) {
|
||||||
|
this.skuImageUrl = skuImageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSkuId() {
|
||||||
|
return skuId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSkuId(String skuId) {
|
||||||
|
this.skuId = skuId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSkuName() {
|
||||||
|
return skuName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSkuName(String skuName) {
|
||||||
|
this.skuName = skuName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getItemId() {
|
||||||
|
return itemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItemId(String itemId) {
|
||||||
|
this.itemId = itemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSkuNum() {
|
||||||
|
return skuNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSkuNum(Integer skuNum) {
|
||||||
|
this.skuNum = skuNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCosPrice() {
|
||||||
|
return cosPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCosPrice(String cosPrice) {
|
||||||
|
this.cosPrice = cosPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderTime() {
|
||||||
|
return orderTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderTime(String orderTime) {
|
||||||
|
this.orderTime = orderTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFinishTime() {
|
||||||
|
return finishTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFinishTime(String finishTime) {
|
||||||
|
this.finishTime = finishTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProPriceAmount() {
|
||||||
|
return proPriceAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProPriceAmount(String proPriceAmount) {
|
||||||
|
this.proPriceAmount = proPriceAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProPriceTime() {
|
||||||
|
return proPriceTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProPriceTime(String proPriceTime) {
|
||||||
|
this.proPriceTime = proPriceTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.ruoyi.jarvis.domain.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快捷录单页:型号下拉项及该型号最近一次落库单的付款 / 后返
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class QuickRecordModelOption {
|
||||||
|
|
||||||
|
private String modelNumber;
|
||||||
|
|
||||||
|
/** 型号店铺短前缀 */
|
||||||
|
private String modelShop;
|
||||||
|
|
||||||
|
/** 最近一次订单的下单付款金额 */
|
||||||
|
private Double lastPaymentAmount;
|
||||||
|
|
||||||
|
/** 最近一次订单的后返金额 */
|
||||||
|
private Double lastRebateAmount;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.jarvis.domain.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快捷录单:型号后缀店铺选项(前缀拼接到型号末尾,如 W5000PLUS2.0白 + 海尔厨房)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class QuickRecordModelShopOption {
|
||||||
|
|
||||||
|
/** 拼接到型号末尾的短前缀,如 海尔官旗 */
|
||||||
|
private String prefix;
|
||||||
|
|
||||||
|
/** 括号内完整店铺名,如 海尔官方旗舰店 */
|
||||||
|
private String fullName;
|
||||||
|
|
||||||
|
/** 展示文案,如 海尔官旗(海尔官方旗舰店) */
|
||||||
|
private String label;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.ruoyi.jarvis.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GoofishNotifyMessage {
|
||||||
|
private String appid;
|
||||||
|
private Long timestamp;
|
||||||
|
private String body;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.ruoyi.jarvis.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闲管家订单:日日顺承运且已关联京东单的出库统计口径(与前台「手动推送/hasPlatformShipped」基本一致)。
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GoofishRrsLogisticsStatsVo {
|
||||||
|
|
||||||
|
/** 已出库:有有效运单去重计数 + 无运单但已发货/完成或本系统发货成功的订单数 */
|
||||||
|
private long shippedOutboundCount;
|
||||||
|
|
||||||
|
/** 待出库:平台「待发货」且无运单、且非本系统发货成功 */
|
||||||
|
private long pendingOutboundCount;
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.ruoyi.jarvis.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闲管家订单发货预览:闲鱼订单侧收件信息 vs 拟提交开放平台发货参数(可含京东兜底)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GoofishShipPreviewVo {
|
||||||
|
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
/** 管家 goods.title(表或详情) */
|
||||||
|
private String goodsTitle;
|
||||||
|
|
||||||
|
/** 关联京东单的型号 */
|
||||||
|
private String jdModelNumber;
|
||||||
|
|
||||||
|
/** 关联京东单的整段收件地址快照 */
|
||||||
|
private String jdAddressFull;
|
||||||
|
|
||||||
|
/** 仅从闲鱼开放平台落库的收件人姓名 */
|
||||||
|
private String goofishOrderReceiverName;
|
||||||
|
|
||||||
|
private String goofishOrderReceiverMobile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闲鱼订单侧完整收件串:省市区镇 + detail(与发货流水线中 receiverFieldsToShipParts 一致,不含京东)
|
||||||
|
*/
|
||||||
|
private String goofishOrderFullAddress;
|
||||||
|
|
||||||
|
/** 拟调用发货接口使用的收件人(可能由京东兜底补姓名) */
|
||||||
|
private String shipReceiverName;
|
||||||
|
|
||||||
|
private String shipReceiverMobile;
|
||||||
|
|
||||||
|
/** 拟提交的发货详情地址字符串 */
|
||||||
|
private String shipFullAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货收件地址是否与「闲鱼订单侧」归一化后一致(订单侧任一字段为空时为 null)
|
||||||
|
*/
|
||||||
|
private Boolean receiverAddressMatchesGoofish;
|
||||||
|
|
||||||
|
/** 是否与京东整段地址归一化后一致(无视京东或未维护京东地址时为 null) */
|
||||||
|
private Boolean receiverAddressMatchesJd;
|
||||||
|
|
||||||
|
/** 简短说明比对结论或数据来源 */
|
||||||
|
private String compareHint;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.ruoyi.jarvis.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.jarvis.domain.ErpGoofishOrderEventLog;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpGoofishOrderEventLogQuery;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ErpGoofishOrderEventLogMapper {
|
||||||
|
|
||||||
|
int insert(ErpGoofishOrderEventLog row);
|
||||||
|
|
||||||
|
List<ErpGoofishOrderEventLog> selectByOrderId(@Param("orderId") Long orderId);
|
||||||
|
|
||||||
|
List<ErpGoofishOrderEventLog> selectLogList(ErpGoofishOrderEventLogQuery query);
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.ruoyi.jarvis.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.jarvis.domain.ErpGoofishOrder;
|
||||||
|
import com.ruoyi.jarvis.dto.GoofishRrsLogisticsStatsVo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ErpGoofishOrderMapper {
|
||||||
|
|
||||||
|
ErpGoofishOrder selectById(Long id);
|
||||||
|
|
||||||
|
ErpGoofishOrder selectByAppKeyAndOrderNo(@Param("appKey") String appKey, @Param("orderNo") String orderNo);
|
||||||
|
|
||||||
|
List<ErpGoofishOrder> selectList(ErpGoofishOrder query);
|
||||||
|
|
||||||
|
int insert(ErpGoofishOrder row);
|
||||||
|
|
||||||
|
int update(ErpGoofishOrder row);
|
||||||
|
|
||||||
|
List<ErpGoofishOrder> selectPendingShip(@Param("statuses") List<Integer> statuses, @Param("limit") int limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按闲鱼买家订单号(与 jd_order.third_party_order_no 对齐时)检索,用于京东运单就绪后补绑发货。
|
||||||
|
*/
|
||||||
|
List<ErpGoofishOrder> selectByGoofishOrderNo(@Param("orderNo") String orderNo);
|
||||||
|
|
||||||
|
int resetShipForRetry(@Param("id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已关联 jd_order_id、承运为日日顺(rrs 或名称含日日顺);排除已退款/已关闭。
|
||||||
|
*/
|
||||||
|
GoofishRrsLogisticsStatsVo selectRrsJdLinkedLogisticsStats();
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.ruoyi.jarvis.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.jarvis.domain.ErpOpenConfig;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ErpOpenConfigMapper {
|
||||||
|
|
||||||
|
ErpOpenConfig selectById(Long id);
|
||||||
|
|
||||||
|
ErpOpenConfig selectByAppKey(@Param("appKey") String appKey);
|
||||||
|
|
||||||
|
List<ErpOpenConfig> selectList(ErpOpenConfig query);
|
||||||
|
|
||||||
|
List<ErpOpenConfig> selectEnabledOrderBySort();
|
||||||
|
|
||||||
|
int insert(ErpOpenConfig row);
|
||||||
|
|
||||||
|
int update(ErpOpenConfig row);
|
||||||
|
|
||||||
|
int deleteById(Long id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.jarvis.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.jarvis.domain.GoodsInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 京东订单商品信息 Mapper
|
||||||
|
*/
|
||||||
|
public interface GoodsInfoMapper {
|
||||||
|
|
||||||
|
GoodsInfo selectGoodsInfoById(Long id);
|
||||||
|
|
||||||
|
List<GoodsInfo> selectGoodsInfoByIds(Long[] ids);
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.jarvis.mapper;
|
package com.ruoyi.jarvis.mapper;
|
||||||
|
|
||||||
import com.ruoyi.jarvis.domain.JDOrder;
|
import com.ruoyi.jarvis.domain.JDOrder;
|
||||||
|
import com.ruoyi.jarvis.domain.dto.QuickRecordModelOption;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,6 +62,18 @@ public interface JDOrderMapper {
|
|||||||
* @return 订单列表
|
* @return 订单列表
|
||||||
*/
|
*/
|
||||||
List<JDOrder> selectJDOrderListByDistributionMarkFOrPDD();
|
List<JDOrder> selectJDOrderListByDistributionMarkFOrPDD();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每个型号取其主键最大的一条订单的付款 / 后返(用于快捷录单下拉回填)
|
||||||
|
*/
|
||||||
|
List<QuickRecordModelOption> selectQuickRecordModelOptions();
|
||||||
|
|
||||||
|
/** 待拆分型号店铺的历史订单(全表扫描,由业务层按配置过滤) */
|
||||||
|
List<JDOrder> selectOrdersPendingModelShopMigration();
|
||||||
|
|
||||||
|
int updateModelShopFields(@org.apache.ibatis.annotations.Param("id") Long id,
|
||||||
|
@org.apache.ibatis.annotations.Param("modelNumber") String modelNumber,
|
||||||
|
@org.apache.ibatis.annotations.Param("modelShop") String modelShop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -87,4 +87,9 @@ public interface OrderRowsMapper
|
|||||||
* @return 订单列表
|
* @return 订单列表
|
||||||
*/
|
*/
|
||||||
public List<OrderRows> selectOrderRowsByGiftCouponKey(@Param("giftCouponKey") String giftCouponKey);
|
public List<OrderRows> selectOrderRowsByGiftCouponKey(@Param("giftCouponKey") String giftCouponKey);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据订单号查询(匹配子单号 order_id 或父单号 parent_id)
|
||||||
|
*/
|
||||||
|
public List<OrderRows> selectOrderRowsByOrderNo(@Param("orderNo") String orderNo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.ruoyi.jarvis.mapper;
|
|||||||
import com.ruoyi.jarvis.domain.TencentDocBatchPushRecord;
|
import com.ruoyi.jarvis.domain.TencentDocBatchPushRecord;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,5 +42,11 @@ public interface TencentDocBatchPushRecordMapper {
|
|||||||
*/
|
*/
|
||||||
TencentDocBatchPushRecord selectLastSuccessRecord(@Param("fileId") String fileId,
|
TencentDocBatchPushRecord selectLastSuccessRecord(@Param("fileId") String fileId,
|
||||||
@Param("sheetId") String sheetId);
|
@Param("sheetId") String sheetId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仍为 RUNNING 且开始时间早于指定时间的批次(用于超时归档)
|
||||||
|
*/
|
||||||
|
List<TencentDocBatchPushRecord> selectRunningRecordsBefore(@Param("fileId") String fileId,
|
||||||
|
@Param("beforeTime") Date beforeTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.ruoyi.jarvis.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.ruoyi.jarvis.domain.TgScalperPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TG 黄牛电话库 Mapper
|
||||||
|
*/
|
||||||
|
public interface TgScalperPhoneMapper
|
||||||
|
{
|
||||||
|
TgScalperPhone selectTgScalperPhoneById(Long id);
|
||||||
|
|
||||||
|
List<TgScalperPhone> selectTgScalperPhoneList(TgScalperPhone q);
|
||||||
|
|
||||||
|
/** 某号码是否已被其它行占用(JSON 数组含该号) */
|
||||||
|
Long selectIdHavingPhone(@Param("excludeId") Long excludeId, @Param("cellPhone") String cellPhone);
|
||||||
|
|
||||||
|
/** 启用状态下按手机号查(开/慢走前置) */
|
||||||
|
TgScalperPhone selectEnabledByPhone(String phone);
|
||||||
|
|
||||||
|
int insertTgScalperPhone(TgScalperPhone row);
|
||||||
|
|
||||||
|
int updateTgScalperPhone(TgScalperPhone row);
|
||||||
|
|
||||||
|
int deleteTgScalperPhoneById(Long id);
|
||||||
|
|
||||||
|
int deleteTgScalperPhoneByIds(Long[] ids);
|
||||||
|
}
|
||||||
@@ -25,4 +25,17 @@ public interface WeComShareLinkLogisticsJobMapper {
|
|||||||
* 仅 {@code create_time} 在最近一个月内的记录,避免扫到过旧历史。
|
* 仅 {@code create_time} 在最近一个月内的记录,避免扫到过旧历史。
|
||||||
*/
|
*/
|
||||||
List<WeComShareLinkLogisticsJob> selectJobsNeedingQueueReconcile(@Param("limit") int limit);
|
List<WeComShareLinkLogisticsJob> selectJobsNeedingQueueReconcile(@Param("limit") int limit);
|
||||||
|
|
||||||
|
int deleteByJobKey(@Param("jobKey") String jobKey);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机器人「京外物列表」:最近若干天内的任务,按 id 倒序,可选备注子串筛选。
|
||||||
|
*/
|
||||||
|
List<WeComShareLinkLogisticsJob> selectRecentForInstruction(@Param("remarkKeyword") String remarkKeyword,
|
||||||
|
@Param("days") int days, @Param("limit") int limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机器人「京外物删」:按备注与短链精确匹配(trim)物理删除,返回删除行数。
|
||||||
|
*/
|
||||||
|
int deleteByRemarkAndTrackingUrl(@Param("remark") String remark, @Param("trackingUrl") String trackingUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.ruoyi.jarvis.mq;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.ruoyi.jarvis.dto.GoofishNotifyMessage;
|
||||||
|
import com.ruoyi.jarvis.service.goofish.GoofishOrderPipeline;
|
||||||
|
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||||
|
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闲管家订单推送消费(需配置 rocketmq.name-server)。
|
||||||
|
* <p>
|
||||||
|
* 在此线程内同步执行 {@link GoofishOrderPipeline#runFullPipeline},避免再投递 {@code @Async} 线程池造成
|
||||||
|
* 「MQ 堆积 + goofishTaskExecutor 排队」的双重延迟;回调 HTTP 已在 {@link com.ruoyi.jarvis.service.impl.ErpGoofishOrderServiceImpl#publishOrProcessNotify} 中快速返回。
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@ConditionalOnProperty(name = "rocketmq.name-server")
|
||||||
|
@RocketMQMessageListener(
|
||||||
|
nameServer = "${rocketmq.name-server}",
|
||||||
|
topic = "${jarvis.goofish-order.mq-topic:jarvis-goofish-erp-order}",
|
||||||
|
consumerGroup = "${jarvis.goofish-order.consumer-group:jarvis-goofish-order-consumer}"
|
||||||
|
)
|
||||||
|
public class GoofishOrderNotifyConsumer implements RocketMQListener<String> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private GoofishOrderPipeline goofishOrderPipeline;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(String message) {
|
||||||
|
GoofishNotifyMessage m = JSON.parseObject(message, GoofishNotifyMessage.class);
|
||||||
|
if (m == null || m.getAppid() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JSONObject body = m.getBody() == null ? new JSONObject() : JSON.parseObject(m.getBody());
|
||||||
|
if (body == null) {
|
||||||
|
body = new JSONObject();
|
||||||
|
}
|
||||||
|
goofishOrderPipeline.runFullPipeline(m.getAppid(), body);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.ruoyi.jarvis.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpGoofishOrder;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpGoofishOrderEventLog;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpGoofishOrderEventLogQuery;
|
||||||
|
import com.ruoyi.jarvis.dto.GoofishShipPreviewVo;
|
||||||
|
import com.ruoyi.jarvis.dto.GoofishRrsLogisticsStatsVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IErpGoofishOrderService {
|
||||||
|
|
||||||
|
void publishOrProcessNotify(String appid, Long timestamp, JSONObject body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MQ 消费者或线程池:写库、拉详情、关联京东单、同步运单、尝试发货
|
||||||
|
*/
|
||||||
|
void asyncPipelineAfterNotify(String appid, JSONObject notifyBody);
|
||||||
|
|
||||||
|
/** 日日顺 + 关联京东出库统计(侧边栏):已出库(去重运单口径)/待出库 */
|
||||||
|
GoofishRrsLogisticsStatsVo selectRrsJdLinkedLogisticsStats();
|
||||||
|
|
||||||
|
List<ErpGoofishOrder> selectList(ErpGoofishOrder query);
|
||||||
|
|
||||||
|
ErpGoofishOrder selectById(Long id);
|
||||||
|
|
||||||
|
int pullOrdersForAppKey(String appKey, int lookbackHours);
|
||||||
|
|
||||||
|
int pullAllEnabled(int lookbackHours);
|
||||||
|
|
||||||
|
/** 按配置的起始天数 + 时间分段,尽量拉全历史订单(update_time) */
|
||||||
|
int pullOrdersForAppKeyFullHistory(String appKey);
|
||||||
|
|
||||||
|
int pullAllEnabledFullHistory();
|
||||||
|
|
||||||
|
void refreshDetail(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货预览:闲鱼订单收件串 vs 即将提交开放平台地址(可与京东快照比对)。
|
||||||
|
*/
|
||||||
|
GoofishShipPreviewVo shipPreview(Long id);
|
||||||
|
|
||||||
|
void retryShip(Long id);
|
||||||
|
|
||||||
|
int syncWaybillAndTryShipBatch(int limit);
|
||||||
|
|
||||||
|
void applyListOrNotifyItem(String appKey, JSONObject item, String lastNotifyJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 京东单物流扫描已得到运单号并写入 Redis 后调用:同步到闲鱼单并尝试开放平台发货。
|
||||||
|
*/
|
||||||
|
void notifyJdWaybillReady(Long jdOrderId);
|
||||||
|
|
||||||
|
/** 京东物流服务在写 Redis / 企微货主推送后、触发闲鱼同步前记一笔(source=JD_LOGISTICS_PUSH)。 */
|
||||||
|
void traceJdLogisticsPushForGoofish(Long jdOrderId, String waybillNo, String summary);
|
||||||
|
|
||||||
|
/** 是否存在关联本京东单的闲管家订单(用于物流企微走闲鱼自建应用)。 */
|
||||||
|
boolean hasLinkedGoofishOrder(Long jdOrderId);
|
||||||
|
|
||||||
|
/** 订单状态 / 物流 / 发货 变更日志(新→旧) */
|
||||||
|
List<ErpGoofishOrderEventLog> listEventLogsByOrderId(Long orderId);
|
||||||
|
|
||||||
|
/** 全表分页检索(排查用,配合 PageHelper) */
|
||||||
|
List<ErpGoofishOrderEventLog> selectEventLogList(ErpGoofishOrderEventLogQuery query);
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.ruoyi.jarvis.service;
|
||||||
|
|
||||||
|
import com.ruoyi.jarvis.domain.ErpOpenConfig;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IErpOpenConfigService {
|
||||||
|
|
||||||
|
ErpOpenConfig selectById(Long id);
|
||||||
|
|
||||||
|
ErpOpenConfig selectByAppKey(String appKey);
|
||||||
|
|
||||||
|
ErpOpenConfig selectFirstEnabled();
|
||||||
|
|
||||||
|
List<ErpOpenConfig> selectList(ErpOpenConfig query);
|
||||||
|
|
||||||
|
List<ErpOpenConfig> selectEnabledOrderBySort();
|
||||||
|
|
||||||
|
int insert(ErpOpenConfig row);
|
||||||
|
|
||||||
|
int update(ErpOpenConfig row);
|
||||||
|
|
||||||
|
int deleteById(Long id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.ruoyi.jarvis.service;
|
||||||
|
|
||||||
|
import com.ruoyi.jarvis.domain.GoodsInfo;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 京东订单商品信息 Service
|
||||||
|
*/
|
||||||
|
public interface IGoodsInfoService {
|
||||||
|
|
||||||
|
GoodsInfo selectGoodsInfoById(Long id);
|
||||||
|
|
||||||
|
Map<Long, GoodsInfo> selectGoodsInfoMapByIds(Set<Long> ids);
|
||||||
|
}
|
||||||
@@ -27,7 +27,13 @@ public interface IInstructionService {
|
|||||||
* @return 执行结果文本列表(可能为单条或多条)
|
* @return 执行结果文本列表(可能为单条或多条)
|
||||||
*/
|
*/
|
||||||
java.util.List<String> execute(String command, boolean forceGenerate, boolean isFromConsole);
|
java.util.List<String> execute(String command, boolean forceGenerate, boolean isFromConsole);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行文本指令(支持传入企微成员 UserID,用于「京」统计按绑定联盟过滤)
|
||||||
|
* @param wecomUserId 企业微信成员 UserID;控制台等非企微入口传 null(按全局规则统计)
|
||||||
|
*/
|
||||||
|
java.util.List<String> execute(String command, boolean forceGenerate, boolean isFromConsole, String wecomUserId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取历史消息记录
|
* 获取历史消息记录
|
||||||
* @param type 消息类型:request(请求) 或 response(响应)
|
* @param type 消息类型:request(请求) 或 response(响应)
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.ruoyi.jarvis.service;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ruoyi.jarvis.domain.JDOrder;
|
||||||
|
import com.ruoyi.jarvis.domain.dto.QuickRecordModelShopOption;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 型号与店铺前缀拆分、归一化及历史数据迁移。
|
||||||
|
*/
|
||||||
|
public interface IJDOrderModelShopService {
|
||||||
|
|
||||||
|
List<QuickRecordModelShopOption> loadShopOptions();
|
||||||
|
|
||||||
|
void normalizeOrder(JDOrder order);
|
||||||
|
|
||||||
|
String fullModel(JDOrder order);
|
||||||
|
|
||||||
|
String lookupModelBase(String rawModel);
|
||||||
|
|
||||||
|
/** 一键迁移:将 model_number 末尾匹配的店铺前缀写入 model_shop 并从 model_number 截掉 */
|
||||||
|
Map<String, Object> migrateExistingOrders();
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@ package com.ruoyi.jarvis.service;
|
|||||||
|
|
||||||
import com.ruoyi.jarvis.domain.JDOrder;
|
import com.ruoyi.jarvis.domain.JDOrder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单利润/售价:按分销标识规则计算并写回订单对象(由列表保存前调用)。
|
* 订单利润/售价:按分销标识规则计算并写回订单对象(由列表保存前调用)。
|
||||||
*/
|
*/
|
||||||
@@ -9,7 +11,16 @@ public interface IJDOrderProfitService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据分销标识、型号配置、手动标记等,填充售价(自动时)并计算利润。
|
* 根据分销标识、型号配置、手动标记等,填充售价(自动时)并计算利润。
|
||||||
|
* F:利润 = 对客实收(直款=售价,闲鱼=扣点后的到账)-(下单付款 - 后返金额);
|
||||||
|
* H-TF:固定利润 15,再扣额外成本。
|
||||||
* 会修改传入的 {@code order}。
|
* 会修改传入的 {@code order}。
|
||||||
*/
|
*/
|
||||||
void recalculate(JDOrder order);
|
void recalculate(JDOrder order);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对「利润未手动锁定」的订单按当前库内数据重算售价/利润字段;仅当计算结果与库中不一致时才 UPDATE。
|
||||||
|
*
|
||||||
|
* @return 实际执行 UPDATE 的条数
|
||||||
|
*/
|
||||||
|
int syncAutoProfitIfChanged(List<Long> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.jarvis.service;
|
package com.ruoyi.jarvis.service;
|
||||||
|
|
||||||
import com.ruoyi.jarvis.domain.JDOrder;
|
import com.ruoyi.jarvis.domain.JDOrder;
|
||||||
|
import com.ruoyi.jarvis.domain.dto.QuickRecordModelOption;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,6 +49,12 @@ public interface IJDOrderService {
|
|||||||
|
|
||||||
/** 查询分销标记为F或PDD且有物流链接的订单列表 */
|
/** 查询分销标记为F或PDD且有物流链接的订单列表 */
|
||||||
java.util.List<JDOrder> selectJDOrderListByDistributionMarkFOrPDD();
|
java.util.List<JDOrder> selectJDOrderListByDistributionMarkFOrPDD();
|
||||||
|
|
||||||
|
/** 快捷录单:型号及最近一次单的付款 / 后返 */
|
||||||
|
List<QuickRecordModelOption> selectQuickRecordModelOptions();
|
||||||
|
|
||||||
|
/** 一键迁移:拆分 model_number 末尾店铺前缀到 model_shop */
|
||||||
|
java.util.Map<String, Object> migrateModelShopSplit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,14 @@ public interface ILogisticsService {
|
|||||||
* @return 健康状态信息,包含是否健康、状态描述等
|
* @return 健康状态信息,包含是否健康、状态描述等
|
||||||
*/
|
*/
|
||||||
HealthCheckResult checkHealth();
|
HealthCheckResult checkHealth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造调用物流解析服务的完整 GET URL(路径与编码与 {@link #fetchLogisticsAndPush} 一致)。
|
||||||
|
* 配置多个 {@code jarvis.server.logistics.base-urls} 时按轮询选取 base,便于内网多实例并行。
|
||||||
|
*
|
||||||
|
* @param logisticsLink 原始物流追踪链接(未编码)
|
||||||
|
*/
|
||||||
|
String buildFetchLogisticsRequestUrl(String logisticsLink);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 健康检测结果
|
* 健康检测结果
|
||||||
|
|||||||
@@ -72,4 +72,9 @@ public interface IOrderRowsService
|
|||||||
public int deleteOrderRowsById(String id);
|
public int deleteOrderRowsById(String id);
|
||||||
|
|
||||||
public OrderRows selectOrderRowsByOrderId(String orderId);
|
public OrderRows selectOrderRowsByOrderId(String orderId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据订单号查询(匹配子单号 order_id 或父单号 parent_id)
|
||||||
|
*/
|
||||||
|
public List<OrderRows> selectOrderRowsByOrderNo(String orderNo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.jarvis.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 「开/慢开」TG 查询完成后,经 wxSend 主动推送文本(已按企微单条上限切分)。
|
||||||
|
* 实现类在 ruoyi-admin,委托 WxSendWeComPushClient。
|
||||||
|
*/
|
||||||
|
public interface IPhoneForwardActivePush {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在被动回复已发出后,按序推送到企微成员(首条前短暂延迟,避免次序错乱)。
|
||||||
|
*
|
||||||
|
* @param toUser 企微 message/send 的 touser(可与 XML FromUserName 相同,或由超级管理员 touser 解析为 {@code |} 分隔多成员)
|
||||||
|
* @param wecomCallbackAgentId 回调明文 XML 中的 AgentId(字符串);空则 wxSend 使用默认 {@code qywx.app.agentId}
|
||||||
|
* @param chunks 每段不超过 UTF-8 2048 字节的正文
|
||||||
|
* @return {@code true} 表示配置齐全且每一段非空正文均收到 wxSend 2xx 响应
|
||||||
|
*/
|
||||||
|
boolean schedulePushChunks(String toUser, String wecomCallbackAgentId, List<String> chunks);
|
||||||
|
}
|
||||||
@@ -65,13 +65,17 @@ public interface ISocialMediaService
|
|||||||
com.ruoyi.common.core.domain.AjaxResult deletePromptTemplate(String key);
|
com.ruoyi.common.core.domain.AjaxResult deletePromptTemplate(String key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据标题(+可选型号备注)生成闲鱼文案(代下单、教你下单),不依赖JD接口
|
* 生成闲鱼文案(代下单、教你下单),并可选生成种草文案。
|
||||||
*
|
*
|
||||||
* @param title 商品标题(必填)
|
* request 常用字段:
|
||||||
* @param remark 型号/备注(可选)
|
* - title/remark(兼容旧版手动入口)
|
||||||
* @return 包含代下单、教你下单两种文案的 Map
|
* - generateSeedNote(boolean) 是否额外生成种草文案
|
||||||
|
* - goods_title/goods_model/goods_type(种草文案必传)
|
||||||
|
* - goods_brand/channel_source/official_price/sell_price/warranty/delivery_install(可选)
|
||||||
|
*
|
||||||
|
* @return 包含代下单、教你下单,以及可选 seedNote 的 Map
|
||||||
*/
|
*/
|
||||||
Map<String, Object> generateXianyuWenan(String title, String remark);
|
Map<String, Object> generateXianyuWenan(Map<String, Object> request);
|
||||||
|
|
||||||
/** 列出多套大模型接入配置及当前激活的 id(与 Jarvis 共用 Redis) */
|
/** 列出多套大模型接入配置及当前激活的 id(与 Jarvis 共用 Redis) */
|
||||||
com.ruoyi.common.core.domain.AjaxResult listLlmProfiles();
|
com.ruoyi.common.core.domain.AjaxResult listLlmProfiles();
|
||||||
|
|||||||
@@ -41,5 +41,10 @@ public interface ITencentDocBatchPushService {
|
|||||||
* 获取推送状态和倒计时信息
|
* 获取推送状态和倒计时信息
|
||||||
*/
|
*/
|
||||||
Map<String, Object> getPushStatusAndCountdown();
|
Map<String, Object> getPushStatusAndCountdown();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将长时间仍处于 RUNNING 的批次归档为 INTERRUPTED(并可选发企微告警,见实现类配置)
|
||||||
|
*/
|
||||||
|
void reconcileStaleRunningRecords(String fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.ruoyi.jarvis.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.jarvis.domain.TgScalperPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TG 黄牛电话库
|
||||||
|
*/
|
||||||
|
public interface ITgScalperPhoneService
|
||||||
|
{
|
||||||
|
TgScalperPhone selectTgScalperPhoneById(Long id);
|
||||||
|
|
||||||
|
List<TgScalperPhone> selectTgScalperPhoneList(TgScalperPhone q);
|
||||||
|
|
||||||
|
/** 启用状态命中(供 phone-forward 前置) */
|
||||||
|
TgScalperPhone selectEnabledByPhone(String phone);
|
||||||
|
|
||||||
|
int insertTgScalperPhone(TgScalperPhone row);
|
||||||
|
|
||||||
|
int updateTgScalperPhone(TgScalperPhone row);
|
||||||
|
|
||||||
|
int deleteTgScalperPhoneByIds(Long[] ids);
|
||||||
|
|
||||||
|
int deleteTgScalperPhoneById(Long id);
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ import com.ruoyi.jarvis.domain.dto.WeComInboundResult;
|
|||||||
public interface IWeComInboundService {
|
public interface IWeComInboundService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首条进入被动回复;其余由控制器异步调 wxSend /wecom/active-push。
|
* 长文本按企微上限拆成多段(每段 ≤2048 UTF-8 字节):首段被动回复,后续段由控制器异步调 wxSend /wecom/active-push。
|
||||||
*/
|
*/
|
||||||
WeComInboundResult handleInbound(WeComInboundRequest request);
|
WeComInboundResult handleInbound(WeComInboundRequest request);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,4 +16,10 @@ public interface IWeComShareLinkLogisticsJobService {
|
|||||||
* jobKey 固定为 tracebf{traceId},可重复执行跳过已存在项。
|
* jobKey 固定为 tracebf{traceId},可重复执行跳过已存在项。
|
||||||
*/
|
*/
|
||||||
Map<String, Object> backfillImportedFromInboundTrace();
|
Map<String, Object> backfillImportedFromInboundTrace();
|
||||||
|
|
||||||
|
List<WeComShareLinkLogisticsJob> selectRecentForInstruction(String remarkKeyword, int days, int limit);
|
||||||
|
|
||||||
|
int deleteByJobKey(String jobKey);
|
||||||
|
|
||||||
|
int deleteByRemarkAndTrackingUrl(String remark, String trackingUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,15 @@ package com.ruoyi.jarvis.service;
|
|||||||
*/
|
*/
|
||||||
public interface IWxSendService {
|
public interface IWxSendService {
|
||||||
/**
|
/**
|
||||||
* 检查微信推送服务健康状态
|
* 检查微信推送服务健康状态(会真实下发一条测试消息,仅用于服务监控页「手动测试」)
|
||||||
* @return 健康状态信息,包含是否健康、状态描述等
|
* @return 健康状态信息,包含是否健康、状态描述等
|
||||||
*/
|
*/
|
||||||
HealthCheckResult checkHealth();
|
HealthCheckResult checkHealth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已配置的微信推送健康检查 URL(展示用,不发起请求)
|
||||||
|
*/
|
||||||
|
String getHealthCheckServiceUrl();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 健康检测结果
|
* 健康检测结果
|
||||||
|
|||||||
@@ -61,4 +61,10 @@ public interface SuperAdminService
|
|||||||
SuperAdmin selectSuperAdminByUnionId(Long unionId);
|
SuperAdmin selectSuperAdminByUnionId(Long unionId);
|
||||||
|
|
||||||
SuperAdmin selectSuperAdminByWecomUserId(String wxid);
|
SuperAdmin selectSuperAdminByWecomUserId(String wxid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企微 {@code message/send} 的 {@code touser}:优先超级管理员表 {@code touser}(支持英文/中文逗号,转换为 {@code |}),
|
||||||
|
* 否则为发消息成员 UserID。逻辑与 {@link com.ruoyi.jarvis.service.impl.WeComInboundServiceImpl} 中 {@code resolveTouser} 一致。
|
||||||
|
*/
|
||||||
|
String resolveTouserPipeForActivePush(String fromWecomUserId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.ruoyi.jarvis.service.erp;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.erp.request.ERPAccount;
|
||||||
|
import com.ruoyi.erp.request.IERPAccount;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpOpenConfig;
|
||||||
|
import com.ruoyi.jarvis.service.IErpOpenConfigService;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class ErpAccountResolver {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IErpOpenConfigService erpOpenConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优先库表启用配置,其次兼容历史枚举,最后默认胡歌
|
||||||
|
*/
|
||||||
|
public IERPAccount resolve(String appid) {
|
||||||
|
if (StringUtils.isNotEmpty(appid)) {
|
||||||
|
ErpOpenConfig cfg = erpOpenConfigService.selectByAppKey(appid.trim());
|
||||||
|
if (cfg != null && "0".equals(cfg.getStatus())) {
|
||||||
|
return cfg;
|
||||||
|
}
|
||||||
|
for (ERPAccount a : ERPAccount.values()) {
|
||||||
|
if (a.getApiKey().equals(appid.trim())) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ErpOpenConfig first = erpOpenConfigService.selectFirstEnabled();
|
||||||
|
if (first != null) {
|
||||||
|
return first;
|
||||||
|
}
|
||||||
|
return ERPAccount.ACCOUNT_HUGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 校验回调签名时须严格对应 appid,不允许回落到默认账号 */
|
||||||
|
public IERPAccount resolveStrict(String appid) {
|
||||||
|
if (StringUtils.isEmpty(appid)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ErpOpenConfig cfg = erpOpenConfigService.selectByAppKey(appid.trim());
|
||||||
|
if (cfg != null && "0".equals(cfg.getStatus())) {
|
||||||
|
return cfg;
|
||||||
|
}
|
||||||
|
for (ERPAccount a : ERPAccount.values()) {
|
||||||
|
if (a.getApiKey().equals(appid.trim())) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.jarvis.service.goofish;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class GoofishNotifyAsyncFacade {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private GoofishOrderPipeline goofishOrderPipeline;
|
||||||
|
|
||||||
|
@Async("goofishTaskExecutor")
|
||||||
|
public void afterNotify(String appid, JSONObject body) {
|
||||||
|
goofishOrderPipeline.runFullPipeline(appid, body);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,213 @@
|
|||||||
|
package com.ruoyi.jarvis.service.goofish;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpGoofishOrder;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpGoofishOrderEventLog;
|
||||||
|
import com.ruoyi.jarvis.mapper.ErpGoofishOrderEventLogMapper;
|
||||||
|
import com.ruoyi.jarvis.wecom.WxSendGoofishNotifyClient;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闲管家订单:状态 / 物流 / 发货 变更落库 + SLF4J
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class GoofishOrderChangeLogger {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(GoofishOrderChangeLogger.class);
|
||||||
|
private static final int MESSAGE_MAX = 1000;
|
||||||
|
|
||||||
|
public static final String TYPE_ORDER = "ORDER_SYNC";
|
||||||
|
public static final String TYPE_LOGISTICS = "LOGISTICS_SYNC";
|
||||||
|
public static final String TYPE_SHIP = "SHIP";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 京东物流扫描:货主通知已由 LogisticsServiceImpl 走闲鱼自建应用或 PDD;此处仅落库,避免再调 wxSend 重复推送。
|
||||||
|
*/
|
||||||
|
public static final String SOURCE_JD_LOGISTICS_PUSH = "JD_LOGISTICS_PUSH";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redis 写入本地运单:与后续详情运单合并、发货成功通知重复度高,仅落库便于对账,不推企微。
|
||||||
|
*/
|
||||||
|
public static final String SOURCE_REDIS_WAYBILL = "REDIS_WAYBILL";
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ErpGoofishOrderEventLogMapper erpGoofishOrderEventLogMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WxSendGoofishNotifyClient wxSendGoofishNotifyClient;
|
||||||
|
|
||||||
|
public void append(Long orderId, String appKey, String orderNo, String eventType, String source, String message) {
|
||||||
|
append(orderId, appKey, orderNo, eventType, source, message, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param notifyWecom 为 false 时仅写事件日志,不推企微(用于过滤纯对齐类状态)。
|
||||||
|
*/
|
||||||
|
public void append(Long orderId, String appKey, String orderNo, String eventType, String source, String message,
|
||||||
|
boolean notifyWecom) {
|
||||||
|
if (orderId == null || StringUtils.isEmpty(message)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String msg = message.length() > MESSAGE_MAX ? message.substring(0, MESSAGE_MAX - 1) + "…" : message;
|
||||||
|
ErpGoofishOrderEventLog row = new ErpGoofishOrderEventLog();
|
||||||
|
row.setOrderId(orderId);
|
||||||
|
row.setAppKey(appKey);
|
||||||
|
row.setOrderNo(orderNo != null ? orderNo : "");
|
||||||
|
row.setEventType(eventType != null ? eventType : "UNKNOWN");
|
||||||
|
row.setSource(source != null ? source : "");
|
||||||
|
row.setMessage(msg);
|
||||||
|
row.setCreateTime(DateUtils.getNowDate());
|
||||||
|
try {
|
||||||
|
erpGoofishOrderEventLogMapper.insert(row);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("闲管家订单事件日志写入失败 orderId={} {}", orderId, e.toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log.info("[goofish-order-event] orderId={} orderNo={} type={} source={} {}", orderId, orderNo, eventType, source, msg);
|
||||||
|
if (SOURCE_JD_LOGISTICS_PUSH.equals(source) || SOURCE_REDIS_WAYBILL.equals(source)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!notifyWecom) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
wxSendGoofishNotifyClient.notifyGoofishEvent(orderNo, eventType, source, msg);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.debug("闲鱼订单事件 wxSend 通知跳过 err={}", ex.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合并摘要前后对比:订单状态/退款状态、平台运单与快递、本地运单。
|
||||||
|
*
|
||||||
|
* @param beforeSnap 合并前从 row 拷贝的跟踪字段快照(可不含 id)
|
||||||
|
* @param afterRow 合并并 apply 后的 row
|
||||||
|
*/
|
||||||
|
public void logSummaryMergeDiff(ErpGoofishOrder beforeSnap, ErpGoofishOrder afterRow, String source) {
|
||||||
|
if (afterRow == null || afterRow.getId() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RowSnap b = RowSnap.from(beforeSnap);
|
||||||
|
RowSnap a = RowSnap.from(afterRow);
|
||||||
|
|
||||||
|
boolean refundDiff = !Objects.equals(b.refundStatus, a.refundStatus);
|
||||||
|
boolean orderDiff = !Objects.equals(b.orderStatus, a.orderStatus);
|
||||||
|
|
||||||
|
List<String> orderParts = new ArrayList<>();
|
||||||
|
if (orderDiff) {
|
||||||
|
orderParts.add("订单状态 " + GoofishStatusLabels.orderStatusChangeForNotify(b.orderStatus, a.orderStatus));
|
||||||
|
}
|
||||||
|
if (refundDiff) {
|
||||||
|
orderParts.add("退款状态 " + GoofishStatusLabels.refundStatusChange(b.refundStatus, a.refundStatus));
|
||||||
|
}
|
||||||
|
if (!orderParts.isEmpty()) {
|
||||||
|
boolean notifyWecom = refundDiff || (orderDiff
|
||||||
|
&& GoofishStatusLabels.isWxNotifiableOrderStatusChange(b.orderStatus, a.orderStatus));
|
||||||
|
append(afterRow.getId(), afterRow.getAppKey(), afterRow.getOrderNo(), TYPE_ORDER, source,
|
||||||
|
String.join(";", orderParts), notifyWecom);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> logParts = new ArrayList<>();
|
||||||
|
if (!eqStr(b.detailWaybillNo, a.detailWaybillNo)) {
|
||||||
|
logParts.add("平台运单 " + str(b.detailWaybillNo) + "→" + str(a.detailWaybillNo));
|
||||||
|
}
|
||||||
|
if (!eqStr(b.detailExpressCode, a.detailExpressCode)) {
|
||||||
|
logParts.add("快递编码 " + str(b.detailExpressCode) + "→" + str(a.detailExpressCode));
|
||||||
|
}
|
||||||
|
if (!eqStr(b.detailExpressName, a.detailExpressName)) {
|
||||||
|
logParts.add("快递名称 " + str(b.detailExpressName) + "→" + str(a.detailExpressName));
|
||||||
|
}
|
||||||
|
if (!eqStr(b.localWaybillNo, a.localWaybillNo)) {
|
||||||
|
logParts.add("本地运单 " + str(b.localWaybillNo) + "→" + str(a.localWaybillNo));
|
||||||
|
}
|
||||||
|
if (!logParts.isEmpty()) {
|
||||||
|
boolean notifyWecomLogistics =
|
||||||
|
!isLogisticsWecomMirroringShipWaybillFill(beforeSnap, afterRow, logParts);
|
||||||
|
append(afterRow.getId(), afterRow.getAppKey(), afterRow.getOrderNo(), TYPE_LOGISTICS, source,
|
||||||
|
String.join(";", logParts), notifyWecomLogistics);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情/列表反拉:平台「运单号为 null→671…」并与本地 Redis 写入的运单一致、本地运单字段未在同一笔合并里改动时,
|
||||||
|
* 内容与刚发的「发货」通知重复 → 不写企微,仅保留事件日志。
|
||||||
|
*/
|
||||||
|
private static boolean isLogisticsWecomMirroringShipWaybillFill(ErpGoofishOrder b, ErpGoofishOrder a,
|
||||||
|
List<String> logParts) {
|
||||||
|
if (a == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String lwAfter = trimEmpty(a.getLocalWaybillNo());
|
||||||
|
if (lwAfter.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!eqStr(b == null ? null : b.getLocalWaybillNo(), a == null ? null : a.getLocalWaybillNo())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (String p : logParts) {
|
||||||
|
if (p.startsWith("本地运单 ")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(p.startsWith("平台运单 ") || p.startsWith("快递编码 ") || p.startsWith("快递名称 "))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String adb = trimEmpty(a.getDetailWaybillNo());
|
||||||
|
String bdb = trimEmpty(b == null ? null : b.getDetailWaybillNo());
|
||||||
|
if (!adb.equals(lwAfter)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 平台侧从空补上运单号,与同单本地发货所用单号一致
|
||||||
|
boolean detailWaybillJustFilled =
|
||||||
|
!eqStr(b == null ? null : b.getDetailWaybillNo(), a.getDetailWaybillNo()) && bdb.isEmpty();
|
||||||
|
// 或运单早前已对齐,只差快递字段刷新,仍视作发货侧已知信息延伸
|
||||||
|
boolean detailStableMatchesLocal =
|
||||||
|
eqStr(b == null ? null : b.getDetailWaybillNo(), a.getDetailWaybillNo()) && !adb.isEmpty();
|
||||||
|
return detailWaybillJustFilled || detailStableMatchesLocal;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String trimEmpty(String x) {
|
||||||
|
return x == null ? "" : x.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String str(Object o) {
|
||||||
|
return o == null ? "null" : String.valueOf(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean eqStr(String x, String y) {
|
||||||
|
String a = x == null ? "" : x.trim();
|
||||||
|
String b = y == null ? "" : y.trim();
|
||||||
|
return Objects.equals(a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class RowSnap {
|
||||||
|
Integer orderStatus;
|
||||||
|
Integer refundStatus;
|
||||||
|
String detailWaybillNo;
|
||||||
|
String detailExpressCode;
|
||||||
|
String detailExpressName;
|
||||||
|
String localWaybillNo;
|
||||||
|
|
||||||
|
static RowSnap from(ErpGoofishOrder r) {
|
||||||
|
RowSnap s = new RowSnap();
|
||||||
|
if (r == null) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
s.orderStatus = r.getOrderStatus();
|
||||||
|
s.refundStatus = r.getRefundStatus();
|
||||||
|
s.detailWaybillNo = r.getDetailWaybillNo();
|
||||||
|
s.detailExpressCode = r.getDetailExpressCode();
|
||||||
|
s.detailExpressName = r.getDetailExpressName();
|
||||||
|
s.localWaybillNo = r.getLocalWaybillNo();
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,125 @@
|
|||||||
|
package com.ruoyi.jarvis.service.goofish;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闲管家开放平台:订单状态、退款状态中文说明(与 Apifox 订单列表 schema 一致)
|
||||||
|
*/
|
||||||
|
public final class GoofishStatusLabels {
|
||||||
|
|
||||||
|
private static final Map<Integer, String> ORDER = new HashMap<>();
|
||||||
|
private static final Map<Integer, String> REFUND = new HashMap<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
ORDER.put(11, "待付款");
|
||||||
|
ORDER.put(12, "待发货");
|
||||||
|
ORDER.put(21, "已发货");
|
||||||
|
ORDER.put(22, "已完成");
|
||||||
|
ORDER.put(23, "已退款");
|
||||||
|
ORDER.put(24, "已关闭");
|
||||||
|
REFUND.put(0, "未申请退款");
|
||||||
|
REFUND.put(1, "待商家处理");
|
||||||
|
REFUND.put(2, "待买家退货");
|
||||||
|
REFUND.put(3, "待商家收货");
|
||||||
|
REFUND.put(4, "退款关闭");
|
||||||
|
REFUND.put(5, "退款成功");
|
||||||
|
REFUND.put(6, "已拒绝退款");
|
||||||
|
REFUND.put(8, "待确认退货地址");
|
||||||
|
}
|
||||||
|
|
||||||
|
private GoofishStatusLabels() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 仅中文;未知时返回 null */
|
||||||
|
public static String orderStatusLabel(Integer s) {
|
||||||
|
if (s == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return ORDER.get(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 仅中文;未知时返回 null */
|
||||||
|
public static String refundStatusLabel(Integer s) {
|
||||||
|
if (s == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return REFUND.get(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于日志/企微:优先中文,未知时带码便于排查
|
||||||
|
*/
|
||||||
|
public static String orderStatusHuman(Integer s) {
|
||||||
|
String t = orderStatusLabel(s);
|
||||||
|
if (t != null) {
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
if (s == null) {
|
||||||
|
return "—";
|
||||||
|
}
|
||||||
|
return "未识别状态(" + s + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String refundStatusHuman(Integer s) {
|
||||||
|
String t = refundStatusLabel(s);
|
||||||
|
if (t != null) {
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
if (s == null) {
|
||||||
|
return "—";
|
||||||
|
}
|
||||||
|
return "未识别状态(" + s + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 变化摘要:A→B,两边均为人话
|
||||||
|
*/
|
||||||
|
public static String orderStatusChange(Integer from, Integer to) {
|
||||||
|
return orderStatusHuman(from) + " → " + orderStatusHuman(to);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快照/首行展示:待发阶段注明已付款语义(开放平台码 12 即待发货)。
|
||||||
|
*/
|
||||||
|
public static String orderStatusHumanForNotify(Integer s) {
|
||||||
|
if (Objects.equals(s, 12)) {
|
||||||
|
return "待发货(已付款)";
|
||||||
|
}
|
||||||
|
return orderStatusHuman(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企微通知用变化文案:付款完成单独写「已付款(待发货)」。
|
||||||
|
*/
|
||||||
|
public static String orderStatusChangeForNotify(Integer from, Integer to) {
|
||||||
|
if (Objects.equals(from, 11) && Objects.equals(to, 12)) {
|
||||||
|
return orderStatusHuman(11) + " → 已付款(待发货)";
|
||||||
|
}
|
||||||
|
return orderStatusHuman(from) + " → " + orderStatusHumanForNotify(to);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否与「付款、待发、在途、终态退款/完成/关闭」相关,从而值得推企微(排除已由 SHIP 覆盖的待发→已发)。
|
||||||
|
*/
|
||||||
|
public static boolean isWxNotifiableOrderStatusChange(Integer from, Integer to) {
|
||||||
|
if (Objects.equals(from, to)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (Objects.equals(from, 12) && Objects.equals(to, 21)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int[] anchors = {11, 12, 21, 22, 23, 24};
|
||||||
|
for (int code : anchors) {
|
||||||
|
if (Objects.equals(from, code) || Objects.equals(to, code)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String refundStatusChange(Integer from, Integer to) {
|
||||||
|
return refundStatusHuman(from) + " → " + refundStatusHuman(to);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,340 @@
|
|||||||
|
package com.ruoyi.jarvis.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.ruoyi.jarvis.config.JarvisGoofishProperties;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpGoofishOrder;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpGoofishOrderEventLog;
|
||||||
|
import com.ruoyi.jarvis.domain.JDOrder;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpGoofishOrderEventLogQuery;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpOpenConfig;
|
||||||
|
import com.ruoyi.jarvis.dto.GoofishNotifyMessage;
|
||||||
|
import com.ruoyi.jarvis.dto.GoofishRrsLogisticsStatsVo;
|
||||||
|
import com.ruoyi.jarvis.dto.GoofishShipPreviewVo;
|
||||||
|
import com.ruoyi.jarvis.mapper.ErpGoofishOrderEventLogMapper;
|
||||||
|
import com.ruoyi.jarvis.mapper.ErpGoofishOrderMapper;
|
||||||
|
import com.ruoyi.jarvis.service.IErpGoofishOrderService;
|
||||||
|
import com.ruoyi.jarvis.service.IJDOrderService;
|
||||||
|
import com.ruoyi.jarvis.service.IErpOpenConfigService;
|
||||||
|
import com.ruoyi.jarvis.service.goofish.GoofishNotifyAsyncFacade;
|
||||||
|
import com.ruoyi.jarvis.service.goofish.GoofishOrderChangeLogger;
|
||||||
|
import com.ruoyi.jarvis.service.goofish.GoofishOrderPipeline;
|
||||||
|
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||||
|
import org.springframework.beans.factory.ObjectProvider;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ErpGoofishOrderServiceImpl implements IErpGoofishOrderService {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(ErpGoofishOrderServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ObjectProvider<RocketMQTemplate> rocketMQTemplate;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private JarvisGoofishProperties goofishProperties;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private GoofishNotifyAsyncFacade goofishNotifyAsyncFacade;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private GoofishOrderPipeline goofishOrderPipeline;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ErpGoofishOrderMapper erpGoofishOrderMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ErpGoofishOrderEventLogMapper erpGoofishOrderEventLogMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IErpOpenConfigService erpOpenConfigService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private GoofishOrderChangeLogger goofishOrderChangeLogger;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IJDOrderService jdOrderService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void publishOrProcessNotify(String appid, Long timestamp, JSONObject body) {
|
||||||
|
RocketMQTemplate mq = rocketMQTemplate.getIfAvailable();
|
||||||
|
if (mq != null) {
|
||||||
|
GoofishNotifyMessage m = new GoofishNotifyMessage();
|
||||||
|
m.setAppid(appid);
|
||||||
|
m.setTimestamp(timestamp);
|
||||||
|
m.setBody(body.toJSONString());
|
||||||
|
mq.syncSend(goofishProperties.getMqTopic(), JSON.toJSONString(m));
|
||||||
|
} else {
|
||||||
|
goofishNotifyAsyncFacade.afterNotify(appid, body);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void asyncPipelineAfterNotify(String appid, JSONObject notifyBody) {
|
||||||
|
goofishOrderPipeline.runFullPipeline(appid, notifyBody);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GoofishRrsLogisticsStatsVo selectRrsJdLinkedLogisticsStats() {
|
||||||
|
GoofishRrsLogisticsStatsVo vo = erpGoofishOrderMapper.selectRrsJdLinkedLogisticsStats();
|
||||||
|
return vo != null ? vo : new GoofishRrsLogisticsStatsVo();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ErpGoofishOrder> selectList(ErpGoofishOrder query) {
|
||||||
|
return erpGoofishOrderMapper.selectList(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ErpGoofishOrder selectById(Long id) {
|
||||||
|
return erpGoofishOrderMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int pullOrdersForAppKey(String appKey, int lookbackHours) {
|
||||||
|
return goofishOrderPipeline.pullForAppKey(appKey, lookbackHours);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int pullAllEnabled(int lookbackHours) {
|
||||||
|
int total = 0;
|
||||||
|
List<ErpOpenConfig> cfgs = erpOpenConfigService.selectEnabledOrderBySort();
|
||||||
|
if (cfgs == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
for (ErpOpenConfig c : cfgs) {
|
||||||
|
if (c.getAppKey() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
total += goofishOrderPipeline.pullForAppKey(c.getAppKey(), lookbackHours);
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int pullOrdersForAppKeyFullHistory(String appKey) {
|
||||||
|
return goofishOrderPipeline.pullForAppKeyFullHistory(appKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int pullAllEnabledFullHistory() {
|
||||||
|
int total = 0;
|
||||||
|
List<ErpOpenConfig> cfgs = erpOpenConfigService.selectEnabledOrderBySort();
|
||||||
|
if (cfgs == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
for (ErpOpenConfig c : cfgs) {
|
||||||
|
if (c.getAppKey() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
total += goofishOrderPipeline.pullForAppKeyFullHistory(c.getAppKey());
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void refreshDetail(Long id) {
|
||||||
|
ErpGoofishOrder row = erpGoofishOrderMapper.selectById(id);
|
||||||
|
if (row != null) {
|
||||||
|
goofishOrderPipeline.refreshDetail(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GoofishShipPreviewVo shipPreview(Long id) {
|
||||||
|
ErpGoofishOrder row = erpGoofishOrderMapper.selectById(id);
|
||||||
|
if (row == null) {
|
||||||
|
GoofishShipPreviewVo empty = new GoofishShipPreviewVo();
|
||||||
|
empty.setCompareHint("订单不存在");
|
||||||
|
return empty;
|
||||||
|
}
|
||||||
|
return goofishOrderPipeline.buildShipPreview(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void retryShip(Long id) {
|
||||||
|
erpGoofishOrderMapper.resetShipForRetry(id);
|
||||||
|
ErpGoofishOrder row = erpGoofishOrderMapper.selectById(id);
|
||||||
|
if (row != null) {
|
||||||
|
goofishOrderPipeline.refreshDetail(row);
|
||||||
|
goofishOrderPipeline.tryLinkJdOrder(row);
|
||||||
|
goofishOrderPipeline.syncWaybillFromRedis(row);
|
||||||
|
goofishOrderPipeline.tryAutoShip(row, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int syncWaybillAndTryShipBatch(int limit) {
|
||||||
|
return goofishOrderPipeline.syncWaybillAndTryShipBatch(limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyListOrNotifyItem(String appKey, JSONObject item, String lastNotifyJson) {
|
||||||
|
goofishOrderPipeline.applyListOrNotifyItem(appKey, item, lastNotifyJson);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyJdWaybillReady(Long jdOrderId) {
|
||||||
|
if (jdOrderId == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JDOrder jd = jdOrderService.selectJDOrderById(jdOrderId);
|
||||||
|
LinkedHashSet<Long> processedGoofishPk = new LinkedHashSet<>();
|
||||||
|
|
||||||
|
ErpGoofishOrder queryByJd = new ErpGoofishOrder();
|
||||||
|
queryByJd.setJdOrderId(jdOrderId);
|
||||||
|
List<ErpGoofishOrder> linked = erpGoofishOrderMapper.selectList(queryByJd);
|
||||||
|
if (linked != null) {
|
||||||
|
for (ErpGoofishOrder ref : linked) {
|
||||||
|
processGoofishWaybillSyncAfterJdReady(ref.getId(), processedGoofishPk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jd != null && org.springframework.util.StringUtils.hasText(jd.getThirdPartyOrderNo())
|
||||||
|
&& isFxianyuDistributionMark(jd.getDistributionMark())) {
|
||||||
|
List<ErpGoofishOrder> byNo =
|
||||||
|
erpGoofishOrderMapper.selectByGoofishOrderNo(jd.getThirdPartyOrderNo().trim());
|
||||||
|
if (byNo != null) {
|
||||||
|
for (ErpGoofishOrder ref : byNo) {
|
||||||
|
ErpGoofishOrder full = erpGoofishOrderMapper.selectById(ref.getId());
|
||||||
|
if (full == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (full.getJdOrderId() != null && !full.getJdOrderId().equals(jdOrderId)) {
|
||||||
|
log.warn(
|
||||||
|
"闲鱼单 {} 已关联本地 jd_order_id={},与本次京东单行主键 {} 不一致,跳过补绑",
|
||||||
|
full.getOrderNo(), full.getJdOrderId(), jdOrderId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (full.getJdOrderId() == null) {
|
||||||
|
attachGoofishToJdOrder(full.getId(), jdOrderId);
|
||||||
|
}
|
||||||
|
processGoofishWaybillSyncAfterJdReady(ref.getId(), processedGoofishPk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 单次:读库、同步 Redis 运单(含镜像 key)、尽力自动发货 */
|
||||||
|
private void processGoofishWaybillSyncAfterJdReady(Long erpGoofishPk,
|
||||||
|
LinkedHashSet<Long> processedGoofishPk) {
|
||||||
|
if (erpGoofishPk == null || processedGoofishPk.contains(erpGoofishPk)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ErpGoofishOrder full = erpGoofishOrderMapper.selectById(erpGoofishPk);
|
||||||
|
if (full == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
goofishOrderPipeline.syncWaybillFromRedis(full);
|
||||||
|
goofishOrderPipeline.tryAutoShip(full);
|
||||||
|
processedGoofishPk.add(erpGoofishPk);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void attachGoofishToJdOrder(long erpGoofishPk, long jdOrderDbId) {
|
||||||
|
ErpGoofishOrder p = new ErpGoofishOrder();
|
||||||
|
p.setId(erpGoofishPk);
|
||||||
|
p.setJdOrderId(jdOrderDbId);
|
||||||
|
p.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
erpGoofishOrderMapper.update(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isFxianyuDistributionMark(String distributionMark) {
|
||||||
|
if (!org.springframework.util.StringUtils.hasText(distributionMark)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String m = distributionMark.trim();
|
||||||
|
return m.startsWith("F") || m.contains("\u95f2\u9c7c");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasLinkedGoofishOrder(Long jdOrderId) {
|
||||||
|
if (jdOrderId == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ErpGoofishOrder query = new ErpGoofishOrder();
|
||||||
|
query.setJdOrderId(jdOrderId);
|
||||||
|
List<ErpGoofishOrder> list = erpGoofishOrderMapper.selectList(query);
|
||||||
|
return list != null && !list.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void traceJdLogisticsPushForGoofish(Long jdOrderId, String waybillNo, String summary) {
|
||||||
|
if (jdOrderId == null || goofishOrderChangeLogger == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JDOrder jd = jdOrderService.selectJDOrderById(jdOrderId);
|
||||||
|
LinkedHashSet<Long> ids = resolveGoofishRowIdsForJdLogisticsEvent(jdOrderId, jd);
|
||||||
|
if (ids.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String wb = waybillNo != null ? waybillNo.trim() : "";
|
||||||
|
String sum = summary != null ? summary : "";
|
||||||
|
String msg = "京东订单 " + jdOrderId + ",运单 " + wb + ";" + sum;
|
||||||
|
if (msg.length() > 1000) {
|
||||||
|
msg = msg.substring(0, 999) + "…";
|
||||||
|
}
|
||||||
|
for (Long oid : ids) {
|
||||||
|
ErpGoofishOrder row = erpGoofishOrderMapper.selectById(oid);
|
||||||
|
if (row == null || row.getId() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
goofishOrderChangeLogger.append(row.getId(), row.getAppKey(), row.getOrderNo(),
|
||||||
|
GoofishOrderChangeLogger.TYPE_LOGISTICS, GoofishOrderChangeLogger.SOURCE_JD_LOGISTICS_PUSH, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private LinkedHashSet<Long> resolveGoofishRowIdsForJdLogisticsEvent(Long jdOrderId, JDOrder jd) {
|
||||||
|
LinkedHashSet<Long> ids = new LinkedHashSet<>();
|
||||||
|
ErpGoofishOrder q = new ErpGoofishOrder();
|
||||||
|
q.setJdOrderId(jdOrderId);
|
||||||
|
List<ErpGoofishOrder> linked = erpGoofishOrderMapper.selectList(q);
|
||||||
|
if (linked != null) {
|
||||||
|
for (ErpGoofishOrder r : linked) {
|
||||||
|
if (r.getId() != null) {
|
||||||
|
ids.add(r.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (jd != null && org.springframework.util.StringUtils.hasText(jd.getThirdPartyOrderNo())
|
||||||
|
&& isFxianyuDistributionMark(jd.getDistributionMark())) {
|
||||||
|
List<ErpGoofishOrder> byNo =
|
||||||
|
erpGoofishOrderMapper.selectByGoofishOrderNo(jd.getThirdPartyOrderNo().trim());
|
||||||
|
if (byNo != null) {
|
||||||
|
for (ErpGoofishOrder r : byNo) {
|
||||||
|
if (r.getId() != null) {
|
||||||
|
ids.add(r.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ErpGoofishOrderEventLog> listEventLogsByOrderId(Long orderId) {
|
||||||
|
if (orderId == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
List<ErpGoofishOrderEventLog> list = erpGoofishOrderEventLogMapper.selectByOrderId(orderId);
|
||||||
|
return list != null ? list : Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ErpGoofishOrderEventLog> selectEventLogList(ErpGoofishOrderEventLogQuery query) {
|
||||||
|
if (query == null) {
|
||||||
|
query = new ErpGoofishOrderEventLogQuery();
|
||||||
|
}
|
||||||
|
List<ErpGoofishOrderEventLog> list = erpGoofishOrderEventLogMapper.selectLogList(query);
|
||||||
|
return list != null ? list : Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.ruoyi.jarvis.service.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpOpenConfig;
|
||||||
|
import com.ruoyi.jarvis.mapper.ErpOpenConfigMapper;
|
||||||
|
import com.ruoyi.jarvis.service.IErpOpenConfigService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ErpOpenConfigServiceImpl implements IErpOpenConfigService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ErpOpenConfigMapper erpOpenConfigMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ErpOpenConfig selectById(Long id) {
|
||||||
|
return erpOpenConfigMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ErpOpenConfig selectByAppKey(String appKey) {
|
||||||
|
if (appKey == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return erpOpenConfigMapper.selectByAppKey(appKey.trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ErpOpenConfig selectFirstEnabled() {
|
||||||
|
List<ErpOpenConfig> list = erpOpenConfigMapper.selectEnabledOrderBySort();
|
||||||
|
return list == null || list.isEmpty() ? null : list.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ErpOpenConfig> selectList(ErpOpenConfig query) {
|
||||||
|
return erpOpenConfigMapper.selectList(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ErpOpenConfig> selectEnabledOrderBySort() {
|
||||||
|
return erpOpenConfigMapper.selectEnabledOrderBySort();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insert(ErpOpenConfig row) {
|
||||||
|
row.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return erpOpenConfigMapper.insert(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int update(ErpOpenConfig row) {
|
||||||
|
row.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return erpOpenConfigMapper.update(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteById(Long id) {
|
||||||
|
return erpOpenConfigMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user