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
e7233dfa
Commit
e7233dfa
authored
Jun 11, 2020
by
dengshichuan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dsc' into 'develop'
公海扫描规则,业务组单独id,name列表 See merge request 8timerv2/8timerapiv200!166
parents
40a644e3
c479d815
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
149 additions
and
15 deletions
+149
-15
src/main/java/cn/timer/api/bean/crm/CrmSeaRule.java
+2
-2
src/main/java/cn/timer/api/controller/crm/CrmController.java
+41
-13
src/main/java/cn/timer/api/controller/crm/CrmRuleController.java
+106
-0
No files found.
src/main/java/cn/timer/api/bean/crm/CrmSeaRule.java
View file @
e7233dfa
...
@@ -64,6 +64,6 @@ public class CrmSeaRule extends Model<CrmSeaRule> {
...
@@ -64,6 +64,6 @@ public class CrmSeaRule extends Model<CrmSeaRule> {
@ApiModelProperty
(
value
=
"系统提前(four)天自动提醒业务员客户将被回收"
)
@ApiModelProperty
(
value
=
"系统提前(four)天自动提醒业务员客户将被回收"
)
private
Integer
four
;
private
Integer
four
;
@ApiModelProperty
(
value
=
"我的客户数量最多(five)人(合作中的不算)"
)
//
@ApiModelProperty(value = "我的客户数量最多(five)人(合作中的不算)")
private
Integer
five
;
//
private Integer five;
}
}
src/main/java/cn/timer/api/controller/crm/CrmController.java
View file @
e7233dfa
...
@@ -117,6 +117,17 @@ public class CrmController {
...
@@ -117,6 +117,17 @@ public class CrmController {
@RequestBody
CrmBusinessGroup
crmBusinessGroup
)
{
@RequestBody
CrmBusinessGroup
crmBusinessGroup
)
{
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
CrmSeaRule
crmSeaRule
=
crmBusinessGroup
.
getCrmSeaRules
();
Integer
one
=
crmSeaRule
.
getOne
();
Integer
two
=
crmSeaRule
.
getTwo
();
Integer
three
=
crmSeaRule
.
getThree
();
Integer
four
=
crmSeaRule
.
getFour
();
if
((
one
!=
null
&&
one
<
1
)
||
(
two
!=
null
&&
two
<
1
)
||
(
three
!=
null
&&
three
<
1
)
||
(
four
!=
null
&&
four
<
1
))
return
ResultUtil
.
error
(
"请输入正确的规则天数"
);
if
(
three
<=
one
)
return
ResultUtil
.
error
(
"该规则天数必须大于规则1的天数"
);
Integer
gid
=
crmBusinessGroup
.
getId
();
Integer
gid
=
crmBusinessGroup
.
getId
();
crmBusinessGroup
.
setModifyUser
(
empNum
);
// 修改人
crmBusinessGroup
.
setModifyUser
(
empNum
);
// 修改人
if
(
gid
==
null
)
{
if
(
gid
==
null
)
{
...
@@ -141,7 +152,6 @@ public class CrmController {
...
@@ -141,7 +152,6 @@ public class CrmController {
for
(
Integer
empId
:
managerIds
)
{
for
(
Integer
empId
:
managerIds
)
{
insertMembers
(
gid
,
empId
,
orgCode
,
1
);
insertMembers
(
gid
,
empId
,
orgCode
,
1
);
}
}
CrmSeaRule
crmSeaRule
=
crmBusinessGroup
.
getCrmSeaRules
();
crmSeaRule
.
setGid
(
gid
);
crmSeaRule
.
setGid
(
gid
);
crmSeaRule
.
insert
();
crmSeaRule
.
insert
();
return
ResultUtil
.
success
(
"新增业务组成功"
);
return
ResultUtil
.
success
(
"新增业务组成功"
);
...
@@ -153,10 +163,10 @@ public class CrmController {
...
@@ -153,10 +163,10 @@ public class CrmController {
updateMembers
(
orgCode
,
gid
,
memberIds
,
0
);
updateMembers
(
orgCode
,
gid
,
memberIds
,
0
);
updateMembers
(
orgCode
,
gid
,
managerIds
,
1
);
updateMembers
(
orgCode
,
gid
,
managerIds
,
1
);
// 更新公海规则
// 更新公海规则
crm
BusinessGroup
.
getCrmSeaRules
()
.
update
(
new
LambdaQueryWrapper
<
CrmSeaRule
>().
eq
(
CrmSeaRule:
:
getGid
,
gid
));
crm
SeaRule
.
update
(
new
LambdaQueryWrapper
<
CrmSeaRule
>().
eq
(
CrmSeaRule:
:
getGid
,
gid
));
return
ResultUtil
.
success
(
"编辑业务组成功"
);
return
ResultUtil
.
success
(
"编辑业务组成功"
);
}
}
}
}
private
void
insertMembers
(
Integer
gid
,
Integer
empId
,
Integer
orgCode
,
Integer
type
)
{
private
void
insertMembers
(
Integer
gid
,
Integer
empId
,
Integer
orgCode
,
Integer
type
)
{
...
@@ -229,6 +239,16 @@ public class CrmController {
...
@@ -229,6 +239,16 @@ public class CrmController {
return
ResultUtil
.
data
(
list
,
"获取成功"
);
return
ResultUtil
.
data
(
list
,
"获取成功"
);
}
}
@GetMapping
(
"getBusinessGroupId"
)
@ApiOperation
(
value
=
"获取业务组列表(id,name)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
getBusinessGroupId
(
@CurrentUser
UserBean
userBean
)
{
return
ResultUtil
.
data
(
CrmBusinessGroup
.
builder
().
build
()
.
selectList
(
new
LambdaQueryWrapper
<
CrmBusinessGroup
>()
.
eq
(
CrmBusinessGroup:
:
getOrgCode
,
getOrgCode
(
userBean
))
.
select
(
CrmBusinessGroup:
:
getId
,
CrmBusinessGroup:
:
getName
)),
"获取成功"
);
}
// @GetMapping("getBusinessGroupMembers")
// @GetMapping("getBusinessGroupMembers")
// @ApiOperation(value = "获取业务组列表成员", httpMethod = "GET", notes = "接口发布说明")
// @ApiOperation(value = "获取业务组列表成员", httpMethod = "GET", notes = "接口发布说明")
// public Result<Object> getBusinessGroupMembers(@CurrentUser UserBean userBean, @RequestParam Integer gid) {
// public Result<Object> getBusinessGroupMembers(@CurrentUser UserBean userBean, @RequestParam Integer gid) {
...
@@ -284,18 +304,26 @@ public class CrmController {
...
@@ -284,18 +304,26 @@ public class CrmController {
crmClientData
.
setBelongUserName
(
getEmpName
(
orgCode
,
crmClientData
.
getBelongUser
()));
crmClientData
.
setBelongUserName
(
getEmpName
(
orgCode
,
crmClientData
.
getBelongUser
()));
crmClientData
.
setOrgCode
(
getOrgCode
(
userBean
));
crmClientData
.
setOrgCode
(
getOrgCode
(
userBean
));
Integer
belongGroup
=
crmClientData
.
getBelongGroup
();
Integer
belongGroup
=
crmClientData
.
getBelongGroup
();
if
(
belongGroup
==
null
)
return
ResultUtil
.
error
(
"未选择业务组"
);
String
belongGroupName
=
CrmBusinessGroup
.
builder
().
id
(
belongGroup
).
build
().
selectById
().
getName
();
String
belongGroupName
=
CrmBusinessGroup
.
builder
().
id
(
belongGroup
).
build
().
selectById
().
getName
();
crmClientData
.
setBelongGroupName
(
belongGroupName
);
crmClientData
.
setBelongGroupName
(
belongGroupName
);
Integer
clientSource
=
crmClientData
.
getClientSource
();
String
clientSourceName
=
ClientSourceClass
.
builder
().
id
(
crmClientData
.
getClientSource
()).
build
().
selectById
()
Integer
clientType
=
crmClientData
.
getClientType
();
.
getName
();
// 客户来源
Integer
industry
=
crmClientData
.
getIndustry
();
String
clientTypeName
=
ClientTypeClass
.
builder
().
id
(
crmClientData
.
getClientType
()).
build
().
selectById
()
if
(
clientSource
!=
null
)
{
.
getName
();
// 客户类型
String
clientSourceName
=
ClientSourceClass
.
builder
().
id
(
clientSource
).
build
().
selectById
().
getName
();
// 客户来源
String
industryName
=
IndustryClass
.
builder
().
id
(
crmClientData
.
getIndustry
()).
build
().
selectById
().
getName
();
// 行业名
crmClientData
.
setClientSourceName
(
clientSourceName
);
}
crmClientData
.
setClientSourceName
(
clientSourceName
);
if
(
clientType
!=
null
)
{
crmClientData
.
setClientTypeName
(
clientTypeName
);
String
clientTypeName
=
ClientTypeClass
.
builder
().
id
(
clientType
).
build
().
selectById
().
getName
();
// 客户类型
crmClientData
.
setIndustryName
(
industryName
);
crmClientData
.
setClientTypeName
(
clientTypeName
);
}
if
(
industry
!=
null
)
{
String
industryName
=
IndustryClass
.
builder
().
id
(
industry
).
build
().
selectById
().
getName
();
// 行业名
crmClientData
.
setIndustryName
(
industryName
);
}
if
(!
crmClientData
.
insert
())
if
(!
crmClientData
.
insert
())
return
ResultUtil
.
error
(
"新增失败"
);
return
ResultUtil
.
error
(
"新增失败"
);
Integer
crmDataId
=
crmClientData
.
getId
();
Integer
crmDataId
=
crmClientData
.
getId
();
...
...
src/main/java/cn/timer/api/controller/crm/CrmRuleController.java
0 → 100644
View file @
e7233dfa
/**
* Title: CrmRuleController.java
* Description:
* @author dsc
* @date 2020年6月11日
* @version 1.0
*/
package
cn
.
timer
.
api
.
controller
.
crm
;
import
java.util.Date
;
import
java.util.List
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
cn.timer.api.bean.crm.CrmClientAssociate
;
import
cn.timer.api.bean.crm.CrmClientData
;
import
cn.timer.api.bean.crm.CrmSeaRule
;
/**
* Title: CrmRuleController.java
*
* @Description: 公海规则
* @author dsc
* @date 2020年6月11日
* @version 1.0
*/
@Component
public
class
CrmRuleController
{
@Scheduled
(
cron
=
"0 0 0/1 * * ? "
)
// 每小时扫描
@Transactional
public
void
getRules
()
{
// 全部业务组规则
List
<
CrmSeaRule
>
crmSeaRules
=
CrmSeaRule
.
builder
().
build
().
selectAll
();
for
(
CrmSeaRule
crmSeaRule
:
crmSeaRules
)
{
// 单个业务组规则信息
Integer
one
=
crmSeaRule
.
getOne
();
Integer
two
=
crmSeaRule
.
getTwo
();
Integer
three
=
crmSeaRule
.
getThree
();
Integer
four
=
crmSeaRule
.
getFour
();
// app提醒
// Integer five = crmSeaRule.getFive(); // 客户添加限制(暂不做)
Integer
gid
=
crmSeaRule
.
getGid
();
// 单个业务组对应的全部客户
List
<
CrmClientData
>
crmClientDatas
=
CrmClientData
.
builder
().
build
()
.
selectList
(
new
LambdaQueryWrapper
<
CrmClientData
>().
eq
(
CrmClientData:
:
getBelongGroup
,
gid
).
select
(
CrmClientData:
:
getCreateTime
,
CrmClientData:
:
getId
,
CrmClientData:
:
getLastFollowTime
,
CrmClientData:
:
getClientStatus
,
CrmClientData:
:
getBelongUserName
,
CrmClientData:
:
getClientName
));
for
(
CrmClientData
crmClientData
:
crmClientDatas
)
{
// 单个客户信息
Date
createTime
=
crmClientData
.
getCreateTime
();
Date
lastFollowTime
=
crmClientData
.
getLastFollowTime
();
Integer
status
=
crmClientData
.
getClientStatus
();
String
belongUserName
=
crmClientData
.
getBelongUserName
();
String
clientName
=
crmClientData
.
getClientName
();
// 客户创建时间+ x天 = 过期释放时间
DateTime
overDate1
=
DateUtil
.
offsetDay
(
createTime
,
one
);
DateTime
overDate2
=
DateUtil
.
offsetDay
(
lastFollowTime
,
two
);
DateTime
overDate3
=
DateUtil
.
offsetDay
(
createTime
,
three
);
// 时间比较
Date
now
=
new
Date
();
long
compare1
=
DateUtil
.
between
(
overDate1
,
now
,
DateUnit
.
DAY
,
false
);
long
compare2
=
DateUtil
.
between
(
overDate2
,
now
,
DateUnit
.
DAY
,
false
);
long
compare3
=
DateUtil
.
between
(
overDate3
,
now
,
DateUnit
.
DAY
,
false
);
// 判断1和2和3
if
((
lastFollowTime
==
null
&&
compare1
>=
0
)
||
(
lastFollowTime
!=
null
&&
compare2
>=
0
)
||
(
compare3
>=
0
&&
status
!=
3
&&
status
!=
4
))
release
(
crmClientData
);
// 判断4
if
(
compare1
==
-
four
||
compare2
==
-
four
||
compare3
==
-
four
)
remind
(
belongUserName
,
clientName
,
four
);
}
}
}
/**
* @param four
* @param name
*/
// app提醒
private
void
remind
(
String
belongUserName
,
String
clienName
,
Integer
four
)
{
System
.
err
.
println
(
belongUserName
+
"的客户:"
+
clienName
+
"还有"
+
four
+
"天即将过期,"
+
"正在向'"
+
belongUserName
+
"'的App发推送提醒"
);
// TODO
}
// 释放到公海
private
void
release
(
CrmClientData
crmClientData
)
{
crmClientData
.
setBelongUser
(
0
);
// 0-进入客户公海
crmClientData
.
setBelongUserName
(
null
);
// 删除协作人列表
CrmClientAssociate
.
builder
().
build
().
delete
(
new
QueryWrapper
<
CrmClientAssociate
>().
lambda
().
eq
(
CrmClientAssociate:
:
getCid
,
crmClientData
.
getId
()));
crmClientData
.
updateById
();
}
}
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