Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
624c4a5b
Commit
624c4a5b
authored
Jun 20, 2024
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企微托管
parent
e959f39b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
160 additions
and
2 deletions
+160
-2
QywxOpenTaskController.java
...an/manage/web/controller/open/QywxOpenTaskController.java
+160
-2
No files found.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/open/QywxOpenTaskController.java
View file @
624c4a5b
...
@@ -2,6 +2,7 @@ package com.gic.haoban.manage.web.controller.open;
...
@@ -2,6 +2,7 @@ package com.gic.haoban.manage.web.controller.open;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DatePattern
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.BasePageInfo
;
import
com.gic.api.base.commons.BasePageInfo
;
import
com.gic.api.base.commons.JSONResponse
;
import
com.gic.api.base.commons.JSONResponse
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
...
@@ -9,6 +10,8 @@ import com.gic.api.base.commons.ServiceResponse;
...
@@ -9,6 +10,8 @@ import com.gic.api.base.commons.ServiceResponse;
import
com.gic.clerk.api.dto.AuthorizedUser
;
import
com.gic.clerk.api.dto.AuthorizedUser
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.EntityUtil
;
...
@@ -49,6 +52,7 @@ import java.util.ArrayList;
...
@@ -49,6 +52,7 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* 企微托管任务
* 企微托管任务
...
@@ -65,6 +69,8 @@ public class QywxOpenTaskController {
...
@@ -65,6 +69,8 @@ public class QywxOpenTaskController {
private
MemberTagApiService
memberTagApiService
;
private
MemberTagApiService
memberTagApiService
;
@Autowired
@Autowired
private
MemberTagGroupApiService
memberTagGroupApiService
;
private
MemberTagGroupApiService
memberTagGroupApiService
;
@Autowired
private
StoreService
storeService
;
/**
/**
* 加好友任务列表
* 加好友任务列表
...
@@ -114,7 +120,31 @@ public class QywxOpenTaskController {
...
@@ -114,7 +120,31 @@ public class QywxOpenTaskController {
ServiceResponse
<
OpenQwAddTaskDTO
>
oldResp
=
this
.
openQwApiService
.
getAddTask
(
addTaskId
);
ServiceResponse
<
OpenQwAddTaskDTO
>
oldResp
=
this
.
openQwApiService
.
getAddTask
(
addTaskId
);
oldDTO
=
oldResp
.
getResult
();
oldDTO
=
oldResp
.
getResult
();
}
}
if
(
null
!=
oldDTO
)
{
String
oldName
=
oldDTO
.
getName
()
+
"-"
+
addTaskId
;
String
title
=
"编辑任务【"
+
oldName
+
"】"
;
StringBuilder
sb
=
new
StringBuilder
();
int
oldMemberType
=
oldDTO
.
getMemberType
();
int
newMemberType
=
dto
.
getMemberType
();
String
oldMemberTypeTitle
=
oldMemberType
==
0
?
"客户筛选"
:
"客户分组"
;
String
newMemberTypeTitle
=
newMemberType
==
0
?
"客户筛选"
:
"客户分组"
;
this
.
otherLog
(
oldMemberType
,
newMemberType
,
sb
,
"参与人群"
,
oldMemberTypeTitle
,
newMemberTypeTitle
);
int
oldMemberRule
=
oldDTO
.
getMemberRule
();
int
newMemberRule
=
dto
.
getMemberRule
();
String
oldMemberRuleTitle
=
oldMemberRule
==
1
?
"和专属导购没有好友关系的客户"
:
"和企业下所有导购均没有好友关系的客户"
;
String
newMemberRuleTitle
=
newMemberRule
==
1
?
"和专属导购没有好友关系的客户"
:
"和企业下所有导购均没有好友关系的客户"
;
this
.
otherLog
(
oldMemberRule
,
newMemberRule
,
sb
,
"人群规则"
,
oldMemberRuleTitle
,
newMemberRuleTitle
);
String
oldLabel
=
oldDTO
.
getMemberLabelId
();
String
newLabel
=
dto
.
getMemberLabelId
();
this
.
membrLabel
(
3
,
oldLabel
,
newLabel
,
sb
);
if
(
StringUtils
.
isNotBlank
(
sb
.
toString
()))
{
String
logContent
=
title
+
sb
.
toString
();
GicLogRecordEvaluationContext
.
putAttribute
(
"logValue"
,
logContent
);
GicLogRecordEvaluationContext
.
putOptTargetId
(
AuthWebRequestUtil
.
getLoginUser
().
getClerkId
());
}
else
{
GicLogRecordEvaluationContext
.
noWriteLog
();
}
}
ServiceResponse
<
OpenQwAddTaskDTO
>
resp
=
this
.
openQwApiService
.
saveAddTask
(
dto
);
ServiceResponse
<
OpenQwAddTaskDTO
>
resp
=
this
.
openQwApiService
.
saveAddTask
(
dto
);
if
(!
resp
.
isSuccess
())
{
if
(!
resp
.
isSuccess
())
{
GicLogRecordEvaluationContext
.
noWriteLog
();
GicLogRecordEvaluationContext
.
noWriteLog
();
...
@@ -123,6 +153,27 @@ public class QywxOpenTaskController {
...
@@ -123,6 +153,27 @@ public class QywxOpenTaskController {
return
RestResponse
.
successResult
(
resp
.
getResult
());
return
RestResponse
.
successResult
(
resp
.
getResult
());
}
}
private
void
otherLog
(
int
oldValue
,
int
newValue
,
StringBuilder
sb
,
String
s1
,
String
s2
,
String
s3
)
{
if
(
oldValue
!=
newValue
)
{
sb
.
append
(
s1
+
"从【"
+
s2
+
"】修改为【"
+
s3
+
"】"
);
}
}
private
void
membrLabel
(
int
type
,
String
oldValue
,
String
newValue
,
StringBuilder
sb
)
{
if
(
type
==
3
&&
!
oldValue
.
equals
(
newValue
))
{
MemberTagItemDTO
oldResp
=
this
.
memberTagApiService
.
findMemberTagItem
(
oldValue
);
MemberTagItemDTO
newResp
=
this
.
memberTagApiService
.
findMemberTagItem
(
newValue
);
if
(
null
!=
oldResp
)
{
oldValue
=
oldResp
.
getTagName
()
+
"-"
+
oldResp
.
getTagItemName
();
}
if
(
null
!=
newResp
)
{
newValue
=
newResp
.
getTagName
()
+
"-"
+
newResp
.
getTagItemName
();
}
sb
.
append
(
"标签从【"
+
oldValue
+
"】修改为【"
+
newValue
+
"】"
);
}
}
/**
/**
* 获取加好友任务详情
* 获取加好友任务详情
*
*
...
@@ -166,7 +217,6 @@ public class QywxOpenTaskController {
...
@@ -166,7 +217,6 @@ public class QywxOpenTaskController {
List
<
MemberTagGroupDTO
>
memberTagGroupDTOList
=
memberTagGroupApiService
.
findListByIds
(
List
<
MemberTagGroupDTO
>
memberTagGroupDTOList
=
memberTagGroupApiService
.
findListByIds
(
new
ArrayList
<>(
Arrays
.
asList
(
tagGroupIdArr
)));
new
ArrayList
<>(
Arrays
.
asList
(
tagGroupIdArr
)));
if
(
CollectionUtils
.
isNotEmpty
(
memberTagGroupDTOList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
memberTagGroupDTOList
))
{
for
(
MemberTagGroupDTO
memberTagGroupDTO
:
memberTagGroupDTOList
)
{
for
(
MemberTagGroupDTO
memberTagGroupDTO
:
memberTagGroupDTOList
)
{
MemberTagGroupVO
memberTagGroupVO
=
new
MemberTagGroupVO
();
MemberTagGroupVO
memberTagGroupVO
=
new
MemberTagGroupVO
();
memberTagGroupVO
.
setGroupName
(
memberTagGroupDTO
.
getGroupName
());
memberTagGroupVO
.
setGroupName
(
memberTagGroupDTO
.
getGroupName
());
...
@@ -324,13 +374,121 @@ public class QywxOpenTaskController {
...
@@ -324,13 +374,121 @@ public class QywxOpenTaskController {
String
enterpriseId
=
loginUser
.
getEnterpriseId
();
String
enterpriseId
=
loginUser
.
getEnterpriseId
();
dto
.
setWxEnterpriseId
(
wxEnterpriseId
);
dto
.
setWxEnterpriseId
(
wxEnterpriseId
);
dto
.
setEnterpriseId
(
enterpriseId
);
dto
.
setEnterpriseId
(
enterpriseId
);
ServiceResponse
<
OpenQwAddTaskSettingDTO
>
oldResp
=
this
.
openQwApiService
.
geAddSetting
(
wxEnterpriseId
,
enterpriseId
);
if
(
null
!=
oldResp
.
getResult
())
{
OpenQwAddTaskSettingDTO
oldDTO
=
oldResp
.
getResult
();
String
logContent1
=
""
;
String
logContent2
=
""
;
String
oldAddTime
=
oldDTO
.
getAddTime
();
String
newAddTime
=
dto
.
getAddTime
();
if
(!
oldAddTime
.
equals
(
newAddTime
))
{
logContent1
=
"添加时段从【"
+
oldAddTime
+
"】修改为【"
+
newAddTime
+
"】 "
;
}
String
oldInt
=
oldDTO
.
getAddIntervalStart
()
+
"-"
+
oldDTO
.
getAddIntervalEnd
();
String
newInt
=
dto
.
getAddIntervalStart
()
+
"-"
+
dto
.
getAddIntervalEnd
();
if
(!
oldInt
.
equals
(
newInt
))
{
logContent2
=
"添加间隔从【"
+
oldInt
+
"】修改为【"
+
newInt
+
"】 "
;
}
String
n1
=
this
.
numLog
(
oldDTO
.
getReAddTime
(),
dto
.
getReAddTime
(),
"客户未通过好友重新添加时间从【%s】修改未【%s】"
);
String
n2
=
this
.
numLog
(
oldDTO
.
getReAddTimes
(),
dto
.
getReAddTimes
(),
"最多重新添加次数从【%s】修改为【%s】"
);
String
n3
=
this
.
openLog
(
oldDTO
.
getReAddFlag
(),
dto
.
getReAddFlag
(),
"自动重新添加"
);
String
logContent3
=
""
;
if
(!
StringUtils
.
isAllBlank
(
n1
,
n2
,
n3
))
{
logContent3
=
n3
+
n1
+
n2
;
}
String
logContent4
=
this
.
storeLog
(
oldDTO
.
getMainStoreJson
(),
dto
.
getMainStoreJson
(),
"服务门店"
);
String
logContent5
=
this
.
storeLog
(
oldDTO
.
getMainStoreJson
(),
dto
.
getMainStoreJson
(),
"协管门店"
);
String
logContent6
=
this
.
storeLog
(
oldDTO
.
getMainStoreJson
(),
dto
.
getMainStoreJson
(),
"指定门店"
);
if
(
StringUtils
.
isAnyEmpty
(
logContent1
,
logContent2
,
logContent3
,
logContent4
,
logContent5
,
logContent6
))
{
String
logContent
=
logContent1
+
logContent2
+
logContent3
+
logContent4
+
logContent5
+
logContent6
;
GicLogRecordEvaluationContext
.
putAttribute
(
"logValue"
,
logContent
);
GicLogRecordEvaluationContext
.
putOptTargetId
(
AuthWebRequestUtil
.
getLoginUser
().
getClerkId
());
}
else
{
GicLogRecordEvaluationContext
.
noWriteLog
();
}
}
ServiceResponse
<
OpenQwAddTaskSettingDTO
>
resp
=
this
.
openQwApiService
.
saveAddSetting
(
dto
);
ServiceResponse
<
OpenQwAddTaskSettingDTO
>
resp
=
this
.
openQwApiService
.
saveAddSetting
(
dto
);
if
(!
resp
.
isSuccess
())
{
if
(!
resp
.
isSuccess
())
{
GicLogRecordEvaluationContext
.
noWriteLog
();
return
RestResponse
.
failure
(
"9999"
,
resp
.
getMessage
());
return
RestResponse
.
failure
(
"9999"
,
resp
.
getMessage
());
}
}
return
RestResponse
.
successResult
(
resp
.
getResult
());
return
RestResponse
.
successResult
(
resp
.
getResult
());
}
}
private
String
storeLog
(
String
oldStr
,
String
newStr
,
String
name
)
{
JSONObject
oldJson
=
JSONObject
.
parseObject
(
oldStr
);
int
oldFlag
=
oldJson
.
getIntValue
(
"open"
);
JSONObject
newJson
=
JSONObject
.
parseObject
(
oldStr
);
int
newFlag
=
newJson
.
getInteger
(
"open"
);
String
s1
=
this
.
openLog
(
oldFlag
,
newFlag
,
name
);
String
s2Old
=
this
.
getLogOption
(
oldJson
.
getIntValue
(
"zs"
),
oldJson
.
getIntValue
(
"dz"
),
oldJson
.
getIntValue
(
"dy"
),
oldJson
.
getIntValue
(
"xg"
));
String
s2New
=
this
.
getLogOption
(
newJson
.
getIntValue
(
"zs"
),
newJson
.
getIntValue
(
"dz"
),
newJson
.
getIntValue
(
"dy"
),
newJson
.
getIntValue
(
"xg"
));
String
s2
=
""
;
if
(!
s2Old
.
equals
(
s2New
))
{
s2
=
s2New
;
}
String
s3
=
""
;
if
(
"指定门店"
.
equals
(
name
))
{
s3
=
this
.
getStore
(
oldJson
.
getString
(
"storeId"
),
newJson
.
getString
(
"storeId"
));
}
return
s1
+
s3
+
s2
;
}
private
String
getStore
(
String
oldStoreId
,
String
newStoreId
)
{
if
(!
oldStoreId
.
equals
(
newStoreId
))
{
StoreDTO
oldStore
=
this
.
storeService
.
getStore
(
oldStoreId
);
StoreDTO
newStore
=
this
.
storeService
.
getStore
(
newStoreId
);
String
oldName
=
""
;
if
(
null
!=
oldStore
)
{
oldName
=
oldStore
.
getStoreName
()
+
"、"
+
oldStore
.
getStoreCode
();
}
String
newName
=
""
;
if
(
null
!=
newStore
)
{
newName
=
newStore
.
getStoreName
()
+
"、"
+
newStore
.
getStoreCode
();
}
String
s
=
String
.
format
(
"指定门店从【%s】修改未【%s】"
,
oldName
,
newName
);
return
s
;
}
return
""
;
}
private
String
getLogOption
(
int
zs
,
int
dz
,
int
dy
,
int
xg
)
{
List
<
String
>
list
=
new
ArrayList
<>();
if
(
zs
==
1
)
{
list
.
add
(
"专属导购"
);
}
if
(
xg
==
1
)
{
list
.
add
(
"协管导购"
);
}
if
(
dz
==
1
)
{
list
.
add
(
"店长"
);
}
if
(
dy
==
1
)
{
list
.
add
(
"其他导购随机"
);
}
return
list
.
stream
().
collect
(
Collectors
.
joining
(
"、"
));
}
private
String
openLog
(
int
oldFlag
,
int
openFlag
,
String
title
)
{
if
(
oldFlag
==
openFlag
)
{
return
""
;
}
if
(
openFlag
==
1
)
{
return
"开启"
+
title
;
}
return
"关闭"
+
title
;
}
private
String
numLog
(
int
old
,
int
newValue
,
String
title
)
{
if
(
old
!=
newValue
)
{
return
String
.
format
(
title
,
old
+
""
,
newValue
+
""
);
}
return
null
;
}
/**
/**
* 删除好友配置
* 删除好友配置
...
...
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