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
60eff80f
Commit
60eff80f
authored
Jun 20, 2020
by
xuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复部分父账户数据缺失的usershop信息
parent
fc8e8d2f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
10 deletions
+96
-10
AccountController.java
.../browserbackend/account/controller/AccountController.java
+11
-1
BillQueryResultDto.java
.../edgec/browserbackend/account/dto/BillQueryResultDto.java
+0
-4
ShopController.java
...gec/browserbackend/browser/controller/ShopController.java
+13
-0
ShopRepository.java
...gec/browserbackend/browser/repository/ShopRepository.java
+5
-0
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+62
-3
ShopService.java
...com/edgec/browserbackend/browser/service/ShopService.java
+5
-2
No files found.
src/main/java/com/edgec/browserbackend/account/controller/AccountController.java
View file @
60eff80f
...
@@ -162,7 +162,10 @@ public class AccountController {
...
@@ -162,7 +162,10 @@ public class AccountController {
emailService
.
sendHtmlMail
(
"sales@cloudam.io"
,
"客户联系:"
+
contactUs
.
getName
(),
sb
.
toString
());
emailService
.
sendHtmlMail
(
"sales@cloudam.io"
,
"客户联系:"
+
contactUs
.
getName
(),
sb
.
toString
());
}
}
// 消费总览
/**
* 费用明细
*/
@RequestMapping
(
path
=
"/userbilling"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/userbilling"
,
method
=
RequestMethod
.
POST
)
public
ResultDto
getUserBills0
(
Principal
principal
,
@RequestBody
UserPrePaidBillingRequestDto
userPrePaidBillingRequestDto
)
{
public
ResultDto
getUserBills0
(
Principal
principal
,
@RequestBody
UserPrePaidBillingRequestDto
userPrePaidBillingRequestDto
)
{
ResultDto
resultDto
=
new
ResultDto
();
ResultDto
resultDto
=
new
ResultDto
();
...
@@ -264,6 +267,9 @@ public class AccountController {
...
@@ -264,6 +267,9 @@ public class AccountController {
return
paymentService
.
wxCheckOrderStatus
(
tradno
,
chargeType
);
return
paymentService
.
wxCheckOrderStatus
(
tradno
,
chargeType
);
}
}
/**
* 使用 支付宝 充值 成功后回调
*/
@RequestMapping
(
path
=
"/0xalipaycallback/{tradno}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xalipaycallback/{tradno}"
,
method
=
RequestMethod
.
GET
)
public
void
alipayPayCallback
(
@PathVariable
String
tradno
)
{
public
void
alipayPayCallback
(
@PathVariable
String
tradno
)
{
paymentService
.
alipaCallback
(
tradno
);
paymentService
.
alipaCallback
(
tradno
);
...
@@ -274,6 +280,10 @@ public class AccountController {
...
@@ -274,6 +280,10 @@ public class AccountController {
return
paymentService
.
aliCheckOrderStatus
(
tradno
,
chargeType
);
return
paymentService
.
aliCheckOrderStatus
(
tradno
,
chargeType
);
}
}
/**
* 使用 支付宝 充值
*/
@RequestMapping
(
path
=
"/0xalipay/{amount}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xalipay/{amount}"
,
method
=
RequestMethod
.
GET
)
public
void
alipayPutOrder
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@PathVariable
int
amount
)
throws
Exception
{
public
void
alipayPutOrder
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@PathVariable
int
amount
)
throws
Exception
{
...
...
src/main/java/com/edgec/browserbackend/account/dto/BillQueryResultDto.java
View file @
60eff80f
package
com
.
edgec
.
browserbackend
.
account
.
dto
;
package
com
.
edgec
.
browserbackend
.
account
.
dto
;
import
com.edgec.browserbackend.account.domain.Promotion
;
import
com.edgec.browserbackend.account.domain.Promotion
;
import
com.edgec.browserbackend.account.domain.UserPrePaidBilling
;
import
org.springframework.data.domain.Page
;
import
java.util.List
;
public
class
BillQueryResultDto
{
public
class
BillQueryResultDto
{
double
parentExpense
;
double
parentExpense
;
...
...
src/main/java/com/edgec/browserbackend/browser/controller/ShopController.java
View file @
60eff80f
...
@@ -204,6 +204,19 @@ public class ShopController {
...
@@ -204,6 +204,19 @@ public class ShopController {
return
resultDto
;
return
resultDto
;
}
}
@GetMapping
(
value
=
"/deal_dirtydata"
)
public
ResultDto
dealDirtydata
()
{
Integer
num
=
shopService
.
dealDirtyData
();
ResultDto
resultDto
=
new
ResultDto
();
resultDto
.
setStatus
(
0
);
resultDto
.
setData
(
"修复脏数据"
+
num
+
"条"
);
return
resultDto
;
}
private
void
dealClientRequestException
(
ResultDto
resultDto
,
ClientRequestException
e
)
{
private
void
dealClientRequestException
(
ResultDto
resultDto
,
ClientRequestException
e
)
{
resultDto
.
setStatus
(-
1
);
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
...
...
src/main/java/com/edgec/browserbackend/browser/repository/ShopRepository.java
View file @
60eff80f
...
@@ -9,7 +9,12 @@ import java.util.List;
...
@@ -9,7 +9,12 @@ import java.util.List;
public
interface
ShopRepository
extends
MongoRepository
<
Shop
,
String
>
{
public
interface
ShopRepository
extends
MongoRepository
<
Shop
,
String
>
{
Page
<
Shop
>
findByShopIdInAndShopAccountLikeOrderByCreateTimeDesc
(
List
<
String
>
shopIds
,
String
shopAccount
,
Pageable
pageable
);
Page
<
Shop
>
findByShopIdInAndShopAccountLikeOrderByCreateTimeDesc
(
List
<
String
>
shopIds
,
String
shopAccount
,
Pageable
pageable
);
Page
<
Shop
>
findByShopIdInAndShopNameLikeOrderByCreateTimeDesc
(
List
<
String
>
shopIds
,
String
shopName
,
Pageable
pageable
);
Page
<
Shop
>
findByShopIdInAndShopNameLikeOrderByCreateTimeDesc
(
List
<
String
>
shopIds
,
String
shopName
,
Pageable
pageable
);
Page
<
Shop
>
findByShopIdInOrderByCreateTimeDesc
(
List
<
String
>
shopIds
,
Pageable
pageable
);
Page
<
Shop
>
findByShopIdInOrderByCreateTimeDesc
(
List
<
String
>
shopIds
,
Pageable
pageable
);
List
<
Shop
>
findByShopIdIn
(
List
<
String
>
shopIds
);
List
<
Shop
>
findByShopIdIn
(
List
<
String
>
shopIds
);
List
<
Shop
>
findByOwnerIn
(
List
<
String
>
owners
);
}
}
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
60eff80f
...
@@ -26,9 +26,7 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -26,9 +26,7 @@ import org.springframework.web.multipart.MultipartFile;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.time.Instant
;
import
java.time.Instant
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
...
@@ -546,6 +544,67 @@ public class ShopServiceImpl implements ShopService {
...
@@ -546,6 +544,67 @@ public class ShopServiceImpl implements ShopService {
return
shopUsers
;
return
shopUsers
;
}
}
@Override
public
Integer
dealDirtyData
()
{
List
<
Account
>
all
=
accountRepository
.
findAll
();
List
<
Account
>
parents
=
all
.
stream
().
filter
(
x
->
StringUtils
.
isEmpty
(
x
.
getParent
())).
collect
(
Collectors
.
toList
());
// 移除 父账户,剩下的都是子账户了
all
.
removeAll
(
parents
);
// 父账户, 子账户列表
Map
<
Account
,
List
<
Account
>>
map
=
new
HashMap
<>();
for
(
Account
account
:
parents
)
{
List
<
Account
>
list
=
new
ArrayList
<>();
for
(
Account
child
:
all
)
{
if
(
child
.
getParent
().
equals
(
account
.
getName
()))
{
list
.
add
(
child
);
}
}
if
(
list
.
size
()
!=
0
)
{
map
.
put
(
account
,
list
);
}
}
Integer
result
=
0
;
Iterator
<
Map
.
Entry
<
Account
,
List
<
Account
>>>
entries
=
map
.
entrySet
().
iterator
();
while
(
entries
.
hasNext
())
{
Map
.
Entry
<
Account
,
List
<
Account
>>
entry
=
entries
.
next
();
List
<
Account
>
children
=
entry
.
getValue
();
// 查找子类所拥有的店铺
List
<
Shop
>
childrenShop
=
shopRepository
.
findByOwnerIn
(
children
.
stream
().
map
(
Account:
:
getName
).
collect
(
Collectors
.
toList
()));
if
(
childrenShop
.
size
()
==
0
)
{
continue
;
}
List
<
String
>
ids
=
childrenShop
.
stream
().
map
(
x
->
x
.
getShopId
()).
collect
(
Collectors
.
toList
());
// 查出来 父账户已有的 usershop信息
List
<
UserShop
>
parentUserShops
=
userShopRepository
.
findByUsernameAndShopIdIn
(
entry
.
getKey
().
getName
(),
ids
);
List
<
String
>
parentShopIds
=
parentUserShops
.
stream
().
map
(
x
->
x
.
getShopId
()).
collect
(
Collectors
.
toList
());
// 剩下的就是 父账户的 usershop 缺失的信息
ids
.
removeAll
(
parentShopIds
);
// 构建父账户缺失的 usershop 信息并保存
List
<
UserShop
>
userShops
=
new
ArrayList
<>();
for
(
String
id
:
ids
)
{
UserShop
userShop
=
new
UserShop
();
userShop
.
setShopId
(
id
);
userShop
.
setUsername
(
entry
.
getKey
().
getName
());
userShop
.
setGroupId
(
"-1"
);
userShops
.
add
(
userShop
);
}
if
(
userShops
.
size
()
!=
0
)
{
// 将父账户缺失的 usershop 信息补充完整
List
<
UserShop
>
userShops1
=
userShopRepository
.
saveAll
(
userShops
);
result
+=
userShops1
.
size
();
}
}
return
result
;
}
private
String
getShopId
(
String
username
,
ShopResultDto
shopResultDto
)
{
private
String
getShopId
(
String
username
,
ShopResultDto
shopResultDto
)
{
Shop
shop
=
new
Shop
();
Shop
shop
=
new
Shop
();
...
...
src/main/java/com/edgec/browserbackend/browser/service/ShopService.java
View file @
60eff80f
package
com
.
edgec
.
browserbackend
.
browser
.
service
;
package
com
.
edgec
.
browserbackend
.
browser
.
service
;
import
com.edgec.browserbackend.browser.domain.Shop
;
import
com.edgec.browserbackend.browser.domain.ShopSummary
;
import
com.edgec.browserbackend.browser.domain.ShopSummary
;
import
com.edgec.browserbackend.browser.dto.*
;
import
com.edgec.browserbackend.browser.dto.ShopFilterDto
;
import
com.edgec.browserbackend.browser.dto.ShopPageResultDto
;
import
com.edgec.browserbackend.browser.dto.ShopResultDto
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -31,4 +32,6 @@ public interface ShopService {
...
@@ -31,4 +32,6 @@ public interface ShopService {
List
<
String
>
getShopUsers
(
String
username
,
String
shopId
);
List
<
String
>
getShopUsers
(
String
username
,
String
shopId
);
List
<
String
>
getBatchShopUsers
(
String
username
,
List
<
String
>
shopIds
);
List
<
String
>
getBatchShopUsers
(
String
username
,
List
<
String
>
shopIds
);
Integer
dealDirtyData
();
}
}
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