src/main/java/com/mzl/flower/dto/request/wallet/QueryWalletAmountDTO.java
对比新文件 @@ -0,0 +1,13 @@ package com.mzl.flower.dto.request.wallet; import lombok.Data; @Data public class QueryWalletAmountDTO { private String userId; private Long SupplierId; private String startTime; } src/main/java/com/mzl/flower/dto/request/wallet/QueryWalletBillDTO.java
对比新文件 @@ -0,0 +1,30 @@ package com.mzl.flower.dto.request.wallet; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDate; @Data public class QueryWalletBillDTO { @ApiModelProperty(value = "供应商Id") private Long supplierId; // // @ApiModelProperty(value = "供应商名称") // private String supplierName; @ApiModelProperty(value = "开始日期") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate startDate; @ApiModelProperty(value = "结束日期") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate endDate; } src/main/java/com/mzl/flower/dto/request/wallet/QueryWalletReduceDTO.java
对比新文件 @@ -0,0 +1,33 @@ package com.mzl.flower.dto.request.wallet; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDate; @Data public class QueryWalletReduceDTO { @ApiModelProperty(value = "供应商Id") private Long supplierId; // // @ApiModelProperty(value = "供应商名称") // private String supplierName; @ApiModelProperty(value = "审核日期-开始日期") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate startDate; @ApiModelProperty(value = "审核日期-结束日期") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate endDate; @ApiModelProperty(value = "钱包上线时间",hidden = true) private String walletOnlineTime; } src/main/java/com/mzl/flower/dto/response/wallet/WalletBillRecordVO.java
对比新文件 @@ -0,0 +1,60 @@ package com.mzl.flower.dto.response.wallet; import com.mzl.flower.base.AbstractTransDTO; import com.mzl.flower.base.annotation.DictTrans; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; @Data public class WalletBillRecordVO extends AbstractTransDTO { @ApiModelProperty(value = "供应商Id") private Long supplierId; @ApiModelProperty(value = "钱包Id") private Long walletId; @ApiModelProperty(value = "账单变动类型(提现,结算)") @DictTrans(target = "typeName",codeType = "BILL_CHANGE_TYPE") private String type; @ApiModelProperty(value = "类型明细") private String typeDetail; @ApiModelProperty(value = "结算单id") private String settlementId; @ApiModelProperty(value = "转账Id") private String transferId; @ApiModelProperty(value = "变动方式(增加、减少") @DictTrans(target = "methodName",codeType = "BILL_CHANGE_METHOD") private String method; @ApiModelProperty(value = "原金额") private BigDecimal originalAmount; @ApiModelProperty(value = "变动金额") private BigDecimal changeAmount; @ApiModelProperty(value = "余额") private BigDecimal balance; @ApiModelProperty(value = "转账明细id") private String transferDetailId; @ApiModelProperty(value = "转账状态") private String transferState; @ApiModelProperty(value = "openId") private String openId; @ApiModelProperty(value = "账单变动类型(提现,结算)") private String typeName; @ApiModelProperty(value = "变动方式(增加、减少") private String methodName; } src/main/java/com/mzl/flower/dto/response/wallet/WalletReduceVO.java
对比新文件 @@ -0,0 +1,29 @@ package com.mzl.flower.dto.response.wallet; import com.mzl.flower.base.AbstractTransDTO; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; @Data public class WalletReduceVO extends AbstractTransDTO { // 根据上面的列写属性 @ApiModelProperty(value = "原主键") private String id; @ApiModelProperty(value = "费用") private BigDecimal fee; @ApiModelProperty(value = "审核时间") private String auditTime; @ApiModelProperty(value = "扣款类型") private String type; @ApiModelProperty(value = "扣款类型名称") private String typeName; @ApiModelProperty(value = "订单编号") private String orderNo; @ApiModelProperty(value = "供应商ID") private Long supplierId; } src/main/java/com/mzl/flower/mapper/wallet/WalletBillRecordMapper.java
@@ -1,8 +1,15 @@ package com.mzl.flower.mapper.wallet; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.dto.request.wallet.QueryWalletBillDTO; import com.mzl.flower.dto.response.wallet.WalletBillRecordVO; import com.mzl.flower.dto.response.wallet.WalletWithdrawRecordVO; import com.mzl.flower.entity.wallet.WalletBillRecordDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; /** * <p> @@ -15,4 +22,5 @@ @Repository public interface WalletBillRecordMapper extends BaseMapper<WalletBillRecordDO> { List<WalletBillRecordVO> getPage(Page page, @Param("dto") QueryWalletBillDTO dto); } src/main/java/com/mzl/flower/mapper/wallet/WalletMapper.java
@@ -1,9 +1,13 @@ package com.mzl.flower.mapper.wallet; import com.mzl.flower.dto.request.wallet.QueryWalletAmountDTO; import com.mzl.flower.entity.wallet.WalletDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; import java.math.BigDecimal; /** * <p> @@ -19,4 +23,12 @@ @Select("select * from t_wallet where supplier_id =#{supplierId}") public WalletDO getTotalAmount(String supplierId); BigDecimal getWaittingSettlementAmount(@Param("dto") WalletDO walletDO); @Select("select label from t_code_value where type_code='WALLET_ONLINE_TIME' and value='online'") String selectWalletOnlineTime(); BigDecimal getSupplierTotalTransactionAmount(@Param("dto") QueryWalletAmountDTO queryWalletAmountDTO); } src/main/java/com/mzl/flower/mapper/wallet/WalletReduceMapper.java
对比新文件 @@ -0,0 +1,33 @@ package com.mzl.flower.mapper.wallet; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.dto.request.wallet.QueryWalletAmountDTO; import com.mzl.flower.dto.request.wallet.QueryWalletReduceDTO; import com.mzl.flower.dto.response.wallet.WalletReduceVO; import com.mzl.flower.entity.wallet.WalletDO; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; import java.math.BigDecimal; import java.util.List; /** * <p> * Mapper 接口 * </p> * * @author @TaoJie * @since 2024-10-22 */ @Repository public interface WalletReduceMapper extends BaseMapper<WalletDO> { List<WalletReduceVO> getPage(Page page,@Param("dto") QueryWalletReduceDTO dto); BigDecimal getCheckReduceAmount(@Param("dto") QueryWalletAmountDTO queryWalletAmountDTO); BigDecimal getSaleReduceAmount(@Param("dto")QueryWalletAmountDTO queryWalletAmountDTO); } src/main/java/com/mzl/flower/service/impl/report/OrderReportServiceImpl.java
@@ -347,7 +347,7 @@ @Override public AppSupplierStatisticsVO getAppSupplierStatistics(QueryAppSupplierDTO dto) { // TODO // 总成交:花农售卖全部的底价合计, // 本月成交:本月售卖的底价合计, src/main/java/com/mzl/flower/service/impl/wallet/WalletBillRecordServiceImpl.java
@@ -1,8 +1,12 @@ package com.mzl.flower.service.impl.wallet; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.constant.Constants; import com.mzl.flower.dto.request.wallet.CreateWalletBillRecordDTO; import com.mzl.flower.dto.request.wallet.QueryWalletBillDTO; import com.mzl.flower.dto.response.wallet.WalletBillRecordVO; import com.mzl.flower.dto.response.wallet.WalletWithdrawRecordVO; import com.mzl.flower.entity.payment.Transfer; import com.mzl.flower.entity.payment.TransferDetail; import com.mzl.flower.entity.wallet.WalletBillRecordDO; @@ -21,6 +25,7 @@ import org.springframework.util.StringUtils; import javax.annotation.Resource; import java.util.List; /** * <p> @@ -111,4 +116,11 @@ } } } @Override public Page<WalletBillRecordVO> getPage(Page page, QueryWalletBillDTO dto) { List<WalletBillRecordVO> list = walletBillRecordMapper.getPage(page,dto); page.setRecords(list); return page; } } src/main/java/com/mzl/flower/service/impl/wallet/WalletReduceServiceImpl.java
对比新文件 @@ -0,0 +1,45 @@ package com.mzl.flower.service.impl.wallet; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.dto.request.wallet.QueryWalletAmountDTO; import com.mzl.flower.dto.request.wallet.QueryWalletReduceDTO; import com.mzl.flower.dto.response.wallet.WalletReduceVO; import com.mzl.flower.dto.response.wallet.WalletWithdrawRecordVO; import com.mzl.flower.mapper.wallet.WalletReduceMapper; import com.mzl.flower.service.wallet.WalletReduceService; import com.mzl.flower.service.wallet.WalletService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.List; @Service public class WalletReduceServiceImpl implements WalletReduceService { @Autowired private WalletReduceMapper walletReduceMapper; @Autowired private WalletService walletService; @Override public Page<WalletReduceVO> getPage(Page page, QueryWalletReduceDTO dto) { // 设置查询的时间为钱包的上线时间 dto.setWalletOnlineTime(walletService.getWalletOnLineTime()); List<WalletReduceVO> list = walletReduceMapper.getPage(page,dto); page.setRecords(list); return page; } @Override public BigDecimal getCheckReduceAmount(QueryWalletAmountDTO queryWalletAmountDTO) { return walletReduceMapper.getCheckReduceAmount(queryWalletAmountDTO); } @Override public BigDecimal getSaleReduceAmount(QueryWalletAmountDTO queryWalletAmountDTO) { return walletReduceMapper.getSaleReduceAmount(queryWalletAmountDTO); } } src/main/java/com/mzl/flower/service/impl/wallet/WalletServiceImpl.java
@@ -2,12 +2,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.mzl.flower.config.security.SecurityUtils; import com.mzl.flower.dto.request.wallet.QueryWalletAmountDTO; import com.mzl.flower.dto.response.supplier.SupplierDTO; import com.mzl.flower.entity.coupon.CouponTemplateDO; import com.mzl.flower.entity.wallet.WalletDO; import com.mzl.flower.enums.TrueOrFalseEnum; import com.mzl.flower.mapper.wallet.WalletMapper; import com.mzl.flower.service.supplier.SupplierService; import com.mzl.flower.service.wallet.WalletReduceService; import com.mzl.flower.service.wallet.WalletService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.collections4.CollectionUtils; @@ -15,7 +17,10 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.regex.Pattern; /** * <p> @@ -30,6 +35,27 @@ @Autowired private SupplierService supplierService; @Autowired private WalletReduceService walletReduceService; private static final String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; private static final Pattern dateTimeRegex = Pattern.compile("^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$"); @Override public String getWalletOnLineTime() { String walletOnlineTime =baseMapper.selectWalletOnlineTime(); // 这里需要判断walletOnlineTime是不是一个正确的yyyy-mm-dd hh24:mi:ss的时间 String startTime; if (isValidDateTime(walletOnlineTime)) { startTime = walletOnlineTime; } else { // 如果 walletOnlineTime 无效,则使用当前时间的字符串 startTime = getCurrentDateTime(); } return startTime; } @Override public WalletDO getCurrentSupplier() { @@ -76,4 +102,62 @@ }else return null; } @Override public BigDecimal getWaittingSettlementAmount(WalletDO walletDO) { return baseMapper.getWaittingSettlementAmount(walletDO); } @Override public BigDecimal getSupplierTotalTransactionAmount(WalletDO walletDO) { QueryWalletAmountDTO queryWalletAmountDTO=new QueryWalletAmountDTO(); queryWalletAmountDTO.setSupplierId(walletDO.getSupplierId()); queryWalletAmountDTO.setStartTime(getWalletOnLineTime()); queryWalletAmountDTO.setUserId(walletDO.getUserId()); BigDecimal totalTransactionAmount=baseMapper.getSupplierTotalTransactionAmount(queryWalletAmountDTO); return totalTransactionAmount; } @Override public BigDecimal getSupplierDeductAmount(WalletDO walletDO) { QueryWalletAmountDTO queryWalletAmountDTO=new QueryWalletAmountDTO(); queryWalletAmountDTO.setSupplierId(walletDO.getSupplierId()); queryWalletAmountDTO.setStartTime(getWalletOnLineTime()); queryWalletAmountDTO.setUserId(walletDO.getUserId()); // 质检扣款 BigDecimal checkDeduceAmount = walletReduceService.getCheckReduceAmount(queryWalletAmountDTO); checkDeduceAmount = checkDeduceAmount != null ? checkDeduceAmount : BigDecimal.ZERO; // 售后扣款 BigDecimal saleDeduceAmount = walletReduceService.getSaleReduceAmount(queryWalletAmountDTO); saleDeduceAmount = saleDeduceAmount != null ? saleDeduceAmount : BigDecimal.ZERO; // 总扣款 BigDecimal deduceAmount = checkDeduceAmount.add(saleDeduceAmount); return deduceAmount; } public static boolean isValidDateTime(String dateTime) { if (dateTime == null || !dateTimeRegex.matcher(dateTime).matches()) { return false; } SimpleDateFormat sdf = new SimpleDateFormat(DATE_TIME_PATTERN); sdf.setLenient(false); try { sdf.parse(dateTime); return true; } catch (Exception e) { return false; } } public static String getCurrentDateTime() { SimpleDateFormat sdf = new SimpleDateFormat(DATE_TIME_PATTERN); return sdf.format(new Date()); } } src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java
@@ -117,6 +117,12 @@ // 1.新增一条余额提现记录 WalletWithdrawRecordDO withdrawRecordDO = new WalletWithdrawRecordDO(); //原金额 withdrawRecordDO.setOriginalAmount(walletDO.getWithdrawableAmount()); // 变动金额 withdrawRecordDO.setChangeAmount(dto.getAmount()); // 余额 withdrawRecordDO.setBalance(walletDO.getWithdrawableAmount().subtract(dto.getAmount())); withdrawRecordDO.setAmount(dto.getAmount()); withdrawRecordDO.setSupplierId(supplierDTO.getId()); withdrawRecordDO.setWithdrawState(Constants.WALLET_WITHDRAW_STATE.WAITING.name()); src/main/java/com/mzl/flower/service/wallet/WalletBillRecordService.java
@@ -1,6 +1,10 @@ package com.mzl.flower.service.wallet; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.dto.request.wallet.CreateWalletBillRecordDTO; import com.mzl.flower.dto.request.wallet.QueryWalletBillDTO; import com.mzl.flower.dto.response.wallet.WalletBillRecordVO; import com.mzl.flower.dto.response.wallet.WalletReduceVO; import com.mzl.flower.entity.wallet.WalletBillRecordDO; import com.baomidou.mybatisplus.extension.service.IService; @@ -17,4 +21,6 @@ void create(CreateWalletBillRecordDTO dto); void updateTransferStatus(String transferId); Page<WalletBillRecordVO> getPage(Page page, QueryWalletBillDTO dto); } src/main/java/com/mzl/flower/service/wallet/WalletReduceService.java
对比新文件 @@ -0,0 +1,38 @@ package com.mzl.flower.service.wallet; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.mzl.flower.dto.request.wallet.QueryWalletAmountDTO; import com.mzl.flower.dto.request.wallet.QueryWalletReduceDTO; import com.mzl.flower.dto.response.wallet.WalletReduceVO; import com.mzl.flower.entity.wallet.WalletDO; import java.math.BigDecimal; /** * <p> * 服务类 * </p> * * @author @TaoJie * @since 2024-10-22 */ public interface WalletReduceService { Page<WalletReduceVO> getPage(Page page, QueryWalletReduceDTO dto); /** * 获取质检扣款钱 * @param queryWalletAmountDTO * @return */ BigDecimal getCheckReduceAmount(QueryWalletAmountDTO queryWalletAmountDTO); /** * 获取售后质检扣款钱 * @param queryWalletAmountDTO * @return */ BigDecimal getSaleReduceAmount(QueryWalletAmountDTO queryWalletAmountDTO); } src/main/java/com/mzl/flower/service/wallet/WalletService.java
@@ -3,6 +3,8 @@ import com.mzl.flower.entity.wallet.WalletDO; import com.baomidou.mybatisplus.extension.service.IService; import java.math.BigDecimal; /** * <p> * 服务类 @@ -13,8 +15,27 @@ */ public interface WalletService extends IService<WalletDO> { String getWalletOnLineTime(); WalletDO getCurrentSupplier(); WalletDO getBySupplierId(Long supplierId); BigDecimal getWaittingSettlementAmount(WalletDO walletDO); /** * 获取供应商总交易额 * @param walletDO * @return */ BigDecimal getSupplierTotalTransactionAmount(WalletDO walletDO); /** * 获取供应商总扣款额度 * @param walletDO * @return */ BigDecimal getSupplierDeductAmount(WalletDO walletDO); } src/main/java/com/mzl/flower/web/v2/wallet/WalletBillRecordController.java
@@ -8,11 +8,14 @@ import com.mzl.flower.config.exception.ValidationException; import com.mzl.flower.dto.request.wallet.CreateWalletBillRecordDTO; import com.mzl.flower.dto.request.wallet.QueryWalletBillDTO; import com.mzl.flower.dto.response.wallet.WalletBillRecordVO; import com.mzl.flower.entity.supplier.Supplier; import com.mzl.flower.entity.wallet.WalletDO; import com.mzl.flower.mapper.supplier.SupplierMapper; import com.mzl.flower.service.supplier.SupplierService; import com.mzl.flower.service.wallet.WalletBillRecordService; import com.mzl.flower.service.wallet.WalletReduceService; import com.mzl.flower.service.wallet.WalletService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; @@ -35,7 +38,8 @@ @Autowired private WalletBillRecordService walletBillRecordService; @Autowired private SupplierService supplierService; @PostMapping("") public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateWalletBillRecordDTO dto) { @@ -60,14 +64,11 @@ } @GetMapping("/page") public ResponseEntity<ReturnDataDTO<Page<WalletBillRecordDO>>> page( @RequestParam(name = "page", required = false, defaultValue = "0") @Min(value = 0, message = "{page.number.min}") Integer page, @RequestParam(name = "count", required = false, defaultValue = "10") @Min(value = 1, message = "{page.count.min}") @Max(value = 30, message = "{page.count.max}") Integer count public ResponseEntity<ReturnDataDTO<Page<WalletBillRecordVO>>> page(Page page, QueryWalletBillDTO dto ) { return returnData(R.SUCCESS.getCode(), null); // 根据当前用户获取供应商 dto.setSupplierId(supplierService.getCurrentSupplier().getId()); return returnData(R.SUCCESS.getCode(), walletBillRecordService.getPage(page,dto)); } src/main/java/com/mzl/flower/web/v2/wallet/WalletController.java
@@ -19,6 +19,7 @@ import com.mzl.flower.entity.wallet.WalletDO; import javax.validation.constraints.Positive; import java.math.BigDecimal; /** * @author @TaoJie @@ -66,9 +67,19 @@ if(null==currentSupplier){ throw new ValidationException("供应商不能为空"); } final WalletDO walletDO = walletService.getCurrentSupplier(); if(null!=walletDO){ // 根据当前供应商获取待结算的钱 BigDecimal waittingSettlementAmount = walletService.getWaittingSettlementAmount(walletDO); walletDO.setSettlingAmount(waittingSettlementAmount); // 总交易额度 walletDO.setTotalTransactionAmount(walletService.getSupplierTotalTransactionAmount(walletDO)); // 总扣款数量 walletDO.setTotalDeduction(walletService.getSupplierDeductAmount(walletDO)); } return returnData(R.SUCCESS.getCode(), walletService.getCurrentSupplier()); return returnData(R.SUCCESS.getCode(), walletDO); } @GetMapping("/page") src/main/java/com/mzl/flower/web/v2/wallet/WalletDeductController.java
对比新文件 @@ -0,0 +1,53 @@ package com.mzl.flower.web.v2.wallet; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzl.flower.base.BaseController; import com.mzl.flower.base.R; import com.mzl.flower.base.ReturnDataDTO; import com.mzl.flower.dto.request.wallet.CreateWalletWithdrawRecordDTO; import com.mzl.flower.dto.request.wallet.QueryWalletReduceDTO; import com.mzl.flower.dto.request.wallet.QueryWalletWithdrawDTO; import com.mzl.flower.dto.request.wallet.WalletWithdrawRecordDTO; import com.mzl.flower.dto.response.wallet.WalletWithdrawRecordVO; import com.mzl.flower.entity.wallet.WalletWithdrawRecordDO; import com.mzl.flower.service.supplier.SupplierService; import com.mzl.flower.service.wallet.WalletBillRecordService; import com.mzl.flower.service.wallet.WalletReduceService; import com.mzl.flower.service.wallet.WalletService; import com.mzl.flower.service.wallet.WalletWithdrawRecordService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.constraints.Positive; /** * @author @TaoJie * @since 2024-10-22 */ @Api(value = "扣款记录", tags = "扣款记录") @RestController @RequestMapping("/v2/wallet/reduce-record") @RequiredArgsConstructor public class WalletDeductController extends BaseController { @Autowired private WalletReduceService walletReduceService; @Autowired private SupplierService supplierService; @GetMapping("/supplier/page") public ResponseEntity<ReturnDataDTO<Page<WalletWithdrawRecordDO>>> page(Page page, QueryWalletReduceDTO dto ) { // 根据当前用户获取供应商 dto.setSupplierId(supplierService.getCurrentSupplier().getId()); return returnData(R.SUCCESS.getCode(), walletReduceService.getPage(page,dto)); } } src/main/resources/mapper/report/OrderReportMapper.xml
@@ -611,7 +611,7 @@ <!--供应商总价款--> <sql id="all_supplier_amount"> select IFNULL(sum(oi.supplier_price*oi.num),0) as supplier_amount from t_order_item oi where oi.supplier_id=287 select IFNULL(sum(oi.supplier_price*oi.num),0) as supplier_amount from t_order_item oi where oi.supplier_id=#{dto.supplierId} </sql> <!--本月成交:本月售卖的底价合计--> <sql id="cur_mon_supplier_amount"> src/main/resources/mapper/wallet/WalletBillRecordMapper.xml
@@ -22,5 +22,20 @@ <result column="transfer_detail_id" property="transferDetailId" /> <result column="open_id" property="openId" /> </resultMap> <select id="getPage" resultType="com.mzl.flower.dto.response.wallet.WalletBillRecordVO"> select * from t_wallet_bill_record wbr where wbr.DELETED=0 <if test="dto.supplierId != null and dto.supplierId != ''"> and wbr.supplier_id= #{dto.supplierId} </if> <if test="dto.startDate != null"> and DATE_FORMAT(wbr.create_time, '%Y-%m-%d') >= #{dto.startDate} </if> <if test="dto.endDate != null"> and DATE_FORMAT(wbr.create_time, '%Y-%m-%d') <= #{dto.endDate} </if> </select> </mapper> src/main/resources/mapper/wallet/WalletMapper.xml
@@ -22,5 +22,29 @@ <result column="settled_amount" property="settledAmount" /> </resultMap> <select id="getWaittingSettlementAmount" resultType="java.math.BigDecimal"> <include refid="supplier_settlement_amount"></include> </select> <!-- 总交易额--> <select id="getSupplierTotalTransactionAmount" resultType="java.math.BigDecimal"> select IFNULL(sum(oi.supplier_price*oi.num),0) as cur_mon_supplier_amount from t_order_item oi left join t_order o on oi.order_id = o.id where oi.supplier_id = #{dto.supplierId} and o.payment_time > #{dto.startTime} </select> <!-- 待结算--> <sql id="supplier_settlement_amount"> SELECT IFNULL(sum(settlement_amount),0) AS settlement_amount FROM t_order_settlement OS WHERE OS.DELETED=0 AND OS.TYPE='supplier' AND OS.status='PENDING' AND USER_ID=#{dto.userId} </sql> </mapper> src/main/resources/mapper/wallet/WalletReduceMapper.xml
对比新文件 @@ -0,0 +1,71 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.mzl.flower.mapper.wallet.WalletReduceMapper"> <select id="getPage" resultType="com.mzl.flower.dto.response.wallet.WalletReduceVO"> select * from ( SELECT si.id as id,si.fee_supplier as fee ,si.audit_time as audit_time,'sale' as type,'售后扣款' as type_name,o.order_no as order_no,oi.supplier_id as supplier_id FROM t_order_item_sales si join t_order_item oi on oi.id = si.order_item_id left join t_order o on oi.order_id=o.id where si.deleted=0 and si.status='AGREED' and oi.deleted=0 and o.deleted=0 and o.payment_time >= #{dto.walletOnlineTime} <if test="dto.supplierId != null"> and oi.supplier_id = #{dto.supplierId} </if> <if test="dto.startDate != null"> and DATE_FORMAT(si.audit_time, '%Y-%m-%d') >= #{dto.startDate} </if> <if test="dto.endDate != null"> and DATE_FORMAT(si.audit_time, '%Y-%m-%d') <= #{dto.endDate} </if> union select oic.id as id ,oic.deduct_amount as fee,oic.audit_time as audit_time,oic.type as type,check_type.label as type_name,o.order_no as order_no,oi.supplier_id as supplier_id from t_order_item_check oic left join t_order_item oi on oic.order_item_id=oi.id left join t_order o on oi.order_id=o.id left join t_code_value check_type on check_type.value=oic.type and check_type.type_code='CHECK_TYPE' where oic.deleted=0 and oic.audit_status='AGREED' and oi.deleted=0 and o.deleted=0 and o.payment_time >= #{dto.walletOnlineTime} <if test="dto.supplierId != null"> and oi.supplier_id = #{dto.supplierId} </if> <if test="dto.startDate != null"> and DATE_FORMAT(oic.audit_time, '%Y-%m-%d') >= #{dto.startDate} </if> <if test="dto.endDate != null"> and DATE_FORMAT(oic.audit_time, '%Y-%m-%d') <= #{dto.endDate} </if> ) t order by audit_time desc </select> <select id="getCheckReduceAmount" resultType="java.math.BigDecimal"> SELECT sum(si.fee_supplier) FROM t_order_item_sales si join t_order_item oi on oi.id = si.order_item_id left join t_order o on oi.order_id=o.id where si.deleted=0 and si.status='AGREED' and oi.deleted=0 and o.deleted=0 and oi.supplier_id = #{dto.supplierId} and o.payment_time >= #{dto.startTime} </select> <select id="getSaleReduceAmount" resultType="java.math.BigDecimal"> select sum(oic.deduct_amount) from t_order_item_check oic left join t_order_item oi on oic.order_item_id=oi.id left join t_order o on oi.order_id=o.id left join t_code_value check_type on check_type.value=oic.type and check_type.type_code='CHECK_TYPE' where oic.deleted=0 and oic.audit_status='AGREED' and oi.deleted=0 and o.deleted=0 and oi.supplier_id = #{dto.supplierId} and o.payment_time >= #{dto.startTime} </select> </mapper> src/main/resources/mapper/wallet/WalletWithdrawRecordMapper.xml
@@ -35,12 +35,12 @@ </if> <if test="dto.createStartDate!=null "> <![CDATA[ AND t.create_time >= #{dto.createStartDate} AND DATE_FORMAT(t.create_time, '%Y-%m-%d') >= #{dto.createStartDate} ]]> </if> <if test="dto.endEndDate!=null "> <![CDATA[ AND t.create_time <= #{dto.endEndDate} AND DATE_FORMAT(t.create_time, '%Y-%m-%d') <= #{dto.endEndDate} ]]> </if> <if test="dto.approveStartDate!=null ">