From bfb1a0cc7642f59c5bc881fc83bd2ee4858564fe Mon Sep 17 00:00:00 2001 From: "fengyu.wang" Date: Tue, 27 Oct 2020 21:51:38 +0800 Subject: [PATCH 1/2] commit --- .../service/impl/AssessUserServiceImpl.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java index 19db4ff..5758e91 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java +++ b/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 { } -} \ No newline at end of file +} From a8e11b590d1b715b0cfa99b747ba1bda52157b81 Mon Sep 17 00:00:00 2001 From: "fengyu.wang" Date: Sat, 31 Oct 2020 12:41:58 +0800 Subject: [PATCH 2/2] feign update --- .../main/java/com/blockchain/server/yyyf/feign/BtcFeign.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/BtcFeign.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/BtcFeign.java index c095b2f..0d5690c 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/BtcFeign.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/BtcFeign.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> getWallets(@RequestParam("userId") String userId); }