Commit 15c4ac91 authored by Quxl's avatar Quxl

x

parent 93faac0e
......@@ -4,11 +4,13 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableAsync
@EnableScheduling
@EnableCaching
@EnableSwagger2
......
......@@ -2,11 +2,11 @@ package com.egolm.shop.config;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
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.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
......@@ -15,6 +15,7 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.wall.WallConfig;
import com.alibaba.druid.wall.WallFilter;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.dialect.MySqlDialect;
import com.egolm.common.jdbc.dialect.SqlServerDialect;
@Configuration
......@@ -58,4 +59,23 @@ public class DataSourceConfig {
return wallConfig;
}
@Bean
@Qualifier("log")
@ConfigurationProperties(prefix = "log.datasource")
public DataSource getLogDataSource() {
return DataSourceBuilder.create().type(DruidDataSource.class).build();
}
@Bean
@Qualifier("log")
public JdbcTemplate getLogJdbcTemplate(@Qualifier("log")DataSource dataSource) {
JdbcTemplate jdbcTemplate = new JdbcTemplate();
jdbcTemplate.setDataSource(dataSource);
jdbcTemplate.setDialect(new MySqlDialect());
jdbcTemplate.setSql_level(3);
return jdbcTemplate;
}
}
\ No newline at end of file
......@@ -22,6 +22,7 @@ import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.common.jdbc.dialect.SqlServerDialect;
import com.egolm.shop.config.XException;
import com.egolm.shop.pojo.TCustomer;
import com.egolm.shop.pojo.TShop;
import com.egolm.shop.service.CommonService;
......@@ -169,9 +170,12 @@ public class GoodsServiceImpl implements GoodsService {
String goodsId=(String) map.get("goodsId");
String contractNo=(String) map.get("contractNo");
String sql = "select * from V_OrgGoods where sOrgNO = ? and sAgentContractNO = ? and nGoodsID = ?";
Map<String, Object> detail = jdbcTemplate.queryForMap(sql, orgNo, contractNo, goodsId);
String categoryNo = (String)detail.get("sCategoryNO");
String brandId = (String)detail.get("sBrandID");
Map<String, Object> detail = null;
try {
detail = jdbcTemplate.queryForMap(sql, orgNo, contractNo, goodsId);
} catch (EmptyResultDataAccessException e) {
throw new XException("商品已下架");
}
BigDecimal nMarketPrice = (BigDecimal)detail.get("nMarketPrice");
BigDecimal nRealSalePrice = (BigDecimal)detail.get("nRealSalePrice");
BigDecimal nProfitMargin = BigDecimal.ZERO;
......
logging.level.com.egolm=debug
\ No newline at end of file
logging.level.com.egolm=debug
logging.level.com.egolm=debug
spring.datasource.username=sa
spring.datasource.password=Asters#2019@Linkfern
spring.datasource.url=jdbc:sqlserver://172.16.0.8:55433;instanceName=SQLSERVER;DatabaseName=B2BDB;allowMultiQueries=true
logging.level.com.egolm=debug
\ No newline at end of file
server.tomcat.max-threads=1000
server.tomcat.min-spare-threads=30
server.port=30005
server.servlet.context-path=/shop
server.session.timeout=90000
server.tomcat.uri-encoding=utf-8
spring.http.multipart.maxFileSize=5MB
spring.http.multipart.maxRequestSize=5MB
spring.http.encoding.force=true
spring.http.encoding.enabled=true
spring.http.encoding.charset=utf-8
spring.datasource.username=ERP
spring.datasource.password=qiyang@2013
spring.datasource.url=jdbc:sqlserver://127.0.0.1:1433;instanceName=SQLSERVER;DatabaseName=B2BDB;allowMultiQueries=true
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.testWhileIdle=true
spring.datasource.validationQueryTimeout=5
spring.datasource.validationQuery=SELECT 1
spring.datasource.timeBetweenEvictionRunsMillis=3600000
spring.datasource.filters=stat,log4j
spring.redis.database=0
spring.redis.host=127.0.0.1
spring.redis.port=16379
spring.redis.password=
spring.redis.timeout=2000
spring.redis.pool.max-active=20
spring.redis.pool.max-wait=2000
spring.redis.pool.max-idle=5
spring.redis.pool.min-idle=0
redis.guest.key=B2B_Guest
redis.sms.code.key=B2B_Sms
\ No newline at end of file
......@@ -45,6 +45,13 @@ spring.datasource.validationQuery=SELECT 1
spring.datasource.timeBetweenEvictionRunsMillis=3600000
spring.datasource.filters=stat,log4j
log.datasource.username=root
log.datasource.password=123456
log.datasource.url=jdbc:mysql://10.10.0.111:3306/mv?useSSL=false&useUnicode=true&characterEncoding=utf8
log.datasource.driver-class-name=com.mysql.jdbc.Driver
log.datasource.testWhileIdle=true
log.datasource.validationQueryTimeout=5
log.datasource.validationQuery=SELECT 1 FROM DUAL
spring.redis.database=0
spring.redis.host=127.0.0.1
......
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