Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
8755380d
提交
8755380d
authored
10月 19, 2022
作者:
gh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
延时客服合并
上级
b79b3207
显示空白字符变更
内嵌
并排
正在显示
45 个修改的文件
包含
479 行增加
和
148 行删除
+479
-148
CustomerServiceCommonAsyncComponent.java
...tomer/components/CustomerServiceCommonAsyncComponent.java
+1
-4
CrowdPackageController.java
.../yaoyaozw/customer/controller/CrowdPackageController.java
+0
-1
CustomerCommonController.java
...aoyaozw/customer/controller/CustomerCommonController.java
+1
-1
CustomerDelayGraphicsController.java
.../customer/controller/CustomerDelayGraphicsController.java
+1
-1
TestController.java
...java/com/yaoyaozw/customer/controller/TestController.java
+33
-0
CustomerDelayPublish.java
...va/com/yaoyaozw/customer/entity/CustomerDelayPublish.java
+7
-4
CustomerGraphics.java
...n/java/com/yaoyaozw/customer/entity/CustomerGraphics.java
+3
-3
CustomerGraphicsDelay.java
...a/com/yaoyaozw/customer/entity/CustomerGraphicsDelay.java
+5
-0
RegisterUserEntity.java
...java/com/yaoyaozw/customer/entity/RegisterUserEntity.java
+8
-0
AccountOrderMapper.java
...java/com/yaoyaozw/customer/mapper/AccountOrderMapper.java
+3
-2
CustomerDelayPublishMapper.java
.../yaoyaozw/customer/mapper/CustomerDelayPublishMapper.java
+7
-0
CustomerGraphicsDelayMapper.java
...yaoyaozw/customer/mapper/CustomerGraphicsDelayMapper.java
+6
-5
KanbanCommonMapper.java
...java/com/yaoyaozw/customer/mapper/KanbanCommonMapper.java
+4
-1
MaterialCommonMapper.java
...va/com/yaoyaozw/customer/mapper/MaterialCommonMapper.java
+1
-2
MaterialCrowdPackageMapper.java
.../yaoyaozw/customer/mapper/MaterialCrowdPackageMapper.java
+1
-1
RegisterUserEntityMapper.java
...om/yaoyaozw/customer/mapper/RegisterUserEntityMapper.java
+9
-0
SchedulingTask.java
...java/com/yaoyaozw/customer/scheduling/SchedulingTask.java
+9
-0
CrowdPackageService.java
...va/com/yaoyaozw/customer/service/CrowdPackageService.java
+0
-1
CustomerGraphicsDelayService.java
...oyaozw/customer/service/CustomerGraphicsDelayService.java
+14
-2
CustomerServiceCommonService.java
...oyaozw/customer/service/CustomerServiceCommonService.java
+1
-2
RegisterUserEntityService.java
.../yaoyaozw/customer/service/RegisterUserEntityService.java
+1
-0
AccountOrderServiceImpl.java
...oyaozw/customer/service/impl/AccountOrderServiceImpl.java
+14
-23
CrowdPackageServiceImpl.java
...oyaozw/customer/service/impl/CrowdPackageServiceImpl.java
+1
-7
CustomerDelayPublishServiceImpl.java
...ustomer/service/impl/CustomerDelayPublishServiceImpl.java
+19
-12
CustomerGraphicsDelayServiceImpl.java
...stomer/service/impl/CustomerGraphicsDelayServiceImpl.java
+10
-9
CustomerGraphicsServiceImpl.java
...zw/customer/service/impl/CustomerGraphicsServiceImpl.java
+1
-19
CustomerServiceCommonServiceImpl.java
...stomer/service/impl/CustomerServiceCommonServiceImpl.java
+1
-1
WeChatRestService.java
...zw/customer/service/wechat/service/WeChatRestService.java
+5
-4
WeChatService.java
...oyaozw/customer/service/wechat/service/WeChatService.java
+8
-1
WeChatServiceImpl.java
...zw/customer/service/wechat/service/WeChatServiceImpl.java
+100
-18
ConditionOptionResponseVO.java
...yaoyaozw/customer/vo/crowd/ConditionOptionResponseVO.java
+1
-1
CrowdPackageConditionVO.java
...m/yaoyaozw/customer/vo/crowd/CrowdPackageConditionVO.java
+0
-2
CustomerDelayItemVO.java
...om/yaoyaozw/customer/vo/customer/CustomerDelayItemVO.java
+52
-5
CommonCostSetupVo.java
...va/com/yaoyaozw/customer/vo/kanban/CommonCostSetupVo.java
+20
-0
CommonOptionResponseVO.java
...m/yaoyaozw/customer/vo/kanban/CommonOptionResponseVO.java
+1
-1
UserAvgAmountVO.java
...java/com/yaoyaozw/customer/vo/kanban/UserAvgAmountVO.java
+1
-1
bootstrap.yml
src/main/resources/bootstrap.yml
+1
-1
AccountOrderMapper.xml
src/main/resources/mapper/AccountOrderMapper.xml
+1
-1
CustomerDelayPublishMapper.xml
src/main/resources/mapper/CustomerDelayPublishMapper.xml
+13
-0
CustomerGraphicsDelayMapper.xml
src/main/resources/mapper/CustomerGraphicsDelayMapper.xml
+14
-8
KanbanCommonMapper.xml
src/main/resources/mapper/KanbanCommonMapper.xml
+9
-2
MaterialCommonMapper.xml
src/main/resources/mapper/MaterialCommonMapper.xml
+1
-1
MaterialCrowdPackageMapper.xml
src/main/resources/mapper/MaterialCrowdPackageMapper.xml
+1
-1
RegisterUserEntityMapper.xml
src/main/resources/mapper/RegisterUserEntityMapper.xml
+23
-0
test.java
src/test/java/test.java
+67
-0
没有找到文件。
src/main/java/com/yaoyaozw/customer/components/CustomerServiceCommonAsyncComponent.java
浏览文件 @
8755380d
...
@@ -10,9 +10,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -10,9 +10,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.alibaba.fastjson.TypeReference
;
import
com.alibaba.fastjson.TypeReference
;
import
com.yaoyaozw.customer.common.R
;
import
com.yaoyaozw.customer.common.R
;
import
com.yaoyaozw.customer.constants.ApiResultConstant
;
import
com.yaoyaozw.customer.constants.ApiResultConstant
;
import
com.yaoyaozw.customer.constants.CrowdPackageCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO
;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
import
com.yaoyaozw.customer.entity.CustomerGraphicsDelay
;
import
com.yaoyaozw.customer.entity.CustomerGraphicsDelay
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
...
@@ -27,7 +25,7 @@ import com.yaoyaozw.customer.service.CrowdPackageConditionMatchService;
...
@@ -27,7 +25,7 @@ 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.
kanban.
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
;
...
@@ -37,7 +35,6 @@ import org.springframework.data.redis.core.RedisTemplate;
...
@@ -37,7 +35,6 @@ 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
;
...
...
src/main/java/com/yaoyaozw/customer/controller/CrowdPackageController.java
浏览文件 @
8755380d
...
@@ -5,7 +5,6 @@ import com.yaoyaozw.customer.common.GenericsResult;
...
@@ -5,7 +5,6 @@ import com.yaoyaozw.customer.common.GenericsResult;
import
com.yaoyaozw.customer.dto.crowd.CrowdPackageQueryDTO
;
import
com.yaoyaozw.customer.dto.crowd.CrowdPackageQueryDTO
;
import
com.yaoyaozw.customer.dto.crowd.CrowdPackageConditionDTO
;
import
com.yaoyaozw.customer.dto.crowd.CrowdPackageConditionDTO
;
import
com.yaoyaozw.customer.service.CrowdPackageService
;
import
com.yaoyaozw.customer.service.CrowdPackageService
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.crowd.*
;
import
com.yaoyaozw.customer.vo.crowd.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
...
src/main/java/com/yaoyaozw/customer/controller/CustomerCommonController.java
浏览文件 @
8755380d
...
@@ -2,7 +2,7 @@ package com.yaoyaozw.customer.controller;
...
@@ -2,7 +2,7 @@ package com.yaoyaozw.customer.controller;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.service.CustomerServiceCommonService
;
import
com.yaoyaozw.customer.service.CustomerServiceCommonService
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.
kanban.
CommonOptionResponseVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
src/main/java/com/yaoyaozw/customer/controller/CustomerDelayGraphicsController.java
浏览文件 @
8755380d
...
@@ -7,7 +7,7 @@ import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO;
...
@@ -7,7 +7,7 @@ import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO;
import
com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO
;
import
com.yaoyaozw.customer.service.CustomerGraphicsDelayService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsDelayService
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.
kanban.
CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayListVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayListVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
...
src/main/java/com/yaoyaozw/customer/controller/TestController.java
浏览文件 @
8755380d
package
com
.
yaoyaozw
.
customer
.
controller
;
package
com
.
yaoyaozw
.
customer
.
controller
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.service.AccountOrderService
;
import
com.yaoyaozw.customer.service.CustomerDelayPublishService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
@@ -19,6 +21,10 @@ public class TestController {
...
@@ -19,6 +21,10 @@ public class TestController {
@Autowired
@Autowired
private
CustomerGraphicsService
customerGraphicsService
;
private
CustomerGraphicsService
customerGraphicsService
;
@Autowired
private
AccountOrderService
accountOrderService
;
@Autowired
private
CustomerDelayPublishService
customerDelayPublishService
;
@GetMapping
(
"/CustomerTest"
)
@GetMapping
(
"/CustomerTest"
)
public
void
test
(){
public
void
test
(){
...
@@ -35,5 +41,32 @@ public class TestController {
...
@@ -35,5 +41,32 @@ public class TestController {
customerGraphicsService
.
sendCustomerMessage
(
integrationRequestDTO
);
customerGraphicsService
.
sendCustomerMessage
(
integrationRequestDTO
);
}
}
@GetMapping
(
"/CustomerDelayTest"
)
public
void
delayTest
(){
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
set
(
Calendar
.
AM_PM
,
0
);
calendar
.
set
(
Calendar
.
HOUR
,
17
);
calendar
.
set
(
Calendar
.
MINUTE
,
0
);
calendar
.
set
(
Calendar
.
SECOND
,
0
);
calendar
.
set
(
Calendar
.
MILLISECOND
,
0
);
IntegrationRequestDTO
integrationRequestDTO
=
new
IntegrationRequestDTO
();
integrationRequestDTO
.
setRequestDate
(
calendar
.
getTime
());
customerDelayPublishService
.
sendCustomerDelayMessage
(
integrationRequestDTO
);
}
@GetMapping
(
"/payTest"
)
public
void
payTest
(){
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
set
(
Calendar
.
AM_PM
,
0
);
calendar
.
set
(
Calendar
.
HOUR
,
12
);
calendar
.
set
(
Calendar
.
MINUTE
,
0
);
calendar
.
set
(
Calendar
.
SECOND
,
0
);
calendar
.
set
(
Calendar
.
MILLISECOND
,
0
);
IntegrationRequestDTO
integrationRequestDTO
=
new
IntegrationRequestDTO
();
integrationRequestDTO
.
setRequestDate
(
calendar
.
getTime
());
accountOrderService
.
activeUserByOrder
(
integrationRequestDTO
);
}
}
}
src/main/java/com/yaoyaozw/customer/entity/CustomerDelayPublish.java
浏览文件 @
8755380d
...
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
...
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Date
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
/**
* @author wgh
* @author wgh
...
@@ -25,19 +26,19 @@ public class CustomerDelayPublish implements Serializable {
...
@@ -25,19 +26,19 @@ public class CustomerDelayPublish implements Serializable {
/**
/**
* app_id
* app_id
*/
*/
@TableField
(
exist
=
false
,
value
=
"app_id"
)
@TableField
(
exist
=
false
)
private
String
appId
;
private
String
appId
;
/**
/**
* openid
* openid
*/
*/
@TableField
(
exist
=
false
,
value
=
"open_id"
)
@TableField
(
exist
=
false
)
private
String
openId
;
private
String
openId
;
/**
/**
* 未付费0/付费1/VIP 2
* 未付费0/付费1/VIP 2
*/
*/
@TableField
(
exist
=
false
,
value
=
"pay_type"
)
@TableField
(
exist
=
false
)
private
Byte
payType
;
private
Byte
payType
;
/**
/**
...
@@ -52,10 +53,12 @@ public class CustomerDelayPublish implements Serializable {
...
@@ -52,10 +53,12 @@ public class CustomerDelayPublish implements Serializable {
@TableField
(
value
=
"customer_publish"
)
@TableField
(
value
=
"customer_publish"
)
private
Date
customerPublish
;
private
Date
customerPublish
;
@TableField
(
value
=
"first_active"
)
private
Date
firstActive
;
/**
/**
* 创建时间
* 创建时间
*/
*/
@TableField
(
exist
=
false
,
value
=
"gmt_create"
)
@TableField
(
exist
=
false
)
private
Date
gmtCreate
;
private
Date
gmtCreate
;
...
...
src/main/java/com/yaoyaozw/customer/entity/CustomerGraphics.java
浏览文件 @
8755380d
...
@@ -107,11 +107,11 @@ public class CustomerGraphics implements Serializable {
...
@@ -107,11 +107,11 @@ public class CustomerGraphics implements Serializable {
@TableLogic
@TableLogic
private
Integer
isDeleted
;
private
Integer
isDeleted
;
@TableField
(
exist
=
false
)
@TableField
(
value
=
"send_Num"
)
private
Integer
send
Count
;
private
Integer
send
Num
;
public
void
updateCount
(){
public
void
updateCount
(){
sendCount
++;
this
.
sendNum
++;
}
}
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/main/java/com/yaoyaozw/customer/entity/CustomerGraphicsDelay.java
浏览文件 @
8755380d
...
@@ -46,6 +46,11 @@ public class CustomerGraphicsDelay implements Serializable {
...
@@ -46,6 +46,11 @@ public class CustomerGraphicsDelay implements Serializable {
@TableField
(
value
=
"extend_title"
)
@TableField
(
value
=
"extend_title"
)
private
String
extendTitle
;
private
String
extendTitle
;
/**
* 封面图地址
*/
@TableField
(
value
=
"cover_url"
)
private
String
coverUrl
;
/**
/**
* 文本内容
* 文本内容
...
...
src/main/java/com/yaoyaozw/customer/entity/RegisterUserEntity.java
浏览文件 @
8755380d
...
@@ -70,6 +70,12 @@ public class RegisterUserEntity implements Serializable {
...
@@ -70,6 +70,12 @@ public class RegisterUserEntity implements Serializable {
private
Date
lastActive
;
private
Date
lastActive
;
/**
/**
* 首次活跃时间
*/
@TableField
(
value
=
"first_active"
)
private
Date
firstActive
;
/**
* 创建时间
* 创建时间
*/
*/
@TableField
(
value
=
"gmt_create"
)
@TableField
(
value
=
"gmt_create"
)
...
@@ -93,6 +99,8 @@ public class RegisterUserEntity implements Serializable {
...
@@ -93,6 +99,8 @@ public class RegisterUserEntity implements Serializable {
@TableField
(
value
=
"in_package"
)
@TableField
(
value
=
"in_package"
)
private
String
inPackage
;
private
String
inPackage
;
@TableField
(
exist
=
false
)
private
Date
formatDate
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/main/java/com/yaoyaozw/customer/mapper/AccountOrderMapper.java
浏览文件 @
8755380d
package
com
.
yaoyaozw
.
customer
.
mapper
;
package
com
.
yaoyaozw
.
customer
.
mapper
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yaoyaozw.customer.entity.AccountOrder
;
import
com.yaoyaozw.customer.entity.AccountOrder
;
import
com.yaoyaozw.customer.vo.UserAvgAmountVO
;
import
com.yaoyaozw.customer.vo.
kanban.
UserAvgAmountVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
@DS
(
"kanban"
)
@Mapper
@Mapper
public
interface
AccountOrderMapper
extends
BaseMapper
<
AccountOrder
>
{
public
interface
AccountOrderMapper
extends
BaseMapper
<
AccountOrder
>
{
...
...
src/main/java/com/yaoyaozw/customer/mapper/CustomerDelayPublishMapper.java
浏览文件 @
8755380d
...
@@ -3,6 +3,10 @@ package com.yaoyaozw.customer.mapper;
...
@@ -3,6 +3,10 @@ package com.yaoyaozw.customer.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yaoyaozw.customer.entity.CustomerDelayPublish
;
import
com.yaoyaozw.customer.entity.CustomerDelayPublish
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* @author wgh
* @author wgh
...
@@ -10,4 +14,6 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -10,4 +14,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
*/
@Mapper
@Mapper
public
interface
CustomerDelayPublishMapper
extends
BaseMapper
<
CustomerDelayPublish
>
{
public
interface
CustomerDelayPublishMapper
extends
BaseMapper
<
CustomerDelayPublish
>
{
List
<
CustomerDelayPublish
>
findPublishUser
(
@Param
(
"requestDate"
)
Date
requestDate
);
}
}
\ No newline at end of file
src/main/java/com/yaoyaozw/customer/mapper/CustomerGraphicsDelayMapper.java
浏览文件 @
8755380d
...
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO
;
import
com.yaoyaozw.customer.entity.CustomerGraphicsDelay
;
import
com.yaoyaozw.customer.entity.CustomerGraphicsDelay
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.
kanban.
CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayListVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayListVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
...
@@ -18,16 +18,17 @@ import java.util.Set;
...
@@ -18,16 +18,17 @@ import java.util.Set;
@DS
(
"material"
)
@DS
(
"material"
)
@Mapper
@Mapper
public
interface
CustomerGraphicsDelayMapper
extends
BaseMapper
<
CustomerGraphicsDelay
>
{
public
interface
CustomerGraphicsDelayMapper
extends
BaseMapper
<
CustomerGraphicsDelay
>
{
/**
/**
* 根据appid找延时客服
* 根据appid找有限序列的延时客服
*
* @param appidList
* @param appidList
* @param maxSort
* @return
* @return
*/
*/
List
<
CustomerDelayItemVO
>
findAllDelayCustomerMessage
(
@Param
(
"appidList"
)
Set
<
String
>
appidList
);
List
<
CustomerDelayItemVO
>
findDelayCustomerMessageByRange
(
@Param
(
"appidList"
)
Set
<
String
>
appidList
,
@Param
(
"maxSort"
)
Integer
maxSort
);
List
<
CustomerDelayItemVO
>
findDelayCustomerMessageByRange
(
@Param
(
"appidList"
)
Set
<
String
>
appidList
,
@Param
(
"maxSort"
)
Integer
maxSort
);
void
updateSendNumByVo
(
@Param
(
"CustomerDelayItems"
)
Set
<
CustomerDelayItemVO
>
voList
);
/**
/**
* 页面列表
* 页面列表
*
*
...
...
src/main/java/com/yaoyaozw/customer/mapper/KanbanCommonMapper.java
浏览文件 @
8755380d
...
@@ -2,7 +2,8 @@ package com.yaoyaozw.customer.mapper;
...
@@ -2,7 +2,8 @@ package com.yaoyaozw.customer.mapper;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.yaoyaozw.customer.entity.CrowdPackageCondition
;
import
com.yaoyaozw.customer.entity.CrowdPackageCondition
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.kanban.CommonCostSetupVo
;
import
com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
...
@@ -51,4 +52,6 @@ public interface KanbanCommonMapper {
...
@@ -51,4 +52,6 @@ public interface KanbanCommonMapper {
List
<
CommonOptionResponseVO
>
getStoreTypeEntity
(
@Param
(
"storeKeySet"
)
Set
<
String
>
storeKeySet
);
List
<
CommonOptionResponseVO
>
getStoreTypeEntity
(
@Param
(
"storeKeySet"
)
Set
<
String
>
storeKeySet
);
List
<
CommonCostSetupVo
>
getWechatCostSetup
(
@Param
(
"appid"
)
String
appid
);
}
}
src/main/java/com/yaoyaozw/customer/mapper/MaterialCommonMapper.java
浏览文件 @
8755380d
package
com
.
yaoyaozw
.
customer
.
mapper
;
package
com
.
yaoyaozw
.
customer
.
mapper
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.
kanban.
CommonOptionResponseVO
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
...
...
src/main/java/com/yaoyaozw/customer/mapper/MaterialCrowdPackageMapper.java
浏览文件 @
8755380d
...
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.yaoyaozw.customer.dto.crowd.CrowdPackageQueryDTO
;
import
com.yaoyaozw.customer.dto.crowd.CrowdPackageQueryDTO
;
import
com.yaoyaozw.customer.entity.CrowdPackage
;
import
com.yaoyaozw.customer.entity.CrowdPackage
;
import
com.yaoyaozw.customer.entity.CrowdPackageCondition
;
import
com.yaoyaozw.customer.entity.CrowdPackageCondition
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.
kanban.
CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.crowd.CrowdPackageListVO
;
import
com.yaoyaozw.customer.vo.crowd.CrowdPackageListVO
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
...
...
src/main/java/com/yaoyaozw/customer/mapper/RegisterUserEntityMapper.java
浏览文件 @
8755380d
package
com
.
yaoyaozw
.
customer
.
mapper
;
package
com
.
yaoyaozw
.
customer
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yaoyaozw.customer.entity.AuthorizerInfo
;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
...
@@ -51,4 +52,11 @@ public interface RegisterUserEntityMapper extends BaseMapper<RegisterUserEntity>
...
@@ -51,4 +52,11 @@ public interface RegisterUserEntityMapper extends BaseMapper<RegisterUserEntity>
*/
*/
List
<
CrowdPackageUserVO
>
getCurrentInPackUserListWithoutAccountId
(
@Param
(
"packageId"
)
Long
packageId
);
List
<
CrowdPackageUserVO
>
getCurrentInPackUserListWithoutAccountId
(
@Param
(
"packageId"
)
Long
packageId
);
/**
* 获取所有appid
* @return
*/
List
<
AuthorizerInfo
>
existAppid
();
List
<
RegisterUserEntity
>
findAllUserWithoutSetupId
(
String
appid
);
}
}
\ No newline at end of file
src/main/java/com/yaoyaozw/customer/scheduling/SchedulingTask.java
浏览文件 @
8755380d
...
@@ -56,6 +56,8 @@ public class SchedulingTask {
...
@@ -56,6 +56,8 @@ public class SchedulingTask {
IntegrationRequestDTO
integrationRequestDTO
=
new
IntegrationRequestDTO
();
IntegrationRequestDTO
integrationRequestDTO
=
new
IntegrationRequestDTO
();
integrationRequestDTO
.
setRequestDate
(
calendar
.
getTime
());
accountOrderService
.
activeUserByOrder
(
integrationRequestDTO
);
accountOrderService
.
activeUserByOrder
(
integrationRequestDTO
);
}
}
...
@@ -72,6 +74,8 @@ public class SchedulingTask {
...
@@ -72,6 +74,8 @@ public class SchedulingTask {
IntegrationRequestDTO
integrationRequestDTO
=
new
IntegrationRequestDTO
();
IntegrationRequestDTO
integrationRequestDTO
=
new
IntegrationRequestDTO
();
integrationRequestDTO
.
setRequestDate
(
calendar
.
getTime
());
accountOrderService
.
calculateAvgMonth
(
integrationRequestDTO
);
accountOrderService
.
calculateAvgMonth
(
integrationRequestDTO
);
}
}
...
@@ -90,6 +94,8 @@ public class SchedulingTask {
...
@@ -90,6 +94,8 @@ public class SchedulingTask {
IntegrationRequestDTO
integrationRequestDTO
=
new
IntegrationRequestDTO
();
IntegrationRequestDTO
integrationRequestDTO
=
new
IntegrationRequestDTO
();
integrationRequestDTO
.
setRequestDate
(
calendar
.
getTime
());
customerGraphicsService
.
sendCustomerMessage
(
integrationRequestDTO
);
customerGraphicsService
.
sendCustomerMessage
(
integrationRequestDTO
);
...
@@ -99,6 +105,7 @@ public class SchedulingTask {
...
@@ -99,6 +105,7 @@ public class SchedulingTask {
/**
/**
* 每1min扫延时客服
* 每1min扫延时客服
*/
*/
@Scheduled
(
cron
=
"0 0/1 * * * *"
)
public
void
publishDelayCustomerMessage
(){
public
void
publishDelayCustomerMessage
(){
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
...
@@ -109,6 +116,8 @@ public class SchedulingTask {
...
@@ -109,6 +116,8 @@ public class SchedulingTask {
IntegrationRequestDTO
integrationRequestDTO
=
new
IntegrationRequestDTO
();
IntegrationRequestDTO
integrationRequestDTO
=
new
IntegrationRequestDTO
();
integrationRequestDTO
.
setRequestDate
(
calendar
.
getTime
());
customerDelayPublishService
.
sendCustomerDelayMessage
(
integrationRequestDTO
);
customerDelayPublishService
.
sendCustomerDelayMessage
(
integrationRequestDTO
);
}
}
...
...
src/main/java/com/yaoyaozw/customer/service/CrowdPackageService.java
浏览文件 @
8755380d
...
@@ -6,7 +6,6 @@ import com.yaoyaozw.customer.common.GenericsResult;
...
@@ -6,7 +6,6 @@ import com.yaoyaozw.customer.common.GenericsResult;
import
com.yaoyaozw.customer.dto.crowd.CrowdPackageQueryDTO
;
import
com.yaoyaozw.customer.dto.crowd.CrowdPackageQueryDTO
;
import
com.yaoyaozw.customer.dto.crowd.CrowdPackageConditionDTO
;
import
com.yaoyaozw.customer.dto.crowd.CrowdPackageConditionDTO
;
import
com.yaoyaozw.customer.entity.CrowdPackage
;
import
com.yaoyaozw.customer.entity.CrowdPackage
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.crowd.*
;
import
com.yaoyaozw.customer.vo.crowd.*
;
import
java.util.List
;
import
java.util.List
;
...
...
src/main/java/com/yaoyaozw/customer/service/CustomerGraphicsDelayService.java
浏览文件 @
8755380d
...
@@ -8,7 +8,7 @@ import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO;
...
@@ -8,7 +8,7 @@ import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO;
import
com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO
;
import
com.yaoyaozw.customer.entity.CustomerGraphicsDelay
;
import
com.yaoyaozw.customer.entity.CustomerGraphicsDelay
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.
kanban.
CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayListVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayListVO
;
...
@@ -22,7 +22,19 @@ import java.util.Set;
...
@@ -22,7 +22,19 @@ import java.util.Set;
*/
*/
public
interface
CustomerGraphicsDelayService
extends
IService
<
CustomerGraphicsDelay
>
{
public
interface
CustomerGraphicsDelayService
extends
IService
<
CustomerGraphicsDelay
>
{
List
<
CustomerDelayItemVO
>
findAllDelayCustomerMessage
(
Set
<
String
>
appidList
,
Integer
maxSortRage
);
/**
* 找到延时客服
* @param appidList
* @param maxSortRage
* @return
*/
List
<
CustomerDelayItemVO
>
findAllDelayCustomerSort
(
Set
<
String
>
appidList
,
Integer
maxSortRage
);
/**
* 更新发送人数
* @param voList
*/
void
updateSendNumById
(
Set
<
CustomerDelayItemVO
>
voList
);
/**
/**
* 插入客户延迟
* 插入客户延迟
...
...
src/main/java/com/yaoyaozw/customer/service/CustomerServiceCommonService.java
浏览文件 @
8755380d
package
com
.
yaoyaozw
.
customer
.
service
;
package
com
.
yaoyaozw
.
customer
.
service
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
...
...
src/main/java/com/yaoyaozw/customer/service/RegisterUserEntityService.java
浏览文件 @
8755380d
...
@@ -4,6 +4,7 @@ import com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO;
...
@@ -4,6 +4,7 @@ import com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
import
java.util.List
;
...
...
src/main/java/com/yaoyaozw/customer/service/impl/AccountOrderServiceImpl.java
浏览文件 @
8755380d
...
@@ -2,18 +2,14 @@ package com.yaoyaozw.customer.service.impl;
...
@@ -2,18 +2,14 @@ package com.yaoyaozw.customer.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.entity.CustomerDelayPublish
;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.yaoyaozw.customer.service.CustomerDelayPublishService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsDelayService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsDelayService
;
import
com.yaoyaozw.customer.service.RegisterUserEntityService
;
import
com.yaoyaozw.customer.service.RegisterUserEntityService
;
import
com.yaoyaozw.customer.vo.UserAvgAmountVO
;
import
com.yaoyaozw.customer.vo.
kanban.
UserAvgAmountVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -40,12 +36,15 @@ public class AccountOrderServiceImpl extends ServiceImpl<AccountOrderMapper, Acc
...
@@ -40,12 +36,15 @@ public class AccountOrderServiceImpl extends ServiceImpl<AccountOrderMapper, Acc
Set
<
String
>
openIdSet
=
runtimeOrders
.
stream
().
map
(
AccountOrder:
:
getOpenId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
openIdSet
=
runtimeOrders
.
stream
().
map
(
AccountOrder:
:
getOpenId
).
collect
(
Collectors
.
toSet
());
Map
<
String
,
List
<
AccountOrder
>>
userOrderMap
=
runtimeOrders
.
stream
().
collect
(
Collectors
.
groupingBy
(
AccountOrder:
:
getOpenId
));
Map
<
String
,
List
<
AccountOrder
>>
userOrderMap
=
runtimeOrders
.
stream
().
collect
(
Collectors
.
groupingBy
(
AccountOrder:
:
getOpenId
));
if
(!
openIdSet
.
isEmpty
()){
//获取注册用户信息
//获取注册用户信息
List
<
RegisterUserEntity
>
userList
=
registerUserEntityService
.
list
(
new
QueryWrapper
<
RegisterUserEntity
>().
in
(
RegisterUserEntity
.
COL_OPEN_ID
,
openIdSet
));
List
<
RegisterUserEntity
>
userList
=
registerUserEntityService
.
list
(
new
QueryWrapper
<
RegisterUserEntity
>().
in
(
RegisterUserEntity
.
COL_OPEN_ID
,
openIdSet
));
if
(!
userList
.
isEmpty
()){
Set
<
String
>
appIdSet
=
userList
.
stream
().
map
(
RegisterUserEntity:
:
getAppId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
appIdSet
=
userList
.
stream
().
map
(
RegisterUserEntity:
:
getAppId
).
collect
(
Collectors
.
toSet
());
List
<
CustomerDelayItemVO
>
allDelayCustomerMessage
=
customerGraphicsDelayService
.
findAllDelayCustomerMessage
(
appIdSet
,
2
);
List
<
CustomerDelayItemVO
>
allDelayCustomerMessage
=
customerGraphicsDelayService
.
findAllDelayCustomerSort
(
appIdSet
,
1
);
Map
<
String
,
Map
<
Integer
,
Long
>>
delayMessageMap
=
allDelayCustomerMessage
.
stream
().
collect
(
Collectors
.
groupingBy
(
CustomerDelayItemVO:
:
getAppId
,
Collectors
.
toMap
(
CustomerDelayItemVO:
:
getPostSort
,
CustomerDelayItemVO:
:
getTimeInterval
,
(
v1
,
v2
)
->
v2
)));
Map
<
String
,
Map
<
Integer
,
Long
>>
delayMessageMap
=
allDelayCustomerMessage
.
stream
().
collect
(
Collectors
.
groupingBy
(
CustomerDelayItemVO:
:
getAppId
,
Collectors
.
toMap
(
CustomerDelayItemVO:
:
getPostSort
,
CustomerDelayItemVO:
:
getTimeInterval
,
(
v1
,
v2
)
->
v2
)));
...
@@ -55,7 +54,7 @@ public class AccountOrderServiceImpl extends ServiceImpl<AccountOrderMapper, Acc
...
@@ -55,7 +54,7 @@ public class AccountOrderServiceImpl extends ServiceImpl<AccountOrderMapper, Acc
Date
lastFinishTime
=
registerUser
.
getLastActive
();
Date
lastFinishTime
=
registerUser
.
getLastActive
();
int
type
=
registerUser
.
getPayType
()!=
null
?
registerUser
.
getPayType
():
0
;
int
type
=
registerUser
.
getPayType
()!=
null
?
registerUser
.
getPayType
():
0
;
Double
sum
=
registerUser
.
getPayAmount
()
;
Double
sum
=
registerUser
.
getPayAmount
()!=
null
?
registerUser
.
getPayAmount
():
0
;
for
(
AccountOrder
accountOrder
:
accountOrders
)
{
for
(
AccountOrder
accountOrder
:
accountOrders
)
{
//最近活跃时间
//最近活跃时间
...
@@ -66,7 +65,9 @@ public class AccountOrderServiceImpl extends ServiceImpl<AccountOrderMapper, Acc
...
@@ -66,7 +65,9 @@ public class AccountOrderServiceImpl extends ServiceImpl<AccountOrderMapper, Acc
}
}
//计算用户信息
//计算用户信息
if
(
registerUser
.
getLastActive
()==
null
){
if
(
registerUser
.
getLastActive
()==
null
){
//排期重置....
//如果没有活跃时间,记录为首次活跃
registerUser
.
setFirstActive
(
lastFinishTime
);
//排期重置
delayCustomerManage
(
registerUser
,
lastFinishTime
,
delayMessageMap
);
delayCustomerManage
(
registerUser
,
lastFinishTime
,
delayMessageMap
);
}
}
//活跃时间重置
//活跃时间重置
...
@@ -80,7 +81,8 @@ public class AccountOrderServiceImpl extends ServiceImpl<AccountOrderMapper, Acc
...
@@ -80,7 +81,8 @@ public class AccountOrderServiceImpl extends ServiceImpl<AccountOrderMapper, Acc
}
}
registerUserEntityService
.
updateBatchById
(
userList
);
registerUserEntityService
.
updateBatchById
(
userList
);
}
}
}
}
...
@@ -113,27 +115,16 @@ public class AccountOrderServiceImpl extends ServiceImpl<AccountOrderMapper, Acc
...
@@ -113,27 +115,16 @@ public class AccountOrderServiceImpl extends ServiceImpl<AccountOrderMapper, Acc
Map
<
Integer
,
Long
>
integerLongMap
=
delayMessageMap
.
get
(
registerUserPublish
.
getAppId
());
Map
<
Integer
,
Long
>
integerLongMap
=
delayMessageMap
.
get
(
registerUserPublish
.
getAppId
());
if
(
integerLongMap
!=
null
&&!
integerLongMap
.
isEmpty
()){
if
(
integerLongMap
!=
null
&&!
integerLongMap
.
isEmpty
()){
//找初始排期间隔时间
Long
firstDelayMessage
=
integerLongMap
.
get
(
1
);
Long
firstDelayMessage
=
integerLongMap
.
get
(
1
);
Long
secondDelayMessage
=
integerLongMap
.
get
(
2
);
if
(
activeTime
.
getTime
()-
registerUserPublish
.
getGmtCreate
().
getTime
()<
firstDelayMessage
){
Date
publishTime
=
new
Date
(
activeTime
.
getTime
()
+
firstDelayMessage
);
Date
publishTime
=
new
Date
(
activeTime
.
getTime
()
+
firstDelayMessage
);
registerUserPublish
.
setCustomerSort
(
1
);
registerUserPublish
.
setCustomerSort
(
1
);
registerUserPublish
.
setCustomerPublish
(
publishTime
);
registerUserPublish
.
setCustomerPublish
(
publishTime
);
//如果活跃时间和注册时间的间隔小于首次排期间隔,则说明首次没发,从1序列开始排;否则从2序列开始排
}
else
{
Date
publishTime
=
new
Date
(
activeTime
.
getTime
()
+
secondDelayMessage
);
registerUserPublish
.
setCustomerSort
(
2
);
registerUserPublish
.
setCustomerPublish
(
publishTime
);
}
}
}
}
}
...
...
src/main/java/com/yaoyaozw/customer/service/impl/CrowdPackageServiceImpl.java
浏览文件 @
8755380d
package
com
.
yaoyaozw
.
customer
.
service
.
impl
;
package
com
.
yaoyaozw
.
customer
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.text.StrBuilder
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
...
@@ -10,10 +9,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...
@@ -10,10 +9,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.components.CustomerServiceCommonAsyncComponent
;
import
com.yaoyaozw.customer.components.CustomerServiceCommonAsyncComponent
;
import
com.yaoyaozw.customer.components.SnowflakeComponent
;
import
com.yaoyaozw.customer.components.TokenManager
;
import
com.yaoyaozw.customer.components.TokenManager
;
import
com.yaoyaozw.customer.constants.CrowdPackageCommonConstant
;
import
com.yaoyaozw.customer.constants.CrowdPackageCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.dto.crowd.CrowdPackageQueryDTO
;
import
com.yaoyaozw.customer.dto.crowd.CrowdPackageQueryDTO
;
import
com.yaoyaozw.customer.dto.crowd.CrowdPackageConditionDTO
;
import
com.yaoyaozw.customer.dto.crowd.CrowdPackageConditionDTO
;
import
com.yaoyaozw.customer.entity.CrowdPackage
;
import
com.yaoyaozw.customer.entity.CrowdPackage
;
...
@@ -26,8 +23,7 @@ import com.yaoyaozw.customer.mapper.RegisterUserEntityMapper;
...
@@ -26,8 +23,7 @@ import com.yaoyaozw.customer.mapper.RegisterUserEntityMapper;
import
com.yaoyaozw.customer.service.CrowdPackageConditionMatchService
;
import
com.yaoyaozw.customer.service.CrowdPackageConditionMatchService
;
import
com.yaoyaozw.customer.service.CrowdPackageConditionService
;
import
com.yaoyaozw.customer.service.CrowdPackageConditionService
;
import
com.yaoyaozw.customer.service.CrowdPackageService
;
import
com.yaoyaozw.customer.service.CrowdPackageService
;
import
com.yaoyaozw.customer.service.RegisterUserEntityService
;
import
com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.crowd.*
;
import
com.yaoyaozw.customer.vo.crowd.*
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -37,9 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -37,9 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
...
src/main/java/com/yaoyaozw/customer/service/impl/CustomerDelayPublishServiceImpl.java
浏览文件 @
8755380d
...
@@ -10,10 +10,7 @@ import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO;
...
@@ -10,10 +10,7 @@ import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.Future
;
import
java.util.concurrent.Future
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -44,16 +41,16 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
...
@@ -44,16 +41,16 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
@Override
@Override
public
void
sendCustomerDelayMessage
(
IntegrationRequestDTO
integrationRequestDTO
)
{
public
void
sendCustomerDelayMessage
(
IntegrationRequestDTO
integrationRequestDTO
)
{
//读取延时客服排期
人
//读取延时客服排期
List
<
CustomerDelayPublish
>
allPostUser
=
list
(
new
QueryWrapper
<
CustomerDelayPublish
>().
eq
(
CustomerDelayPublish
.
COL_CUSTOMER_PUBLISH
,
integrationRequestDTO
.
getRequestDate
()
));
List
<
CustomerDelayPublish
>
allPostUser
=
baseMapper
.
findPublishUser
(
integrationRequestDTO
.
getRequestDate
(
));
//涉及的appid
//涉及的appid
Set
<
String
>
appidSet
=
allPostUser
.
stream
().
map
(
CustomerDelayPublish:
:
getAppId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
appidSet
=
allPostUser
.
stream
().
map
(
CustomerDelayPublish:
:
getAppId
).
collect
(
Collectors
.
toSet
());
if
(!
allPostUser
.
isEmpty
()){
if
(!
allPostUser
.
isEmpty
()){
//号-用户
//号-用户
Map
<
String
,
List
<
CustomerDelayPublish
>>
userMap
=
allPostUser
.
stream
().
collect
(
Collectors
.
groupingBy
(
CustomerDelayPublish:
:
getAppId
));
Map
<
String
,
List
<
CustomerDelayPublish
>>
userMap
=
allPostUser
.
stream
().
filter
(
a
->
a
.
getCustomerSort
()!=
null
).
collect
(
Collectors
.
groupingBy
(
CustomerDelayPublish:
:
getAppId
));
//获取所有延时客服
//获取所有延时客服
List
<
CustomerDelayItemVO
>
allDelayCustomerMessage
=
customerGraphicsDelayService
.
findAllDelayCustomer
Message
(
appidSet
,
null
);
List
<
CustomerDelayItemVO
>
allDelayCustomerMessage
=
customerGraphicsDelayService
.
findAllDelayCustomer
Sort
(
appidSet
,
null
);
if
(
allDelayCustomerMessage
!=
null
&&!
allDelayCustomerMessage
.
isEmpty
()){
if
(
allDelayCustomerMessage
!=
null
&&!
allDelayCustomerMessage
.
isEmpty
()){
...
@@ -63,10 +60,12 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
...
@@ -63,10 +60,12 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
allDelayCustomerMessage
.
stream
().
collect
(
Collectors
.
groupingBy
(
CustomerDelayItemVO:
:
getAppId
,
allDelayCustomerMessage
.
stream
().
collect
(
Collectors
.
groupingBy
(
CustomerDelayItemVO:
:
getAppId
,
Collectors
.
toMap
(
CustomerDelayItemVO:
:
getPostSort
,
a
->
a
,
(
v1
,
v2
)
->
v2
)));
Collectors
.
toMap
(
CustomerDelayItemVO:
:
getPostSort
,
a
->
a
,
(
v1
,
v2
)
->
v2
)));
Set
<
CustomerDelayItemVO
>
needUpdateCustomerDelay
=
new
HashSet
<>();
for
(
Map
.
Entry
<
String
,
List
<
CustomerDelayPublish
>>
userEntry
:
userMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
CustomerDelayPublish
>>
userEntry
:
userMap
.
entrySet
())
{
String
appid
=
userEntry
.
getKey
();
String
appid
=
userEntry
.
getKey
();
//获取该号token
AuthorizerToken
authorizerToken
=
authorizerTokenService
.
findTokenByAppid
(
appid
);
AuthorizerToken
authorizerToken
=
authorizerTokenService
.
findTokenByAppid
(
appid
);
String
token
=
authorizerToken
.
getAuthorizerAppid
();
String
token
=
authorizerToken
.
getAuthorizerAppid
();
...
@@ -78,10 +77,10 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
...
@@ -78,10 +77,10 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
List
<
CustomerDelayPublish
>
userList
=
userEntry
.
getValue
();
List
<
CustomerDelayPublish
>
userList
=
userEntry
.
getValue
();
if
(
delaySortMap
!=
null
&&!
delaySortMap
.
isEmpty
()){
if
(
delaySortMap
!=
null
&&!
delaySortMap
.
isEmpty
()){
//将所有待用延时客服收集
for
(
CustomerDelayPublish
userPublish
:
userList
)
{
for
(
CustomerDelayPublish
userPublish
:
userList
)
{
//发送客服
//发送
延时
客服
futureList
.
add
(
weChatService
.
sendCustomerDelayMessage
(
token
,
userPublish
,
delaySortMap
))
;
futureList
.
add
(
weChatService
.
sendCustomerDelayMessage
(
authorizerToken
,
userPublish
,
delaySortMap
,
needUpdateCustomerDelay
))
;
}
}
}
}
}
}
...
@@ -95,8 +94,16 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
...
@@ -95,8 +94,16 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
if
(!
registerUserEntities
.
isEmpty
()){
updateBatchById
(
registerUserEntities
);
updateBatchById
(
registerUserEntities
);
}
}
//更新延时客服的发送人数数据
if
(!
needUpdateCustomerDelay
.
isEmpty
()){
customerGraphicsDelayService
.
updateSendNumById
(
needUpdateCustomerDelay
);
}
}
}
}
}
}
...
...
src/main/java/com/yaoyaozw/customer/service/impl/CustomerGraphicsDelayServiceImpl.java
浏览文件 @
8755380d
...
@@ -3,9 +3,6 @@ package com.yaoyaozw.customer.service.impl;
...
@@ -3,9 +3,6 @@ package com.yaoyaozw.customer.service.impl;
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.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
...
@@ -27,7 +24,7 @@ import com.yaoyaozw.customer.service.AuthorizerInfoService;
...
@@ -27,7 +24,7 @@ import com.yaoyaozw.customer.service.AuthorizerInfoService;
import
com.yaoyaozw.customer.service.CustomerGraphicsDelayService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsDelayService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.
kanban.
CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayListVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayListVO
;
...
@@ -64,17 +61,21 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
...
@@ -64,17 +61,21 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
@Override
@Override
public
List
<
CustomerDelayItemVO
>
findAllDelayCustomerMessage
(
Set
<
String
>
appidList
,
Integer
maxSortRange
)
{
public
List
<
CustomerDelayItemVO
>
findAllDelayCustomerSort
(
Set
<
String
>
appidList
,
Integer
maxSortRange
)
{
if
(
maxSortRange
!=
null
){
return
baseMapper
.
findDelayCustomerMessageByRange
(
appidList
,
maxSortRange
);
return
baseMapper
.
findDelayCustomerMessageByRange
(
appidList
,
maxSortRange
);
}
else
{
return
baseMapper
.
findAllDelayCustomerMessage
(
appidList
);
}
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateSendNumById
(
Set
<
CustomerDelayItemVO
>
voList
)
{
baseMapper
.
updateSendNumByVo
(
voList
);
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
BaseResult
insertCustomerDelay
(
CustomerDelaySaveDTO
saveDto
)
{
public
BaseResult
insertCustomerDelay
(
CustomerDelaySaveDTO
saveDto
)
{
...
...
src/main/java/com/yaoyaozw/customer/service/impl/CustomerGraphicsServiceImpl.java
浏览文件 @
8755380d
...
@@ -2,24 +2,14 @@ package com.yaoyaozw.customer.service.impl;
...
@@ -2,24 +2,14 @@ package com.yaoyaozw.customer.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
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.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.sun.xml.internal.bind.v2.TODO
;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.common.R
;
import
com.yaoyaozw.customer.components.CustomerServiceCommonAsyncComponent
;
import
com.yaoyaozw.customer.components.CustomerServiceCommonAsyncComponent
;
import
com.yaoyaozw.customer.components.SnowflakeComponent
;
import
com.yaoyaozw.customer.components.SnowflakeComponent
;
import
com.yaoyaozw.customer.components.TokenManager
;
import
com.yaoyaozw.customer.components.TokenManager
;
import
com.yaoyaozw.customer.constants.ApiResultConstant
;
import
com.yaoyaozw.customer.constants.CrowdPackageCommonConstant
;
import
com.yaoyaozw.customer.constants.CrowdPackageCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO
;
...
@@ -30,15 +20,10 @@ import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
...
@@ -30,15 +20,10 @@ import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
import
com.yaoyaozw.customer.entity.CrowdPackageCondition
;
import
com.yaoyaozw.customer.entity.CrowdPackageCondition
;
import
com.yaoyaozw.customer.entity.CrowdPackageConditionMatch
;
import
com.yaoyaozw.customer.entity.CrowdPackageConditionMatch
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.enums.CustomerStoreTemplateEnum
;
import
com.yaoyaozw.customer.feigns.ReferralFeignClient
;
import
com.yaoyaozw.customer.mapper.KanbanCommonMapper
;
import
com.yaoyaozw.customer.mapper.KanbanCommonMapper
;
import
com.yaoyaozw.customer.mapper.MaterialCommonMapper
;
import
com.yaoyaozw.customer.service.CrowdPackageConditionMatchService
;
import
com.yaoyaozw.customer.service.CrowdPackageConditionMatchService
;
import
com.yaoyaozw.customer.service.CrowdPackageConditionService
;
import
com.yaoyaozw.customer.service.CrowdPackageConditionService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.customer.*
;
import
com.yaoyaozw.customer.vo.customer.*
;
import
com.yaoyaozw.customer.service.*
;
import
com.yaoyaozw.customer.service.*
;
import
com.yaoyaozw.customer.service.wechat.service.WeChatService
;
import
com.yaoyaozw.customer.service.wechat.service.WeChatService
;
...
@@ -54,9 +39,6 @@ import java.util.*;
...
@@ -54,9 +39,6 @@ import java.util.*;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.List
;
import
java.util.List
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
...
@@ -237,7 +219,6 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
...
@@ -237,7 +219,6 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
List
<
CustomerGraphics
>
customerGraphicsList
=
list
(
new
QueryWrapper
<
CustomerGraphics
>().
eq
(
CustomerGraphics
.
COL_POST_TIME
,
requestDate
));
List
<
CustomerGraphics
>
customerGraphicsList
=
list
(
new
QueryWrapper
<
CustomerGraphics
>().
eq
(
CustomerGraphics
.
COL_POST_TIME
,
requestDate
));
for
(
CustomerGraphics
customerGraphics
:
customerGraphicsList
)
{
for
(
CustomerGraphics
customerGraphics
:
customerGraphicsList
)
{
customerGraphics
.
setSendCount
(
0
);
//人群包id
//人群包id
Long
packId
=
customerGraphics
.
getPackId
();
Long
packId
=
customerGraphics
.
getPackId
();
//根据人群包找人,并按appId分组
//根据人群包找人,并按appId分组
...
@@ -268,6 +249,7 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
...
@@ -268,6 +249,7 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
}
}
}
}
}
}
updateBatchById
(
customerGraphicsList
);
}
}
private
BaseResult
checkExtendBook
(
String
storeType
,
CrowdPackageConditionMatch
storeConditionMatch
)
{
private
BaseResult
checkExtendBook
(
String
storeType
,
CrowdPackageConditionMatch
storeConditionMatch
)
{
...
...
src/main/java/com/yaoyaozw/customer/service/impl/CustomerServiceCommonServiceImpl.java
浏览文件 @
8755380d
...
@@ -5,7 +5,7 @@ import com.yaoyaozw.customer.common.GenericsResult;
...
@@ -5,7 +5,7 @@ import com.yaoyaozw.customer.common.GenericsResult;
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.CustomerServiceCommonService
;
import
com.yaoyaozw.customer.service.CustomerServiceCommonService
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.
kanban.
CommonOptionResponseVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
...
src/main/java/com/yaoyaozw/customer/service/wechat/service/WeChatRestService.java
浏览文件 @
8755380d
...
@@ -23,6 +23,7 @@ import java.io.BufferedReader;
...
@@ -23,6 +23,7 @@ import java.io.BufferedReader;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.net.URI
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.net.URISyntaxException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Map
;
import
java.util.Map
;
@Service
@Service
...
@@ -69,10 +70,10 @@ public class WeChatRestService {
...
@@ -69,10 +70,10 @@ public class WeChatRestService {
}
}
public
<
T
>
Object
httpPostRequest
(
String
fullPath
,
Object
requestEntity
,
Class
<
T
>
responseEntity
)
throws
Exception
{
public
<
T
>
Object
httpPostRequest
(
UriComponentsBuilder
uriComponentsBuilder
,
Object
requestEntity
,
Class
<
T
>
responseEntity
)
throws
Exception
{
HttpClient
defaultHttpClient
=
HttpClients
.
createDefault
();
HttpClient
defaultHttpClient
=
HttpClients
.
createDefault
();
UriComponentsBuilder
uriComponentsBuilder
=
UriComponentsBuilder
.
fromHttpUrl
(
fullPath
);
HttpPost
httpPost
=
new
HttpPost
(
uriComponentsBuilder
.
toUriString
());
HttpPost
httpPost
=
new
HttpPost
(
uriComponentsBuilder
.
toUriString
());
httpPost
.
setHeader
(
"Content-Type"
,
"application/json;charset=utf-8"
);
httpPost
.
setHeader
(
"Content-Type"
,
"application/json;charset=utf-8"
);
if
(
requestEntity
!=
null
)
{
if
(
requestEntity
!=
null
)
{
...
@@ -84,11 +85,11 @@ public class WeChatRestService {
...
@@ -84,11 +85,11 @@ public class WeChatRestService {
HttpResponse
httpResponse
=
defaultHttpClient
.
execute
(
httpPost
);
HttpResponse
httpResponse
=
defaultHttpClient
.
execute
(
httpPost
);
if
(
httpResponse
.
getStatusLine
().
getStatusCode
()
!=
200
)
{
if
(
httpResponse
.
getStatusLine
().
getStatusCode
()
!=
200
)
{
String
errorLog
=
"请求失败,errorCode:"
+
httpResponse
.
getStatusLine
().
getStatusCode
();
String
errorLog
=
"请求失败,errorCode:"
+
httpResponse
.
getStatusLine
().
getStatusCode
();
throw
new
Exception
(
fullPath
+
errorLog
);
throw
new
Exception
(
errorLog
);
}
}
//读取返回信息
//读取返回信息
String
output
;
String
output
;
BufferedReader
bufferedReader
=
new
BufferedReader
(
new
InputStreamReader
(
httpResponse
.
getEntity
().
getContent
(),
"utf-8"
));
BufferedReader
bufferedReader
=
new
BufferedReader
(
new
InputStreamReader
(
httpResponse
.
getEntity
().
getContent
(),
StandardCharsets
.
UTF_8
));
StringBuilder
stringBuilder
=
new
StringBuilder
();
StringBuilder
stringBuilder
=
new
StringBuilder
();
while
((
output
=
bufferedReader
.
readLine
())
!=
null
)
{
while
((
output
=
bufferedReader
.
readLine
())
!=
null
)
{
stringBuilder
.
append
(
output
);
stringBuilder
.
append
(
output
);
...
...
src/main/java/com/yaoyaozw/customer/service/wechat/service/WeChatService.java
浏览文件 @
8755380d
...
@@ -10,6 +10,7 @@ import com.yaoyaozw.customer.vo.referral.ReferralEntityVo;
...
@@ -10,6 +10,7 @@ import com.yaoyaozw.customer.vo.referral.ReferralEntityVo;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.Future
;
import
java.util.concurrent.Future
;
public
interface
WeChatService
{
public
interface
WeChatService
{
...
@@ -17,8 +18,14 @@ public interface WeChatService {
...
@@ -17,8 +18,14 @@ public interface WeChatService {
/**
/**
* 发送延时客服消息
* 发送延时客服消息
*/
*/
Future
<
CustomerDelayPublish
>
sendCustomerDelayMessage
(
String
token
,
CustomerDelayPublish
user
,
Map
<
Integer
,
CustomerDelayItemVO
>
delaySortMap
);
Future
<
CustomerDelayPublish
>
sendCustomerDelayMessage
(
AuthorizerToken
authorizerToken
,
CustomerDelayPublish
user
,
Map
<
Integer
,
CustomerDelayItemVO
>
delaySortMap
,
Set
<
CustomerDelayItemVO
>
needUpdateVoList
);
/**
* 定时发送客服消息
*/
void
sendCustomerMessage
(
String
appid
,
AuthorizerToken
authorizerToken
,
CustomerGraphics
customerGraphics
,
List
<
CrowdPackageUserVO
>
openidList
,
List
<
ReferralEntityVo
>
referralEntityVo
);
void
sendCustomerMessage
(
String
appid
,
AuthorizerToken
authorizerToken
,
CustomerGraphics
customerGraphics
,
List
<
CrowdPackageUserVO
>
openidList
,
List
<
ReferralEntityVo
>
referralEntityVo
);
}
}
src/main/java/com/yaoyaozw/customer/service/wechat/service/WeChatServiceImpl.java
浏览文件 @
8755380d
...
@@ -5,6 +5,7 @@ import com.yaoyaozw.customer.constants.CustomerCommonConstant;
...
@@ -5,6 +5,7 @@ import com.yaoyaozw.customer.constants.CustomerCommonConstant;
import
com.yaoyaozw.customer.entity.AuthorizerToken
;
import
com.yaoyaozw.customer.entity.AuthorizerToken
;
import
com.yaoyaozw.customer.entity.CustomerDelayPublish
;
import
com.yaoyaozw.customer.entity.CustomerDelayPublish
;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
import
com.yaoyaozw.customer.service.AuthorizerTokenService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.service.wechat.entity.WeChatResponseEntity
;
import
com.yaoyaozw.customer.service.wechat.entity.WeChatResponseEntity
;
import
com.yaoyaozw.customer.service.wechat.entity.customerRequest.CustomerNewsArticleItem
;
import
com.yaoyaozw.customer.service.wechat.entity.customerRequest.CustomerNewsArticleItem
;
...
@@ -18,12 +19,10 @@ import org.springframework.http.ResponseEntity;
...
@@ -18,12 +19,10 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.AsyncResult
;
import
org.springframework.scheduling.annotation.AsyncResult
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.util.UriComponentsBuilder
;
import
java.net.URISyntaxException
;
import
java.net.URISyntaxException
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.*
;
import
java.util.concurrent.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -38,31 +37,72 @@ public class WeChatServiceImpl implements WeChatService{
...
@@ -38,31 +37,72 @@ public class WeChatServiceImpl implements WeChatService{
private
static
final
int
THREAD_NUM
=
1000
;
private
static
final
int
THREAD_NUM
=
1000
;
private
static
final
Integer
SUCCESS_CODE
=
0
;
private
static
final
Integer
EXPIRED_CODE
=
40001
;
private
static
final
ThreadPoolExecutor
EXECUTOR
=
new
ThreadPoolExecutor
(
20
,
100
,
60L
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<>(
2
),
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
private
static
final
ThreadPoolExecutor
EXECUTOR
=
new
ThreadPoolExecutor
(
20
,
100
,
60L
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<>(
2
),
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
private
final
static
Object
LOCK
=
new
Object
();
private
final
static
Object
CUSTOMER_LOCK
=
new
Object
();
@Autowired
private
AuthorizerTokenService
authorizerTokenService
;
@Autowired
@Autowired
private
WeChatRestService
weChatRestService
;
private
WeChatRestService
weChatRestService
;
@Async
(
"myExecutor"
)
@Async
(
"myExecutor"
)
@Override
@Override
public
Future
<
CustomerDelayPublish
>
sendCustomerDelayMessage
(
String
token
,
CustomerDelayPublish
user
,
Map
<
Integer
,
CustomerDelayItemVO
>
delaySortMap
)
{
public
Future
<
CustomerDelayPublish
>
sendCustomerDelayMessage
(
AuthorizerToken
authorizerToken
,
CustomerDelayPublish
user
,
Map
<
Integer
,
CustomerDelayItemVO
>
delaySortMap
,
Set
<
CustomerDelayItemVO
>
needUpdateVoList
)
{
//token
UriComponentsBuilder
uriComponentsBuilder
=
UriComponentsBuilder
.
fromHttpUrl
(
customerPath
).
queryParam
(
"access_token"
,
authorizerToken
.
getAuthorizerAccessToken
());
//找到延时序列
CustomerDelayItemVO
sendCustomerDelay
=
delaySortMap
.
get
(
user
.
getCustomerSort
());
if
(
sendCustomerDelay
!=
null
){
needUpdateVoList
.
add
(
sendCustomerDelay
);
//构建请求参数
WeChatCustomerRequestEntity
customerRequest
=
buildCustomerRequest
(
sendCustomerDelay
);
if
(
customerRequest
!=
null
){
customerRequest
.
setTouser
(
user
.
getOpenId
());
//System.err.println(user.getOpenId());
try
{
WeChatResponseEntity
response
=(
WeChatResponseEntity
)
weChatRestService
.
httpPostRequest
(
uriComponentsBuilder
,
customerRequest
,
WeChatResponseEntity
.
class
);
//System.err.println(response);
if
(
SUCCESS_CODE
.
equals
(
response
.
getErrcode
())){
//发送成功计数
sendCustomerDelay
.
updateSendNum
();
//当前时间批次发文素材的用户关注时间一致
}
else
if
(
EXPIRED_CODE
.
equals
(
response
.
getErrcode
())
){
Long
subscribeTimestamp
=
user
.
getGmtCreate
().
getTime
();
//token过期重新取一下
AuthorizerToken
updateToken
=
authorizerTokenService
.
findTokenByAppid
(
authorizerToken
.
getAuthorizerAppid
());
Integer
newSort
=
user
.
getCustomerSort
()+
1
;
return
sendCustomerDelayMessage
(
updateToken
,
user
,
delaySortMap
,
needUpdateVoList
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
//用户首次活跃时间
Long
subscribeTimestamp
=
user
.
getFirstActive
().
getTime
();
Set
<
Integer
>
sortSet
=
delaySortMap
.
keySet
();
//找最小
Integer
newSort
=
sortSet
.
stream
().
filter
(
a
->
a
>
user
.
getCustomerSort
()).
min
(
Comparator
.
naturalOrder
()).
orElse
(-
1
);
user
.
setCustomerSort
(
newSort
);
CustomerDelayItemVO
customerDelayItemVO
=
delaySortMap
.
get
(
newSort
);
CustomerDelayItemVO
customerDelayItemVO
=
delaySortMap
.
get
(
newSort
);
if
(
customerDelayItemVO
!=
null
&&
customerDelayItemVO
.
getTimeInterval
()!=
null
){
if
(
customerDelayItemVO
!=
null
&&
customerDelayItemVO
.
getTimeInterval
()!=
null
){
user
.
setCustomerSort
(
newSort
);
user
.
setCustomerPublish
(
new
Date
(
subscribeTimestamp
+
customerDelayItemVO
.
getTimeInterval
()));
user
.
setCustomerPublish
(
new
Date
(
subscribeTimestamp
+
customerDelayItemVO
.
getTimeInterval
()));
}
}
return
new
AsyncResult
<>(
user
);
return
new
AsyncResult
<>(
user
);
...
@@ -71,16 +111,15 @@ public class WeChatServiceImpl implements WeChatService{
...
@@ -71,16 +111,15 @@ public class WeChatServiceImpl implements WeChatService{
@Override
@Override
public
void
sendCustomerMessage
(
String
appid
,
AuthorizerToken
authorizerToken
,
CustomerGraphics
customerGraphics
,
List
<
CrowdPackageUserVO
>
openidList
,
List
<
ReferralEntityVo
>
referralEntityVo
)
{
public
void
sendCustomerMessage
(
String
appid
,
AuthorizerToken
authorizerToken
,
CustomerGraphics
customerGraphics
,
List
<
CrowdPackageUserVO
>
openidList
,
List
<
ReferralEntityVo
>
referralEntityVo
)
{
//
根据公众号发送客服
//
token
String
fullPath
=
customerPath
+
"?access_token="
+
authorizerToken
.
getAuthorizerAccessToken
(
);
UriComponentsBuilder
uriComponentsBuilder
=
UriComponentsBuilder
.
fromHttpUrl
(
customerPath
).
queryParam
(
"access_token"
,
authorizerToken
.
getAuthorizerAccessToken
()
);
//构建请求参数(文本/图文)
//构建请求参数(文本/图文)
WeChatCustomerRequestEntity
customerRequest
=
buildCustomerRequest
(
customerGraphics
,
referralEntityVo
);
WeChatCustomerRequestEntity
customerRequest
=
buildCustomerRequest
(
customerGraphics
,
referralEntityVo
);
if
(
customerRequest
!=
null
){
//计数器
//计数器
CountDownLatch
latch
=
new
CountDownLatch
(
openidList
.
size
());
CountDownLatch
latch
=
new
CountDownLatch
(
openidList
.
size
());
if
(
customerRequest
!=
null
){
for
(
int
i
=
0
;
i
<
openidList
.
size
();
i
+=
THREAD_NUM
)
{
for
(
int
i
=
0
;
i
<
openidList
.
size
();
i
+=
THREAD_NUM
)
{
List
<
CrowdPackageUserVO
>
subOpenidList
=
openidList
.
subList
(
i
,
Math
.
min
(
i
+
THREAD_NUM
,
openidList
.
size
()));
List
<
CrowdPackageUserVO
>
subOpenidList
=
openidList
.
subList
(
i
,
Math
.
min
(
i
+
THREAD_NUM
,
openidList
.
size
()));
...
@@ -94,13 +133,23 @@ public class WeChatServiceImpl implements WeChatService{
...
@@ -94,13 +133,23 @@ public class WeChatServiceImpl implements WeChatService{
try
{
try
{
System
.
err
.
println
(
customerRequest
.
getTouser
());
System
.
err
.
println
(
customerRequest
.
getTouser
());
WeChatResponseEntity
response
=(
WeChatResponseEntity
)
weChatRestService
.
httpPostRequest
(
fullPath
,
customerRequest
,
WeChatResponseEntity
.
class
);
WeChatResponseEntity
response
=(
WeChatResponseEntity
)
weChatRestService
.
httpPostRequest
(
uriComponentsBuilder
,
customerRequest
,
WeChatResponseEntity
.
class
);
if
(
SUCCESS_CODE
.
equals
(
response
.
getErrcode
())){
//线程锁
//线程锁
synchronized
(
LOCK
){
synchronized
(
CUSTOMER_LOCK
){
//发送成功计数
customerGraphics
.
updateCount
();
customerGraphics
.
updateCount
();
}
}
System
.
err
.
println
(
response
);
System
.
err
.
println
(
response
);
}
else
if
(
EXPIRED_CODE
.
equals
(
response
.
getErrcode
())
){
Thread
.
sleep
(
500
);
//token过期重新取一下
synchronized
(
uriComponentsBuilder
){
AuthorizerToken
updateToken
=
authorizerTokenService
.
findTokenByAppid
(
appid
);
uriComponentsBuilder
.
replaceQueryParam
(
"access_token"
,
updateToken
.
getAuthorizerAccessToken
());
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -110,11 +159,42 @@ public class WeChatServiceImpl implements WeChatService{
...
@@ -110,11 +159,42 @@ public class WeChatServiceImpl implements WeChatService{
}
}
});
});
}
}
try
{
latch
.
await
();
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
/**
* 延时客服参数构建
* @param customerDelay
* @return
*/
private
WeChatCustomerRequestEntity
buildCustomerRequest
(
CustomerDelayItemVO
customerDelay
)
{
//类型判断
if
(
CUSTOMER_TEXT
.
equals
(
customerDelay
.
getType
())){
//文本类
return
new
WeChatCustomerRequestEntity
(
CUSTOMER_TEXT
,
customerDelay
.
getContent
());
}
else
if
(
CUSTOMER_NEWS
.
equals
(
customerDelay
.
getType
())){
//图文类
return
new
WeChatCustomerRequestEntity
(
CUSTOMER_NEWS
,
customerDelay
.
getExtendTitle
(),
customerDelay
.
getContent
(),
customerDelay
.
getSourceUrl
(),
customerDelay
.
getCoverUrl
());
}
return
null
;
}
/**
* 定时客服参数构建
* @param customerGraphics
* @param urlList
* @return
*/
private
WeChatCustomerRequestEntity
buildCustomerRequest
(
CustomerGraphics
customerGraphics
,
List
<
ReferralEntityVo
>
urlList
){
private
WeChatCustomerRequestEntity
buildCustomerRequest
(
CustomerGraphics
customerGraphics
,
List
<
ReferralEntityVo
>
urlList
){
//类型判断
//类型判断
if
(
CUSTOMER_TEXT
.
equals
(
customerGraphics
.
getType
())){
if
(
CUSTOMER_TEXT
.
equals
(
customerGraphics
.
getType
())){
...
@@ -145,4 +225,6 @@ public class WeChatServiceImpl implements WeChatService{
...
@@ -145,4 +225,6 @@ public class WeChatServiceImpl implements WeChatService{
}
}
return
null
;
return
null
;
}
}
}
}
src/main/java/com/yaoyaozw/customer/vo/crowd/ConditionOptionResponseVO.java
浏览文件 @
8755380d
package
com
.
yaoyaozw
.
customer
.
vo
.
crowd
;
package
com
.
yaoyaozw
.
customer
.
vo
.
crowd
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.
kanban.
CommonOptionResponseVO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
...
...
src/main/java/com/yaoyaozw/customer/vo/crowd/CrowdPackageConditionVO.java
浏览文件 @
8755380d
...
@@ -2,13 +2,11 @@ package com.yaoyaozw.customer.vo.crowd;
...
@@ -2,13 +2,11 @@ package com.yaoyaozw.customer.vo.crowd;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yaoyaozw.customer.vo.CommonOptionResponseVO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.List
;
/**
/**
* @author darker
* @author darker
...
...
src/main/java/com/yaoyaozw/customer/vo/customer/CustomerDelayItemVO.java
浏览文件 @
8755380d
...
@@ -2,6 +2,7 @@ package com.yaoyaozw.customer.vo.customer;
...
@@ -2,6 +2,7 @@ package com.yaoyaozw.customer.vo.customer;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -9,21 +10,20 @@ import java.io.Serializable;
...
@@ -9,21 +10,20 @@ import java.io.Serializable;
* @author darker
* @author darker
* @date 2022/9/16 10:45
* @date 2022/9/16 10:45
*/
*/
@Data
@Data
@EqualsAndHashCode
(
of
=
"id"
)
public
class
CustomerDelayItemVO
implements
Serializable
{
public
class
CustomerDelayItemVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4630777409975737444L
;
private
static
final
long
serialVersionUID
=
-
4630777409975737444L
;
private
Long
id
;
/**
/**
* appid
* appid
*/
*/
private
String
appId
;
private
String
appId
;
/**
/**
* 客服消息id
*/
private
Long
customerInfoId
;
/**
* 发送序列
* 发送序列
*/
*/
private
Integer
postSort
;
private
Integer
postSort
;
...
@@ -33,4 +33,51 @@ public class CustomerDelayItemVO implements Serializable {
...
@@ -33,4 +33,51 @@ public class CustomerDelayItemVO implements Serializable {
*/
*/
private
Long
timeInterval
;
private
Long
timeInterval
;
/**
* 类型
*/
private
String
type
;
/**
* 推广标题
*/
private
String
extendTitle
;
/**
* 文本内容
*/
private
String
content
;
/**
* 图文原文链接
*/
private
String
sourceUrl
;
/**
* 图片
*/
private
String
coverUrl
;
/**
* 送达人数
*/
private
Integer
sendNum
;
/**
* 计数锁
*/
private
final
Object
LOCK
;
public
CustomerDelayItemVO
()
{
this
.
LOCK
=
new
Object
();
}
public
void
updateSendNum
(){
synchronized
(
LOCK
){
this
.
sendNum
++;
}
}
}
}
src/main/java/com/yaoyaozw/customer/vo/kanban/CommonCostSetupVo.java
0 → 100644
浏览文件 @
8755380d
package
com
.
yaoyaozw
.
customer
.
vo
.
kanban
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author wgh
* @date 2022/10/17 18:24
*/
@Data
public
class
CommonCostSetupVo
implements
Serializable
{
private
Long
id
;
private
String
appId
;
private
Date
costDate
;
}
src/main/java/com/yaoyaozw/customer/vo/CommonOptionResponseVO.java
→
src/main/java/com/yaoyaozw/customer/vo/
kanban/
CommonOptionResponseVO.java
浏览文件 @
8755380d
package
com
.
yaoyaozw
.
customer
.
vo
;
package
com
.
yaoyaozw
.
customer
.
vo
.
kanban
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
src/main/java/com/yaoyaozw/customer/vo/UserAvgAmountVO.java
→
src/main/java/com/yaoyaozw/customer/vo/
kanban/
UserAvgAmountVO.java
浏览文件 @
8755380d
package
com
.
yaoyaozw
.
customer
.
vo
;
package
com
.
yaoyaozw
.
customer
.
vo
.
kanban
;
import
lombok.Data
;
import
lombok.Data
;
...
...
src/main/resources/bootstrap.yml
浏览文件 @
8755380d
...
@@ -18,7 +18,7 @@ spring:
...
@@ -18,7 +18,7 @@ spring:
namespace
:
062507b6-b1d7-4aac-8ed8-0da1cd9451e1
namespace
:
062507b6-b1d7-4aac-8ed8-0da1cd9451e1
file-extension
:
yml
file-extension
:
yml
ext-config
:
ext-config
:
-
data-id
:
customer-service-
test
.yml
-
data-id
:
customer-service-
dev
.yml
group
:
DEFAULT_GROUP
group
:
DEFAULT_GROUP
refresh
:
true
refresh
:
true
---
---
...
...
src/main/resources/mapper/AccountOrderMapper.xml
浏览文件 @
8755380d
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
<select
id=
"findMonthDailyAccountOrder"
resultType=
"com.yaoyaozw.customer.vo.UserAvgAmountVO"
>
<select
id=
"findMonthDailyAccountOrder"
resultType=
"com.yaoyaozw.customer.vo.
kanban.
UserAvgAmountVO"
>
SELECT
SELECT
open_id,convert(SUM(profit)/(if(datediff(CURDATE(),user_subscribe_time)
<
30,datediff(CURDATE(),user_subscribe_time),30)),decimal(8,2))
open_id,convert(SUM(profit)/(if(datediff(CURDATE(),user_subscribe_time)
<
30,datediff(CURDATE(),user_subscribe_time),30)),decimal(8,2))
FROM
FROM
...
...
src/main/resources/mapper/CustomerDelayPublishMapper.xml
浏览文件 @
8755380d
...
@@ -10,9 +10,21 @@
...
@@ -10,9 +10,21 @@
<result
column=
"pay_type"
jdbcType=
"TINYINT"
property=
"payType"
/>
<result
column=
"pay_type"
jdbcType=
"TINYINT"
property=
"payType"
/>
<result
column=
"customer_sort"
jdbcType=
"INTEGER"
property=
"customerSort"
/>
<result
column=
"customer_sort"
jdbcType=
"INTEGER"
property=
"customerSort"
/>
<result
column=
"customer_publish"
jdbcType=
"TIMESTAMP"
property=
"customerPublish"
/>
<result
column=
"customer_publish"
jdbcType=
"TIMESTAMP"
property=
"customerPublish"
/>
<result
column=
"first_active"
jdbcType=
"TIMESTAMP"
property=
"firstActive"
/>
<result
column=
"gmt_create"
jdbcType=
"TIMESTAMP"
property=
"gmtCreate"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
id, app_id, open_id, pay_type, customer_sort, customer_publish
id, app_id, open_id, pay_type, customer_sort, customer_publish
</sql>
</sql>
<select
id=
"findPublishUser"
resultMap=
"BaseResultMap"
>
select id,app_id,open_id,pay_type,first_active ,customer_sort,customer_publish, gmt_create
from register_user_entity
where customer_publish=#{requestDate} and customer_sort>0
</select>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mapper/CustomerGraphicsDelayMapper.xml
浏览文件 @
8755380d
...
@@ -20,18 +20,24 @@
...
@@ -20,18 +20,24 @@
is_deleted
is_deleted
</sql>
</sql>
<update
id=
"updateSendNumByVo"
>
<select
id=
"findAllDelayCustomerMessage"
resultType=
"com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO"
>
<foreach
collection=
"CustomerDelayItems"
item=
"itemVo"
separator=
";"
>
update customer_graphics_delay set send_num = #{itemVo.sendNum} where id=#{itemVo.id}
select * from customer_graphics_delay
</foreach>
</update>
</select>
<select
id=
"findDelayCustomerMessageByRange"
resultType=
"com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO"
>
<select
id=
"findDelayCustomerMessageByRange"
resultType=
"com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO"
>
select * from customer_graphics_delay where post_sort
<
#{maxSort}
select * from customer_graphics_delay
where send_status=9 and is_deleted=0 and app_id in
<foreach
collection=
"appidList"
item=
"appid"
separator=
","
open=
"("
close=
")"
>
#{appid}
</foreach>
<if
test=
"maxSort != null and maxSort != ''"
>
and post_sort
<
= #{maxSort}
</if>
</select>
</select>
...
@@ -78,7 +84,7 @@
...
@@ -78,7 +84,7 @@
</select>
</select>
<select
id=
"getTimeIntervalList"
resultType=
"com.yaoyaozw.customer.vo.CommonOptionResponseVO"
>
<select
id=
"getTimeIntervalList"
resultType=
"com.yaoyaozw.customer.vo.
kanban.
CommonOptionResponseVO"
>
select
select
dic_value as name,
dic_value as name,
dic_key as `key`
dic_key as `key`
...
...
src/main/resources/mapper/KanbanCommonMapper.xml
浏览文件 @
8755380d
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.yaoyaozw.customer.mapper.KanbanCommonMapper"
>
<mapper
namespace=
"com.yaoyaozw.customer.mapper.KanbanCommonMapper"
>
<select
id=
"getConditionOptionByConfig"
resultType=
"com.yaoyaozw.customer.vo.CommonOptionResponseVO"
>
<select
id=
"getConditionOptionByConfig"
resultType=
"com.yaoyaozw.customer.vo.
kanban.
CommonOptionResponseVO"
>
select
select
${conditionItem.keyColumn} as `key`,
${conditionItem.keyColumn} as `key`,
${conditionItem.nameColumn} as `name`
${conditionItem.nameColumn} as `name`
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
</select>
</select>
<select
id=
"getStoreTypeEntity"
resultType=
"com.yaoyaozw.customer.vo.CommonOptionResponseVO"
>
<select
id=
"getStoreTypeEntity"
resultType=
"com.yaoyaozw.customer.vo.
kanban.
CommonOptionResponseVO"
>
select
select
store_type as `key`,
store_type as `key`,
store_name as `name`
store_name as `name`
...
@@ -44,4 +44,10 @@
...
@@ -44,4 +44,10 @@
#{storeKey}
#{storeKey}
</foreach>
</foreach>
</select>
</select>
<select
id=
"getWechatCostSetup"
resultType=
"com.yaoyaozw.customer.vo.kanban.CommonCostSetupVo"
>
select id,app_id,cost_date from account_cost_setup where app_id =#{appid}
</select>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mapper/MaterialCommonMapper.xml
浏览文件 @
8755380d
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.yaoyaozw.customer.mapper.MaterialCommonMapper"
>
<mapper
namespace=
"com.yaoyaozw.customer.mapper.MaterialCommonMapper"
>
<select
id=
"getStoreList"
resultType=
"com.yaoyaozw.customer.vo.CommonOptionResponseVO"
>
<select
id=
"getStoreList"
resultType=
"com.yaoyaozw.customer.vo.
kanban.
CommonOptionResponseVO"
>
select
select
`value` as `key`,
`value` as `key`,
explanation as `name`
explanation as `name`
...
...
src/main/resources/mapper/MaterialCrowdPackageMapper.xml
浏览文件 @
8755380d
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.yaoyaozw.customer.mapper.MaterialCrowdPackageMapper"
>
<mapper
namespace=
"com.yaoyaozw.customer.mapper.MaterialCrowdPackageMapper"
>
<select
id=
"getConditionOptionByConfig"
resultType=
"com.yaoyaozw.customer.vo.CommonOptionResponseVO"
>
<select
id=
"getConditionOptionByConfig"
resultType=
"com.yaoyaozw.customer.vo.
kanban.
CommonOptionResponseVO"
>
select
select
${conditionItem.keyColumn} as `key`,
${conditionItem.keyColumn} as `key`,
${conditionItem.nameColumn} as `name`
${conditionItem.nameColumn} as `name`
...
...
src/main/resources/mapper/RegisterUserEntityMapper.xml
浏览文件 @
8755380d
...
@@ -99,4 +99,26 @@
...
@@ -99,4 +99,26 @@
</select>
</select>
<resultMap
id=
"updateSetupMap"
type=
"com.yaoyaozw.customer.entity.RegisterUserEntity"
>
<!--@mbg.generated-->
<!--@Table register_user_entity-->
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"app_id"
jdbcType=
"VARCHAR"
property=
"appId"
/>
<result
column=
"format_date"
jdbcType=
"TIMESTAMP"
property=
"formatDate"
/>
</resultMap>
<select
id=
"existAppid"
resultType=
"com.yaoyaozw.customer.entity.AuthorizerInfo"
>
select authinfo.appid,authinfo.nick_name from (select app_id from register_user_entity GROUP BY app_id) existAppid left join authorizer_info authinfo
on existAppid.app_id=authinfo.appid where authinfo.appid is not null
</select>
<select
id=
"findAllUserWithoutSetupId"
resultMap=
"updateSetupMap"
>
select id,app_id,DATE_FORMAT(gmt_create,'%Y-%m-%d') as format_date from register_user_entity where setup_id is null and app_id=#{appid}
</select>
</mapper>
</mapper>
\ No newline at end of file
src/test/java/test.java
0 → 100644
浏览文件 @
8755380d
import
com.yaoyaozw.customer.CustomerServiceApplication
;
import
com.yaoyaozw.customer.entity.AuthorizerInfo
;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.yaoyaozw.customer.mapper.KanbanCommonMapper
;
import
com.yaoyaozw.customer.mapper.RegisterUserEntityMapper
;
import
com.yaoyaozw.customer.service.RegisterUserEntityService
;
import
com.yaoyaozw.customer.vo.kanban.CommonCostSetupVo
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author wgh
* @date 2022/10/17 19:20
*/
@SpringBootTest
(
classes
=
CustomerServiceApplication
.
class
)
@RunWith
(
SpringRunner
.
class
)
public
class
test
{
@Autowired
private
KanbanCommonMapper
kanbanCommonMapper
;
@Autowired
private
RegisterUserEntityMapper
registerUserEntityMapper
;
@Autowired
private
RegisterUserEntityService
registerUserEntityService
;
@Test
public
void
updateSetupId
(){
List
<
AuthorizerInfo
>
appidList
=
registerUserEntityMapper
.
existAppid
();
if
(
appidList
!=
null
){
for
(
AuthorizerInfo
authInfo
:
appidList
)
{
String
appid
=
authInfo
.
getAppid
();
System
.
err
.
println
(
"开始:"
+
authInfo
.
getNickName
());
List
<
CommonCostSetupVo
>
wechatCostSetup
=
kanbanCommonMapper
.
getWechatCostSetup
(
appid
);
if
(
wechatCostSetup
!=
null
){
Map
<
Date
,
Long
>
setupMap
=
wechatCostSetup
.
stream
().
collect
(
Collectors
.
toMap
(
CommonCostSetupVo:
:
getCostDate
,
CommonCostSetupVo:
:
getId
,
(
v1
,
v2
)
->
v1
));
List
<
RegisterUserEntity
>
allUser
=
registerUserEntityMapper
.
findAllUserWithoutSetupId
(
appid
);
System
.
err
.
println
(
"总计:"
+
allUser
.
size
());
for
(
RegisterUserEntity
user
:
allUser
){
user
.
setSetupId
(
setupMap
.
get
(
user
.
getFormatDate
())
);
}
registerUserEntityService
.
updateBatchById
(
allUser
);
System
.
err
.
println
(
"====>完成:"
+
authInfo
.
getNickName
());
}
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论