Compare commits

..

No commits in common. "07f35e0a0678c3a5b31d3aef9887d9bcf10a7a0b" and "2b4773b67e945b607427c2d2036f3bf5757e8925" have entirely different histories.

2 changed files with 120 additions and 67 deletions

View File

@ -17,12 +17,6 @@ type WriteoffResponse struct {
Result string `json:"result"` // 回覆明細 Result string `json:"result"` // 回覆明細
Checksum string `json:"checksum"` // 校驗碼 Checksum string `json:"checksum"` // 校驗碼
ReturnSeq string `json:"rtnSeq"` // 回覆序號 ReturnSeq string `json:"rtnSeq"` // 回覆序號
Message string `json:"message"` // 回覆訊息
}
type FeeAuditInfo struct {
WriteoffYYYYMM string `json:"writeoff_yyyymm"` // 支審年月
TransNo string `json:"trans_no"` // 交易序號
} }
// FeeApplyUpload 是 FeeApply 的傳送資料 // FeeApplyUpload 是 FeeApply 的傳送資料
@ -32,15 +26,16 @@ type FeeApplyUpload struct {
// ApplyInfo 是 FeeApplyUpload 的單筆資料 // ApplyInfo 是 FeeApplyUpload 的單筆資料
type ApplyInfo struct { type ApplyInfo struct {
FeeAuditInfo WriteoffYYYYMM string `json:"writeoff_yyyymm"` // 支審年月
Records int `json:"records"` // 服務記錄筆數 TransNo string `json:"trans_no"` // 交易序號
Amount int `json:"amount"` // 服務記錄金額 Records int `json:"records"` // 服務記錄筆數
Cases int `json:"cases"` // 申請個案數 Amount int `json:"amount"` // 服務記錄金額
CaseSvcRecords []CaseSvcRecord `json:"case_svc_records"` // 個案服務記錄 Cases int `json:"cases"` // 申請個案數
CaseSvceRecords []CaseSvceRecord `json:"case_svc_records"` // 個案服務記錄
} }
// CaseSvcRecord 是個案服務記錄 // CaseSvcRecord 是個案服務記錄
type CaseSvcRecord struct { type CaseSvceRecord struct {
ObjID string `json:"objid"` // 識別碼 ObjID string `json:"objid"` // 識別碼
IDN string `json:"idn,omitempty"` // 個案身份證字號 IDN string `json:"idn,omitempty"` // 個案身份證字號
SvcAt string `json:"svc_dt,omitempty"` // 服務日期 SvcAt string `json:"svc_dt,omitempty"` // 服務日期
@ -102,9 +97,10 @@ type ObjDelUpload struct {
// SvcDelInfo 是刪除資料 // SvcDelInfo 是刪除資料
type SvcDelInfo struct { type SvcDelInfo struct {
FeeAuditInfo WriteoffYYYYMM string `json:"writeoff_yyyymm"` // 支審年月
Records int `json:"records"` // 服務記錄筆數 TransNo string `json:"trans_no"` // 交易序號
CaseSvcRecords []CaseSvcRecord `json:"case_svc_records"` // 個案服務記錄 Records int `json:"records"` // 服務記錄筆數
CaseSvceRecords []CaseSvceRecord `json:"case_svc_records"` // 個案服務記錄
} }
// AppCompletionNoticeUpload 是 AppCompletionNotice 的傳送資料 // AppCompletionNoticeUpload 是 AppCompletionNotice 的傳送資料
@ -114,27 +110,19 @@ type AppCompletionNoticeUpload struct {
// FinishInfo 是申報確認資料 // FinishInfo 是申報確認資料
type FinishInfo struct { type FinishInfo struct {
FeeAuditInfo WriteoffYYYYMM string `json:"writeoff_yyyymm"` // 支審年月
FinishCityInfos []FinishCityInfo `json:"city_info"` // 縣市案號資訊 TransNo string `json:"trans_no"` // 交易序號
CityInfos []CityInfo `json:"city_info"` // 縣市案號資訊
} }
type FinishCityInfo struct { // CityInfo 是縣市案號資訊
type CityInfo struct {
CityCode string `json:"city_cd"` // 縣市代碼 CityCode string `json:"city_cd"` // 縣市代碼
CaseNoInfos []CaseNoInfo `json:"case_no_info"` // 案件資訊 CaseNoInfos []CaseNoInfo `json:"case_no_info"` // 案件資訊
} }
// CaseNoInfo 是案件資訊 // CaseNoInfo 是案件資訊
type CaseNoInfo struct { type CaseNoInfo struct {
CaseNo string `json:"case_no"` // 案件編號
}
// CityInfo 是縣市案號資訊
type CityInfo struct {
CityCode string `json:"city_cd"` // 縣市代碼
CaseInfos []CaseInfo `json:"case_infos"` // 案件資訊
}
type CaseInfo struct {
CaseNo string `json:"case_no"` // 案件編號 CaseNo string `json:"case_no"` // 案件編號
Status string `json:"status,omitempty"` // 核銷狀況 Status string `json:"status,omitempty"` // 核銷狀況
DocVer string `json:"doc_ver,omitempty"` // 總表版次 DocVer string `json:"doc_ver,omitempty"` // 總表版次
@ -148,10 +136,11 @@ type AppResultQueryUpload struct {
// AppResultQueryInfo 是查詢輸入資訊 // AppResultQueryInfo 是查詢輸入資訊
type AppResultQueryInfo struct { type AppResultQueryInfo struct {
FeeAuditInfo WriteoffYYYYMM string `json:"writeoff_yyyymm"` // 支審年月
QueryType string `json:"query_type"` // 查詢類別 TransNo string `json:"trans_no"` // 交易序號
CityCode string `json:"city_cd,omitempty"` // 縣市代碼 QueryType string `json:"query_type"` // 查詢類別
CaseNo string `json:"case_no,omitempty"` // 核銷案號 CityCode string `json:"city_cd,omitempty"` // 縣市代碼
CaseNo string `json:"case_no,omitempty"` // 核銷案號
} }
// AppResultQueryResult 是 AppResultQuery 的 Response.result // AppResultQueryResult 是 AppResultQuery 的 Response.result
@ -161,15 +150,15 @@ type AppResultQueryResult struct {
CaseNo string `json:"case_no,omitempty"` // 核銷案號 CaseNo string `json:"case_no,omitempty"` // 核銷案號
Records int `json:"records,omitempty"` // 服務記錄筆數 Records int `json:"records,omitempty"` // 服務記錄筆數
Cases int `json:"cases,omitempty"` // 個案數 Cases int `json:"cases,omitempty"` // 個案數
Amount float64 `json:"amount,omitempty"` // 申請核銷金額 Amount int `json:"amount,omitempty"` // 申請核銷金額
AuditMan string `json:"audit_man,omitempty"` // 承辦人員 AuditMan string `json:"audit_man,omitempty"` // 承辦人員
AuditReason string `json:"audit_reason,omitempty"` // 承辦審核意見 AuditReason string `json:"audit_reason,omitempty"` // 承辦審核意見
DocVer string `json:"doc_ver,omitempty"` // 總表版次 DocVer string `json:"doc_ver,omitempty"` // 總表版次
VerDate string `json:"ver_dt,omitempty"` // 版次時間 VerDate string `json:"ver_dt,omitempty"` // 版次時間
ApproveCasesNum int `json:"approve_cases_num,omitempty"` // 核定個案數 ApproveCasesNum int `json:"approve_cases_num,omitempty"` // 核定個案數
ApproveRecordCount int `json:"approve_record_count,omitempty"` // 核定服務記錄數 ApproveRecordCount int `json:"approve_record_count,omitempty"` // 核定服務記錄數
ApproveFee float64 `json:"approve_fee,omitempty"` // 核定金額 ApproveFee int `json:"approve_fee,omitempty"` // 核定金額
ASvcFee float64 `json:"a_svc_fee,omitempty"` // 政策鼓勵金額 ASvcFee int `json:"a_svc_fee,omitempty"` // 政策鼓勵金額
TempPaymentStatus string `json:"temp_payment_status,omitempty"` // 暫付申請狀態 TempPaymentStatus string `json:"temp_payment_status,omitempty"` // 暫付申請狀態
TempPaymentFee int `json:"temp_payment_fee,omitempty"` // 分案暫付金額 TempPaymentFee int `json:"temp_payment_fee,omitempty"` // 分案暫付金額
TempPaymentDocUrl string `json:"temp_payment_doc_url,omitempty"` // 暫付總表下載路徑 TempPaymentDocUrl string `json:"temp_payment_doc_url,omitempty"` // 暫付總表下載路徑
@ -181,9 +170,9 @@ type AppResultQueryResult struct {
CaseErrListUrl string `json:"case_err_list_url,omitempty"` // 申請記錄不通過清冊路徑 CaseErrListUrl string `json:"case_err_list_url,omitempty"` // 申請記錄不通過清冊路徑
CaseErrListExcelUrl string `json:"case_err_list_excel_url,omitempty"` // 申請記錄不通過 EXCEL 清冊路徑 CaseErrListExcelUrl string `json:"case_err_list_excel_url,omitempty"` // 申請記錄不通過 EXCEL 清冊路徑
TransNos []string `json:"trans_nos,omitempty"` // 分案已處理之單號申請單單號 TransNos []string `json:"trans_nos,omitempty"` // 分案已處理之單號申請單單號
IncInAcc float64 `json:"inc_in_acc,omitempty"` // 核增金額 IncInAcc int `json:"inc_in_acc,omitempty"` // 核增金額
IncInReason string `json:"inc_in_reason,omitempty"` // 核增原因 IncInReason string `json:"inc_in_reason,omitempty"` // 核增原因
DecInAcc float64 `json:"dec_in_acc,omitempty"` // 核減金額 DecInAcc int `json:"dec_in_acc,omitempty"` // 核減金額
DecInReason string `json:"dec_in_reason,omitempty"` //核減原因 DecInReason string `json:"dec_in_reason,omitempty"` //核減原因
ApproveRecords []ApproveRecord `json:"approve_records,omitempty"` // 審核通過服務記錄 ApproveRecords []ApproveRecord `json:"approve_records,omitempty"` // 審核通過服務記錄
ErrorRecords []ExceptionRecord `json:"err_records,omitempty"` // 錯誤服務記錄 ErrorRecords []ExceptionRecord `json:"err_records,omitempty"` // 錯誤服務記錄
@ -216,19 +205,19 @@ type ExceptionRecord struct {
// ApproveRecord 是審核通過服務記錄 // ApproveRecord 是審核通過服務記錄
type ApproveRecord struct { type ApproveRecord struct {
SourceSystem string `json:"source_system"` // 來源系統別 SourceSystem string `json:"source_system"` // 來源系統別
ObjID string `json:"objid"` // 識別碼 ObjID string `json:"objid"` // 識別碼
TransNo string `json:"trans_no"` // 交易序號 TransNo string `json:"trans_no"` // 交易序號
Price float64 `json:"price"` // 單價 Price int `json:"price"` // 單價
Copayment float64 `json:"copayment"` // 自付額 Copayment int `json:"copayment"` // 自付額
} }
// ASvcRecord 是 A 碼加成資料區 // ASvcRecord 是 A 碼加成資料區
type ASvcRecord struct { type ASvcRecord struct {
RefSourceSystem string `json:"ref_source_system"` // 審核通過服務記錄來源系統別 RefSourceSystem string `json:"ref_source_system"` // 審核通過服務記錄來源系統別
RefObjID string `json:"ref_objid"` // 審核通過服務記錄識別碼 RefObjID string `json:"ref_objid"` // 審核通過服務記錄識別碼
AGovItemCode string `json:"a_gov_item_cd"` // A 碼 AGovItemCode string `json:"a_gov_item_cd"` // A 碼
Price float64 `json:"price"` // 單價 Price int `json:"price"` // 單價
} }
// AppCancelUpload 是 AppCancel 的傳送資料 // AppCancelUpload 是 AppCancel 的傳送資料
@ -239,9 +228,10 @@ type AppCancelUpload struct {
// CancelInfo 是服務單位撤回資料 // CancelInfo 是服務單位撤回資料
type CancelInfo struct { type CancelInfo struct {
FeeAuditInfo WriteoffYYYYMM string `json:"writeoff_yyyymm"` // 支審年月
CityCode string `json:"city_cd,omitempty"` // 縣市代碼 CityCode string `json:"city_cd,omitempty"` // 縣市代碼
CaseNo string `json:"case_no,omitempty"` // 核銷案號 CaseNo string `json:"case_no,omitempty"` // 核銷案號
TransNo string `json:"trans_no"` // 交易序號
} }
// CancelResultResponseUpload 是 CancelResultResponse 的傳送資料 // CancelResultResponseUpload 是 CancelResultResponse 的傳送資料
@ -251,6 +241,7 @@ type CancelResultResponseUpload struct {
// CancelResultResponseInfo 是取消交易單結果回報資料 // CancelResultResponseInfo 是取消交易單結果回報資料
type CancelResultResponseInfo struct { type CancelResultResponseInfo struct {
FeeAuditInfo WriteoffYYYYMM string `json:"writeoff_yyyymm"` // 支審年月
CancelTransNo string `json:"cancel_trans_no"` // 所要取消結果回報之交易序號 TransNo string `json:"trans_no"` // 交易序號
CancelTransNo string `json:"cancel_trans_no"` // 所要取消結果回報之交易序號
} }

View File

@ -26,7 +26,6 @@ type FeeAuditUtils struct {
Cert []byte Cert []byte
} }
// NewFeeAuditUtils 用來産生 FeeAuditUtils
func NewFeeAuditUtils(unitNo, sourceSystem, hash, url, certPath string) (feeAuditUtils FeeAuditUtils, err error) { func NewFeeAuditUtils(unitNo, sourceSystem, hash, url, certPath string) (feeAuditUtils FeeAuditUtils, err error) {
stringutils := golanghelper.StringUtils{} stringutils := golanghelper.StringUtils{}
if stringutils.IsEmpty(unitNo) || stringutils.IsEmpty(sourceSystem) || stringutils.IsEmpty(hash) || if stringutils.IsEmpty(unitNo) || stringutils.IsEmpty(sourceSystem) || stringutils.IsEmpty(hash) ||
@ -78,7 +77,7 @@ func (f *FeeAuditUtils) getChecksum(apData string) string {
} }
// httpsPost 用來上傳 WriteoffResponse // httpsPost 用來上傳 WriteoffResponse
func (f *FeeAuditUtils) httpsPost(funcName string, writeoffRequest WriteoffRequest) (responseData []byte, err error) { func (f *FeeAuditUtils) httpsPost(funcName string, writeoffRequest WriteoffRequest) (writeoffResponse WriteoffResponse, err error) {
data, err := json.Marshal(&writeoffRequest) data, err := json.Marshal(&writeoffRequest)
if err != nil { if err != nil {
return return
@ -108,10 +107,17 @@ func (f *FeeAuditUtils) httpsPost(funcName string, writeoffRequest WriteoffReque
} }
defer response.Body.Close() defer response.Body.Close()
return io.ReadAll(response.Body) responseData, err := io.ReadAll(response.Body)
if err != nil {
return
}
err = json.Unmarshal(responseData, &writeoffResponse)
return
} }
// NewRequest 用來産生 WirteoffRequest // CreateRequest 用來産生 WirteoffRequest
func (f *FeeAuditUtils) NewRequest(data []byte) WriteoffRequest { func (f *FeeAuditUtils) NewRequest(data []byte) WriteoffRequest {
apData := base64.StdEncoding.EncodeToString(data) apData := base64.StdEncoding.EncodeToString(data)
@ -127,31 +133,87 @@ func (f *FeeAuditUtils) NewRequest(data []byte) WriteoffRequest {
} }
// SendFeeApply 傳送服務記錄申報 // SendFeeApply 傳送服務記錄申報
func (f *FeeAuditUtils) SendFeeApply(writeoffRequest WriteoffRequest) (responseData []byte, err error) { func (f *FeeAuditUtils) SendFeeApply(writeoffRequest WriteoffRequest) (feeApplyResult FeeApplyResult, err error) {
return f.httpsPost("FeeApply", writeoffRequest) //uploadData, err := json.Marshal(&feeApply)
//if err != nil {
// return
//}
writeoffResponse, err := f.httpsPost("FeeApply", writeoffRequest)
if err != nil {
return
}
resultData, err := base64.StdEncoding.DecodeString(writeoffResponse.Result)
err = json.Unmarshal(resultData, &feeApplyResult)
return
} }
// SendObjDel 傳送服務紀錄刪除 // SendObjDel 傳送服務紀錄刪除
func (f *FeeAuditUtils) SendObjDel(writeoffRequest WriteoffRequest) (responseData []byte, err error) { func (f *FeeAuditUtils) SendObjDel(writeoffRequest WriteoffRequest) (err error) {
return f.httpsPost("ObjDel", writeoffRequest) //uploadData, err := json.Marshal(&objDel)
//if err != nil {
// return
//}
_, err = f.httpsPost("ObjDel", writeoffRequest)
return
} }
// SendAppCompletionNotice 傳送申報確認通知 // SendAppCompletionNotice 傳送申報確認通知
func (f *FeeAuditUtils) SendAppCompletionNotice(writeoffRequest WriteoffRequest) (responseData []byte, err error) { func (f *FeeAuditUtils) SendAppCompletionNotice(writeoffRequest WriteoffRequest) (err error) {
return f.httpsPost("appCompletionNotice", writeoffRequest) //uploadData, err := json.Marshal(&appCompletionNotice)
//if err != nil {
// return
//}
_, err = f.httpsPost("appCompletionNotice", writeoffRequest)
return
} }
// SendAppResultQuery 傳送「服務單位各分案審核狀態查詢」或「分案審核明細查詢」 // SendAppResultQuery 傳送「服務單位各分案審核狀態查詢」或「分案審核明細查詢」
func (f *FeeAuditUtils) SendAppResultQuery(writeoffRequest WriteoffRequest) (responseData []byte, err error) { func (f *FeeAuditUtils) SendAppResultQuery(writeoffRequest WriteoffRequest) (appResultQueryResult AppResultQueryResult, err error) {
return f.httpsPost("appResultQuery", writeoffRequest) //uploadData, err := json.Marshal(&appResultQuery)
//if err != nil {
// return
//}
writeoffResponse, err := f.httpsPost("appResultQuery", writeoffRequest)
if err != nil {
return
}
resultData, err := base64.StdEncoding.DecodeString(writeoffResponse.Result)
err = json.Unmarshal(resultData, &appResultQueryResult)
return
} }
// SendAppCancel 傳送撤回服務記錄 // SendAppCancel 傳送撤回服務記錄
func (f *FeeAuditUtils) SendAppCancel(writeoffRequest WriteoffRequest) (responseData []byte, err error) { func (f *FeeAuditUtils) SendAppCancel(writeoffRequest WriteoffRequest) (err error) {
return f.httpsPost("appCancel", writeoffRequest) //uploadData, err := json.Marshal(&appCancel)
//if err != nil {
// return
//}
_, err = f.httpsPost("appCancel", writeoffRequest)
return
} }
// SendCancelResultResponse 傳送取消交易單處理結果回報 // SendCancelResultResponse 傳送取消交易單處理結果回報
func (f *FeeAuditUtils) SendCancelResultResponse(writeoffRequest WriteoffRequest) (responseData []byte, err error) { func (f *FeeAuditUtils) SendCancelResultResponse(writeoffRequest WriteoffRequest) (err error) {
return f.httpsPost("CancelResultResponse", writeoffRequest) //uploadData, err := json.Marshal(&cancelResultResponse)
//if err != nil {
// return
//}
_, err = f.httpsPost("CancelResultResponse", writeoffRequest)
return
} }