From 2e64c232ab6b51b2cecf1ee96e1e9b709234f326 Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期六, 21 八月 2021 16:35:14 +0800 Subject: [PATCH] 随手拍改版接口开发 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActUserWalletTradeServiceImpl.java | 82 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 82 insertions(+), 0 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActUserWalletTradeServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActUserWalletTradeServiceImpl.java index 603851a..c167f7c 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActUserWalletTradeServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActUserWalletTradeServiceImpl.java @@ -2,13 +2,19 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.panzhihua.common.model.dtos.community.wallet.PageComActWalletTradeAdminDTO; import com.panzhihua.common.model.dtos.community.wallet.PageComActWalletTradeDTO; import com.panzhihua.common.model.vos.R; +import com.panzhihua.common.model.vos.community.ComActUserWalletTradeRewardExcelVO; import com.panzhihua.service_community.dao.ComActUserWalletTradeMapper; import com.panzhihua.service_community.model.dos.ComActUserWalletTradeDO; import com.panzhihua.service_community.service.ComActUserWalletTradeService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; /** * @auther lyq @@ -29,4 +35,80 @@ return R.ok(this.baseMapper.getUserWalletTradeList(new Page(walletTradeDTO.getPageNum(),walletTradeDTO.getPageSize()),walletTradeDTO)); } + /** + * 新增钱包交易记录 + * @param userId 用户id + * @param communityId 社区id + * @param serviceId 交易业务id + * @param amount 交易金额 + * @param type 交易类型(1.发布随手拍 2.结算) + * @param remark 交易备注 + * @param createBy 操作人id + * @param walletId 钱包id + * @param changeType 变动类型(1.增加 2.减少) + */ + @Override + public Long addWalletTrade(Long userId, Long communityId, Long serviceId + , BigDecimal amount, Integer type, String remark, Long createBy, Long walletId,Integer changeType){ + ComActUserWalletTradeDO walletTradeDO = new ComActUserWalletTradeDO(); + walletTradeDO.setUserId(userId); + walletTradeDO.setCommunityId(communityId); + walletTradeDO.setServiceId(serviceId); + walletTradeDO.setAmount(amount); + walletTradeDO.setType(type); + walletTradeDO.setRemark(remark); + walletTradeDO.setCreateBy(createBy); + walletTradeDO.setWalletId(walletId); + walletTradeDO.setChangeType(changeType); + walletTradeDO.setCreateAt(new Date()); + this.baseMapper.insert(walletTradeDO); + return walletTradeDO.getId(); + } + + /** + * 分页查询交易记录 + * + * @param pageTradeAdminDTO 请求参数 + * @return 交易记录列表 + */ + @Override + public R pageUserWalletTradeAdmin(PageComActWalletTradeAdminDTO pageTradeAdminDTO){ + return R.ok(this.baseMapper.getUserWalletTradeAdmin(new Page(pageTradeAdminDTO.getPageNum(),pageTradeAdminDTO.getPageSize()),pageTradeAdminDTO)); + } + + /** + * 查询用户交易记录总额 + * @param pageTradeAdminDTO 请求参数 + * @return 交易记录总额 + */ + @Override + public R getTradeUserTotalWalletTradeAdmin(PageComActWalletTradeAdminDTO pageTradeAdminDTO){ + BigDecimal total = this.baseMapper.getTradeUserTotalWalletTradeAdmin(pageTradeAdminDTO); + if(total == null){ + total = BigDecimal.ZERO; + } + return R.ok(total); + } + + @Override + public R getTradeUserTotalWalletTradeExportAdmin(PageComActWalletTradeAdminDTO pageTradeAdminDTO){ + return R.ok(this.baseMapper.getTradeUserTotalWalletTradeExportAdmin(pageTradeAdminDTO)); + } + + @Override + public R getTradeUserTotalJLWalletTradeExportAdmin(PageComActWalletTradeAdminDTO pageTradeAdminDTO){ + List<ComActUserWalletTradeRewardExcelVO> tradeList = this.baseMapper.getTradeUserTotalJLWalletTradeExportAdmin(pageTradeAdminDTO); + tradeList.forEach(trade -> { + if(trade.getType().equals("1")){ + trade.setType("发布随手拍"); + } + }); + return R.ok(tradeList); + } + + @Override + public R getTradeUserStatisticsAdmin(PageComActWalletTradeAdminDTO pageTradeAdminDTO){ + return R.ok(this.baseMapper.getTradeUserStatisticsAdmin(pageTradeAdminDTO)); + } + } -- Gitblit v1.7.1