Commit 9ea91eeb by chenmingyang

complete account service

parent 37529f12
package io.better.toutiao.api.account; package io.better.toutiao.api.account;
import io.better.toutiao.dto.TouTiaoRespDTO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
/** /**
* 账号管家Api
*
* @author better create in 2019-05-07 15:15 * @author better create in 2019-05-07 15:15
*/ */
@FeignClient(value = "https://ad.toutiao.com/open_api/2", url = "/majordomo")
public interface AccountApi { public interface AccountApi {
/**
* 账号服务-账号管家-广告主列表
*
* @param accessToken the access token
* @param advertiserId the advertiser id
* @return the advertiser list
*/
@GetMapping(value = "/advertiser/select/")
TouTiaoRespDTO<?> getAdvertiserList(@RequestHeader("Access-Token") String accessToken,
@RequestParam("advertiser_id") Long advertiserId);
} }
...@@ -2,7 +2,7 @@ package io.better.toutiao.api.account; ...@@ -2,7 +2,7 @@ package io.better.toutiao.api.account;
import io.better.toutiao.dto.TouTiaoRespDTO; import io.better.toutiao.dto.TouTiaoRespDTO;
import io.better.toutiao.dto.account.AdvertiserInfoDTO; import io.better.toutiao.dto.account.AdvertiserInfoDTO;
import io.better.toutiao.dto.account.AgentDTO; import io.better.toutiao.dto.account.AdvertiserDTO;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -24,10 +24,10 @@ public interface AgentApi { ...@@ -24,10 +24,10 @@ public interface AgentApi {
* @return advertiser by agent id * @return advertiser by agent id
*/ */
@GetMapping(value = "/advertiser/select") @GetMapping(value = "/advertiser/select")
TouTiaoRespDTO<AgentDTO> getAdvertiserByAgentId(@RequestHeader("Access-Token") String accessToken, TouTiaoRespDTO<AdvertiserDTO> getAdvertiserByAgentId(@RequestHeader("Access-Token") String accessToken,
@RequestParam("advertiser_id") Long advertiserId, @RequestParam("advertiser_id") Long advertiserId,
@RequestParam(value = "page", defaultValue = "1", required = false) String page, @RequestParam(value = "page", defaultValue = "1", required = false) String page,
@RequestParam(value = "page_size", defaultValue = "100", required = false) String pageSize); @RequestParam(value = "page_size", defaultValue = "100", required = false) String pageSize);
/** /**
* 账号服务-代理商账号-创建广告主信息 * 账号服务-代理商账号-创建广告主信息
...@@ -61,7 +61,7 @@ public interface AgentApi { ...@@ -61,7 +61,7 @@ public interface AgentApi {
* @return the second agent * @return the second agent
*/ */
@GetMapping(value = "/child_agent/select/") @GetMapping(value = "/child_agent/select/")
TouTiaoRespDTO<AgentDTO> getSecondAgent(@RequestHeader("Access-Token") String accessToken, TouTiaoRespDTO<AdvertiserDTO> getSecondAgent(@RequestHeader("Access-Token") String accessToken,
@RequestParam(value = "page", defaultValue = "1", required = false) String page, @RequestParam(value = "page", defaultValue = "1", required = false) String page,
@RequestParam(value = "page_size", defaultValue = "100", required = false) String pageSize); @RequestParam(value = "page_size", defaultValue = "100", required = false) String pageSize);
} }
package io.better.toutiao.api.account;
import io.better.toutiao.dto.TouTiaoRespDTO;
import io.better.toutiao.dto.account.AccountBalanceDTO;
import io.better.toutiao.dto.account.AccountDayFundFlowDTO;
import io.better.toutiao.dto.account.FundFlowCallBackDTO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 账号服务-资金流水
*
* @author better create in 2019-05-07 16:45
*/
@FeignClient(value = "https://ad.toutiao.com/open_api/2", url = "/advertiser/fund")
public interface FundFlowApi {
/**
* 账号服务-资金流水-查询账户余额
*
* @param accessToken 访问凭证
* @param advertiserId 广告主ID
* @return the account balance
*/
@GetMapping(value = "/get")
TouTiaoRespDTO<AccountBalanceDTO> getAccountBalance(@RequestHeader("Access-Token") String accessToken,
@RequestParam("advertiser_id") Long advertiserId);
/**
* 账号服务-资金流水-查询账号日流水
*
* @param accessToken 访问凭证
* @param advertiserId 广告主ID
* @param startDate 开始时间
* @param endDate 结束时间
* @param page 第几页
* @param pageSize 每页记录数
* @return the account balance
*/
@GetMapping(value = "/daily_stat")
TouTiaoRespDTO<AccountDayFundFlowDTO> getAccountDayFundFlow(@RequestHeader("Access-Token") String accessToken,
@RequestParam("advertiser_id") Long advertiserId,
@RequestParam(value = "start_date", required = false) String startDate,
@RequestParam(value = "end_date", required = false) String endDate,
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "page_size", required = false, defaultValue = "10") Integer pageSize
);
/**
* 账号服务-资金流水-查询账号流水明细
*
* @param accessToken 访问凭证
* @param advertiserId 广告主ID
* @param startDate 开始时间
* @param endDate 结束时间
* @param transactionType 流水类型
* @param page 第几页
* @param pageSize 每页记录数
* @return the account balance
* @see io.better.toutiao.enums.FlowType 查看流水类型取值
*/
@GetMapping(value = "/transaction/get")
TouTiaoRespDTO<FundFlowCallBackDTO> getAccountFundFlowDetail(@RequestHeader("Access-Token") String accessToken,
@RequestParam("advertiser_id") Long advertiserId,
@RequestParam(value = "start_date") String startDate,
@RequestParam(value = "end_date") String endDate,
@RequestParam(value = "transaction_type") String transactionType,
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "page_size", required = false, defaultValue = "10") Integer pageSize
);
}
package io.better.toutiao.dto.account;
import io.better.toutiao.dto.BaseDTO;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 账号余额信息
*
* @author better create in 2019-05-07 16:47
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class AccountBalanceDTO extends BaseDTO {
/**
* 账户名
*/
private String name;
/**
* 联系邮箱
*/
private String email;
/**
* 账户总余额(单位元)
*/
private Double balance;
/**
* 账户可用总余额(单位元)
*/
private Double validBalance;
/**
* 现金余额(单位元)
*/
private Double cash;
/**
* 现金可用余额(单位元)
*/
private Double validCash;
/**
* 赠款余额(单位元)
*/
private Double grant;
/**
* 赠款可用余额(单位元)
*/
private Double validGrant;
/**
* 返货余额(单位元),仅支持部分广告主
*/
private Double returnGoodsAbs;
/**
* 返货可用余额(单位元),仅支持部分广告主
*/
private Double validReturnGoodsAbs;
/**
* 返货支出(单位元),仅支持部分广告主
*/
private Double returnGoodsCost;
}
package io.better.toutiao.dto.account;
import io.better.toutiao.dto.BaseDTO;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 账号资金日流水
*
* @author better create in 2019-05-07 16:47
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class AccountDayFundFlowDTO extends BaseDTO {
/**
* 日期
*/
private String date;
/**
* 日终结余(单位元)
*/
private Double balance;
/**
* 现金支出(单位元)
*/
private Double cashCost;
/**
* 总支出(单位元)
*/
private Double cost;
/**
* 冻结(单位元)
*/
private Double frozen;
/**
* 总存入(单位元)
*/
private Double income;
/**
* 赠款支出(单位元)
*/
private Double rewardCost;
/**
* 返货支出(单位元)
*/
private Double returnGoodsCost;
/**
* 总转入(单位元)
*/
private Double transferIn;
/**
* 总转出(单位元)
*/
private Double transferOut;
}
package io.better.toutiao.dto.account;
import io.better.toutiao.dto.BaseDTO;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 账号资金流水明细
*
* @author better create in 2019-05-07 17:06
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class AccountFundFlowDetailDTO extends BaseDTO {
/**
* 流水类型
*
* @see io.better.toutiao.enums.FlowType
*/
private String transactionType;
/**
* 流水产生时间
*/
private String createTime;
/**
* 交易总金额(单位元)
*/
private Double amount;
/**
* 冻结总金额(单位元)
*/
private Double frozen;
/**
* 现金总金额(单位元)
*/
private Double cash;
/**
* 赠款总金额(单位元)
*/
private Double grant;
/**
* 返货总金额(单位元)
*/
private Double returnGoods;
/**
* 交易流水号
*/
private Double transactionSeq;
/**
* 付款方,即广告主id
*/
private Long remitter;
/**
* 收款方,即广告主id
*/
private Long payee;
}
package io.better.toutiao.dto.account; package io.better.toutiao.dto.account;
import io.better.toutiao.dto.BaseDTO;
import io.better.toutiao.dto.PageDTO; import io.better.toutiao.dto.PageDTO;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List; import java.util.List;
...@@ -9,7 +11,8 @@ import java.util.List; ...@@ -9,7 +11,8 @@ import java.util.List;
* @author better create in 2019-05-07 16:07 * @author better create in 2019-05-07 16:07
*/ */
@Data @Data
public class AgentDTO { @EqualsAndHashCode(callSuper = true)
public class AdvertiserDTO extends BaseDTO {
/** /**
* 广告主ID列表 * 广告主ID列表
...@@ -21,7 +24,6 @@ public class AgentDTO { ...@@ -21,7 +24,6 @@ public class AgentDTO {
*/ */
private PageDTO page; private PageDTO page;
/** /**
* 二级代理商ID集合 * 二级代理商ID集合
*/ */
......
package io.better.toutiao.dto.account;
import lombok.Data;
import java.util.List;
/**
* 资金流水返回DTO
*
* @author better create in 2019-05-07 17:21
*/
@Data
public class FundFlowCallBackDTO {
/**
* 账号资金流水明细信息集合
*/
private List<AccountFundFlowDetailDTO> list;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment