From 4de5ded1a8ccc9f819f86ef2ed4b03a5461b4744 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期二, 24 十二月 2024 15:39:21 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java                    |    6 +
 /dev/null                                                                                                |   56 --------------
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/ObsUploadUtil.java                      |   91 ++++++++++++++++++++++
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderInfoVo.java                              |    6 +
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java            |    5 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java |   19 ++++
 6 files changed, 123 insertions(+), 60 deletions(-)

diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
index 1647240..eabf87f 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -16,10 +16,9 @@
 import com.ruoyi.account.api.model.*;
 import com.ruoyi.account.dto.DangerInfoDto;
 import com.ruoyi.account.service.*;
-import com.ruoyi.account.util.OssUploadUtil;
+import com.ruoyi.account.util.ObsUploadUtil;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.bean.BeanUtils;
-import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
 import com.ruoyi.order.model.Order;
@@ -718,7 +717,7 @@
     public String upload(MultipartFile file){
         String s = null;
         try {
-            s = OssUploadUtil.ossUpload(file);
+            s = ObsUploadUtil.obsUpload(file);
         } catch (IOException e) {
             throw new RuntimeException(e);
         }
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/ObsUploadUtil.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/ObsUploadUtil.java
new file mode 100644
index 0000000..dd417b6
--- /dev/null
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/ObsUploadUtil.java
@@ -0,0 +1,91 @@
+package com.ruoyi.account.util;
+
+import com.obs.services.ObsClient;
+import com.obs.services.model.ObjectMetadata;
+import com.obs.services.model.PutObjectResult;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.UUID;
+
+public class ObsUploadUtil {
+	//OBS图片访问域名
+	public static String endPoint = "obs.cn-southwest-2.myhuaweicloud.com";
+	public static String accessKeyId = "F95RSIZQ1B77MGRTPWSU";
+	public static String accessKeySecret = "rMhmXnuDGPwI5ptq0jGCZ6QwaoUDQ5ZJm3RFrZuy";
+	public static String bucketName = "qijishenghuiyuan";
+	public static String oss_domain = "http://qijishenghuiyuan.obs.cn-southwest-2.myhuaweicloud.com/";
+
+
+	// 创建ObsClient实例
+	public static ObsClient obsClient = new ObsClient(accessKeyId, accessKeySecret, endPoint);
+
+	public static String obsUpload(MultipartFile file) throws IOException{
+		String fileName = "";
+		if(file!=null && !"".equals(file.getOriginalFilename()) && file.getOriginalFilename()!=null){
+			InputStream content = file.getInputStream();//获得指定文件的输入流
+			ObjectMetadata meta = new ObjectMetadata();// 创建上传Object的Metadata
+			meta.setContentLength(file.getSize());  // 必须设置ContentLength
+			String originalFilename = file.getOriginalFilename();
+			fileName =  UUID.randomUUID().toString().replaceAll("-","") + originalFilename.subSequence(originalFilename.lastIndexOf("."), originalFilename.length());
+			obsClient.putObject(bucketName,"admin/"+fileName,content,meta);
+			if(fileName != null && !"".equals(fileName)){
+				System.out.println(fileName);
+				fileName = oss_domain+"admin/"+fileName;
+			}
+		}
+		return fileName;
+	}
+	
+	
+	
+	public static String obsUpload(String suffix, InputStream content){
+		String fileName =  UUID.randomUUID().toString().replaceAll("-","") + "." + suffix;
+		try {
+			PutObjectResult putObjectResult = obsClient.putObject(bucketName, "admin/" + fileName, content);
+			String objectUrl = putObjectResult.getObjectUrl();
+			return oss_domain+"admin/"+fileName;
+		}catch (Exception e){
+			e.printStackTrace();
+		}
+		return "";
+	}
+	
+	
+
+	/**
+	 * 删除某个Object
+	 *
+	 * @param bucketUrl
+	 * @return
+	 */
+	public static boolean deleteObject(String bucketUrl) {
+		try {
+			bucketUrl=bucketUrl.replace(oss_domain+"web","");
+			// 删除Object.
+			obsClient.deleteObject(bucketName, bucketUrl);
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		} finally {
+			//ossClient.shutdown();
+		}
+		return true;
+	}
+	
+//	 public static void createBucket(String bucketName)
+//     {
+//         //初始化 OSSClient
+////          ossClient = new OssClient(endPoint, accessKeyId, accessKeySecret);
+//
+//         // 新建一个Bucket
+//         Bucket bucket = ossClient.createBucket(bucketName);
+//         System.out.println(bucket.getName());
+//         System.out.println(bucket.getCreationDate());
+//     }
+//	 
+//	 public static void main(String[] args) {
+//		 OssUploadUtil.createBucket("ssfdfsd");
+//	}
+}
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/OssUploadUtil.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/OssUploadUtil.java
deleted file mode 100644
index 0e2c160..0000000
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/OssUploadUtil.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.ruoyi.account.util;
-
-import com.aliyun.oss.OSSClient;
-import com.aliyun.oss.model.ObjectMetadata;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.UUID;
-
-public class OssUploadUtil {
-	//OSS图片访问域名
-	public static String oss_domain = "http://qijishenghuiyuan.obs.cn-southwest-2.myhuaweicloud.com/";
-	public static String accessKeyId = "F95RSIZQ1B77MGRTPWSU";
-	public static String accessKeySecret = "rMhmXnuDGPwI5ptq0jGCZ6QwaoUDQ5ZJm3RFrZuy";
-	public static String bucketName="qijishenghuiyuan";
-	public static String endpoint = "obs.cn-southwest-2.myhuaweicloud.com";
-
-	public static OSSClient ossClient = new OSSClient(endpoint, accessKeyId,accessKeySecret);
-
-	public static String ossUpload(HttpServletRequest request, MultipartFile file) throws IOException{
-		String fileName = "";
-		if(file!=null && !"".equals(file.getOriginalFilename()) && file.getOriginalFilename()!=null){
-			InputStream content = file.getInputStream();//获得指定文件的输入流
-			ObjectMetadata meta = new ObjectMetadata();// 创建上传Object的Metadata
-			meta.setContentLength(file.getSize());  // 必须设置ContentLength
-			String originalFilename = file.getOriginalFilename();
-			fileName =  UUID.randomUUID().toString().replaceAll("-","") + originalFilename.subSequence(originalFilename.lastIndexOf("."), originalFilename.length());
-			ossClient.putObject(bucketName,"img/"+fileName,content,meta);// 上传Object.
-			if(fileName != null && !"".equals(fileName)){
-				System.out.println(fileName);
-				fileName = oss_domain+"img/"+fileName;
-			}
-		}
-		return fileName;
-	}
-
-	public static String ossUpload(MultipartFile file) throws IOException{
-		//CommonsMultipartFile file = (CommonsMultipartFile)multipartFile;
-		String fileName = "";
-		if(file!=null && !"".equals(file.getOriginalFilename()) && file.getOriginalFilename()!=null){
-			InputStream content = file.getInputStream();//获得指定文件的输入流
-			ObjectMetadata meta = new ObjectMetadata();// 创建上传Object的Metadata
-			meta.setContentLength(file.getSize());  // 必须设置ContentLength
-			String originalFilename = file.getOriginalFilename();
-			fileName =  UUID.randomUUID().toString().replaceAll("-","") + originalFilename.subSequence(originalFilename.lastIndexOf("."), originalFilename.length());
-			ossClient.putObject(bucketName,"img/"+fileName,content,meta);// 上传Object.
-			if(fileName != null && !"".equals(fileName)){
-				System.out.println(fileName);
-				fileName = oss_domain+"img/"+fileName;
-			}
-		}
-		return fileName;
-	}
-}
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderInfoVo.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderInfoVo.java
index 75039e3..a6bfc35 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderInfoVo.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderInfoVo.java
@@ -54,5 +54,11 @@
 	private Integer goodsNum;
 	@ApiModelProperty("商品信息")
 	private String goodsJson;
+	@ApiModelProperty("核销时间")
+	private String writeOffTime;
+	@ApiModelProperty("服务技师")
+	private String technicianName;
+	@ApiModelProperty("分佣金额")
+	private BigDecimal subcommission;
 	
 }
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java
index 03e63ba..d8637d0 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java
@@ -3,6 +3,8 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.api.feignClient.AppUserClient;
+import com.ruoyi.account.api.model.AppUser;
 import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
