作者 yangfu

fix: 导入模板修改

... ... @@ -321,10 +321,10 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "上传图片失败")
}
ossFile = append(ossFile,ossFile1)
ossFile = append(ossFile, ossFile1)
}
//图片2
_,mBytes2,err := f.GetPicture(f.GetSheetName(index), "F"+fmt.Sprintf("%v", excelImport.RowBegin+key+1))
_, mBytes2, err := f.GetPicture(f.GetSheetName(index), "F"+fmt.Sprintf("%v", excelImport.RowBegin+key+1))
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "读取图片失败")
}
... ... @@ -333,10 +333,10 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "上传图片失败")
}
ossFile = append(ossFile,ossFile2)
ossFile = append(ossFile, ossFile2)
}
//图片3
_,mBytes3,err := f.GetPicture(f.GetSheetName(index), "G"+fmt.Sprintf("%v", excelImport.RowBegin+key+1))
_, mBytes3, err := f.GetPicture(f.GetSheetName(index), "G"+fmt.Sprintf("%v", excelImport.RowBegin+key+1))
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "读取图片失败")
}
... ... @@ -345,7 +345,7 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "上传图片失败")
}
ossFile = append(ossFile,ossFile3)
ossFile = append(ossFile, ossFile3)
}
//choiceId, err := strconv.Atoi(v["choiceId"])
choiceId := domain.NodeType{}.GetIdByName(strings.TrimSpace(v["choiceId"]))
... ... @@ -382,7 +382,7 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
YesterdayActual: strings.TrimSpace(v["yesterdayActual"]),
Types: importCostCommand.Types,
}
if len(ossFile) >0 {
if len(ossFile) > 0 {
item.Urls = ossFile
} else {
item.Urls = []string{}
... ... @@ -398,15 +398,15 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
"successCount": 0,
"fail": map[string]interface{}{
"header": map[string]string{
"failReason": "错误详情",
"projectCode": "项目编码",
"itemName": "细项名称",
"failReason": "错误详情",
"projectCode": "项目编码",
"itemName": "细项名称",
},
"body": []map[string]interface{}{
{"failReason":result.Msg,"projectCode":"","itemName":""},
"body": []map[string]interface{}{
{"failReason": result.Msg, "projectCode": "", "itemName": ""},
},
},
"successData":nil,
"successData": nil,
}, nil
} else {
return result.Data, nil
... ... @@ -451,7 +451,7 @@ func (srv ExcelDataService) fieldValueAllEmpty(param map[string]string) bool {
// FileImportTemplate 导入模板
func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.ImportDataCommand) (interface{}, error) {
var mapTemplate = map[string]string{
domain.ImportCompanyUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/opportunity/dev_online/20220222/object/1645495589_cFNDGRTfCxYMZ5hPYzfKxThYd3ywARRz.xlsx",
domain.ImportCompanyUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/opportunity/dev_online/20220427/object/1651040510_YxpaeFBaZfGKxs6dERrsKeZY5ha7ByrQ.xlsx",
domain.ImportOrganization: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210916/object/1631807490_r2XWhGmbWWmpbeePBkZ3EJQFKcZEMpEm.xlsx",
domain.ImportDividendsOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743206_NPYTKw6RGhXn4TpYNEQhGGdCkXKXTnxM.xlsx",
domain.ImportCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210926/object/1632635345_SbfzmkXjQHhCwPw4MB7zb5EBBtdp2MSE.xlsx",
... ...