Compare commits

..

25 Commits

Author SHA1 Message Date
huan.xu 75cd1faf5e 修复第一次进入 ,系统自动注册失败的问题 4 years ago
huan.xu e490449c58 修复考试时间过长的问题,duration改为Long 4 years ago
huan.xu 2bff674480 修复提交报错的bug 4 years ago
huan.xu 5417d726d7 Merge branch 'master' of https://git.czcyedu.com/zhixinlian/client-server 4 years ago
fengyu.wang a8e11b590d feign update 4 years ago
fengyu.wang bfb1a0cc76 commit 4 years ago
huan.xu 332af212ff 修复历史成绩查看bug 4 years ago
huan.xu 23927365bc 修复bug 4 years ago
fengyu.wang 96691ea013 thread pool update 4 years ago
fengyu.wang 26f71afade 做市商 bug fix 4 years ago
fengyu.wang 3306fb2473 做市商 bug fix 4 years ago
huan.xu 9467cc4823 修复登陆后未将相关信息放入缓存的bug 4 years ago
fengyu.wang cb783c3040 做市商 出售 4 years ago
huan.xu a36cb7c7b5 修复资金密码设置问题 4 years ago
fengyu.wang e8824d8b65 Merge branch 'EP-Indicator' of zhixinlian/client-server into master 4 years ago
fengyu.wang 83e50a26a3 gateway support 4 years ago
fengyu.wang 07a37581ba bug fix 4 years ago
fengyu.wang 4f5b91fa82 Merge branch 'EP-Indicator' of zhixinlian/client-server into master 4 years ago
fengyu.wang 6e43b3feb8 bug fix 4 years ago
unclekh 4914c57520 修复产品提的bug(全景显示、返回、资金管理显示0) 4 years ago
unclekh 0961639ed1 处理线上登录报错 4 years ago
unclekh fcc3fdaa84 实现提币、充币、法币交易 4 years ago
unclekh aeec182834 充币、法币交易后台实现 4 years ago
unclekh 2298799078 更改注释 4 years ago
unclekh 7c0c2cacb8 更改注释 4 years ago
  1. 2
      blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/YyyfConstant.java
  2. 2
      blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/dto/YyyfUserDto.java
  3. 4
      blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java
  4. 5
      blockchain-server/blockchain-server-btc/Dockerfile
  5. 4
      blockchain-server/blockchain-server-btc/run.sh
  6. 22
      blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/feign/YyyyfMoneyFeign.java
  7. 2
      blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/mapper/BtcWalletMapper.java
  8. 22
      blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java
  9. 24
      blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletTransferServiceImpl.java
  10. 2
      blockchain-server/blockchain-server-btc/src/main/resources/mapper/BtcWalletMapper.xml
  11. 5
      blockchain-server/blockchain-server-cct/Dockerfile
  12. 4
      blockchain-server/blockchain-server-cct/run.sh
  13. 5
      blockchain-server/blockchain-server-currency/Dockerfile
  14. 4
      blockchain-server/blockchain-server-currency/run.sh
  15. 4
      blockchain-server/blockchain-server-currency/src/main/java/com/blockchain/server/currency/Scheduling/CurrencyMarketScheduling.java
  16. 13
      blockchain-server/blockchain-server-currency/src/main/java/com/blockchain/server/currency/Scheduling/HuobiMarketScheduling.java
  17. 9
      blockchain-server/blockchain-server-currency/src/main/java/com/blockchain/server/currency/inner/CurrencyMarketInnerController.java
  18. 6
      blockchain-server/blockchain-server-currency/src/main/java/com/blockchain/server/currency/inner/api/CurrencyMarketInnerApi.java
  19. 5
      blockchain-server/blockchain-server-currency/src/main/java/com/blockchain/server/currency/redis/MarketKCache.java
  20. 54
      blockchain-server/blockchain-server-currency/src/main/java/com/blockchain/server/currency/service/impl/CurrencyMarketServiceImpl.java
  21. 5
      blockchain-server/blockchain-server-databot/Dockerfile
  22. 4
      blockchain-server/blockchain-server-databot/run.sh
  23. 5
      blockchain-server/blockchain-server-eos/Dockerfile
  24. 4
      blockchain-server/blockchain-server-eos/run.sh
  25. 2
      blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/common/enums/EosWalletEnums.java
  26. 22
      blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/feign/YyyyfMoneyFeign.java
  27. 35
      blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/service/impl/EosWalletServiceImpl.java
  28. 5
      blockchain-server/blockchain-server-eth/Dockerfile
  29. 4
      blockchain-server/blockchain-server-eth/run.sh
  30. 1
      blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/common/enums/EthWalletEnums.java
  31. 16
      blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/controller/EthWalletController.java
  32. 22
      blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/feign/YyyyfMoneyFeign.java
  33. 33
      blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java
  34. 5
      blockchain-server/blockchain-server-imJg/Dockerfile
  35. 4
      blockchain-server/blockchain-server-imJg/run.sh
  36. 5
      blockchain-server/blockchain-server-otc/Dockerfile
  37. 4
      blockchain-server/blockchain-server-otc/run.sh
  38. 21
      blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/common/config/ApplicationConfig.java
  39. 2
      blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/common/enums/OtcEnums.java
  40. 1
      blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/dto/ad/PublishAdParamDTO.java
  41. 2
      blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/entity/Ad.java
  42. 22
      blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/feign/YyyyfMoneyFeign.java
  43. 40
      blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/service/impl/AdServiceImpl.java
  44. 119
      blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/service/impl/OrderServiceImpl.java
  45. 28
      blockchain-server/blockchain-server-otc/src/main/java/com/blockchain/server/otc/service/impl/UserPayInfoServiceImpl.java
  46. 5
      blockchain-server/blockchain-server-sysconf/Dockerfile
  47. 4
      blockchain-server/blockchain-server-sysconf/run.sh
  48. 5
      blockchain-server/blockchain-server-user/Dockerfile
  49. 4
      blockchain-server/blockchain-server-user/run.sh
  50. 4
      blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/controller/LoginController.java
  51. 2
      blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/entity/AssessUser.java
  52. 8
      blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/AssessUserService.java
  53. 2
      blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/impl/AssessUserServiceImpl.java
  54. 10
      blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/impl/UserMainServiceImpl.java
  55. 5
      blockchain-server/blockchain-server-yyyf/Dockerfile
  56. 4
      blockchain-server/blockchain-server-yyyf/run.sh
  57. 52
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java
  58. 12
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java
  59. 37
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/YyyfMoneyController.java
  60. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/TeachingGradeApi.java
  61. 26
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/YyyfMoneyApi.java
  62. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/AssessUserDto.java
  63. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDetailsDto.java
  64. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/OverviewDto.java
  65. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ReExamOverviewDto.java
  66. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/TransactResultDto.java
  67. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/UserTimeMoneyDto.java
  68. 4
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfStudentAnswerDto.java
  69. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/AssessUser.java
  70. 4
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/YyyfMoney.java
  71. 4
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/BtcFeign.java
  72. 4
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/CurrencyFeign.java
  73. 3
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/feign/EosFeign.java
  74. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/IndicatorsUtils.java
  75. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/indicators/dto/LastAndFirstAssetsDto.java
  76. 47
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/InitData.java
  77. 33
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/InitProject.java
  78. 59
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/init/SpringContextUtil.java
  79. 13
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java
  80. 4
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTargetMapper.java
  81. 27
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/TrainCaseManageMapper.java
  82. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/YyyfMoneyMapper.java
  83. 34
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java
  84. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java
  85. 27
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/YyyfMoneyService.java
  86. 56
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java
  87. 76
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/YyyfMoneyServiceImpl.java
  88. 6
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/task/ScheduleTask.java
  89. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/HttpClientUtil.java
  90. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/IdGenerator.java
  91. 8
      blockchain-server/blockchain-server-yyyf/src/main/resources/bootstrap.yml
  92. 6
      blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserMapper.xml
  93. 6
      blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssetsReporterMapper.xml
  94. 36
      blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/TrainCaseManageMapper.xml
  95. 5
      build.sh
  96. 5
      pom.xml
  97. 1
      spring-cloud/pom.xml
  98. 5
      spring-cloud/spring-cloud-config/Dockerfile
  99. 4
      spring-cloud/spring-cloud-config/run.sh
  100. 2
      spring-cloud/spring-cloud-config/src/main/resources/properties/dbconf-dev.yml
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,7 +1,7 @@
package com.blockchain.common.base.constant; package com.blockchain.common.base.constant;
/** /**
* @author huan.xu * @author zijie
* @version 1.0 * @version 1.0
* @className CaseConstant * @className CaseConstant
* @description * @description

@ -7,7 +7,7 @@ import java.math.BigDecimal;
import java.util.Map; import java.util.Map;
/** /**
* @author huan.xu * @author zijie
* @version 1.0 * @version 1.0
* @className YyyfUserDto * @className YyyfUserDto
* @description * @description

@ -8,7 +8,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/** /**
* @author huan.xu * @author zijie
* @version 1.0 * @version 1.0
* @className YyyfUserDto * @className YyyfUserDto
* @description * @description
@ -36,7 +36,7 @@ public class YyyfUserDtoUtils {
/** /**
* @description 通过userId获取以渔有方用户信息 * @description 通过userId获取以渔有方用户信息
* @author huan.xu * @author zijie
* @date 2020-05-20 15:42:47 * @date 2020-05-20 15:42:47
* @param [userId, redisTemplate] * @param [userId, redisTemplate]
* @return com.blockchain.common.base.dto.YyyfUserDto * @return com.blockchain.common.base.dto.YyyfUserDto

@ -1,5 +0,0 @@
FROM registry.cn-hangzhou.aliyuncs.com/xuankai/jdk8-231
MAINTAINER fengyu.wang wfyvv@qq.com
ADD target/*.jar /app/app.jar
WORKDIR /app
CMD ["java", "-jar", "-Duser.timezone=Asia/ShangHai", "./app.jar"]

@ -1,4 +0,0 @@
workDir=$(cd `dirname $0`; pwd)
imagesName=$(basename $workDir | tr "[A-Z]" "[a-z]")
docker build -t registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName -f $workDir .
docker push registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName:latest

@ -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/resetWallet")
ResultDTO<Boolean> resetWallet(@RequestParam("assessUserId") String assessUserId, @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance);
}

@ -69,7 +69,7 @@ public interface BtcWalletMapper extends Mapper<BtcWallet> {
*/ */
List<BtcWalletDTO> selectAllByUserOpenId(@Param("userOpenId") String userOpenId, @Param("walletType") String walletType); List<BtcWalletDTO> selectAllByUserOpenId(@Param("userOpenId") String userOpenId, @Param("walletType") String walletType);
List<BtcWalletDTO> selectAll(@Param("userOpenId") String userOpenId); List<BtcWalletDTO> selectAllByOpenId(@Param("userOpenId") String userOpenId);
/** /**
* 用户充值修改钱包金额 * 用户充值修改钱包金额

@ -1,5 +1,8 @@
package com.blockchain.server.btc.service.impl; 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.constants.BtcTransferConstans;
import com.blockchain.server.btc.common.enums.BtcEnums; import com.blockchain.server.btc.common.enums.BtcEnums;
import com.blockchain.server.btc.common.exception.BtcException; 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.BtcWallet;
import com.blockchain.server.btc.entity.BtcWalletTransfer; import com.blockchain.server.btc.entity.BtcWalletTransfer;
import com.blockchain.server.btc.entity.WalletInitConfig; 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.BtcWalletMapper;
import com.blockchain.server.btc.mapper.WalletInitConfigMapper; import com.blockchain.server.btc.mapper.WalletInitConfigMapper;
import com.blockchain.server.btc.service.BtcApplicationService; 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.BtcWalletService;
import com.blockchain.server.btc.service.BtcWalletTransferService; import com.blockchain.server.btc.service.BtcWalletTransferService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -43,6 +48,12 @@ public class BtcWalletServiceImpl<psvm> implements BtcWalletService {
@Autowired @Autowired
private WalletInitConfigMapper walletInitConfigMapper; private WalletInitConfigMapper walletInitConfigMapper;
@Autowired
private YyyyfMoneyFeign yyyyfMoneyFeign;
@Autowired
private RedisTemplate redisTemplate;
@Override @Override
@Transactional @Transactional
public Integer insertWallet(String userOpenId) { public Integer insertWallet(String userOpenId) {
@ -93,7 +104,7 @@ public class BtcWalletServiceImpl<psvm> implements BtcWalletService {
@Override @Override
public List<BtcWalletDTO> selectAllByUserOpenId(String userOpenId) { public List<BtcWalletDTO> selectAllByUserOpenId(String userOpenId) {
return btcWalletMapper.selectAll(userOpenId); return btcWalletMapper.selectAllByOpenId(userOpenId);
} }
@Override @Override
@ -204,7 +215,14 @@ public class BtcWalletServiceImpl<psvm> implements BtcWalletService {
if (config == null || config.getBalance() == null) { if (config == null || config.getBalance() == null) {
throw new BtcException(BtcEnums.RESET_ERROR); throw new BtcException(BtcEnums.RESET_ERROR);
} }
btcWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(), userOpenId, tokenId, walletType, new Date()); YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userOpenId, redisTemplate);
ResultDTO<Boolean> 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());
}else {
throw new BtcException(BtcEnums.FREEBALANCE_NOT_ENOUGH);
}
return 1; return 1;
} }

@ -1,6 +1,7 @@
package com.blockchain.server.btc.service.impl; package com.blockchain.server.btc.service.impl;
import com.blockchain.common.base.dto.GasDTO; 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.WalletChangeDTO;
import com.blockchain.common.base.dto.WalletOrderDTO; import com.blockchain.common.base.dto.WalletOrderDTO;
import com.blockchain.server.btc.common.constants.BtcTransferConstans; 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.dto.BtcWalletTransferDTO;
import com.blockchain.server.btc.entity.BtcWalletTransfer; import com.blockchain.server.btc.entity.BtcWalletTransfer;
import com.blockchain.server.btc.feign.EthServerFegin; 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.mapper.BtcWalletTransferMapper;
import com.blockchain.server.btc.service.*; import com.blockchain.server.btc.service.*;
import com.codingapi.tx.annotation.ITxTransaction; import com.codingapi.tx.annotation.ITxTransaction;
import com.codingapi.tx.annotation.TxTransaction; import com.codingapi.tx.annotation.TxTransaction;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
@ -46,6 +48,12 @@ public class BtcWalletTransferServiceImpl implements BtcWalletTransferService, I
@Autowired @Autowired
private EthServerFegin ethServerFegin; private EthServerFegin ethServerFegin;
@Autowired
RedisTemplate redisTemplate;
@Autowired
private YyyyfMoneyFeign yyyyfMoneyFeign;
@Override @Override
public Integer insertTransfer(BtcWalletTransfer btcWalletTransfer) { public Integer insertTransfer(BtcWalletTransfer btcWalletTransfer) {
return btcWalletTransferMapper.insertSelective(btcWalletTransfer); return btcWalletTransferMapper.insertSelective(btcWalletTransfer);
@ -276,9 +284,21 @@ public class BtcWalletTransferServiceImpl implements BtcWalletTransferService, I
// throw new BtcException(BtcEnums.WITHDRAW_ERROR); // throw new BtcException(BtcEnums.WITHDRAW_ERROR);
// } // }
// } // }
btcWalletDTO= null;
String coinName="BTC";
if(tokenId==1){
coinName="USDT";
}
ResultDTO<Boolean> 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 /*@Override

@ -30,7 +30,7 @@
WHERE user_open_id = #{userOpenId} AND wallet_type = #{walletType} WHERE user_open_id = #{userOpenId} AND wallet_type = #{walletType}
</select> </select>
<select id="selectAll" resultMap="BtcWalletMap"> <select id="selectAllByOpenId" resultMap="BtcWalletMap">
SELECT * FROM SELECT * FROM
<include refid="tableName"/> <include refid="tableName"/>
WHERE user_open_id = #{userOpenId} WHERE user_open_id = #{userOpenId}

@ -1,5 +0,0 @@
FROM registry.cn-hangzhou.aliyuncs.com/xuankai/jdk8-231
MAINTAINER fengyu.wang wfyvv@qq.com
ADD target/*.jar /app/app.jar
WORKDIR /app
CMD ["java", "-jar", "-Duser.timezone=Asia/ShangHai", "./app.jar"]

@ -1,4 +0,0 @@
workDir=$(cd `dirname $0`; pwd)
imagesName=$(basename $workDir | tr "[A-Z]" "[a-z]")
docker build -t registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName -f $workDir .
docker push registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName:latest

@ -1,5 +0,0 @@
FROM registry.cn-hangzhou.aliyuncs.com/xuankai/jdk8-231
MAINTAINER fengyu.wang wfyvv@qq.com
ADD target/*.jar /app/app.jar
WORKDIR /app
CMD ["java", "-jar", "-Duser.timezone=Asia/ShangHai", "./app.jar"]

@ -1,4 +0,0 @@
workDir=$(cd `dirname $0`; pwd)
imagesName=$(basename $workDir | tr "[A-Z]" "[a-z]")
docker build -t registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName -f $workDir .
docker push registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName:latest

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.blockchain.server.currency.common.constant.BaseCoinEnums; import com.blockchain.server.currency.common.constant.BaseCoinEnums;
import com.blockchain.server.currency.common.constant.RatesEnums; import com.blockchain.server.currency.common.constant.RatesEnums;
import com.blockchain.server.currency.redis.MarketLegalCache; import com.blockchain.server.currency.redis.MarketLegalCache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable; import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -15,6 +16,7 @@ import org.springframework.web.client.RestTemplate;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@Slf4j
@Component @Component
@Configurable @Configurable
@EnableScheduling @EnableScheduling
@ -37,7 +39,7 @@ public class CurrencyMarketScheduling {
try { try {
setLegalMarket(); setLegalMarket();
} catch (Exception e) { } catch (Exception e) {
// e.printStackTrace(); log.error("CurrencyMarketScheduling.getCurrencyMarket: get currency market error", e);
} }
} }

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.blockchain.common.base.util.HttpUtilManager; import com.blockchain.common.base.util.HttpUtilManager;
import com.blockchain.server.currency.dto.CurrencyMarketDTO; import com.blockchain.server.currency.dto.CurrencyMarketDTO;
import com.blockchain.server.currency.service.CurrencyMarketService; import com.blockchain.server.currency.service.CurrencyMarketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable; import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -19,6 +20,7 @@ import java.util.concurrent.Executors;
@Component @Component
@Configurable @Configurable
@EnableScheduling @EnableScheduling
@Slf4j
public class HuobiMarketScheduling { public class HuobiMarketScheduling {
@Autowired @Autowired
@ -45,8 +47,12 @@ public class HuobiMarketScheduling {
private void setHuobiMarket() { private void setHuobiMarket() {
List<List> currencys = JSONObject.parseArray(huobiCurrencys,List.class); List<List> currencys = JSONObject.parseArray(huobiCurrencys,List.class);
for (List data : currencys){ for (List data : currencys){
saveMarket(getHuobiMarket(huobiUrl + data.get(0).toString()), try {
data.get(1).toString(),data.get(2).toString()); saveMarket(getHuobiMarket(huobiUrl + data.get(0).toString()),
data.get(1).toString(),data.get(2).toString());
} catch (Exception e) {
log.error("HuobiMarketScheduling.setHuobiMarket: save market error, data={}", data, e);
}
} }
} }
@ -60,13 +66,14 @@ public class HuobiMarketScheduling {
CurrencyMarketDTO now = currencyMarketService.get(coinName + "-" + unitName); CurrencyMarketDTO now = currencyMarketService.get(coinName + "-" + unitName);
for (JSONObject obj : list) { for (JSONObject obj : list) {
Long timestamp = Long.parseLong(obj.get("ts").toString()); Long timestamp = Long.parseLong(obj.get("ts").toString());
if(timestamp >= now.getTimestamp()) { if(now == null || timestamp >= now.getTimestamp()) {
List<JSONObject> data = (List<JSONObject>)obj.get("data"); List<JSONObject> data = (List<JSONObject>)obj.get("data");
currencyMarketService.save(coinName, unitName, currencyMarketService.save(coinName, unitName,
new BigDecimal(data.get(0).get("price").toString()), new BigDecimal(data.get(0).get("price").toString()),
new BigDecimal(data.get(0).get("amount").toString()), new BigDecimal(data.get(0).get("amount").toString()),
timestamp,data.get(0).get("direction").toString().toUpperCase()); timestamp,data.get(0).get("direction").toString().toUpperCase());
} else { } else {
log.warn("HuobiMarketScheduling.saveMarket: save market ignore");
break; break;
} }
} }

@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
@Api(CurrencyMarketInnerApi.MARKET_CONTROLLER_API) @Api(CurrencyMarketInnerApi.MARKET_CONTROLLER_API)
@ -43,4 +42,12 @@ public class CurrencyMarketInnerController {
return currencyMarketService.getList(); 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);
}
} }

@ -14,4 +14,10 @@ public class CurrencyMarketInnerApi {
public static final String METHOD_API_TRADINGTYPE = "成交类型"; 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 = "数字货币对";
}
} }

@ -51,8 +51,9 @@ public class MarketKCache {
} }
public void setMarketKListCache(SortedMap<String,CurrencyMarketKDTO> map, String currencyPair, String timeType, int timeNumber){ public void setMarketKListCache(SortedMap<String,CurrencyMarketKDTO> map, String currencyPair, String timeType, int timeNumber){
redisTemplate.opsForValue().set(MARKET_LIST_CACHE + currencyPair + ":" + timeNumber + timeType if (map != null && !map.isEmpty()) {
,map); redisTemplate.opsForValue().set(MARKET_LIST_CACHE + currencyPair + ":" + timeNumber + timeType, map);
}
} }
public SortedMap<String,CurrencyMarketKDTO> getMarketKListCache(String currencyPair, String timeType, int timeNumber){ public SortedMap<String,CurrencyMarketKDTO> getMarketKListCache(String currencyPair, String timeType, int timeNumber){

@ -21,8 +21,10 @@ import com.blockchain.server.currency.redis.MarketLegalCache;
import com.blockchain.server.currency.service.CurrencyMarketService; import com.blockchain.server.currency.service.CurrencyMarketService;
import com.blockchain.server.currency.service.CurrencyPairService; import com.blockchain.server.currency.service.CurrencyPairService;
import com.blockchain.server.currency.websocket.WebSocketSendMsgUtils; import com.blockchain.server.currency.websocket.WebSocketSendMsgUtils;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -32,6 +34,7 @@ import java.util.*;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@Slf4j
@Service @Service
public class CurrencyMarketServiceImpl implements CurrencyMarketService { public class CurrencyMarketServiceImpl implements CurrencyMarketService {
@ -95,24 +98,30 @@ public class CurrencyMarketServiceImpl implements CurrencyMarketService {
*/ */
@Override @Override
public CurrencyMarketDTO save(String coinName, String unitName, BigDecimal amount, BigDecimal total, Long timestamp, String tradingType) { public CurrencyMarketDTO save(String coinName, String unitName, BigDecimal amount, BigDecimal total, Long timestamp, String tradingType) {
String currencyPair = coinName + "-" + unitName; try {
//检测币对是否合法 String currencyPair = coinName + "-" + unitName;
checkCurrency(currencyPair); //检测币对是否合法
CurrencyMarket currencyMarket = new CurrencyMarket(); checkCurrency(currencyPair);
currencyMarket.setCurrencyPair(currencyPair); CurrencyMarket currencyMarket = new CurrencyMarket();
currencyMarket.setTotal(total); currencyMarket.setCurrencyPair(currencyPair);
currencyMarket.setAmount(amount); currencyMarket.setTotal(total);
currencyMarket.setTimestamp(timestamp); currencyMarket.setAmount(amount);
//保存新数据 currencyMarket.setTimestamp(timestamp);
save(currencyMarket); //保存新数据
CurrencyMarketDTO dto = new CurrencyMarketDTO(); save(currencyMarket);
BeanUtils.copyProperties(currencyMarket, dto); CurrencyMarketDTO dto = new CurrencyMarketDTO();
//发送历史成交记录信息 BeanUtils.copyProperties(currencyMarket, dto);
sendHistoryMsg(dto, tradingType); //发送历史成交记录信息
//添加缓存数据,发送行情变动信息 sendHistoryMsg(dto, tradingType);
setMarketCache(dto); //添加缓存数据,发送行情变动信息
setMarketCache(dto);
return dto;
return dto;
} catch (BeansException e) {
log.error("CurrencyMarketServiceImpl.save: save error, coinName={}, unitName={}, amount={}, total={}, timestamp={}, tradingType={}",
coinName, unitName, amount, total, timestamp, tradingType);
return null;
}
} }
@Override @Override
@ -122,6 +131,9 @@ public class CurrencyMarketServiceImpl implements CurrencyMarketService {
//获取一天的K线行情 //获取一天的K线行情
SortedMap<String, CurrencyMarketKDTO> map = getOneDayMarketK(currencyPair, SortedMap<String, CurrencyMarketKDTO> map = getOneDayMarketK(currencyPair,
MarketKTypeEnums.ONEDAY.getTimeType(), MarketKTypeEnums.ONEDAY.getTimeNumber()); MarketKTypeEnums.ONEDAY.getTimeType(), MarketKTypeEnums.ONEDAY.getTimeNumber());
if (map == null || map.isEmpty()) {
return null;
}
CurrencyMarketDTO dto = getMarketInfo(currencyPair, map); CurrencyMarketDTO dto = getMarketInfo(currencyPair, map);
return dto; return dto;
} }
@ -432,9 +444,9 @@ public class CurrencyMarketServiceImpl implements CurrencyMarketService {
ktype.getTimeType(), ktype.getTimeNumber()); ktype.getTimeType(), ktype.getTimeNumber());
if (lock) { if (lock) {
SortedMap<String, CurrencyMarketKDTO> map = marketKCache.getMarketKListCache(dto.getCurrencyPair(), ktype.getTimeType(), ktype.getTimeNumber()); SortedMap<String, CurrencyMarketKDTO> map = marketKCache.getMarketKListCache(dto.getCurrencyPair(), ktype.getTimeType(), ktype.getTimeNumber());
if (map == null) if (map == null || map.isEmpty())
map = selectMarketK(dto.getCurrencyPair(), ktype.getTimeType(), ktype.getTimeNumber()); map = selectMarketK(dto.getCurrencyPair(), ktype.getTimeType(), ktype.getTimeNumber());
if (map == null) continue; if (map == null || map.isEmpty()) continue;
Long timestamp = (dto.getTimestamp() / (ktype.getTimeNumber() * MarketKEnums.valueOf(ktype.getTimeType()).getSecond())) * ktype.getTimeNumber() * MarketKEnums.valueOf(ktype.getTimeType()).getSecond(); Long timestamp = (dto.getTimestamp() / (ktype.getTimeNumber() * MarketKEnums.valueOf(ktype.getTimeType()).getSecond())) * ktype.getTimeNumber() * MarketKEnums.valueOf(ktype.getTimeType()).getSecond();
CurrencyMarketKDTO kdto = map.get(timestamp.toString()); CurrencyMarketKDTO kdto = map.get(timestamp.toString());
if (kdto == null) { if (kdto == null) {
@ -608,7 +620,7 @@ public class CurrencyMarketServiceImpl implements CurrencyMarketService {
*/ */
private SortedMap<String, CurrencyMarketKDTO> getOneDayMarketK(String currencyPair, String timeType, Integer timeNumber) { private SortedMap<String, CurrencyMarketKDTO> getOneDayMarketK(String currencyPair, String timeType, Integer timeNumber) {
SortedMap<String, CurrencyMarketKDTO> map = marketKCache.getMarketKListCache(currencyPair, timeType, timeNumber); SortedMap<String, CurrencyMarketKDTO> map = marketKCache.getMarketKListCache(currencyPair, timeType, timeNumber);
if (map == null) { if (map == null || map.isEmpty()) {
boolean lock = marketKCache.tryFairLock(redissonClient, currencyPair, boolean lock = marketKCache.tryFairLock(redissonClient, currencyPair,
timeType, timeNumber); timeType, timeNumber);
if (lock) { if (lock) {

@ -1,5 +0,0 @@
FROM registry.cn-hangzhou.aliyuncs.com/xuankai/jdk8-231
MAINTAINER fengyu.wang wfyvv@qq.com
ADD target/*.jar /app/app.jar
WORKDIR /app
CMD ["java", "-jar", "-Duser.timezone=Asia/ShangHai", "./app.jar"]

@ -1,4 +0,0 @@
workDir=$(cd `dirname $0`; pwd)
imagesName=$(basename $workDir | tr "[A-Z]" "[a-z]")
docker build -t registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName -f $workDir .
docker push registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName:latest

@ -1,5 +0,0 @@
FROM registry.cn-hangzhou.aliyuncs.com/xuankai/jdk8-231
MAINTAINER fengyu.wang wfyvv@qq.com
ADD target/*.jar /app/app.jar
WORKDIR /app
CMD ["java", "-jar", "-Duser.timezone=Asia/ShangHai", "./app.jar"]

@ -1,4 +0,0 @@
workDir=$(cd `dirname $0`; pwd)
imagesName=$(basename $workDir | tr "[A-Z]" "[a-z]")
docker build -t registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName -f $workDir .
docker push registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName:latest

@ -19,7 +19,7 @@ public enum EosWalletEnums {
CURRENCY_FAILURE_ERROR(7008, "出币失败", "Currency failure.", "出幣失敗"), CURRENCY_FAILURE_ERROR(7008, "出币失败", "Currency failure.", "出幣失敗"),
INEXISTENCE_TX(12500, "该记录未找到", "The record was not found", "該記錄未找到"), INEXISTENCE_TX(12500, "该记录未找到", "The record was not found", "該記錄未找到"),
INEXISTENCE_WALLET(7017, "该钱包不存在", "The wallet does not exist.", "該錢包不存在"), INEXISTENCE_WALLET(7017, "该钱包不存在", "The wallet does not exist.", "該錢包不存在"),
FREEBALANCE_NOT_ENOUGH(7009, "钱包可用余额不足", "Insufficient balance available in wallet.", "錢包可用餘額不足")
; ;

@ -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/resetWallet")
ResultDTO<Boolean> resetWallet(@RequestParam("assessUserId") String assessUserId, @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance);
}

@ -1,12 +1,10 @@
package com.blockchain.server.eos.service.impl; package com.blockchain.server.eos.service.impl;
import com.blockchain.common.base.constant.BaseConstant; import com.blockchain.common.base.constant.BaseConstant;
import com.blockchain.common.base.dto.GasDTO; import com.blockchain.common.base.dto.*;
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.exception.RPCException; import com.blockchain.common.base.exception.RPCException;
import com.blockchain.common.base.util.ExceptionPreconditionUtils; 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.constant.EosConstant;
import com.blockchain.server.eos.common.enums.EosWalletEnums; import com.blockchain.server.eos.common.enums.EosWalletEnums;
import com.blockchain.server.eos.common.exception.EosWalletException; 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.entity.*;
import com.blockchain.server.eos.feign.UserServerFegin; import com.blockchain.server.eos.feign.UserServerFegin;
import com.blockchain.server.eos.feign.WalletTransferFegin; 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.WalletInitConfigMapper;
import com.blockchain.server.eos.mapper.WalletMapper; import com.blockchain.server.eos.mapper.WalletMapper;
import com.blockchain.server.eos.service.*; import com.blockchain.server.eos.service.*;
import com.codingapi.tx.annotation.ITxTransaction; import com.codingapi.tx.annotation.ITxTransaction;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
@ -55,6 +55,11 @@ public class EosWalletServiceImpl implements EosWalletService, ITxTransaction {
@Autowired @Autowired
private WalletInitConfigMapper walletInitConfigMapper; private WalletInitConfigMapper walletInitConfigMapper;
@Autowired
private YyyyfMoneyFeign yyyyfMoneyFeign;
@Autowired
private RedisTemplate redisTemplate;
/** /**
* 用户充值修改钱包金额 * 用户充值修改钱包金额
* *
@ -130,7 +135,15 @@ public class EosWalletServiceImpl implements EosWalletService, ITxTransaction {
walletTransfer.setTransferType(EosConstant.TransferType.TRANSFER_OUT); walletTransfer.setTransferType(EosConstant.TransferType.TRANSFER_OUT);
walletTransfer.setStatus(EosConstant.TransferStatus.SUCCESS); walletTransfer.setStatus(EosConstant.TransferStatus.SUCCESS);
walletTransfer.setTimestamp(now); walletTransfer.setTimestamp(now);
return eosWalletTransferService.insertWalletTransfer(walletTransfer);
ResultDTO<Boolean> 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;
} }
@ -387,8 +400,16 @@ public class EosWalletServiceImpl implements EosWalletService, ITxTransaction {
if (config == null || config.getBalance() == null) { if (config == null || config.getBalance() == null) {
throw new EosWalletException(EosWalletEnums.RESET_ERROR); throw new EosWalletException(EosWalletEnums.RESET_ERROR);
} }
// 修改钱包插入充值记录 YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userOpenId, redisTemplate);
walletMapper.updateWalletBalanceByUserOpenId(config.getBalance(), userOpenId, tokenId, walletType, new Date()); ResultDTO<Boolean> 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());
}else {
throw new EosWalletException(EosWalletEnums.FREEBALANCE_NOT_ENOUGH);
}
} }
} }

@ -1,5 +0,0 @@
FROM registry.cn-hangzhou.aliyuncs.com/xuankai/jdk8-231
MAINTAINER fengyu.wang wfyvv@qq.com
ADD target/*.jar /app/app.jar
WORKDIR /app
CMD ["java", "-jar", "-Duser.timezone=Asia/ShangHai", "./app.jar"]

@ -1,4 +0,0 @@
workDir=$(cd `dirname $0`; pwd)
imagesName=$(basename $workDir | tr "[A-Z]" "[a-z]")
docker build -t registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName -f $workDir .
docker push registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName:latest

@ -1,6 +1,7 @@
package com.blockchain.server.eth.common.enums; package com.blockchain.server.eth.common.enums;
public enum EthWalletEnums { public enum EthWalletEnums {
FREEBALANCE_NOT_ENOUGH(7009, "钱包可用余额不足", "Insufficient balance available in wallet.", "錢包可用餘額不足"),
SUCCESS(200, "请求成功", "Request success", ""), SUCCESS(200, "请求成功", "Request success", ""),
RESET_ERROR(7001, "查无初始额度设置,充值失败", "Check no initial limit Settings, recharge failed", "查無初始額度設置,充值失敗"), RESET_ERROR(7001, "查无初始额度设置,充值失败", "Check no initial limit Settings, recharge failed", "查無初始額度設置,充值失敗"),
NO_LOGIN(201, "未登录", "No login", ""), NO_LOGIN(201, "未登录", "No login", ""),

@ -1,23 +1,18 @@
package com.blockchain.server.eth.controller; package com.blockchain.server.eth.controller;
import com.blockchain.common.base.constant.BaseConstant;
import com.blockchain.common.base.dto.ResultDTO; import com.blockchain.common.base.dto.ResultDTO;
import com.blockchain.common.base.dto.SessionUserDTO; import com.blockchain.common.base.dto.SessionUserDTO;
import com.blockchain.common.base.exception.RPCException;
import com.blockchain.common.base.util.SSOHelper; import com.blockchain.common.base.util.SSOHelper;
import com.blockchain.server.eth.common.enums.EthWalletEnums;
import com.blockchain.server.eth.common.exception.EthWalletException;
import com.blockchain.server.eth.controller.api.EthTokenApi;
import com.blockchain.server.eth.controller.api.EthWalletApi; import com.blockchain.server.eth.controller.api.EthWalletApi;
import com.blockchain.server.eth.entity.EthWalletTransfer; import com.blockchain.server.eth.entity.EthWalletTransfer;
import com.blockchain.server.eth.feign.UserFeign; import com.blockchain.server.eth.feign.UserFeign;
import com.blockchain.server.eth.service.IEthTokenService;
import com.blockchain.server.eth.service.IEthWalletKeyService; import com.blockchain.server.eth.service.IEthWalletKeyService;
import com.blockchain.server.eth.service.IEthWalletService; import com.blockchain.server.eth.service.IEthWalletService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.apache.tomcat.jni.User; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -43,6 +38,8 @@ public class EthWalletController {
private UserFeign userFeign; private UserFeign userFeign;
private static final Logger LOG = LoggerFactory.getLogger(EthWalletController.class);
@ApiOperation(value = EthWalletApi.GetWallet.METHOD_API_NAME, notes = EthWalletApi.GetWallet.METHOD_API_NOTE) @ApiOperation(value = EthWalletApi.GetWallet.METHOD_API_NAME, notes = EthWalletApi.GetWallet.METHOD_API_NOTE)
@GetMapping("/getWallet") @GetMapping("/getWallet")
public ResultDTO getWallet( public ResultDTO getWallet(
@ -95,13 +92,14 @@ public class EthWalletController {
@ApiParam(EthWalletApi.SaveWalletPass.METHOD_API_CODE) @RequestParam(name = "code", required = false) String code, @ApiParam(EthWalletApi.SaveWalletPass.METHOD_API_CODE) @RequestParam(name = "code", required = false) String code,
HttpServletRequest request) { HttpServletRequest request) {
SessionUserDTO user = SSOHelper.getUser(redisTemplate, request); SessionUserDTO user = SSOHelper.getUser(redisTemplate, request);
ResultDTO resultDTO = userFeign.validateSmsg(code, user.getTel()); /* ResultDTO resultDTO = userFeign.validateSmsg(code, user.getTel());
if (resultDTO == null) { if (resultDTO == null) {
throw new EthWalletException(EthWalletEnums.SERVER_IS_TOO_BUSY); throw new EthWalletException(EthWalletEnums.SERVER_IS_TOO_BUSY);
} }
if (resultDTO.getCode() != BaseConstant.REQUEST_SUCCESS) { if (resultDTO.getCode() != BaseConstant.REQUEST_SUCCESS) {
throw new RPCException(resultDTO.getCode(), resultDTO.getMsg()); throw new RPCException(resultDTO.getCode(), resultDTO.getMsg());
} }*/
LOG.info(" user yyyfUserId : "+ user.getYyyfUserId());
ethWalletService.updatePassword(user.getId(), password); ethWalletService.updatePassword(user.getId(), password);
return ResultDTO.requstSuccess(); return ResultDTO.requstSuccess();
} }

@ -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/resetWallet")
ResultDTO<Boolean> resetWallet(@RequestParam("assessUserId") String assessUserId, @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance);
}

@ -2,12 +2,10 @@ package com.blockchain.server.eth.service.impl;
import com.blockchain.common.base.constant.BaseConstant; import com.blockchain.common.base.constant.BaseConstant;
import com.blockchain.common.base.dto.GasDTO; import com.blockchain.common.base.dto.*;
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.exception.RPCException; import com.blockchain.common.base.exception.RPCException;
import com.blockchain.common.base.util.ExceptionPreconditionUtils; 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.constants.EthWalletConstants;
import com.blockchain.server.eth.common.enums.EthWalletEnums; import com.blockchain.server.eth.common.enums.EthWalletEnums;
import com.blockchain.server.eth.common.exception.EthWalletException; import com.blockchain.server.eth.common.exception.EthWalletException;
@ -18,12 +16,15 @@ import com.blockchain.server.eth.dto.EthWalletDTO;
import com.blockchain.server.eth.dto.Web3jTransferDTO; import com.blockchain.server.eth.dto.Web3jTransferDTO;
import com.blockchain.server.eth.entity.*; import com.blockchain.server.eth.entity.*;
import com.blockchain.server.eth.feign.UserFeign; 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.EthWalletMapper;
import com.blockchain.server.eth.mapper.WalletInitConfigMapper; import com.blockchain.server.eth.mapper.WalletInitConfigMapper;
import com.blockchain.server.eth.service.*; import com.blockchain.server.eth.service.*;
import com.blockchain.server.eth.web3j.IWalletWeb3j; import com.blockchain.server.eth.web3j.IWalletWeb3j;
import com.codingapi.tx.annotation.ITxTransaction; import com.codingapi.tx.annotation.ITxTransaction;
import com.codingapi.tx.annotation.TxTransaction; import com.codingapi.tx.annotation.TxTransaction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -62,6 +63,10 @@ public class EthWalletServiceImpl implements IEthWalletService, ITxTransaction {
IWalletWeb3j walletWeb3j; IWalletWeb3j walletWeb3j;
@Autowired @Autowired
RedisTemplate redisTemplate; RedisTemplate redisTemplate;
@Autowired
private YyyyfMoneyFeign yyyyfMoneyFeign;
@Autowired @Autowired
private WalletInitConfigMapper walletInitConfigMapper; private WalletInitConfigMapper walletInitConfigMapper;
@ -75,6 +80,7 @@ public class EthWalletServiceImpl implements IEthWalletService, ITxTransaction {
return ethWalletMapper.select(ethWallet); return ethWalletMapper.select(ethWallet);
} }
private static Logger LOG= LoggerFactory.getLogger(EthWalletServiceImpl.class);
@Override @Override
@Transactional @Transactional
public EthWalletDTO insert(String userOpenId, String tokenAddr, String walletType, String pass) { public EthWalletDTO insert(String userOpenId, String tokenAddr, String walletType, String pass) {
@ -331,6 +337,12 @@ public class EthWalletServiceImpl implements IEthWalletService, ITxTransaction {
// EthWalletConstants.TransferType.OUT, EthWalletConstants.StatusType.OUT_LOAD1, date); // EthWalletConstants.TransferType.OUT, EthWalletConstants.StatusType.OUT_LOAD1, date);
// } // }
// } // }
ResultDTO<Boolean> 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; return tx;
} }
@ -435,7 +447,18 @@ public class EthWalletServiceImpl implements IEthWalletService, ITxTransaction {
if(config==null || config.getBalance()==null){ if(config==null || config.getBalance()==null){
throw new EthWalletException(EthWalletEnums.RESET_ERROR); throw new EthWalletException(EthWalletEnums.RESET_ERROR);
} }
ethWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date()); YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userOpenId, redisTemplate);
LOG.info(yyyfUserDto.toString());
LOG.info("yyyfUserDtoID "+yyyfUserDto.getUserId());
ResultDTO<Boolean> 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());
}else {
throw new EthWalletException(EthWalletEnums.FREEBALANCE_NOT_ENOUGH);
}
} }

@ -1,5 +0,0 @@
FROM registry.cn-hangzhou.aliyuncs.com/xuankai/jdk8-231
MAINTAINER fengyu.wang wfyvv@qq.com
ADD target/*.jar /app/app.jar
WORKDIR /app
CMD ["java", "-jar", "-Duser.timezone=Asia/ShangHai", "./app.jar"]

@ -1,4 +0,0 @@
workDir=$(cd `dirname $0`; pwd)
imagesName=$(basename $workDir | tr "[A-Z]" "[a-z]")
docker build -t registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName -f $workDir .
docker push registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName:latest

@ -1,5 +0,0 @@
FROM registry.cn-hangzhou.aliyuncs.com/xuankai/jdk8-231
MAINTAINER fengyu.wang wfyvv@qq.com
ADD target/*.jar /app/app.jar
WORKDIR /app
CMD ["java", "-jar", "-Duser.timezone=Asia/ShangHai", "./app.jar"]

@ -1,4 +0,0 @@
workDir=$(cd `dirname $0`; pwd)
imagesName=$(basename $workDir | tr "[A-Z]" "[a-z]")
docker build -t registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName -f $workDir .
docker push registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName:latest

@ -0,0 +1,21 @@
package com.blockchain.server.otc.common.config;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
import java.util.concurrent.ThreadPoolExecutor;
@Component
public class ApplicationConfig {
@Bean
public ThreadPoolTaskExecutor executor() {
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
threadPoolTaskExecutor.setCorePoolSize(5);
threadPoolTaskExecutor.setMaxPoolSize(10);
threadPoolTaskExecutor.setQueueCapacity(50);
threadPoolTaskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
threadPoolTaskExecutor.setThreadNamePrefix("executor-");
return threadPoolTaskExecutor;
}
}

@ -3,6 +3,8 @@ package com.blockchain.server.otc.common.enums;
import lombok.Getter; import lombok.Getter;
public enum OtcEnums { 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!"), PASS_NULL(8701, "请输入密码!", "Please enter password!"),
USERID_NULL(8702, "用户id为空!", "User id is empty!"), USERID_NULL(8702, "用户id为空!", "User id is empty!"),
PUBLISH_AD_COIN_NULL(8703, "请选择交易货币!", "Please select the currency of exchange!"), PUBLISH_AD_COIN_NULL(8703, "请选择交易货币!", "Please select the currency of exchange!"),

@ -17,4 +17,5 @@ public class PublishAdParamDTO extends BaseDTO {
private BigDecimal minLimit; private BigDecimal minLimit;
private String[] payType; private String[] payType;
private String remark; private String remark;
private Boolean isTeacher;
} }

@ -52,6 +52,8 @@ public class Ad extends BaseModel {
private String adStatus; private String adStatus;
@Column(name = "ad_remark") @Column(name = "ad_remark")
private String adRemark; private String adRemark;
@Column(name = "built_in")
private Boolean builtIn;
@Column(name = "create_time") @Column(name = "create_time")
private java.util.Date createTime; private java.util.Date createTime;
@Column(name = "modify_time") @Column(name = "modify_time")

@ -0,0 +1,22 @@
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<Boolean> resetWallet(@RequestParam("assessUserId") String assessUserId, @RequestParam("coinName") String coinName, @RequestParam("balance") BigDecimal balance);
}

@ -15,6 +15,7 @@ import com.blockchain.server.otc.mapper.AdMapper;
import com.blockchain.server.otc.service.*; import com.blockchain.server.otc.service.*;
import com.codingapi.tx.annotation.ITxTransaction; import com.codingapi.tx.annotation.ITxTransaction;
import com.codingapi.tx.annotation.TxTransaction; import com.codingapi.tx.annotation.TxTransaction;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -62,7 +63,7 @@ public class AdServiceImpl implements AdService, ITxTransaction {
//广告手续费率 //广告手续费率
BigDecimal serviceCharge = checkAdServiceCharge(coin.getCoinServiceCharge(), param.getUserId()); BigDecimal serviceCharge = checkAdServiceCharge(coin.getCoinServiceCharge(), param.getUserId());
//新建广告数据,返回广告流水号 //新建广告数据,返回广告流水号
String adNumber = insertAd(param, CommonConstans.BUY, serviceCharge); String adNumber = insertAd(param, CommonConstans.BUY, serviceCharge, false);
//新增用户交易数据表 //新增用户交易数据表
dealStatsService.insertIsNotExist(param.getUserId()); dealStatsService.insertIsNotExist(param.getUserId());
//记录用户操作 //记录用户操作
@ -75,16 +76,22 @@ public class AdServiceImpl implements AdService, ITxTransaction {
public void publishSellAd(PublishAdParamDTO param) { public void publishSellAd(PublishAdParamDTO param) {
//发布广告参数校验方法 //发布广告参数校验方法
Coin coin = publishAdVerify(param); Coin coin = publishAdVerify(param);
//检查市商否能发布更多广告 String adNumber;
checkMarketAdCount(param.getUserId(), CommonConstans.SELL, coin.getCoinName(), coin.getUnitName()); if (BooleanUtils.isFalse(param.getIsTeacher())) {
//检查卖家是否绑定支付方式 //检查市商否能发布更多广告
checkPublishPaysIsBinging(param); checkMarketAdCount(param.getUserId(), CommonConstans.SELL, coin.getCoinName(), coin.getUnitName());
//判断是否开启广告手续费 //检查卖家是否绑定支付方式
BigDecimal chargeRatio = checkAdServiceCharge(coin.getCoinServiceCharge(), param.getUserId()); checkPublishPaysIsBinging(param);
//新建广告数据,返回广告流水号 //判断是否开启广告手续费
String adNumber = insertAd(param, CommonConstans.SELL, chargeRatio); BigDecimal chargeRatio = checkAdServiceCharge(coin.getCoinServiceCharge(), param.getUserId());
//更新钱包并记录资金变动 //新建广告数据,返回广告流水号
publishSellAdHandleWallet(param, adNumber, chargeRatio); adNumber = insertAd(param, CommonConstans.SELL, chargeRatio, false);
//更新钱包并记录资金变动
publishSellAdHandleWallet(param, adNumber, chargeRatio);
} else {
//新建广告数据,返回广告流水号
adNumber = insertAd(param, CommonConstans.SELL, BigDecimal.ZERO, true);
}
//新增用户交易数据表 //新增用户交易数据表
dealStatsService.insertIsNotExist(param.getUserId()); dealStatsService.insertIsNotExist(param.getUserId());
//记录用户操作 //记录用户操作
@ -216,9 +223,11 @@ public class AdServiceImpl implements AdService, ITxTransaction {
//检查发布参数 //检查发布参数
checkPublishParam(param); checkPublishParam(param);
//判断用户是否可以发布广告 //判断用户是否可以发布广告
marketUserService.checkMarketUser(param.getUserId()); if (BooleanUtils.isFalse(param.getIsTeacher())) {
//检查密码 marketUserService.checkMarketUser(param.getUserId());
walletService.isPassword(param.getPass()); //检查密码
walletService.isPassword(param.getPass());
}
//检查币对 //检查币对
Coin coin = checkCoinIsNull(param.getCoinName(), param.getUnitName()); Coin coin = checkCoinIsNull(param.getCoinName(), param.getUnitName());
//检查发布数量、单价小数长度、单价下限是否合法 //检查发布数量、单价小数长度、单价下限是否合法
@ -452,7 +461,7 @@ public class AdServiceImpl implements AdService, ITxTransaction {
* @param coinChargeRaito * @param coinChargeRaito
* @return adNumber * @return adNumber
*/ */
private String insertAd(PublishAdParamDTO param, String adType, BigDecimal coinChargeRaito) { private String insertAd(PublishAdParamDTO param, String adType, BigDecimal coinChargeRaito, boolean buildIn) {
//检查发布支付类型与枚举是否正确,并返回支付信息字符串 //检查发布支付类型与枚举是否正确,并返回支付信息字符串
String pays = checkPaysTypeIsRealAndGeneratePayStr(param.getPayType()); String pays = checkPaysTypeIsRealAndGeneratePayStr(param.getPayType());
@ -472,6 +481,7 @@ public class AdServiceImpl implements AdService, ITxTransaction {
ad.setUnitName(param.getUnitName()); ad.setUnitName(param.getUnitName());
ad.setCoinName(param.getCoinName()); ad.setCoinName(param.getCoinName());
ad.setAdPay(pays); ad.setAdPay(pays);
ad.setBuiltIn(buildIn);
ad.setAdStatus(AdConstants.DEFAULT); ad.setAdStatus(AdConstants.DEFAULT);
ad.setAdType(adType); ad.setAdType(adType);
ad.setAdRemark(param.getRemark()); ad.setAdRemark(param.getRemark());

@ -2,25 +2,36 @@ package com.blockchain.server.otc.service.impl;
import com.blockchain.common.base.constant.PushConstants; import com.blockchain.common.base.constant.PushConstants;
import com.blockchain.common.base.dto.ResultDTO; 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.enums.PushEnums;
import com.blockchain.common.base.util.YyyfUserDtoUtils;
import com.blockchain.server.otc.common.constant.*; import com.blockchain.server.otc.common.constant.*;
import com.blockchain.server.otc.common.enums.*; import com.blockchain.server.otc.common.enums.JgMsgEnums;
import com.blockchain.server.otc.common.enums.OtcEnums;
import com.blockchain.server.otc.common.exception.OtcException; import com.blockchain.server.otc.common.exception.OtcException;
import com.blockchain.server.otc.common.util.CheckDecimalUtil; import com.blockchain.server.otc.common.util.CheckDecimalUtil;
import com.blockchain.server.otc.common.util.ImUtil; import com.blockchain.server.otc.common.util.ImUtil;
import com.blockchain.server.otc.dto.order.OrderDTO; import com.blockchain.server.otc.dto.order.OrderDTO;
import com.blockchain.server.otc.dto.user.UserBaseDTO; import com.blockchain.server.otc.dto.user.UserBaseDTO;
import com.blockchain.server.otc.entity.*; import com.blockchain.server.otc.entity.Ad;
import com.blockchain.server.otc.entity.Coin;
import com.blockchain.server.otc.entity.Order;
import com.blockchain.server.otc.entity.UserPayInfo;
import com.blockchain.server.otc.feign.PushFeign; import com.blockchain.server.otc.feign.PushFeign;
import com.blockchain.server.otc.feign.UserFeign; 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.mapper.OrderMapper;
import com.blockchain.server.otc.redis.OrderCache; import com.blockchain.server.otc.redis.OrderCache;
import com.blockchain.server.otc.service.*; import com.blockchain.server.otc.service.*;
import com.codingapi.tx.annotation.ITxTransaction; import com.codingapi.tx.annotation.ITxTransaction;
import com.codingapi.tx.annotation.TxTransaction; import com.codingapi.tx.annotation.TxTransaction;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -60,6 +71,14 @@ public class OrderServiceImpl implements OrderService, ITxTransaction {
private ImUtil imUtil; private ImUtil imUtil;
@Autowired @Autowired
private OrderCache orderCache; private OrderCache orderCache;
@Autowired
private YyyyfMoneyFeign yyyyfMoneyFeign;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private ApplicationContext applicationContext;
@Autowired
private ThreadPoolTaskExecutor executor;
private static final BigDecimal DECIMAL_DISH = new BigDecimal("0.1"); //下单金额计算的偏差值 private static final BigDecimal DECIMAL_DISH = new BigDecimal("0.1"); //下单金额计算的偏差值
@ -256,7 +275,7 @@ public class OrderServiceImpl implements OrderService, ITxTransaction {
} }
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class)
public void pay(String userId, String orderId, String payType) { public void pay(String userId, String orderId, String payType) {
//订单id判空 //订单id判空
checkOrderIdNull(orderId); checkOrderIdNull(orderId);
@ -278,15 +297,29 @@ public class OrderServiceImpl implements OrderService, ITxTransaction {
checkPayTypeIsAdPayType(payType, ad.getAdPay()); checkPayTypeIsAdPayType(payType, ad.getAdPay());
//确认支付时,设置订单支付信息 //确认支付时,设置订单支付信息
order.setOrderPayType(payType); order.setOrderPayType(payType);
//更新订单状态
receiptOrPayUpdateOrder(order, UserHandleConstants.PAY);
//记录用户操作 YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userId, redisTemplate);
insertUserHandleLog(userId, order.getOrderNumber(), UserHandleConstants.PAY); ResultDTO<Boolean> resultDTO = yyyyfMoneyFeign.resetWallet(yyyfUserDto.getAssessUserId(), payType, BigDecimal.ZERO.subtract(order.getTurnover()));
//确认付款发送提示消息
sendNewOrderMsg(JgMsgEnums.CONFIRM_BUYER_SELL.getName(), JgMsgEnums.CONFIRM_BUYER_BUY.getName(),
order.getSellUserId(), order.getBuyUserId(), order.getId()); if (resultDTO.getCode() == 200 && resultDTO.getData()) {
//发送手机消息通知 //更新订单状态
pushToSingle(order.getSellUserId(), order.getId(), PushEnums.OTC_ORDER_PAY.getPushType()); receiptOrPayUpdateOrder(order, UserHandleConstants.PAY);
//记录用户操作
insertUserHandleLog(userId, order.getOrderNumber(), UserHandleConstants.PAY);
//确认付款发送提示消息
sendNewOrderMsg(JgMsgEnums.CONFIRM_BUYER_SELL.getName(), JgMsgEnums.CONFIRM_BUYER_BUY.getName(),
order.getSellUserId(), order.getBuyUserId(), order.getId());
//发送手机消息通知
pushToSingle(order.getSellUserId(), order.getId(), PushEnums.OTC_ORDER_PAY.getPushType());
} else {
throw new OtcException(OtcEnums.FREEBALANCE_NOT_ENOUGH);
}
if (BooleanUtils.isTrue(ad.getBuiltIn())) {
executor.execute(() -> applicationContext.getBean(OrderService.class).receipt(order.getSellUserId(), orderId, "123456"));
}
} }
@Override @Override
@ -295,29 +328,41 @@ public class OrderServiceImpl implements OrderService, ITxTransaction {
public void receipt(String userId, String orderId, String pass) { public void receipt(String userId, String orderId, String pass) {
//订单id判空 //订单id判空
checkOrderIdNull(orderId); checkOrderIdNull(orderId);
//校验密码
walletService.isPassword(pass);
//排他锁查询订单 //排他锁查询订单
Order order = orderMapper.selectByIdForUpdate(orderId); Order order = orderMapper.selectByIdForUpdate(orderId);
//订单是否存在 //订单是否存在
checkOrderNull(order); checkOrderNull(order);
//校验密码
Ad ad = adService.selectById(order.getAdId());
if (BooleanUtils.isFalse(ad.getBuiltIn())) {
walletService.isPassword(pass);
}
//检查订单能否确认收款 //检查订单能否确认收款
checkOrderCanHandle(order, userId, UserHandleConstants.RECEIPT); checkOrderCanHandle(order, userId, UserHandleConstants.RECEIPT);
//更新订单状态
receiptOrPayUpdateOrder(order, UserHandleConstants.RECEIPT); YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDtoByUserId(userId, redisTemplate);
//记录用户操作 ResultDTO<Boolean> resultDTO = yyyyfMoneyFeign.resetWallet(yyyfUserDto.getAssessUserId(), order.getOrderPayType(), order.getTurnover());
insertUserHandleLog(userId, order.getOrderNumber(), UserHandleConstants.RECEIPT); if (resultDTO.getCode() == 200 && resultDTO.getData()) {
//更新广告发布方成交统计数据
updateAdUserDealStats(order);
//更新余额并记录资金变动 //更新订单状态
receiptUpdateBalance(order); receiptOrPayUpdateOrder(order, UserHandleConstants.RECEIPT);
//判断广告是否可以结束 //记录用户操作
checkAdCanFinish(order.getAdId()); insertUserHandleLog(userId, order.getOrderNumber(), UserHandleConstants.RECEIPT);
//确认收款发送提示消息 //更新广告发布方成交统计数据
sendNewOrderMsg(JgMsgEnums.CONFIRM_SELLER_SELL.getName(), JgMsgEnums.CONFIRM_SELLER_BUY.getName(), updateAdUserDealStats(order);
order.getSellUserId(), order.getBuyUserId(), order.getId()); //更新余额并记录资金变动
//发送手机消息通知 receiptUpdateBalance(order);
pushToSingle(order.getBuyUserId(), order.getId(), PushEnums.OTC_ORDER_RECEIPT.getPushType()); //判断广告是否可以结束
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 @Override
@ -377,7 +422,9 @@ public class OrderServiceImpl implements OrderService, ITxTransaction {
//判断广告类型是否正确 //判断广告类型是否正确
checkAdType(ad.getAdType(), adType); checkAdType(ad.getAdType(), adType);
//检查下单用户是不是广告发布用户 //检查下单用户是不是广告发布用户
checkAdUserAndOrderUserEquals(ad.getUserId(), userId); if (!ad.getBuiltIn()) {
checkAdUserAndOrderUserEquals(ad.getUserId(), userId);
}
//检查检查下单数量、单价是否合法 //检查检查下单数量、单价是否合法
checkAmountAndPrice(ad, amount, price); checkAmountAndPrice(ad, amount, price);
@ -1011,10 +1058,12 @@ public class OrderServiceImpl implements OrderService, ITxTransaction {
walletService.handleRealBalance(order.getBuyUserId(), order.getOrderNumber(), order.getCoinName(), order.getUnitName(), realAmount, BigDecimal.ZERO, serviceCharge); walletService.handleRealBalance(order.getBuyUserId(), order.getOrderNumber(), order.getCoinName(), order.getUnitName(), realAmount, BigDecimal.ZERO, serviceCharge);
//记录资金变动 //记录资金变动
billService.insertBill(order.getBuyUserId(), order.getOrderNumber(), realAmount, BigDecimal.ZERO, BillConstants.MARK, order.getCoinName()); billService.insertBill(order.getBuyUserId(), order.getOrderNumber(), realAmount, BigDecimal.ZERO, BillConstants.MARK, order.getCoinName());
//卖家解冻 if (BooleanUtils.isFalse(ad.getBuiltIn())) {
walletService.handleRealBalance(order.getSellUserId(), order.getOrderNumber(), order.getCoinName(), order.getUnitName(), BigDecimal.ZERO, minusAmount, BigDecimal.ZERO); //卖家解冻
//记录资金变动 walletService.handleRealBalance(order.getSellUserId(), order.getOrderNumber(), order.getCoinName(), order.getUnitName(), BigDecimal.ZERO, minusAmount, BigDecimal.ZERO);
billService.insertBill(order.getSellUserId(), order.getOrderNumber(), BigDecimal.ZERO, minusAmount, BillConstants.MARK, order.getCoinName()); //记录资金变动
billService.insertBill(order.getSellUserId(), order.getOrderNumber(), BigDecimal.ZERO, minusAmount, BillConstants.MARK, order.getCoinName());
}
} }
/*** /***
@ -1037,7 +1086,7 @@ public class OrderServiceImpl implements OrderService, ITxTransaction {
//falge为卖 //falge为卖
boolean flag = checkBuyOrSell(ad.getAdType()); boolean flag = checkBuyOrSell(ad.getAdType());
//广告是卖出类型时 并且 有剩余数量时,解冻余额 //广告是卖出类型时 并且 有剩余数量时,解冻余额
if (!flag && ad.getLastNum().compareTo(BigDecimal.ZERO) > 0) { if (!flag && BooleanUtils.isFalse(ad.getBuiltIn()) && ad.getLastNum().compareTo(BigDecimal.ZERO) > 0) {
//广告手续费 //广告手续费
BigDecimal serviceCharge = ad.getLastNum().multiply(ad.getChargeRatio()); BigDecimal serviceCharge = ad.getLastNum().multiply(ad.getChargeRatio());
//增加可用 //增加可用

@ -17,10 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Service @Service
public class UserPayInfoServiceImpl implements UserPayInfoService { public class UserPayInfoServiceImpl implements UserPayInfoService {
@ -55,14 +52,23 @@ public class UserPayInfoServiceImpl implements UserPayInfoService {
Ad ad = adService.selectById(order.getAdId()); Ad ad = adService.selectById(order.getAdId());
//获取广告设置的支付信息 //获取广告设置的支付信息
String[] pays = ad.getAdPay().split(","); String[] pays = ad.getAdPay().split(",");
//遍历查询支付信息,添加到集合中 if (ad.getBuiltIn()) {
for (String pay : pays) { Arrays.stream(pays).forEach(pay -> {
UserPayInfo userPayInfo = selectByUserIdAndPayType(order.getSellUserId(), pay); UserPayInfo userPayInfo = new UserPayInfo();
//防空 userPayInfo.setUserId(order.getSellUserId());
if (userPayInfo == null) { userPayInfo.setPayType(pay);
continue; userPayInfos.add(userPayInfo);
});
} else {
//遍历查询支付信息,添加到集合中
for (String pay : pays) {
UserPayInfo userPayInfo = selectByUserIdAndPayType(order.getSellUserId(), pay);
//防空
if (userPayInfo == null) {
continue;
}
userPayInfos.add(userPayInfo);
} }
userPayInfos.add(userPayInfo);
} }
} else { } else {
//其他状态时,查询确认付款后选择的支付方式 //其他状态时,查询确认付款后选择的支付方式

@ -1,5 +0,0 @@
FROM registry.cn-hangzhou.aliyuncs.com/xuankai/jdk8-231
MAINTAINER fengyu.wang wfyvv@qq.com
ADD target/*.jar /app/app.jar
WORKDIR /app
CMD ["java", "-jar", "-Duser.timezone=Asia/ShangHai", "./app.jar"]

@ -1,4 +0,0 @@
workDir=$(cd `dirname $0`; pwd)
imagesName=$(basename $workDir | tr "[A-Z]" "[a-z]")
docker build -t registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName -f $workDir .
docker push registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName:latest

@ -1,5 +0,0 @@
FROM registry.cn-hangzhou.aliyuncs.com/xuankai/jdk8-231
MAINTAINER fengyu.wang wfyvv@qq.com
ADD target/*.jar /app/app.jar
WORKDIR /app
CMD ["java", "-jar", "-Duser.timezone=Asia/ShangHai", "./app.jar"]

@ -1,4 +0,0 @@
workDir=$(cd `dirname $0`; pwd)
imagesName=$(basename $workDir | tr "[A-Z]" "[a-z]")
docker build -t registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName -f $workDir .
docker push registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName:latest

@ -168,8 +168,10 @@ public class LoginController {
@ApiOperation(value = LoginApi.PassWorldLoginPC.METHOD_NAME, @ApiOperation(value = LoginApi.PassWorldLoginPC.METHOD_NAME,
notes = LoginApi.PassWorldLoginPC.METHOD_NOTE) notes = LoginApi.PassWorldLoginPC.METHOD_NOTE)
public ResultDTO loginByPasswordPC(@ApiParam(LoginApi.PassWorldLoginPC.METHOD_API_TEL) @RequestParam(name = "tel") String tel, public ResultDTO loginByPasswordPC(@ApiParam(LoginApi.PassWorldLoginPC.METHOD_API_TEL) @RequestParam(name = "tel") String tel,
@ApiParam(LoginApi.PassWorldLoginPC.METHOD_API_PASS) @RequestParam(name = "password") String password) { @ApiParam(LoginApi.PassWorldLoginPC.METHOD_API_PASS) @RequestParam(name = "password") String password,
HttpServletRequest request) {
UserMain userMain = userLoginService.handleLoginByPassword(tel, password); UserMain userMain = userLoginService.handleLoginByPassword(tel, password);
dealBindYyyfAccount(userMain.getId(),request);
return handleAfterLogin(userMain, TokenTypeEnums.PC.getValue()); return handleAfterLogin(userMain, TokenTypeEnums.PC.getValue());
} }

@ -61,7 +61,7 @@ public class AssessUser implements Serializable {
* 时长 * 时长
*/ */
@Column(name = "duration") @Column(name = "duration")
private Integer duration; private Long duration;
/** /**
* 时长单位 * 时长单位
*/ */

@ -9,7 +9,7 @@ import java.util.List;
/** /**
* @param * @param
* @author huan.xu * @author zijie
* @description 学生用户考核信息表 服务接口类 * @description 学生用户考核信息表 服务接口类
* @date 2019-10-31 14:36:49 * @date 2019-10-31 14:36:49
* @return * @return
@ -33,7 +33,7 @@ public interface AssessUserService {
/** /**
* @description 插入 * @description 插入
* @author Mr.Xu * @author
* @date 2020-05-13 22:37:12 * @date 2020-05-13 22:37:12
* @param [assessUser] * @param [assessUser]
* @return void * @return void
@ -44,7 +44,7 @@ public interface AssessUserService {
/** /**
* @description 更新数据 * @description 更新数据
* @author Mr.Xu * @author
* @date 2020-05-14 22:03:02 * @date 2020-05-14 22:03:02
* @param [assessUser] * @param [assessUser]
* @return void * @return void
@ -53,7 +53,7 @@ public interface AssessUserService {
/** /**
* @description 根据assessUserId获取答题总表 * @description 根据assessUserId获取答题总表
* @author Mr.Xu * @author
* @date 2020-06-01 21:51:09 * @date 2020-06-01 21:51:09
* @param [assessUserId] * @param [assessUserId]
* @return com.blockchain.server.user.entity.AssessUser * @return com.blockchain.server.user.entity.AssessUser

@ -24,7 +24,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* @author huan.xu * @author zijie
* @version 1.0 * @version 1.0
* @className AssessUserServiceImpl * @className AssessUserServiceImpl
* @description 学生用户考核信息表 服务实现类 * @description 学生用户考核信息表 服务实现类

@ -25,6 +25,8 @@ import com.blockchain.server.user.mapper.UserMainMapper;
import com.blockchain.server.user.service.*; import com.blockchain.server.user.service.*;
import com.codingapi.tx.annotation.TxTransaction; import com.codingapi.tx.annotation.TxTransaction;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -59,6 +61,7 @@ public class UserMainServiceImpl implements UserMainService {
@Autowired @Autowired
private BtcFeign btcFeign; private BtcFeign btcFeign;
private static final Logger LOG = LoggerFactory.getLogger(UserMainServiceImpl.class);
@Override @Override
public UserMain selectByMobilePhone(String tel) { public UserMain selectByMobilePhone(String tel) {
@ -97,8 +100,8 @@ public class UserMainServiceImpl implements UserMainService {
userLoginService.insertEntity(userId, password);//插入密码信息 userLoginService.insertEntity(userId, password);//插入密码信息
int insertRow = userRelationService.insertRelationChain(userId, invitationCode);//插入推荐关系 int insertRow = userRelationService.insertRelationChain(userId, invitationCode);//插入推荐关系
userInfoService.saveUser(userId,tel, insertRow > 0);//插入用户其他信息 userInfoService.saveUser(userId,tel, insertRow > 0);//插入用户其他信息
LOG.info("生成钱包开始");
/* ResultDTO ethResult = ethFeign.initWallets(userId); ResultDTO ethResult = ethFeign.initWallets(userId);
if (ethResult.getCode() != BaseConstant.REQUEST_SUCCESS) { if (ethResult.getCode() != BaseConstant.REQUEST_SUCCESS) {
throw new RPCException(ethResult.getCode(), ethResult.getMsg()); throw new RPCException(ethResult.getCode(), ethResult.getMsg());
} }
@ -109,7 +112,8 @@ public class UserMainServiceImpl implements UserMainService {
ResultDTO btcResult = btcFeign.createWallet(userId); ResultDTO btcResult = btcFeign.createWallet(userId);
if (btcResult.getCode() != BaseConstant.REQUEST_SUCCESS) { if (btcResult.getCode() != BaseConstant.REQUEST_SUCCESS) {
throw new RPCException(btcResult.getCode(), btcResult.getMsg()); throw new RPCException(btcResult.getCode(), btcResult.getMsg());
}*/ }
LOG.info("生成钱包结束");
return user; return user;
} }

@ -1,5 +0,0 @@
FROM registry.cn-hangzhou.aliyuncs.com/xuankai/jdk8-231
MAINTAINER fengyu.wang wfyvv@qq.com
ADD target/*.jar /app/app.jar
WORKDIR /app
CMD ["java", "-jar", "-Duser.timezone=Asia/ShangHai", "./app.jar"]

@ -1,4 +0,0 @@
workDir=$(cd `dirname $0`; pwd)
imagesName=$(basename $workDir | tr "[A-Z]" "[a-z]")
docker build -t registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName -f $workDir .
docker push registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName:latest

@ -1,5 +1,6 @@
package com.blockchain.server.yyyf.controller; package com.blockchain.server.yyyf.controller;
import com.alibaba.fastjson.JSONObject;
import com.blockchain.common.base.constant.YyyfConstant; import com.blockchain.common.base.constant.YyyfConstant;
import com.blockchain.common.base.dto.ResultDTO; import com.blockchain.common.base.dto.ResultDTO;
import com.blockchain.common.base.dto.TokenDTO; import com.blockchain.common.base.dto.TokenDTO;
@ -85,7 +86,9 @@ public class LoginController {
yyyfUserDto.setUserName(userName); yyyfUserDto.setUserName(userName);
yyyfUserDto.setUserId(userId); yyyfUserDto.setUserId(userId);
yyyfUserDto.setUserType(yyyfLoginRequestVo.getUserType()); yyyfUserDto.setUserType(yyyfLoginRequestVo.getUserType());
boolean needInit = false;
AssessUser assessUser = null;
List<TrainCaseTargetDto> trainCaseTargeList = null;
//做考试和练习 //做考试和练习
if (0 == reqType || 1 == reqType) { if (0 == reqType || 1 == reqType) {
if (0 == reqType) { if (0 == reqType) {
@ -96,17 +99,17 @@ public class LoginController {
return handleAfterLogin(yyyfLoginDto, yyyfUserDto); return handleAfterLogin(yyyfLoginDto, yyyfUserDto);
} }
} }
AssessUser assessUser = this.assessUserService.selectAssessUserByUserIdAndissueIdForNotEnd(userId, examId); assessUser = this.assessUserService.selectAssessUserByUserIdAndissueIdForNotEnd(userId, examId);
if (assessUser == null) { if (assessUser == null) {
Date now = new Date(); Date now = new Date();
String tel=new SimpleDateFormat("yyMMddHHmmss").format(now).concat(String.valueOf(userId)); String tel = new SimpleDateFormat("yyMMddHHmmss").format(now).concat(String.valueOf(userId));
//第一次进入进行注册 //第一次进入进行注册
String code=String.format("%06d",new Random().nextInt(1000000)); String code = String.format("%06d", new Random().nextInt(1000000));
redisTemplate.opsForValue().set(YyyfConstant.REGISTER_KEY.concat(tel),code,YyyfConstant.TIME_OUT, TimeUnit.MINUTES); redisTemplate.opsForValue().set(YyyfConstant.REGISTER_KEY.concat(tel), code, YyyfConstant.TIME_OUT, TimeUnit.MINUTES);
yyyfLoginDto.setCode(code); yyyfLoginDto.setCode(code);
String password=String.format("%08d",new Random().nextInt(10000000)); String password = String.format("%08d", new Random().nextInt(10000000));
String assessUserId = IdGenerator.uuid(); String assessUserId = IdGenerator.uuid();
assessUser = new AssessUser(); assessUser = new AssessUser();
assessUser.setId(assessUserId); assessUser.setId(assessUserId);
@ -126,16 +129,23 @@ public class LoginController {
//获取案例信息 //获取案例信息
HashOperations<String, String, ExamPaperDto> examPaperOpsForHash = redisTemplate.opsForHash(); HashOperations<String, String, ExamPaperDto> examPaperOpsForHash = redisTemplate.opsForHash();
ExamPaperDto examPaperDto = examPaperOpsForHash.get(YyyfConstant.EXAM_PAPER_KEY, examPaperId); ExamPaperDto examPaperDto = examPaperOpsForHash.get(YyyfConstant.EXAM_PAPER_KEY, examPaperId);
List<TrainCaseTargetDto> trainCaseTargeList = examPaperDto.getTrainCaseTargetList(); trainCaseTargeList = examPaperDto.getTrainCaseTargetList();
assessUser.setWechatInitMoney(examPaperDto.getWechatInitMoney()); assessUser.setWechatInitMoney(examPaperDto.getWechatInitMoney());
assessUser.setAlipayInitMoney(examPaperDto.getAlipayInitMoney()); assessUser.setAlipayInitMoney(examPaperDto.getAlipayInitMoney());
assessUser.setBankcardInitMoney(examPaperDto.getBankcardInitMoney()); assessUser.setBankcardInitMoney(examPaperDto.getBankcardInitMoney());
assessUser.setDigitwalletInitMoney(examPaperDto.getDigitwalletInitMoney()); assessUser.setDigitwalletInitMoney(examPaperDto.getDigitwalletInitMoney());
this.assessUserService.initAssessUser(assessUser, trainCaseTargeList); needInit = true;
}else{
String tel=assessUser.getTel();
int count=assessUserService.countUserByTel(tel);
if(count==0){
String code = String.format("%06d", new Random().nextInt(1000000));
redisTemplate.opsForValue().set(YyyfConstant.REGISTER_KEY.concat(tel), code, YyyfConstant.TIME_OUT, TimeUnit.MINUTES);
yyyfLoginDto.setCode(code);
}
} }
yyyfUserDto.setAssessUserId(assessUser.getId()); yyyfUserDto.setAssessUserId(assessUser.getId());
yyyfLoginDto.setTel(assessUser.getTel()); yyyfLoginDto.setTel(assessUser.getTel());
yyyfLoginDto.setPassword(assessUser.getPassword()); yyyfLoginDto.setPassword(assessUser.getPassword());
@ -163,7 +173,7 @@ public class LoginController {
examDto.setExamPaperId(examPaperId); examDto.setExamPaperId(examPaperId);
examDtoOpsForHash.put(YyyfConstant.EXAM_KEY, examId, examDto); examDtoOpsForHash.put(YyyfConstant.EXAM_KEY, examId, examDto);
} }
yyyfLoginDto.setRemainingTime((examDto.getEndTime().getTime() - new Date().getTime() )/ 1000); yyyfLoginDto.setRemainingTime((examDto.getEndTime().getTime() - new Date().getTime()) / 1000);
joinStuIds = studentOpsForHash.get(YyyfConstant.JOIN_EXAM_STU_IDS_KEY, examId); joinStuIds = studentOpsForHash.get(YyyfConstant.JOIN_EXAM_STU_IDS_KEY, examId);
if (joinStuIds == null) { if (joinStuIds == null) {
joinStuIds = new ArrayList<Integer>(); joinStuIds = new ArrayList<Integer>();
@ -187,19 +197,27 @@ public class LoginController {
return handleAfterLogin(yyyfLoginDto, yyyfUserDto); return handleAfterLogin(yyyfLoginDto, yyyfUserDto);
} }
} else { } else {
String jioinExamId=null; String jioinExamId = null;
if (redisTemplate.hasKey(caseKey)) { if (redisTemplate.hasKey(caseKey)) {
Map<String, String> examMsgMap = (Map<String, String>) redisTemplate.opsForValue().get(caseKey); Map<String, String> examMsgMap = (Map<String, String>) redisTemplate.opsForValue().get(caseKey);
jioinExamId= examMsgMap.get("examId"); jioinExamId = examMsgMap.get("examId");
joinStuIds = studentOpsForHash.get(YyyfConstant.JOIN_EXAM_STU_IDS_KEY,jioinExamId); joinStuIds = studentOpsForHash.get(YyyfConstant.JOIN_EXAM_STU_IDS_KEY, jioinExamId);
} }
//缓存是考试,要进入练习,则不让进入 //缓存是考试,要进入练习,则不让进入
if (joinStuIds != null && joinStuIds.stream() if (joinStuIds != null && joinStuIds.stream()
.filter(stuIds -> (stuIds.equals(userId))).count() != 0) { .filter(stuIds -> (stuIds.equals(userId))).count() != 0) {
yyyfLoginDto.setStatus(3); yyyfLoginDto.setStatus(3);
yyyfLoginDto.setMsg(YyyfConstant.NO_ENTRY_INTO_PRACTICE); yyyfLoginDto.setMsg(YyyfConstant.NO_ENTRY_INTO_PRACTICE);
ExamDto examDto = examDtoOpsForHash.get(YyyfConstant.EXAM_KEY, examId); ExamDto examDto = examDtoOpsForHash.get(YyyfConstant.EXAM_KEY, jioinExamId);
yyyfLoginDto.setRemainingTime((examDto.getEndTime().getTime() - new Date().getTime() )/ 1000); LOG.info("examId is " + examId + "examDto is " + JSONObject.toJSON(examDto) + "jioinExamId is " + jioinExamId);
yyyfLoginDto.setRemainingTime((examDto.getEndTime().getTime() - new Date().getTime()) / 1000);
assessUser = this.assessUserService.selectAssessUserByUserIdAndissueIdForNotEnd(userId, jioinExamId);
yyyfUserDto.setAssessUserId(assessUser.getId());
yyyfLoginDto.setTel(assessUser.getTel());
yyyfLoginDto.setPassword(assessUser.getPassword());
yyyfLoginDto.setNickName(userName);
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
map.put("examPaperId", examDto.getExamPaperId()); map.put("examPaperId", examDto.getExamPaperId());
@ -218,7 +236,9 @@ public class LoginController {
yyyfLoginDto.setStatus(1); yyyfLoginDto.setStatus(1);
} }
if (needInit && assessUser != null && trainCaseTargeList != null) {
this.assessUserService.initAssessUser(assessUser, trainCaseTargeList);
}
return handleAfterLogin(yyyfLoginDto, yyyfUserDto); return handleAfterLogin(yyyfLoginDto, yyyfUserDto);
} }

@ -40,7 +40,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @author huan.xu * @author zijie
* @version 1.0 * @version 1.0
* @className TeachingGradeController * @className TeachingGradeController
* @description 练习考核成绩Controller * @description 练习考核成绩Controller
@ -69,12 +69,12 @@ public class TeachingGradeController {
/** /**
* @description 教师获取考核概况 * @description 教师获取考核概况
* @author huan.xu * @author zijie
* @date 2020-05-19 10:47:29 * @date 2020-05-19 10:47:29
* @param [issueId, totalNum, caseId, response] * @param [issueId, totalNum, caseId, response]
* @return void * @return void
**/ **/
@GetMapping(value = "/getGradeData", produces = {"application/text;charset=UTF-8"}) @PostMapping(value = "/getGradeData", produces = {"application/text;charset=UTF-8"})
@ResponseBody @ResponseBody
@SuppressWarnings("all") @SuppressWarnings("all")
@ApiOperation(value = TeachingGradeApi.GetGradeData.METHOD_NAME, @ApiOperation(value = TeachingGradeApi.GetGradeData.METHOD_NAME,
@ -148,7 +148,7 @@ public class TeachingGradeController {
* @param [issueId, notExamNum] * @param [issueId, notExamNum]
* @return java.util.Map<java.lang.String, java.lang.Object> * @return java.util.Map<java.lang.String, java.lang.Object>
* @description 封装错误率 * @description 封装错误率
* @author huan.xu * @author zijie
* @date 2019-11-08 18:27:22 * @date 2019-11-08 18:27:22
**/ **/
private Map<String, Object> getWrongStatistics(String issueId, Integer totalNum, List<TrainCaseTargetDto> trainCaseTargeList) { private Map<String, Object> getWrongStatistics(String issueId, Integer totalNum, List<TrainCaseTargetDto> trainCaseTargeList) {
@ -311,7 +311,7 @@ public class TeachingGradeController {
* @param [issueId, authorization] * @param [issueId, authorization]
* @return java.util.Map<java.lang.String, java.lang.Object> * @return java.util.Map<java.lang.String, java.lang.Object>
* @description 重新成绩同步 * @description 重新成绩同步
* @author huan.xu * @author zijie
* @date 2019-11-08 18:39:55 * @date 2019-11-08 18:39:55
**/ **/
@GetMapping("/studyGrade/reSynchroze") @GetMapping("/studyGrade/reSynchroze")
@ -541,7 +541,7 @@ public class TeachingGradeController {
* @param [cell, wb, str, startIndex, endIndex] * @param [cell, wb, str, startIndex, endIndex]
* @return void * @return void
* @description poi实现单元格中部分字体颜色设定 * @description poi实现单元格中部分字体颜色设定
* @author huan.xu * @author zijie
* @date 2019-12-10 16:19:48 * @date 2019-12-10 16:19:48
**/ **/
private void setFontColor(HSSFWorkbook wb, HSSFCell cell, String str, int startIndex, int endIndex) { private void setFontColor(HSSFWorkbook wb, HSSFCell cell, String str, int startIndex, int endIndex) {

@ -3,7 +3,6 @@ package com.blockchain.server.yyyf.controller;
import com.blockchain.common.base.dto.ResultDTO; import com.blockchain.common.base.dto.ResultDTO;
import com.blockchain.server.yyyf.controller.api.YyyfMoneyApi; import com.blockchain.server.yyyf.controller.api.YyyfMoneyApi;
import com.blockchain.server.yyyf.dto.TransactResultDto; import com.blockchain.server.yyyf.dto.TransactResultDto;
import com.blockchain.server.yyyf.entity.YyyfMoney;
import com.blockchain.server.yyyf.service.YyyfMoneyService; import com.blockchain.server.yyyf.service.YyyfMoneyService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -11,15 +10,12 @@ import io.swagger.annotations.ApiParam;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* @author Mr.Xu * @author
* @version 1.0 * @version 1.0
* @className MoneyController * @className MoneyController
* @description * @description
@ -46,4 +42,33 @@ public class YyyfMoneyController {
return ResultDTO.requstSuccess(transactResultDto); return ResultDTO.requstSuccess(transactResultDto);
} }
@GetMapping("/resetWallet")
@ApiOperation(value = YyyfMoneyApi.ResetWallet.METHOD_NAME,
notes = YyyfMoneyApi.ResetWallet.METHOD_NOTE)
public ResultDTO<Boolean> 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) {
LOG.info("assessUserId is "+assessUserId+" ,coinName is "+ coinName + " ,balance is "+balance);
boolean result=this.yyyfMoneyService.resetWallet(assessUserId,coinName,balance);
return ResultDTO.requstSuccess(result);
}
/* @PostMapping("/resetWallet")
@ApiOperation(value = YyyfMoneyApi.ResetWallet.METHOD_NAME,
notes = YyyfMoneyApi.ResetWallet.METHOD_NOTE)
public ResultDTO<Boolean> 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);
}*/
} }

@ -1,7 +1,7 @@
package com.blockchain.server.yyyf.controller.api; package com.blockchain.server.yyyf.controller.api;
/** /**
* @author huan.xu * @author zijie
* @version 1.0 * @version 1.0
* @className TeachingGradeApi * @className TeachingGradeApi
* @description * @description

@ -1,7 +1,7 @@
package com.blockchain.server.yyyf.controller.api; package com.blockchain.server.yyyf.controller.api;
/** /**
* @author Mr.Xu * @author
* @version 1.0 * @version 1.0
* @className MoneyApi * @className MoneyApi
* @description * @description
@ -17,4 +17,28 @@ public class YyyfMoneyApi {
public static final String METHOD_IN="转入币种"; public static final String METHOD_IN="转入币种";
public static final String METHOD_AMOUNT="转入金额"; 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 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 {
}*/
} }

@ -8,7 +8,7 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
/** /**
* @author Mr.Xu * @author
* @version 1.0 * @version 1.0
* @className AssessUserDto * @className AssessUserDto
* @description * @description

@ -10,7 +10,7 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
/** /**
* @author huan.xu * @author zijie
* @version 1.0 * @version 1.0
* @className ExamDetailsDto * @className ExamDetailsDto
* @description * @description

@ -9,7 +9,7 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
/** /**
* @author huan.xu * @author zijie
* @version 1.0 * @version 1.0
* @className OverviewDto * @className OverviewDto
* @description * @description

@ -7,7 +7,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
/** /**
* @author huan.xu * @author zijie
* @version 1.0 * @version 1.0
* @className ReExamOverviewDto * @className ReExamOverviewDto
* @description * @description

@ -7,7 +7,7 @@ import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* @author Mr.Xu * @author
* @version 1.0 * @version 1.0
* @className TransactDto * @className TransactDto
* @description * @description

@ -11,7 +11,7 @@ import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
* @author Mr.Xu * @author
* @version 1.0 * @version 1.0
* @className UserTimeMoneyDto * @className UserTimeMoneyDto
* @description 包含以渔有方userId本系统userId开始时间以及各个币种余额情况 * @description 包含以渔有方userId本系统userId开始时间以及各个币种余额情况

@ -8,7 +8,7 @@ import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
* @author Mr.Xu * @author
* @version 1.0 * @version 1.0
* @className YyyfStudentAnswerDto * @className YyyfStudentAnswerDto
* @description * @description
@ -18,7 +18,7 @@ import java.util.Date;
public class YyyfStudentAnswerDto implements Serializable { public class YyyfStudentAnswerDto implements Serializable {
private static final long serialVersionUID = 505667820932379758L; private static final long serialVersionUID = 505667820932379758L;
private String authorization="87DIVy348Oxzj3ha"; private String authorization="87DIVy348Oxzj3ha";
private String sysType="130"; private String sysType="148";
private Integer userId; private Integer userId;
private Double totalScore; private Double totalScore;
private Date startTime; private Date startTime;

@ -61,7 +61,7 @@ public class AssessUser implements Serializable {
* 时长 * 时长
*/ */
@Column(name = "duration") @Column(name = "duration")
private Integer duration; private Long duration;
/** /**
* 时长单位 * 时长单位
*/ */

@ -10,13 +10,13 @@ import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
* @author Mr.Xu * @author
* @version 1.0 * @version 1.0
* @className YyyfMoney * @className YyyfMoney
* @description * @description
* @date 2020-05-26 21:30 * @date 2020-05-26 21:30
*/ */
@Table(name = "Yyyf_money") @Table(name = "yyyf_money")
@Data @Data
public class YyyfMoney implements Serializable { public class YyyfMoney implements Serializable {
private static final long serialVersionUID = 8690026237757740821L; private static final long serialVersionUID = 8690026237757740821L;

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

@ -3,6 +3,7 @@ package com.blockchain.server.yyyf.feign;
import com.blockchain.server.yyyf.feign.dto.CurrencyMarketDTO; import com.blockchain.server.yyyf.feign.dto.CurrencyMarketDTO;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
@ -10,4 +11,7 @@ import java.util.List;
public interface CurrencyFeign { public interface CurrencyFeign {
@GetMapping("/inner/market/getList") @GetMapping("/inner/market/getList")
List<CurrencyMarketDTO> getList(); List<CurrencyMarketDTO> getList();
@GetMapping("/inner/market/get")
CurrencyMarketDTO get(@RequestParam("currencyPair") String currencyPair);
} }

@ -4,11 +4,12 @@ import com.blockchain.common.base.dto.ResultDTO;
import com.blockchain.server.yyyf.feign.dto.EosWalletDTO; import com.blockchain.server.yyyf.feign.dto.EosWalletDTO;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
@FeignClient("dapp-eos-server") @FeignClient("dapp-eos-server")
public interface EosFeign { public interface EosFeign {
@GetMapping("/inner/walletTx/selectWalletByUserOpenId") @GetMapping("/inner/walletTx/selectWalletByUserOpenId")
ResultDTO<List<EosWalletDTO>> selectWalletByWalletType(String userOpenId); ResultDTO<List<EosWalletDTO>> selectWalletByWalletType(@RequestParam("userOpenId") String userOpenId);
} }

@ -8,7 +8,7 @@ import javax.persistence.EntityExistsException;
import java.util.List; import java.util.List;
/** /**
* @author huan.xu * @author zijie
* @version 1.0 * @version 1.0
* @className IndicatorsUtils * @className IndicatorsUtils
* @description * @description

@ -1,7 +1,7 @@
package com.blockchain.server.yyyf.indicators.dto; package com.blockchain.server.yyyf.indicators.dto;
import lombok.Data; import lombok.Data;
/** /**
* @author huan.xu * @author zijie
* @version 1.0 * @version 1.0
* @className LastAndFirstAssetsReporterDto * @className LastAndFirstAssetsReporterDto
* @description * @description

@ -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();
}
}

@ -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());
}
}
}

@ -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> T getBean(Class<T> 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();
}
}

@ -24,7 +24,7 @@ public interface AssessUserMapper extends Mapper<AssessUser> {
/** /**
* @description 通过AssessUserDtoLis批量更新AssessUser * @description 通过AssessUserDtoLis批量更新AssessUser
* @author Mr.Xu * @author
* @date 2020-05-15 00:08:17 * @date 2020-05-15 00:08:17
* @param [assessUserDtoList] * @param [assessUserDtoList]
* @return void * @return void
@ -35,7 +35,7 @@ public interface AssessUserMapper extends Mapper<AssessUser> {
/** /**
* @description 获取未提交的 UserTimeMoneyDto List * @description 获取未提交的 UserTimeMoneyDto List
* @author Mr.Xu * @author
* @date 2020-06-01 22:05:09 * @date 2020-06-01 22:05:09
* @param [] * @param []
* @return java.util.List<com.blockchain.server.yyyf.dto.UserTimeMoneyDto> * @return java.util.List<com.blockchain.server.yyyf.dto.UserTimeMoneyDto>
@ -44,7 +44,7 @@ public interface AssessUserMapper extends Mapper<AssessUser> {
/** /**
* @description assessUserId通过assessUserId 获取余额情况 * @description assessUserId通过assessUserId 获取余额情况
* @author Mr.Xu * @author
* @date 2020-06-02 21:07:23 * @date 2020-06-02 21:07:23
* @param [assessUserId] * @param [assessUserId]
* @return com.blockchain.server.yyyf.dto.UserTimeMoneyDto * @return com.blockchain.server.yyyf.dto.UserTimeMoneyDto
@ -52,4 +52,11 @@ public interface AssessUserMapper extends Mapper<AssessUser> {
UserTimeMoneyDto getUserTimeMoneyDtoByAssessUserId(@Param("assessUserId") String assessUserId); UserTimeMoneyDto getUserTimeMoneyDtoByAssessUserId(@Param("assessUserId") String assessUserId);
UserTimeMoneyDto selectCurrentUserTimeMoneyDto(@Param("assessUserId") String assessUserId, @Param("qUserId")String qUserId); UserTimeMoneyDto selectCurrentUserTimeMoneyDto(@Param("assessUserId") String assessUserId, @Param("qUserId")String qUserId);
/**
* @description 查询子系统是否有改电话号码注册成功
* @date 2020-12-29 17:18:29
* @param [tel]
* @return int
**/
int countUserByTel(@Param("tel")String tel);
} }

@ -16,7 +16,7 @@ public interface AssessUserTargetMapper extends Mapper<AssessUserTarget> {
/** /**
* @description 批量插入指标 * @description 批量插入指标
* @author Mr.Xu * @author
* @date 2020-05-14 23:24:21 * @date 2020-05-14 23:24:21
* @param [list] * @param [list]
* @return void * @return void
@ -29,7 +29,7 @@ public interface AssessUserTargetMapper extends Mapper<AssessUserTarget> {
/** /**
* @description 批量更新指标库最终答题情况 * @description 批量更新指标库最终答题情况
* @author Mr.Xu * @author
* @date 2020-06-01 22:54:19 * @date 2020-06-01 22:54:19
* @param [updateAssessUserTargetList] * @param [updateAssessUserTargetList]
* @return void * @return void

@ -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<ExamPaperDto> getAllExamPaperDto();
}

@ -5,7 +5,7 @@ import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
/** /**
* @author Mr.Xu * @author
* @version 1.0 * @version 1.0
* @className YyyfMoneyMapper * @className YyyfMoneyMapper
* @description * @description

@ -1,6 +1,7 @@
package com.blockchain.server.yyyf.service; package com.blockchain.server.yyyf.service;
import com.blockchain.server.train.dto.ExamPaperDto;
import com.blockchain.server.train.dto.TrainCaseTargetDto; import com.blockchain.server.train.dto.TrainCaseTargetDto;
import com.blockchain.server.yyyf.dto.AssessUserDto; import com.blockchain.server.yyyf.dto.AssessUserDto;
import com.blockchain.server.yyyf.dto.UserTimeMoneyDto; import com.blockchain.server.yyyf.dto.UserTimeMoneyDto;
@ -10,7 +11,7 @@ import java.util.List;
/** /**
* @param * @param
* @author huan.xu * @author zijie
* @description 学生用户考核信息表 服务接口类 * @description 学生用户考核信息表 服务接口类
* @date 2019-10-31 14:36:49 * @date 2019-10-31 14:36:49
* @return * @return
@ -34,7 +35,7 @@ public interface AssessUserService {
/** /**
* @description 插入 * @description 插入
* @author Mr.Xu * @author
* @date 2020-05-13 22:37:12 * @date 2020-05-13 22:37:12
* @param [assessUser] * @param [assessUser]
* @return void * @return void
@ -43,7 +44,7 @@ public interface AssessUserService {
/** /**
* @description 初始化考核数据 * @description 初始化考核数据
* @author Mr.Xu * @author
* @date 2020-05-14 22:03:38 * @date 2020-05-14 22:03:38
* @param [assessUser, trainCaseTargeList] * @param [assessUser, trainCaseTargeList]
* @return void * @return void
@ -52,7 +53,7 @@ public interface AssessUserService {
/** /**
* @description 更新数据 * @description 更新数据
* @author Mr.Xu * @author
* @date 2020-05-14 22:03:02 * @date 2020-05-14 22:03:02
* @param [assessUser] * @param [assessUser]
* @return void * @return void
@ -61,7 +62,7 @@ public interface AssessUserService {
/** /**
* @description 提交事务 * @description 提交事务
* @author Mr.Xu * @author
* @date 2020-05-14 22:24:29 * @date 2020-05-14 22:24:29
* @param [assessUserId] * @param [assessUserId]
* @return void * @return void
@ -70,7 +71,7 @@ public interface AssessUserService {
/** /**
* @description 批量同步成绩 * @description 批量同步成绩
* @author Mr.Xu * @author
* @date 2020-05-14 23:21:20 * @date 2020-05-14 23:21:20
* @param [issueId] * @param [issueId]
* @return void * @return void
@ -91,7 +92,7 @@ public interface AssessUserService {
/** /**
* @description 获取未提交的 UserTimeMoneyDto List * @description 获取未提交的 UserTimeMoneyDto List
* @author Mr.Xu * @author
* @date 2020-06-01 22:05:09 * @date 2020-06-01 22:05:09
* @param [] * @param []
* @return java.util.List<com.blockchain.server.yyyf.dto.UserTimeMoneyDto> * @return java.util.List<com.blockchain.server.yyyf.dto.UserTimeMoneyDto>
@ -100,10 +101,27 @@ public interface AssessUserService {
/** /**
* @description assessUserId通过assessUserId 获取余额情况 * @description assessUserId通过assessUserId 获取余额情况
* @author Mr.Xu * @author
* @date 2020-06-02 21:06:35 * @date 2020-06-02 21:06:35
* @param [assessUserId] * @param [assessUserId]
* @return com.blockchain.server.yyyf.dto.UserTimeMoneyDto * @return com.blockchain.server.yyyf.dto.UserTimeMoneyDto
**/ **/
UserTimeMoneyDto getUserTimeMoneyDtoByAssessUserId(String assessUserId); UserTimeMoneyDto getUserTimeMoneyDtoByAssessUserId(String assessUserId);
/**
* @description 缓存获取所有练习和考核
* @author zijie
* @date 2020-07-22 21:48:16
* @param []
* @return void
**/
void initAllExamPaperDto();
/**
* @description 查询子系统是否有改电话号码注册成功
* @date 2020-12-29 17:18:29
* @param [tel]
* @return int
**/
int countUserByTel(String tel);
} }

@ -35,7 +35,7 @@ public interface AssessUserTargetService{
/** /**
* @description 还原指标表 * @description 还原指标表
* @author Mr.Xu * @author
* @date 2020-06-03 00:05:17 * @date 2020-06-03 00:05:17
* @param [assessUserId] * @param [assessUserId]
* @return void * @return void

@ -8,7 +8,7 @@ import java.math.BigDecimal;
public interface YyyfMoneyService { public interface YyyfMoneyService {
/** /**
* @description 交易转账 * @description 交易转账
* @author Mr.Xu * @author zijie
* @date 2020-05-26 21:51:15 * @date 2020-05-26 21:51:15
* @param [assessUserId, out, in, amount] * @param [assessUserId, out, in, amount]
* @return com.blockchain.server.yyyf.dto.TransactResultDto * @return com.blockchain.server.yyyf.dto.TransactResultDto
@ -18,7 +18,7 @@ public interface YyyfMoneyService {
/** /**
* @description 插入 * @description 插入
* @author Mr.Xu * @author zijie
* @date 2020-05-26 22:48:08 * @date 2020-05-26 22:48:08
* @param [yyyfMoney] * @param [yyyfMoney]
* @return void * @return void
@ -27,10 +27,31 @@ public interface YyyfMoneyService {
/** /**
* @description 更新 * @description 更新
* @author Mr.Xu * @author zijie
* @date 2020-05-26 22:48:19 * @date 2020-05-26 22:48:19
* @param [yyyfMoney] * @param [yyyfMoney]
* @return void * @return void
**/ **/
void update(YyyfMoney yyyfMoney); void update(YyyfMoney yyyfMoney);
/**
* @description 充币提币法币交易
* @author zijie
* @date 2020-07-12 22:45:43
* @param [assessUserId, coinName, balance]
* @return boolean
**/
boolean resetWallet(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);
} }

@ -1,6 +1,9 @@
package com.blockchain.server.yyyf.service.impl; package com.blockchain.server.yyyf.service.impl;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.blockchain.common.base.constant.YyyfConstant; import com.blockchain.common.base.constant.YyyfConstant;
import com.blockchain.server.train.dto.ExamPaperDto;
import com.blockchain.server.train.dto.TrainCaseTargetDto; import com.blockchain.server.train.dto.TrainCaseTargetDto;
import com.blockchain.server.yyyf.dto.AssessUserDto; import com.blockchain.server.yyyf.dto.AssessUserDto;
import com.blockchain.server.yyyf.dto.ExamDto; import com.blockchain.server.yyyf.dto.ExamDto;
@ -12,10 +15,13 @@ import com.blockchain.server.yyyf.entity.YyyfMoney;
import com.blockchain.server.yyyf.enums.YyyfEnums; import com.blockchain.server.yyyf.enums.YyyfEnums;
import com.blockchain.server.yyyf.exceprion.YyyfException; import com.blockchain.server.yyyf.exceprion.YyyfException;
import com.blockchain.server.yyyf.indicators.IndicatorsManager; import com.blockchain.server.yyyf.indicators.IndicatorsManager;
import com.blockchain.server.yyyf.indicators.dto.AssetsReporter;
import com.blockchain.server.yyyf.mapper.AssessUserMapper; import com.blockchain.server.yyyf.mapper.AssessUserMapper;
import com.blockchain.server.yyyf.mapper.AssessUserTargetMapper; 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.mapper.YyyfMoneyMapper;
import com.blockchain.server.yyyf.service.AssessUserService; import com.blockchain.server.yyyf.service.AssessUserService;
import com.blockchain.server.yyyf.service.AssetsReporterService;
import com.blockchain.server.yyyf.utils.HttpClientUtil; import com.blockchain.server.yyyf.utils.HttpClientUtil;
import com.blockchain.server.yyyf.utils.IdGenerator; import com.blockchain.server.yyyf.utils.IdGenerator;
import lombok.SneakyThrows; import lombok.SneakyThrows;
@ -36,7 +42,7 @@ import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
* @author huan.xu * @author zijie
* @version 1.0 * @version 1.0
* @className AssessUserServiceImpl * @className AssessUserServiceImpl
* @description 学生用户考核信息表 服务实现类 * @description 学生用户考核信息表 服务实现类
@ -56,9 +62,13 @@ public class AssessUserServiceImpl implements AssessUserService {
private AssessUserTargetMapper assessUserTargetMapper; private AssessUserTargetMapper assessUserTargetMapper;
@Autowired @Autowired
private YyyfMoneyMapper yyyfMoneyMapper; private YyyfMoneyMapper yyyfMoneyMapper;
@Autowired
private TrainCaseManageMapper trainCaseManageMapper;
//@Autowired @Autowired
private IndicatorsManager indicatorsManager; private IndicatorsManager indicatorsManager;
@Autowired
private AssetsReporterService assetsReporterService;
@Value("${yyyf.url}") @Value("${yyyf.url}")
@ -144,6 +154,19 @@ public class AssessUserServiceImpl implements AssessUserService {
if (assessUser.getEndTime() != null) { if (assessUser.getEndTime() != null) {
throw new YyyfException(YyyfEnums.PROHIBIT_DUPLICATE_SUBMISSION); throw new YyyfException(YyyfEnums.PROHIBIT_DUPLICATE_SUBMISSION);
} }
//计算当前时间收益
BigDecimal assets = indicatorsManager.calculateCurrentTotalAssets(assessUser.getQUserId(), assessUserId);
Date now = new Date();
assetsReporterService.saveList(Collections.singletonList(AssetsReporter.builder()
.id(IdGenerator.uuid())
.assessUserId(assessUserId)
.assets(assets)
//不满一天按一天计算
.days(DateUtil.between(assessUser.getStartTime(), now, DateUnit.DAY) + 1)
.coinName("RMB")
.createTime(now)
.build()));
Double totalScore = 0d; Double totalScore = 0d;
//获取指标信息 //获取指标信息
Example example = new Example(AssessUserTarget.class); Example example = new Example(AssessUserTarget.class);
@ -168,13 +191,12 @@ public class AssessUserServiceImpl implements AssessUserService {
} }
Date startTime = assessUser.getStartTime(); Date startTime = assessUser.getStartTime();
Date now = new Date();
assessUser.setTotalScore(totalScore); assessUser.setTotalScore(totalScore);
assessUser.setEndTime(now); assessUser.setEndTime(now);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//考试时长 //考试时长
long duration = sdf.parse(sdf.format(now)).getTime() - sdf.parse(sdf.format(startTime)).getTime(); long duration = sdf.parse(sdf.format(now)).getTime() - sdf.parse(sdf.format(startTime)).getTime();
assessUser.setDuration(Math.toIntExact(duration)); assessUser.setDuration(duration);
if (assessUser.getUserType() == 0 && assessUser.getAchieveMentType() == 0) { if (assessUser.getUserType() == 0 && assessUser.getAchieveMentType() == 0) {
YyyfStudentAnswerDto yyyfStudentAnswerDto = new YyyfStudentAnswerDto(); YyyfStudentAnswerDto yyyfStudentAnswerDto = new YyyfStudentAnswerDto();
BeanUtils.copyProperties(assessUser, yyyfStudentAnswerDto); BeanUtils.copyProperties(assessUser, yyyfStudentAnswerDto);
@ -225,7 +247,7 @@ public class AssessUserServiceImpl implements AssessUserService {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//考试时长 //考试时长
long duration = sdf.parse(sdf.format(now)).getTime() - sdf.parse(sdf.format(startTime)).getTime(); long duration = sdf.parse(sdf.format(now)).getTime() - sdf.parse(sdf.format(startTime)).getTime();
assessUserDto.setDuration(Math.toIntExact(duration)); assessUserDto.setDuration(duration);
updateAssessUserDtoList.add(assessUserDto); updateAssessUserDtoList.add(assessUserDto);
//指标库更新 //指标库更新
@ -249,7 +271,7 @@ public class AssessUserServiceImpl implements AssessUserService {
this.assessUserTargetMapper.batchUpdateTargetAnswer(updateAssessUserTargetList); this.assessUserTargetMapper.batchUpdateTargetAnswer(updateAssessUserTargetList);
} }
HttpClientUtil.doPostWithJSON(new StringBuilder().append(yyyfUrl).append(assessmentList).toString(), yyyfStudentAnswerDtoList); HttpClientUtil.doPostWithJSON(new StringBuilder().append(yyyfUrl).append(assessmentList).toString(), yyyfStudentAnswerDtoList);
} }
@ -285,7 +307,8 @@ public class AssessUserServiceImpl implements AssessUserService {
Example example = new Example(AssessUser.class); Example example = new Example(AssessUser.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andCondition("issue_id = ", issueId) criteria.andCondition("issue_id = ", issueId)
.andCondition("user_id = ", userId); .andCondition("user_id = ", userId)
.andCondition("end_time is not null ");
return this.assessUserMapper.selectByExample(example); return this.assessUserMapper.selectByExample(example);
} }
@ -304,11 +327,28 @@ public class AssessUserServiceImpl implements AssessUserService {
return this.assessUserMapper.getUserTimeMoneyDtoByAssessUserId(assessUserId); return this.assessUserMapper.getUserTimeMoneyDtoByAssessUserId(assessUserId);
} }
@Override
public void initAllExamPaperDto() {
List<ExamPaperDto> examPaperDtoList = trainCaseManageMapper.getAllExamPaperDto();
redisTemplate.delete(YyyfConstant.EXAM_PAPER_KEY);
HashOperations<String, String, ExamPaperDto> examPaperOpsForHash = redisTemplate.opsForHash();
for (ExamPaperDto examPaperDto : examPaperDtoList) {
examPaperOpsForHash.put(YyyfConstant.EXAM_PAPER_KEY, examPaperDto.getId(), examPaperDto);
}
}
@Override
public int countUserByTel(String tel) {
return this.assessUserMapper.countUserByTel(tel);
}
/** /**
* @param [assessUserTarget, targetResultMap] * @param [assessUserTarget, targetResultMap]
* @return void * @return void
* @description 计算是否达标 * @description 计算是否达标
* @author Mr.Xu * @author
* @date 2020-06-01 22:49:37 * @date 2020-06-01 22:49:37
**/ **/
private void answerResultForTarget(AssessUserTarget assessUserTarget, Map<String, Float> targetResultMap) { private void answerResultForTarget(AssessUserTarget assessUserTarget, Map<String, Float> targetResultMap) {

@ -7,15 +7,18 @@ import com.blockchain.server.yyyf.exceprion.YyyfException;
import com.blockchain.server.yyyf.mapper.YyyfMoneyMapper; import com.blockchain.server.yyyf.mapper.YyyfMoneyMapper;
import com.blockchain.server.yyyf.service.YyyfMoneyService; import com.blockchain.server.yyyf.service.YyyfMoneyService;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
/** /**
* @author Mr.Xu * @author zijie
* @version 1.0 * @version 1.0
* @className YyyfMoneyServiceImpl * @className YyyfMoneyServiceImpl
* @description * @description
@ -25,10 +28,13 @@ import java.math.BigDecimal;
@Service @Service
public class YyyfMoneyServiceImpl implements YyyfMoneyService { public class YyyfMoneyServiceImpl implements YyyfMoneyService {
private Logger logger = LoggerFactory.getLogger(YyyfMoneyServiceImpl.class);
@Autowired @Autowired
private YyyfMoneyMapper yyyfMoneyMapper; private YyyfMoneyMapper yyyfMoneyMapper;
/* @Autowired
private CurrencyFeign currencyFeign;*/
@SneakyThrows @SneakyThrows
@Override @Override
@ -58,11 +64,11 @@ public class YyyfMoneyServiceImpl implements YyyfMoneyService {
//转入币种后的余额 //转入币种后的余额
BigDecimal inSurplus = inOriginal.add(amount); BigDecimal inSurplus = inOriginal.add(amount);
Method outSetMethod = aClass.getMethod("set".concat(outField),BigDecimal.class); Method outSetMethod = aClass.getMethod("set".concat(outField), BigDecimal.class);
Method inSetMethod = aClass.getMethod("set".concat(inField),BigDecimal.class); Method inSetMethod = aClass.getMethod("set".concat(inField), BigDecimal.class);
outSetMethod.invoke(yyyfMoney,outSurplus); outSetMethod.invoke(yyyfMoney, outSurplus);
inSetMethod.invoke(yyyfMoney,inSurplus); inSetMethod.invoke(yyyfMoney, inSurplus);
this.yyyfMoneyMapper.updateByPrimaryKeySelective(yyyfMoney); this.yyyfMoneyMapper.updateByPrimaryKeySelective(yyyfMoney);
@ -89,4 +95,64 @@ public class YyyfMoneyServiceImpl implements YyyfMoneyService {
public void update(YyyfMoney yyyfMoney) { public void update(YyyfMoney yyyfMoney) {
this.yyyfMoneyMapper.updateByPrimaryKeySelective(yyyfMoney); this.yyyfMoneyMapper.updateByPrimaryKeySelective(yyyfMoney);
} }
@Override
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":{
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;
}
} }

@ -18,7 +18,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
/** /**
* @author Mr.Xu * @author
* @version 1.0 * @version 1.0
* @className ScheduleTask * @className ScheduleTask
* @description * @description
@ -36,6 +36,10 @@ public class ScheduleTask {
@Scheduled(initialDelay = 5000,fixedRate=60000) @Scheduled(initialDelay = 5000,fixedRate=60000)
private void OneMinuteTask() { private void OneMinuteTask() {
logger.info("开始扫描案例"+ new Date());
this.assessUserService.initAllExamPaperDto();
logger.info("完成扫描案例"+ new Date());
logger.info("开始扫描考试"+ new Date()); logger.info("开始扫描考试"+ new Date());
HashOperations<String, String, ExamDto> examDtoOpsForHash = redisTemplate.opsForHash(); HashOperations<String, String, ExamDto> examDtoOpsForHash = redisTemplate.opsForHash();
Map<String, ExamDto> examDtoMap = examDtoOpsForHash.entries(YyyfConstant.EXAM_KEY); Map<String, ExamDto> examDtoMap = examDtoOpsForHash.entries(YyyfConstant.EXAM_KEY);

@ -22,7 +22,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @author huan.xu * @author zijie
* @version 1.0 * @version 1.0
* @className HttpClientUtil * @className HttpClientUtil
* @description * @description

@ -3,7 +3,7 @@ package com.blockchain.server.yyyf.utils;
import java.util.UUID; import java.util.UUID;
/** /**
* @author Mr.Xu * @author
* @version 1.0 * @version 1.0
* @className IdGenerator * @className IdGenerator
* @description * @description

@ -22,11 +22,17 @@ spring:
name: dapp-yyyf-server name: dapp-yyyf-server
#以渔有方配置 #以渔有方配置
yyyf: yyyf:
url: http://10.1.129.60:9090/yyyf-server-app #测试环境
#url: http://10.1.129.60:9090/yyyf-server-app
#线上环境
url: http://www.iyyyf.com
#在线同步 #在线同步
integral: /api/bd/v1.0/integral integral: /api/bd/v1.0/integral
#成绩同步(单个) #成绩同步(单个)
assessment: /api/db/v1.0/assessment assessment: /api/db/v1.0/assessment
#成绩同步(整场考试) #成绩同步(整场考试)
assessmentList: /api/db/v1.0/assessmentList assessmentList: /api/db/v1.0/assessmentList
rate:
riskFree: 0.04

@ -128,7 +128,11 @@
<select id="selectCurrentUserTimeMoneyDto" resultMap="UserTimeMoneyDtoMap"> <select id="selectCurrentUserTimeMoneyDto" resultMap="UserTimeMoneyDtoMap">
SELECT au.id,au.user_id,au.q_user_id,au.alipay_init_money,au.wechat_init_money,au.bankcard_init_money,au.start_time,m.wx_pay,m.ali_pay,m.bank_card,m.btc,m.eth,m.usdt,m.eos SELECT au.id,au.user_id,au.q_user_id,au.alipay_init_money,au.wechat_init_money,au.bankcard_init_money,au.start_time,m.wx_pay,m.ali_pay,m.bank_card,m.btc,m.eth,m.usdt,m.eos
from yyyf_server_assess_user au,yyyf_money m from yyyf_server_assess_user au,yyyf_money m
where au.id=m.assess_user_id and au.q_user_id=#{qUserId} and au.id={assessUserId} where au.id=m.assess_user_id and au.q_user_id=#{qUserId} and au.id=#{assessUserId}
</select>
<select id="countUserByTel" resultType="java.lang.Integer">
select count(1) from dapp_u_user_main where mobile_phone = #{tel}
</select> </select>
</mapper> </mapper>

@ -20,11 +20,11 @@
<foreach collection="list" item="assetsReporter" index="index" separator=","> <foreach collection="list" item="assetsReporter" index="index" separator=",">
( (
#{assetsReporter.id}, #{assetsReporter.id},
#{assetsReporter.assess_user_id}, #{assetsReporter.assessUserId},
#{assetsReporter.coin_name}, #{assetsReporter.coinName},
#{assetsReporter.days}, #{assetsReporter.days},
#{assetsReporter.assets}, #{assetsReporter.assets},
#{assetsReporter.create_time} #{assetsReporter.createTime}
) )
</foreach> </foreach>
</insert> </insert>

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.blockchain.server.yyyf.mapper.TrainCaseManageMapper">
<resultMap type="com.blockchain.server.train.dto.ExamPaperDto" id="ExamPaperDtoMap">
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="INTEGER"/>
<result property="wechatInitMoney" column="wechat_init_money" jdbcType="DECIMAL"/>
<result property="alipayInitMoney" column="alipay_init_money" jdbcType="DECIMAL"/>
<result property="bankcardInitMoney" column="bankcard_init_money" jdbcType="DECIMAL"/>
<result property="digitwalletInitMoney" column="digitwallet_init_money" jdbcType="DECIMAL"/>
<collection property="trainCaseTargetList" javaType="list" ofType="com.blockchain.server.train.dto.TrainCaseTargetDto">
<result property="id" column="case_target_id" jdbcType="VARCHAR"/>
<result property="name" column="target_name" jdbcType="VARCHAR"/>
<result property="taskOperate" column="task_operate" jdbcType="INTEGER"/>
<result property="taskRate" column="task_rate" jdbcType="DOUBLE"/>
<result property="taskScore" column="task_score" jdbcType="DOUBLE"/>
<result property="targetId" column="target_id" jdbcType="VARCHAR"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
</collection>
</resultMap>
<select id="getAllExamPaperDto" resultMap="ExamPaperDtoMap">
SELECT
cm.id ,cm.name,cm.type,cm.wechat_init_money,cm.alipay_init_money,cm.bankcard_init_money,cm.digitwallet_init_money,ct.id case_target_id,dt.name target_name,ct.task_rate,ct.task_score,ct.task_operate,dt.code,dt.id target_id
FROM
train_case_manage cm,
train_case_target ct,
train_dict_target dt
WHERE
cm.id = ct.case_id and ct.target_id=dt.id
AND cm.is_del = 0
</select>
</mapper>

@ -1,5 +0,0 @@
for k in $(ls */*/run.sh)
do
echo $k
sh $k
done

@ -33,8 +33,9 @@
<custom-project-version>latest</custom-project-version> <custom-project-version>latest</custom-project-version>
<!-- 配置信息 --> <!-- 配置信息 -->
<eureka-host>zhixinlian:zhi123xin678lian@127.0.0.1</eureka-host> <eureka-host>zhixinlian:zhi123xin678lian@spring-cloud-eureka</eureka-host>
<redis-host>127.0.0.1</redis-host> <redis-host>redis</redis-host>
<tx-host>tx-manager</tx-host>
</properties> </properties>
<dependencies> <dependencies>

@ -16,6 +16,7 @@
<module>spring-cloud-eureka</module> <module>spring-cloud-eureka</module>
<module>spring-cloud-hystrix-dashboard</module> <module>spring-cloud-hystrix-dashboard</module>
<module>spring-cloud-config</module> <module>spring-cloud-config</module>
<module>spring-cloud-gateway</module>
</modules> </modules>

@ -1,5 +0,0 @@
FROM registry.cn-hangzhou.aliyuncs.com/xuankai/jdk8-231
MAINTAINER fengyu.wang wfyvv@qq.com
ADD target/*.jar /app/app.jar
WORKDIR /app
CMD ["java", "-jar", "-Duser.timezone=Asia/ShangHai", "./app.jar"]

@ -1,4 +0,0 @@
workDir=$(cd `dirname $0`; pwd)
imagesName=$(basename $workDir | tr "[A-Z]" "[a-z]")
docker build -t registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName -f $workDir .
docker push registry.cn-hangzhou.aliyuncs.com/god-team/client-$imagesName:latest

@ -1,6 +1,6 @@
spring: spring:
datasource: datasource:
url: jdbc:mysql://127.0.0.1:3306/zhixinlian?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true url: jdbc:mysql://mysql:3306/zhixinlian?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true
username: root username: root
password: 123456 password: 123456
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save