From c885f99c9ff1445f6975d16faf4a23006cd5763b Mon Sep 17 00:00:00 2001
From: yupeng <roc__yu@163.com>
Date: 星期三, 05 二月 2025 14:53:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into xizang-changyun

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java     |   35 +++++++++++++++++
 ruoyi-system/src/main/resources/mapper/system/THouseMapper.xml                  |    3 +
 ruoyi-admin/src/main/resources/application-test.yml                             |    2 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java |    2 
 ruoyi-applet/src/main/resources/application-prod.yml                            |    2 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/COSController.java       |   10 ++++
 ruoyi-admin/src/main/resources/application-prod.yml                             |    2 
 ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml               |    2 +
 ruoyi-system/src/main/java/com/ruoyi/system/model/TContract.java                |    4 +-
 ruoyi-applet/src/main/resources/application-test.yml                            |    2 
 ruoyi-system/src/main/resources/mapper/system/TTenantMapper.xml                 |    2 
 11 files changed, 56 insertions(+), 10 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/COSController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/COSController.java
index 5fe8e8d..0702deb 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/COSController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/COSController.java
@@ -37,12 +37,20 @@
         String url = tencentCosUtil.upLoadFile(file);
         return R.ok(url, url);
     }
+    @PostMapping("/downloadImg")
+    @ApiOperation(value = "文件下载", tags = "公共-文件下载")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "文件url", name = "url", dataType = "String", required = true)
+    })
+    public String downloadImg(@RequestParam("url") String url) {
+       return tencentCosUtil.downLoadFileImg(url);
+    }
     @PostMapping("/download")
     @ApiOperation(value = "文件下载", tags = "公共-文件下载")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "文件url", name = "url", dataType = "String", required = true)
     })
-    public void upload(@RequestParam("url") String url) {
+    public void download(@RequestParam("url") String url) {
         tencentCosUtil.downLoadFile(url);
     }
 }
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java
index 108901e..4476610 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java
@@ -72,7 +72,7 @@
         }
         return R.ok();
     }
