-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
cokie
committed
Jan 22, 2024
1 parent
96a4c48
commit 4346745
Showing
20 changed files
with
227 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../micro/api/dict/SystemDictController.java → ...o/api/http/dict/SystemDictController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...icro/api/function/FunctionController.java → ...api/http/function/FunctionController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...cro/api/robot/QQRobotLoginController.java → ...pi/http/robot/QQRobotLoginController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...cro/api/robot/RobotManagerController.java → ...pi/http/robot/RobotManagerController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...o/micro/api/user/AuthorityController.java → ...ro/api/http/user/AuthorityController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ava/io/micro/api/user/UserController.java → ...o/micro/api/http/user/UserController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...io/micro/api/wx/WxOfficialController.java → ...cro/api/http/wx/WxOfficialController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tokisaki-api/src/main/java/io/micro/api/mq/robot/RobotCustomer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.micro.api.mq.robot; | ||
|
||
import io.micro.server.robot.infra.event.dto.RobotDTO; | ||
import io.micro.server.robot.infra.event.sdk.RobotConstant; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import org.eclipse.microprofile.reactive.messaging.Incoming; | ||
import org.eclipse.microprofile.reactive.messaging.Message; | ||
|
||
import java.util.concurrent.CompletionStage; | ||
|
||
@ApplicationScoped | ||
public class RobotCustomer { | ||
|
||
@Incoming(RobotConstant.Queue.ROBOT_LOGIN_SUCCESS) | ||
public CompletionStage<Void> robotLoginSuccess(Message<RobotDTO> msg) { | ||
RobotDTO robot = msg.getPayload(); | ||
System.out.println("=========="); | ||
System.out.println(robot.getId()); | ||
System.out.println("=========="); | ||
return msg.ack(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
tokisaki-server/src/main/kotlin/io/micro/server/robot/domain/event/IRobotEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package io.micro.server.robot.domain.event | ||
|
||
import io.micro.server.robot.domain.model.entity.RobotDO | ||
import io.smallrye.mutiny.Uni | ||
|
||
interface IRobotEvent { | ||
|
||
fun publishRobotLoginSuccess(robotDO: RobotDO): Uni<Unit> | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
tokisaki-server/src/main/kotlin/io/micro/server/robot/infra/event/RobotEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package io.micro.server.robot.infra.event | ||
|
||
import io.micro.server.robot.domain.event.IRobotEvent | ||
import io.micro.server.robot.domain.model.entity.RobotDO | ||
import io.micro.server.robot.infra.converter.RobotConverter | ||
import io.micro.server.robot.infra.event.dto.RobotDTO | ||
import io.micro.server.robot.infra.event.sdk.RobotConstant | ||
import io.smallrye.mutiny.Uni | ||
import io.smallrye.reactive.messaging.rabbitmq.OutgoingRabbitMQMetadata | ||
import jakarta.enterprise.context.ApplicationScoped | ||
import org.eclipse.microprofile.reactive.messaging.Channel | ||
import org.eclipse.microprofile.reactive.messaging.Emitter | ||
import org.eclipse.microprofile.reactive.messaging.Message | ||
import org.eclipse.microprofile.reactive.messaging.Metadata | ||
import java.util.concurrent.CompletableFuture | ||
|
||
@ApplicationScoped | ||
class RobotEvent( | ||
private val robotConverter: RobotConverter, | ||
@Channel(RobotConstant.Exchange.ROBOT_LOGIN) private val emitter: Emitter<RobotDTO> | ||
) : IRobotEvent { | ||
|
||
override fun publishRobotLoginSuccess(robotDO: RobotDO): Uni<Unit> { | ||
val rabbitMQMetadata = OutgoingRabbitMQMetadata.builder() | ||
.withRoutingKey(RobotConstant.RotingKey.ROBOT_LOGIN_SUCCESS) | ||
.build() | ||
return Uni.createFrom().emitter { | ||
emitter.send(Message.of(robotConverter.robotDO2RobotDTO(robotDO), Metadata.of(rabbitMQMetadata), { | ||
it.complete(null) | ||
CompletableFuture.completedFuture(null) | ||
}, { reason -> | ||
it.fail(reason) | ||
CompletableFuture.completedFuture(null) | ||
})) | ||
} | ||
|
||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
tokisaki-server/src/main/kotlin/io/micro/server/robot/infra/event/dto/FeatureFunctionDTO.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.micro.server.robot.infra.event.dto | ||
|
||
import io.micro.core.function.sdk.Cmd | ||
import io.micro.server.robot.domain.model.valobj.Switch | ||
import kotlin.properties.Delegates | ||
|
||
class FeatureFunctionDTO { | ||
|
||
var id: Long? = null | ||
|
||
var refId: Long? = null | ||
|
||
var code: String? = null | ||
|
||
var name: String? = null | ||
|
||
var config: String? = null | ||
|
||
var remark: String? = null | ||
|
||
var enabled: Boolean = false | ||
|
||
var cmdAlias: String? = null | ||
|
||
var requireQuota: Boolean? = null | ||
|
||
var cmd: Cmd by Delegates.notNull() | ||
|
||
var args: MutableList<String> = mutableListOf() | ||
|
||
var switch: Switch = Switch() | ||
|
||
var groupId: Long by Delegates.notNull() | ||
|
||
var memberId: Long by Delegates.notNull() | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
tokisaki-server/src/main/kotlin/io/micro/server/robot/infra/event/dto/RobotDTO.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.micro.server.robot.infra.event.dto | ||
|
||
class RobotDTO { | ||
|
||
var id: Long? = null | ||
|
||
var userId: Long? = null | ||
|
||
var name: String? = null | ||
|
||
var account: String? = null | ||
|
||
var password: String? = null | ||
|
||
var type: Int? = null | ||
|
||
var state: Int? = null | ||
|
||
var remark: String? = null | ||
|
||
val functions: MutableList<FeatureFunctionDTO> = mutableListOf() | ||
|
||
var cmdPrefix: String? = null | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
tokisaki-server/src/main/kotlin/io/micro/server/robot/infra/event/sdk/RobotConstant.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.micro.server.robot.infra.event.sdk | ||
|
||
object RobotConstant { | ||
|
||
object Exchange { | ||
const val ROBOT_LOGIN = "robot-login" | ||
} | ||
|
||
object RotingKey { | ||
const val ROBOT_LOGIN_SUCCESS = "robot.login.success" | ||
} | ||
|
||
object Queue { | ||
const val ROBOT_LOGIN_SUCCESS = "robot-login-success" | ||
} | ||
|
||
} |
Oops, something went wrong.