diff --git a/vhr/vhrserver/vhr-mapper/src/main/java/org/javaboy/vhr/mapper/HrMapper.java b/vhr/vhrserver/vhr-mapper/src/main/java/org/javaboy/vhr/mapper/HrMapper.java
index 3c481e7b31b6d98379884e7e6e2edf00544b9538..d2c66157fc08a5cbf52c35e60fbd85d82215f655 100644
--- a/vhr/vhrserver/vhr-mapper/src/main/java/org/javaboy/vhr/mapper/HrMapper.java
+++ b/vhr/vhrserver/vhr-mapper/src/main/java/org/javaboy/vhr/mapper/HrMapper.java
@@ -28,4 +28,6 @@ public interface HrMapper {
List
getAllHrsExceptCurrentHr(Integer id);
Integer updatePasswd(@Param("hrid") Integer hrid, @Param("encodePass") String encodePass);
+
+ Integer updateUserface(@Param("url") String url, @Param("id") Integer id);
}
\ No newline at end of file
diff --git a/vhr/vhrserver/vhr-mapper/src/main/java/org/javaboy/vhr/mapper/HrMapper.xml b/vhr/vhrserver/vhr-mapper/src/main/java/org/javaboy/vhr/mapper/HrMapper.xml
index cac0d1629c2f1e9462e02e173e0e82b1f42467d5..cce05d26064dee3f86c802e159285e64a0075e73 100644
--- a/vhr/vhrserver/vhr-mapper/src/main/java/org/javaboy/vhr/mapper/HrMapper.xml
+++ b/vhr/vhrserver/vhr-mapper/src/main/java/org/javaboy/vhr/mapper/HrMapper.xml
@@ -161,6 +161,9 @@
where id = #{id,jdbcType=INTEGER}
+
+ update hr set userface = #{url} where id=#{id};
+
update hr set password = #{encodePass} where id=#{hrid};
diff --git a/vhr/vhrserver/vhr-service/src/main/java/org/javaboy/vhr/service/HrService.java b/vhr/vhrserver/vhr-service/src/main/java/org/javaboy/vhr/service/HrService.java
index dbd81e6abe436a225160186e39086e3c0d6200d2..9e63e32447401ef394e1112555bf4e559d186394 100644
--- a/vhr/vhrserver/vhr-service/src/main/java/org/javaboy/vhr/service/HrService.java
+++ b/vhr/vhrserver/vhr-service/src/main/java/org/javaboy/vhr/service/HrService.java
@@ -78,4 +78,8 @@ public class HrService implements UserDetailsService {
}
return false;
}
+
+ public Integer updateUserface(String url, Integer id) {
+ return hrMapper.updateUserface(url, id);
+ }
}
diff --git a/vhr/vhrserver/vhr-service/vhr-service.iml b/vhr/vhrserver/vhr-service/vhr-service.iml
index 903560c14ebf87eb52d61431f2a119a9da5065d4..b483d42c5a7a872fde17e317d7cc2f133c541035 100644
--- a/vhr/vhrserver/vhr-service/vhr-service.iml
+++ b/vhr/vhrserver/vhr-service/vhr-service.iml
@@ -25,7 +25,6 @@
-
diff --git a/vhr/vhrserver/vhr-web/pom.xml b/vhr/vhrserver/vhr-web/pom.xml
index fc43108180de88a605763743e929e5945a1598ea..3787fcac1f25b7a677568aa25362ab78e72de117 100644
--- a/vhr/vhrserver/vhr-web/pom.xml
+++ b/vhr/vhrserver/vhr-web/pom.xml
@@ -32,6 +32,11 @@
org.springframework.boot
spring-boot-starter-websocket
+
+ net.oschina.zcx7878
+ fastdfs-client-java
+ 1.27.0.0
+
org.springframework.boot
spring-boot-starter-test
diff --git a/vhr/vhrserver/vhr-web/src/main/java/org/javaboy/vhr/config/FastDFSUtils.java b/vhr/vhrserver/vhr-web/src/main/java/org/javaboy/vhr/config/FastDFSUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..e419f2cfda408cf851502c9c7cc84664689ab3dc
--- /dev/null
+++ b/vhr/vhrserver/vhr-web/src/main/java/org/javaboy/vhr/config/FastDFSUtils.java
@@ -0,0 +1,48 @@
+package org.javaboy.vhr.config;
+
+import org.csource.common.MyException;
+import org.csource.fastdfs.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+
+/**
+ * @作者 江南一点雨
+ * @公众号 江南一点雨
+ * @微信号 a_java_boy
+ * @GitHub https://github.com/lenve
+ * @博客 http://wangsong.blog.csdn.net
+ * @网站 http://www.javaboy.org
+ * @时间 2020-03-01 22:49
+ */
+public class FastDFSUtils {
+ private static StorageClient1 client1;
+
+ static {
+ try {
+ ClientGlobal.initByProperties("fastdfs-client.properties");
+ TrackerClient trackerClient = new TrackerClient();
+ TrackerServer trackerServer = trackerClient.getConnection();
+ StorageServer storageServer = null;
+ client1 = new StorageClient1(trackerServer, storageServer);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (MyException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static String upload(MultipartFile file) {
+ String name = file.getOriginalFilename();
+ String s = null;
+ try {
+ s = client1.upload_file1(file.getBytes(), name.substring(name.lastIndexOf(".") + 1), null);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (MyException e) {
+ e.printStackTrace();
+ }
+ return s;
+ }
+
+}
diff --git a/vhr/vhrserver/vhr-web/src/main/java/org/javaboy/vhr/controller/HrInfoController.java b/vhr/vhrserver/vhr-web/src/main/java/org/javaboy/vhr/controller/HrInfoController.java
index 767ebf9f2e7a37c4210ca7a8f522eac36bbf3eb2..189f3e69adc4667c2fc76dd102e8b198aca8bce6 100644
--- a/vhr/vhrserver/vhr-web/src/main/java/org/javaboy/vhr/controller/HrInfoController.java
+++ b/vhr/vhrserver/vhr-web/src/main/java/org/javaboy/vhr/controller/HrInfoController.java
@@ -1,14 +1,14 @@
package org.javaboy.vhr.controller;
+import org.javaboy.vhr.config.FastDFSUtils;
import org.javaboy.vhr.model.Hr;
import org.javaboy.vhr.model.RespBean;
import org.javaboy.vhr.service.HrService;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
import java.util.Map;
@@ -27,6 +27,9 @@ public class HrInfoController {
@Autowired
HrService hrService;
+ @Value("${javaboy.nginx.host}")
+ String nginxHost;
+
@GetMapping("/hr/info")
public Hr getCurrentHr(Authentication authentication) {
return ((Hr) authentication.getPrincipal());
@@ -51,4 +54,14 @@ public class HrInfoController {
return RespBean.error("更新失败!");
}
-}
+ @PostMapping("/hr/userface")
+ public RespBean updateUserface(MultipartFile file, Integer id) {
+ String upload = FastDFSUtils.upload(file);
+ String url = nginxHost + upload;
+ if (hrService.updateUserface(url, id) == 1) {
+ return RespBean.ok("更新成功!",url);
+ }
+ return RespBean.error("更新失败!");
+ }
+
+}
\ No newline at end of file
diff --git a/vhr/vhrserver/vhr-web/src/main/resources/application.properties b/vhr/vhrserver/vhr-web/src/main/resources/application.properties
index e68e894b17eb6388495b5826c0dd1833fa9b463a..ba2c52ce0d7562546ff437ec76769406dd48bf9a 100644
--- a/vhr/vhrserver/vhr-web/src/main/resources/application.properties
+++ b/vhr/vhrserver/vhr-web/src/main/resources/application.properties
@@ -16,4 +16,6 @@ spring.redis.host=192.168.91.128
spring.redis.database=0
spring.redis.port=6379
spring.redis.password=123
-spring.cache.cache-names=menus_cache
\ No newline at end of file
+spring.cache.cache-names=menus_cache
+# FastDFS ļַ
+javaboy.nginx.host=http://192.168.91.128/
\ No newline at end of file
diff --git a/vhr/vhrserver/vhr-web/src/main/resources/fastdfs-client.properties b/vhr/vhrserver/vhr-web/src/main/resources/fastdfs-client.properties
new file mode 100644
index 0000000000000000000000000000000000000000..c4a1604836cd4f4c1d8b30f504649531430cba29
--- /dev/null
+++ b/vhr/vhrserver/vhr-web/src/main/resources/fastdfs-client.properties
@@ -0,0 +1,24 @@
+## fastdfs-client.properties
+
+fastdfs.connect_timeout_in_seconds = 5
+fastdfs.network_timeout_in_seconds = 30
+
+fastdfs.charset = UTF-8
+
+fastdfs.http_anti_steal_token = false
+fastdfs.http_secret_key = FastDFS1234567890
+fastdfs.http_tracker_http_port = 80
+
+fastdfs.tracker_servers = 192.168.91.128:22122
+
+## Whether to open the connection pool, if not, create a new connection every time
+fastdfs.connection_pool.enabled = true
+
+## max_count_per_entry: max connection count per host:port , 0 is not limit
+fastdfs.connection_pool.max_count_per_entry = 500
+
+## connections whose the idle time exceeds this time will be closed, unit: second, default value is 3600
+fastdfs.connection_pool.max_idle_time = 3600
+
+## Maximum waiting time when the maximum number of connections is reached, unit: millisecond, default value is 1000
+fastdfs.connection_pool.max_wait_time_in_ms = 1000
\ No newline at end of file
diff --git a/vhr/vhrserver/vhr-web/vhr-web.iml b/vhr/vhrserver/vhr-web/vhr-web.iml
index c9f8cfbb77e622d6b351ec8dbd767163e88c4377..bf471ee79931f12e4fd2b6bb7243c4f28ec874ea 100644
--- a/vhr/vhrserver/vhr-web/vhr-web.iml
+++ b/vhr/vhrserver/vhr-web/vhr-web.iml
@@ -25,7 +25,6 @@
-
@@ -91,6 +90,7 @@
+
diff --git a/vuehr/src/views/HrInfo.vue b/vuehr/src/views/HrInfo.vue
index 206567170c854a5c1af594699320bf98adf937d2..9ce5aff0d2bdbe8cf4083a90bc9a09f8a2d11de9 100644
--- a/vuehr/src/views/HrInfo.vue
+++ b/vuehr/src/views/HrInfo.vue
@@ -6,8 +6,15 @@
-
+
+
+
+
电话号码:
{{hr.telephone}}
@@ -34,7 +41,8 @@
:visible.sync="passwdDialogVisible"
width="30%">
-
+
@@ -58,20 +66,36 @@
- 用户姓名: |
- |
+
+ 用户姓名:
+ |
+
+
+ |
- 电话号码: |
- |
+
+ 电话号码:
+ |
+
+
+ |
- 手机号码: |
- |
+
+ 手机号码:
+ |
+
+
+ |
- 用户地址: |
- |
+
+ 用户地址:
+ |
+
+
+ |
@@ -108,36 +132,42 @@
};
return {
ruleForm: {
- oldpass:'',
+ oldpass: '',
pass: '',
checkPass: ''
},
rules: {
oldpass: [
- { validator: validatePass, trigger: 'blur' }
+ {validator: validatePass, trigger: 'blur'}
],
pass: [
- { validator: validatePass, trigger: 'blur' }
+ {validator: validatePass, trigger: 'blur'}
],
checkPass: [
- { validator: validatePass2, trigger: 'blur' }
+ {validator: validatePass2, trigger: 'blur'}
]
},
hr: null,
hr2: null,
- passwdDialogVisible:false,
- dialogVisible:false
+ passwdDialogVisible: false,
+ dialogVisible: false
}
},
mounted() {
this.initHr();
},
methods: {
+ onSuccess() {
+ this.getRequest("/logout");
+ window.sessionStorage.removeItem("user")
+ this.$store.commit('initRoutes', []);
+ this.$router.replace("/");
+ },
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.ruleForm.hrid = this.hr.id;
- this.putRequest("/hr/pass",this.ruleForm).then(resp=>{
+ this.putRequest("/hr/pass", this.ruleForm).then(resp => {
if (resp) {
this.getRequest("/logout");
window.sessionStorage.removeItem("user")
@@ -157,7 +187,7 @@
this.passwdDialogVisible = true;
},
updateHrInfo() {
- this.putRequest("/hr/info",this.hr2).then(resp=>{
+ this.putRequest("/hr/info", this.hr2).then(resp => {
if (resp) {
this.getRequest("/logout");
window.sessionStorage.removeItem("user")