feat(0): [java]-[wechat-ferry-mvn]-项目名称及目录统一调整

This commit is contained in:
chandler 2024-10-01 00:15:50 +08:00
parent fed590cdc6
commit cca9d1f52c
32 changed files with 1952 additions and 1945 deletions

View File

@ -20,11 +20,11 @@
可以直接以WeChatFerry为根目录打开 可以直接以WeChatFerry为根目录打开
或者以WeChatFerry/clients/java/wcferry-mvn为根目录打开 或者以WeChatFerry/clients/java/wechat-ferry-mvn为根目录打开
### 添加Maven ### 添加Maven
找到 WeChatFerry/clients/java/wcferry-mvn/pom.xml 文件右键添加到Maven中会自动下载依赖 找到 WeChatFerry/clients/java/wechat-ferry-mvn/pom.xml 文件右键添加到Maven中会自动下载依赖
### 替换对应版本的dll ### 替换对应版本的dll
@ -40,14 +40,14 @@
# 本服务参数 # 本服务参数
wcferry: wcferry:
# DLL文件位置 # DLL文件位置
dll-path: E:\WeChatFerry\clients\java\wcferry-mvn\dll\sdk.dll dll-path: E:\WeChatFerry\clients\java\wechat-ferry-mvn\dll\sdk.dll
# socket端口 # socket端口
socket-port: 10086 socket-port: 10086
``` ```
### 编译运行 ### 编译运行
找到 src/main/java/com/iamteer/WcferryApplication.java 类 找到 src/main/java/com/wechat/ferry/WeChatFerryApplication.java 类
直接启动即可 直接启动即可
@ -71,24 +71,29 @@ swagger地址http://localhost:9201/swagger-ui/index.html
### 模块结构 ### 模块结构
``` ```
wcferry-mvn wechat-ferry-mvn
├─dll 核心dll ├─dll 核心dll
│ ├─sdk.dll sdk文件 │ ├─sdk.dll sdk文件
│ └─readme.txt 本目录说明文件 │ └─readme.txt 本目录说明文件
├─src 源 ├─src 源
│ ├─main 重启命令 │ ├─main 重启命令
│ │ ├─java(com.iamteer) java代码目录 │ │ ├─java(com.wechat.ferry) java代码目录
│ │ │ ├─config 配置 │ │ │ ├─config 配置
│ │ │ ├─entity 实体 │ │ │ ├─entity 聚合模型
│ │ │ ├─runner 运行(程序启动中与启动后的自动化任务都放置于此) │ │ │ │ ├─dto DTO模型
│ │ │ │ ├─po 实体模型
│ │ │ │ └─vo 视图层返回体目录
│ │ │ ├─enums 枚举
│ │ │ ├─handle 处理层
│ │ │ ├─service 业务接口 │ │ │ ├─service 业务接口
│ │ │ │ └─impl 业务实现类 │ │ │ │ └─impl 业务实现类
│ │ │ ├─Client.java socket客户端 │ │ │ ├─utils 工具类
│ │ │ └─WcferryApplication.java 启动类 │ │ │ └─WcferryApplication.java 启动类
│ │ │
│ │ │resources 资源目录 │ │ │resources 资源目录
│ │ │ ├─libs 本程序内置依赖包 │ │ │ ├─libs 本程序内置依赖包
│ │ │ ├─proto proto文件 │ │ │ ├─proto proto文件(此目录打包将被排除)
│ │ │ ├─win32-x86-64 依赖程序 │ │ │ ├─win32-x86-64 依赖程序
│ │ │ ├─application.yml 本程序主配置文件 │ │ │ ├─application.yml 本程序主配置文件
│ │ │ └─logback-spring.xml 日志配置文件 │ │ │ └─logback-spring.xml 日志配置文件
@ -105,12 +110,13 @@ wcferry-mvn
#### 配置参数 #### 配置参数
本程序内置参数统一前缀wcferry 所有自定义本服务的参数请都放置在此前缀下,如: 本程序内置参数统一前缀wechat.ferry 所有自定义本服务的参数请都放置在此前缀下,如:
```ymal ```ymal
wcferry: wechat:
# DLL文件位置 ferry:
dll-path: /dll/sdk.dll # DLL文件位置
dll-path: /dll/sdk.dll
``` ```
#### 生成proto文件 #### 生成proto文件
@ -129,7 +135,7 @@ wcferry:
如: 如:
```cmd ```cmd
feat(0): [java]-[wcferry-mvn]-基础类目录划分迁移及代码格式 feat(0): [java]-[wechat-ferry-mvn]-基础类目录划分迁移及代码格式
``` ```
| 名称 | 版本 | | 名称 | 版本 |

