xiaoyong931011
2021-06-17 4c902d9c20dd965d1ec832760809c622d1df9aac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package com.xcong.excoin.modules.trademanage.service.impl;
 
 
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xcong.excoin.common.entity.FebsResponse;
import com.xcong.excoin.common.entity.QueryRequest;
import com.xcong.excoin.common.utils.CoinTypeConvert;
import com.xcong.excoin.common.utils.RedisUtils;
import com.xcong.excoin.modules.member.entity.MemberAccountMoneyChangeEntity;
import com.xcong.excoin.modules.member.entity.MemberAuthenticationEntity;
import com.xcong.excoin.modules.member.entity.MemberEntity;
import com.xcong.excoin.modules.member.mapper.MemberAccountMoneyChangeMapper;
import com.xcong.excoin.modules.member.mapper.MemberAuthenticationMapper;
import com.xcong.excoin.modules.member.mapper.MemberMapper;
import com.xcong.excoin.modules.trademanage.dto.BzzNewPriceDto;
import com.xcong.excoin.modules.trademanage.entity.*;
import com.xcong.excoin.modules.trademanage.mapper.*;
import com.xcong.excoin.modules.trademanage.service.OrderCoinDealService;
import com.xcong.excoin.modules.trademanage.service.TradeManageService;
import com.xcong.excoin.modules.trademanage.vo.BzzNewPriceVo;
import com.xcong.excoin.modules.trademanage.vo.MemberAccountInfoVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
@Service
@RequiredArgsConstructor
public class OrderCoinsDealServiceImpl extends ServiceImpl<OrderCoinDealMapper, OrderCoinsDealEntity> implements OrderCoinDealService {
 
 
    private final OrderCoinDealMapper orderCoinDealMapper;
    private final RedisUtils redisUtils;
    @Override
    public IPage<OrderCoinsDealEntity> findOrderCoinsDealListInPage(OrderCoinsDealEntity contractHoldOrderEntity, QueryRequest request) {
        Page<OrderCoinsDealEntity> page = new Page<>(request.getPageNum(), request.getPageSize());
        IPage<OrderCoinsDealEntity> findMemberAccountInfoListInPage = orderCoinDealMapper.selectOrderCoinsDealListInPage(page, contractHoldOrderEntity);
        //List<OrderCoinsDealEntity> records = findMemberAccountInfoListInPage.getRecords();
        return findMemberAccountInfoListInPage;
    }
 
    @Override
    public IPage<BzzNewPriceVo> bzzNewPrice(QueryRequest request) {
        String newPrice = redisUtils.getString("bzz_order_new_price");
        String bzzStart = redisUtils.getString("bzz_start");
        BzzNewPriceVo bzzNewPriceVo = new BzzNewPriceVo();
        bzzNewPriceVo.setNewprice(newPrice);
        bzzNewPriceVo.setBzzStart(Integer.parseInt(bzzStart));
        List<BzzNewPriceVo> bzzNewPrices = new ArrayList<>();
        bzzNewPrices.add(bzzNewPriceVo);
 
        Page<BzzNewPriceVo> bzzNewPriceVos = new Page<>();
        bzzNewPriceVos.setRecords(bzzNewPrices);
        return bzzNewPriceVos;
    }
 
    @Override
    @Transactional
    public FebsResponse bzzNewPriceUpdate(BzzNewPriceDto bzzNewPriceDto) {
        String newprice = bzzNewPriceDto.getNewprice();
        if(StrUtil.isEmpty(newprice)){
            return new FebsResponse().fail().message("最新价不能为空");
        }
        int bzzStart = bzzNewPriceDto.getBzzStart();
        boolean flag = redisUtils.set("bzz_order_new_price", newprice);
        boolean flagStart = redisUtils.set("bzz_start", bzzStart);
        if(flag && flagStart){
            return new FebsResponse().success().message("设置成功");
        }else{
            return new FebsResponse().fail().message("设置失败");
        }
    }
 
    @Override
    public IPage<GbzOrderEntity> gbzOrderEntity(GbzOrderEntity gbzOrderEntity, QueryRequest request) {
        Page<GbzOrderEntity> page = new Page<>(request.getPageNum(), request.getPageSize());
        IPage<GbzOrderEntity> gbzOrderEntitys = orderCoinDealMapper.selectGbzOrderEntitysInPage(page, gbzOrderEntity);
        return gbzOrderEntitys;
    }
}