Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
4177051f
Commit
4177051f
authored
Feb 26, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开关设置
parent
b10f9e8e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
20 deletions
+31
-20
ch-core/src/main/java/com/wwdz/ch/core/consts/ResultCode.java
...ore/src/main/java/com/wwdz/ch/core/consts/ResultCode.java
+1
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
...wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
+25
-15
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/UserTokenManager.java
...rc/main/java/com/wwdz/ch/wx/manager/UserTokenManager.java
+2
-2
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/WxPayServiceTest.java
...pi/src/test/java/com/wwdz/ch/wx/api/WxPayServiceTest.java
+3
-3
No files found.
ch-core/src/main/java/com/wwdz/ch/core/consts/ResultCode.java
View file @
4177051f
...
@@ -8,6 +8,7 @@ package com.wwdz.ch.core.consts;
...
@@ -8,6 +8,7 @@ package com.wwdz.ch.core.consts;
public
enum
ResultCode
{
public
enum
ResultCode
{
SUCCESS
(
0
,
"成功"
),
SUCCESS
(
0
,
"成功"
),
UNLOGIN
(
401
,
"未登录"
),
FAILED
(
4000
,
"操作失败"
),
FAILED
(
4000
,
"操作失败"
),
UNKNOWN_USER
(
4001
,
"请先登录"
),
UNKNOWN_USER
(
4001
,
"请先登录"
),
INVALID_FILE
(
4002
,
"文件类型不正确"
),
INVALID_FILE
(
4002
,
"文件类型不正确"
),
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
View file @
4177051f
package
com.wwdz.ch.wx.impl.distribution
;
package
com.wwdz.ch.wx.impl.distribution
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.core.consts.ResultCode
;
import
com.wwdz.ch.core.type.PageSearchResult
;
import
com.wwdz.ch.core.type.PageSearchResult
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.MediaUtil
;
import
com.wwdz.ch.core.util.MediaUtil
;
...
@@ -22,6 +23,7 @@ import org.slf4j.Logger;
...
@@ -22,6 +23,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
...
@@ -158,23 +160,31 @@ public class SupplierItemServiceImpl implements SupplierItemService {
...
@@ -158,23 +160,31 @@ public class SupplierItemServiceImpl implements SupplierItemService {
List
<
SupplierItemVo
>
supplierItemVos
=
new
ArrayList
<>();
List
<
SupplierItemVo
>
supplierItemVos
=
new
ArrayList
<>();
//为了小程序过审,关闭列表展示,0关闭,1打开,展示一个默认
//为了小程序过审,关闭列表展示,0关闭,1打开,展示一个默认
Switch
sswitch
=
switchDao
.
find
();
Switch
sswitch
=
switchDao
.
find
();
//当前用户
Long
userId
=
dto
.
getUserId
();
if
(
sswitch
.
getState
()
==
0
)
{
if
(
sswitch
.
getState
()
==
0
)
{
SupplierItem
supplierItem
=
supplierItemDao
.
findById
(
3289012L
);
//开关关闭状态,检查是否有用户id,有的话检查是否有浏览记录
SupplierItemVo
supplierItemVo
=
new
SupplierItemVo
();
if
(
ObjectUtils
.
isEmpty
(
userId
))
{
EntityMapper
.
copyAttribute
(
supplierItem
,
supplierItemVo
);
SupplierItem
supplierItem
=
supplierItemDao
.
findById
(
3289012L
);
supplierItemVo
.
setSalePrice
(
PriceUtil
.
convertPriceFenToYuan
(
100L
));
SupplierItemVo
supplierItemVo
=
new
SupplierItemVo
();
supplierItemVo
.
setHomePageImage
(
MediaUtil
.
getHomePageImage
(
supplierItem
.
getImages
(),
supplierItem
.
getVideos
()));
EntityMapper
.
copyAttribute
(
supplierItem
,
supplierItemVo
);
supplierItemVos
.
add
(
supplierItemVo
);
supplierItemVo
.
setSalePrice
(
PriceUtil
.
convertPriceFenToYuan
(
100L
));
PageSearchResult
pageSearchResult
=
new
PageSearchResult
();
supplierItemVo
.
setHomePageImage
(
MediaUtil
.
getHomePageImage
(
supplierItem
.
getImages
(),
supplierItem
.
getVideos
()));
pageSearchResult
.
setTotal
(
1L
);
supplierItemVos
.
add
(
supplierItemVo
);
pageSearchResult
.
setPageSize
(
20
);
PageSearchResult
pageSearchResult
=
new
PageSearchResult
();
pageSearchResult
.
setPageIndex
(
1
);
pageSearchResult
.
setTotal
(
1L
);
pageSearchResult
.
setIsHasNextPage
(
false
);
pageSearchResult
.
setPageSize
(
20
);
pageSearchResult
.
setDataList
(
supplierItemVos
);
pageSearchResult
.
setPageIndex
(
1
);
return
Result
.
success
(
pageSearchResult
);
pageSearchResult
.
setIsHasNextPage
(
false
);
pageSearchResult
.
setDataList
(
supplierItemVos
);
return
Result
.
success
(
pageSearchResult
);
}
}
if
(
sswitch
.
getState
()
==
1
)
{
if
(
ObjectUtils
.
isEmpty
(
userId
))
{
return
Result
.
failed
(
ResultCode
.
UNLOGIN
);
}
}
}
//当前用户
long
userId
=
dto
.
getUserId
();
//用户默认展示逍遥分享的商品列表
//用户默认展示逍遥分享的商品列表
long
sellerId
=
291997
;
long
sellerId
=
291997
;
//查询用户是否绑定过分销商,绑定过则展示该分销商的商品
//查询用户是否绑定过分销商,绑定过则展示该分销商的商品
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/UserTokenManager.java
View file @
4177051f
...
@@ -29,7 +29,7 @@ public class UserTokenManager {
...
@@ -29,7 +29,7 @@ public class UserTokenManager {
private
static
final
String
TOKEN_ID_PREFIX
=
"cjxc:wx:token:token_id_prefix:"
;
private
static
final
String
TOKEN_ID_PREFIX
=
"cjxc:wx:token:token_id_prefix:"
;
private
static
Map
<
String
,
UserToken
>
tokenMap
=
new
HashMap
<>();
private
static
Map
<
String
,
UserToken
>
tokenMap
=
new
HashMap
<>();
private
static
Map
<
Long
,
UserToken
>
idMap
=
new
HashMap
<>();
private
static
Map
<
Long
,
UserToken
>
idMap
=
new
HashMap
<>();
private
static
long
SURVIVAL_TIME
=
86400
;
private
static
long
SURVIVAL_TIME
=
86400
*
7
;
public
Long
getUserId
(
String
token
)
{
public
Long
getUserId
(
String
token
)
{
String
key
=
TOKEN_PREFIX
+
token
;
String
key
=
TOKEN_PREFIX
+
token
;
...
@@ -88,7 +88,7 @@ public class UserTokenManager {
...
@@ -88,7 +88,7 @@ public class UserTokenManager {
}
}
LocalDateTime
update
=
LocalDateTime
.
now
();
LocalDateTime
update
=
LocalDateTime
.
now
();
LocalDateTime
expire
=
update
.
plusDays
(
1
);
LocalDateTime
expire
=
update
.
plusDays
(
7
);
userToken
=
new
UserToken
();
userToken
=
new
UserToken
();
userToken
.
setToken
(
token
);
userToken
.
setToken
(
token
);
...
...
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/WxPayServiceTest.java
View file @
4177051f
...
@@ -43,12 +43,12 @@ public class WxPayServiceTest {
...
@@ -43,12 +43,12 @@ public class WxPayServiceTest {
@Test
@Test
public
void
refund
()
{
public
void
refund
()
{
List
<
String
>
list
=
Arrays
.
asList
(
"DA2402
061728218723255
"
);
List
<
String
>
list
=
Arrays
.
asList
(
"DA2402
241542377839584
"
);
list
.
forEach
(
orderId
->{
list
.
forEach
(
orderId
->{
DistributionOrderRequestDto
dto
=
new
DistributionOrderRequestDto
();
DistributionOrderRequestDto
dto
=
new
DistributionOrderRequestDto
();
dto
.
setDistributionOrderId
(
orderId
);
dto
.
setDistributionOrderId
(
orderId
);
dto
.
setAmount
(
"
0.11
"
);
dto
.
setAmount
(
"
28.8
"
);
dto
.
setRefundPrice
(
"
0.11
"
);
dto
.
setRefundPrice
(
"
28.8
"
);
Result
result
=
wxPayServiceApi
.
refund
(
dto
);
Result
result
=
wxPayServiceApi
.
refund
(
dto
);
logger
.
info
(
"申请微信支付退款:{}"
,
result
);
logger
.
info
(
"申请微信支付退款:{}"
,
result
);
});
});
...
...
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