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
13bc26af
Commit
13bc26af
authored
Mar 26, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修复2
parent
d2376720
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
367 additions
and
40 deletions
+367
-40
ch-core/src/main/java/com/wwdz/ch/core/entity/LogisticsInfo.java
.../src/main/java/com/wwdz/ch/core/entity/LogisticsInfo.java
+21
-0
ch-core/src/main/java/com/wwdz/ch/core/entity/LogisticsRequestDto.java
...ain/java/com/wwdz/ch/core/entity/LogisticsRequestDto.java
+12
-0
ch-core/src/main/java/com/wwdz/ch/core/entity/TrailInfo.java
ch-core/src/main/java/com/wwdz/ch/core/entity/TrailInfo.java
+12
-0
ch-core/src/main/resources/application-dev.yml
ch-core/src/main/resources/application-dev.yml
+5
-0
ch-core/src/main/resources/application-prod.yml
ch-core/src/main/resources/application-prod.yml
+5
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/SupplierItemDao.java
...java/com/wwdz/ch/db/dao/distribution/SupplierItemDao.java
+2
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/SupplierItemDaoImpl.java
...com/wwdz/ch/db/impl/distribution/SupplierItemDaoImpl.java
+12
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/LogisticsApi.java
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/LogisticsApi.java
+214
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SelfPageServiceImpl.java
...com/wwdz/ch/wx/impl/distribution/SelfPageServiceImpl.java
+9
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
...wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
+43
-38
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/LogisticsApiTest.java
...pi/src/test/java/com/wwdz/ch/wx/api/LogisticsApiTest.java
+32
-0
No files found.
ch-core/src/main/java/com/wwdz/ch/core/entity/LogisticsInfo.java
0 → 100644
View file @
13bc26af
package
com.wwdz.ch.core.entity
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
LogisticsInfo
implements
Entity
{
private
String
logisticCode
;
private
String
logisticName
;
private
String
waybill
;
private
String
state
;
private
String
stateName
;
private
List
<
TrailInfo
>
trailInfoList
;
}
ch-core/src/main/java/com/wwdz/ch/core/entity/LogisticsRequestDto.java
0 → 100644
View file @
13bc26af
package
com.wwdz.ch.core.entity
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
@Data
public
class
LogisticsRequestDto
implements
Entity
{
private
String
logisticsCode
;
private
String
waybill
;
}
ch-core/src/main/java/com/wwdz/ch/core/entity/TrailInfo.java
0 → 100644
View file @
13bc26af
package
com.wwdz.ch.core.entity
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
@Data
public
class
TrailInfo
implements
Entity
{
private
String
createTime
;
private
String
desc
;
}
ch-core/src/main/resources/application-dev.yml
View file @
13bc26af
...
...
@@ -24,6 +24,11 @@ dts:
#分销拍卖业务,众号消息点击后跳转到小程序页面的链接
auction-msg-url
:
pages/saleAuctionDetail/index
#快递鸟
kuaidiniao-id
:
1622726
apikey
:
be9b8745-a47e-4d4d-afba-e55aab4bca74
# 商户证书文件路径
# 请参考“商户证书”一节 https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=4_3
key-path
:
xxxxx
...
...
ch-core/src/main/resources/application-prod.yml
View file @
13bc26af
...
...
@@ -9,6 +9,11 @@ dts:
get-access-token-url
:
https://api.weixin.qq.com/cgi-bin/stable_token
#快递鸟
kuaidiniao-id
:
1622726
apikey
:
be9b8745-a47e-4d4d-afba-e55aab4bca74
#公众号消息点击后跳转到小程序页面的链接
msg-url
:
pages/consignNodeDetail/index
#分销业务,公众号消息点击后跳转到小程序页面的链接
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/SupplierItemDao.java
View file @
13bc26af
...
...
@@ -52,5 +52,7 @@ public interface SupplierItemDao {
*/
List
<
SupplierItem
>
findForHomePage
(
SupplierItemRequestDto
supplierItemRequestDto
);
long
countByCreatorId
(
long
creatorId
);
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/SupplierItemDaoImpl.java
View file @
13bc26af
...
...
@@ -101,4 +101,16 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getLimit
());
return
supplierItemMapper
.
selectByExampleWithBLOBs
(
supplierItemExample
);
}
@Override
public
long
countByCreatorId
(
long
creatorId
)
{
SupplierItemExample
supplierItemExample
=
new
SupplierItemExample
();
SupplierItemExample
.
Criteria
criteria
=
supplierItemExample
.
createCriteria
();
criteria
.
andCreatorIdEqualTo
(
creatorId
);
criteria
.
andTypeEqualTo
(
3
);
criteria
.
andIsDeletedEqualTo
(
false
);
criteria
.
andIsOnSaleEqualTo
(
true
);
return
supplierItemMapper
.
countByExample
(
supplierItemExample
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/LogisticsApi.java
0 → 100644
View file @
13bc26af
package
com.wwdz.ch.wx.api
;
import
com.wwdz.ch.core.consts.LogisticsEnum
;
import
com.wwdz.ch.core.entity.LogisticsInfo
;
import
com.wwdz.ch.core.entity.LogisticsRequestDto
;
import
com.wwdz.ch.core.entity.TrailInfo
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.Base64
;
import
com.wwdz.ch.core.util.OkHttpUtil
;
import
com.xxdxxs.utils.JsonUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.io.*
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.security.MessageDigest
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Component
public
class
LogisticsApi
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
LogisticsApi
.
class
);
@Value
(
"${dts.wx.kuaidiniao-id}"
)
private
String
KUAIDINIAO_ID
;
@Value
(
"${dts.wx.apikey}"
)
private
String
APIKEY
;
private
final
static
String
GET_TRAIL_URL
=
"https://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx"
;
/**
* 查询物流轨迹
*/
public
Result
findTrails
(
LogisticsRequestDto
dto
){
try
{
String
RequestData
=
"{"
+
"'ShipperCode': '"
+
dto
.
getLogisticsCode
()
+
"',"
+
"'LogisticCode': '"
+
dto
.
getWaybill
()
+
"',"
+
"}"
;
// 组装系统级参数
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
params
.
put
(
"RequestData"
,
urlEncoder
(
RequestData
,
"UTF-8"
));
params
.
put
(
"EBusinessID"
,
KUAIDINIAO_ID
);
params
.
put
(
"RequestType"
,
"8001"
);
String
dataSign
=
encrypt
(
RequestData
,
APIKEY
,
"UTF-8"
);
params
.
put
(
"DataSign"
,
urlEncoder
(
dataSign
,
"UTF-8"
));
params
.
put
(
"DataType"
,
"2"
);
String
result
=
sendPost
(
GET_TRAIL_URL
,
params
);
logger
.
info
(
"findTrails response :{}"
,
result
);
String
isSuccess
=
JsonUtils
.
getValueByPath
(
result
,
"Success"
);
if
(
"true"
.
equals
(
isSuccess
))
{
LogisticsInfo
logisticsInfo
=
new
LogisticsInfo
();
String
trails
=
JsonUtils
.
getValueByPath
(
result
,
"Traces"
);
List
<
TrailInfo
>
trailInfoList
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
list
=
JsonUtils
.
toMapList
(
trails
);
list
.
forEach
(
map
->
{
TrailInfo
trailInfo
=
new
TrailInfo
();
trailInfo
.
setCreateTime
((
String
)
map
.
get
(
"AcceptTime"
));
trailInfo
.
setDesc
((
String
)
map
.
get
(
"AcceptStation"
));
trailInfoList
.
add
(
trailInfo
);
});
String
state
=
JsonUtils
.
getValueByPath
(
result
,
"State"
);
logisticsInfo
.
setLogisticCode
(
dto
.
getLogisticsCode
());
logisticsInfo
.
setLogisticName
(
LogisticsEnum
.
getNameByCode
(
dto
.
getLogisticsCode
()));
logisticsInfo
.
setWaybill
(
dto
.
getWaybill
());
logisticsInfo
.
setTrailInfoList
(
trailInfoList
);
logisticsInfo
.
setState
(
state
);
return
Result
.
success
(
logisticsInfo
);
}
return
Result
.
failed
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询物流轨迹error :{}"
,
e
);
}
return
Result
.
failed
();
}
/**
* MD5加密
* str 内容
* charset 编码方式
* @throws Exception
*/
@SuppressWarnings
(
"unused"
)
private
String
MD5
(
String
str
,
String
charset
)
throws
Exception
{
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
md
.
update
(
str
.
getBytes
(
charset
));
byte
[]
result
=
md
.
digest
();
StringBuffer
sb
=
new
StringBuffer
(
32
);
for
(
int
i
=
0
;
i
<
result
.
length
;
i
++)
{
int
val
=
result
[
i
]
&
0xff
;
if
(
val
<=
0xf
)
{
sb
.
append
(
"0"
);
}
sb
.
append
(
Integer
.
toHexString
(
val
));
}
return
sb
.
toString
().
toLowerCase
();
}
/**
* base64编码
* str 内容
* charset 编码方式
* @throws UnsupportedEncodingException
*/
private
String
base64
(
String
str
,
String
charset
)
throws
UnsupportedEncodingException
{
String
encoded
=
Base64
.
encode
(
str
.
getBytes
(
charset
));
return
encoded
;
}
private
String
urlEncoder
(
String
str
,
String
charset
)
throws
UnsupportedEncodingException
{
String
result
=
URLEncoder
.
encode
(
str
,
charset
);
return
result
;
}
/**
* Sign签名生成
* content 内容
* keyValue ApiKey
* charset 编码方式
* @throws UnsupportedEncodingException ,Exception
* @return DataSign签名
*/
private
String
encrypt
(
String
content
,
String
keyValue
,
String
charset
)
throws
UnsupportedEncodingException
,
Exception
{
if
(
keyValue
!=
null
)
{
return
base64
(
MD5
(
content
+
keyValue
,
charset
),
charset
);
}
return
base64
(
MD5
(
content
,
charset
),
charset
);
}
/**
* 向指定 URL 发送POST方法的请求
* url 发送请求的 URL
* params 请求的参数集合
* @return 远程资源的响应结果
*/
private
String
sendPost
(
String
url
,
Map
<
String
,
String
>
params
)
{
OutputStreamWriter
out
=
null
;
BufferedReader
in
=
null
;
StringBuilder
result
=
new
StringBuilder
();
try
{
URL
realUrl
=
new
URL
(
url
);
HttpURLConnection
conn
=
(
HttpURLConnection
)
realUrl
.
openConnection
();
// 发送POST请求必须设置如下两行
conn
.
setDoOutput
(
true
);
conn
.
setDoInput
(
true
);
// POST方法
conn
.
setRequestMethod
(
"POST"
);
// 设置通用的请求属性
conn
.
setRequestProperty
(
"accept"
,
"*/*"
);
conn
.
setRequestProperty
(
"connection"
,
"Keep-Alive"
);
conn
.
setRequestProperty
(
"user-agent"
,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"
);
conn
.
setRequestProperty
(
"Content-Type"
,
"application/x-www-form-urlencoded"
);
conn
.
connect
();
// 获取URLConnection对象对应的输出流
out
=
new
OutputStreamWriter
(
conn
.
getOutputStream
(),
"UTF-8"
);
// 发送请求参数
if
(
params
!=
null
)
{
StringBuilder
param
=
new
StringBuilder
();
for
(
Map
.
Entry
<
String
,
String
>
entry
:
params
.
entrySet
())
{
if
(
param
.
length
()
>
0
)
{
param
.
append
(
"&"
);
}
param
.
append
(
entry
.
getKey
());
param
.
append
(
"="
);
param
.
append
(
entry
.
getValue
());
System
.
out
.
println
(
entry
.
getKey
()
+
":"
+
entry
.
getValue
());
}
System
.
out
.
println
(
"param:"
+
param
.
toString
());
out
.
write
(
param
.
toString
());
}
// flush输出流的缓冲
out
.
flush
();
// 定义BufferedReader输入流来读取URL的响应
in
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
(),
"UTF-8"
));
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
result
.
append
(
line
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
out
!=
null
)
{
out
.
close
();
}
if
(
in
!=
null
)
{
in
.
close
();
}
}
catch
(
IOException
ex
)
{
ex
.
printStackTrace
();
}
}
return
result
.
toString
();
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SelfPageServiceImpl.java
View file @
13bc26af
...
...
@@ -8,6 +8,7 @@ import com.wwdz.ch.core.util.PriceUtil;
import
com.wwdz.ch.core.util.RedisUtils
;
import
com.wwdz.ch.db.bean.DistributionOrderNum
;
import
com.wwdz.ch.db.dao.distribution.*
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.domain.distribution.AuctionConfig
;
import
com.wwdz.ch.db.domain.distribution.AuctionRecord
;
import
com.wwdz.ch.db.domain.distribution.CollectionShareRecord
;
...
...
@@ -60,6 +61,9 @@ public class SelfPageServiceImpl implements SelfPageService {
@Autowired
CollectionShareRecordDao
collectionShareRecordDao
;
@Autowired
SupplierItemDao
supplierItemDao
;
@Override
...
...
@@ -158,8 +162,11 @@ public class SelfPageServiceImpl implements SelfPageService {
}
else
{
map
.
put
(
"isMine"
,
true
);
}
String
avatar
=
cacheUtil
.
getAppletUserById
(
itemUserId
).
getAvatar
();
map
.
put
(
"avatar"
,
StringUtils
.
isEmpty
(
avatar
)
?
CommConsts
.
DEFAULT_AVATAR_URL
:
avatar
);
User
user
=
cacheUtil
.
getAppletUserById
(
itemUserId
);
map
.
put
(
"avatar"
,
StringUtils
.
isEmpty
(
user
.
getAvatar
())
?
CommConsts
.
DEFAULT_AVATAR_URL
:
user
.
getAvatar
());
map
.
put
(
"name"
,
StringUtils
.
isEmpty
(
user
.
getNickname
())
?
"微信用户"
:
user
.
getNickname
());
long
count
=
supplierItemDao
.
countByCreatorId
(
itemUserId
);
map
.
put
(
"count"
,
count
);
return
Result
.
success
(
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"判断主客态 error : {}"
,
e
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
View file @
13bc26af
...
...
@@ -188,18 +188,20 @@ public class SupplierItemServiceImpl implements SupplierItemService {
SupplierItem
supplierItem
=
supplierItemDao
.
findById
(
itemId
);
SupplierItemVo
supplierItemVo
=
new
SupplierItemVo
();
if
(
StringUtils
.
hasLength
(
shareRecordId
))
{
//做浏览记录
boolean
flag
=
userRecentBrowseDao
.
isExisted
(
dto
.
getUserId
(),
distributorShareRecord
.
getDistributorId
());
if
(!
flag
)
{
UserRecentBrowse
newRecord
=
new
UserRecentBrowse
();
newRecord
.
setShareRecordId
(
dto
.
getShareRecordId
());
newRecord
.
setSharerId
(
distributorShareRecord
.
getDistributorId
());
newRecord
.
setUserId
(
dto
.
getUserId
());
newRecord
.
setCreateTime
(
new
Date
());
newRecord
.
setUpdateTime
(
new
Date
());
newRecord
.
setType
(
DistributionEnum
.
UserBrowseTypeEnum
.
PLATFORM_ITEM
.
getCode
());
newRecord
.
setSharedUserId
(
distributorShareRecord
.
getDistributorId
());
userRecentBrowseDao
.
insert
(
newRecord
);
if
(
distributorShareRecord
.
getDistributorId
()
!=
dto
.
getUserId
())
{
//做浏览记录
boolean
flag
=
userRecentBrowseDao
.
isExisted
(
dto
.
getUserId
(),
distributorShareRecord
.
getDistributorId
());
if
(!
flag
)
{
UserRecentBrowse
newRecord
=
new
UserRecentBrowse
();
newRecord
.
setShareRecordId
(
dto
.
getShareRecordId
());
newRecord
.
setSharerId
(
distributorShareRecord
.
getDistributorId
());
newRecord
.
setUserId
(
dto
.
getUserId
());
newRecord
.
setCreateTime
(
new
Date
());
newRecord
.
setUpdateTime
(
new
Date
());
newRecord
.
setType
(
DistributionEnum
.
UserBrowseTypeEnum
.
PLATFORM_ITEM
.
getCode
());
newRecord
.
setSharedUserId
(
distributorShareRecord
.
getDistributorId
());
userRecentBrowseDao
.
insert
(
newRecord
);
}
}
}
...
...
@@ -405,18 +407,20 @@ public class SupplierItemServiceImpl implements SupplierItemService {
itemId
=
dto
.
getId
();
}
if
(
StringUtils
.
hasLength
(
shareRecordId
))
{
//做浏览记录
boolean
flag
=
userRecentBrowseDao
.
isExisted
(
dto
.
getUserId
(),
distributorShareRecord
.
getDistributorId
());
if
(!
flag
)
{
UserRecentBrowse
newRecord
=
new
UserRecentBrowse
();
newRecord
.
setShareRecordId
(
dto
.
getShareRecordId
());
newRecord
.
setSharerId
(
distributorShareRecord
.
getDistributorId
());
newRecord
.
setUserId
(
dto
.
getUserId
());
newRecord
.
setCreateTime
(
new
Date
());
newRecord
.
setUpdateTime
(
new
Date
());
newRecord
.
setType
(
DistributionEnum
.
UserBrowseTypeEnum
.
PLATFORM_ITEM
.
getCode
());
newRecord
.
setSharedUserId
(
distributorShareRecord
.
getDistributorId
());
userRecentBrowseDao
.
insert
(
newRecord
);
if
(
distributorShareRecord
.
getDistributorId
()
!=
dto
.
getUserId
())
{
//做浏览记录
boolean
flag
=
userRecentBrowseDao
.
isExisted
(
dto
.
getUserId
(),
distributorShareRecord
.
getDistributorId
());
if
(!
flag
)
{
UserRecentBrowse
newRecord
=
new
UserRecentBrowse
();
newRecord
.
setShareRecordId
(
dto
.
getShareRecordId
());
newRecord
.
setSharerId
(
distributorShareRecord
.
getDistributorId
());
newRecord
.
setUserId
(
dto
.
getUserId
());
newRecord
.
setCreateTime
(
new
Date
());
newRecord
.
setUpdateTime
(
new
Date
());
newRecord
.
setType
(
DistributionEnum
.
UserBrowseTypeEnum
.
PLATFORM_ITEM
.
getCode
());
newRecord
.
setSharedUserId
(
distributorShareRecord
.
getDistributorId
());
userRecentBrowseDao
.
insert
(
newRecord
);
}
}
}
...
...
@@ -653,17 +657,19 @@ public class SupplierItemServiceImpl implements SupplierItemService {
}
//如果是客态,需要记录浏览记录
if
(
StringUtils
.
hasLength
(
dto
.
getShareRecordId
()))
{
boolean
isExisted
=
userRecentBrowseDao
.
isExistedBySharedUserId
(
userId
,
collectionShareRecord
.
getItemUserId
());
if
(!
isExisted
)
{
UserRecentBrowse
userRecentBrowse
=
new
UserRecentBrowse
();
userRecentBrowse
.
setUserId
(
userId
);
userRecentBrowse
.
setSharerId
(
collectionShareRecord
.
getSharerId
());
userRecentBrowse
.
setCreateTime
(
new
Date
());
userRecentBrowse
.
setUpdateTime
(
new
Date
());
userRecentBrowse
.
setShareRecordId
(
dto
.
getShareRecordId
());
userRecentBrowse
.
setType
(
DistributionEnum
.
UserBrowseTypeEnum
.
USER_ITEM
.
getCode
());
userRecentBrowse
.
setSharedUserId
(
collectionShareRecord
.
getItemUserId
());
userRecentBrowseDao
.
insert
(
userRecentBrowse
);
if
(
collectionShareRecord
.
getItemUserId
().
longValue
()
!=
dto
.
getUserId
())
{
boolean
isExisted
=
userRecentBrowseDao
.
isExistedBySharedUserId
(
userId
,
collectionShareRecord
.
getItemUserId
());
if
(!
isExisted
)
{
UserRecentBrowse
userRecentBrowse
=
new
UserRecentBrowse
();
userRecentBrowse
.
setUserId
(
userId
);
userRecentBrowse
.
setSharerId
(
collectionShareRecord
.
getSharerId
());
userRecentBrowse
.
setCreateTime
(
new
Date
());
userRecentBrowse
.
setUpdateTime
(
new
Date
());
userRecentBrowse
.
setShareRecordId
(
dto
.
getShareRecordId
());
userRecentBrowse
.
setType
(
DistributionEnum
.
UserBrowseTypeEnum
.
USER_ITEM
.
getCode
());
userRecentBrowse
.
setSharedUserId
(
collectionShareRecord
.
getItemUserId
());
userRecentBrowseDao
.
insert
(
userRecentBrowse
);
}
}
}
}
else
{
...
...
@@ -767,10 +773,10 @@ public class SupplierItemServiceImpl implements SupplierItemService {
List
<
Long
>
distributorShareItemIds
=
distributorShareRecordList
.
stream
().
filter
(
StringUtil
.
distinctByKey
(
DistributorShareRecord:
:
getItemId
)).
map
(
DistributorShareRecord:
:
getItemId
).
collect
(
Collectors
.
toList
());
//浏览记录是用户上传的
List
<
Long
>
uploadUserIdList
=
userRecentBrowseList
.
stream
().
filter
(
a
->
a
.
getType
()
==
DistributionEnum
.
UserBrowseTypeEnum
.
USER_ITEM
.
getCode
()).
map
(
UserRecentBrowse:
:
getSharedUserId
).
collect
(
Collectors
.
toList
());
/*
List<Long> uploadUserIdList = userRecentBrowseList.stream().filter(a -> a.getType() == DistributionEnum.UserBrowseTypeEnum.USER_ITEM.getCode()).map(UserRecentBrowse::getSharedUserId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(uploadUserIdList)) {
uploadUserIdList.add(sellerId);
}
}
*/
searchDto
.
setIds
(
distributorShareItemIds
);
Map
<
Long
,
DistributorShareRecord
>
map
=
distributorShareRecordList
.
stream
().
collect
(
Collectors
.
toMap
(
DistributorShareRecord:
:
getItemId
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
searchDto
.
setIsOnSale
(
true
);
...
...
@@ -780,7 +786,6 @@ public class SupplierItemServiceImpl implements SupplierItemService {
}
else
{
searchDto
.
setTypeList
(
Arrays
.
asList
(
DistributionEnum
.
DistributionTypeEnum
.
AUCTION
.
getCode
()));
}
searchDto
.
setCreatorIdList
(
uploadUserIdList
);
searchDto
.
setStock
(
0
);
//库存大于0
searchDto
.
setPage
(
dto
.
getPage
());
searchDto
.
setLimit
(
dto
.
getLimit
());
...
...
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/LogisticsApiTest.java
0 → 100644
View file @
13bc26af
package
com.wwdz.ch.wx.api
;
import
com.wwdz.ch.core.entity.LogisticsRequestDto
;
import
com.wwdz.ch.core.type.Result
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
@SpringBootTest
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
public
class
LogisticsApiTest
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
LogisticsApiTest
.
class
);
@Autowired
LogisticsApi
logisticsApi
;
@Test
public
void
findTrails
()
{
LogisticsRequestDto
dto
=
new
LogisticsRequestDto
();
dto
.
setLogisticsCode
(
"YTO"
);
dto
.
setWaybill
(
"YT1160805180957"
);
Result
result
=
logisticsApi
.
findTrails
(
dto
);
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