Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yanxuan-wx-store-sharer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wx
yanxuan-wx-store-sharer
Commits
03364e3e
Commit
03364e3e
authored
Mar 14, 2025
by
fanjiaxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
联调问题处理
parent
66970561
Pipeline
#71582
passed with stages
in 1 minute 6 seconds
Changes
12
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
156 additions
and
57 deletions
+156
-57
ProductListVO.java
...xuan/wx/store/sharer/biz/meta/model/vo/ProductListVO.java
+3
-5
ProductPromotionLinkVO.java
...tore/sharer/biz/meta/model/vo/ProductPromotionLinkVO.java
+19
-0
SharerInfoVO.java
...nxuan/wx/store/sharer/biz/meta/model/vo/SharerInfoVO.java
+10
-0
IProductService.java
.../yanxuan/wx/store/sharer/biz/service/IProductService.java
+6
-0
ProductServiceImpl.java
.../wx/store/sharer/biz/service/impl/ProductServiceImpl.java
+21
-8
UserServiceImpl.java
...uan/wx/store/sharer/biz/service/impl/UserServiceImpl.java
+24
-24
HttpStatusConstant.java
...n/wx/store/sharer/common/constant/HttpStatusConstant.java
+6
-1
NoBindSharerException.java
.../store/sharer/common/exception/NoBindSharerException.java
+40
-0
GlobalExceptionHandler.java
...x/store/sharer/common/handler/GlobalExceptionHandler.java
+16
-5
ProductController.java
...uan/wx/store/sharer/web/controller/ProductController.java
+11
-0
package-info.java
...nxuan/wx/store/sharer/web/meta/model/vo/package-info.java
+0
-7
package-info.java
...com/netease/yanxuan/wx/store/sharer/web/package-info.java
+0
-7
No files found.
yanxuan-wx-store-sharer-biz/src/main/java/com/netease/yanxuan/wx/store/sharer/biz/meta/model/vo/ProductListVO.java
View file @
03364e3e
...
...
@@ -2,6 +2,7 @@ package com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
...
...
@@ -10,7 +11,8 @@ import java.math.BigDecimal;
* @Date 2025/3/11 11:05
*/
@Data
public
class
ProductListVO
{
public
class
ProductListVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
8340371734171952574L
;
/**
* 商品标题
*/
...
...
@@ -35,8 +37,4 @@ public class ProductListVO {
* 商品ID
*/
private
String
productId
;
/**
* 商品推广链接
*/
private
String
productUrl
;
}
yanxuan-wx-store-sharer-biz/src/main/java/com/netease/yanxuan/wx/store/sharer/biz/meta/model/vo/ProductPromotionLinkVO.java
0 → 100644
View file @
03364e3e
package
com
.
netease
.
yanxuan
.
wx
.
store
.
sharer
.
biz
.
meta
.
model
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Description 商品短链
* @Author fanjiaxin
* @Date 2025/3/11 11:05
*/
@Data
public
class
ProductPromotionLinkVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
9193922166179487836L
;
/**
* 商品短链
*/
private
String
promotionLink
;
}
yanxuan-wx-store-sharer-biz/src/main/java/com/netease/yanxuan/wx/store/sharer/biz/meta/model/vo/SharerInfoVO.java
View file @
03364e3e
package
com
.
netease
.
yanxuan
.
wx
.
store
.
sharer
.
biz
.
meta
.
model
.
vo
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
/**
* @Description 用户信息
...
...
@@ -47,4 +49,12 @@ public class SharerInfoVO {
* 绑定时需要的queryString参数
*/
private
String
bindQueryString
;
@Getter
@RequiredArgsConstructor
public
enum
bindStatus
{
UNBIND
(
0
),
BIND
(
1
);
private
final
Integer
code
;
}
}
yanxuan-wx-store-sharer-biz/src/main/java/com/netease/yanxuan/wx/store/sharer/biz/service/IProductService.java
View file @
03364e3e
package
com
.
netease
.
yanxuan
.
wx
.
store
.
sharer
.
biz
.
service
;
import
com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.ProductListVO
;
import
com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.ProductPromotionLinkVO
;
import
com.netease.yanxuan.wx.store.sharer.biz.meta.page.PageQuery
;
import
com.netease.yanxuan.wx.store.sharer.biz.meta.page.PageVO
;
...
...
@@ -15,4 +16,9 @@ public interface IProductService {
* 获取商品分页列表
*/
PageVO
<
ProductListVO
>
getProductPageList
(
PageQuery
pageQuery
,
String
keyword
);
/**
* 商品分享短链
*/
ProductPromotionLinkVO
getProductPromotionLink
(
String
productId
,
String
sharerAppid
);
}
yanxuan-wx-store-sharer-biz/src/main/java/com/netease/yanxuan/wx/store/sharer/biz/service/impl/ProductServiceImpl.java
View file @
03364e3e
...
...
@@ -3,7 +3,9 @@ package com.netease.yanxuan.wx.store.sharer.biz.service.impl;
import
com.netease.yanxuan.wx.store.sharer.biz.config.DrmSharerConfig
;
import
com.netease.yanxuan.wx.store.sharer.biz.core.LoginUserContextHolder
;
import
com.netease.yanxuan.wx.store.sharer.biz.core.LoginUserInfo
;
import
com.netease.yanxuan.wx.store.sharer.common.exception.NoBindSharerException
;
import
com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.ProductListVO
;
import
com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.ProductPromotionLinkVO
;
import
com.netease.yanxuan.wx.store.sharer.biz.meta.page.PageQuery
;
import
com.netease.yanxuan.wx.store.sharer.biz.meta.page.PageVO
;
import
com.netease.yanxuan.wx.store.sharer.biz.service.IProductService
;
...
...
@@ -101,14 +103,6 @@ public class ProductServiceImpl implements IProductService {
listVO
.
setCommission
(
commission
);
listVO
.
setShopAppid
(
item
.
getShop_appid
());
listVO
.
setProductId
(
item
.
getProduct_id
());
// 获取推广链接
if
(
null
!=
loginUserInfo
&&
StringUtils
.
isNotBlank
(
loginUserInfo
.
getSharerAppId
())){
WeChatPromoteProductLinkVO
promoteProductLinkVO
=
weChatShopPromoteProductLinkRequest
.
handle
(
loginUserInfo
.
getSharerAppId
(),
Long
.
valueOf
(
item
.
getProduct_id
()),
item
.
getShop_appid
());
listVO
.
setProductUrl
(
null
!=
promoteProductLinkVO
?
promoteProductLinkVO
.
getShort_link
()
:
null
);
}
return
listVO
;
})
.
filter
(
Objects:
:
nonNull
)
...
...
@@ -116,4 +110,23 @@ public class ProductServiceImpl implements IProductService {
pageVO
.
setList
(
resultList
);
return
pageVO
;
}
@Override
public
ProductPromotionLinkVO
getProductPromotionLink
(
String
productId
,
String
shopAppid
)
{
// 获取用户信息
LoginUserInfo
loginUserInfo
=
LoginUserContextHolder
.
get
();
if
(
StringUtils
.
isBlank
(
loginUserInfo
.
getSharerAppId
()))
{
throw
new
NoBindSharerException
(
"未绑定推客"
);
}
WeChatPromoteProductLinkVO
promoteProductLinkVO
=
weChatShopPromoteProductLinkRequest
.
handle
(
loginUserInfo
.
getSharerAppId
(),
Long
.
valueOf
(
productId
),
shopAppid
);
if
(
null
!=
promoteProductLinkVO
&&
StringUtils
.
isNotBlank
(
promoteProductLinkVO
.
getShort_link
()))
{
ProductPromotionLinkVO
result
=
new
ProductPromotionLinkVO
();
result
.
setPromotionLink
(
promoteProductLinkVO
.
getShort_link
());
return
result
;
}
return
null
;
}
}
yanxuan-wx-store-sharer-biz/src/main/java/com/netease/yanxuan/wx/store/sharer/biz/service/impl/UserServiceImpl.java
View file @
03364e3e
...
...
@@ -11,7 +11,6 @@ import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.SharerInfoVO;
import
com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.UserCommissionRatioVO
;
import
com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.UserTokenVO
;
import
com.netease.yanxuan.wx.store.sharer.biz.service.IUserService
;
import
com.netease.yanxuan.wx.store.sharer.common.exception.NoAuthException
;
import
com.netease.yanxuan.wx.store.sharer.dal.mapper.SharerInfoMapper
;
import
com.netease.yanxuan.wx.store.sharer.dal.meta.model.po.SharerInfo
;
import
com.netease.yanxuan.wx.store.sharer.integration.handler.impl.WeChatShopSharerListRequest
;
...
...
@@ -82,53 +81,54 @@ public class UserServiceImpl implements IUserService {
@Override
public
SharerInfoVO
refreshUserInfo
()
{
LoginUserInfo
loginUserInfo
=
LoginUserContextHolder
.
get
();
if
(
null
==
loginUserInfo
)
{
throw
new
NoAuthException
(
"用户登录状态过期"
);
}
SharerInfoVO
result
=
getSharerRegisterBindInfo
(
loginUserInfo
.
getOpenId
());
// 获取本地用户信息
LambdaQueryWrapper
<
SharerInfo
>
sharerInfoLqw
=
Wrappers
.
lambdaQuery
();
sharerInfoLqw
.
eq
(
SharerInfo:
:
getOpenId
,
loginUserInfo
.
getOpenId
());
sharerInfoLqw
.
last
(
"LIMIT 1"
);
SharerInfo
sharerInfo
=
sharerInfoMapper
.
selectOne
(
sharerInfoLqw
);
Date
now
=
new
Date
(
);
SharerInfoVO
result
=
getSharerRegisterBindInfo
(
loginUserInfo
.
getOpenId
()
);
// 初始化保存
if
(
null
==
sharerInfo
)
{
sharerInfo
=
new
SharerInfo
();
sharerInfo
.
setOpenId
(
loginUserInfo
.
getOpenId
());
// 默认佣金比例
sharerInfo
.
setCommissionRatio
(
drmSharerConfig
.
getDefaultCommissionRatio
());
sharerInfo
.
setCommissionType
(
CommissionTypeEnum
.
PLATFORM
.
getCode
());
sharerInfo
.
setCreateTime
(
now
);
sharerInfo
.
setUpdateTime
(
now
);
sharerInfoMapper
.
insert
(
sharerInfo
);
}
// 已经绑定
if
(
StringUtils
.
isNotBlank
(
sharerInfo
.
getSharerAppid
()))
{
result
.
setSharerAppId
(
sharerInfo
.
getSharerAppid
());
}
WeChatSharerInfoVO
sharerInfoVO
;
Date
now
=
new
Date
();
// 已绑定
if
(
SharerInfoVO
.
bindStatus
.
BIND
.
getCode
().
equals
(
result
.
getBindStatus
())){
// 获取绑定信息
WeChatSharerListVO
sharerListVO
=
weChatShopSharerListRequest
.
handle
(
loginUserInfo
.
getOpenId
(),
""
,
1
);
if
(
null
!=
sharerListVO
&&
!
CollectionUtils
.
isEmpty
(
sharerListVO
.
getSharer_info_list
()))
{
WeChatSharerInfoVO
sharerInfoVO
=
sharerListVO
.
getSharer_info_list
().
get
(
0
);
if
(
null
!=
sharerInfoVO
&&
StringUtils
.
isNotBlank
(
sharerInfoVO
.
getSharer_appid
()))
{
sharerInfoVO
=
sharerListVO
.
getSharer_info_list
().
get
(
0
);
if
(
null
!=
sharerInfoVO
)
{
result
.
setSharerAppId
(
sharerInfoVO
.
getSharer_appid
());
sharerInfo
.
setSharerAppid
(
sharerInfoVO
.
getSharer_appid
());
sharerInfo
.
setBindTime
(
new
Date
(
sharerInfoVO
.
getBind_time
()));
Date
bindTime
=
null
!=
sharerInfoVO
.
getBind_time
()
?
new
Date
(
sharerInfoVO
.
getBind_time
())
:
now
;
sharerInfo
.
setBindTime
(
bindTime
);
sharerInfo
.
setCommissionRatio
(
sharerInfoVO
.
getCommission_ratio
());
sharerInfo
.
setCommissionType
(
sharerInfoVO
.
getCommission_type
().
toString
());
String
commissionType
=
null
!=
sharerInfoVO
.
getCommission_type
()
?
sharerInfoVO
.
getCommission_type
().
toString
()
:
CommissionTypeEnum
.
PLATFORM
.
getCode
();
sharerInfo
.
setCommissionType
(
commissionType
);
}
}
}
// 初始化保存
if
(
null
==
sharerInfo
.
getId
())
{
// 默认佣金比例
sharerInfo
.
setCommissionRatio
(
drmSharerConfig
.
getDefaultCommissionRatio
());
sharerInfo
.
setCommissionType
(
CommissionTypeEnum
.
PLATFORM
.
getCode
());
sharerInfo
.
setCreateTime
(
now
);
sharerInfo
.
setUpdateTime
(
now
);
sharerInfoMapper
.
insert
(
sharerInfo
);
}
else
{
sharerInfo
.
setUpdateTime
(
now
);
sharerInfoMapper
.
updateById
(
sharerInfo
);
}
}
return
result
;
}
@Override
public
SharerInfoVO
getUserInfo
()
{
LoginUserInfo
loginUserInfo
=
LoginUserContextHolder
.
get
();
if
(
null
==
loginUserInfo
)
{
throw
new
NoAuthException
(
"用户登录状态过期"
);
}
SharerInfoVO
result
=
getSharerRegisterBindInfo
(
loginUserInfo
.
getOpenId
());
// 获取本地用户信息
LambdaQueryWrapper
<
SharerInfo
>
sharerInfoLqw
=
Wrappers
.
lambdaQuery
();
...
...
yanxuan-wx-store-sharer-common/src/main/java/com/netease/yanxuan/wx/store/sharer/common/constant/HttpStatusConstant.java
View file @
03364e3e
...
...
@@ -10,11 +10,16 @@ public interface HttpStatusConstant {
int
SUCCESS
=
200
;
/**
*
未授权
*
鉴权失败
*/
int
UNAUTHORIZED
=
401
;
/**
* 未绑定推客
*/
int
UNAUTHSHARER
=
40101
;
/**
* 失败标记
*/
int
FAIL
=
500
;
...
...
yanxuan-wx-store-sharer-common/src/main/java/com/netease/yanxuan/wx/store/sharer/common/exception/NoBindSharerException.java
0 → 100644
View file @
03364e3e
package
com
.
netease
.
yanxuan
.
wx
.
store
.
sharer
.
common
.
exception
;
/**
* 未绑定推客-异常类
*/
public
class
NoBindSharerException
extends
BizException
{
private
static
final
long
serialVersionUID
=
6300030459749920168L
;
public
NoBindSharerException
()
{
super
();
}
public
NoBindSharerException
(
String
message
)
{
super
(
message
);
}
public
NoBindSharerException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
NoBindSharerException
(
Throwable
cause
)
{
super
(
cause
);
}
public
NoBindSharerException
(
Object
obj
)
{
super
();
}
public
NoBindSharerException
(
String
message
,
Object
obj
)
{
super
(
message
);
}
public
NoBindSharerException
(
String
message
,
Throwable
cause
,
Object
obj
)
{
super
(
message
,
cause
);
}
public
NoBindSharerException
(
Throwable
cause
,
Object
obj
)
{
super
(
cause
);
}
}
yanxuan-wx-store-sharer-common/src/main/java/com/netease/yanxuan/wx/store/sharer/common/handler/GlobalExceptionHandler.java
View file @
03364e3e
...
...
@@ -5,6 +5,7 @@ import com.netease.yanxuan.wx.store.sharer.common.constant.HttpStatusConstant;
import
com.netease.yanxuan.wx.store.sharer.common.core.Result
;
import
com.netease.yanxuan.wx.store.sharer.common.exception.BizException
;
import
com.netease.yanxuan.wx.store.sharer.common.exception.NoAuthException
;
import
com.netease.yanxuan.wx.store.sharer.common.exception.NoBindSharerException
;
import
com.netease.yanxuan.wx.store.sharer.common.exception.WeChatException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
...
...
@@ -30,13 +31,13 @@ public class GlobalExceptionHandler {
}
/**
*
系统
异常
*
未绑定推客
异常
*/
@ExceptionHandler
(
Exception
.
class
)
public
Result
<
Void
>
handle
Exception
(
Exception
e
,
HttpServletRequest
request
)
{
@ExceptionHandler
(
NoBindSharer
Exception
.
class
)
public
Result
<
Void
>
handle
NoBindSharerException
(
NoBindSharer
Exception
e
,
HttpServletRequest
request
)
{
String
requestURI
=
request
.
getRequestURI
();
log
.
error
(
"请求地址'{}',
发生系统异常."
,
requestURI
,
e
);
return
Result
.
fail
(
e
);
log
.
error
(
"请求地址'{}',
认证失败'{}',无法访问系统资源"
,
requestURI
,
e
.
getMessage
()
);
return
Result
.
fail
(
HttpStatusConstant
.
UNAUTHSHARER
,
"未授权推客"
);
}
/**
...
...
@@ -58,4 +59,14 @@ public class GlobalExceptionHandler {
log
.
error
(
"请求地址'{}',发生业务异常."
,
requestURI
,
e
);
return
Result
.
fail
(
e
);
}
/**
* 系统异常
*/
@ExceptionHandler
(
Exception
.
class
)
public
Result
<
Void
>
handleException
(
Exception
e
,
HttpServletRequest
request
)
{
String
requestURI
=
request
.
getRequestURI
();
log
.
error
(
"请求地址'{}',发生系统异常."
,
requestURI
,
e
);
return
Result
.
fail
(
e
);
}
}
yanxuan-wx-store-sharer-web/src/main/java/com/netease/yanxuan/wx/store/sharer/web/controller/ProductController.java
View file @
03364e3e
package
com
.
netease
.
yanxuan
.
wx
.
store
.
sharer
.
web
.
controller
;
import
com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.ProductListVO
;
import
com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.ProductPromotionLinkVO
;
import
com.netease.yanxuan.wx.store.sharer.biz.meta.page.PageQuery
;
import
com.netease.yanxuan.wx.store.sharer.biz.meta.page.PageVO
;
import
com.netease.yanxuan.wx.store.sharer.biz.service.IProductService
;
...
...
@@ -33,4 +34,14 @@ public class ProductController extends BaseController {
return
Result
.
ok
(
pageList
);
}
/**
* 商品分享短链
*/
@GetMapping
(
"/promotion/link"
)
public
Result
<
ProductPromotionLinkVO
>
getProductPromotionLink
(
@RequestParam
(
"shopAppid"
)
String
shopAppid
,
@RequestParam
(
"productId"
)
String
productId
)
{
ProductPromotionLinkVO
promotionLink
=
iProductService
.
getProductPromotionLink
(
shopAppid
,
productId
);
return
Result
.
ok
(
promotionLink
);
}
}
yanxuan-wx-store-sharer-web/src/main/java/com/netease/yanxuan/wx/store/sharer/web/meta/model/vo/package-info.java
deleted
100644 → 0
View file @
66970561
/**
* vo对象
*
* @author 莫闲.
* @date 2021/1/29.
*/
package
com
.
netease
.
yanxuan
.
wx
.
store
.
sharer
.
web
.
meta
.
model
.
vo
;
yanxuan-wx-store-sharer-web/src/main/java/com/netease/yanxuan/wx/store/sharer/web/package-info.java
deleted
100644 → 0
View file @
66970561
/**
* web 部分一般包含常见的Controller,Servlet等组件
*
* @author hzwangliyuan.
* @date 2019/11/28.
*/
package
com
.
netease
.
yanxuan
.
wx
.
store
.
sharer
.
web
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment