熊哥提交
This commit is contained in:
@ -151,6 +151,7 @@ func (c *Company) Form(params *BasicParams, other *config.IdentityForCompany) er
|
||||
if mManageCompany.ExamineStatus == model2.ExamineStatusForAgree {
|
||||
_ = manage.Update()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// 查询手机号码是否在当前租户下是否已经注册了
|
||||
mManageCompany.Name = params.Name
|
||||
|
@ -5,9 +5,11 @@ import (
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/app/session"
|
||||
config2 "SciencesServer/config"
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Laboratory 实验室信息
|
||||
@ -22,7 +24,9 @@ type (
|
||||
LaboratoryInstance struct {
|
||||
ID string `json:"id"`
|
||||
*model.ManageLaboratoryInfo
|
||||
Area string `json:"area"`
|
||||
Area string `json:"area"`
|
||||
Industrys []string `json:"industrys"`
|
||||
Researchs []string `json:"researchs"`
|
||||
}
|
||||
// LaboratorySelect 实验室筛选信息
|
||||
LaboratorySelect struct {
|
||||
@ -34,10 +38,10 @@ type (
|
||||
ID string `json:"id"`
|
||||
TenantID string `json:"tenant_id"`
|
||||
*model2.ManageLaboratory
|
||||
Industrys []*config.Industry `json:"industrys"`
|
||||
Keywords []string `json:"keywords"`
|
||||
Researchs []string `json:"researchs"`
|
||||
Area string `json:"area"`
|
||||
ResearchID string `json:"research_id"`
|
||||
Industrys []*config.Industry `json:"industrys"`
|
||||
Keywords []string `json:"keywords"`
|
||||
Researchs []string `json:"researchs"`
|
||||
}
|
||||
)
|
||||
|
||||
@ -69,13 +73,23 @@ func (c *Laboratory) Instance(tenantID uint64, name string, examineStatus, page,
|
||||
list := make([]*LaboratoryInstance, 0)
|
||||
|
||||
for _, v := range out {
|
||||
mManageLaboratory.Industry = v.Industry
|
||||
mManageLaboratory.Research = v.Research
|
||||
v.Address = v.FormatBasic()
|
||||
|
||||
_industrys := make([]string, 0)
|
||||
|
||||
for _, v := range mManageLaboratory.GetIndustryAttribute() {
|
||||
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", ">").Value)
|
||||
}
|
||||
|
||||
list = append(list, &LaboratoryInstance{
|
||||
ID: v.GetEncodeID(), ManageLaboratoryInfo: v, Area: (&model2.Area{
|
||||
Province: v.TenantProvince,
|
||||
City: v.TenantCity,
|
||||
}).FormatBasic(),
|
||||
Industrys: _industrys,
|
||||
Researchs: mManageLaboratory.GetResearchAttribute(),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
@ -158,8 +172,25 @@ func (c *Laboratory) Form(params *BasicParams, other *config.IdentityForLaborato
|
||||
if c.TenantID <= 0 {
|
||||
mManageLaboratory.TenantID = params.TenantID
|
||||
}
|
||||
_industrys := make([]string, 0)
|
||||
|
||||
for _, v := range params.Industrys {
|
||||
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "-").Value)
|
||||
}
|
||||
manage := service.NewESManage(
|
||||
service.WithManageIdentity(config.TenantUserIdentityForLaboratory),
|
||||
service.WithManageIndustry(strings.Join(_industrys, ";")),
|
||||
service.WithManageKeyword(strings.Join(params.Keywords, ";")),
|
||||
service.WithManageResearch(strings.Join(other.Researchs, ";")),
|
||||
)
|
||||
if mManageLaboratory.ID > 0 {
|
||||
return model2.Updates(mManageLaboratory.ManageLaboratory, mManageLaboratory.ManageLaboratory)
|
||||
if err := model2.Updates(mManageLaboratory.ManageLaboratory, mManageLaboratory.ManageLaboratory); err != nil {
|
||||
return err
|
||||
}
|
||||
if mManageLaboratory.ExamineStatus == model2.ExamineStatusForAgree {
|
||||
_ = manage.Update()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
mManageLaboratory.Name = params.Name
|
||||
mManageLaboratory.Code = params.Code
|
||||
@ -172,7 +203,13 @@ func (c *Laboratory) Form(params *BasicParams, other *config.IdentityForLaborato
|
||||
} else if isExist {
|
||||
return errors.New("操作错误,已存在同一实验室机构代码")
|
||||
}
|
||||
return model2.Create(mManageLaboratory.ManageLaboratory)
|
||||
if err := model2.Create(mManageLaboratory.ManageLaboratory); err != nil {
|
||||
return err
|
||||
}
|
||||
service.WithManageID(mManageLaboratory.ID)(manage)
|
||||
service.WithManageTitle(params.Name)(manage)
|
||||
|
||||
return manage.Create()
|
||||
|
||||
}
|
||||
|
||||
@ -197,6 +234,7 @@ func (c *Laboratory) Detail(id uint64) (*LaboratoryDetail, error) {
|
||||
return &LaboratoryDetail{
|
||||
ID: out.GetEncodeID(),
|
||||
TenantID: out.GetEncodeTenantID(),
|
||||
ResearchID: (&model2.Model{ID: out.ResearchID}).GetEncodeID(),
|
||||
ManageLaboratory: out.ManageLaboratory,
|
||||
Industrys: _industrys,
|
||||
Keywords: out.GetKeywordAttribute(),
|
||||
|
@ -5,9 +5,11 @@ import (
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/app/session"
|
||||
config2 "SciencesServer/config"
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Research 研究机构
|
||||
@ -165,8 +167,26 @@ func (c *Research) Form(params *BasicParams, other *config.IdentityForResearch)
|
||||
if c.TenantID <= 0 {
|
||||
mManageResearch.TenantID = params.TenantID
|
||||
}
|
||||
_industrys := make([]string, 0)
|
||||
|
||||
for _, v := range params.Industrys {
|
||||
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "-").Value)
|
||||
}
|
||||
manage := service.NewESManage(
|
||||
service.WithManageIdentity(config.TenantUserIdentityForResearch),
|
||||
service.WithManageIndustry(strings.Join(_industrys, ";")),
|
||||
service.WithManageKeyword(strings.Join(params.Keywords, ";")),
|
||||
service.WithManageResearch(strings.Join(other.Researchs, ";")),
|
||||
)
|
||||
|
||||
if mManageResearch.ID > 0 {
|
||||
return model2.Updates(mManageResearch.ManageResearch, mManageResearch.ManageResearch)
|
||||
if err := model2.Updates(mManageResearch.ManageResearch, mManageResearch.ManageResearch); err != nil {
|
||||
return err
|
||||
}
|
||||
if mManageResearch.ExamineStatus == model2.ExamineStatusForAgree {
|
||||
_ = manage.Update()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
mManageResearch.Name = params.Name
|
||||
mManageResearch.Code = params.Code
|
||||
@ -179,7 +199,13 @@ func (c *Research) Form(params *BasicParams, other *config.IdentityForResearch)
|
||||
} else if isExist {
|
||||
return errors.New("操作错误,已存在同一研究机构代码")
|
||||
}
|
||||
return model2.Create(mManageResearch.ManageResearch)
|
||||
if err := model2.Create(mManageResearch.ManageResearch); err != nil {
|
||||
return err
|
||||
}
|
||||
service.WithManageID(mManageResearch.ID)(manage)
|
||||
service.WithManageTitle(params.Name)(manage)
|
||||
return manage.Create()
|
||||
|
||||
}
|
||||
|
||||
// Detail 详细信息
|
||||
|
Reference in New Issue
Block a user