Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-dj-strategy
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 127b07c5
authored
Jan 23, 2026
by
杨卫
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:效果分析自测
1 parent
35ec70b7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
16 deletions
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/mapper/StrategyStaffMessageMapper.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyDetailService.java
rpc-dj-strategy/src/main/resources/META-INF/orm/StrategyStaffMessageMapper.xml
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/mapper/StrategyStaffMessageMapper.java
View file @
127b07c
package
cn
.
com
.
glsx
.
dj
.
strategy
.
mapper
;
package
cn
.
com
.
glsx
.
dj
.
strategy
.
mapper
;
import
cn.com.glsx.dj.strategy.dto.TaskStrategyIssueResponse
;
import
cn.com.glsx.dj.strategy.model.StrategyStaffMessage
;
import
cn.com.glsx.dj.strategy.model.StrategyStaffMessage
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.oreframework.datasource.mybatis.mapper.OreMapper
;
import
org.oreframework.datasource.mybatis.mapper.OreMapper
;
import
java.util.List
;
@Mapper
@Mapper
public
interface
StrategyStaffMessageMapper
extends
OreMapper
<
StrategyStaffMessage
>
{
public
interface
StrategyStaffMessageMapper
extends
OreMapper
<
StrategyStaffMessage
>
{
...
@@ -14,4 +17,13 @@ public interface StrategyStaffMessageMapper extends OreMapper<StrategyStaffMessa
...
@@ -14,4 +17,13 @@ public interface StrategyStaffMessageMapper extends OreMapper<StrategyStaffMessa
* @return 更新记录数
* @return 更新记录数
*/
*/
int
updateReadStatusByMessageId
(
@Param
(
"messageId"
)
Integer
messageId
);
int
updateReadStatusByMessageId
(
@Param
(
"messageId"
)
Integer
messageId
);
/**
* 根据策略id查询策略推送记录
* @author yangwei
* @since 2026/1/23 15:22
* @param strategyId 策略id
* @return java.util.List<cn.com.glsx.dj.strategy.dto.TaskStrategyIssueResponse>
*/
List
<
TaskStrategyIssueResponse
>
selectStaffMessageByStrategyId
(
@Param
(
"strategyId"
)
Integer
strategyId
);
}
}
\ No newline at end of file
\ No newline at end of file
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyDetailService.java
View file @
127b07c
...
@@ -13,7 +13,6 @@ import cn.com.glsx.dj.strategy.mapper.StrategyInfoMapper;
...
@@ -13,7 +13,6 @@ import cn.com.glsx.dj.strategy.mapper.StrategyInfoMapper;
import
cn.com.glsx.dj.strategy.mapper.StrategyStaffMessageMapper
;
import
cn.com.glsx.dj.strategy.mapper.StrategyStaffMessageMapper
;
import
cn.com.glsx.dj.strategy.mapper.StrategyStaffRelMapper
;
import
cn.com.glsx.dj.strategy.mapper.StrategyStaffRelMapper
;
import
cn.com.glsx.dj.strategy.model.StrategyInfo
;
import
cn.com.glsx.dj.strategy.model.StrategyInfo
;
import
cn.com.glsx.dj.strategy.model.StrategyStaffMessage
;
import
cn.com.glsx.dj.strategy.model.StrategyStaffRel
;
import
cn.com.glsx.dj.strategy.model.StrategyStaffRel
;
import
cn.com.glsx.dj.strategy.util.LocalDateUtil
;
import
cn.com.glsx.dj.strategy.util.LocalDateUtil
;
import
cn.com.glsx.dj.strategy.util.PercentageCalculator
;
import
cn.com.glsx.dj.strategy.util.PercentageCalculator
;
...
@@ -38,6 +37,7 @@ import org.springframework.stereotype.Service;
...
@@ -38,6 +37,7 @@ import org.springframework.stereotype.Service;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.entity.Example
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.CompletableFuture
;
...
@@ -109,34 +109,32 @@ public class StrategyDetailService {
...
@@ -109,34 +109,32 @@ public class StrategyDetailService {
result
.
setExecutePersons
(
BeanUtil
.
copyToList
(
result
.
setExecutePersons
(
BeanUtil
.
copyToList
(
strategyStaffRelList
,
strategyStaffRelList
,
OperatorResponse
.
class
,
OperatorResponse
.
class
,
CopyOptions
.
create
().
setFieldMapping
(
CopyOptions
.
create
()
.
setFieldMapping
(
MapUtil
.<
String
,
String
>
builder
()
MapUtil
.<
String
,
String
>
builder
()
.
put
(
"userUuid"
,
"uuid"
)
.
put
(
"userUuid"
,
"uuid"
)
.
put
(
"userName"
,
"username"
).
build
())));
.
put
(
"userName"
,
"username"
).
build
())));
break
;
break
;
case
FINAL_INVENTORY:
case
FINAL_INVENTORY:
case
POWERFUL_PROMOTION:
case
POWERFUL_PROMOTION:
RpcResponse
<
StrategyOrderStatisticsRespDTO
>
strategyOrderInfoResponse
=
// 订单统计
biAnalyseBackgroundRemote
.
getStrategyOrderInfo
(
strategyOrderStatisticsBuilder
(
strategyInfo
,
strategyByValue
));
StrategyOrderStatisticsDTO
strategyOrderStatisticsDTO
=
strategyOrderStatisticsBuilder
(
strategyInfo
,
strategyByValue
);
log
.
info
(
"strategyId: {} order statistics rpc strategyOrderStatisticsDTO:{}"
,
strategyInfo
.
getId
(),
strategyOrderStatisticsDTO
);
RpcResponse
<
StrategyOrderStatisticsRespDTO
>
strategyOrderInfoResponse
=
biAnalyseBackgroundRemote
.
getStrategyOrderInfo
(
strategyOrderStatisticsDTO
);
if
(
strategyOrderInfoResponse
.
isFailed
())
{
if
(
strategyOrderInfoResponse
.
isFailed
())
{
throw
new
RpcServiceException
(
strategyOrderInfoResponse
.
getError
(),
strategyOrderInfoResponse
.
getMessage
());
throw
new
RpcServiceException
(
strategyOrderInfoResponse
.
getError
(),
strategyOrderInfoResponse
.
getMessage
());
}
}
StrategyOrderStatisticsRespDTO
strategyOrderStatisticsRespDTO
=
Optional
.
ofNullable
(
strategyOrderInfoResponse
.
getResult
()).
orElseGet
(
StrategyOrderStatisticsRespDTO:
:
new
);
StrategyOrderStatisticsRespDTO
strategyOrderStatisticsRespDTO
=
Optional
.
ofNullable
(
strategyOrderInfoResponse
.
getResult
()).
orElseGet
(
StrategyOrderStatisticsRespDTO:
:
new
);
result
.
setOrderTotalCount
(
strategyOrderStatisticsRespDTO
.
getOrderCount
());
result
.
setOrderTotalCount
(
strategyOrderStatisticsRespDTO
.
getOrderCount
());
result
.
setOrderTotalAmount
(
strategyOrderStatisticsRespDTO
.
getTotalPrice
(
));
result
.
setOrderTotalAmount
(
Optional
.
ofNullable
(
strategyOrderStatisticsRespDTO
.
getTotalPrice
()).
orElse
(
BigDecimal
.
ZERO
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
result
.
setDiscountTotalAmount
(
strategyOrderStatisticsRespDTO
.
getDiscountPrice
(
));
result
.
setDiscountTotalAmount
(
Optional
.
ofNullable
(
strategyOrderStatisticsRespDTO
.
getDiscountPrice
()).
orElse
(
BigDecimal
.
ZERO
).
setScale
(
2
,
RoundingMode
.
HALF_UP
));
break
;
break
;
default
:
default
:
throw
new
RpcServiceException
(
StrategyErrorEnum
.
STRATEGY_TYPE_NOT_SUPPORTED
);
throw
new
RpcServiceException
(
StrategyErrorEnum
.
STRATEGY_TYPE_NOT_SUPPORTED
);
}
}
}
else
if
(
StrategyTypeEnum
.
TASK
.
equals
(
strategyByValue
))
{
}
else
if
(
StrategyTypeEnum
.
TASK
.
equals
(
strategyByValue
))
{
Example
staffMessageExample
=
new
Example
(
StrategyStaffMessage
.
class
);
List
<
TaskStrategyIssueResponse
>
taskStrategyIssueResponses
=
strategyStaffMessageMapper
.
selectStaffMessageByStrategyId
(
request
.
getStrategyId
());
staffMessageExample
.
orderBy
(
"id"
).
asc
();
result
.
getTaskStrategyIssueList
().
addAll
(
taskStrategyIssueResponses
);
staffMessageExample
.
createCriteria
()
.
andEqualTo
(
"strategyId"
,
request
.
getStrategyId
())
.
andEqualTo
(
"deletedFlag"
,
DeleteFlagEnum
.
N
.
getValue
());
List
<
StrategyStaffMessage
>
strategyStaffMessageList
=
strategyStaffMessageMapper
.
selectByExample
(
staffMessageExample
);
result
.
getTaskStrategyIssueList
().
addAll
(
BeanUtil
.
copyToList
(
strategyStaffMessageList
,
TaskStrategyIssueResponse
.
class
));
}
else
{
}
else
{
throw
new
RpcServiceException
(
StrategyErrorEnum
.
STRATEGY_TYPE_NOT_SUPPORTED
);
throw
new
RpcServiceException
(
StrategyErrorEnum
.
STRATEGY_TYPE_NOT_SUPPORTED
);
}
}
...
@@ -246,9 +244,12 @@ public class StrategyDetailService {
...
@@ -246,9 +244,12 @@ public class StrategyDetailService {
*/
*/
public
List
<
StrategyTypeStatisticsRespDTO
>
findStrategyTypeDistribution
(
StrategyTypeStatisticsDTO
request
)
{
public
List
<
StrategyTypeStatisticsRespDTO
>
findStrategyTypeDistribution
(
StrategyTypeStatisticsDTO
request
)
{
List
<
StrategyTypeStatisticsRespDTO
>
result
=
strategyInfoMapper
.
findStrategyTypeDistribution
(
request
);
List
<
StrategyTypeStatisticsRespDTO
>
result
=
strategyInfoMapper
.
findStrategyTypeDistribution
(
request
);
Map
<
Integer
,
StrategyTypeStatisticsRespDTO
>
strategyTypeMapStatistics
=
Optional
.
ofNullable
(
result
)
if
(
CollUtil
.
isEmpty
(
result
))
{
.
orElseGet
(
ArrayList:
:
new
)
log
.
info
(
"策略类型分布结果为空"
);
.
stream
()
return
Lists
.
newArrayList
();
}
Map
<
Integer
,
StrategyTypeStatisticsRespDTO
>
strategyTypeMapStatistics
=
result
.
stream
()
.
collect
(
Collectors
.
toMap
(
StrategyTypeStatisticsRespDTO:
:
getStrategyType
,
Function
.
identity
()));
.
collect
(
Collectors
.
toMap
(
StrategyTypeStatisticsRespDTO:
:
getStrategyType
,
Function
.
identity
()));
// 计算占比
// 计算占比
...
@@ -264,6 +265,7 @@ public class StrategyDetailService {
...
@@ -264,6 +265,7 @@ public class StrategyDetailService {
List
<
PercentageResultDTO
<
Integer
>>
percentageResults
=
PercentageCalculator
.
calculateAdjustPercentage
(
statisticItems
,
true
,
0
);
List
<
PercentageResultDTO
<
Integer
>>
percentageResults
=
PercentageCalculator
.
calculateAdjustPercentage
(
statisticItems
,
true
,
0
);
return
percentageResults
.
stream
()
return
percentageResults
.
stream
()
.
sorted
((
o1
,
o2
)
->
Optional
.
ofNullable
(
o2
.
getValue
()).
orElse
(
BigDecimal
.
ZERO
).
compareTo
(
Optional
.
ofNullable
(
o1
.
getValue
()).
orElse
(
BigDecimal
.
ZERO
)))
.
map
(
percentageResultDTO
->
StrategyTypeStatisticsRespDTO
.
map
(
percentageResultDTO
->
StrategyTypeStatisticsRespDTO
.
builder
()
.
builder
()
.
strategyType
(
percentageResultDTO
.
getDimension
())
.
strategyType
(
percentageResultDTO
.
getDimension
())
...
...
rpc-dj-strategy/src/main/resources/META-INF/orm/StrategyStaffMessageMapper.xml
View file @
127b07c
...
@@ -41,4 +41,20 @@
...
@@ -41,4 +41,20 @@
WHERE message_id = #{messageId,jdbcType=INTEGER}
WHERE message_id = #{messageId,jdbcType=INTEGER}
AND deleted_flag = 'N'
AND deleted_flag = 'N'
</update>
</update>
<select
id=
"selectStaffMessageByStrategyId"
resultType=
"cn.com.glsx.dj.strategy.dto.TaskStrategyIssueResponse"
>
select
t1.id,
t1.strategy_id as strategyId,
t1.uuid as uuid,
t1.phone as phone,
t1.staff_name as staffName,
t2.user_position as userPosition,
t1.read_status as readStatus,
t1.read_time as readTime
from dj_car_life_strategy_staff_message t1
join dj_car_life_strategy_staff_rel t2 on t1.strategy_id = t2.strategy_id and t1.uuid = t2.user_uuid
where t1.deleted_flag = 'N' and t2.deleted_flag = 'N' and t1.strategy_id = #{strategyId}
</select>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment