Commit aee5a60c by wuchengwu

讯飞声纹下载

parent 2b0617f0
......@@ -170,4 +170,12 @@ public class DataSourceConfig {
public DataSource tenthDataSource(){
return tenthDbProperties().initializeDataSourceBuilder().build();
}
@Bean(name="xfswdb")
@Qualifier("xfswdb")
@ConfigurationProperties(prefix = "spring.datasource.xfswdb")
public DataSource xfswdbDataSource(){
return tenthDbProperties().initializeDataSourceBuilder().build();
}
}
package com.founder.config;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import javax.sql.DataSource;
/**
* @author www
* @DateTime: 2020/6/9 3:14 下午
*/
@Configuration
@MapperScan(basePackages = {"com.founder.xfswDao"},sqlSessionFactoryRef = "xfswdbSqlSessionFactory")
public class MybatisXfswDbConfig {
static final String MAPPER_LOCATION = "classpath:mapper/*.xml";
@Autowired
@Qualifier("xfswdb")
private DataSource xfswdb;
@Bean(name="xfswdbSqlSessionFactory")
public SqlSessionFactory xzxtcxSqlSessionFactory() throws Exception {
SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
factoryBean.setDataSource(xfswdb);
factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MAPPER_LOCATION));
return factoryBean.getObject();
}
@Bean(name="xfswdbSqlSessionTemplate")
public SqlSessionTemplate xzxtcxSqlSessionTemplate() throws Exception {
return new SqlSessionTemplate(xzxtcxSqlSessionFactory());
}
}
......@@ -3,7 +3,6 @@ package com.founder.controller;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.founder.model.*;
import com.founder.module.redis.service.IDicItemService;
import com.founder.ryswtz.controller.CommonController;
import com.founder.service.AutoTbXwRycjService;
import com.founder.service.IParamService;
......@@ -11,8 +10,7 @@ import com.founder.service.ISwCjService;
import com.founder.service.XzxtcxService;
import com.founder.utils.EasyuiPage;
import com.founder.utils.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
......@@ -44,8 +42,8 @@ import static com.founder.model.Constant.USER_LEVEL_CX;
* @date 2019-3-19
*/
@Controller
@Slf4j
public class SwCjController {
private static Log log = LogFactory.getLog(SwCjController.class);
@Autowired
private ISwCjService swCjService;
/**
......@@ -694,7 +692,7 @@ private static Log log = LogFactory.getLog(SwCjController.class);
}
/**
* 保存声纹采集数据
* 保存声纹采集数据---讯飞
* @param tbStSw
* @return
*/
......@@ -805,7 +803,15 @@ private static Log log = LogFactory.getLog(SwCjController.class);
@RequestMapping(value = "/downloadfile")
@ResponseBody
public String findfile(HttpServletRequest request,HttpServletResponse response,@RequestParam("filename") String filename,@RequestParam("rybh") String rybh) throws IOException {
public String findfile(HttpServletRequest request,HttpServletResponse response,@RequestParam("filename") String filename,@RequestParam("rybh") String rybh,String sbcs) {
if ("1".equals(sbcs)){
String xfFile = swCjService.querySwByRybh(rybh);
if (StringUtils.isEmpty(xfFile)){
return null;
}
log.info("该人员编号:{},查询讯飞下载路径为:{}",rybh,xfFile);
return xfFile;
}
ServletOutputStream out = null;
FileInputStream ips = null;
......
......@@ -38,4 +38,11 @@ public interface ISwCjService {
* @return
*/
boolean deleteSwxx(String xxzjbh);
/**
* 根据人员编号获取讯飞下载链接
* @param rybh
* @return
*/
String querySwByRybh(String rybh);
}
......@@ -3,6 +3,7 @@ package com.founder.service.impl;
import com.founder.dao.SwCjDao;
import com.founder.model.TbStSw;
import com.founder.service.ISwCjService;
import com.founder.xfswDao.XfswDao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -19,6 +20,8 @@ public class SwCjServiceImpl implements ISwCjService {
private static Log log = LogFactory.getLog(SwCjServiceImpl.class);
@Autowired
private SwCjDao swCjDao;
@Autowired
private XfswDao xfswDao;
@Override
public Boolean saveSwSjXx(TbStSw tbStSw,String ssdw) {
Boolean b = false;
......@@ -60,4 +63,15 @@ private static Log log = LogFactory.getLog(SwCjServiceImpl.class);
}
return b;
}
/**
* 根据人员编号获取讯飞下载链接
*
* @param rybh
* @return
*/
@Override
public String querySwByRybh(String rybh) {
return xfswDao.querySwByRybh(rybh);
}
}
package com.founder.xfswDao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
/**
* @Author: wcw
* @Date: 2022/11/4 14:48
*/
@Component
@Mapper
public interface XfswDao {
String querySwByRybh(@Param("rybh") String rybh);
}
......@@ -89,6 +89,14 @@ spring.datasource.hnxzxtdb.password=ENC(h9d/u+bhR4tkrWih6C/7cQ==)
spring.datasource.hnxzxtdb.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.hnxzxtdb.type: com.alibaba.druid.pool.DruidDataSource
#声纹数据库下载
spring.datasource.xfswdb.url: jdbc:mysql://65.26.13.247:3365/vlib3?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
spring.datasource.xfswdb.username: xtsend
spring.datasource.xfswdb.password: xtsend
spring.datasource.xfswdb.driver-class-name: com.mysql.cj.jdbc.Driver
spring.datasource.xfswdb.type: com.alibaba.druid.pool.DruidDataSource
mapper.mappers= com.founder.util.MyMapper
mapper.not-empty= false
mapper.identity= oracle
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.founder.xfswDao.XfswDao">
<!-- 根据人员编号查询讯飞声纹下载信息 -->
<select id="querySwByRybh" parameterType="java.lang.String" resultType="java.lang.String">
select 下载地址 from xt_send where 人员编号 = #{rybh,jdbcType=VARCHAR} rownum = 1
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment