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
ab9f41af
Commit
ab9f41af
authored
Jun 10, 2025
by
王祖波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步建联
parent
4fedbb9c
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
949 additions
and
73 deletions
+949
-73
ContactLogDTO.java
.../com/gic/haoban/manage/api/dto/contact/ContactLogDTO.java
+51
-0
ContactBizTypeEnum.java
...c/haoban/manage/api/enums/contact/ContactBizTypeEnum.java
+59
-0
ContactFollowBatchQDTO.java
...aoban/manage/api/qdto/contact/ContactFollowBatchQDTO.java
+42
-0
ContactFollowQDTO.java
...gic/haoban/manage/api/qdto/contact/ContactFollowQDTO.java
+44
-0
ContactLogCheckQDTO.java
...c/haoban/manage/api/qdto/contact/ContactLogCheckQDTO.java
+15
-0
ContactLogQDTO.java
...om/gic/haoban/manage/api/qdto/contact/ContactLogQDTO.java
+83
-0
ContactOrderSearchQDTO.java
...aoban/manage/api/qdto/contact/ContactOrderSearchQDTO.java
+16
-0
ContactLogApiService.java
...oban/manage/api/service/contact/ContactLogApiService.java
+10
-0
pom.xml
haoban-manage3-service/pom.xml
+6
-0
TabContactFollowMapper.java
...ge/service/dao/mapper/contact/TabContactFollowMapper.java
+16
-0
TabContactLogMapper.java
...anage/service/dao/mapper/contact/TabContactLogMapper.java
+1
-1
TabContactFollow.java
...aoban/manage/service/entity/contact/TabContactFollow.java
+40
-0
TabContactLog.java
...c/haoban/manage/service/entity/contact/TabContactLog.java
+65
-0
TabContactOrder.java
...haoban/manage/service/entity/contact/TabContactOrder.java
+25
-0
ContactLogService.java
...ban/manage/service/service/contact/ContactLogService.java
+22
-5
ContactFollowServiceImpl.java
...ervice/service/contact/impl/ContactFollowServiceImpl.java
+3
-1
ContactLogServiceImpl.java
...e/service/service/contact/impl/ContactLogServiceImpl.java
+225
-41
ContactOrderServiceImpl.java
...service/service/contact/impl/ContactOrderServiceImpl.java
+11
-2
EnterpriseAdaptor.java
...ge/service/service/content/adaptor/EnterpriseAdaptor.java
+12
-0
RouterApiServiceImpl.java
...service/service/out/impl/common/RouterApiServiceImpl.java
+2
-1
ContactLogApiServiceImpl.java
...ce/service/out/impl/contact/ContactLogApiServiceImpl.java
+19
-1
ContactOrderApiServiceImpl.java
.../service/out/impl/contact/ContactOrderApiServiceImpl.java
+1
-1
dubbo-haoban-manage-service.xml
...ervice/src/main/resources/dubbo-haoban-manage-service.xml
+3
-0
TabContactFollowMapper.xml
.../main/resources/mapper/contact/TabContactFollowMapper.xml
+46
-6
TabContactLogMapper.xml
...src/main/resources/mapper/contact/TabContactLogMapper.xml
+61
-9
TabContactOrderMapper.xml
...c/main/resources/mapper/contact/TabContactOrderMapper.xml
+11
-4
ContactTest.java
...an-manage3-service/src/test/java/contact/ContactTest.java
+1
-1
ContactController.java
...an/manage/web/controller/potential/ContactController.java
+1
-0
ContactLogCheckQO.java
...m/gic/haoban/manage/web/qo/contact/ContactLogCheckQO.java
+15
-0
ContactLogQO.java
...va/com/gic/haoban/manage/web/qo/contact/ContactLogQO.java
+43
-0
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/contact/ContactLogDTO.java
View file @
ab9f41af
...
...
@@ -60,6 +60,25 @@ public class ContactLogDTO implements Serializable {
*/
private
Date
potentialTime
;
/**
* 来源日志id
*/
private
Long
sourceLogId
;
/**
* 来源类型 1潜客(0001)2机会人群(0010)
*/
private
Integer
sourceType
;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
*/
private
Integer
bizType
;
/**
* 跟进记录组
*/
private
String
followTypes
;
/**
* 企业id
*/
private
String
enterpriseId
;
...
...
@@ -168,4 +187,35 @@ public class ContactLogDTO implements Serializable {
this
.
enterpriseId
=
enterpriseId
;
}
public
Long
getSourceLogId
()
{
return
sourceLogId
;
}
public
void
setSourceLogId
(
Long
sourceLogId
)
{
this
.
sourceLogId
=
sourceLogId
;
}
public
Integer
getSourceType
()
{
return
sourceType
;
}
public
void
setSourceType
(
Integer
sourceType
)
{
this
.
sourceType
=
sourceType
;
}
public
Integer
getBizType
()
{
return
bizType
;
}
public
void
setBizType
(
Integer
bizType
)
{
this
.
bizType
=
bizType
;
}
public
String
getFollowTypes
()
{
return
followTypes
;
}
public
void
setFollowTypes
(
String
followTypes
)
{
this
.
followTypes
=
followTypes
;
}
}
\ No newline at end of file
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/enums/contact/ContactBizTypeEnum.java
0 → 100644
View file @
ab9f41af
package
com
.
gic
.
haoban
.
manage
.
api
.
enums
.
contact
;
import
java.util.Objects
;
public
enum
ContactBizTypeEnum
{
// 业务类型 1潜客(0001)2机会人群(0010)
POTENTIAL_CUSTOMER
(
"10"
,
1
,
"潜客"
),
OPPORTUNITY_CUSTOMER
(
"20"
,
2
,
"机会人群"
);
private
final
String
codePre
;
private
final
int
type
;
private
final
String
description
;
public
String
getCodePre
()
{
return
codePre
;
}
public
int
getType
()
{
return
type
;
}
public
String
getDescription
()
{
return
description
;
}
public
Long
getEsClerkContactTime
(
Long
contactTime
)
{
if
(
Objects
.
equals
(
contactTime
,
-
1L
))
{
return
null
;
}
return
Long
.
parseLong
(
this
.
getCodePre
()
+
contactTime
);
}
ContactBizTypeEnum
(
String
codePre
,
int
type
,
String
description
)
{
this
.
codePre
=
codePre
;
this
.
type
=
type
;
this
.
description
=
description
;
}
public
static
ContactBizTypeEnum
fromCode
(
String
code
)
{
for
(
ContactBizTypeEnum
type
:
values
())
{
if
(
Objects
.
equals
(
type
.
codePre
,
code
))
{
return
type
;
}
}
return
ContactBizTypeEnum
.
POTENTIAL_CUSTOMER
;
}
public
static
ContactBizTypeEnum
fromType
(
int
type
)
{
for
(
ContactBizTypeEnum
bizTypeEnum
:
values
())
{
if
(
bizTypeEnum
.
type
==
type
)
{
return
bizTypeEnum
;
}
}
return
ContactBizTypeEnum
.
POTENTIAL_CUSTOMER
;
}
}
\ No newline at end of file
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/qdto/contact/ContactFollowBatchQDTO.java
View file @
ab9f41af
package
com
.
gic
.
haoban
.
manage
.
api
.
qdto
.
contact
;
import
com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -25,6 +27,22 @@ public class ContactFollowBatchQDTO implements Serializable {
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private
Integer
followType
;
/**
* 业务id(建联日志id)
*/
private
String
bizId
;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private
Integer
bizType
=
ContactBizTypeEnum
.
POTENTIAL_CUSTOMER
.
getType
();
/**
* 来源类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private
Integer
sourceType
;
/**
* 跟进记录
*/
...
...
@@ -67,6 +85,30 @@ public class ContactFollowBatchQDTO implements Serializable {
this
.
followType
=
followType
;
}
public
String
getBizId
()
{
return
bizId
;
}
public
void
setBizId
(
String
bizId
)
{
this
.
bizId
=
bizId
;
}
public
Integer
getBizType
()
{
return
bizType
;
}
public
void
setBizType
(
Integer
bizType
)
{
this
.
bizType
=
bizType
;
}
public
Integer
getSourceType
()
{
return
sourceType
;
}
public
void
setSourceType
(
Integer
sourceType
)
{
this
.
sourceType
=
sourceType
;
}
public
String
getFollowRemark
()
{
return
followRemark
;
}
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/qdto/contact/ContactFollowQDTO.java
View file @
ab9f41af
package
com
.
gic
.
haoban
.
manage
.
api
.
qdto
.
contact
;
import
com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -23,6 +25,24 @@ public class ContactFollowQDTO implements Serializable {
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private
Integer
followType
;
/**
* 业务id(建联日志id)
*/
private
String
bizId
;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private
Integer
bizType
=
ContactBizTypeEnum
.
POTENTIAL_CUSTOMER
.
getType
();
/**
* 来源类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private
Integer
sourceType
;
/**
* 跟进记录
*/
...
...
@@ -76,6 +96,30 @@ public class ContactFollowQDTO implements Serializable {
this
.
followType
=
followType
;
}
public
String
getBizId
()
{
return
bizId
;
}
public
void
setBizId
(
String
bizId
)
{
this
.
bizId
=
bizId
;
}
public
Integer
getBizType
()
{
return
bizType
;
}
public
void
setBizType
(
Integer
bizType
)
{
this
.
bizType
=
bizType
;
}
public
Integer
getSourceType
()
{
return
sourceType
;
}
public
void
setSourceType
(
Integer
sourceType
)
{
this
.
sourceType
=
sourceType
;
}
public
String
getFollowRemark
()
{
return
followRemark
;
}
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/qdto/contact/ContactLogCheckQDTO.java
View file @
ab9f41af
...
...
@@ -17,6 +17,12 @@ public class ContactLogCheckQDTO implements Serializable {
*/
private
String
enterpriseId
;
/**
* 业务类型 1潜客(0001)2机会人群(0010)null为都校验
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private
Integer
bizType
;
public
String
getMemberId
()
{
return
memberId
;
}
...
...
@@ -40,4 +46,12 @@ public class ContactLogCheckQDTO implements Serializable {
public
void
setEnterpriseId
(
String
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
Integer
getBizType
()
{
return
bizType
;
}
public
void
setBizType
(
Integer
bizType
)
{
this
.
bizType
=
bizType
;
}
}
\ No newline at end of file
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/qdto/contact/ContactLogQDTO.java
View file @
ab9f41af
package
com
.
gic
.
haoban
.
manage
.
api
.
qdto
.
contact
;
import
com.gic.haoban.manage.api.enums.contact.ContactAutoTypeEnum
;
import
com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
;
import
com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
;
import
java.io.Serializable
;
import
java.util.List
;
public
class
ContactLogQDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
973688857967269973L
;
...
...
@@ -24,11 +27,42 @@ public class ContactLogQDTO implements Serializable {
private
String
enterpriseId
;
/**
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联 6自动建联 7营销素材
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private
Integer
followType
=
ContactFollowTypeEnum
.
CONTACT
.
getCode
();
/**
* 跟进记录
*/
private
String
followRemark
;
/**
* 跟进上传素材,数组格式
*/
private
List
<
String
>
followMaterialList
;
/**
* 自动建联类型
* @see ContactAutoTypeEnum
*/
private
Integer
contactAutoType
;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private
Integer
bizType
=
ContactBizTypeEnum
.
POTENTIAL_CUSTOMER
.
getType
();
/**
* 来源类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private
Integer
sourceType
;
/**
* 来源建联id
*/
private
Long
sourceLogId
;
public
ContactLogQDTO
()
{
}
...
...
@@ -72,6 +106,30 @@ public class ContactLogQDTO implements Serializable {
this
.
enterpriseId
=
enterpriseId
;
}
public
Integer
getFollowType
()
{
return
followType
;
}
public
void
setFollowType
(
Integer
followType
)
{
this
.
followType
=
followType
;
}
public
String
getFollowRemark
()
{
return
followRemark
;
}
public
void
setFollowRemark
(
String
followRemark
)
{
this
.
followRemark
=
followRemark
;
}
public
List
<
String
>
getFollowMaterialList
()
{
return
followMaterialList
;
}
public
void
setFollowMaterialList
(
List
<
String
>
followMaterialList
)
{
this
.
followMaterialList
=
followMaterialList
;
}
public
Integer
getContactAutoType
()
{
return
contactAutoType
;
}
...
...
@@ -79,4 +137,28 @@ public class ContactLogQDTO implements Serializable {
public
void
setContactAutoType
(
Integer
contactAutoType
)
{
this
.
contactAutoType
=
contactAutoType
;
}
public
Integer
getBizType
()
{
return
bizType
;
}
public
void
setBizType
(
Integer
bizType
)
{
this
.
bizType
=
bizType
;
}
public
Integer
getSourceType
()
{
return
sourceType
;
}
public
void
setSourceType
(
Integer
sourceType
)
{
this
.
sourceType
=
sourceType
;
}
public
Long
getSourceLogId
()
{
return
sourceLogId
;
}
public
void
setSourceLogId
(
Long
sourceLogId
)
{
this
.
sourceLogId
=
sourceLogId
;
}
}
\ No newline at end of file
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/qdto/contact/ContactOrderSearchQDTO.java
View file @
ab9f41af
package
com
.
gic
.
haoban
.
manage
.
api
.
qdto
.
contact
;
import
cn.hutool.core.date.DateUtil
;
import
com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
;
import
java.io.Serializable
;
import
java.util.Date
;
...
...
@@ -43,6 +44,12 @@ public class ContactOrderSearchQDTO implements Serializable {
*/
private
Date
endTime
;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private
Integer
bizType
=
ContactBizTypeEnum
.
POTENTIAL_CUSTOMER
.
getType
();
public
String
getMemberId
()
{
return
memberId
;
}
...
...
@@ -102,4 +109,12 @@ public class ContactOrderSearchQDTO implements Serializable {
this
.
endTime
=
DateUtil
.
endOfDay
(
endTime
);
}
}
public
Integer
getBizType
()
{
return
bizType
;
}
public
void
setBizType
(
Integer
bizType
)
{
this
.
bizType
=
bizType
;
}
}
\ No newline at end of file
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/contact/ContactLogApiService.java
View file @
ab9f41af
...
...
@@ -5,6 +5,8 @@ import com.gic.haoban.manage.api.dto.contact.ContactLogDTO;
import
com.gic.haoban.manage.api.qdto.contact.ContactLogCheckQDTO
;
import
com.gic.haoban.manage.api.qdto.contact.ContactLogQDTO
;
import
java.util.List
;
public
interface
ContactLogApiService
{
/**
...
...
@@ -12,9 +14,17 @@ public interface ContactLogApiService {
* @param memberId
* @return
*/
@Deprecated
ServiceResponse
<
ContactLogDTO
>
getClerkContactTime
(
String
memberId
);
/**
* 获取每个业务最近一条有效建联记录
* @param memberId
* @return
*/
ServiceResponse
<
List
<
ContactLogDTO
>>
getClerkContactTimeList
(
String
memberId
);
/**
* 保存建联记录
* @param qdto
* @return
...
...
haoban-manage3-service/pom.xml
View file @
ab9f41af
...
...
@@ -93,6 +93,12 @@
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
haoban-app-performance-api
</artifactId>
<version>
${haoban-app-performance-api}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-enterprise-api
</artifactId>
<version>
${gic-enterprise-api}
</version>
<exclusions>
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/contact/TabContactFollowMapper.java
View file @
ab9f41af
...
...
@@ -5,6 +5,7 @@ import com.gic.haoban.manage.api.qdto.contact.ContactFollowSearchQDTO;
import
com.gic.haoban.manage.service.entity.contact.TabContactFollow
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -50,6 +51,21 @@ public interface TabContactFollowMapper {
List
<
TabContactFollow
>
queryByIds
(
@Param
(
"followIds"
)
List
<
Long
>
followIds
);
/**
* 获取时间段内跟进类型
* @param enterpriseId
* @param clerkId
* @param memberId
* @param beginTime
* @param endTime
* @return
*/
String
getFollowTypes
(
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"clerkId"
)
String
clerkId
,
@Param
(
"memberId"
)
String
memberId
,
@Param
(
"beginTime"
)
Date
beginTime
,
@Param
(
"endTime"
)
Date
endTime
);
/**
* 统计总行数
*
* @param tabContactFollow 查询条件
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/contact/TabContactLogMapper.java
View file @
ab9f41af
...
...
@@ -35,7 +35,7 @@ public interface TabContactLogMapper {
* @param clerkId
* @return
*/
TabContactLog
queryLastLog
(
@Param
(
"memberId"
)
String
memberId
,
@Param
(
"clerkId"
)
String
clerkId
,
@Param
(
"beginTime"
)
Date
beginTime
,
@Param
(
"endTime"
)
Date
endTime
);
List
<
TabContactLog
>
queryLastLog
(
@Param
(
"memberId"
)
String
memberId
,
@Param
(
"clerkId"
)
String
clerkId
,
@Param
(
"beginTime"
)
Date
beginTime
,
@Param
(
"endTime"
)
Date
endTime
);
/**
* 统计总行数
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/contact/TabContactFollow.java
View file @
ab9f41af
...
...
@@ -48,6 +48,22 @@ public class TabContactFollow implements Serializable {
* 跟进时间
*/
private
Date
followTime
;
/**
* 来源类型 1潜客(0001)2机会人群(0010)
*/
private
Integer
sourceType
;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
*/
private
Integer
bizType
;
/**
* 业务id(建联日志id)
*/
private
String
bizId
;
/**
* 企业id
*/
...
...
@@ -137,6 +153,30 @@ public class TabContactFollow implements Serializable {
this
.
followTime
=
followTime
;
}
public
Integer
getSourceType
()
{
return
sourceType
;
}
public
void
setSourceType
(
Integer
sourceType
)
{
this
.
sourceType
=
sourceType
;
}
public
Integer
getBizType
()
{
return
bizType
;
}
public
void
setBizType
(
Integer
bizType
)
{
this
.
bizType
=
bizType
;
}
public
String
getBizId
()
{
return
bizId
;
}
public
void
setBizId
(
String
bizId
)
{
this
.
bizId
=
bizId
;
}
public
String
getEnterpriseId
()
{
return
enterpriseId
;
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/contact/TabContactLog.java
View file @
ab9f41af
...
...
@@ -59,6 +59,31 @@ public class TabContactLog implements Serializable {
* 成为潜客时间
*/
private
Date
potentialTime
;
/**
* 来源日志id
*/
private
Long
sourceLogId
;
/**
* 来源类型 1潜客(0001)2机会人群(0010)
*/
private
Integer
sourceType
;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
*/
private
Integer
bizType
;
/**
* 业务冗余数据
*/
private
String
bizData
;
/**
* 跟进记录组
*/
private
String
followTypes
;
/**
* 企业id
*/
...
...
@@ -172,6 +197,46 @@ public class TabContactLog implements Serializable {
this
.
potentialTime
=
potentialTime
;
}
public
Integer
getSourceType
()
{
return
sourceType
;
}
public
void
setSourceType
(
Integer
sourceType
)
{
this
.
sourceType
=
sourceType
;
}
public
Long
getSourceLogId
()
{
return
sourceLogId
;
}
public
void
setSourceLogId
(
Long
sourceLogId
)
{
this
.
sourceLogId
=
sourceLogId
;
}
public
Integer
getBizType
()
{
return
bizType
;
}
public
void
setBizType
(
Integer
bizType
)
{
this
.
bizType
=
bizType
;
}
public
String
getBizData
()
{
return
bizData
;
}
public
void
setBizData
(
String
bizData
)
{
this
.
bizData
=
bizData
;
}
public
String
getFollowTypes
()
{
return
followTypes
;
}
public
void
setFollowTypes
(
String
followTypes
)
{
this
.
followTypes
=
followTypes
;
}
public
String
getEnterpriseId
()
{
return
enterpriseId
;
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/contact/TabContactOrder.java
View file @
ab9f41af
...
...
@@ -88,6 +88,15 @@ public class TabContactOrder implements Serializable {
*/
private
Integer
potentialScore
;
/**
* 来源类型 1潜客(0001)2机会人群(0010)
*/
private
Integer
sourceType
;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
*/
private
Integer
bizType
;
/**
* 是否删除
*/
private
Integer
deleteFlag
;
...
...
@@ -256,6 +265,22 @@ public class TabContactOrder implements Serializable {
this
.
potentialScore
=
potentialScore
;
}
public
Integer
getSourceType
()
{
return
sourceType
;
}
public
void
setSourceType
(
Integer
sourceType
)
{
this
.
sourceType
=
sourceType
;
}
public
Integer
getBizType
()
{
return
bizType
;
}
public
void
setBizType
(
Integer
bizType
)
{
this
.
bizType
=
bizType
;
}
public
Integer
getDeleteFlag
()
{
return
deleteFlag
;
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/contact/ContactLogService.java
View file @
ab9f41af
...
...
@@ -6,6 +6,8 @@ import com.gic.haoban.manage.api.qdto.contact.ContactLogQDTO;
import
com.gic.haoban.manage.service.entity.contact.TabContactLog
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
public
interface
ContactLogService
{
...
...
@@ -16,14 +18,14 @@ public interface ContactLogService {
* @param clerkDTO
* @return
*/
boolean
contactCheck
(
String
enterpriseId
,
String
memberId
,
ClerkDTO
clerkDTO
)
;
boolean
contactCheck
(
String
enterpriseId
,
String
memberId
,
ClerkDTO
clerkDTO
,
Integer
bizType
)
;
/**
* 保存建联记录
*
* @param qdto
*/
TabContactLog
saveContactLog
(
ContactLogQDTO
qdto
)
throws
BusinessException
;
void
saveContactLog
(
ContactLogQDTO
qdto
)
throws
BusinessException
;
/**
* 自动建联
...
...
@@ -32,12 +34,18 @@ public interface ContactLogService {
void
autoContactLog
(
ContactLogQDTO
qdto
);
/**
* 同步建联
* @param qdto
*/
void
syncContactLog
(
ContactLogQDTO
qdto
);
/**
* 清除建联状态
*
* @param memberId
* @param clearType 1 消费清除 2 换绑主导购
*/
void
clearContactLog
(
String
memberId
,
Integer
clearType
,
String
clerkId
);
void
clearContactLog
(
String
enterpriseId
,
String
memberId
,
Integer
clearType
,
String
clerkId
);
/**
* 获取最近一条有效建联记录
...
...
@@ -48,10 +56,19 @@ public interface ContactLogService {
TabContactLog
getClerkContactTime
(
String
memberId
);
/**
* 根据时间获取最近一条建联记录
* 获取每个业务最近一条有效建联记录
* @param memberId
* @return
*/
List
<
TabContactLog
>
getClerkContactTimeList
(
String
memberId
);
/**
* 获取最近一条建联记录
* @param memberId
* @param clerkId
* @param beginTime
* @param endTime
* @return
*/
TabContactLog
getLastByTime
(
String
memberId
,
Date
beginTime
,
Date
endTime
);
Map
<
Integer
,
TabContactLog
>
getLastByTime
(
String
memberId
,
String
clerkId
,
Date
beginTime
,
Date
endTime
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/contact/impl/ContactFollowServiceImpl.java
View file @
ab9f41af
...
...
@@ -103,7 +103,7 @@ public class ContactFollowServiceImpl implements ContactFollowService {
autoContactSend
(
followList
);
}
private
static
void
autoContactSend
(
List
<
TabContactFollow
>
followList
)
{
private
void
autoContactSend
(
List
<
TabContactFollow
>
followList
)
{
// 自动建联
Integer
followType
=
followList
.
get
(
0
).
getFollowType
();
Integer
contactAutoType
=
ContactFollowTypeEnum
.
fromCode
(
followType
).
getContactAutoType
();
...
...
@@ -114,6 +114,8 @@ public class ContactFollowServiceImpl implements ContactFollowService {
contactLogQDTO
.
setClerkId
(
x
.
getClerkId
());
contactLogQDTO
.
setEnterpriseId
(
x
.
getEnterpriseId
());
contactLogQDTO
.
setContactAutoType
(
contactAutoType
);
contactLogQDTO
.
setBizType
(
x
.
getSourceType
());
contactLogQDTO
.
setSourceType
(
x
.
getSourceType
());
return
JSON
.
toJSONString
(
contactLogQDTO
);
}).
collect
(
Collectors
.
toList
());
String
routerName
=
"autoContactLogForMQ"
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/contact/impl/ContactLogServiceImpl.java
View file @
ab9f41af
...
...
@@ -3,11 +3,14 @@ package com.gic.haoban.manage.service.service.contact.impl;
import
cn.hutool.core.date.*
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.gic.api.base.commons.BusinessException
;
import
com.gic.api.base.commons.Constant
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.commons.util.UniqueIdUtils
;
import
com.gic.enterprise.api.constant.EnterpriseServiceEnum
;
import
com.gic.enterprise.api.dto.StoreDTO
;
...
...
@@ -17,22 +20,27 @@ import com.gic.haoban.app.customer.dto.MemberInfoListParamsDTO;
import
com.gic.haoban.app.customer.dto.contact.ContactParamDTO
;
import
com.gic.haoban.app.customer.dto.contact.ContactSumDTO
;
import
com.gic.haoban.app.customer.service.api.service.CustomerApiService
;
import
com.gic.haoban.app.objectives.api.service.ObjectivesManageApiService
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.manage.api.constants.Manage3Constants
;
import
com.gic.haoban.manage.api.dto.contact.ContactConfigDTO
;
import
com.gic.haoban.manage.api.enums.contact.ContactAutoTypeEnum
;
import
com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
;
import
com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
;
import
com.gic.haoban.manage.api.qdto.contact.ContactFollowQDTO
;
import
com.gic.haoban.manage.api.qdto.contact.ContactLogQDTO
;
import
com.gic.haoban.manage.service.dao.mapper.contact.TabContactFollowMapper
;
import
com.gic.haoban.manage.service.dao.mapper.contact.TabContactLogMapper
;
import
com.gic.haoban.manage.service.entity.contact.TabContactFollow
;
import
com.gic.haoban.manage.service.entity.contact.TabContactLog
;
import
com.gic.haoban.manage.service.service.ESMemberInfoService
;
import
com.gic.haoban.manage.service.service.contact.ContactConfigService
;
import
com.gic.haoban.manage.service.service.contact.ContactFollowService
;
import
com.gic.haoban.manage.service.service.contact.ContactLogService
;
import
com.gic.haoban.manage.service.service.content.adaptor.EnterpriseAdaptor
;
import
com.gic.member.api.dto.MemberStoreClerkDTO
;
import
com.gic.member.api.dto.es.MemberDataDTO
;
import
com.gic.member.api.service.MemberService
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.search.engine.api.dto.ESResponse
;
import
com.gic.search.engine.api.dto.dynamic.DynamicDocDTO
;
import
com.gic.search.engine.api.service.dynamic.ESDataDynamicOperationApiService
;
...
...
@@ -44,9 +52,9 @@ import org.apache.logging.log4j.Logger;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.
Date
;
import
java.util.
List
;
import
java.util.
Object
s
;
import
java.util.
*
;
import
java.util.
concurrent.atomic.AtomicBoolean
;
import
java.util.
stream.Collector
s
;
@Service
(
"contactLogService"
)
public
class
ContactLogServiceImpl
implements
ContactLogService
{
...
...
@@ -56,6 +64,8 @@ public class ContactLogServiceImpl implements ContactLogService {
@Autowired
private
TabContactLogMapper
contactLogMapper
;
@Autowired
private
TabContactFollowMapper
contactFollowMapper
;
@Autowired
private
ContactConfigService
contactConfigService
;
@Autowired
private
ContactFollowService
contactFollowService
;
...
...
@@ -70,17 +80,24 @@ public class ContactLogServiceImpl implements ContactLogService {
@Autowired
private
CustomerApiService
customerApiService
;
@Autowired
private
ObjectivesManageApiService
objectivesManageApiService
;
@Autowired
private
ESDataDynamicOperationApiService
esDataDynamicOperationApiService
;
@Autowired
private
ESMemberInfoService
esMemberInfoService
;
@Autowired
private
EnterpriseAdaptor
enterpriseAdaptor
;
@Override
public
boolean
contactCheck
(
String
enterpriseId
,
String
memberId
,
ClerkDTO
clerkDTO
)
{
public
boolean
contactCheck
(
String
enterpriseId
,
String
memberId
,
ClerkDTO
clerkDTO
,
Integer
bizType
)
{
if
(
clerkDTO
==
null
)
{
return
false
;
}
CustomerDTO
params
=
new
CustomerDTO
();
int
clerkType
=
clerkDTO
.
getClerkType
();
if
(
clerkType
>
2
)
{
return
false
;
}
String
clerkId
=
clerkDTO
.
getClerkId
();
String
storeId
=
""
;
if
(
clerkType
==
0
||
clerkType
==
1
)
{
...
...
@@ -91,6 +108,25 @@ public class ContactLogServiceImpl implements ContactLogService {
params
.
setStoreId
(
storeId
);
params
.
setClerkId
(
clerkId
);
params
.
setEnterpriseId
(
enterpriseId
);
if
(
Objects
.
equals
(
bizType
,
ContactBizTypeEnum
.
POTENTIAL_CUSTOMER
.
getType
()))
{
return
checkPotential
(
memberId
,
params
);
}
else
if
(
Objects
.
equals
(
bizType
,
ContactBizTypeEnum
.
OPPORTUNITY_CUSTOMER
.
getType
()))
{
// todo 机会人群是否能建联
}
else
{
boolean
checkPotential
=
checkPotential
(
memberId
,
params
);
if
(
checkPotential
)
{
return
true
;
}
// todo 机会人群是否能建联
}
return
false
;
}
private
boolean
checkPotential
(
String
memberId
,
CustomerDTO
params
)
{
boolean
hasRight
=
enterpriseAdaptor
.
checkEnterpriseHasRightByContactBizType
(
params
.
getEnterpriseId
(),
ContactBizTypeEnum
.
POTENTIAL_CUSTOMER
.
getType
());
if
(!
hasRight
)
{
return
false
;
}
ContactParamDTO
contact
=
new
ContactParamDTO
();
// 搜索信息
MemberInfoListParamsDTO
memberInfoListParamsDTO
=
com
.
gic
.
haoban
.
common
.
utils
.
StringUtil
.
getBean
(
"{}"
,
MemberInfoListParamsDTO
.
class
);
...
...
@@ -116,13 +152,22 @@ public class ContactLogServiceImpl implements ContactLogService {
@Override
public
TabContactLog
saveContactLog
(
ContactLogQDTO
qdto
)
throws
BusinessException
{
public
void
saveContactLog
(
ContactLogQDTO
qdto
)
throws
BusinessException
{
logger
.
info
(
"保存建联记录:{}"
,
JSON
.
toJSONString
(
qdto
));
String
enterpriseId
=
qdto
.
getEnterpriseId
();
boolean
hasRight
=
enterpriseAdaptor
.
checkEnterpriseHasRightByContactBizType
(
qdto
.
getEnterpriseId
(),
qdto
.
getBizType
());
if
(!
hasRight
)
{
logger
.
info
(
"无服务权限"
);
throw
new
BusinessException
(
"-1"
,
"无服务权限"
);
}
String
storeId
=
qdto
.
getStoreId
();
String
clerkId
=
qdto
.
getClerkId
();
String
memberId
=
qdto
.
getMemberId
();
Integer
contactAutoType
=
qdto
.
getContactAutoType
();
Integer
followType
=
qdto
.
getFollowType
();
Integer
bizType
=
qdto
.
getBizType
();
Integer
sourceType
=
qdto
.
getSourceType
();
Long
sourceLogId
=
qdto
.
getSourceLogId
();
DateTime
date
=
DateUtil
.
date
();
MemberStoreClerkDTO
memberStoreClerk
=
memberService
.
getMemberStoreClerk
(
memberId
);
if
(
memberStoreClerk
==
null
)
{
...
...
@@ -137,7 +182,7 @@ public class ContactLogServiceImpl implements ContactLogService {
ClerkDTO
clerkDTO
=
clerkService
.
getClerkByClerkId
(
clerkId
);
// 自动建联校验
if
(
contactAutoType
!=
null
)
{
boolean
contactCheck
=
contactCheck
(
enterpriseId
,
memberId
,
clerkDTO
);
boolean
contactCheck
=
contactCheck
(
enterpriseId
,
memberId
,
clerkDTO
,
bizType
);
logger
.
info
(
"非潜客未建联或建联未转化:{}"
,
contactCheck
);
if
(!
contactCheck
)
{
throw
new
BusinessException
(
"-1"
,
"非潜客未建联或建联未转化,无法建联"
);
...
...
@@ -147,11 +192,13 @@ public class ContactLogServiceImpl implements ContactLogService {
Integer
contactCycle
=
1
;
// 建联周期 14天内同周期/14天以上周期+1
Integer
contactCycleFirst
=
Constant
.
FLAG_TRUE
;
TabContactLog
lastContactLog
=
contactLogMapper
.
queryLastLog
(
memberId
,
clerkId
,
null
,
null
);
Map
<
Integer
,
TabContactLog
>
contactLogMap
=
getLastByTime
(
memberId
,
clerkId
,
null
,
null
);
TabContactLog
lastContactLog
=
contactLogMap
.
get
(
bizType
);
Date
lastContactTime
=
null
;
if
(
lastContactLog
!=
null
)
{
Date
c
ontactTime
=
lastContactLog
.
getContactTime
();
Integer
contactOrderLimitDay
=
getContactOrderLimitDay
(
c
ontactTime
);
if
(
DateUtil
.
between
(
date
,
c
ontactTime
,
DateUnit
.
SECOND
)
>
contactOrderLimitDay
*
24
*
60
*
60
)
{
lastC
ontactTime
=
lastContactLog
.
getContactTime
();
Integer
contactOrderLimitDay
=
getContactOrderLimitDay
(
lastC
ontactTime
);
if
(
DateUtil
.
between
(
date
,
lastC
ontactTime
,
DateUnit
.
SECOND
)
>
contactOrderLimitDay
*
24
*
60
*
60
)
{
contactCycle
=
lastContactLog
.
getContactCycle
()
+
1
;
}
else
{
contactCycle
=
lastContactLog
.
getContactCycle
();
...
...
@@ -159,8 +206,11 @@ public class ContactLogServiceImpl implements ContactLogService {
}
}
logger
.
info
(
"建联周期:{},是否周期内首次:{}"
,
contactCycle
,
contactCycleFirst
);
// 获取当前建联时间和上一次建联时间之间的跟进类型
String
followTypes
=
contactFollowMapper
.
getFollowTypes
(
enterpriseId
,
clerkId
,
memberId
,
lastContactTime
,
date
);
TabContactLog
contactLog
=
new
TabContactLog
();
contactLog
.
setFollowTypes
(
followTypes
);
contactLog
.
setClerkId
(
clerkId
);
contactLog
.
setStoreId
(
storeId
);
if
(
clerkDTO
!=
null
)
{
...
...
@@ -175,7 +225,8 @@ public class ContactLogServiceImpl implements ContactLogService {
contactLog
.
setStoreCode
(
store
.
getStoreCode
());
}
}
contactLog
.
setLogId
(
UniqueIdUtils
.
uniqueLong
());
Long
logId
=
UniqueIdUtils
.
uniqueLong
();
contactLog
.
setLogId
(
logId
);
contactLog
.
setMemberId
(
memberId
);
contactLog
.
setContactStatus
(
Constant
.
FLAG_TRUE
);
contactLog
.
setContactTime
(
date
);
...
...
@@ -183,12 +234,66 @@ public class ContactLogServiceImpl implements ContactLogService {
contactLog
.
setContactCycleFirst
(
contactCycleFirst
);
// 成为潜客时间 无用暂不写
contactLog
.
setPotentialTime
(
null
);
contactLog
.
setSourceType
(
sourceType
);
contactLog
.
setBizType
(
bizType
);
contactLog
.
setEnterpriseId
(
enterpriseId
);
contactLog
.
setSourceLogId
(
sourceLogId
);
contactLogMapper
.
insert
(
contactLog
);
// 刷新es建联时间
Long
clerkContactTime
=
Long
.
parseLong
(
DateUtil
.
format
(
date
,
DatePattern
.
PURE_DATETIME_PATTERN
));
refreshContactTime
(
enterpriseId
,
memberId
,
clerkContactTime
);
return
contactLog
;
refreshContactTime
(
enterpriseId
,
memberId
,
bizType
,
clerkContactTime
);
// 建联跟进记录
String
followRemark
=
qdto
.
getFollowRemark
();
if
(
StringUtils
.
isNotBlank
(
followRemark
))
{
ContactFollowQDTO
followQDTO
=
EntityUtil
.
changeEntityNew
(
ContactFollowQDTO
.
class
,
qdto
);
followQDTO
.
setFollowType
(
followType
);
followQDTO
.
setFollowTime
(
date
);
followQDTO
.
setBizId
(
String
.
valueOf
(
logId
));
contactFollowService
.
saveFollow
(
followQDTO
);
}
// 同步建联
syncContactSend
(
contactLog
);
// 冗余机会人群数据
if
(
Objects
.
equals
(
bizType
,
ContactBizTypeEnum
.
OPPORTUNITY_CUSTOMER
.
getType
()))
{
modifyBizData
(
memberId
,
clerkId
,
enterpriseId
,
logId
);
}
}
/**
* 冗余机会人群数据
* @param memberId
* @param clerkId
* @param enterpriseId
* @param logId
*/
private
void
modifyBizData
(
String
memberId
,
String
clerkId
,
String
enterpriseId
,
Long
logId
)
{
try
{
ServiceResponse
<
List
<
String
>>
crowdTypeResponse
=
objectivesManageApiService
.
getMemberCrowdType
(
memberId
,
clerkId
,
enterpriseId
);
List
<
String
>
result
=
crowdTypeResponse
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
result
))
{
TabContactLog
modifyContactLog
=
new
TabContactLog
();
modifyContactLog
.
setLogId
(
logId
);
modifyContactLog
.
setBizData
(
JSON
.
toJSONString
(
result
));
contactLogMapper
.
update
(
modifyContactLog
);
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"冗余人群数据错误!"
,
e
);
}
}
private
void
syncContactSend
(
TabContactLog
contactLog
)
{
// 同步建联
ContactLogQDTO
contactLogQDTO
=
EntityUtil
.
changeEntityNew
(
ContactLogQDTO
.
class
,
contactLog
);
contactLogQDTO
.
setContactAutoType
(
null
);
contactLogQDTO
.
setSourceLogId
(
contactLog
.
getLogId
());
String
message
=
JSON
.
toJSONString
(
contactLogQDTO
);
String
routerName
=
"autoContactLogForMQ"
;
try
{
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
clientInstance
.
sendMessage
(
routerName
,
message
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"发送错误!路由规则名称:"
+
routerName
+
",message:"
+
message
,
e
);
}
}
/**
...
...
@@ -210,10 +315,6 @@ public class ContactLogServiceImpl implements ContactLogService {
if
(
qdto
==
null
)
{
return
;
}
boolean
hasRight
=
enterpriseAdaptor
.
checkEnterpriseHasRight
(
qdto
.
getEnterpriseId
(),
EnterpriseServiceEnum
.
POTENTIAL
.
getRightMenuCode
());
if
(!
hasRight
)
{
return
;
}
String
enterpriseId
=
qdto
.
getEnterpriseId
();
Integer
contactAutoType
=
qdto
.
getContactAutoType
();
ContactConfigDTO
contactConfig
=
contactConfigService
.
getContactConfig
(
enterpriseId
);
...
...
@@ -227,17 +328,9 @@ public class ContactLogServiceImpl implements ContactLogService {
}
logger
.
info
(
"自动建联:{}"
,
JSON
.
toJSONString
(
qdto
));
try
{
TabContactLog
contactLog
=
saveContactLog
(
qdto
);
// 写入自动建联跟进记录
ContactFollowQDTO
followQDTO
=
new
ContactFollowQDTO
();
followQDTO
.
setMemberId
(
contactLog
.
getMemberId
());
followQDTO
.
setClerkId
(
contactLog
.
getClerkId
());
followQDTO
.
setClerkCode
(
contactLog
.
getClerkCode
());
followQDTO
.
setFollowType
(
ContactFollowTypeEnum
.
AUTO_CONTACT
.
getCode
());
followQDTO
.
setFollowRemark
(
"因"
+
ContactAutoTypeEnum
.
fromCode
(
contactAutoType
).
getDescription
()
+
",系统自动标记了建联"
);
followQDTO
.
setFollowTime
(
DateUtil
.
date
());
followQDTO
.
setEnterpriseId
(
enterpriseId
);
contactFollowService
.
saveFollow
(
followQDTO
);
qdto
.
setFollowType
(
ContactFollowTypeEnum
.
AUTO_CONTACT
.
getCode
());
qdto
.
setFollowRemark
(
"因"
+
ContactAutoTypeEnum
.
fromCode
(
contactAutoType
).
getDescription
()
+
",系统自动标记了建联"
);
saveContactLog
(
qdto
);
}
catch
(
BusinessException
e
)
{
logger
.
info
(
"自动建联异常:{}"
,
e
.
getMessage
());
return
;
...
...
@@ -245,37 +338,89 @@ public class ContactLogServiceImpl implements ContactLogService {
}
@Override
public
void
clearContactLog
(
String
memberId
,
Integer
clearType
,
String
clerkId
)
{
public
void
syncContactLog
(
ContactLogQDTO
qdto
)
{
if
(
qdto
==
null
)
{
return
;
}
Integer
sourceType
=
qdto
.
getSourceType
();
if
(
Objects
.
isNull
(
sourceType
))
{
return
;
}
logger
.
info
(
"同步建联:{}"
,
JSON
.
toJSONString
(
qdto
));
Integer
bizType
=
qdto
.
getBizType
();
for
(
ContactBizTypeEnum
bizTypeEnum
:
ContactBizTypeEnum
.
values
())
{
Integer
syncBizType
=
bizTypeEnum
.
getType
();
if
(
Objects
.
equals
(
bizType
,
syncBizType
))
{
continue
;
}
ContactLogQDTO
syncQdto
=
EntityUtil
.
changeEntityNew
(
ContactLogQDTO
.
class
,
qdto
);
syncQdto
.
setBizType
(
syncBizType
);
syncQdto
.
setSourceType
(
sourceType
);
try
{
saveContactLog
(
syncQdto
);
}
catch
(
BusinessException
e
)
{
logger
.
info
(
"同步建联异常:{}"
,
e
.
getMessage
());
}
}
}
@Override
public
void
clearContactLog
(
String
enterpriseId
,
String
memberId
,
Integer
clearType
,
String
clerkId
)
{
logger
.
info
(
"清除建联状态:{},clearType:{},clerkId:{}"
,
memberId
,
clearType
,
clerkId
);
TabContactLog
lastContactLog
=
contactLogMapper
.
queryLastLog
(
memberId
,
null
,
null
,
null
);
if
(
lastContactLog
==
null
)
{
Map
<
Integer
,
TabContactLog
>
contactLogMap
=
getLastByTime
(
memberId
,
null
,
null
,
null
);
if
(
contactLogMap
==
null
||
contactLogMap
.
isEmpty
()
)
{
return
;
}
contactLogMap
.
forEach
((
k
,
v
)->{
// clearType 1 消费清除 2 换绑主导购(不清除表建联状态)
if
(
Objects
.
equals
(
clearType
,
1
))
{
TabContactLog
update
=
new
TabContactLog
();
update
.
setLogId
(
lastContactLog
.
getLogId
());
update
.
setLogId
(
v
.
getLogId
());
update
.
setContactStatus
(
Constant
.
FLAG_FALSE
);
contactLogMapper
.
update
(
update
);
}
else
if
(
Objects
.
equals
(
clearType
,
2
))
{
String
lastClerkId
=
lastContactLog
.
getClerkId
();
String
lastClerkId
=
v
.
getClerkId
();
if
(
Objects
.
equals
(
lastClerkId
,
clerkId
))
{
logger
.
info
(
"最后一次建联和换绑导购一致则不清除建联"
);
return
;
}
}
// 清除es建联时间 -1
refreshContactTime
(
lastContactLog
.
getEnterpriseId
(),
memberId
,
-
1L
);
// 清除es建联时间
refreshContactTime
(
enterpriseId
,
memberId
,
k
,
-
1L
);
});
}
private
void
refreshContactTime
(
String
enterpriseId
,
String
memberId
,
Long
contactTime
)
{
private
void
refreshContactTime
(
String
enterpriseId
,
String
memberId
,
Integer
bizType
,
Long
contactTime
)
{
JSONObject
memberJO
=
esMemberInfoService
.
queryDataSingle
(
enterpriseId
,
memberId
,
"clerkContactTime"
);
if
(
memberJO
==
null
)
{
return
;
}
List
<
Long
>
clerkContactTimeList
=
memberJO
.
getObject
(
"clerkContactTime"
,
new
TypeReference
<
List
<
Long
>>(){});
if
(
bizType
==
null
)
{
clerkContactTimeList
=
Arrays
.
stream
(
ContactBizTypeEnum
.
values
())
.
map
(
bizTypeEnum
->
bizTypeEnum
.
getEsClerkContactTime
(
contactTime
))
.
filter
(
Objects:
:
nonNull
)
.
collect
(
Collectors
.
toList
());
}
else
{
ContactBizTypeEnum
bizTypeEnum
=
ContactBizTypeEnum
.
fromType
(
bizType
);
Long
bizContactTime
=
bizTypeEnum
.
getEsClerkContactTime
(
contactTime
);
clerkContactTimeList
=
clerkContactTimeList
.
stream
().
map
(
time
->
{
if
(
String
.
valueOf
(
time
).
startsWith
(
bizTypeEnum
.
getCodePre
()))
{
return
bizContactTime
;
}
else
{
return
time
;
}
}).
filter
(
Objects:
:
nonNull
)
.
collect
(
Collectors
.
toList
());
}
logger
.
info
(
"刷新建联时间:{},memberId:{}"
,
clerkContactTimeList
,
memberId
);
DynamicDocDTO
dynamicDocDTO
=
new
DynamicDocDTO
();
dynamicDocDTO
.
setEnterpriseId
(
enterpriseId
);
dynamicDocDTO
.
setColumnCategoryCode
(
"member"
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"id"
,
memberId
);
jsonObject
.
put
(
"memberId"
,
memberId
);
jsonObject
.
put
(
"clerkContactTime"
,
c
ontactTime
);
jsonObject
.
put
(
"clerkContactTime"
,
c
lerkContactTimeList
);
dynamicDocDTO
.
setDocJson
(
jsonObject
);
dynamicDocDTO
.
setRefresh
(
Constant
.
FLAG_TRUE
);
ESResponse
res
=
esDataDynamicOperationApiService
.
updateDataSingle
(
dynamicDocDTO
,
false
);
...
...
@@ -284,7 +429,11 @@ public class ContactLogServiceImpl implements ContactLogService {
@Override
public
TabContactLog
getClerkContactTime
(
String
memberId
)
{
TabContactLog
lastContactLog
=
contactLogMapper
.
queryLastLog
(
memberId
,
null
,
null
,
null
);
Map
<
Integer
,
TabContactLog
>
contactMap
=
getLastByTime
(
memberId
,
null
,
null
,
null
);
if
(
contactMap
==
null
||
contactMap
.
isEmpty
())
{
return
null
;
}
TabContactLog
lastContactLog
=
contactMap
.
get
(
ContactBizTypeEnum
.
POTENTIAL_CUSTOMER
.
getType
());
if
(
lastContactLog
==
null
)
{
return
null
;
}
...
...
@@ -310,7 +459,42 @@ public class ContactLogServiceImpl implements ContactLogService {
}
@Override
public
TabContactLog
getLastByTime
(
String
memberId
,
Date
beginTime
,
Date
endTime
)
{
return
contactLogMapper
.
queryLastLog
(
memberId
,
null
,
beginTime
,
endTime
);
public
List
<
TabContactLog
>
getClerkContactTimeList
(
String
memberId
)
{
Map
<
Integer
,
TabContactLog
>
contactMap
=
getLastByTime
(
memberId
,
null
,
null
,
null
);
if
(
contactMap
==
null
||
contactMap
.
isEmpty
())
{
return
null
;
}
List
<
TabContactLog
>
list
=
new
ArrayList
<>();
contactMap
.
forEach
((
k
,
lastContactLog
)->{
Integer
contactStatus
=
lastContactLog
.
getContactStatus
();
if
(
Objects
.
equals
(
contactStatus
,
Constant
.
FLAG_FALSE
))
{
return
;
}
String
clerkId
=
lastContactLog
.
getClerkId
();
Date
contactTime
=
lastContactLog
.
getContactTime
();
MemberStoreClerkDTO
memberStoreClerk
=
memberService
.
getMemberStoreClerk
(
memberId
);
if
(
memberStoreClerk
==
null
)
{
return
;
}
logger
.
info
(
"建联导购id:{},专属导购id:{}"
,
clerkId
,
memberStoreClerk
.
getClerkId
());
if
(!
Objects
.
equals
(
clerkId
,
memberStoreClerk
.
getClerkId
()))
{
return
;
}
Integer
contactOrderLimitDay
=
getContactOrderLimitDay
(
contactTime
);
if
(
DateUtil
.
compare
(
contactTime
,
DateUtil
.
date
().
offset
(
DateField
.
DAY_OF_MONTH
,
-
contactOrderLimitDay
))
<
0
)
{
return
;
}
list
.
add
(
lastContactLog
);
});
return
list
;
}
@Override
public
Map
<
Integer
,
TabContactLog
>
getLastByTime
(
String
memberId
,
String
clerkId
,
Date
beginTime
,
Date
endTime
)
{
List
<
TabContactLog
>
list
=
contactLogMapper
.
queryLastLog
(
memberId
,
clerkId
,
beginTime
,
endTime
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
new
HashMap
<>();
}
return
list
.
stream
().
collect
(
Collectors
.
toMap
(
TabContactLog:
:
getBizType
,
v
->
v
,
(
e
,
x
)
->
e
));
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/contact/impl/ContactOrderServiceImpl.java
View file @
ab9f41af
...
...
@@ -91,10 +91,16 @@ public class ContactOrderServiceImpl implements ContactOrderService {
contactBeginTime
=
DateUtil
.
offsetDay
(
receiptsDate
,
-
1
);
}
TabContactLog
lastContactLog
=
contactLogService
.
getLastByTime
(
memberId
,
contactBeginTime
,
receiptsDate
);
if
(
lastContactLog
==
null
)
{
Map
<
Integer
,
TabContactLog
>
contactMap
=
contactLogService
.
getLastByTime
(
memberId
,
null
,
contactBeginTime
,
receiptsDate
);
if
(
contactMap
==
null
||
contactMap
.
isEmpty
()
)
{
return
false
;
}
for
(
Map
.
Entry
<
Integer
,
TabContactLog
>
entry
:
contactMap
.
entrySet
())
{
Integer
key
=
entry
.
getKey
();
TabContactLog
lastContactLog
=
entry
.
getValue
();
if
(
lastContactLog
==
null
)
{
continue
;
}
logger
.
info
(
"建联转化订单建联信息:{}"
,
JSON
.
toJSONString
(
lastContactLog
));
TabContactOrder
contactOrder
=
new
TabContactOrder
();
contactOrder
.
setOrderId
(
orderId
);
...
...
@@ -122,6 +128,8 @@ public class ContactOrderServiceImpl implements ContactOrderService {
contactOrder
.
setContactLogId
(
lastContactLog
.
getLogId
());
contactOrder
.
setContactTime
(
lastContactLog
.
getContactTime
());
contactOrder
.
setPotentialTime
(
lastContactLog
.
getPotentialTime
());
contactOrder
.
setSourceType
(
lastContactLog
.
getSourceType
());
contactOrder
.
setBizType
(
lastContactLog
.
getBizType
());
contactOrder
.
setEnterpriseId
(
lastContactLog
.
getEnterpriseId
());
JSONObject
jsonObject
=
esMemberInfoService
.
queryDataSingle
(
enterpriseId
,
memberId
,
"potentialScore"
);
...
...
@@ -129,6 +137,7 @@ public class ContactOrderServiceImpl implements ContactOrderService {
contactOrder
.
setPotentialScore
(
jsonObject
.
getInteger
(
"potentialScore"
));
}
contactOrderMapper
.
insert
(
contactOrder
);
}
return
true
;
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/content/adaptor/EnterpriseAdaptor.java
View file @
ab9f41af
...
...
@@ -6,6 +6,7 @@ import com.gic.enterprise.api.constant.EnterpriseServiceEnum;
import
com.gic.enterprise.api.dto.EnterpriseUsingPermissionDto
;
import
com.gic.enterprise.api.dto.enterprise.EnterpriseUsingStatusDTO
;
import
com.gic.enterprise.api.service.EnterpriseUseForbidService
;
import
com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.google.common.collect.Lists
;
import
lombok.AllArgsConstructor
;
...
...
@@ -134,6 +135,17 @@ public class EnterpriseAdaptor {
return
StringUtils
.
equals
(
cache
,
"1"
);
}
public
boolean
checkEnterpriseHasRightByContactBizType
(
String
enterpriseId
,
Integer
contactBizType
)
{
if
(
Objects
.
equals
(
contactBizType
,
ContactBizTypeEnum
.
POTENTIAL_CUSTOMER
.
getType
()))
{
return
checkEnterpriseHasRights
(
enterpriseId
,
Lists
.
newArrayList
(
EnterpriseServiceEnum
.
POTENTIAL
.
getRightMenuCode
()));
}
else
if
(
Objects
.
equals
(
contactBizType
,
ContactBizTypeEnum
.
OPPORTUNITY_CUSTOMER
.
getType
()))
{
return
checkEnterpriseHasRights
(
enterpriseId
,
Lists
.
newArrayList
(
EnterpriseServiceEnum
.
OBJECTIVES
.
getRightMenuCode
()));
}
else
{
return
checkEnterpriseHasRights
(
enterpriseId
,
Lists
.
newArrayList
(
EnterpriseServiceEnum
.
POTENTIAL
.
getRightMenuCode
()))
||
checkEnterpriseHasRights
(
enterpriseId
,
Lists
.
newArrayList
(
EnterpriseServiceEnum
.
OBJECTIVES
.
getRightMenuCode
()));
}
}
public
boolean
checkEnterpriseHasRight
(
String
enterpriseId
,
String
rightMenuCode
)
{
return
checkEnterpriseHasRights
(
enterpriseId
,
Lists
.
newArrayList
(
rightMenuCode
));
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/common/RouterApiServiceImpl.java
View file @
ab9f41af
...
...
@@ -31,12 +31,13 @@ public class RouterApiServiceImpl implements RouterApiService {
return
ServiceResponse
.
success
();
}
ClerkAddEventParam
clerkAddEventParam
=
JSONObject
.
parseObject
(
params
,
ClerkAddEventParam
.
class
);
String
enterpriseId
=
clerkAddEventParam
.
getEnterpriseId
();
String
memberId
=
clerkAddEventParam
.
getMemberId
();
Integer
changeType
=
clerkAddEventParam
.
getChangeType
();
String
clerkId
=
clerkAddEventParam
.
getClerkId
();
if
(
Objects
.
equals
(
changeType
,
1
))
{
// 换绑主导购清除建联状态
contactLogService
.
clearContactLog
(
memberId
,
2
,
clerkId
);
contactLogService
.
clearContactLog
(
enterpriseId
,
memberId
,
2
,
clerkId
);
}
return
ServiceResponse
.
success
();
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/contact/ContactLogApiServiceImpl.java
View file @
ab9f41af
...
...
@@ -16,6 +16,9 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Created by wangzubo on 2022/11/1.
*/
...
...
@@ -35,6 +38,16 @@ public class ContactLogApiServiceImpl implements ContactLogApiService {
}
@Override
public
ServiceResponse
<
List
<
ContactLogDTO
>>
getClerkContactTimeList
(
String
memberId
)
{
List
<
TabContactLog
>
list
=
contactLogService
.
getClerkContactTimeList
(
memberId
);
if
(
list
==
null
)
{
return
ServiceResponse
.
success
(
new
ArrayList
<>());
}
List
<
ContactLogDTO
>
dtos
=
EntityUtil
.
changeEntityListNew
(
ContactLogDTO
.
class
,
list
);
return
ServiceResponse
.
success
(
dtos
);
}
@Override
public
ServiceResponse
<
Void
>
saveContactLog
(
ContactLogQDTO
qdto
)
{
try
{
contactLogService
.
saveContactLog
(
qdto
);
...
...
@@ -50,7 +63,12 @@ public class ContactLogApiServiceImpl implements ContactLogApiService {
return
ServiceResponse
.
success
();
}
ContactLogQDTO
contactLogQDTO
=
JSONObject
.
parseObject
(
message
,
ContactLogQDTO
.
class
);
Integer
contactAutoType
=
contactLogQDTO
.
getContactAutoType
();
if
(
contactAutoType
!=
null
)
{
contactLogService
.
autoContactLog
(
contactLogQDTO
);
}
else
{
contactLogService
.
syncContactLog
(
contactLogQDTO
);
}
return
ServiceResponse
.
success
();
}
...
...
@@ -60,7 +78,7 @@ public class ContactLogApiServiceImpl implements ContactLogApiService {
if
(
clerkDTO
==
null
)
{
return
ServiceResponse
.
success
(
Boolean
.
FALSE
);
}
boolean
check
=
contactLogService
.
contactCheck
(
checkQDTO
.
getEnterpriseId
(),
checkQDTO
.
getMemberId
(),
clerkDTO
);
boolean
check
=
contactLogService
.
contactCheck
(
checkQDTO
.
getEnterpriseId
(),
checkQDTO
.
getMemberId
(),
clerkDTO
,
checkQDTO
.
getBizType
()
);
return
ServiceResponse
.
success
(
check
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/contact/ContactOrderApiServiceImpl.java
View file @
ab9f41af
...
...
@@ -41,7 +41,7 @@ public class ContactOrderApiServiceImpl implements ContactOrderApiService {
OrderInfoResp
result
=
serviceResponse
.
getResult
();
boolean
contactOrder
=
contactOrderService
.
saveContactOrder
(
result
);
if
(
contactOrder
)
{
contactLogService
.
clearContactLog
(
memberId
,
1
,
""
);
contactLogService
.
clearContactLog
(
enterpriseId
,
memberId
,
1
,
""
);
}
return
ServiceResponse
.
success
();
}
...
...
haoban-manage3-service/src/main/resources/dubbo-haoban-manage-service.xml
View file @
ab9f41af
...
...
@@ -180,6 +180,9 @@
<dubbo:reference
id=
"customerApiService"
interface=
"com.gic.haoban.app.customer.service.api.service.CustomerApiService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
<dubbo:reference
id=
"objectivesManageApiService"
interface=
"com.gic.haoban.app.objectives.api.service.ObjectivesManageApiService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
<dubbo:reference
id=
"qywxTagSyncApiService"
interface=
"com.gic.haoban.app.customer.service.api.service.QywxTagSyncApiService"
timeout=
"10000"
...
...
haoban-manage3-service/src/main/resources/mapper/contact/TabContactFollowMapper.xml
View file @
ab9f41af
...
...
@@ -14,6 +14,9 @@
<result
column=
"follow_material"
property=
"followMaterial"
/>
<result
column=
"goods_info"
property=
"goodsInfo"
/>
<result
column=
"follow_time"
property=
"followTime"
/>
<result
column=
"source_type"
property=
"sourceType"
/>
<result
column=
"biz_type"
property=
"bizType"
/>
<result
column=
"biz_id"
property=
"bizId"
/>
<result
column=
"enterprise_id"
property=
"enterpriseId"
/>
<result
column=
"delete_flag"
property=
"deleteFlag"
/>
<result
column=
"create_time"
property=
"createTime"
/>
...
...
@@ -21,10 +24,10 @@
</resultMap>
<sql
id=
"Base_Column_List"
>
follow_id, member_id, clerk_id, clerk_code, follow_type,follow_remark, follow_material, goods_info, follow_time, enterprise_id, delete_flag, create_time, update_time
follow_id, member_id, clerk_id, clerk_code, follow_type,follow_remark, follow_material, goods_info, follow_time,
source_type,biz_type,biz_id,
enterprise_id, delete_flag, create_time, update_time
</sql>
<sql
id=
"Alias_Base_Column_List"
>
t.follow_id, t.member_id, t.clerk_id, t.clerk_code, t.follow_type,t.follow_remark, t.follow_material, t.goods_info, t.follow_time, t.enterprise_id, t.delete_flag, t.create_time, t.update_time
t.follow_id, t.member_id, t.clerk_id, t.clerk_code, t.follow_type,t.follow_remark, t.follow_material, t.goods_info, t.follow_time,
t.source_type,t.biz_type,t.biz_id,
t.enterprise_id, t.delete_flag, t.create_time, t.update_time
</sql>
<select
id=
"queryById"
resultMap=
"BaseResultMap"
>
...
...
@@ -44,6 +47,29 @@
</foreach>
</select>
<select
id=
"getFollowTypes"
resultType=
"java.lang.String"
>
SELECT
GROUP_CONCAT(DISTINCT follow_type)
FROM tab_contact_follow
<where>
enterprise_id = #{enterpriseId}
AND follow_type not in (5,6)
<if
test=
"memberId != null"
>
AND member_id = #{memberId}
</if>
<if
test=
"clerkId != null"
>
AND clerk_id = #{clerkId}
</if>
<if
test=
"beginTime != null"
>
AND follow_time > #{beginTime}
</if>
<if
test=
"endTime != null"
>
AND follow_time
<![CDATA[<=]]>
#{endTime}
</if>
</where>
group by member_id
</select>
<select
id=
"count"
resultType=
"long"
>
SELECT COUNT(*)
FROM tab_contact_follow
...
...
@@ -109,16 +135,27 @@
</select>
<insert
id=
"insert"
useGeneratedKeys=
"true"
keyProperty=
"followId"
>
INSERT INTO tab_contact_follow (member_id, clerk_id, clerk_code,follow_type, follow_remark, follow_material, goods_info, follow_time, enterprise_id, delete_flag, create_time, update_time)
VALUES (#{memberId}, #{clerkId}, #{clerkCode},#{followType}, #{followRemark}, #{followMaterial}, #{goodsInfo}, #{followTime}, #{enterpriseId}, #{deleteFlag}, #{createTime}, #{updateTime})
INSERT INTO tab_contact_follow (member_id, clerk_id, clerk_code,follow_type, follow_remark, follow_material, goods_info, follow_time,
source_type,biz_type,biz_id,
enterprise_id, delete_flag, create_time, update_time)
VALUES (#{memberId}, #{clerkId}, #{clerkCode},#{followType}, #{followRemark}, #{followMaterial}, #{goodsInfo}, #{followTime},
#{sourceType},#{bizType},#{bizId},
#{enterpriseId}, #{deleteFlag}, #{createTime}, #{updateTime})
</insert>
<insert
id=
"insertBatch"
>
INSERT INTO tab_contact_follow (follow_id,member_id, clerk_id, clerk_code,follow_type, follow_remark, follow_material, goods_info, follow_time, enterprise_id)
INSERT INTO tab_contact_follow (
follow_id, member_id, clerk_id, clerk_code,
follow_type, follow_remark, follow_material,
goods_info, follow_time, source_type, biz_type, biz_id, enterprise_id
)
VALUES
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(#{item.followId},#{item.memberId}, #{item.clerkId}, #{item.clerkCode}, #{item.followType},#{item.followRemark}, #{item.followMaterial}, #{item.goodsInfo}, #{item.followTime}, #{item.enterpriseId})
(#{item.followId}, #{item.memberId}, #{item.clerkId}, #{item.clerkCode},
#{item.followType}, #{item.followRemark}, #{item.followMaterial},
#{item.goodsInfo}, #{item.followTime}, #{sourceType}, #{bizType}, #{bizId}, #{item.enterpriseId})
</foreach>
ON DUPLICATE KEY UPDATE
biz_type = CASE
WHEN VALUES(biz_id) IS NOT NULL THEN biz_type + VALUES(biz_type)
ELSE biz_type
END
</insert>
<update
id=
"update"
>
...
...
@@ -132,6 +169,9 @@
<if
test=
"followMaterial != null"
>
follow_material = #{followMaterial},
</if>
<if
test=
"goodsInfo != null"
>
goods_info = #{goodsInfo},
</if>
<if
test=
"followTime != null"
>
follow_time = #{followTime},
</if>
<if
test=
"bizType != null"
>
biz_type = #{bizType},
</if>
<if
test=
"bizId != null"
>
biz_id = #{bizId},
</if>
<if
test=
"source_type != null"
>
source_type = #{sourceType},
</if>
<if
test=
"enterpriseId != null"
>
enterprise_id = #{enterpriseId},
</if>
<if
test=
"deleteFlag != null"
>
delete_flag = #{deleteFlag},
</if>
update_time = #{updateTime}
...
...
haoban-manage3-service/src/main/resources/mapper/contact/TabContactLogMapper.xml
View file @
ab9f41af
...
...
@@ -14,6 +14,11 @@
<result
property=
"contactCycle"
column=
"contact_cycle"
jdbcType=
"INTEGER"
/>
<result
property=
"contactCycleFirst"
column=
"contact_cycle_first"
jdbcType=
"INTEGER"
/>
<result
property=
"potentialTime"
column=
"potential_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"sourceType"
column=
"source_type"
jdbcType=
"INTEGER"
/>
<result
property=
"sourceLogId"
column=
"source_log_id"
jdbcType=
"BIGINT"
/>
<result
property=
"bizType"
column=
"biz_type"
jdbcType=
"INTEGER"
/>
<result
property=
"bizData"
column=
"biz_data"
jdbcType=
"VARCHAR"
/>
<result
property=
"followTypes"
column=
"follow_types"
jdbcType=
"VARCHAR"
/>
<result
property=
"enterpriseId"
column=
"enterprise_id"
jdbcType=
"VARCHAR"
/>
<result
property=
"deleteFlag"
column=
"delete_flag"
jdbcType=
"INTEGER"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
...
...
@@ -39,19 +44,41 @@
</select>
<select
id=
"queryLastLog"
resultMap=
"TabContactLogMap"
>
select *
from tab_contact_log
where delete_flag = 0 and member_id = #{memberId}
SELECT t1.*
FROM tab_contact_log t1
INNER JOIN (
SELECT biz_type, MAX(contact_time) AS max_contact_time
FROM tab_contact_log
WHERE delete_flag = 0
<if
test=
"memberId != null"
>
AND member_id = #{memberId}
</if>
<if
test=
"clerkId!=null and clerkId!=''"
>
and clerk_id = #{clerkId}
AND clerk_id = #{clerkId}
</if>
<if
test=
"beginTime != null"
>
AND contact_time >= #{beginTime}
</if>
<if
test=
"endTime != null"
>
AND contact_time
<![CDATA[<=]]>
#{endTime}
</if>
GROUP BY biz_type
) t2
ON t1.biz_type = t2.biz_type AND t1.contact_time = t2.max_contact_time
WHERE t1.delete_flag = 0
<if
test=
"memberId != null"
>
AND t1.member_id = #{memberId}
</if>
<if
test=
"beginTime!=null "
>
and contact_time >= #{beginTime}
<if
test=
"clerkId!=null and clerkId!=''"
>
AND t1.clerk_id = #{clerkId}
</if>
<if
test=
"beginTime != null"
>
AND t1.contact_time >= #{beginTime}
</if>
<if
test=
"endTime
!=null
"
>
and
contact_time
<![CDATA[<=]]>
#{endTime}
<if
test=
"endTime
!= null
"
>
AND t1.
contact_time
<![CDATA[<=]]>
#{endTime}
</if>
order by contact_time desc,log_id desc limit 1
ORDER BY t1.biz_type ASC,t1.contact_time desc,t1.log_id desc
</select>
<!--查询列表-->
...
...
@@ -128,6 +155,11 @@
contact_cycle,
contact_cycle_first,
potential_time,
source_type,
source_log_id,
biz_type,
biz_data,
follow_types,
enterprise_id
)
values (
...
...
@@ -143,6 +175,11 @@
#{contactCycle},
#{contactCycleFirst},
#{potentialTime},
#{sourceType},
#{sourceLogId},
#{bizType},
#{bizData},
#{followTypes},
#{enterpriseId})
</insert>
...
...
@@ -183,6 +220,21 @@
<if
test=
"potentialTime != null"
>
potential_time = #{potentialTime},
</if>
<if
test=
"sourceType != null"
>
source_type = #{sourceType},
</if>
<if
test=
"sourceLogId != null"
>
source_log_id = #{sourceLogId},
</if>
<if
test=
"bizType != null"
>
biz_type = #{bizType},
</if>
<if
test=
"bizData != null"
>
biz_data = #{bizData},
</if>
<if
test=
"followTypes != null"
>
follow_types = #{followTypes},
</if>
<if
test=
"enterpriseId != null and enterpriseId != ''"
>
enterprise_id = #{enterpriseId},
</if>
...
...
haoban-manage3-service/src/main/resources/mapper/contact/TabContactOrderMapper.xml
View file @
ab9f41af
...
...
@@ -24,6 +24,8 @@
<result
column=
"contact_time"
property=
"contactTime"
/>
<result
column=
"potential_time"
property=
"potentialTime"
/>
<result
column=
"potential_score"
property=
"potentialScore"
/>
<result
column=
"source_type"
property=
"sourceType"
/>
<result
column=
"biz_type"
property=
"bizType"
/>
<result
column=
"delete_flag"
property=
"deleteFlag"
/>
<result
column=
"enterprise_id"
property=
"enterpriseId"
/>
<result
column=
"create_time"
property=
"createTime"
/>
...
...
@@ -31,7 +33,7 @@
</resultMap>
<sql
id=
"Base_Column_List"
>
id, order_id, member_id, order_number, paid_amount, product_count, goods_info, pay_time, receipts_date, channel_code, channel_type, clerk_id, clerk_code,clerk_name, store_id, contact_log_id, contact_time, potential_time, potential_score, delete_flag, enterprise_id, create_time, update_time
id, order_id, member_id, order_number, paid_amount, product_count, goods_info, pay_time, receipts_date, channel_code, channel_type, clerk_id, clerk_code,clerk_name, store_id, contact_log_id, contact_time, potential_time, potential_score,
source_type,biz_type,
delete_flag, enterprise_id, create_time, update_time
</sql>
<select
id=
"queryById"
resultMap=
"BaseResultMap"
>
...
...
@@ -45,7 +47,7 @@
SELECT
<include
refid=
"Base_Column_List"
/>
FROM tab_contact_order
WHERE order_id = #{orderId} and delete_flag = 0
WHERE order_id = #{orderId} and delete_flag = 0
limit 1
</select>
<select
id=
"queryByIds"
resultMap=
"BaseResultMap"
>
...
...
@@ -74,6 +76,9 @@
<if
test=
"search.channelType != null"
>
AND channel_type = #{search.channelType}
</if>
<if
test=
"search.bizType != null"
>
AND biz_type = #{search.bizType}
</if>
<if
test=
"search.storeIdList != null and search.storeIdList.size() > 0"
>
AND store_id IN
<foreach
item=
"storeId"
index=
"index"
collection=
"search.storeIdList"
open=
"("
separator=
","
close=
")"
>
...
...
@@ -109,8 +114,8 @@
</select>
<insert
id=
"insert"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
INSERT INTO tab_contact_order (order_id, member_id, order_number, paid_amount, product_count, goods_info, pay_time, receipts_date, channel_code, channel_type, clerk_id, clerk_code,clerk_name, store_id, contact_log_id, contact_time, potential_time,potential_score, enterprise_id)
VALUES (#{orderId}, #{memberId}, #{orderNumber}, #{paidAmount}, #{productCount}, #{goodsInfo}, #{payTime}, #{receiptsDate}, #{channelCode}, #{channelType}, #{clerkId}, #{clerkCode},#{clerkName}, #{storeId}, #{contactLogId}, #{contactTime}, #{potentialTime}, #{potentialScore}, #{enterpriseId})
INSERT INTO tab_contact_order (order_id, member_id, order_number, paid_amount, product_count, goods_info, pay_time, receipts_date, channel_code, channel_type, clerk_id, clerk_code,clerk_name, store_id, contact_log_id, contact_time, potential_time,potential_score,
source_type,biz_type,
enterprise_id)
VALUES (#{orderId}, #{memberId}, #{orderNumber}, #{paidAmount}, #{productCount}, #{goodsInfo}, #{payTime}, #{receiptsDate}, #{channelCode}, #{channelType}, #{clerkId}, #{clerkCode},#{clerkName}, #{storeId}, #{contactLogId}, #{contactTime}, #{potentialTime}, #{potentialScore}, #{
sourceType},#{bizType},#{
enterpriseId})
</insert>
<update
id=
"update"
>
...
...
@@ -133,6 +138,8 @@
<if
test=
"contactTime != null"
>
contact_time = #{contactTime},
</if>
<if
test=
"potentialTime != null"
>
potential_time = #{potentialTime},
</if>
<if
test=
"potentialScore != null"
>
potential_score = #{potentialScore},
</if>
<if
test=
"bizType != null"
>
biz_type = #{bizType},
</if>
<if
test=
"source_type != null"
>
source_type = #{sourceType},
</if>
<if
test=
"deleteFlag != null"
>
delete_flag = #{deleteFlag},
</if>
<if
test=
"enterpriseId != null"
>
enterprise_id = #{enterpriseId},
</if>
update_time = #{updateTime}
...
...
haoban-manage3-service/src/test/java/contact/ContactTest.java
View file @
ab9f41af
...
...
@@ -102,7 +102,7 @@ public class ContactTest {
@Test
public
void
clearContactLog
()
throws
Exception
{
contactLogService
.
clearContactLog
(
memberId
,
1
,
""
);
contactLogService
.
clearContactLog
(
eid
,
memberId
,
1
,
""
);
}
@Test
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/potential/ContactController.java
View file @
ab9f41af
...
...
@@ -120,6 +120,7 @@ public class ContactController {
@RequestMapping
(
path
=
"/log"
)
public
RestResponse
<
Void
>
saveLog
(
@RequestBody
ContactLogQO
contactLogQO
)
{
ContactLogQDTO
logQDTO
=
EntityUtil
.
changeEntityNew
(
ContactLogQDTO
.
class
,
contactLogQO
);
logQDTO
.
setSourceType
(
contactLogQO
.
getBizType
());
ServiceResponse
<
Void
>
serviceResponse
=
contactLogApiService
.
saveContactLog
(
logQDTO
);
if
(!
serviceResponse
.
isSuccess
())
{
return
RestResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/qo/contact/ContactLogCheckQO.java
View file @
ab9f41af
...
...
@@ -17,6 +17,12 @@ public class ContactLogCheckQO implements Serializable {
*/
private
String
enterpriseId
;
/**
* 业务类型 1潜客(0001)2机会人群(0010)null为都校验
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private
Integer
bizType
;
public
String
getMemberId
()
{
return
memberId
;
}
...
...
@@ -40,4 +46,12 @@ public class ContactLogCheckQO implements Serializable {
public
void
setEnterpriseId
(
String
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
Integer
getBizType
()
{
return
bizType
;
}
public
void
setBizType
(
Integer
bizType
)
{
this
.
bizType
=
bizType
;
}
}
\ No newline at end of file
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/qo/contact/ContactLogQO.java
View file @
ab9f41af
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
.
contact
;
import
com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
;
import
java.io.Serializable
;
import
java.util.List
;
public
class
ContactLogQO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
973688857967269973L
;
...
...
@@ -21,6 +24,21 @@ public class ContactLogQO implements Serializable {
*/
private
String
enterpriseId
;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private
Integer
bizType
=
ContactBizTypeEnum
.
POTENTIAL_CUSTOMER
.
getType
();
/**
* 跟进记录
*/
private
String
followRemark
;
/**
* 跟进上传素材,数组格式
*/
private
List
<
String
>
followMaterialList
;
public
String
getMemberId
()
{
return
memberId
;
}
...
...
@@ -52,4 +70,28 @@ public class ContactLogQO implements Serializable {
public
void
setEnterpriseId
(
String
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
Integer
getBizType
()
{
return
bizType
;
}
public
void
setBizType
(
Integer
bizType
)
{
this
.
bizType
=
bizType
;
}
public
String
getFollowRemark
()
{
return
followRemark
;
}
public
void
setFollowRemark
(
String
followRemark
)
{
this
.
followRemark
=
followRemark
;
}
public
List
<
String
>
getFollowMaterialList
()
{
return
followMaterialList
;
}
public
void
setFollowMaterialList
(
List
<
String
>
followMaterialList
)
{
this
.
followMaterialList
=
followMaterialList
;
}
}
\ No newline at end of file
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