diff --git a/mall-common/pom.xml b/mall-common/pom.xml
index e679edd6..3af6b2f1 100644
--- a/mall-common/pom.xml
+++ b/mall-common/pom.xml
@@ -102,19 +102,19 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
@@ -274,6 +274,11 @@
spring-boot-starter-freemarker
+
+ com.huaban
+ jieba-analysis
+ 1.0.2
+
diff --git a/mall-common/src/main/java/com/suisung/mall/common/utils/JiebaUtils.java b/mall-common/src/main/java/com/suisung/mall/common/utils/JiebaUtils.java
new file mode 100644
index 00000000..ba6c7760
--- /dev/null
+++ b/mall-common/src/main/java/com/suisung/mall/common/utils/JiebaUtils.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
+ * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
+ * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
+ * Vestibulum commodo. Ut rhoncus gravida arcu.
+ */
+
+package com.suisung.mall.common.utils;
+
+import com.huaban.analysis.jieba.JiebaSegmenter;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Component
+public class JiebaUtils {
+
+ private final JiebaSegmenter segmenter = new JiebaSegmenter();
+
+ public static void main(String[] args) {
+ JiebaUtils jiebaUtils = new JiebaUtils();
+ String text = "中国工商银行桂平市光明支行";
+ List words = jiebaUtils.segmentForSearch(text);
+ System.out.println(words);
+ }
+
+ /**
+ * 精确模式分词
+ */
+ public List segment(String text) {
+ return segmenter.process(text, JiebaSegmenter.SegMode.INDEX)
+ .stream()
+ .map(token -> token.word)
+ .collect(Collectors.toList());
+ }
+
+ /**
+ * 搜索模式分词(更细粒度)
+ */
+ public List segmentForSearch(String text) {
+ return segmenter.process(text, JiebaSegmenter.SegMode.SEARCH)
+ .stream()
+ .map(token -> token.word)
+ .collect(Collectors.toList());
+ }
+}
diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/components/IpUtil.java b/mall-shop/src/main/java/com/suisung/mall/shop/components/IpUtil.java
index 6c4ef10b..21c13e73 100644
--- a/mall-shop/src/main/java/com/suisung/mall/shop/components/IpUtil.java
+++ b/mall-shop/src/main/java/com/suisung/mall/shop/components/IpUtil.java
@@ -29,11 +29,16 @@ public class IpUtil implements ApplicationRunner {
log.error("IP2RegionUtils 没有成功加载数据文件");
return null;
}
+
+ if (CheckUtil.isEmpty(ip)) {
+ return null;
+ }
+
try {
return searcher.search(ip);
} catch (Exception e) {
- log.error("IP:{} 格式错误:{}", ip, e);
- return null;
+ log.error("IP:{} 格式错误:{}", ip, e.getMessage());
+ return ip;
}
}
diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklBanksServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklBanksServiceImpl.java
index 6fe8fa91..1a7795da 100644
--- a/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklBanksServiceImpl.java
+++ b/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklBanksServiceImpl.java
@@ -13,14 +13,22 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.suisung.mall.common.constant.CommonConstant;
import com.suisung.mall.common.modules.lakala.LklBanks;
+import com.suisung.mall.common.utils.JiebaUtils;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import com.suisung.mall.shop.lakala.mapper.LklBanksMapper;
import com.suisung.mall.shop.lakala.service.LklBanksService;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import java.util.List;
+
+@Slf4j
@Service
public class LklBanksServiceImpl extends BaseServiceImpl implements LklBanksService {
+ @Resource
+ private JiebaUtils jiebaUtils;
/**
* 根据关键字查询有效记录分页列表
@@ -43,14 +51,24 @@ public class LklBanksServiceImpl extends BaseServiceImpl wrapper
- .like("branch_bank_name", keyword)
- .or()
- .like("branch_bank_no", keyword)
- .or()
- .like("clear_no", keyword)
- .or()
- .like("bank_no", keyword));
+ List keywordList = jiebaUtils.segmentForSearch(keyword);
+ log.info("分词后的关键词:{}", keywordList);
+ queryWrapper.and(wrapper -> {
+// wrapper.like("branch_bank_name", keyword)
+// .or()
+// .like("branch_bank_no", keyword)
+// .or()
+// .like("clear_no", keyword)
+// .or()
+// .like("bank_no", keyword);
+
+ // 再添加分词后的关键词条件
+
+ for (String kw : keywordList) {
+ wrapper.like("branch_bank_name", kw);
+ }
+
+ });
}
return lists(queryWrapper, pageNum, pageSize);
diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklTkServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklTkServiceImpl.java
index 8cc6e9ea..4846acd9 100644
--- a/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklTkServiceImpl.java
+++ b/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklTkServiceImpl.java
@@ -131,7 +131,8 @@ public class LklTkServiceImpl {
} catch (IllegalArgumentException e) {
logger.error("Base64 解码时出现非法参数异常: ", e.getMessage());
} catch (Exception e) {
- // 捕获其他可能的异常,如 NoSuchAlgorithmException、NoSuchPaddingException、InvalidKeySpecException、InvalidKeyException、BadPaddingException 等
+ // 捕获其他可能的异常,如 NoSuchAlgorithmException、NoSuchPaddingException、
+ // InvalidKeySpecException、InvalidKeyException、BadPaddingException 等
logger.error("解密过程中出现异常: ", e.getMessage());
}
@@ -337,7 +338,7 @@ public class LklTkServiceImpl {
header.put("Authorization", getLklTkAuthorization());
// 获取商家入驻信息,组成请求参数
- ShopMchEntry shopMchEntry = shopMchEntryService.getShopMerchEntryByCondition(mchMobile, bizLicenseNumber, CommonConstant.MCH_APPR_STA_LKL_PADDING);
+ ShopMchEntry shopMchEntry = shopMchEntryService.getShopMerchEntryByCondition(mchMobile, bizLicenseNumber, CommonConstant.MCH_APPR_STA_PASS, CommonConstant.MCH_APPR_STA_LKL_PADDING);
if (ObjectUtil.isEmpty(shopMchEntry)) {
return Pair.of(false, "商家入驻信息不存在");
}
@@ -425,12 +426,14 @@ public class LklTkServiceImpl {
JSONObject bizContent = new JSONObject();
bizContent.put("activityId", 687);
bizContent.put("termNum", "1");
- bizContent.put("mcc", "5311"); // 超市的 code
+ bizContent.put("mcc", "12015"); // 超市的 code
bizContent.put("fees", new JSONArray() {{
- put(new JSONObject() {{
- put("feeCode", "WECHAT");
- put("feeValue", 0.38);
- }});
+ put(new JSONObject() {
+ {
+ put("feeCode", "WECHAT");
+ put("feeValue", 0.6);
+ }
+ });
}});
formData.put("bizContent", bizContent);
@@ -526,17 +529,21 @@ public class LklTkServiceImpl {
JSONObject reqBodyJSON = JSONUtil.parseObj(requestBody);
if (reqBodyJSON.isEmpty() || reqBodyJSON.get("data") == null) {
- return new JSONObject().set("code", "500").set("message", "参数格式有误");
+ return new JSONObject().set("code", "500").set("message", "参数格式有误,无法解析");
+ }
+
+ String srcData = reqBodyJSON.getStr("data");
+ if (StrUtil.isBlank(srcData)) {
+ return new JSONObject().set("code", "500").set("message", "关键参数为空值");
}
// 公钥解密出来的数据
String notifyPubKey = LakalaUtil.getResourceFile(notifyPubKeyPath);
logger.debug("解密公钥:{}", notifyPubKey);
- String data = decryptNotifyData(notifyPubKey, reqBodyJSON.getStr("data"));
- logger.debug("拉卡拉进件异步通知返回解密后的参数:{}", data);
-
+ String data = decryptNotifyData(notifyPubKey, srcData);
+ logger.debug("拉卡拉进件异步通知返回 data 数据:{}, 解密后的 data 数据:{}", srcData, data);
if (StrUtil.isBlank(data)) {
- return new JSONObject().set("code", "500").set("message", "参数解密出错");
+ return new JSONObject().set("code", "500").set("message", "无法解密出 data 参数");
}
// 逻辑处理
@@ -548,7 +555,6 @@ public class LklTkServiceImpl {
// 给商家入驻表增加拉卡拉的商户号和拉卡拉返回的数据
String merCupNo = dataJSON.getStr("externalCustomerNo"); //拉卡拉外部商户号
String merInnerNo = dataJSON.getStr("customerNo"); //拉卡拉内部商户号
-
ShopMchEntry shopMchEntry = shopMchEntryService.getShopMerchEntryByMerCupNo(merCupNo);
if (ObjectUtil.isEmpty(shopMchEntry)) {
return new JSONObject().set("code", "500").set("message", "商户入驻信息不存在");
diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMchEntryService.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMchEntryService.java
index 0e74dacd..4cfcc46a 100644
--- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMchEntryService.java
+++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMchEntryService.java
@@ -103,10 +103,10 @@ public interface ShopMchEntryService {
*
* @param loginMobile
* @param bizLicenseNumber
- * @param approvalStatus
+ * @param approvalStatusList
* @return
*/
- ShopMchEntry getShopMerchEntryByCondition(String loginMobile, String bizLicenseNumber, Integer approvalStatus);
+ ShopMchEntry getShopMerchEntryByCondition(String loginMobile, String bizLicenseNumber, Integer... approvalStatusList);
/**
diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java
index ca14330d..9e13cc78 100644
--- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java
+++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java
@@ -42,10 +42,7 @@ import org.springframework.data.util.Pair;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/**
* 商家入驻申请表
@@ -634,12 +631,12 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl recordList = list(queryWrapper);
if (CollectionUtil.isEmpty(recordList)) {
return null;
@@ -744,7 +740,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("login_mobile", loginMobile);
if (ObjectUtil.isNotEmpty(lklAuditStatus)) {
- updateWrapper.set("lkl_audit_status", lklAuditStatus);
+ updateWrapper.set("lkl_tk_audit_status", lklAuditStatus);
}
if (StrUtil.isNotBlank(lklMerCupNo)) {
updateWrapper.set("lkl_mer_cup_no", lklMerCupNo); // 银联商户号
@@ -778,7 +774,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("lkl_mer_inner_no", lklInnerMerNo);
if (ObjectUtil.isNotEmpty(lklAuditStatus)) {
- updateWrapper.set("lkl_audit_status", lklAuditStatus);
+ updateWrapper.set("lkl_tk_audit_status", lklAuditStatus);
}
// 商家入驻审核正式通过