Compare commits

..

2 Commits

Author SHA1 Message Date
fengyu.wang 5832510737 integration shell update 4 years ago
fengyu.wang 5ec160eb64 integration init 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;
/**
* @author zijie
* @author huan.xu
* @version 1.0
* @className CaseConstant
* @description

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

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

@ -0,0 +1,5 @@
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"]

@ -0,0 +1,4 @@
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,22 +0,0 @@
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> selectAllByOpenId(@Param("userOpenId") String userOpenId);
List<BtcWalletDTO> selectAll(@Param("userOpenId") String userOpenId);
/**
* 用户充值修改钱包金额

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

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

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

@ -0,0 +1,5 @@
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"]

@ -0,0 +1,4 @@
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,5 @@
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"]

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

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

@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Api(CurrencyMarketInnerApi.MARKET_CONTROLLER_API)
@ -42,12 +43,4 @@ public class CurrencyMarketInnerController {
return currencyMarketService.getList();
}
@ApiOperation(value = CurrencyMarketInnerApi.Get.METHOD_API_NAME,
notes = CurrencyMarketInnerApi.Get.METHOD_API_NOTE)
@RequestMapping(value = "/get", method = RequestMethod.GET)
public CurrencyMarketDTO get(
@ApiParam(CurrencyMarketInnerApi.Get.METHOD_API_CURRENCY_PAIR) String currencyPair) {
return currencyMarketService.get(currencyPair);
}
}

@ -14,10 +14,4 @@ public class CurrencyMarketInnerApi {
public static final String METHOD_API_TRADINGTYPE = "成交类型";
}
public static class Get {
public static final String METHOD_API_NAME = "最新行情";
public static final String METHOD_API_NOTE = "获取数字货币最新行情";
public static final String METHOD_API_CURRENCY_PAIR = "数字货币对";
}
}

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

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

@ -0,0 +1,5 @@
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"]

@ -0,0 +1,4 @@
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,5 @@
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"]

@ -0,0 +1,4 @@
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.", "出幣失敗"),
INEXISTENCE_TX(12500, "该记录未找到", "The record was not found", "該記錄未找到"),
INEXISTENCE_WALLET(7017, "该钱包不存在", "The wallet does not exist.", "該錢包不存在"),
FREEBALANCE_NOT_ENOUGH(7009, "钱包可用余额不足", "Insufficient balance available in wallet.", "錢包可用餘額不足")
;

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

@ -0,0 +1,5 @@
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"]

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

@ -1,18 +1,23 @@
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.SessionUserDTO;
import com.blockchain.common.base.exception.RPCException;
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.entity.EthWalletTransfer;
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.IEthWalletService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.tomcat.jni.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
@ -38,8 +43,6 @@ public class EthWalletController {
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)
@GetMapping("/getWallet")
public ResultDTO getWallet(
@ -92,14 +95,13 @@ public class EthWalletController {
@ApiParam(EthWalletApi.SaveWalletPass.METHOD_API_CODE) @RequestParam(name = "code", required = false) String code,
HttpServletRequest request) {
SessionUserDTO user = SSOHelper.getUser(redisTemplate, request);
/* ResultDTO resultDTO = userFeign.validateSmsg(code, user.getTel());
ResultDTO resultDTO = userFeign.validateSmsg(code, user.getTel());
if (resultDTO == null) {
throw new EthWalletException(EthWalletEnums.SERVER_IS_TOO_BUSY);
}
if (resultDTO.getCode() != BaseConstant.REQUEST_SUCCESS) {
throw new RPCException(resultDTO.getCode(), resultDTO.getMsg());
}*/
LOG.info(" user yyyfUserId : "+ user.getYyyfUserId());
}
ethWalletService.updatePassword(user.getId(), password);
return ResultDTO.requstSuccess();
}

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

@ -0,0 +1,5 @@
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"]

@ -0,0 +1,4 @@
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,5 @@
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"]

