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 0dd112d1
authored
Jan 08, 2026
by
春觉晓
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
新增批量插入/删除策略信息接口
1 parent
b8d053b3
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
406 additions
and
7 deletions
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/dto/BatchInsertStrategyInfo.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/dto/MerchantInfo.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/model/StrategyCourseRel.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/model/StrategyInfo.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/model/StrategyRecordingRel.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/model/StrategyStaffRel.java
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/remote/StrategyInfoRemote.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/remote/StrategyInfoRemoteImpl.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyCourseRelService.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyInfoService.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyRecordingRelService.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyStaffRelService.java
rpc-dj-strategy/src/main/resources/META-INF/orm/StrategyInfoMapper.xml
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/dto/BatchInsertStrategyInfo.java
0 → 100644
View file @
0dd112d
package
cn
.
com
.
glsx
.
dj
.
strategy
.
dto
;
import
cn.com.glsx.dj.strategy.model.StrategyCourseRel
;
import
cn.com.glsx.dj.strategy.model.StrategyInfo
;
import
cn.com.glsx.dj.strategy.model.StrategyRecordingRel
;
import
cn.com.glsx.dj.strategy.model.StrategyStaffRel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
public
class
BatchInsertStrategyInfo
implements
Serializable
{
@NotEmpty
(
message
=
"商户ID列表不能为空"
)
@ApiModelProperty
(
notes
=
"商户列表"
,
required
=
true
)
private
List
<
MerchantInfo
>
merchantList
;
@NotNull
(
message
=
"策略信息不能为空"
)
@ApiModelProperty
(
notes
=
"策略信息"
,
required
=
true
)
private
StrategyInfo
strategyInfo
;
@ApiModelProperty
(
notes
=
"人员列表"
)
private
List
<
StrategyStaffRel
>
staffList
;
@ApiModelProperty
(
notes
=
"课程列表"
)
private
List
<
StrategyCourseRel
>
courseList
;
@ApiModelProperty
(
notes
=
"录音列表"
)
private
List
<
StrategyRecordingRel
>
recordingList
;
private
String
createdBy
;
}
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/dto/MerchantInfo.java
0 → 100644
View file @
0dd112d
package
cn
.
com
.
glsx
.
dj
.
strategy
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
MerchantInfo
implements
Serializable
{
@ApiModelProperty
(
value
=
"商户ID"
)
private
Integer
merchantId
;
@ApiModelProperty
(
value
=
"商户名称"
)
private
String
merchantName
;
}
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/model/StrategyCourseRel.java
View file @
0dd112d
package
cn
.
com
.
glsx
.
dj
.
strategy
.
model
;
package
cn
.
com
.
glsx
.
dj
.
strategy
.
model
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -22,6 +23,7 @@ public class StrategyCourseRel implements Serializable {
...
@@ -22,6 +23,7 @@ public class StrategyCourseRel implements Serializable {
/**
/**
* 课程id,dj_beisen_course.id
* 课程id,dj_beisen_course.id
*/
*/
@ApiModelProperty
(
notes
=
"课程ID"
)
@Column
(
name
=
"course_id"
)
@Column
(
name
=
"course_id"
)
private
String
courseId
;
private
String
courseId
;
...
...
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/model/StrategyInfo.java
View file @
0dd112d
...
@@ -2,7 +2,9 @@ package cn.com.glsx.dj.strategy.model;
...
@@ -2,7 +2,9 @@ package cn.com.glsx.dj.strategy.model;
import
cn.com.glsx.dj.strategy.enums.StrategyPushType
;
import
cn.com.glsx.dj.strategy.enums.StrategyPushType
;
import
cn.com.glsx.dj.strategy.enums.StrategyTypeEnum
;
import
cn.com.glsx.dj.strategy.enums.StrategyTypeEnum
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -18,45 +20,66 @@ public class StrategyInfo implements Serializable {
...
@@ -18,45 +20,66 @@ public class StrategyInfo implements Serializable {
private
Integer
id
;
private
Integer
id
;
/**
/**
* 执行策略类型,0-学习类,1-优秀录音分享类,2-记录类型,3-任务型
* 执行策略类型,0-学习类,1-优秀录音分享类,3-任务型
* * 2-带教、4-销售精英到店提拉、5-强力促销、6-最终盘点,7-低客单产品购入;
* @see StrategyTypeEnum
* @see StrategyTypeEnum
*/
*/
@ApiModelProperty
(
notes
=
"执行策略类型,0-学习类,1-优秀录音分享类,3-任务型, 2-带教、4-销售精英到店提拉、5-强力促销、6-最终盘点,7-低客单产品购入;"
,
required
=
true
)
@Column
(
name
=
"strategy_type"
)
@Column
(
name
=
"strategy_type"
)
private
Integer
strategyType
;
private
Integer
strategyType
;
/**
* 商户ID
*/
@Column
(
name
=
"merchant_id"
)
private
Integer
merchantId
;
/**
* 商户名称
*/
@Column
(
name
=
"merchant_name"
)
private
String
merchantName
;
/**
/**
* 标题
* 标题
*/
*/
@ApiModelProperty
(
notes
=
"标题"
)
@Column
(
name
=
"title"
)
@Column
(
name
=
"title"
)
private
String
title
;
private
String
title
;
/**
/**
* 副标题
* 副标题
*/
*/
@ApiModelProperty
(
notes
=
"副标题"
)
@Column
(
name
=
"sub_title"
)
@Column
(
name
=
"sub_title"
)
private
String
subTitle
;
private
String
subTitle
;
/**
/**
* 执行开始日期
* 执行开始日期
*/
*/
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
notes
=
"执行开始日期, yyyy-MM-dd HH:mm:ss"
)
@Column
(
name
=
"start_date"
)
@Column
(
name
=
"start_date"
)
private
Date
startDate
;
private
Date
startDate
;
/**
/**
* 执行结束日期
* 执行结束日期
*/
*/
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
notes
=
"执行结束日期, yyyy-MM-dd HH:mm:ss"
)
@Column
(
name
=
"end_date"
)
@Column
(
name
=
"end_date"
)
private
Date
endDate
;
private
Date
endDate
;
/**
/**
* 策略说明
* 策略说明
*/
*/
@ApiModelProperty
(
notes
=
"策略说明"
)
@Column
(
name
=
"description"
)
@Column
(
name
=
"description"
)
private
String
description
;
private
String
description
;
/**
/**
* 处理人类型,0-区域运营,1-驻店人员
* 处理人类型,0-区域运营,1-驻店人员
*/
*/
@ApiModelProperty
(
notes
=
"处理人类型,0-区域运营,1-驻店人员"
)
@Column
(
name
=
"handler_type"
)
@Column
(
name
=
"handler_type"
)
private
Integer
handlerType
;
private
Integer
handlerType
;
...
@@ -64,12 +87,14 @@ public class StrategyInfo implements Serializable {
...
@@ -64,12 +87,14 @@ public class StrategyInfo implements Serializable {
* 推送方式,0-定时推送,1-立即推送
* 推送方式,0-定时推送,1-立即推送
* @see StrategyPushType
* @see StrategyPushType
*/
*/
@ApiModelProperty
(
notes
=
"推送方式,0-定时推送,1-立即推送"
)
@Column
(
name
=
"push_type"
)
@Column
(
name
=
"push_type"
)
private
Integer
pushType
;
private
Integer
pushType
;
/**
/**
* 内容
* 内容
*/
*/
@ApiModelProperty
(
notes
=
"内容"
)
@Column
(
name
=
"content"
)
@Column
(
name
=
"content"
)
private
String
content
;
private
String
content
;
...
...
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/model/StrategyRecordingRel.java
View file @
0dd112d
package
cn
.
com
.
glsx
.
dj
.
strategy
.
model
;
package
cn
.
com
.
glsx
.
dj
.
strategy
.
model
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -22,15 +24,21 @@ public class StrategyRecordingRel implements Serializable {
...
@@ -22,15 +24,21 @@ public class StrategyRecordingRel implements Serializable {
/**
/**
* 录音id
* 录音id
*/
*/
@ApiModelProperty
(
notes
=
"录音ID"
)
@Column
(
name
=
"recording_id"
)
@Column
(
name
=
"recording_id"
)
private
String
recordingId
;
private
String
recordingId
;
/**
/**
* 接待员工名称
* 接待员工名称
*/
*/
@ApiModelProperty
(
notes
=
"接待员工名称"
)
@Column
(
name
=
"reception_staff_name"
)
@Column
(
name
=
"reception_staff_name"
)
private
String
receptionStaffName
;
private
String
receptionStaffName
;
/**
* 接待时间
*/
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
notes
=
"接待时间, yyyy-MM-dd HH:mm:ss"
)
@Column
(
name
=
"reception_date"
)
@Column
(
name
=
"reception_date"
)
private
Date
receptionDate
;
private
Date
receptionDate
;
...
...
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/model/StrategyStaffRel.java
View file @
0dd112d
package
cn
.
com
.
glsx
.
dj
.
strategy
.
model
;
package
cn
.
com
.
glsx
.
dj
.
strategy
.
model
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -22,12 +23,14 @@ public class StrategyStaffRel implements Serializable {
...
@@ -22,12 +23,14 @@ public class StrategyStaffRel implements Serializable {
/**
/**
* 人员uuid
* 人员uuid
*/
*/
@ApiModelProperty
(
notes
=
"人员uuid"
)
@Column
(
name
=
"user_uuid"
)
@Column
(
name
=
"user_uuid"
)
private
String
userUuid
;
private
String
userUuid
;
/**
/**
* 人员名称
* 人员名称
*/
*/
@ApiModelProperty
(
notes
=
"人员名称"
)
@Column
(
name
=
"user_name"
)
@Column
(
name
=
"user_name"
)
private
String
userName
;
private
String
userName
;
...
...
rpc-dj-strategy-api/src/main/java/cn/com/glsx/dj/strategy/remote/StrategyInfoRemote.java
View file @
0dd112d
package
cn
.
com
.
glsx
.
dj
.
strategy
.
remote
;
package
cn
.
com
.
glsx
.
dj
.
strategy
.
remote
;
import
cn.com.glsx.dj.strategy.dto.BatchInsertStrategyInfo
;
import
cn.com.glsx.dj.strategy.model.StrategyInfo
;
import
cn.com.glsx.dj.strategy.model.StrategyInfo
;
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.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
java.util.List
;
import
java.util.List
;
...
@@ -13,4 +17,14 @@ public interface StrategyInfoRemote {
...
@@ -13,4 +17,14 @@ public interface StrategyInfoRemote {
* @return
* @return
*/
*/
RpcResponse
<
List
<
StrategyInfo
>>
getStrategyInfoById
(
Integer
id
);
RpcResponse
<
List
<
StrategyInfo
>>
getStrategyInfoById
(
Integer
id
);
@ApiMethod
(
"批量新增策略"
)
@ApiParam
(
name
=
"batchStrategyInfo"
,
notes
=
"策略信息"
,
dataType
=
ApiParam
.
DataTypeEnum
.
OBJECT
,
required
=
true
)
@ApiResponse
(
"结果"
)
RpcResponse
<
Boolean
>
batchCreate
(
BatchInsertStrategyInfo
batchStrategyInfo
);
@ApiMethod
(
"删除策略"
)
@ApiParam
(
name
=
"strategyInfo"
,
notes
=
"策略信息"
,
dataType
=
ApiParam
.
DataTypeEnum
.
OBJECT
,
required
=
true
)
@ApiResponse
(
"结果"
)
RpcResponse
<
Boolean
>
delete
(
StrategyInfo
strategyInfo
);
}
}
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/remote/StrategyInfoRemoteImpl.java
View file @
0dd112d
package
cn
.
com
.
glsx
.
dj
.
strategy
.
remote
;
package
cn
.
com
.
glsx
.
dj
.
strategy
.
remote
;
import
cn.com.glsx.dj.strategy.dto.BatchInsertStrategyInfo
;
import
cn.com.glsx.dj.strategy.model.StrategyInfo
;
import
cn.com.glsx.dj.strategy.model.StrategyInfo
;
import
cn.com.glsx.dj.strategy.service.StrategyInfoService
;
import
cn.com.glsx.dj.strategy.service.StrategyInfoService
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
...
@@ -19,13 +20,39 @@ public class StrategyInfoRemoteImpl implements StrategyInfoRemote {
...
@@ -19,13 +20,39 @@ public class StrategyInfoRemoteImpl implements StrategyInfoRemote {
@Override
@Override
public
RpcResponse
<
List
<
StrategyInfo
>>
getStrategyInfoById
(
Integer
strategyType
)
{
public
RpcResponse
<
List
<
StrategyInfo
>>
getStrategyInfoById
(
Integer
strategyType
)
{
try
{
try
{
return
RpcResponse
.
success
(
strategyInfoService
.
queryStrategyInfoList
(
strategyType
));
return
RpcResponse
.
success
(
strategyInfoService
.
queryStrategyInfoList
(
strategyType
));
}
catch
(
RpcServiceException
e
)
{
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
return
RpcResponse
.
error
(
e
.
getError
(),
e
.
getMessage
());
return
RpcResponse
.
error
(
e
.
getError
(),
e
.
getMessage
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
return
RpcResponse
.
error
(
DefaultErrorEnum
.
SERVICE_ERROR
,
e
.
getMessage
());
}
}
@Override
public
RpcResponse
<
Boolean
>
batchCreate
(
BatchInsertStrategyInfo
batchStrategyInfo
)
{
try
{
return
RpcResponse
.
success
(
strategyInfoService
.
batchCreate
(
batchStrategyInfo
));
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
RpcResponse
.
error
(
e
.
getError
(),
e
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
RpcResponse
.
error
(
DefaultErrorEnum
.
SERVICE_ERROR
,
e
.
getMessage
());
}
}
@Override
public
RpcResponse
<
Boolean
>
delete
(
StrategyInfo
strategyInfo
)
{
try
{
return
RpcResponse
.
success
(
strategyInfoService
.
delete
(
strategyInfo
));
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
RpcResponse
.
error
(
e
.
getError
(),
e
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
RpcResponse
.
error
(
DefaultErrorEnum
.
SERVICE_ERROR
,
e
.
getMessage
());
return
RpcResponse
.
error
(
DefaultErrorEnum
.
SERVICE_ERROR
,
e
.
getMessage
());
}
}
}
}
...
...
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyCourseRelService.java
0 → 100644
View file @
0dd112d
package
cn
.
com
.
glsx
.
dj
.
strategy
.
service
;
import
cn.com.glsx.dj.strategy.mapper.StrategyCourseRelMapper
;
import
cn.com.glsx.dj.strategy.model.StrategyCourseRel
;
import
cn.com.glsx.dj.strategy.model.StrategyInfo
;
import
cn.com.glsx.scrm.equity.enums.DeleteFlagEnum
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
@Slf4j
@Service
public
class
StrategyCourseRelService
{
@Autowired
private
StrategyCourseRelMapper
strategyCourseRelMapper
;
public
int
batchInsert
(
List
<
StrategyInfo
>
strategyInfoList
,
List
<
StrategyCourseRel
>
courseList
)
{
if
(
CollectionUtils
.
isEmpty
(
courseList
))
{
return
0
;
}
//构建对象,遍历2个对象创建新StrategyCourseRel
List
<
StrategyCourseRel
>
all
=
new
ArrayList
<>();
for
(
StrategyInfo
strategyInfo
:
strategyInfoList
)
{
for
(
StrategyCourseRel
course
:
courseList
)
{
StrategyCourseRel
rel
=
new
StrategyCourseRel
();
rel
.
setCourseId
(
course
.
getCourseId
());
rel
.
setStrategyId
(
strategyInfo
.
getId
());
rel
.
setCreatedBy
(
strategyInfo
.
getCreatedBy
());
rel
.
setCreatedDate
(
strategyInfo
.
getCreatedDate
());
rel
.
setDeletedFlag
(
DeleteFlagEnum
.
N
.
getValue
());
all
.
add
(
rel
);
}
}
return
strategyCourseRelMapper
.
insertList
(
all
);
}
public
int
deleteByStrategyId
(
Integer
strategyId
,
String
updatedBy
,
Date
updatedDate
)
{
StrategyCourseRel
rel
=
new
StrategyCourseRel
();
rel
.
setDeletedFlag
(
DeleteFlagEnum
.
D
.
getValue
());
rel
.
setUpdatedDate
(
updatedDate
);
rel
.
setUpdatedBy
(
updatedBy
);
Example
example
=
new
Example
(
StrategyCourseRel
.
class
);
example
.
createCriteria
().
andEqualTo
(
"strategyId"
,
strategyId
)
.
andEqualTo
(
"deletedFlag"
,
DeleteFlagEnum
.
N
.
getValue
());
return
strategyCourseRelMapper
.
updateByExampleSelective
(
rel
,
example
);
}
}
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyInfoService.java
View file @
0dd112d
package
cn
.
com
.
glsx
.
dj
.
strategy
.
service
;
package
cn
.
com
.
glsx
.
dj
.
strategy
.
service
;
import
cn.com.glsx.dj.strategy.dto.BatchInsertStrategyInfo
;
import
cn.com.glsx.dj.strategy.dto.MerchantInfo
;
import
cn.com.glsx.dj.strategy.enums.StrategyPushType
;
import
cn.com.glsx.dj.strategy.mapper.StrategyInfoMapper
;
import
cn.com.glsx.dj.strategy.mapper.StrategyInfoMapper
;
import
cn.com.glsx.dj.strategy.model.StrategyInfo
;
import
cn.com.glsx.dj.strategy.model.StrategyInfo
;
import
cn.com.glsx.scrm.equity.enums.DeleteFlagEnum
;
import
cn.com.glsx.scrm.equity.enums.DeleteFlagEnum
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
@Slf4j
@Slf4j
@Service
@Service
...
@@ -17,6 +26,16 @@ public class StrategyInfoService {
...
@@ -17,6 +26,16 @@ public class StrategyInfoService {
@Autowired
@Autowired
private
StrategyInfoMapper
strategyInfoMapper
;
private
StrategyInfoMapper
strategyInfoMapper
;
@Autowired
private
StrategyStaffRelService
strategyStaffRelService
;
@Autowired
private
StrategyCourseRelService
strategyCourseRelService
;
@Autowired
private
StrategyRecordingRelService
strategyRecordingRelService
;
public
List
<
StrategyInfo
>
queryStrategyInfoList
(
Integer
strategyType
)
{
public
List
<
StrategyInfo
>
queryStrategyInfoList
(
Integer
strategyType
)
{
Example
example
=
new
Example
(
StrategyInfo
.
class
);
Example
example
=
new
Example
(
StrategyInfo
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
Example
.
Criteria
criteria
=
example
.
createCriteria
();
...
@@ -24,4 +43,66 @@ public class StrategyInfoService {
...
@@ -24,4 +43,66 @@ public class StrategyInfoService {
.
andEqualTo
(
"deletedFlag"
,
DeleteFlagEnum
.
N
);
.
andEqualTo
(
"deletedFlag"
,
DeleteFlagEnum
.
N
);
return
strategyInfoMapper
.
selectByExample
(
example
);
return
strategyInfoMapper
.
selectByExample
(
example
);
}
}
/**
* 批量创建策略记录
* @param batchStrategyInfo
* @return
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
rollbackFor
=
Exception
.
class
)
public
Boolean
batchCreate
(
BatchInsertStrategyInfo
batchStrategyInfo
)
{
//构建策略基础信息
List
<
MerchantInfo
>
merchantIdList
=
batchStrategyInfo
.
getMerchantList
();
StrategyInfo
baseStrategyInfo
=
batchStrategyInfo
.
getStrategyInfo
();
//设置默认推送方式
if
(
Objects
.
isNull
(
baseStrategyInfo
.
getPushType
()))
{
baseStrategyInfo
.
setPushType
(
StrategyPushType
.
TIMED_PUSH
.
getValue
());
}
Date
date
=
new
Date
();
List
<
StrategyInfo
>
strategyInfoList
=
merchantIdList
.
stream
().
map
(
merchantInfo
->
{
StrategyInfo
strategyInfo
=
new
StrategyInfo
();
BeanUtils
.
copyProperties
(
baseStrategyInfo
,
strategyInfo
);
strategyInfo
.
setMerchantId
(
merchantInfo
.
getMerchantId
());
strategyInfo
.
setMerchantName
(
merchantInfo
.
getMerchantName
());
strategyInfo
.
setDeletedFlag
(
DeleteFlagEnum
.
N
.
getValue
());
strategyInfo
.
setCreatedDate
(
date
);
strategyInfo
.
setCreatedBy
(
batchStrategyInfo
.
getCreatedBy
());
return
strategyInfo
;
}).
collect
(
Collectors
.
toList
());
//批量插入策略基础信息
strategyInfoMapper
.
insertList
(
strategyInfoList
);
//批量插入策略人员关联信息
strategyStaffRelService
.
batchInsert
(
strategyInfoList
,
batchStrategyInfo
.
getStaffList
());
//批量插入策略课程关联关系
strategyCourseRelService
.
batchInsert
(
strategyInfoList
,
batchStrategyInfo
.
getCourseList
());
//批量插入策略-录音关联关系
strategyRecordingRelService
.
batchInsert
(
strategyInfoList
,
batchStrategyInfo
.
getRecordingList
());
//判断是否需要立即推送消息
if
(
StrategyPushType
.
IMMEDIATE_PUSH
.
getValue
().
equals
(
baseStrategyInfo
.
getPushType
()))
{
//立即推送消息
}
return
Boolean
.
TRUE
;
}
/**
* 删除策略
* @param strategyInfo
* @return
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
rollbackFor
=
Exception
.
class
)
public
Boolean
delete
(
StrategyInfo
strategyInfo
)
{
Date
date
=
new
Date
();
strategyInfo
.
setDeletedFlag
(
DeleteFlagEnum
.
D
.
getValue
());
strategyInfo
.
setUpdatedDate
(
date
);
strategyInfoMapper
.
updateByPrimaryKeySelective
(
strategyInfo
);
//删除策略人员关联关系
strategyStaffRelService
.
deleteByStrategyId
(
strategyInfo
.
getId
(),
strategyInfo
.
getUpdatedBy
(),
date
);
//删除策略课程关联关系
strategyCourseRelService
.
deleteByStrategyId
(
strategyInfo
.
getId
(),
strategyInfo
.
getUpdatedBy
(),
date
);
//删除策略-录音关联关系
strategyRecordingRelService
.
deleteByStrategyId
(
strategyInfo
.
getId
(),
strategyInfo
.
getUpdatedBy
(),
date
);
return
Boolean
.
TRUE
;
}
}
}
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyRecordingRelService.java
0 → 100644
View file @
0dd112d
package
cn
.
com
.
glsx
.
dj
.
strategy
.
service
;
import
cn.com.glsx.dj.strategy.mapper.StrategyRecordingRelMapper
;
import
cn.com.glsx.dj.strategy.model.StrategyInfo
;
import
cn.com.glsx.dj.strategy.model.StrategyRecordingRel
;
import
cn.com.glsx.scrm.equity.enums.DeleteFlagEnum
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
@Slf4j
@Service
public
class
StrategyRecordingRelService
{
@Autowired
private
StrategyRecordingRelMapper
strategyRecordingRelMapper
;
public
int
batchInsert
(
List
<
StrategyInfo
>
strategyInfoList
,
List
<
StrategyRecordingRel
>
strategyRecordingRelList
)
{
if
(
CollectionUtils
.
isEmpty
(
strategyRecordingRelList
))
{
return
0
;
}
List
<
StrategyRecordingRel
>
all
=
new
ArrayList
<>();
//双重遍历构建对象
for
(
StrategyInfo
strategyInfo
:
strategyInfoList
)
{
for
(
StrategyRecordingRel
strategyRecordingRel
:
strategyRecordingRelList
)
{
StrategyRecordingRel
recordRel
=
getStrategyRecordingRel
(
strategyInfo
,
strategyRecordingRel
);
all
.
add
(
recordRel
);
}
}
return
strategyRecordingRelMapper
.
insertList
(
all
);
}
private
static
StrategyRecordingRel
getStrategyRecordingRel
(
StrategyInfo
strategyInfo
,
StrategyRecordingRel
strategyRecordingRel
)
{
StrategyRecordingRel
recordRel
=
new
StrategyRecordingRel
();
recordRel
.
setStrategyId
(
strategyInfo
.
getId
());
recordRel
.
setRecordingId
(
strategyRecordingRel
.
getRecordingId
());
recordRel
.
setReceptionStaffName
(
strategyRecordingRel
.
getReceptionStaffName
());
recordRel
.
setReceptionDate
(
strategyRecordingRel
.
getReceptionDate
());
recordRel
.
setCreatedBy
(
strategyInfo
.
getCreatedBy
());
recordRel
.
setCreatedDate
(
strategyInfo
.
getCreatedDate
());
recordRel
.
setDeletedFlag
(
DeleteFlagEnum
.
N
.
getValue
());
return
recordRel
;
}
/**
* 根据策略id删除关联关系
* @param strategyId
* @return
*/
public
int
deleteByStrategyId
(
Integer
strategyId
,
String
updatedBy
,
Date
updatedDate
)
{
StrategyRecordingRel
rel
=
new
StrategyRecordingRel
();
rel
.
setDeletedFlag
(
DeleteFlagEnum
.
D
.
getValue
());
rel
.
setUpdatedDate
(
updatedDate
);
rel
.
setUpdatedBy
(
updatedBy
);
Example
example
=
new
Example
(
StrategyRecordingRel
.
class
);
example
.
createCriteria
().
andEqualTo
(
"strategyId"
,
strategyId
)
.
andEqualTo
(
"deletedFlag"
,
DeleteFlagEnum
.
N
.
getValue
());
return
strategyRecordingRelMapper
.
updateByExampleSelective
(
rel
,
example
);
}
}
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyStaffRelService.java
0 → 100644
View file @
0dd112d
package
cn
.
com
.
glsx
.
dj
.
strategy
.
service
;
import
cn.com.glsx.dj.strategy.mapper.StrategyStaffRelMapper
;
import
cn.com.glsx.dj.strategy.model.StrategyInfo
;
import
cn.com.glsx.dj.strategy.model.StrategyStaffRel
;
import
cn.com.glsx.scrm.equity.enums.DeleteFlagEnum
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
@Service
@Slf4j
public
class
StrategyStaffRelService
{
@Autowired
private
StrategyStaffRelMapper
strategyStaffRelMapper
;
/**
* 批量插入策略人员关联关系
* @param strategyInfoList
* @param staffList
* @return
*/
public
int
batchInsert
(
List
<
StrategyInfo
>
strategyInfoList
,
List
<
StrategyStaffRel
>
staffList
)
{
if
(
CollectionUtils
.
isEmpty
(
staffList
))
return
0
;
//构建对象,遍历2个对象创建新StrategyStaffRel
List
<
StrategyStaffRel
>
all
=
new
ArrayList
<>();
for
(
StrategyInfo
strategyInfo
:
strategyInfoList
)
{
for
(
StrategyStaffRel
staff
:
staffList
)
{
StrategyStaffRel
rel
=
new
StrategyStaffRel
();
rel
.
setUserUuid
(
staff
.
getUserUuid
());
rel
.
setUserName
(
staff
.
getUserName
());
rel
.
setStrategyId
(
strategyInfo
.
getId
());
rel
.
setCreatedBy
(
strategyInfo
.
getCreatedBy
());
rel
.
setCreatedDate
(
strategyInfo
.
getCreatedDate
());
rel
.
setDeletedFlag
(
DeleteFlagEnum
.
N
.
getValue
());
all
.
add
(
rel
);
}
}
return
strategyStaffRelMapper
.
insertList
(
all
);
}
/**
* 根据策略id删除关联关系
* @param strategyId
* @return
*/
public
int
deleteByStrategyId
(
Integer
strategyId
,
String
updatedBy
,
Date
updatedDate
)
{
StrategyStaffRel
rel
=
new
StrategyStaffRel
();
rel
.
setDeletedFlag
(
DeleteFlagEnum
.
D
.
getValue
());
rel
.
setUpdatedDate
(
updatedDate
);
rel
.
setUpdatedBy
(
updatedBy
);
Example
example
=
new
Example
(
StrategyStaffRel
.
class
);
example
.
createCriteria
().
andEqualTo
(
"strategyId"
,
strategyId
)
.
andEqualTo
(
"deletedFlag"
,
DeleteFlagEnum
.
N
.
getValue
());
return
strategyStaffRelMapper
.
updateByExampleSelective
(
rel
,
example
);
}
}
rpc-dj-strategy/src/main/resources/META-INF/orm/StrategyInfoMapper.xml
View file @
0dd112d
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
-->
-->
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"strategy_type"
property=
"strategyType"
jdbcType=
"INTEGER"
/>
<result
column=
"strategy_type"
property=
"strategyType"
jdbcType=
"INTEGER"
/>
<result
column=
"merchant_id"
property=
"merchantId"
jdbcType=
"INTEGER"
/>
<result
column=
"merchant_name"
property=
"merchantName"
jdbcType=
"VARCHAR"
/>
<result
column=
"title"
property=
"title"
jdbcType=
"VARCHAR"
/>
<result
column=
"title"
property=
"title"
jdbcType=
"VARCHAR"
/>
<result
column=
"sub_title"
property=
"subTitle"
jdbcType=
"VARCHAR"
/>
<result
column=
"sub_title"
property=
"subTitle"
jdbcType=
"VARCHAR"
/>
<result
column=
"start_date"
property=
"startDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"start_date"
property=
"startDate"
jdbcType=
"TIMESTAMP"
/>
...
@@ -30,7 +32,7 @@
...
@@ -30,7 +32,7 @@
<!--
<!--
WARNING - @mbg.generated
WARNING - @mbg.generated
-->
-->
id, strategy_type, title, sub_title,
start_date, end_date, description, handler_type,
id, strategy_type, title, sub_title,
merchant_id, merchant_name, start_date, end_date, description, handler_type,
push_type, created_by, created_date, updated_by, updated_date, deleted_flag
push_type, created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
</sql>
<sql
id=
"Blob_Column_List"
>
<sql
id=
"Blob_Column_List"
>
...
...
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