解决冲突

This commit is contained in:
jhc 2023-04-27 13:49:33 +08:00
commit 1e91eb3b7d
13 changed files with 1240 additions and 243 deletions

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,9 @@ service Approval {
rpc AllType(CommonRequest) returns (AllTypeResponse) {};
rpc RemoveType(RemoveRequest) returns (StatusResponse) {};
rpc AllGroup(CommonRequest) returns (AllGroupResponse) {};
//
rpc GetName(GetNameRequest) returns (GetNameResponse) {};
}
message CommonResponse {
@ -280,6 +283,7 @@ message ArtExhibitionDetail {
uint64 IsShow = 12 ;
string ShowTime = 13;
string Address = 14 ;
string Agent = 15 ;
}
message BundlePayPrice {
@ -326,6 +330,7 @@ message CreateRequest {
string TypeName = 28 [json_name = "typeName"];
string GroupName = 29 [json_name = "groupName"];
BundlePayPrice BundlePayPrice = 30 [json_name = "bundlePayPrice"];
FinancialForm FinancialForm = 31 [json_name = "financialForm"];
}
message WorkFlow {
@ -415,4 +420,52 @@ message DetailSettingRequest {
message SettingResponse {
uint64 ID=1 [json_name = "ID"];
bool Success=2 [json_name = "success"];
}
//
message GetNameRequest {
string SettingType = 1 [json_name = "settingType"];
}
message GetNameResponse {
repeated string Name = 1 [json_name = "name"];
}
message FinancialForm {
uint64 ID=1 [json_name = "ID"];
uint64 DeletedAt=2 [json_name = "deletedAt"];
string CreatedAt=3 [json_name = "createdAt"];
string UpdatedAt=4 [json_name = "updatedAt"];
uint64 ApprovalID=5 [json_name = "approvalID"];
string PaymentCompany = 6 [json_name = "paymentCompany"];
string TransactionDepartment = 7 [json_name = "transactionDepartment"];
string Payee = 8 [json_name = "payee"];
string BeneficiaryBank = 9 [json_name = "beneficiaryBank"];
string BankNo = 10 [json_name = "bankNo"];
repeated CostInfo CostInfo = 11 [json_name = "costInfo"];
string PaymentMethod = 12 [json_name = "paymentMethod"];
repeated InvoiceInfo InvoiceInfo = 13 [json_name = "invoiceInfo"];
}
message CostInfo {
string Description = 1 [json_name = "description"];
string UnitPrice = 2 [json_name = "unitPrice"];
string CostUnit = 3 [json_name = "costUnit"];
int64 CostNum = 4 [json_name = "costNum"];
string TotalPrice = 5 [json_name = "totalPrice"];
string UsedDepartment = 6 [json_name = "usedDepartment"];
}
message InvoiceInfo {
string InvoiceDate = 1 [json_name = "invoiceDate"];
string InvoiceNo = 2 [json_name = "invoiceNo"];
string InvoiceProvider = 3 [json_name = "invoiceProvider"];
string Amount = 4 [json_name = "amount"];
string UseTo = 5 [json_name = "useTo"];
string Applicant = 6 [json_name = "applicant"];
string PaymentMethod = 7 [json_name = "paymentMethod"];
string PaymentObj = 8 [json_name = "paymentObj"];
string InvoiceType = 9 [json_name = "invoiceType"];
string Notes = 10 [json_name = "notes"];
}

View File

@ -263,6 +263,11 @@ func (this *CreateRequest) Validate() error {
return github_com_mwitkow_go_proto_validators.FieldError("BundlePayPrice", err)
}
}
if this.FinancialForm != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.FinancialForm); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("FinancialForm", err)
}
}
return nil
}
func (this *WorkFlow) Validate() error {
@ -325,3 +330,32 @@ func (this *DetailSettingRequest) Validate() error {
func (this *SettingResponse) Validate() error {
return nil
}
func (this *GetNameRequest) Validate() error {
return nil
}
func (this *GetNameResponse) Validate() error {
return nil
}
func (this *FinancialForm) Validate() error {
for _, item := range this.CostInfo {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("CostInfo", err)
}
}
}
for _, item := range this.InvoiceInfo {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("InvoiceInfo", err)
}
}
}
return nil
}
func (this *CostInfo) Validate() error {
return nil
}
func (this *InvoiceInfo) Validate() error {
return nil
}

