|  | @@ -6,6 +6,7 @@ package com.jeeplus.modules.sys.web;
 | 
	
		
			
				|  |  |  import com.google.common.collect.Lists;
 | 
	
		
			
				|  |  |  import com.google.common.collect.Maps;
 | 
	
		
			
				|  |  |  import com.jeeplus.common.beanvalidator.BeanValidators;
 | 
	
		
			
				|  |  | +import com.jeeplus.common.bos.BOSClientUtil;
 | 
	
		
			
				|  |  |  import com.jeeplus.common.config.Global;
 | 
	
		
			
				|  |  |  import com.jeeplus.common.json.AjaxJson;
 | 
	
		
			
				|  |  |  import com.jeeplus.common.json.ComNameJson;
 | 
	
	
		
			
				|  | @@ -765,39 +766,16 @@ public class UserController extends BaseController {
 | 
	
		
			
				|  |  |      @RequestMapping(value = "imageUpload")
 | 
	
		
			
				|  |  |      public String imageUpload( HttpServletRequest request, HttpServletResponse response,MultipartFile file) throws IllegalStateException, IOException {
 | 
	
		
			
				|  |  |          User currentUser = UserUtils.getUser();
 | 
	
		
			
				|  |  | -        String oldPhoto = currentUser.getPhoto();
 | 
	
		
			
				|  |  | -        String key = "";
 | 
	
		
			
				|  |  | -        if(StringUtils.isNotBlank(oldPhoto)){
 | 
	
		
			
				|  |  | -            String aliyunUrl = Global.getAliyunUrl();
 | 
	
		
			
				|  |  | -            String aliDownloadUrl = Global.getAliDownloadUrl();
 | 
	
		
			
				|  |  | -            String cons = "";
 | 
	
		
			
				|  |  | -            if (oldPhoto.contains(aliyunUrl)){
 | 
	
		
			
				|  |  | -                cons = aliyunUrl;
 | 
	
		
			
				|  |  | -            }else if (oldPhoto.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
 | 
	
		
			
				|  |  | -                cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
 | 
	
		
			
				|  |  | -            }else {
 | 
	
		
			
				|  |  | -                cons = aliDownloadUrl;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            String[] arr = oldPhoto.split(cons+"/");
 | 
	
		
			
				|  |  | -            key = arr[1];
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        OSSClientUtil ossUtil =new OSSClientUtil();
 | 
	
		
			
				|  |  | -        // 判断文件是否为空
 | 
	
		
			
				|  |  | -        if (!file.isEmpty()) {
 | 
	
		
			
				|  |  | -            String filepath= ossUtil.uploadFile2OSS(file, "photo");
 | 
	
		
			
				|  |  | -            ossUtil.deleteSingleObject(key);
 | 
	
		
			
				|  |  | -            // 文件保存路径
 | 
	
		
			
				|  |  | -//            	String realPath = Global.USERFILES_BASE_URL
 | 
	
		
			
				|  |  | -//        		+ UserUtils.getPrincipal() + "/images/" ;
 | 
	
		
			
				|  |  | -//                // 转存文件
 | 
	
		
			
				|  |  | -//            	FileUtils.createDirectory(Global.getUserfilesBaseDir()+realPath);
 | 
	
		
			
				|  |  | -//            	file.transferTo(new File( Global.getUserfilesBaseDir() +realPath +  file.getOriginalFilename()));
 | 
	
		
			
				|  |  | -//            	currentUser.setPhoto(request.getContextPath()+realPath + file.getOriginalFilename());
 | 
	
		
			
				|  |  | -            currentUser.setPhoto(filepath);
 | 
	
		
			
				|  |  | +        if(file != null && file.getSize()>0){
 | 
	
		
			
				|  |  | +            String path = new StringBuilder("/headImg/")
 | 
	
		
			
				|  |  | +                    .append(currentUser.getName()).append(".png").toString();
 | 
	
		
			
				|  |  | +            InputStream inputStream = file.getInputStream();
 | 
	
		
			
				|  |  | +            BOSClientUtil bosClientUtil = new BOSClientUtil();
 | 
	
		
			
				|  |  | +            String url = bosClientUtil.upload(path, inputStream);
 | 
	
		
			
				|  |  | +            currentUser.setPhoto(url);
 | 
	
		
			
				|  |  |              currentUser.setDefaultPhoto("1");
 | 
	
		
			
				|  |  |              systemService.updateUserInfo(currentUser);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          return "modules/sys/userImageEdit";
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |