Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
f4c10adf
Commit
f4c10adf
authored
Jun 11, 2020
by
dengshichuan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dsc' into 'develop'
Dsc See merge request 8timerv2/8timerapiv200!164
parents
45d89e3e
1fd371cf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
12 deletions
+48
-12
src/main/java/cn/timer/api/bean/crm/CrmBusinessGroup.java
+2
-2
src/main/java/cn/timer/api/controller/crm/CrmController.java
+46
-10
No files found.
src/main/java/cn/timer/api/bean/crm/CrmBusinessGroup.java
View file @
f4c10adf
...
...
@@ -87,7 +87,7 @@ public class CrmBusinessGroup extends Model<CrmBusinessGroup> {
@Transient
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"组管理员id"
)
private
Integer
[]
managerIds
;
private
List
<
Integer
>
managerIds
;
@Transient
@TableField
(
exist
=
false
)
...
...
@@ -97,7 +97,7 @@ public class CrmBusinessGroup extends Model<CrmBusinessGroup> {
@Transient
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"组成员id"
)
private
Integer
[]
memberIds
;
private
List
<
Integer
>
memberIds
;
@Transient
@TableField
(
exist
=
false
)
...
...
src/main/java/cn/timer/api/controller/crm/CrmController.java
View file @
f4c10adf
...
...
@@ -112,11 +112,14 @@ public class CrmController {
@PostMapping
(
"addBusinessGroup"
)
@Transactional
@ApiOperation
(
value
=
"新增业务组"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperation
(
value
=
"新增
/编辑
业务组"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
addBusinessGroup
(
@CurrentUser
UserBean
userBean
,
@RequestBody
CrmBusinessGroup
crmBusinessGroup
)
{
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
gid
=
crmBusinessGroup
.
getId
();
crmBusinessGroup
.
setModifyUser
(
empNum
);
// 修改人
if
(
gid
==
null
)
{
CrmBusinessGroup
crmBusinessGroupOld
=
CrmBusinessGroup
.
builder
().
build
()
.
selectOne
(
new
QueryWrapper
<
CrmBusinessGroup
>().
lambda
().
eq
(
CrmBusinessGroup:
:
getOrgCode
,
orgCode
)
.
select
(
CrmBusinessGroup:
:
getSort
).
last
(
"limit 1"
).
orderByDesc
(
CrmBusinessGroup:
:
getId
));
...
...
@@ -124,30 +127,61 @@ public class CrmController {
crmBusinessGroup
.
setSort
(
1
);
else
crmBusinessGroup
.
setSort
(
crmBusinessGroupOld
.
getSort
()
+
1
);
// 排序
// crmBusinessGroup.setManagerName(getEmpName(orgCode, empNum)); // 设置管理员姓名
crmBusinessGroup
.
setCreateUser
(
empNum
);
// 创建人
crmBusinessGroup
.
setModifyUser
(
empNum
);
// 修改人
crmBusinessGroup
.
setOrgCode
(
orgCode
);
// crmBusinessGroup.setMember(member); // ,字符串拼接
boolean
result
=
crmBusinessGroup
.
insert
();
if
(!
result
)
return
ResultUtil
.
success
(
"新增失败"
);
Integer
gid
=
crmBusinessGroup
.
getId
();
Integer
[]
memberIds
=
crmBusinessGroup
.
getMemberIds
();
gid
=
crmBusinessGroup
.
getId
();
List
<
Integer
>
memberIds
=
crmBusinessGroup
.
getMemberIds
();
for
(
Integer
empId
:
memberIds
)
{
CrmBusinessGroupMember
.
builder
().
gid
(
gid
).
empNum
(
empId
).
orgCode
(
orgCode
).
type
(
0
).
build
().
insert
(
);
insertMembers
(
gid
,
empId
,
orgCode
,
0
);
}
Integer
[]
managerIds
=
crmBusinessGroup
.
getManagerIds
();
List
<
Integer
>
managerIds
=
crmBusinessGroup
.
getManagerIds
();
for
(
Integer
empId
:
managerIds
)
{
CrmBusinessGroupMember
.
builder
().
gid
(
gid
).
empNum
(
empId
).
orgCode
(
orgCode
).
type
(
1
).
build
().
insert
(
);
insertMembers
(
gid
,
empId
,
orgCode
,
1
);
}
CrmSeaRule
crmSeaRule
=
crmBusinessGroup
.
getCrmSeaRules
();
crmSeaRule
.
setGid
(
gid
);
crmSeaRule
.
insert
();
}
else
{
List
<
Integer
>
memberIds
=
crmBusinessGroup
.
getMemberIds
();
List
<
Integer
>
managerIds
=
crmBusinessGroup
.
getManagerIds
();
// 更新组成员
updateMembers
(
orgCode
,
gid
,
memberIds
,
0
);
updateMembers
(
orgCode
,
gid
,
managerIds
,
1
);
// 更新公海规则
crmBusinessGroup
.
getCrmSeaRules
().
update
(
new
LambdaQueryWrapper
<
CrmSeaRule
>().
eq
(
CrmSeaRule:
:
getGid
,
gid
));
}
return
ResultUtil
.
success
(
"新增业务组成功"
);
}
private
void
insertMembers
(
Integer
gid
,
Integer
empId
,
Integer
orgCode
,
Integer
type
)
{
CrmBusinessGroupMember
.
builder
().
gid
(
gid
).
empNum
(
empId
).
orgCode
(
orgCode
).
type
(
type
).
build
().
insert
();
}
private
void
updateMembers
(
Integer
orgCode
,
Integer
gid
,
List
<
Integer
>
memberIds
,
Integer
type
)
{
List
<
CrmBusinessGroupMember
>
oldMembers
=
CrmBusinessGroupMember
.
builder
().
build
()
.
selectList
(
new
LambdaQueryWrapper
<
CrmBusinessGroupMember
>().
eq
(
CrmBusinessGroupMember:
:
getGid
,
gid
)
.
eq
(
CrmBusinessGroupMember:
:
getType
,
type
).
select
(
CrmBusinessGroupMember:
:
getEmpNum
));
// 旧组成员idlist
List
<
Integer
>
oldIdsList
=
oldMembers
.
stream
().
map
(
CrmBusinessGroupMember:
:
getEmpNum
)
.
collect
(
Collectors
.
toList
());
List
<
Integer
>
deList
=
CheckUtil
.
reduce
(
oldIdsList
,
memberIds
);
// 删
for
(
Integer
integer
:
deList
)
{
CrmBusinessGroupMember
.
builder
().
build
()
.
delete
(
new
LambdaQueryWrapper
<
CrmBusinessGroupMember
>()
.
eq
(
CrmBusinessGroupMember:
:
getEmpNum
,
integer
).
eq
(
CrmBusinessGroupMember:
:
getGid
,
gid
)
.
eq
(
CrmBusinessGroupMember:
:
getOrgCode
,
orgCode
).
eq
(
CrmBusinessGroupMember:
:
getType
,
type
));
}
List
<
Integer
>
addList
=
CheckUtil
.
reduce
(
memberIds
,
oldIdsList
);
// 增
for
(
Integer
integer
:
addList
)
{
CrmBusinessGroupMember
.
builder
().
empNum
(
integer
).
gid
(
gid
).
orgCode
(
orgCode
).
type
(
type
).
build
().
insert
();
}
}
@GetMapping
(
"getBusinessGroup"
)
@ApiOperation
(
value
=
"获取业务组列表"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
getBusinessGroup
(
@CurrentUser
UserBean
userBean
)
{
...
...
@@ -169,6 +203,7 @@ public class CrmController {
String
name
=
getEmpName
(
getOrgCode
(
userBean
),
empNum
);
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"name"
,
name
);
map
.
put
(
"empNum"
,
empNum
);
managers
.
add
(
map
);
}
crmBusinessGroup
.
setManagers
(
managers
);
...
...
@@ -179,6 +214,7 @@ public class CrmController {
String
name
=
getEmpName
(
getOrgCode
(
userBean
),
empNum
);
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"name"
,
name
);
map
.
put
(
"empNum"
,
empNum
);
members
.
add
(
map
);
}
crmBusinessGroup
.
setMembers
(
members
);
...
...
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