@@ -35,10 +37,25 @@
     private RemoteOrderGoodsClient orderGoodsClient;
     @Resource
     private RedisTemplate<String, String> redisTemplate;
+    
+    @Resource
+    private AppUserClient appUserClient;
+    
+    
+    
+    
 
     @Override
     public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long shopId, Integer status) {
-        return technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop(shopId,status);
+        List<TechnicianSubscribeVO> list = technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop(shopId, status);
+        for (TechnicianSubscribeVO technicianSubscribeVO : list) {
+            Long id = technicianSubscribeVO.getId();
+            TechnicianSubscribe technicianSubscribe = this.getById(id);
+            AppUser appUser = appUserClient.getAppUserById(technicianSubscribe.getAppUserId());
+            technicianSubscribeVO.setUserName(appUser.getName());
+            technicianSubscribeVO.setPhone(appUser.getPhone());
+        }
+        return list;
     }
     @Override
     public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop1(Long shopId, Integer status ,String phone,
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java
index 610d9f4..8260e32 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java
@@ -60,6 +60,12 @@
 
     @ApiModelProperty(value = "纬度")
     private String latitude;
+    
+    @ApiModelProperty(value = "预约用户")
+    private String userName;
+    
+    @ApiModelProperty(value = "联系电话")
+    private String phone;
 
 
 }

--
Gitblit v1.7.1