| | |
| | | package com.xcong.excoin.modules.otc.service.impl; |
| | | |
| | | public class OtcServiceImpl { |
| | | 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.modules.member.entity.MemberAccountMoneyChangeEntity; |
| | | import com.xcong.excoin.modules.member.entity.MemberEntity; |
| | | import com.xcong.excoin.modules.member.mapper.MemberMapper; |
| | | import com.xcong.excoin.modules.otc.entity.OtcMarketBussinessEntity; |
| | | import com.xcong.excoin.modules.otc.mapper.OtcMarketBussinessMapper; |
| | | import com.xcong.excoin.modules.otc.service.OtcService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class OtcServiceImpl extends ServiceImpl<OtcMarketBussinessMapper, OtcMarketBussinessEntity> implements OtcService { |
| | | |
| | | @Resource |
| | | private OtcMarketBussinessMapper otcMarketBussinessMapper; |
| | | @Resource |
| | | private MemberMapper memberMapper; |
| | | |
| | | @Override |
| | | public IPage<OtcMarketBussinessEntity> otcShopList(OtcMarketBussinessEntity otcMarketBussinessEntity, QueryRequest request) { |
| | | Page<OtcMarketBussinessEntity> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<OtcMarketBussinessEntity> otcMarketBussinessEntitys = otcMarketBussinessMapper.otcShopList(page, otcMarketBussinessEntity); |
| | | return otcMarketBussinessEntitys; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public FebsResponse agreeShop(Long id) { |
| | | OtcMarketBussinessEntity otcMarketBussinessEntity = otcMarketBussinessMapper.selectById(id); |
| | | Integer status = otcMarketBussinessEntity.getStatus(); |
| | | if(OtcMarketBussinessEntity.STATUS_ONE != status){ |
| | | return new FebsResponse().fail().message("当前状态不是待审核"); |
| | | } |
| | | otcMarketBussinessEntity.setStatus(OtcMarketBussinessEntity.STATUS_TWO); |
| | | otcMarketBussinessMapper.updateById(otcMarketBussinessEntity); |
| | | |
| | | long memberId = otcMarketBussinessEntity.getMemberId(); |
| | | MemberEntity memberEntity = memberMapper.selectById(memberId); |
| | | memberEntity.setIsTrader(MemberEntity.ISTRADER_Y); |
| | | memberMapper.updateById(memberEntity); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public FebsResponse disagreeShop(Long id) { |
| | | OtcMarketBussinessEntity otcMarketBussinessEntity = otcMarketBussinessMapper.selectById(id); |
| | | Integer status = otcMarketBussinessEntity.getStatus(); |
| | | if(OtcMarketBussinessEntity.STATUS_ONE != status){ |
| | | return new FebsResponse().fail().message("当前状态不是待审核"); |
| | | } |
| | | otcMarketBussinessEntity.setStatus(OtcMarketBussinessEntity.STATUS_THREE); |
| | | otcMarketBussinessMapper.updateById(otcMarketBussinessEntity); |
| | | |
| | | long memberId = otcMarketBussinessEntity.getMemberId(); |
| | | MemberEntity memberEntity = memberMapper.selectById(memberId); |
| | | memberEntity.setIsTrader(MemberEntity.ISTRADER_Y); |
| | | memberMapper.updateById(memberEntity); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | } |