作者 yangfu
正在显示 68 个修改的文件 包含 706 行增加15 行删除
version: v1
kind: HttpApi
metadata:
service: systemSetting
path: /system-settings
endpoints:
- method: updateSystemSetting
route:
put: /
- method: getSystemSetting
route:
post: /get
- method: listSystemSetting
route:
post: /search
... ...
version: v1
kind: Attribute
metadata:
name: pageIndex
description: 页码
type:
primitive: int
... ...
version: v1
kind: Attribute
metadata:
name: pageSize
description: 每页数量
type:
primitive: int
... ...
version: v1
kind: Attribute
metadata:
name: companyId
description: 企业id
type:
primitive: int64
... ...
version: v1
kind: Attribute
metadata:
name: controlLevel
description: 管控层级
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: description
description: 描述
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: settingCode
description: 设置对应的编码
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: settingName
description: 设置对应的名称
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: systemSettingId
description: 数据id
type:
primitive: int64
... ...
version: v1
kind: Attribute
metadata:
name: value
description: 设定的值
type:
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: valueType
description: 值类型
type:
primitive: string
... ...
swagger: "2.0"
info:
title: ""
description: 天联基础
contact:
name: ""
email: ""
home: ""
version: 0.0.1
paths: {}
definitions:
LoginAccessGetQrcodeForLoginResponseBody:
title: 'Mediatype identifier: LoginAccessGetQrcodeForLoginResponseBody'
type: object
properties:
authCode:
type: string
description: 登录认证的凭证
imgBase64:
type: string
description: base64形式的二维码图片
loginAccess:
$ref: '#/definitions/loginAccessResponseBody'
LoginAccessLoginByAccountRequestBody:
title: LoginAccessLoginByAccountRequestBody
type: object
properties:
account:
type: string
description: 账号
passwd:
type: string
description: 密码
LoginAccessLoginByAccountResponseBody:
title: 'Mediatype identifier: LoginAccessLoginByAccountResponseBody'
type: object
properties:
authcode:
type: string
description: 登录认证的凭证
loginAccess:
$ref: '#/definitions/loginAccessResponseBody'
LoginAccessLoginByScanQrcodeRequestBody:
title: LoginAccessLoginByScanQrcodeRequestBody
type: object
properties:
authCode:
type: string
description: 登录认证的凭证
LoginAccessLoginByScanQrcodeResponseBody:
title: 'Mediatype identifier: LoginAccessLoginByScanQrcodeResponseBody'
type: object
properties:
accessToken:
type: string
description: 真正的登录凭证
isLogin:
type: string
description: 是否可以登录
loginAccess:
$ref: '#/definitions/loginAccessResponseBody'
LoginAccessLoginBySmsCodeRequestBody:
title: LoginAccessLoginBySmsCodeRequestBody
type: object
properties:
phone:
type: string
description: 手机号
smsCode:
type: string
description: 短信验证码
LoginAccessLoginBySmsCodeResponseBody:
title: 'Mediatype identifier: LoginAccessLoginBySmsCodeResponseBody'
type: object
properties:
authcode:
type: string
description: 登录认证的凭证
loginAccess:
$ref: '#/definitions/loginAccessResponseBody'
LoginAccessLoginInfoByAuthCodeRequestBody:
title: LoginAccessLoginInfoByAuthCodeRequestBody
type: object
properties:
authCode:
type: string
description: 登录认证的凭证
companyId:
type: string
description: 公司id
organizationId:
type: string
description: 组织id
LoginAccessLoginInfoByAuthCodeResponseBody:
title: 'Mediatype identifier: LoginAccessLoginInfoByAuthCodeResponseBody'
type: object
properties:
accessToken:
type: string
description: 登录系统的凭证
loginAccess:
$ref: '#/definitions/loginAccessResponseBody'
loginAccessResponseBody:
title: loginAccessResponseBody
type: object
properties:
accessExpired:
type: integer
description: 登录凭证过期时间,时间戳精度秒
format: int64
accessToken:
type: string
description: 登录凭证存储
account:
type: string
description: 账号
companyId:
type: integer
description: 公司id
format: int64
createdTime:
type: string
description: 创建时间
format: datetime
organizationId:
type: integer
description: 组织id
format: int64
platform:
type: string
description: 对应平台
refreshExpired:
type: integer
description: 刷新登录凭证过期时间,时间戳精度秒
format: int64
refreshToken:
type: string
description: 刷新登录凭证
updatedTime:
type: string
description: 更新时间
format: datetime
description: 登录凭证存储
... ...
version: v1
kind: Schema
metadata:
name: systemSetting
description: 系统参数设置
attributes:
- ref: companyId
required: true
- ref: controlLevel
required: true
- ref: description
required: true
- ref: settingCode
required: true
- ref: settingName
required: true
- ref: systemSettingId
required: true
- ref: value
required: true
- ref: valueType
required: true
... ...
... ... @@ -5,9 +5,9 @@ metadata:
type: query
description: 返回数据字典设置列表
payload:
- ref: offset
- ref: pageIndex
required: true
- ref: limit
- ref: pageSize
required: true
result:
- ref: count
... ...
... ... @@ -9,14 +9,10 @@ metadata:
description: 接收方用户的id
type:
primitive: int64
- name: offset
description: 分页偏移量
type:
primitive: int64
- name: limit
description: 每页限制数量 默认20
type:
primitive: int64
- ref: pageIndex
required: true
- ref: pageSize
required: true
- name: isRead
description: 是否是已读
type:
... ...
... ... @@ -5,9 +5,9 @@ metadata:
type: query
description: 返回编排消息通知内容列表
payload:
- ref: offset
- ref: pageIndex
required: true
- ref: limit
- ref: pageSize
required: true
result:
- ref: count
... ...
version: v1
kind: Method
metadata:
name: getSystemSetting
type: query
description: 返回用户的系统设置
payload:
- ref: settingCode
required: true
- name: companyId
description: 企业id
type:
primitive: int64
result:
- name: systemSetting
type:
schema: systemSetting
required: true
... ...
version: v1
kind: Method
metadata:
name: listSystemSetting
type: query
description: 返回用户的系统设置列表
payload:
- name: companyId
description: 公司id
type:
primitive: int64
- ref: settingCode
result:
- name: systemSettings
type:
array: systemSetting
required: true
... ...
version: v1
kind: Method
metadata:
name: updateSystemSetting
type: command
description: 更新用户的系统设置
payload:
- ref: settingCode
required: true
- ref: companyId
required: true
result:
- name: systemSetting
type:
schema: systemSetting
required: true
... ...
version: v1
kind: Service
metadata:
name: systemSetting
description: 用户的系统设置
... ...
version: v1
kind: HttpApi
metadata:
service: cooperationContractUndertaker
path: /cooperation-contract-undertakers
endpoints:
- method: createCooperationContractUndertaker
route:
post: /
- method: updateCooperationContractUndertaker
route:
put: /{cooperationContractUndertakerId}
- method: getCooperationContractUndertaker
route:
get: /{cooperationContractUndertakerId}
- method: removeCooperationContractUndertaker
route:
delete: /{cooperationContractUndertakerId}
- method: listCooperationContractUndertaker
route:
get: /
params:
- name: offset
- name: limit
... ...
... ... @@ -19,6 +19,9 @@ metadata:
- method: searchDividendsOrder
route:
post: /search
- method: searchDividendsOrderNumber
route:
post: /search-order-number
- method: listDividendsOrders
route:
get: /
... ...
version: v1
kind: Attribute
metadata:
name: cooperationContractRelevantId
description: 共创合约相关人id
type:
primitive: int64
... ...
version: v1
kind: Attribute
metadata:
name: relevant
description: 相关人
type:
schema: relevant
... ...
version: v1
kind: Attribute
metadata:
name: cooperationContractUndertakerId
description: 共创合约承接人id
type:
primitive: int64
... ...
version: v1
kind: Attribute
metadata:
name: undertaker
description: 共创合约承接人
type:
schema: undertaker
... ...
... ... @@ -4,4 +4,4 @@ metadata:
name: dividendsOrderNumber
description: 分红订单号
type:
primitive: int64
primitive: string
... ...
version: v1
kind: Attribute
metadata:
name: moneyIcentivesRuleId
name: moneyIncentivesRuleId
description: 金额激励规则ID
type:
primitive: int64
... ...
func CreateCooperationContractUndertakerRepository(options map[string]interface{}) (domain.CooperationContractUndertakerRepository, error) {
var transactionContext *pg.TransactionContext
if value, ok := options["transactionContext"]; ok {
transactionContext = value.(*pg.TransactionContext)
}
return repository.NewCooperationContractUndertakerRepository(transactionContext)
}
\ No newline at end of file
... ...
package domain
// 共创合约承接人
type CooperationContractUndertaker struct {
}
type CooperationContractUndertakerRepository interface {
Save(cooperationContractUndertaker *CooperationContractUndertaker) (*CooperationContractUndertaker, error)
Remove(cooperationContractUndertaker *CooperationContractUndertaker) (*CooperationContractUndertaker, error)
FindOne(queryOptions map[string]interface{}) (*CooperationContractUndertaker, error)
Find(queryOptions map[string]interface{}) (int64, []*CooperationContractUndertaker, error)
}
func (cooperationContractUndertaker *CooperationContractUndertaker) Identify() interface{} {
if cooperationContractUndertaker.cooperationContractUndertakerId == 0 {
return nil
}
return cooperationContractUndertaker.cooperationContractUndertakerId
}
func (cooperationContractUndertaker *CooperationContractUndertaker) Update(data map[string]interface{}) error {
return nil
}
... ...
package models
type CooperationContractUndertaker struct {
tableName string `comment:"共创合约承接人" pg:"cooperation_contract_undertakers,alias:cooperation_contract_undertaker"`
}
... ...
package transform
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
)
func TransformToCooperationContractUndertakerDomainModelFromPgModels(cooperationContractUndertakerModel *models.CooperationContractUndertaker) (*domain.CooperationContractUndertaker, error) {
return &domain.CooperationContractUndertaker{}, nil
}
... ...
package repository
import (
"fmt"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"github.com/linmadan/egglib-go/utils/snowflake"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/transform"
)
type CooperationContractUndertakerRepository struct {
transactionContext *pgTransaction.TransactionContext
}
func (repository *CooperationContractUndertakerRepository) nextIdentify() (int64, error) {
IdWorker, err := snowflake.NewIdWorker(1)
if err != nil {
return 0, err
}
id, err := IdWorker.NextId()
return id, err
}
func (repository *CooperationContractUndertakerRepository) Save(cooperationContractUndertaker *domain.CooperationContractUndertaker) (*domain.CooperationContractUndertaker, error) {
sqlBuildFields := []string{}
insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields)
returningFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "cooperationContractUndertaker_id")
updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields)
tx := repository.transactionContext.PgTx
if cooperationContractUndertaker.Identify() == nil {
cooperationContractUndertakerId, err := repository.nextIdentify()
if err != nil {
return cooperationContractUndertaker, err
} else {
cooperationContractUndertaker.CooperationContractUndertakerId = cooperationContractUndertakerId
}
if _, err := tx.QueryOne(
pg.Scan(),
fmt.Sprintf("INSERT INTO cooperation_contract_undertakers (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
); err != nil {
return cooperationContractUndertaker, err
}
} else {
if _, err := tx.QueryOne(
pg.Scan(),
fmt.Sprintf("UPDATE cooperation_contract_undertakers SET %s WHERE cooperation_contract_undertaker_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
cooperationContractUndertaker.Identify(),
); err != nil {
return cooperationContractUndertaker, err
}
}
return cooperationContractUndertaker, nil
}
func (repository *CooperationContractUndertakerRepository) Remove(cooperationContractUndertaker *domain.CooperationContractUndertaker) (*domain.CooperationContractUndertaker, error) {
tx := repository.transactionContext.PgTx
cooperationContractUndertakerModel := new(models.CooperationContractUndertaker)
cooperationContractUndertakerModel.CooperationContractUndertakerId = cooperationContractUndertaker.Identify().(int64)
if _, err := tx.Model(cooperationContractUndertakerModel).WherePK().Delete(); err != nil {
return cooperationContractUndertaker, err
}
return cooperationContractUndertaker, nil
}
func (repository *CooperationContractUndertakerRepository) FindOne(queryOptions map[string]interface{}) (*domain.CooperationContractUndertaker, error) {
tx := repository.transactionContext.PgTx
cooperationContractUndertakerModel := new(models.CooperationContractUndertaker)
query := sqlbuilder.BuildQuery(tx.Model(cooperationContractUndertakerModel), queryOptions)
query.SetWhereByQueryOption("cooperation_contract_undertaker.cooperation_contract_undertaker_id = ?", "cooperationContractUndertakerId")
if err := query.First(); err != nil {
if err.Error() == "pg: no rows in result set" {
return nil, fmt.Errorf("没有此资源")
} else {
return nil, err
}
}
if cooperationContractUndertakerModel.CooperationContractUndertakerId == 0 {
return nil, nil
} else {
return transform.TransformToCooperationContractUndertakerDomainModelFromPgModels(cooperationContractUndertakerModel)
}
}
func (repository *CooperationContractUndertakerRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.CooperationContractUndertaker, error) {
tx := repository.transactionContext.PgTx
var cooperationContractUndertakerModels []*models.CooperationContractUndertaker
cooperationContractUndertakers := make([]*domain.CooperationContractUndertaker, 0)
query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractUndertakerModels), queryOptions)
query.SetOffsetAndLimit(20)
query.SetOrderDirect("cooperation_contract_undertaker_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, cooperationContractUndertakers, err
} else {
for _, cooperationContractUndertakerModel := range cooperationContractUndertakerModels {
if cooperationContractUndertaker, err := transform.TransformToCooperationContractUndertakerDomainModelFromPgModels(cooperationContractUndertakerModel); err != nil {
return 0, cooperationContractUndertakers, err
} else {
cooperationContractUndertakers = append(cooperationContractUndertakers, cooperationContractUndertaker)
}
}
return int64(count), cooperationContractUndertakers, nil
}
}
func NewCooperationContractUndertakerRepository(transactionContext *pgTransaction.TransactionContext) (*CooperationContractUndertakerRepository, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能为nil")
} else {
return &CooperationContractUndertakerRepository{
transactionContext: transactionContext,
}, nil
}
}
... ...
... ... @@ -4,6 +4,8 @@ metadata:
name: cooperationContractChangeLog
description: 共创合约变更日志
attributes:
- ref: cooperationContractChangeLogId
required: true
- ref: incentivesRule
required: true
- ref: incentivesRuleDetail
... ...
version: v1
kind: Schema
metadata:
name: cooperationContractRelevant
description: 共创合约相关人
attributes:
- ref: cooperationContractRelevantId
required: true
- ref: cooperationContractNumber
required: true
- ref: relevant
required: true
- ref: updatedAt
required: true
- ref: deletedAt
required: true
- ref: createdAt
required: true
... ...
version: v1
kind: Schema
metadata:
name: cooperationContractUndertaker
description: 共创合约承接人
attributes:
- ref: cooperationContractUndertakerId
required: true
- ref: cooperationContractNumber
required: true
- ref: undertaker
required: true
- ref: createdAt
required: true
- ref: updatedAt
required: true
- ref: deletedAt
required: true
... ...
... ... @@ -25,7 +25,7 @@ metadata:
description: 参与人uid,包括承接人、推荐人、关联业务员
required: true
type:
array: int64
schema: participator
- ref: paymentDocumentAttachment
description: 支付凭证附件
required: true
... ...
version: v1
kind: Schema
metadata:
name: participator
description: 共创参与人
attributes:
- ref: userId
required: true
- ref: userBaseId
required: true
- ref: org
description: 用户所属的组织机构
required: true
- ref: orgs
description: 用户关联的组织机构
required: true
- ref: department
description: 用户所属的部门
required: true
- ref: role
required: true
- ref: userInfo
required: true
- ref: userType
required: true
- ref: status
required: true
- ref: company
required: true
\ No newline at end of file
... ...
version: v1
kind: Method
metadata:
name: createCooperationContractUndertaker
type: command
description: 创建
result:
- name: cooperationContractUndertaker
type:
schema: cooperationContractUndertaker
required: true
... ...
version: v1
kind: Method
metadata:
name: getCooperationContractUndertaker
type: query
description: 返回
payload:
- ref: cooperationContractUndertakerId
required: true
result:
- name: cooperationContractUndertaker
type:
schema: cooperationContractUndertaker
required: true
... ...
version: v1
kind: Method
metadata:
name: listCooperationContractUndertaker
type: query
description: 返回列表
payload:
- ref: offset
required: true
- ref: limit
required: true
result:
- ref: count
required: true
- name: cooperationContractUndertakers
type:
array: cooperationContractUndertaker
required: true
... ...
version: v1
kind: Method
metadata:
name: removeCooperationContractUndertaker
type: command
description: 移除
payload:
- ref: cooperationContractUndertakerId
required: true
result:
- name: cooperationContractUndertaker
type:
schema: cooperationContractUndertaker
required: true
... ...
version: v1
kind: Method
metadata:
name: updateCooperationContractUndertaker
type: command
description: 更新
payload:
- ref: cooperationContractUndertakerId
required: true
result:
- name: cooperationContractUndertaker
type:
schema: cooperationContractUndertaker
required: true
... ...
version: v1
kind: Service
metadata:
name: cooperationContractUndertaker
description:
... ...
... ... @@ -5,6 +5,8 @@ metadata:
type: command
description: 更新共创模式服务
payload:
- ref: cooperationModeId
required: true
- ref: cooperationModeName
required: true
- ref: cooperationModeNumber
... ...
... ... @@ -5,6 +5,8 @@ metadata:
type: command
description: 更新共创项目服务
payload:
- ref: cooperationProjectId
required: true
- ref: cooperationProjectName
required: true
- ref: cooperationProjectUndertakerType
... ...
... ... @@ -20,3 +20,4 @@ metadata:
type:
schema: creditAccount
required: true
\ No newline at end of file
... ...
... ... @@ -5,6 +5,8 @@ metadata:
type: command
description: 更新业绩分红激励规则服务
payload:
- ref: dividendsIncentivesRuleId
required: true
- ref: cooperationContractNumber
required: true
- ref: dividendsIncentivesPercentage
... ...
version: v1
kind: Method
metadata:
name: searchDividendsOrderNumber
type: query
description: 查询分红订单方法
payload:
- ref: dividendsOrderNumber
required: false
- ref: companyId
required: true
- ref: orgId
required: true
- ref: userId
required: true
result:
- ref: dividendsOrderNumber
description: 返回分红订单号
required: true
... ...
... ... @@ -5,6 +5,8 @@ metadata:
type: command
description: 更新分红订单实体对象
payload:
- ref: dividendsOrderId
required: true
- ref: customerName
required: true
- ref: dividendsOrderAmount
... ...
... ... @@ -5,6 +5,8 @@ metadata:
type: command
description: 更新分红退货单服务
payload:
- ref: dividendsReturnedOrderId
required: true
- ref: dividendsReturnedOrderRefund
required: true
- ref: dividendsReturnedCustomerName
... ...
... ... @@ -5,6 +5,8 @@ metadata:
type: command
description: 更新项目金额激励规则服务
payload:
- ref: moneyIncentivesRuleId
required: true
- ref: moneyIncentivesStageEnd
required: true
- ref: moneyIncentivesStageStart
... ...