View File

@ -11,10 +11,10 @@
<version>2.7.18</version> <version>2.7.18</version>
</parent> </parent>
<artifactId>wcferry-mvn</artifactId> <artifactId>wechat-ferry-mvn</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>wcferry-mvn</name> <name>wechat-ferry-mvn</name>
<description>wcferry客户端Java-Maven版</description> <description>WeChatFerry客户端Java-Maven版</description>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@ -1,4 +1,4 @@
package com.iamteer; package com.wechat.ferry;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -10,10 +10,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @date 2024-09-21 12:19 * @date 2024-09-21 12:19
*/ */
@SpringBootApplication @SpringBootApplication
public class WcferryApplication { public class WeChatFerryApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(WcferryApplication.class, args); SpringApplication.run(WeChatFerryApplication.class, args);
} }
} }

View File

@ -1,4 +1,4 @@
package com.iamteer.config; package com.wechat.ferry.config;
import java.util.Collections; import java.util.Collections;

View File

@ -1,4 +1,4 @@
package com.iamteer.config; package com.wechat.ferry.config;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -26,7 +26,7 @@ public class SwaggerConfig {
public Docket api() { public Docket api() {
return new Docket(DocumentationType.SWAGGER_2).select() return new Docket(DocumentationType.SWAGGER_2).select()
// 替换为您的Controller所在的包路径 // 替换为您的Controller所在的包路径
.apis(RequestHandlerSelectors.basePackage("com.iamteer.controller")) .apis(RequestHandlerSelectors.basePackage("com.wechat.ferry.controller"))
// 地址 // 地址
.paths(PathSelectors.any()).build().apiInfo(apiInfo()); .paths(PathSelectors.any()).build().apiInfo(apiInfo());
} }
@ -34,7 +34,7 @@ public class SwaggerConfig {
private ApiInfo apiInfo() { private ApiInfo apiInfo() {
return new ApiInfoBuilder() return new ApiInfoBuilder()
// 文档标题 // 文档标题
.title("Wcferry接口文档") .title("WeChatFerry接口文档")
// 文档路径 // 文档路径
.description("微信机器人底层框架接口文档") .description("微信机器人底层框架接口文档")
// 文档版本 // 文档版本

View File

@ -1,4 +1,4 @@
package com.iamteer.config; package com.wechat.ferry.config;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -6,15 +6,15 @@ import org.springframework.stereotype.Component;
import lombok.Data; import lombok.Data;
/** /**
* 配置文件-wcferry的配置文件 * 配置文件-WeChatFerry的配置文件
* *
* @author chandler * @author chandler
* @date 2024-09-21 21:35 * @date 2024-09-21 21:35
*/ */
@Data @Data
@Component @Component
@ConfigurationProperties(prefix = "wcferry") @ConfigurationProperties(prefix = "wechat.ferry")
public class WcferryProperties { public class WeChatFerryProperties {
/** /**
* dll文件位置 * dll文件位置

View File

@ -1,11 +1,12 @@
package com.iamteer.config; package com.wechat.ferry.config;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.iamteer.handle.WechatSocketClient;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import com.wechat.ferry.handle.WechatSocketClient;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /**
@ -19,7 +20,7 @@ import lombok.extern.slf4j.Slf4j;
public class WechatConfiguration { public class WechatConfiguration {
@Resource @Resource
private WcferryProperties properties; private WeChatFerryProperties properties;
@Bean @Bean
public WechatSocketClient client() { public WechatSocketClient client() {
@ -62,7 +63,7 @@ public class WechatConfiguration {
// client.sendFile("C:\\Projs\\WeChatFerry\\README.MD", "filehelper"); // client.sendFile("C:\\Projs\\WeChatFerry\\README.MD", "filehelper");
String xml = String xml =
"<?xml version=\"1.0\"?><msg><appmsg appid=\"\" sdkver=\"0\"><title>叮当药房24小时服务28分钟送药到家</title><des>叮当快药首家承诺范围内28分钟送药到家叮当快药核心区域内7*24小时全天候服务送药上门叮当快药官网为您提供快捷便利正品低价安全放心的购药、送药服务体验。</des><action>view</action><type>33</type><showtype>0</showtype><content /><url>https://mp.weixin.qq.com/mp/waerrpage?appid=wxc2edadc87077fa2a&amp;type=upgrade&amp;upgradetype=3#wechat_redirect</url><dataurl /><lowurl /><lowdataurl /><recorditem /><thumburl /><messageaction /><md5>7f6f49d301ebf47100199b8a4fcf4de4</md5><extinfo /><sourceusername>gh_c2b88a38c424@app</sourceusername><sourcedisplayname>叮当快药 药店送药到家夜间买药</sourcedisplayname><commenturl /><appattach><totallen>0</totallen><attachid /><emoticonmd5></emoticonmd5><fileext>jpg</fileext><filekey>da0e08f5c7259d03da150d5e7ca6d950</filekey><cdnthumburl>3057020100044b30490201000204e4c0232702032f4ef20204a6bace6f02046401f62d042430326337303430352d333734332d343362652d623335322d6233333566623266376334620204012400030201000405004c537600</cdnthumburl><aeskey>0db26456caf243fbd4efb99058a01d66</aeskey><cdnthumbaeskey>0db26456caf243fbd4efb99058a01d66</cdnthumbaeskey><encryver>1</encryver><cdnthumblength>61558</cdnthumblength><cdnthumbheight>100</cdnthumbheight><cdnthumbwidth>100</cdnthumbwidth></appattach><weappinfo><pagepath>pages/index/index.html</pagepath><username>gh_c2b88a38c424@app</username><appid>wxc2edadc87077fa2a</appid><version>197</version><type>2</type><weappiconurl>http://wx.qlogo.cn/mmhead/Q3auHgzwzM4727n0NQ0ZIPQPlfp15m1WLsnrXbo1kLhFGcolgLyc0A/96</weappiconurl><appservicetype>0</appservicetype><shareId>1_wxc2edadc87077fa2a_29177e9a9b918cb9e75964f80bb8f32e_1677849476_0</shareId></weappinfo><websearch /></appmsg><fromusername>wxid_eob5qfcrv4zd22</fromusername><scene>0</scene><appinfo><version>1</version><appname /></appinfo><commenturl /></msg>"; "<?xml version=\"1.0\"?><msg><appmsg appid=\"\" sdkver=\"0\"><title>叮当药房24小时服务28分钟送药到家</title><des>叮当快药首家承诺范围内28分钟送药到家叮当快药核心区域内7*24小时全天候服务送药上门叮当快药官网为您提供快捷便利正品低价安全放心的购药、送药服务体验。</des><action>view</action><type>33</type><showtype>0</showtype><content /><url>https://mp.weixin.qq.com/mp/waerrpage?appid=wxc2edadc87077fa2a&amp;type=upgrade&amp;upgradetype=3#wechat_redirect</url><dataurl /><lowurl /><lowdataurl /><recorditem /><thumburl /><messageaction /><md5>7f6f49d301ebf47100199b8a4fcf4de4</md5><extinfo /><sourceusername>gh_c2b88a38c424@app</sourceusername><sourcedisplayname>叮当快药 药店送药到家夜间买药</sourcedisplayname><commenturl /><appattach><totallen>0</totallen><attachid /><emoticonmd5></emoticonmd5><fileext>jpg</fileext><filekey>da0e08f5c7259d03da150d5e7ca6d950</filekey><cdnthumburl>3057020100044b30490201000204e4c0232702032f4ef20204a6bace6f02046401f62d042430326337303430352d333734332d343362652d623335322d6233333566623266376334620204012400030201000405004c537600</cdnthumburl><aeskey>0db26456caf243fbd4efb99058a01d66</aeskey><cdnthumbaeskey>0db26456caf243fbd4efb99058a01d66</cdnthumbaeskey><encryver>1</encryver><cdnthumblength>61558</cdnthumblength><cdnthumbheight>100</cdnthumbheight><cdnthumbwidth>100</cdnthumbwidth></appattach><weappinfo><pagepath>pages/index/index.html</pagepath><username>gh_c2b88a38c424@app</username><appid>wxc2edadc87077fa2a</appid><version>197</version><type>2</type><weappiconurl>http://wx.qlogo.cn/mmhead/Q3auHgzwzM4727n0NQ0ZIPQPlfp15m1WLsnrXbo1kLhFGcolgLyc0A/96</weappiconurl><appservicetype>0</appservicetype><shareId>1_wxc2edadc87077fa2a_29177e9a9b918cb9e75964f80bb8f32e_1677849476_0</shareId></weappinfo><websearch /></appmsg><fromusername>wxid_eob5qfcrv4zd22</fromusername><scene>0</scene><appinfo><version>1</version><appname /></appinfo><commenturl /></msg>";
// client.sendXml("filehelper", xml, "", 0x21); // client.sendXml("filehelper", xml, "", 0x21);
// 发送表情消息gif 必须要存在 // 发送表情消息gif 必须要存在
@ -80,8 +81,6 @@ public class WechatConfiguration {
thread.start(); thread.start();
// client.diableRecvMsg(); // 需要停止时调用 // client.diableRecvMsg(); // 需要停止时调用
wechatSocketClient.keepRunning();
new Thread(new Runnable() { new Thread(new Runnable() {
public void run() { public void run() {
wechatSocketClient.keepRunning(); wechatSocketClient.keepRunning();

View File

@ -1,13 +1,13 @@
package com.iamteer.controller; package com.wechat.ferry.controller;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.iamteer.entity.TResponse; import com.wechat.ferry.entity.TResponse;
import com.iamteer.enums.ResponseCodeEnum; import com.wechat.ferry.enums.ResponseCodeEnum;
import com.iamteer.service.TestService; import com.wechat.ferry.service.TestService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;

View File

@ -1,4 +1,4 @@
package com.iamteer.entity; package com.wechat.ferry.entity;
/** /**
* 返回类接口 * 返回类接口

View File

@ -1,10 +1,10 @@
package com.iamteer.entity; package com.wechat.ferry.entity;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.iamteer.enums.ResponseCodeEnum; import com.wechat.ferry.enums.ResponseCodeEnum;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

View File

@ -1,4 +1,4 @@
package com.iamteer.entity.vo.response; package com.wechat.ferry.entity.vo.response;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

View File

@ -1,6 +1,6 @@
package com.iamteer.enums; package com.wechat.ferry.enums;
import com.iamteer.entity.IResponse; import com.wechat.ferry.entity.IResponse;
/** /**
* 枚举-返回类状态码 * 枚举-返回类状态码

View File

@ -1,4 +1,4 @@
package com.iamteer.handle; package com.wechat.ferry.handle;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.Arrays; import java.util.Arrays;
@ -12,21 +12,21 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.iamteer.entity.Wcf; import com.wechat.ferry.entity.po.Wcf;
import com.iamteer.entity.Wcf.DbQuery; import com.wechat.ferry.entity.po.Wcf.DbQuery;
import com.iamteer.entity.Wcf.DbRow; import com.wechat.ferry.entity.po.Wcf.DbRow;
import com.iamteer.entity.Wcf.DbTable; import com.wechat.ferry.entity.po.Wcf.DbTable;
import com.iamteer.entity.Wcf.DecPath; import com.wechat.ferry.entity.po.Wcf.DecPath;
import com.iamteer.entity.Wcf.Functions; import com.wechat.ferry.entity.po.Wcf.Functions;
import com.iamteer.entity.Wcf.MemberMgmt; import com.wechat.ferry.entity.po.Wcf.MemberMgmt;
import com.iamteer.entity.Wcf.Request; import com.wechat.ferry.entity.po.Wcf.Request;
import com.iamteer.entity.Wcf.Response; import com.wechat.ferry.entity.po.Wcf.Response;
import com.iamteer.entity.Wcf.RpcContact; import com.wechat.ferry.entity.po.Wcf.RpcContact;
import com.iamteer.entity.Wcf.UserInfo; import com.wechat.ferry.entity.po.Wcf.UserInfo;
import com.iamteer.entity.Wcf.Verification; import com.wechat.ferry.entity.po.Wcf.Verification;
import com.iamteer.entity.Wcf.WxMsg; import com.wechat.ferry.entity.po.Wcf.WxMsg;
import com.iamteer.entity.vo.response.WxMsgResp; import com.wechat.ferry.entity.vo.response.WxMsgResp;
import com.iamteer.service.SDK; import com.wechat.ferry.service.SDK;
import com.sun.jna.Native; import com.sun.jna.Native;
import io.sisu.nng.Socket; import io.sisu.nng.Socket;

View File

@ -1,4 +1,4 @@
package com.iamteer.service; package com.wechat.ferry.service;
import com.sun.jna.Library; import com.sun.jna.Library;

View File

@ -1,4 +1,4 @@
package com.iamteer.service; package com.wechat.ferry.service;
/** /**
* 业务接口-注册 * 业务接口-注册

View File

@ -1,4 +1,4 @@
package com.iamteer.service.impl; package com.wechat.ferry.service.impl;
import java.util.List; import java.util.List;
@ -6,8 +6,8 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.iamteer.handle.WechatSocketClient; import com.wechat.ferry.handle.WechatSocketClient;
import com.iamteer.service.TestService; import com.wechat.ferry.service.TestService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@ -1,4 +1,4 @@
package com.iamteer.utils; package com.wechat.ferry.utils;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;

View File

@ -9,15 +9,16 @@ spring:
# 配置应用信息 # 配置应用信息
application: application:
# 应用名 # 应用名
name: wcferry-mvn name: wechat-ferry
# swagger适配 # swagger适配
mvc: mvc:
pathmatch: pathmatch:
matching-strategy: ant_path_matcher matching-strategy: ant_path_matcher
# 本服务参数 # 本服务参数
wcferry: wechat:
# DLL文件位置 ferry:
dll-path: E:\WeChatFerry\clients\java\wcferry-mvn\dll\sdk.dll # DLL文件位置
# socket端口 dll-path: E:\WeChatFerry\clients\java\wechat-ferry-mvn\dll\sdk.dll
socket-port: 10086 # socket端口
socket-port: 10086

View File

@ -1,7 +1,7 @@
syntax = "proto3"; syntax = "proto3";
package wcf; package wcf;
option java_package = "com.iamteer.entity"; option java_package = "com.wechat.ferry.entity.po";
enum Functions { enum Functions {
FUNC_RESERVED = 0x00; FUNC_RESERVED = 0x00;