| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.dapp.dto.AddMallGoodsDto; |
| | | import cc.mrbird.febs.dapp.dto.HlmBasicPerkDto; |
| | | import cc.mrbird.febs.dapp.dto.MallGoodsUpdateDto; |
| | | import cc.mrbird.febs.dapp.dto.MallOrderInfoDto; |
| | | import cc.mrbird.febs.dapp.entity.DataDictionaryCustom; |
| | | import cc.mrbird.febs.dapp.entity.MallGoods; |
| | | import cc.mrbird.febs.dapp.entity.MallOrderInfo; |
| | | import cc.mrbird.febs.dapp.dto.*; |
| | | import cc.mrbird.febs.dapp.entity.*; |
| | | import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum; |
| | | import cc.mrbird.febs.dapp.mapper.DappFundFlowDao; |
| | | import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper; |
| | | import cc.mrbird.febs.dapp.mapper.MallGoodsMapper; |
| | | import cc.mrbird.febs.dapp.mapper.MallOrderInfoMapper; |
| | | import cc.mrbird.febs.dapp.mapper.*; |
| | | import cc.mrbird.febs.dapp.service.IAdminMallGoodsService; |
| | | import cc.mrbird.febs.dapp.vo.AdminMallGoodsCategoryTreeVo; |
| | | import cc.mrbird.febs.dapp.vo.AdminMallGoodsCategoryVo; |
| | | import cc.mrbird.febs.dapp.vo.AdminMallMoneyFlowVo; |
| | | import cc.mrbird.febs.dapp.vo.AdminMallOrderVo; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | private final MallOrderInfoMapper mallOrderInfoMapper; |
| | | private final DappFundFlowDao dappFundFlowDao; |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | private final MallGoodsCategoryMapper mallGoodsCategoryMapper; |
| | | |
| | | private final PlatformBannerMapper platformBannerMapper; |
| | | private final MallGoodsImagesMapper mallGoodsImagesMapper; |
| | | private final DappMemberDao dappMemberDao; |
| | | |
| | | @Override |
| | | public IPage<MallGoods> getCategoryListInPage(MallGoods mallGoods, QueryRequest request) { |
| | |
| | | BeanUtil.copyProperties(addMallGoodsDto, mallGoods); |
| | | mallGoods.setIsSale(MallGoods.ISSALE_STATUS_DISABLED); |
| | | mallGoodsMapper.insert(mallGoods); |
| | | |
| | | String thumbs = addMallGoodsDto.getThumbs(); |
| | | if (StrUtil.isNotEmpty(thumbs)) { |
| | | List<String> imgs = StrUtil.splitTrim(thumbs, ","); |
| | | if (CollUtil.isNotEmpty(imgs)) { |
| | | int i = 1; |
| | | for (String img : imgs) { |
| | | MallGoodsImages mallGoodsImages = new MallGoodsImages(); |
| | | mallGoodsImages.setGoodsId(mallGoods.getId()); |
| | | mallGoodsImages.setImageUrl(img); |
| | | mallGoodsImages.setSeq(i); |
| | | mallGoodsImagesMapper.insert(mallGoodsImages); |
| | | i++; |
| | | } |
| | | } |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public MallGoods selectGoodsById(long id) { |
| | | MallGoods mallGoods = mallGoodsMapper.selectById(id); |
| | | List<String> thumbs = mallGoodsImagesMapper.selectByGoodId(mallGoods.getId()); |
| | | mallGoods.setImages(thumbs); |
| | | return mallGoods; |
| | | } |
| | | |
| | |
| | | |
| | | BeanUtil.copyProperties(mallGoodsUpdateDto, mallGoods); |
| | | mallGoodsMapper.updateById(mallGoods); |
| | | |
| | | mallGoodsImagesMapper.deleteByGoodsId(mallGoodsUpdateDto.getId()); |
| | | String thumbs = mallGoodsUpdateDto.getThumbs(); |
| | | if (StrUtil.isNotEmpty(thumbs)) { |
| | | List<String> imgs = StrUtil.splitTrim(thumbs, ","); |
| | | if (CollUtil.isNotEmpty(imgs)) { |
| | | int i = 1; |
| | | for (String img : imgs) { |
| | | MallGoodsImages mallGoodsImages = new MallGoodsImages(); |
| | | mallGoodsImages.setGoodsId(mallGoods.getId()); |
| | | mallGoodsImages.setImageUrl(img); |
| | | mallGoodsImages.setSeq(i); |
| | | mallGoodsImagesMapper.insert(mallGoodsImages); |
| | | i++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | |
| | | updateDataDic(DataDictionaryEnum.WITHDRAW_FEE.getType(), |
| | | DataDictionaryEnum.WITHDRAW_FEE.getCode(), |
| | | hlmBasicPerkDto.getWithDrawFee()); |
| | | updateDataDic(DataDictionaryEnum.MIN_WITHDRAW_AMOUNT.getType(), |
| | | DataDictionaryEnum.MIN_WITHDRAW_AMOUNT.getCode(), |
| | | hlmBasicPerkDto.getMinWithdraw()); |
| | | updateDataDic(DataDictionaryEnum.MAX_WITHDRAW_AMOUNT.getType(), |
| | | DataDictionaryEnum.MAX_WITHDRAW_AMOUNT.getCode(), |
| | | hlmBasicPerkDto.getMaxWithdraw()); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<MallGoodsCategory> getCategoryList(MallGoodsCategory mallGoodsCategory, QueryRequest request) { |
| | | Page<MallGoodsCategory> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<MallGoodsCategory> mallGoodsCategorys = mallGoodsCategoryMapper.selectCategoryListInPage(page, mallGoodsCategory); |
| | | return mallGoodsCategorys; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse addCategory(MallGoodsCategory mallGoodsCategory) { |
| | | String name = mallGoodsCategory.getName(); |
| | | if(StrUtil.isEmpty(name)){ |
| | | return new FebsResponse().fail().message("分类名称不能为空"); |
| | | } |
| | | List<MallGoodsCategory> categorys = mallGoodsCategoryMapper.selectCategoryByName(name); |
| | | if(CollUtil.isNotEmpty(categorys)){ |
| | | return new FebsResponse().fail().message("分类名称不能重复"); |
| | | } |
| | | Long parentIdParam = mallGoodsCategory.getParentId() == null ? 0L:mallGoodsCategory.getParentId(); |
| | | Integer isRecommendParam = mallGoodsCategory.getIsRecommend(); |
| | | if(parentIdParam > 0 && isRecommendParam == 1){ |
| | | return new FebsResponse().fail().message("子分类不能选择【是否推荐】为【是】"); |
| | | } |
| | | |
| | | MallGoodsCategory goodsCategory = new MallGoodsCategory(); |
| | | goodsCategory.setName(name); |
| | | goodsCategory.setImage(mallGoodsCategory.getImage()); |
| | | if(ObjectUtil.isNotEmpty(mallGoodsCategory.getParentId())){ |
| | | Long parentId = mallGoodsCategory.getParentId(); |
| | | MallGoodsCategory mallGoodsCategoryParent = mallGoodsCategoryMapper.selectById(parentId); |
| | | goodsCategory.setParentId(mallGoodsCategory.getParentId()); |
| | | if(StrUtil.isNotEmpty(mallGoodsCategoryParent.getParentIds())){ |
| | | goodsCategory.setParentIds(mallGoodsCategoryParent.getParentIds()+","+mallGoodsCategory.getParentId()+","); |
| | | }else{ |
| | | goodsCategory.setParentIds(mallGoodsCategory.getParentId()+","); |
| | | } |
| | | goodsCategory.setIsRecommend(0); |
| | | }else{ |
| | | goodsCategory.setParentId(0L); |
| | | goodsCategory.setIsRecommend(mallGoodsCategory.getIsRecommend()); |
| | | } |
| | | mallGoodsCategoryMapper.insert(goodsCategory); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse updateCategory(MallGoodsCategory mallGoodsCategoryParam) { |
| | | String name = mallGoodsCategoryParam.getName(); |
| | | if(StrUtil.isEmpty(name)){ |
| | | return new FebsResponse().fail().message("名称不能为空"); |
| | | } |
| | | Long parentIdParam = mallGoodsCategoryParam.getParentId() == null ? 0L:mallGoodsCategoryParam.getParentId(); |
| | | Integer isRecommendParam = mallGoodsCategoryParam.getIsRecommend(); |
| | | if(parentIdParam > 0 && isRecommendParam == 1){ |
| | | return new FebsResponse().fail().message("子分类不能选择【是否推荐】为【是】"); |
| | | } |
| | | |
| | | Long id = mallGoodsCategoryParam.getId(); |
| | | MallGoodsCategory mallGoodsCategory = mallGoodsCategoryMapper.selectById(id); |
| | | mallGoodsCategory.setName(mallGoodsCategoryParam.getName()); |
| | | mallGoodsCategory.setImage(mallGoodsCategoryParam.getImage()); |
| | | mallGoodsCategory.setIndexNum(mallGoodsCategoryParam.getIndexNum()); |
| | | if(ObjectUtil.isNotEmpty(mallGoodsCategoryParam.getParentId())){ |
| | | Long parentId = mallGoodsCategoryParam.getParentId(); |
| | | MallGoodsCategory mallGoodsCategoryParent = mallGoodsCategoryMapper.selectById(parentId); |
| | | mallGoodsCategory.setParentId(mallGoodsCategoryParam.getParentId()); |
| | | if(StrUtil.isNotEmpty(mallGoodsCategoryParent.getParentIds())){ |
| | | mallGoodsCategory.setParentIds(mallGoodsCategoryParent.getParentIds()+","+mallGoodsCategory.getParentId()+","); |
| | | }else{ |
| | | mallGoodsCategory.setParentIds(mallGoodsCategory.getParentId()+","); |
| | | } |
| | | mallGoodsCategory.setIsRecommend(0); |
| | | }else{ |
| | | mallGoodsCategory.setParentId(0L); |
| | | mallGoodsCategory.setIsRecommend(mallGoodsCategoryParam.getIsRecommend()); |
| | | } |
| | | mallGoodsCategoryMapper.updateById(mallGoodsCategory); |
| | | |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse delCategary(Long id) { |
| | | MallGoodsCategory mallGoodsCategory = mallGoodsCategoryMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallGoodsCategory)){ |
| | | return new FebsResponse().fail().message("系统繁忙,请刷新页面重试"); |
| | | } |
| | | List<MallGoodsCategory> childCategarys = mallGoodsCategoryMapper.selectChildCategaryById(id); |
| | | if(CollUtil.isNotEmpty(childCategarys)){ |
| | | for(MallGoodsCategory childCategary : childCategarys){ |
| | | Long childCategaryId = childCategary.getId(); |
| | | List<MallGoods> mallChildGoods = mallGoodsMapper.selectMallGoodsByCategaryId(childCategaryId); |
| | | if(CollUtil.isNotEmpty(mallChildGoods)){ |
| | | return new FebsResponse().fail().message("该分类下的子类【"+childCategary.getName()+"】还有商品,请先删除商品或者修改商品分类"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(CollUtil.isNotEmpty(childCategarys)){ |
| | | return new FebsResponse().fail().message("该分类下还有子类,请先删除子类"); |
| | | } |
| | | |
| | | List<MallGoods> mallGoods = mallGoodsMapper.selectMallGoodsByCategaryId(id); |
| | | if(CollUtil.isNotEmpty(mallGoods)){ |
| | | return new FebsResponse().fail().message("该分类下还有商品,请先删除商品或者修改商品分类"); |
| | | } |
| | | mallGoodsCategoryMapper.deleteById(mallGoodsCategory); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public AdminMallGoodsCategoryVo getMallGoodsCategoryInfoById(long id) { |
| | | return mallGoodsCategoryMapper.getMallGoodsCategoryInfoById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<AdminMallGoodsCategoryTreeVo> getParentCategorys() { |
| | | List<AdminMallGoodsCategoryTreeVo> adminMallGoodsCategoryTreeVos = mallGoodsCategoryMapper.getParentCategorys(); |
| | | return adminMallGoodsCategoryTreeVos; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<PlatformBanner> findPlatformBannerInPage(PlatformBanner platformBannerEntity, |
| | | QueryRequest request) { |
| | | Page<PlatformBanner> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<PlatformBanner> platformBannerEntitys = platformBannerMapper.findPlatformBannerInPage(page, platformBannerEntity); |
| | | return platformBannerEntitys; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformBanner selectPlatformBannerById(long id) { |
| | | PlatformBanner platformBannerEntity = platformBannerMapper.selectById(id); |
| | | return platformBannerEntity; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public FebsResponse platformBannerConfirm(@Valid PlatformBanner platformBannerEntity) { |
| | | platformBannerMapper.updateById(platformBannerEntity); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public FebsResponse platformBannerDelete(@NotNull(message = "{required}") Long id) { |
| | | platformBannerMapper.deleteById(id); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void platformBannerAdd(@Valid PlatformBanner platformBannerEntity) { |
| | | PlatformBanner platformBannerEntityAdd = new PlatformBanner(); |
| | | platformBannerEntityAdd.setImageUrl(platformBannerEntity.getImageUrl()); |
| | | platformBannerEntityAdd.setIsInside(platformBannerEntity.getIsInside()); |
| | | platformBannerEntityAdd.setIsJump(platformBannerEntity.getIsJump()); |
| | | platformBannerEntityAdd.setIsTop(platformBannerEntity.getIsTop()); |
| | | platformBannerEntityAdd.setJumpUrl(platformBannerEntity.getJumpUrl()); |
| | | platformBannerEntityAdd.setName(platformBannerEntity.getName()); |
| | | platformBannerEntityAdd.setShowPort(platformBannerEntity.getShowPort()); |
| | | platformBannerEntityAdd.setSort(platformBannerEntity.getSort()); |
| | | platformBannerMapper.insert(platformBannerEntityAdd); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public AdminMallOrderVo getMallOrderInfoById(long id) { |
| | | return this.baseMapper.getMallOrderInfoById(id); |
| | | } |
| | | |
| | | public void updateDataDic(String type, String code, String value) { |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse deliverGoods(DeliverGoodsDto deliverGoodsDto) { |
| | | MallOrderInfo mallOrderInfo = mallOrderInfoMapper.selectById(deliverGoodsDto.getId()); |
| | | if(ObjectUtil.isEmpty(mallOrderInfo)){ |
| | | return new FebsResponse().fail().message("订单不存在,刷新后重试"); |
| | | } |
| | | Integer status = mallOrderInfo.getStatus(); |
| | | if(2 != status){ |
| | | return new FebsResponse().fail().message("订单不是已完成状态"); |
| | | } |
| | | Integer deliverState = mallOrderInfo.getDeliverState(); |
| | | if(1 != deliverState){ |
| | | return new FebsResponse().fail().message("订单不是待发货状态"); |
| | | } |
| | | String expressNo = deliverGoodsDto.getExpressNo(); |
| | | if(StrUtil.isEmpty(expressNo)){ |
| | | return new FebsResponse().fail().message("请输入物流单号"); |
| | | } |
| | | String expressCom = deliverGoodsDto.getExpressCom(); |
| | | if(StrUtil.isEmpty(expressCom)){ |
| | | return new FebsResponse().fail().message("请输入物流公司"); |
| | | } |
| | | mallOrderInfo.setDeliverState(2); |
| | | mallOrderInfo.setDeliverName(expressCom); |
| | | mallOrderInfo.setDeliverCode(expressNo); |
| | | mallOrderInfoMapper.updateById(mallOrderInfo); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse delOrder(Long id) { |
| | | MallOrderInfo mallOrderInfo = mallOrderInfoMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallOrderInfo)){ |
| | | return new FebsResponse().fail().message("订单不存在,请刷新重试"); |
| | | } |
| | | mallOrderInfoMapper.deleteById(id); |
| | | dappMemberDao.deleteByOrderId(id); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public void deliverGoodsByOrderNo(DeliverGoodsDto deliverGoods) { |
| | | |
| | | MallOrderInfo mallOrderInfo = dappMemberDao.selectOrderByOrderNo(deliverGoods.getOrderNo()); |
| | | if(ObjectUtil.isEmpty(mallOrderInfo)){ |
| | | return; |
| | | } |
| | | Integer status = mallOrderInfo.getStatus(); |
| | | if(2 != status){ |
| | | return; |
| | | } |
| | | Integer deliverState = mallOrderInfo.getDeliverState(); |
| | | if(1 != deliverState){ |
| | | return; |
| | | } |
| | | String expressNo = deliverGoods.getExpressNo(); |
| | | if(StrUtil.isEmpty(expressNo)){ |
| | | return; |
| | | } |
| | | String expressCom = deliverGoods.getExpressCom(); |
| | | if(StrUtil.isEmpty(expressCom)){ |
| | | return; |
| | | } |
| | | mallOrderInfo.setDeliverState(2); |
| | | mallOrderInfo.setDeliverName(expressCom); |
| | | mallOrderInfo.setDeliverCode(expressNo); |
| | | mallOrderInfoMapper.updateById(mallOrderInfo); |
| | | } |
| | | |
| | | } |