Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
browser-backend
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
Administrator
browser-backend
Commits
b0e8a610
Commit
b0e8a610
authored
Mar 15, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支付返送保护
parent
01ab2121
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
1 deletion
+100
-1
pom.xml
pom.xml
+11
-0
PaymentServiceImpl.java
...owserbackend/account/service/impl/PaymentServiceImpl.java
+12
-0
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+5
-1
FileUtil.java
.../java/com/edgec/browserbackend/common/utils/FileUtil.java
+66
-0
application.yml
src/main/resources/application.yml
+6
-0
batchAdd.xlsx
src/main/resources/batchAdd.xlsx
+0
-0
No files found.
pom.xml
View file @
b0e8a610
...
@@ -157,6 +157,17 @@
...
@@ -157,6 +157,17 @@
<artifactId>
shedlock-spring
</artifactId>
<artifactId>
shedlock-spring
</artifactId>
<version>
2.1.0
</version>
<version>
2.1.0
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
<version>
3.16
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
3.16
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/com/edgec/browserbackend/account/service/impl/PaymentServiceImpl.java
View file @
b0e8a610
...
@@ -271,6 +271,18 @@ public class PaymentServiceImpl implements PaymentService {
...
@@ -271,6 +271,18 @@ public class PaymentServiceImpl implements PaymentService {
bill
.
setYear
(
year
);
bill
.
setYear
(
year
);
bill
.
setMonth
(
monthValue
);
bill
.
setMonth
(
monthValue
);
if
(
more
!=
20
||
more
!=
45
||
more
!=
125
||
more
!=
300
)
more
=
0
;
if
((
more
==
20
&&
byTradeNo
.
getAmount
()
!=
100
)
||
(
more
!=
20
&&
byTradeNo
.
getAmount
()
==
100
))
more
=
0
;
if
((
more
==
45
&&
byTradeNo
.
getAmount
()
!=
200
)
||
(
more
!=
45
&&
byTradeNo
.
getAmount
()
==
200
))
more
=
0
;
if
((
more
==
125
&&
byTradeNo
.
getAmount
()
!=
500
)
||
(
more
!=
125
&&
byTradeNo
.
getAmount
()
==
500
))
more
=
0
;
if
((
more
==
300
&&
byTradeNo
.
getAmount
()
!=
1000
)
||
(
more
!=
300
&&
byTradeNo
.
getAmount
()
==
1000
))
more
=
0
;
balance
.
setBalanced
(
balance
.
getBalanced
()
+
byTradeNo
.
getAmount
()
+
more
);
balance
.
setBalanced
(
balance
.
getBalanced
()
+
byTradeNo
.
getAmount
()
+
more
);
userBalanceRepository
.
save
(
balance
);
userBalanceRepository
.
save
(
balance
);
}
}
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
b0e8a610
...
@@ -16,7 +16,9 @@ import com.edgec.browserbackend.browser.repository.ShopRepository;
...
@@ -16,7 +16,9 @@ import com.edgec.browserbackend.browser.repository.ShopRepository;
import
com.edgec.browserbackend.browser.repository.UserShopRepository
;
import
com.edgec.browserbackend.browser.repository.UserShopRepository
;
import
com.edgec.browserbackend.browser.service.ShopService
;
import
com.edgec.browserbackend.browser.service.ShopService
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
com.edgec.browserbackend.common.utils.FileUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -97,6 +99,8 @@ public class ShopServiceImpl implements ShopService {
...
@@ -97,6 +99,8 @@ public class ShopServiceImpl implements ShopService {
@Override
@Override
public
List
<
String
>
addShops
(
String
username
,
List
<
Shop
>
shops
)
{
public
List
<
String
>
addShops
(
String
username
,
List
<
Shop
>
shops
)
{
Workbook
workbook
=
FileUtil
.
readExcel
(
""
);
return
null
;
return
null
;
}
}
...
@@ -234,7 +238,7 @@ public class ShopServiceImpl implements ShopService {
...
@@ -234,7 +238,7 @@ public class ShopServiceImpl implements ShopService {
}
}
UserShop
userShop
=
userShopRepository
.
findByUsernameAndShopId
(
username
,
shopId
);
UserShop
userShop
=
userShopRepository
.
findByUsernameAndShopId
(
username
,
shopId
);
Group
group
=
groupRepository
.
findById
(
groupId
).
orElse
(
null
);
Group
group
=
groupRepository
.
findById
(
groupId
).
orElse
(
null
);
if
(
account
.
getPermission
()
<
4
||
userShop
==
null
||
!
group
.
getOwner
().
equals
(
username
))
{
if
(
userShop
==
null
||
!
group
.
getOwner
().
equals
(
username
))
{
throw
new
ClientRequestException
(
AccountErrorCode
.
NOPERMISSION
);
throw
new
ClientRequestException
(
AccountErrorCode
.
NOPERMISSION
);
}
}
Shop
shop
=
shopRepository
.
findById
(
shopId
).
orElse
(
null
);
Shop
shop
=
shopRepository
.
findById
(
shopId
).
orElse
(
null
);
...
...
src/main/java/com/edgec/browserbackend/common/utils/FileUtil.java
View file @
b0e8a610
package
com
.
edgec
.
browserbackend
.
common
.
utils
;
package
com
.
edgec
.
browserbackend
.
common
.
utils
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.DateUtil
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -61,4 +66,65 @@ public class FileUtil {
...
@@ -61,4 +66,65 @@ public class FileUtil {
log
.
debug
(
"["
+
file
.
getName
()
+
"]文件写入成功"
);
log
.
debug
(
"["
+
file
.
getName
()
+
"]文件写入成功"
);
return
true
;
return
true
;
}
}
//读取excel
public
static
Workbook
readExcel
(
String
filePath
){
Workbook
wb
=
null
;
if
(
filePath
==
null
){
return
null
;
}
String
extString
=
filePath
.
substring
(
filePath
.
lastIndexOf
(
"."
));
InputStream
is
=
null
;
try
{
is
=
new
FileInputStream
(
filePath
);
if
(
".xls"
.
equals
(
extString
)){
return
wb
=
new
HSSFWorkbook
(
is
);
}
else
if
(
".xlsx"
.
equals
(
extString
)){
return
wb
=
new
XSSFWorkbook
(
is
);
}
else
{
return
wb
=
null
;
}
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
wb
;
}
public
static
Object
getCellFormatValue
(
Cell
cell
){
Object
cellValue
=
null
;
if
(
cell
!=
null
){
//判断cell类型
switch
(
cell
.
getCellType
()){
case
Cell
.
CELL_TYPE_NUMERIC
:{
cellValue
=
String
.
valueOf
(
cell
.
getNumericCellValue
());
break
;
}
case
Cell
.
CELL_TYPE_FORMULA
:{
//判断cell是否为日期格式
if
(
DateUtil
.
isCellDateFormatted
(
cell
)){
//转换为日期格式YYYY-mm-dd
cellValue
=
cell
.
getDateCellValue
();
}
else
{
//数字
cellValue
=
String
.
valueOf
(
cell
.
getNumericCellValue
());
}
break
;
}
case
Cell
.
CELL_TYPE_STRING
:{
cellValue
=
cell
.
getRichStringCellValue
().
getString
();
break
;
}
default
:
cellValue
=
""
;
}
}
else
{
cellValue
=
""
;
}
return
cellValue
;
}
}
}
src/main/resources/application.yml
View file @
b0e8a610
...
@@ -25,6 +25,12 @@ spring:
...
@@ -25,6 +25,12 @@ spring:
enable
:
true
enable
:
true
resources
:
resources
:
static-locations
:
classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
static-locations
:
classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
http
:
servlet
:
multipart
:
max-file-size
:
50MB
max-request-size
:
50MB
security
:
security
:
...
...
src/main/resources/batchAdd.xlsx
0 → 100644
View file @
b0e8a610
File added
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