|
@@ -1,6 +1,7 @@
|
|
|
package qiyuesuosdk
|
|
package qiyuesuosdk
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
|
+ "strconv"
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
|
v2auth_request "git.sxidc.com/student-physical-examination/contract_lock_sdk/model/v2auth/request"
|
|
v2auth_request "git.sxidc.com/student-physical-examination/contract_lock_sdk/model/v2auth/request"
|
|
@@ -164,10 +165,70 @@ func (c *Client) CompanySealAuthURLFor(company CompanyLocateParams, adminMobile
|
|
|
return resp.Result.Url, nil
|
|
return resp.Result.Url, nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// AuthorizedCompanySeal 静默授权记录中的印章摘要(与签章权限一致,不依赖印章列表查看权限)。
|
|
|
|
|
+type AuthorizedCompanySeal struct {
|
|
|
|
|
+ ID string
|
|
|
|
|
+ Name string
|
|
|
|
|
+ Type string
|
|
|
|
|
+ SealAttribute string
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// ListAuthorizedCompanySeals 查询法人单位静默授权中的印章;status 传 EFFECT 查生效授权。
|
|
|
|
|
+func (c *Client) ListAuthorizedCompanySeals(company CompanyLocateParams, status string) ([]AuthorizedCompanySeal, error) {
|
|
|
|
|
+ companyReq, err := company.toCompanyRequest()
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return nil, err
|
|
|
|
|
+ }
|
|
|
|
|
+ req := v2auth_request.V2AuthSignsilentCompanyRecordRequest{
|
|
|
|
|
+ AuthCompany: companyReq,
|
|
|
|
|
+ Status: status,
|
|
|
|
|
+ }
|
|
|
|
|
+ var resp companyAuthRecordResp
|
|
|
|
|
+ if err := c.postJSON("/v2/auth/signsilent/company/record", req, &resp); err != nil {
|
|
|
|
|
+ return nil, err
|
|
|
|
|
+ }
|
|
|
|
|
+ if err := resp.err(); err != nil {
|
|
|
|
|
+ return nil, err
|
|
|
|
|
+ }
|
|
|
|
|
+ out := make([]AuthorizedCompanySeal, 0, len(resp.Result))
|
|
|
|
|
+ for _, item := range resp.Result {
|
|
|
|
|
+ seal := authorizedSealFromRecord(item)
|
|
|
|
|
+ if seal.ID == "" {
|
|
|
|
|
+ continue
|
|
|
|
|
+ }
|
|
|
|
|
+ out = append(out, seal)
|
|
|
|
|
+ }
|
|
|
|
|
+ return out, nil
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func authorizedSealFromRecord(item common.AuthorizedSealRecordBean) AuthorizedCompanySeal {
|
|
|
|
|
+ seal := AuthorizedCompanySeal{}
|
|
|
|
|
+ if item.AuthorizedSealRecord != nil {
|
|
|
|
|
+ seal.ID = item.AuthorizedSealRecord.SealId
|
|
|
|
|
+ }
|
|
|
|
|
+ if item.SealBean != nil {
|
|
|
|
|
+ if seal.ID == "" && item.SealBean.Id != nil {
|
|
|
|
|
+ seal.ID = strconv.FormatInt(*item.SealBean.Id, 10)
|
|
|
|
|
+ }
|
|
|
|
|
+ seal.Name = item.SealBean.Name
|
|
|
|
|
+ seal.Type = item.SealBean.Type_
|
|
|
|
|
+ seal.SealAttribute = item.SealBean.SealAttribute
|
|
|
|
|
+ }
|
|
|
|
|
+ return seal
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// QueryCompanySealAuthRecords 查询机构静默授权记录;status 传 "EFFECT" 查有效授权。
|
|
// QueryCompanySealAuthRecords 查询机构静默授权记录;status 传 "EFFECT" 查有效授权。
|
|
|
func (c *Client) QueryCompanySealAuthRecords(openCompanyID, status string) ([]AuthRecord, error) {
|
|
func (c *Client) QueryCompanySealAuthRecords(openCompanyID, status string) ([]AuthRecord, error) {
|
|
|
|
|
+ return c.queryCompanySealAuthRecordsFor(CompanyLocateParams{OpenCompanyID: openCompanyID}, status)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (c *Client) queryCompanySealAuthRecordsFor(company CompanyLocateParams, status string) ([]AuthRecord, error) {
|
|
|
|
|
+ companyReq, err := company.toCompanyRequest()
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return nil, err
|
|
|
|
|
+ }
|
|
|
req := v2auth_request.V2AuthSignsilentCompanyRecordRequest{
|
|
req := v2auth_request.V2AuthSignsilentCompanyRecordRequest{
|
|
|
- AuthCompany: &common.CompanyRequest{OpenCompanyId: openCompanyID},
|
|
|
|
|
|
|
+ AuthCompany: companyReq,
|
|
|
Status: status,
|
|
Status: status,
|
|
|
}
|
|
}
|
|
|
var resp companyAuthRecordResp
|
|
var resp companyAuthRecordResp
|
|
@@ -179,6 +240,9 @@ func (c *Client) QueryCompanySealAuthRecords(openCompanyID, status string) ([]Au
|
|
|
}
|
|
}
|
|
|
out := make([]AuthRecord, 0, len(resp.Result))
|
|
out := make([]AuthRecord, 0, len(resp.Result))
|
|
|
for _, item := range resp.Result {
|
|
for _, item := range resp.Result {
|
|
|
|
|
+ if item.AuthorizedSealRecord == nil {
|
|
|
|
|
+ continue
|
|
|
|
|
+ }
|
|
|
out = append(out, AuthRecord{
|
|
out = append(out, AuthRecord{
|
|
|
Status: item.AuthorizedSealRecord.Status,
|
|
Status: item.AuthorizedSealRecord.Status,
|
|
|
StartTime: item.AuthorizedSealRecord.StartTime,
|
|
StartTime: item.AuthorizedSealRecord.StartTime,
|