From 9671a5baaebe1b3bce04dba485d4e7435e1aed03 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Wed, 13 Dec 2023 14:46:28 +0800
Subject: [PATCH] 微信小程序配置

---
 src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java |  136 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 107 insertions(+), 29 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java
index 96a505e..e2adb67 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java
@@ -363,24 +363,41 @@
         );
         DateTime endTime = DateUtil.parseTime(endTimeDic.getValue());
         if(nowTime.compareTo(startTime) >= 0 && nowTime.compareTo(endTime) <= 0){
-            //买单
-            if(2 == orderType){
-                IPage<ApiOrderListVo> page = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize());
-                IPage<ApiOrderListVo> apiOrderListVoIPageBuy = mallProductBuyMapper.selectListInPage(page, apiOrderListDto);
-                if(CollUtil.isNotEmpty(apiOrderListVoIPageBuy.getRecords())){
-                    for(ApiOrderListVo apiOrderListVo : apiOrderListVoIPageBuy.getRecords()){
-                        objects.add(apiOrderListVo);
-                    }
+//            //买单
+//            if(2 == orderType){
+//                IPage<ApiOrderListVo> page = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize());
+//                IPage<ApiOrderListVo> apiOrderListVoIPageBuy = mallProductBuyMapper.selectListInPage(page, apiOrderListDto);
+//                if(CollUtil.isNotEmpty(apiOrderListVoIPageBuy.getRecords())){
+//                    for(ApiOrderListVo apiOrderListVo : apiOrderListVoIPageBuy.getRecords()){
+//                        objects.add(apiOrderListVo);
+//                    }
+//                }
+//            }
+//            //卖单
+//            if(1 == orderType){
+//                IPage<ApiOrderListVo> page = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize());
+//                IPage<ApiOrderListVo> apiOrderListVoIPageSell = mallProductSellMapper.selectListInPage(page, apiOrderListDto);
+//                if(CollUtil.isNotEmpty(apiOrderListVoIPageSell.getRecords())){
+//                    for(ApiOrderListVo apiOrderListVo : apiOrderListVoIPageSell.getRecords()){
+//                        objects.add(apiOrderListVo);
+//                    }
+//                }
+//            }
+
+            IPage<ApiOrderListVo> pageBuy = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize());
+            IPage<ApiOrderListVo> apiOrderListVoIPageBuy = mallProductBuyMapper.selectListInPage(pageBuy, apiOrderListDto);
+            if(CollUtil.isNotEmpty(apiOrderListVoIPageBuy.getRecords())){
+                for(ApiOrderListVo apiOrderListVo : apiOrderListVoIPageBuy.getRecords()){
+                    objects.add(apiOrderListVo);
                 }
             }
-            //卖单
-            if(1 == orderType){
-                IPage<ApiOrderListVo> page = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize());
-                IPage<ApiOrderListVo> apiOrderListVoIPageSell = mallProductSellMapper.selectListInPage(page, apiOrderListDto);
-                if(CollUtil.isNotEmpty(apiOrderListVoIPageSell.getRecords())){
-                    for(ApiOrderListVo apiOrderListVo : apiOrderListVoIPageSell.getRecords()){
-                        objects.add(apiOrderListVo);
-                    }
+
+
+            IPage<ApiOrderListVo> pageSell = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize());
+            IPage<ApiOrderListVo> apiOrderListVoIPageSell = mallProductSellMapper.selectListInPage(pageSell, apiOrderListDto);
+            if(CollUtil.isNotEmpty(apiOrderListVoIPageSell.getRecords())){
+                for(ApiOrderListVo apiOrderListVo : apiOrderListVoIPageSell.getRecords()){
+                    objects.add(apiOrderListVo);
                 }
             }
         }
