Search in sources :

Example 1 with Store

use of cn.lili.modules.store.entity.dos.Store in project lilishop by lilishop.

the class StoreDetailServiceImpl method editMerchantEuid.

@Override
public Boolean editMerchantEuid(String merchantEuid) {
    AuthUser tokenUser = Objects.requireNonNull(UserContext.getCurrentUser());
    Store store = storeService.getById(tokenUser.getStoreId());
    store.setMerchantEuid(merchantEuid);
    return storeService.updateById(store);
}
Also used : Store(cn.lili.modules.store.entity.dos.Store) AuthUser(cn.lili.common.security.AuthUser)

Example 2 with Store

use of cn.lili.modules.store.entity.dos.Store in project lilishop by lilishop.

the class StoreServiceImpl method add.

@Override
@Transactional(rollbackFor = Exception.class)
public Store add(AdminStoreApplyDTO adminStoreApplyDTO) {
    // 判断店铺名称是否存在
    QueryWrapper<Store> queryWrapper = Wrappers.query();
    queryWrapper.eq("store_name", adminStoreApplyDTO.getStoreName());
    if (this.getOne(queryWrapper) != null) {
        throw new ServiceException(ResultCode.STORE_NAME_EXIST_ERROR);
    }
    Member member = memberService.getById(adminStoreApplyDTO.getMemberId());
    // 判断用户是否存在
    if (member == null) {
        throw new ServiceException(ResultCode.USER_NOT_EXIST);
    }
    // 判断是否拥有店铺
    if (Boolean.TRUE.equals(member.getHaveStore())) {
        throw new ServiceException(ResultCode.STORE_APPLY_DOUBLE_ERROR);
    }
    // 添加店铺
    Store store = new Store(member, adminStoreApplyDTO);
    this.save(store);
    // 判断是否存在店铺详情,如果没有则进行新建,如果存在则进行修改
    StoreDetail storeDetail = new StoreDetail(store, adminStoreApplyDTO);
    storeDetailService.save(storeDetail);
    // 设置会员-店铺信息
    memberService.update(new LambdaUpdateWrapper<Member>().eq(Member::getId, member.getId()).set(Member::getHaveStore, true).set(Member::getStoreId, store.getId()));
    return store;
}
Also used : LambdaUpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper) StoreDetail(cn.lili.modules.store.entity.dos.StoreDetail) ServiceException(cn.lili.common.exception.ServiceException) Store(cn.lili.modules.store.entity.dos.Store) Member(cn.lili.modules.member.entity.dos.Member) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with Store

use of cn.lili.modules.store.entity.dos.Store in project lilishop by lilishop.

the class StoreServiceImpl method disable.

@Override
public boolean disable(String id) {
    Store store = this.getById(id);
    if (store != null) {
        store.setStoreDisable(StoreStatusEnum.CLOSED.value());
        // 下架所有此店铺商品
        goodsService.underStoreGoods(id);
        return this.updateById(store);
    }
    throw new ServiceException(ResultCode.STORE_NOT_EXIST);
}
Also used : ServiceException(cn.lili.common.exception.ServiceException) Store(cn.lili.modules.store.entity.dos.Store)

Example 4 with Store

use of cn.lili.modules.store.entity.dos.Store in project lilishop by lilishop.

the class StoreServiceImpl method applyThirdStep.

@Override
public boolean applyThirdStep(StoreOtherInfoDTO storeOtherInfoDTO) {
    // 获取当前操作的店铺
    Store store = getStoreByMember();
    BeanUtil.copyProperties(storeOtherInfoDTO, store);
    this.updateById(store);
    StoreDetail storeDetail = storeDetailService.getStoreDetail(store.getId());
    // 设置店铺的其他信息
    BeanUtil.copyProperties(storeOtherInfoDTO, storeDetail);
    // 设置店铺经营范围
    storeDetail.setGoodsManagementCategory(storeOtherInfoDTO.getGoodsManagementCategory());
    // 最后一步申请,给予店铺设置库存预警默认值
    storeDetail.setStockWarning(10);
    // 修改店铺详细信息
    storeDetailService.updateById(storeDetail);
    // 设置店铺名称,修改店铺信息
    store.setStoreName(storeOtherInfoDTO.getStoreName());
    store.setStoreDisable(StoreStatusEnum.APPLYING.name());
    store.setStoreCenter(storeOtherInfoDTO.getStoreCenter());
    store.setStoreDesc(storeOtherInfoDTO.getStoreDesc());
    store.setStoreLogo(storeOtherInfoDTO.getStoreLogo());
    return this.updateById(store);
}
Also used : StoreDetail(cn.lili.modules.store.entity.dos.StoreDetail) Store(cn.lili.modules.store.entity.dos.Store)

Example 5 with Store

use of cn.lili.modules.store.entity.dos.Store in project lilishop by lilishop.

the class StoreServiceImpl method applySecondStep.

@Override
public boolean applySecondStep(StoreBankDTO storeBankDTO) {
    // 获取当前操作的店铺
    Store store = getStoreByMember();
    StoreDetail storeDetail = storeDetailService.getStoreDetail(store.getId());
    // 设置店铺的银行信息
    BeanUtil.copyProperties(storeBankDTO, storeDetail);
    return storeDetailService.updateById(storeDetail);
}
Also used : StoreDetail(cn.lili.modules.store.entity.dos.StoreDetail) Store(cn.lili.modules.store.entity.dos.Store)

Aggregations

Store (cn.lili.modules.store.entity.dos.Store)13 ServiceException (cn.lili.common.exception.ServiceException)5 StoreDetail (cn.lili.modules.store.entity.dos.StoreDetail)5 AuthUser (cn.lili.common.security.AuthUser)4 Member (cn.lili.modules.member.entity.dos.Member)3 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)3 Transactional (org.springframework.transaction.annotation.Transactional)3 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)2 DateTime (cn.hutool.core.date.DateTime)1 MemberEvaluation (cn.lili.modules.member.entity.dos.MemberEvaluation)1 StoreRatingVO (cn.lili.modules.member.entity.vo.StoreRatingVO)1 StoreMessage (cn.lili.modules.message.entity.dos.StoreMessage)1 LambdaUpdateWrapper (com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper)1 ArrayList (java.util.ArrayList)1