作者 庄敏学

fixed

... ... @@ -278,9 +278,9 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
importCostCommand := &command.ImportCostDataCommand{}
err = json.Unmarshal([]byte(importDataCommand.Where),importCostCommand)
err = json.Unmarshal([]byte(importDataCommand.Where), importCostCommand)
if err != nil {
return nil,application.ThrowError(application.ARG_ERROR,"风险类型不能为空")
return nil, application.ThrowError(application.ARG_ERROR, "风险类型不能为空")
}
if importCostCommand.Types <= 0 {
return nil, application.ThrowError(application.ARG_ERROR, "风险类型不能为空")
... ... @@ -323,10 +323,8 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "上传图片失败")
}
}
choiceId, err := strconv.Atoi(v["choiceId"])
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "节点类型非数字类型")
}
//choiceId, err := strconv.Atoi(v["choiceId"])
choiceId := domain.NodeType{}.GetIdByName(strings.TrimSpace(v["choiceId"]))
// 负责人
chargePersons := make([]string, 0)
names := strings.Split(strings.TrimSpace(v["chargePersons"]), " ")
... ... @@ -410,6 +408,7 @@ func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.Import
domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743214_rNHm6ZBXZaC5xKTrsE7M4h45MY6n6Ff3.xlsx",
domain.ImportProducts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220120/object/1642670543_cbraNKjNPHcbN6RNBYQBrwhC7BXGbDWp.xlsx",
domain.ImportDevices: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220126/object/1643184320_hT6sY5BKHmBa4TynfSGSCGyZ2KTTtzkj.xlsx",
domain.ImportCosts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220311/object/1646977166_ATAD4tJbBDp4WhNFABatTZzkJDeZWB3K.xlsx",
}
var url string
var ok bool
... ...
package domain
type BatchCreateCostManagemant struct {
UserId int64 `cname:"操作人id" json:"UserId" valid:"Required"`
// 公司id
CompanyId int64 `cname:"公司id" json:"companyId" valid:"Required"`
... ... @@ -62,5 +61,29 @@ type CostManagemant struct {
Types int `json:"types"`
// 昨日实际值
YesterdayActual string `json:"yesterdayActual"`
}
type NodeType struct {
TypeId int
TypeName string
}
}
\ No newline at end of file
var NodeTypeGroup = []NodeType{
{TypeId: 1, TypeName: "组合框"},
{TypeId: 2, TypeName: "员工类型"},
{TypeId: 3, TypeName: "文本类型"},
{TypeId: 4, TypeName: "BOM表类型"},
{TypeId: 5, TypeName: "数值框"},
{TypeId: 6, TypeName: "计算框"},
{TypeId: 7, TypeName: "图片框"},
}
func (NodeType) GetIdByName(name string) int {
group := NodeTypeGroup
for _, item := range group {
if item.TypeName == name {
return item.TypeId
}
}
return 0
}
... ...