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
eb27168b
Commit
eb27168b
authored
Mar 25, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
缺失字段补充
parent
25944b8d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
96 additions
and
28 deletions
+96
-28
ch-core/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
...ore/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
+5
-0
ch-core/src/main/java/com/wwdz/ch/core/entity/SupplierItemVo.java
...src/main/java/com/wwdz/ch/core/entity/SupplierItemVo.java
+10
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/DistributorShareRecordDao.java
...wdz/ch/db/dao/distribution/DistributorShareRecordDao.java
+1
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/DistributorShareRecordDaoImpl.java
...h/db/impl/distribution/DistributorShareRecordDaoImpl.java
+1
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/SupplierItemDaoImpl.java
...com/wwdz/ch/db/impl/distribution/SupplierItemDaoImpl.java
+11
-6
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/OfficialAccountCallbackController.java
...com/wwdz/ch/wx/api/OfficialAccountCallbackController.java
+10
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
...wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
+47
-20
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/distribution/SupplierItemService.java
.../wwdz/ch/wx/service/distribution/SupplierItemService.java
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/distribution/SupplierItemController.java
...m/wwdz/ch/wx/web/distribution/SupplierItemController.java
+10
-0
No files found.
ch-core/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
View file @
eb27168b
...
...
@@ -40,6 +40,11 @@ public interface CommConsts {
public
static
final
Long
SYSTEM_ACCOUNT
=
8888888888L
;
/**
* 系统默认用户头像URL
*/
public
static
final
String
DEFAULT_AVATAR_URL
=
"https://cdn.wanwudezhi.com/mall-portal/image/4337400862"
;
}
ch-core/src/main/java/com/wwdz/ch/core/entity/SupplierItemVo.java
View file @
eb27168b
...
...
@@ -220,4 +220,14 @@ public class SupplierItemVo implements Entity {
* 收藏人头像
*/
private
List
<
String
>
collectorsAvatar
;
/**
* 当前用户是否已收藏
*/
private
Boolean
isCollected
;
/**
* 当前用户是否已分享过
*/
private
Boolean
isShared
;
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/DistributorShareRecordDao.java
View file @
eb27168b
...
...
@@ -68,4 +68,5 @@ public interface DistributorShareRecordDao {
*/
DistributorShareRecord
findItemShareRecordByDistributorId
(
long
distributorId
,
long
itemId
);
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/DistributorShareRecordDaoImpl.java
View file @
eb27168b
...
...
@@ -37,6 +37,7 @@ public class DistributorShareRecordDaoImpl implements DistributorShareRecordDao
DistributorShareRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
JdbcHelper
.
ifPresent
(
dto
.
getDistributorIdList
(),
criteria:
:
andDistributorIdIn
);
JdbcHelper
.
ifPresent
(
dto
.
getItemIdList
(),
criteria:
:
andItemIdIn
);
JdbcHelper
.
ifPresent
(
dto
.
getType
(),
criteria:
:
andTypeEqualTo
);
criteria
.
andEnabledEqualTo
(
true
);
return
distributorShareRecordMapper
.
selectByExample
(
example
);
}
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/SupplierItemDaoImpl.java
View file @
eb27168b
...
...
@@ -86,12 +86,17 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
public
List
<
SupplierItem
>
findForHomePage
(
SupplierItemRequestDto
dto
)
{
SupplierItemExample
supplierItemExample
=
new
SupplierItemExample
();
SupplierItemExample
.
Criteria
criteria
=
supplierItemExample
.
createCriteria
();
JdbcHelper
.
ifPresent
(
dto
.
getId
(),
criteria:
:
andIdEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getIds
(),
criteria:
:
andIdIn
);
JdbcHelper
.
ifPresent
(
dto
.
getType
(),
criteria:
:
andTypeEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getStock
(),
criteria:
:
andStockGreaterThan
);
JdbcHelper
.
ifPresent
(
dto
.
getIsOnSale
(),
criteria:
:
andIsOnSaleEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getIsDeleted
(),
criteria:
:
andIsDeletedEqualTo
);
criteria
.
andCreatorIdIn
(
dto
.
getCreatorIdList
());
criteria
.
andTypeIn
(
dto
.
getTypeList
());
criteria
.
andStockGreaterThan
(
0
);
criteria
.
andIsDeletedEqualTo
(
false
);
criteria
.
andIsOnSaleEqualTo
(
true
);
SupplierItemExample
.
Criteria
orCriteria
=
supplierItemExample
.
or
();
orCriteria
.
andIdIn
(
dto
.
getIds
());
orCriteria
.
andTypeIn
(
dto
.
getTypeList
());
orCriteria
.
andStockGreaterThan
(
0
);
orCriteria
.
andIsDeletedEqualTo
(
false
);
orCriteria
.
andIsOnSaleEqualTo
(
true
);
supplierItemExample
.
setOrderByClause
(
" update_time desc"
);
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getLimit
());
return
supplierItemMapper
.
selectByExampleWithBLOBs
(
supplierItemExample
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/OfficialAccountCallbackController.java
View file @
eb27168b
...
...
@@ -38,6 +38,10 @@ public class OfficialAccountCallbackController {
private
final
static
String
UNSUBSCRIBE_EVENT
=
"unsubscribe"
;
//一次性订阅消息
private
final
static
String
SUBSCRIBE_MSG_POPUP_EVENT
=
"subscribe_msg_popup_event"
;
@Value
(
"${dts.wx.officialaccount-token}"
)
private
String
OFFICIALACCOUNTTOKEN
;
...
...
@@ -122,7 +126,12 @@ public class OfficialAccountCallbackController {
officialAccountSubscribeRecord
.
setPlatformType
(
OfficalAccountEnum
.
PlatformTypeEnum
.
WECHAT
.
getCode
());
officialAccountSubscribeRecordService
.
insert
(
officialAccountSubscribeRecord
);
}
logger
.
info
(
"=============== 更新订阅记录成功 =============="
);
logger
.
info
(
"=============== 更新订阅公众号记录成功 =============="
);
}
else
if
(
SUBSCRIBE_MSG_POPUP_EVENT
.
equals
(
event
))
{
//一次性订阅消息
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"微信公众号通知回调接口 error : {}"
,
e
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
View file @
eb27168b
package
com.wwdz.ch.wx.impl.distribution
;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.core.consts.CommConsts
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.consts.ResultCode
;
import
com.wwdz.ch.core.type.PageSearchResult
;
...
...
@@ -8,6 +9,7 @@ import com.wwdz.ch.core.type.Result;
import
com.wwdz.ch.core.util.CacheUtil
;
import
com.wwdz.ch.core.util.MediaUtil
;
import
com.wwdz.ch.core.util.PriceUtil
;
import
com.wwdz.ch.core.util.StringUtil
;
import
com.wwdz.ch.db.dao.SwitchDao
;
import
com.wwdz.ch.db.dao.distribution.*
;
import
com.wwdz.ch.db.domain.Switch
;
...
...
@@ -173,6 +175,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
newRecord
.
setUserId
(
dto
.
getUserId
());
newRecord
.
setCreateTime
(
new
Date
());
newRecord
.
setUpdateTime
(
new
Date
());
newRecord
.
setType
(
DistributionEnum
.
UserBrowseTypeEnum
.
PLATFORM_ITEM
.
getCode
());
userRecentBrowseDao
.
insert
(
newRecord
);
}
}
else
{
...
...
@@ -182,6 +185,13 @@ public class SupplierItemServiceImpl implements SupplierItemService {
}
else
{
supplierItemVo
.
setShopBought
(
false
);
}
//判断商家是否已经分享过
DistributorShareRecord
shareRecord
=
distributorShareRecordDao
.
findItemShareRecordByDistributorId
(
dto
.
getUserId
(),
itemId
);
if
(
shareRecord
!=
null
&&
StringUtils
.
hasLength
(
shareRecord
.
getShareId
()))
{
supplierItemVo
.
setIsShared
(
true
);
}
else
{
supplierItemVo
.
setIsShared
(
false
);
}
}
SupplierItem
supplierItem
=
supplierItemDao
.
findById
(
itemId
);
EntityMapper
.
copyAttribute
(
supplierItem
,
supplierItemVo
);
...
...
@@ -573,12 +583,20 @@ public class SupplierItemServiceImpl implements SupplierItemService {
itemId
=
collectionShareRecord
.
getShareTargetId
();
}
supplierItemVo
.
setIsCollected
(
true
);
SupplierItem
supplierItem
=
supplierItemDao
.
findById
(
itemId
);
if
(
supplierItem
.
getCreatorId
().
longValue
()
!=
userId
)
{
supplierItemVo
.
setIsMine
(
false
);
boolean
isCollected
=
itemCollectedRecordDao
.
isExisted
(
itemId
,
userId
);
if
(
isCollected
)
{
supplierItemVo
.
setIsCollected
(
true
);
}
else
{
supplierItemVo
.
setIsCollected
(
false
);
}
if
(
supplierItem
.
getIsDeleted
())
{
//判断是否有相关收藏记录,有则删除
if
(
i
temCollectedRecordDao
.
isExisted
(
itemId
,
userId
)
)
{
if
(
i
sCollected
)
{
itemCollectedRecordDao
.
cancel
(
itemId
,
userId
);
}
return
Result
.
failed
(
"该藏品已删除"
);
...
...
@@ -609,7 +627,8 @@ public class SupplierItemServiceImpl implements SupplierItemService {
List
<
Long
>
collectorIds
=
itemCollectedRecords
.
stream
().
map
(
ItemCollectedRecord:
:
getCollectorsId
).
collect
(
Collectors
.
toList
());
List
<
String
>
avatarList
=
new
ArrayList
<>();
for
(
Long
collectorId
:
collectorIds
)
{
avatarList
.
add
(
cacheUtil
.
getAppletUserById
(
collectorId
).
getAvatar
());
String
avatar
=
cacheUtil
.
getAppletUserById
(
collectorId
).
getAvatar
();
avatarList
.
add
(
StringUtils
.
isEmpty
(
avatar
)
?
CommConsts
.
DEFAULT_AVATAR_URL
:
avatar
);
}
supplierItemVo
.
setCollectorsAvatar
(
avatarList
);
}
...
...
@@ -618,7 +637,8 @@ public class SupplierItemServiceImpl implements SupplierItemService {
supplierItemVo
.
setDistributionPrice
(
PriceUtil
.
convertPriceFenToYuan
(
supplierItem
.
getDistributionPrice
()));
supplierItemVo
.
setHomePageImage
(
MediaUtil
.
getHomePageImage
(
supplierItem
.
getImages
(),
supplierItem
.
getVideos
()));
supplierItemVo
.
setCreatorName
(
cacheUtil
.
getAppletUserNameById
(
supplierItem
.
getCreatorId
()));
supplierItemVo
.
setCreatorAvatar
(
cacheUtil
.
getAppletUserById
(
supplierItem
.
getCreatorId
()).
getAvatar
());
String
avatar
=
cacheUtil
.
getAppletUserById
(
supplierItem
.
getCreatorId
()).
getAvatar
();
supplierItemVo
.
setCreatorAvatar
(
StringUtils
.
isEmpty
(
avatar
)
?
CommConsts
.
DEFAULT_AVATAR_URL
:
avatar
);
//查询藏品被收藏的次数
long
countNum
=
itemCollectedRecordDao
.
countByItemId
(
dto
.
getId
());
supplierItemVo
.
setCollectedNum
((
int
)
countNum
);
...
...
@@ -644,7 +664,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
@Override
public
Result
h
omePage
(
SupplierItemRequestDto
dto
)
{
public
Result
findH
omePage
(
SupplierItemRequestDto
dto
)
{
try
{
List
<
SupplierItemVo
>
supplierItemVos
=
new
ArrayList
<>();
//为了小程序过审,关闭列表展示,0关闭,1打开,展示一个默认
...
...
@@ -679,19 +699,27 @@ public class SupplierItemServiceImpl implements SupplierItemService {
SupplierItemRequestDto
searchDto
=
new
SupplierItemRequestDto
();
//查询用户的历史浏览记录
List
<
UserRecentBrowse
>
userRecentBrowseList
=
userRecentBrowseDao
.
findByUserId
(
userId
);
List
<
Long
>
sharedUserIdList
=
userRecentBrowseList
.
stream
().
map
(
UserRecentBrowse:
:
getSharedUserId
).
collect
(
Collectors
.
toList
());
List
<
DistributorShareRecord
>
distributorShareRecordList
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
sharedUserIdList
))
{
searchDto
.
setCreatorIdList
(
sharedUserIdList
);
DistributorShareRecordRequestDto
distributorShareRecordRequestDto
=
new
DistributorShareRecordRequestDto
();
distributorShareRecordRequestDto
.
setDistributorIdList
(
sharedUserIdList
);
distributorShareRecordRequestDto
.
setType
(
dto
.
getType
());
distributorShareRecordList
=
distributorShareRecordDao
.
find
(
distributorShareRecordRequestDto
);
List
<
Long
>
distributorShareItemIds
=
distributorShareRecordList
.
stream
().
map
(
DistributorShareRecord:
:
getItemId
).
collect
(
Collectors
.
toList
());
searchDto
.
setIds
(
distributorShareItemIds
);
//浏览记录是平台商品的
List
<
Long
>
sharedUserIdList
=
userRecentBrowseList
.
stream
().
filter
(
a
->
a
.
getType
()
==
DistributionEnum
.
UserBrowseTypeEnum
.
PLATFORM_ITEM
.
getCode
()).
map
(
UserRecentBrowse:
:
getSharedUserId
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
sharedUserIdList
))
{
sharedUserIdList
.
add
(
sellerId
);
}
Map
<
Long
,
DistributorShareRecord
>
map
=
distributorShareRecordList
.
stream
().
collect
(
Collectors
.
toMap
(
DistributorShareRecord:
:
getItemId
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
searchDto
.
setCreatorIdList
(
sharedUserIdList
);
DistributorShareRecordRequestDto
distributorShareRecordRequestDto
=
new
DistributorShareRecordRequestDto
();
distributorShareRecordRequestDto
.
setDistributorIdList
(
sharedUserIdList
);
distributorShareRecordRequestDto
.
setType
(
dto
.
getType
());
List
<
DistributorShareRecord
>
distributorShareRecordList
=
distributorShareRecordDao
.
find
(
distributorShareRecordRequestDto
);
//平台商品被分享出去对应的分销商的所有分享商品
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
());
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
);
searchDto
.
setIsDeleted
(
false
);
if
(
dto
.
getType
()
==
DistributionEnum
.
DistributionTypeEnum
.
FIXED_PRICE
.
getCode
())
{
...
...
@@ -699,19 +727,18 @@ public class SupplierItemServiceImpl implements SupplierItemService {
}
else
{
searchDto
.
setTypeList
(
Arrays
.
asList
(
DistributionEnum
.
DistributionTypeEnum
.
AUCTION
.
getCode
()));
}
searchDto
.
setCreatorIdList
(
share
dUserIdList
);
searchDto
.
setCreatorIdList
(
uploa
dUserIdList
);
searchDto
.
setStock
(
0
);
//库存大于0
searchDto
.
setPage
(
dto
.
getPage
());
searchDto
.
setLimit
(
dto
.
getLimit
());
List
<
SupplierItem
>
supplierItemList
=
supplierItemDao
.
findForHomePage
(
searchDto
);
logger
.
info
(
">>>>>>> supplierItemList >>>>> : {}"
,
JsonUtils
.
from
(
supplierItemList
));
PageInfo
<
SupplierItem
>
pageInfo
=
new
PageInfo
(
supplierItemList
);
supplierItemList
.
forEach
(
supplierItem
->
{
SupplierItemVo
supplierItemVo
=
new
SupplierItemVo
();
EntityMapper
.
copyAttribute
(
supplierItem
,
supplierItemVo
);
supplierItemVo
.
setItemId
(
supplierItem
.
getId
());
supplierItemVo
.
setHomePageImage
(
MediaUtil
.
getHomePageImage
(
supplierItem
.
getImages
(),
supplierItem
.
getVideos
()));
logger
.
info
(
"商品id:{}, 对应shareid : {}"
,
supplierItem
.
getId
(),
map
.
get
(
supplierItem
.
getId
()).
getShareId
());
supplierItemVo
.
setShareId
(
map
.
get
(
supplierItem
.
getId
()).
getShareId
());
supplierItemVo
.
setShareId
(
map
.
get
(
supplierItem
.
getId
())==
null
?
""
:
map
.
get
(
supplierItem
.
getId
()).
getShareId
());
//竞拍商品需要展示当前价
if
(
supplierItem
.
getType
()
==
DistributionEnum
.
DistributionTypeEnum
.
AUCTION
.
getCode
())
{
AuctionRecord
auctionRecord
=
auctionRecordDao
.
findLastedRecord
(
supplierItem
.
getId
());
...
...
@@ -727,7 +754,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
});
return
Result
.
success
(
PageSearchResult
.
of
(
pageInfo
,
supplierItemVos
));
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询
最近订单所属分销商的
商品列表,商品类型为:{}, error : {}"
,
dto
.
getType
(),
e
);
logger
.
error
(
"查询
主页
商品列表,商品类型为:{}, error : {}"
,
dto
.
getType
(),
e
);
}
return
Result
.
failed
();
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/distribution/SupplierItemService.java
View file @
eb27168b
...
...
@@ -87,6 +87,6 @@ public interface SupplierItemService {
* @param dto
* @return
*/
Result
h
omePage
(
SupplierItemRequestDto
dto
);
Result
findH
omePage
(
SupplierItemRequestDto
dto
);
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/distribution/SupplierItemController.java
View file @
eb27168b
...
...
@@ -131,4 +131,14 @@ public class SupplierItemController {
return
supplierItemService
.
delete
(
dto
);
}
@ApiOperation
(
value
=
"查询主页列表"
)
@PostMapping
(
"/findHomePage"
)
public
Result
findHomePage
(
@RequestBody
SupplierItemRequestDto
dto
)
{
logger
.
info
(
"删除用户查询主页列表藏品,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
dto
.
getId
()
==
null
)
{
return
Result
.
failed
(
ResultCode
.
PARAM_ERROR
);
}
return
supplierItemService
.
findHomePage
(
dto
);
}
}
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