zhibing.pu
2024-04-29 a3eb11bc975770c6d97406dec3f03250869230d6
修改返回数据结构
2个文件已修改
47 ■■■■ 已修改文件
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/WithdrawalController.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/WithdrawalWarpper.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/WithdrawalController.java
@@ -83,23 +83,23 @@
            @ApiImplicitParam(value = "提现状态(1=待处理,2=已提现,3=提现失败)", name = "state", required = true, dataType = "int"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<WithdrawalVo> queryWithdrawal(Integer pageNum, Integer size, Integer state, Integer language, HttpServletRequest request){
    public ResultUtil<List<WithdrawalWarpper>> queryWithdrawal(Integer pageNum, Integer size, Integer state, Integer language, HttpServletRequest request){
        try {
            Integer uid = userInfoService.getUserIdFormRedis(request);
            if(null == uid){
                return ResultUtil.tokenErr();
            }
            List<Map<String, Object>> list = withdrawalService.queryWithdrawal(uid, pageNum, size, state, language);
            WithdrawalVo withdrawalVo = new WithdrawalVo();
            withdrawalVo.setList(WithdrawalWarpper.getWithdrawalWarpper(list));
            List<Withdrawal> withdrawals = withdrawalService.selectList(new EntityWrapper<Withdrawal>().eq("userId", uid).eq("userType", 1).ne("flag", 3));
            double withdrawn = withdrawals.stream().filter(s -> s.getState().compareTo(2) == 0).mapToDouble(Withdrawal::getMoney).sum();
            withdrawalVo.setWithdrawn(withdrawn);
            double processing = withdrawals.stream().filter(s -> s.getState().compareTo(1) == 0).mapToDouble(Withdrawal::getMoney).sum();
            withdrawalVo.setProcessing(processing);
            double fail = withdrawals.stream().filter(s -> s.getState().compareTo(3) == 0).mapToDouble(Withdrawal::getMoney).sum();
            withdrawalVo.setFail(fail);
            return ResultUtil.success(withdrawalVo);
            for (Map<String, Object> map : list) {
                map.put("withdrawn", withdrawn);
                map.put("processing", processing);
                map.put("fail", fail);
            }
            return ResultUtil.success(WithdrawalWarpper.getWithdrawalWarpper(list));
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/WithdrawalWarpper.java
@@ -21,6 +21,12 @@
    private String remark;
    @ApiModelProperty("提现状态(1=待处理,2=成功,3=失败)")
    private Integer state;
    @ApiModelProperty("已提现总金额")
    private Double withdrawn;
    @ApiModelProperty("处理中总金额")
    private Double processing;
    @ApiModelProperty("提现失败总金额")
    private Double fail;
    public Integer getId() {
        return id;
@@ -70,6 +76,30 @@
        this.state = state;
    }
    public Double getWithdrawn() {
        return withdrawn;
    }
    public void setWithdrawn(Double withdrawn) {
        this.withdrawn = withdrawn;
    }
    public Double getProcessing() {
        return processing;
    }
    public void setProcessing(Double processing) {
        this.processing = processing;
    }
    public Double getFail() {
        return fail;
    }
    public void setFail(Double fail) {
        this.fail = fail;
    }
    @Override
    public String toString() {
        return "WithdrawalWarpper{" +
@@ -93,6 +123,9 @@
                withdrawalWarpper.setRemark(null != map.get("remark") ? String.valueOf(map.get("remark")) : "");
                withdrawalWarpper.setState(null != map.get("state") ? Integer.valueOf(String.valueOf(map.get("state"))) : 0);
                withdrawalWarpper.setInsertTime(null != map.get("insertTime") ? String.valueOf(map.get("insertTime")) : "");
                withdrawalWarpper.setWithdrawn(null != map.get("withdrawn") ? Double.valueOf(String.valueOf(map.get("withdrawn"))) : 0);
                withdrawalWarpper.setProcessing(null != map.get("processing") ? Double.valueOf(String.valueOf(map.get("processing"))) : 0);
                withdrawalWarpper.setFail(null != map.get("fail") ? Double.valueOf(String.valueOf(map.get("fail"))) : 0);
                list.add(withdrawalWarpper);
            }
        }