作者 庄敏学

修改成本导入模板

... ... @@ -17,7 +17,6 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util/converter"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util/oss"
"io"
"strconv"
"strings"
)
... ... @@ -325,6 +324,7 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
// 负责人
chargePersons := make([]string, 0)
names := strings.Split(strings.TrimSpace(v["chargePersons"]), " ")
for _, userName := range names {
if userName == "" {
continue
... ... @@ -336,7 +336,7 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
}
}
//目标值期限
targetPeriod, _ := strconv.Atoi(strings.TrimSpace(v["targetPeriod"]))
targetPeriod := domain.GetTargetPeriod(v["targetPeriod"])
item := &domain.CostManagemant{
ProjectCode: strings.TrimSpace(v["projectCode"]),
ItemName: strings.TrimSpace(v["itemName"]),
... ... @@ -412,7 +412,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",
domain.ImportCosts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/test/20220316/object/1647432062_ewSe5CzD3TKmxQTGtExpxDWZtm3JTs4p.xlsx",
}
var url string
var ok bool
... ...
package domain
import "strings"
type BatchCreateCostManagemant struct {
UserId int64 `cname:"操作人id" json:"UserId" valid:"Required"`
// 公司id
... ... @@ -89,3 +91,22 @@ func (NodeType) GetIdByName(name string) int {
}
return 0
}
func GetTargetPeriod(targetPeriod string) int {
targetPeriod = strings.TrimSpace(targetPeriod)
switch targetPeriod {
case "年度":
return 5
case "第一季度":
return 1
case "第二季度":
return 2
case "第三季度":
return 3
case "第四季度":
return 4
case "":
return 0
}
return -1
}
\ No newline at end of file
... ...