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 6efbb469
authored
Jan 20, 2026
by
杨卫
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:策略中心代码
1 parent
f52b04e7
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
493 additions
and
0 deletions
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/dto/OperatorResponse.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/dto/StrategyDetailReqDTO.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/dto/StrategyDetailRespDTO.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/dto/TaskStrategyIssueResponse.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/enums/StrategyErrorEnum.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/enums/StrategyTypeEnum.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/remote/StrategyDetailRemote.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/remote/StrategyDetailRemoteImpl.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyDetailService.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/dto/OperatorResponse.java
0 → 100644
View file @
6efbb46
package
cn
.
com
.
glsx
.
dj
.
strategy
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author yangwei
* @version 1.0
* @since 2026/01/15 14:52
*/
@Data
public
class
OperatorResponse
implements
Serializable
{
private
static
final
long
serialVersionUID
=
5271042959850503848L
;
/**
* 员工uuid
*/
@ApiModelProperty
(
name
=
"uuid"
,
notes
=
"员工uuid"
,
example
=
"1"
)
private
String
uuid
;
/**
* 运营人员名称
*/
@ApiModelProperty
(
name
=
"username"
,
notes
=
"人员名称"
,
example
=
"1"
)
private
String
username
;
}
\ No newline at end of file
\ No newline at end of file
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/dto/StrategyDetailReqDTO.java
0 → 100644
View file @
6efbb46
package
cn
.
com
.
glsx
.
dj
.
strategy
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 查询门店详情
* @author yangwei
* @version 1.0
* @since 2026/01/20 14:25
*/
@Data
public
class
StrategyDetailReqDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
6162463723841860609L
;
/**
* 策略id
*/
private
Integer
strategyId
;
}
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/dto/StrategyDetailRespDTO.java
0 → 100644
View file @
6efbb46
package
cn
.
com
.
glsx
.
dj
.
strategy
.
dto
;
import
com.google.common.collect.Lists
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
/**
* 策略详情
* @author yangwei
* @version 1.0
* @since 2026/01/20 15:13
*/
@Data
@ApiModel
(
"策略详情"
)
public
class
StrategyDetailRespDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3803844962443151041L
;
/**
* 策略id
*/
private
Integer
id
;
/**
* 执行策略类型
*/
private
Integer
strategyType
;
/**
* 执行策略类型名称
*/
private
String
strategyTypeName
;
/**
* 执行开始日期
*/
private
Date
startDate
;
/**
* 执行结束日期
*/
private
Date
endDate
;
/**
* 执行人员列表
*/
private
List
<
OperatorResponse
>
executePersons
;
/**
* 策略说明
*/
private
String
description
;
/**
* 订单总数
*/
private
Integer
orderTotalCount
;
/**
* 订单总金额
*/
private
BigDecimal
orderTotalAmount
;
/**
* 优惠总金额
*/
private
BigDecimal
discountTotalAmount
;
/**
* 创建人
*/
private
String
createdBy
;
/**
* 创建时间
*/
private
Date
createdDate
;
/**
* 标题
*/
private
String
title
;
/**
* 副标题
*/
private
String
subTitle
;
/**
* 内容
*/
private
String
content
;
/**
* 任务下发情况
*/
private
List
<
TaskStrategyIssueResponse
>
taskStrategyIssueList
=
Lists
.
newArrayList
();
}
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/dto/TaskStrategyIssueResponse.java
0 → 100644
View file @
6efbb46
package
cn
.
com
.
glsx
.
dj
.
strategy
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 任务下发情况
* @author yangwei
* @version 1.0
* @since 2026/01/16 14:32
*/
@Data
public
class
TaskStrategyIssueResponse
implements
Serializable
{
private
static
final
long
serialVersionUID
=
8160526954126655220L
;
// id 主键ID
@ApiModelProperty
(
name
=
"id"
,
notes
=
"主键ID"
,
example
=
"1"
)
private
Integer
id
;
// strategy_id 策略ID
@ApiModelProperty
(
name
=
"strategyId"
,
notes
=
"策略ID"
,
example
=
"1"
)
private
Integer
strategyId
;
// uuid 人员UUID
@ApiModelProperty
(
name
=
"uuid"
,
notes
=
"人员UUID"
,
example
=
"1"
)
private
String
uuid
;
// phone 人员手机号
@ApiModelProperty
(
name
=
"phone"
,
notes
=
"人员手机号"
,
example
=
"1"
)
private
String
phone
;
// staff_name 人员姓名
@ApiModelProperty
(
name
=
"staffName"
,
notes
=
"人员姓名"
,
example
=
"1"
)
private
String
staffName
;
// user_position 岗位类型:0:驻店人员,6:飞行督导,9:2.1区域运营
@ApiModelProperty
(
name
=
"userPosition"
,
notes
=
"岗位类型:0:驻店人员,6:飞行督导,9:2.1区域运营"
,
example
=
"1"
)
private
Integer
userPosition
;
// read_status 阅读状态,0-未读,1-已读
@ApiModelProperty
(
name
=
"readStatus"
,
notes
=
"阅读状态,0-未读,1-已读"
,
example
=
"1"
)
private
Integer
readStatus
;
// read_time 阅读时间
@ApiModelProperty
(
name
=
"readTime"
,
notes
=
"阅读时间"
,
example
=
"1"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
readTime
;
}
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/enums/StrategyErrorEnum.java
0 → 100644
View file @
6efbb46
package
cn
.
com
.
glsx
.
dj
.
strategy
.
enums
;
import
cn.com.glsx.framework.core.enums.ErrorEnum
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 策略服务错误枚举
* @author yangwei
* @version 1.0
* @since 2026/01/20 10:34
*/
@Getter
@AllArgsConstructor
public
enum
StrategyErrorEnum
implements
ErrorEnum
{
COMMON_ERROR
(
"11000000"
,
"common error"
),
STRATEGY_NOT_EXISTS
(
"11010001"
,
"策略不存在"
),
STRATEGY_TYPE_NOT_SUPPORTED
(
"11010002"
,
"策略类型不支持"
),
;
private
final
String
value
;
private
final
String
displayName
;
static
final
Map
<
String
,
StrategyErrorEnum
>
ENUM_MAP
=
new
HashMap
<
String
,
StrategyErrorEnum
>();
static
{
for
(
StrategyErrorEnum
code
:
StrategyErrorEnum
.
values
())
{
ENUM_MAP
.
put
(
code
.
getValue
(),
code
);
}
}
public
static
StrategyErrorEnum
getEnum
(
String
value
)
{
return
ENUM_MAP
.
get
(
value
);
}
}
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/enums/StrategyTypeEnum.java
View file @
6efbb46
package
cn
.
com
.
glsx
.
dj
.
strategy
.
enums
;
package
cn
.
com
.
glsx
.
dj
.
strategy
.
enums
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
/**
/**
* 执行策略类型,0-学习类,1-优秀录音分享类,3-任务型
* 执行策略类型,0-学习类,1-优秀录音分享类,3-任务型
* 2-带教、4-销售精英到店提拉、5-强力促销、6-最终盘点与低客单产品购入;
* 2-带教、4-销售精英到店提拉、5-强力促销、6-最终盘点与低客单产品购入;
...
@@ -49,5 +51,13 @@ public enum StrategyTypeEnum {
...
@@ -49,5 +51,13 @@ public enum StrategyTypeEnum {
return
displayName
;
return
displayName
;
}
}
public
static
StrategyTypeEnum
getStrategyByValue
(
Integer
value
)
{
for
(
StrategyTypeEnum
item
:
StrategyTypeEnum
.
values
())
{
if
(
item
.
value
.
equals
(
value
))
{
return
item
;
}
}
throw
new
RpcServiceException
(
StrategyErrorEnum
.
COMMON_ERROR
,
"无效的策略类型:"
+
value
);
}
}
}
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/remote/StrategyDetailRemote.java
0 → 100644
View file @
6efbb46
package
cn
.
com
.
glsx
.
dj
.
strategy
.
remote
;
import
cn.com.glsx.dj.strategy.dto.StrategyDetailReqDTO
;
import
cn.com.glsx.dj.strategy.dto.StrategyDetailRespDTO
;
import
cn.com.glsx.framework.core.annotation.ApiMethod
;
import
cn.com.glsx.framework.core.annotation.ApiParam
;
import
cn.com.glsx.framework.core.annotation.ApiResponse
;
import
cn.com.glsx.framework.core.annotation.ApiService
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
/**
* 策略中心-策略详情
* @author yangwei
* @version 1.0
* @since 2026/01/19 10:31
*/
@ApiService
(
value
=
"策略中心-策略详情"
,
owner
=
"yangwei"
)
public
interface
StrategyDetailRemote
{
@ApiMethod
(
"查询记录下/任务型策略详情"
)
@ApiParam
(
name
=
"request"
,
notes
=
"请求对象"
,
dataType
=
ApiParam
.
DataTypeEnum
.
OBJECT
,
required
=
true
)
@ApiResponse
(
"查询记录下/任务型策略详情"
)
RpcResponse
<
StrategyDetailRespDTO
>
findStrategyDetail
(
StrategyDetailReqDTO
request
);
}
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/remote/StrategyDetailRemoteImpl.java
0 → 100644
View file @
6efbb46
package
cn
.
com
.
glsx
.
dj
.
strategy
.
remote
;
import
cn.com.glsx.dj.strategy.dto.StrategyDetailReqDTO
;
import
cn.com.glsx.dj.strategy.dto.StrategyDetailRespDTO
;
import
cn.com.glsx.dj.strategy.service.StrategyDetailService
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.dubbo.config.annotation.DubboService
;
/**
* 策略中心-策略详情
* @author yangwei
* @version 1.0
* @since 2026/01/19 10:33
*/
@Slf4j
@DubboService
@RequiredArgsConstructor
public
class
StrategyDetailRemoteImpl
implements
StrategyDetailRemote
{
private
final
StrategyDetailService
strategyDetailService
;
/**
* 查询记录下/任务型策略详情
* @author yangwei
* @since 2026/1/20 10:08
* @param request 请求对象
* @return cn.com.glsx.framework.core.beans.rpc.RpcResponse<cn.com.glsx.dj.strategy.dto.StrategyDetailRespDTO>
*/
@Override
public
RpcResponse
<
StrategyDetailRespDTO
>
findStrategyDetail
(
StrategyDetailReqDTO
request
)
{
try
{
return
RpcResponse
.
success
(
strategyDetailService
.
findStrategyDetail
(
request
));
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
"查询记录下/任务型策略详情 occur RpcServiceException"
,
e
);
return
RpcResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
"查询记录下/任务型策略详情 occur Exception"
,
e
);
return
RpcResponse
.
error
(
e
);
}
}
}
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyDetailService.java
0 → 100644
View file @
6efbb46
package
cn
.
com
.
glsx
.
dj
.
strategy
.
service
;
import
cn.com.glsx.dj.peanalysis.dto.analysis.StrategyOrderStatisticsDTO
;
import
cn.com.glsx.dj.peanalysis.remote.BiAnalyseBackgroundRemote
;
import
cn.com.glsx.dj.strategy.dto.OperatorResponse
;
import
cn.com.glsx.dj.strategy.dto.StrategyDetailReqDTO
;
import
cn.com.glsx.dj.strategy.dto.StrategyDetailRespDTO
;
import
cn.com.glsx.dj.strategy.dto.TaskStrategyIssueResponse
;
import
cn.com.glsx.dj.strategy.enums.StrategyErrorEnum
;
import
cn.com.glsx.dj.strategy.enums.StrategyTypeEnum
;
import
cn.com.glsx.dj.strategy.mapper.StrategyInfoMapper
;
import
cn.com.glsx.dj.strategy.mapper.StrategyStaffMessageMapper
;
import
cn.com.glsx.dj.strategy.mapper.StrategyStaffRelMapper
;
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.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.scrm.equity.enums.DeleteFlagEnum
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.google.common.collect.Lists
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.List
;
import
java.util.Optional
;
/**
* 策略详情服务
* @author yangwei
* @version 1.0
* @since 2026/01/20 10:06
*/
@Slf4j
@Service
@RequiredArgsConstructor
public
class
StrategyDetailService
{
private
final
StrategyInfoMapper
strategyInfoMapper
;
private
final
StrategyStaffRelMapper
strategyStaffRelMapper
;
private
final
BiAnalyseBackgroundRemote
biAnalyseBackgroundRemote
;
private
final
StrategyStaffMessageMapper
strategyStaffMessageMapper
;
/**
* 记录型策略
*/
private
final
List
<
StrategyTypeEnum
>
recordStrategy
=
Lists
.
newArrayList
(
StrategyTypeEnum
.
MENTORING
,
StrategyTypeEnum
.
FINAL_INVENTORY
,
StrategyTypeEnum
.
POWERFUL_PROMOTION
,
StrategyTypeEnum
.
SALE_ELITE_TO_STORE_PULL
);
/**
* 查询记录下/任务型策略详情
* @author yangwei
* @since 2026/1/20 10:10
* @param request 请求对象
* @return cn.com.glsx.dj.strategy.dto.StrategyDetailRespDTO
*/
public
StrategyDetailRespDTO
findStrategyDetail
(
StrategyDetailReqDTO
request
)
{
Example
example
=
new
Example
(
StrategyInfo
.
class
);
example
.
createCriteria
()
.
andEqualTo
(
"id"
,
request
.
getStrategyId
())
.
andEqualTo
(
"deletedFlag"
,
DeleteFlagEnum
.
N
.
getValue
());
StrategyInfo
strategyInfo
=
Optional
.
ofNullable
(
strategyInfoMapper
.
selectOneByExample
(
example
)).
orElseThrow
(()
->
new
RpcServiceException
(
StrategyErrorEnum
.
STRATEGY_NOT_EXISTS
));
StrategyDetailRespDTO
result
=
BeanUtil
.
copyProperties
(
strategyInfo
,
StrategyDetailRespDTO
.
class
);
StrategyTypeEnum
strategyByValue
=
StrategyTypeEnum
.
getStrategyByValue
(
strategyInfo
.
getStrategyType
());
result
.
setStrategyTypeName
(
strategyByValue
.
getDisplayName
());
log
.
info
(
"strategyByValue:{}"
,
strategyByValue
);
// 这里只处理记录和任务型
if
(
recordStrategy
.
contains
(
strategyByValue
))
{
switch
(
strategyByValue
)
{
case
MENTORING:
case
SALE_ELITE_TO_STORE_PULL:
Example
strategyStaffRelExample
=
new
Example
(
StrategyStaffRel
.
class
);
strategyStaffRelExample
.
orderBy
(
"id"
).
asc
();
strategyStaffRelExample
.
createCriteria
()
.
andEqualTo
(
"strategyId"
,
request
.
getStrategyId
())
.
andEqualTo
(
"deletedFlag"
,
DeleteFlagEnum
.
N
.
getValue
());
List
<
StrategyStaffRel
>
strategyStaffRelList
=
strategyStaffRelMapper
.
selectByExample
(
strategyStaffRelExample
);
result
.
setExecutePersons
(
BeanUtil
.
copyToList
(
strategyStaffRelList
,
OperatorResponse
.
class
));
break
;
case
FINAL_INVENTORY:
case
POWERFUL_PROMOTION:
// todo
biAnalyseBackgroundRemote
.
getStrategyOrderInfo
();
break
;
default
:
throw
new
RpcServiceException
(
StrategyErrorEnum
.
STRATEGY_TYPE_NOT_SUPPORTED
);
}
}
else
if
(
StrategyTypeEnum
.
TASK
.
equals
(
strategyByValue
))
{
Example
staffMessageExample
=
new
Example
(
StrategyStaffMessage
.
class
);
staffMessageExample
.
orderBy
(
"id"
).
asc
();
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
{
throw
new
RpcServiceException
(
StrategyErrorEnum
.
STRATEGY_TYPE_NOT_SUPPORTED
);
}
return
result
;
}
public
StrategyOrderStatisticsDTO
StrategyOrderStatisticsBuilder
(
StrategyInfo
strategyInfo
,
StrategyTypeEnum
strategyByValue
)
{
StrategyOrderStatisticsDTO
.
builder
()
.
startTime
(
strategyInfo
.
getStartDate
())
.
endTime
(
strategyInfo
.
getEndDate
())
.
merchantNo
(
strategyInfo
.
getMerchantId
())
.
businessType
(
strategyByValue
.
getDisplayName
())
.
djOrderTypes
(
Lists
.
newArrayList
(
"DJ"
))
.
build
();
return
null
;
}
}
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