Commit a9e4b9d3 authored by 吴琼's avatar 吴琼

新增数据库

parent cf9f118e
package cn.quantgroup.customer.config.data;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Primary;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.Database;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import java.util.Properties;
@Configuration
@EnableJpaRepositories(basePackages = "cn.quantgroup.customer.repo.xyqb")
@EnableTransactionManagement
public class DbCashConfig {
@Value("${data.mysql.cash.jdbc-url}")
private String jdbcUrl;
@Value("${data.mysql.cash.password}")
private String password;
@Value("${data.mysql.cash.user}")
private String user;
@Value("${data.mysql.cash.max-pool-size}")
private Integer maxPoolSize;
@Bean
@DependsOn(value = "dataSource")
public EntityManagerFactory entityManagerFactory(DataSource dataSource) {
LocalContainerEntityManagerFactoryBean entityManager = new LocalContainerEntityManagerFactoryBean();
entityManager.setDataSource(dataSource);
entityManager.setPackagesToScan("cn.quantgroup.customer");
entityManager.setPersistenceUnitName("dataSource");
Properties properties = new Properties();
properties.put("hibernate.jdbc.batch_size", 30);
properties.put("hibernate.order_inserts", true);
properties.put("hibernate.order_updates", true);
entityManager.setJpaProperties(properties);
entityManager.setJpaVendorAdapter(jpaVendorAdapter());
entityManager.afterPropertiesSet();
return entityManager.getObject();
}
@Bean
@Primary
public DataSource dataSource() {
HikariConfig config = new HikariConfig();
config.setJdbcUrl(jdbcUrl);
config.setPassword(password);
config.setUsername(user);
config.setMaximumPoolSize(maxPoolSize);
config.setMinimumIdle(20);
config.addDataSourceProperty("cachePrepStmts", "true");
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
return new HikariDataSource(config);
}
private JpaVendorAdapter jpaVendorAdapter() {
HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
hibernateJpaVendorAdapter.setShowSql(false);
hibernateJpaVendorAdapter.setGenerateDdl(false);
hibernateJpaVendorAdapter.setDatabase(Database.MYSQL);
return hibernateJpaVendorAdapter;
}
@Bean
public PlatformTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(entityManagerFactory);
return transactionManager;
}
}
package cn.quantgroup.customer.model.xyqbuser; package cn.quantgroup.customer.model.xyqbuser;
import cn.quantgroup.customer.repo.IXyqbLoanApplicationManifestHistoryRepository; import cn.quantgroup.customer.repo.xyqb.IXyqbLoanApplicationManifestHistoryRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
......
package cn.quantgroup.customer.model.xyqbuser; package cn.quantgroup.customer.model.xyqbuser;
import cn.quantgroup.customer.repo.IXyqbLoanApplicationHistoryRepository; import cn.quantgroup.customer.repo.xyqb.IXyqbLoanApplicationHistoryRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
......
package cn.quantgroup.customer.model.xyqbuser; package cn.quantgroup.customer.model.xyqbuser;
import cn.quantgroup.customer.repo.IXyqbRepaymentRepository; import cn.quantgroup.customer.repo.xyqb.IXyqbRepaymentRepository;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
......
package cn.quantgroup.customer.repo; package cn.quantgroup.customer.repo.xyqb;
import cn.quantgroup.customer.model.xyqbuser.FundingCorpEntity; import cn.quantgroup.customer.model.xyqbuser.FundingCorpEntity;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Modifying;
......
package cn.quantgroup.customer.repo; package cn.quantgroup.customer.repo.xyqb;
import cn.quantgroup.customer.model.xyqbuser.BusinessType; import cn.quantgroup.customer.model.xyqbuser.BusinessType;
import cn.quantgroup.customer.model.xyqbuser.LoanProgress; import cn.quantgroup.customer.model.xyqbuser.LoanProgress;
......
package cn.quantgroup.customer.repo; package cn.quantgroup.customer.repo.xyqb;
import cn.quantgroup.customer.model.xyqbuser.XyqbLoanApplicationManifestHistory; import cn.quantgroup.customer.model.xyqbuser.XyqbLoanApplicationManifestHistory;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
......
package cn.quantgroup.customer.repo; package cn.quantgroup.customer.repo.xyqb;
import cn.quantgroup.customer.model.xyqbuser.XyqbRepaymentPlan; import cn.quantgroup.customer.model.xyqbuser.XyqbRepaymentPlan;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
......
...@@ -9,10 +9,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -9,10 +9,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.quantgroup.customer.service.IUserService;
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/userCash") @RequestMapping("/user")
public class UserCashRest { public class UserCashRest {
private final IUserService userService; private final IUserService userService;
...@@ -25,7 +25,7 @@ public class UserCashRest { ...@@ -25,7 +25,7 @@ public class UserCashRest {
* @param combinationParam * @param combinationParam
* @return * @return
*/ */
@GetMapping(value = "/info") @GetMapping(value = "/cashInfo")
public JsonResult findUserCombination(UserCombinationParam combinationParam) { public JsonResult findUserCombination(UserCombinationParam combinationParam) {
return userService.findUserCashCombination(combinationParam); return userService.findUserCashCombination(combinationParam);
} }
......
...@@ -2,7 +2,7 @@ package cn.quantgroup.customer.service.impl; ...@@ -2,7 +2,7 @@ package cn.quantgroup.customer.service.impl;
import cn.quantgroup.customer.model.order.*; import cn.quantgroup.customer.model.order.*;
import cn.quantgroup.customer.model.xyqbuser.*; import cn.quantgroup.customer.model.xyqbuser.*;
import cn.quantgroup.customer.repo.IFundingCorpRepository; import cn.quantgroup.customer.repo.xyqb.IFundingCorpRepository;
import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery; import cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery;
import cn.quantgroup.customer.rest.vo.JsonResult; import cn.quantgroup.customer.rest.vo.JsonResult;
import cn.quantgroup.customer.service.IFileService; import cn.quantgroup.customer.service.IFileService;
......
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