-    @Log(title = "合同管理-编辑合同", businessType = BusinessType.UPDATE)
+    @Log(title = "合同管理-编辑合同", businessType =  BusinessType.UPDATE)
     @ApiOperation(value = "编辑合同")
     @PostMapping(value = "/updateContract")
     public R<Boolean> updateContract(@Validated @RequestBody TContractDTO dto) {
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java
index be2bdbb..1d02134 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java
@@ -24,6 +24,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Base64;
 import java.util.UUID;
 
 /**
@@ -129,6 +130,7 @@
     public void downLoadFile(String file) {
         HttpServletResponse response = WebUtils.response();
         String replace = file.replace(rootSrc, "");
+        response.setHeader("Access-Control-Expose-Headers","File-Type");
         COSCredentials cred = new BasicCOSCredentials(
                 secretId,
                 secretKey);
@@ -157,5 +159,36 @@
             cosClient.shutdown();
         }
     }
-//    https://xzgttest-1305134071.cos.ap-chengdu.myqcloud.com/xizang/e4ea88b8-5470-456e-bf97-75cf47f38e84.jpg
+    public String downLoadFileImg(String file) {
+        byte[] data = null;
+        String replace = file.replace(rootSrc, "");
+        COSCredentials cred = new BasicCOSCredentials(
+                secretId,
+                secretKey);
+        // 2.1 设置存储桶的地域(上文获得)
+        Region region = new Region(bucketAddr);
+        ClientConfig clientConfig = new ClientConfig(region);
+        // 2.2 使用https协议传输
+        clientConfig.setHttpProtocol(HttpProtocol.https);
+        COSClient cosClient = new COSClient(cred, clientConfig);
+        try {
+            // 5. 下载文件并获取输入流
+            InputStream inputStream = cosClient.getObject(bucketName, replace).getObjectContent();
+            ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
+            // 6. 处理输入流,例如读取内容或保存到本地文件
+            byte[] buffer = new byte[1024];
+            int len;
+            while ((len = inputStream.read(buffer)) != -1) {
+                // 处理读取到的数据
+                swapStream.write(buffer, 0, len);
+            }
+            data = swapStream.toByteArray();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            // 7. 关闭输入流
+            cosClient.shutdown();
+        }
+        return Base64.getEncoder().encodeToString(data);
+    }
 }
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml
index ee46864..027c4d6 100644
--- a/ruoyi-admin/src/main/resources/application-prod.yml
+++ b/ruoyi-admin/src/main/resources/application-prod.yml
@@ -96,7 +96,7 @@
     druid:
       # 主库数据源
       master:
-        url: jdbc:mysql://127.0.0.1:10633/xizang?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        url: jdbc:mysql://127.0.0.1:10633/xizang?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai
         username: root
         password: XiZang@2025!
       # 从库数据源
diff --git a/ruoyi-admin/src/main/resources/application-test.yml b/ruoyi-admin/src/main/resources/application-test.yml
index 2f6795f..4ca4b21 100644
--- a/ruoyi-admin/src/main/resources/application-test.yml
+++ b/ruoyi-admin/src/main/resources/application-test.yml
@@ -96,7 +96,7 @@
     druid:
       # 主库数据源
       master:
-        url: jdbc:mysql://xzgt.test.591taxi.cn:13306/xizang?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
+        url: jdbc:mysql://xzgt.test.591taxi.cn:13306/xizang?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai
         username: root
         password: 8f5z9g52gx4bg
       # 从库数据源
diff --git a/ruoyi-applet/src/main/resources/application-prod.yml b/ruoyi-applet/src/main/resources/application-prod.yml
index 47ea687..47a6c8f 100644
--- a/ruoyi-applet/src/main/resources/application-prod.yml
+++ b/ruoyi-applet/src/main/resources/application-prod.yml
@@ -96,7 +96,7 @@
     druid:
       # 主库数据源
       master:
-        url: jdbc:mysql://127.0.0.1:10633/xizang?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        url: jdbc:mysql://127.0.0.1:10633/xizang?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai
         username: root
         password: XiZang@2025!
       # 从库数据源
diff --git a/ruoyi-applet/src/main/resources/application-test.yml b/ruoyi-applet/src/main/resources/application-test.yml
index 47ab28f..355f277 100644
--- a/ruoyi-applet/src/main/resources/application-test.yml
+++ b/ruoyi-applet/src/main/resources/application-test.yml
@@ -96,7 +96,7 @@
     druid:
       # 主库数据源
       master:
-        url: jdbc:mysql://xzgt.test.591taxi.cn:13306/xizang?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
+        url: jdbc:mysql://xzgt.test.591taxi.cn:13306/xizang?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai
         username: root
         password: 8f5z9g52gx4bg
       # 从库数据源
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/model/TContract.java b/ruoyi-system/src/main/java/com/ruoyi/system/model/TContract.java
index 4b73a95..bc259e8 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/model/TContract.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/model/TContract.java
@@ -127,9 +127,9 @@
     private Integer status;
     @ApiModelProperty(value = "内存大小多个文件逗号拼接")
     @TableField("memory")
-    private Integer memory;
+    private String memory;
     @ApiModelProperty(value = "附件名称 逗号拼接")
     @TableField("contract_file_name")
-    private Integer contractFileName;
+    private String contractFileName;
 
 }
diff --git a/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
index 27b7137..fa1131b 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
@@ -53,6 +53,8 @@
             <if test="query.status != null">
                 and t1.status = #{query.status}
             </if>
+            AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+
         </where>
     </select>
 
diff --git a/ruoyi-system/src/main/resources/mapper/system/THouseMapper.xml b/ruoyi-system/src/main/resources/mapper/system/THouseMapper.xml
index 43cf3d6..d09143d 100644
--- a/ruoyi-system/src/main/resources/mapper/system/THouseMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/THouseMapper.xml
@@ -41,6 +41,7 @@
             <if test="req.leaseStatus != null">
                 and t1.lease_status = #{req.leaseStatus}
             </if>
+            AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
         </where>
     </select>
     <select id="userHistoryList" resultType="com.ruoyi.system.vo.HouseVO">
@@ -61,6 +62,8 @@
         left join t_tenant t2 on t1.tenant_id = t2.id
         LEFT JOIN t_house t3 on t3.id = t1.house_id
         where t1.house_id = #{req.id}
+          AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+
     </select>
 
 </mapper>
diff --git a/ruoyi-system/src/main/resources/mapper/system/TTenantMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TTenantMapper.xml
index ec45f48..4e23099 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TTenantMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TTenantMapper.xml
@@ -30,7 +30,7 @@
     </sql>
     <select id="pageList" resultType="com.ruoyi.system.vo.TenantVO">
         SELECT id, resident_name, checkIn_time, tenant_attributes, tenant_type, phone, id_card, email,
-        bank_number, mail_address, create_time, disabled,account,
+        bank_number, mail_address, create_time, disabled,account
         FROM t_tenant
         <where>
             <if test="query.residentName != null and query.residentName != ''">

--
Gitblit v1.7.1