@ -0,0 +1,4 @@
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,21 +0,0 @@
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,8 +3,6 @@ package com.blockchain.server.otc.common.enums;
import lombok.Getter;
public enum OtcEnums {
FREEBALANCE_NOT_ENOUGH(7009, "钱包可用余额不足", "Insufficient balance available in wallet."),
ERROR_IN_WALLET_CALL(7010, "钱包调用出错,钱包余额不足或者系统错误", "Wallet call error, insufficient wallet balance or system error"),
PASS_NULL(8701, "请输入密码!", "Please enter password!"),
USERID_NULL(8702, "用户id为空!", "User id is empty!"),
PUBLISH_AD_COIN_NULL(8703, "请选择交易货币!", "Please select the currency of exchange!"),

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

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

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

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

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

@ -0,0 +1,5 @@
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"]

@ -0,0 +1,4 @@
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,5 @@
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"]

@ -0,0 +1,4 @@
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,10 +168,8 @@ public class LoginController {
@ApiOperation(value = LoginApi.PassWorldLoginPC.METHOD_NAME,
notes = LoginApi.PassWorldLoginPC.METHOD_NOTE)
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,
HttpServletRequest request) {
@ApiParam(LoginApi.PassWorldLoginPC.METHOD_API_PASS) @RequestParam(name = "password") String password) {
UserMain userMain = userLoginService.handleLoginByPassword(tel, password);
dealBindYyyfAccount(userMain.getId(),request);
return handleAfterLogin(userMain, TokenTypeEnums.PC.getValue());
}

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

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

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

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

@ -0,0 +1,5 @@
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"]

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

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

@ -3,6 +3,7 @@ package com.blockchain.server.yyyf.controller;
import com.blockchain.common.base.dto.ResultDTO;
import com.blockchain.server.yyyf.controller.api.YyyfMoneyApi;
import com.blockchain.server.yyyf.dto.TransactResultDto;
import com.blockchain.server.yyyf.entity.YyyfMoney;
import com.blockchain.server.yyyf.service.YyyfMoneyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -10,12 +11,15 @@ import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
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;
/**
* @author
* @author Mr.Xu
* @version 1.0
* @className MoneyController
* @description
@ -42,33 +46,4 @@ public class YyyfMoneyController {
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;
/**
* @author zijie
* @author huan.xu
* @version 1.0
* @className TeachingGradeApi
* @description

@ -1,7 +1,7 @@
package com.blockchain.server.yyyf.controller.api;
/**
* @author
* @author Mr.Xu
* @version 1.0
* @className MoneyApi
* @description
@ -17,28 +17,4 @@ public class YyyfMoneyApi {
public static final String METHOD_IN="转入币种";
public static final String METHOD_AMOUNT="转入金额";
}
public static class ResetWallet {
/* public static final String METHOD_NAME = "法币交易";
public static final String METHOD_NOTE = "balance为负数是是减少,正数是增加";
public static final String METHOD_ASSESS_USER_ID= "assessUser的主键ID";
public static final String METHOD_COIN_NAME="货币名称";
public static final String METHOD_BALANCE="个数";
public static final String METHOD_PAY_TYPE = "支付类型";
public static final String METHOD_PAY_MONENY = "支付金额";*/
public static 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;
/**
* @author
* @author Mr.Xu
* @version 1.0
* @className AssessUserDto
* @description

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1,47 +0,0 @@
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();
}
}

@ -1,33 +0,0 @@
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());
}
}
}

@ -1,59 +0,0 @@
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
* @author
* @author Mr.Xu
* @date 2020-05-15 00:08:17
* @param [assessUserDtoList]
* @return void
@ -35,7 +35,7 @@ public interface AssessUserMapper extends Mapper<AssessUser> {
/**
* @description 获取未提交的 UserTimeMoneyDto List
* @author
* @author Mr.Xu
* @date 2020-06-01 22:05:09
* @param []
* @return java.util.List<com.blockchain.server.yyyf.dto.UserTimeMoneyDto>
@ -44,7 +44,7 @@ public interface AssessUserMapper extends Mapper<AssessUser> {
/**
* @description assessUserId通过assessUserId 获取余额情况
* @author
* @author Mr.Xu
* @date 2020-06-02 21:07:23
* @param [assessUserId]
* @return com.blockchain.server.yyyf.dto.UserTimeMoneyDto
@ -52,11 +52,4 @@ public interface AssessUserMapper extends Mapper<AssessUser> {
UserTimeMoneyDto getUserTimeMoneyDtoByAssessUserId(@Param("assessUserId") String assessUserId);
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 批量插入指标
* @author
* @author Mr.Xu
* @date 2020-05-14 23:24:21
* @param [list]
* @return void
@ -29,7 +29,7 @@ public interface AssessUserTargetMapper extends Mapper<AssessUserTarget> {
/**
* @description 批量更新指标库最终答题情况
* @author
* @author Mr.Xu
* @date 2020-06-01 22:54:19
* @param [updateAssessUserTargetList]
* @return void

@ -1,27 +0,0 @@
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;
/**
* @author
* @author Mr.Xu
* @version 1.0
* @className YyyfMoneyMapper
* @description

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

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

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

@ -7,18 +7,15 @@ import com.blockchain.server.yyyf.exceprion.YyyfException;
import com.blockchain.server.yyyf.mapper.YyyfMoneyMapper;
import com.blockchain.server.yyyf.service.YyyfMoneyService;
import lombok.SneakyThrows;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author zijie
* @author Mr.Xu
* @version 1.0
* @className YyyfMoneyServiceImpl
* @description
@ -28,13 +25,10 @@ import java.util.Date;
@Service
public class YyyfMoneyServiceImpl implements YyyfMoneyService {
private Logger logger = LoggerFactory.getLogger(YyyfMoneyServiceImpl.class);
@Autowired
private YyyfMoneyMapper yyyfMoneyMapper;
/* @Autowired
private CurrencyFeign currencyFeign;*/
@SneakyThrows
@Override
@ -64,11 +58,11 @@ public class YyyfMoneyServiceImpl implements YyyfMoneyService {
//转入币种后的余额
BigDecimal inSurplus = inOriginal.add(amount);
Method outSetMethod = aClass.getMethod("set".concat(outField), BigDecimal.class);
Method inSetMethod = aClass.getMethod("set".concat(inField), BigDecimal.class);
Method outSetMethod = aClass.getMethod("set".concat(outField),BigDecimal.class);
Method inSetMethod = aClass.getMethod("set".concat(inField),BigDecimal.class);
outSetMethod.invoke(yyyfMoney, outSurplus);
inSetMethod.invoke(yyyfMoney, inSurplus);
outSetMethod.invoke(yyyfMoney,outSurplus);
inSetMethod.invoke(yyyfMoney,inSurplus);
this.yyyfMoneyMapper.updateByPrimaryKeySelective(yyyfMoney);
@ -95,64 +89,4 @@ public class YyyfMoneyServiceImpl implements YyyfMoneyService {
public void update(YyyfMoney 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;
/**
* @author
* @author Mr.Xu
* @version 1.0
* @className ScheduleTask
* @description
@ -36,10 +36,6 @@ public class ScheduleTask {
@Scheduled(initialDelay = 5000,fixedRate=60000)
private void OneMinuteTask() {
logger.info("开始扫描案例"+ new Date());
this.assessUserService.initAllExamPaperDto();
logger.info("完成扫描案例"+ new Date());
logger.info("开始扫描考试"+ new Date());
HashOperations<String, String, ExamDto> examDtoOpsForHash = redisTemplate.opsForHash();
Map<String, ExamDto> examDtoMap = examDtoOpsForHash.entries(YyyfConstant.EXAM_KEY);

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

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

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

@ -128,11 +128,7 @@
<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
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}
</select>
<select id="countUserByTel" resultType="java.lang.Integer">
select count(1) from dapp_u_user_main where mobile_phone = #{tel}
where au.id=m.assess_user_id and au.q_user_id=#{qUserId} and au.id={assessUserId}
</select>
</mapper>

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

@ -1,36 +0,0 @@
<?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>

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

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

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

@ -0,0 +1,5 @@
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"]

@ -0,0 +1,4 @@
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:
datasource:
url: jdbc:mysql://mysql:3306/zhixinlian?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true
url: jdbc:mysql://127.0.0.1:3306/zhixinlian?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true
username: root
password: 123456
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