use of cn.lili.modules.store.entity.dos.StoreDetail 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;
}
use of cn.lili.modules.store.entity.dos.StoreDetail 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);
}
use of cn.lili.modules.store.entity.dos.StoreDetail 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);
}
use of cn.lili.modules.store.entity.dos.StoreDetail in project lilishop by lilishop.
the class StoreDetailServiceImpl method goodsManagementCategory.
@Override
public List<StoreManagementCategoryVO> goodsManagementCategory(String storeId) {
// 获取顶部分类列表
List<Category> categoryList = categoryService.firstCategory();
// 获取店铺信息
StoreDetail storeDetail = this.getOne(new LambdaQueryWrapper<StoreDetail>().eq(StoreDetail::getStoreId, storeId));
// 获取店铺分类
String[] storeCategoryList = storeDetail.getGoodsManagementCategory().split(",");
List<StoreManagementCategoryVO> list = new ArrayList<>();
for (Category category : categoryList) {
StoreManagementCategoryVO storeManagementCategoryVO = new StoreManagementCategoryVO(category);
for (String storeCategory : storeCategoryList) {
if (storeCategory.equals(category.getId())) {
storeManagementCategoryVO.setSelected(true);
}
}
list.add(storeManagementCategoryVO);
}
return list;
}
use of cn.lili.modules.store.entity.dos.StoreDetail in project lilishop by lilishop.
the class StoreServiceImpl method applyFirstStep.
@Override
public boolean applyFirstStep(StoreCompanyDTO storeCompanyDTO) {
// 获取当前操作的店铺
Store store = getStoreByMember();
// 如果没有申请过店铺,新增店铺
if (!Optional.ofNullable(store).isPresent()) {
AuthUser authUser = Objects.requireNonNull(UserContext.getCurrentUser());
Member member = memberService.getById(authUser.getId());
store = new Store(member);
BeanUtil.copyProperties(storeCompanyDTO, store);
this.save(store);
StoreDetail storeDetail = new StoreDetail();
storeDetail.setStoreId(store.getId());
BeanUtil.copyProperties(storeCompanyDTO, storeDetail);
return storeDetailService.save(storeDetail);
} else {
BeanUtil.copyProperties(storeCompanyDTO, store);
this.updateById(store);
// 判断是否存在店铺详情,如果没有则进行新建,如果存在则进行修改
StoreDetail storeDetail = storeDetailService.getStoreDetail(store.getId());
BeanUtil.copyProperties(storeCompanyDTO, storeDetail);
return storeDetailService.updateById(storeDetail);
}
}
Aggregations