type
status
date
slug
summary
tags
category
titleIcon
password
icon
calloutIcon
1️⃣
记录第一天开发环境搭建中遇到的问题与解决方案:SSH连接问题;Jenkins构建失败问题;Docker代理问题;gogs git私服克隆502错误;Maven私服配置
 
可以对照着看,都是项目部署的共通问题(域名代理等见):
感觉快把环境问题写完了,后面可能没得写了( 天机|神领|中州|四方|云岚

SSH连接配置

  • 在ssh配置写入,更换为自己的私钥

java

Host shenling HostName 192.168.150.101 User root Port 22 IdentityFile E:\Core\ssh-lab\id_rsa
Java
  • 在机器上创建ssh相关文件夹与文件
notion image
  • scp命令复制公钥到远程文件上
notion image
  • 连接成功 经典文件夹路径/usr/local/src
notion image
梦回天机学堂
notion image
域名
直奔Nginx配置查看
notion image

Jenkins构建失败问题(Docker代理问题)

  • 虚拟机导入后直接构建效果:
notion image
notion image
  • 字面意义http超时,大概率代理问题
先加入DNS,在VSCode终端执行

shell

code /etc/resolv.conf
Shell
加入

plain

nameserver 8.8.8.8 nameserver 8.8.4.4
Plain text
notion image
  • 创建docker服务代理文件夹

shell

sudo mkdir -p /etc/systemd/system/docker.service.d
Shell
  • 打开文件写入

shell

code /etc/systemd/system/docker.service.d/http-proxy.conf
Shell

shell

[Service] Environment="HTTP_PROXY=http://192.168.150.1:7890/" Environment="HTTPS_PROXY=http://192.168.150.1:7890/" Environment="NO_PROXY=localhost,127.*"
Shell
notion image
  • 读取新配置,重启docker

shell

sudo systemctl daemon-reload sudo systemctl restart docker
Shell
  • 正常下载,构建成功
notion image
notion image
  • 可以在Nacos里观察到服务启动成功
notion image
notion image

无法克隆git私服(gogs)项目502错误

将域名转为ip加端口解决,看图
notion image
notion image

校验鉴权

Maven安装依赖

由于settings.xml配置里已经写入了镜像,可以关闭Maven代理
notion image
之后执行maven clean
在通过双击ctrl执行mvn install -DskipTests跳过测试安装依赖
notion image
如果导入多个maven项目时没有识别,可以手动导入
导入前效果
notion image
点击+号 Add Maven Projects
notion image
选中pom.xml
notion image
点击后导入效果
notion image
notion image
之后可以逐个安装依赖,clean之后install

Maven私服settings.xml模版

Maven私服settings.xml模版
notion image
notion image
notion image

xml

<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <!-- 本地仓库 --> <localRepository>E:\sl-express\apache-maven-3.6.3\repository</localRepository> <!-- 配置私服中deploy的账号 --> <servers> <server> <id>sl-releases</id> <username>deployment</username> <password>deployment123</password> </server> <server> <id>sl-snapshots</id> <username>deployment</username> <password>deployment123</password> </server> </servers> <!-- 使用阿里云maven镜像,排除私服资源库 --> <mirrors> <mirror> <id>mirror</id> <mirrorOf>central,jcenter,!sl-releases,!sl-snapshots</mirrorOf> <name>mirror</name> <url>https://maven.aliyun.com/nexus/content/groups/public</url> </mirror> </mirrors> <profiles> <profile> <id>sl</id> <!-- 配置项目deploy的地址 --> <properties> <altReleaseDeploymentRepository> sl-releases::default::http://maven.sl-express.com/nexus/content/repositories/releases/ </altReleaseDeploymentRepository> <altSnapshotDeploymentRepository> sl-snapshots::default::http://maven.sl-express.com/nexus/content/repositories/snapshots/ </altSnapshotDeploymentRepository> </properties> <!-- 配置项目下载依赖的私服地址 --> <repositories> <repository> <id>sl-releases</id> <url>http://maven.sl-express.com/nexus/content/repositories/releases/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>sl-snapshots</id> <url>http://maven.sl-express.com/nexus/content/repositories/snapshots/</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> </profile> </profiles> <activeProfiles> <!-- 激活配置 --> <activeProfile>sl</activeProfile> </activeProfiles> </settings>
XML

其他总结

代码中没有声明的抛出异常

代码中包含对异常的捕获作为校验失败的逻辑
notion image
如果直接观察API发现没有异常抛出
notion image
再进一步看,可以看到是捕获异常后重新抛出的异常,不会提示要加异常声明
notion image

读取配置表达式

notion image

java

@Value("${role.manager}") private List<Long> managerIds;
Java

四端校验调试

  • 管理端视频里已经提及,不再赘述
  • (APP端)司机+快递员
在模拟器拖拽APK安装后,配置本机的URL地址
notion image
断点调试可以进入Driver部分
notion image
检验放行后
notion image
  • (小程序端)用户端
小程序导入后env.js配置本机URL
notion image
断点调试可以进入Customer部分
notion image
正常可以在小程序里看到手机号

Day01练习参考

司机&快递员端校验

司机端,快递员端类似,仅参数不同
notion image

java

@Value("${role.driver}") private List<Long> driverIds;
Java

java

@Override public Boolean auth(String token, AuthUserInfoDTO authUserInfoDTO, String path) { AuthTemplate authTemplate = AuthTemplateFactory.get(token); // * 获取用户对应角色ids Result<List<Long>> roleByUserId = authTemplate.opsForRole().findRoleByUserId(authUserInfoDTO.getUserId()); List<Long> roleIds = roleByUserId.getData(); // * 判断id是否有落在配置的id中,对应判断是否有权限 Collection<Long> intersection = CollUtil.intersection(roleIds, driverIds); return CollUtil.isNotEmpty(intersection); }
Java

用户端的校验

如果直接复用其他端的逻辑会报错,与其他端的逻辑主要不同两点:
1.解析公钥
复用报错:java.security.InvalidKeyException: invalid key format
2.解析封装
直接转bean会得到字段全空的对象
notion image

java

@Override public AuthUserInfoDTO check(String token) { // 普通用户的token没有对接权限系统,需要自定实现 try { // * Hutool RSA解析 RSA rsa = new RSA(null, jwtProperties.getPublicKey()); PublicKey publicKey = rsa.getPublicKey(); //未配置公钥的情况下本地不做校验 if (publicKey == null) { return null; } // * 取出userId Jws<Claims> jws = Jwts.parser().setSigningKey(publicKey).parseClaimsJws(token); Long userId = jws.getBody().get(Constants.GATEWAY.USER_ID, Long.class); // * 封入token解析对象 AuthUserInfoDTO authUserInfoDTO = new AuthUserInfoDTO(); authUserInfoDTO.setUserId(userId); return authUserInfoDTO; } catch (ExpiredJwtException var3) { throw new AuthSdkException("token已过期"); } catch (Exception var6) { log.error("用户端token校验异常:{}", var6.getMessage()); throw new AuthSdkException("token不合法"); } }
Java
 
相关文章
MetingJS使用自定义音乐源-CF+Huggingface部署
Lazy loaded image
Win与linux开发环境配置|Powershell与Zsh配置记录
Lazy loaded image
折腾linux虚拟机杂记
Lazy loaded image
Redis5.0源码学习 - 草稿
Lazy loaded image
Leetcode Hot 100解题记录 - 草稿
Lazy loaded image
天机学堂完结复盘
Lazy loaded image
灵茶山艾府力扣题单follow[神领物流]项目复盘-环境搭建
Loading...
CamelliaV
CamelliaV
Java;CV;ACGN
最新发布
SEU9系本硕资料
2025-6-14
中英文开发资料汇总
2025-6-14
Leetcode Hot 100解题记录 - 草稿
2025-6-14
神领物流Day02复盘-运费业务 - 草稿
2025-6-4
天机学堂完结复盘-更新草稿
2025-6-4
Redis5.0源码学习 - 草稿
2025-6-3
公告
计划:
  • LLM相关
  • 支付业务 & 双token无感刷新
  • (线程池计算优惠方案)天机学堂Day09-Day12复盘-优惠劵业务
  • (业务复盘,技术汇总)天机学堂完结复盘
  • hot 100
 
2024-2025CamelliaV.

CamelliaV | Java;CV;ACGN


  1. 1 给予你的爱 Xi YuaN/Digital Vengeance/唢清
  2. 2 スペルビア帝国/夜 平松建治
  3. 3 Imagination QQHHh
  4. 4 virtues QQHHh
  5. 5 Tricolor (short ver.) Digital Vengeance/44
  6. 6 港口夜 - 四周年 月代彩
  7. 7 神よ、その黄昏よ 金﨑猛
  8. 8 絆炎 (English Ver) Katherine Eames
  9. 9 ラストエンゲージ~祈りの呪文 馬場泰久
  10. 10 an evening calm fripSide
  11. 11 フレスベルグの少女~風花雪月~ Caro
  12. 12 Answer 北原春希/小木曽雪菜
  13. 13 Kiss Kiss Kiss BENI
  14. 14 远航高歌 染音若蔡/阿南
  15. 15 Sentimental Blue Trident
  16. 16 目指す先にあるもの Falcom Sound Team J.D.K.
  17. 17 Night City r e l/Artemis Delta
  18. 18 Gimme×Gimme P*Light/Giga/初音ミク/鏡音リン
  19. 19 桃幻浪漫 Airots/Active Planets & AUGUST
  20. 20 DESIRE 美郷あき
  21. 21 镜花堂(feat.芬璃尔) 幻塔手游/Rux
  22. 22 she was sitting under the osmanthus tree 梶浦由記
给予你的爱 - Xi YuaN/Digital Vengeance/唢清
00:00 / 03:59