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
3ceea4ee
Commit
3ceea4ee
authored
Apr 12, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
我推荐的列表详情
parent
478d5dbd
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
185 additions
and
9 deletions
+185
-9
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/DistributionOrderDao.java
...com/wwdz/ch/db/dao/distribution/DistributionOrderDao.java
+22
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/DistributionOrderDaoImpl.java
...wdz/ch/db/impl/distribution/DistributionOrderDaoImpl.java
+32
-0
ch-dao/src/main/java/com/wwdz/ch/db/mapper/distribution/DistributionOrderMapper.java
...dz/ch/db/mapper/distribution/DistributionOrderMapper.java
+12
-0
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/DistributionOrderMapper.xml
...wdz/ch/db/mapper/distribution/DistributionOrderMapper.xml
+4
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/FollowFansRecordVo.java
...ain/java/com/wwdz/ch/wx/entity/vo/FollowFansRecordVo.java
+10
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/DistributionOrderVo.java
...wdz/ch/wx/entity/vo/distribution/DistributionOrderVo.java
+5
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/DistributorShareRecordVo.java
...h/wx/entity/vo/distribution/DistributorShareRecordVo.java
+4
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FollowFansRecordServiceImpl.java
...java/com/wwdz/ch/wx/impl/FollowFansRecordServiceImpl.java
+80
-9
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FollowFansRecordService.java
.../java/com/wwdz/ch/wx/service/FollowFansRecordService.java
+16
-0
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/DistributionOrderDao.java
View file @
3ceea4ee
...
...
@@ -91,6 +91,28 @@ public interface DistributionOrderDao {
*/
Long
countSelledNum
(
long
itemId
);
List
<
DistributionOrder
>
findByIntroducer
(
DistributionOrderRequestDto
dto
);
/**
* 该介绍人产生的订单数量
* @param introducerId
* @param sellerId
* @return
*/
Long
countByIntroducer
(
long
introducerId
,
long
sellerId
);
/**
* 该介绍人产生的订单总金额
* @param introducerId
* @param sellerId
* @return
*/
Long
sumAmountByIntroducer
(
long
introducerId
,
long
sellerId
);
/**
* 根据状态统计订单数量
* @param buyerId
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/DistributionOrderDaoImpl.java
View file @
3ceea4ee
...
...
@@ -12,6 +12,7 @@ import com.xxdxxs.db.component.JdbcHelper;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -122,6 +123,37 @@ public class DistributionOrderDaoImpl implements DistributionOrderDao {
return
distributionOrderMapper
.
countSelledNum
(
itemId
);
}
@Override
public
List
<
DistributionOrder
>
findByIntroducer
(
DistributionOrderRequestDto
dto
)
{
DistributionOrderExample
example
=
new
DistributionOrderExample
();
DistributionOrderExample
.
Criteria
criteria
=
example
.
createCriteria
();
//藏品订单,分享id为介绍人自己的id
criteria
.
andShareRecordIdEqualTo
(
String
.
valueOf
(
dto
.
getShareRecordId
()));
criteria
.
andSellerIdEqualTo
(
dto
.
getSellerId
());
criteria
.
andStateNotIn
(
Arrays
.
asList
(
1
,
101
));
example
.
setOrderByClause
(
"create_time desc"
);
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getLimit
());
return
distributionOrderMapper
.
selectByExample
(
example
);
}
@Override
public
Long
countByIntroducer
(
long
introducerId
,
long
sellerId
)
{
DistributionOrderExample
example
=
new
DistributionOrderExample
();
DistributionOrderExample
.
Criteria
criteria
=
example
.
createCriteria
();
//藏品订单,分享id为介绍人自己的id
criteria
.
andShareRecordIdEqualTo
(
String
.
valueOf
(
introducerId
));
criteria
.
andSellerIdEqualTo
(
sellerId
);
criteria
.
andStateNotIn
(
Arrays
.
asList
(
1
,
101
));
return
distributionOrderMapper
.
countByExample
(
example
);
}
@Override
public
Long
sumAmountByIntroducer
(
long
introducerId
,
long
sellerId
)
{
return
distributionOrderMapper
.
sumAmountByIntroducer
(
introducerId
,
sellerId
);
}
@Override
public
Long
countByStateForBuyer
(
long
buyerId
,
int
state
)
{
DistributionOrderExample
example
=
new
DistributionOrderExample
();
...
...
ch-dao/src/main/java/com/wwdz/ch/db/mapper/distribution/DistributionOrderMapper.java
View file @
3ceea4ee
...
...
@@ -75,6 +75,18 @@ public interface DistributionOrderMapper {
*/
List
<
DistributionOrderNum
>
countGroupByStateForDistributor
(
@Param
(
"sellerId"
)
Long
distributorId
);
/**
* 介绍人产生的订单金额总和
* @param introducerId
* @param sellerId
* @return
*/
long
sumAmountByIntroducer
(
@Param
(
"introducerId"
)
Long
introducerId
,
@Param
(
"sellerId"
)
Long
sellerId
);
/**
* 统计用户各状态的订单数量
* @param userId
...
...
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/DistributionOrderMapper.xml
View file @
3ceea4ee
...
...
@@ -641,4 +641,8 @@
<select
id=
"countSelledNum"
parameterType=
"java.lang.Long"
resultType=
"java.lang.Long"
>
select sum(item_num) as selledNum from distribution_order where item_id = #{itemId} and state not in (1, 101)
</select>
<select
id=
"sumAmountByIntroducer"
parameterType=
"java.lang.Long"
resultType=
"java.lang.Long"
>
select sum(amount) as amount from distribution_order where share_record_id = #{introducerId} and seller_id =#{sellerId} and state not in (1, 101)
</select>
</mapper>
\ No newline at end of file
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/FollowFansRecordVo.java
View file @
3ceea4ee
...
...
@@ -102,4 +102,14 @@ public class FollowFansRecordVo implements Entity {
*/
private
Long
introduceNum
;
/**
* 介绍人产生的订单数量
*/
private
Long
orderNum
;
/**
* 介绍获取的佣金
*/
private
String
introduceAmount
;
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/DistributionOrderVo.java
View file @
3ceea4ee
...
...
@@ -165,5 +165,10 @@ public class DistributionOrderVo implements Entity {
* 利润
*/
private
String
profit
;
/**
* 介绍佣金
*/
private
String
introduceAmount
;
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/DistributorShareRecordVo.java
View file @
3ceea4ee
...
...
@@ -9,6 +9,10 @@ import java.util.Map;
@Data
public
class
DistributorShareRecordVo
implements
Entity
{
/**
*
*/
/**
* 分享记录id
*/
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FollowFansRecordServiceImpl.java
View file @
3ceea4ee
...
...
@@ -8,15 +8,23 @@ import com.wwdz.ch.core.consts.ResultCode;
import
com.wwdz.ch.core.type.PageSearchResult
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.CacheUtil
;
import
com.wwdz.ch.core.util.PriceUtil
;
import
com.wwdz.ch.core.util.RedisUtils
;
import
com.wwdz.ch.core.util.StringUtil
;
import
com.wwdz.ch.db.dao.FollowFansRecordDao
;
import
com.wwdz.ch.db.dao.distribution.DistributionOrderDao
;
import
com.wwdz.ch.db.dao.distribution.SupplierItemDao
;
import
com.wwdz.ch.db.domain.FollowFansRecord
;
import
com.wwdz.ch.db.domain.distribution.DistributionOrder
;
import
com.wwdz.ch.db.domain.distribution.DistributorShareRecord
;
import
com.wwdz.ch.db.domain.distribution.SupplierItem
;
import
com.wwdz.ch.db.dto.request.FollowFansRecordRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto
;
import
com.wwdz.ch.wx.entity.MessageContentText
;
import
com.wwdz.ch.wx.entity.request.MessageRequestDto
;
import
com.wwdz.ch.wx.entity.vo.FollowFansRecordVo
;
import
com.wwdz.ch.wx.entity.vo.distribution.DistributionOrderVo
;
import
com.wwdz.ch.wx.entity.vo.distribution.DistributorShareRecordVo
;
import
com.wwdz.ch.wx.service.FollowFansRecordService
;
import
com.wwdz.ch.wx.service.MessageService
;
import
com.wwdz.mall.common.vo.response.CloudServerResponse
;
...
...
@@ -54,8 +62,11 @@ public class FollowFansRecordServiceImpl implements FollowFansRecordService {
@Autowired
RedisUtils
redisUtils
;
@Reference
CommunityAttributeReadService
communityAttributeReadService
;
@Autowired
DistributionOrderDao
distributionOrderDao
;
@Autowired
SupplierItemDao
supplierItemDao
;
@Override
public
Result
follow
(
FollowFansRecordRequestDto
dto
)
{
...
...
@@ -214,12 +225,12 @@ public class FollowFansRecordServiceImpl implements FollowFansRecordService {
List
<
FollowFansRecord
>
followRecordList
=
followFansRecordDao
.
findList
(
followFansRecordRequestDto
);
List
<
Long
>
followerIdList
=
followRecordList
.
stream
().
map
(
FollowFansRecord:
:
getFollowerId
).
collect
(
Collectors
.
toList
());
fo
llowFansRecordList
.
forEach
(
f
->
{
fo
r
(
FollowFansRecord
f
:
followFansRecordList
)
{
FollowFansRecordVo
followFansRecordVo
=
new
FollowFansRecordVo
();
EntityMapper
.
copyAttribute
(
f
,
followFansRecordVo
);
followFansRecordVo
.
setFansName
(
cacheUtil
.
getAppletUserNameById
(
f
.
getFansId
()
));
followFansRecordVo
.
setFansIcon
(
cacheUtil
.
getAppletUserById
(
f
.
getFansId
()
).
getAvatar
());
followFansRecordVo
.
setIntroducerName
(
cacheUtil
.
getAppletUserById
(
f
.
getIntroducerId
()
).
getNickname
());
followFansRecordVo
.
setFansName
(
cacheUtil
.
appletUserInfoCache
.
get
(
f
.
getFansId
()).
get
().
getNickname
(
));
followFansRecordVo
.
setFansIcon
(
cacheUtil
.
appletUserInfoCache
.
get
(
f
.
getFansId
()).
get
(
).
getAvatar
());
followFansRecordVo
.
setIntroducerName
(
cacheUtil
.
appletUserInfoCache
.
get
(
f
.
getIntroducerId
()).
get
(
).
getNickname
());
/* try {
CloudServerResponse<CommunityUserAttributeDO> response = communityAttributeReadService.getCommunityUserAttributeByUserId(f.getFansId());
if (response.isSuccess()) {
...
...
@@ -236,7 +247,7 @@ public class FollowFansRecordServiceImpl implements FollowFansRecordService {
followFansRecordVo
.
setRelationCode
(
FollowFansEnum
.
RelationEnum
.
BACK_FOLLOWED
.
getCode
());
}
followFansRecordVos
.
add
(
followFansRecordVo
);
}
);
}
List
<
FollowFansRecordVo
>
followFansRecordVoList
=
getCurrentFollowRelation
(
dto
,
followFansRecordVos
,
"fans"
);
return
Result
.
success
(
PageSearchResult
.
of
(
pageInfo
,
followFansRecordVoList
));
}
catch
(
Exception
e
)
{
...
...
@@ -327,7 +338,9 @@ public class FollowFansRecordServiceImpl implements FollowFansRecordService {
List
<
FollowFansRecord
>
followFansRecordList
=
followFansRecordDao
.
findListGroupByFollowerId
(
dto
);
PageInfo
<
FollowFansRecord
>
pageInfo
=
new
PageInfo
<>(
followFansRecordList
);
List
<
FollowFansRecord
>
list
=
followFansRecordList
.
stream
().
filter
(
StringUtil
.
distinctByKey
(
FollowFansRecord:
:
getFollowerId
)).
collect
(
Collectors
.
toList
());
list
.
forEach
(
f
->
{
long
totolOrderNum
=
0
;
double
totalIntroduceAmount
=
0
;
for
(
FollowFansRecord
f
:
list
)
{
FollowFansRecordVo
followFansRecordVo
=
new
FollowFansRecordVo
();
followFansRecordVo
.
setCollectorId
(
f
.
getFollowerId
());
followFansRecordVo
.
setCollectorName
(
cacheUtil
.
getAppletUserById
(
f
.
getFollowerId
()).
getNickname
());
...
...
@@ -335,8 +348,21 @@ public class FollowFansRecordServiceImpl implements FollowFansRecordService {
followFansRecordVo
.
setIntroducerName
(
cacheUtil
.
getAppletUserById
(
f
.
getIntroducerId
()).
getNickname
());
long
num
=
followFansRecordDao
.
countFansByIntroducerId
(
f
.
getIntroducerId
(),
f
.
getFollowerId
());
followFansRecordVo
.
setIntroduceNum
(
num
);
//我介绍的人创建的订单数
long
orderNum
=
distributionOrderDao
.
countByIntroducer
(
f
.
getIntroducerId
(),
f
.
getFollowerId
());
totolOrderNum
=
totolOrderNum
+
orderNum
;
followFansRecordVo
.
setOrderNum
(
orderNum
);
//获得的佣金
Long
totalOrderAmount
=
distributionOrderDao
.
sumAmountByIntroducer
(
f
.
getIntroducerId
(),
f
.
getFollowerId
());
double
introduceCost
=
totalOrderAmount
.
doubleValue
()
*
0.03
;
totalIntroduceAmount
=
totalIntroduceAmount
+
introduceCost
;
followFansRecordVo
.
setIntroduceAmount
(
PriceUtil
.
convertDoubleToString
(
introduceCost
));
followFansRecordVos
.
add
(
followFansRecordVo
);
});
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"list"
,
PageSearchResult
.
of
(
pageInfo
,
followFansRecordVos
));
map
.
put
(
"totolOrderNum"
,
totolOrderNum
);
map
.
put
(
"totalIntroduceAmount"
,
PriceUtil
.
convertDoubleToString
(
totalIntroduceAmount
));
return
Result
.
success
(
PageSearchResult
.
of
(
pageInfo
,
followFansRecordVos
));
}
catch
(
Exception
e
)
{
logger
.
error
(
"{} 查询我推荐的列表 {}"
,
dto
.
getId
(),
e
);
...
...
@@ -367,4 +393,49 @@ public class FollowFansRecordServiceImpl implements FollowFansRecordService {
}
return
Result
.
failed
();
}
@Override
public
Result
introduceAmountDetail
(
FollowFansRecordRequestDto
dto
)
{
try
{
DistributionOrderRequestDto
distributionOrderRequestDto
=
new
DistributionOrderRequestDto
();
distributionOrderRequestDto
.
setShareRecordId
(
String
.
valueOf
(
dto
.
getIntroducerId
()));
distributionOrderRequestDto
.
setSellerId
(
dto
.
getFollowerId
());
List
<
DistributionOrder
>
distributionOrderList
=
distributionOrderDao
.
findByIntroducer
(
distributionOrderRequestDto
);
PageInfo
<
DistributionOrder
>
pageInfo
=
new
PageInfo
<>(
distributionOrderList
);
List
<
DistributionOrderVo
>
distributionOrderVoList
=
new
ArrayList
<>();
for
(
DistributionOrder
distributionOrder
:
distributionOrderList
)
{
DistributionOrderVo
distributionOrderVo
=
new
DistributionOrderVo
();
EntityMapper
.
copyAttribute
(
distributionOrder
,
distributionOrderVo
);
double
introduceCost
=
distributionOrder
.
getAmount
().
doubleValue
()
*
0.03
;
distributionOrderVo
.
setIntroduceAmount
(
PriceUtil
.
convertDoubleToString
(
introduceCost
));
distributionOrderVoList
.
add
(
distributionOrderVo
);
}
return
Result
.
success
(
PageSearchResult
.
of
(
pageInfo
,
distributionOrderVoList
));
}
catch
(
Exception
e
)
{
logger
.
error
(
"{} 查询分佣订单列表 {}"
,
dto
.
getId
(),
e
);
}
return
Result
.
failed
();
}
@Override
public
Result
introduceOrderDetail
(
DistributionOrderRequestDto
dto
)
{
try
{
DistributionOrder
distributionOrder
=
distributionOrderDao
.
findById
(
dto
.
getDistributionOrderId
());
DistributionOrderVo
distributionOrderVo
=
new
DistributionOrderVo
();
EntityMapper
.
copyAttribute
(
distributionOrder
,
distributionOrderVo
);
double
introduceCost
=
distributionOrder
.
getAmount
().
doubleValue
()
*
0.03
;
distributionOrderVo
.
setIntroduceAmount
(
PriceUtil
.
convertDoubleToString
(
introduceCost
));
SupplierItem
supplierItem
=
supplierItemDao
.
findById
(
distributionOrder
.
getItemId
());
distributionOrderVo
.
setItemName
(
supplierItem
.
getName
());
distributionOrderVo
.
setBuyerName
(
cacheUtil
.
appletUserInfoCache
.
get
(
distributionOrder
.
getBuyerId
()).
get
().
getNickname
());
distributionOrderVo
.
setSellerName
(
cacheUtil
.
appletUserInfoCache
.
get
(
distributionOrder
.
getSellerId
()).
get
().
getNickname
());
distributionOrderVo
.
setAmount
(
PriceUtil
.
convertPriceFenToYuan
(
distributionOrder
.
getAmount
()));
return
Result
.
success
(
distributionOrderVo
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"{} 查询分佣订单明细 {}"
,
dto
.
getDistributionOrderId
(),
e
);
}
return
Result
.
failed
();
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FollowFansRecordService.java
View file @
3ceea4ee
...
...
@@ -2,6 +2,7 @@ package com.wwdz.ch.wx.service;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dto.request.FollowFansRecordRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto
;
public
interface
FollowFansRecordService
{
...
...
@@ -74,4 +75,19 @@ public interface FollowFansRecordService {
* @return
*/
Result
findRecommendDetail
(
FollowFansRecordRequestDto
dto
);
/**
* 查询分佣明细(介绍人产生的订单列表)
* @param dto
* @return
*/
Result
introduceAmountDetail
(
FollowFansRecordRequestDto
dto
);
/**
* 查询分佣订单明细
* @param dto
* @return
*/
Result
introduceOrderDetail
(
DistributionOrderRequestDto
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