Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
4e5006e1
提交
4e5006e1
authored
10月 11, 2022
作者:
沈振路
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
客服-活动
上级
bd36ced5
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
215 行增加
和
14 行删除
+215
-14
CustomerServiceCommonAsyncComponent.java
...tomer/components/CustomerServiceCommonAsyncComponent.java
+63
-7
CustomerCommonConstant.java
...m/yaoyaozw/customer/constants/CustomerCommonConstant.java
+4
-0
CustomerReferralDTO.java
...m/yaoyaozw/customer/dto/customer/CustomerReferralDTO.java
+1
-1
CustomerStoreTemplateEnum.java
...om/yaoyaozw/customer/enums/CustomerStoreTemplateEnum.java
+50
-0
ReferralFeignClient.java
...ava/com/yaoyaozw/customer/feigns/ReferralFeignClient.java
+14
-0
KanbanCommonMapper.java
...java/com/yaoyaozw/customer/mapper/KanbanCommonMapper.java
+9
-0
SchedulingTask.java
...java/com/yaoyaozw/customer/scheduling/SchedulingTask.java
+48
-0
CrowdPackageServiceImpl.java
...oyaozw/customer/service/impl/CrowdPackageServiceImpl.java
+0
-4
CustomerGraphicsServiceImpl.java
...zw/customer/service/impl/CustomerGraphicsServiceImpl.java
+5
-0
CommonOptionResponseVO.java
...java/com/yaoyaozw/customer/vo/CommonOptionResponseVO.java
+6
-0
CrowdPackageListVO.java
...va/com/yaoyaozw/customer/vo/crowd/CrowdPackageListVO.java
+1
-1
KanbanCommonMapper.xml
src/main/resources/mapper/KanbanCommonMapper.xml
+12
-0
MaterialCrowdPackageMapper.xml
src/main/resources/mapper/MaterialCrowdPackageMapper.xml
+2
-1
没有找到文件。
src/main/java/com/yaoyaozw/customer/components/CustomerServiceCommonAsyncComponent.java
浏览文件 @
4e5006e1
...
@@ -3,6 +3,8 @@ package com.yaoyaozw.customer.components;
...
@@ -3,6 +3,8 @@ package com.yaoyaozw.customer.components;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.alibaba.fastjson.TypeReference
;
...
@@ -14,13 +16,16 @@ import com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO;
...
@@ -14,13 +16,16 @@ import com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.yaoyaozw.customer.enums.CustomerStoreTemplateEnum
;
import
com.yaoyaozw.customer.feigns.ReferralFeignClient
;
import
com.yaoyaozw.customer.feigns.ReferralFeignClient
;
import
com.yaoyaozw.customer.mapper.CustomerGraphicsMapper
;
import
com.yaoyaozw.customer.mapper.KanbanCommonMapper
;
import
com.yaoyaozw.customer.mapper.KanbanCommonMapper
;
import
com.yaoyaozw.customer.mapper.MaterialCommonMapper
;
import
com.yaoyaozw.customer.mapper.MaterialCommonMapper
;
import
com.yaoyaozw.customer.service.CrowdPackageConditionMatchService
;
import
com.yaoyaozw.customer.service.CrowdPackageConditionMatchService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.service.RegisterUserEntityService
;
import
com.yaoyaozw.customer.service.RegisterUserEntityService
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -30,6 +35,7 @@ import org.springframework.data.redis.core.RedisTemplate;
...
@@ -30,6 +35,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.math.RoundingMode
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -60,6 +66,8 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -60,6 +66,8 @@ public class CustomerServiceCommonAsyncComponent {
@Autowired
@Autowired
private
MaterialCommonMapper
materialCommonMapper
;
private
MaterialCommonMapper
materialCommonMapper
;
@Autowired
@Autowired
private
CustomerGraphicsMapper
customerGraphicsMapper
;
@Autowired
private
KanbanCommonMapper
kanbanCommonMapper
;
private
KanbanCommonMapper
kanbanCommonMapper
;
...
@@ -150,6 +158,9 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -150,6 +158,9 @@ public class CustomerServiceCommonAsyncComponent {
generateUsualLink
(
storeGroupMap
,
customerReferral
);
generateUsualLink
(
storeGroupMap
,
customerReferral
);
}
}
// 处理完之后将状态改为待发送
customerMain
.
setSendStatus
(
2
);
customerGraphicsMapper
.
updateById
(
customerMain
);
}
}
...
@@ -168,6 +179,7 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -168,6 +179,7 @@ public class CustomerServiceCommonAsyncComponent {
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy/MM/dd"
);
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy/MM/dd"
);
String
dateStr
=
dateFormat
.
format
(
new
Date
());
String
dateStr
=
dateFormat
.
format
(
new
Date
());
Map
<
String
,
String
>
storeEntityMap
=
getStoreEntityMap
(
storeGroupMap
.
keySet
());
storeGroupMap
.
forEach
((
storeType
,
userVoList
)
->
{
storeGroupMap
.
forEach
((
storeType
,
userVoList
)
->
{
LOCAL_LOG
.
info
(
"当前处理书城: {}"
,
storeType
);
LOCAL_LOG
.
info
(
"当前处理书城: {}"
,
storeType
);
...
@@ -183,6 +195,7 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -183,6 +195,7 @@ public class CustomerServiceCommonAsyncComponent {
// 重新生成链接主键id
// 重新生成链接主键id
referralEntity
.
setId
(
snowflakeComponent
.
snowflakeId
());
referralEntity
.
setId
(
snowflakeComponent
.
snowflakeId
());
referralEntity
.
setAccountId
(
authInfoVo
.
getAccountId
());
referralEntity
.
setAccountId
(
authInfoVo
.
getAccountId
());
referralEntity
.
setStoreTypeName
(
storeEntityMap
.
get
(
storeType
));
try
{
try
{
getCopyReferral
(
dateStr
,
authInfoVo
,
referralEntity
);
getCopyReferral
(
dateStr
,
authInfoVo
,
referralEntity
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -201,9 +214,40 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -201,9 +214,40 @@ public class CustomerServiceCommonAsyncComponent {
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy/MM/dd"
);
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy/MM/dd"
);
String
dateStr
=
dateFormat
.
format
(
new
Date
());
String
dateStr
=
dateFormat
.
format
(
new
Date
());
String
activityContent
=
customerReferral
.
getRechargeAmount
().
stripTrailingZeros
().
toPlainString
()
+
"送"
+
customerReferral
.
getGiftAmount
();
LOCAL_LOG
.
info
(
"活动内容: {}"
,
activityContent
);
Map
<
String
,
String
>
storeEntityMap
=
getStoreEntityMap
(
storeGroupMap
.
keySet
());
storeGroupMap
.
forEach
((
storeType
,
userVoList
)
->
{
storeGroupMap
.
forEach
((
storeType
,
userVoList
)
->
{
LOCAL_LOG
.
info
(
"当前处理书城: {}"
,
storeType
);
LOCAL_LOG
.
info
(
"当前处理书城: {}"
,
storeType
);
boolean
isLegal
=
true
;
// 阳光、掌中云 需要获取configId
if
(
storeType
.
equals
(
CustomerCommonConstant
.
STORE_NAME_YANG_GUANG
)
||
storeType
.
equals
(
CustomerCommonConstant
.
STORE_NAME_ZHANG_ZHONG_YUN
))
{
R
activityConfig
=
referralFeignClient
.
getActivityConfig
(
customerReferral
.
getRechargeAmount
().
stripTrailingZeros
().
toPlainString
(),
storeType
,
null
);
// 获取资源配置列表
Map
<
String
,
Object
>
data
=
activityConfig
.
getData
();
JSONArray
configList
=
JSONUtil
.
parseArray
(
data
.
get
(
"configList"
));
List
<
CommonOptionResponseVO
>
activityConfigList
=
JSONUtil
.
toList
(
configList
,
CommonOptionResponseVO
.
class
);
if
(!
CollectionUtil
.
isEmpty
(
activityConfigList
))
{
// 转换config
Map
<
String
,
String
>
configMap
=
activityConfigList
.
stream
().
collect
(
Collectors
.
toMap
(
key
->
key
.
getLabel
().
replaceAll
(
"[^(0-9.送)]"
,
""
),
CommonOptionResponseVO:
:
getValue
,
(
o1
,
o2
)
->
o2
));
String
configId
=
configMap
.
get
(
activityContent
);
LOCAL_LOG
.
info
(
"活动内容: {} 获取到configId: {}"
,
activityContent
,
configId
);
customerReferral
.
setConfigId
(
configId
);
if
(
ObjectUtil
.
isNull
(
configId
))
{
isLegal
=
false
;
}
}
else
{
isLegal
=
false
;
LOCAL_LOG
.
info
(
"无法获取资源配置, 中断当前循环"
);
}
}
String
tempId
=
CustomerStoreTemplateEnum
.
getTempId
(
storeType
);
customerReferral
.
setTemplateId
(
tempId
);
if
(
isLegal
)
{
// 去重提取公众号
// 去重提取公众号
Set
<
String
>
accountSet
=
userVoList
.
stream
().
map
(
CrowdPackageUserVO:
:
getAccountId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
accountSet
=
userVoList
.
stream
().
map
(
CrowdPackageUserVO:
:
getAccountId
).
collect
(
Collectors
.
toSet
());
List
<
AuthInfoVO
>
authInfoList
=
materialCommonMapper
.
getAuthInfoList
(
accountSet
);
List
<
AuthInfoVO
>
authInfoList
=
materialCommonMapper
.
getAuthInfoList
(
accountSet
);
...
@@ -217,17 +261,24 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -217,17 +261,24 @@ public class CustomerServiceCommonAsyncComponent {
// 重新生成链接主键id
// 重新生成链接主键id
referralEntity
.
setId
(
snowflakeComponent
.
snowflakeId
());
referralEntity
.
setId
(
snowflakeComponent
.
snowflakeId
());
referralEntity
.
setAccountId
(
authInfoVo
.
getAccountId
());
referralEntity
.
setAccountId
(
authInfoVo
.
getAccountId
());
referralEntity
.
setStoreTypeName
(
storeEntityMap
.
get
(
storeType
));
try
{
getCopyReferral
(
dateStr
,
authInfoVo
,
referralEntity
);
getCopyReferral
(
dateStr
,
authInfoVo
,
referralEntity
);
}
catch
(
Exception
e
)
{
LOCAL_LOG
.
warn
(
"公众号: {} 获取链接异常: {}"
,
authInfoVo
.
getAccountName
(),
e
.
getMessage
());
}
referralEntityList
.
add
(
referralEntity
);
referralEntityList
.
add
(
referralEntity
);
}
}
// 批量新增
// 批量新增
referralEntityService
.
saveBatch
(
referralEntityList
);
referralEntityService
.
saveBatch
(
referralEntityList
);
}
});
});
}
}
private
void
generateUsualLink
(
Map
<
String
,
List
<
CrowdPackageUserVO
>>
storeGroupMap
,
ReferralEntity
customerReferral
)
{
private
void
generateUsualLink
(
Map
<
String
,
List
<
CrowdPackageUserVO
>>
storeGroupMap
,
ReferralEntity
customerReferral
)
{
Map
<
String
,
String
>
storeEntityMap
=
getStoreEntityMap
(
storeGroupMap
.
keySet
());
storeGroupMap
.
forEach
((
storeType
,
userVoList
)
->
{
storeGroupMap
.
forEach
((
storeType
,
userVoList
)
->
{
LOCAL_LOG
.
info
(
"当前处理书城: {}"
,
storeType
);
LOCAL_LOG
.
info
(
"当前处理书城: {}"
,
storeType
);
...
@@ -244,6 +295,8 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -244,6 +295,8 @@ public class CustomerServiceCommonAsyncComponent {
// 重新生成链接主键id
// 重新生成链接主键id
referralEntity
.
setId
(
snowflakeComponent
.
snowflakeId
());
referralEntity
.
setId
(
snowflakeComponent
.
snowflakeId
());
referralEntity
.
setAccountId
(
authInfoVo
.
getAccountId
());
referralEntity
.
setAccountId
(
authInfoVo
.
getAccountId
());
referralEntity
.
setStoreTypeName
(
storeEntityMap
.
get
(
storeType
));
getCopyReferral
(
null
,
authInfoVo
,
referralEntity
);
getCopyReferral
(
null
,
authInfoVo
,
referralEntity
);
referralEntityList
.
add
(
referralEntity
);
referralEntityList
.
add
(
referralEntity
);
...
@@ -254,8 +307,6 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -254,8 +307,6 @@ public class CustomerServiceCommonAsyncComponent {
});
});
}
}
private
void
getCopyReferral
(
String
dateStr
,
AuthInfoVO
authInfoVo
,
ReferralEntity
referralEntity
)
{
private
void
getCopyReferral
(
String
dateStr
,
AuthInfoVO
authInfoVo
,
ReferralEntity
referralEntity
)
{
referralEntity
.
setStoreType
(
authInfoVo
.
getStoreType
());
referralEntity
.
setStoreType
(
authInfoVo
.
getStoreType
());
// 非常用链接类型的name需要处理
// 非常用链接类型的name需要处理
...
@@ -268,13 +319,13 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -268,13 +319,13 @@ public class CustomerServiceCommonAsyncComponent {
}
}
// 替换共用字段
// 替换共用字段
name
=
name
.
replace
(
"{newsType}"
,
newsTypeName
).
replace
(
"{accountNickName}"
,
authInfoVo
.
getAccountName
())
name
=
name
.
replace
(
"{newsType}"
,
newsTypeName
).
replace
(
"{accountNickName}"
,
authInfoVo
.
getAccountName
())
.
replace
(
"{storeType}"
,
referralEntity
.
getStoreType
()).
replace
(
"{currentDate}"
,
dateStr
);
.
replace
(
"{storeType}"
,
referralEntity
.
getStoreType
Name
()).
replace
(
"{currentDate}"
,
dateStr
);
if
(
newsType
.
equals
(
CustomerCommonConstant
.
BOOK_NEWS_TYPE
))
{
if
(
newsType
.
equals
(
CustomerCommonConstant
.
BOOK_NEWS_TYPE
))
{
// 系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-{bookName}
// 系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-{bookName}
name
=
name
.
replace
(
"{bookName}"
,
referralEntity
.
getBookName
());
name
=
name
.
replace
(
"{bookName}"
,
referralEntity
.
getBookName
());
}
else
if
(
newsType
.
equals
(
CustomerCommonConstant
.
ACTIVITY_NEWS_TYPE
))
{
}
else
if
(
newsType
.
equals
(
CustomerCommonConstant
.
ACTIVITY_NEWS_TYPE
))
{
// 系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-充{recharge}送{gift}
// 系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-充{recharge}送{gift}
name
=
name
.
replace
(
"{recharge}"
,
referralEntity
.
getRechargeAmount
().
toPlainString
()).
replace
(
"{gift}"
,
referralEntity
.
getGiftAmount
().
toString
());
name
=
name
.
replace
(
"{recharge}"
,
referralEntity
.
getRechargeAmount
().
stripTrailingZeros
().
toPlainString
()).
replace
(
"{gift}"
,
referralEntity
.
getGiftAmount
().
toString
());
}
}
referralEntity
.
setName
(
name
);
referralEntity
.
setName
(
name
);
}
}
...
@@ -282,6 +333,8 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -282,6 +333,8 @@ public class CustomerServiceCommonAsyncComponent {
R
r
=
referralFeignClient
.
productReferral
(
referralEntity
);
R
r
=
referralFeignClient
.
productReferral
(
referralEntity
);
if
(!
r
.
getCode
().
equals
(
ApiResultConstant
.
SUCCESS_CODE
))
{
if
(!
r
.
getCode
().
equals
(
ApiResultConstant
.
SUCCESS_CODE
))
{
throw
new
RuntimeException
(
r
.
getMessage
());
throw
new
RuntimeException
(
r
.
getMessage
());
}
else
{
LOCAL_LOG
.
info
(
"公众号: {} 获取链接成功"
,
authInfoVo
.
getAccountName
());
}
}
String
res
=
r
.
getData
(
"storeReferral"
,
new
TypeReference
<
String
>()
{});
String
res
=
r
.
getData
(
"storeReferral"
,
new
TypeReference
<
String
>()
{});
JSONObject
jsonObject1
=
JSON
.
parseObject
(
res
);
JSONObject
jsonObject1
=
JSON
.
parseObject
(
res
);
...
@@ -290,10 +343,13 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -290,10 +343,13 @@ public class CustomerServiceCommonAsyncComponent {
referralEntity
.
setReferral
(
referral
);
referralEntity
.
setReferral
(
referral
);
}
}
private
String
getConfigIdFromInterface
(
String
storeType
)
{
private
Map
<
String
,
String
>
getStoreEntityMap
(
Set
<
String
>
storeKeySet
)
{
if
(
CollectionUtil
.
isEmpty
(
storeKeySet
))
{
return
new
HashMap
<>(
4
);
}
List
<
CommonOptionResponseVO
>
storeTypeEntity
=
kanbanCommonMapper
.
getStoreTypeEntity
(
storeKeySet
);
return
storeTypeEntity
.
stream
().
collect
(
Collectors
.
toMap
(
CommonOptionResponseVO:
:
getKey
,
CommonOptionResponseVO:
:
getName
));
return
null
;
}
}
}
}
src/main/java/com/yaoyaozw/customer/constants/CustomerCommonConstant.java
浏览文件 @
4e5006e1
...
@@ -10,6 +10,10 @@ public class CustomerCommonConstant {
...
@@ -10,6 +10,10 @@ public class CustomerCommonConstant {
public
final
static
String
CROWD_HUMAN_NUN_REDIS_KEY
=
"crowdHumanNum"
;
public
final
static
String
CROWD_HUMAN_NUN_REDIS_KEY
=
"crowdHumanNum"
;
public
final
static
String
STORE_NAME_YANG_GUANG
=
"YANG_GUANG"
;
public
final
static
String
STORE_NAME_ZHANG_ZHONG_YUN
=
"ZHANG_ZHONG_YUN"
;
public
final
static
String
STORE_NAME_YUE_WEN
=
"YUE_WEN"
;
public
final
static
Integer
BOOK_NEWS_TYPE
=
1
;
public
final
static
Integer
BOOK_NEWS_TYPE
=
1
;
public
final
static
String
BOOK_NEWS_TYPE_NAME
=
"推广"
;
public
final
static
String
BOOK_NEWS_TYPE_NAME
=
"推广"
;
...
...
src/main/java/com/yaoyaozw/customer/dto/customer/CustomerReferralDTO.java
浏览文件 @
4e5006e1
...
@@ -82,7 +82,7 @@ public class CustomerReferralDTO implements Serializable {
...
@@ -82,7 +82,7 @@ public class CustomerReferralDTO implements Serializable {
public
Date
getEndTime
()
{
public
Date
getEndTime
()
{
if
(
ObjectUtil
.
isNull
(
this
.
endTime
)
&&
CollectionUtil
.
isNotEmpty
(
this
.
dateList
))
{
if
(
ObjectUtil
.
isNull
(
this
.
endTime
)
&&
CollectionUtil
.
isNotEmpty
(
this
.
dateList
))
{
return
dateList
.
get
(
0
);
return
dateList
.
get
(
1
);
}
}
return
endTime
;
return
endTime
;
}
}
...
...
src/main/java/com/yaoyaozw/customer/enums/CustomerStoreTemplateEnum.java
0 → 100644
浏览文件 @
4e5006e1
package
com
.
yaoyaozw
.
customer
.
enums
;
import
org.apache.commons.lang3.StringUtils
;
/**
* @author darker
* @date 2022/10/11 20:23
*/
public
enum
CustomerStoreTemplateEnum
{
/**
* 客服消息书城活动模板
*/
YANG_GUANG
(
"YANG_GUANG"
,
"5"
),
YUE_WEN
(
"YUE_WEN"
,
"1"
),
ZHANG_ZHONG_YUN
(
"ZHANG_ZHONG_YUN"
,
"1"
),
ZHANG_DU
(
"ZHANG_DU"
,
"1"
)
;
private
final
String
storeType
;
private
final
String
templateId
;
CustomerStoreTemplateEnum
(
String
storeType
,
String
templateId
)
{
this
.
storeType
=
storeType
;
this
.
templateId
=
templateId
;
}
public
String
getStoreType
()
{
return
storeType
;
}
public
String
getTemplateId
()
{
return
templateId
;
}
public
static
String
getTempId
(
String
storeType
)
{
if
(
StringUtils
.
isBlank
(
storeType
))
{
return
null
;
}
for
(
CustomerStoreTemplateEnum
value
:
CustomerStoreTemplateEnum
.
values
())
{
if
(
storeType
.
contains
(
value
.
getStoreType
()))
{
return
value
.
getTemplateId
();
}
}
return
null
;
}
}
src/main/java/com/yaoyaozw/customer/feigns/ReferralFeignClient.java
浏览文件 @
4e5006e1
...
@@ -3,8 +3,10 @@ package com.yaoyaozw.customer.feigns;
...
@@ -3,8 +3,10 @@ package com.yaoyaozw.customer.feigns;
import
com.yaoyaozw.customer.common.R
;
import
com.yaoyaozw.customer.common.R
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
/**
...
@@ -25,4 +27,16 @@ public interface ReferralFeignClient {
...
@@ -25,4 +27,16 @@ public interface ReferralFeignClient {
@PostMapping
(
"/getReferral"
)
@PostMapping
(
"/getReferral"
)
R
productReferral
(
@RequestBody
ReferralEntity
referralEntity
);
R
productReferral
(
@RequestBody
ReferralEntity
referralEntity
);
/**
* 获取活动config
*
* @param Key 关键
* @param storeType 存储类型
* @param infoId 信息标识
* @return {@link R}
*/
@GetMapping
(
"/getActivityConfig"
)
R
getActivityConfig
(
@RequestParam
String
Key
,
@RequestParam
String
storeType
,
@RequestParam
(
required
=
false
)
Long
infoId
);
}
}
src/main/java/com/yaoyaozw/customer/mapper/KanbanCommonMapper.java
浏览文件 @
4e5006e1
...
@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
...
@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
/**
/**
* @author darker
* @author darker
...
@@ -41,5 +42,13 @@ public interface KanbanCommonMapper {
...
@@ -41,5 +42,13 @@ public interface KanbanCommonMapper {
*/
*/
String
getStoreTypeByExpression
(
@Param
(
"expression"
)
String
expression
);
String
getStoreTypeByExpression
(
@Param
(
"expression"
)
String
expression
);
/**
* 获取书城
*
* @param storeKeySet 存储键设置
* @return {@link List}<{@link CommonOptionResponseVO}>
*/
List
<
CommonOptionResponseVO
>
getStoreTypeEntity
(
@Param
(
"storeKeySet"
)
Set
<
String
>
storeKeySet
);
}
}
src/main/java/com/yaoyaozw/customer/scheduling/SchedulingTask.java
浏览文件 @
4e5006e1
package
com
.
yaoyaozw
.
customer
.
scheduling
;
package
com
.
yaoyaozw
.
customer
.
scheduling
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.entity.CrowdPackage
;
import
com.yaoyaozw.customer.service.AccountOrderService
;
import
com.yaoyaozw.customer.service.AccountOrderService
;
import
com.yaoyaozw.customer.service.RegisterUserEntityService
;
import
com.yaoyaozw.customer.service.RegisterUserEntityService
;
import
com.yaoyaozw.customer.service.impl.CrowdPackageServiceImpl
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Component
@Component
public
class
SchedulingTask
{
public
class
SchedulingTask
{
private
final
static
Logger
localLog
=
LoggerFactory
.
getLogger
(
SchedulingTask
.
class
);
@Autowired
@Autowired
private
AccountOrderService
accountOrderService
;
private
AccountOrderService
accountOrderService
;
@Autowired
@Autowired
private
RegisterUserEntityService
registerUserEntityService
;
private
RegisterUserEntityService
registerUserEntityService
;
@Autowired
private
RedisTemplate
redisTemplate
;
@Autowired
private
CrowdPackageServiceImpl
crowdPackageService
;
/**
/**
...
@@ -69,4 +87,34 @@ public class SchedulingTask {
...
@@ -69,4 +87,34 @@ public class SchedulingTask {
}
}
/**
* 从redis中更新人群包人数
*/
@Scheduled
(
cron
=
"0 0/15 * * * ?"
)
public
void
updateCrowdPackageNumFromRedis
()
{
localLog
.
info
(
"开始同步redis中人群包人数至数据库"
);
HashMap
<
String
,
Integer
>
entries
=
(
HashMap
<
String
,
Integer
>)
redisTemplate
.
boundHashOps
(
CustomerCommonConstant
.
CROWD_HUMAN_NUN_REDIS_KEY
).
entries
();
if
(
CollectionUtil
.
isEmpty
(
entries
))
{
return
;
}
localLog
.
info
(
"redis中获取到人群包人数数据: {}对"
,
entries
.
size
());
Date
now
=
new
Date
();
List
<
CrowdPackage
>
list
=
crowdPackageService
.
list
();
localLog
.
info
(
"数据库中获取人群包: {}条"
,
list
.
size
());
List
<
CrowdPackage
>
resultList
=
list
.
stream
().
filter
(
item
->
entries
.
containsKey
(
item
.
getId
().
toString
()))
.
peek
(
item
->
{
item
.
setLastCountTime
(
now
);
Integer
num
=
entries
.
get
(
item
.
getId
().
toString
());
item
.
setCrowdNum
(
num
);
}).
collect
(
Collectors
.
toList
());
localLog
.
info
(
"要更新人群包: {} 条"
,
resultList
.
size
());
if
(
CollectionUtil
.
isNotEmpty
(
resultList
))
{
crowdPackageService
.
updateBatchById
(
resultList
);
}
localLog
.
info
(
"删除创建时的临时数据"
);
crowdPackageService
.
remove
(
new
QueryWrapper
<
CrowdPackage
>().
isNull
(
"package_name"
));
}
}
}
src/main/java/com/yaoyaozw/customer/service/impl/CrowdPackageServiceImpl.java
浏览文件 @
4e5006e1
...
@@ -147,10 +147,6 @@ public class CrowdPackageServiceImpl extends ServiceImpl<MaterialCrowdPackageMap
...
@@ -147,10 +147,6 @@ public class CrowdPackageServiceImpl extends ServiceImpl<MaterialCrowdPackageMap
if
(
CollectionUtil
.
isEmpty
(
pageList
))
{
if
(
CollectionUtil
.
isEmpty
(
pageList
))
{
return
new
GenericsResult
<>(
false
,
"暂无数据"
);
return
new
GenericsResult
<>(
false
,
"暂无数据"
);
}
}
HashMap
<
String
,
Integer
>
entries
=
(
HashMap
<
String
,
Integer
>)
redisTemplate
.
boundHashOps
(
CustomerCommonConstant
.
CROWD_HUMAN_NUN_REDIS_KEY
).
entries
();
if
(
CollectionUtil
.
isNotEmpty
(
entries
))
{
pageList
.
forEach
(
item
->
item
.
setNumOfCrowdInPackage
(
entries
.
get
(
item
.
getId
().
toString
())));
}
return
new
GenericsResult
<>(
pageList
);
return
new
GenericsResult
<>(
pageList
);
}
}
...
...
src/main/java/com/yaoyaozw/customer/service/impl/CustomerGraphicsServiceImpl.java
浏览文件 @
4e5006e1
...
@@ -25,6 +25,7 @@ import com.yaoyaozw.customer.service.CrowdPackageConditionService;
...
@@ -25,6 +25,7 @@ import com.yaoyaozw.customer.service.CrowdPackageConditionService;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.vo.customer.CustomerMessageDetailVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerMessageDetailVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerMessageListVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerMessageListVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -86,7 +87,9 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
...
@@ -86,7 +87,9 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
// 获取name模板
// 获取name模板
String
nameModel
=
CustomerCommonConstant
.
getLinkNameModel
(
referralEntity
.
getNewsType
());
String
nameModel
=
CustomerCommonConstant
.
getLinkNameModel
(
referralEntity
.
getNewsType
());
LOCAL_LOG
.
info
(
"获取name模板: {}"
,
nameModel
);
LOCAL_LOG
.
info
(
"获取name模板: {}"
,
nameModel
);
if
(
StringUtils
.
isNotBlank
(
nameModel
))
{
referralEntity
.
setName
(
nameModel
);
referralEntity
.
setName
(
nameModel
);
}
// 保存链接数据
// 保存链接数据
referralEntityService
.
saveOrUpdate
(
referralEntity
);
referralEntityService
.
saveOrUpdate
(
referralEntity
);
...
@@ -168,6 +171,8 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
...
@@ -168,6 +171,8 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
}
}
byId
.
setPackId
(
packId
);
byId
.
setPackId
(
packId
);
// 设置状态为链接生成中
byId
.
setSendStatus
(
1
);
boolean
result
=
super
.
updateById
(
byId
);
boolean
result
=
super
.
updateById
(
byId
);
if
(
result
)
{
if
(
result
)
{
// 删除之前设置人群包的时候获取链接生成的数据
// 删除之前设置人群包的时候获取链接生成的数据
...
...
src/main/java/com/yaoyaozw/customer/vo/CommonOptionResponseVO.java
浏览文件 @
4e5006e1
...
@@ -20,4 +20,10 @@ public class CommonOptionResponseVO implements Serializable {
...
@@ -20,4 +20,10 @@ public class CommonOptionResponseVO implements Serializable {
@ApiModelProperty
(
"选项名称"
)
@ApiModelProperty
(
"选项名称"
)
private
String
name
;
private
String
name
;
@ApiModelProperty
(
"key值"
)
private
String
value
;
@ApiModelProperty
(
"选项名称"
)
private
String
label
;
}
}
src/main/java/com/yaoyaozw/customer/vo/crowd/CrowdPackageListVO.java
浏览文件 @
4e5006e1
...
@@ -31,7 +31,7 @@ public class CrowdPackageListVO implements Serializable {
...
@@ -31,7 +31,7 @@ public class CrowdPackageListVO implements Serializable {
private
Integer
numOfCrowdInPackage
;
private
Integer
numOfCrowdInPackage
;
@ApiModelProperty
(
"最后一次统计时间"
)
@ApiModelProperty
(
"最后一次统计时间"
)
private
Integer
lastCountTime
;
private
String
lastCountTime
;
@ApiModelProperty
(
"创建时间"
)
@ApiModelProperty
(
"创建时间"
)
private
String
createTime
;
private
String
createTime
;
...
...
src/main/resources/mapper/KanbanCommonMapper.xml
浏览文件 @
4e5006e1
...
@@ -33,4 +33,15 @@
...
@@ -33,4 +33,15 @@
limit 1
limit 1
</select>
</select>
<select
id=
"getStoreTypeEntity"
resultType=
"com.yaoyaozw.customer.vo.CommonOptionResponseVO"
>
select
store_type as `key`,
store_name as `name`
from store_entity
where store_type in
<foreach
collection=
"storeKeySet"
item=
"storeKey"
open=
"("
close=
")"
separator=
","
>
#{storeKey}
</foreach>
</select>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mapper/MaterialCrowdPackageMapper.xml
浏览文件 @
4e5006e1
...
@@ -18,7 +18,8 @@
...
@@ -18,7 +18,8 @@
<select
id=
"getPageList"
resultType=
"com.yaoyaozw.customer.vo.crowd.CrowdPackageListVO"
>
<select
id=
"getPageList"
resultType=
"com.yaoyaozw.customer.vo.crowd.CrowdPackageListVO"
>
select
select
cpm.id, cpm.package_name as packageName,
cpm.id, cpm.package_name as packageName,
cpm.crowd_num as numOfCrowdInPackage, cpm.last_count_time as lastCountTime,
ifnull(cpm.crowd_num, 0) as numOfCrowdInPackage,
cpm.last_count_time as lastCountTime,
cpm.create_time as createTime, cpm.modified_time as modifiedTime,
cpm.create_time as createTime, cpm.modified_time as modifiedTime,
cau.nick_name as createUser, mau.nick_name as modifiedUser,
cau.nick_name as createUser, mau.nick_name as modifiedUser,
group_concat(concat('【', mat.operator_description, '】')) as packageLabel
group_concat(concat('【', mat.operator_description, '】')) as packageLabel
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论