zjh
2023-11-20 9cbc9025db84bb67ea8e91b99ec0847edbeec36b
zjh 2023/11/20--2
4个文件已修改
68 ■■■■■ 已修改文件
ltkj-admin/src/main/java/com/ltkj/web/controller/api/TableController.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-admin/src/main/java/com/ltkj/web/controller/mall/MallAftersaleController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-framework/src/main/java/com/ltkj/framework/config/DruidConfig.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-hosp/src/main/resources/mapper/mall/MallAftersaleMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 = "数据库ip")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();
            // 这里是测试写法,具体的value可以通过请求参数传递过来
            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();
    }
}
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) {
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();
            // 这里是测试写法,具体的value可以通过请求参数传递过来
            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);
    }
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>