feat:完成企业和专家导入功能,缺少保存数据表中
This commit is contained in:
@ -8,8 +8,10 @@ import (
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/app/session"
|
||||
config2 "SciencesServer/config"
|
||||
"SciencesServer/lib"
|
||||
"SciencesServer/utils"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@ -53,6 +55,38 @@ type (
|
||||
*model.ManageExpertPatent
|
||||
IsBind bool `json:"is_bind"`
|
||||
}
|
||||
|
||||
// ExpertExcel 专家表格数据
|
||||
ExpertExcel struct {
|
||||
Name string `json:"name" xlsx:"专家姓名"`
|
||||
Province string `json:"province" xlsx:"所在省"`
|
||||
City string `json:"city" xlsx:"所在市"`
|
||||
District string `json:"district" xlsx:"所在区"`
|
||||
Address string `json:"address" xlsx:"详细地址"`
|
||||
Site string `json:"site" form:"所属站点"`
|
||||
Industry string `json:"industry" xlsx:"所属领域"`
|
||||
Research string `json:"research" xlsx:"所属单位"`
|
||||
Laboratory string `json:"laboratory" xlsx:"所属实验室"`
|
||||
School string `json:"school" xlsx:"毕业院校"`
|
||||
Keyword string `json:"keyword" xlsx:"关键词"`
|
||||
Education string `json:"education" xlsx:"最高学历"`
|
||||
Major string `json:"major" xlsx:"主修专业"`
|
||||
Job string `json:"job" xlsx:"职务"`
|
||||
WorkAt string `json:"work_at" xlsx:"从业时间"`
|
||||
Gender string `json:"gender" xlsx:"性别"`
|
||||
ResearchWhere string `json:"research_where" xlsx:"研究方向"`
|
||||
Mobile string `json:"mobile" xlsx:"手机号"`
|
||||
Introduce string `json:"introduce" xlsx:"个人简介"`
|
||||
Technology string `json:"technology" xlsx:"核心技术及产品"`
|
||||
Scene string `json:"scene" xlsx:"应用场景"`
|
||||
Tag1 string `json:"tag_1" xlsx:"代表成果及合作模式"`
|
||||
Tag2 string `json:"tag_2" xlsx:"承担科研项目"`
|
||||
Tag3 string `json:"tag_3" xlsx:"代表专利"`
|
||||
Tag4 string `json:"tag_4" xlsx:"代表论文"`
|
||||
Tag5 string `json:"tag_5" xlsx:"已合作企业"`
|
||||
Tag6 string `json:"tag_6" xlsx:"想合作企业"`
|
||||
Tag7 string `json:"tag_7" xlsx:"我的需求"`
|
||||
}
|
||||
)
|
||||
|
||||
// Instance 首页信息
|
||||
@ -307,6 +341,27 @@ func (c *Expert) PatentUnbind(id uint64, patentID []uint64) error {
|
||||
})
|
||||
}
|
||||
|
||||
// Import 导入数据
|
||||
func (c *Expert) Import(file string) error {
|
||||
excel := lib.NewExcel()
|
||||
err := excel.Import(strings.Replace(file, "/", "", 1), 1, 0)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
data := excel.Analysis(&ExpertExcel{})
|
||||
|
||||
//now := time.Now()
|
||||
|
||||
for _, v := range data {
|
||||
_data := v.(*ExpertExcel)
|
||||
// 所属领域
|
||||
//industrys := strings.Split(_data.Industry, "\n")
|
||||
fmt.Println(_data)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewExpert() ExpertHandle {
|
||||
return func(session *session.Admin) *Expert {
|
||||
return &Expert{session}
|
||||
|
Reference in New Issue
Block a user