Commit facb5916 authored by liucx's avatar liucx

优化 只更新4个字段

parent 00ec197d
......@@ -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);
}
......
......@@ -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);
}
}
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment