Browse Source

修改文件路径

chunping 3 years ago
parent
commit
3784933d32

+ 16 - 21
mp-admin/src/main/java/com/qs/mp/web/controller/system/SysProfileController.java

@@ -42,42 +42,37 @@ import org.springframework.web.multipart.MultipartFile;
 
 /**
  * 个人信息 业务处理
- * 
+ *
  * @author ygp
  */
 @RestController
 @RequestMapping("/system/user/profile")
 public class SysProfileController extends BaseController
 {
-	
+
 	private static final Logger log = LoggerFactory.getLogger(FileUploadController.class);
-	
+
     @Autowired
     private ISysUserService userService;
 
     @Autowired
     private TokenService tokenService;
-    
+
     @Autowired
     protected HostHolder hostHolder;
-    
+
     /**
      * 文件上传路径
      */
     @Value("${mp.profile}")
     public String filePath;
-    
+
     /**
      * 公开
      */
     @Value("${cloud.public-bucket-name}")
     private String publicBucketName;
-    
-    /**
-     * 模板原稿文件目录
-     */
-    @Value("${cloud.template-dir}")
-    private String tempSrcDir;
+
 
     /**
      * 个人信息
@@ -137,8 +132,8 @@ public class SysProfileController extends BaseController
         LoginUser loginUser = SecurityUtils.getLoginUser();
         String userName = loginUser.getUsername();
         String password = loginUser.getPassword();
-        
-    
+
+
         if (!SecurityUtils.matchesPassword(oldPassword, password))
         {
             return AjaxResult.error("修改密码失败,旧密码错误");
@@ -156,7 +151,7 @@ public class SysProfileController extends BaseController
         }
         return AjaxResult.error("修改密码异常,请联系管理员");
     }
-    
+
     /**
      * 重置密码
      */
@@ -167,7 +162,7 @@ public class SysProfileController extends BaseController
         LoginUser loginUser = SecurityUtils.getLoginUser();
         String userName = loginUser.getUsername();
         String password = loginUser.getPassword();
-        
+
         //校验短信验证码
         ValidSMSResult res = JSMSUtils.sendValidSMSCode(
         		messageId, authCode);
@@ -175,7 +170,7 @@ public class SysProfileController extends BaseController
         if(res == null || !res.getIsValid()){
             throw new CaptchaExpireException();
         }
-        
+
         if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
         {
             // 更新缓存用户密码
@@ -210,8 +205,8 @@ public class SysProfileController extends BaseController
         }
         return AjaxResult.error("上传图片异常,请联系管理员");
     }
-    
-    
+
+
     private AjaxResult uploadAvatar(MultipartFile file) {
         try {
             if (null == file) {
@@ -237,7 +232,7 @@ public class SysProfileController extends BaseController
                 LogUtil.error(logger, "头像上传失败.");
                 return AjaxResult.error("头像上传失败.");
             }
-            
+
             if (userService.updateUserAvatar(loginUser.getUsername(), name))
             {
                 AjaxResult ajax = AjaxResult.success();
@@ -253,7 +248,7 @@ public class SysProfileController extends BaseController
             return AjaxResult.error("头像上传失败.");
         }
     }
-    
+
     private String commpressPicAndUpLoadOSS(String userId,MultipartFile file,String mimeType,int width,int height,String bucketName) {
         String fileName = file.getOriginalFilename();
         int idx = fileName.lastIndexOf('.');