View File

@ -50,6 +50,8 @@ type ApprovalClient interface {
AllType(ctx context.Context, in *CommonRequest, opts ...grpc_go.CallOption) (*AllTypeResponse, common.ErrorWithAttachment)
RemoveType(ctx context.Context, in *RemoveRequest, opts ...grpc_go.CallOption) (*StatusResponse, common.ErrorWithAttachment)
AllGroup(ctx context.Context, in *CommonRequest, opts ...grpc_go.CallOption) (*AllGroupResponse, common.ErrorWithAttachment)
// 财务报表审批
GetName(ctx context.Context, in *GetNameRequest, opts ...grpc_go.CallOption) (*GetNameResponse, common.ErrorWithAttachment)
}
type approvalClient struct {
@ -79,6 +81,7 @@ type ApprovalClientImpl struct {
AllType func(ctx context.Context, in *CommonRequest) (*AllTypeResponse, error)
RemoveType func(ctx context.Context, in *RemoveRequest) (*StatusResponse, error)
AllGroup func(ctx context.Context, in *CommonRequest) (*AllGroupResponse, error)
GetName func(ctx context.Context, in *GetNameRequest) (*GetNameResponse, error)
}
func (c *ApprovalClientImpl) GetDubboStub(cc *triple.TripleConn) ApprovalClient {
@ -225,6 +228,12 @@ func (c *approvalClient) AllGroup(ctx context.Context, in *CommonRequest, opts .
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/AllGroup", in, out)
}
func (c *approvalClient) GetName(ctx context.Context, in *GetNameRequest, opts ...grpc_go.CallOption) (*GetNameResponse, common.ErrorWithAttachment) {
out := new(GetNameResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetName", in, out)
}
// ApprovalServer is the server API for Approval service.
// All implementations must embed UnimplementedApprovalServer
// for forward compatibility
@ -251,6 +260,8 @@ type ApprovalServer interface {
AllType(context.Context, *CommonRequest) (*AllTypeResponse, error)
RemoveType(context.Context, *RemoveRequest) (*StatusResponse, error)
AllGroup(context.Context, *CommonRequest) (*AllGroupResponse, error)
// 财务报表审批
GetName(context.Context, *GetNameRequest) (*GetNameResponse, error)
mustEmbedUnimplementedApprovalServer()
}
@ -325,6 +336,9 @@ func (UnimplementedApprovalServer) RemoveType(context.Context, *RemoveRequest) (
func (UnimplementedApprovalServer) AllGroup(context.Context, *CommonRequest) (*AllGroupResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AllGroup not implemented")
}
func (UnimplementedApprovalServer) GetName(context.Context, *GetNameRequest) (*GetNameResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetName not implemented")
}
func (s *UnimplementedApprovalServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
@ -991,6 +1005,35 @@ func _Approval_AllGroup_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler)
}
func _Approval_GetName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetNameRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("GetName", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
// Approval_ServiceDesc is the grpc_go.ServiceDesc for Approval service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -1086,6 +1129,10 @@ var Approval_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "AllGroup",
Handler: _Approval_AllGroup_Handler,
},
{
MethodName: "GetName",
Handler: _Approval_GetName_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "api/approval/approval.proto",

View File

@ -51,6 +51,7 @@ type Approval struct {
BundlePayPrice *BundlePayPrice `gorm:"foreignKey:ApprovalID" json:"BundlePayPrice"` //关联的type
ExhibitionReward *ExhibitionReward `gorm:"foreignKey:ApprovalID" json:"ExhibitionReward"` //关联的type
ApprovalWorkFlows []*ApprovalWorkFlow `gorm:"foreignKey:ApprovalID" json:"ApprovalWorkFlows"`
FinancialForm *FinancialForm `gorm:"foreignKey:ApprovalID" json:"financialForm"`
}
func (j *KeyInfos) Scan(src interface{}) error {
@ -72,6 +73,7 @@ const (
TypeBundle = "bundle"
TypeBundlePayPrice = "bundlePayPrice"
TypeArtExhibitionReward = "artExhibitionReward"
TypeFinancialForm = "financialFormApply"
)
const (
StatusDoing = 1
@ -532,10 +534,9 @@ func MyAllWorkApprovals(in *approval.ListRequest) ([]*Approval, int64) {
Preload("BundlePayPrice").
Preload("ApprovalType.ApprovalTypeGroup").
Preload("ExhibitionReward.ApprovalExhibitions").
Preload("ApprovalWorkFlows", func(db *gorm.DB) *gorm.DB {
return db.Order("level asc")
}).
Preload("Exhibition.ApprovalExhibitions")
Preload("ApprovalWorkFlows").
Preload("Exhibition.ApprovalExhibitions").
Preload("FinancialForm")
//我未阅读的和我未操作的
DB.Model(&Approval{}).Where(&Approval{Type: in.Type}).Where(&Approval{NowUserId: in.UserID, Status: StatusDoing}).Order("id desc").Select("id").Find(&ids)
@ -572,7 +573,8 @@ func MyApprovalWorkApprovals(in *approval.ListRequest) ([]*Approval, int64) {
Preload("BundlePayPrice").
Preload("ApprovalType.ApprovalTypeGroup").
Preload("ApprovalWorkFlows").
Preload("Exhibition.ApprovalExhibitions")
Preload("Exhibition.ApprovalExhibitions").
Preload("FinancialForm")
if in.Type != "" {
modelObj = modelObj.Where(&Approval{Type: in.Type})
@ -629,7 +631,8 @@ func MyWorkApprovals(in *approval.ListRequest) ([]*Approval, int64) {
Preload("ApprovalType.ApprovalTypeGroup").
Preload("ExhibitionReward.ApprovalExhibitions").
Preload("ApprovalWorkFlows").
Preload("Exhibition.ApprovalExhibitions")
Preload("Exhibition.ApprovalExhibitions").
Preload("FinancialForm")
if in.Type != "" {
modelObj = modelObj.Where(&Approval{Type: in.Type})
@ -687,7 +690,8 @@ func MySubmitApprovals(in *approval.ListRequest) ([]*Approval, int64) {
}).
Preload("ExhibitionReward.ApprovalExhibitions").
Preload("ApprovalType.ApprovalTypeGroup").
Preload("Exhibition.ApprovalExhibitions")
Preload("Exhibition.ApprovalExhibitions").
Preload("FinancialForm")
if in.Status != 0 {
modelObj = modelObj.Where(&Approval{Status: int8(in.Status)})
@ -719,7 +723,8 @@ func MyReadApprovals(in *approval.ListRequest) ([]*Approval, int64) {
Preload("ApprovalWorkFlows").
Preload("ExhibitionReward.ApprovalExhibitions").
Preload("ApprovalType.ApprovalTypeGroup").
Preload("Exhibition.ApprovalExhibitions")
Preload("Exhibition.ApprovalExhibitions").
Preload("FinancialForm")
if in.Type != "" {
modelObj = modelObj.Where(&Approval{Type: in.Type})
@ -807,6 +812,8 @@ func getApprovalContentFactory(typeFiled string) (ApprovalContentInterface, erro
return &BundlePayPrice{}, nil
case TypeArtExhibitionReward:
return &ExhibitionReward{}, nil
case TypeFinancialForm:
return &FinancialForm{}, nil
default:
return &Approval{}, nil
}

View File

@ -23,6 +23,7 @@ type ArtExhibitionDetail struct {
IsShow uint64
ShowTime string
Address string
Agent string
}
type Artwork struct {

View File

@ -39,6 +39,24 @@ var TypeMap = map[string]string{
"show": "",
TypeBundlePayPrice: "",
TypeArtExhibitionReward: "",
"leave": "", // 事假
"sick": "", // 病假
"annualLeave": "", // 年假
"dayOff": "", // 调休
"maritalLeave": "", // 婚假
"matingCheckLeave": "", // 孕检假
"maternityLeave": "", // 产假
"paternityLeave": "", // 陪产假
"parentalLeave": "", // 育儿假
"nursingLeave": "", // 独生子女护理假
"funeralLeave": "", // 丧假
"makeUp": "", // 补卡
"overTime": "", // 加班
"outWork": "", // 外勤
"turnover": "", // 离职
"financialFormApply": "", // 财务表单审批
}
var keyWordMap = map[string]string{
@ -49,6 +67,22 @@ var keyWordMap = map[string]string{
"画展审批": "show",
"画展包付款单申请": TypeBundlePayPrice,
"画作润格审批": TypeArtExhibitionReward,
"事假": "leave", // 事假
"病假": "sick", // 病假
"年假": "annualLeave", // 年假
"调休": "dayOff", // 调休
"婚假": "maritalLeave", // 婚假
"孕检假": "matingCheckLeave", // 孕检假
"产假": "maternityLeave", // 产假
"陪产假": "paternityLeave", // 陪产假
"育儿假": "parentalLeave", // 育儿假
"独生子女护理假": "nursingLeave", // 独生子女护理假
"丧假": "funeralLeave", // 丧假
"补卡": "makeUp", // 补卡
"加班": "overTime", // 加班
"外勤": "outWork", // 外勤
"离职": "turnover", // 离职
"财务表单审批": "financialFormApply", // 财务表单审批
}
func DataExist(domain, keyWork, title string) bool {

View File

@ -95,6 +95,7 @@ func (m *Exhibition) SaveApprovalContent(in *approval.CreateRequest, a *Approval
IsShow: approvalExhibition.ArtExhibitionDetail.IsShow,
ShowTime: approvalExhibition.ArtExhibitionDetail.ShowTime,
Address: approvalExhibition.ArtExhibitionDetail.Address,
Agent: approvalExhibition.ArtExhibitionDetail.Agent,
}
}
@ -274,6 +275,7 @@ func (m *Exhibition) BuildResContent(a *Approval, request *approval.CreateReques
IsShow: one.ArtExhibitionDetail.IsShow,
ShowTime: one.ArtExhibitionDetail.ShowTime,
Address: one.ArtExhibitionDetail.Address,
Agent: one.ArtExhibitionDetail.Agent,
}
//画作详情

152
pkg/model/financial_form.go Normal file
View File

@ -0,0 +1,152 @@
package model
import (
"errors"
"github.com/fonchain_enterprise/fonchain-approval/api/approval"
m2 "github.com/fonchain_enterprise/fonchain-approval/pkg/m"
"github.com/jinzhu/copier"
"gorm.io/plugin/soft_delete"
"time"
)
type FinancialForm struct {
ID uint64 `gorm:"primaryKey;column:id" json:"id"` // ID
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at" json:"deletedAt"` // 删除时间
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"` // 创建时间
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
ApprovalID uint64 `gorm:"primaryKey;column:approval_id" json:"approvalId"` // 关联申请的ID
PaymentCompany string `json:"paymentCompany" gorm:"column:payment_company;type:varchar(2048);comment:付款公司别"`
TransactionDepartment string `json:"transactionDepartment" gorm:"column:transaction_department;type:varchar(255);comment:经办部门"`
Payee string `json:"payee" gorm:"column:payee;type:varchar(2048);comment:收款人全称"`
BeneficiaryBank string `json:"beneficiaryBank" gorm:"column:beneficiary_bank;type:varchar(1024);comment:收款人开户行"`
BankNo string `json:"bankNo" gorm:"column:bank_no;type:varchar(1024);comment:收款人账号"`
CostInfo []*CostInfo `json:"costInfo" gorm:"column:cost_info;type:json;serializer:json;comment:费用说明"`
PaymentMethod string `json:"paymentMethod" gorm:"column:payment_method;type:varchar(255);comment:付款方式"`
InvoiceInfo []*InvoiceInfo `json:"invoiceInfo" gorm:"column:invoice_info;type:json;serializer:json;comment:发票信息"`
}
type CostInfo struct {
Description string `json:"description" gorm:"column:description;type:text;comment:说明"`
UnitPrice string `json:"unitPrice" gorm:"column:unit_price;type:varchar(255);comment:费用单价"`
CostUnit string `json:"costUnit" gorm:"column:cost_unit;type:varchar(255);comment:费用单位"`
CostNum int64 `json:"costNum" gorm:"column:cost_num;type:int;comment:费用数量"`
TotalPrice string `json:"totalPrice" gorm:"column:total_price;type:varchar(255);comment:费用总额"`
UsedDepartment string `json:"usedDepartment" gorm:"column:used_department;type:varchar(2048);comment:使用部门"`
}
type InvoiceInfo struct {
InvoiceDate string `json:"invoiceDate" gorm:"column:invoice_date;type:varchar(255);comment:发票日期"`
InvoiceNo string `json:"invoiceNo" gorm:"column:invoice_no;type:varchar(255);comment:发票号码"`
InvoiceProvider string `json:"invoiceProvider" gorm:"column:invoice_provider;type:varchar(1024);comment:发票提供者"`
Amount string `json:"amount" gorm:"column:amount;type:varchar(255);comment:发票或付款金额"`
UseTo string `json:"useTo" gorm:"column:use_to;type:varchar(1024);comment:用途"`
Applicant string `json:"applicant" gorm:"column:applicant;varchar(255);comment:申请人"`
PaymentMethod string `json:"paymentMethod" gorm:"column:payment_method;type:varchar(255);comment:付款方式"`
PaymentObj string `json:"paymentObj" gorm:"column:payment_obj;type:varchar(255);comment:付款或报销对象"`
InvoiceType string `json:"invoiceType" gorm:"column:invoice_type;type:varchar(255);comment:发票类型"`
Notes string `json:"notes" gorm:"column:notes;type:text;comment:备注"`
}
// TableName get sql table name.获取数据库表名
func (m *FinancialForm) TableName() string {
return "financial_form"
}
func (m *FinancialForm) GetApproval(id uint64) (*Approval, error) {
var entity *Approval
if err := DB.
Preload("ApprovalWorkFlows").
Preload("ApprovalType").
Preload("FinancialForm").
First(&entity, id).Error; err != nil {
return entity, err
}
return entity, nil
}
func (m *FinancialForm) SaveApprovalContent(in *approval.CreateRequest, a *Approval) error {
copier.CopyWithOption(&m, in.FinancialForm, copier.Option{DeepCopy: true})
m.ApprovalID = a.ID
costInfos := make([]*CostInfo, 0)
for i := 0; i < len(in.FinancialForm.CostInfo); i++ {
costInfo := new(CostInfo)
copier.CopyWithOption(&costInfo, in.FinancialForm.CostInfo[i], copier.Option{DeepCopy: true})
costInfos = append(costInfos, costInfo)
}
m.CostInfo = costInfos
invoiceInfos := make([]*InvoiceInfo, 0)
for i := 0; i < len(in.FinancialForm.InvoiceInfo); i++ {
invoiceInfo := new(InvoiceInfo)
copier.CopyWithOption(&invoiceInfo, in.FinancialForm.InvoiceInfo[i], copier.Option{DeepCopy: true})
invoiceInfos = append(invoiceInfos, invoiceInfo)
}
m.InvoiceInfo = invoiceInfos
return DB.Create(&m).Error
}
func (m *FinancialForm) UpdateApprovalContent(in *approval.CreateRequest, a *Approval) error {
var entity *FinancialForm
if err := DB.Where(&FinancialForm{ApprovalID: a.ID}).First(&entity).Error; err != nil {
return errors.New(m2.ErrorNotFound)
}
copier.CopyWithOption(&m, in.FinancialForm, copier.Option{DeepCopy: true})
m.ID = entity.ID
costInfos := make([]*CostInfo, 0)
for i := 0; i < len(in.FinancialForm.CostInfo); i++ {
costInfo := new(CostInfo)
copier.CopyWithOption(&costInfo, in.FinancialForm.CostInfo[i], copier.Option{DeepCopy: true})
costInfos = append(costInfos, costInfo)
}
m.CostInfo = costInfos
invoiceInfos := make([]*InvoiceInfo, 0)
for i := 0; i < len(in.FinancialForm.InvoiceInfo); i++ {
invoiceInfo := new(InvoiceInfo)
copier.CopyWithOption(&invoiceInfo, in.FinancialForm.InvoiceInfo[i], copier.Option{DeepCopy: true})
invoiceInfos = append(invoiceInfos, invoiceInfo)
}
m.InvoiceInfo = invoiceInfos
return DB.Model(&m).Updates(m).Error
}
func (m *FinancialForm) BuildResContent(a *Approval, request *approval.CreateRequest) {
if a.FinancialForm != nil {
financialForm := new(approval.FinancialForm)
copier.CopyWithOption(&financialForm, a.FinancialForm, copier.Option{DeepCopy: true})
costInfos := make([]*approval.CostInfo, 0)
for i := 0; i < len(a.FinancialForm.CostInfo); i++ {
costInfo := new(approval.CostInfo)
copier.CopyWithOption(&costInfo, a.FinancialForm.CostInfo[i], copier.Option{DeepCopy: true})
costInfos = append(costInfos, costInfo)
}
financialForm.CostInfo = costInfos
invoiceInfos := make([]*approval.InvoiceInfo, 0)
for i := 0; i < len(a.FinancialForm.InvoiceInfo); i++ {
invoiceInfo := new(approval.InvoiceInfo)
copier.CopyWithOption(&invoiceInfo, a.FinancialForm.InvoiceInfo[i], copier.Option{DeepCopy: true})
invoiceInfos = append(invoiceInfos, invoiceInfo)
}
financialForm.InvoiceInfo = invoiceInfos
request.FinancialForm = financialForm
}
}
func (m *FinancialForm) DeleteApproval(p *Approval) error {
return DB.Where(&FinancialForm{ApprovalID: p.ID}).Delete(&FinancialForm{}).Error
}

View File

@ -0,0 +1,33 @@
package model
import (
"gorm.io/plugin/soft_delete"
"time"
)
type FinancialFormSetting struct {
ID uint64 `gorm:"primaryKey;column:id" json:"id"` // ID
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at" json:"deletedAt"` // 删除时间
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"` // 创建时间
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
SettingType string `json:"settingType" gorm:"column:setting_type;type:varchar(255);comment:财务付款单设置,paymentCompany|transactionDepartment|payment"`
Name string `json:"name" gorm:"column:name;type:varchar(1024)"`
}
// TableName get sql table name.获取数据库表名
func (m *FinancialFormSetting) TableName() string {
return "financial_form_setting"
}
//func GetName(in *approval.GetNameRequest) (*approval.GetNameResponse, error) {
// settings := make([]*FinancialFormSetting, 0)
// err := DB.Model(&FinancialFormSetting{}).Where("settingType = ?", in.SettingType).Find(&settings).Error
// if err != nil {
// return nil, err
// }
// response := new(approval.GetNameResponse)
// for i := 0; i < len(settings); i++ {
// response.Name = append(response.Name, settings[i].Name)
// }
// return response, nil
//}

View File

@ -13,6 +13,9 @@ func migration() {
addTable(&ExhibitionReward{})
addTable(&ApprovalReward{})
addTable(&FinancialFormSetting{}) // 财务报表审批 设置信息
addTable(&FinancialForm{}) // 财务报表审批 设置信息
//增加字段
addColumn(&ApprovalType{}, "is_normal")
addColumn(&ApprovalType{}, "key_json")

View File

@ -13,6 +13,7 @@ func BuildApproval(entity *model.Approval, userId uint64) *approval.CreateReques
var exhibition *approval.Exhibition
var bundle *approval.Bundle
var workFlows []*approval.WorkFlow
var financialForm *approval.FinancialForm
canViewed := false
canApproval := false
allStatus := uint64(entity.Status)
@ -71,6 +72,7 @@ func BuildApproval(entity *model.Approval, userId uint64) *approval.CreateReques
Show: show,
Exhibition: exhibition,
Bundle: bundle,
FinancialForm: financialForm,
CustomizeInfo: BuildKeyInfo(entity.ValueJson),
CreatedAt: entity.CreatedAt.Format("2006-01-02 15:04:05"),
AllStatus: allStatus, //0-未处理 1-通过 2-拒绝 3-已阅读 4-待阅读

View File

@ -0,0 +1,21 @@
package service
import (
"context"
"github.com/fonchain_enterprise/fonchain-approval/api/approval"
"github.com/fonchain_enterprise/fonchain-approval/pkg/model"
)
func (a *ApprovalProvider) GetName(ctx context.Context, in *approval.GetNameRequest) (*approval.GetNameResponse, error) {
settings := make([]*model.FinancialFormSetting, 0)
err := model.DB.Model(&model.FinancialFormSetting{}).Where("setting_type = ?", in.SettingType).Find(&settings).Error
if err != nil {
return nil, err
}
response := new(approval.GetNameResponse)
for i := 0; i < len(settings); i++ {
response.Name = append(response.Name, settings[i].Name)
}
return response, nil
}