f
This commit is contained in:
@@ -489,21 +489,21 @@ type IVYZ2A8BReq struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type QYGL4YABReq struct {
|
type QYGL4YABReq struct {
|
||||||
EntName string `json:"ent_name" validate:"required,min=1,validEnterpriseName"`
|
EntName string `json:"ent_name" validate:"required,min=1,validEnterpriseName"`
|
||||||
EntCode string `json:"ent_code" validate:"required,validUSCI"`
|
LegalPerson string `json:"legal_person" validate:"required,min=1,validName"`
|
||||||
IDCard string `json:"id_card" validate:"required,validIDCard"`
|
EntCode string `json:"ent_code" validate:"required,validUSCI"`
|
||||||
Name string `json:"name" validate:"required,min=1,validName"`
|
IDCard string `json:"id_card" validate:"required,validIDCard"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type QYGL3YSBReq struct {
|
type QYGL3YSBReq struct {
|
||||||
Name string `json:"name" validate:"required,min=1,validName"`
|
EntName string `json:"ent_name" validate:"required,min=1,validEnterpriseName"`
|
||||||
EntCode string `json:"ent_code" validate:"required,validUSCI"`
|
LegalPerson string `json:"legal_person" validate:"required,min=1,validName"`
|
||||||
EntName string `json:"ent_name" validate:"required,min=1,validEnterpriseName"`
|
EntCode string `json:"ent_code" validate:"required,validUSCI"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type QYGL2YSBReq struct {
|
type QYGL2YSBReq struct {
|
||||||
EntCode string `json:"ent_code" validate:"required,validUSCI"`
|
LegalPerson string `json:"legal_person" validate:"required,min=1,validName"`
|
||||||
Name string `json:"name" validate:"required,min=1,validName"`
|
EntCode string `json:"ent_code" validate:"required,validUSCI"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type IVYZ7C9DReq struct {
|
type IVYZ7C9DReq struct {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func ProcessQYGL2YSBRequest(ctx context.Context, params []byte, deps *processors
|
|||||||
return nil, errors.Join(processors.ErrInvalidParam, err)
|
return nil, errors.Join(processors.ErrInvalidParam, err)
|
||||||
}
|
}
|
||||||
reqFormData := map[string]interface{}{
|
reqFormData := map[string]interface{}{
|
||||||
"legalPerson": paramsDto.Name,
|
"legalPerson": paramsDto.LegalPerson,
|
||||||
"creditNo": paramsDto.EntCode,
|
"creditNo": paramsDto.EntCode,
|
||||||
}
|
}
|
||||||
apiPath := "/v4/company/two/check" // 接口路径,根据数脉文档填写(如 v4/xxx)
|
apiPath := "/v4/company/two/check" // 接口路径,根据数脉文档填写(如 v4/xxx)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func ProcessQYGL3YSBRequest(ctx context.Context, params []byte, deps *processors
|
|||||||
return nil, errors.Join(processors.ErrInvalidParam, err)
|
return nil, errors.Join(processors.ErrInvalidParam, err)
|
||||||
}
|
}
|
||||||
reqFormData := map[string]interface{}{
|
reqFormData := map[string]interface{}{
|
||||||
"legalPerson": paramsDto.Name,
|
"legalPerson": paramsDto.LegalPerson,
|
||||||
"companyName": paramsDto.EntName,
|
"companyName": paramsDto.EntName,
|
||||||
"creditNo": paramsDto.EntCode,
|
"creditNo": paramsDto.EntCode,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ func ProcessQYGL4YABRequest(ctx context.Context, params []byte, deps *processors
|
|||||||
}
|
}
|
||||||
reqFormData := map[string]interface{}{
|
reqFormData := map[string]interface{}{
|
||||||
"idCard": paramsDto.IDCard,
|
"idCard": paramsDto.IDCard,
|
||||||
"legalPerson": paramsDto.Name,
|
"legalPerson": paramsDto.LegalPerson,
|
||||||
"companyName": paramsDto.EntName,
|
"companyName": paramsDto.EntName,
|
||||||
"creditNo": paramsDto.EntCode,
|
"creditNo": paramsDto.EntCode,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -449,8 +449,8 @@ func (s *ProductManagementService) GetAllProductsForDictionary(ctx context.Conte
|
|||||||
|
|
||||||
options := interfaces.ListOptions{
|
options := interfaces.ListOptions{
|
||||||
Page: 1,
|
Page: 1,
|
||||||
PageSize: 1000, // 获取所有产品
|
PageSize: 1000, // 获取所有产品
|
||||||
Sort: "sort", // 使用 products 表的 sort 字段,排序后再按分类分组
|
Sort: "category.sort", // 按分类的排序字段排序
|
||||||
Order: "asc",
|
Order: "asc",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,20 +461,5 @@ func (s *ProductManagementService) GetAllProductsForDictionary(ctx context.Conte
|
|||||||
return nil, fmt.Errorf("获取产品字典数据失败: %w", err)
|
return nil, fmt.Errorf("获取产品字典数据失败: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 预加载分类信息
|
|
||||||
for _, product := range products {
|
|
||||||
if product.CategoryID != "" {
|
|
||||||
category, _ := s.categoryRepo.GetByID(ctx, product.CategoryID)
|
|
||||||
product.Category = &category
|
|
||||||
}
|
|
||||||
|
|
||||||
if product.SubCategoryID != nil && *product.SubCategoryID != "" {
|
|
||||||
subCategory, err := s.subCategoryRepo.GetByID(ctx, *product.SubCategoryID)
|
|
||||||
if err == nil && subCategory != nil {
|
|
||||||
product.SubCategory = subCategory
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return products, nil
|
return products, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ func (r *GormProductRepository) ListProducts(ctx context.Context, query *queries
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 预加载分类信息并获取数据
|
// 预加载分类信息并获取数据
|
||||||
if err := dbQuery.Preload("Category").Find(&productEntities).Error; err != nil {
|
if err := dbQuery.Preload("Category").Preload("SubCategory").Find(&productEntities).Error; err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user