作者 庄敏学

fixed

@@ -278,9 +278,9 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm @@ -278,9 +278,9 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
278 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 278 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
279 } 279 }
280 importCostCommand := &command.ImportCostDataCommand{} 280 importCostCommand := &command.ImportCostDataCommand{}
281 - err = json.Unmarshal([]byte(importDataCommand.Where),importCostCommand) 281 + err = json.Unmarshal([]byte(importDataCommand.Where), importCostCommand)
282 if err != nil { 282 if err != nil {
283 - return nil,application.ThrowError(application.ARG_ERROR,"风险类型不能为空") 283 + return nil, application.ThrowError(application.ARG_ERROR, "风险类型不能为空")
284 } 284 }
285 if importCostCommand.Types <= 0 { 285 if importCostCommand.Types <= 0 {
286 return nil, application.ThrowError(application.ARG_ERROR, "风险类型不能为空") 286 return nil, application.ThrowError(application.ARG_ERROR, "风险类型不能为空")
@@ -323,10 +323,8 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm @@ -323,10 +323,8 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
323 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "上传图片失败") 323 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "上传图片失败")
324 } 324 }
325 } 325 }
326 - choiceId, err := strconv.Atoi(v["choiceId"])  
327 - if err != nil {  
328 - return nil, application.ThrowError(application.ARG_ERROR, "节点类型非数字类型")  
329 - } 326 + //choiceId, err := strconv.Atoi(v["choiceId"])
  327 + choiceId := domain.NodeType{}.GetIdByName(strings.TrimSpace(v["choiceId"]))
330 // 负责人 328 // 负责人
331 chargePersons := make([]string, 0) 329 chargePersons := make([]string, 0)
332 names := strings.Split(strings.TrimSpace(v["chargePersons"]), " ") 330 names := strings.Split(strings.TrimSpace(v["chargePersons"]), " ")
@@ -410,6 +408,7 @@ func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.Import @@ -410,6 +408,7 @@ func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.Import
410 domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743214_rNHm6ZBXZaC5xKTrsE7M4h45MY6n6Ff3.xlsx", 408 domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743214_rNHm6ZBXZaC5xKTrsE7M4h45MY6n6Ff3.xlsx",
411 domain.ImportProducts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220120/object/1642670543_cbraNKjNPHcbN6RNBYQBrwhC7BXGbDWp.xlsx", 409 domain.ImportProducts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220120/object/1642670543_cbraNKjNPHcbN6RNBYQBrwhC7BXGbDWp.xlsx",
412 domain.ImportDevices: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220126/object/1643184320_hT6sY5BKHmBa4TynfSGSCGyZ2KTTtzkj.xlsx", 410 domain.ImportDevices: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220126/object/1643184320_hT6sY5BKHmBa4TynfSGSCGyZ2KTTtzkj.xlsx",
  411 + domain.ImportCosts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220311/object/1646977166_ATAD4tJbBDp4WhNFABatTZzkJDeZWB3K.xlsx",
413 } 412 }
414 var url string 413 var url string
415 var ok bool 414 var ok bool
1 package domain 1 package domain
2 2
3 type BatchCreateCostManagemant struct { 3 type BatchCreateCostManagemant struct {
4 -  
5 UserId int64 `cname:"操作人id" json:"UserId" valid:"Required"` 4 UserId int64 `cname:"操作人id" json:"UserId" valid:"Required"`
6 // 公司id 5 // 公司id
7 CompanyId int64 `cname:"公司id" json:"companyId" valid:"Required"` 6 CompanyId int64 `cname:"公司id" json:"companyId" valid:"Required"`
@@ -62,5 +61,29 @@ type CostManagemant struct { @@ -62,5 +61,29 @@ type CostManagemant struct {
62 Types int `json:"types"` 61 Types int `json:"types"`
63 // 昨日实际值 62 // 昨日实际值
64 YesterdayActual string `json:"yesterdayActual"` 63 YesterdayActual string `json:"yesterdayActual"`
  64 +}
  65 +
  66 +type NodeType struct {
  67 + TypeId int
  68 + TypeName string
  69 +}
  70 +
  71 +var NodeTypeGroup = []NodeType{
  72 + {TypeId: 1, TypeName: "组合框"},
  73 + {TypeId: 2, TypeName: "员工类型"},
  74 + {TypeId: 3, TypeName: "文本类型"},
  75 + {TypeId: 4, TypeName: "BOM表类型"},
  76 + {TypeId: 5, TypeName: "数值框"},
  77 + {TypeId: 6, TypeName: "计算框"},
  78 + {TypeId: 7, TypeName: "图片框"},
  79 +}
65 80
  81 +func (NodeType) GetIdByName(name string) int {
  82 + group := NodeTypeGroup
  83 + for _, item := range group {
  84 + if item.TypeName == name {
  85 + return item.TypeId
  86 + }
  87 + }
  88 + return 0
66 } 89 }