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
c479d815
Commit
c479d815
authored
Jun 11, 2020
by
邓实川
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公海扫描规则,业务组单独id,name列表
parent
fad12c50
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
145 additions
and
11 deletions
+145
-11
src/main/java/cn/timer/api/bean/crm/CrmSeaRule.java
+2
-2
src/main/java/cn/timer/api/controller/crm/CrmController.java
+37
-9
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 @
c479d815
...
...
@@ -64,6 +64,6 @@ public class CrmSeaRule extends Model<CrmSeaRule> {
@ApiModelProperty
(
value
=
"系统提前(four)天自动提醒业务员客户将被回收"
)
private
Integer
four
;
@ApiModelProperty
(
value
=
"我的客户数量最多(five)人(合作中的不算)"
)
private
Integer
five
;
//
@ApiModelProperty(value = "我的客户数量最多(five)人(合作中的不算)")
//
private Integer five;
}
src/main/java/cn/timer/api/controller/crm/CrmController.java
View file @
c479d815
...
...
@@ -117,6 +117,17 @@ public class CrmController {
@RequestBody
CrmBusinessGroup
crmBusinessGroup
)
{
Integer
orgCode
=
getOrgCode
(
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
();
crmBusinessGroup
.
setModifyUser
(
empNum
);
// 修改人
if
(
gid
==
null
)
{
...
...
@@ -141,7 +152,6 @@ public class CrmController {
for
(
Integer
empId
:
managerIds
)
{
insertMembers
(
gid
,
empId
,
orgCode
,
1
);
}
CrmSeaRule
crmSeaRule
=
crmBusinessGroup
.
getCrmSeaRules
();
crmSeaRule
.
setGid
(
gid
);
crmSeaRule
.
insert
();
return
ResultUtil
.
success
(
"新增业务组成功"
);
...
...
@@ -153,7 +163,7 @@ public class CrmController {
updateMembers
(
orgCode
,
gid
,
memberIds
,
0
);
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
(
"编辑业务组成功"
);
}
...
...
@@ -229,6 +239,16 @@ public class CrmController {
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")
// @ApiOperation(value = "获取业务组列表成员", httpMethod = "GET", notes = "接口发布说明")
// public Result<Object> getBusinessGroupMembers(@CurrentUser UserBean userBean, @RequestParam Integer gid) {
...
...
@@ -284,18 +304,26 @@ public class CrmController {
crmClientData
.
setBelongUserName
(
getEmpName
(
orgCode
,
crmClientData
.
getBelongUser
()));
crmClientData
.
setOrgCode
(
getOrgCode
(
userBean
));
Integer
belongGroup
=
crmClientData
.
getBelongGroup
();
if
(
belongGroup
==
null
)
return
ResultUtil
.
error
(
"未选择业务组"
);
String
belongGroupName
=
CrmBusinessGroup
.
builder
().
id
(
belongGroup
).
build
().
selectById
().
getName
();
crmClientData
.
setBelongGroupName
(
belongGroupName
);
String
clientSourceName
=
ClientSourceClass
.
builder
().
id
(
crmClientData
.
getClientSource
()).
build
().
selectById
()
.
getName
();
// 客户来源
String
clientTypeName
=
ClientTypeClass
.
builder
().
id
(
crmClientData
.
getClientType
()).
build
().
selectById
()
.
getName
();
// 客户类型
String
industryName
=
IndustryClass
.
builder
().
id
(
crmClientData
.
getIndustry
()).
build
().
selectById
().
getName
();
// 行业名
Integer
clientSource
=
crmClientData
.
getClientSource
();
Integer
clientType
=
crmClientData
.
getClientType
();
Integer
industry
=
crmClientData
.
getIndustry
();
if
(
clientSource
!=
null
)
{
String
clientSourceName
=
ClientSourceClass
.
builder
().
id
(
clientSource
).
build
().
selectById
().
getName
();
// 客户来源
crmClientData
.
setClientSourceName
(
clientSourceName
);
}
if
(
clientType
!=
null
)
{
String
clientTypeName
=
ClientTypeClass
.
builder
().
id
(
clientType
).
build
().
selectById
().
getName
();
// 客户类型
crmClientData
.
setClientTypeName
(
clientTypeName
);
}
if
(
industry
!=
null
)
{
String
industryName
=
IndustryClass
.
builder
().
id
(
industry
).
build
().
selectById
().
getName
();
// 行业名
crmClientData
.
setIndustryName
(
industryName
);
}
if
(!
crmClientData
.
insert
())
return
ResultUtil
.
error
(
"新增失败"
);
Integer
crmDataId
=
crmClientData
.
getId
();
...
...
src/main/java/cn/timer/api/controller/crm/CrmRuleController.java
0 → 100644
View file @
c479d815
/**
* 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