From cacf9bc8c94295ec3296a8cb49bda2b95087afb7 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 16 Aug 2023 17:04:55 +0800
Subject: [PATCH] 后台修改

---
 src/main/java/cc/mrbird/febs/dapp/service/impl/AdminMallGoodsService.java |  129 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 121 insertions(+), 8 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/AdminMallGoodsService.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/AdminMallGoodsService.java
index e391a27..50152aa 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/AdminMallGoodsService.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/AdminMallGoodsService.java
@@ -2,20 +2,15 @@
 
 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.MallGoodsCategory;
-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.*;
 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;
@@ -28,6 +23,8 @@
 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;
@@ -43,6 +40,9 @@
     private final DappFundFlowDao dappFundFlowDao;
     private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
     private final MallGoodsCategoryMapper mallGoodsCategoryMapper;
+
+    private final PlatformBannerMapper platformBannerMapper;
+    private final MallGoodsImagesMapper mallGoodsImagesMapper;
 
     @Override
     public IPage<MallGoods> getCategoryListInPage(MallGoods mallGoods, QueryRequest request) {
@@ -69,6 +69,22 @@
         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("操作成功");
     }
 
@@ -113,6 +129,8 @@
     @Override
     public MallGoods selectGoodsById(long id) {
         MallGoods mallGoods = mallGoodsMapper.selectById(id);
+        List<String> thumbs = mallGoodsImagesMapper.selectByGoodId(mallGoods.getId());
+        mallGoods.setImages(thumbs);
         return mallGoods;
     }
 
@@ -135,6 +153,23 @@
 
         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("操作成功");
     }
@@ -337,6 +372,55 @@
         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) {
         DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(type, code);
         if (dic != null) {
@@ -345,4 +429,33 @@
         }
     }
 
+    @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();
+    }
+
 }

--
Gitblit v1.9.1