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
facb5916
Commit
facb5916
authored
Jun 02, 2022
by
liucx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 只更新4个字段
parent
00ec197d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
69 deletions
+79
-69
AssetStockPriceTask.java
...ech/telmarket/task/followAccount/AssetStockPriceTask.java
+37
-37
SmartStockPriceTask.java
...ech/telmarket/task/followAccount/SmartStockPriceTask.java
+5
-0
StockPriceTask.java
...zfxftech/telmarket/task/followAccount/StockPriceTask.java
+37
-32
No files found.
src/main/java/com/zfxftech/telmarket/task/followAccount/AssetStockPriceTask.java
View file @
facb5916
...
...
@@ -52,24 +52,20 @@ public class AssetStockPriceTask implements ApplicationRunner {
private
UsMemberBaseService
memberBaseService
;
@Override
public
void
run
(
ApplicationArguments
args
)
throws
Exception
{
log
.
info
(
"资管计算股票统计日志开始"
,
commonConfig
.
getAssetStockPriceTask
());
log
.
info
(
"资管计算股票统计日志开始"
,
commonConfig
.
getAssetStockPriceTask
());
//log.info("资管计算股票统计日志开始配置更新开关状态:" + commonConfig.getStockPriceTask());
if
(
commonConfig
.
getAssetStockPriceTask
()
!=
null
&&
commonConfig
.
getAssetStockPriceTask
().
equals
(
"run"
))
{
//if (true) {
//if (true) {
//分页查询异动配置列表
ExecutorService
PersonalexecutorService
=
Executors
.
newSingleThreadExecutor
();
ExecutorService
executorServicePersonal
=
Executors
.
newFixedThreadPool
(
100
);
CompletableFuture
.
runAsync
(()
->
{
while
(
true
)
{
if
(
DateUtil
.
isTradeDayForChangeRemind
())
{
// if (true) {
if
(
DateUtil
.
isTradeDayForChangeRemind
())
{
// if (true) {
AtomicReference
<
Integer
>
pageNo
=
new
AtomicReference
<>(
1
);
Integer
pageSize
=
100
;
Date
startTime
=
new
Date
();
...
...
@@ -145,36 +141,40 @@ public class AssetStockPriceTask implements ApplicationRunner {
//资管
public
void
AccountProductRelationTask
(
AssetAccountProductRelation
accountProductRelation
)
{
String
type
=
SIMULATED
.
getCode
();
OptionalUtil
.
checkNull
(
accountProductRelation
,
"当前用户产品关系不存在"
);
//查询客户信息
Long
marketId
=
accountProductRelation
.
getSimulatedMarketId
();
//查询持仓信息
BigDecimal
funding
=
null
;
//获取可用资金
if
(
REAL
.
getCode
().
equals
(
type
))
{
return
;
}
if
(
SIMULATED
.
getCode
().
equals
(
type
))
{
funding
=
accountProductRelation
.
getSimulatedFunding
();
try
{
String
type
=
SIMULATED
.
getCode
();
OptionalUtil
.
checkNull
(
accountProductRelation
,
"当前用户产品关系不存在"
);
//查询客户信息
Long
marketId
=
accountProductRelation
.
getSimulatedMarketId
();
//查询持仓信息
BigDecimal
funding
=
null
;
//获取可用资金
if
(
REAL
.
getCode
().
equals
(
type
))
{
return
;
}
if
(
SIMULATED
.
getCode
().
equals
(
type
))
{
funding
=
accountProductRelation
.
getSimulatedFunding
();
}
AssetAccountProductRelation
productRelation
=
new
AssetAccountProductRelation
();
productRelation
.
setId
(
accountProductRelation
.
getId
());
//获取所有买入过的股票
List
<
AssetStockPosition
>
stockPositions
=
stockPositionService
.
queryStockPositions
(
marketId
);
//汇总数据
AssetMarketDetailsVO
marketDetailsVO
=
stockPositionService
.
createMarketDetailsVOTask
(
stockPositions
,
funding
,
accountProductRelation
);
//示范盈亏比例
productRelation
.
setSimulatedTotalProfit
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfitRate
()));
//示范盘总资产
productRelation
.
setSimulatedTotalPrice
(
new
BigDecimal
(
marketDetailsVO
.
getTotalPrice
()));
//示范持仓比
productRelation
.
setSimulatedProportion
(
new
BigDecimal
(
marketDetailsVO
.
getPosition
()));
//示范盘持仓数量
productRelation
.
setPositionCount
(
ObjectUtils
.
isEmpty
(
stockPositions
.
size
())
?
0
:
stockPositions
.
size
());
//示范盘盈亏金额
productRelation
.
setProfitAmount
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfit
()));
accountProductRelationService
.
updateAccountProductRelation
(
productRelation
);
}
catch
(
Exception
e
)
{
log
.
error
(
"资管更新数据错误:{}"
,
e
);
}
AssetAccountProductRelation
productRelation
=
new
AssetAccountProductRelation
();
productRelation
.
setId
(
accountProductRelation
.
getId
());
//获取所有买入过的股票
List
<
AssetStockPosition
>
stockPositions
=
stockPositionService
.
queryStockPositions
(
marketId
);
//汇总数据
AssetMarketDetailsVO
marketDetailsVO
=
stockPositionService
.
createMarketDetailsVOTask
(
stockPositions
,
funding
,
accountProductRelation
);
//示范盈亏比例
productRelation
.
setSimulatedTotalProfit
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfitRate
()));
//示范盘总资产
productRelation
.
setSimulatedTotalPrice
(
new
BigDecimal
(
marketDetailsVO
.
getTotalPrice
()));
//示范持仓比
productRelation
.
setSimulatedProportion
(
new
BigDecimal
(
marketDetailsVO
.
getPosition
()));
//示范盘持仓数量
productRelation
.
setPositionCount
(
ObjectUtils
.
isEmpty
(
stockPositions
.
size
())
?
0
:
stockPositions
.
size
());
//示范盘盈亏金额
productRelation
.
setProfitAmount
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfit
()));
accountProductRelationService
.
updateAccountProductRelation
(
productRelation
);
}
...
...
src/main/java/com/zfxftech/telmarket/task/followAccount/SmartStockPriceTask.java
View file @
facb5916
...
...
@@ -148,6 +148,7 @@ public class SmartStockPriceTask implements ApplicationRunner {
//智能跟投
public
void
AccountProductRelationTask
(
SmartAccountProductRelation
accountProductRelation
)
{
try
{
String
type
=
SIMULATED
.
getCode
();
OptionalUtil
.
checkNull
(
accountProductRelation
,
"当前用户产品关系不存在"
);
//查询客户信息
...
...
@@ -181,6 +182,10 @@ public class SmartStockPriceTask implements ApplicationRunner {
//示范盘盈亏金额
smartAccountProductRelation
.
setProfitAmount
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfit
()));
accountProductRelationService
.
updateAccountProductRelation
(
smartAccountProductRelation
);
}
catch
(
Exception
e
){
log
.
error
(
"更新数据错误:{}"
,
e
);
}
}
...
...
src/main/java/com/zfxftech/telmarket/task/followAccount/StockPriceTask.java
View file @
facb5916
...
...
@@ -145,39 +145,44 @@ public class StockPriceTask implements ApplicationRunner {
//私人定制
public
void
AccountProductRelationTask
(
AccountProductRelation
accountProductRelation
)
{
String
type
=
SIMULATED
.
getCode
();
OptionalUtil
.
checkNull
(
accountProductRelation
,
"当前用户产品关系不存在"
);
//查询客户信息
Long
customerId
=
accountProductRelation
.
getCustomerId
();
MemberBase
memberBase
=
memberBaseService
.
queryUsMemberBaseById
(
customerId
);
Long
marketId
=
accountProductRelation
.
getSimulatedMarketId
();
OptionalUtil
.
checkNull
(
memberBase
,
"查询用户数据不存在"
);
//查询持仓信息
BigDecimal
funding
=
null
;
//获取可用资金
if
(
REAL
.
getCode
().
equals
(
type
))
{
funding
=
accountProductRelation
.
getRealFunding
();
try
{
String
type
=
SIMULATED
.
getCode
();
OptionalUtil
.
checkNull
(
accountProductRelation
,
"当前用户产品关系不存在"
);
//查询客户信息
Long
customerId
=
accountProductRelation
.
getCustomerId
();
MemberBase
memberBase
=
memberBaseService
.
queryUsMemberBaseById
(
customerId
);
Long
marketId
=
accountProductRelation
.
getSimulatedMarketId
();
OptionalUtil
.
checkNull
(
memberBase
,
"查询用户数据不存在"
);
//查询持仓信息
BigDecimal
funding
=
null
;
//获取可用资金
if
(
REAL
.
getCode
().
equals
(
type
))
{
funding
=
accountProductRelation
.
getRealFunding
();
}
if
(
SIMULATED
.
getCode
().
equals
(
type
))
{
funding
=
accountProductRelation
.
getSimulatedFunding
();
}
//获取所有买入过的股票
List
<
StockPosition
>
stockPositions
=
stockPositionService
.
queryStockPositions
(
marketId
);
//汇总数据
MarketDetailsVO
marketDetailsVO
=
stockPositionService
.
createMarketDetailsVOTask
(
stockPositions
,
funding
,
accountProductRelation
);
AccountProductRelation
productRelation
=
new
AccountProductRelation
();
productRelation
.
setId
(
accountProductRelation
.
getId
());
//示范盈亏比例
productRelation
.
setSimulatedTotalProfit
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfitRate
()));
//示范盘总资产
productRelation
.
setSimulatedTotalPrice
(
new
BigDecimal
(
marketDetailsVO
.
getTotalPrice
()));
//示范持仓比
productRelation
.
setSimulatedProportion
(
new
BigDecimal
(
marketDetailsVO
.
getPosition
()));
//示范盘持仓数量
productRelation
.
setPositionCount
(
ObjectUtils
.
isEmpty
(
stockPositions
.
size
())
?
0
:
stockPositions
.
size
());
//示范盘盈亏金额
productRelation
.
setProfitAmount
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfit
()));
accountProductRelationService
.
updateAccountProductRelation
(
productRelation
);
}
catch
(
Exception
e
){
log
.
error
(
"私人定制更新数据错误:{}"
,
e
);
}
if
(
SIMULATED
.
getCode
().
equals
(
type
))
{
funding
=
accountProductRelation
.
getSimulatedFunding
();
}
//获取所有买入过的股票
List
<
StockPosition
>
stockPositions
=
stockPositionService
.
queryStockPositions
(
marketId
);
//汇总数据
MarketDetailsVO
marketDetailsVO
=
stockPositionService
.
createMarketDetailsVOTask
(
stockPositions
,
funding
,
accountProductRelation
);
AccountProductRelation
productRelation
=
new
AccountProductRelation
();
productRelation
.
setId
(
accountProductRelation
.
getId
());
//示范盈亏比例
productRelation
.
setSimulatedTotalProfit
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfitRate
()));
//示范盘总资产
productRelation
.
setSimulatedTotalPrice
(
new
BigDecimal
(
marketDetailsVO
.
getTotalPrice
()));
//示范持仓比
productRelation
.
setSimulatedProportion
(
new
BigDecimal
(
marketDetailsVO
.
getPosition
()));
//示范盘持仓数量
productRelation
.
setPositionCount
(
ObjectUtils
.
isEmpty
(
stockPositions
.
size
())
?
0
:
stockPositions
.
size
());
//示范盘盈亏金额
productRelation
.
setProfitAmount
(
new
BigDecimal
(
marketDetailsVO
.
getTotalProfit
()));
accountProductRelationService
.
updateAccountProductRelation
(
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