From 9909c23061541816b21d560f765d0a7274fc6323 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Tue, 18 May 2021 15:12:34 +0800 Subject: [PATCH] 20210518 商户审核 --- src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java | 70 ++++++++++++++++++++++++++++++++++ 1 files changed, 69 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java b/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java index 111aba1..e2128f7 100644 --- a/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java @@ -1,4 +1,72 @@ 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(); + } + } -- Gitblit v1.9.1