Merge branches 'cpv' and 'feature/撮合交易' of https://gitee.com/chonggaoxiao/new_excoin into cpv
# Conflicts:
# src/main/java/com/xcong/excoin/common/enumerates/SymbolEnum.java
# src/main/java/com/xcong/excoin/modules/blackchain/service/UsdtEthService.java
# src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java
# src/main/java/com/xcong/excoin/rabbit/consumer/ExchangeConsumer.java
# src/main/java/com/xcong/excoin/utils/mail/Sms106Send.java
# src/main/resources/application-prod.yml
# src/main/resources/application-prodapp.yml
# src/main/resources/application-test.yml
# src/main/resources/application.yml
| | |
| | | boolean result = Sms106Send.sendVerifyCode(account, code.toString(), 2); |
| | | if (result) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | boolean flag = redisUtils.set(AppContants.VERIFY_CODE_PREFIX + account, code, 120); |
| | | boolean flag = redisUtils.set(AppContants.VERIFY_CODE_PREFIX + account, code, 600); |
| | | map.put("code", flag); |
| | | return Result.ok(MessageSourceUtils.getString("member_service_0010"), map); |
| | | } |
| | |
| | | |
| | | public boolean verifyCode(String account, String code); |
| | | |
| | | boolean mutiVerifyCode(String email, String emailCode, String phone, String phoneCode); |
| | | |
| | | public String generateOrderNo(Long mid); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public boolean verifyCode(String account, String code) { |
| | | if(StrUtil.isBlank(code)){ |
| | | return false; |
| | | } |
| | | String cacheCode = redisUtils.getString(AppContants.VERIFY_CODE_PREFIX + account); |
| | | if (StrUtil.isBlank(cacheCode)) { |
| | | return false; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean mutiVerifyCode(String email, String emailCode, String phone, String phoneCode) { |
| | | if (StrUtil.isBlank(emailCode) || StrUtil.isBlank(phoneCode)) { |
| | | return false; |
| | | } |
| | | |
| | | String cacheEmailCode = redisUtils.getString(AppContants.VERIFY_CODE_PREFIX + email); |
| | | String cachePhoneCode = redisUtils.getString(AppContants.VERIFY_CODE_PREFIX + phone); |
| | | if (StrUtil.isBlank(cacheEmailCode) || StrUtil.isBlank(cachePhoneCode)) { |
| | | return false; |
| | | } |
| | | |
| | | if (emailCode.equals(cacheEmailCode) && phoneCode.equals(cachePhoneCode)) { |
| | | redisUtils.del(AppContants.VERIFY_CODE_PREFIX + email); |
| | | redisUtils.del(AppContants.VERIFY_CODE_PREFIX + phone); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public String generateOrderNo(Long mid) { |
| | | StringBuilder orderNo = new StringBuilder(); |
| | | String date = DateUtil.format(new Date(), "yyyyMMdd"); |
| | |
| | | import javax.annotation.Resource;
|
| | | import javax.validation.Valid;
|
| | |
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | |
| | | */
|
| | | @ApiOperation(value="绑定邮箱", notes="绑定邮箱")
|
| | | @PostMapping(value="/memberBindEmail")
|
| | | public Result memberBindEmail(@RequestBody @Valid MemberBindEmailDto memberBindEmailDto) {
|
| | | public Result memberBindEmail(@RequestBody @Validated MemberBindEmailDto memberBindEmailDto) {
|
| | | return memberService.memberBindEmail(memberBindEmailDto);
|
| | | }
|
| | |
|
| | |
| | | * 是否设置预估强平价系数 0-否1-是 |
| | | */ |
| | | private Integer isForce; |
| | | |
| | | |
| | | /** |
| | | * shifou xianzhi |
| | | */ |
| | | private Integer isTrader; |
| | | |
| | | /** |
| | | * 滑点 |
| | | */ |
| | |
| | | package com.xcong.excoin.modules.member.parameter.dto;
|
| | |
|
| | | import javax.validation.constraints.NotBlank;
|
| | | import javax.validation.constraints.NotNull;
|
| | |
|
| | | import io.swagger.annotations.ApiModel;
|
| | |
| | | @ApiModel(value = "MemberBindEmailDto", description = "绑定邮箱参数接收类")
|
| | | public class MemberBindEmailDto {
|
| | |
|
| | | @NotNull(message = "验证码不能为空")
|
| | | @NotBlank(message = "验证码不能为空")
|
| | | @ApiModelProperty(value = "验证码", example = "123456")
|
| | | private String code;
|
| | |
|
| | | @NotBlank(message = "手机验证码验证码不能为空")
|
| | | @ApiModelProperty(value = "手机验证码验证码", example = "123456")
|
| | | private String otherCode;
|
| | |
|
| | | @NotNull(message = "邮箱不能为空")
|
| | | @NotBlank(message = "邮箱不能为空")
|
| | | @ApiModelProperty(value = "邮箱", example = "www.13412341234@134.com")
|
| | | private String email;
|
| | |
|
| | |
| | | package com.xcong.excoin.modules.member.parameter.dto;
|
| | |
|
| | | import javax.validation.constraints.NotBlank;
|
| | | import javax.validation.constraints.NotNull;
|
| | |
|
| | | import io.swagger.annotations.ApiModel;
|
| | |
| | | @ApiModel(value = "MemberBindPhoneDto", description = "绑定手机号参数接收类")
|
| | | public class MemberBindPhoneDto {
|
| | |
|
| | | @NotNull(message = "验证码不能为空")
|
| | | @ApiModelProperty(value = "验证码", example = "123456")
|
| | | @NotBlank(message = "手机验证码不能为空")
|
| | | @ApiModelProperty(value = "手机验证码", example = "123456")
|
| | | private String code;
|
| | |
|
| | | @NotBlank(message = "邮箱验证码不能为空")
|
| | | @ApiModelProperty(value = "邮箱验证码", example = "123456")
|
| | | private String otherCode;
|
| | |
|
| | | @NotNull(message = "电话号码不能为空")
|
| | | @NotBlank(message = "电话号码不能为空")
|
| | | @ApiModelProperty(value = "电话号码", example = "13412341234")
|
| | | private String phone;
|
| | |
|
| | |
| | | MemberEntity member = memberDao.selectById(memberId); |
| | | |
| | | if (ObjectUtil.isNotEmpty(member)) { |
| | | if (!commonservice.verifyCode(phone, code)) { |
| | | if (!commonservice.mutiVerifyCode(member.getEmail(), memberBindPhoneDto.getOtherCode(), phone, code)) { |
| | | return Result.fail(MessageSourceUtils.getString("member_service_0013")); |
| | | } |
| | | // 验证邮箱验证码 |
| | | // if (!commonservice.verifyCode(member.getEmail(), memberBindPhoneDto.getOtherCode())) { |
| | | // return Result.fail("邮箱"+MessageSourceUtils.getString("member_service_0013")); |
| | | // } |
| | | Map<String, Object> columnMap = new HashMap<>(); |
| | | columnMap.put("phone", phone); |
| | | List<MemberEntity> selectByMap = memberDao.selectByMap(columnMap); |
| | |
| | | String code = memberBindEmailDto.getCode(); |
| | | |
| | | MemberEntity member = memberDao.selectById(memberId); |
| | | boolean flag = commonservice.verifyCode(email, code); |
| | | boolean flag = commonservice.mutiVerifyCode(email, code, member.getPhone(), memberBindEmailDto.getOtherCode()); |
| | | // boolean flag2 = commonservice.verifyCode(member.getPhone(), memberBindEmailDto.getOtherCode()); |
| | | if(!flag){ |
| | | return Result.fail(MessageSourceUtils.getString("member_service_0013")); |
| | | } |
| | | // if(!flag2){ |
| | | // return Result.fail("手机"+MessageSourceUtils.getString("member_service_0013")); |
| | | // } |
| | | if (ObjectUtil.isNotEmpty(member)) { |
| | | if (flag) { |
| | | Map<String, Object> columnMap = new HashMap<>(); |
| | |
| | | //获取用户ID |
| | | Long memberId = LoginUserUtils.getAppLoginUser().getId(); |
| | | MemberEntity member = memberDao.selectById(memberId); |
| | | String golden_limit_transfer = redisUtils.getString("GOLDEN_LIMIT_TRANSFER"); |
| | | // 判断是否限制 |
| | | if(StringUtils.isNotBlank(member.getPhone()) &&StringUtils.isNotBlank(golden_limit_transfer) && golden_limit_transfer.contains(member.getPhone())){ |
| | | return Result.fail("此账号有财务问题,需联系客服"); |
| | | } |
| | | if(StringUtils.isNotBlank(member.getEmail()) &&StringUtils.isNotBlank(golden_limit_transfer) && golden_limit_transfer.contains(member.getEmail())){ |
| | | return Result.fail("此账号有财务问题,需联系客服"); |
| | | } |
| | | if (member.getCertifyStatus() != MemberEntity.CERTIFY_STATUS_Y) { |
| | | return Result.fail(MessageSourceUtils.getString("member_service_0077")); |
| | | } |
| | |
| | | } |
| | | // 如果开盘价为0,则设置为前一个价格 |
| | | if(kLine.getOpen().compareTo(BigDecimal.ZERO) == 0) { |
| | | kLine.setOpen(coinThumb.getClose()); |
| | | kLine.setClose(coinThumb.getClose()); |
| | | kLine.setLow(coinThumb.getClose()); |
| | | kLine.setHigh(coinThumb.getClose()); |
| | | // 查询前一根K线 TODO |
| | | String key = "KINE_" + symbol + "/USDT_" + period; |
| | | Object data = redisUtils.get(key); |
| | | List list = new ArrayList(); |
| | | if (data != null) { |
| | | list = (List) data; |
| | | Candlestick o = (Candlestick)list.get(list.size() - 1); |
| | | kLine.setOpen(o.getClose()); |
| | | kLine.setClose(o.getClose()); |
| | | kLine.setLow(o.getClose()); |
| | | kLine.setHigh(o.getClose()); |
| | | }else{ |
| | | kLine.setOpen(coinThumb.getClose()); |
| | | kLine.setClose(coinThumb.getClose()); |
| | | kLine.setLow(coinThumb.getClose()); |
| | | kLine.setHigh(coinThumb.getClose()); |
| | | } |
| | | |
| | | } |
| | | //logger.info("generate " + range + rangeUnit + " kline in {},data={}", df.format(new Date(kLine.getTimestamp())), JSON.toJSONString(kLine)); |
| | | service.saveKLine(symbol,period, kLine); |
| | |
| | | package com.xcong.excoin; |
| | | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.xcong.excoin.modules.coin.dao.OrderCoinsDao; |
| | | import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity; |
| | | import com.xcong.excoin.modules.coin.service.OrderCoinService; |
| | | import com.xcong.excoin.trade.CoinTrader; |
| | | import com.xcong.excoin.utils.RedisUtils; |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | |
| | | @Test |
| | | public void buy(){ |
| | | } |
| | | |
| | | public static void main(String[] args) throws InterruptedException { |
| | | String s = SecureUtil.md5("330021"); |
| | | System.out.println(s); |
| | | } |
| | | } |