xiaoyong931011
2021-05-17 7572b8dbd4c41ca9b6437a032da2aa1a0fdd5444
src/main/java/com/xcong/excoin/modules/yunding/service/impl/BasicSettingServiceImpl.java
@@ -5,21 +5,25 @@
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.entity.MemberWalletCoinEntity;
import com.xcong.excoin.modules.member.mapper.MemberMapper;
import com.xcong.excoin.modules.member.mapper.MemberWalletCoinMapper;
import com.xcong.excoin.modules.yunding.entity.BasicSettingEntity;
import com.xcong.excoin.modules.yunding.entity.YdOrderEntity;
import com.xcong.excoin.modules.yunding.entity.YdProductEntity;
import com.xcong.excoin.modules.yunding.mapper.BasicSettingMapper;
import com.xcong.excoin.modules.yunding.mapper.YdProductMapper;
import com.xcong.excoin.modules.yunding.service.IBasicSettingService;
import com.xcong.excoin.modules.yunding.vo.YdAgentOrderVo;
import com.xcong.excoin.modules.yunding.vo.YdMemberVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
@@ -34,6 +38,10 @@
    private BasicSettingMapper basicSettingMapper;
    @Resource
    private MemberWalletCoinMapper memberWalletCoinMapper;
    @Resource
    private MemberMapper memberMapper;
    @Resource
    private YdProductMapper ydProductMapper;
    @Override
    public IPage<YdOrderEntity> getOrderList(YdOrderEntity ydOrderEntity, QueryRequest request) {
@@ -124,4 +132,60 @@
        return ydOrderEntitys;
    }
    @Override
    @Transactional
    public FebsResponse addIsTraderOn(Long id) {
        MemberEntity memberEntity = memberMapper.selectById(id);
        if(ObjectUtil.isEmpty(memberEntity)) {
            return new FebsResponse().fail().message("会员信息不存在");
        }
        memberEntity.setIsTrader(MemberEntity.ISTRADER_Y);
        memberMapper.updateById(memberEntity);
        return new FebsResponse().success();
    }
    @Override
    @Transactional
    public FebsResponse delIsTraderOn(Long id) {
        MemberEntity memberEntity = memberMapper.selectById(id);
        if(ObjectUtil.isEmpty(memberEntity)) {
            return new FebsResponse().fail().message("会员信息不存在");
        }
        memberEntity.setIsTrader(MemberEntity.ISTRADER_N);
        memberMapper.updateById(memberEntity);
        return new FebsResponse().success();
    }
    @Override
    public YdProductEntity getydProductUpdateById(long id) {
        return basicSettingMapper.getydProductById(id);
    }
    @Override
    @Transactional
    public FebsResponse ydProductUpdateOn(YdProductEntity ydProductEntity) {
        Long id = ydProductEntity.getId();
        YdProductEntity ydProductEntityOld = ydProductMapper.selectById(id);
        String name = ydProductEntity.getName();
        ydProductEntityOld.setName(name);
        BigDecimal totalT = ydProductEntity.getTotalT();
        ydProductEntityOld.setTotalT(totalT);
        BigDecimal surplusT = ydProductEntity.getSurplusT();
        ydProductEntityOld.setSurplusT(surplusT);
        BigDecimal salePrice = ydProductEntity.getSalePrice();
        ydProductEntityOld.setSalePrice(salePrice);
        Integer proCycle = ydProductEntity.getProCycle();
        ydProductEntityOld.setProCycle(proCycle);
        BigDecimal manageExpense = ydProductEntity.getManageExpense();
        ydProductEntityOld.setManageExpense(manageExpense);
        Integer shelvesDays = ydProductEntity.getShelvesDays();
        ydProductEntityOld.setShelvesDays(shelvesDays);
        Integer limitedNum = ydProductEntity.getLimitedNum();
        ydProductEntityOld.setLimitedNum(limitedNum);
        Integer status = ydProductEntity.getStatus();
        ydProductEntityOld.setStatus(status);
        ydProductMapper.updateById(ydProductEntityOld);
        return new FebsResponse().success();
    }
}