删除模块 取消打开紫鸟

This commit is contained in:
super
2026-03-31 23:12:46 +08:00
parent bf802c1019
commit b6dd1d7931
8 changed files with 260 additions and 60 deletions
@@ -0,0 +1,30 @@
package com.nanri.aiimage.modules.ziniao.model.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "紫鸟店铺匹配结果")
public class ZiniaoShopMatchResultVo {
@Schema(description = "是否匹配成功")
private boolean matched;
@Schema(description = "店铺ID")
private String shopId;
@Schema(description = "店铺名称")
private String shopName;
@Schema(description = "平台")
private String platform;
@Schema(description = "匹配到的员工 userId")
private Long matchedUserId;
@Schema(description = "打开店铺链接")
private String openStoreUrl;
}
@@ -0,0 +1,53 @@
package com.nanri.aiimage.modules.ziniao.service;
import com.nanri.aiimage.common.exception.BusinessException;
import com.nanri.aiimage.modules.ziniao.model.vo.ZiniaoShopMatchResultVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class ZiniaoShopSwitchService {
private final ZiniaoAuthService ziniaoAuthService;
public ZiniaoShopMatchResultVo matchStoreByNameAcrossStaff(String targetShopName, Long preferUserId) {
String normalizedShopName = normalizeShopName(targetShopName);
if (normalizedShopName.isBlank()) {
return emptyMatchResult();
}
ZiniaoAuthService.StoreMatchResult result = ziniaoAuthService.matchStoreByNameAcrossStaff(normalizedShopName, preferUserId);
return new ZiniaoShopMatchResultVo(
result.matched(),
result.shopId(),
result.shopName(),
result.platform(),
result.matchedUserId(),
result.openStoreUrl()
);
}
public ZiniaoShopMatchResultVo emptyMatchResult() {
return new ZiniaoShopMatchResultVo(false, null, null, null, null, null);
}
public String normalizeShopName(String value) {
if (value == null) {
return "";
}
return value.replace("\u3000", " ").trim();
}
public boolean isSkippableMatchError(BusinessException ex) {
String message = ex == null ? null : ex.getMessage();
if (message == null || message.isBlank()) {
return false;
}
return (message.contains("code=40004")
|| message.contains("userId\u5b58\u5728\u65e0\u6548\u7684\u53c2\u6570\u503c")
|| message.contains("\u65e0\u6743\u9650")
|| message.contains("\u6ca1\u6709\u6743\u9650"))
&& !message.contains("\u767d\u540d\u5355");
}
}