|
@@ -57,18 +57,13 @@ func (c *PercentageController) Percentage_List() {
|
|
|
T_start_date := c.GetString("T_start_date") // 开始时间
|
|
|
T_end_date := c.GetString("T_end_date") // 结束时间
|
|
|
|
|
|
- var T_company_list []string
|
|
|
- if len(T_name) > 0 {
|
|
|
- T_company_list = Percentage.Read_VerifyCompany_T_uuid_ListByT_name(T_name)
|
|
|
- }
|
|
|
-
|
|
|
userList, _ := NatsServer.Read_User_List_All()
|
|
|
Account.Read_User_All_Map(userList)
|
|
|
Percentage.Read_VerifyCompany_All_Map()
|
|
|
|
|
|
PercentageDao := Percentage.NewPercentage(orm.NewOrm())
|
|
|
- R_List, R_cnt := PercentageDao.Read_Percentage_List(T_name, T_uuid, T_start_date, T_end_date,
|
|
|
- T_company_list, T_state, T_type, page, page_z)
|
|
|
+ R_List, R_cnt := PercentageDao.Read_Percentage_List_SQL(T_name, T_uuid, T_start_date, T_end_date,
|
|
|
+ false, T_state, T_type, page, page_z)
|
|
|
|
|
|
var r_jsons lib.R_JSONS
|
|
|
r_jsons.Num = R_cnt
|
|
@@ -98,17 +93,13 @@ func (c *PercentageController) Percentage_User_List() {
|
|
|
T_state, _ := c.GetInt("T_state")
|
|
|
T_start_date := c.GetString("T_start_date") // 开始时间
|
|
|
T_end_date := c.GetString("T_end_date") // 结束时间
|
|
|
- var T_company_list []string
|
|
|
- if len(T_name) > 0 {
|
|
|
- T_company_list = Percentage.Read_VerifyCompany_T_uuid_ListByT_name(T_name)
|
|
|
- }
|
|
|
|
|
|
userList, _ := NatsServer.Read_User_List_All()
|
|
|
Account.Read_User_All_Map(userList)
|
|
|
- Contract.Read_VerifyContract_All_Map()
|
|
|
+ Percentage.Read_VerifyCompany_All_Map()
|
|
|
|
|
|
PercentageDao := Percentage.NewPercentage(orm.NewOrm())
|
|
|
- R_List, R_cnt := PercentageDao.Read_Percentage_User_List(c.User.T_uuid, T_name, T_start_date, T_end_date, T_company_list, T_state, page, page_z)
|
|
|
+ R_List, R_cnt := PercentageDao.Read_Percentage_User_List_SQL(c.User.T_uuid, T_name, T_start_date, T_end_date, false, T_state, page, page_z)
|
|
|
|
|
|
var r_jsons lib.R_JSONS
|
|
|
r_jsons.Num = R_cnt
|
|
@@ -135,7 +126,7 @@ func (c *PercentageController) Percentage_Export() {
|
|
|
Percentage.Read_VerifyCompany_All_Map()
|
|
|
Basic.Read_VerifyItem_All_Map()
|
|
|
PercentageDao := Percentage.NewPercentage(orm.NewOrm())
|
|
|
- percentageList, _ := PercentageDao.Read_Percentage_List_For_Excel(T_name, T_uuid, T_start_date, T_end_date, []string{}, T_state, T_type)
|
|
|
+ percentageList, _ := PercentageDao.Read_Percentage_List_SQL(T_name, T_uuid, T_start_date, T_end_date, true, T_state, T_type, 0, 9999)
|
|
|
dataInterval := fmt.Sprintf("%s - %s", T_start_date, T_end_date)
|
|
|
if dataInterval == " - " {
|
|
|
dataInterval = ""
|
|
@@ -158,25 +149,17 @@ func (c *PercentageController) Percentage_Export() {
|
|
|
{Type: "right", Color: "000000", Style: 1},
|
|
|
},
|
|
|
})
|
|
|
- f.MergeCell("Sheet1", "A1", "AC1")
|
|
|
+ var schemeStartCell = "H"
|
|
|
+ var schemeEndCell = "U"
|
|
|
+ var reportingStartCell = "V"
|
|
|
+ var reportingEndCell = "AE"
|
|
|
+ f.MergeCell("Sheet1", "A1", reportingEndCell+"1")
|
|
|
f.SetRowStyle("Sheet1", 1, 1, Style1)
|
|
|
f.SetRowHeight("Sheet1", 1, 50)
|
|
|
f.SetCellValue("Sheet1", "A1", fmt.Sprintf("%s提成统计表", dataInterval))
|
|
|
|
|
|
- //Style3, _ := f.NewStyle(
|
|
|
- // &excelize.Style{
|
|
|
- // Font: &excelize.Font{Bold: true, Size: 10, Family: "宋体"},
|
|
|
- // Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center", WrapText: true},
|
|
|
- // Border: []excelize.Border{
|
|
|
- // {Type: "left", Color: "000000", Style: 1},
|
|
|
- // {Type: "top", Color: "000000", Style: 1},
|
|
|
- // {Type: "bottom", Color: "000000", Style: 1},
|
|
|
- // {Type: "right", Color: "000000", Style: 1},
|
|
|
- // },
|
|
|
- // })
|
|
|
-
|
|
|
f.SetCellStyle("Sheet1", "A2", "G4", Style2)
|
|
|
- f.SetRowHeight("Sheet1", 2, 20)
|
|
|
+ f.SetRowHeight("Sheet1", 2, 30)
|
|
|
f.SetRowHeight("Sheet1", 4, 20)
|
|
|
|
|
|
// 这里设置表头
|
|
@@ -190,41 +173,46 @@ func (c *PercentageController) Percentage_Export() {
|
|
|
|
|
|
f.SetCellValue("Sheet1", "A2", "序号")
|
|
|
f.SetCellValue("Sheet1", "B2", "公司名称")
|
|
|
- f.SetCellValue("Sheet1", "C2", "验证类型")
|
|
|
- f.SetCellValue("Sheet1", "D2", "项目名称")
|
|
|
- f.SetCellValue("Sheet1", "E2", "项目负责人")
|
|
|
- f.SetCellValue("Sheet1", "F2", "统计日期")
|
|
|
+ f.SetCellValue("Sheet1", "C2", "项目名称")
|
|
|
+ f.SetCellValue("Sheet1", "D2", "项目负责人")
|
|
|
+ f.SetCellValue("Sheet1", "E2", "统计日期")
|
|
|
+ f.SetCellValue("Sheet1", "F2", "验证类型")
|
|
|
f.SetCellValue("Sheet1", "G2", "提成类型")
|
|
|
|
|
|
- f.MergeCell("Sheet1", "H2", "S2")
|
|
|
- f.SetCellValue("Sheet1", "H2", "验证实施")
|
|
|
+ f.MergeCell("Sheet1", schemeStartCell+"2", schemeEndCell+"2")
|
|
|
+ f.SetCellValue("Sheet1", schemeStartCell+"2", "验证实施")
|
|
|
|
|
|
- f.MergeCell("Sheet1", "T2", "AC2")
|
|
|
- f.SetCellValue("Sheet1", "T2", "报告编写")
|
|
|
+ f.MergeCell("Sheet1", reportingStartCell+"2", reportingEndCell+"2")
|
|
|
+ f.SetCellValue("Sheet1", reportingStartCell+"2", "报告编写")
|
|
|
|
|
|
verifyItemList, _ := Basic.Read_VerifyItem_List(0, "", 0, 9999)
|
|
|
for _, item := range verifyItemList {
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("%s3", item.T_cell), item.T_name)
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("%s4", item.T_cell), item.T_price)
|
|
|
+ if item.T_name != "其他" {
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("%s4", item.T_cell), item.T_price)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- f.MergeCell("Sheet1", "S3", "S4")
|
|
|
- f.SetCellValue("Sheet1", "S3", "合计")
|
|
|
+ f.MergeCell("Sheet1", schemeEndCell+"3", schemeEndCell+"4")
|
|
|
+ f.SetCellValue("Sheet1", schemeEndCell+"3", "合计")
|
|
|
|
|
|
- f.MergeCell("Sheet1", "AC3", "AC4")
|
|
|
- f.SetCellValue("Sheet1", "AC3", "合计")
|
|
|
+ f.MergeCell("Sheet1", reportingEndCell+"3", reportingEndCell+"4")
|
|
|
+ f.SetCellValue("Sheet1", reportingEndCell+"3", "合计")
|
|
|
// 设置列宽
|
|
|
f.SetColWidth("Sheet1", "A", "A", 5)
|
|
|
- f.SetColWidth("Sheet1", "B", "G", 16)
|
|
|
- f.SetColWidth("Sheet1", "E", "G", 10)
|
|
|
- f.SetColWidth("Sheet1", "H", "AC", 10)
|
|
|
+ f.SetColWidth("Sheet1", "B", "B", 25)
|
|
|
+ f.SetColWidth("Sheet1", "C", "C", 16)
|
|
|
+ f.SetColWidth("Sheet1", "D", "E", 10)
|
|
|
+ f.SetColWidth("Sheet1", "F", "F", 16)
|
|
|
+ f.SetColWidth("Sheet1", "G", "G", 10)
|
|
|
+ f.SetColWidth("Sheet1", schemeStartCell, reportingEndCell, 10)
|
|
|
|
|
|
// 冻结1-3行
|
|
|
f.SetPanes("Sheet1", &excelize.Panes{
|
|
|
Freeze: true,
|
|
|
Split: false,
|
|
|
- XSplit: 2,
|
|
|
- YSplit: 4,
|
|
|
+ XSplit: 4, // 列
|
|
|
+ YSplit: 4, // 行
|
|
|
TopLeftCell: "A1",
|
|
|
ActivePane: "topRight",
|
|
|
})
|
|
@@ -239,29 +227,31 @@ func (c *PercentageController) Percentage_Export() {
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("A%d", line), i+1)
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("B%d", line), percentage.T_verifyCompany.T_name)
|
|
|
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("C%d", line), percentage.T_device_type+percentage.T_verify_type)
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("D%d", line), percentage.T_task_name)
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("E%d", line), percentage.T_uuid_name)
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("F%d", line), percentage.T_reporting_pass_time[:10])
|
|
|
-
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("C%d", line), percentage.T_task_name)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("D%d", line), percentage.T_uuid_name)
|
|
|
+ if len(percentage.T_reporting_pass_time) > 0 {
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("E%d", line), percentage.T_reporting_pass_time[:10])
|
|
|
+ }
|
|
|
+ deviceType := fmt.Sprintf("%s-%s", percentage.T_device_type, percentage.T_verify_type)
|
|
|
+ if percentage.T_device_type == "位置" {
|
|
|
+ deviceType = fmt.Sprintf("%s-%s(%d)", percentage.T_device_type, percentage.T_verify_type, percentage.T_device_quantity)
|
|
|
+ }
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("F%d", line), deviceType)
|
|
|
verifyItem := Basic.Read_VerifyItem_Get(percentage.T_verify_item)
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("%s%d", verifyItem.T_cell, line), verifyItem.T_price)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("%s%d", verifyItem.T_cell, line), percentage.T_money)
|
|
|
var verifyType string
|
|
|
if percentage.T_type == Percentage.SchemeType {
|
|
|
verifyType = "验证实施"
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("S%d", line), verifyItem.T_price)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("%s%d", schemeEndCell, line), percentage.T_money)
|
|
|
|
|
|
} else if percentage.T_type == Percentage.ReportingType {
|
|
|
verifyType = "报告编写"
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("AC%d", line), verifyItem.T_price)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("%s%d", reportingEndCell, line), percentage.T_money)
|
|
|
|
|
|
}
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("G%d", line), verifyType)
|
|
|
line++
|
|
|
}
|
|
|
- // 函数统计
|
|
|
- //f.SetCellFormula("Sheet1", fmt.Sprintf("S%d", line), fmt.Sprintf("SUM(S5:S%d)", line-1))
|
|
|
- //f.SetCellFormula("Sheet1", fmt.Sprintf("AC%d", line), fmt.Sprintf("SUM(AC5:AC%d)", line-1))
|
|
|
|
|
|
Style4, _ := f.NewStyle(
|
|
|
&excelize.Style{
|
|
@@ -327,12 +317,12 @@ func (c *PercentageController) Percentage_Export() {
|
|
|
Fill: excelize.Fill{Type: "pattern", Color: []string{"#92D050"}, Pattern: 1},
|
|
|
})
|
|
|
|
|
|
- f.SetCellStyle("Sheet1", "A5", fmt.Sprintf("AC%d", line-1), Style4)
|
|
|
+ f.SetCellStyle("Sheet1", "A5", fmt.Sprintf("%s%d", reportingEndCell, line-1), Style4)
|
|
|
|
|
|
- f.SetCellStyle("Sheet1", "H2", "S4", StyleYellowFill)
|
|
|
- f.SetCellStyle("Sheet1", "S5", fmt.Sprintf("S%d", line-1), StyleYellowFill1)
|
|
|
- f.SetCellStyle("Sheet1", "T2", "AC4", StyleGreenFill)
|
|
|
- f.SetCellStyle("Sheet1", "AC5", fmt.Sprintf("AC%d", line-1), StyleGreenFill1)
|
|
|
+ f.SetCellStyle("Sheet1", schemeStartCell+"2", schemeEndCell+"4", StyleYellowFill)
|
|
|
+ f.SetCellStyle("Sheet1", schemeEndCell+"5", fmt.Sprintf("%s%d", schemeEndCell, line-1), StyleYellowFill1)
|
|
|
+ f.SetCellStyle("Sheet1", reportingStartCell+"2", reportingEndCell+"4", StyleGreenFill)
|
|
|
+ f.SetCellStyle("Sheet1", reportingEndCell+"5", fmt.Sprintf("%s%d", reportingEndCell, line-1), StyleGreenFill1)
|
|
|
filename := fmt.Sprintf("%s提成统计表(%s)", dataInterval, lib.GetRandstring(6, "0123456789", 0))
|
|
|
// 保存文件
|
|
|
if err := f.SaveAs("ofile/" + filename + ".xlsx"); err != nil {
|
|
@@ -364,13 +354,13 @@ func (c *PercentageController) Percentage_User_Export() {
|
|
|
T_start_date := c.GetString("T_start_date") // 开始时间
|
|
|
T_end_date := c.GetString("T_end_date") // 结束时间
|
|
|
T_state, _ := c.GetInt("T_state")
|
|
|
- T_type, _ := c.GetInt("T_type") // 提成类型
|
|
|
userList, _ := NatsServer.Read_User_List_All()
|
|
|
Account.Read_User_All_Map(userList)
|
|
|
Percentage.Read_VerifyCompany_All_Map()
|
|
|
Basic.Read_VerifyItem_All_Map()
|
|
|
PercentageDao := Percentage.NewPercentage(orm.NewOrm())
|
|
|
- percentageList, _ := PercentageDao.Read_Percentage_List_For_Excel(T_name, c.User.T_uuid, T_start_date, T_end_date, []string{}, T_state, T_type)
|
|
|
+ percentageList, _ := PercentageDao.Read_Percentage_User_List_SQL(c.User.T_uuid, T_name, T_start_date, T_end_date, true, T_state, 0, 9999)
|
|
|
+
|
|
|
dataInterval := fmt.Sprintf("%s - %s", T_start_date, T_end_date)
|
|
|
if dataInterval == " - " {
|
|
|
dataInterval = ""
|
|
@@ -393,25 +383,18 @@ func (c *PercentageController) Percentage_User_Export() {
|
|
|
{Type: "right", Color: "000000", Style: 1},
|
|
|
},
|
|
|
})
|
|
|
- f.MergeCell("Sheet1", "A1", "AC1")
|
|
|
+
|
|
|
+ var schemeStartCell = "H"
|
|
|
+ var schemeEndCell = "U"
|
|
|
+ var reportingStartCell = "V"
|
|
|
+ var reportingEndCell = "AE"
|
|
|
+ f.MergeCell("Sheet1", "A1", reportingEndCell+"1")
|
|
|
f.SetRowStyle("Sheet1", 1, 1, Style1)
|
|
|
f.SetRowHeight("Sheet1", 1, 50)
|
|
|
- f.SetCellValue("Sheet1", "A1", fmt.Sprintf("%s提成统计表", dataInterval))
|
|
|
-
|
|
|
- //Style3, _ := f.NewStyle(
|
|
|
- // &excelize.Style{
|
|
|
- // Font: &excelize.Font{Bold: true, Size: 10, Family: "宋体"},
|
|
|
- // Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center", WrapText: true},
|
|
|
- // Border: []excelize.Border{
|
|
|
- // {Type: "left", Color: "000000", Style: 1},
|
|
|
- // {Type: "top", Color: "000000", Style: 1},
|
|
|
- // {Type: "bottom", Color: "000000", Style: 1},
|
|
|
- // {Type: "right", Color: "000000", Style: 1},
|
|
|
- // },
|
|
|
- // })
|
|
|
+ f.SetCellValue("Sheet1", "A1", fmt.Sprintf("^%s%s提成统计表", c.User.T_name, dataInterval))
|
|
|
|
|
|
f.SetCellStyle("Sheet1", "A2", "G4", Style2)
|
|
|
- f.SetRowHeight("Sheet1", 2, 20)
|
|
|
+ f.SetRowHeight("Sheet1", 2, 30)
|
|
|
f.SetRowHeight("Sheet1", 4, 20)
|
|
|
|
|
|
// 这里设置表头
|
|
@@ -425,41 +408,47 @@ func (c *PercentageController) Percentage_User_Export() {
|
|
|
|
|
|
f.SetCellValue("Sheet1", "A2", "序号")
|
|
|
f.SetCellValue("Sheet1", "B2", "公司名称")
|
|
|
- f.SetCellValue("Sheet1", "C2", "验证类型")
|
|
|
- f.SetCellValue("Sheet1", "D2", "项目名称")
|
|
|
- f.SetCellValue("Sheet1", "E2", "项目负责人")
|
|
|
- f.SetCellValue("Sheet1", "F2", "统计日期")
|
|
|
+ f.SetCellValue("Sheet1", "C2", "项目名称")
|
|
|
+ f.SetCellValue("Sheet1", "D2", "项目负责人")
|
|
|
+ f.SetCellValue("Sheet1", "E2", "统计日期")
|
|
|
+ f.SetCellValue("Sheet1", "F2", "验证类型")
|
|
|
f.SetCellValue("Sheet1", "G2", "提成类型")
|
|
|
|
|
|
- f.MergeCell("Sheet1", "H2", "S2")
|
|
|
- f.SetCellValue("Sheet1", "H2", "验证实施")
|
|
|
+ f.MergeCell("Sheet1", schemeStartCell+"2", schemeEndCell+"2")
|
|
|
+ f.SetCellValue("Sheet1", schemeStartCell+"2", "验证实施")
|
|
|
|
|
|
- f.MergeCell("Sheet1", "T2", "AC2")
|
|
|
- f.SetCellValue("Sheet1", "T2", "报告编写")
|
|
|
+ f.MergeCell("Sheet1", reportingStartCell+"2", reportingEndCell+"2")
|
|
|
+ f.SetCellValue("Sheet1", reportingStartCell+"2", "报告编写")
|
|
|
|
|
|
verifyItemList, _ := Basic.Read_VerifyItem_List(0, "", 0, 9999)
|
|
|
for _, item := range verifyItemList {
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("%s3", item.T_cell), item.T_name)
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("%s4", item.T_cell), item.T_price)
|
|
|
+ if item.T_name != "其他" {
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("%s4", item.T_cell), item.T_price)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- f.MergeCell("Sheet1", "S3", "S4")
|
|
|
- f.SetCellValue("Sheet1", "S3", "合计")
|
|
|
+ f.MergeCell("Sheet1", schemeEndCell+"3", schemeEndCell+"4")
|
|
|
+ f.SetCellValue("Sheet1", schemeEndCell+"3", "合计")
|
|
|
+
|
|
|
+ f.MergeCell("Sheet1", reportingEndCell+"3", reportingEndCell+"4")
|
|
|
+ f.SetCellValue("Sheet1", reportingEndCell+"3", "合计")
|
|
|
|
|
|
- f.MergeCell("Sheet1", "AC3", "AC4")
|
|
|
- f.SetCellValue("Sheet1", "AC3", "合计")
|
|
|
// 设置列宽
|
|
|
f.SetColWidth("Sheet1", "A", "A", 5)
|
|
|
- f.SetColWidth("Sheet1", "B", "G", 16)
|
|
|
- f.SetColWidth("Sheet1", "E", "G", 10)
|
|
|
- f.SetColWidth("Sheet1", "H", "AC", 10)
|
|
|
+ f.SetColWidth("Sheet1", "B", "B", 25)
|
|
|
+ f.SetColWidth("Sheet1", "C", "C", 16)
|
|
|
+ f.SetColWidth("Sheet1", "D", "E", 10)
|
|
|
+ f.SetColWidth("Sheet1", "F", "F", 16)
|
|
|
+ f.SetColWidth("Sheet1", "G", "G", 10)
|
|
|
+ f.SetColWidth("Sheet1", schemeStartCell, reportingEndCell, 10)
|
|
|
|
|
|
// 冻结1-3行
|
|
|
f.SetPanes("Sheet1", &excelize.Panes{
|
|
|
Freeze: true,
|
|
|
Split: false,
|
|
|
- XSplit: 2,
|
|
|
- YSplit: 4,
|
|
|
+ XSplit: 4, // 列
|
|
|
+ YSplit: 4, // 行
|
|
|
TopLeftCell: "A1",
|
|
|
ActivePane: "topRight",
|
|
|
})
|
|
@@ -474,29 +463,31 @@ func (c *PercentageController) Percentage_User_Export() {
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("A%d", line), i+1)
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("B%d", line), percentage.T_verifyCompany.T_name)
|
|
|
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("C%d", line), percentage.T_device_type+percentage.T_verify_type)
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("D%d", line), percentage.T_task_name)
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("E%d", line), percentage.T_uuid_name)
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("F%d", line), percentage.T_reporting_pass_time[:10])
|
|
|
-
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("C%d", line), percentage.T_task_name)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("D%d", line), percentage.T_uuid_name)
|
|
|
+ if len(percentage.T_reporting_pass_time) > 0 {
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("E%d", line), percentage.T_reporting_pass_time[:10])
|
|
|
+ }
|
|
|
+ deviceType := fmt.Sprintf("%s-%s", percentage.T_device_type, percentage.T_verify_type)
|
|
|
+ if percentage.T_device_type == "位置" {
|
|
|
+ deviceType = fmt.Sprintf("%s-%s(%d)", percentage.T_device_type, percentage.T_verify_type, percentage.T_device_quantity)
|
|
|
+ }
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("F%d", line), deviceType)
|
|
|
verifyItem := Basic.Read_VerifyItem_Get(percentage.T_verify_item)
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("%s%d", verifyItem.T_cell, line), verifyItem.T_price)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("%s%d", verifyItem.T_cell, line), percentage.T_money)
|
|
|
var verifyType string
|
|
|
if percentage.T_type == Percentage.SchemeType {
|
|
|
verifyType = "验证实施"
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("S%d", line), verifyItem.T_price)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("%s%d", schemeEndCell, line), verifyItem.T_price)
|
|
|
|
|
|
} else if percentage.T_type == Percentage.ReportingType {
|
|
|
verifyType = "报告编写"
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("AC%d", line), verifyItem.T_price)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("%s%d", reportingEndCell, line), percentage.T_money)
|
|
|
|
|
|
}
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("G%d", line), verifyType)
|
|
|
line++
|
|
|
}
|
|
|
- // 函数统计
|
|
|
- //f.SetCellFormula("Sheet1", fmt.Sprintf("S%d", line), fmt.Sprintf("SUM(S5:S%d)", line-1))
|
|
|
- //f.SetCellFormula("Sheet1", fmt.Sprintf("AC%d", line), fmt.Sprintf("SUM(AC5:AC%d)", line-1))
|
|
|
|
|
|
Style4, _ := f.NewStyle(
|
|
|
&excelize.Style{
|
|
@@ -562,13 +553,13 @@ func (c *PercentageController) Percentage_User_Export() {
|
|
|
Fill: excelize.Fill{Type: "pattern", Color: []string{"#92D050"}, Pattern: 1},
|
|
|
})
|
|
|
|
|
|
- f.SetCellStyle("Sheet1", "A5", fmt.Sprintf("AC%d", line-1), Style4)
|
|
|
+ f.SetCellStyle("Sheet1", "A5", fmt.Sprintf("%s%d", reportingEndCell, line-1), Style4)
|
|
|
|
|
|
- f.SetCellStyle("Sheet1", "H2", "S4", StyleYellowFill)
|
|
|
- f.SetCellStyle("Sheet1", "S5", fmt.Sprintf("S%d", line-1), StyleYellowFill1)
|
|
|
- f.SetCellStyle("Sheet1", "T2", "AC4", StyleGreenFill)
|
|
|
- f.SetCellStyle("Sheet1", "AC5", fmt.Sprintf("AC%d", line-1), StyleGreenFill1)
|
|
|
- filename := fmt.Sprintf("%s提成统计表(%s)", dataInterval, lib.GetRandstring(6, "0123456789", 0))
|
|
|
+ f.SetCellStyle("Sheet1", schemeStartCell+"2", schemeEndCell+"4", StyleYellowFill)
|
|
|
+ f.SetCellStyle("Sheet1", schemeEndCell+"5", fmt.Sprintf("%s%d", schemeEndCell, line-1), StyleYellowFill1)
|
|
|
+ f.SetCellStyle("Sheet1", reportingStartCell+"2", reportingEndCell+"4", StyleGreenFill)
|
|
|
+ f.SetCellStyle("Sheet1", reportingEndCell+"5", fmt.Sprintf("%s%d", reportingEndCell, line-1), StyleGreenFill1)
|
|
|
+ filename := fmt.Sprintf("%s%s提成统计表(%s)", c.User.T_name, dataInterval, lib.GetRandstring(6, "0123456789", 0))
|
|
|
// 保存文件
|
|
|
if err := f.SaveAs("ofile/" + filename + ".xlsx"); err != nil {
|
|
|
fmt.Println(err)
|
|
@@ -618,6 +609,7 @@ func (c *PercentageController) Percentage_Add() {
|
|
|
T_verify_type := c.GetString("T_verify_type") // 验证类型
|
|
|
T_company_uuid := c.GetString("T_company_uuid") // 公司id
|
|
|
T_type, _ := c.GetInt("T_type") // 类型 1-验证实施 2-报告编写
|
|
|
+ T_money, _ := c.GetFloat("T_money") // 金额
|
|
|
|
|
|
company, is := Percentage.Read_VerifyCompany(T_company_uuid)
|
|
|
if !is {
|
|
@@ -641,7 +633,7 @@ func (c *PercentageController) Percentage_Add() {
|
|
|
T_verify_type: T_verify_type,
|
|
|
T_uuid: c.User.T_uuid,
|
|
|
T_company_uuid: T_company_uuid,
|
|
|
- T_money: verifyItemMap[T_device_type].T_price,
|
|
|
+ T_money: float32(T_money),
|
|
|
T_type: T_type, //类型 1-验证实施 2-报告编写
|
|
|
T_State: 6, // 6-未提交审核
|
|
|
T_verify_item: verifyItemMap[T_device_type].Id,
|
|
@@ -729,6 +721,7 @@ func (c *PercentageController) Percentage_Edit() {
|
|
|
T_device_type := c.GetString("T_device_type") // 提成类型
|
|
|
T_verify_type := c.GetString("T_verify_type") // 验证类型
|
|
|
T_company_uuid := c.GetString("T_company_uuid") // 公司id
|
|
|
+ T_money, _ := c.GetFloat("T_money") // 金额
|
|
|
T_type, _ := c.GetInt("T_type") // 类型 1-验证实施 2-报告编写
|
|
|
|
|
|
company, is := Percentage.Read_VerifyCompany(T_company_uuid)
|
|
@@ -777,8 +770,11 @@ func (c *PercentageController) Percentage_Edit() {
|
|
|
if T_type > 0 {
|
|
|
percentage.T_type = T_type
|
|
|
}
|
|
|
+ if T_money > 0 {
|
|
|
+ percentage.T_money = float32(T_money)
|
|
|
+ }
|
|
|
|
|
|
- percentage.T_money = verifyItemMap[percentage.T_device_type].T_price
|
|
|
+ //percentage.T_money = verifyItemMap[percentage.T_device_type].T_price
|
|
|
percentage.T_verify_item = verifyItemMap[percentage.T_device_type].Id
|
|
|
|
|
|
err = PercentageDao.Update_Percentage(percentage, "T_company_uuid", "T_Distributor_id", "T_device_type", "T_verify_type", "T_type", "T_money", "T_verify_item")
|
|
@@ -1128,7 +1124,7 @@ func SyncVerifyPercentage(isCron bool) {
|
|
|
// 自动同步报告提成
|
|
|
_, err = PercentageDao.Read_Percentage_ByT_T_task_id_T_type(task.T_task_id, Percentage.ReportingType)
|
|
|
if err != nil && err.Error() == orm.ErrNoRows.Error() {
|
|
|
- verifyItem := GetPercentageMoney(task.T_device_type, task.T_verify_type, verifyItemReportingMap)
|
|
|
+ verifyItem := GetPercentageMoney(Percentage.DeviceTypeMap[task.T_device_type], task.T_verify_type, verifyItemReportingMap)
|
|
|
// 添加报告提成
|
|
|
percentage := Percentage.Percentage{
|
|
|
T_Distributor_id: task.T_Distributor_id,
|
|
@@ -1136,6 +1132,7 @@ func SyncVerifyPercentage(isCron bool) {
|
|
|
T_task_int_id: task.Id,
|
|
|
T_device_type: Percentage.DeviceTypeMap[task.T_device_type],
|
|
|
T_verify_type: task.T_verify_type,
|
|
|
+ T_device_quantity: task.T_device_quantity,
|
|
|
T_company_uuid: task.T_uuid,
|
|
|
T_task_name: task.T_name,
|
|
|
T_uuid: coldVerifyUUIDMap[task.T_reporting],
|
|
@@ -1145,6 +1142,9 @@ func SyncVerifyPercentage(isCron bool) {
|
|
|
T_verify_item: verifyItem.Id,
|
|
|
T_reporting_pass_time: task.T_reporting_pass_time,
|
|
|
}
|
|
|
+ if task.T_device_type == "WZ" {
|
|
|
+ percentage.T_money = verifyItem.T_price * float32(task.T_device_quantity)
|
|
|
+ }
|
|
|
_, err = PercentageDao.Add_Percentage(percentage)
|
|
|
}
|
|
|
|
|
@@ -1156,23 +1156,28 @@ func SyncVerifyPercentage(isCron bool) {
|
|
|
// 自动同步实施提成
|
|
|
_, err = PercentageDao.Read_Percentage_ByT_T_task_id_T_type(task.T_task_id, Percentage.SchemeType)
|
|
|
if err != nil && err.Error() == orm.ErrNoRows.Error() {
|
|
|
- verifyItem := GetPercentageMoney(task.T_device_type, task.T_verify_type, verifyItemSchemeMap)
|
|
|
+ T_device_type := Percentage.DeviceTypeMap[task.T_device_type]
|
|
|
+ verifyItem := GetPercentageMoney(T_device_type, task.T_verify_type, verifyItemSchemeMap)
|
|
|
// 添加报告提成
|
|
|
percentage := Percentage.Percentage{
|
|
|
T_Distributor_id: task.T_Distributor_id,
|
|
|
T_task_id: task.T_task_id,
|
|
|
T_task_int_id: task.Id,
|
|
|
- T_device_type: Percentage.DeviceTypeMap[task.T_device_type],
|
|
|
+ T_device_type: T_device_type,
|
|
|
T_verify_type: task.T_verify_type,
|
|
|
+ T_device_quantity: task.T_device_quantity,
|
|
|
T_company_uuid: task.T_uuid,
|
|
|
T_task_name: task.T_name,
|
|
|
- T_uuid: coldVerifyUUIDMap[task.T_scheme],
|
|
|
+ T_uuid: coldVerifyUUIDMap[task.T_delivery],
|
|
|
T_money: verifyItem.T_price,
|
|
|
T_type: Percentage.SchemeType,
|
|
|
T_State: 1,
|
|
|
T_verify_item: verifyItem.Id,
|
|
|
T_reporting_pass_time: task.T_reporting_pass_time,
|
|
|
}
|
|
|
+ if task.T_device_type == "WZ" {
|
|
|
+ percentage.T_money = verifyItem.T_price * float32(task.T_device_quantity)
|
|
|
+ }
|
|
|
_, err = PercentageDao.Add_Percentage(percentage)
|
|
|
}
|
|
|
}
|
|
@@ -1205,35 +1210,44 @@ func GetColdVerifyUUIDMap() (uuidMap map[string]string) {
|
|
|
// 获取实施提成金额
|
|
|
func GetPercentageMoney(T_device_type, T_verify_type string, verifyItemMap map[string]Basic.VerifyItem) (money Basic.VerifyItem) {
|
|
|
if strings.Contains(T_device_type, "箱") {
|
|
|
- return verifyItemMap["保温箱"]
|
|
|
+ return verifyItemMap["箱"]
|
|
|
}
|
|
|
if strings.Contains(T_device_type, "车") {
|
|
|
if strings.Contains(T_verify_type, "空载") {
|
|
|
- return verifyItemMap["冷藏车(空载)"]
|
|
|
+ return verifyItemMap["车(空载)"]
|
|
|
} else {
|
|
|
- return verifyItemMap["冷藏车(满载)"]
|
|
|
+ return verifyItemMap["车(满载)"]
|
|
|
}
|
|
|
}
|
|
|
if strings.Contains(T_device_type, "柜") {
|
|
|
if strings.Contains(T_verify_type, "空载") {
|
|
|
- return verifyItemMap["冷库(空载)"]
|
|
|
+ return verifyItemMap["库(空载)"]
|
|
|
} else {
|
|
|
- return verifyItemMap["冷库(满载)"]
|
|
|
+ return verifyItemMap["库(满载)"]
|
|
|
}
|
|
|
}
|
|
|
if strings.Contains(T_device_type, "库") {
|
|
|
if strings.Contains(T_verify_type, "空载") {
|
|
|
- return verifyItemMap["冷库(空载)"]
|
|
|
+ return verifyItemMap["库(空载)"]
|
|
|
} else {
|
|
|
- return verifyItemMap["冷库(满载)"]
|
|
|
+ return verifyItemMap["库(满载)"]
|
|
|
}
|
|
|
}
|
|
|
- if strings.Contains(T_device_type, "系统验证") {
|
|
|
- return verifyItemMap["系统验证"]
|
|
|
+ if strings.Contains(T_device_type, "系统") {
|
|
|
+ return verifyItemMap["系统"]
|
|
|
}
|
|
|
if strings.Contains(T_device_type, "位置") {
|
|
|
return verifyItemMap["位置"]
|
|
|
}
|
|
|
+ if strings.Contains(T_device_type, "巡检") {
|
|
|
+ return verifyItemMap["巡检"]
|
|
|
+ }
|
|
|
+ if strings.Contains(T_device_type, "培训") {
|
|
|
+ return verifyItemMap["培训"]
|
|
|
+ }
|
|
|
+ if strings.Contains(T_device_type, "其他") {
|
|
|
+ return verifyItemMap["其他"]
|
|
|
+ }
|
|
|
return Basic.VerifyItem{}
|
|
|
}
|
|
|
|
|
@@ -1269,11 +1283,13 @@ func (c *PercentageController) VerifyCompany_List() {
|
|
|
func (c *PercentageController) VerifyCompany_Add() {
|
|
|
|
|
|
T_name := c.GetString("T_name")
|
|
|
- T_State, _ := c.GetInt("T_State") // 总价
|
|
|
+ T_recoveries_time := c.GetString("T_recoveries_time") // 回款时间
|
|
|
+ T_State, _ := c.GetInt("T_State") // 总价
|
|
|
|
|
|
var_ := Percentage.VerifyCompany{
|
|
|
- T_name: T_name,
|
|
|
- T_State: T_State,
|
|
|
+ T_name: T_name,
|
|
|
+ T_State: T_State,
|
|
|
+ T_recoveries_time: T_recoveries_time,
|
|
|
}
|
|
|
|
|
|
if _, is := Percentage.Read_VerifyCompanyByT_name(T_name); is {
|
|
@@ -1298,7 +1314,8 @@ func (c *PercentageController) VerifyCompany_Add() {
|
|
|
func (c *PercentageController) VerifyCompany_Edit() {
|
|
|
|
|
|
T_uuid := c.GetString("T_uuid")
|
|
|
- T_State, _ := c.GetInt("T_State") // 总价
|
|
|
+ T_State, _ := c.GetInt("T_State") // 总价
|
|
|
+ T_recoveries_time := c.GetString("T_recoveries_time") // 回款时间
|
|
|
|
|
|
company, is := Percentage.Read_VerifyCompany(T_uuid)
|
|
|
if !is {
|
|
@@ -1308,11 +1325,15 @@ func (c *PercentageController) VerifyCompany_Edit() {
|
|
|
}
|
|
|
if T_State > 0 {
|
|
|
company.T_State = T_State
|
|
|
- if !Percentage.Update_VerifyCompany(company, "T_State") {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改验证公司失败"}
|
|
|
- c.ServeJSON()
|
|
|
- return
|
|
|
- }
|
|
|
+ }
|
|
|
+ if len(T_recoveries_time) > 0 {
|
|
|
+ company.T_recoveries_time = T_recoveries_time
|
|
|
+ }
|
|
|
+
|
|
|
+ if !Percentage.Update_VerifyCompany(company, "T_State", "T_recoveries_time") {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改验证公司失败"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
NatsServer.AddUserLogs(c.User.T_uuid, "验证公司", "修改", company)
|