From 9cbc9025db84bb67ea8e91b99ec0847edbeec36b Mon Sep 17 00:00:00 2001
From: zjh <1084500556@qq.com>
Date: 星期一, 20 十一月 2023 18:10:54 +0800
Subject: [PATCH] zjh 2023/11/20--2

---
 ltkj-hosp/src/main/resources/mapper/mall/MallAftersaleMapper.xml                   |    2 
 ltkj-admin/src/main/java/com/ltkj/web/controller/mall/MallAftersaleController.java |    8 ++++
 ltkj-admin/src/main/java/com/ltkj/web/controller/api/TableController.java          |   33 ++++++++++++++++
 ltkj-framework/src/main/java/com/ltkj/framework/config/DruidConfig.java            |   25 ++++++++++++
 4 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/api/TableController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/api/TableController.java
index 132658a..b333faa 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/api/TableController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/api/TableController.java
@@ -1,19 +1,27 @@
 package com.ltkj.web.controller.api;
 
+import com.alibaba.druid.pool.DruidDataSource;
+import com.ltkj.common.annotation.Anonymous;
 import com.ltkj.common.core.domain.AjaxResult;
+import com.ltkj.common.utils.spring.SpringUtils;
 import com.ltkj.web.config.wordUtil.ITableService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
+
+import java.sql.SQLException;
+import java.util.Properties;
 
 @Slf4j
 @RestController
 @RequestMapping("/api")
-//@Api(tags = "AAAAAAAAAAAAAAA瀵煎嚭鏁版嵁搴�")
+@Api(tags = "AAAAAAAAAAAAA  鏁版嵁搴撴搷浣滄帴鍙�")
 public class TableController {
 
     @Autowired
@@ -28,4 +36,27 @@
             return AjaxResult.error(e.getMessage());
         }
     }
+
+    @GetMapping("/updateDruidProperty")
+    @ApiOperation(value ="鍒囨崲鏁版嵁搴�")
+    @Anonymous
+    public AjaxResult updateProperty(@RequestParam @ApiParam(value = "鏁版嵁搴搃p")String ip,
+                                     @RequestParam @ApiParam(value = "鏁版嵁搴撶鍙�")String prot,
+                                     @RequestParam @ApiParam(value = "鏁版嵁搴撳悕")String name,
+                                     @RequestParam @ApiParam(value = "鏁版嵁搴撶敤鎴峰悕")String userName,
+                                     @RequestParam @ApiParam(value = "鏁版嵁搴撳瘑鐮�")String passWored){
+        DruidDataSource dataSource = SpringUtils.getBean("masterDataSource");
+        try {
+            Properties properties = new Properties();
+            // 杩欓噷鏄祴璇曞啓娉曪紝鍏蜂綋鐨剉alue鍙互閫氳繃璇锋眰鍙傛暟浼犻�掕繃鏉�
+            properties.setProperty("druid.url","jdbc:mysql://"+ip+":"+prot+"/"+name+"?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8");
+            properties.setProperty("druid.username",userName);
+            properties.setProperty("druid.password",passWored);
+            dataSource.restart(properties);
+        } catch (SQLException throwables) {
+            throwables.printStackTrace();
+        }
+        return AjaxResult.success();
+    }
+
 }
diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/mall/MallAftersaleController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/mall/MallAftersaleController.java
index 0a7f26a..23d0e98 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/mall/MallAftersaleController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/mall/MallAftersaleController.java
@@ -7,6 +7,8 @@
 import javax.servlet.http.HttpServletResponse;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
 import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
@@ -77,6 +79,12 @@
     @ApiOperation(value = "鏌ヨ鍞悗鍒楄〃")
     public TableDataInfo list(MallAftersale mallAftersale) {
         startPage();
+        if(null !=mallAftersale.getEndTime()){
+            String endTime = mallAftersale.getEndTime();
+            DateTime dateTime = DateUtil.endOfDay(DateUtil.parse(endTime));
+            String format = DateUtil.format(dateTime, "yyyy-MM-dd HH:mm:ss");
+            mallAftersale.setEndTime(format);
+        }
         List<MallAftersale> list = mallAftersaleService.selectMallAftersaleList(mallAftersale);
         if(null !=list && list.size()>0){
             for (MallAftersale aftersale : list) {
diff --git a/ltkj-framework/src/main/java/com/ltkj/framework/config/DruidConfig.java b/ltkj-framework/src/main/java/com/ltkj/framework/config/DruidConfig.java
index c3977e8..1742f44 100644
--- a/ltkj-framework/src/main/java/com/ltkj/framework/config/DruidConfig.java
+++ b/ltkj-framework/src/main/java/com/ltkj/framework/config/DruidConfig.java
@@ -1,8 +1,12 @@
 package com.ltkj.framework.config;
 
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Properties;
+import javax.annotation.Resource;
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.ServletException;
@@ -12,6 +16,8 @@
 
 import com.ltkj.framework.config.properties.DruidProperties;
 import com.ltkj.framework.datasource.DynamicDataSource;
+import com.ltkj.system.service.ISysConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.web.servlet.FilterRegistrationBean;
@@ -32,10 +38,27 @@
  */
 @Configuration
 public class DruidConfig {
+
     @Bean
-    @ConfigurationProperties("spring.datasource.druid.master")
+//    @ConfigurationProperties("spring.datasource.druid.master")
     public DataSource masterDataSource(DruidProperties druidProperties) {
         DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
+        Properties props = new Properties();
+        try {
+            // 浠庢枃浠朵腑璇诲彇閰嶇疆淇℃伅
+            FileInputStream fis = new FileInputStream("D:\\ltkjprojectconf\\config.properties");
+            props.load(fis);
+            fis.close();
+            // 鑾峰彇灞炴�у�煎苟璧嬪��
+            Properties properties = new Properties();
+            // 杩欓噷鏄祴璇曞啓娉曪紝鍏蜂綋鐨剉alue鍙互閫氳繃璇锋眰鍙傛暟浼犻�掕繃鏉�
+            properties.setProperty("druid.url",props.getProperty("url"));
+            properties.setProperty("druid.username",props.getProperty("username"));
+            properties.setProperty("druid.password",props.getProperty("password"));
+            dataSource.restart(properties);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
         return druidProperties.dataSource(dataSource);
     }
 
diff --git a/ltkj-hosp/src/main/resources/mapper/mall/MallAftersaleMapper.xml b/ltkj-hosp/src/main/resources/mapper/mall/MallAftersaleMapper.xml
index 8b5293f..2dc8f5e 100644
--- a/ltkj-hosp/src/main/resources/mapper/mall/MallAftersaleMapper.xml
+++ b/ltkj-hosp/src/main/resources/mapper/mall/MallAftersaleMapper.xml
@@ -63,7 +63,7 @@
                 and user_id in(SELECT DISTINCT(a.user_id) FROM mall_order a WHERE a.deleted=0 AND a.mobile LIKE CONCAT(CONCAT('%',#{mobile},"%")))
             </if>
             <if test="startTime != null and endTime !=null ">
-                and handle_time between #{startTime} and #{endTime}
+                and create_time between #{startTime} and #{endTime}
             </if>
             and  deleted=0
         </where>

--
Gitblit v1.8.0