| 
					
				 | 
			
			
				@@ -8,6 +8,11 @@ import com.ozs.common.core.controller.BaseController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.common.core.domain.AjaxResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.common.utils.ImgUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.common.utils.MinioUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.common.utils.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.common.utils.uuid.IdUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.service.entity.BaseCameraManagement; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.service.entity.BaseRailwayManagement; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.service.entity.MsgAppPush; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.service.entity.vo.MsgAppPushVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.service.service.MsgAppPushService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -22,8 +27,11 @@ import org.springframework.util.ObjectUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.multipart.MultipartFile; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.annotation.Resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.File; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.FileOutputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.UUID; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -44,43 +52,43 @@ public class GeoHazardMineController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private ISysUserService sysUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private MsgAppPushService msgAppPushService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private MinioUtils minioUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Value("${base.imgUrl}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private String imgUrl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 修改头像 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PostMapping("/updateAvatar") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation("app修改头像") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public AjaxResult updateAvatar(MultipartFile image, String userId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String imageUrl = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (image != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //获取文件名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                String fileName = image.getOriginalFilename(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (org.springframework.util.StringUtils.isEmpty(fileName) || image.getSize() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    throw new Exception("图像文件不能为空!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //验证文件名是否合格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (!ImgUtil.isImg(fileName)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    throw new Exception("图像文件必须是图片格式!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                String saveFileName = UUID.randomUUID().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                File saveDirFile = new File(avatarURL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (!saveDirFile.exists()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    saveDirFile.mkdirs(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public AjaxResult updateAvatar(@RequestParam("image") MultipartFile image, @RequestParam("userId") String userId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (image.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return AjaxResult.error("不能上传空文件哦"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //图片保存路径 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //String fileUploadPath ="/"+userId+"/image"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String uploadFile = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (image != null && !image.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String imageName = image.getOriginalFilename(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (StringUtils.isNotBlank(imageName)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // String date = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String filename = IdUtils.fastSimpleUUID() + image.getOriginalFilename().substring(image.getOriginalFilename().lastIndexOf(".")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String format1 = dateFormat1.format(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String imgName = format1 + "/" + filename; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    minioUtils.minIoClientUpload(image.getInputStream(), imgName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                File picFullFile = new File(saveDirFile.getAbsolutePath(), saveFileName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                FileOutputStream fos = new FileOutputStream(picFullFile); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                fos.write(image.getBytes()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                imageUrl = fileUrl + avatarURL + saveFileName; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                sysUserService.updateUserAvatarById(userId, imageUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                throw new Exception("上传文件不能为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                uploadFile = imgUrl + "/" + format1 + "/" + filename; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sysUserService.updateUserAvatarById(userId, uploadFile); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return AjaxResult.error("上传功能出错"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return AjaxResult.success(imageUrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return AjaxResult.success(uploadFile); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 |