huan.xu 4 years ago
commit 5417d726d7
  1. 4
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/BtcFeign.java
  2. 22
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java

@ -3,7 +3,7 @@ package com.blockchain.server.yyyf.feign;
import com.blockchain.common.base.dto.ResultDTO;
import com.blockchain.server.yyyf.feign.dto.BtcWalletDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@ -12,6 +12,6 @@ import java.util.List;
public interface BtcFeign {
String CONTENT_PATH = "/inner/wallet";
@PostMapping(CONTENT_PATH + "/getWallets")
@GetMapping(CONTENT_PATH + "/getWallets")
ResultDTO<List<BtcWalletDTO>> getWallets(@RequestParam("userId") String userId);
}

@ -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");
@ -344,4 +362,4 @@ public class AssessUserServiceImpl implements AssessUserService {
}
}
}

Loading…
Cancel
Save