@@ -553,29 +570,90 @@
     public FebsResponse orderSellComplain(ApiOrderSellComplainDto apiOrderSellComplainDto) {
         Long memberId = LoginUserUtil.getLoginUser().getId();
         Long sellRecordId = apiOrderSellComplainDto.getSellRecordId();
-        MallProductSellRecord mallProductSellRecord = mallProductSellRecordMapper.selectById(sellRecordId);
-        if(ObjectUtil.isEmpty(mallProductSellRecord)){
-            throw new FebsException("记录不存在");
+        Integer orderType = apiOrderSellComplainDto.getOrderType();
+        String buyOrderNo = null;
+        if(orderType == 1){
+
+            MallProductSellRecord mallProductSellRecord = mallProductSellRecordMapper.selectById(sellRecordId);
+            if(ObjectUtil.isEmpty(mallProductSellRecord)){
+                throw new FebsException("记录不存在");
+            }
+            MallProductBuyRecord mallProductBuyRecord = mallProductBuyRecordMapper.selectById(mallProductSellRecord.getBuyRecordId());
+            if(ObjectUtil.isEmpty(mallProductBuyRecord)){
+                throw new FebsException("记录不存在");
+            }
+
+            mallProductBuyRecord.setState(ProductEnum.PRODUCT_MATE_STATE_COMPLAIN.getValue());
+            mallProductBuyRecordMapper.updateById(mallProductBuyRecord);
+
+            mallProductSellRecord.setState(ProductEnum.PRODUCT_MATE_STATE_COMPLAIN.getValue());
+            mallProductSellRecordMapper.updateById(mallProductSellRecord);
+            buyOrderNo = mallProductBuyRecord.getBuyOrderNo();
         }
+        if(orderType == 2){
+            MallProductBuyRecord mallProductBuyRecord = mallProductBuyRecordMapper.selectById(sellRecordId);
+            if(ObjectUtil.isEmpty(mallProductBuyRecord)){
+                throw new FebsException("记录不存在");
+            }
 
-        MallProductBuyRecord mallProductBuyRecord = mallProductBuyRecordMapper.selectById(mallProductSellRecord.getBuyRecordId());
-        if(ObjectUtil.isEmpty(mallProductBuyRecord)){
-            throw new FebsException("记录不存在");
+            MallProductSellRecord mallProductSellRecord = mallProductSellRecordMapper.selectById(mallProductBuyRecord.getSellRecordId());
+            if(ObjectUtil.isEmpty(mallProductSellRecord)){
+                throw new FebsException("记录不存在");
+            }
+
+
+            mallProductBuyRecord.setState(ProductEnum.PRODUCT_MATE_STATE_COMPLAIN.getValue());
+            mallProductBuyRecordMapper.updateById(mallProductBuyRecord);
+
+            mallProductSellRecord.setState(ProductEnum.PRODUCT_MATE_STATE_COMPLAIN.getValue());
+            mallProductSellRecordMapper.updateById(mallProductSellRecord);
+            buyOrderNo = mallProductBuyRecord.getBuyOrderNo();
+
         }
-
-        mallProductBuyRecord.setState(ProductEnum.PRODUCT_MATE_STATE_COMPLAIN.getValue());
-        mallProductBuyRecordMapper.updateById(mallProductBuyRecord);
-
-        mallProductSellRecord.setState(ProductEnum.PRODUCT_MATE_STATE_COMPLAIN.getValue());
-        mallProductSellRecordMapper.updateById(mallProductSellRecord);
 
         MallMemberSpeak mallMemberSpeak = new MallMemberSpeak();
         mallMemberSpeak.setMemberId(memberId);
         mallMemberSpeak.setState(ProductEnum.SPEAK_NO_DEAL.getValue());
         String description = apiOrderSellComplainDto.getDescription();
-        String buyOrderNo = mallProductBuyRecord.getBuyOrderNo();
         mallMemberSpeak.setDescription("编号:"+buyOrderNo+","+description);
         mallMemberSpeakMapper.insert(mallMemberSpeak);
         return new FebsResponse().success();
     }
+
+    @Override
+    public FebsResponse orderRecordList(ApiOrderRecordListDto apiOrderListDto) {
+        Long memberId = LoginUserUtil.getLoginUser().getId();
+        List<ApiOrderRecordListVo> objects = new ArrayList<>();
+        apiOrderListDto.setMemberId(memberId);
+        DateTime nowTime = DateUtil.parseTime(DateUtil.formatTime(DateUtil.date()));
+        DataDictionaryCustom startTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+                DataDictionaryEnum.YU_YUE_START_TIME.getType(),
+                DataDictionaryEnum.YU_YUE_START_TIME.getCode()
+        );
+        DateTime startTime = DateUtil.parseTime(startTimeDic.getValue());
+        DataDictionaryCustom endTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+                DataDictionaryEnum.YU_YUE_END_TIME.getType(),
+                DataDictionaryEnum.YU_YUE_END_TIME.getCode()
+        );
+        DateTime endTime = DateUtil.parseTime(endTimeDic.getValue());
+        if(nowTime.compareTo(startTime) >= 0 && nowTime.compareTo(endTime) <= 0){
+            IPage<ApiOrderRecordListVo> pageBuy = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize());
+            IPage<ApiOrderRecordListVo> apiOrderListVoIPageBuy = mallProductBuyRecordMapper.selectListInPage(pageBuy, apiOrderListDto);
+            if(CollUtil.isNotEmpty(apiOrderListVoIPageBuy.getRecords())){
+                for(ApiOrderRecordListVo apiOrderListVo : apiOrderListVoIPageBuy.getRecords()){
+                    objects.add(apiOrderListVo);
+                }
+            }
+
+            IPage<ApiOrderRecordListVo> pageSell = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize());
+            IPage<ApiOrderRecordListVo> apiOrderListVoIPageSell = mallProductSellRecordMapper.selectListInPage(pageSell, apiOrderListDto);
+            if(CollUtil.isNotEmpty(apiOrderListVoIPageSell.getRecords())){
+                for(ApiOrderRecordListVo apiOrderListVo : apiOrderListVoIPageSell.getRecords()){
+                    objects.add(apiOrderListVo);
+                }
+            }
+        }
+
+        return new FebsResponse().success().data(objects);
+    }
 }

--
Gitblit v1.9.1