KKSU
2023-12-13 e89fa51bb8592aae31ed345400c5a632e394739d
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);
                }
            }
        }
@@ -602,4 +619,65 @@
        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);
    }
    @Override
    public FebsResponse orderSellRecord(ApiOrderSellInfoDto apiOrderSellInfoDto) {
        Long productSellRecordId = apiOrderSellInfoDto.getId();
        Long memberId = LoginUserUtil.getLoginUser().getId();
        MallProductSellRecord mallProductSellRecord = mallProductSellRecordMapper.selectById(productSellRecordId);
        if(ObjectUtil.isEmpty(mallProductSellRecord)){
            throw new FebsException("记录不存在");
        }
        ApiOrderSellRecordInfoVo apiOrderSellRecordInfoVo = mallProductSellRecordMapper.selectBySellRecordId(productSellRecordId);
        return new FebsResponse().success().data(apiOrderSellRecordInfoVo);
    }
    @Override
    public FebsResponse orderBuyRecord(ApiOrderBuyInfoDto apiOrderBuyInfoDto) {
        Long productBuyRecordId = apiOrderBuyInfoDto.getId();
        Long memberId = LoginUserUtil.getLoginUser().getId();
        MallProductBuyRecord mallProductBuyRecord = mallProductBuyRecordMapper.selectById(productBuyRecordId);
        if(ObjectUtil.isEmpty(mallProductBuyRecord)){
            throw new FebsException("记录不存在");
        }
        ApiOrderBuyRecordInfoVo apiOrderBuyRecordInfoVo = mallProductBuyRecordMapper.selectByBuyRecordId(productBuyRecordId);
        return new FebsResponse().success().data(apiOrderBuyRecordInfoVo);
    }
}