Commit 08e8341c authored by liucx's avatar liucx

文字优化

parent e36dc34c
...@@ -51,7 +51,6 @@ public class AssetStockPriceTask implements ApplicationRunner { ...@@ -51,7 +51,6 @@ public class AssetStockPriceTask implements ApplicationRunner {
private CommonConfig commonConfig; private CommonConfig commonConfig;
@Override @Override
public void run(ApplicationArguments args) throws Exception { public void run(ApplicationArguments args) throws Exception {
log.info("资管计算股票统计日志开始", commonConfig.getAssetStockPriceTask()); log.info("资管计算股票统计日志开始", commonConfig.getAssetStockPriceTask());
...@@ -83,7 +82,7 @@ public class AssetStockPriceTask implements ApplicationRunner { ...@@ -83,7 +82,7 @@ public class AssetStockPriceTask implements ApplicationRunner {
List<AssetAccountProductRelation> assetAccountProductRelations = new ArrayList<>(); List<AssetAccountProductRelation> assetAccountProductRelations = new ArrayList<>();
for (AssetAccountProductRelation accountProductRelation : accountProductRelationList) { for (AssetAccountProductRelation accountProductRelation : accountProductRelationList) {
AssetAccountProductRelation assetAccountProductRelation = this.AccountProductRelationTask(accountProductRelation); AssetAccountProductRelation assetAccountProductRelation = this.AccountProductRelationTask(accountProductRelation);
if(!ObjectUtils.isEmpty(assetAccountProductRelation) && !ObjectUtils.isEmpty(assetAccountProductRelation.getId())){ if (!ObjectUtils.isEmpty(assetAccountProductRelation) && !ObjectUtils.isEmpty(assetAccountProductRelation.getId())) {
assetAccountProductRelations.add(assetAccountProductRelation); assetAccountProductRelations.add(assetAccountProductRelation);
} }
} }
...@@ -165,26 +164,32 @@ public class AssetStockPriceTask implements ApplicationRunner { ...@@ -165,26 +164,32 @@ public class AssetStockPriceTask implements ApplicationRunner {
//汇总数据 //汇总数据
AssetMarketDetailsVO marketDetailsVO = stockPositionService.createMarketDetailsVOTask(stockPositions, funding, accountProductRelation); AssetMarketDetailsVO marketDetailsVO = stockPositionService.createMarketDetailsVOTask(stockPositions, funding, accountProductRelation);
if(BigDecimalUtil.compare(new BigDecimal(marketDetailsVO.getTotalProfitRate()),accountProductRelation.getSimulatedTotalProfit(),0)){
return null;
}
productRelation.setId(accountProductRelation.getId()); productRelation.setId(accountProductRelation.getId());
//示范盈亏比例
productRelation.setSimulatedTotalProfit(new BigDecimal(marketDetailsVO.getTotalProfitRate())); if (!ObjectUtils.isEmpty(marketDetailsVO.getTotalProfitRate())) {
//示范盘总资产 productRelation.setSimulatedTotalProfit(new BigDecimal(marketDetailsVO.getTotalProfitRate()));
productRelation.setSimulatedTotalPrice(new BigDecimal(marketDetailsVO.getTotalPrice())); }
//示范持仓比 if (!ObjectUtils.isEmpty(marketDetailsVO.getTotalPrice())) {
productRelation.setSimulatedProportion(new BigDecimal(marketDetailsVO.getPosition())); //示范盘总资产
productRelation.setSimulatedTotalPrice(new BigDecimal(marketDetailsVO.getTotalPrice()));
}
if (!ObjectUtils.isEmpty(marketDetailsVO.getPosition())) {
//示范持仓比
productRelation.setSimulatedProportion(new BigDecimal(marketDetailsVO.getPosition()));
}
//示范盘持仓数量 //示范盘持仓数量
productRelation.setPositionCount(ObjectUtils.isEmpty(stockPositions.size()) ? 0 : stockPositions.size()); productRelation.setPositionCount(ObjectUtils.isEmpty(stockPositions.size()) ? 0 : stockPositions.size());
//示范盘盈亏金额
productRelation.setProfitAmount(new BigDecimal(marketDetailsVO.getTotalProfit())); if (!ObjectUtils.isEmpty(marketDetailsVO.getTotalProfit())) {
//示范盘盈亏金额
productRelation.setProfitAmount(new BigDecimal(marketDetailsVO.getTotalProfit()));
}
//accountProductRelationService.updateAccountProductRelation(); //accountProductRelationService.updateAccountProductRelation();
} catch (Exception e) { } catch (Exception e) {
log.error("资管更新数据错误:{}", e); log.error("资管更新数据错误:{}", e);
} }
return productRelation; return productRelation;
} }
......
...@@ -45,8 +45,6 @@ import static com.zfxftech.telmarket.common.constant.AdminConstant.MarketTypeEnu ...@@ -45,8 +45,6 @@ import static com.zfxftech.telmarket.common.constant.AdminConstant.MarketTypeEnu
public class SmartStockPriceTask implements ApplicationRunner { public class SmartStockPriceTask implements ApplicationRunner {
@Autowired @Autowired
private SmartAccountProductRelationService smartAccountProductRelationService; private SmartAccountProductRelationService smartAccountProductRelationService;
@Autowired @Autowired
...@@ -57,16 +55,12 @@ public class SmartStockPriceTask implements ApplicationRunner { ...@@ -57,16 +55,12 @@ public class SmartStockPriceTask implements ApplicationRunner {
private UsMemberBaseService memberBaseService; private UsMemberBaseService memberBaseService;
@Override @Override
public void run(ApplicationArguments args) throws Exception { public void run(ApplicationArguments args) throws Exception {
log.info("智能跟投计算股票统计日志开始",commonConfig.getSmartStockPriceTask() ); log.info("智能跟投计算股票统计日志开始", commonConfig.getSmartStockPriceTask());
//log.info("智能跟投计算股票统计日志开始配置更新开关状态:" + commonConfig.getStockPriceTask()); //log.info("智能跟投计算股票统计日志开始配置更新开关状态:" + commonConfig.getStockPriceTask());
if (commonConfig.getSmartStockPriceTask() != null && commonConfig.getSmartStockPriceTask().equals("run")) { if (commonConfig.getSmartStockPriceTask() != null && commonConfig.getSmartStockPriceTask().equals("run")) {
// if (true) { // if (true) {
//分页查询异动配置列表 //分页查询异动配置列表
ExecutorService PersonalexecutorService = Executors.newSingleThreadExecutor(); ExecutorService PersonalexecutorService = Executors.newSingleThreadExecutor();
...@@ -90,8 +84,8 @@ public class SmartStockPriceTask implements ApplicationRunner { ...@@ -90,8 +84,8 @@ public class SmartStockPriceTask implements ApplicationRunner {
List<SmartAccountProductRelation> productRelations = new ArrayList<>(); List<SmartAccountProductRelation> productRelations = new ArrayList<>();
for (SmartAccountProductRelation accountProductRelation : accountProductRelationList) { for (SmartAccountProductRelation accountProductRelation : accountProductRelationList) {
SmartAccountProductRelation smartAccountProductRelation = this.AccountProductRelationTask(accountProductRelation); SmartAccountProductRelation smartAccountProductRelation = this.AccountProductRelationTask(accountProductRelation);
if(!ObjectUtils.isEmpty(smartAccountProductRelation) && !ObjectUtils.isEmpty(smartAccountProductRelation.getId()) ) { if (!ObjectUtils.isEmpty(smartAccountProductRelation) && !ObjectUtils.isEmpty(smartAccountProductRelation.getId())) {
productRelations.add(smartAccountProductRelation); productRelations.add(smartAccountProductRelation);
} }
} }
...@@ -159,49 +153,57 @@ public class SmartStockPriceTask implements ApplicationRunner { ...@@ -159,49 +153,57 @@ public class SmartStockPriceTask implements ApplicationRunner {
public SmartAccountProductRelation AccountProductRelationTask(SmartAccountProductRelation accountProductRelation) { public SmartAccountProductRelation AccountProductRelationTask(SmartAccountProductRelation accountProductRelation) {
SmartAccountProductRelation smartAccountProductRelation = new SmartAccountProductRelation(); SmartAccountProductRelation smartAccountProductRelation = new SmartAccountProductRelation();
try{ if (!accountProductRelation.getId().toString().equals("232366752727043")) {
String type = SIMULATED.getCode(); return null;
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)) { try {
funding = accountProductRelation.getSimulatedFunding(); String type = SIMULATED.getCode();
} OptionalUtil.checkNull(accountProductRelation, "当前用户产品关系不存在");
//获取所有买入过的股票 //查询客户信息
List<SmartStockPosition> stockPositions = stockPositionService.queryStockPositions(marketId); Long customerId = accountProductRelation.getCustomerId();
//汇总数据 MemberBase memberBase = memberBaseService.queryUsMemberBaseById(customerId);
SmartMarketDetailsVO marketDetailsVO = stockPositionService.createMarketDetailsVOTask( stockPositions, funding, accountProductRelation); 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<SmartStockPosition> stockPositions = stockPositionService.queryStockPositions(marketId);
//汇总数据
SmartMarketDetailsVO marketDetailsVO = stockPositionService.createMarketDetailsVOTask(stockPositions, funding, accountProductRelation);
if( ObjectUtils.isEmpty(marketDetailsVO) || ObjectUtils.isEmpty(marketDetailsVO.getTotalProfitRate()) || ObjectUtils.isEmpty(accountProductRelation.getSimulatedTotalProfit()) || BigDecimalUtil.compare(new BigDecimal(marketDetailsVO.getTotalProfitRate()),accountProductRelation.getSimulatedTotalProfit(),0)){
return null; //示范盈亏比例
smartAccountProductRelation.setId(accountProductRelation.getId());
if (!ObjectUtils.isEmpty(marketDetailsVO.getTotalProfitRate())) {
smartAccountProductRelation.setSimulatedTotalProfit(new BigDecimal(marketDetailsVO.getTotalProfitRate()));
}
if (!ObjectUtils.isEmpty(marketDetailsVO.getTotalPrice())) {
//示范盘总资产
smartAccountProductRelation.setSimulatedTotalPrice(new BigDecimal(marketDetailsVO.getTotalPrice()));
} }
if (!ObjectUtils.isEmpty(marketDetailsVO.getPosition())) {
//示范持仓比
smartAccountProductRelation.setSimulatedProportion(new BigDecimal(marketDetailsVO.getPosition()));
}
//示范盘持仓数量
smartAccountProductRelation.setPositionCount(ObjectUtils.isEmpty(stockPositions.size()) ? 0 : stockPositions.size());
//示范盈亏比例 if (!ObjectUtils.isEmpty(marketDetailsVO.getTotalProfit())) {
smartAccountProductRelation.setId(accountProductRelation.getId()); //示范盘盈亏金额
smartAccountProductRelation.setSimulatedTotalProfit(new BigDecimal(marketDetailsVO.getTotalProfitRate())); smartAccountProductRelation.setProfitAmount(new BigDecimal(marketDetailsVO.getTotalProfit()));
//示范盘总资产 }
smartAccountProductRelation.setSimulatedTotalPrice(new BigDecimal(marketDetailsVO.getTotalPrice())); } catch (Exception e) {
//示范持仓比 log.error("更新数据错误:{}", e);
smartAccountProductRelation.setSimulatedProportion(new BigDecimal(marketDetailsVO.getPosition()));
//示范盘持仓数量
smartAccountProductRelation.setPositionCount(ObjectUtils.isEmpty(stockPositions.size()) ? 0 : stockPositions.size());
//示范盘盈亏金额
smartAccountProductRelation.setProfitAmount(new BigDecimal(marketDetailsVO.getTotalProfit()));
//accountProductRelationService.updateAccountProductRelation(smartAccountProductRelation);
}
catch (Exception e){
log.error("更新数据错误:{}",e);
} }
return smartAccountProductRelation; return smartAccountProductRelation;
} }
......
...@@ -42,7 +42,6 @@ import static com.zfxftech.telmarket.common.constant.AdminConstant.MarketTypeEnu ...@@ -42,7 +42,6 @@ import static com.zfxftech.telmarket.common.constant.AdminConstant.MarketTypeEnu
public class StockPriceTask implements ApplicationRunner { public class StockPriceTask implements ApplicationRunner {
@Autowired @Autowired
private AccountProductRelationService accountProductRelationService; private AccountProductRelationService accountProductRelationService;
@Autowired @Autowired
...@@ -53,16 +52,12 @@ public class StockPriceTask implements ApplicationRunner { ...@@ -53,16 +52,12 @@ public class StockPriceTask implements ApplicationRunner {
private UsMemberBaseService memberBaseService; private UsMemberBaseService memberBaseService;
@Override @Override
public void run(ApplicationArguments args) throws Exception { public void run(ApplicationArguments args) throws Exception {
log.info("私人定制计算股票统计日志开始"); log.info("私人定制计算股票统计日志开始");
//log.info("私人定制计算股票统计日志开始配置更新开关状态:" + commonConfig.getStockPriceTask()); //log.info("私人定制计算股票统计日志开始配置更新开关状态:" + commonConfig.getStockPriceTask());
if (commonConfig.getStockPriceTask() != null && commonConfig.getStockPriceTask().equals("run")) { if (commonConfig.getStockPriceTask() != null && commonConfig.getStockPriceTask().equals("run")) {
//if (true) { //if (true) {
//分页查询异动配置列表 //分页查询异动配置列表
ExecutorService PersonalexecutorService = Executors.newSingleThreadExecutor(); ExecutorService PersonalexecutorService = Executors.newSingleThreadExecutor();
...@@ -87,8 +82,8 @@ public class StockPriceTask implements ApplicationRunner { ...@@ -87,8 +82,8 @@ public class StockPriceTask implements ApplicationRunner {
List<AccountProductRelation> list = new ArrayList<>(); List<AccountProductRelation> list = new ArrayList<>();
for (AccountProductRelation accountProductRelation : accountProductRelationList) { for (AccountProductRelation accountProductRelation : accountProductRelationList) {
AccountProductRelation productRelation = this.AccountProductRelationTask(accountProductRelation); AccountProductRelation productRelation = this.AccountProductRelationTask(accountProductRelation);
if(!ObjectUtils.isEmpty(productRelation) && !ObjectUtils.isEmpty(productRelation.getId())){ if (!ObjectUtils.isEmpty(productRelation) && !ObjectUtils.isEmpty(productRelation.getId())) {
list.add(productRelation); list.add(productRelation);
} }
...@@ -177,26 +172,29 @@ public class StockPriceTask implements ApplicationRunner { ...@@ -177,26 +172,29 @@ public class StockPriceTask implements ApplicationRunner {
//汇总数据 //汇总数据
MarketDetailsVO marketDetailsVO = stockPositionService.createMarketDetailsVOTask(stockPositions, funding, accountProductRelation); MarketDetailsVO marketDetailsVO = stockPositionService.createMarketDetailsVOTask(stockPositions, funding, accountProductRelation);
productRelation.setId(accountProductRelation.getId());
if(BigDecimalUtil.compare(new BigDecimal(marketDetailsVO.getTotalProfitRate()),accountProductRelation.getSimulatedTotalProfit(),0)){ if (!ObjectUtils.isEmpty(marketDetailsVO.getTotalProfitRate())) {
return null; productRelation.setSimulatedTotalProfit(new BigDecimal(marketDetailsVO.getTotalProfitRate()));
}
if (!ObjectUtils.isEmpty(marketDetailsVO.getTotalPrice())) {
//示范盘总资产
productRelation.setSimulatedTotalPrice(new BigDecimal(marketDetailsVO.getTotalPrice()));
}
if (!ObjectUtils.isEmpty(marketDetailsVO.getPosition())) {
//示范持仓比
productRelation.setSimulatedProportion(new BigDecimal(marketDetailsVO.getPosition()));
} }
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.setPositionCount(ObjectUtils.isEmpty(stockPositions.size()) ? 0 : stockPositions.size());
//示范盘盈亏金额
productRelation.setProfitAmount(new BigDecimal(marketDetailsVO.getTotalProfit()));
//accountProductRelationService.updateAccountProductRelation(productRelation);
}catch (Exception e){ if (!ObjectUtils.isEmpty(marketDetailsVO.getTotalProfit())) {
log.error("私人定制更新数据错误:{}",e); //示范盘盈亏金额
productRelation.setProfitAmount(new BigDecimal(marketDetailsVO.getTotalProfit()));
}
} catch (Exception e) {
log.error("私人定制更新数据错误:{}", e);
} }
return productRelation; return 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