Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
82b11240
提交
82b11240
authored
11月 15, 2022
作者:
gh
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
09cd46ef
931865c5
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
30 行增加
和
49 行删除
+30
-49
TestController.java
...java/com/yaoyaozw/customer/controller/TestController.java
+14
-45
CustomerStoreTemplateEnum.java
...om/yaoyaozw/customer/enums/CustomerStoreTemplateEnum.java
+2
-2
KanbanCommonMapper.java
...java/com/yaoyaozw/customer/mapper/KanbanCommonMapper.java
+6
-0
CrowdPackageServiceImpl.java
...oyaozw/customer/service/impl/CrowdPackageServiceImpl.java
+0
-2
KanbanCommonMapper.xml
src/main/resources/mapper/KanbanCommonMapper.xml
+8
-0
没有找到文件。
src/main/java/com/yaoyaozw/customer/controller/TestController.java
浏览文件 @
82b11240
...
@@ -6,9 +6,11 @@ import com.rabbitmq.client.Channel;
...
@@ -6,9 +6,11 @@ import com.rabbitmq.client.Channel;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.constants.RabbitCommonNameConstant
;
import
com.yaoyaozw.customer.constants.RabbitCommonNameConstant
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.mapper.KanbanCommonMapper
;
import
com.yaoyaozw.customer.service.AccountOrderService
;
import
com.yaoyaozw.customer.service.AccountOrderService
;
import
com.yaoyaozw.customer.service.CustomerDelayPublishService
;
import
com.yaoyaozw.customer.service.CustomerDelayPublishService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsService
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.amqp.rabbit.core.ChannelCallback
;
import
org.springframework.amqp.rabbit.core.ChannelCallback
;
...
@@ -20,6 +22,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -20,6 +22,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
/**
* @author wgh
* @author wgh
...
@@ -30,6 +35,8 @@ import java.util.Calendar;
...
@@ -30,6 +35,8 @@ import java.util.Calendar;
@RequestMapping
(
"/customer-service/test"
)
@RequestMapping
(
"/customer-service/test"
)
public
class
TestController
{
public
class
TestController
{
private
final
static
String
STORE_ENTITY_REDIS_KEY
=
"STORE_NAME_MAP"
;
@Autowired
@Autowired
private
CustomerGraphicsService
customerGraphicsService
;
private
CustomerGraphicsService
customerGraphicsService
;
@Autowired
@Autowired
...
@@ -40,6 +47,8 @@ public class TestController {
...
@@ -40,6 +47,8 @@ public class TestController {
private
RabbitTemplate
rabbitTemplate
;
private
RabbitTemplate
rabbitTemplate
;
@Autowired
@Autowired
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
@Autowired
private
KanbanCommonMapper
kanbanCommonMapper
;
@GetMapping
(
"/CustomerTest"
)
@GetMapping
(
"/CustomerTest"
)
public
void
test
(){
public
void
test
(){
...
@@ -85,52 +94,12 @@ public class TestController {
...
@@ -85,52 +94,12 @@ public class TestController {
accountOrderService
.
activeUserByOrder
(
integrationRequestDTO
);
accountOrderService
.
activeUserByOrder
(
integrationRequestDTO
);
}
}
@GetMapping
(
"/ygLimit"
)
@GetMapping
(
"/putRedisStore"
)
public
void
ygLimit
(){
public
void
redisStore
()
{
List
<
AuthInfoVO
>
allStoreList
=
kanbanCommonMapper
.
getAllStoreList
();
limit
();
Map
<
String
,
String
>
storeMap
=
allStoreList
.
stream
().
collect
(
Collectors
.
toMap
(
AuthInfoVO:
:
getStoreType
,
AuthInfoVO:
:
getStoreTypeName
));
redisTemplate
.
opsForHash
().
putAll
(
STORE_ENTITY_REDIS_KEY
,
storeMap
);
}
private
void
limit
()
{
boolean
go
;
synchronized
(
rabbitTemplate
)
{
// 从redis查询计数
Object
count
=
redisTemplate
.
opsForValue
().
get
(
CustomerCommonConstant
.
YANG_GUANG_ACCESS_LIMIT_REDIS_KEY
);
if
(
ObjectUtil
.
isNull
(
count
))
{
// redis中没有,设置0
redisTemplate
.
opsForValue
().
set
(
CustomerCommonConstant
.
YANG_GUANG_ACCESS_LIMIT_REDIS_KEY
,
0
);
count
=
0
;
}
log
.
info
(
"当前count: {}"
,
count
);
long
stamp
=
System
.
currentTimeMillis
();
// 判断计数是否达到上限
go
=
(
Integer
)
count
<
40
;
if
(
go
)
{
// 没有达到上限,发送消息并且计数加1
rabbitTemplate
.
convertAndSend
(
RabbitCommonNameConstant
.
OPERATE_COMMON_EXCHANGE
,
RabbitCommonNameConstant
.
YG_LIMIT_TTL_ROUTE_KEY
,
stamp
);
redisTemplate
.
opsForValue
().
increment
(
CustomerCommonConstant
.
YANG_GUANG_ACCESS_LIMIT_REDIS_KEY
);
}
}
if
(!
go
)
{
// 计数达到上限了,休眠30秒,递归调用
try
{
log
.
info
(
"达到上限, 休眠15秒"
);
Thread
.
sleep
(
15000
);
limit
();
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
}
@RabbitListener
(
queues
=
RabbitCommonNameConstant
.
YG_LIMIT_DEATH_QUEUE
)
public
void
listener
()
{
log
.
info
(
"消费"
);
redisTemplate
.
opsForValue
().
decrement
(
CustomerCommonConstant
.
YANG_GUANG_ACCESS_LIMIT_REDIS_KEY
);
}
}
}
}
src/main/java/com/yaoyaozw/customer/enums/CustomerStoreTemplateEnum.java
浏览文件 @
82b11240
...
@@ -14,8 +14,8 @@ public enum CustomerStoreTemplateEnum {
...
@@ -14,8 +14,8 @@ public enum CustomerStoreTemplateEnum {
YANG_GUANG
(
"YANG_GUANG"
,
"5"
),
YANG_GUANG
(
"YANG_GUANG"
,
"5"
),
YUE_WEN
(
"YUE_WEN"
,
"1"
),
YUE_WEN
(
"YUE_WEN"
,
"1"
),
ZHANG_ZHONG_YUN
(
"ZHANG_ZHONG_YUN"
,
"1"
),
ZHANG_ZHONG_YUN
(
"ZHANG_ZHONG_YUN"
,
"1
5
"
),
ZHANG_DU
(
"ZHANG_DU"
,
"
1
"
)
ZHANG_DU
(
"ZHANG_DU"
,
"
0
"
)
;
;
...
...
src/main/java/com/yaoyaozw/customer/mapper/KanbanCommonMapper.java
浏览文件 @
82b11240
...
@@ -2,6 +2,7 @@ package com.yaoyaozw.customer.mapper;
...
@@ -2,6 +2,7 @@ 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.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.kanban.CommonCostSetupVo
;
import
com.yaoyaozw.customer.vo.kanban.CommonCostSetupVo
;
import
com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -55,4 +56,9 @@ public interface KanbanCommonMapper {
...
@@ -55,4 +56,9 @@ public interface KanbanCommonMapper {
List
<
CommonCostSetupVo
>
getWechatCostSetup
(
@Param
(
"appid"
)
String
appid
);
List
<
CommonCostSetupVo
>
getWechatCostSetup
(
@Param
(
"appid"
)
String
appid
);
/**
* @return {@link List}<{@link AuthInfoVO}>
*/
List
<
AuthInfoVO
>
getAllStoreList
();
}
}
src/main/java/com/yaoyaozw/customer/service/impl/CrowdPackageServiceImpl.java
浏览文件 @
82b11240
...
@@ -272,8 +272,6 @@ public class CrowdPackageServiceImpl extends ServiceImpl<MaterialCrowdPackageMap
...
@@ -272,8 +272,6 @@ public class CrowdPackageServiceImpl extends ServiceImpl<MaterialCrowdPackageMap
if
(
CollectionUtil
.
isNotEmpty
(
resultList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
resultList
))
{
super
.
updateBatchById
(
resultList
);
super
.
updateBatchById
(
resultList
);
}
}
LOCAL_LOG
.
info
(
"删除创建时的临时数据"
);
super
.
remove
(
new
QueryWrapper
<
CrowdPackage
>().
isNull
(
"package_name"
));
}
}
/**
/**
...
...
src/main/resources/mapper/KanbanCommonMapper.xml
浏览文件 @
82b11240
...
@@ -51,4 +51,11 @@
...
@@ -51,4 +51,11 @@
</select>
</select>
<select
id=
"getAllStoreList"
resultType=
"com.yaoyaozw.customer.vo.AuthInfoVO"
>
select
store_name as storeTypeName,
store_type as storeType
from store_entity
where is_deleted = 0 and pct_type = 'PROFIT_PCT'
</select>
</mapper>
</mapper>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论