|
@@ -5,6 +5,7 @@ import (
|
|
"fmt"
|
|
"fmt"
|
|
"github.com/SuperH-0630/hdangan/src/model"
|
|
"github.com/SuperH-0630/hdangan/src/model"
|
|
"github.com/SuperH-0630/hdangan/src/runtime"
|
|
"github.com/SuperH-0630/hdangan/src/runtime"
|
|
|
|
+ "github.com/SuperH-0630/hdangan/src/systeminit"
|
|
"github.com/xuri/excelize/v2"
|
|
"github.com/xuri/excelize/v2"
|
|
"io"
|
|
"io"
|
|
"strconv"
|
|
"strconv"
|
|
@@ -13,15 +14,15 @@ import (
|
|
)
|
|
)
|
|
|
|
|
|
var InputTitle = map[model.FileSetType][]string{
|
|
var InputTitle = map[model.FileSetType][]string{
|
|
- model.QianRu: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "旧地址", "新地址", "办理时间", "备考", "材料页数", "材料"},
|
|
|
|
- model.ChuSheng: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "地址", "办理时间", "备考", "材料页数", "材料"},
|
|
|
|
- model.QianChu: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "新地址", "办理时间", "备考", "材料页数", "材料"},
|
|
|
|
- model.SiWang: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "地址", "办理时间", "备考", "材料页数", "材料"},
|
|
|
|
- model.BianGeng: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "地址", "办理时间", "备考", "材料页数", "材料"},
|
|
|
|
- model.SuoNeiYiJu: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "地址", "办理时间", "备考", "材料页数", "材料"},
|
|
|
|
- model.SuoJianYiJu: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "地址", "办理时间", "备考", "材料页数", "材料"},
|
|
|
|
- model.NongZiZhuanFei: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "地址", "办理时间", "备考", "材料页数", "材料"},
|
|
|
|
- model.YiZhanShiQianYiZheng: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "地址", "办理时间", "备考", "材料页数", "材料"},
|
|
|
|
|
|
+ model.QianRu: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "旧地址", "新地址", "办理时间", "备考", "材料页数", "材料", "录入人", "录入单位"},
|
|
|
|
+ model.ChuSheng: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "地址", "办理时间", "备考", "材料页数", "材料", "录入人", "录入单位"},
|
|
|
|
+ model.QianChu: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "新地址", "办理时间", "备考", "材料页数", "材料", "录入人", "录入单位"},
|
|
|
|
+ model.SiWang: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "地址", "办理时间", "备考", "材料页数", "材料", "录入人", "录入单位"},
|
|
|
|
+ model.BianGeng: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "地址", "办理时间", "备考", "材料页数", "材料", "录入人", "录入单位"},
|
|
|
|
+ model.SuoNeiYiJu: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "地址", "办理时间", "备考", "材料页数", "材料", "录入人", "录入单位"},
|
|
|
|
+ model.SuoJianYiJu: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "地址", "办理时间", "备考", "材料页数", "材料", "录入人", "录入单位"},
|
|
|
|
+ model.NongZiZhuanFei: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "地址", "办理时间", "备考", "材料页数", "材料", "录入人", "录入单位"},
|
|
|
|
+ model.YiZhanShiQianYiZheng: {"档案ID", "姓名", "曾用名", "身份证", "性别", "出生日期", "是否同上", "备注", "类型", "地址", "办理时间", "备考", "材料页数", "材料", "录入人", "录入单位"},
|
|
}
|
|
}
|
|
|
|
|
|
var Header = []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S"}
|
|
var Header = []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S"}
|
|
@@ -114,12 +115,12 @@ func checkTitle(t []string, tit []string) bool {
|
|
|
|
|
|
func makeFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []string) int {
|
|
func makeFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []string) int {
|
|
if t[0] == "" {
|
|
if t[0] == "" {
|
|
- file, err := makeNewFile(rt, fst, t, tit)
|
|
|
|
|
|
+ file, record, err := makeNewFile(rt, fst, t, tit)
|
|
if err != nil {
|
|
if err != nil {
|
|
return fail
|
|
return fail
|
|
}
|
|
}
|
|
|
|
|
|
- err = model.CreateFile(rt, file.GetFile().FileSetType, file)
|
|
|
|
|
|
+ err = model.CreateFile(rt, file.GetFile().FileSetType, file, record)
|
|
if err != nil {
|
|
if err != nil {
|
|
return fail
|
|
return fail
|
|
}
|
|
}
|
|
@@ -143,10 +144,15 @@ func makeFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []strin
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []string) (model.File, error) {
|
|
|
|
|
|
+func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []string) (model.File, *model.FileMoveRecord, error) {
|
|
|
|
+ config, err := systeminit.GetInit()
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, nil, err
|
|
|
|
+ }
|
|
|
|
+
|
|
name := t[1]
|
|
name := t[1]
|
|
if len(name) == 0 {
|
|
if len(name) == 0 {
|
|
- return nil, fmt.Errorf("must has name")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has name")
|
|
}
|
|
}
|
|
|
|
|
|
oldName := sql.NullString{
|
|
oldName := sql.NullString{
|
|
@@ -166,7 +172,7 @@ func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []st
|
|
var err error
|
|
var err error
|
|
birthday, err = timeReader(time.Now(), t[5])
|
|
birthday, err = timeReader(time.Now(), t[5])
|
|
if err != nil {
|
|
if err != nil {
|
|
- return nil, err
|
|
|
|
|
|
+ return nil, nil, err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -190,7 +196,7 @@ func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []st
|
|
var err error
|
|
var err error
|
|
fileTime, err = timeReader(time.Now(), t[fileTimeIndex])
|
|
fileTime, err = timeReader(time.Now(), t[fileTimeIndex])
|
|
if err != nil {
|
|
if err != nil {
|
|
- return nil, err
|
|
|
|
|
|
+ return nil, nil, err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -201,7 +207,7 @@ func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []st
|
|
|
|
|
|
page, err := strconv.ParseInt(t[fileTimeIndex+2], 10, 64)
|
|
page, err := strconv.ParseInt(t[fileTimeIndex+2], 10, 64)
|
|
if err != nil {
|
|
if err != nil {
|
|
- return nil, err
|
|
|
|
|
|
+ return nil, nil, err
|
|
}
|
|
}
|
|
|
|
|
|
material := sql.NullString{
|
|
material := sql.NullString{
|
|
@@ -209,6 +215,16 @@ func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []st
|
|
String: t[fileTimeIndex+3],
|
|
String: t[fileTimeIndex+3],
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ moveInPeople := sql.NullString{
|
|
|
|
+ Valid: len(t[fileTimeIndex+4]) != 0,
|
|
|
|
+ String: t[fileTimeIndex+4],
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ moveInUnit := sql.NullString{
|
|
|
|
+ Valid: len(t[fileTimeIndex+5]) != 0,
|
|
|
|
+ String: t[fileTimeIndex+5],
|
|
|
|
+ }
|
|
|
|
+
|
|
var res model.File
|
|
var res model.File
|
|
|
|
|
|
abs := model.FileAbs{
|
|
abs := model.FileAbs{
|
|
@@ -234,17 +250,17 @@ func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []st
|
|
case model.QianRu:
|
|
case model.QianRu:
|
|
fileType := t[8]
|
|
fileType := t[8]
|
|
if len(fileType) == 0 {
|
|
if len(fileType) == 0 {
|
|
- return nil, fmt.Errorf("must has file type")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has file type")
|
|
}
|
|
}
|
|
|
|
|
|
oldLoc := t[9]
|
|
oldLoc := t[9]
|
|
if len(oldLoc) == 0 {
|
|
if len(oldLoc) == 0 {
|
|
- return nil, fmt.Errorf("must has old location")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has old location")
|
|
}
|
|
}
|
|
|
|
|
|
newLoc := t[10]
|
|
newLoc := t[10]
|
|
if len(newLoc) == 0 {
|
|
if len(newLoc) == 0 {
|
|
- return nil, fmt.Errorf("must has new location")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has new location")
|
|
}
|
|
}
|
|
|
|
|
|
res = &model.FileQianRu{
|
|
res = &model.FileQianRu{
|
|
@@ -256,12 +272,12 @@ func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []st
|
|
case model.ChuSheng:
|
|
case model.ChuSheng:
|
|
fileType := t[8]
|
|
fileType := t[8]
|
|
if len(fileType) == 0 {
|
|
if len(fileType) == 0 {
|
|
- return nil, fmt.Errorf("must has file type")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has file type")
|
|
}
|
|
}
|
|
|
|
|
|
loc := t[9]
|
|
loc := t[9]
|
|
if len(loc) == 0 {
|
|
if len(loc) == 0 {
|
|
- return nil, fmt.Errorf("must has location")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has location")
|
|
}
|
|
}
|
|
|
|
|
|
res = &model.FileChuSheng{
|
|
res = &model.FileChuSheng{
|
|
@@ -272,12 +288,12 @@ func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []st
|
|
case model.SiWang:
|
|
case model.SiWang:
|
|
fileType := t[8]
|
|
fileType := t[8]
|
|
if len(fileType) == 0 {
|
|
if len(fileType) == 0 {
|
|
- return nil, fmt.Errorf("must has file type")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has file type")
|
|
}
|
|
}
|
|
|
|
|
|
loc := t[9]
|
|
loc := t[9]
|
|
if len(loc) == 0 {
|
|
if len(loc) == 0 {
|
|
- return nil, fmt.Errorf("must has new location")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has new location")
|
|
}
|
|
}
|
|
|
|
|
|
res = &model.FileSiWang{
|
|
res = &model.FileSiWang{
|
|
@@ -288,12 +304,12 @@ func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []st
|
|
case model.BianGeng:
|
|
case model.BianGeng:
|
|
fileType := t[8]
|
|
fileType := t[8]
|
|
if len(fileType) == 0 {
|
|
if len(fileType) == 0 {
|
|
- return nil, fmt.Errorf("must has file type")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has file type")
|
|
}
|
|
}
|
|
|
|
|
|
loc := t[9]
|
|
loc := t[9]
|
|
if len(loc) == 0 {
|
|
if len(loc) == 0 {
|
|
- return nil, fmt.Errorf("must has location")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has location")
|
|
}
|
|
}
|
|
|
|
|
|
res = &model.FileBianGeng{
|
|
res = &model.FileBianGeng{
|
|
@@ -304,12 +320,12 @@ func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []st
|
|
case model.SuoNeiYiJu:
|
|
case model.SuoNeiYiJu:
|
|
fileType := t[8]
|
|
fileType := t[8]
|
|
if len(fileType) == 0 {
|
|
if len(fileType) == 0 {
|
|
- return nil, fmt.Errorf("must has file type")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has file type")
|
|
}
|
|
}
|
|
|
|
|
|
loc := t[9]
|
|
loc := t[9]
|
|
if len(loc) == 0 {
|
|
if len(loc) == 0 {
|
|
- return nil, fmt.Errorf("must has location")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has location")
|
|
}
|
|
}
|
|
|
|
|
|
res = &model.FileSuoNeiYiJu{
|
|
res = &model.FileSuoNeiYiJu{
|
|
@@ -320,12 +336,12 @@ func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []st
|
|
case model.SuoJianYiJu:
|
|
case model.SuoJianYiJu:
|
|
fileType := t[8]
|
|
fileType := t[8]
|
|
if len(fileType) == 0 {
|
|
if len(fileType) == 0 {
|
|
- return nil, fmt.Errorf("must has file type")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has file type")
|
|
}
|
|
}
|
|
|
|
|
|
loc := t[9]
|
|
loc := t[9]
|
|
if len(loc) == 0 {
|
|
if len(loc) == 0 {
|
|
- return nil, fmt.Errorf("must has new location")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has new location")
|
|
}
|
|
}
|
|
|
|
|
|
res = &model.FileSuoJianYiJu{
|
|
res = &model.FileSuoJianYiJu{
|
|
@@ -336,12 +352,12 @@ func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []st
|
|
case model.NongZiZhuanFei:
|
|
case model.NongZiZhuanFei:
|
|
fileType := t[8]
|
|
fileType := t[8]
|
|
if len(fileType) == 0 {
|
|
if len(fileType) == 0 {
|
|
- return nil, fmt.Errorf("must has file type")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has file type")
|
|
}
|
|
}
|
|
|
|
|
|
loc := t[9]
|
|
loc := t[9]
|
|
if len(loc) == 0 {
|
|
if len(loc) == 0 {
|
|
- return nil, fmt.Errorf("must has location")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has location")
|
|
}
|
|
}
|
|
|
|
|
|
res = &model.FileNongZiZhuanFei{
|
|
res = &model.FileNongZiZhuanFei{
|
|
@@ -352,12 +368,12 @@ func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []st
|
|
case model.YiZhanShiQianYiZheng:
|
|
case model.YiZhanShiQianYiZheng:
|
|
fileType := t[8]
|
|
fileType := t[8]
|
|
if len(fileType) == 0 {
|
|
if len(fileType) == 0 {
|
|
- return nil, fmt.Errorf("must has file type")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has file type")
|
|
}
|
|
}
|
|
|
|
|
|
loc := t[9]
|
|
loc := t[9]
|
|
if len(loc) == 0 {
|
|
if len(loc) == 0 {
|
|
- return nil, fmt.Errorf("must has location")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("must has location")
|
|
}
|
|
}
|
|
|
|
|
|
res = &model.FileYiZhanShiQianYiZheng{
|
|
res = &model.FileYiZhanShiQianYiZheng{
|
|
@@ -366,10 +382,16 @@ func makeNewFile(rt runtime.RunTime, fst model.FileSetType, t []string, tit []st
|
|
Location: loc,
|
|
Location: loc,
|
|
}
|
|
}
|
|
default:
|
|
default:
|
|
- return nil, fmt.Errorf("file set type error")
|
|
|
|
|
|
+ return nil, nil, fmt.Errorf("file set type error")
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ record := &model.FileMoveRecord{
|
|
|
|
+ MoveStatus: config.Yaml.Move.MoveInStatus,
|
|
|
|
+ MoveInPeopleName: moveInPeople,
|
|
|
|
+ MoveInPeopleUnit: moveInUnit,
|
|
}
|
|
}
|
|
|
|
|
|
- return res, nil
|
|
|
|
|
|
+ return res, record, nil
|
|
}
|
|
}
|
|
|
|
|
|
func makeUpdateFile(rt runtime.RunTime, fileID int64, fst model.FileSetType, t []string, tit []string) (model.File, error) {
|
|
func makeUpdateFile(rt runtime.RunTime, fileID int64, fst model.FileSetType, t []string, tit []string) (model.File, error) {
|