From 9963b062c0e49f57dbed3dfc3414b1d10291bfa2 Mon Sep 17 00:00:00 2001 From: "fengyu.wang" Date: Wed, 27 May 2020 23:02:42 +0800 Subject: [PATCH] indicator design --- .../server/btc/inner/BtcWalletInner.java | 15 +++++- .../inner/CurrencyMarketInnerController.java | 7 +++ .../eos/inner/EosWalletInnerController.java | 11 +++++ .../server/eth/inner/EthWalletInner.java | 6 +++ .../yyyf/indicators/IndicatorsManager.java | 47 +++++++++++++++++++ .../yyyf/indicators/dto/AssetsReporter.java | 21 +++++++++ .../yyyf/indicators/dto/IndicatorsDetail.java | 16 +++++++ .../server/yyyf/task/ExamProcessTask.java | 21 +++++++++ 8 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/IndicatorsManager.java create mode 100644 blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/AssetsReporter.java create mode 100644 blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/IndicatorsDetail.java create mode 100644 blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/task/ExamProcessTask.java diff --git a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/inner/BtcWalletInner.java b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/inner/BtcWalletInner.java index b30d97b..f8bd558 100644 --- a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/inner/BtcWalletInner.java +++ b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/inner/BtcWalletInner.java @@ -1,6 +1,10 @@ package com.blockchain.server.btc.inner; import com.blockchain.common.base.dto.ResultDTO; +import com.blockchain.common.base.util.SSOHelper; +import com.blockchain.server.btc.common.constants.BtcApplicationConstans; +import com.blockchain.server.btc.controller.api.BtcWalletApi; +import com.blockchain.server.btc.dto.BtcWalletDTO; import com.blockchain.server.btc.inner.api.BtcWalletInnerApi; import com.blockchain.server.btc.service.BtcWalletService; import io.swagger.annotations.Api; @@ -12,6 +16,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletRequest; +import java.util.List; + @Api(BtcWalletInnerApi.MARKET_CONTROLLER_API) @RestController @RequestMapping("/inner/wallet") @@ -26,4 +33,10 @@ public class BtcWalletInner { return ResultDTO.requstSuccess(btcWalletService.insertWallet(userOpenId)); } -} \ No newline at end of file + @GetMapping("/getWallets") + public ResultDTO> getWallets(@RequestParam("userId") String userId, + @RequestParam("walletType") String walletType) { + return ResultDTO.requstSuccess(btcWalletService.selectAllByUserOpenId(userId, walletType)); + } + +} diff --git a/blockchain-server/blockchain-server-currency/src/main/java/com/blockchain/server/currency/inner/CurrencyMarketInnerController.java b/blockchain-server/blockchain-server-currency/src/main/java/com/blockchain/server/currency/inner/CurrencyMarketInnerController.java index 375ad8b..57626c2 100644 --- a/blockchain-server/blockchain-server-currency/src/main/java/com/blockchain/server/currency/inner/CurrencyMarketInnerController.java +++ b/blockchain-server/blockchain-server-currency/src/main/java/com/blockchain/server/currency/inner/CurrencyMarketInnerController.java @@ -1,6 +1,7 @@ package com.blockchain.server.currency.inner; import com.blockchain.common.base.dto.ResultDTO; +import com.blockchain.server.currency.dto.CurrencyMarketDTO; import com.blockchain.server.currency.inner.api.CurrencyMarketInnerApi; import com.blockchain.server.currency.service.CurrencyMarketService; import io.swagger.annotations.Api; @@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; import java.util.Date; +import java.util.List; @Api(CurrencyMarketInnerApi.MARKET_CONTROLLER_API) @RestController @@ -36,4 +38,9 @@ public class CurrencyMarketInnerController { return ResultDTO.requstSuccess(null); } + @RequestMapping(value = "/getList", method = RequestMethod.GET) + public List getList() { + return currencyMarketService.getList(); + } + } diff --git a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/inner/EosWalletInnerController.java b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/inner/EosWalletInnerController.java index 0f08afb..5436ed7 100644 --- a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/inner/EosWalletInnerController.java +++ b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/inner/EosWalletInnerController.java @@ -3,6 +3,8 @@ package com.blockchain.server.eos.inner; import com.blockchain.common.base.dto.ResultDTO; import com.blockchain.common.base.dto.WalletChangeDTO; import com.blockchain.common.base.dto.WalletOrderDTO; +import com.blockchain.common.base.util.SSOHelper; +import com.blockchain.server.eos.dto.WalletDTO; import com.blockchain.server.eos.inner.api.EosWalletApi; import com.blockchain.server.eos.service.EosWalletService; import io.swagger.annotations.Api; @@ -13,6 +15,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; +import java.util.List; + /** * @author Harvey * @date 2019/2/19 18:09 @@ -49,4 +54,10 @@ public class EosWalletInnerController { return ResultDTO.requstSuccess(); } + @GetMapping("/selectWalletByWalletType") + public ResultDTO> selectWalletByWalletType(@RequestParam("userOpenId") String userOpenId, + @RequestParam("walletType") String walletType) { + return ResultDTO.requstSuccess(eosWalletService.listWalletByWalletType(walletType, userOpenId)); + } + } diff --git a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/inner/EthWalletInner.java b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/inner/EthWalletInner.java index 2d166b6..233af76 100644 --- a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/inner/EthWalletInner.java +++ b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/inner/EthWalletInner.java @@ -60,4 +60,10 @@ public class EthWalletInner { return ResultDTO.requstSuccess(); } + @GetMapping("/getWallets") + public ResultDTO getWallets(@RequestParam("userId") String userId, + @RequestParam(name = "walletType", required = false) String walletType) { + return ResultDTO.requstSuccess(ethWalletService.selectByUserOpenIdAndWalletType(userId, walletType)); + } + } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/IndicatorsManager.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/IndicatorsManager.java new file mode 100644 index 0000000..01df104 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/IndicatorsManager.java @@ -0,0 +1,47 @@ +package com.blockchain.server.yyyf.indicators; + +import com.blockchain.server.yyyf.indicators.dto.AssetsReporter; + +import java.util.List; +import java.util.Map; + +public interface IndicatorsManager { + /** + * save assets reporter item + * + * @author fengyu.wang + * @date 2020-05-27 22:32:30 + */ + void saveAssetsReporter(List assetsReporterList); + + /** + * get assets reporter item by assessUserId + * + * @param assessUserId page result id + * @author fengyu.wang + * @date 2020-05-27 22:32:49 + */ + List getAssetsReporterListByAssessUserId(String assessUserId); + + /** + * calculate single indicator + * + * @param assessUserId page result id + * @param type indicators type + * @return indicators result + * @author fengyu.wang + * @date 2020-05-27 22:34:19 + */ + float calculateIndicators(String assessUserId, String type); + + /** + * calculate indicator by full exam + * + * @param assessUserId page result id + * @return indicators type -> indicators result + * @author fengyu.wang + * @date 2020-05-27 22:36:01 + */ + Map calculatePageIndicators(String assessUserId); + +} diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/AssetsReporter.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/AssetsReporter.java new file mode 100644 index 0000000..b7e6ede --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/AssetsReporter.java @@ -0,0 +1,21 @@ +package com.blockchain.server.yyyf.indicators.dto; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * assets recoding day by day + * + * @author fengyu.wang + * @date 2020-05-27 22:59:34 + */ +@Data +public class AssetsReporter { + private String assessUserId;//成绩id + private String coinName;//币种 + private int days;//交易天数 + private BigDecimal assets;//资产总额 + private Date createTime;//创建时间 +} diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/IndicatorsDetail.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/IndicatorsDetail.java new file mode 100644 index 0000000..29aab25 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/IndicatorsDetail.java @@ -0,0 +1,16 @@ +package com.blockchain.server.yyyf.indicators.dto; + +import lombok.Data; + +/** + * indicators persist + * + * @author fengyu.wang + * @date 2020-05-27 22:55:14 + */ +@Data +public class IndicatorsDetail { + private String assessUserId; + private String type;//indicator type + private float indicator; +} diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/task/ExamProcessTask.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/task/ExamProcessTask.java new file mode 100644 index 0000000..979836e --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/task/ExamProcessTask.java @@ -0,0 +1,21 @@ +package com.blockchain.server.yyyf.task; + +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; + +@Configuration +@EnableScheduling +public class ExamProcessTask { + + @Scheduled(cron="0 0 0 1/1 * ? *") + public void processRecording() { + //1.获取所有正在进行考核学生id(子系统userId) + //2.获取 币币总资产 + 法币总资产 + 数据钱包 + 初始资产 + 挂单资金 + //3.计算总资产 转换成RMB + + //4.获取学生考核开始时间 计算当前进行到第几天 + //5.获取学生试卷Id assessUserId + //6.保存到DB + } +}