作者 庄敏学

修改成本导入模板

@@ -17,7 +17,6 @@ import ( @@ -17,7 +17,6 @@ import (
17 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util/converter" 17 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util/converter"
18 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util/oss" 18 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util/oss"
19 "io" 19 "io"
20 - "strconv"  
21 "strings" 20 "strings"
22 ) 21 )
23 22
@@ -325,6 +324,7 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm @@ -325,6 +324,7 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
325 // 负责人 324 // 负责人
326 chargePersons := make([]string, 0) 325 chargePersons := make([]string, 0)
327 names := strings.Split(strings.TrimSpace(v["chargePersons"]), " ") 326 names := strings.Split(strings.TrimSpace(v["chargePersons"]), " ")
  327 +
328 for _, userName := range names { 328 for _, userName := range names {
329 if userName == "" { 329 if userName == "" {
330 continue 330 continue
@@ -336,7 +336,7 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm @@ -336,7 +336,7 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
336 } 336 }
337 } 337 }
338 //目标值期限 338 //目标值期限
339 - targetPeriod, _ := strconv.Atoi(strings.TrimSpace(v["targetPeriod"])) 339 + targetPeriod := domain.GetTargetPeriod(v["targetPeriod"])
340 item := &domain.CostManagemant{ 340 item := &domain.CostManagemant{
341 ProjectCode: strings.TrimSpace(v["projectCode"]), 341 ProjectCode: strings.TrimSpace(v["projectCode"]),
342 ItemName: strings.TrimSpace(v["itemName"]), 342 ItemName: strings.TrimSpace(v["itemName"]),
@@ -412,7 +412,7 @@ func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.Import @@ -412,7 +412,7 @@ func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.Import
412 domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743214_rNHm6ZBXZaC5xKTrsE7M4h45MY6n6Ff3.xlsx", 412 domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743214_rNHm6ZBXZaC5xKTrsE7M4h45MY6n6Ff3.xlsx",
413 domain.ImportProducts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220120/object/1642670543_cbraNKjNPHcbN6RNBYQBrwhC7BXGbDWp.xlsx", 413 domain.ImportProducts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220120/object/1642670543_cbraNKjNPHcbN6RNBYQBrwhC7BXGbDWp.xlsx",
414 domain.ImportDevices: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220126/object/1643184320_hT6sY5BKHmBa4TynfSGSCGyZ2KTTtzkj.xlsx", 414 domain.ImportDevices: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220126/object/1643184320_hT6sY5BKHmBa4TynfSGSCGyZ2KTTtzkj.xlsx",
415 - domain.ImportCosts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220311/object/1646977166_ATAD4tJbBDp4WhNFABatTZzkJDeZWB3K.xlsx", 415 + domain.ImportCosts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/test/20220316/object/1647432062_ewSe5CzD3TKmxQTGtExpxDWZtm3JTs4p.xlsx",
416 } 416 }
417 var url string 417 var url string
418 var ok bool 418 var ok bool
1 package domain 1 package domain
2 2
  3 +import "strings"
  4 +
3 type BatchCreateCostManagemant struct { 5 type BatchCreateCostManagemant struct {
4 UserId int64 `cname:"操作人id" json:"UserId" valid:"Required"` 6 UserId int64 `cname:"操作人id" json:"UserId" valid:"Required"`
5 // 公司id 7 // 公司id
@@ -89,3 +91,22 @@ func (NodeType) GetIdByName(name string) int { @@ -89,3 +91,22 @@ func (NodeType) GetIdByName(name string) int {
89 } 91 }
90 return 0 92 return 0
91 } 93 }
  94 +
  95 +func GetTargetPeriod(targetPeriod string) int {
  96 + targetPeriod = strings.TrimSpace(targetPeriod)
  97 + switch targetPeriod {
  98 + case "年度":
  99 + return 5
  100 + case "第一季度":
  101 + return 1
  102 + case "第二季度":
  103 + return 2
  104 + case "第三季度":
  105 + return 3
  106 + case "第四季度":
  107 + return 4
  108 + case "":
  109 + return 0
  110 + }
  111 + return -1
  112 +}