Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-api-boot-master
Commits
b2238b69
Commit
b2238b69
authored
Aug 02, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单V值触发使用mq
parent
ef6c09cc
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
425 additions
and
14 deletions
+425
-14
ScoreProducerApi.java
.../cn/iocoder/yudao/module/member/api/ScoreProducerApi.java
+11
-0
ScoreRuleController.java
...ember/controller/admin/scoreRule/ScoreRuleController.java
+10
-4
ScoreConsumer.java
.../yudao/module/member/mq/consumer/score/ScoreConsumer.java
+26
-0
OderVStrategy.java
...o/module/member/mq/consumer/score/core/OderVStrategy.java
+223
-0
RecommendStrategy.java
...dule/member/mq/consumer/score/core/RecommendStrategy.java
+22
-0
RegisterStrategy.java
...odule/member/mq/consumer/score/core/RegisterStrategy.java
+23
-0
ScoreRuleStrategy.java
...dule/member/mq/consumer/score/core/ScoreRuleStrategy.java
+11
-0
ScoreRuleStrategyFactory.java
...mber/mq/consumer/score/core/ScoreRuleStrategyFactory.java
+27
-0
ScoreMessage.java
.../iocoder/yudao/module/member/mq/message/ScoreMessage.java
+21
-0
ScoreProducer.java
.../yudao/module/member/mq/producer/score/ScoreProducer.java
+37
-0
pom.xml
yudao-module-shipment/yudao-module-shipment-core/pom.xml
+5
-1
BoxServiceImpl.java
...der/yudao/module/shipment/service/box/BoxServiceImpl.java
+9
-9
No files found.
yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/ScoreProducerApi.java
0 → 100644
View file @
b2238b69
package
cn
.
iocoder
.
yudao
.
module
.
member
.
api
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
/**
* @author zhangfeng
*/
public
interface
ScoreProducerApi
{
void
sendOderMessage
(
ScoreRuleTypeEnum
scoreRuleType
,
Long
orderId
);
void
sendRecommendMessage
(
ScoreRuleTypeEnum
scoreRuleType
,
Long
userId
);
void
sendRegisterMessage
(
ScoreRuleTypeEnum
scoreRuleType
,
Long
userId
);
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/admin/scoreRule/ScoreRuleController.java
View file @
b2238b69
package
cn
.
iocoder
.
yudao
.
module
.
member
.
controller
.
admin
.
scoreRule
;
import
cn.iocoder.yudao.framework.apollo.core.event.OrderInShippingEvent
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.excel.util.ExcelUtils
;
...
...
@@ -8,8 +7,10 @@ import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import
cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog
;
import
cn.iocoder.yudao.module.depository.service.warehouse.WarehouseService
;
import
cn.iocoder.yudao.module.depository.vo.warehouse.WarehouseTreeRegionVO
;
import
cn.iocoder.yudao.module.member.api.ScoreProducerApi
;
import
cn.iocoder.yudao.module.member.convert.scoreRule.ScoreRuleConvert
;
import
cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
cn.iocoder.yudao.module.member.service.scoreRule.ScoreRuleService
;
import
cn.iocoder.yudao.module.member.vo.scoreRule.*
;
import
io.swagger.annotations.Api
;
...
...
@@ -45,6 +46,8 @@ public class ScoreRuleController {
private
WarehouseService
warehouseService
;
@Resource
private
ApplicationContext
applicationContext
;
@Resource
private
ScoreProducerApi
scoreProducerApi
;
@PostMapping
(
"/create"
)
@ApiOperation
(
"创建积分规则"
)
...
...
@@ -93,6 +96,7 @@ public class ScoreRuleController {
PageResult
<
ScoreRuleBackVO
>
pageResult
=
scoreRuleService
.
getScoreRulePage
(
query
,
page
);
return
success
(
pageResult
);
}
@PostMapping
(
"/status"
)
@ApiOperation
(
"启用关闭"
)
@PreAuthorize
(
"@ss.hasPermission('member:score-rule:update')"
)
...
...
@@ -100,12 +104,14 @@ public class ScoreRuleController {
scoreRuleService
.
updateStatus
(
scoreRuleStatusReqVO
);
return
success
(
true
);
}
@PostMapping
(
"/copy"
)
@ApiOperation
(
"复制规则"
)
@PreAuthorize
(
"@ss.hasPermission('member:score-rule:create')"
)
public
CommonResult
<
Long
>
copyScoreRule
(
@Valid
@RequestBody
IdReqVo
idReqVo
)
{
return
success
(
scoreRuleService
.
copyScoreRule
(
idReqVo
.
getId
()));
}
@PostMapping
(
"/delay"
)
@ApiOperation
(
"延期规则"
)
@PreAuthorize
(
"@ss.hasPermission('member:score-rule:update')"
)
...
...
@@ -126,18 +132,18 @@ public class ScoreRuleController {
@GetMapping
(
"/test-score-rule"
)
@ApiOperation
(
"测试订单V值触发"
)
public
CommonResult
<
Void
>
testScoreRule
(
@RequestParam
Long
orderId
,
@RequestParam
String
orderNo
)
{
applicationContext
.
publishEvent
(
new
OrderInShippingEvent
(
orderId
,
orderNo
));
//applicationContext.publishEvent(new OrderInShippingEvent(orderId, orderNo));
scoreProducerApi
.
sendOderMessage
(
ScoreRuleTypeEnum
.
ORDER_V
,
orderId
);
return
success
(
null
);
}
@GetMapping
(
"/export-excel"
)
@ApiOperation
(
"导出积分规则Excel"
)
@PreAuthorize
(
"@ss.hasPermission('member:score-rule:export')"
)
@OperateLog
(
type
=
EXPORT
)
public
void
exportScoreRuleExcel
(
@Valid
ScoreRuleQueryVO
query
,
HttpServletResponse
response
)
throws
IOException
{
HttpServletResponse
response
)
throws
IOException
{
List
<
ScoreRuleDO
>
list
=
scoreRuleService
.
getScoreRuleList
(
query
);
// 导出 Excel
List
<
ScoreRuleBackVO
>
datas
=
ScoreRuleConvert
.
INSTANCE
.
convertList
(
list
);
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/ScoreConsumer.java
0 → 100644
View file @
b2238b69
package
cn
.
iocoder
.
yudao
.
module
.
member
.
mq
.
consumer
.
score
;
import
cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener
;
import
cn.iocoder.yudao.module.member.mq.consumer.score.core.ScoreRuleStrategy
;
import
cn.iocoder.yudao.module.member.mq.consumer.score.core.ScoreRuleStrategyFactory
;
import
cn.iocoder.yudao.module.member.mq.message.ScoreMessage
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
/**
* @author zhangfeng
*/
@Component
@Slf4j
public
class
ScoreConsumer
extends
AbstractStreamMessageListener
<
ScoreMessage
>
{
@Resource
private
ScoreRuleStrategyFactory
strategyFactory
;
@Override
public
void
onMessage
(
ScoreMessage
message
)
{
ScoreRuleStrategy
strategy
=
strategyFactory
.
getStrategy
(
message
.
getScoreRuleType
());
if
(
strategy
!=
null
)
{
strategy
.
addScore
(
message
);
}
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/OderVStrategy.java
0 → 100644
View file @
b2238b69
This diff is collapsed.
Click to expand it.
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/RecommendStrategy.java
0 → 100644
View file @
b2238b69
package
cn
.
iocoder
.
yudao
.
module
.
member
.
mq
.
consumer
.
score
.
core
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
cn.iocoder.yudao.module.member.mq.message.ScoreMessage
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
/**
* @author zhangfeng
*/
@Service
@Slf4j
public
class
RecommendStrategy
implements
ScoreRuleStrategy
{
@Override
public
void
addScore
(
ScoreMessage
message
)
{
log
.
info
(
"推荐增加积分"
);
}
@Override
public
ScoreRuleTypeEnum
getScoreRuleType
()
{
return
ScoreRuleTypeEnum
.
RECOMMEND
;
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/RegisterStrategy.java
0 → 100644
View file @
b2238b69
package
cn
.
iocoder
.
yudao
.
module
.
member
.
mq
.
consumer
.
score
.
core
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
cn.iocoder.yudao.module.member.mq.message.ScoreMessage
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
/**
* @author zhangfeng
*/
@Service
@Slf4j
public
class
RegisterStrategy
implements
ScoreRuleStrategy
{
@Override
public
void
addScore
(
ScoreMessage
message
)
{
log
.
info
(
"注册增加积分"
);
}
@Override
public
ScoreRuleTypeEnum
getScoreRuleType
()
{
return
ScoreRuleTypeEnum
.
REGISTER
;
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/ScoreRuleStrategy.java
0 → 100644
View file @
b2238b69
package
cn
.
iocoder
.
yudao
.
module
.
member
.
mq
.
consumer
.
score
.
core
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
cn.iocoder.yudao.module.member.mq.message.ScoreMessage
;
/**
* @author zhangfeng
*/
public
interface
ScoreRuleStrategy
{
void
addScore
(
ScoreMessage
message
);
ScoreRuleTypeEnum
getScoreRuleType
();
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/consumer/score/core/ScoreRuleStrategyFactory.java
0 → 100644
View file @
b2238b69
package
cn
.
iocoder
.
yudao
.
module
.
member
.
mq
.
consumer
.
score
.
core
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author zhangfeng
*/
@Component
public
class
ScoreRuleStrategyFactory
{
private
final
Map
<
ScoreRuleTypeEnum
,
ScoreRuleStrategy
>
strategies
=
new
HashMap
<>();
@Autowired
public
void
setStrategyFactory
(
List
<
ScoreRuleStrategy
>
strategyList
)
{
for
(
ScoreRuleStrategy
strategy
:
strategyList
)
{
strategies
.
put
(
strategy
.
getScoreRuleType
(),
strategy
);
}
}
public
ScoreRuleStrategy
getStrategy
(
ScoreRuleTypeEnum
scoreRuleType
)
{
return
strategies
.
get
(
scoreRuleType
);
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/message/ScoreMessage.java
0 → 100644
View file @
b2238b69
package
cn
.
iocoder
.
yudao
.
module
.
member
.
mq
.
message
;
import
cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessage
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
lombok.*
;
/**
* @author zhangfeng
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
ScoreMessage
extends
AbstractStreamMessage
{
private
ScoreRuleTypeEnum
scoreRuleType
;
private
Long
orderId
;
@Override
public
String
getStreamKey
()
{
return
"member.score.add"
;
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/mq/producer/score/ScoreProducer.java
0 → 100644
View file @
b2238b69
package
cn
.
iocoder
.
yudao
.
module
.
member
.
mq
.
producer
.
score
;
import
cn.iocoder.yudao.framework.mq.core.RedisMQTemplate
;
import
cn.iocoder.yudao.module.member.api.ScoreProducerApi
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
cn.iocoder.yudao.module.member.mq.message.ScoreMessage
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
/**
* @author zhangfeng
*/
@Slf4j
@Component
public
class
ScoreProducer
implements
ScoreProducerApi
{
@Resource
private
RedisMQTemplate
redisMQTemplate
;
@Override
public
void
sendOderMessage
(
ScoreRuleTypeEnum
scoreRuleType
,
Long
orderId
)
{
ScoreMessage
message
=
ScoreMessage
.
builder
()
.
scoreRuleType
(
scoreRuleType
)
.
orderId
(
orderId
)
.
build
();
redisMQTemplate
.
send
(
message
);
}
@Override
public
void
sendRecommendMessage
(
ScoreRuleTypeEnum
scoreRuleType
,
Long
userId
)
{
}
@Override
public
void
sendRegisterMessage
(
ScoreRuleTypeEnum
scoreRuleType
,
Long
userId
)
{
}
}
yudao-module-shipment/yudao-module-shipment-core/pom.xml
View file @
b2238b69
...
...
@@ -65,6 +65,10 @@
<artifactId>
yudao-module-sale-core
</artifactId>
<version>
${revision}
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-member-api
</artifactId>
<version>
${revision}
</version>
</dependency>
</dependencies>
</project>
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/service/box/BoxServiceImpl.java
View file @
b2238b69
...
...
@@ -4,12 +4,11 @@ import cn.hutool.core.collection.CollectionUtil;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.apollo.core.event.OrderInShippingEvent
;
import
cn.iocoder.yudao.framework.common.util.spring.enums.CommonStatusEnum
;
import
cn.iocoder.yudao.framework.common.exception.ServiceException
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.util.code.CodeUtils
;
import
cn.iocoder.yudao.framework.common.util.date.DateUtils
;
import
cn.iocoder.yudao.framework.common.util.spring.enums.CommonStatusEnum
;
import
cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO
;
import
cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils
;
import
cn.iocoder.yudao.framework.i18n.core.I18nMessage
;
...
...
@@ -45,8 +44,10 @@ import cn.iocoder.yudao.module.ecw.dal.mysql.ladingTemplate.LadingTemplateMapper
import
cn.iocoder.yudao.module.ecw.service.busiPwd.BusiPwdService
;
import
cn.iocoder.yudao.module.ecw.service.cabinet.CabinetService
;
import
cn.iocoder.yudao.module.ecw.service.region.RegionService
;
import
cn.iocoder.yudao.module.member.api.ScoreProducerApi
;
import
cn.iocoder.yudao.module.member.api.user.MemberUserApi
;
import
cn.iocoder.yudao.module.member.api.user.dto.UserRespDTO
;
import
cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum
;
import
cn.iocoder.yudao.module.order.convert.orderLocation.OrderLocationConvert
;
import
cn.iocoder.yudao.module.order.dal.dataobject.approval.OrderApprovalDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO
;
...
...
@@ -205,7 +206,6 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
...
...
@@ -423,7 +423,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
private
BoxPkgOrderService
boxPkgOrderService
;
@Resource
private
ApplicationContext
applicationContext
;
private
ScoreProducerApi
scoreProducerApi
;
static
{
String
key
=
"130-4174-1"
;
...
...
@@ -1875,7 +1875,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
updateOrderStatusByOrderIdAndTransportType
(
orderIdList
,
orderStatus
,
inWarehouseState
,
shipmentState
,
auditType
,
auditResult
,
businessTime
,
estTime
,
transportType
);
if
(
Objects
.
equals
(
orderStatus
,
OrderStatusEnum
.
IN_SHIPPING
.
getValue
()))
{
for
(
Long
orderId
:
orderIdList
)
{
applicationContext
.
publishEvent
(
new
OrderInShippingEvent
(
orderId
,
null
)
);
scoreProducerApi
.
sendOderMessage
(
ScoreRuleTypeEnum
.
ORDER_V
,
orderId
);
}
}
}
...
...
@@ -4969,7 +4969,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
BoxOrderMarkUpVO
boxOrderMarkUpVO
=
JSON
.
parseObject
(
details
,
BoxOrderMarkUpVO
.
class
);
zTest
z
=
new
zTest
();
zTest
z
=
new
zTest
();
z
.
setTestname
(
"开始调用 handleAirOrderBatchMarkup"
);
z
.
setCreatedate
(
new
Date
());
zTestMapper2
.
insert
(
z
);
...
...
@@ -5001,9 +5001,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
public
void
checkIsInClearance
(
Long
shipmentId
,
Long
orderId
)
{
BoxClearanceOrderDO
clearanceOrderDO
=
boxClearanceOrderService
.
getOne
(
new
LambdaQueryWrapper
<
BoxClearanceOrderDO
>()
.
eq
(
BoxClearanceOrderDO:
:
getShipmentId
,
shipmentId
)
.
eq
(
BoxClearanceOrderDO:
:
getOrderId
,
orderId
)
);
.
eq
(
BoxClearanceOrderDO:
:
getShipmentId
,
shipmentId
)
.
eq
(
BoxClearanceOrderDO:
:
getOrderId
,
orderId
)
);
if
(
clearanceOrderDO
==
null
)
{
throw
new
ServiceException
(
500
,
"订单不是已清关状态"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment