Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
shop
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
shop
Commits
15c4ac91
Commit
15c4ac91
authored
Oct 15, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
93faac0e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
34 deletions
+43
-34
ShopApplication.java
src/main/java/com/egolm/shop/ShopApplication.java
+2
-0
DataSourceConfig.java
src/main/java/com/egolm/shop/config/DataSourceConfig.java
+21
-1
GoodsServiceImpl.java
...in/java/com/egolm/shop/service/impl/GoodsServiceImpl.java
+7
-3
application-dev.properties
src/main/resources/application-dev.properties
+1
-1
application-pro.properties
src/main/resources/application-pro.properties
+5
-1
application-test.properties
src/main/resources/application-test.properties
+0
-28
application.properties
src/main/resources/application.properties
+7
-0
No files found.
src/main/java/com/egolm/shop/ShopApplication.java
View file @
15c4ac91
...
...
@@ -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
...
...
src/main/java/com/egolm/shop/config/DataSourceConfig.java
View file @
15c4ac91
...
...
@@ -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
src/main/java/com/egolm/shop/service/impl/GoodsServiceImpl.java
View file @
15c4ac91
...
...
@@ -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
;
...
...
src/main/resources/application-dev.properties
View file @
15c4ac91
logging.level.com.egolm
=
debug
\ No newline at end of file
logging.level.com.egolm
=
debug
src/main/resources/application-pro.properties
View file @
15c4ac91
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
src/main/resources/application-test.properties
View file @
15c4ac91
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
src/main/resources/application.properties
View file @
15c4ac91
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment