xiaoyong931011
2022-08-09 45f867b6f1e83c52bc0c13dd99b8301e64692b30
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallTeamLeaderServiceImpl.java
@@ -1,6 +1,7 @@
package cc.mrbird.febs.mall.service.impl;
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.enumerates.OrderDeliveryStateEnum;
import cc.mrbird.febs.common.enumerates.OrderStatusEnum;
import cc.mrbird.febs.common.utils.LoginUserUtil;
import cc.mrbird.febs.common.utils.ShareCodeUtil;
@@ -45,6 +46,10 @@
        if(CollUtil.isNotEmpty(mallTeamLeaders)){
            return new FebsResponse().fail().message("正在申请中");
        }
        List<MallTeamLeader> mallTeamLeaderCancel = this.baseMapper.selectListByMemberIdAndState(memberId, MallTeamLeader.STATE_CANCEL);
        if(CollUtil.isNotEmpty(mallTeamLeaderCancel)){
            return new FebsResponse().fail().message("当前用户无法申请");
        }
        MallTeamLeader mallTeamLeader = MallTeamLeaderConversion.INSTANCE.dtoToEntity(apiApplayLeaderDto);
        mallTeamLeader.setMemberId(memberId);
        mallTeamLeader.setState(MallTeamLeader.STATE_ING);
@@ -68,10 +73,13 @@
        List<MallTeamLeader> mallTeamLeadersIng = this.baseMapper.selectListByMemberIdAndState(memberId, MallTeamLeader.STATE_ING);
        List<MallTeamLeader> mallTeamLeadersNo = this.baseMapper.selectListByMemberIdAndState(memberId, MallTeamLeader.STATE_NO);
        List<MallTeamLeader> mallTeamLeadersYes = this.baseMapper.selectListByMemberIdAndState(memberId, MallTeamLeader.STATE_YES);
        List<MallTeamLeader> mallTeamLeadersCancel = this.baseMapper.selectListByMemberIdAndState(memberId, MallTeamLeader.STATE_CANCEL);
        if(CollUtil.isNotEmpty(mallTeamLeadersIng) ||CollUtil.isNotEmpty(mallTeamLeadersYes)){
            apiMallleaderStateVo.setState(2);
        }else if(CollUtil.isNotEmpty(mallTeamLeadersNo)){
            apiMallleaderStateVo.setState(1);
        }else if(CollUtil.isNotEmpty(mallTeamLeadersCancel)){
            apiMallleaderStateVo.setState(2);
        }else{
            apiMallleaderStateVo.setState(1);
        }
@@ -82,6 +90,7 @@
    public FebsResponse getApiLeaderInfoVoById(Long id) {
        MallTeamLeader mallTeamLeader = this.baseMapper.selectById(id);
        ApiLeaderInfoVo apiLeaderInfoVo = new ApiLeaderInfoVo();
        apiLeaderInfoVo.setId(mallTeamLeader.getId());
        apiLeaderInfoVo.setName(mallTeamLeader.getName());
        apiLeaderInfoVo.setPhone(mallTeamLeader.getPhone());
        apiLeaderInfoVo.setAddressPic(mallTeamLeader.getAddressPic());
@@ -113,14 +122,14 @@
            return new FebsResponse().fail().message("订单不存在");
        }
        Integer status = mallOrderInfo.getStatus();
        if(OrderStatusEnum.WAIT_SHIPPING.getValue() != status){
        if(OrderStatusEnum.WAIT_FINISH.getValue() != status){
            return new FebsResponse().fail().message("订单不是待确认到货状态");
        }
        Integer deliveryType = mallOrderInfo.getDeliveryType();
        if(1 != deliveryType){
            return new FebsResponse().fail().message("订单的配送方式不是自提");
        }
        mallOrderInfo.setStatus(OrderStatusEnum.WAIT_FINISH.getValue());
        mallOrderInfo.setDeliveryState(OrderDeliveryStateEnum.DELIVERY_FINISH.getValue());
        mallOrderInfoMapper.updateById(mallOrderInfo);
        return new FebsResponse().success().message("确认成功");
    }