diff --git a/server/src/main/kotlin/com/bbit/ticket/entity/request/QueryDigitalAccountListRequest.kt b/server/src/main/kotlin/com/bbit/ticket/entity/request/QueryDigitalAccountListRequest.kt new file mode 100644 index 0000000..87b7767 --- /dev/null +++ b/server/src/main/kotlin/com/bbit/ticket/entity/request/QueryDigitalAccountListRequest.kt @@ -0,0 +1,27 @@ +package com.bbit.ticket.entity.request + +import kotlinx.serialization.Serializable + +/** + * 查询数电账号列表请求 + */ +@Serializable +data class QueryDigitalAccountListRequest( + + /** + * 销售方纳税人识别号 + * + * 长度:15-20 + * 校验规则: + * - 只能包含大写英文字母或数字 + */ + val taxpayerNum: String, + + /** + * 电子税局登录账号 + * + * 非必填。 + * 如果传入,则按指定账号进行过滤查询。 + */ + val account: String? = null +) \ No newline at end of file diff --git a/server/src/main/kotlin/com/bbit/ticket/entity/request/QueryEnterpriseBankAccountRequest.kt b/server/src/main/kotlin/com/bbit/ticket/entity/request/QueryEnterpriseBankAccountRequest.kt new file mode 100644 index 0000000..0cca9f6 --- /dev/null +++ b/server/src/main/kotlin/com/bbit/ticket/entity/request/QueryEnterpriseBankAccountRequest.kt @@ -0,0 +1,18 @@ +package com.bbit.ticket.entity.request + +import kotlinx.serialization.Serializable + +/** + * 查询企业开户行及账号请求 + */ +@Serializable +data class QueryEnterpriseBankAccountRequest( + + /** + * 销售方纳税人识别号 + * + * 长度:15-20 + * 例如:统一社会信用代码 + */ + val taxpayerNum: String +) \ No newline at end of file diff --git a/server/src/main/kotlin/com/bbit/ticket/entity/request/QueryEnterpriseInfoRequest.kt b/server/src/main/kotlin/com/bbit/ticket/entity/request/QueryEnterpriseInfoRequest.kt new file mode 100644 index 0000000..069965f --- /dev/null +++ b/server/src/main/kotlin/com/bbit/ticket/entity/request/QueryEnterpriseInfoRequest.kt @@ -0,0 +1,18 @@ +package com.bbit.ticket.entity.request + +import kotlinx.serialization.Serializable + +/** + * 查询企业信息请求 + */ +@Serializable +data class QueryEnterpriseInfoRequest( + + /** + * 销售方纳税人识别号 + * + * 长度:15-20 + * 一般为统一社会信用代码 + */ + val taxpayerNum: String +) \ No newline at end of file diff --git a/server/src/main/kotlin/com/bbit/ticket/entity/response/QueryDigitalAccountListResponse.kt b/server/src/main/kotlin/com/bbit/ticket/entity/response/QueryDigitalAccountListResponse.kt new file mode 100644 index 0000000..f324123 --- /dev/null +++ b/server/src/main/kotlin/com/bbit/ticket/entity/response/QueryDigitalAccountListResponse.kt @@ -0,0 +1,145 @@ +package com.bbit.ticket.entity.response + +import kotlinx.serialization.Serializable + +/** + * 查询数电账号列表响应 + */ +@Serializable +data class QueryDigitalAccountListResponse( + + /** + * 数电账号列表 + */ + val list: List +) + +/** + * 数电账号信息 + */ +@Serializable +data class DigitalAccountInfo( + + /** + * 销售方纳税人识别号 + * + * 长度:15-20 + * 只能包含大写英文字母或数字 + */ + val taxpayerNum: String, + + /** + * 电子税局登录账号 + */ + val account: String, + + /** + * 人员姓名 + */ + val name: String, + + /** + * 登录身份类型 + * + * 01:法定代表人 + * 02:财务负责人 + * 03:办税员 + * 04:涉税服务人员 + * 05:管理员 + * 07:领票人 + * 09:开票员 + * 99:其他人员 + */ + val identityType: String, + + /** + * 操作建议 + * + * 注意: + * 该值是根据账号状态及不同地区登录方式综合判断, + * 并非与账号状态一一对应。 + * + * 0:无需认证 + * 1:需扫码认证 + * 2:需扫码或短信认证 + * 3:需短信认证 + */ + val operationProposed: String, + + /** + * 账号状态 + * + * 0:无需认证 + * 1:风险认证 + * 2:登录认证 + * 3:风险 + 登录认证 + * + * 注: + * 风险认证通常需要在开票时才能得知。 + */ + val authStatus: String, + + /** + * 是否可切换企业状态 + * + * 0:不可切换 + * 1:可切换 + * + * 表示该账号在当前地区其他企业已存在登录状态, + * 当前企业无需重复登录认证。 + * 若发生开票,将自动调度切换至当前企业。 + */ + val switchable: String, + + /** + * 是否绑定微信公众号 + * + * 是否绑定票通云服务微信公众号。 + * + * 0:否 + * 1:是 + */ + val wechatUserBindStatus: String, + + /** + * 最新认证成功时间 + * + * 包括登录认证或风险认证成功时间。 + * + * 时间格式: + * yyyy-MM-dd HH:mm:ss + */ + val lastAuthSuccTime: String? = null, + + /** + * 登录认证状态 + * + * 0:未登录 + * 1:已登录 + */ + val loginAuthStatus: String, + + /** + * 最新登录认证时间 + * + * 时间格式: + * yyyy-MM-dd HH:mm:ss + */ + val lastLoginAuthTime: String? = null, + + /** + * 风险认证状态 + * + * 0:未认证 + * 1:已认证 + */ + val riskAuthStatus: String, + + /** + * 最新风险认证时间 + * + * 时间格式: + * yyyy-MM-dd HH:mm:ss + */ + val lastRiskAuthTime: String? = null +) \ No newline at end of file diff --git a/server/src/main/kotlin/com/bbit/ticket/entity/response/QueryEnterpriseBankAccountResponse.kt b/server/src/main/kotlin/com/bbit/ticket/entity/response/QueryEnterpriseBankAccountResponse.kt new file mode 100644 index 0000000..39dfc21 --- /dev/null +++ b/server/src/main/kotlin/com/bbit/ticket/entity/response/QueryEnterpriseBankAccountResponse.kt @@ -0,0 +1,56 @@ +package com.bbit.ticket.entity.response + +import kotlinx.serialization.Serializable + +/** + * 查询企业开户行及账号响应 + */ +@Serializable +data class QueryEnterpriseBankAccountResponse( + + /** + * 销售方纳税人识别号 + * + * 一般为统一社会信用代码 + * 长度:15-20 + */ + val taxpayerNum: String, + + /** + * 企业开户行列表 + */ + val bankList: List +) + +/** + * 企业银行账户信息 + */ +@Serializable +data class BankInfo( + + /** + * 企业开户银行名称 + * + * 示例: + * XXXXXXX银行XX支行 + * + * 长度:1-100 + */ + val bankName: String, + + /** + * 银行账号 + * + * 可能为空 + * 长度:1-50 + */ + val bankAccount: String? = null, + + /** + * 数据来源 + * + * 1:票通平台 + * 2:电子税局 + */ + val source: String +) \ No newline at end of file diff --git a/server/src/main/kotlin/com/bbit/ticket/entity/response/QueryEnterpriseInfoResponse.kt b/server/src/main/kotlin/com/bbit/ticket/entity/response/QueryEnterpriseInfoResponse.kt new file mode 100644 index 0000000..84e0ecb --- /dev/null +++ b/server/src/main/kotlin/com/bbit/ticket/entity/response/QueryEnterpriseInfoResponse.kt @@ -0,0 +1,75 @@ +package com.bbit.ticket.entity.response + +import kotlinx.serialization.Serializable + +/** + * 查询企业信息响应参数 - 业务报文部分 + */ +@Serializable +data class QueryEnterpriseInfoResponse( + /** 销售方纳税人识别号,长度 15-20 位 */ + val taxpayerNum: String, + + /** 销售方企业名称,长度 4-100,按 GBK 字节长度校验 */ + val enterpriseName: String, + + /** 地区编码,省级编码,长度 2 位 */ + val regionCode: String, + + /** 市/地区名称,直辖市为地区名 */ + val cityName: String, + + /** 企业详细地址,长度 1-85,按 GBK 字节长度校验 */ + val enterpriseAddress: String, + + /** 代理商邀请码,长度 6-10,非必填 */ + val invitationCode: String? = null, + + /** + * 审核状态: + * 0:待审核 + * 1:审核通过 + * 2:审核不通过 + * 3:审核中 + */ + val reviewStatus: String, + + /** 审核意见,非必填,最大长度 200 */ + val reviewOpinion: String? = null, + + /** + * 已开通的发票种类,多个用 | 分割: + * 10:电子普票 + * 04:纸质普票 + * 01:纸质专票 + * 12:机动车销售统一发票 + * 9:区块链电子发票 + * 08:电子专票 + * 81:数电票(增值税专用发票) + * 82:数电票(普通发票) + */ + val invoiceKind: String? = null, + + /** + * 电子发票版式文件类型: + * pdf:PDF 格式 + * ofd:OFD 格式 + */ + val invoiceLayoutFileType: String? = null, + + /** 区块链单张发票限额,精确到 2 位小数,开通区块链发票时必传 */ + val blockchainInvSingleQuota: String? = null, + + /** 区块链日开票限额,精确到 2 位小数,开通区块链发票时必传 */ + val blockchainInvDailyQuota: String? = null, + + /** 区块链月开票限额,精确到 2 位小数,开通区块链发票时必传 */ + val blockchainInvMonthlyQuota: String? = null, + + /** + * 服务状态: + * 0:已禁用 + * 1:正常 + */ + val serviceStatus: String +) \ No newline at end of file diff --git a/server/src/main/kotlin/com/bbit/ticket/service/piaotong/PTAuthService.kt b/server/src/main/kotlin/com/bbit/ticket/service/piaotong/PTAuthService.kt index a30fca1..45abed9 100644 --- a/server/src/main/kotlin/com/bbit/ticket/service/piaotong/PTAuthService.kt +++ b/server/src/main/kotlin/com/bbit/ticket/service/piaotong/PTAuthService.kt @@ -3,8 +3,12 @@ package com.bbit.ticket.service.piaotong import com.bbit.ticket.dao.piaotong.EnterpriseTaxDao +import com.bbit.ticket.database.system.SysUserTable.taxpayerNum import com.bbit.ticket.entity.request.AuthQrcodeRequest import com.bbit.ticket.entity.request.GetLoginSmsCodeRequest +import com.bbit.ticket.entity.request.QueryDigitalAccountListRequest +import com.bbit.ticket.entity.request.QueryEnterpriseBankAccountRequest +import com.bbit.ticket.entity.request.QueryEnterpriseInfoRequest import com.bbit.ticket.entity.request.QueryRealNameAuthQrStatusRequest import com.bbit.ticket.entity.request.SmsLoginRequest import com.bbit.ticket.entity.request.TaxBureauAuthReq @@ -16,6 +20,9 @@ import com.bbit.ticket.entity.response.AuthQrcodeStatusResponse import com.bbit.ticket.entity.response.EnterpriseTaxInfo import com.bbit.ticket.entity.response.EtaxRegisterResponse import com.bbit.ticket.entity.response.LoginSmsCodeResponse +import com.bbit.ticket.entity.response.QueryDigitalAccountListResponse +import com.bbit.ticket.entity.response.QueryEnterpriseBankAccountResponse +import com.bbit.ticket.entity.response.QueryEnterpriseInfoResponse import com.bbit.ticket.entity.response.SMSLoginResponse import com.bbit.ticket.entity.response.TaxBureauAccountAuthContent import com.bbit.ticket.utils.plugins.dbQuery @@ -26,7 +33,7 @@ import kotlin.uuid.Uuid object PTAuthService { /** - * 查询数电账号认证状态 + * 查询数电账号认证状态 2.8 */ suspend fun getTaxBureauAccountAuthStatus(req: TaxBureauAuthReq): TaxBureauAccountAuthContent { val res = @@ -35,10 +42,7 @@ object PTAuthService { } /** - * 登记/删除 数电账号 - */ - /** - * 登记/删除 数电账号(前端弹窗传入 taxpayerNum + taxAccount) + * 登记/删除 数电账号 2.3 */ suspend fun registerUserFromPayload(req: TaxRegisterUserRequest, currentUser: CurrentUser): String { val res = PTClient.ptPost( @@ -56,7 +60,7 @@ object PTAuthService { } /** - * 注册企业(纳税人) + * 注册企业(纳税人) 2.2 * 将企业信息注册到票通平台 */ suspend fun registerEnterprise(req: TaxRegisterInfo, userId: Uuid): String { @@ -66,7 +70,7 @@ object PTAuthService { } /** - * 获取实名认证二维码 + * 获取实名认证二维码 2.6 * * @return AuthQrcodeResponse 包含 base64 二维码图片 */ @@ -75,16 +79,19 @@ object PTAuthService { } /** - * 查询认证二维码扫码状态 + * 查询认证二维码扫码状态 2.7 * * @return AuthQrcodeStatusResponse 包含 scanStatus、msg */ suspend fun queryAuthQrcodeScanStatus(req: QueryRealNameAuthQrStatusRequest): AuthQrcodeStatusResponse { - return PTClient.ptPost("queryAuthQrcodeScanStatus.pt", req) + return PTClient.ptPost( + "queryAuthQrcodeScanStatus.pt", + req + ) } /** - * 发送登录短信验证码 + * 发送登录短信验证码 2.4 * * @return LoginSmsCodeResponse 包含脱敏手机号、有效时长 */ @@ -93,11 +100,36 @@ object PTAuthService { } /** - * 短信验证码登录 + * 短信验证码登录 2.5 * * @return SMSLoginResponse 包含登录结果 */ suspend fun smsLogin(req: SmsLoginRequest): SMSLoginResponse { return PTClient.ptPost("smsLogin.pt", req) } + + /** + * 查询企业状态 2.47 + */ + suspend fun getEnterpriseInfo(req: QueryEnterpriseInfoRequest): QueryEnterpriseInfoResponse { + return PTClient.ptPost("getEnterpriseInfo.pt", req) + } + + /** + * 查询数电账号列表 2.45 + */ + suspend fun getListTaxBureauAccount(req: QueryDigitalAccountListRequest): QueryDigitalAccountListResponse { + return PTClient.ptPost( + "listTaxBureauAccount.pt", + req + ) + } + + /** + * 查询企业开户行及账号 2.49 + */ + suspend fun queryEnterpriseBankInfo(req: QueryEnterpriseBankAccountRequest): QueryEnterpriseBankAccountResponse { + return PTClient.ptPost("queryEnterpriseBankInfo.pt", req) + } + } \ No newline at end of file diff --git a/server/src/main/kotlin/com/bbit/ticket/utils/bootstrap/Global.kt b/server/src/main/kotlin/com/bbit/ticket/utils/bootstrap/Global.kt index addabb6..bea4805 100644 --- a/server/src/main/kotlin/com/bbit/ticket/utils/bootstrap/Global.kt +++ b/server/src/main/kotlin/com/bbit/ticket/utils/bootstrap/Global.kt @@ -22,7 +22,6 @@ object Global { // 票通编码 (票通提供) var ptPlatformCode: String - init { if (isDev) { baseUrl = "http://fpkj.testnw.vpiaotong.cn/tp/openapi/" @@ -43,6 +42,4 @@ object Global { ptPlatformCode = "XR8TmK3S" } } - - } \ No newline at end of file