diff --git a/pom.xml b/pom.xml index 0af57de..62ccb78 100644 --- a/pom.xml +++ b/pom.xml @@ -197,6 +197,159 @@ + <!-- 引入外部jar包 --> + <dependency> + <groupId>com.cxz</groupId> + <artifactId>2020idea-mybatis_log_plugin</artifactId> + <version>1.45</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/2020idea-mybatis_log_plugin.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>bcprov-ext-jdk15to18-165</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/bcprov-ext-jdk15to18-165.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>commons-beanutils</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/commons-beanutils.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>commons-codec-1.14</artifactId> + <version>1.14</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/commons-codec-1.14.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>commons-collections-3.1</artifactId> + <version>3.1</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/commons-collections-3.1.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>commons-lang-2.1</artifactId> + <version>2.1</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/commons-lang-2.1.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>commons-logging</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/commons-logging.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>ezmorph-1.0.6</artifactId> + <version>1.0.6</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/ezmorph-1.0.6.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>httpclient-4.5.6</artifactId> + <version>4.5.6</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/httpclient-4.5.6.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>httpcore-4.4.6</artifactId> + <version>4.4.6</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/httpcore-4.4.6.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>jackson-annotations-2.9.3</artifactId> + <version>2.9.3</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/jackson-annotations-2.9.3.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>jackson-core-2.9.3</artifactId> + <version>2.9.3</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/jackson-core-2.9.3.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>jackson-databind-2.9.3</artifactId> + <version>2.9.3</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/jackson-databind-2.9.3.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>javax.websocket-api-1.1</artifactId> + <version>1.1</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/javax.websocket-api-1.1.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>json-lib-2.2.3-jdk13</artifactId> + <version>2.2.3</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/json-lib-2.2.3-jdk13.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>okhttp-3.2.0</artifactId> + <version>3.2.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/okhttp-3.2.0.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>wechatpay-apache-httpclient-0.2.2</artifactId> + <version>0.2.2</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/wechatpay-apache-httpclient-0.2.2.jar</systemPath> + </dependency> + + <dependency> + <groupId>com.cxz</groupId> + <artifactId>xom-1.2.5</artifactId> + <version>1.2.5</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/xom-1.2.5.jar</systemPath> + </dependency> + + + + + + + + + </dependencies> <build> @@ -213,6 +366,7 @@ </excludes> </configuration> </plugin> + </plugins> </build> diff --git a/src/main/java/com/greenorange/promotion/aop/OperateLogAspect.java b/src/main/java/com/greenorange/promotion/aop/OperateLogAspect.java index 755af23..b310565 100644 --- a/src/main/java/com/greenorange/promotion/aop/OperateLogAspect.java +++ b/src/main/java/com/greenorange/promotion/aop/OperateLogAspect.java @@ -16,6 +16,7 @@ import org.springframework.web.context.request.RequestContextHolder; import java.io.BufferedReader; +import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Method; import java.net.HttpURLConnection; @@ -248,32 +249,32 @@ public class OperateLogAspect { public String getIpLocation(String ip) { - try { - // 发送请求到ip-api服务 - String url = "http://ip-api.com/json/" + ip + "?lang=zh-CN"; // 获取中文结果 - URL obj = new URL(url); - HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - con.setRequestMethod("GET"); - - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - StringBuffer response = new StringBuffer(); - - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - - // 解析JSON返回结果 - JSONObject jsonResponse = JSONObject.parseObject(response.toString()); - String region = jsonResponse.getString("regionName"); // 省 - String city = jsonResponse.getString("city"); // 城市 - String country = jsonResponse.getString("country"); // 国家 - - return city + ", " + region + ", " + country; // 返回位置 - } catch (Exception e) { - e.printStackTrace(); - } +// try { +// // 发送请求到ip-api服务 +// String url = "http://ip-api.com/json/" + ip + "?lang=zh-CN"; // 获取中文结果 +// URL obj = new URL(url); +// HttpURLConnection con = (HttpURLConnection) obj.openConnection(); +// con.setRequestMethod("GET"); +// +// BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); +// String inputLine; +// StringBuffer response = new StringBuffer(); +// +// while ((inputLine = in.readLine()) != null) { +// response.append(inputLine); +// } +// in.close(); +// +// // 解析JSON返回结果 +// JSONObject jsonResponse = JSONObject.parseObject(response.toString()); +// String country = jsonResponse.getString("country"); // 国家 +// String region = jsonResponse.getString("regionName"); // 省 +// String city = jsonResponse.getString("city"); // 城市 +// +// return country + "-" + region + "-" + city; // 返回位置 +// } catch (Exception e) { +// e.printStackTrace(); +// } return "未知"; } diff --git a/src/main/java/com/greenorange/promotion/controller/user/UserInfoController.java b/src/main/java/com/greenorange/promotion/controller/user/UserInfoController.java index 418d613..5db55af 100644 --- a/src/main/java/com/greenorange/promotion/controller/user/UserInfoController.java +++ b/src/main/java/com/greenorange/promotion/controller/user/UserInfoController.java @@ -4,6 +4,7 @@ import com.auth0.jwt.interfaces.DecodedJWT; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.greenorange.promotion.annotation.RequiresPermission; +import com.greenorange.promotion.annotation.SysLog; import com.greenorange.promotion.common.BaseResponse; import com.greenorange.promotion.common.ErrorCode; import com.greenorange.promotion.common.ResultUtils; @@ -123,6 +124,7 @@ public class UserInfoController { return ResultUtils.success(true); } + /** * web端管理员删除用户表 * @param commonRequest 用户表删除请求体 @@ -136,6 +138,7 @@ public class UserInfoController { return ResultUtils.success(true); } + /** * Web端管理员分页查看用户表 * @param userInfoQueryRequest 用户表查询请求体 @@ -157,6 +160,7 @@ public class UserInfoController { return ResultUtils.success(voPage); } + /** * web端管理员根据id查询用户表 * @param commonRequest 用户表查询请求体 @@ -164,7 +168,8 @@ public class UserInfoController { */ @PostMapping("queryById") @Operation(summary = "web端管理员根据id查询用户", description = "参数:用户表查询请求体,权限:管理员(boss, admin),方法名:queryUserInfoById") -// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "用户管理", content = "web端管理员根据id查询用户") public BaseResponse<UserInfoVO> queryUserInfoById(@Valid @RequestBody CommonRequest commonRequest) { Long id = commonRequest.getId(); UserInfo userInfo = userInfoService.getById(id); @@ -174,38 +179,6 @@ public class UserInfoController { } - /** - * web端管理员根据id查询用户表 - * @param id 用户表查询请求体 - * @return 用户表信息 - */ - @GetMapping("queryById") - @Operation(summary = "web端管理员根据id查询用户", description = "参数:用户表查询请求体,权限:管理员(boss, admin),方法名:queryUserInfoById") -// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) - public BaseResponse<UserInfoVO> queryUserInfoByGetId(@RequestParam Long id) { - UserInfo userInfo = userInfoService.getById(id); - ThrowUtils.throwIf(userInfo == null, ErrorCode.OPERATION_ERROR, "当前用户不存在"); - UserInfoVO userInfoVO = commonService.copyProperties(userInfo, UserInfoVO.class); - return ResultUtils.success(userInfoVO); - } - - - - /** - * web端管理员根据id查询用户表 - * @param id 用户表查询请求体 - * @return 用户表信息 - */ - @GetMapping("queryById/{id}") - @Operation(summary = "web端管理员根据id查询用户", description = "参数:用户表查询请求体,权限:管理员(boss, admin),方法名:queryUserInfoById") -// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) - public BaseResponse<UserInfoVO> queryUserInfoByPathId(@PathVariable Long id) { - UserInfo userInfo = userInfoService.getById(id); - ThrowUtils.throwIf(userInfo == null, ErrorCode.OPERATION_ERROR, "当前用户不存在"); - UserInfoVO userInfoVO = commonService.copyProperties(userInfo, UserInfoVO.class); - return ResultUtils.success(userInfoVO); - } - diff --git a/src/main/java/com/greenorange/promotion/utils/paybank/CompanyWxPayBankBuilder.java b/src/main/java/com/greenorange/promotion/utils/paybank/CompanyWxPayBankBuilder.java index 42f676a..155eb0e 100644 --- a/src/main/java/com/greenorange/promotion/utils/paybank/CompanyWxPayBankBuilder.java +++ b/src/main/java/com/greenorange/promotion/utils/paybank/CompanyWxPayBankBuilder.java @@ -1,8 +1,10 @@ package com.greenorange.promotion.utils.paybank; +import net.sf.json.JSONObject; + import java.util.Map; -import net.sf.json.JSONObject; + /** * v1.0.2 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index be5d1ab..3e0177b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -30,6 +30,7 @@ springdoc: server: + address: 0.0.0.0 port: 3456 servlet: diff --git a/src/main/resources/lib/log4j-1.2.17.jar b/src/main/resources/lib/log4j-1.2.17.jar deleted file mode 100644 index 1d425cf..0000000 Binary files a/src/main/resources/lib/log4j-1.2.17.jar and /dev/null differ diff --git a/src/main/resources/lib/slf4j-api-1.7.21.jar b/src/main/resources/lib/slf4j-api-1.7.21.jar deleted file mode 100644 index 2a5c33e..0000000 Binary files a/src/main/resources/lib/slf4j-api-1.7.21.jar and /dev/null differ diff --git a/src/main/resources/lib/slf4j-log4j12-1.7.21.jar b/src/main/resources/lib/slf4j-log4j12-1.7.21.jar deleted file mode 100644 index ff4fddd..0000000 Binary files a/src/main/resources/lib/slf4j-log4j12-1.7.21.jar and /dev/null differ diff --git a/src/main/resources/static/install-libs.ps1 b/src/main/resources/static/install-libs.ps1 new file mode 100644 index 0000000..667dbf2 --- /dev/null +++ b/src/main/resources/static/install-libs.ps1 @@ -0,0 +1,12 @@ +$libDir = "D:\青橙\backend\src\main\resources\lib" # 使用绝对路径指定 lib 目录 +$repositoryDir = "D:\software\Maven\maven-repository" # 设置自定义仓库目录 + +# 遍历 lib 目录下的所有 JAR 文件并安装到指定的仓库 +Get-ChildItem -Path $libDir -Filter "*.jar" | ForEach-Object { + mvn install:install-file -Dfile=$_.FullName ` + -DgroupId=com.example ` + -DartifactId=$($_.BaseName) ` + -Dversion=1.0 ` + -Dpackaging=jar ` + -DlocalRepositoryPath=$repositoryDir +} diff --git a/src/test/java/com/greenorange/promotion/IpDemo.java b/src/test/java/com/greenorange/promotion/IpDemo.java index 1939e8c..3d73d17 100644 --- a/src/test/java/com/greenorange/promotion/IpDemo.java +++ b/src/test/java/com/greenorange/promotion/IpDemo.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import org.junit.jupiter.api.Test; import java.io.BufferedReader; +import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; @@ -11,8 +12,10 @@ import java.net.URL; public class IpDemo { public static void main(String[] args) { - getIpLocation("123.167.57.119"); + getIpLocation("42.100.248.19"); } + + public static String getIpLocation(String ip) { try { // 发送请求到ip-api服务 @@ -36,8 +39,8 @@ public class IpDemo { String region = jsonResponse.getString("regionName"); // 省 String city = jsonResponse.getString("city"); // 城市 System.out.println(jsonResponse); - System.out.println(country + "-" + region + "省" + "-" + city); - return country + "-" + region + "省" + "-" + city; // 返回位置 + System.out.println(country + "-" + region + "-" + city); + return country + "-" + region + "-" + city; // 返回位置 } catch (Exception e) { e.printStackTrace(); } @@ -45,4 +48,6 @@ public class IpDemo { } + + } diff --git a/src/test/java/com/greenorange/promotion/draft/DraftList.java b/src/test/java/com/greenorange/promotion/draft/DraftList.java new file mode 100644 index 0000000..1784aa7 --- /dev/null +++ b/src/test/java/com/greenorange/promotion/draft/DraftList.java @@ -0,0 +1,37 @@ +package com.greenorange.promotion.draft; + +public class DraftList { + +// /** +// * web端管理员根据id查询用户表 +// * @param id 用户表查询请求体 +// * @return 用户表信息 +// */ +// @GetMapping("queryById") +// @Operation(summary = "web端管理员根据id查询用户", description = "参数:用户表查询请求体,权限:管理员(boss, admin),方法名:queryUserInfoById") +//// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) +// public BaseResponse<UserInfoVO> queryUserInfoByGetId(@RequestParam Long id) { +// UserInfo userInfo = userInfoService.getById(id); +// ThrowUtils.throwIf(userInfo == null, ErrorCode.OPERATION_ERROR, "当前用户不存在"); +// UserInfoVO userInfoVO = commonService.copyProperties(userInfo, UserInfoVO.class); +// return ResultUtils.success(userInfoVO); +// } +// +// +// +// /** +// * web端管理员根据id查询用户表 +// * @param id 用户表查询请求体 +// * @return 用户表信息 +// */ +// @GetMapping("queryById/{id}") +// @Operation(summary = "web端管理员根据id查询用户", description = "参数:用户表查询请求体,权限:管理员(boss, admin),方法名:queryUserInfoById") +//// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) +// public BaseResponse<UserInfoVO> queryUserInfoByPathId(@PathVariable Long id) { +// UserInfo userInfo = userInfoService.getById(id); +// ThrowUtils.throwIf(userInfo == null, ErrorCode.OPERATION_ERROR, "当前用户不存在"); +// UserInfoVO userInfoVO = commonService.copyProperties(userInfo, UserInfoVO.class); +// return ResultUtils.success(userInfoVO); +// } + +}