From 7c0c2cacb815d7b8449b9ae51c400088bc7f97b3 Mon Sep 17 00:00:00 2001 From: unclekh <5177787+unclekh@user.noreply.gitee.com> Date: Sun, 12 Jul 2020 23:25:31 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/base/constant/YyyfConstant.java | 2 +- .../common/base/dto/YyyfUserDto.java | 2 +- .../common/base/util/YyyfUserDtoUtils.java | 4 +-- .../eth/common/enums/EthWalletEnums.java | 1 + .../user/service/AssessUserService.java | 8 ++--- .../service/impl/AssessUserServiceImpl.java | 2 +- .../controller/TeachingGradeController.java | 10 +++--- .../yyyf/controller/YyyfMoneyController.java | 31 +++++++++++++++++-- .../yyyf/controller/api/TeachingGradeApi.java | 2 +- .../yyyf/controller/api/YyyfMoneyApi.java | 24 +++++++++++++- .../server/yyyf/dto/AssessUserDto.java | 2 +- .../server/yyyf/dto/ExamDetailsDto.java | 2 +- .../server/yyyf/dto/OverviewDto.java | 2 +- .../server/yyyf/dto/ReExamOverviewDto.java | 2 +- .../server/yyyf/dto/TransactResultDto.java | 2 +- .../server/yyyf/dto/UserTimeMoneyDto.java | 2 +- .../server/yyyf/dto/YyyfStudentAnswerDto.java | 2 +- .../server/yyyf/entity/YyyfMoney.java | 2 +- .../yyyf/indicators/IndicatorsUtils.java | 2 +- .../indicators/dto/LastAndFirstAssetsDto.java | 2 +- .../server/yyyf/mapper/AssessUserMapper.java | 6 ++-- .../yyyf/mapper/AssessUserTargetMapper.java | 4 +-- .../server/yyyf/mapper/YyyfMoneyMapper.java | 2 +- .../yyyf/service/AssessUserService.java | 16 +++++----- .../yyyf/service/AssessUserTargetService.java | 2 +- .../service/impl/AssessUserServiceImpl.java | 4 +-- .../server/yyyf/utils/HttpClientUtil.java | 2 +- .../server/yyyf/utils/IdGenerator.java | 2 +- 28 files changed, 97 insertions(+), 47 deletions(-) diff --git a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java index ccf5628..86d0762 100644 --- a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java +++ b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java @@ -1,7 +1,7 @@ package com.blockchain.common.base.constant; /** - * @author huan.xu + * @author haotian * @version 1.0 * @className CaseConstant * @description diff --git a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/dto/YyyfUserDto.java b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/dto/YyyfUserDto.java index 53973ed..cc66eee 100644 --- a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/dto/YyyfUserDto.java +++ b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/dto/YyyfUserDto.java @@ -7,7 +7,7 @@ import java.math.BigDecimal; import java.util.Map; /** - * @author huan.xu + * @author haotian * @version 1.0 * @className YyyfUserDto * @description diff --git a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java index c70cf07..41b9685 100644 --- a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java +++ b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java @@ -8,7 +8,7 @@ import org.springframework.data.redis.core.RedisTemplate; import javax.servlet.http.HttpServletRequest; /** - * @author huan.xu + * @author haotian * @version 1.0 * @className YyyfUserDto * @description @@ -36,7 +36,7 @@ public class YyyfUserDtoUtils { /** * @description 通过userId获取以渔有方用户信息 - * @author huan.xu + * @author haotian * @date 2020-05-20 15:42:47 * @param [userId, redisTemplate] * @return com.blockchain.common.base.dto.YyyfUserDto diff --git a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/common/enums/EthWalletEnums.java b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/common/enums/EthWalletEnums.java index 11c8c74..4117122 100644 --- a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/common/enums/EthWalletEnums.java +++ b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/common/enums/EthWalletEnums.java @@ -1,6 +1,7 @@ package com.blockchain.server.eth.common.enums; public enum EthWalletEnums { + FREEBALANCE_NOT_ENOUGH(7009, "钱包可用余额不足", "Insufficient balance available in wallet.", "錢包可用餘額不足"), SUCCESS(200, "请求成功", "Request success", ""), RESET_ERROR(7001, "查无初始额度设置,充值失败", "Check no initial limit Settings, recharge failed", "查無初始額度設置,充值失敗"), NO_LOGIN(201, "未登录", "No login", ""), diff --git a/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/AssessUserService.java b/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/AssessUserService.java index 877620e..e73d31e 100644 --- a/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/AssessUserService.java +++ b/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/AssessUserService.java @@ -9,7 +9,7 @@ import java.util.List; /** * @param - * @author huan.xu + * @author haotian * @description 学生用户考核信息表 服务接口类 * @date 2019-10-31 14:36:49 * @return @@ -33,7 +33,7 @@ public interface AssessUserService { /** * @description 插入 - * @author Mr.Xu + * @author * @date 2020-05-13 22:37:12 * @param [assessUser] * @return void @@ -44,7 +44,7 @@ public interface AssessUserService { /** * @description 更新数据 - * @author Mr.Xu + * @author * @date 2020-05-14 22:03:02 * @param [assessUser] * @return void @@ -53,7 +53,7 @@ public interface AssessUserService { /** * @description 根据assessUserId获取答题总表 - * @author Mr.Xu + * @author * @date 2020-06-01 21:51:09 * @param [assessUserId] * @return com.blockchain.server.user.entity.AssessUser diff --git a/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/impl/AssessUserServiceImpl.java b/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/impl/AssessUserServiceImpl.java index 0e876ba..42700c4 100644 --- a/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/impl/AssessUserServiceImpl.java +++ b/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/impl/AssessUserServiceImpl.java @@ -24,7 +24,7 @@ import java.util.Date; import java.util.List; /** - * @author huan.xu + * @author haotian * @version 1.0 * @className AssessUserServiceImpl * @description 学生用户考核信息表 服务实现类 diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java index d0a3f00..f50711b 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java @@ -40,7 +40,7 @@ import java.util.List; import java.util.Map; /** - * @author huan.xu + * @author haotian * @version 1.0 * @className TeachingGradeController * @description 练习、考核成绩Controller @@ -69,7 +69,7 @@ public class TeachingGradeController { /** * @description 教师获取考核概况 - * @author huan.xu + * @author haotian * @date 2020-05-19 10:47:29 * @param [issueId, totalNum, caseId, response] * @return void @@ -148,7 +148,7 @@ public class TeachingGradeController { * @param [issueId, notExamNum] * @return java.util.Map * @description 封装错误率 - * @author huan.xu + * @author haotian * @date 2019-11-08 18:27:22 **/ private Map getWrongStatistics(String issueId, Integer totalNum, List trainCaseTargeList) { @@ -311,7 +311,7 @@ public class TeachingGradeController { * @param [issueId, authorization] * @return java.util.Map * @description 重新成绩同步 - * @author huan.xu + * @author haotian * @date 2019-11-08 18:39:55 **/ @GetMapping("/studyGrade/reSynchroze") @@ -541,7 +541,7 @@ public class TeachingGradeController { * @param [cell, wb, str, startIndex, endIndex] * @return void * @description poi实现单元格中部分字体颜色设定 - * @author huan.xu + * @author haotian * @date 2019-12-10 16:19:48 **/ private void setFontColor(HSSFWorkbook wb, HSSFCell cell, String str, int startIndex, int endIndex) { diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/YyyfMoneyController.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/YyyfMoneyController.java index eb84f82..d8510b0 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/YyyfMoneyController.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/YyyfMoneyController.java @@ -3,7 +3,6 @@ package com.blockchain.server.yyyf.controller; import com.blockchain.common.base.dto.ResultDTO; import com.blockchain.server.yyyf.controller.api.YyyfMoneyApi; import com.blockchain.server.yyyf.dto.TransactResultDto; -import com.blockchain.server.yyyf.entity.YyyfMoney; import com.blockchain.server.yyyf.service.YyyfMoneyService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -19,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; /** - * @author Mr.Xu + * @author * @version 1.0 * @className MoneyController * @description @@ -46,4 +45,32 @@ public class YyyfMoneyController { return ResultDTO.requstSuccess(transactResultDto); } + + + + @PostMapping("/resetDigitWallet") + @ApiOperation(value = YyyfMoneyApi.ResetDigitWallet.METHOD_NAME, + notes = YyyfMoneyApi.ResetDigitWallet.METHOD_NOTE) + public ResultDTO resetDigitWallet(@ApiParam(YyyfMoneyApi.ResetDigitWallet.METHOD_ASSESS_USER_ID) @RequestParam(name = "assessUserId",required =true) String assessUserId, + @ApiParam(YyyfMoneyApi.ResetDigitWallet.METHOD_COIN_NAME) @RequestParam(name = "coinName",required =true)String coinName, + @ApiParam(YyyfMoneyApi.ResetDigitWallet.METHOD_BALANCE) @RequestParam(name = "balance",required =true) BigDecimal balance) { + + boolean result=this.yyyfMoneyService.resetDigitWallet(assessUserId,coinName,balance); + + return ResultDTO.requstSuccess(result); + } + + @PostMapping("/resetWallet") + @ApiOperation(value = YyyfMoneyApi.ResetWallet.METHOD_NAME, + notes = YyyfMoneyApi.ResetWallet.METHOD_NOTE) + public ResultDTO resetWallet(@ApiParam(YyyfMoneyApi.ResetWallet.METHOD_ASSESS_USER_ID) @RequestParam(name = "assessUserId",required =true) String assessUserId, + @ApiParam(YyyfMoneyApi.ResetWallet.METHOD_COIN_NAME) @RequestParam(name = "coinName",required =true)String coinName, + @ApiParam(YyyfMoneyApi.ResetWallet.METHOD_BALANCE) @RequestParam(name = "balance",required =true) BigDecimal balance, + @ApiParam(YyyfMoneyApi.ResetWallet.METHOD_PAY_TYPE) @RequestParam(name = "payType",required =true) String payType, + @ApiParam(YyyfMoneyApi.ResetWallet.METHOD_PAY_MONENY) @RequestParam(name = "payMoney",required =true) BigDecimal payMoney) { + + boolean result=this.yyyfMoneyService.resetWallet(assessUserId,coinName,balance,payType,payMoney); + + return ResultDTO.requstSuccess(result); + } } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/TeachingGradeApi.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/TeachingGradeApi.java index 2d6c6f8..d14795e 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/TeachingGradeApi.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/TeachingGradeApi.java @@ -1,7 +1,7 @@ package com.blockchain.server.yyyf.controller.api; /** - * @author huan.xu + * @author haotian * @version 1.0 * @className TeachingGradeApi * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/YyyfMoneyApi.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/YyyfMoneyApi.java index 733d990..a046cd3 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/YyyfMoneyApi.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/YyyfMoneyApi.java @@ -1,7 +1,7 @@ package com.blockchain.server.yyyf.controller.api; /** - * @author Mr.Xu + * @author * @version 1.0 * @className MoneyApi * @description @@ -17,4 +17,26 @@ public class YyyfMoneyApi { public static final String METHOD_IN="转入币种"; public static final String METHOD_AMOUNT="转入金额"; } + + + + + public static class ResetWallet { + public static final String METHOD_NAME = "法币交易"; + public static final String METHOD_NOTE = "balance为负数是是减少,正数是增加"; + public static final String METHOD_ASSESS_USER_ID= "assessUser的主键ID"; + public static final String METHOD_COIN_NAME="货币名称"; + public static final String METHOD_BALANCE="个数"; + public static final String METHOD_PAY_TYPE = "支付类型"; + public static final String METHOD_PAY_MONENY = "支付金额"; + } + + public static class ResetDigitWallet { + public static final String METHOD_NAME = "充币"; + public static final String METHOD_NOTE = "balance、payMoney为负数是是减少,正数是增加"; + public static final String METHOD_ASSESS_USER_ID= "assessUser的主键ID"; + public static final String METHOD_COIN_NAME="货币名称"; + public static final String METHOD_BALANCE="个数"; + + } } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/AssessUserDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/AssessUserDto.java index 477a664..d7699ca 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/AssessUserDto.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/AssessUserDto.java @@ -8,7 +8,7 @@ import java.io.Serializable; import java.util.List; /** - * @author Mr.Xu + * @author * @version 1.0 * @className AssessUserDto * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDetailsDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDetailsDto.java index c1040d3..abf6e85 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDetailsDto.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDetailsDto.java @@ -10,7 +10,7 @@ import java.io.Serializable; import java.util.List; /** - * @author huan.xu + * @author haotian * @version 1.0 * @className ExamDetailsDto * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/OverviewDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/OverviewDto.java index 8e1cb7a..8ad552f 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/OverviewDto.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/OverviewDto.java @@ -9,7 +9,7 @@ import java.io.Serializable; import java.util.List; /** - * @author huan.xu + * @author haotian * @version 1.0 * @className OverviewDto * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ReExamOverviewDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ReExamOverviewDto.java index 1cfc203..b9e48f1 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ReExamOverviewDto.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ReExamOverviewDto.java @@ -7,7 +7,7 @@ import lombok.Data; import java.io.Serializable; /** - * @author huan.xu + * @author haotian * @version 1.0 * @className ReExamOverviewDto * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/TransactResultDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/TransactResultDto.java index ff25ef9..2fa4bbd 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/TransactResultDto.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/TransactResultDto.java @@ -7,7 +7,7 @@ import lombok.Data; import java.math.BigDecimal; /** - * @author Mr.Xu + * @author * @version 1.0 * @className TransactDto * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/UserTimeMoneyDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/UserTimeMoneyDto.java index 08d6d7e..460b0b1 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/UserTimeMoneyDto.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/UserTimeMoneyDto.java @@ -11,7 +11,7 @@ import java.math.BigDecimal; import java.util.Date; /** - * @author Mr.Xu + * @author * @version 1.0 * @className UserTimeMoneyDto * @description 包含以渔有方userId、本系统userId、开始时间以及各个币种余额情况 diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfStudentAnswerDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfStudentAnswerDto.java index 643c487..11342fa 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfStudentAnswerDto.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfStudentAnswerDto.java @@ -8,7 +8,7 @@ import java.math.BigDecimal; import java.util.Date; /** - * @author Mr.Xu + * @author * @version 1.0 * @className YyyfStudentAnswerDto * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/YyyfMoney.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/YyyfMoney.java index 79ac6df..46eb713 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/YyyfMoney.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/YyyfMoney.java @@ -10,7 +10,7 @@ import java.math.BigDecimal; import java.util.Date; /** - * @author Mr.Xu + * @author * @version 1.0 * @className YyyfMoney * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/IndicatorsUtils.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/IndicatorsUtils.java index a64e434..afb34b9 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/IndicatorsUtils.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/IndicatorsUtils.java @@ -8,7 +8,7 @@ import javax.persistence.EntityExistsException; import java.util.List; /** - * @author huan.xu + * @author haotian * @version 1.0 * @className IndicatorsUtils * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/LastAndFirstAssetsDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/LastAndFirstAssetsDto.java index f97eba6..c308cf1 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/LastAndFirstAssetsDto.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/LastAndFirstAssetsDto.java @@ -1,7 +1,7 @@ package com.blockchain.server.yyyf.indicators.dto; import lombok.Data; /** - * @author huan.xu + * @author haotian * @version 1.0 * @className LastAndFirstAssetsReporterDto * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java index b6cf679..c3fed8e 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java @@ -24,7 +24,7 @@ public interface AssessUserMapper extends Mapper { /** * @description 通过AssessUserDtoLis批量更新AssessUser - * @author Mr.Xu + * @author * @date 2020-05-15 00:08:17 * @param [assessUserDtoList] * @return void @@ -35,7 +35,7 @@ public interface AssessUserMapper extends Mapper { /** * @description 获取未提交的 UserTimeMoneyDto List - * @author Mr.Xu + * @author * @date 2020-06-01 22:05:09 * @param [] * @return java.util.List @@ -44,7 +44,7 @@ public interface AssessUserMapper extends Mapper { /** * @description assessUserId通过assessUserId 获取余额情况 - * @author Mr.Xu + * @author * @date 2020-06-02 21:07:23 * @param [assessUserId] * @return com.blockchain.server.yyyf.dto.UserTimeMoneyDto diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTargetMapper.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTargetMapper.java index 7754f1e..87c46a9 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTargetMapper.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTargetMapper.java @@ -16,7 +16,7 @@ public interface AssessUserTargetMapper extends Mapper { /** * @description 批量插入指标 - * @author Mr.Xu + * @author * @date 2020-05-14 23:24:21 * @param [list] * @return void @@ -29,7 +29,7 @@ public interface AssessUserTargetMapper extends Mapper { /** * @description 批量更新指标库最终答题情况 - * @author Mr.Xu + * @author * @date 2020-06-01 22:54:19 * @param [updateAssessUserTargetList] * @return void diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/YyyfMoneyMapper.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/YyyfMoneyMapper.java index ec6517b..44544af 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/YyyfMoneyMapper.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/YyyfMoneyMapper.java @@ -5,7 +5,7 @@ import org.springframework.stereotype.Repository; import tk.mybatis.mapper.common.Mapper; /** - * @author Mr.Xu + * @author * @version 1.0 * @className YyyfMoneyMapper * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java index 70fa7bd..898ae16 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java @@ -10,7 +10,7 @@ import java.util.List; /** * @param - * @author huan.xu + * @author haotian * @description 学生用户考核信息表 服务接口类 * @date 2019-10-31 14:36:49 * @return @@ -34,7 +34,7 @@ public interface AssessUserService { /** * @description 插入 - * @author Mr.Xu + * @author * @date 2020-05-13 22:37:12 * @param [assessUser] * @return void @@ -43,7 +43,7 @@ public interface AssessUserService { /** * @description 初始化考核数据 - * @author Mr.Xu + * @author * @date 2020-05-14 22:03:38 * @param [assessUser, trainCaseTargeList] * @return void @@ -52,7 +52,7 @@ public interface AssessUserService { /** * @description 更新数据 - * @author Mr.Xu + * @author * @date 2020-05-14 22:03:02 * @param [assessUser] * @return void @@ -61,7 +61,7 @@ public interface AssessUserService { /** * @description 提交事务 - * @author Mr.Xu + * @author * @date 2020-05-14 22:24:29 * @param [assessUserId] * @return void @@ -70,7 +70,7 @@ public interface AssessUserService { /** * @description 批量同步成绩 - * @author Mr.Xu + * @author * @date 2020-05-14 23:21:20 * @param [issueId] * @return void @@ -91,7 +91,7 @@ public interface AssessUserService { /** * @description 获取未提交的 UserTimeMoneyDto List - * @author Mr.Xu + * @author * @date 2020-06-01 22:05:09 * @param [] * @return java.util.List @@ -100,7 +100,7 @@ public interface AssessUserService { /** * @description assessUserId通过assessUserId 获取余额情况 - * @author Mr.Xu + * @author * @date 2020-06-02 21:06:35 * @param [assessUserId] * @return com.blockchain.server.yyyf.dto.UserTimeMoneyDto diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java index 448bc86..cbfe201 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java @@ -35,7 +35,7 @@ public interface AssessUserTargetService{ /** * @description 还原指标表 - * @author Mr.Xu + * @author * @date 2020-06-03 00:05:17 * @param [assessUserId] * @return void 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 8f57522..b7bd533 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 @@ -36,7 +36,7 @@ import java.util.*; import java.util.concurrent.TimeUnit; /** - * @author huan.xu + * @author haotian * @version 1.0 * @className AssessUserServiceImpl * @description 学生用户考核信息表 服务实现类 @@ -308,7 +308,7 @@ public class AssessUserServiceImpl implements AssessUserService { * @param [assessUserTarget, targetResultMap] * @return void * @description 计算是否达标 - * @author Mr.Xu + * @author * @date 2020-06-01 22:49:37 **/ private void answerResultForTarget(AssessUserTarget assessUserTarget, Map targetResultMap) { diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/HttpClientUtil.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/HttpClientUtil.java index 967535a..527ec87 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/HttpClientUtil.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/HttpClientUtil.java @@ -22,7 +22,7 @@ import java.util.List; import java.util.Map; /** - * @author huan.xu + * @author haotian * @version 1.0 * @className HttpClientUtil * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/IdGenerator.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/IdGenerator.java index 1b6a300..b4841b3 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/IdGenerator.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/IdGenerator.java @@ -3,7 +3,7 @@ package com.blockchain.server.yyyf.utils; import java.util.UUID; /** - * @author Mr.Xu + * @author * @version 1.0 * @className IdGenerator * @description From 2298799078560e45fb03ff9e5a76db26246b44e0 Mon Sep 17 00:00:00 2001 From: unclekh <5177787+unclekh@user.noreply.gitee.com> Date: Sun, 12 Jul 2020 23:29:04 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blockchain/common/base/constant/YyyfConstant.java | 2 +- .../com/blockchain/common/base/dto/YyyfUserDto.java | 2 +- .../blockchain/common/base/util/YyyfUserDtoUtils.java | 4 ++-- .../server/user/service/AssessUserService.java | 2 +- .../user/service/impl/AssessUserServiceImpl.java | 2 +- .../yyyf/controller/TeachingGradeController.java | 10 +++++----- .../server/yyyf/controller/api/TeachingGradeApi.java | 2 +- .../com/blockchain/server/yyyf/dto/ExamDetailsDto.java | 2 +- .../com/blockchain/server/yyyf/dto/OverviewDto.java | 2 +- .../blockchain/server/yyyf/dto/ReExamOverviewDto.java | 2 +- .../server/yyyf/indicators/IndicatorsUtils.java | 2 +- .../yyyf/indicators/dto/LastAndFirstAssetsDto.java | 2 +- .../server/yyyf/service/AssessUserService.java | 2 +- .../yyyf/service/impl/AssessUserServiceImpl.java | 2 +- .../com/blockchain/server/yyyf/task/ScheduleTask.java | 2 +- .../blockchain/server/yyyf/utils/HttpClientUtil.java | 2 +- 16 files changed, 21 insertions(+), 21 deletions(-) diff --git a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java index 86d0762..83b9a5e 100644 --- a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java +++ b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java @@ -1,7 +1,7 @@ package com.blockchain.common.base.constant; /** - * @author haotian + * @author zijie * @version 1.0 * @className CaseConstant * @description diff --git a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/dto/YyyfUserDto.java b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/dto/YyyfUserDto.java index cc66eee..9950658 100644 --- a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/dto/YyyfUserDto.java +++ b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/dto/YyyfUserDto.java @@ -7,7 +7,7 @@ import java.math.BigDecimal; import java.util.Map; /** - * @author haotian + * @author zijie * @version 1.0 * @className YyyfUserDto * @description diff --git a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java index 41b9685..fefb1aa 100644 --- a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java +++ b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java @@ -8,7 +8,7 @@ import org.springframework.data.redis.core.RedisTemplate; import javax.servlet.http.HttpServletRequest; /** - * @author haotian + * @author zijie * @version 1.0 * @className YyyfUserDto * @description @@ -36,7 +36,7 @@ public class YyyfUserDtoUtils { /** * @description 通过userId获取以渔有方用户信息 - * @author haotian + * @author zijie * @date 2020-05-20 15:42:47 * @param [userId, redisTemplate] * @return com.blockchain.common.base.dto.YyyfUserDto diff --git a/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/AssessUserService.java b/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/AssessUserService.java index e73d31e..d1278ca 100644 --- a/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/AssessUserService.java +++ b/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/AssessUserService.java @@ -9,7 +9,7 @@ import java.util.List; /** * @param - * @author haotian + * @author zijie * @description 学生用户考核信息表 服务接口类 * @date 2019-10-31 14:36:49 * @return diff --git a/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/impl/AssessUserServiceImpl.java b/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/impl/AssessUserServiceImpl.java index 42700c4..ed71427 100644 --- a/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/impl/AssessUserServiceImpl.java +++ b/blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/impl/AssessUserServiceImpl.java @@ -24,7 +24,7 @@ import java.util.Date; import java.util.List; /** - * @author haotian + * @author zijie * @version 1.0 * @className AssessUserServiceImpl * @description 学生用户考核信息表 服务实现类 diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java index f50711b..b41c2b5 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java @@ -40,7 +40,7 @@ import java.util.List; import java.util.Map; /** - * @author haotian + * @author zijie * @version 1.0 * @className TeachingGradeController * @description 练习、考核成绩Controller @@ -69,7 +69,7 @@ public class TeachingGradeController { /** * @description 教师获取考核概况 - * @author haotian + * @author zijie * @date 2020-05-19 10:47:29 * @param [issueId, totalNum, caseId, response] * @return void @@ -148,7 +148,7 @@ public class TeachingGradeController { * @param [issueId, notExamNum] * @return java.util.Map * @description 封装错误率 - * @author haotian + * @author zijie * @date 2019-11-08 18:27:22 **/ private Map getWrongStatistics(String issueId, Integer totalNum, List trainCaseTargeList) { @@ -311,7 +311,7 @@ public class TeachingGradeController { * @param [issueId, authorization] * @return java.util.Map * @description 重新成绩同步 - * @author haotian + * @author zijie * @date 2019-11-08 18:39:55 **/ @GetMapping("/studyGrade/reSynchroze") @@ -541,7 +541,7 @@ public class TeachingGradeController { * @param [cell, wb, str, startIndex, endIndex] * @return void * @description poi实现单元格中部分字体颜色设定 - * @author haotian + * @author zijie * @date 2019-12-10 16:19:48 **/ private void setFontColor(HSSFWorkbook wb, HSSFCell cell, String str, int startIndex, int endIndex) { diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/TeachingGradeApi.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/TeachingGradeApi.java index d14795e..3240676 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/TeachingGradeApi.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/TeachingGradeApi.java @@ -1,7 +1,7 @@ package com.blockchain.server.yyyf.controller.api; /** - * @author haotian + * @author zijie * @version 1.0 * @className TeachingGradeApi * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDetailsDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDetailsDto.java index abf6e85..65bddf9 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDetailsDto.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDetailsDto.java @@ -10,7 +10,7 @@ import java.io.Serializable; import java.util.List; /** - * @author haotian + * @author zijie * @version 1.0 * @className ExamDetailsDto * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/OverviewDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/OverviewDto.java index 8ad552f..4172842 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/OverviewDto.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/OverviewDto.java @@ -9,7 +9,7 @@ import java.io.Serializable; import java.util.List; /** - * @author haotian + * @author zijie * @version 1.0 * @className OverviewDto * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ReExamOverviewDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ReExamOverviewDto.java index b9e48f1..811550e 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ReExamOverviewDto.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ReExamOverviewDto.java @@ -7,7 +7,7 @@ import lombok.Data; import java.io.Serializable; /** - * @author haotian + * @author zijie * @version 1.0 * @className ReExamOverviewDto * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/IndicatorsUtils.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/IndicatorsUtils.java index afb34b9..f67bee7 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/IndicatorsUtils.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/IndicatorsUtils.java @@ -8,7 +8,7 @@ import javax.persistence.EntityExistsException; import java.util.List; /** - * @author haotian + * @author zijie * @version 1.0 * @className IndicatorsUtils * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/LastAndFirstAssetsDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/LastAndFirstAssetsDto.java index c308cf1..a5f4f26 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/LastAndFirstAssetsDto.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/LastAndFirstAssetsDto.java @@ -1,7 +1,7 @@ package com.blockchain.server.yyyf.indicators.dto; import lombok.Data; /** - * @author haotian + * @author zijie * @version 1.0 * @className LastAndFirstAssetsReporterDto * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java index 898ae16..018f047 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java @@ -10,7 +10,7 @@ import java.util.List; /** * @param - * @author haotian + * @author zijie * @description 学生用户考核信息表 服务接口类 * @date 2019-10-31 14:36:49 * @return 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 b7bd533..935af93 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 @@ -36,7 +36,7 @@ import java.util.*; import java.util.concurrent.TimeUnit; /** - * @author haotian + * @author zijie * @version 1.0 * @className AssessUserServiceImpl * @description 学生用户考核信息表 服务实现类 diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/task/ScheduleTask.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/task/ScheduleTask.java index 4ce757c..ad2610b 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/task/ScheduleTask.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/task/ScheduleTask.java @@ -18,7 +18,7 @@ import java.util.Map; import java.util.Set; /** - * @author Mr.Xu + * @author * @version 1.0 * @className ScheduleTask * @description diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/HttpClientUtil.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/HttpClientUtil.java index 527ec87..4ccdf24 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/HttpClientUtil.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/HttpClientUtil.java @@ -22,7 +22,7 @@ import java.util.List; import java.util.Map; /** - * @author haotian + * @author zijie * @version 1.0 * @className HttpClientUtil * @description From aeec182834303aff80020909232b1f0822aa0029 Mon Sep 17 00:00:00 2001 From: unclekh <5177787+unclekh@user.noreply.gitee.com> Date: Sun, 12 Jul 2020 23:31:05 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=85=85=E5=B8=81=E3=80=81=E6=B3=95?= =?UTF-8?q?=E5=B8=81=E4=BA=A4=E6=98=93=E5=90=8E=E5=8F=B0=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/btc/feign/YyyyfMoneyFeign.java | 22 ++ .../service/impl/BtcWalletServiceImpl.java | 20 +- .../inner/CurrencyMarketInnerController.java | 9 +- .../inner/api/CurrencyMarketInnerApi.java | 6 + .../eos/common/enums/EosWalletEnums.java | 2 +- .../server/eos/feign/YyyyfMoneyFeign.java | 22 ++ .../service/impl/EosWalletServiceImpl.java | 25 ++- .../server/eth/feign/YyyyfMoneyFeign.java | 22 ++ .../service/impl/EthWalletServiceImpl.java | 22 +- .../server/otc/common/enums/OtcEnums.java | 2 + .../server/otc/feign/YyyyfMoneyFeign.java | 24 +++ .../otc/service/impl/OrderServiceImpl.java | 61 ++++-- .../server/yyyf/feign/CurrencyFeign.java | 4 + .../server/yyyf/service/YyyfMoneyService.java | 27 ++- .../service/impl/YyyfMoneyServiceImpl.java | 203 +++++++++++++++++- 15 files changed, 434 insertions(+), 37 deletions(-) create mode 100644 blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/feign/YyyyfMoneyFeign.java create mode 100644 blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/feign/YyyyfMoneyFeign.java create mode 100644 blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/feign/YyyyfMoneyFeign.java create mode 100644 blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/feign/YyyyfMoneyFeign.java diff --git a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/feign/YyyyfMoneyFeign.java b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/feign/YyyyfMoneyFeign.java new file mode 100644 index 0000000..df84375 --- /dev/null +++ b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/feign/YyyyfMoneyFeign.java @@ -0,0 +1,22 @@ +package com.blockchain.server.btc.feign; + +import com.blockchain.common.base.dto.ResultDTO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.math.BigDecimal; + +/** + * @author zijie + * @version 1.0 + * @className YyyyfMoneyFeign + * @description + * @date 2020-07-07 20:31 + */ +@FeignClient("dapp-yyyf-server") +public interface YyyyfMoneyFeign { + + @GetMapping("/yyyfMoney/resetDigitWallet") + ResultDTO resetDigitWallet(@RequestParam("assessUserId") String assessUserId, @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance); +} diff --git a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java index 9b5ab60..c615117 100644 --- a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java +++ b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java @@ -1,5 +1,8 @@ package com.blockchain.server.btc.service.impl; +import com.blockchain.common.base.dto.ResultDTO; +import com.blockchain.common.base.dto.YyyfUserDto; +import com.blockchain.common.base.util.YyyfUserDtoUtils; import com.blockchain.server.btc.common.constants.BtcTransferConstans; import com.blockchain.server.btc.common.enums.BtcEnums; import com.blockchain.server.btc.common.exception.BtcException; @@ -10,6 +13,7 @@ import com.blockchain.server.btc.entity.BtcToken; import com.blockchain.server.btc.entity.BtcWallet; import com.blockchain.server.btc.entity.BtcWalletTransfer; import com.blockchain.server.btc.entity.WalletInitConfig; +import com.blockchain.server.btc.feign.YyyyfMoneyFeign; import com.blockchain.server.btc.mapper.BtcWalletMapper; import com.blockchain.server.btc.mapper.WalletInitConfigMapper; import com.blockchain.server.btc.service.BtcApplicationService; @@ -17,6 +21,7 @@ import com.blockchain.server.btc.service.BtcTokenService; import com.blockchain.server.btc.service.BtcWalletService; import com.blockchain.server.btc.service.BtcWalletTransferService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -43,6 +48,12 @@ public class BtcWalletServiceImpl implements BtcWalletService { @Autowired private WalletInitConfigMapper walletInitConfigMapper; + @Autowired + private YyyyfMoneyFeign yyyyfMoneyFeign; + + @Autowired + private RedisTemplate redisTemplate; + @Override @Transactional public Integer insertWallet(String userOpenId) { @@ -204,7 +215,14 @@ public class BtcWalletServiceImpl implements BtcWalletService { if (config == null || config.getBalance() == null) { throw new BtcException(BtcEnums.RESET_ERROR); } - btcWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(), userOpenId, tokenId, walletType, new Date()); + YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userOpenId, redisTemplate); + ResultDTO resultDTO = yyyyfMoneyFeign.resetDigitWallet(yyyfUserDto.getAssessUserId(), tokenId, BigDecimal.ZERO.subtract(config.getBalance())); + + if(resultDTO.getCode()==200 && resultDTO.getData().booleanValue()){ + btcWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(), userOpenId, tokenId, walletType, new Date()); + }else { + throw new BtcException(BtcEnums.FREEBALANCE_NOT_ENOUGH); + } return 1; } 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 57626c2..ba9e4a9 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 @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; -import java.util.Date; import java.util.List; @Api(CurrencyMarketInnerApi.MARKET_CONTROLLER_API) @@ -43,4 +42,12 @@ public class CurrencyMarketInnerController { return currencyMarketService.getList(); } + + @ApiOperation(value = CurrencyMarketInnerApi.Get.METHOD_API_NAME, + notes = CurrencyMarketInnerApi.Get.METHOD_API_NOTE) + @RequestMapping(value = "/get", method = RequestMethod.GET) + public CurrencyMarketDTO get( + @ApiParam(CurrencyMarketInnerApi.Get.METHOD_API_CURRENCY_PAIR) String currencyPair) { + return currencyMarketService.get(currencyPair); + } } diff --git a/blockchain-server/blockchain-server-currency/src/main/java/com/blockchain/server/currency/inner/api/CurrencyMarketInnerApi.java b/blockchain-server/blockchain-server-currency/src/main/java/com/blockchain/server/currency/inner/api/CurrencyMarketInnerApi.java index 488a448..0810c01 100644 --- a/blockchain-server/blockchain-server-currency/src/main/java/com/blockchain/server/currency/inner/api/CurrencyMarketInnerApi.java +++ b/blockchain-server/blockchain-server-currency/src/main/java/com/blockchain/server/currency/inner/api/CurrencyMarketInnerApi.java @@ -14,4 +14,10 @@ public class CurrencyMarketInnerApi { public static final String METHOD_API_TRADINGTYPE = "成交类型"; } + public static class Get { + public static final String METHOD_API_NAME = "最新行情"; + public static final String METHOD_API_NOTE = "获取数字货币最新行情"; + public static final String METHOD_API_CURRENCY_PAIR = "数字货币对"; + } + } diff --git a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/common/enums/EosWalletEnums.java b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/common/enums/EosWalletEnums.java index 6acc7ee..b8770ea 100644 --- a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/common/enums/EosWalletEnums.java +++ b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/common/enums/EosWalletEnums.java @@ -19,7 +19,7 @@ public enum EosWalletEnums { CURRENCY_FAILURE_ERROR(7008, "出币失败", "Currency failure.", "出幣失敗"), INEXISTENCE_TX(12500, "该记录未找到", "The record was not found", "該記錄未找到"), INEXISTENCE_WALLET(7017, "该钱包不存在", "The wallet does not exist.", "該錢包不存在"), - + FREEBALANCE_NOT_ENOUGH(7009, "钱包可用余额不足", "Insufficient balance available in wallet.", "錢包可用餘額不足") ; diff --git a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/feign/YyyyfMoneyFeign.java b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/feign/YyyyfMoneyFeign.java new file mode 100644 index 0000000..f1e04a4 --- /dev/null +++ b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/feign/YyyyfMoneyFeign.java @@ -0,0 +1,22 @@ +package com.blockchain.server.eos.feign; + +import com.blockchain.common.base.dto.ResultDTO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.math.BigDecimal; + +/** + * @author + * @version 1.0 + * @className YyyyfMoneyFeign + * @description + * @date 2020-07-07 20:31 + */ +@FeignClient("dapp-yyyf-server") +public interface YyyyfMoneyFeign { + + @GetMapping("/yyyfMoney/resetDigitWallet") + ResultDTO resetDigitWallet(@RequestParam("assessUserId") String assessUserId, @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance); +} diff --git a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/service/impl/EosWalletServiceImpl.java b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/service/impl/EosWalletServiceImpl.java index a4e349c..c295f59 100644 --- a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/service/impl/EosWalletServiceImpl.java +++ b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/service/impl/EosWalletServiceImpl.java @@ -1,12 +1,10 @@ package com.blockchain.server.eos.service.impl; import com.blockchain.common.base.constant.BaseConstant; -import com.blockchain.common.base.dto.GasDTO; -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.dto.*; import com.blockchain.common.base.exception.RPCException; import com.blockchain.common.base.util.ExceptionPreconditionUtils; +import com.blockchain.common.base.util.YyyfUserDtoUtils; import com.blockchain.server.eos.common.constant.EosConstant; import com.blockchain.server.eos.common.enums.EosWalletEnums; import com.blockchain.server.eos.common.exception.EosWalletException; @@ -14,11 +12,13 @@ import com.blockchain.server.eos.dto.WalletDTO; import com.blockchain.server.eos.entity.*; import com.blockchain.server.eos.feign.UserServerFegin; import com.blockchain.server.eos.feign.WalletTransferFegin; +import com.blockchain.server.eos.feign.YyyyfMoneyFeign; import com.blockchain.server.eos.mapper.WalletInitConfigMapper; import com.blockchain.server.eos.mapper.WalletMapper; import com.blockchain.server.eos.service.*; import com.codingapi.tx.annotation.ITxTransaction; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; @@ -55,6 +55,11 @@ public class EosWalletServiceImpl implements EosWalletService, ITxTransaction { @Autowired private WalletInitConfigMapper walletInitConfigMapper; + @Autowired + private YyyyfMoneyFeign yyyyfMoneyFeign; + + @Autowired + private RedisTemplate redisTemplate; /** * 用户充值修改钱包金额 * @@ -387,8 +392,16 @@ public class EosWalletServiceImpl implements EosWalletService, ITxTransaction { if (config == null || config.getBalance() == null) { throw new EosWalletException(EosWalletEnums.RESET_ERROR); } - // 修改钱包插入充值记录 - walletMapper.updateWalletBalanceByUserOpenId(config.getBalance(), userOpenId, tokenId, walletType, new Date()); + YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userOpenId, redisTemplate); + ResultDTO resultDTO = yyyyfMoneyFeign.resetDigitWallet(yyyfUserDto.getAssessUserId(), tokenId, BigDecimal.ZERO.subtract(config.getBalance())); + if(resultDTO.getCode()==200 && resultDTO.getData().booleanValue()){ + // 修改钱包插入充值记录 + walletMapper.updateWalletBalanceByUserOpenId(config.getBalance(), userOpenId, tokenId, walletType, new Date()); + }else { + throw new EosWalletException(EosWalletEnums.FREEBALANCE_NOT_ENOUGH); + } + + } } diff --git a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/feign/YyyyfMoneyFeign.java b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/feign/YyyyfMoneyFeign.java new file mode 100644 index 0000000..7d305bf --- /dev/null +++ b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/feign/YyyyfMoneyFeign.java @@ -0,0 +1,22 @@ +package com.blockchain.server.eth.feign; + +import com.blockchain.common.base.dto.ResultDTO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.math.BigDecimal; + +/** + * @author + * @version 1.0 + * @className YyyyfMoneyFeign + * @description + * @date 2020-07-07 20:31 + */ +@FeignClient("dapp-yyyf-server") +public interface YyyyfMoneyFeign { + + @GetMapping("/yyyfMoney/resetDigitWallet") + ResultDTO resetDigitWallet(@RequestParam("assessUserId") String assessUserId, @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance); +} diff --git a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java index b09b5d2..f0b83d0 100644 --- a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java +++ b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java @@ -2,12 +2,10 @@ package com.blockchain.server.eth.service.impl; import com.blockchain.common.base.constant.BaseConstant; -import com.blockchain.common.base.dto.GasDTO; -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.dto.*; import com.blockchain.common.base.exception.RPCException; import com.blockchain.common.base.util.ExceptionPreconditionUtils; +import com.blockchain.common.base.util.YyyfUserDtoUtils; import com.blockchain.server.eth.common.constants.EthWalletConstants; import com.blockchain.server.eth.common.enums.EthWalletEnums; import com.blockchain.server.eth.common.exception.EthWalletException; @@ -18,6 +16,7 @@ import com.blockchain.server.eth.dto.EthWalletDTO; import com.blockchain.server.eth.dto.Web3jTransferDTO; import com.blockchain.server.eth.entity.*; import com.blockchain.server.eth.feign.UserFeign; +import com.blockchain.server.eth.feign.YyyyfMoneyFeign; import com.blockchain.server.eth.mapper.EthWalletMapper; import com.blockchain.server.eth.mapper.WalletInitConfigMapper; import com.blockchain.server.eth.service.*; @@ -62,6 +61,10 @@ public class EthWalletServiceImpl implements IEthWalletService, ITxTransaction { IWalletWeb3j walletWeb3j; @Autowired RedisTemplate redisTemplate; + + @Autowired + private YyyyfMoneyFeign yyyyfMoneyFeign; + @Autowired private WalletInitConfigMapper walletInitConfigMapper; @@ -435,7 +438,16 @@ public class EthWalletServiceImpl implements IEthWalletService, ITxTransaction { if(config==null || config.getBalance()==null){ throw new EthWalletException(EthWalletEnums.RESET_ERROR); } - ethWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date()); + YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userOpenId, redisTemplate); + ResultDTO resultDTO = yyyyfMoneyFeign.resetDigitWallet(yyyfUserDto.getAssessUserId(), tokenId, BigDecimal.ZERO.subtract(config.getBalance())); + + if(resultDTO.getCode()==200 && resultDTO.getData().booleanValue()){ + ethWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date()); + }else { + throw new EthWalletException(EthWalletEnums.FREEBALANCE_NOT_ENOUGH); + } + + } diff --git a/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/common/enums/OtcEnums.java b/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/common/enums/OtcEnums.java index f9ca476..b17d1a1 100644 --- a/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/common/enums/OtcEnums.java +++ b/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/common/enums/OtcEnums.java @@ -3,6 +3,8 @@ package com.blockchain.server.otc.common.enums; import lombok.Getter; public enum OtcEnums { + FREEBALANCE_NOT_ENOUGH(7009, "钱包可用余额不足", "Insufficient balance available in wallet."), + ERROR_IN_WALLET_CALL(7010, "钱包调用出错,钱包余额不足或者系统错误", "Wallet call error, insufficient wallet balance or system error"), PASS_NULL(8701, "请输入密码!", "Please enter password!"), USERID_NULL(8702, "用户id为空!", "User id is empty!"), PUBLISH_AD_COIN_NULL(8703, "请选择交易货币!", "Please select the currency of exchange!"), diff --git a/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/feign/YyyyfMoneyFeign.java b/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/feign/YyyyfMoneyFeign.java new file mode 100644 index 0000000..fd12e37 --- /dev/null +++ b/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/feign/YyyyfMoneyFeign.java @@ -0,0 +1,24 @@ +package com.blockchain.server.otc.feign; + +import com.blockchain.common.base.dto.ResultDTO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.math.BigDecimal; + +/** + * @author + * @version 1.0 + * @className YyyyfMoneyFeign + * @description + * @date 2020-07-07 20:31 + */ +@FeignClient("dapp-yyyf-server") +public interface YyyyfMoneyFeign { + + @GetMapping("/yyyfMoney/resetWallet") + ResultDTO resetWallet(@RequestParam("assessUserId") String assessUserId, + @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance, + @RequestParam("String")String payType, @RequestParam("payMoney")BigDecimal payMoney); +} diff --git a/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/service/impl/OrderServiceImpl.java b/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/service/impl/OrderServiceImpl.java index 7cb0209..18615ce 100644 --- a/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/service/impl/OrderServiceImpl.java +++ b/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/service/impl/OrderServiceImpl.java @@ -2,7 +2,9 @@ package com.blockchain.server.otc.service.impl; import com.blockchain.common.base.constant.PushConstants; import com.blockchain.common.base.dto.ResultDTO; +import com.blockchain.common.base.dto.YyyfUserDto; import com.blockchain.common.base.enums.PushEnums; +import com.blockchain.common.base.util.YyyfUserDtoUtils; import com.blockchain.server.otc.common.constant.*; import com.blockchain.server.otc.common.enums.*; import com.blockchain.server.otc.common.exception.OtcException; @@ -13,6 +15,7 @@ import com.blockchain.server.otc.dto.user.UserBaseDTO; import com.blockchain.server.otc.entity.*; import com.blockchain.server.otc.feign.PushFeign; import com.blockchain.server.otc.feign.UserFeign; +import com.blockchain.server.otc.feign.YyyyfMoneyFeign; import com.blockchain.server.otc.mapper.OrderMapper; import com.blockchain.server.otc.redis.OrderCache; import com.blockchain.server.otc.service.*; @@ -21,6 +24,7 @@ import com.codingapi.tx.annotation.TxTransaction; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -60,6 +64,10 @@ public class OrderServiceImpl implements OrderService, ITxTransaction { private ImUtil imUtil; @Autowired private OrderCache orderCache; + @Autowired + private YyyyfMoneyFeign yyyyfMoneyFeign; + @Autowired + private RedisTemplate redisTemplate; private static final BigDecimal DECIMAL_DISH = new BigDecimal("0.1"); //下单金额计算的偏差值 @@ -278,6 +286,13 @@ public class OrderServiceImpl implements OrderService, ITxTransaction { checkPayTypeIsAdPayType(payType, ad.getAdPay()); //确认支付时,设置订单支付信息 order.setOrderPayType(payType); + + + YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userId, redisTemplate); + ResultDTO resultDTO = yyyyfMoneyFeign.resetWallet(yyyfUserDto.getAssessUserId(), order.getCoinName(),order.getAmount(),payType,BigDecimal.ZERO.subtract(order.getTurnover())); + + + if(resultDTO.getCode()==200 && resultDTO.getData().booleanValue()) { //更新订单状态 receiptOrPayUpdateOrder(order, UserHandleConstants.PAY); //记录用户操作 @@ -287,6 +302,11 @@ public class OrderServiceImpl implements OrderService, ITxTransaction { order.getSellUserId(), order.getBuyUserId(), order.getId()); //发送手机消息通知 pushToSingle(order.getSellUserId(), order.getId(), PushEnums.OTC_ORDER_PAY.getPushType()); + }else{ + throw new OtcException(OtcEnums.FREEBALANCE_NOT_ENOUGH); + } + + } @Override @@ -303,21 +323,32 @@ public class OrderServiceImpl implements OrderService, ITxTransaction { checkOrderNull(order); //检查订单能否确认收款 checkOrderCanHandle(order, userId, UserHandleConstants.RECEIPT); - //更新订单状态 - receiptOrPayUpdateOrder(order, UserHandleConstants.RECEIPT); - //记录用户操作 - insertUserHandleLog(userId, order.getOrderNumber(), UserHandleConstants.RECEIPT); - //更新广告发布方成交统计数据 - updateAdUserDealStats(order); - //更新余额并记录资金变动 - receiptUpdateBalance(order); - //判断广告是否可以结束 - checkAdCanFinish(order.getAdId()); - //确认收款发送提示消息 - sendNewOrderMsg(JgMsgEnums.CONFIRM_SELLER_SELL.getName(), JgMsgEnums.CONFIRM_SELLER_BUY.getName(), - order.getSellUserId(), order.getBuyUserId(), order.getId()); - //发送手机消息通知 - pushToSingle(order.getBuyUserId(), order.getId(), PushEnums.OTC_ORDER_RECEIPT.getPushType()); + + + + YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userId, redisTemplate); + ResultDTO resultDTO = yyyyfMoneyFeign.resetWallet(yyyfUserDto.getAssessUserId(), order.getCoinName(),BigDecimal.ZERO.subtract(order.getAmount()),order.getOrderPayType(),order.getTurnover()); + if(resultDTO.getCode()==200 && resultDTO.getData().booleanValue()) { + + + //更新订单状态 + receiptOrPayUpdateOrder(order, UserHandleConstants.RECEIPT); + //记录用户操作 + insertUserHandleLog(userId, order.getOrderNumber(), UserHandleConstants.RECEIPT); + //更新广告发布方成交统计数据 + updateAdUserDealStats(order); + //更新余额并记录资金变动 + receiptUpdateBalance(order); + //判断广告是否可以结束 + checkAdCanFinish(order.getAdId()); + //确认收款发送提示消息 + sendNewOrderMsg(JgMsgEnums.CONFIRM_SELLER_SELL.getName(), JgMsgEnums.CONFIRM_SELLER_BUY.getName(), + order.getSellUserId(), order.getBuyUserId(), order.getId()); + //发送手机消息通知 + pushToSingle(order.getBuyUserId(), order.getId(), PushEnums.OTC_ORDER_RECEIPT.getPushType()); + }else{ + throw new OtcException(OtcEnums.ERROR_IN_WALLET_CALL); + } } @Override diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/CurrencyFeign.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/CurrencyFeign.java index 01a2bd8..bc4383c 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/CurrencyFeign.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/CurrencyFeign.java @@ -3,6 +3,7 @@ package com.blockchain.server.yyyf.feign; import com.blockchain.server.yyyf.feign.dto.CurrencyMarketDTO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; import java.util.List; @@ -10,4 +11,7 @@ import java.util.List; public interface CurrencyFeign { @GetMapping("/inner/market/getList") List getList(); + + @GetMapping("/inner/market/get") + CurrencyMarketDTO get(@RequestParam("currencyPair") String currencyPair); } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/YyyfMoneyService.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/YyyfMoneyService.java index 80098de..a970321 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/YyyfMoneyService.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/YyyfMoneyService.java @@ -8,7 +8,7 @@ import java.math.BigDecimal; public interface YyyfMoneyService { /** * @description 交易转账 - * @author Mr.Xu + * @author zijie * @date 2020-05-26 21:51:15 * @param [assessUserId, out, in, amount] * @return com.blockchain.server.yyyf.dto.TransactResultDto @@ -18,7 +18,7 @@ public interface YyyfMoneyService { /** * @description 插入 - * @author Mr.Xu + * @author zijie * @date 2020-05-26 22:48:08 * @param [yyyfMoney] * @return void @@ -27,10 +27,31 @@ public interface YyyfMoneyService { /** * @description 更新 - * @author Mr.Xu + * @author zijie * @date 2020-05-26 22:48:19 * @param [yyyfMoney] * @return void **/ void update(YyyfMoney yyyfMoney); + + + + + /** + * @description 充币、提币 + * @author zijie + * @date 2020-07-12 22:45:43 + * @param [assessUserId, coinName, balance] + * @return boolean + **/ + boolean resetDigitWallet(String assessUserId, String coinName, BigDecimal balance); + + /** + * @description 法币交易 + * @author zijie + * @date 2020-07-12 22:46:21 + * @param [assessUserId, coinName, balance, payType, payMoney] + * @return boolean + **/ + boolean resetWallet(String assessUserId, String coinName, BigDecimal balance, String payType, BigDecimal payMoney); } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/YyyfMoneyServiceImpl.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/YyyfMoneyServiceImpl.java index 4845280..3de3e69 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/YyyfMoneyServiceImpl.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/YyyfMoneyServiceImpl.java @@ -7,15 +7,18 @@ import com.blockchain.server.yyyf.exceprion.YyyfException; import com.blockchain.server.yyyf.mapper.YyyfMoneyMapper; import com.blockchain.server.yyyf.service.YyyfMoneyService; import lombok.SneakyThrows; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.lang.reflect.Method; import java.math.BigDecimal; +import java.util.Date; /** - * @author Mr.Xu + * @author zijie * @version 1.0 * @className YyyfMoneyServiceImpl * @description @@ -25,10 +28,13 @@ import java.math.BigDecimal; @Service public class YyyfMoneyServiceImpl implements YyyfMoneyService { + private Logger logger = LoggerFactory.getLogger(YyyfMoneyServiceImpl.class); @Autowired private YyyfMoneyMapper yyyfMoneyMapper; + /* @Autowired + private CurrencyFeign currencyFeign;*/ @SneakyThrows @Override @@ -58,11 +64,11 @@ public class YyyfMoneyServiceImpl implements YyyfMoneyService { //转入币种后的余额 BigDecimal inSurplus = inOriginal.add(amount); - Method outSetMethod = aClass.getMethod("set".concat(outField),BigDecimal.class); - Method inSetMethod = aClass.getMethod("set".concat(inField),BigDecimal.class); + Method outSetMethod = aClass.getMethod("set".concat(outField), BigDecimal.class); + Method inSetMethod = aClass.getMethod("set".concat(inField), BigDecimal.class); - outSetMethod.invoke(yyyfMoney,outSurplus); - inSetMethod.invoke(yyyfMoney,inSurplus); + outSetMethod.invoke(yyyfMoney, outSurplus); + inSetMethod.invoke(yyyfMoney, inSurplus); this.yyyfMoneyMapper.updateByPrimaryKeySelective(yyyfMoney); @@ -89,4 +95,191 @@ public class YyyfMoneyServiceImpl implements YyyfMoneyService { public void update(YyyfMoney yyyfMoney) { this.yyyfMoneyMapper.updateByPrimaryKeySelective(yyyfMoney); } + + @Override + public boolean resetDigitWallet(String assessUserId, String coinName, BigDecimal balance) { + + YyyfMoney yyyfMoney = this.yyyfMoneyMapper.selectByPrimaryKey(assessUserId); + BigDecimal add =BigDecimal.ZERO; + switch (coinName) { + case"ZFB":{ + add = yyyfMoney.getAliPay().add(balance); + yyyfMoney.setAliPay(add); + break; + } + case"WX":{ + add= yyyfMoney.getWxPay().add(balance); + yyyfMoney.setWxPay(add); + break; + } + case"BANK":{ + add = yyyfMoney.getBankCard().add(balance); + yyyfMoney.setBankCard(add); + break; + } + case "btc": { + add = yyyfMoney.getBtc().add(balance); + yyyfMoney.setBtc(add); + break; + } + case "usdt": { + add = yyyfMoney.getUsdt().add(balance); + yyyfMoney.setUsdt(add); + + break; + } + case "eth": { + add = yyyfMoney.getEth().add(balance); + yyyfMoney.setEth(add); + break; + } + case "eos": { + add = yyyfMoney.getEos().add(balance); + yyyfMoney.setEos(add); + break; + } + default: + add=BigDecimal.ZERO.subtract(BigDecimal.ONE); + } + if(add.compareTo(BigDecimal.ZERO)==-1){ + return false; + }else{ + yyyfMoney.setUpdateTime(new Date()); + this.yyyfMoneyMapper.updateByPrimaryKeySelective(yyyfMoney); + } + return true; + } + + @Override + public boolean resetWallet(String assessUserId, String coinName, BigDecimal balance, String payType, BigDecimal payMoney) { + YyyfMoney yyyfMoney = this.yyyfMoneyMapper.selectByPrimaryKey(assessUserId); + BigDecimal coninAdd =BigDecimal.ZERO; + switch (coinName) { + case "btc": { + coninAdd = yyyfMoney.getBtc().add(balance); + yyyfMoney.setBtc(coninAdd); + break; + } + case "usdt": { + coninAdd = yyyfMoney.getUsdt().add(balance); + yyyfMoney.setUsdt(coninAdd); + + break; + } + case "eth": { + coninAdd = yyyfMoney.getEth().add(balance); + yyyfMoney.setEth(coninAdd); + break; + } + case "eos": { + coninAdd = yyyfMoney.getEos().add(balance); + yyyfMoney.setEos(coninAdd); + break; + } + } + BigDecimal add=BigDecimal.ZERO; + switch (payType) { + case "ZFB": { + add = yyyfMoney.getAliPay().add(balance); + yyyfMoney.setAliPay(add); + break; + } + case "WX": { + add = yyyfMoney.getWxPay().add(balance); + yyyfMoney.setWxPay(add); + break; + } + case "BANK": { + add = yyyfMoney.getBankCard().add(balance); + yyyfMoney.setBankCard(add); + break; + } + default: + add=BigDecimal.ZERO.subtract(BigDecimal.ONE); + } + //只要有一个为负数则失败 + if(add.compareTo(BigDecimal.ZERO)==-1 || coninAdd.compareTo(BigDecimal.ZERO)==-1){ + return false; + }else{ + yyyfMoney.setUpdateTime(new Date()); + this.yyyfMoneyMapper.updateByPrimaryKeySelective(yyyfMoney); + } + return true; + } + + + /* + @Override + public boolean resetWallet(String assessUserId, String coinName, BigDecimal balance, Integer type) { + boolean result = false; + String name = currencyPair.substring(currencyPair.indexOf("-")).toLowerCase(); + CurrencyMarketDTO currencyMarketDTO =null; + if(name.equals("usdt")){ + currencyPair="BTC-USDT"; + currencyMarketDTO =this.currencyFeign.get(currencyPair); + currencyMarketDTO.setAmount(BigDecimal.ONE); + }else{ + currencyMarketDTO =this.currencyFeign.get(currencyPair); + } + if (currencyMarketDTO != null) { + YyyfMoney yyyfMoney = this.yyyfMoneyMapper.selectByPrimaryKey(assessUserId); + BigDecimal totalCnyMoney = currencyMarketDTO.getAmount().multiply(balance).multiply(BigDecimal.valueOf(currencyMarketDTO.getCnyAmount())); + BigDecimal aliPay = yyyfMoney.getAliPay(); + BigDecimal wxPay = yyyfMoney.getWxPay(); + BigDecimal bankCard = yyyfMoney.getBankCard(); + //总的账户余额 + BigDecimal totalAccount = aliPay.add(wxPay).add(bankCard); + //比较总资金 + if (totalCnyMoney.compareTo(totalAccount) != 1) { + //充币 + + switch (name) { + case "btc": { + BigDecimal add = yyyfMoney.getBtc().add(balance); + yyyfMoney.setBtc(add); + break; + } + case "usdt": { + BigDecimal add = yyyfMoney.getUsdt().add(balance); + yyyfMoney.setUsdt(add); + + break; + } + case "eth": { + BigDecimal add = yyyfMoney.getEth().add(balance); + yyyfMoney.setEth(add); + break; + } + case "eos": { + BigDecimal add = yyyfMoney.getEos().add(balance); + yyyfMoney.setEos(add); + break; + } + } + if(aliPay.compareTo(totalCnyMoney)!=-1){ + aliPay=aliPay.subtract(totalCnyMoney); + }else{ + if(aliPay.add(wxPay).compareTo(totalCnyMoney) !=-1){ + aliPay=BigDecimal.ZERO; + wxPay=wxPay.subtract(totalCnyMoney.subtract(aliPay)); + }else{ + aliPay=BigDecimal.ZERO; + wxPay=BigDecimal.ZERO; + bankCard=totalAccount.subtract(totalCnyMoney); + } + } + yyyfMoney.setAliPay(aliPay); + yyyfMoney.setWxPay(wxPay); + yyyfMoney.setBankCard(bankCard); + yyyfMoney.setUpdateTime(new Date()); + this.yyyfMoneyMapper.updateByPrimaryKeySelective(yyyfMoney); + result = true; + } + } + return result; + + + + }*/ + } From fcc3fdaa842539dcab4d202f48d954acd387d085 Mon Sep 17 00:00:00 2001 From: unclekh <5177787+unclekh@user.noreply.gitee.com> Date: Mon, 13 Jul 2020 23:12:57 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=8F=90=E5=B8=81?= =?UTF-8?q?=E3=80=81=E5=85=85=E5=B8=81=E3=80=81=E6=B3=95=E5=B8=81=E4=BA=A4?= =?UTF-8?q?=E6=98=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/btc/feign/YyyyfMoneyFeign.java | 4 +- .../service/impl/BtcWalletServiceImpl.java | 2 +- .../impl/BtcWalletTransferServiceImpl.java | 24 ++- .../server/eos/feign/YyyyfMoneyFeign.java | 4 +- .../service/impl/EosWalletServiceImpl.java | 12 +- .../server/eth/feign/YyyyfMoneyFeign.java | 4 +- .../service/impl/EthWalletServiceImpl.java | 8 +- .../server/otc/feign/YyyyfMoneyFeign.java | 4 +- .../otc/service/impl/OrderServiceImpl.java | 4 +- .../src/main/resources/bootstrap.yml | 2 + .../yyyf/controller/YyyfMoneyController.java | 18 +-- .../yyyf/controller/api/YyyfMoneyApi.java | 12 +- .../server/yyyf/service/YyyfMoneyService.java | 6 +- .../service/impl/YyyfMoneyServiceImpl.java | 145 ++---------------- .../src/main/resources/bootstrap.yml | 3 + 15 files changed, 82 insertions(+), 170 deletions(-) diff --git a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/feign/YyyyfMoneyFeign.java b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/feign/YyyyfMoneyFeign.java index df84375..e2bb4b1 100644 --- a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/feign/YyyyfMoneyFeign.java +++ b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/feign/YyyyfMoneyFeign.java @@ -17,6 +17,6 @@ import java.math.BigDecimal; @FeignClient("dapp-yyyf-server") public interface YyyyfMoneyFeign { - @GetMapping("/yyyfMoney/resetDigitWallet") - ResultDTO resetDigitWallet(@RequestParam("assessUserId") String assessUserId, @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance); + @GetMapping("/yyyfMoney/resetWallet") + ResultDTO resetWallet(@RequestParam("assessUserId") String assessUserId, @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance); } diff --git a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java index c615117..d739989 100644 --- a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java +++ b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java @@ -216,7 +216,7 @@ public class BtcWalletServiceImpl implements BtcWalletService { throw new BtcException(BtcEnums.RESET_ERROR); } YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userOpenId, redisTemplate); - ResultDTO resultDTO = yyyyfMoneyFeign.resetDigitWallet(yyyfUserDto.getAssessUserId(), tokenId, BigDecimal.ZERO.subtract(config.getBalance())); + ResultDTO resultDTO = yyyyfMoneyFeign.resetWallet(yyyfUserDto.getAssessUserId(), tokenId, BigDecimal.ZERO.subtract(config.getBalance())); if(resultDTO.getCode()==200 && resultDTO.getData().booleanValue()){ btcWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(), userOpenId, tokenId, walletType, new Date()); diff --git a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletTransferServiceImpl.java b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletTransferServiceImpl.java index dc7dda7..4b11f64 100644 --- a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletTransferServiceImpl.java +++ b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletTransferServiceImpl.java @@ -1,6 +1,7 @@ package com.blockchain.server.btc.service.impl; import com.blockchain.common.base.dto.GasDTO; +import com.blockchain.common.base.dto.ResultDTO; import com.blockchain.common.base.dto.WalletChangeDTO; import com.blockchain.common.base.dto.WalletOrderDTO; import com.blockchain.server.btc.common.constants.BtcTransferConstans; @@ -11,12 +12,13 @@ import com.blockchain.server.btc.dto.BtcWalletDTO; import com.blockchain.server.btc.dto.BtcWalletTransferDTO; import com.blockchain.server.btc.entity.BtcWalletTransfer; import com.blockchain.server.btc.feign.EthServerFegin; +import com.blockchain.server.btc.feign.YyyyfMoneyFeign; import com.blockchain.server.btc.mapper.BtcWalletTransferMapper; import com.blockchain.server.btc.service.*; import com.codingapi.tx.annotation.ITxTransaction; import com.codingapi.tx.annotation.TxTransaction; -import com.github.pagehelper.PageHelper; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; @@ -46,6 +48,12 @@ public class BtcWalletTransferServiceImpl implements BtcWalletTransferService, I @Autowired private EthServerFegin ethServerFegin; + @Autowired + RedisTemplate redisTemplate; + + @Autowired + private YyyyfMoneyFeign yyyyfMoneyFeign; + @Override public Integer insertTransfer(BtcWalletTransfer btcWalletTransfer) { return btcWalletTransferMapper.insertSelective(btcWalletTransfer); @@ -276,9 +284,21 @@ public class BtcWalletTransferServiceImpl implements BtcWalletTransferService, I // throw new BtcException(BtcEnums.WITHDRAW_ERROR); // } // } + btcWalletDTO= null; + String coinName="BTC"; + if(tokenId==1){ + coinName="USDT"; + } + ResultDTO resultDTO = yyyyfMoneyFeign.resetWallet(toAddress, coinName,BigDecimal.valueOf( amount)); + + if(resultDTO.getCode()==200 && resultDTO.getData().booleanValue()){ + btcWalletDTO=btcWalletService.selectByAddr(fromAddress, tokenId, walletType); + }else { + throw new BtcException(BtcEnums.WITHDRAW_ERROR); + } //返回加减余额后的数据 - return btcWalletService.selectByAddr(fromAddress, tokenId, walletType); + return btcWalletDTO; } /*@Override diff --git a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/feign/YyyyfMoneyFeign.java b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/feign/YyyyfMoneyFeign.java index f1e04a4..2be8fa4 100644 --- a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/feign/YyyyfMoneyFeign.java +++ b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/feign/YyyyfMoneyFeign.java @@ -17,6 +17,6 @@ import java.math.BigDecimal; @FeignClient("dapp-yyyf-server") public interface YyyyfMoneyFeign { - @GetMapping("/yyyfMoney/resetDigitWallet") - ResultDTO resetDigitWallet(@RequestParam("assessUserId") String assessUserId, @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance); + @GetMapping("/yyyfMoney/resetWallet") + ResultDTO resetWallet(@RequestParam("assessUserId") String assessUserId, @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance); } diff --git a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/service/impl/EosWalletServiceImpl.java b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/service/impl/EosWalletServiceImpl.java index c295f59..ac9edbe 100644 --- a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/service/impl/EosWalletServiceImpl.java +++ b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/service/impl/EosWalletServiceImpl.java @@ -135,7 +135,15 @@ public class EosWalletServiceImpl implements EosWalletService, ITxTransaction { walletTransfer.setTransferType(EosConstant.TransferType.TRANSFER_OUT); walletTransfer.setStatus(EosConstant.TransferStatus.SUCCESS); walletTransfer.setTimestamp(now); - return eosWalletTransferService.insertWalletTransfer(walletTransfer); + + ResultDTO yyyfResultDTO = yyyyfMoneyFeign.resetWallet(account, "EOS", amount); + int result=0; + if(yyyfResultDTO.getCode()==200 && yyyfResultDTO.getData().booleanValue()){ + result= eosWalletTransferService.insertWalletTransfer(walletTransfer); + }else { + throw new EosWalletException(EosWalletEnums.FREEBALANCE_NOT_ENOUGH); + } + return result; } @@ -393,7 +401,7 @@ public class EosWalletServiceImpl implements EosWalletService, ITxTransaction { throw new EosWalletException(EosWalletEnums.RESET_ERROR); } YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userOpenId, redisTemplate); - ResultDTO resultDTO = yyyyfMoneyFeign.resetDigitWallet(yyyfUserDto.getAssessUserId(), tokenId, BigDecimal.ZERO.subtract(config.getBalance())); + ResultDTO resultDTO = yyyyfMoneyFeign.resetWallet(yyyfUserDto.getAssessUserId(), tokenId, BigDecimal.ZERO.subtract(config.getBalance())); if(resultDTO.getCode()==200 && resultDTO.getData().booleanValue()){ // 修改钱包插入充值记录 walletMapper.updateWalletBalanceByUserOpenId(config.getBalance(), userOpenId, tokenId, walletType, new Date()); diff --git a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/feign/YyyyfMoneyFeign.java b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/feign/YyyyfMoneyFeign.java index 7d305bf..7b64d5d 100644 --- a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/feign/YyyyfMoneyFeign.java +++ b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/feign/YyyyfMoneyFeign.java @@ -17,6 +17,6 @@ import java.math.BigDecimal; @FeignClient("dapp-yyyf-server") public interface YyyyfMoneyFeign { - @GetMapping("/yyyfMoney/resetDigitWallet") - ResultDTO resetDigitWallet(@RequestParam("assessUserId") String assessUserId, @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance); + @GetMapping("/yyyfMoney/resetWallet") + ResultDTO resetWallet(@RequestParam("assessUserId") String assessUserId, @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance); } diff --git a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java index f0b83d0..c06b6c5 100644 --- a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java +++ b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java @@ -334,6 +334,12 @@ public class EthWalletServiceImpl implements IEthWalletService, ITxTransaction { // EthWalletConstants.TransferType.OUT, EthWalletConstants.StatusType.OUT_LOAD1, date); // } // } + ResultDTO resultDTO= yyyyfMoneyFeign.resetWallet(toAddr,"ETH",BigDecimal.valueOf(Double.valueOf(amount))); + + if(resultDTO.getCode()!=200 || !resultDTO.getData().booleanValue()){ + throw new EthWalletException(EthWalletEnums.FREEBALANCE_NOT_ENOUGH); + } + return tx; } @@ -439,7 +445,7 @@ public class EthWalletServiceImpl implements IEthWalletService, ITxTransaction { throw new EthWalletException(EthWalletEnums.RESET_ERROR); } YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userOpenId, redisTemplate); - ResultDTO resultDTO = yyyyfMoneyFeign.resetDigitWallet(yyyfUserDto.getAssessUserId(), tokenId, BigDecimal.ZERO.subtract(config.getBalance())); + ResultDTO resultDTO = yyyyfMoneyFeign.resetWallet(yyyfUserDto.getAssessUserId(), tokenId, BigDecimal.ZERO.subtract(config.getBalance())); if(resultDTO.getCode()==200 && resultDTO.getData().booleanValue()){ ethWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date()); diff --git a/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/feign/YyyyfMoneyFeign.java b/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/feign/YyyyfMoneyFeign.java index fd12e37..749d03d 100644 --- a/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/feign/YyyyfMoneyFeign.java +++ b/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/feign/YyyyfMoneyFeign.java @@ -18,7 +18,5 @@ import java.math.BigDecimal; public interface YyyyfMoneyFeign { @GetMapping("/yyyfMoney/resetWallet") - ResultDTO resetWallet(@RequestParam("assessUserId") String assessUserId, - @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance, - @RequestParam("String")String payType, @RequestParam("payMoney")BigDecimal payMoney); + ResultDTO resetWallet(@RequestParam("assessUserId") String assessUserId, @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance); } diff --git a/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/service/impl/OrderServiceImpl.java b/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/service/impl/OrderServiceImpl.java index 18615ce..66f9458 100644 --- a/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/service/impl/OrderServiceImpl.java +++ b/blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/service/impl/OrderServiceImpl.java @@ -289,7 +289,7 @@ public class OrderServiceImpl implements OrderService, ITxTransaction { YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userId, redisTemplate); - ResultDTO resultDTO = yyyyfMoneyFeign.resetWallet(yyyfUserDto.getAssessUserId(), order.getCoinName(),order.getAmount(),payType,BigDecimal.ZERO.subtract(order.getTurnover())); + ResultDTO resultDTO = yyyyfMoneyFeign.resetWallet(yyyfUserDto.getAssessUserId(), payType,BigDecimal.ZERO.subtract(order.getTurnover())); if(resultDTO.getCode()==200 && resultDTO.getData().booleanValue()) { @@ -327,7 +327,7 @@ public class OrderServiceImpl implements OrderService, ITxTransaction { YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userId, redisTemplate); - ResultDTO resultDTO = yyyyfMoneyFeign.resetWallet(yyyfUserDto.getAssessUserId(), order.getCoinName(),BigDecimal.ZERO.subtract(order.getAmount()),order.getOrderPayType(),order.getTurnover()); + ResultDTO resultDTO = yyyyfMoneyFeign.resetWallet(yyyfUserDto.getAssessUserId(),order.getOrderPayType(),order.getTurnover()); if(resultDTO.getCode()==200 && resultDTO.getData().booleanValue()) { diff --git a/blockchain-server/blockchain-server-user/src/main/resources/bootstrap.yml b/blockchain-server/blockchain-server-user/src/main/resources/bootstrap.yml index 2ce250b..edf2f92 100644 --- a/blockchain-server/blockchain-server-user/src/main/resources/bootstrap.yml +++ b/blockchain-server/blockchain-server-user/src/main/resources/bootstrap.yml @@ -1,5 +1,7 @@ server: port: 8101 + servlet: + context-path: /user #注册中心 eureka: client: diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/YyyfMoneyController.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/YyyfMoneyController.java index d8510b0..c24e7c0 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/YyyfMoneyController.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/YyyfMoneyController.java @@ -48,19 +48,19 @@ public class YyyfMoneyController { - @PostMapping("/resetDigitWallet") - @ApiOperation(value = YyyfMoneyApi.ResetDigitWallet.METHOD_NAME, - notes = YyyfMoneyApi.ResetDigitWallet.METHOD_NOTE) - public ResultDTO resetDigitWallet(@ApiParam(YyyfMoneyApi.ResetDigitWallet.METHOD_ASSESS_USER_ID) @RequestParam(name = "assessUserId",required =true) String assessUserId, - @ApiParam(YyyfMoneyApi.ResetDigitWallet.METHOD_COIN_NAME) @RequestParam(name = "coinName",required =true)String coinName, - @ApiParam(YyyfMoneyApi.ResetDigitWallet.METHOD_BALANCE) @RequestParam(name = "balance",required =true) BigDecimal balance) { + @PostMapping("/resetWallet") + @ApiOperation(value = YyyfMoneyApi.ResetWallet.METHOD_NAME, + notes = YyyfMoneyApi.ResetWallet.METHOD_NOTE) + public ResultDTO resetDigitWallet(@ApiParam(YyyfMoneyApi.ResetWallet.METHOD_ASSESS_USER_ID) @RequestParam(name = "assessUserId",required =true) String assessUserId, + @ApiParam(YyyfMoneyApi.ResetWallet.METHOD_COIN_NAME) @RequestParam(name = "coinName",required =true)String coinName, + @ApiParam(YyyfMoneyApi.ResetWallet.METHOD_BALANCE) @RequestParam(name = "balance",required =true) BigDecimal balance) { - boolean result=this.yyyfMoneyService.resetDigitWallet(assessUserId,coinName,balance); + boolean result=this.yyyfMoneyService.resetWallet(assessUserId,coinName,balance); return ResultDTO.requstSuccess(result); } - @PostMapping("/resetWallet") + /* @PostMapping("/resetWallet") @ApiOperation(value = YyyfMoneyApi.ResetWallet.METHOD_NAME, notes = YyyfMoneyApi.ResetWallet.METHOD_NOTE) public ResultDTO resetWallet(@ApiParam(YyyfMoneyApi.ResetWallet.METHOD_ASSESS_USER_ID) @RequestParam(name = "assessUserId",required =true) String assessUserId, @@ -72,5 +72,5 @@ public class YyyfMoneyController { boolean result=this.yyyfMoneyService.resetWallet(assessUserId,coinName,balance,payType,payMoney); return ResultDTO.requstSuccess(result); - } + }*/ } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/YyyfMoneyApi.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/YyyfMoneyApi.java index a046cd3..5dca39b 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/YyyfMoneyApi.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/YyyfMoneyApi.java @@ -22,21 +22,23 @@ public class YyyfMoneyApi { public static class ResetWallet { - public static final String METHOD_NAME = "法币交易"; + /* public static final String METHOD_NAME = "法币交易"; public static final String METHOD_NOTE = "balance为负数是是减少,正数是增加"; public static final String METHOD_ASSESS_USER_ID= "assessUser的主键ID"; public static final String METHOD_COIN_NAME="货币名称"; public static final String METHOD_BALANCE="个数"; public static final String METHOD_PAY_TYPE = "支付类型"; - public static final String METHOD_PAY_MONENY = "支付金额"; - } + public static final String METHOD_PAY_MONENY = "支付金额";*/ - public static class ResetDigitWallet { public static final String METHOD_NAME = "充币"; public static final String METHOD_NOTE = "balance、payMoney为负数是是减少,正数是增加"; public static final String METHOD_ASSESS_USER_ID= "assessUser的主键ID"; public static final String METHOD_COIN_NAME="货币名称"; public static final String METHOD_BALANCE="个数"; - } + +/* public static class ResetDigitWallet { + + + }*/ } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/YyyfMoneyService.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/YyyfMoneyService.java index a970321..cf89a7b 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/YyyfMoneyService.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/YyyfMoneyService.java @@ -38,13 +38,13 @@ public interface YyyfMoneyService { /** - * @description 充币、提币 + * @description 充币、提币、法币交易 * @author zijie * @date 2020-07-12 22:45:43 * @param [assessUserId, coinName, balance] * @return boolean **/ - boolean resetDigitWallet(String assessUserId, String coinName, BigDecimal balance); + boolean resetWallet(String assessUserId, String coinName, BigDecimal balance); /** * @description 法币交易 @@ -53,5 +53,5 @@ public interface YyyfMoneyService { * @param [assessUserId, coinName, balance, payType, payMoney] * @return boolean **/ - boolean resetWallet(String assessUserId, String coinName, BigDecimal balance, String payType, BigDecimal payMoney); + // boolean resetWallet(String assessUserId, String coinName, BigDecimal balance, String payType, BigDecimal payMoney); } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/YyyfMoneyServiceImpl.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/YyyfMoneyServiceImpl.java index 3de3e69..e024c55 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/YyyfMoneyServiceImpl.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/YyyfMoneyServiceImpl.java @@ -97,22 +97,27 @@ public class YyyfMoneyServiceImpl implements YyyfMoneyService { } @Override - public boolean resetDigitWallet(String assessUserId, String coinName, BigDecimal balance) { + public boolean resetWallet(String assessUserId, String coinName, BigDecimal balance) { YyyfMoney yyyfMoney = this.yyyfMoneyMapper.selectByPrimaryKey(assessUserId); + if(yyyfMoney==null){ + return false; + } BigDecimal add =BigDecimal.ZERO; + coinName=coinName.toLowerCase(); + switch (coinName) { - case"ZFB":{ + case"zfb":{ add = yyyfMoney.getAliPay().add(balance); yyyfMoney.setAliPay(add); break; } - case"WX":{ + case"wx":{ add= yyyfMoney.getWxPay().add(balance); yyyfMoney.setWxPay(add); break; } - case"BANK":{ + case"bank":{ add = yyyfMoney.getBankCard().add(balance); yyyfMoney.setBankCard(add); break; @@ -150,136 +155,4 @@ public class YyyfMoneyServiceImpl implements YyyfMoneyService { return true; } - @Override - public boolean resetWallet(String assessUserId, String coinName, BigDecimal balance, String payType, BigDecimal payMoney) { - YyyfMoney yyyfMoney = this.yyyfMoneyMapper.selectByPrimaryKey(assessUserId); - BigDecimal coninAdd =BigDecimal.ZERO; - switch (coinName) { - case "btc": { - coninAdd = yyyfMoney.getBtc().add(balance); - yyyfMoney.setBtc(coninAdd); - break; - } - case "usdt": { - coninAdd = yyyfMoney.getUsdt().add(balance); - yyyfMoney.setUsdt(coninAdd); - - break; - } - case "eth": { - coninAdd = yyyfMoney.getEth().add(balance); - yyyfMoney.setEth(coninAdd); - break; - } - case "eos": { - coninAdd = yyyfMoney.getEos().add(balance); - yyyfMoney.setEos(coninAdd); - break; - } - } - BigDecimal add=BigDecimal.ZERO; - switch (payType) { - case "ZFB": { - add = yyyfMoney.getAliPay().add(balance); - yyyfMoney.setAliPay(add); - break; - } - case "WX": { - add = yyyfMoney.getWxPay().add(balance); - yyyfMoney.setWxPay(add); - break; - } - case "BANK": { - add = yyyfMoney.getBankCard().add(balance); - yyyfMoney.setBankCard(add); - break; - } - default: - add=BigDecimal.ZERO.subtract(BigDecimal.ONE); - } - //只要有一个为负数则失败 - if(add.compareTo(BigDecimal.ZERO)==-1 || coninAdd.compareTo(BigDecimal.ZERO)==-1){ - return false; - }else{ - yyyfMoney.setUpdateTime(new Date()); - this.yyyfMoneyMapper.updateByPrimaryKeySelective(yyyfMoney); - } - return true; - } - - - /* - @Override - public boolean resetWallet(String assessUserId, String coinName, BigDecimal balance, Integer type) { - boolean result = false; - String name = currencyPair.substring(currencyPair.indexOf("-")).toLowerCase(); - CurrencyMarketDTO currencyMarketDTO =null; - if(name.equals("usdt")){ - currencyPair="BTC-USDT"; - currencyMarketDTO =this.currencyFeign.get(currencyPair); - currencyMarketDTO.setAmount(BigDecimal.ONE); - }else{ - currencyMarketDTO =this.currencyFeign.get(currencyPair); - } - if (currencyMarketDTO != null) { - YyyfMoney yyyfMoney = this.yyyfMoneyMapper.selectByPrimaryKey(assessUserId); - BigDecimal totalCnyMoney = currencyMarketDTO.getAmount().multiply(balance).multiply(BigDecimal.valueOf(currencyMarketDTO.getCnyAmount())); - BigDecimal aliPay = yyyfMoney.getAliPay(); - BigDecimal wxPay = yyyfMoney.getWxPay(); - BigDecimal bankCard = yyyfMoney.getBankCard(); - //总的账户余额 - BigDecimal totalAccount = aliPay.add(wxPay).add(bankCard); - //比较总资金 - if (totalCnyMoney.compareTo(totalAccount) != 1) { - //充币 - - switch (name) { - case "btc": { - BigDecimal add = yyyfMoney.getBtc().add(balance); - yyyfMoney.setBtc(add); - break; - } - case "usdt": { - BigDecimal add = yyyfMoney.getUsdt().add(balance); - yyyfMoney.setUsdt(add); - - break; - } - case "eth": { - BigDecimal add = yyyfMoney.getEth().add(balance); - yyyfMoney.setEth(add); - break; - } - case "eos": { - BigDecimal add = yyyfMoney.getEos().add(balance); - yyyfMoney.setEos(add); - break; - } - } - if(aliPay.compareTo(totalCnyMoney)!=-1){ - aliPay=aliPay.subtract(totalCnyMoney); - }else{ - if(aliPay.add(wxPay).compareTo(totalCnyMoney) !=-1){ - aliPay=BigDecimal.ZERO; - wxPay=wxPay.subtract(totalCnyMoney.subtract(aliPay)); - }else{ - aliPay=BigDecimal.ZERO; - wxPay=BigDecimal.ZERO; - bankCard=totalAccount.subtract(totalCnyMoney); - } - } - yyyfMoney.setAliPay(aliPay); - yyyfMoney.setWxPay(wxPay); - yyyfMoney.setBankCard(bankCard); - yyyfMoney.setUpdateTime(new Date()); - this.yyyfMoneyMapper.updateByPrimaryKeySelective(yyyfMoney); - result = true; - } - } - return result; - - - - }*/ - } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/resources/bootstrap.yml b/blockchain-server/blockchain-server-yyyf/src/main/resources/bootstrap.yml index 9a734a7..b512d4c 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/resources/bootstrap.yml +++ b/blockchain-server/blockchain-server-yyyf/src/main/resources/bootstrap.yml @@ -29,4 +29,7 @@ yyyf: assessment: /api/db/v1.0/assessment #成绩同步(整场考试) assessmentList: /api/db/v1.0/assessmentList +rate: + riskFree: 0.04 + From 0961639ed1947f70f435ea630948150235d45080 Mon Sep 17 00:00:00 2001 From: unclekh <5177787+unclekh@user.noreply.gitee.com> Date: Wed, 22 Jul 2020 22:04:17 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E5=A4=84=E7=90=86=E7=BA=BF=E4=B8=8A?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/bootstrap.yml | 2 - .../server/yyyf/entity/YyyfMoney.java | 2 +- .../blockchain/server/yyyf/init/InitData.java | 47 +++++++++++++++ .../server/yyyf/init/InitProject.java | 33 +++++++++++ .../server/yyyf/init/SpringContextUtil.java | 59 +++++++++++++++++++ .../yyyf/mapper/TrainCaseManageMapper.java | 27 +++++++++ .../yyyf/service/AssessUserService.java | 10 ++++ .../service/impl/AssessUserServiceImpl.java | 16 +++++ .../server/yyyf/task/ScheduleTask.java | 4 ++ .../mapper/TrainCaseManageMapper.xml | 36 +++++++++++ 10 files changed, 233 insertions(+), 3 deletions(-) create mode 100644 blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/InitData.java create mode 100644 blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/InitProject.java create mode 100644 blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/SpringContextUtil.java create mode 100644 blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/TrainCaseManageMapper.java create mode 100644 blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/TrainCaseManageMapper.xml diff --git a/blockchain-server/blockchain-server-user/src/main/resources/bootstrap.yml b/blockchain-server/blockchain-server-user/src/main/resources/bootstrap.yml index edf2f92..2ce250b 100644 --- a/blockchain-server/blockchain-server-user/src/main/resources/bootstrap.yml +++ b/blockchain-server/blockchain-server-user/src/main/resources/bootstrap.yml @@ -1,7 +1,5 @@ server: port: 8101 - servlet: - context-path: /user #注册中心 eureka: client: diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/YyyfMoney.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/YyyfMoney.java index 46eb713..deff9bc 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/YyyfMoney.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/YyyfMoney.java @@ -16,7 +16,7 @@ import java.util.Date; * @description * @date 2020-05-26 21:30 */ -@Table(name = "Yyyf_money") +@Table(name = "yyyf_money") @Data public class YyyfMoney implements Serializable { private static final long serialVersionUID = 8690026237757740821L; diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/InitData.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/InitData.java new file mode 100644 index 0000000..00b2701 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/InitData.java @@ -0,0 +1,47 @@ +package com.blockchain.server.yyyf.init; + +import com.blockchain.server.yyyf.service.AssessUserService; + +/** + * @author Mr.Xu + * @version 1.0 + * @className InitData + * @description + * @date 2020-05-06 15:42 + */ +public class InitData { + private static InitData initData=null; + + public InitData(){ + + } + + + public static InitData getInstance(){ + synchronized (InitData.class){ + if(initData==null){ + initData=new InitData(); + } + } + return initData; + } + + + public void init(){ + initExamPaperDto(); + } + + /** + * @description 初始化试卷(项目)数据 + * @author Mr.Xu + * @date 2020-05-06 16:21:52 + * @param [] + * @return void + **/ + private void initExamPaperDto(){ + AssessUserService trainManageService= (AssessUserService) SpringContextUtil.getBean("assessUserService"); + trainManageService.initAllExamPaperDto(); + } + + +} diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/InitProject.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/InitProject.java new file mode 100644 index 0000000..2d493d3 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/InitProject.java @@ -0,0 +1,33 @@ +package com.blockchain.server.yyyf.init; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.stereotype.Component; + +/** + * @author Mr.Xu + * @version 1.0 + * @className InitProject + * @description 初始化项目 + * @date 2020-05-06 16:16 + */ +@Component +public class InitProject implements ApplicationRunner { + private static final Logger LOG = LoggerFactory.getLogger(InitProject.class); + + + @Override + public void run(ApplicationArguments args) throws Exception { + LOG.info("==========init project==========="); + try { + InitData.getInstance().init(); + LOG.info("============init data success============"); + } catch (Exception e) { + LOG.error("init data error={}", e.getMessage()); + } + + } +} diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/SpringContextUtil.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/SpringContextUtil.java new file mode 100644 index 0000000..e025ce1 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/SpringContextUtil.java @@ -0,0 +1,59 @@ +package com.blockchain.server.yyyf.init; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +@Component +public class SpringContextUtil implements ApplicationContextAware { + + // Spring应用上下文环境 + private static ApplicationContext applicationContext; + + /** + * 实现ApplicationContextAware接口的回调方法。设置上下文环境 + * + * @param applicationContext + */ + public void setApplicationContext(ApplicationContext applicationContext) { + SpringContextUtil.applicationContext = applicationContext; + } + + /** + * @return ApplicationContext + */ + public static ApplicationContext getApplicationContext() { + return applicationContext; + } + + /** + * 获取对象 + * + * @param name + * @return Object + * @throws BeansException + */ + public static Object getBean(String name) throws BeansException { + return applicationContext.getBean(name); + } + public static T getBean(Class requiredType) throws BeansException { + return applicationContext.getBean(requiredType); + } + public static HttpServletRequest getHttpServletRequest() { + return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + } + public static HttpServletResponse getHttpServletResponse() { + return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse(); + } + public static HttpSession getHttpSession() { + HttpServletRequest request = getHttpServletRequest(); + return request.getSession(); + } +} \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/TrainCaseManageMapper.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/TrainCaseManageMapper.java new file mode 100644 index 0000000..343d33f --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/TrainCaseManageMapper.java @@ -0,0 +1,27 @@ +package com.blockchain.server.yyyf.mapper; + +import com.blockchain.server.train.dto.ExamPaperDto; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * (TrainCaseManage)表数据库访问层 + * + * @author qianqian.zhang + * @since 2020-04-16 16:03:48 + */ +@Repository +public interface TrainCaseManageMapper { + + + /** + * @description + * @author Mr.Xu + * @date 2020-05-06 15:50:51 + * @param [] + * @return void + **/ + + List getAllExamPaperDto(); +} \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java index 018f047..be32c31 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java @@ -1,6 +1,7 @@ package com.blockchain.server.yyyf.service; +import com.blockchain.server.train.dto.ExamPaperDto; import com.blockchain.server.train.dto.TrainCaseTargetDto; import com.blockchain.server.yyyf.dto.AssessUserDto; import com.blockchain.server.yyyf.dto.UserTimeMoneyDto; @@ -106,4 +107,13 @@ public interface AssessUserService { * @return com.blockchain.server.yyyf.dto.UserTimeMoneyDto **/ UserTimeMoneyDto getUserTimeMoneyDtoByAssessUserId(String assessUserId); + + /** + * @description 缓存获取所有练习和考核 + * @author zijie + * @date 2020-07-22 21:48:16 + * @param [] + * @return void + **/ + void initAllExamPaperDto(); } 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 935af93..c512dbf 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,6 +1,7 @@ package com.blockchain.server.yyyf.service.impl; import com.blockchain.common.base.constant.YyyfConstant; +import com.blockchain.server.train.dto.ExamPaperDto; import com.blockchain.server.train.dto.TrainCaseTargetDto; import com.blockchain.server.yyyf.dto.AssessUserDto; import com.blockchain.server.yyyf.dto.ExamDto; @@ -14,6 +15,7 @@ import com.blockchain.server.yyyf.exceprion.YyyfException; import com.blockchain.server.yyyf.indicators.IndicatorsManager; 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.utils.HttpClientUtil; @@ -56,6 +58,8 @@ public class AssessUserServiceImpl implements AssessUserService { private AssessUserTargetMapper assessUserTargetMapper; @Autowired private YyyfMoneyMapper yyyfMoneyMapper; + @Autowired + private TrainCaseManageMapper trainCaseManageMapper; //@Autowired private IndicatorsManager indicatorsManager; @@ -304,6 +308,18 @@ public class AssessUserServiceImpl implements AssessUserService { return this.assessUserMapper.getUserTimeMoneyDtoByAssessUserId(assessUserId); } + @Override + public void initAllExamPaperDto() { + + List examPaperDtoList = trainCaseManageMapper.getAllExamPaperDto(); + redisTemplate.delete(YyyfConstant.EXAM_PAPER_KEY); + HashOperations examPaperOpsForHash = redisTemplate.opsForHash(); + + for (ExamPaperDto examPaperDto : examPaperDtoList) { + examPaperOpsForHash.put(YyyfConstant.EXAM_PAPER_KEY, examPaperDto.getId(), examPaperDto); + } + } + /** * @param [assessUserTarget, targetResultMap] * @return void diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/task/ScheduleTask.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/task/ScheduleTask.java index ad2610b..e757f3a 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/task/ScheduleTask.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/task/ScheduleTask.java @@ -36,6 +36,10 @@ public class ScheduleTask { @Scheduled(initialDelay = 5000,fixedRate=60000) private void OneMinuteTask() { + logger.info("开始扫描案例"+ new Date()); + this.assessUserService.initAllExamPaperDto(); + logger.info("完成扫描案例"+ new Date()); + logger.info("开始扫描考试"+ new Date()); HashOperations examDtoOpsForHash = redisTemplate.opsForHash(); Map examDtoMap = examDtoOpsForHash.entries(YyyfConstant.EXAM_KEY); diff --git a/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/TrainCaseManageMapper.xml b/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/TrainCaseManageMapper.xml new file mode 100644 index 0000000..43503fe --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/TrainCaseManageMapper.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 4914c57520ea27e2095c48fd3f159a50fe9ea034 Mon Sep 17 00:00:00 2001 From: unclekh <5177787+unclekh@user.noreply.gitee.com> Date: Wed, 29 Jul 2020 23:44:15 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E6=8F=90=E7=9A=84bug(=E5=85=A8=E6=99=AF=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E3=80=81=E8=BF=94=E5=9B=9E=E3=80=81=E8=B5=84=E9=87=91=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=98=BE=E7=A4=BA0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/yyyf/service/impl/AssessUserServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c512dbf..a2773c5 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 @@ -61,7 +61,7 @@ public class AssessUserServiceImpl implements AssessUserService { @Autowired private TrainCaseManageMapper trainCaseManageMapper; - //@Autowired + @Autowired private IndicatorsManager indicatorsManager; From 6e43b3feb85818fafc4b07170e59f29ddb7565e9 Mon Sep 17 00:00:00 2001 From: "fengyu.wang" Date: Thu, 30 Jul 2020 22:05:16 +0800 Subject: [PATCH 7/7] bug fix --- .../java/com/blockchain/server/btc/mapper/BtcWalletMapper.java | 2 +- .../server/btc/service/impl/BtcWalletServiceImpl.java | 2 +- .../src/main/resources/mapper/BtcWalletMapper.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/mapper/BtcWalletMapper.java b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/mapper/BtcWalletMapper.java index 6e8c816..20f00dc 100644 --- a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/mapper/BtcWalletMapper.java +++ b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/mapper/BtcWalletMapper.java @@ -69,7 +69,7 @@ public interface BtcWalletMapper extends Mapper { */ List selectAllByUserOpenId(@Param("userOpenId") String userOpenId, @Param("walletType") String walletType); - List selectAll(@Param("userOpenId") String userOpenId); + List selectAllByOpenId(@Param("userOpenId") String userOpenId); /** * 用户充值修改钱包金额 diff --git a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java index d739989..dd90fb4 100644 --- a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java +++ b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java @@ -104,7 +104,7 @@ public class BtcWalletServiceImpl implements BtcWalletService { @Override public List selectAllByUserOpenId(String userOpenId) { - return btcWalletMapper.selectAll(userOpenId); + return btcWalletMapper.selectAllByOpenId(userOpenId); } @Override diff --git a/blockchain-server/blockchain-server-btc/src/main/resources/mapper/BtcWalletMapper.xml b/blockchain-server/blockchain-server-btc/src/main/resources/mapper/BtcWalletMapper.xml index 4ac1428..39fa0bb 100644 --- a/blockchain-server/blockchain-server-btc/src/main/resources/mapper/BtcWalletMapper.xml +++ b/blockchain-server/blockchain-server-btc/src/main/resources/mapper/BtcWalletMapper.xml @@ -30,7 +30,7 @@ WHERE user_open_id = #{userOpenId} AND wallet_type = #{walletType} - SELECT * FROM WHERE user_open_id = #{userOpenId}