Compare commits

...

8 Commits

7 changed files with 19 additions and 9 deletions

View File

@ -86,7 +86,7 @@ func (h *ChatService) Chat(c *websocket.Conn) {
} }
// 开启心跳检测 // 开启心跳检测
//go client.InitHeartbeat(time.Duration(h.cfg.Sys.HeartbeatInterval)) go client.InitHeartbeat(time.Duration(h.cfg.Sys.HeartbeatInterval))
// 循环读取客户端消息 // 循环读取客户端消息
for { for {

View File

@ -14,7 +14,7 @@ import (
const ( const (
RedStyle = "${color: FF0000;horizontal:center;vertical:center;borderColor:#000000}" RedStyle = "${color: FF0000;horizontal:center;vertical:center;borderColor:#000000}"
GreenStyle = "${color: 00B050;horizontal:center;vertical:center;borderColor:#000000}" GreenStyle = "${color: 008000;horizontal:center;vertical:center;borderColor:#000000}"
) )
var ( var (
@ -70,7 +70,7 @@ func (b *BbxtTools) DailyReport(now time.Time, downWardValue int32, productName
return return
} }
reports = append(reports, productLossReport...) reports = append(reports, productLossReport...)
reports = append(reports, statisOfficialProductSum, profitRankingSum, statisOfficialProductSumDecline) reports = append(reports, profitRankingSum, statisOfficialProductSum, statisOfficialProductSumDecline)
if ossClient != nil { if ossClient != nil {
uploader := NewUploader(ossClient) uploader := NewUploader(ossClient)
@ -380,7 +380,7 @@ func (b *BbxtTools) GetStatisOfficialProductSumDecline(now time.Time, downWardVa
} }
timeCh := now.Format("1月2日15点") timeCh := now.Format("1月2日15点")
//title := "截至" + timeCh + "销量下滑大于" + fmt.Sprintf("%d", downWardValue) + "明细,分销商仅展示差额大于" + fmt.Sprintf("%d", -sumFilter) //title := "截至" + timeCh + "销量下滑大于" + fmt.Sprintf("%d", downWardValue) + "明细,分销商仅展示差额大于" + fmt.Sprintf("%d", -sumFilter)
title := "截至" + timeCh + "销量下滑较大商品" title := "截至" + timeCh + "销量下滑较大商品"
//总量生成excel //总量生成excel
if len(productSumMap) == 0 { if len(productSumMap) == 0 {
return return

View File

@ -27,7 +27,7 @@ func Test_StatisOursProductLossSumApiTotal(t *testing.T) {
if err != nil { if err != nil {
panic(err) panic(err)
} }
reports, err := o.DailyReport(time.Now(), []string{"官方-爱奇艺-星钻季卡", "官方-爱奇艺-星钻半年卡", "官方--腾讯-年卡", "官方--爱奇艺-月卡"}, ossClient) reports, err := o.DailyReport(time.Now(), DownWardValue, []string{"官方-爱奇艺-星钻季卡", "官方-爱奇艺-星钻半年卡", "官方--腾讯-年卡", "官方--爱奇艺-月卡"}, SumFilter, ossClient)
t.Log(reports, err) t.Log(reports, err)

View File

@ -42,7 +42,7 @@ func (b *BbxtTools) SimpleFillExcelWithTitle(templatePath, outputPath string, da
log.Errorf("获取模板行高失败: %v", err) log.Errorf("获取模板行高失败: %v", err)
rowHeight = 31 // 默认高度 rowHeight = 31 // 默认高度
} }
rowWidth := 25.00
// 反射获取切片数据 // 反射获取切片数据
v := reflect.ValueOf(dataSlice) v := reflect.ValueOf(dataSlice)
if v.Kind() != reflect.Slice { if v.Kind() != reflect.Slice {
@ -101,7 +101,7 @@ func (b *BbxtTools) SimpleFillExcelWithTitle(templatePath, outputPath string, da
// 填充数据到Excel // 填充数据到Excel
for col, value := range rowData { for col, value := range rowData {
cell := fmt.Sprintf("%c%d", 'A'+col, currentRow) cell := fmt.Sprintf("%c%d", 'A'+col, currentRow)
f.SetColWidth(sheet, cell, cell, rowWidth)
switch value.(type) { switch value.(type) {
case string: case string:
var style = value.(string) var style = value.(string)
@ -144,6 +144,8 @@ func SetStyle(styleMap map[string]string, f *excelize.File) (int, error) {
if colorHex, exists := styleMap["color"]; exists { if colorHex, exists := styleMap["color"]; exists {
style.Font = &excelize.Font{ style.Font = &excelize.Font{
Color: colorHex, Color: colorHex,
Family: "SimHei",
Bold: true,
} }
} }
// 设置水平对齐 // 设置水平对齐

View File

@ -223,7 +223,7 @@ func (b *BbxtTools) OfficialProductSumDeclineExcel(templatePath, outputPath stri
if err != nil { if err != nil {
rowHeightData = 20 rowHeightData = 20
} }
rowWidth := 25.00
currentRow := 3 currentRow := 3
pattern := `\$\{(.*?)\}` pattern := `\$\{(.*?)\}`
re := regexp.MustCompile(pattern) re := regexp.MustCompile(pattern)
@ -293,6 +293,14 @@ func (b *BbxtTools) OfficialProductSumDeclineExcel(templatePath, outputPath stri
twoDiffValue := re.ReplaceAllString(twoDiff, "") twoDiffValue := re.ReplaceAllString(twoDiff, "")
f.SetCellStyle(sheet, fmt.Sprintf("G%d", currentRow), fmt.Sprintf("G%d", currentRow), fontStyleIDG) f.SetCellStyle(sheet, fmt.Sprintf("G%d", currentRow), fmt.Sprintf("G%d", currentRow), fontStyleIDG)
// 设置值 // 设置值
//f.SetColWidth(sheet, fmt.Sprintf("A%d", currentRow), fmt.Sprintf("A%d", currentRow), product.OfficialProductName)
//f.SetColWidth(sheet, fmt.Sprintf("B%d", currentRow), fmt.Sprintf("B%d", currentRow), p.ResellerName)
f.SetColWidth(sheet, fmt.Sprintf("C%d", currentRow), fmt.Sprintf("C%d", currentRow), rowWidth)
f.SetColWidth(sheet, fmt.Sprintf("D%d", currentRow), fmt.Sprintf("D%d", currentRow), rowWidth)
f.SetColWidth(sheet, fmt.Sprintf("E%d", currentRow), fmt.Sprintf("E%d", currentRow), rowWidth)
f.SetColWidth(sheet, fmt.Sprintf("F%d", currentRow), fmt.Sprintf("F%d", currentRow), rowWidth)
f.SetColWidth(sheet, fmt.Sprintf("G%d", currentRow), fmt.Sprintf("G%d", currentRow), rowWidth)
f.SetCellValue(sheet, fmt.Sprintf("A%d", currentRow), product.OfficialProductName) f.SetCellValue(sheet, fmt.Sprintf("A%d", currentRow), product.OfficialProductName)
f.SetCellValue(sheet, fmt.Sprintf("B%d", currentRow), p.ResellerName) f.SetCellValue(sheet, fmt.Sprintf("B%d", currentRow), p.ResellerName)
f.SetCellValue(sheet, fmt.Sprintf("C%d", currentRow), p.CurrentNum) f.SetCellValue(sheet, fmt.Sprintf("C%d", currentRow), p.CurrentNum)

Binary file not shown.

Binary file not shown.