master
fengyu.wang 4 years ago
parent 23927365bc
commit bfb1a0cc76
  1. 22
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java

@ -1,5 +1,7 @@
package com.blockchain.server.yyyf.service.impl;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.blockchain.common.base.constant.YyyfConstant;
import com.blockchain.server.train.dto.ExamPaperDto;
import com.blockchain.server.train.dto.TrainCaseTargetDto;
@ -13,11 +15,13 @@ import com.blockchain.server.yyyf.entity.YyyfMoney;
import com.blockchain.server.yyyf.enums.YyyfEnums;
import com.blockchain.server.yyyf.exceprion.YyyfException;
import com.blockchain.server.yyyf.indicators.IndicatorsManager;
import com.blockchain.server.yyyf.indicators.dto.AssetsReporter;
import com.blockchain.server.yyyf.mapper.AssessUserMapper;
import com.blockchain.server.yyyf.mapper.AssessUserTargetMapper;
import com.blockchain.server.yyyf.mapper.TrainCaseManageMapper;
import com.blockchain.server.yyyf.mapper.YyyfMoneyMapper;
import com.blockchain.server.yyyf.service.AssessUserService;
import com.blockchain.server.yyyf.service.AssetsReporterService;
import com.blockchain.server.yyyf.utils.HttpClientUtil;
import com.blockchain.server.yyyf.utils.IdGenerator;
import lombok.SneakyThrows;
@ -63,6 +67,8 @@ public class AssessUserServiceImpl implements AssessUserService {
@Autowired
private IndicatorsManager indicatorsManager;
@Autowired
private AssetsReporterService assetsReporterService;
@Value("${yyyf.url}")
@ -148,6 +154,19 @@ public class AssessUserServiceImpl implements AssessUserService {
if (assessUser.getEndTime() != null) {
throw new YyyfException(YyyfEnums.PROHIBIT_DUPLICATE_SUBMISSION);
}
//计算当前时间收益
BigDecimal assets = indicatorsManager.calculateCurrentTotalAssets(assessUser.getQUserId(), assessUserId);
Date now = new Date();
assetsReporterService.saveList(Collections.singletonList(AssetsReporter.builder()
.id(IdGenerator.uuid())
.assessUserId(assessUserId)
.assets(assets)
//不满一天按一天计算
.days(DateUtil.between(assessUser.getStartTime(), now, DateUnit.DAY) + 1)
.coinName("RMB")
.createTime(now)
.build()));
Double totalScore = 0d;
//获取指标信息
Example example = new Example(AssessUserTarget.class);
@ -172,7 +191,6 @@ public class AssessUserServiceImpl implements AssessUserService {
}
Date startTime = assessUser.getStartTime();
Date now = new Date();
assessUser.setTotalScore(totalScore);
assessUser.setEndTime(now);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -343,4 +361,4 @@ public class AssessUserServiceImpl implements AssessUserService {
}
}
}

Loading…
Cancel
Save