package com.sqx.modules.pay.controller.query;

import com.sqx.common.query.PageQuery;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.util.StringUtils;

import java.util.Date;

/**
 * 钱包明细查询
 */
@Data
@ApiModel("钱包明细详情")
public class WalletDetailQuery extends PageQuery {

    @ApiModelProperty("店铺名称，模糊查询")
    private String shopName;

    @ApiModelProperty("收支类别，1充值、2支出")
    private String type;

    @ApiModelProperty("明细类别，1骑手保证金、2商户保证金 、3钱包明细")
    private String classify;

    @ApiModelProperty("查询开始时间, 时间格式yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private String startTime;

    @ApiModelProperty("查询截止时间, 时间格式yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private String endTime;

    @ApiModelProperty("登录人id")
    private String userId;

    public String toStrMessage() {
        StringBuilder stringBuilder=new StringBuilder();
        stringBuilder.append(!StringUtils.hasText(shopName)?"":"店铺名称："+shopName+";")
                .append(!StringUtils.hasText(startTime)?"":"开始时间："+startTime+";")
                .append(!StringUtils.hasText(endTime)?"":"截止时间："+endTime+";");
        if(StringUtils.hasText(type)){
            switch (type){
                case "1": stringBuilder.append("状态：充值;");break;
                case "2": stringBuilder.append("状态：提现;");break;
            }
        }
        //不展示默认条件
//        if(StringUtils.hasText(classify)){
//            switch (classify){
//                case "1": stringBuilder.append("明细类别：骑手保证金;");break;
//                case "2": stringBuilder.append("明细类别：商户保证金;");break;
//                case "3": stringBuilder.append("明细类别：钱包明细;");break;
//            }
//        }
        return stringBuilder.toString();
    }

    public String toStrCode() {
        return ","+(shopName==null?"":shopName)
                +","+(type==null?"":type)
                +","+(classify==null?"":classify)
                +","+(startTime==null?"":startTime)
                +","+(endTime==null?"":endTime)+",";
    }
}
