| Pass |
- 16:21:35 |
+ 17:32:10 |
Test passed
|
@@ -128,13 +128,13 @@
Started
-
һ 07, 2025 16:21:35
+
һ 09, 2025 17:32:09
Ended
-
һ 07, 2025 16:21:35
+
һ 09, 2025 17:32:10
diff --git a/hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java b/hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java
index c9342859..df482615 100644
--- a/hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java
+++ b/hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java
@@ -4,6 +4,7 @@ import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.constant.UserConstant;
import cc.hiver.core.common.utils.PageUtil;
import cc.hiver.core.common.utils.SecurityUtil;
+import cc.hiver.core.common.utils.StringUtils;
import cc.hiver.core.common.vo.PageVo;
import cc.hiver.core.common.vo.SearchVo;
import cc.hiver.core.dao.UserDao;
@@ -280,6 +281,11 @@ public class UserServiceImpl implements UserService {
final Map resultMap = new HashMap<>();
if (wechatUser != null) {
wechatUser.setOfficialAccountOpenid(openid);
+ if (!wechatUser.getType().contains(UserConstant.USER_TYPE_CUSTOM)) {
+ // 不包含,赋予下游客户身份
+ final String newUserType = StringUtils.isEmpty(wechatUser.getType()) ? UserConstant.USER_TYPE_CUSTOM : wechatUser.getType() + ',' + UserConstant.USER_TYPE_CUSTOM;
+ wechatUser.setType(newUserType);
+ }
} else {
try {
// 新增用户信息
@@ -287,6 +293,7 @@ public class UserServiceImpl implements UserService {
wechatUser.setUnionid(unionid);
wechatUser.setOfficialAccountOpenid(openid);
wechatUser.setStatus(UserConstant.USER_STATUS_NORMAL);
+ wechatUser.setType(UserConstant.USER_TYPE_CUSTOM);
wechatUser = save(wechatUser);
// 设置用户角色
final UserRole userRole = new UserRole();
diff --git a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java
index 8d9a3216..e6c4bf1a 100644
--- a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java
+++ b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java
@@ -593,6 +593,7 @@ public class UserController {
final String sessionKey = jsonObject.get("session_key").getAsString();
final String openId = jsonObject.get("openid").getAsString();
final String unionid = jsonObject.get("unionid").getAsString();
+ log.info("微信登录的传参==openId==:{};unionid==:{}",openId,unionid);
// 判断是否绑定用户
User wechatUser = null;
final Map resultMap = new HashMap<>();
@@ -600,12 +601,26 @@ public class UserController {
wechatUser = userService.findByUnionid(unionid);
}else{
wechatUser = userService.findById(wechatVo.getUserId());
+ if (wechatUser == null) {
+ // 如果根据userid没查到,再根据unionid查询一遍
+ wechatUser = userService.findByUnionid(unionid);
+ }
}
+
if (wechatUser == null) {
+ log.info("微信登录未根据userid和unionid查询到用户,准备新增用户userId:{};unionid:{}",wechatVo.getUserId(),unionid);
try {
// 新增用户信息
wechatUser = new User();
wechatUser.setStatus(UserConstant.USER_STATUS_NORMAL);
+ // 去掉特殊符号(只保留字母和数字)
+ String cleanedOpenid = openId.replaceAll("[^a-zA-Z0-9]", "");
+ // 截取前 10 位,作为username
+ String username = cleanedOpenid.length() > 10 ? cleanedOpenid.substring(0, 10) : cleanedOpenid;
+ wechatUser.setUsername(username);
+ final String encryptPass = new BCryptPasswordEncoder().encode("123456");
+ wechatUser.setPassword(encryptPass);
+ wechatUser.setType(UserConstant.USER_TYPE_CUSTOM);
wechatUser = userService.save(wechatUser);
// 设置用户角色
final UserRole userRole = new UserRole();
@@ -630,6 +645,12 @@ public class UserController {
} else {
// 更新客户信息,绑定登录用户
customerService.updateUserId(wechatVo.getCustomId(), wechatUser.getId());
+ final String type = wechatUser.getType();
+ if (!type.contains(UserConstant.USER_TYPE_CUSTOM)) {
+ // 不包含,赋予下游客户身份
+ final String newUserType = StringUtils.isEmpty(type) ? UserConstant.USER_TYPE_CUSTOM : type + ',' + UserConstant.USER_TYPE_CUSTOM;
+ wechatUser.setType(newUserType);
+ }
}
wechatUser.setUnionid(unionid);
wechatUser.setWechatName(wechatVo.getWechatName());
@@ -688,6 +709,7 @@ public class UserController {
wechatUser.setUnionid(unionid);
wechatUser.setOfficialAccountOpenid(openid);
wechatUser.setStatus(UserConstant.USER_STATUS_NORMAL);
+ wechatUser.setType(UserConstant.USER_TYPE_CUSTOM);
wechatUser = userService.save(wechatUser);
// 设置用户角色
final UserRole userRole = new UserRole();
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/ProductPageQuery.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/ProductPageQuery.java
index 32488390..bb8f90ea 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/ProductPageQuery.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/ProductPageQuery.java
@@ -49,6 +49,9 @@ public class ProductPageQuery extends HiverBasePageQuery {
@ApiModelProperty("货号")
private String productSn;
+ @ApiModelProperty("供应商id")
+ private String supplierId;
+
@ApiModelProperty("供应商名称")
private String supplierName;
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesAndDetailsServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesAndDetailsServiceImpl.java
index a3a06df2..f57f9e17 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesAndDetailsServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesAndDetailsServiceImpl.java
@@ -455,9 +455,8 @@ public class SalesAndDetailsServiceImpl implements SalesAndDetailsService {
String customerId = "";
if (StringUtils.isNotEmpty(saleQueryDTO.getMobile())) {
// 20240906如果前台传了客户id了,不要新增客户了就
- byMobile = userService.findByMobile(saleQueryDTO.getMobile());
if(StringUtils.isEmpty(saleQueryDTO.getUserId())){
- // byMobile = userService.findByMobile(saleQueryDTO.getMobile());
+ byMobile = userService.findByMobile(saleQueryDTO.getMobile());
if (byMobile == null) {
//默认密码
final String encryptPass = new BCryptPasswordEncoder().encode("123456");
@@ -544,14 +543,7 @@ public class SalesAndDetailsServiceImpl implements SalesAndDetailsService {
dealingsRecordService.save(dealingsRecord);
}else{
// 客户id拿前台传的
- String byMobileMobile = byMobile.getMobile();
- if(byMobileMobile.equals(saleQueryDTO.getUserId())){
- customerId = saleQueryDTO.getUserId();
- }else{
- // 根据手机号查询的用户id和前台传的不一样,则根据 userPhone 查customer表(所有数据)更新 userid 为传过来的这个
- customerService.updateUserIdByUserPhone(saleQueryDTO.getMobile(),saleQueryDTO.getUserId());
- }
-
+ customerId = saleQueryDTO.getUserId();
}
} else {
log.error("下游客户未填写手机号!");
diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/CustomerMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/CustomerMapper.xml
index b9e906cc..b954e5f8 100644
--- a/hiver-modules/hiver-mall/src/main/resources/mapper/CustomerMapper.xml
+++ b/hiver-modules/hiver-mall/src/main/resources/mapper/CustomerMapper.xml
@@ -526,7 +526,7 @@
and a.shop_id = #{shopId,jdbcType=VARCHAR}
- and a.user_id = #{userPhone,jdbcType=VARCHAR}
+ and (a.phone = #{userPhone,jdbcType=VARCHAR} or a.user_id = #{userPhone,jdbcType=VARCHAR})
diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
index af774cac..158e8ca5 100644
--- a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
+++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
@@ -631,6 +631,11 @@
AND t.category_id =#{queryParams.categoryId}
+
+
+ AND t.supplier_id =#{queryParams.supplierId}
+
+
AND t.product_name like concat('%',#{queryParams.productName},'%')