|
@@ -1,119 +0,0 @@
|
|
-package tripartite
|
|
|
|
-
|
|
|
|
-import (
|
|
|
|
- "context"
|
|
|
|
- "fmt"
|
|
|
|
- "github.com/gogf/gf/v2/errors/gerror"
|
|
|
|
- "github.com/gogf/gf/v2/frame/g"
|
|
|
|
- "github.com/gogf/gf/v2/util/gconv"
|
|
|
|
-)
|
|
|
|
-
|
|
|
|
-type Billitem struct {
|
|
|
|
- Name string `json:"name"` //税收分类名称(接口中获取)
|
|
|
|
- Ssflbm string `json:"ssflbm"` //税收分类编码(接口中获取)
|
|
|
|
- Thirdid string `json:"thirdid"` //开票项id 自己定义的唯一id
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// GetTaxList 返回内容 allTaxCode.json
|
|
|
|
-func GetTaxList() error {
|
|
|
|
- err := CommonDoPost("/index_taxcode/getTaxCodeList",
|
|
|
|
- getFormHeaderWithToken(),
|
|
|
|
- nil,
|
|
|
|
- func(i interface{}) error {
|
|
|
|
- g.Dump(i)
|
|
|
|
- return nil
|
|
|
|
- })
|
|
|
|
- if err != nil {
|
|
|
|
- return gerror.Wrap(err, "Demo")
|
|
|
|
- }
|
|
|
|
- return nil
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// AddTaxCode 开票项增加
|
|
|
|
-func AddTaxCode(items []Billitem) error {
|
|
|
|
- type AddTaxCodeParam struct {
|
|
|
|
- TaxNum string `json:"taxNum"`
|
|
|
|
- Tel string `json:"tel"`
|
|
|
|
- BillItems []Billitem `json:"billitems"`
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- var (
|
|
|
|
- ctx = context.Background()
|
|
|
|
- param = AddTaxCodeParam{
|
|
|
|
- TaxNum: g.Cfg().MustGet(ctx, "company.taxNum").String(),
|
|
|
|
- Tel: g.Cfg().MustGet(ctx, "company.tel").String(),
|
|
|
|
- BillItems: items,
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
- err := CommonDoPost("/index_taxcode/addTaxCode",
|
|
|
|
- getJsonHeaderWithToken(),
|
|
|
|
- gconv.Map(gconv.String(param)),
|
|
|
|
- nil)
|
|
|
|
- if err != nil {
|
|
|
|
- return gerror.Wrap(err, "Demo")
|
|
|
|
- }
|
|
|
|
- return err
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// GetSuccessTaxCodeList 查询已维护的开票项
|
|
|
|
-func GetSuccessTaxCodeList() ([]map[string]interface{}, error) {
|
|
|
|
- type (
|
|
|
|
- billItem struct {
|
|
|
|
- Code string `json:"code"`
|
|
|
|
- Name string `json:"name"`
|
|
|
|
- Uuid string `json:"uuid"`
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
- var (
|
|
|
|
- ctx = context.Background()
|
|
|
|
- billItems []billItem
|
|
|
|
- )
|
|
|
|
- g.Dump(g.MapStrAny{
|
|
|
|
- "taxNum": g.Cfg().MustGet(ctx, "company.taxNum"),
|
|
|
|
- })
|
|
|
|
- err := CommonDoPost("/index_taxcode/getCompanyTaxCodeList",
|
|
|
|
- getFormHeaderWithToken(),
|
|
|
|
- g.MapStrAny{
|
|
|
|
- "taxNum": g.Cfg().MustGet(ctx, "company.taxNum"),
|
|
|
|
- },
|
|
|
|
- func(i interface{}) error {
|
|
|
|
- return gconv.Struct(i, &billItems)
|
|
|
|
- })
|
|
|
|
- if err != nil {
|
|
|
|
- return nil, gerror.Wrap(err, "查询已维护的开票项异常")
|
|
|
|
- }
|
|
|
|
- return gconv.Maps(billItems), nil
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// DelTaxCode 删除开票项
|
|
|
|
-func DelTaxCode(uuid string) error {
|
|
|
|
- type (
|
|
|
|
- delItem struct {
|
|
|
|
- UUid string `json:"uuid"`
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- AddTaxCodeParam struct {
|
|
|
|
- TaxNum string `json:"taxNum"`
|
|
|
|
- Tel string `json:"tel"`
|
|
|
|
- BillItems []delItem `json:"billitems"`
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
-
|
|
|
|
- var (
|
|
|
|
- ctx = context.Background()
|
|
|
|
- param = AddTaxCodeParam{
|
|
|
|
- TaxNum: g.Cfg().MustGet(ctx, "company.taxNum").String(),
|
|
|
|
- Tel: g.Cfg().MustGet(ctx, "company.tel").String(),
|
|
|
|
- BillItems: []delItem{{UUid: uuid}},
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
- fmt.Println(gconv.String(param))
|
|
|
|
- err := CommonDoPost("/index_taxcode/delTaxCode",
|
|
|
|
- getJsonHeaderWithToken(),
|
|
|
|
- gconv.Map(gconv.String(param)),
|
|
|
|
- nil)
|
|
|
|
- if err != nil {
|
|
|
|
- return gerror.Wrap(err, "删除开票项异常")
|
|
|
|
- }
|
|
|
|
- return err
|
|
|
|
-}
|
|
|