|
@@ -31,6 +31,7 @@ import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.Random;
|
|
|
|
|
|
/**
|
|
|
* @Description: 用户注册登录等相关接口
|
|
@@ -87,8 +88,13 @@ public class UserController extends BaseController {
|
|
|
userEntity.setPhone("-");
|
|
|
userEntity.setGender("0");
|
|
|
userEntity.setPassword("-");
|
|
|
- userEntity.setAvatar("-");
|
|
|
-
|
|
|
+ Random rand = new Random();
|
|
|
+ int number = rand.nextInt(3) + 1;
|
|
|
+ if (userEntity.getGender().equals("1")){
|
|
|
+ userEntity.setAvatar("./userAvatar/man"+number+".png");
|
|
|
+ }else {
|
|
|
+ userEntity.setAvatar("./userAvatar/woman"+number+".png");
|
|
|
+ }
|
|
|
userEntity = this.userService.save(userEntity);
|
|
|
resultJson.put("improve",true);
|
|
|
}
|
|
@@ -156,9 +162,9 @@ public class UserController extends BaseController {
|
|
|
File fileLocal = new File(FILEDIR, fileName);
|
|
|
FileUtils.copyInputStreamToFile(avatar.getInputStream(), fileLocal);
|
|
|
avatarUrl = FILEDIR + fileName;
|
|
|
- userEntity.setAvatar(avatarUrl);
|
|
|
+ /*userEntity.setAvatar(avatarUrl);
|
|
|
userEntity.setUpdateTime(DateUtil.now());
|
|
|
- this.userService.save(userEntity);
|
|
|
+ this.userService.save(userEntity);*/
|
|
|
return success(avatarUrl);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|