Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
stockPriceTack
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
刘长帅
stockPriceTack
Commits
9fd1f93c
Commit
9fd1f93c
authored
Jul 01, 2022
by
liucx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化更新
parent
d8e3c5e0
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
81 additions
and
14 deletions
+81
-14
AccountProductRelationService.java
...arket/service/business/AccountProductRelationService.java
+2
-0
AssetAccountProductRelationService.java
...ce/business/asset/AssetAccountProductRelationService.java
+2
-0
SmartAccountProductRelationService.java
...ce/business/smart/SmartAccountProductRelationService.java
+2
-0
AccountProductRelationServiceImpl.java
...vice/impl/business/AccountProductRelationServiceImpl.java
+5
-0
AssetAccountProductRelationServiceImpl.java
...usiness/asset/AssetAccountProductRelationServiceImpl.java
+5
-0
SmartAccountProductRelationServiceImpl.java
...usiness/smart/SmartAccountProductRelationServiceImpl.java
+5
-0
AssetStockPriceTask.java
...ech/telmarket/task/followAccount/AssetStockPriceTask.java
+18
-4
SmartStockPriceTask.java
...ech/telmarket/task/followAccount/SmartStockPriceTask.java
+22
-6
StockPriceTask.java
...zfxftech/telmarket/task/followAccount/StockPriceTask.java
+20
-4
No files found.
src/main/java/com/zfxftech/telmarket/service/business/AccountProductRelationService.java
View file @
9fd1f93c
...
...
@@ -57,4 +57,6 @@ public interface AccountProductRelationService extends IService<AccountProductRe
List
<
ProductCustomerFansDto
>
getProductUserList
(
Long
productId
);
List
<
AccountProductRelation
>
getRelationByProductIds
(
List
<
Long
>
ids
);
void
updateList
(
List
<
AccountProductRelation
>
list
);
}
src/main/java/com/zfxftech/telmarket/service/business/asset/AssetAccountProductRelationService.java
View file @
9fd1f93c
...
...
@@ -58,4 +58,6 @@ public interface AssetAccountProductRelationService extends IService<AssetAccoun
List
<
AssetAccountProductRelation
>
getRelationByProductIds
(
List
<
Long
>
ids
);
AssetMarketDetailsVO
queryAssetSendFromLog
(
QueryAssetSendFromLogBO
queryAssetSendFromLogBO
);
void
addAccountProductRelationList
(
List
<
AssetAccountProductRelation
>
assetAccountProductRelations
);
}
src/main/java/com/zfxftech/telmarket/service/business/smart/SmartAccountProductRelationService.java
View file @
9fd1f93c
...
...
@@ -52,4 +52,6 @@ public interface SmartAccountProductRelationService extends IService<SmartAccoun
Object
getMarkId
(
Long
membaserId
,
List
<
Long
>
productList
);
List
<
SmartAccountProductRelation
>
getRelationByProductIds
(
List
<
Long
>
ids
);
void
updateBatchById
(
List
<
SmartAccountProductRelation
>
productRelations
);
}
src/main/java/com/zfxftech/telmarket/service/impl/business/AccountProductRelationServiceImpl.java
View file @
9fd1f93c
...
...
@@ -263,4 +263,9 @@ public class AccountProductRelationServiceImpl extends ServiceImpl<AccountProduc
return
result
;
}
@Override
public
void
updateList
(
List
<
AccountProductRelation
>
list
)
{
updateBatchById
(
list
);
}
}
src/main/java/com/zfxftech/telmarket/service/impl/business/asset/AssetAccountProductRelationServiceImpl.java
View file @
9fd1f93c
...
...
@@ -466,6 +466,11 @@ public class AssetAccountProductRelationServiceImpl extends ServiceImpl<AssetAcc
return
null
;
}
@Override
public
void
addAccountProductRelationList
(
List
<
AssetAccountProductRelation
>
assetAccountProductRelations
)
{
updateBatchById
(
assetAccountProductRelations
);
}
@Override
public
List
<
AssetAccountProductRelation
>
getRelationByProductIds
(
List
<
Long
>
ids
)
{
List
<
Integer
>
status
=
Arrays
.
stream
(
AdminConstant
.
ProductStatusEnum
.
values
())
...
...
src/main/java/com/zfxftech/telmarket/service/impl/business/smart/SmartAccountProductRelationServiceImpl.java
View file @
9fd1f93c
...
...
@@ -262,4 +262,9 @@ public class SmartAccountProductRelationServiceImpl extends ServiceImpl<SmartAcc
return
result
;
}
@Override
public
void
updateBatchById
(
List
<
SmartAccountProductRelation
>
productRelations
)
{
updateBatchById
(
productRelations
);
}
}
src/main/java/com/zfxftech/telmarket/task/followAccount/AssetStockPriceTask.java
View file @
9fd1f93c
...
...
@@ -5,6 +5,7 @@ import com.zfxftech.telmarket.common.pojo.dao.MemberBase;
import
com.zfxftech.telmarket.common.pojo.dao.asset.AssetAccountProductRelation
;
import
com.zfxftech.telmarket.common.pojo.dao.asset.AssetStockPosition
;
import
com.zfxftech.telmarket.common.pojo.vo.asset.AssetMarketDetailsVO
;
import
com.zfxftech.telmarket.common.util.BigDecimalUtil
;
import
com.zfxftech.telmarket.common.util.DateUtil
;
import
com.zfxftech.telmarket.common.util.OptionalUtil
;
import
com.zfxftech.telmarket.service.business.UsMemberBaseService
;
...
...
@@ -77,9 +78,17 @@ public class AssetStockPriceTask implements ApplicationRunner {
List
<
AssetAccountProductRelation
>
accountProductRelationList
=
this
.
page
(
accountProductRelations
,
pageNo
.
get
(),
pageSize
);
CompletableFuture
cf
=
CompletableFuture
.
supplyAsync
(()
->
{
List
<
AssetAccountProductRelation
>
assetAccountProductRelations
=
new
ArrayList
<>();
for
(
AssetAccountProductRelation
accountProductRelation
:
accountProductRelationList
)
{
this
.
AccountProductRelationTask
(
accountProductRelation
);
AssetAccountProductRelation
assetAccountProductRelation
=
this
.
AccountProductRelationTask
(
accountProductRelation
);
if
(!
ObjectUtils
.
isEmpty
(
assetAccountProductRelation
)
&&
!
ObjectUtils
.
isEmpty
(
assetAccountProductRelation
.
getId
())){
assetAccountProductRelations
.
add
(
assetAccountProductRelation
);
}
}
accountProductRelationService
.
updateBatchById
(
assetAccountProductRelations
);
return
" "
;
},
executorServicePersonal
).
handle
((
result
,
ex
)
->
{
if
(
null
!=
ex
)
{
...
...
@@ -139,8 +148,9 @@ public class AssetStockPriceTask implements ApplicationRunner {
//资管
public
void
AccountProductRelationTask
(
AssetAccountProductRelation
accountProductRelation
)
{
public
AssetAccountProductRelation
AccountProductRelationTask
(
AssetAccountProductRelation
accountProductRelation
)
{
Date
startTime
=
new
Date
();
AssetAccountProductRelation
productRelation
=
new
AssetAccountProductRelation
();
try
{
OptionalUtil
.
checkNull
(
accountProductRelation
,
"当前用户产品关系不存在"
);
...
...
@@ -156,7 +166,9 @@ public class AssetStockPriceTask implements ApplicationRunner {
//汇总数据
AssetMarketDetailsVO
marketDetailsVO
=
stockPositionService
.
createMarketDetailsVOTask
(
stockPositions
,
funding
,
accountProductRelation
);
AssetAccountProductRelation
productRelation
=
new
AssetAccountProductRelation
();
if
(
BigDecimalUtil
.
compare
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfitRate
()),
accountProductRelation
.
getSimulatedTotalProfit
(),
0
)){
return
null
;
}
productRelation
.
setId
(
accountProductRelation
.
getId
());
//示范盈亏比例
productRelation
.
setSimulatedTotalProfit
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfitRate
()));
...
...
@@ -168,10 +180,12 @@ public class AssetStockPriceTask implements ApplicationRunner {
productRelation
.
setPositionCount
(
ObjectUtils
.
isEmpty
(
stockPositions
.
size
())
?
0
:
stockPositions
.
size
());
//示范盘盈亏金额
productRelation
.
setProfitAmount
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfit
()));
accountProductRelationService
.
updateAccountProductRelation
(
productRelation
);
//accountProductRelationService.updateAccountProductRelation();
}
catch
(
Exception
e
)
{
log
.
error
(
"资管更新数据错误:{}"
,
e
);
}
return
productRelation
;
}
...
...
src/main/java/com/zfxftech/telmarket/task/followAccount/SmartStockPriceTask.java
View file @
9fd1f93c
...
...
@@ -2,9 +2,11 @@ package com.zfxftech.telmarket.task.followAccount;
import
com.zfxftech.telmarket.common.config.CommonConfig
;
import
com.zfxftech.telmarket.common.pojo.dao.MemberBase
;
import
com.zfxftech.telmarket.common.pojo.dao.asset.AssetAccountProductRelation
;
import
com.zfxftech.telmarket.common.pojo.dao.smart.SmartAccountProductRelation
;
import
com.zfxftech.telmarket.common.pojo.dao.smart.SmartStockPosition
;
import
com.zfxftech.telmarket.common.pojo.vo.smart.SmartMarketDetailsVO
;
import
com.zfxftech.telmarket.common.util.BigDecimalUtil
;
import
com.zfxftech.telmarket.common.util.DateUtil
;
import
com.zfxftech.telmarket.common.util.OptionalUtil
;
import
com.zfxftech.telmarket.service.business.UsMemberBaseService
;
...
...
@@ -46,7 +48,7 @@ public class SmartStockPriceTask implements ApplicationRunner {
@Autowired
private
SmartAccountProductRelationService
a
ccountProductRelationService
;
private
SmartAccountProductRelationService
smartA
ccountProductRelationService
;
@Autowired
private
SmartStockPositionService
stockPositionService
;
@Autowired
...
...
@@ -77,7 +79,7 @@ public class SmartStockPriceTask implements ApplicationRunner {
Integer
pageSize
=
50
;
Date
startTime
=
new
Date
();
List
<
CompletableFuture
<
String
>>
futureList
=
new
ArrayList
<>();
List
<
SmartAccountProductRelation
>
accountProductRelations
=
a
ccountProductRelationService
.
queryAll
();
List
<
SmartAccountProductRelation
>
accountProductRelations
=
smartA
ccountProductRelationService
.
queryAll
();
if
(!
ObjectUtils
.
isEmpty
(
accountProductRelations
)
&&
accountProductRelations
.
size
()
>
0
)
{
log
.
info
(
"智能跟投计算股票统计数据大小:{}"
,
accountProductRelations
.
size
());
Integer
pageTOtl
=
accountProductRelations
.
size
()
%
pageSize
==
0
?
accountProductRelations
.
size
()
/
pageSize
:
accountProductRelations
.
size
()
/
pageSize
+
1
;
...
...
@@ -85,9 +87,16 @@ public class SmartStockPriceTask implements ApplicationRunner {
List
<
SmartAccountProductRelation
>
accountProductRelationList
=
this
.
page
(
accountProductRelations
,
pageNo
.
get
(),
pageSize
);
CompletableFuture
cf
=
CompletableFuture
.
supplyAsync
(()
->
{
List
<
SmartAccountProductRelation
>
productRelations
=
new
ArrayList
<>();
for
(
SmartAccountProductRelation
accountProductRelation
:
accountProductRelationList
)
{
this
.
AccountProductRelationTask
(
accountProductRelation
);
SmartAccountProductRelation
smartAccountProductRelation
=
this
.
AccountProductRelationTask
(
accountProductRelation
);
if
(!
ObjectUtils
.
isEmpty
(
smartAccountProductRelation
)
&&
!
ObjectUtils
.
isEmpty
(
smartAccountProductRelation
.
getId
())
)
{
productRelations
.
add
(
smartAccountProductRelation
);
}
}
smartAccountProductRelationService
.
updateBatchById
(
productRelations
);
return
" "
;
},
executorServicePersonal
).
handle
((
result
,
ex
)
->
{
if
(
null
!=
ex
)
{
...
...
@@ -147,7 +156,9 @@ public class SmartStockPriceTask implements ApplicationRunner {
//智能跟投
public
void
AccountProductRelationTask
(
SmartAccountProductRelation
accountProductRelation
)
{
public
SmartAccountProductRelation
AccountProductRelationTask
(
SmartAccountProductRelation
accountProductRelation
)
{
SmartAccountProductRelation
smartAccountProductRelation
=
new
SmartAccountProductRelation
();
try
{
String
type
=
SIMULATED
.
getCode
();
OptionalUtil
.
checkNull
(
accountProductRelation
,
"当前用户产品关系不存在"
);
...
...
@@ -169,8 +180,12 @@ public class SmartStockPriceTask implements ApplicationRunner {
List
<
SmartStockPosition
>
stockPositions
=
stockPositionService
.
queryStockPositions
(
marketId
);
//汇总数据
SmartMarketDetailsVO
marketDetailsVO
=
stockPositionService
.
createMarketDetailsVOTask
(
stockPositions
,
funding
,
accountProductRelation
);
if
(
BigDecimalUtil
.
compare
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfitRate
()),
accountProductRelation
.
getSimulatedTotalProfit
(),
0
)){
return
null
;
}
//示范盈亏比例
SmartAccountProductRelation
smartAccountProductRelation
=
new
SmartAccountProductRelation
();
smartAccountProductRelation
.
setId
(
accountProductRelation
.
getId
());
smartAccountProductRelation
.
setSimulatedTotalProfit
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfitRate
()));
//示范盘总资产
...
...
@@ -181,11 +196,12 @@ public class SmartStockPriceTask implements ApplicationRunner {
smartAccountProductRelation
.
setPositionCount
(
ObjectUtils
.
isEmpty
(
stockPositions
.
size
())
?
0
:
stockPositions
.
size
());
//示范盘盈亏金额
smartAccountProductRelation
.
setProfitAmount
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfit
()));
accountProductRelationService
.
updateAccountProductRelation
(
smartAccountProductRelation
);
//
accountProductRelationService.updateAccountProductRelation(smartAccountProductRelation);
}
catch
(
Exception
e
){
log
.
error
(
"更新数据错误:{}"
,
e
);
}
return
smartAccountProductRelation
;
}
...
...
src/main/java/com/zfxftech/telmarket/task/followAccount/StockPriceTask.java
View file @
9fd1f93c
...
...
@@ -5,6 +5,7 @@ import com.zfxftech.telmarket.common.pojo.dao.AccountProductRelation;
import
com.zfxftech.telmarket.common.pojo.dao.MemberBase
;
import
com.zfxftech.telmarket.common.pojo.dao.StockPosition
;
import
com.zfxftech.telmarket.common.pojo.vo.MarketDetailsVO
;
import
com.zfxftech.telmarket.common.util.BigDecimalUtil
;
import
com.zfxftech.telmarket.common.util.DateUtil
;
import
com.zfxftech.telmarket.common.util.OptionalUtil
;
import
com.zfxftech.telmarket.service.business.*
;
...
...
@@ -82,8 +83,15 @@ public class StockPriceTask implements ApplicationRunner {
List
<
AccountProductRelation
>
accountProductRelationList
=
this
.
page
(
accountProductRelations
,
pageNo
.
get
(),
pageSize
);
CompletableFuture
cf
=
CompletableFuture
.
supplyAsync
(()
->
{
List
<
AccountProductRelation
>
list
=
new
ArrayList
<>();
for
(
AccountProductRelation
accountProductRelation
:
accountProductRelationList
)
{
this
.
AccountProductRelationTask
(
accountProductRelation
);
AccountProductRelation
productRelation
=
this
.
AccountProductRelationTask
(
accountProductRelation
);
if
(!
ObjectUtils
.
isEmpty
(
productRelation
)
&&
!
ObjectUtils
.
isEmpty
(
productRelation
.
getId
())){
list
.
add
(
productRelation
);
}
accountProductRelationService
.
updateBatchById
(
list
);
}
return
" "
;
},
executorServicePersonal
).
handle
((
result
,
ex
)
->
{
...
...
@@ -144,7 +152,9 @@ public class StockPriceTask implements ApplicationRunner {
//私人定制
public
void
AccountProductRelationTask
(
AccountProductRelation
accountProductRelation
)
{
public
AccountProductRelation
AccountProductRelationTask
(
AccountProductRelation
accountProductRelation
)
{
AccountProductRelation
productRelation
=
new
AccountProductRelation
();
try
{
String
type
=
SIMULATED
.
getCode
();
OptionalUtil
.
checkNull
(
accountProductRelation
,
"当前用户产品关系不存在"
);
...
...
@@ -166,7 +176,12 @@ public class StockPriceTask implements ApplicationRunner {
List
<
StockPosition
>
stockPositions
=
stockPositionService
.
queryStockPositions
(
marketId
);
//汇总数据
MarketDetailsVO
marketDetailsVO
=
stockPositionService
.
createMarketDetailsVOTask
(
stockPositions
,
funding
,
accountProductRelation
);
AccountProductRelation
productRelation
=
new
AccountProductRelation
();
if
(
BigDecimalUtil
.
compare
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfitRate
()),
accountProductRelation
.
getSimulatedTotalProfit
(),
0
)){
return
null
;
}
productRelation
.
setId
(
accountProductRelation
.
getId
());
//示范盈亏比例
productRelation
.
setSimulatedTotalProfit
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfitRate
()));
...
...
@@ -178,11 +193,12 @@ public class StockPriceTask implements ApplicationRunner {
productRelation
.
setPositionCount
(
ObjectUtils
.
isEmpty
(
stockPositions
.
size
())
?
0
:
stockPositions
.
size
());
//示范盘盈亏金额
productRelation
.
setProfitAmount
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfit
()));
accountProductRelationService
.
updateAccountProductRelation
(
productRelation
);
//
accountProductRelationService.updateAccountProductRelation(productRelation);
}
catch
(
Exception
e
){
log
.
error
(
"私人定制更新数据错误:{}"
,
e
);
}
return
productRelation
;
}
...
...
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