feat(用户): 添加根据ab98UserId查询微信用户功能并增强订单查询
添加根据ab98UserId查询微信用户的功能 在订单查询中增加对关联微信用户openid的条件查询
This commit is contained in:
parent
4940ebddeb
commit
b283264d19
|
|
@ -31,6 +31,8 @@ import com.agileboot.domain.qywx.authCorpInfo.AuthCorpInfoApplicationService;
|
|||
import com.agileboot.domain.qywx.authCorpInfo.db.QyAuthCorpInfoEntity;
|
||||
import com.agileboot.domain.qywx.user.db.QyUserEntity;
|
||||
import com.agileboot.domain.qywx.user.db.QyUserService;
|
||||
import com.agileboot.domain.wx.user.db.WxUserEntity;
|
||||
import com.agileboot.domain.wx.user.db.WxUserService;
|
||||
import com.agileboot.domain.shop.approval.command.AddReturnApprovalCommand;
|
||||
import com.agileboot.domain.shop.approval.command.UpdateReturnApprovalCommand;
|
||||
import com.agileboot.domain.shop.approval.model.ReturnApprovalModel;
|
||||
|
|
@ -93,6 +95,7 @@ public class OrderApplicationService {
|
|||
private final AccessTokenApplicationService accessTokenApplicationService;
|
||||
private final QyUserService qyUserService;
|
||||
private final Ab98UserService ab98UserService;
|
||||
private final WxUserService wxUserService;
|
||||
@Autowired
|
||||
private WxshopConfig wxshopConfig;
|
||||
|
||||
|
|
@ -513,6 +516,14 @@ public class OrderApplicationService {
|
|||
wrapper.or()
|
||||
.eq("openid", ab98User.getOpenid());
|
||||
}
|
||||
|
||||
// 如果该 ab98UserId 在 wx_user 表中存在绑定的微信用户,则查询条件再加上 openid
|
||||
WxUserEntity wxUser = wxUserService.getByAb98UserId(ab98User.getAb98UserId());
|
||||
if (wxUser != null && StringUtils.isNotBlank(wxUser.getOpenid())) {
|
||||
// 添加 or 条件,根据 wx_user 表中的 openid 查询订单
|
||||
wrapper.or()
|
||||
.eq("openid", wxUser.getOpenid());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@ import com.agileboot.domain.wx.user.dto.WxUserDTO;
|
|||
import com.agileboot.domain.wx.user.model.WxUserModel;
|
||||
import com.agileboot.domain.wx.user.model.WxUserModelFactory;
|
||||
import com.agileboot.domain.wx.user.query.SearchWxUserQuery;
|
||||
import com.agileboot.domain.qywx.user.db.QyUserEntity;
|
||||
import com.agileboot.domain.qywx.user.db.QyUserService;
|
||||
import com.agileboot.domain.qywx.user.dto.QyUserDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -48,6 +52,8 @@ public class WxUserApplicationService {
|
|||
|
||||
private final Ab98UserApplicationService ab98UserApplicationService;
|
||||
|
||||
private final QyUserService qyUserService;
|
||||
|
||||
/**
|
||||
* 获取微信用户列表(分页)
|
||||
*/
|
||||
|
|
@ -222,6 +228,15 @@ public class WxUserApplicationService {
|
|||
userDTO.setAb98Name(ab98UserEntity.getName());
|
||||
userDTO.setAb98FaceImg(ab98UserEntity.getFaceImg());
|
||||
}
|
||||
|
||||
// 查询是否有企业微信用户绑定了该ab98UserId
|
||||
LambdaQueryWrapper<QyUserEntity> qyWrapper = new LambdaQueryWrapper<>();
|
||||
qyWrapper.eq(QyUserEntity::getAb98UserId, userDTO.getAb98UserId())
|
||||
.eq(QyUserEntity::getDeleted, false);
|
||||
QyUserEntity qyUserEntity = qyUserService.getOne(qyWrapper);
|
||||
if (qyUserEntity != null) {
|
||||
userDTO.setQyUserId(qyUserEntity.getId().longValue());
|
||||
}
|
||||
}
|
||||
|
||||
return userDTO;
|
||||
|
|
|
|||
|
|
@ -62,4 +62,12 @@ public interface WxUserService extends IService<WxUserEntity> {
|
|||
* @return 是否成功
|
||||
*/
|
||||
boolean updateBalance(Long wxUserId, Integer balance);
|
||||
|
||||
/**
|
||||
* 根据ab98UserId获取微信用户
|
||||
*
|
||||
* @param ab98UserId 汇邦云用户ID
|
||||
* @return 微信用户信息
|
||||
*/
|
||||
WxUserEntity getByAb98UserId(Long ab98UserId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,4 +98,17 @@ public class WxUserServiceImpl extends ServiceImpl<WxUserMapper, WxUserEntity> i
|
|||
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxUserEntity getByAb98UserId(Long ab98UserId) {
|
||||
if (ab98UserId == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<WxUserEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(WxUserEntity::getAb98UserId, ab98UserId)
|
||||
.eq(WxUserEntity::getDeleted, 0);
|
||||
|
||||
return this.getOne(wrapper);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue