cloudroam
2024-10-23 13ee403d72e85bf16bc0d3c38984e5b0272fb963
add:提现记录查询、审批
已修改8个文件
已添加2个文件
226 ■■■■■ 文件已修改
src/main/java/com/mzl/flower/dto/request/wallet/QueryWalletDTO.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/request/wallet/WalletWithdrawRecordDTO.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/response/wallet/WalletWithdrawRecordVO.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/entity/wallet/WalletWithdrawRecordDO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/mapper/wallet/WalletMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/mapper/wallet/WalletWithdrawRecordMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/service/wallet/WalletWithdrawRecordService.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/web/v2/wallet/WalletWithdrawRecordController.java 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/wallet/WalletWithdrawRecordMapper.xml 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/request/wallet/QueryWalletDTO.java
@@ -1,7 +1,11 @@
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 QueryWalletDTO {
@@ -9,7 +13,28 @@
    @ApiModelProperty(value = "供应商Id")
    private String supplierId;
    @ApiModelProperty(value = "用户Id")
    private String userId;
    @ApiModelProperty(value = "供应商名称")
    private String supplierName;
    @ApiModelProperty(value = "提交日期-开始日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate createStartDate;
    @ApiModelProperty(value = "提交日期-结束日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate endEndDate;
    @ApiModelProperty(value = "审核时间-开始日期")
    @JsonFormat(pattern="yyyy-MM-dd" ,timezone="GMT+8")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private LocalDate approveStartDate;
    @ApiModelProperty(value = "审核时间-结束日期")
    @JsonFormat(pattern="yyyy-MM-dd" ,timezone="GMT+8")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private LocalDate approveEndDate;
}
src/main/java/com/mzl/flower/dto/request/wallet/WalletWithdrawRecordDTO.java
对比新文件
@@ -0,0 +1,15 @@
package com.mzl.flower.dto.request.wallet;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class WalletWithdrawRecordDTO {
    private Long id;
    @ApiModelProperty(value = "审核状态(待审核、已通过、已拒绝)")
    private Integer approveState;
    @ApiModelProperty(value = "不通过原因")
    private String rejectReason;
}
src/main/java/com/mzl/flower/dto/response/wallet/WalletWithdrawRecordVO.java
对比新文件
@@ -0,0 +1,55 @@
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;
import java.time.LocalDateTime;
@Data
public class WalletWithdrawRecordVO extends AbstractTransDTO {
    private Long id;
    @ApiModelProperty(value = "供应商Id")
    private Long supplierId;
    @ApiModelProperty(value = "供应商名称")
    private String supplierName;
    @ApiModelProperty(value = "钱包Id")
    private BigDecimal amount;
    @ApiModelProperty(value = "提现金额")
    private BigDecimal onceWithdrawAmount;
    @ApiModelProperty(value = "提现状态(提现中、提现成功、提现失败)")
    private Integer withdrawState;
    @ApiModelProperty(value = "提现方式(微信)")
    private String method;
    @ApiModelProperty(value = "审核人")
    private String approveBy;
    @ApiModelProperty(value = "审核时间")
    private LocalDateTime approveTime;
    @ApiModelProperty(value = "审核状态(待审核、已通过、已拒绝)")
    private Integer approveState;
    @ApiModelProperty(value = "不通过原因")
    private String rejectReason;
    @ApiModelProperty("创建日期")
    private LocalDateTime createTime;
    @ApiModelProperty("修改日期")
    private LocalDateTime updateTime;
    @ApiModelProperty("操作人")
    private String createName;
    @ApiModelProperty("更新人")
    private String updateBy;
}
src/main/java/com/mzl/flower/entity/wallet/WalletWithdrawRecordDO.java
@@ -43,7 +43,7 @@
     * 提现状态
     */
    @ApiModelProperty(value = "提现状态(提现中、提现成功、提现失败)")
    private Integer withdrawState;
    private String withdrawState;
    /**
     * 提现方式
src/main/java/com/mzl/flower/mapper/wallet/WalletMapper.java
@@ -17,6 +17,6 @@
public interface WalletMapper extends BaseMapper<WalletDO> {
    @Select("select total_amount as totalAmount from t_wallet where supplier_id =#{supplierId}")
    public BigDecimal getTotalAmount(String supplierId);
    @Select("select * from t_wallet where supplier_id =#{supplierId}")
    public WalletDO getTotalAmount(String supplierId);
}
src/main/java/com/mzl/flower/mapper/wallet/WalletWithdrawRecordMapper.java
@@ -1,7 +1,13 @@
package com.mzl.flower.mapper.wallet;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mzl.flower.dto.request.wallet.QueryWalletDTO;
import com.mzl.flower.dto.response.member.MemberVO;
import com.mzl.flower.dto.response.wallet.WalletWithdrawRecordVO;
import com.mzl.flower.entity.wallet.WalletWithdrawRecordDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
 * <p>
@@ -13,4 +19,5 @@
 */
public interface WalletWithdrawRecordMapper extends BaseMapper<WalletWithdrawRecordDO> {
    List<WalletWithdrawRecordVO> queryPage(QueryWalletDTO queryWalletDTO, Page page);
}
src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java
@@ -1,10 +1,23 @@
package com.mzl.flower.service.impl.wallet;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mzl.flower.config.exception.ValidationException;
import com.mzl.flower.config.security.SecurityUtils;
import com.mzl.flower.dto.request.wallet.QueryWalletDTO;
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.mapper.wallet.WalletWithdrawRecordMapper;
import com.mzl.flower.service.wallet.WalletWithdrawRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.List;
/**
 * <p>
@@ -15,6 +28,32 @@
 * @since 2024-10-22
 */
@Service
@Transactional
@RequiredArgsConstructor
public class WalletWithdrawRecordServiceImpl extends ServiceImpl<WalletWithdrawRecordMapper, WalletWithdrawRecordDO> implements WalletWithdrawRecordService {
    private final WalletWithdrawRecordMapper walletWithdrawRecordMapper;
    @Override
    public Page<WalletWithdrawRecordVO> queryPage(QueryWalletDTO queryWalletDTO, Page page) {
        List<WalletWithdrawRecordVO> list = walletWithdrawRecordMapper.queryPage(queryWalletDTO, page);
        page.setRecords(list);
        return page;
    }
    @Override
    public void updateWallet(WalletWithdrawRecordDTO walletWithdrawRecordDTO) {
        WalletWithdrawRecordDO withdrawRecordDO = walletWithdrawRecordMapper.selectById(walletWithdrawRecordDTO.getId());
        if (withdrawRecordDO == null) {
            throw new ValidationException("提现记录信息不存在");
        }
        if (StringUtils.isEmpty(walletWithdrawRecordDTO.getApproveState())) {
            throw new ValidationException("审批状态不能为空");
        }
        BeanUtils.copyProperties(walletWithdrawRecordDTO, withdrawRecordDO);
        withdrawRecordDO.update(SecurityUtils.getUserId());
        withdrawRecordDO.setApproveBy(SecurityUtils.getUserId());
        withdrawRecordDO.setApproveTime(LocalDateTime.now());
        walletWithdrawRecordMapper.updateById(withdrawRecordDO);
    }
}
src/main/java/com/mzl/flower/service/wallet/WalletWithdrawRecordService.java
@@ -1,5 +1,9 @@
package com.mzl.flower.service.wallet;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mzl.flower.dto.request.wallet.QueryWalletDTO;
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.baomidou.mybatisplus.extension.service.IService;
@@ -7,10 +11,13 @@
 * <p>
 *  服务类
 * </p>
 *
 *S
 * @author @TaoJie
 * @since 2024-10-22
 */
public interface WalletWithdrawRecordService extends IService<WalletWithdrawRecordDO> {
    Page<WalletWithdrawRecordVO> queryPage(QueryWalletDTO dto, Page page);
    void updateWallet(WalletWithdrawRecordDTO walletWithdrawRecordDTO);
}
src/main/java/com/mzl/flower/web/v2/wallet/WalletWithdrawRecordController.java
@@ -5,29 +5,44 @@
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.QueryWalletDTO;
import com.mzl.flower.dto.request.wallet.WalletWithdrawRecordDTO;
import com.mzl.flower.dto.response.wallet.WalletWithdrawRecordVO;
import com.mzl.flower.service.wallet.WalletWithdrawRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.*;
import com.mzl.flower.entity.wallet.WalletWithdrawRecordDO;
import javax.validation.constraints.Min;
import javax.validation.constraints.Max;
import javax.validation.constraints.Positive;
import org.springframework.web.bind.annotation.RestController;
/**
* @author @TaoJie
* @since 2024-10-22
*/
@Api(value = "提现记录", tags = "提现记录")
@RestController
@RequestMapping("/v2/withdraw-record")
@RequiredArgsConstructor
public class WalletWithdrawRecordController extends BaseController {
    private final WalletWithdrawRecordService walletWithdrawRecordService;
    @GetMapping("/list")
    @ApiOperation(value = "查询提现记录", httpMethod = "GET")
    public ResponseEntity<ReturnDataDTO<Page<WalletWithdrawRecordVO>>> getMemberList(Page page, QueryWalletDTO dto) {
        return returnData(R.SUCCESS.getCode(), walletWithdrawRecordService.queryPage(dto, page));
    }
    @PostMapping(value = "/edit")
    @ApiOperation(value = "修改", httpMethod = "POST")
    public ResponseEntity update(@RequestBody WalletWithdrawRecordDTO walletWithdrawRecordDTO) {
        walletWithdrawRecordService.updateWallet(walletWithdrawRecordDTO);
        return returnData(R.SUCCESS.getCode(), null);
    }
    @PostMapping("")
    public ResponseEntity<ReturnDataDTO> create() {
        return returnData(R.SUCCESS.getCode(), null);
src/main/resources/mapper/wallet/WalletWithdrawRecordMapper.xml
@@ -20,5 +20,38 @@
        <result column="approve_state" property="approveState" />
        <result column="reject_reason" property="rejectReason" />
    </resultMap>
    <select id="queryPage" resultType="com.mzl.flower.dto.response.wallet.WalletWithdrawRecordVO">
        select t.* ,s.name supplierName from t_wallet_withdraw_record t
        left join t_supplier_info s on t.supplier_id = s.id
        where t.deleted= 0
        <if test="dto.supplierName != null and dto.supplierName != ''">
            and s.name like concat('%', #{dto.supplierName}, '%')
        </if>
        <if test="dto.supplierId != null and dto.supplierId != ''">
            and t.supplier_id = #{dto.supplierId}
        </if>
        <if test="dto.createStartDate!=null ">
            <![CDATA[
               AND t.create_time >= #{dto.createStartDate}
            ]]>
        </if>
        <if test="dto.endEndDate!=null ">
            <![CDATA[
               AND t.create_time <= #{dto.endEndDate}
            ]]>
        </if>
        <if test="dto.approveStartDate!=null ">
            <![CDATA[
               AND t.approve_time >= #{dto.approveStartDate}
            ]]>
        </if>
        <if test="dto.approveEndDate!=null ">
            <![CDATA[
               AND t.approve_time <= #{dto.approveStartDate}
            ]]>
        </if>
        order by t.create_time
    </select>
</mapper>