KKSU
2023-12-14 2ea179b58ce7b3b624f4dad02cd0f4375ce3c939
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java
@@ -17,6 +17,7 @@
import cc.mrbird.febs.rabbit.producter.AgentProducer;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.crypto.SecureUtil;
@@ -30,6 +31,7 @@
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Slf4j
@@ -497,6 +499,15 @@
                mallMember.getId(),
                FlowTypeNewEnum.NFT.getValue(),
                MoneyFlowTypeNewEnum.PAY.getDescrition());
        DataDictionaryCustom insureMinuteDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.INSURE_END_MINUTE.getType(),
                DataDictionaryEnum.INSURE_END_MINUTE.getCode()
        );
        Integer insureMinute = Integer.parseInt(ObjectUtil.isEmpty(insureMinuteDic) ? "60" : insureMinuteDic.getValue());
        Date endTime = DateUtil.offsetMinute(payTime, insureMinute);
        long remainTime = DateUtil.between(payTime, endTime, DateUnit.SECOND, false);
        agentProducer.sendFcmPayBuyTimeTTLMsg(mallProductSellRecord.getId(), remainTime * 1000L);
        return new FebsResponse().success();
    }
@@ -644,16 +655,39 @@
                    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);
                }
        }
        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);
    }
}