智慧校园

This commit is contained in:
张博 2024-10-31 11:34:32 +08:00
parent 23f214d1d0
commit cdf5e28051
6 changed files with 118 additions and 9 deletions

View File

@ -1,5 +1,5 @@
# 使用官方Java运行环境作为基础镜像 # 使用官方Java运行环境作为基础镜像
FROM openjdk:1.8-jre-slim FROM openjdk:8
# 指定维护者信息 # 指定维护者信息
LABEL maintainer="zhangbo" LABEL maintainer="zhangbo"
@ -8,7 +8,7 @@ LABEL maintainer="zhangbo"
VOLUME /tmp VOLUME /tmp
# 将jar包添加到容器中并更名为app.jar # 将jar包添加到容器中并更名为app.jar
ADD shapelight-admin/target/shapelight-admin.jar app.jar ADD target/shapelight-admin.jar app.jar
# 暴露容器内的端口给外部访问 # 暴露容器内的端口给外部访问
EXPOSE 8018 EXPOSE 8018

View File

@ -244,12 +244,38 @@
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- docker的maven插件官网https://github.com/spotify/docker-maven-plugin -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.2.2</version>
<configuration>
<!--配置最终生成的镜像名称-->
<imageName>shapelight/admin</imageName>
<baseImage>java:8-alpine</baseImage>
<entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<!--配置 docker 的地址,当运行 docker build 命令时构建并上传镜像-->
<dockerHost>http://192.168.10.62:2375</dockerHost>
</configuration>
</plugin>
<!--<plugin>
<groupId>com.spotify</groupId> <groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId> <artifactId>docker-maven-plugin</artifactId>
<version>0.4.14</version> <version>0.4.14</version>
<configuration> <configuration>
<imageName>shapelight/admin</imageName> <imageName>shapelight/admin</imageName>
<dockerDirectory>${project.basedir}</dockerDirectory> <dockerDirectory>${project.basedir}</dockerDirectory>
<dockerHost>http://192.168.10.62:2375</dockerHost>
<resources> <resources>
<resource> <resource>
<targetPath>/</targetPath> <targetPath>/</targetPath>
@ -258,8 +284,49 @@
</resource> </resource>
</resources> </resources>
</configuration> </configuration>
<!-- 运行命令 mvn clean package docker:build 打包并生成docker镜像 --> &lt;!&ndash; 运行命令 mvn clean package docker:build 打包并生成docker镜像 &ndash;&gt;
</plugin> </plugin>-->
<!--<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
&lt;!&ndash; 镜像名称 guoweixin/exam&ndash;&gt;
<imageName>${project.artifactId}</imageName>
&lt;!&ndash;指定标签&ndash;&gt;
<imageTags>
<imageTag>latest</imageTag>
</imageTags>
&lt;!&ndash; 基础镜像jdk 1.8&ndash;&gt;
<baseImage>java</baseImage>
&lt;!&ndash; 制作者提供本人信息 &ndash;&gt;
<maintainer>zdk=20477@sina.com</maintainer>
<runs>
<run>mkdir -p /opt/java/</run>
</runs>
&lt;!&ndash;切换到/ROOT目录 &ndash;&gt;
<workdir>/ROOT</workdir>
<cmd>["java", "-version"]</cmd>
<entryPoint>["java", "-jar", "${project.build.finalName}.jar"]</entryPoint>
&lt;!&ndash; 指定 Dockerfile 路径
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
&ndash;&gt;
&lt;!&ndash;指定远程 docker api地址&ndash;&gt;
<dockerHost>http://192.168.10.62:2375</dockerHost>
&lt;!&ndash; 这里是复制 jar 包到 docker 容器指定目录配置 &ndash;&gt;
<resources>
<resource>
<targetPath>/ROOT</targetPath>
&lt;!&ndash;用于指定需要复制的根目录,${project.build.directory}表示target目录&ndash;&gt;
<directory>${project.build.directory}</directory>
&lt;!&ndash;用于指定需要复制的文件。${project.build.finalName}.jar指的是打包后的jar
包文件。&ndash;&gt;
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>-->
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -29,8 +29,8 @@ public class AdminApplication {
SpringApplication.run(AdminApplication.class, args); SpringApplication.run(AdminApplication.class, args);
//初始化掌静脉sdk //初始化掌静脉sdk
//int initCode = PalmSDK.init(); int initCode = PalmSDK.init();
//log.debug("掌静脉sdk初始化。。。。。。。。。。:"+initCode); log.debug("掌静脉sdk初始化。。。。。。。。。。:"+initCode);
// //mqtt服务启动 // //mqtt服务启动
// MqttClientUtil.createClient(); // MqttClientUtil.createClient();
// //

View File

@ -0,0 +1,42 @@
package net.shapelight.modules.job.task;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import net.shapelight.modules.job.entity.KeysEntity;
import net.shapelight.modules.tripartitePlatform.operatorPlatform.OpFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Component("empowerTask")
@Slf4j
public class EmpowerTask implements ITask{
@Autowired
private OpFeignClient feignClient;
@Value("${global.qingju.accountNumber}")
String accountNumber;
@Value("${global.qingju.empowerKey}")
String empowerKey;
// 定义Token续期的方法
public void renewToken() {
Map<String,Object> params = new HashMap<>();
params.put("accountNumber",accountNumber);
params.put("empowerKey", empowerKey);
JSONObject json = feignClient.empower(params);
if(json.getString("shrgStatus").equals("S")) {
KeysEntity.passKey = json.getString("passKey");
KeysEntity.empowerText = json.getString("empowerText");
log.debug("TokenResponse:{}", json.getString("passKey"));
}
}
@Override
public void run(String params) {
renewToken();
}
}

View File

@ -104,7 +104,7 @@ public class TenParentController {
TenParent tenParent = tenParentService.getById(id); TenParent tenParent = tenParentService.getById(id);
AppUserEntity userEntity = appUserService.getById(tenParent.getUserId()); AppUserEntity userEntity = appUserService.getById(tenParent.getUserId());
userEntity.setPassword(DigestUtils.sha256Hex(passWord)); userEntity.setPassword(DigestUtils.sha256Hex(passWord));
appUserService.save(userEntity); appUserService.updateById(userEntity);
return R.ok(); return R.ok();
} }
} }

View File

@ -64,14 +64,14 @@ spring:
async: async:
request-timeout: 60000 #60秒 request-timeout: 60000 #60秒
resources: resources:
static-locations: file:/home/huangyifang/project/cell #根目录 static-locations: file:D:/project/cell/temp #根目录
#file: #file:
#文件上传目录注意Linux和Windows上的目录结构不同 #文件上传目录注意Linux和Windows上的目录结构不同
#uploadPath: D:/project/cell/temp #uploadPath: D:/project/cell/temp
global: global:
http_flag: http http_flag: http
file_path: file_path:
static-locations: /home/huangyifang/project/cell #根目录必须是在static-locations下 static-locations: D:/project/cell/temp #根目录必须是在static-locations下
temp_dir: temp temp_dir: temp
images_dir: images images_dir: images
apk_dir: apk apk_dir: apk